diff --git a/.cursor/rules/party-ai-dev.mdc b/.cursor/rules/party-ai-dev.mdc index 3fddc56b..9602c6f0 100644 --- a/.cursor/rules/party-ai-dev.mdc +++ b/.cursor/rules/party-ai-dev.mdc @@ -32,3 +32,18 @@ ### 复盘格式 使用卡若 AI 标准复盘格式(🎯📌💡📝▶ 五块齐全),带日期+时间。 + +### 小程序上传约定(强制) + +- **版本号固定 `1.2.6`**:每次上传小程序(soul-party / 派对AI)统一使用版本 `1.2.6`,不递增。 +- **上传后设为体验版**:上传完成后自动设为体验版,方便扫码测试。 +- **不自动提交审核**:上传后默认不提交审核。只有用户明确说「上传审核」「提交审核」时,才执行审核提交。 +- **上传命令**: + ```bash + # 上传 + 体验版(默认,不提审) + python 开发文档/小程序管理/scripts/mp_deploy.py deploy soul-party --skip-cert + # 上传 + 体验版 + 提交审核(用户明确要求时) + python 开发文档/小程序管理/scripts/mp_deploy.py deploy soul-party --skip-cert --submit + # 单独提交审核(已上传后) + python 开发文档/小程序管理/scripts/mp_deploy.py submit soul-party + ``` diff --git a/miniprogram/pages/index/index.js b/miniprogram/pages/index/index.js index fc527c68..84f6845f 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -325,15 +325,29 @@ Page({ } let phone = (app.globalData.userInfo.phone || '').trim() let wechatId = (app.globalData.userInfo.wechatId || app.globalData.userInfo.wechat_id || '').trim() + let avatar = (app.globalData.userInfo.avatar || app.globalData.userInfo.avatarUrl || '').trim() if (!phone && !wechatId) { try { const profileRes = await app.request({ url: `/api/miniprogram/user/profile?userId=${userId}`, silent: true }) if (profileRes?.success && profileRes.data) { phone = (profileRes.data.phone || '').trim() wechatId = (profileRes.data.wechatId || profileRes.data.wechat_id || '').trim() + if (!avatar) avatar = (profileRes.data.avatar || '').trim() } } catch (e) {} } + if ((!phone && !wechatId) || !avatar) { + wx.showModal({ + title: '完善资料', + content: !avatar ? '请先设置头像和填写联系方式,以便对方联系您' : '请先填写手机号或微信号,以便对方联系您', + confirmText: '去填写', + cancelText: '取消', + success: (res) => { + if (res.confirm) wx.navigateTo({ url: '/pages/profile-edit/profile-edit' }) + } + }) + return + } if (phone || wechatId) { wx.showLoading({ title: '提交中...', mask: true }) try { diff --git a/miniprogram/pages/my/my.js b/miniprogram/pages/my/my.js index c8a4c53f..ba516a5e 100644 --- a/miniprogram/pages/my/my.js +++ b/miniprogram/pages/my/my.js @@ -462,8 +462,9 @@ Page({ }) }) - // 2. 获取上传后的完整URL - const avatarUrl = app.globalData.baseUrl + uploadRes.data.url + // 2. 获取上传后的完整URL(OSS 返回完整 URL,本地返回相对路径) + const rawUrl = uploadRes.data.url || '' + const avatarUrl = rawUrl.startsWith('http://') || rawUrl.startsWith('https://') ? rawUrl : app.globalData.baseUrl + rawUrl console.log('[My] 头像上传成功:', avatarUrl) // 3. 更新本地头像 @@ -890,7 +891,8 @@ Page({ fail: (e) => reject(e) }) }) - const avatarUrl = app.globalData.baseUrl + uploadRes.data.url + const rawAvatarUrl = uploadRes.data.url || '' + const avatarUrl = rawAvatarUrl.startsWith('http://') || rawAvatarUrl.startsWith('https://') ? rawAvatarUrl : app.globalData.baseUrl + rawAvatarUrl const userInfo = this.data.userInfo userInfo.avatar = avatarUrl this.setData({ userInfo }) diff --git a/miniprogram/pages/profile-edit/profile-edit.js b/miniprogram/pages/profile-edit/profile-edit.js index bd93e0cd..4d86c30c 100644 --- a/miniprogram/pages/profile-edit/profile-edit.js +++ b/miniprogram/pages/profile-edit/profile-edit.js @@ -160,7 +160,8 @@ Page({ fail: reject, }) }) - const avatarUrl = app.globalData.baseUrl + uploadRes.data.url + const rawUrl1 = uploadRes.data.url || '' + const avatarUrl = rawUrl1.startsWith('http://') || rawUrl1.startsWith('https://') ? rawUrl1 : app.globalData.baseUrl + rawUrl1 this.setData({ avatar: avatarUrl }) await app.request({ url: '/api/miniprogram/user/profile', @@ -208,7 +209,8 @@ Page({ }) }) - const avatarUrl = app.globalData.baseUrl + uploadRes.data.url + const rawUrl2 = uploadRes.data.url || '' + const avatarUrl = rawUrl2.startsWith('http://') || rawUrl2.startsWith('https://') ? rawUrl2 : app.globalData.baseUrl + rawUrl2 this.setData({ avatar: avatarUrl }) await app.request({ url: '/api/miniprogram/user/profile', diff --git a/miniprogram/pages/read/read.js b/miniprogram/pages/read/read.js index bbc50be3..ad62f147 100644 --- a/miniprogram/pages/read/read.js +++ b/miniprogram/pages/read/read.js @@ -83,14 +83,16 @@ Page({ async onLoad(options) { wx.showShareMenu({ withShareTimeline: true }) - // 预加载 linkTags、linkedMiniprograms(供 onLinkTagTap 用密钥查 appId) - if (!app.globalData.linkTagsConfig || !app.globalData.linkedMiniprograms) { - app.request({ url: '/api/miniprogram/config', silent: true }).then(cfg => { + // 预加载 linkTags、linkedMiniprograms、persons(供 onLinkTagTap / onMentionTap 和内容自动匹配用) + if (!app.globalData.linkTagsConfig || !app.globalData.linkedMiniprograms || !app.globalData.personsConfig) { + try { + const cfg = await app.request({ url: '/api/miniprogram/config', silent: true }) if (cfg) { if (Array.isArray(cfg.linkTags)) app.globalData.linkTagsConfig = cfg.linkTags if (Array.isArray(cfg.linkedMiniprograms)) app.globalData.linkedMiniprograms = cfg.linkedMiniprograms + if (Array.isArray(cfg.persons)) app.globalData.personsConfig = cfg.persons } - }).catch(() => {}) + } catch (e) {} } // 支持 scene(扫码)、mid、id、ref @@ -270,7 +272,8 @@ Page({ // 已解锁用 data.content(完整内容),未解锁用 content(预览);先 determineAccessState 再 loadContent 保证顺序正确 const displayContent = accessManager.canAccessFullContent(accessState) ? (res.data?.content ?? res.content) : res.content if (res && displayContent) { - const { lines, segments } = contentParser.parseContent(displayContent) + const parserConfig = { persons: app.globalData.personsConfig || [], linkTags: app.globalData.linkTagsConfig || [] } + const { lines, segments } = contentParser.parseContent(displayContent, parserConfig) // 预览内容由后端统一截取比例,这里展示全部预览内容 const previewCount = lines.length const updates = { @@ -294,7 +297,8 @@ Page({ try { const cached = wx.getStorageSync(cacheKey) if (cached && cached.content) { - const { lines, segments } = contentParser.parseContent(cached.content) + const cachedParserConfig = { persons: app.globalData.personsConfig || [], linkTags: app.globalData.linkTagsConfig || [] } + const { lines, segments } = contentParser.parseContent(cached.content, cachedParserConfig) // 预览内容由后端统一截取比例,这里展示全部预览内容 const previewCount = lines.length this.setData({ @@ -551,15 +555,30 @@ Page({ } const linked = (app.globalData.linkedMiniprograms || []).find(m => m.key === mpKey) const targetAppId = (linked && linked.appId) ? linked.appId : (appId || mpKey || '') + const selfAppId = (app.globalData.config?.mpConfig?.appId || app.globalData.appId || 'wxb8bbb2b10dec74aa') + const targetPath = pagePath || (linked && linked.path) || '' + if (targetAppId === selfAppId || !targetAppId) { + if (targetPath) { + const navPath = targetPath.startsWith('/') ? targetPath : '/' + targetPath + wx.navigateTo({ url: navPath, fail: () => wx.switchTab({ url: navPath }) }) + } else { + wx.switchTab({ url: '/pages/index/index' }) + } + return + } if (targetAppId) { wx.navigateToMiniProgram({ appId: targetAppId, - path: pagePath || (linked && linked.path) || '', + path: targetPath, envVersion: 'release', success: () => {}, fail: (err) => { console.warn('[LinkTag] 小程序跳转失败:', err) - wx.showToast({ title: '跳转失败,请检查小程序配置', icon: 'none' }) + if (targetPath) { + wx.navigateTo({ url: targetPath.startsWith('/') ? targetPath : '/' + targetPath, fail: () => {} }) + } else { + wx.showToast({ title: '跳转失败,请检查小程序配置', icon: 'none' }) + } }, }) return @@ -596,9 +615,17 @@ Page({ // 点击正文中的 @某人:确认弹窗 → 登录/资料校验 → 调用 ckb/lead 加好友留资 onMentionTap(e) { - const userId = e.currentTarget.dataset.userId + let userId = e.currentTarget.dataset.userId const nickname = (e.currentTarget.dataset.nickname || '').trim() || 'TA' - if (!userId) return + if (!userId && nickname !== 'TA') { + const persons = app.globalData.personsConfig || [] + const match = persons.find(p => p.name === nickname || (p.aliases || '').split(',').map(a => a.trim()).includes(nickname)) + if (match) userId = match.personId || '' + } + if (!userId) { + wx.showToast({ title: `暂无 @${nickname} 的信息`, icon: 'none' }) + return + } wx.showModal({ title: '添加好友', content: `是否添加 @${nickname} ?`, @@ -629,19 +656,21 @@ Page({ const myUserId = app.globalData.userInfo.id let phone = (app.globalData.userInfo.phone || '').trim() let wechatId = (app.globalData.userInfo.wechatId || app.globalData.userInfo.wechat_id || '').trim() + let avatar = (app.globalData.userInfo.avatar || app.globalData.userInfo.avatarUrl || '').trim() if (!phone && !wechatId) { try { const profileRes = await app.request({ url: `/api/miniprogram/user/profile?userId=${myUserId}`, silent: true }) if (profileRes?.success && profileRes.data) { phone = (profileRes.data.phone || '').trim() wechatId = (profileRes.data.wechatId || profileRes.data.wechat_id || '').trim() + if (!avatar) avatar = (profileRes.data.avatar || '').trim() } } catch (e) {} } - if (!phone && !wechatId) { + if ((!phone && !wechatId) || !avatar) { wx.showModal({ title: '完善资料', - content: '请先填写手机号或微信号,以便对方联系您', + content: !avatar ? '请先设置头像和填写联系方式,以便对方联系您' : '请先填写手机号或微信号,以便对方联系您', confirmText: '去填写', cancelText: '取消', success: (res) => { @@ -706,19 +735,21 @@ Page({ } let phone = (app.globalData.userInfo.phone || '').trim() let wechatId = (app.globalData.userInfo.wechatId || app.globalData.userInfo.wechat_id || '').trim() + let avatar = (app.globalData.userInfo.avatar || app.globalData.userInfo.avatarUrl || '').trim() if (!phone && !wechatId) { try { const profileRes = await app.request({ url: `/api/miniprogram/user/profile?userId=${userId}`, silent: true }) if (profileRes?.success && profileRes.data) { phone = (profileRes.data.phone || '').trim() wechatId = (profileRes.data.wechatId || profileRes.data.wechat_id || '').trim() + if (!avatar) avatar = (profileRes.data.avatar || '').trim() } } catch (e) {} } - if (!phone && !wechatId) { + if ((!phone && !wechatId) || !avatar) { wx.showModal({ title: '完善资料', - content: '请先填写手机号或微信号,以便对方联系您', + content: !avatar ? '请先设置头像和填写联系方式,以便对方联系您' : '请先填写手机号或微信号,以便对方联系您', confirmText: '去填写', cancelText: '取消', success: (res) => { @@ -832,11 +863,18 @@ Page({ }, shareToMoments() { - wx.showModal({ - title: '分享到朋友圈', - content: '点击右上角「···」菜单,选择「分享到朋友圈」即可。\n\n朋友圈分享文案已自动生成。', - showCancel: false, - confirmText: '知道了', + const title = this.data.section?.title || this.data.chapterTitle || '好文推荐' + const raw = (this.data.content || '').replace(/[#@]\S+/g, '').replace(/\s+/g, ' ').trim() + const excerpt = raw.length > 200 ? raw.slice(0, 200) + '……' : raw.length > 100 ? raw + '……' : raw + const copyText = `${title}\n\n${excerpt}\n\n👉 来自「Soul创业派对」` + wx.setClipboardData({ + data: copyText, + success: () => { + wx.showToast({ title: '文案已复制,去朋友圈粘贴发布', icon: 'none', duration: 2500 }) + }, + fail: () => { + wx.showToast({ title: '复制失败,请手动复制', icon: 'none' }) + } }) }, @@ -1511,104 +1549,125 @@ Page({ wx.showModal({ title: '代付分享', - content: `为好友代付本章 ¥${price}\n\n支付后将生成代付链接,好友点击即可免费阅读`, - confirmText: '微信支付', - cancelText: '用余额', + content: `为好友代付本章 ¥${price}\n支付后将生成代付链接,好友点击即可免费阅读`, + confirmText: '确认代付', + cancelText: '取消', success: async (res) => { - if (!res.confirm && !res.cancel) return - - if (res.confirm) { - // Direct WeChat Pay - wx.showLoading({ title: '创建订单...' }) - try { - const payRes = await app.request({ - url: '/api/miniprogram/pay', - method: 'POST', - data: { - openId: app.globalData.openId, - productType: 'gift', - productId: sectionId, - amount: price, - description: `代付解锁:${this.data.section?.title || sectionId}`, - userId: userId, - } - }) - wx.hideLoading() - if (payRes && payRes.payParams) { - wx.requestPayment({ - ...payRes.payParams, - success: async () => { - // After payment, create gift code via balance gift API - // First confirm recharge to add to balance, then deduct for gift - try { - const giftRes = await app.request({ - url: '/api/miniprogram/balance/gift', - method: 'POST', - data: { giverId: userId, sectionId } - }) - if (giftRes && giftRes.data && giftRes.data.giftCode) { - this._giftCodeToShare = giftRes.data.giftCode - wx.showModal({ - title: '代付成功!', - content: `已为好友代付 ¥${price},分享后好友可免费阅读`, - confirmText: '分享给好友', - success: (r) => { if (r.confirm) wx.shareAppMessage() } - }) - } - } catch (e) { - wx.showToast({ title: '生成分享链接失败', icon: 'none' }) - } - }, - fail: () => { wx.showToast({ title: '支付取消', icon: 'none' }) } - }) - } else { - wx.showToast({ title: '创建支付失败', icon: 'none' }) + if (!res.confirm) return + wx.showActionSheet({ + itemList: ['微信支付', '用余额支付'], + success: async (actionRes) => { + if (actionRes.tapIndex === 0) { + this._giftPayViaWechat(sectionId, userId, price) + } else if (actionRes.tapIndex === 1) { + this._giftPayViaBalance(sectionId, userId, price) } - } catch (e) { - wx.hideLoading() - wx.showToast({ title: '支付失败', icon: 'none' }) } - } else { - // Use balance (existing flow) - const balRes = await app.request({ url: `/api/miniprogram/balance?userId=${userId}`, silent: true }).catch(() => null) - const balance = (balRes && balRes.data) ? balRes.data.balance : 0 - - if (balance < price) { - wx.showModal({ - title: '余额不足', - content: `当前余额 ¥${balance.toFixed(2)},需要 ¥${price}\n请先充值`, - confirmText: '去充值', - success: (r) => { if (r.confirm) wx.navigateTo({ url: '/pages/wallet/wallet' }) } - }) - return - } - - wx.showLoading({ title: '处理中...' }) - try { - const giftRes = await app.request({ - url: '/api/miniprogram/balance/gift', - method: 'POST', - data: { giverId: userId, sectionId } - }) - wx.hideLoading() - if (giftRes && giftRes.data && giftRes.data.giftCode) { - this._giftCodeToShare = giftRes.data.giftCode - wx.showModal({ - title: '代付成功!', - content: `已从余额扣除 ¥${price},分享后好友可免费阅读`, - confirmText: '分享给好友', - success: (r) => { if (r.confirm) wx.shareAppMessage() } - }) - } - } catch (e) { - wx.hideLoading() - wx.showToast({ title: '代付失败', icon: 'none' }) - } - } + }) } }) }, + async _giftPayViaWechat(sectionId, userId, price) { + let openId = app.globalData.openId || wx.getStorageSync('openId') + if (!openId) { openId = await app.getOpenId() } + if (!openId) { wx.showToast({ title: '获取支付凭证失败,请重新登录', icon: 'none' }); return } + wx.showLoading({ title: '创建订单...' }) + try { + const payRes = await app.request({ + url: '/api/miniprogram/pay', + method: 'POST', + data: { + openId: openId, + productType: 'gift', + productId: sectionId, + amount: price, + description: `代付解锁:${this.data.section?.title || sectionId}`, + userId: userId, + } + }) + wx.hideLoading() + const params = (payRes && payRes.data && payRes.data.payParams) ? payRes.data.payParams : (payRes && payRes.payParams ? payRes.payParams : null) + if (params) { + wx.requestPayment({ + ...params, + success: async () => { + wx.showLoading({ title: '生成分享链接...' }) + try { + const giftRes = await app.request({ + url: '/api/miniprogram/balance/gift', + method: 'POST', + data: { giverId: userId, sectionId, paidViaWechat: true } + }) + wx.hideLoading() + if (giftRes && giftRes.data && giftRes.data.giftCode) { + this._giftCodeToShare = giftRes.data.giftCode + wx.showModal({ + title: '代付成功', + content: `已为好友代付 ¥${price},分享后好友可免费阅读`, + confirmText: '分享给好友', + cancelText: '稍后分享', + success: (r) => { if (r.confirm) wx.shareAppMessage() } + }) + } else { + wx.showToast({ title: '支付成功,请手动分享', icon: 'none' }) + } + } catch (e) { + wx.hideLoading() + wx.showToast({ title: '支付成功,生成链接失败', icon: 'none' }) + } + }, + fail: () => { wx.showToast({ title: '支付已取消', icon: 'none' }) } + }) + } else { + wx.showToast({ title: '创建支付失败', icon: 'none' }) + } + } catch (e) { + wx.hideLoading() + console.error('[GiftPay] WeChat pay error:', e) + wx.showToast({ title: '支付失败,请重试', icon: 'none' }) + } + }, + + async _giftPayViaBalance(sectionId, userId, price) { + const balRes = await app.request({ url: `/api/miniprogram/balance?userId=${userId}`, silent: true }).catch(() => null) + const balance = (balRes && balRes.data) ? balRes.data.balance : 0 + + if (balance < price) { + wx.showModal({ + title: '余额不足', + content: `当前余额 ¥${balance.toFixed(2)},需要 ¥${price}\n请先充值`, + confirmText: '去充值', + cancelText: '取消', + success: (r) => { if (r.confirm) wx.navigateTo({ url: '/pages/wallet/wallet' }) } + }) + return + } + + wx.showLoading({ title: '处理中...' }) + try { + const giftRes = await app.request({ + url: '/api/miniprogram/balance/gift', + method: 'POST', + data: { giverId: userId, sectionId } + }) + wx.hideLoading() + if (giftRes && giftRes.data && giftRes.data.giftCode) { + this._giftCodeToShare = giftRes.data.giftCode + wx.showModal({ + title: '代付成功', + content: `已从余额扣除 ¥${price},分享后好友可免费阅读`, + confirmText: '分享给好友', + cancelText: '稍后分享', + success: (r) => { if (r.confirm) wx.shareAppMessage() } + }) + } + } catch (e) { + wx.hideLoading() + wx.showToast({ title: '代付失败', icon: 'none' }) + } + }, + // 领取礼物码解锁 async _redeemGiftCode(giftCode) { if (!app.globalData.isLoggedIn || !app.globalData.userInfo) return diff --git a/miniprogram/pages/read/read.wxss b/miniprogram/pages/read/read.wxss index 6f7a00c1..dac553f3 100644 --- a/miniprogram/pages/read/read.wxss +++ b/miniprogram/pages/read/read.wxss @@ -348,17 +348,22 @@ display: flex; gap: 24rpx; margin-bottom: 48rpx; + overflow: hidden; } .nav-btn { flex: 1; + min-width: 0; padding: 24rpx; border-radius: 24rpx; max-width: 48%; + box-sizing: border-box; + overflow: hidden; } .nav-btn-placeholder { flex: 1; + min-width: 0; max-width: 48%; } @@ -433,6 +438,7 @@ .action-btn-inline { flex: 1; display: flex; + flex-direction: column; align-items: center; justify-content: center; gap: 8rpx; @@ -466,11 +472,11 @@ } .action-icon-small { - font-size: 28rpx; + font-size: 40rpx; } .action-text-small { - font-size: 24rpx; + font-size: 22rpx; color: #ffffff; font-weight: 500; } diff --git a/miniprogram/pages/wallet/wallet.js b/miniprogram/pages/wallet/wallet.js index b4931b2e..9ead769f 100644 --- a/miniprogram/pages/wallet/wallet.js +++ b/miniprogram/pages/wallet/wallet.js @@ -74,6 +74,15 @@ Page({ const userId = app.globalData.userInfo.id const amount = this.data.selectedAmount + let openId = app.globalData.openId + if (!openId) { + openId = await app.getOpenId() + } + if (!openId) { + wx.showToast({ title: '获取支付凭证失败,请重新登录', icon: 'none', duration: 2500 }) + return + } + wx.showLoading({ title: '创建订单...' }) try { const res = await app.request({ @@ -83,12 +92,11 @@ Page({ }) wx.hideLoading() if (res && res.data && res.data.orderSn) { - // Trigger WeChat Pay for the recharge order const payRes = await app.request({ url: '/api/miniprogram/pay', method: 'POST', data: { - openId: app.globalData.openId, + openId: openId, productType: 'balance_recharge', productId: res.data.orderSn, amount: amount, @@ -96,9 +104,10 @@ Page({ userId: userId, } }) - if (payRes && payRes.payParams) { + const params = (payRes && payRes.data && payRes.data.payParams) ? payRes.data.payParams : (payRes && payRes.payParams ? payRes.payParams : null) + if (params) { wx.requestPayment({ - ...payRes.payParams, + ...params, success: async () => { // Confirm the recharge await app.request({ @@ -120,7 +129,8 @@ Page({ } } catch (e) { wx.hideLoading() - wx.showToast({ title: '充值失败', icon: 'none' }) + console.error('[Wallet] recharge error:', e) + wx.showToast({ title: '充值失败:' + (e.message || e.errMsg || '网络异常'), icon: 'none', duration: 3000 }) } }, @@ -132,12 +142,12 @@ Page({ } const userId = app.globalData.userInfo.id const balance = this.data.balance - const refundAmount = (balance * 0.9).toFixed(2) wx.showModal({ title: '余额退款', - content: `退回全部余额 ¥${balance.toFixed(2)}\n实际到账 ¥${refundAmount}(9折)\n\n退款将在1-3个工作日内原路返回`, + content: `退回全部余额 ¥${balance.toFixed(2)}\n\n退款将在1-3个工作日内原路返回`, confirmText: '确认退款', + cancelText: '取消', success: async (res) => { if (!res.confirm) return wx.showLoading({ title: '处理中...' }) diff --git a/miniprogram/pages/wallet/wallet.wxml b/miniprogram/pages/wallet/wallet.wxml index 3b3aa15a..22ce9e7f 100644 --- a/miniprogram/pages/wallet/wallet.wxml +++ b/miniprogram/pages/wallet/wallet.wxml @@ -50,7 +50,6 @@ 充值 - 退款(9折) diff --git a/miniprogram/utils/contentParser.js b/miniprogram/utils/contentParser.js index 39492a2e..cb9374e5 100644 --- a/miniprogram/utils/contentParser.js +++ b/miniprogram/utils/contentParser.js @@ -100,8 +100,10 @@ function parseBlockToSegments(block) { /** * 从 HTML 中解析出 lines(纯文本行)和 segments(含富文本片段) + * @param {string} html + * @param {object} [config] - { persons: [], linkTags: [] },用于对 text 段自动匹配 @人名 / #标签 */ -function parseHtmlToSegments(html) { +function parseHtmlToSegments(html, config) { const lines = [] const segments = [] @@ -125,7 +127,7 @@ function parseHtmlToSegments(html) { for (const block of blocks) { if (!block.trim()) continue - const blockSegs = parseBlockToSegments(block) + let blockSegs = parseBlockToSegments(block) if (!blockSegs.length) continue // 纯图片行独立成段 @@ -135,6 +137,20 @@ function parseHtmlToSegments(html) { continue } + // 对 text 段再跑一遍 @人名 / #标签 自动匹配(处理未用 TipTap 插入而是手打的 @xxx) + if (config && (config.persons?.length || config.linkTags?.length)) { + const expanded = [] + for (const seg of blockSegs) { + if (seg.type === 'text' && seg.text) { + const sub = matchLineToSegments(seg.text, config) + expanded.push(...sub) + } else { + expanded.push(seg) + } + } + blockSegs = expanded + } + // 行纯文本用于 lines(previewParagraphs 降级展示) const lineText = decodeEntities(block.replace(/<[^>]+>/g, '')).trim() lines.push(lineText) @@ -163,27 +179,108 @@ function stripMarkdownFormatting(text) { return s } +/** + * 对一行纯文本进行 @人名 / #标签 自动匹配,返回 segments 数组 + * config: { persons: [{personId, name, aliases}], linkTags: [{tagId, label, type, pagePath, mpKey, url, aliases}] } + */ +function matchLineToSegments(line, config) { + if (!config || (!config.persons?.length && !config.linkTags?.length)) { + return [{ type: 'text', text: line }] + } + const normalize = s => (s || '').trim().toLowerCase() + const personMap = {} + const tagMap = {} + for (const p of (config.persons || [])) { + const keys = [p.name, ...(p.aliases ? p.aliases.split(',') : [])].map(normalize).filter(Boolean) + for (const k of keys) { if (!personMap[k]) personMap[k] = p } + } + for (const t of (config.linkTags || [])) { + const keys = [t.label, ...(t.aliases ? t.aliases.split(',') : [])].map(normalize).filter(Boolean) + for (const k of keys) { if (!tagMap[k]) tagMap[k] = t } + } + const esc = n => n.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + const personNames = Object.keys(personMap).sort((a, b) => b.length - a.length).map(esc) + const tagLabels = Object.keys(tagMap).sort((a, b) => b.length - a.length).map(esc) + if (!personNames.length && !tagLabels.length) return [{ type: 'text', text: line }] + + const parts = [] + if (personNames.length) parts.push('[@@](' + personNames.join('|') + ')') + if (tagLabels.length) parts.push('[##](' + tagLabels.join('|') + ')') + const pattern = new RegExp(parts.join('|'), 'gi') + + const segs = [] + let lastEnd = 0 + let m + while ((m = pattern.exec(line)) !== null) { + if (m.index > lastEnd) { + segs.push({ type: 'text', text: line.slice(lastEnd, m.index) }) + } + const full = m[0] + const prefix = full[0] + const body = full.slice(1) + if (prefix === '@' || prefix === '@') { + const person = personMap[normalize(body)] + if (person) { + segs.push({ type: 'mention', userId: person.personId || '', nickname: person.name || body }) + } else { + segs.push({ type: 'text', text: full }) + } + } else { + const tag = tagMap[normalize(body)] + if (tag) { + segs.push({ + type: 'linkTag', + label: tag.label || body, + url: tag.url || '', + tagType: tag.type || 'url', + pagePath: tag.pagePath || '', + tagId: tag.tagId || '', + appId: tag.appId || '', + mpKey: tag.mpKey || '' + }) + } else { + segs.push({ type: 'text', text: full }) + } + } + lastEnd = m.index + full.length + } + if (lastEnd < line.length) { + segs.push({ type: 'text', text: line.slice(lastEnd) }) + } + return segs.length ? segs : [{ type: 'text', text: line }] +} + /** 纯文本/Markdown 按行解析 */ -function parsePlainTextToSegments(text) { +function parsePlainTextToSegments(text, config) { const cleaned = stripMarkdownFormatting(text) const lines = cleaned.split('\n').map(l => l.trim()).filter(l => l.length > 0) - const segments = lines.map(line => [{ type: 'text', text: line }]) + const segments = lines.map(line => matchLineToSegments(line, config)) return { lines, segments } } +/** 清理残留的 Markdown 图片引用文本(如 "image.png![](xxx)" ) */ +function stripOrphanImageRefs(text) { + if (!text) return text + text = text.replace(/[^\s]*\.(?:png|jpg|jpeg|gif|webp|svg|bmp)!\[[^\]]*\]\([^)]*\)/gi, '') + text = text.replace(/!\[[^\]]*\]\([^)]*\)/g, '') + return text +} + /** * 将原始内容解析为 contentSegments(用于阅读页展示) * @param {string} rawContent + * @param {object} [config] - { persons: [], linkTags: [] } * @returns {{ lines: string[], segments: Array> }} */ -function parseContent(rawContent) { +function parseContent(rawContent, config) { if (!rawContent || typeof rawContent !== 'string') { return { lines: [], segments: [] } } - if (isHtmlContent(rawContent)) { - return parseHtmlToSegments(rawContent) + let content = stripOrphanImageRefs(rawContent) + if (isHtmlContent(content)) { + return parseHtmlToSegments(content, config) } - return parsePlainTextToSegments(rawContent) + return parsePlainTextToSegments(content, config) } module.exports = { diff --git a/miniprogram/utils/ruleEngine.js b/miniprogram/utils/ruleEngine.js index b7b1c1d4..9906ed0d 100644 --- a/miniprogram/utils/ruleEngine.js +++ b/miniprogram/utils/ruleEngine.js @@ -1,19 +1,40 @@ /** * Soul创业派对 - 用户旅程规则引擎 - * 在关键页面自动检查用户状态,引导完善信息 - * - * 规则逻辑: - * 1. 注册后 → 引导填写头像和昵称 - * 2. 浏览付费章节 → 引导绑定手机号 - * 3. 完成匹配 → 引导填写 MBTI / 行业等 - * 4. 购买全书 → 引导填写完整信息(进 VIP 群) - * 5. 累计浏览 5 章 → 引导分享推广 + * 从后端 /api/miniprogram/user-rules 读取启用的规则,按场景触发引导 + * + * trigger → scene 映射: + * 注册 → after_login + * 点击收费章节 → before_read + * 完成匹配 → after_match + * 完成付款 → after_pay + * 累计浏览5章节 → page_show + * 加入派对房 → before_join_party + * 绑定微信 → after_bindwechat + * 收益满50元 → earnings_check + * 手动触发 → manual + * 浏览导师页 → browse_mentor */ const app = getApp() const RULE_COOLDOWN_KEY = 'rule_engine_cooldown' const COOLDOWN_MS = 60 * 1000 +let _cachedRules = null +let _cacheTs = 0 +const CACHE_TTL = 5 * 60 * 1000 + +const TRIGGER_SCENE_MAP = { + '注册': 'after_login', + '点击收费章节': 'before_read', + '完成匹配': 'after_match', + '完成付款': 'after_pay', + '累计浏览5章节': 'page_show', + '加入派对房': 'before_join_party', + '绑定微信': 'after_bindwechat', + '收益满50元': 'earnings_check', + '手动触发': 'manual', + '浏览导师页': 'browse_mentor', +} function isInCooldown(ruleId) { try { @@ -36,104 +57,193 @@ function getUserInfo() { return app.globalData.userInfo || {} } -function checkRule_FillAvatar() { +async function loadRules() { + if (_cachedRules && Date.now() - _cacheTs < CACHE_TTL) return _cachedRules + try { + const res = await app.request({ url: '/api/miniprogram/user-rules', method: 'GET', silent: true }) + if (res && res.success && res.rules) { + _cachedRules = res.rules + _cacheTs = Date.now() + return _cachedRules + } + } catch {} + return _cachedRules || [] +} + +function isRuleEnabled(rules, triggerName) { + return rules.some(r => r.trigger === triggerName) +} + +function getRuleInfo(rules, triggerName) { + return rules.find(r => r.trigger === triggerName) +} + +function checkRule_FillAvatar(rules) { + if (!isRuleEnabled(rules, '注册')) return null const user = getUserInfo() if (!user.id) return null const avatar = user.avatar || user.avatarUrl || '' const nickname = user.nickname || '' - if (avatar && !avatar.includes('default') && nickname && nickname !== '微信用户' && !nickname.startsWith('微信用户')) { - return null - } + if (avatar && !avatar.includes('default') && nickname && nickname !== '微信用户' && !nickname.startsWith('微信用户')) return null if (isInCooldown('fill_avatar')) return null setCooldown('fill_avatar') + const info = getRuleInfo(rules, '注册') return { ruleId: 'fill_avatar', - title: '完善个人信息', - message: '设置头像和昵称,让其他创业者更容易认识你', + title: info?.title || '完善个人信息', + message: info?.description || '设置头像和昵称,让其他创业者更容易认识你', action: 'navigate', target: '/pages/profile-edit/profile-edit' } } -function checkRule_BindPhone() { +function checkRule_BindPhone(rules) { + if (!isRuleEnabled(rules, '点击收费章节')) return null const user = getUserInfo() if (!user.id) return null if (user.phone) return null if (isInCooldown('bind_phone')) return null setCooldown('bind_phone') + const info = getRuleInfo(rules, '点击收费章节') return { ruleId: 'bind_phone', - title: '绑定手机号', - message: '绑定手机号解锁更多功能,保障账户安全', + title: info?.title || '绑定手机号', + message: info?.description || '绑定手机号解锁更多功能,保障账户安全', action: 'bind_phone', target: null } } -function checkRule_FillProfile() { +function checkRule_FillProfile(rules) { + if (!isRuleEnabled(rules, '完成匹配')) return null const user = getUserInfo() if (!user.id) return null if (user.mbti && user.industry) return null if (isInCooldown('fill_profile')) return null setCooldown('fill_profile') + const info = getRuleInfo(rules, '完成匹配') return { ruleId: 'fill_profile', - title: '完善创业档案', - message: '填写 MBTI 和行业信息,帮你精准匹配创业伙伴', + title: info?.title || '完善创业档案', + message: info?.description || '填写 MBTI 和行业信息,帮你精准匹配创业伙伴', action: 'navigate', target: '/pages/profile-edit/profile-edit' } } -function checkRule_ShareAfter5Chapters() { +function checkRule_ShareAfter5Chapters(rules) { + if (!isRuleEnabled(rules, '累计浏览5章节')) return null const user = getUserInfo() if (!user.id) return null const readCount = app.globalData.readCount || 0 if (readCount < 5) return null if (isInCooldown('share_after_5')) return null setCooldown('share_after_5') + const info = getRuleInfo(rules, '累计浏览5章节') return { ruleId: 'share_after_5', - title: '邀请好友一起看', - message: '你已阅读 ' + readCount + ' 个章节,分享给好友可获得分销收益', + title: info?.title || '邀请好友一起看', + message: info?.description || '你已阅读 ' + readCount + ' 个章节,分享给好友可获得分销收益', action: 'navigate', target: '/pages/referral/referral' } } -/** - * 在指定场景下检查规则 - * @param {string} scene - 场景:after_login, before_read, after_match, after_pay, page_show - * @returns {object|null} - 触发的规则,null 表示无需触发 - */ -function checkRules(scene) { +function checkRule_FillVipInfo(rules) { + if (!isRuleEnabled(rules, '完成付款')) return null + const user = getUserInfo() + if (!user.id) return null + if (!app.globalData.hasPurchasedFull) return null + if (user.wechatId && user.address) return null + if (isInCooldown('fill_vip_info')) return null + setCooldown('fill_vip_info') + const info = getRuleInfo(rules, '完成付款') + return { + ruleId: 'fill_vip_info', + title: info?.title || '填写完整信息', + message: info?.description || '购买全书后,需填写完整信息以进入 VIP 群', + action: 'navigate', + target: '/pages/profile-edit/profile-edit' + } +} + +function checkRule_JoinParty(rules) { + if (!isRuleEnabled(rules, '加入派对房')) return null + const user = getUserInfo() + if (!user.id) return null + if (user.projectIntro) return null + if (isInCooldown('join_party')) return null + setCooldown('join_party') + const info = getRuleInfo(rules, '加入派对房') + return { + ruleId: 'join_party', + title: info?.title || '填写项目介绍', + message: info?.description || '进入派对房前,引导填写项目介绍和核心需求', + action: 'navigate', + target: '/pages/profile-edit/profile-edit' + } +} + +function checkRule_BindWechat(rules) { + if (!isRuleEnabled(rules, '绑定微信')) return null + const user = getUserInfo() + if (!user.id) return null + if (user.wechatId) return null + if (isInCooldown('bind_wechat')) return null + setCooldown('bind_wechat') + const info = getRuleInfo(rules, '绑定微信') + return { + ruleId: 'bind_wechat', + title: info?.title || '绑定微信号', + message: info?.description || '绑定微信后,引导开启分销功能', + action: 'navigate', + target: '/pages/settings/settings' + } +} + +function checkRule_Withdraw(rules) { + if (!isRuleEnabled(rules, '收益满50元')) return null + const user = getUserInfo() + if (!user.id) return null + const earnings = app.globalData.totalEarnings || 0 + if (earnings < 50) return null + if (isInCooldown('withdraw_50')) return null + setCooldown('withdraw_50') + const info = getRuleInfo(rules, '收益满50元') + return { + ruleId: 'withdraw_50', + title: info?.title || '可以提现了', + message: info?.description || '累计分销收益超过 50 元,快去申请提现吧', + action: 'navigate', + target: '/pages/referral/referral' + } +} + +function checkRulesSync(scene, rules) { const user = getUserInfo() if (!user.id) return null switch (scene) { case 'after_login': - return checkRule_FillAvatar() + return checkRule_FillAvatar(rules) case 'before_read': - return checkRule_BindPhone() || checkRule_FillAvatar() + return checkRule_BindPhone(rules) || checkRule_FillAvatar(rules) case 'after_match': - return checkRule_FillProfile() + return checkRule_FillProfile(rules) || checkRule_JoinParty(rules) case 'after_pay': - return checkRule_FillProfile() + return checkRule_FillVipInfo(rules) || checkRule_FillProfile(rules) case 'page_show': - return checkRule_FillAvatar() || checkRule_ShareAfter5Chapters() + return checkRule_FillAvatar(rules) || checkRule_ShareAfter5Chapters(rules) || checkRule_BindWechat(rules) || checkRule_Withdraw(rules) + case 'before_join_party': + return checkRule_JoinParty(rules) default: return null } } -/** - * 执行规则动作 - * @param {object} rule - checkRules 返回的规则对象 - * @param {object} pageInstance - 页面实例(用于绑定手机号等操作) - */ function executeRule(rule, pageInstance) { if (!rule) return - + wx.showModal({ title: rule.title, content: rule.message, @@ -157,23 +267,20 @@ function executeRule(rule, pageInstance) { function _trackRuleAction(ruleId, action) { const userId = getUserInfo().id if (!userId) return - app.request('/api/miniprogram/track', { + app.request({ + url: '/api/miniprogram/track', method: 'POST', data: { userId, action: 'rule_trigger', target: ruleId, extraData: { result: action } }, silent: true }).catch(() => {}) } -/** - * 在页面 onShow 中调用的便捷方法 - * @param {string} scene - * @param {object} pageInstance - */ -function checkAndExecute(scene, pageInstance) { - const rule = checkRules(scene) +async function checkAndExecute(scene, pageInstance) { + const rules = await loadRules() + const rule = checkRulesSync(scene, rules) if (rule) { setTimeout(() => executeRule(rule, pageInstance), 800) } } -module.exports = { checkRules, executeRule, checkAndExecute } +module.exports = { checkRules: checkRulesSync, executeRule, checkAndExecute, loadRules } diff --git a/soul-admin/dist/assets/index-D9IazBEm.css b/soul-admin/dist/assets/index-D9IazBEm.css new file mode 100644 index 00000000..cfe03fa7 --- /dev/null +++ b/soul-admin/dist/assets/index-D9IazBEm.css @@ -0,0 +1 @@ +.rich-editor-wrapper{border:1px solid #374151;border-radius:.5rem;background:#0a1628;overflow:hidden}.rich-editor-toolbar{display:flex;align-items:center;gap:2px;padding:6px 8px;border-bottom:1px solid #374151;background:#0f1d32;flex-wrap:wrap}.toolbar-group{display:flex;align-items:center;gap:1px}.toolbar-divider{width:1px;height:20px;background:#374151;margin:0 4px}.rich-editor-toolbar button{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:4px;border:none;background:transparent;color:#9ca3af;cursor:pointer;transition:all .15s}.rich-editor-toolbar button:hover{background:#1f2937;color:#d1d5db}.rich-editor-toolbar button.is-active{background:#38bdac33;color:#38bdac}.rich-editor-toolbar button:disabled{opacity:.3;cursor:not-allowed}.link-tag-select{background:#0a1628;border:1px solid #374151;color:#d1d5db;font-size:12px;padding:2px 6px;border-radius:4px;cursor:pointer;max-width:160px}.link-input-bar{display:flex;align-items:center;gap:4px;padding:4px 8px;border-bottom:1px solid #374151;background:#0f1d32}.link-input{flex:1;background:#0a1628;border:1px solid #374151;color:#fff;padding:4px 8px;border-radius:4px;font-size:13px}.link-confirm,.link-remove{padding:4px 10px;border-radius:4px;border:none;font-size:12px;cursor:pointer}.link-confirm{background:#38bdac;color:#fff}.link-remove{background:#374151;color:#9ca3af}.rich-editor-content{min-height:300px;max-height:500px;overflow-y:auto;padding:12px 16px;color:#e5e7eb;font-size:14px;line-height:1.7}.rich-editor-content:focus{outline:none}.rich-editor-content h1{font-size:1.5em;font-weight:700;margin:.8em 0 .4em;color:#fff}.rich-editor-content h2{font-size:1.3em;font-weight:600;margin:.7em 0 .3em;color:#fff}.rich-editor-content h3{font-size:1.15em;font-weight:600;margin:.6em 0 .3em;color:#fff}.rich-editor-content p{margin:.4em 0}.rich-editor-content strong{color:#fff}.rich-editor-content code{background:#1f2937;padding:2px 6px;border-radius:3px;font-size:.9em;color:#38bdac}.rich-editor-content pre{background:#1f2937;padding:12px;border-radius:6px;overflow-x:auto;margin:.6em 0}.rich-editor-content blockquote{border-left:3px solid #38bdac;padding-left:12px;margin:.6em 0;color:#9ca3af}.rich-editor-content ul,.rich-editor-content ol{padding-left:1.5em;margin:.4em 0}.rich-editor-content li{margin:.2em 0}.rich-editor-content hr{border:none;border-top:1px solid #374151;margin:1em 0}.rich-editor-content img{max-width:100%;border-radius:6px;margin:.5em 0}.rich-editor-content a,.rich-link{color:#38bdac;text-decoration:underline;cursor:pointer}.rich-editor-content table{border-collapse:collapse;width:100%;margin:.5em 0}.rich-editor-content th,.rich-editor-content td{border:1px solid #374151;padding:6px 10px;text-align:left}.rich-editor-content th{background:#1f2937;font-weight:600}.rich-editor-content .ProseMirror-placeholder:before{content:attr(data-placeholder);color:#6b7280;float:left;height:0;pointer-events:none}.mention-tag{background:#38bdac26;color:#38bdac;border-radius:4px;padding:1px 4px;font-weight:500}.link-tag-node{background:#ffd7001f;color:gold;border-radius:4px;padding:1px 4px;font-weight:500;cursor:default;-webkit-user-select:all;user-select:all}.mention-popup{position:fixed;z-index:9999;background:#1a2638;border:1px solid #374151;border-radius:8px;padding:4px;min-width:180px;max-height:240px;overflow-y:auto;box-shadow:0 4px 20px #0006}.mention-item{display:flex;align-items:center;justify-content:space-between;padding:6px 10px;border-radius:4px;cursor:pointer;color:#d1d5db;font-size:13px}.mention-item:hover,.mention-item.is-selected{background:#38bdac26;color:#38bdac}.mention-name{font-weight:500}.mention-id{font-size:11px;color:#6b7280}.bubble-menu{display:flex;gap:2px;background:#1a2638;border:1px solid #374151;border-radius:6px;padding:4px;box-shadow:0 4px 12px #0000004d}.bubble-menu button{display:flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:4px;border:none;background:transparent;color:#9ca3af;cursor:pointer}.bubble-menu button:hover{background:#1f2937;color:#d1d5db}.bubble-menu button.is-active{color:#38bdac}.mention-trigger-btn{color:#38bdac!important}.mention-trigger-btn:hover{background:#38bdac33!important}.upload-progress-bar{display:flex;align-items:center;gap:8px;padding:4px 10px;background:#0f1d32;border-bottom:1px solid #374151}.upload-progress-track{flex:1;height:4px;background:#1f2937;border-radius:2px;overflow:hidden}.upload-progress-fill{height:100%;background:linear-gradient(90deg,#38bdac,#4ae3ce);border-radius:2px;transition:width .3s ease}.upload-progress-text{font-size:11px;color:#38bdac;white-space:nowrap}/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-pan-x:initial;--tw-pan-y:initial;--tw-pinch-zoom:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial}}}@layer theme{:root,:host{--font-sans:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-900:oklch(41.4% .112 45.904);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-sky-200:oklch(90.1% .058 230.902);--color-sky-300:oklch(82.8% .111 230.318);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-rose-400:oklch(71.2% .194 13.428);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5/2.25);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--blur-xl:24px;--blur-3xl:64px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.not-sr-only{clip-path:none;white-space:normal;width:auto;height:auto;margin:0;padding:0;position:static;overflow:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.-top-2\.5{top:calc(var(--spacing)*-2.5)}.top-0{top:calc(var(--spacing)*0)}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-4{top:calc(var(--spacing)*4)}.top-16{top:calc(var(--spacing)*16)}.top-\[50\%\]{top:50%}.right-0{right:calc(var(--spacing)*0)}.right-1{right:calc(var(--spacing)*1)}.right-1\/4{right:25%}.right-4{right:calc(var(--spacing)*4)}.bottom-1\/4{bottom:25%}.-left-2\.5{left:calc(var(--spacing)*-2.5)}.left-0{left:calc(var(--spacing)*0)}.left-1\/4{left:25%}.left-2{left:calc(var(--spacing)*2)}.left-3{left:calc(var(--spacing)*3)}.left-\[50\%\]{left:50%}.isolate{isolation:isolate}.isolation-auto{isolation:auto}.z-10{z-index:10}.z-50{z-index:50}.col-span-2{grid-column:span 2/span 2}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.-mx-2{margin-inline:calc(var(--spacing)*-2)}.-mx-8{margin-inline:calc(var(--spacing)*-8)}.mx-20{margin-inline:calc(var(--spacing)*20)}.mx-auto{margin-inline:auto}.-mt-6{margin-top:calc(var(--spacing)*-6)}.mt-0{margin-top:calc(var(--spacing)*0)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-1\.5{margin-top:calc(var(--spacing)*1.5)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mt-8{margin-top:calc(var(--spacing)*8)}.mr-1{margin-right:calc(var(--spacing)*1)}.mr-2{margin-right:calc(var(--spacing)*2)}.mr-3{margin-right:calc(var(--spacing)*3)}.mr-auto{margin-right:auto}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-1\.5{margin-bottom:calc(var(--spacing)*1.5)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-4{margin-left:calc(var(--spacing)*4)}.ml-6{margin-left:calc(var(--spacing)*6)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.flow-root{display:flow-root}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline\!{display:inline!important}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.inline-grid{display:inline-grid}.inline-table{display:inline-table}.list-item{display:list-item}.table{display:table}.table\!{display:table!important}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-column{display:table-column}.table-column-group{display:table-column-group}.table-footer-group{display:table-footer-group}.table-header-group{display:table-header-group}.table-row{display:table-row}.table-row-group{display:table-row-group}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.size-9{width:calc(var(--spacing)*9);height:calc(var(--spacing)*9)}.size-10{width:calc(var(--spacing)*10);height:calc(var(--spacing)*10)}.h-0\.5{height:calc(var(--spacing)*.5)}.h-1\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-3{height:calc(var(--spacing)*3)}.h-3\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-16{height:calc(var(--spacing)*16)}.h-20{height:calc(var(--spacing)*20)}.h-24{height:calc(var(--spacing)*24)}.h-96{height:calc(var(--spacing)*96)}.h-auto{height:auto}.h-full{height:100%}.max-h-60{max-height:calc(var(--spacing)*60)}.max-h-96{max-height:calc(var(--spacing)*96)}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[250px\]{max-height:250px}.max-h-\[300px\]{max-height:300px}.max-h-\[400px\]{max-height:400px}.max-h-\[450px\]{max-height:450px}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-8{min-height:calc(var(--spacing)*8)}.min-h-\[32px\]{min-height:32px}.min-h-\[40px\]{min-height:40px}.min-h-\[60vh\]{min-height:60vh}.min-h-\[72px\]{min-height:72px}.min-h-\[80px\]{min-height:80px}.min-h-\[100px\]{min-height:100px}.min-h-\[120px\]{min-height:120px}.min-h-\[260px\]{min-height:260px}.min-h-\[400px\]{min-height:400px}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-0\.5{width:calc(var(--spacing)*.5)}.w-2{width:calc(var(--spacing)*2)}.w-3{width:calc(var(--spacing)*3)}.w-3\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-7{width:calc(var(--spacing)*7)}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-10{width:calc(var(--spacing)*10)}.w-12{width:calc(var(--spacing)*12)}.w-16{width:calc(var(--spacing)*16)}.w-20{width:calc(var(--spacing)*20)}.w-24{width:calc(var(--spacing)*24)}.w-28{width:calc(var(--spacing)*28)}.w-32{width:calc(var(--spacing)*32)}.w-36{width:calc(var(--spacing)*36)}.w-40{width:calc(var(--spacing)*40)}.w-44{width:calc(var(--spacing)*44)}.w-48{width:calc(var(--spacing)*48)}.w-52{width:calc(var(--spacing)*52)}.w-56{width:calc(var(--spacing)*56)}.w-64{width:calc(var(--spacing)*64)}.w-96{width:calc(var(--spacing)*96)}.w-\[200px\]{width:200px}.w-fit{width:fit-content}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[140px\]{max-width:140px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[250px\]{max-width:250px}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-48{min-width:calc(var(--spacing)*48)}.min-w-\[8rem\]{min-width:8rem}.min-w-\[60px\]{min-width:60px}.min-w-\[120px\]{min-width:120px}.min-w-\[1024px\]{min-width:1024px}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-1\/2{--tw-translate-x: 50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-none{translate:none}.scale-3d{scale:var(--tw-scale-x)var(--tw-scale-y)var(--tw-scale-z)}.scale-\[0\.98\]{scale:.98}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-pointer{cursor:pointer}.touch-pinch-zoom{--tw-pinch-zoom:pinch-zoom;touch-action:var(--tw-pan-x,)var(--tw-pan-y,)var(--tw-pinch-zoom,)}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-\[40px_40px_1fr_80px_80px_80px_60px\]{grid-template-columns:40px 40px 1fr 80px 80px 80px 60px}.grid-cols-\[60px_1fr_100px_100px_80px_120px\]{grid-template-columns:60px 1fr 100px 100px 80px 120px}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:calc(var(--spacing)*0)}.gap-0\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-5{gap:calc(var(--spacing)*5)}.gap-6{gap:calc(var(--spacing)*6)}.gap-8{gap:calc(var(--spacing)*8)}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*0)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*0)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*8)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-reverse>:not(:last-child)){--tw-space-y-reverse:1}.gap-x-8{column-gap:calc(var(--spacing)*8)}:where(.space-x-reverse>:not(:last-child)){--tw-space-x-reverse:1}.gap-y-4{row-gap:calc(var(--spacing)*4)}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px*var(--tw-divide-x-reverse));border-inline-end-width:calc(1px*calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-y-reverse>:not(:last-child)){--tw-divide-y-reverse:1}:where(.divide-gray-700\/50>:not(:last-child)){border-color:#36415380}@supports (color:color-mix(in lab,red,red)){:where(.divide-gray-700\/50>:not(:last-child)){border-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}:where(.divide-white\/5>:not(:last-child)){border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){:where(.divide-white\/5>:not(:last-child)){border-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-s{border-start-start-radius:.25rem;border-end-start-radius:.25rem}.rounded-ss{border-start-start-radius:.25rem}.rounded-e{border-start-end-radius:.25rem;border-end-end-radius:.25rem}.rounded-se{border-start-end-radius:.25rem}.rounded-ee{border-end-end-radius:.25rem}.rounded-es{border-end-start-radius:.25rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-tl{border-top-left-radius:.25rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-r-md{border-top-right-radius:var(--radius-md);border-bottom-right-radius:var(--radius-md)}.rounded-tr{border-top-right-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-br{border-bottom-right-radius:.25rem}.rounded-bl{border-bottom-left-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-\[\#07C160\]{border-color:#07c160}.border-\[\#07C160\]\/20{border-color:#07c16033}.border-\[\#07C160\]\/30{border-color:#07c1604d}.border-\[\#38bdac\]{border-color:#38bdac}.border-\[\#38bdac\]\/20{border-color:#38bdac33}.border-\[\#38bdac\]\/30{border-color:#38bdac4d}.border-\[\#38bdac\]\/40{border-color:#38bdac66}.border-\[\#38bdac\]\/50{border-color:#38bdac80}.border-amber-400\/60{border-color:#fcbb0099}@supports (color:color-mix(in lab,red,red)){.border-amber-400\/60{border-color:color-mix(in oklab,var(--color-amber-400)60%,transparent)}}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.border-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/40{border-color:color-mix(in oklab,var(--color-amber-500)40%,transparent)}}.border-amber-500\/50{border-color:#f99c0080}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/50{border-color:color-mix(in oklab,var(--color-amber-500)50%,transparent)}}.border-amber-600{border-color:var(--color-amber-600)}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/30{border-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.border-blue-500\/40{border-color:#3080ff66}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/40{border-color:color-mix(in oklab,var(--color-blue-500)40%,transparent)}}.border-blue-500\/50{border-color:#3080ff80}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/50{border-color:color-mix(in oklab,var(--color-blue-500)50%,transparent)}}.border-cyan-500\/30{border-color:#00b7d74d}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/30{border-color:color-mix(in oklab,var(--color-cyan-500)30%,transparent)}}.border-cyan-500\/40{border-color:#00b7d766}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/40{border-color:color-mix(in oklab,var(--color-cyan-500)40%,transparent)}}.border-gray-500{border-color:var(--color-gray-500)}.border-gray-600{border-color:var(--color-gray-600)}.border-gray-700{border-color:var(--color-gray-700)}.border-gray-700\/30{border-color:#3641534d}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/30{border-color:color-mix(in oklab,var(--color-gray-700)30%,transparent)}}.border-gray-700\/40{border-color:#36415366}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/40{border-color:color-mix(in oklab,var(--color-gray-700)40%,transparent)}}.border-gray-700\/50{border-color:#36415380}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/50{border-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.border-gray-700\/60{border-color:#36415399}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/60{border-color:color-mix(in oklab,var(--color-gray-700)60%,transparent)}}.border-green-500\/30{border-color:#00c7584d}@supports (color:color-mix(in lab,red,red)){.border-green-500\/30{border-color:color-mix(in oklab,var(--color-green-500)30%,transparent)}}.border-green-500\/40{border-color:#00c75866}@supports (color:color-mix(in lab,red,red)){.border-green-500\/40{border-color:color-mix(in oklab,var(--color-green-500)40%,transparent)}}.border-inherit{border-color:inherit}.border-orange-500\/20{border-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/20{border-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.border-orange-500\/30{border-color:#fe6e004d}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/30{border-color:color-mix(in oklab,var(--color-orange-500)30%,transparent)}}.border-orange-500\/40{border-color:#fe6e0066}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/40{border-color:color-mix(in oklab,var(--color-orange-500)40%,transparent)}}.border-orange-500\/50{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/50{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.border-purple-500\/20{border-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/20{border-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.border-purple-500\/30{border-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/30{border-color:color-mix(in oklab,var(--color-purple-500)30%,transparent)}}.border-purple-500\/40{border-color:#ac4bff66}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/40{border-color:color-mix(in oklab,var(--color-purple-500)40%,transparent)}}.border-red-500{border-color:var(--color-red-500)}.border-red-500\/20{border-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.border-red-500\/20{border-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.border-red-500\/50{border-color:#fb2c3680}@supports (color:color-mix(in lab,red,red)){.border-red-500\/50{border-color:color-mix(in oklab,var(--color-red-500)50%,transparent)}}.border-transparent{border-color:#0000}.border-white\/5{border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.border-white\/5{border-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.border-white\/20{border-color:#fff3}@supports (color:color-mix(in lab,red,red)){.border-white\/20{border-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.border-yellow-500\/30{border-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/30{border-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.border-yellow-500\/40{border-color:#edb20066}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/40{border-color:color-mix(in oklab,var(--color-yellow-500)40%,transparent)}}.bg-\[\#0a1628\]{background-color:#0a1628}.bg-\[\#0a1628\]\/50{background-color:#0a162880}.bg-\[\#0a1628\]\/60{background-color:#0a162899}.bg-\[\#0b1828\]{background-color:#0b1828}.bg-\[\#0f2137\]{background-color:#0f2137}.bg-\[\#00CED1\]{background-color:#00ced1}.bg-\[\#1C1C1E\]{background-color:#1c1c1e}.bg-\[\#07C160\]{background-color:#07c160}.bg-\[\#07C160\]\/5{background-color:#07c1600d}.bg-\[\#07C160\]\/10{background-color:#07c1601a}.bg-\[\#38bdac\]{background-color:#38bdac}.bg-\[\#38bdac\]\/5{background-color:#38bdac0d}.bg-\[\#38bdac\]\/10{background-color:#38bdac1a}.bg-\[\#38bdac\]\/15{background-color:#38bdac26}.bg-\[\#38bdac\]\/20{background-color:#38bdac33}.bg-\[\#38bdac\]\/30{background-color:#38bdac4d}.bg-\[\#38bdac\]\/60{background-color:#38bdac99}.bg-\[\#38bdac\]\/80{background-color:#38bdaccc}.bg-\[\#050c18\]{background-color:#050c18}.bg-\[\#162840\]{background-color:#162840}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/5{background-color:color-mix(in oklab,var(--color-amber-500)5%,transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\/30{background-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.bg-black\/30{background-color:color-mix(in oklab,var(--color-black)30%,transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black)40%,transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black)60%,transparent)}}.bg-black\/90{background-color:#000000e6}@supports (color:color-mix(in lab,red,red)){.bg-black\/90{background-color:color-mix(in oklab,var(--color-black)90%,transparent)}}.bg-blue-500\/5{background-color:#3080ff0d}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/5{background-color:color-mix(in oklab,var(--color-blue-500)5%,transparent)}}.bg-blue-500\/10{background-color:#3080ff1a}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/10{background-color:color-mix(in oklab,var(--color-blue-500)10%,transparent)}}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.bg-cyan-500{background-color:var(--color-cyan-500)}.bg-cyan-500\/20{background-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/20{background-color:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.bg-emerald-500\/20{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/20{background-color:color-mix(in oklab,var(--color-emerald-500)20%,transparent)}}.bg-gray-500{background-color:var(--color-gray-500)}.bg-gray-500\/20{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\/20{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.bg-gray-600{background-color:var(--color-gray-600)}.bg-gray-600\/20{background-color:#4a556533}@supports (color:color-mix(in lab,red,red)){.bg-gray-600\/20{background-color:color-mix(in oklab,var(--color-gray-600)20%,transparent)}}.bg-gray-600\/50{background-color:#4a556580}@supports (color:color-mix(in lab,red,red)){.bg-gray-600\/50{background-color:color-mix(in oklab,var(--color-gray-600)50%,transparent)}}.bg-gray-700{background-color:var(--color-gray-700)}.bg-gray-700\/50{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.bg-gray-700\/50{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\/10{background-color:#00c7581a}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/10{background-color:color-mix(in oklab,var(--color-green-500)10%,transparent)}}.bg-green-500\/20{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/20{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.bg-green-600{background-color:var(--color-green-600)}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-500\/10{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/10{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.bg-purple-500\/20{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/20{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.bg-red-600{background-color:var(--color-red-600)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.bg-white\/5{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.bg-white\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.bg-white\/20{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.bg-yellow-500\/20{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.bg-yellow-500\/20{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-\[\#0f2137\]{--tw-gradient-from:#0f2137;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#00CED1\]{--tw-gradient-from:#00ced1;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#38bdac\]\/10{--tw-gradient-from:oklab(72.378% -.11483 -.0053193/.1);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-blue-500\/20{--tw-gradient-from:#3080ff33}@supports (color:color-mix(in lab,red,red)){.from-blue-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.from-blue-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-cyan-500\/20{--tw-gradient-from:#00b7d733}@supports (color:color-mix(in lab,red,red)){.from-cyan-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.from-cyan-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-green-500\/20{--tw-gradient-from:#00c75833}@supports (color:color-mix(in lab,red,red)){.from-green-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.from-green-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-purple-500\/20{--tw-gradient-from:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.from-purple-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.from-purple-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-yellow-500\/20{--tw-gradient-from:#edb20033}@supports (color:color-mix(in lab,red,red)){.from-yellow-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.from-yellow-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.via-\[\#38bdac\]\/30{--tw-gradient-via:oklab(72.378% -.11483 -.0053193/.3);--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-\[\#0f2137\]{--tw-gradient-to:#0f2137;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-\[\#20B2AA\]{--tw-gradient-to:#20b2aa;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-\[\#162d4a\]{--tw-gradient-to:#162d4a;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-amber-500\/20{--tw-gradient-to:#f99c0033}@supports (color:color-mix(in lab,red,red)){.to-amber-500\/20{--tw-gradient-to:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.to-amber-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-cyan-500\/5{--tw-gradient-to:#00b7d70d}@supports (color:color-mix(in lab,red,red)){.to-cyan-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-cyan-500)5%,transparent)}}.to-cyan-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-green-500\/5{--tw-gradient-to:#00c7580d}@supports (color:color-mix(in lab,red,red)){.to-green-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-green-500)5%,transparent)}}.to-green-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-purple-500\/5{--tw-gradient-to:#ac4bff0d}@supports (color:color-mix(in lab,red,red)){.to-purple-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-purple-500)5%,transparent)}}.to-purple-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-yellow-500\/5{--tw-gradient-to:#edb2000d}@supports (color:color-mix(in lab,red,red)){.to-yellow-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-yellow-500)5%,transparent)}}.to-yellow-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.bg-repeat{background-repeat:repeat}.mask-no-clip{-webkit-mask-clip:no-clip;mask-clip:no-clip}.mask-repeat{-webkit-mask-repeat:repeat;mask-repeat:repeat}.fill-amber-400{fill:var(--color-amber-400)}.fill-current{fill:currentColor}.object-cover{object-fit:cover}.p-0{padding:calc(var(--spacing)*0)}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.p-2\.5{padding:calc(var(--spacing)*2.5)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.px-0{padding-inline:calc(var(--spacing)*0)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-5{padding-block:calc(var(--spacing)*5)}.py-6{padding-block:calc(var(--spacing)*6)}.py-8{padding-block:calc(var(--spacing)*8)}.py-10{padding-block:calc(var(--spacing)*10)}.py-12{padding-block:calc(var(--spacing)*12)}.py-16{padding-block:calc(var(--spacing)*16)}.py-20{padding-block:calc(var(--spacing)*20)}.pt-0{padding-top:calc(var(--spacing)*0)}.pt-1{padding-top:calc(var(--spacing)*1)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-4{padding-top:calc(var(--spacing)*4)}.pt-5{padding-top:calc(var(--spacing)*5)}.pt-6{padding-top:calc(var(--spacing)*6)}.pr-1{padding-right:calc(var(--spacing)*1)}.pr-2{padding-right:calc(var(--spacing)*2)}.pr-4{padding-right:calc(var(--spacing)*4)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-3{padding-bottom:calc(var(--spacing)*3)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-4{padding-left:calc(var(--spacing)*4)}.pl-8{padding-left:calc(var(--spacing)*8)}.pl-10{padding-left:calc(var(--spacing)*10)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-6{--tw-leading:calc(var(--spacing)*6);line-height:calc(var(--spacing)*6)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.text-wrap{text-wrap:wrap}.break-all{word-break:break-all}.text-clip{text-overflow:clip}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#00CED1\]{color:#00ced1}.text-\[\#07C160\]{color:#07c160}.text-\[\#07C160\]\/60{color:#07c16099}.text-\[\#07C160\]\/70{color:#07c160b3}.text-\[\#07C160\]\/80{color:#07c160cc}.text-\[\#26A17B\]{color:#26a17b}.text-\[\#38bdac\]{color:#38bdac}.text-\[\#38bdac\]\/30{color:#38bdac4d}.text-\[\#38bdac\]\/40{color:#38bdac66}.text-\[\#169BD7\]{color:#169bd7}.text-\[\#1677FF\]{color:#1677ff}.text-\[\#FFD700\]{color:gold}.text-amber-200{color:var(--color-amber-200)}.text-amber-200\/80{color:#fee685cc}@supports (color:color-mix(in lab,red,red)){.text-amber-200\/80{color:color-mix(in oklab,var(--color-amber-200)80%,transparent)}}.text-amber-300{color:var(--color-amber-300)}.text-amber-400{color:var(--color-amber-400)}.text-amber-400\/30{color:#fcbb004d}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/30{color:color-mix(in oklab,var(--color-amber-400)30%,transparent)}}.text-amber-400\/90{color:#fcbb00e6}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/90{color:color-mix(in oklab,var(--color-amber-400)90%,transparent)}}.text-black{color:var(--color-black)}.text-blue-300{color:var(--color-blue-300)}.text-blue-300\/60{color:#90c5ff99}@supports (color:color-mix(in lab,red,red)){.text-blue-300\/60{color:color-mix(in oklab,var(--color-blue-300)60%,transparent)}}.text-blue-400{color:var(--color-blue-400)}.text-blue-400\/60{color:#54a2ff99}@supports (color:color-mix(in lab,red,red)){.text-blue-400\/60{color:color-mix(in oklab,var(--color-blue-400)60%,transparent)}}.text-cyan-400{color:var(--color-cyan-400)}.text-emerald-400{color:var(--color-emerald-400)}.text-gray-200{color:var(--color-gray-200)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-green-300{color:var(--color-green-300)}.text-green-400{color:var(--color-green-400)}.text-green-400\/90{color:#05df72e6}@supports (color:color-mix(in lab,red,red)){.text-green-400\/90{color:color-mix(in oklab,var(--color-green-400)90%,transparent)}}.text-green-500{color:var(--color-green-500)}.text-orange-300{color:var(--color-orange-300)}.text-orange-300\/60{color:#ffb96d99}@supports (color:color-mix(in lab,red,red)){.text-orange-300\/60{color:color-mix(in oklab,var(--color-orange-300)60%,transparent)}}.text-orange-400{color:var(--color-orange-400)}.text-orange-400\/60{color:#ff8b1a99}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/60{color:color-mix(in oklab,var(--color-orange-400)60%,transparent)}}.text-orange-400\/70{color:#ff8b1ab3}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/70{color:color-mix(in oklab,var(--color-orange-400)70%,transparent)}}.text-orange-400\/80{color:#ff8b1acc}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/80{color:color-mix(in oklab,var(--color-orange-400)80%,transparent)}}.text-purple-400{color:var(--color-purple-400)}.text-red-400{color:var(--color-red-400)}.text-rose-400{color:var(--color-rose-400)}.text-sky-300{color:var(--color-sky-300)}.text-white{color:var(--color-white)}.text-white\/40{color:#fff6}@supports (color:color-mix(in lab,red,red)){.text-white\/40{color:color-mix(in oklab,var(--color-white)40%,transparent)}}.text-white\/60{color:#fff9}@supports (color:color-mix(in lab,red,red)){.text-white\/60{color:color-mix(in oklab,var(--color-white)60%,transparent)}}.text-white\/70{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.text-white\/70{color:color-mix(in oklab,var(--color-white)70%,transparent)}}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.text-white\/80{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.text-yellow-400{color:var(--color-yellow-400)}.text-yellow-400\/60{color:#fac80099}@supports (color:color-mix(in lab,red,red)){.text-yellow-400\/60{color:color-mix(in oklab,var(--color-yellow-400)60%,transparent)}}.text-yellow-500\/70{color:#edb200b3}@supports (color:color-mix(in lab,red,red)){.text-yellow-500\/70{color:color-mix(in oklab,var(--color-yellow-500)70%,transparent)}}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.italic\!{font-style:italic!important}.not-italic{font-style:normal}.diagonal-fractions{--tw-numeric-fraction:diagonal-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.stacked-fractions{--tw-numeric-fraction:stacked-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.normal-nums{font-variant-numeric:normal}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.overline{text-decoration-line:overline}.underline{text-decoration-line:underline}.underline\!{text-decoration-line:underline!important}.underline-offset-4{text-underline-offset:4px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.subpixel-antialiased{-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto}.accent-\[\#38bdac\]{accent-color:#38bdac}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-55{opacity:.55}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-0{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.inset-ring{--tw-inset-ring-shadow:inset 0 0 0 1px var(--tw-inset-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[\#38bdac\]\/20{--tw-shadow-color:#38bdac33}@supports (color:color-mix(in lab,red,red)){.shadow-\[\#38bdac\]\/20{--tw-shadow-color:color-mix(in oklab,oklab(72.378% -.11483 -.0053193/.2) var(--tw-shadow-alpha),transparent)}}.shadow-\[\#38bdac\]\/30{--tw-shadow-color:#38bdac4d}@supports (color:color-mix(in lab,red,red)){.shadow-\[\#38bdac\]\/30{--tw-shadow-color:color-mix(in oklab,oklab(72.378% -.11483 -.0053193/.3) var(--tw-shadow-alpha),transparent)}}.ring-\[\#38bdac\]{--tw-ring-color:#38bdac}.ring-\[\#38bdac\]\/40{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.4)}.ring-\[\#38bdac\]\/50{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.5)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.blur-3xl{--tw-blur:blur(var(--blur-3xl));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.drop-shadow{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#0000001a))drop-shadow(0 1px 1px var(--tw-drop-shadow-color,#0000000f));--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a)drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter\!{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)!important}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-grayscale{--tw-backdrop-grayscale:grayscale(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-invert{--tw-backdrop-invert:invert(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-sepia{--tw-backdrop-sepia:sepia(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition\!{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events!important;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))!important;transition-duration:var(--tw-duration,var(--default-transition-duration))!important}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}:where(.divide-x-reverse>:not(:last-child)){--tw-divide-x-reverse:1}.ring-inset{--tw-ring-inset:inset}@media(hover:hover){.group-hover\:text-\[\#38bdac\]:is(:where(.group):hover *){color:#38bdac}.group-hover\:text-gray-400:is(:where(.group):hover *){color:var(--color-gray-400)}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.peer-disabled\:cursor-not-allowed:is(:where(.peer):disabled~*){cursor:not-allowed}.peer-disabled\:opacity-70:is(:where(.peer):disabled~*){opacity:.7}.placeholder\:text-gray-500::placeholder{color:var(--color-gray-500)}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}@media(hover:hover){.hover\:border-\[\#38bdac\]\/30:hover{border-color:#38bdac4d}.hover\:border-\[\#38bdac\]\/50:hover{border-color:#38bdac80}.hover\:border-\[\#38bdac\]\/60:hover{border-color:#38bdac99}.hover\:border-\[\#38bdac\]\/70:hover{border-color:#38bdacb3}.hover\:border-blue-500\/60:hover{border-color:#3080ff99}@supports (color:color-mix(in lab,red,red)){.hover\:border-blue-500\/60:hover{border-color:color-mix(in oklab,var(--color-blue-500)60%,transparent)}}.hover\:border-gray-500:hover{border-color:var(--color-gray-500)}.hover\:border-gray-600:hover{border-color:var(--color-gray-600)}.hover\:border-orange-500\/50:hover{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.hover\:border-orange-500\/50:hover{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.hover\:border-yellow-500\/60:hover{border-color:#edb20099}@supports (color:color-mix(in lab,red,red)){.hover\:border-yellow-500\/60:hover{border-color:color-mix(in oklab,var(--color-yellow-500)60%,transparent)}}.hover\:bg-\[\#0a1628\]:hover{background-color:#0a1628}.hover\:bg-\[\#0a1628\]\/80:hover{background-color:#0a1628cc}.hover\:bg-\[\#1a3050\]:hover{background-color:#1a3050}.hover\:bg-\[\#2da396\]:hover{background-color:#2da396}.hover\:bg-\[\#06AD51\]:hover{background-color:#06ad51}.hover\:bg-\[\#07C160\]\/10:hover{background-color:#07c1601a}.hover\:bg-\[\#20B2AA\]:hover{background-color:#20b2aa}.hover\:bg-\[\#38bdac\]\/10:hover{background-color:#38bdac1a}.hover\:bg-\[\#38bdac\]\/20:hover{background-color:#38bdac33}.hover\:bg-\[\#162840\]:hover{background-color:#162840}.hover\:bg-\[\#162840\]\/30:hover{background-color:#1628404d}.hover\:bg-\[\#162840\]\/50:hover{background-color:#16284080}.hover\:bg-amber-500\/10:hover{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/10:hover{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.hover\:bg-amber-500\/20:hover{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/20:hover{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.hover\:bg-amber-500\/30:hover{background-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/30:hover{background-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.hover\:bg-amber-600:hover{background-color:var(--color-amber-600)}.hover\:bg-amber-900\/30:hover{background-color:#7b33064d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-900\/30:hover{background-color:color-mix(in oklab,var(--color-amber-900)30%,transparent)}}.hover\:bg-blue-400\/10:hover{background-color:#54a2ff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-400\/10:hover{background-color:color-mix(in oklab,var(--color-blue-400)10%,transparent)}}.hover\:bg-blue-500\/20:hover{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-500\/20:hover{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.hover\:bg-gray-500:hover{background-color:var(--color-gray-500)}.hover\:bg-gray-500\/20:hover{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-500\/20:hover{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.hover\:bg-gray-700:hover{background-color:var(--color-gray-700)}.hover\:bg-gray-700\/50:hover{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-700\/50:hover{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.hover\:bg-gray-800:hover{background-color:var(--color-gray-800)}.hover\:bg-green-500\/20:hover{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.hover\:bg-green-500\/20:hover{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.hover\:bg-green-700:hover{background-color:var(--color-green-700)}.hover\:bg-orange-400\/10:hover{background-color:#ff8b1a1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-400\/10:hover{background-color:color-mix(in oklab,var(--color-orange-400)10%,transparent)}}.hover\:bg-orange-500\/10:hover{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/10:hover{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.hover\:bg-orange-500\/20:hover{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/20:hover{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.hover\:bg-orange-600:hover{background-color:var(--color-orange-600)}.hover\:bg-purple-500\/10:hover{background-color:#ac4bff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/10:hover{background-color:color-mix(in oklab,var(--color-purple-500)10%,transparent)}}.hover\:bg-purple-500\/20:hover{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/20:hover{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.hover\:bg-purple-500\/30:hover{background-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/30:hover{background-color:color-mix(in oklab,var(--color-purple-500)30%,transparent)}}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.hover\:bg-red-500\/20:hover{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/20:hover{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.hover\:bg-red-700:hover{background-color:var(--color-red-700)}.hover\:bg-white\/5:hover{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/5:hover{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.hover\:bg-white\/20:hover{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/20:hover{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.hover\:bg-yellow-500\/20:hover{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-500\/20:hover{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.hover\:bg-yellow-500\/30:hover{background-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-500\/30:hover{background-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.hover\:text-\[\#2da396\]:hover{color:#2da396}.hover\:text-\[\#5fe0cd\]:hover{color:#5fe0cd}.hover\:text-\[\#38bdac\]:hover{color:#38bdac}.hover\:text-amber-200:hover{color:var(--color-amber-200)}.hover\:text-amber-300:hover{color:var(--color-amber-300)}.hover\:text-amber-400:hover{color:var(--color-amber-400)}.hover\:text-blue-300:hover{color:var(--color-blue-300)}.hover\:text-blue-400:hover{color:var(--color-blue-400)}.hover\:text-gray-300:hover{color:var(--color-gray-300)}.hover\:text-green-400:hover{color:var(--color-green-400)}.hover\:text-orange-400:hover{color:var(--color-orange-400)}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:text-sky-200:hover{color:var(--color-sky-200)}.hover\:text-white:hover{color:var(--color-white)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}}.focus\:border-\[\#38bdac\]:focus{border-color:#38bdac}.focus\:border-orange-500\/50:focus{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.focus\:border-orange-500\/50:focus{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.focus\:bg-\[\#38bdac\]\/20:focus{background-color:#38bdac33}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-\[\#38bdac\]:focus{--tw-ring-color:#38bdac}.focus\:ring-amber-400:focus{--tw-ring-color:var(--color-amber-400)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:ring-0:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[3px\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[\#38bdac\]:focus-visible{--tw-ring-color:#38bdac}.focus-visible\:ring-red-500:focus-visible{--tw-ring-color:var(--color-red-500)}.focus-visible\:ring-offset-0:focus-visible{--tw-ring-offset-width:0px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus-visible\:ring-offset-\[\#0a1628\]:focus-visible{--tw-ring-offset-color:#0a1628}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.has-\[\>svg\]\:px-2\.5:has(>svg){padding-inline:calc(var(--spacing)*2.5)}.has-\[\>svg\]\:px-3:has(>svg){padding-inline:calc(var(--spacing)*3)}.has-\[\>svg\]\:px-4:has(>svg){padding-inline:calc(var(--spacing)*4)}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:calc(var(--spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=active\]\:bg-\[\#07C160\]\/20[data-state=active]{background-color:#07c16033}.data-\[state\=active\]\:bg-\[\#26A17B\]\/20[data-state=active]{background-color:#26a17b33}.data-\[state\=active\]\:bg-\[\#38bdac\]\/20[data-state=active]{background-color:#38bdac33}.data-\[state\=active\]\:bg-\[\#1677FF\]\/20[data-state=active]{background-color:#1677ff33}.data-\[state\=active\]\:bg-\[\#003087\]\/20[data-state=active]{background-color:#00308733}.data-\[state\=active\]\:bg-amber-500\/20[data-state=active]{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.data-\[state\=active\]\:bg-amber-500\/20[data-state=active]{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.data-\[state\=active\]\:bg-purple-500\/20[data-state=active]{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.data-\[state\=active\]\:bg-purple-500\/20[data-state=active]{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.data-\[state\=active\]\:font-medium[data-state=active]{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.data-\[state\=active\]\:text-\[\#07C160\][data-state=active]{color:#07c160}.data-\[state\=active\]\:text-\[\#26A17B\][data-state=active]{color:#26a17b}.data-\[state\=active\]\:text-\[\#38bdac\][data-state=active]{color:#38bdac}.data-\[state\=active\]\:text-\[\#169BD7\][data-state=active]{color:#169bd7}.data-\[state\=active\]\:text-\[\#1677FF\][data-state=active]{color:#1677ff}.data-\[state\=active\]\:text-amber-400[data-state=active]{color:var(--color-amber-400)}.data-\[state\=active\]\:text-purple-400[data-state=active]{color:var(--color-purple-400)}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x:calc(var(--spacing)*4);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=checked\]\:bg-\[\#38bdac\][data-state=checked]{background-color:#38bdac}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=unchecked\]\:bg-gray-600[data-state=unchecked]{background-color:var(--color-gray-600)}@media(min-width:40rem){.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.sm\:text-left{text-align:left}}@media(min-width:48rem){.md\:col-span-2{grid-column:span 2/span 2}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@media(min-width:64rem){.lg\:block{display:block}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}@media(min-width:80rem){.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.\[\&_tr\]\:border-b tr{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-style:var(--tw-border-style);border-width:0}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:calc(var(--spacing)*0)}.\[\&\>span\]\:line-clamp-1>span{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}}:root{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20% .02 240);--card-foreground:oklch(98.5% 0 0);--popover:oklch(20% .02 240);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(65% .15 180);--primary-foreground:oklch(20% 0 0);--secondary:oklch(27% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(27% 0 0);--muted-foreground:oklch(65% 0 0);--accent:oklch(27% 0 0);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(55% .2 25);--destructive-foreground:oklch(98.5% 0 0);--border:oklch(35% 0 0);--input:oklch(35% 0 0);--ring:oklch(65% .15 180);--radius:.625rem}body{font-family:var(--font-sans);color:var(--foreground);background:#0a1628}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-pan-x{syntax:"*";inherits:false}@property --tw-pan-y{syntax:"*";inherits:false}@property --tw-pinch-zoom{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}} diff --git a/soul-admin/dist/assets/index-Dr1oX1ee.js b/soul-admin/dist/assets/index-DxdnfQve.js similarity index 96% rename from soul-admin/dist/assets/index-Dr1oX1ee.js rename to soul-admin/dist/assets/index-DxdnfQve.js index 2c126b5a..556ecac8 100644 --- a/soul-admin/dist/assets/index-Dr1oX1ee.js +++ b/soul-admin/dist/assets/index-DxdnfQve.js @@ -34,10 +34,10 @@ function xE(t,e){for(var n=0;nH||j[M]!==S[H]){var J=` -`+j[M].replace(" at new "," at ");return l.displayName&&J.includes("")&&(J=J.replace("",l.displayName)),J}while(1<=M&&0<=H);break}}}finally{K=!1,Error.prepareStackTrace=p}return(l=l?l.displayName||l.name:"")?W(l):""}function oe(l){switch(l.tag){case 5:return W(l.type);case 16:return W("Lazy");case 13:return W("Suspense");case 19:return W("SuspenseList");case 0:case 2:case 15:return l=B(l.type,!1),l;case 11:return l=B(l.type.render,!1),l;case 1:return l=B(l.type,!0),l;default:return""}}function G(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case _:return"Fragment";case D:return"Portal";case L:return"Profiler";case P:return"StrictMode";case he:return"Suspense";case me:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case ee:return(l.displayName||"Context")+".Consumer";case z:return(l._context.displayName||"Context")+".Provider";case U:var d=l.render;return l=l.displayName,l||(l=d.displayName||d.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case R:return d=l.displayName||null,d!==null?d:G(l.type)||"Memo";case O:d=l._payload,l=l._init;try{return G(l(d))}catch{}}return null}function Q(l){var d=l.type;switch(l.tag){case 24:return"Cache";case 9:return(d.displayName||"Context")+".Consumer";case 10:return(d._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=d.render,l=l.displayName||l.name||"",d.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return d;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return G(d);case 8:return d===P?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d}return null}function se(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function ye(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function Me(l){var d=ye(l)?"checked":"value",p=Object.getOwnPropertyDescriptor(l.constructor.prototype,d),x=""+l[d];if(!l.hasOwnProperty(d)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var j=p.get,S=p.set;return Object.defineProperty(l,d,{configurable:!0,get:function(){return j.call(this)},set:function(M){x=""+M,S.call(this,M)}}),Object.defineProperty(l,d,{enumerable:p.enumerable}),{getValue:function(){return x},setValue:function(M){x=""+M},stopTracking:function(){l._valueTracker=null,delete l[d]}}}}function Be(l){l._valueTracker||(l._valueTracker=Me(l))}function He(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var p=d.getValue(),x="";return l&&(x=ye(l)?l.checked?"true":"false":l.value),l=x,l!==p?(d.setValue(l),!0):!1}function gt(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}function Dt(l,d){var p=d.checked;return Y({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??l._wrapperState.initialChecked})}function jn(l,d){var p=d.defaultValue==null?"":d.defaultValue,x=d.checked!=null?d.checked:d.defaultChecked;p=se(d.value!=null?d.value:p),l._wrapperState={initialChecked:x,initialValue:p,controlled:d.type==="checkbox"||d.type==="radio"?d.checked!=null:d.value!=null}}function it(l,d){d=d.checked,d!=null&&E(l,"checked",d,!1)}function Mt(l,d){it(l,d);var p=se(d.value),x=d.type;if(p!=null)x==="number"?(p===0&&l.value===""||l.value!=p)&&(l.value=""+p):l.value!==""+p&&(l.value=""+p);else if(x==="submit"||x==="reset"){l.removeAttribute("value");return}d.hasOwnProperty("value")?Pe(l,d.type,p):d.hasOwnProperty("defaultValue")&&Pe(l,d.type,se(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(l.defaultChecked=!!d.defaultChecked)}function re(l,d,p){if(d.hasOwnProperty("value")||d.hasOwnProperty("defaultValue")){var x=d.type;if(!(x!=="submit"&&x!=="reset"||d.value!==void 0&&d.value!==null))return;d=""+l._wrapperState.initialValue,p||d===l.value||(l.value=d),l.defaultValue=d}p=l.name,p!==""&&(l.name=""),l.defaultChecked=!!l._wrapperState.initialChecked,p!==""&&(l.name=p)}function Pe(l,d,p){(d!=="number"||gt(l.ownerDocument)!==l)&&(p==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+p&&(l.defaultValue=""+p))}var et=Array.isArray;function xt(l,d,p,x){if(l=l.options,d){d={};for(var j=0;j"+d.valueOf().toString()+"",d=At.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;d.firstChild;)l.appendChild(d.firstChild)}});function ns(l,d){if(d){var p=l.firstChild;if(p&&p===l.lastChild&&p.nodeType===3){p.nodeValue=d;return}}l.textContent=d}var or={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},ge=["Webkit","ms","Moz","O"];Object.keys(or).forEach(function(l){ge.forEach(function(d){d=d+l.charAt(0).toUpperCase()+l.substring(1),or[d]=or[l]})});function Ne(l,d,p){return d==null||typeof d=="boolean"||d===""?"":p||typeof d!="number"||d===0||or.hasOwnProperty(l)&&or[l]?(""+d).trim():d+"px"}function qn(l,d){l=l.style;for(var p in d)if(d.hasOwnProperty(p)){var x=p.indexOf("--")===0,j=Ne(p,d[p],x);p==="float"&&(p="cssFloat"),x?l.setProperty(p,j):l[p]=j}}var Es=Y({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ts(l,d){if(d){if(Es[l]&&(d.children!=null||d.dangerouslySetInnerHTML!=null))throw Error(n(137,l));if(d.dangerouslySetInnerHTML!=null){if(d.children!=null)throw Error(n(60));if(typeof d.dangerouslySetInnerHTML!="object"||!("__html"in d.dangerouslySetInnerHTML))throw Error(n(61))}if(d.style!=null&&typeof d.style!="object")throw Error(n(62))}}function Pa(l,d){if(l.indexOf("-")===-1)return typeof d.is=="string";switch(l){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var br=null;function Vi(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var vr=null,lr=null,Ms=null;function Oa(l){if(l=xc(l)){if(typeof vr!="function")throw Error(n(280));var d=l.stateNode;d&&(d=Ud(d),vr(l.stateNode,l.type,d))}}function Hi(l){lr?Ms?Ms.push(l):Ms=[l]:lr=l}function Xs(){if(lr){var l=lr,d=Ms;if(Ms=lr=null,Oa(l),d)for(l=0;l>>=0,l===0?32:31-(Wo(l)/Fa|0)|0}var Rs=64,Ps=4194304;function Os(l){switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function Ds(l,d){var p=l.pendingLanes;if(p===0)return 0;var x=0,j=l.suspendedLanes,S=l.pingedLanes,M=p&268435455;if(M!==0){var H=M&~j;H!==0?x=Os(H):(S&=M,S!==0&&(x=Os(S)))}else M=p&~j,M!==0?x=Os(M):S!==0&&(x=Os(S));if(x===0)return 0;if(d!==0&&d!==x&&(d&j)===0&&(j=x&-x,S=d&-d,j>=S||j===16&&(S&4194240)!==0))return d;if((x&4)!==0&&(x|=p&16),d=l.entangledLanes,d!==0)for(l=l.entanglements,d&=x;0p;p++)d.push(l);return d}function kn(l,d,p){l.pendingLanes|=d,d!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,d=31-$n(d),l[d]=p}function Uo(l,d){var p=l.pendingLanes&~d;l.pendingLanes=d,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=d,l.mutableReadLanes&=d,l.entangledLanes&=d,d=l.entanglements;var x=l.eventTimes;for(l=l.expirationTimes;0=lc),py=" ",my=!1;function gy(l,d){switch(l){case"keyup":return h3.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xy(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var Yo=!1;function p3(l,d){switch(l){case"compositionend":return xy(d);case"keypress":return d.which!==32?null:(my=!0,py);case"textInput":return l=d.data,l===py&&my?null:l;default:return null}}function m3(l,d){if(Yo)return l==="compositionend"||!rp&&gy(l,d)?(l=ly(),Od=Qf=Wa=null,Yo=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1=d)return{node:p,offset:d-l};l=x}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=ky(p)}}function Cy(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?Cy(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function Ey(){for(var l=window,d=gt();d instanceof l.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)l=d.contentWindow;else break;d=gt(l.document)}return d}function ip(l){var d=l&&l.nodeName&&l.nodeName.toLowerCase();return d&&(d==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||d==="textarea"||l.contentEditable==="true")}function k3(l){var d=Ey(),p=l.focusedElem,x=l.selectionRange;if(d!==p&&p&&p.ownerDocument&&Cy(p.ownerDocument.documentElement,p)){if(x!==null&&ip(p)){if(d=x.start,l=x.end,l===void 0&&(l=d),"selectionStart"in p)p.selectionStart=d,p.selectionEnd=Math.min(l,p.value.length);else if(l=(d=p.ownerDocument||document)&&d.defaultView||window,l.getSelection){l=l.getSelection();var j=p.textContent.length,S=Math.min(x.start,j);x=x.end===void 0?S:Math.min(x.end,j),!l.extend&&S>x&&(j=x,x=S,S=j),j=Sy(p,S);var M=Sy(p,x);j&&M&&(l.rangeCount!==1||l.anchorNode!==j.node||l.anchorOffset!==j.offset||l.focusNode!==M.node||l.focusOffset!==M.offset)&&(d=d.createRange(),d.setStart(j.node,j.offset),l.removeAllRanges(),S>x?(l.addRange(d),l.extend(M.node,M.offset)):(d.setEnd(M.node,M.offset),l.addRange(d)))}}for(d=[],l=p;l=l.parentNode;)l.nodeType===1&&d.push({element:l,left:l.scrollLeft,top:l.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p=document.documentMode,Qo=null,op=null,hc=null,lp=!1;function Ty(l,d,p){var x=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;lp||Qo==null||Qo!==gt(x)||(x=Qo,"selectionStart"in x&&ip(x)?x={start:x.selectionStart,end:x.selectionEnd}:(x=(x.ownerDocument&&x.ownerDocument.defaultView||window).getSelection(),x={anchorNode:x.anchorNode,anchorOffset:x.anchorOffset,focusNode:x.focusNode,focusOffset:x.focusOffset}),hc&&uc(hc,x)||(hc=x,x=Vd(op,"onSelect"),0nl||(l.current=vp[nl],vp[nl]=null,nl--)}function _t(l,d){nl++,vp[nl]=l.current,l.current=d}var Ga={},Yn=qa(Ga),wr=qa(!1),Xi=Ga;function rl(l,d){var p=l.type.contextTypes;if(!p)return Ga;var x=l.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===d)return x.__reactInternalMemoizedMaskedChildContext;var j={},S;for(S in p)j[S]=d[S];return x&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=d,l.__reactInternalMemoizedMaskedChildContext=j),j}function jr(l){return l=l.childContextTypes,l!=null}function Kd(){qt(wr),qt(Yn)}function Hy(l,d,p){if(Yn.current!==Ga)throw Error(n(168));_t(Yn,d),_t(wr,p)}function Wy(l,d,p){var x=l.stateNode;if(d=d.childContextTypes,typeof x.getChildContext!="function")return p;x=x.getChildContext();for(var j in x)if(!(j in d))throw Error(n(108,Q(l)||"Unknown",j));return Y({},p,x)}function qd(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||Ga,Xi=Yn.current,_t(Yn,l),_t(wr,wr.current),!0}function Uy(l,d,p){var x=l.stateNode;if(!x)throw Error(n(169));p?(l=Wy(l,d,Xi),x.__reactInternalMemoizedMergedChildContext=l,qt(wr),qt(Yn),_t(Yn,l)):qt(wr),_t(wr,p)}var ia=null,Gd=!1,Np=!1;function Ky(l){ia===null?ia=[l]:ia.push(l)}function L3(l){Gd=!0,Ky(l)}function Ja(){if(!Np&&ia!==null){Np=!0;var l=0,d=st;try{var p=ia;for(st=1;l>=M,j-=M,oa=1<<32-$n(d)+j|p<rt?(On=Ze,Ze=null):On=Ze.sibling;var bt=ve(ae,Ze,de[rt],Ie);if(bt===null){Ze===null&&(Ze=On);break}l&&Ze&&bt.alternate===null&&d(ae,Ze),Z=S(bt,Z,rt),Xe===null?Ve=bt:Xe.sibling=bt,Xe=bt,Ze=On}if(rt===de.length)return p(ae,Ze),Jt&&eo(ae,rt),Ve;if(Ze===null){for(;rtrt?(On=Ze,Ze=null):On=Ze.sibling;var si=ve(ae,Ze,bt.value,Ie);if(si===null){Ze===null&&(Ze=On);break}l&&Ze&&si.alternate===null&&d(ae,Ze),Z=S(si,Z,rt),Xe===null?Ve=si:Xe.sibling=si,Xe=si,Ze=On}if(bt.done)return p(ae,Ze),Jt&&eo(ae,rt),Ve;if(Ze===null){for(;!bt.done;rt++,bt=de.next())bt=je(ae,bt.value,Ie),bt!==null&&(Z=S(bt,Z,rt),Xe===null?Ve=bt:Xe.sibling=bt,Xe=bt);return Jt&&eo(ae,rt),Ve}for(Ze=x(ae,Ze);!bt.done;rt++,bt=de.next())bt=Oe(Ze,ae,rt,bt.value,Ie),bt!==null&&(l&&bt.alternate!==null&&Ze.delete(bt.key===null?rt:bt.key),Z=S(bt,Z,rt),Xe===null?Ve=bt:Xe.sibling=bt,Xe=bt);return l&&Ze.forEach(function(gE){return d(ae,gE)}),Jt&&eo(ae,rt),Ve}function fn(ae,Z,de,Ie){if(typeof de=="object"&&de!==null&&de.type===_&&de.key===null&&(de=de.props.children),typeof de=="object"&&de!==null){switch(de.$$typeof){case I:e:{for(var Ve=de.key,Xe=Z;Xe!==null;){if(Xe.key===Ve){if(Ve=de.type,Ve===_){if(Xe.tag===7){p(ae,Xe.sibling),Z=j(Xe,de.props.children),Z.return=ae,ae=Z;break e}}else if(Xe.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===O&&Xy(Ve)===Xe.type){p(ae,Xe.sibling),Z=j(Xe,de.props),Z.ref=yc(ae,Xe,de),Z.return=ae,ae=Z;break e}p(ae,Xe);break}else d(ae,Xe);Xe=Xe.sibling}de.type===_?(Z=lo(de.props.children,ae.mode,Ie,de.key),Z.return=ae,ae=Z):(Ie=wu(de.type,de.key,de.props,null,ae.mode,Ie),Ie.ref=yc(ae,Z,de),Ie.return=ae,ae=Ie)}return M(ae);case D:e:{for(Xe=de.key;Z!==null;){if(Z.key===Xe)if(Z.tag===4&&Z.stateNode.containerInfo===de.containerInfo&&Z.stateNode.implementation===de.implementation){p(ae,Z.sibling),Z=j(Z,de.children||[]),Z.return=ae,ae=Z;break e}else{p(ae,Z);break}else d(ae,Z);Z=Z.sibling}Z=ym(de,ae.mode,Ie),Z.return=ae,ae=Z}return M(ae);case O:return Xe=de._init,fn(ae,Z,Xe(de._payload),Ie)}if(et(de))return _e(ae,Z,de,Ie);if(ce(de))return Fe(ae,Z,de,Ie);Xd(ae,de)}return typeof de=="string"&&de!==""||typeof de=="number"?(de=""+de,Z!==null&&Z.tag===6?(p(ae,Z.sibling),Z=j(Z,de),Z.return=ae,ae=Z):(p(ae,Z),Z=xm(de,ae.mode,Ie),Z.return=ae,ae=Z),M(ae)):p(ae,Z)}return fn}var ol=Zy(!0),eb=Zy(!1),Zd=qa(null),eu=null,ll=null,Ep=null;function Tp(){Ep=ll=eu=null}function Mp(l){var d=Zd.current;qt(Zd),l._currentValue=d}function Ap(l,d,p){for(;l!==null;){var x=l.alternate;if((l.childLanes&d)!==d?(l.childLanes|=d,x!==null&&(x.childLanes|=d)):x!==null&&(x.childLanes&d)!==d&&(x.childLanes|=d),l===p)break;l=l.return}}function cl(l,d){eu=l,Ep=ll=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(kr=!0),l.firstContext=null)}function Ur(l){var d=l._currentValue;if(Ep!==l)if(l={context:l,memoizedValue:d,next:null},ll===null){if(eu===null)throw Error(n(308));ll=l,eu.dependencies={lanes:0,firstContext:l}}else ll=ll.next=l;return d}var to=null;function Ip(l){to===null?to=[l]:to.push(l)}function tb(l,d,p,x){var j=d.interleaved;return j===null?(p.next=p,Ip(d)):(p.next=j.next,j.next=p),d.interleaved=p,ca(l,x)}function ca(l,d){l.lanes|=d;var p=l.alternate;for(p!==null&&(p.lanes|=d),p=l,l=l.return;l!==null;)l.childLanes|=d,p=l.alternate,p!==null&&(p.childLanes|=d),p=l,l=l.return;return p.tag===3?p.stateNode:null}var Ya=!1;function Rp(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function nb(l,d){l=l.updateQueue,d.updateQueue===l&&(d.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function da(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function Qa(l,d,p){var x=l.updateQueue;if(x===null)return null;if(x=x.shared,(mt&2)!==0){var j=x.pending;return j===null?d.next=d:(d.next=j.next,j.next=d),x.pending=d,ca(l,p)}return j=x.interleaved,j===null?(d.next=d,Ip(x)):(d.next=j.next,j.next=d),x.interleaved=d,ca(l,p)}function tu(l,d,p){if(d=d.updateQueue,d!==null&&(d=d.shared,(p&4194240)!==0)){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,Xt(l,p)}}function rb(l,d){var p=l.updateQueue,x=l.alternate;if(x!==null&&(x=x.updateQueue,p===x)){var j=null,S=null;if(p=p.firstBaseUpdate,p!==null){do{var M={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};S===null?j=S=M:S=S.next=M,p=p.next}while(p!==null);S===null?j=S=d:S=S.next=d}else j=S=d;p={baseState:x.baseState,firstBaseUpdate:j,lastBaseUpdate:S,shared:x.shared,effects:x.effects},l.updateQueue=p;return}l=p.lastBaseUpdate,l===null?p.firstBaseUpdate=d:l.next=d,p.lastBaseUpdate=d}function nu(l,d,p,x){var j=l.updateQueue;Ya=!1;var S=j.firstBaseUpdate,M=j.lastBaseUpdate,H=j.shared.pending;if(H!==null){j.shared.pending=null;var J=H,pe=J.next;J.next=null,M===null?S=pe:M.next=pe,M=J;var we=l.alternate;we!==null&&(we=we.updateQueue,H=we.lastBaseUpdate,H!==M&&(H===null?we.firstBaseUpdate=pe:H.next=pe,we.lastBaseUpdate=J))}if(S!==null){var je=j.baseState;M=0,we=pe=J=null,H=S;do{var ve=H.lane,Oe=H.eventTime;if((x&ve)===ve){we!==null&&(we=we.next={eventTime:Oe,lane:0,tag:H.tag,payload:H.payload,callback:H.callback,next:null});e:{var _e=l,Fe=H;switch(ve=d,Oe=p,Fe.tag){case 1:if(_e=Fe.payload,typeof _e=="function"){je=_e.call(Oe,je,ve);break e}je=_e;break e;case 3:_e.flags=_e.flags&-65537|128;case 0:if(_e=Fe.payload,ve=typeof _e=="function"?_e.call(Oe,je,ve):_e,ve==null)break e;je=Y({},je,ve);break e;case 2:Ya=!0}}H.callback!==null&&H.lane!==0&&(l.flags|=64,ve=j.effects,ve===null?j.effects=[H]:ve.push(H))}else Oe={eventTime:Oe,lane:ve,tag:H.tag,payload:H.payload,callback:H.callback,next:null},we===null?(pe=we=Oe,J=je):we=we.next=Oe,M|=ve;if(H=H.next,H===null){if(H=j.shared.pending,H===null)break;ve=H,H=ve.next,ve.next=null,j.lastBaseUpdate=ve,j.shared.pending=null}}while(!0);if(we===null&&(J=je),j.baseState=J,j.firstBaseUpdate=pe,j.lastBaseUpdate=we,d=j.shared.interleaved,d!==null){j=d;do M|=j.lane,j=j.next;while(j!==d)}else S===null&&(j.shared.lanes=0);so|=M,l.lanes=M,l.memoizedState=je}}function sb(l,d,p){if(l=d.effects,d.effects=null,l!==null)for(d=0;dp?p:4,l(!0);var x=_p.transition;_p.transition={};try{l(!1),d()}finally{st=p,_p.transition=x}}function jb(){return Kr().memoizedState}function F3(l,d,p){var x=ti(l);if(p={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null},kb(l))Sb(d,p);else if(p=tb(l,d,p,x),p!==null){var j=hr();xs(p,l,x,j),Cb(p,d,x)}}function B3(l,d,p){var x=ti(l),j={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null};if(kb(l))Sb(d,j);else{var S=l.alternate;if(l.lanes===0&&(S===null||S.lanes===0)&&(S=d.lastRenderedReducer,S!==null))try{var M=d.lastRenderedState,H=S(M,p);if(j.hasEagerState=!0,j.eagerState=H,hs(H,M)){var J=d.interleaved;J===null?(j.next=j,Ip(d)):(j.next=J.next,J.next=j),d.interleaved=j;return}}catch{}finally{}p=tb(l,d,j,x),p!==null&&(j=hr(),xs(p,l,x,j),Cb(p,d,x))}}function kb(l){var d=l.alternate;return l===en||d!==null&&d===en}function Sb(l,d){wc=au=!0;var p=l.pending;p===null?d.next=d:(d.next=p.next,p.next=d),l.pending=d}function Cb(l,d,p){if((p&4194240)!==0){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,Xt(l,p)}}var lu={readContext:Ur,useCallback:Qn,useContext:Qn,useEffect:Qn,useImperativeHandle:Qn,useInsertionEffect:Qn,useLayoutEffect:Qn,useMemo:Qn,useReducer:Qn,useRef:Qn,useState:Qn,useDebugValue:Qn,useDeferredValue:Qn,useTransition:Qn,useMutableSource:Qn,useSyncExternalStore:Qn,useId:Qn,unstable_isNewReconciler:!1},V3={readContext:Ur,useCallback:function(l,d){return $s().memoizedState=[l,d===void 0?null:d],l},useContext:Ur,useEffect:mb,useImperativeHandle:function(l,d,p){return p=p!=null?p.concat([l]):null,iu(4194308,4,yb.bind(null,d,l),p)},useLayoutEffect:function(l,d){return iu(4194308,4,l,d)},useInsertionEffect:function(l,d){return iu(4,2,l,d)},useMemo:function(l,d){var p=$s();return d=d===void 0?null:d,l=l(),p.memoizedState=[l,d],l},useReducer:function(l,d,p){var x=$s();return d=p!==void 0?p(d):d,x.memoizedState=x.baseState=d,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:d},x.queue=l,l=l.dispatch=F3.bind(null,en,l),[x.memoizedState,l]},useRef:function(l){var d=$s();return l={current:l},d.memoizedState=l},useState:fb,useDebugValue:Wp,useDeferredValue:function(l){return $s().memoizedState=l},useTransition:function(){var l=fb(!1),d=l[0];return l=$3.bind(null,l[1]),$s().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,p){var x=en,j=$s();if(Jt){if(p===void 0)throw Error(n(407));p=p()}else{if(p=d(),Pn===null)throw Error(n(349));(ro&30)!==0||lb(x,d,p)}j.memoizedState=p;var S={value:p,getSnapshot:d};return j.queue=S,mb(db.bind(null,x,S,l),[l]),x.flags|=2048,Sc(9,cb.bind(null,x,S,p,d),void 0,null),p},useId:function(){var l=$s(),d=Pn.identifierPrefix;if(Jt){var p=la,x=oa;p=(x&~(1<<32-$n(x)-1)).toString(32)+p,d=":"+d+"R"+p,p=jc++,0")&&(J=J.replace("",l.displayName)),J}while(1<=M&&0<=H);break}}}finally{K=!1,Error.prepareStackTrace=p}return(l=l?l.displayName||l.name:"")?W(l):""}function oe(l){switch(l.tag){case 5:return W(l.type);case 16:return W("Lazy");case 13:return W("Suspense");case 19:return W("SuspenseList");case 0:case 2:case 15:return l=B(l.type,!1),l;case 11:return l=B(l.type.render,!1),l;case 1:return l=B(l.type,!0),l;default:return""}}function G(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case _:return"Fragment";case D:return"Portal";case L:return"Profiler";case P:return"StrictMode";case he:return"Suspense";case me:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case ee:return(l.displayName||"Context")+".Consumer";case z:return(l._context.displayName||"Context")+".Provider";case U:var d=l.render;return l=l.displayName,l||(l=d.displayName||d.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case R:return d=l.displayName||null,d!==null?d:G(l.type)||"Memo";case O:d=l._payload,l=l._init;try{return G(l(d))}catch{}}return null}function Q(l){var d=l.type;switch(l.tag){case 24:return"Cache";case 9:return(d.displayName||"Context")+".Consumer";case 10:return(d._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=d.render,l=l.displayName||l.name||"",d.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return d;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return G(d);case 8:return d===P?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d}return null}function se(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function ye(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function Me(l){var d=ye(l)?"checked":"value",p=Object.getOwnPropertyDescriptor(l.constructor.prototype,d),x=""+l[d];if(!l.hasOwnProperty(d)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var j=p.get,S=p.set;return Object.defineProperty(l,d,{configurable:!0,get:function(){return j.call(this)},set:function(M){x=""+M,S.call(this,M)}}),Object.defineProperty(l,d,{enumerable:p.enumerable}),{getValue:function(){return x},setValue:function(M){x=""+M},stopTracking:function(){l._valueTracker=null,delete l[d]}}}}function Be(l){l._valueTracker||(l._valueTracker=Me(l))}function He(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var p=d.getValue(),x="";return l&&(x=ye(l)?l.checked?"true":"false":l.value),l=x,l!==p?(d.setValue(l),!0):!1}function gt(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}function Dt(l,d){var p=d.checked;return Y({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??l._wrapperState.initialChecked})}function jn(l,d){var p=d.defaultValue==null?"":d.defaultValue,x=d.checked!=null?d.checked:d.defaultChecked;p=se(d.value!=null?d.value:p),l._wrapperState={initialChecked:x,initialValue:p,controlled:d.type==="checkbox"||d.type==="radio"?d.checked!=null:d.value!=null}}function it(l,d){d=d.checked,d!=null&&E(l,"checked",d,!1)}function Mt(l,d){it(l,d);var p=se(d.value),x=d.type;if(p!=null)x==="number"?(p===0&&l.value===""||l.value!=p)&&(l.value=""+p):l.value!==""+p&&(l.value=""+p);else if(x==="submit"||x==="reset"){l.removeAttribute("value");return}d.hasOwnProperty("value")?Pe(l,d.type,p):d.hasOwnProperty("defaultValue")&&Pe(l,d.type,se(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(l.defaultChecked=!!d.defaultChecked)}function re(l,d,p){if(d.hasOwnProperty("value")||d.hasOwnProperty("defaultValue")){var x=d.type;if(!(x!=="submit"&&x!=="reset"||d.value!==void 0&&d.value!==null))return;d=""+l._wrapperState.initialValue,p||d===l.value||(l.value=d),l.defaultValue=d}p=l.name,p!==""&&(l.name=""),l.defaultChecked=!!l._wrapperState.initialChecked,p!==""&&(l.name=p)}function Pe(l,d,p){(d!=="number"||gt(l.ownerDocument)!==l)&&(p==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+p&&(l.defaultValue=""+p))}var et=Array.isArray;function xt(l,d,p,x){if(l=l.options,d){d={};for(var j=0;j"+d.valueOf().toString()+"",d=At.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;d.firstChild;)l.appendChild(d.firstChild)}});function rs(l,d){if(d){var p=l.firstChild;if(p&&p===l.lastChild&&p.nodeType===3){p.nodeValue=d;return}}l.textContent=d}var or={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},ge=["Webkit","ms","Moz","O"];Object.keys(or).forEach(function(l){ge.forEach(function(d){d=d+l.charAt(0).toUpperCase()+l.substring(1),or[d]=or[l]})});function Ne(l,d,p){return d==null||typeof d=="boolean"||d===""?"":p||typeof d!="number"||d===0||or.hasOwnProperty(l)&&or[l]?(""+d).trim():d+"px"}function qn(l,d){l=l.style;for(var p in d)if(d.hasOwnProperty(p)){var x=p.indexOf("--")===0,j=Ne(p,d[p],x);p==="float"&&(p="cssFloat"),x?l.setProperty(p,j):l[p]=j}}var Es=Y({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ts(l,d){if(d){if(Es[l]&&(d.children!=null||d.dangerouslySetInnerHTML!=null))throw Error(n(137,l));if(d.dangerouslySetInnerHTML!=null){if(d.children!=null)throw Error(n(60));if(typeof d.dangerouslySetInnerHTML!="object"||!("__html"in d.dangerouslySetInnerHTML))throw Error(n(61))}if(d.style!=null&&typeof d.style!="object")throw Error(n(62))}}function Pa(l,d){if(l.indexOf("-")===-1)return typeof d.is=="string";switch(l){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var br=null;function Vi(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var vr=null,lr=null,Ms=null;function Oa(l){if(l=xc(l)){if(typeof vr!="function")throw Error(n(280));var d=l.stateNode;d&&(d=Ud(d),vr(l.stateNode,l.type,d))}}function Hi(l){lr?Ms?Ms.push(l):Ms=[l]:lr=l}function Xs(){if(lr){var l=lr,d=Ms;if(Ms=lr=null,Oa(l),d)for(l=0;l>>=0,l===0?32:31-(Wo(l)/Fa|0)|0}var Rs=64,Ps=4194304;function Os(l){switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function Ds(l,d){var p=l.pendingLanes;if(p===0)return 0;var x=0,j=l.suspendedLanes,S=l.pingedLanes,M=p&268435455;if(M!==0){var H=M&~j;H!==0?x=Os(H):(S&=M,S!==0&&(x=Os(S)))}else M=p&~j,M!==0?x=Os(M):S!==0&&(x=Os(S));if(x===0)return 0;if(d!==0&&d!==x&&(d&j)===0&&(j=x&-x,S=d&-d,j>=S||j===16&&(S&4194240)!==0))return d;if((x&4)!==0&&(x|=p&16),d=l.entangledLanes,d!==0)for(l=l.entanglements,d&=x;0p;p++)d.push(l);return d}function kn(l,d,p){l.pendingLanes|=d,d!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,d=31-$n(d),l[d]=p}function Uo(l,d){var p=l.pendingLanes&~d;l.pendingLanes=d,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=d,l.mutableReadLanes&=d,l.entangledLanes&=d,d=l.entanglements;var x=l.eventTimes;for(l=l.expirationTimes;0=lc),py=" ",my=!1;function gy(l,d){switch(l){case"keyup":return h3.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xy(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var Yo=!1;function p3(l,d){switch(l){case"compositionend":return xy(d);case"keypress":return d.which!==32?null:(my=!0,py);case"textInput":return l=d.data,l===py&&my?null:l;default:return null}}function m3(l,d){if(Yo)return l==="compositionend"||!rp&&gy(l,d)?(l=ly(),Od=Qf=Wa=null,Yo=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1=d)return{node:p,offset:d-l};l=x}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=ky(p)}}function Cy(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?Cy(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function Ey(){for(var l=window,d=gt();d instanceof l.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)l=d.contentWindow;else break;d=gt(l.document)}return d}function ip(l){var d=l&&l.nodeName&&l.nodeName.toLowerCase();return d&&(d==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||d==="textarea"||l.contentEditable==="true")}function k3(l){var d=Ey(),p=l.focusedElem,x=l.selectionRange;if(d!==p&&p&&p.ownerDocument&&Cy(p.ownerDocument.documentElement,p)){if(x!==null&&ip(p)){if(d=x.start,l=x.end,l===void 0&&(l=d),"selectionStart"in p)p.selectionStart=d,p.selectionEnd=Math.min(l,p.value.length);else if(l=(d=p.ownerDocument||document)&&d.defaultView||window,l.getSelection){l=l.getSelection();var j=p.textContent.length,S=Math.min(x.start,j);x=x.end===void 0?S:Math.min(x.end,j),!l.extend&&S>x&&(j=x,x=S,S=j),j=Sy(p,S);var M=Sy(p,x);j&&M&&(l.rangeCount!==1||l.anchorNode!==j.node||l.anchorOffset!==j.offset||l.focusNode!==M.node||l.focusOffset!==M.offset)&&(d=d.createRange(),d.setStart(j.node,j.offset),l.removeAllRanges(),S>x?(l.addRange(d),l.extend(M.node,M.offset)):(d.setEnd(M.node,M.offset),l.addRange(d)))}}for(d=[],l=p;l=l.parentNode;)l.nodeType===1&&d.push({element:l,left:l.scrollLeft,top:l.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p=document.documentMode,Qo=null,op=null,hc=null,lp=!1;function Ty(l,d,p){var x=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;lp||Qo==null||Qo!==gt(x)||(x=Qo,"selectionStart"in x&&ip(x)?x={start:x.selectionStart,end:x.selectionEnd}:(x=(x.ownerDocument&&x.ownerDocument.defaultView||window).getSelection(),x={anchorNode:x.anchorNode,anchorOffset:x.anchorOffset,focusNode:x.focusNode,focusOffset:x.focusOffset}),hc&&uc(hc,x)||(hc=x,x=Vd(op,"onSelect"),0nl||(l.current=vp[nl],vp[nl]=null,nl--)}function _t(l,d){nl++,vp[nl]=l.current,l.current=d}var Ga={},Yn=qa(Ga),wr=qa(!1),Xi=Ga;function rl(l,d){var p=l.type.contextTypes;if(!p)return Ga;var x=l.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===d)return x.__reactInternalMemoizedMaskedChildContext;var j={},S;for(S in p)j[S]=d[S];return x&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=d,l.__reactInternalMemoizedMaskedChildContext=j),j}function jr(l){return l=l.childContextTypes,l!=null}function Kd(){qt(wr),qt(Yn)}function Hy(l,d,p){if(Yn.current!==Ga)throw Error(n(168));_t(Yn,d),_t(wr,p)}function Wy(l,d,p){var x=l.stateNode;if(d=d.childContextTypes,typeof x.getChildContext!="function")return p;x=x.getChildContext();for(var j in x)if(!(j in d))throw Error(n(108,Q(l)||"Unknown",j));return Y({},p,x)}function qd(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||Ga,Xi=Yn.current,_t(Yn,l),_t(wr,wr.current),!0}function Uy(l,d,p){var x=l.stateNode;if(!x)throw Error(n(169));p?(l=Wy(l,d,Xi),x.__reactInternalMemoizedMergedChildContext=l,qt(wr),qt(Yn),_t(Yn,l)):qt(wr),_t(wr,p)}var ia=null,Gd=!1,Np=!1;function Ky(l){ia===null?ia=[l]:ia.push(l)}function L3(l){Gd=!0,Ky(l)}function Ja(){if(!Np&&ia!==null){Np=!0;var l=0,d=st;try{var p=ia;for(st=1;l>=M,j-=M,oa=1<<32-$n(d)+j|p<rt?(On=Ze,Ze=null):On=Ze.sibling;var bt=ve(ae,Ze,de[rt],Ie);if(bt===null){Ze===null&&(Ze=On);break}l&&Ze&&bt.alternate===null&&d(ae,Ze),Z=S(bt,Z,rt),Xe===null?Ve=bt:Xe.sibling=bt,Xe=bt,Ze=On}if(rt===de.length)return p(ae,Ze),Jt&&eo(ae,rt),Ve;if(Ze===null){for(;rtrt?(On=Ze,Ze=null):On=Ze.sibling;var si=ve(ae,Ze,bt.value,Ie);if(si===null){Ze===null&&(Ze=On);break}l&&Ze&&si.alternate===null&&d(ae,Ze),Z=S(si,Z,rt),Xe===null?Ve=si:Xe.sibling=si,Xe=si,Ze=On}if(bt.done)return p(ae,Ze),Jt&&eo(ae,rt),Ve;if(Ze===null){for(;!bt.done;rt++,bt=de.next())bt=je(ae,bt.value,Ie),bt!==null&&(Z=S(bt,Z,rt),Xe===null?Ve=bt:Xe.sibling=bt,Xe=bt);return Jt&&eo(ae,rt),Ve}for(Ze=x(ae,Ze);!bt.done;rt++,bt=de.next())bt=Oe(Ze,ae,rt,bt.value,Ie),bt!==null&&(l&&bt.alternate!==null&&Ze.delete(bt.key===null?rt:bt.key),Z=S(bt,Z,rt),Xe===null?Ve=bt:Xe.sibling=bt,Xe=bt);return l&&Ze.forEach(function(gE){return d(ae,gE)}),Jt&&eo(ae,rt),Ve}function fn(ae,Z,de,Ie){if(typeof de=="object"&&de!==null&&de.type===_&&de.key===null&&(de=de.props.children),typeof de=="object"&&de!==null){switch(de.$$typeof){case I:e:{for(var Ve=de.key,Xe=Z;Xe!==null;){if(Xe.key===Ve){if(Ve=de.type,Ve===_){if(Xe.tag===7){p(ae,Xe.sibling),Z=j(Xe,de.props.children),Z.return=ae,ae=Z;break e}}else if(Xe.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===O&&Xy(Ve)===Xe.type){p(ae,Xe.sibling),Z=j(Xe,de.props),Z.ref=yc(ae,Xe,de),Z.return=ae,ae=Z;break e}p(ae,Xe);break}else d(ae,Xe);Xe=Xe.sibling}de.type===_?(Z=lo(de.props.children,ae.mode,Ie,de.key),Z.return=ae,ae=Z):(Ie=wu(de.type,de.key,de.props,null,ae.mode,Ie),Ie.ref=yc(ae,Z,de),Ie.return=ae,ae=Ie)}return M(ae);case D:e:{for(Xe=de.key;Z!==null;){if(Z.key===Xe)if(Z.tag===4&&Z.stateNode.containerInfo===de.containerInfo&&Z.stateNode.implementation===de.implementation){p(ae,Z.sibling),Z=j(Z,de.children||[]),Z.return=ae,ae=Z;break e}else{p(ae,Z);break}else d(ae,Z);Z=Z.sibling}Z=ym(de,ae.mode,Ie),Z.return=ae,ae=Z}return M(ae);case O:return Xe=de._init,fn(ae,Z,Xe(de._payload),Ie)}if(et(de))return _e(ae,Z,de,Ie);if(ce(de))return Fe(ae,Z,de,Ie);Xd(ae,de)}return typeof de=="string"&&de!==""||typeof de=="number"?(de=""+de,Z!==null&&Z.tag===6?(p(ae,Z.sibling),Z=j(Z,de),Z.return=ae,ae=Z):(p(ae,Z),Z=xm(de,ae.mode,Ie),Z.return=ae,ae=Z),M(ae)):p(ae,Z)}return fn}var ol=Zy(!0),eb=Zy(!1),Zd=qa(null),eu=null,ll=null,Ep=null;function Tp(){Ep=ll=eu=null}function Mp(l){var d=Zd.current;qt(Zd),l._currentValue=d}function Ap(l,d,p){for(;l!==null;){var x=l.alternate;if((l.childLanes&d)!==d?(l.childLanes|=d,x!==null&&(x.childLanes|=d)):x!==null&&(x.childLanes&d)!==d&&(x.childLanes|=d),l===p)break;l=l.return}}function cl(l,d){eu=l,Ep=ll=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(kr=!0),l.firstContext=null)}function Kr(l){var d=l._currentValue;if(Ep!==l)if(l={context:l,memoizedValue:d,next:null},ll===null){if(eu===null)throw Error(n(308));ll=l,eu.dependencies={lanes:0,firstContext:l}}else ll=ll.next=l;return d}var to=null;function Ip(l){to===null?to=[l]:to.push(l)}function tb(l,d,p,x){var j=d.interleaved;return j===null?(p.next=p,Ip(d)):(p.next=j.next,j.next=p),d.interleaved=p,ca(l,x)}function ca(l,d){l.lanes|=d;var p=l.alternate;for(p!==null&&(p.lanes|=d),p=l,l=l.return;l!==null;)l.childLanes|=d,p=l.alternate,p!==null&&(p.childLanes|=d),p=l,l=l.return;return p.tag===3?p.stateNode:null}var Ya=!1;function Rp(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function nb(l,d){l=l.updateQueue,d.updateQueue===l&&(d.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function da(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function Qa(l,d,p){var x=l.updateQueue;if(x===null)return null;if(x=x.shared,(mt&2)!==0){var j=x.pending;return j===null?d.next=d:(d.next=j.next,j.next=d),x.pending=d,ca(l,p)}return j=x.interleaved,j===null?(d.next=d,Ip(x)):(d.next=j.next,j.next=d),x.interleaved=d,ca(l,p)}function tu(l,d,p){if(d=d.updateQueue,d!==null&&(d=d.shared,(p&4194240)!==0)){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,Xt(l,p)}}function rb(l,d){var p=l.updateQueue,x=l.alternate;if(x!==null&&(x=x.updateQueue,p===x)){var j=null,S=null;if(p=p.firstBaseUpdate,p!==null){do{var M={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};S===null?j=S=M:S=S.next=M,p=p.next}while(p!==null);S===null?j=S=d:S=S.next=d}else j=S=d;p={baseState:x.baseState,firstBaseUpdate:j,lastBaseUpdate:S,shared:x.shared,effects:x.effects},l.updateQueue=p;return}l=p.lastBaseUpdate,l===null?p.firstBaseUpdate=d:l.next=d,p.lastBaseUpdate=d}function nu(l,d,p,x){var j=l.updateQueue;Ya=!1;var S=j.firstBaseUpdate,M=j.lastBaseUpdate,H=j.shared.pending;if(H!==null){j.shared.pending=null;var J=H,pe=J.next;J.next=null,M===null?S=pe:M.next=pe,M=J;var we=l.alternate;we!==null&&(we=we.updateQueue,H=we.lastBaseUpdate,H!==M&&(H===null?we.firstBaseUpdate=pe:H.next=pe,we.lastBaseUpdate=J))}if(S!==null){var je=j.baseState;M=0,we=pe=J=null,H=S;do{var ve=H.lane,Oe=H.eventTime;if((x&ve)===ve){we!==null&&(we=we.next={eventTime:Oe,lane:0,tag:H.tag,payload:H.payload,callback:H.callback,next:null});e:{var _e=l,Fe=H;switch(ve=d,Oe=p,Fe.tag){case 1:if(_e=Fe.payload,typeof _e=="function"){je=_e.call(Oe,je,ve);break e}je=_e;break e;case 3:_e.flags=_e.flags&-65537|128;case 0:if(_e=Fe.payload,ve=typeof _e=="function"?_e.call(Oe,je,ve):_e,ve==null)break e;je=Y({},je,ve);break e;case 2:Ya=!0}}H.callback!==null&&H.lane!==0&&(l.flags|=64,ve=j.effects,ve===null?j.effects=[H]:ve.push(H))}else Oe={eventTime:Oe,lane:ve,tag:H.tag,payload:H.payload,callback:H.callback,next:null},we===null?(pe=we=Oe,J=je):we=we.next=Oe,M|=ve;if(H=H.next,H===null){if(H=j.shared.pending,H===null)break;ve=H,H=ve.next,ve.next=null,j.lastBaseUpdate=ve,j.shared.pending=null}}while(!0);if(we===null&&(J=je),j.baseState=J,j.firstBaseUpdate=pe,j.lastBaseUpdate=we,d=j.shared.interleaved,d!==null){j=d;do M|=j.lane,j=j.next;while(j!==d)}else S===null&&(j.shared.lanes=0);so|=M,l.lanes=M,l.memoizedState=je}}function sb(l,d,p){if(l=d.effects,d.effects=null,l!==null)for(d=0;dp?p:4,l(!0);var x=_p.transition;_p.transition={};try{l(!1),d()}finally{st=p,_p.transition=x}}function jb(){return qr().memoizedState}function F3(l,d,p){var x=ti(l);if(p={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null},kb(l))Sb(d,p);else if(p=tb(l,d,p,x),p!==null){var j=hr();xs(p,l,x,j),Cb(p,d,x)}}function B3(l,d,p){var x=ti(l),j={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null};if(kb(l))Sb(d,j);else{var S=l.alternate;if(l.lanes===0&&(S===null||S.lanes===0)&&(S=d.lastRenderedReducer,S!==null))try{var M=d.lastRenderedState,H=S(M,p);if(j.hasEagerState=!0,j.eagerState=H,hs(H,M)){var J=d.interleaved;J===null?(j.next=j,Ip(d)):(j.next=J.next,J.next=j),d.interleaved=j;return}}catch{}finally{}p=tb(l,d,j,x),p!==null&&(j=hr(),xs(p,l,x,j),Cb(p,d,x))}}function kb(l){var d=l.alternate;return l===en||d!==null&&d===en}function Sb(l,d){wc=au=!0;var p=l.pending;p===null?d.next=d:(d.next=p.next,p.next=d),l.pending=d}function Cb(l,d,p){if((p&4194240)!==0){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,Xt(l,p)}}var lu={readContext:Kr,useCallback:Qn,useContext:Qn,useEffect:Qn,useImperativeHandle:Qn,useInsertionEffect:Qn,useLayoutEffect:Qn,useMemo:Qn,useReducer:Qn,useRef:Qn,useState:Qn,useDebugValue:Qn,useDeferredValue:Qn,useTransition:Qn,useMutableSource:Qn,useSyncExternalStore:Qn,useId:Qn,unstable_isNewReconciler:!1},V3={readContext:Kr,useCallback:function(l,d){return $s().memoizedState=[l,d===void 0?null:d],l},useContext:Kr,useEffect:mb,useImperativeHandle:function(l,d,p){return p=p!=null?p.concat([l]):null,iu(4194308,4,yb.bind(null,d,l),p)},useLayoutEffect:function(l,d){return iu(4194308,4,l,d)},useInsertionEffect:function(l,d){return iu(4,2,l,d)},useMemo:function(l,d){var p=$s();return d=d===void 0?null:d,l=l(),p.memoizedState=[l,d],l},useReducer:function(l,d,p){var x=$s();return d=p!==void 0?p(d):d,x.memoizedState=x.baseState=d,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:d},x.queue=l,l=l.dispatch=F3.bind(null,en,l),[x.memoizedState,l]},useRef:function(l){var d=$s();return l={current:l},d.memoizedState=l},useState:fb,useDebugValue:Wp,useDeferredValue:function(l){return $s().memoizedState=l},useTransition:function(){var l=fb(!1),d=l[0];return l=$3.bind(null,l[1]),$s().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,p){var x=en,j=$s();if(Jt){if(p===void 0)throw Error(n(407));p=p()}else{if(p=d(),Pn===null)throw Error(n(349));(ro&30)!==0||lb(x,d,p)}j.memoizedState=p;var S={value:p,getSnapshot:d};return j.queue=S,mb(db.bind(null,x,S,l),[l]),x.flags|=2048,Sc(9,cb.bind(null,x,S,p,d),void 0,null),p},useId:function(){var l=$s(),d=Pn.identifierPrefix;if(Jt){var p=la,x=oa;p=(x&~(1<<32-$n(x)-1)).toString(32)+p,d=":"+d+"R"+p,p=jc++,0<\/script>",l=l.removeChild(l.firstChild)):typeof x.is=="string"?l=M.createElement(p,{is:x.is}):(l=M.createElement(p),p==="select"&&(M=l,x.multiple?M.multiple=!0:x.size&&(M.size=x.size))):l=M.createElementNS(l,p),l[_s]=d,l[gc]=x,Kb(l,d,!1,!1),d.stateNode=l;e:{switch(M=Pa(p,x),p){case"dialog":Kt("cancel",l),Kt("close",l),j=x;break;case"iframe":case"object":case"embed":Kt("load",l),j=x;break;case"video":case"audio":for(j=0;jpl&&(d.flags|=128,x=!0,Cc(S,!1),d.lanes=4194304)}else{if(!x)if(l=ru(M),l!==null){if(d.flags|=128,x=!0,p=l.updateQueue,p!==null&&(d.updateQueue=p,d.flags|=4),Cc(S,!0),S.tail===null&&S.tailMode==="hidden"&&!M.alternate&&!Jt)return Xn(d),null}else 2*It()-S.renderingStartTime>pl&&p!==1073741824&&(d.flags|=128,x=!0,Cc(S,!1),d.lanes=4194304);S.isBackwards?(M.sibling=d.child,d.child=M):(p=S.last,p!==null?p.sibling=M:d.child=M,S.last=M)}return S.tail!==null?(d=S.tail,S.rendering=d,S.tail=d.sibling,S.renderingStartTime=It(),d.sibling=null,p=Zt.current,_t(Zt,x?p&1|2:p&1),d):(Xn(d),null);case 22:case 23:return pm(),x=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==x&&(d.flags|=8192),x&&(d.mode&1)!==0?(Or&1073741824)!==0&&(Xn(d),d.subtreeFlags&6&&(d.flags|=8192)):Xn(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function Y3(l,d){switch(jp(d),d.tag){case 1:return jr(d.type)&&Kd(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return dl(),qt(wr),qt(Yn),Lp(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return Op(d),null;case 13:if(qt(Zt),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));il()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return qt(Zt),null;case 4:return dl(),null;case 10:return Mp(d.type._context),null;case 22:case 23:return pm(),null;case 24:return null;default:return null}}var hu=!1,Zn=!1,Q3=typeof WeakSet=="function"?WeakSet:Set,Le=null;function hl(l,d){var p=l.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(x){sn(l,d,x)}else p.current=null}function nm(l,d,p){try{p()}catch(x){sn(l,d,x)}}var Jb=!1;function X3(l,d){if(pp=Rd,l=Ey(),ip(l)){if("selectionStart"in l)var p={start:l.selectionStart,end:l.selectionEnd};else e:{p=(p=l.ownerDocument)&&p.defaultView||window;var x=p.getSelection&&p.getSelection();if(x&&x.rangeCount!==0){p=x.anchorNode;var j=x.anchorOffset,S=x.focusNode;x=x.focusOffset;try{p.nodeType,S.nodeType}catch{p=null;break e}var M=0,H=-1,J=-1,pe=0,we=0,je=l,ve=null;t:for(;;){for(var Oe;je!==p||j!==0&&je.nodeType!==3||(H=M+j),je!==S||x!==0&&je.nodeType!==3||(J=M+x),je.nodeType===3&&(M+=je.nodeValue.length),(Oe=je.firstChild)!==null;)ve=je,je=Oe;for(;;){if(je===l)break t;if(ve===p&&++pe===j&&(H=M),ve===S&&++we===x&&(J=M),(Oe=je.nextSibling)!==null)break;je=ve,ve=je.parentNode}je=Oe}p=H===-1||J===-1?null:{start:H,end:J}}else p=null}p=p||{start:0,end:0}}else p=null;for(mp={focusedElem:l,selectionRange:p},Rd=!1,Le=d;Le!==null;)if(d=Le,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,Le=l;else for(;Le!==null;){d=Le;try{var _e=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(_e!==null){var Fe=_e.memoizedProps,fn=_e.memoizedState,ae=d.stateNode,Z=ae.getSnapshotBeforeUpdate(d.elementType===d.type?Fe:ps(d.type,Fe),fn);ae.__reactInternalSnapshotBeforeUpdate=Z}break;case 3:var de=d.stateNode.containerInfo;de.nodeType===1?de.textContent="":de.nodeType===9&&de.documentElement&&de.removeChild(de.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ie){sn(d,d.return,Ie)}if(l=d.sibling,l!==null){l.return=d.return,Le=l;break}Le=d.return}return _e=Jb,Jb=!1,_e}function Ec(l,d,p){var x=d.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var j=x=x.next;do{if((j.tag&l)===l){var S=j.destroy;j.destroy=void 0,S!==void 0&&nm(d,p,S)}j=j.next}while(j!==x)}}function fu(l,d){if(d=d.updateQueue,d=d!==null?d.lastEffect:null,d!==null){var p=d=d.next;do{if((p.tag&l)===l){var x=p.create;p.destroy=x()}p=p.next}while(p!==d)}}function rm(l){var d=l.ref;if(d!==null){var p=l.stateNode;switch(l.tag){case 5:l=p;break;default:l=p}typeof d=="function"?d(l):d.current=l}}function Yb(l){var d=l.alternate;d!==null&&(l.alternate=null,Yb(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[_s],delete d[gc],delete d[bp],delete d[O3],delete d[D3])),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function Qb(l){return l.tag===5||l.tag===3||l.tag===4}function Xb(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||Qb(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function sm(l,d,p){var x=l.tag;if(x===5||x===6)l=l.stateNode,d?p.nodeType===8?p.parentNode.insertBefore(l,d):p.insertBefore(l,d):(p.nodeType===8?(d=p.parentNode,d.insertBefore(l,p)):(d=p,d.appendChild(l)),p=p._reactRootContainer,p!=null||d.onclick!==null||(d.onclick=Wd));else if(x!==4&&(l=l.child,l!==null))for(sm(l,d,p),l=l.sibling;l!==null;)sm(l,d,p),l=l.sibling}function am(l,d,p){var x=l.tag;if(x===5||x===6)l=l.stateNode,d?p.insertBefore(l,d):p.appendChild(l);else if(x!==4&&(l=l.child,l!==null))for(am(l,d,p),l=l.sibling;l!==null;)am(l,d,p),l=l.sibling}var Fn=null,ms=!1;function Xa(l,d,p){for(p=p.child;p!==null;)Zb(l,d,p),p=p.sibling}function Zb(l,d,p){if(dr&&typeof dr.onCommitFiberUnmount=="function")try{dr.onCommitFiberUnmount($a,p)}catch{}switch(p.tag){case 5:Zn||hl(p,d);case 6:var x=Fn,j=ms;Fn=null,Xa(l,d,p),Fn=x,ms=j,Fn!==null&&(ms?(l=Fn,p=p.stateNode,l.nodeType===8?l.parentNode.removeChild(p):l.removeChild(p)):Fn.removeChild(p.stateNode));break;case 18:Fn!==null&&(ms?(l=Fn,p=p.stateNode,l.nodeType===8?yp(l.parentNode,p):l.nodeType===1&&yp(l,p),Ha(l)):yp(Fn,p.stateNode));break;case 4:x=Fn,j=ms,Fn=p.stateNode.containerInfo,ms=!0,Xa(l,d,p),Fn=x,ms=j;break;case 0:case 11:case 14:case 15:if(!Zn&&(x=p.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){j=x=x.next;do{var S=j,M=S.destroy;S=S.tag,M!==void 0&&((S&2)!==0||(S&4)!==0)&&nm(p,d,M),j=j.next}while(j!==x)}Xa(l,d,p);break;case 1:if(!Zn&&(hl(p,d),x=p.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=p.memoizedProps,x.state=p.memoizedState,x.componentWillUnmount()}catch(H){sn(p,d,H)}Xa(l,d,p);break;case 21:Xa(l,d,p);break;case 22:p.mode&1?(Zn=(x=Zn)||p.memoizedState!==null,Xa(l,d,p),Zn=x):Xa(l,d,p);break;default:Xa(l,d,p)}}function ev(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var p=l.stateNode;p===null&&(p=l.stateNode=new Q3),d.forEach(function(x){var j=oE.bind(null,l,x);p.has(x)||(p.add(x),x.then(j,j))})}}function gs(l,d){var p=d.deletions;if(p!==null)for(var x=0;xj&&(j=M),x&=~S}if(x=j,x=It()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*eE(x/1960))-x,10l?16:l,ei===null)var x=!1;else{if(l=ei,ei=null,yu=0,(mt&6)!==0)throw Error(n(331));var j=mt;for(mt|=4,Le=l.current;Le!==null;){var S=Le,M=S.child;if((Le.flags&16)!==0){var H=S.deletions;if(H!==null){for(var J=0;JIt()-lm?io(l,0):om|=p),Cr(l,d)}function fv(l,d){d===0&&((l.mode&1)===0?d=1:(d=Ps,Ps<<=1,(Ps&130023424)===0&&(Ps=4194304)));var p=hr();l=ca(l,d),l!==null&&(kn(l,d,p),Cr(l,p))}function iE(l){var d=l.memoizedState,p=0;d!==null&&(p=d.retryLane),fv(l,p)}function oE(l,d){var p=0;switch(l.tag){case 13:var x=l.stateNode,j=l.memoizedState;j!==null&&(p=j.retryLane);break;case 19:x=l.stateNode;break;default:throw Error(n(314))}x!==null&&x.delete(d),fv(l,p)}var pv;pv=function(l,d,p){if(l!==null)if(l.memoizedProps!==d.pendingProps||wr.current)kr=!0;else{if((l.lanes&p)===0&&(d.flags&128)===0)return kr=!1,G3(l,d,p);kr=(l.flags&131072)!==0}else kr=!1,Jt&&(d.flags&1048576)!==0&&qy(d,Yd,d.index);switch(d.lanes=0,d.tag){case 2:var x=d.type;uu(l,d),l=d.pendingProps;var j=rl(d,Yn.current);cl(d,p),j=$p(null,d,x,l,j,p);var S=Fp();return d.flags|=1,typeof j=="object"&&j!==null&&typeof j.render=="function"&&j.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,jr(x)?(S=!0,qd(d)):S=!1,d.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,Rp(d),j.updater=cu,d.stateNode=j,j._reactInternals=d,Kp(d,x,l,p),d=Yp(null,d,x,!0,S,p)):(d.tag=0,Jt&&S&&wp(d),ur(null,d,j,p),d=d.child),d;case 16:x=d.elementType;e:{switch(uu(l,d),l=d.pendingProps,j=x._init,x=j(x._payload),d.type=x,j=d.tag=cE(x),l=ps(x,l),j){case 0:d=Jp(null,d,x,l,p);break e;case 1:d=Fb(null,d,x,l,p);break e;case 11:d=Db(null,d,x,l,p);break e;case 14:d=Lb(null,d,x,ps(x.type,l),p);break e}throw Error(n(306,x,""))}return d;case 0:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:ps(x,j),Jp(l,d,x,j,p);case 1:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:ps(x,j),Fb(l,d,x,j,p);case 3:e:{if(Bb(d),l===null)throw Error(n(387));x=d.pendingProps,S=d.memoizedState,j=S.element,nb(l,d),nu(d,x,null,p);var M=d.memoizedState;if(x=M.element,S.isDehydrated)if(S={element:x,isDehydrated:!1,cache:M.cache,pendingSuspenseBoundaries:M.pendingSuspenseBoundaries,transitions:M.transitions},d.updateQueue.baseState=S,d.memoizedState=S,d.flags&256){j=ul(Error(n(423)),d),d=Vb(l,d,x,p,j);break e}else if(x!==j){j=ul(Error(n(424)),d),d=Vb(l,d,x,p,j);break e}else for(Pr=Ka(d.stateNode.containerInfo.firstChild),Rr=d,Jt=!0,fs=null,p=eb(d,null,x,p),d.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(il(),x===j){d=ua(l,d,p);break e}ur(l,d,x,p)}d=d.child}return d;case 5:return ab(d),l===null&&Sp(d),x=d.type,j=d.pendingProps,S=l!==null?l.memoizedProps:null,M=j.children,gp(x,j)?M=null:S!==null&&gp(x,S)&&(d.flags|=32),$b(l,d),ur(l,d,M,p),d.child;case 6:return l===null&&Sp(d),null;case 13:return Hb(l,d,p);case 4:return Pp(d,d.stateNode.containerInfo),x=d.pendingProps,l===null?d.child=ol(d,null,x,p):ur(l,d,x,p),d.child;case 11:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:ps(x,j),Db(l,d,x,j,p);case 7:return ur(l,d,d.pendingProps,p),d.child;case 8:return ur(l,d,d.pendingProps.children,p),d.child;case 12:return ur(l,d,d.pendingProps.children,p),d.child;case 10:e:{if(x=d.type._context,j=d.pendingProps,S=d.memoizedProps,M=j.value,_t(Zd,x._currentValue),x._currentValue=M,S!==null)if(hs(S.value,M)){if(S.children===j.children&&!wr.current){d=ua(l,d,p);break e}}else for(S=d.child,S!==null&&(S.return=d);S!==null;){var H=S.dependencies;if(H!==null){M=S.child;for(var J=H.firstContext;J!==null;){if(J.context===x){if(S.tag===1){J=da(-1,p&-p),J.tag=2;var pe=S.updateQueue;if(pe!==null){pe=pe.shared;var we=pe.pending;we===null?J.next=J:(J.next=we.next,we.next=J),pe.pending=J}}S.lanes|=p,J=S.alternate,J!==null&&(J.lanes|=p),Ap(S.return,p,d),H.lanes|=p;break}J=J.next}}else if(S.tag===10)M=S.type===d.type?null:S.child;else if(S.tag===18){if(M=S.return,M===null)throw Error(n(341));M.lanes|=p,H=M.alternate,H!==null&&(H.lanes|=p),Ap(M,p,d),M=S.sibling}else M=S.child;if(M!==null)M.return=S;else for(M=S;M!==null;){if(M===d){M=null;break}if(S=M.sibling,S!==null){S.return=M.return,M=S;break}M=M.return}S=M}ur(l,d,j.children,p),d=d.child}return d;case 9:return j=d.type,x=d.pendingProps.children,cl(d,p),j=Ur(j),x=x(j),d.flags|=1,ur(l,d,x,p),d.child;case 14:return x=d.type,j=ps(x,d.pendingProps),j=ps(x.type,j),Lb(l,d,x,j,p);case 15:return _b(l,d,d.type,d.pendingProps,p);case 17:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:ps(x,j),uu(l,d),d.tag=1,jr(x)?(l=!0,qd(d)):l=!1,cl(d,p),Tb(d,x,j),Kp(d,x,j,p),Yp(null,d,x,!0,l,p);case 19:return Ub(l,d,p);case 22:return zb(l,d,p)}throw Error(n(156,d.tag))};function mv(l,d){return un(l,d)}function lE(l,d,p,x){this.tag=l,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Gr(l,d,p,x){return new lE(l,d,p,x)}function gm(l){return l=l.prototype,!(!l||!l.isReactComponent)}function cE(l){if(typeof l=="function")return gm(l)?1:0;if(l!=null){if(l=l.$$typeof,l===U)return 11;if(l===R)return 14}return 2}function ri(l,d){var p=l.alternate;return p===null?(p=Gr(l.tag,d,l.key,l.mode),p.elementType=l.elementType,p.type=l.type,p.stateNode=l.stateNode,p.alternate=l,l.alternate=p):(p.pendingProps=d,p.type=l.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=l.flags&14680064,p.childLanes=l.childLanes,p.lanes=l.lanes,p.child=l.child,p.memoizedProps=l.memoizedProps,p.memoizedState=l.memoizedState,p.updateQueue=l.updateQueue,d=l.dependencies,p.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},p.sibling=l.sibling,p.index=l.index,p.ref=l.ref,p}function wu(l,d,p,x,j,S){var M=2;if(x=l,typeof l=="function")gm(l)&&(M=1);else if(typeof l=="string")M=5;else e:switch(l){case _:return lo(p.children,j,S,d);case P:M=8,j|=8;break;case L:return l=Gr(12,p,d,j|2),l.elementType=L,l.lanes=S,l;case he:return l=Gr(13,p,d,j),l.elementType=he,l.lanes=S,l;case me:return l=Gr(19,p,d,j),l.elementType=me,l.lanes=S,l;case X:return ju(p,j,S,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case z:M=10;break e;case ee:M=9;break e;case U:M=11;break e;case R:M=14;break e;case O:M=16,x=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=Gr(M,p,d,j),d.elementType=l,d.type=x,d.lanes=S,d}function lo(l,d,p,x){return l=Gr(7,l,x,d),l.lanes=p,l}function ju(l,d,p,x){return l=Gr(22,l,x,d),l.elementType=X,l.lanes=p,l.stateNode={isHidden:!1},l}function xm(l,d,p){return l=Gr(6,l,null,d),l.lanes=p,l}function ym(l,d,p){return d=Gr(4,l.children!==null?l.children:[],l.key,d),d.lanes=p,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function dE(l,d,p,x,j){this.tag=d,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=xn(0),this.expirationTimes=xn(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=xn(0),this.identifierPrefix=x,this.onRecoverableError=j,this.mutableSourceEagerHydrationData=null}function bm(l,d,p,x,j,S,M,H,J){return l=new dE(l,d,p,H,J),d===1?(d=1,S===!0&&(d|=8)):d=0,S=Gr(3,null,null,d),l.current=S,S.stateNode=l,S.memoizedState={element:x,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},Rp(S),l}function uE(l,d,p){var x=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Sm.exports=jE(),Sm.exports}var Mv;function kE(){if(Mv)return Au;Mv=1;var t=Ow();return Au.createRoot=t.createRoot,Au.hydrateRoot=t.hydrateRoot,Au}var SE=kE(),jd=Ow();const Dw=Pw(jd);/** +`+S.stack}return{value:l,source:d,stack:j,digest:null}}function qp(l,d,p){return{value:l,source:null,stack:p??null,digest:d??null}}function Gp(l,d){try{console.error(d.value)}catch(p){setTimeout(function(){throw p})}}var U3=typeof WeakMap=="function"?WeakMap:Map;function Ab(l,d,p){p=da(-1,p),p.tag=3,p.payload={element:null};var x=d.value;return p.callback=function(){gu||(gu=!0,cm=x),Gp(l,d)},p}function Ib(l,d,p){p=da(-1,p),p.tag=3;var x=l.type.getDerivedStateFromError;if(typeof x=="function"){var j=d.value;p.payload=function(){return x(j)},p.callback=function(){Gp(l,d)}}var S=l.stateNode;return S!==null&&typeof S.componentDidCatch=="function"&&(p.callback=function(){Gp(l,d),typeof x!="function"&&(Za===null?Za=new Set([this]):Za.add(this));var M=d.stack;this.componentDidCatch(d.value,{componentStack:M!==null?M:""})}),p}function Rb(l,d,p){var x=l.pingCache;if(x===null){x=l.pingCache=new U3;var j=new Set;x.set(d,j)}else j=x.get(d),j===void 0&&(j=new Set,x.set(d,j));j.has(p)||(j.add(p),l=aE.bind(null,l,d,p),d.then(l,l))}function Pb(l){do{var d;if((d=l.tag===13)&&(d=l.memoizedState,d=d!==null?d.dehydrated!==null:!0),d)return l;l=l.return}while(l!==null);return null}function Ob(l,d,p,x,j){return(l.mode&1)===0?(l===d?l.flags|=65536:(l.flags|=128,p.flags|=131072,p.flags&=-52805,p.tag===1&&(p.alternate===null?p.tag=17:(d=da(-1,1),d.tag=2,Qa(p,d,1))),p.lanes|=1),l):(l.flags|=65536,l.lanes=j,l)}var K3=A.ReactCurrentOwner,kr=!1;function ur(l,d,p,x){d.child=l===null?eb(d,null,p,x):ol(d,l.child,p,x)}function Db(l,d,p,x,j){p=p.render;var S=d.ref;return cl(d,j),x=$p(l,d,p,x,S,j),p=Fp(),l!==null&&!kr?(d.updateQueue=l.updateQueue,d.flags&=-2053,l.lanes&=~j,ua(l,d,j)):(Jt&&p&&wp(d),d.flags|=1,ur(l,d,x,j),d.child)}function Lb(l,d,p,x,j){if(l===null){var S=p.type;return typeof S=="function"&&!gm(S)&&S.defaultProps===void 0&&p.compare===null&&p.defaultProps===void 0?(d.tag=15,d.type=S,_b(l,d,S,x,j)):(l=wu(p.type,null,x,d,d.mode,j),l.ref=d.ref,l.return=d,d.child=l)}if(S=l.child,(l.lanes&j)===0){var M=S.memoizedProps;if(p=p.compare,p=p!==null?p:uc,p(M,x)&&l.ref===d.ref)return ua(l,d,j)}return d.flags|=1,l=ri(S,x),l.ref=d.ref,l.return=d,d.child=l}function _b(l,d,p,x,j){if(l!==null){var S=l.memoizedProps;if(uc(S,x)&&l.ref===d.ref)if(kr=!1,d.pendingProps=x=S,(l.lanes&j)!==0)(l.flags&131072)!==0&&(kr=!0);else return d.lanes=l.lanes,ua(l,d,j)}return Jp(l,d,p,x,j)}function zb(l,d,p){var x=d.pendingProps,j=x.children,S=l!==null?l.memoizedState:null;if(x.mode==="hidden")if((d.mode&1)===0)d.memoizedState={baseLanes:0,cachePool:null,transitions:null},_t(fl,Or),Or|=p;else{if((p&1073741824)===0)return l=S!==null?S.baseLanes|p:p,d.lanes=d.childLanes=1073741824,d.memoizedState={baseLanes:l,cachePool:null,transitions:null},d.updateQueue=null,_t(fl,Or),Or|=l,null;d.memoizedState={baseLanes:0,cachePool:null,transitions:null},x=S!==null?S.baseLanes:p,_t(fl,Or),Or|=x}else S!==null?(x=S.baseLanes|p,d.memoizedState=null):x=p,_t(fl,Or),Or|=x;return ur(l,d,j,p),d.child}function $b(l,d){var p=d.ref;(l===null&&p!==null||l!==null&&l.ref!==p)&&(d.flags|=512,d.flags|=2097152)}function Jp(l,d,p,x,j){var S=jr(p)?Xi:Yn.current;return S=rl(d,S),cl(d,j),p=$p(l,d,p,x,S,j),x=Fp(),l!==null&&!kr?(d.updateQueue=l.updateQueue,d.flags&=-2053,l.lanes&=~j,ua(l,d,j)):(Jt&&x&&wp(d),d.flags|=1,ur(l,d,p,j),d.child)}function Fb(l,d,p,x,j){if(jr(p)){var S=!0;qd(d)}else S=!1;if(cl(d,j),d.stateNode===null)uu(l,d),Tb(d,p,x),Kp(d,p,x,j),x=!0;else if(l===null){var M=d.stateNode,H=d.memoizedProps;M.props=H;var J=M.context,pe=p.contextType;typeof pe=="object"&&pe!==null?pe=Kr(pe):(pe=jr(p)?Xi:Yn.current,pe=rl(d,pe));var we=p.getDerivedStateFromProps,je=typeof we=="function"||typeof M.getSnapshotBeforeUpdate=="function";je||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(H!==x||J!==pe)&&Mb(d,M,x,pe),Ya=!1;var ve=d.memoizedState;M.state=ve,nu(d,x,M,j),J=d.memoizedState,H!==x||ve!==J||wr.current||Ya?(typeof we=="function"&&(Up(d,p,we,x),J=d.memoizedState),(H=Ya||Eb(d,p,H,x,ve,J,pe))?(je||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount()),typeof M.componentDidMount=="function"&&(d.flags|=4194308)):(typeof M.componentDidMount=="function"&&(d.flags|=4194308),d.memoizedProps=x,d.memoizedState=J),M.props=x,M.state=J,M.context=pe,x=H):(typeof M.componentDidMount=="function"&&(d.flags|=4194308),x=!1)}else{M=d.stateNode,nb(l,d),H=d.memoizedProps,pe=d.type===d.elementType?H:ps(d.type,H),M.props=pe,je=d.pendingProps,ve=M.context,J=p.contextType,typeof J=="object"&&J!==null?J=Kr(J):(J=jr(p)?Xi:Yn.current,J=rl(d,J));var Oe=p.getDerivedStateFromProps;(we=typeof Oe=="function"||typeof M.getSnapshotBeforeUpdate=="function")||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(H!==je||ve!==J)&&Mb(d,M,x,J),Ya=!1,ve=d.memoizedState,M.state=ve,nu(d,x,M,j);var _e=d.memoizedState;H!==je||ve!==_e||wr.current||Ya?(typeof Oe=="function"&&(Up(d,p,Oe,x),_e=d.memoizedState),(pe=Ya||Eb(d,p,pe,x,ve,_e,J)||!1)?(we||typeof M.UNSAFE_componentWillUpdate!="function"&&typeof M.componentWillUpdate!="function"||(typeof M.componentWillUpdate=="function"&&M.componentWillUpdate(x,_e,J),typeof M.UNSAFE_componentWillUpdate=="function"&&M.UNSAFE_componentWillUpdate(x,_e,J)),typeof M.componentDidUpdate=="function"&&(d.flags|=4),typeof M.getSnapshotBeforeUpdate=="function"&&(d.flags|=1024)):(typeof M.componentDidUpdate!="function"||H===l.memoizedProps&&ve===l.memoizedState||(d.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||H===l.memoizedProps&&ve===l.memoizedState||(d.flags|=1024),d.memoizedProps=x,d.memoizedState=_e),M.props=x,M.state=_e,M.context=J,x=pe):(typeof M.componentDidUpdate!="function"||H===l.memoizedProps&&ve===l.memoizedState||(d.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||H===l.memoizedProps&&ve===l.memoizedState||(d.flags|=1024),x=!1)}return Yp(l,d,p,x,S,j)}function Yp(l,d,p,x,j,S){$b(l,d);var M=(d.flags&128)!==0;if(!x&&!M)return j&&Uy(d,p,!1),ua(l,d,S);x=d.stateNode,K3.current=d;var H=M&&typeof p.getDerivedStateFromError!="function"?null:x.render();return d.flags|=1,l!==null&&M?(d.child=ol(d,l.child,null,S),d.child=ol(d,null,H,S)):ur(l,d,H,S),d.memoizedState=x.state,j&&Uy(d,p,!0),d.child}function Bb(l){var d=l.stateNode;d.pendingContext?Hy(l,d.pendingContext,d.pendingContext!==d.context):d.context&&Hy(l,d.context,!1),Pp(l,d.containerInfo)}function Vb(l,d,p,x,j){return il(),Cp(j),d.flags|=256,ur(l,d,p,x),d.child}var Qp={dehydrated:null,treeContext:null,retryLane:0};function Xp(l){return{baseLanes:l,cachePool:null,transitions:null}}function Hb(l,d,p){var x=d.pendingProps,j=Zt.current,S=!1,M=(d.flags&128)!==0,H;if((H=M)||(H=l!==null&&l.memoizedState===null?!1:(j&2)!==0),H?(S=!0,d.flags&=-129):(l===null||l.memoizedState!==null)&&(j|=1),_t(Zt,j&1),l===null)return Sp(d),l=d.memoizedState,l!==null&&(l=l.dehydrated,l!==null)?((d.mode&1)===0?d.lanes=1:l.data==="$!"?d.lanes=8:d.lanes=1073741824,null):(M=x.children,l=x.fallback,S?(x=d.mode,S=d.child,M={mode:"hidden",children:M},(x&1)===0&&S!==null?(S.childLanes=0,S.pendingProps=M):S=ju(M,x,0,null),l=lo(l,x,p,null),S.return=d,l.return=d,S.sibling=l,d.child=S,d.child.memoizedState=Xp(p),d.memoizedState=Qp,l):Zp(d,M));if(j=l.memoizedState,j!==null&&(H=j.dehydrated,H!==null))return q3(l,d,M,x,H,j,p);if(S){S=x.fallback,M=d.mode,j=l.child,H=j.sibling;var J={mode:"hidden",children:x.children};return(M&1)===0&&d.child!==j?(x=d.child,x.childLanes=0,x.pendingProps=J,d.deletions=null):(x=ri(j,J),x.subtreeFlags=j.subtreeFlags&14680064),H!==null?S=ri(H,S):(S=lo(S,M,p,null),S.flags|=2),S.return=d,x.return=d,x.sibling=S,d.child=x,x=S,S=d.child,M=l.child.memoizedState,M=M===null?Xp(p):{baseLanes:M.baseLanes|p,cachePool:null,transitions:M.transitions},S.memoizedState=M,S.childLanes=l.childLanes&~p,d.memoizedState=Qp,x}return S=l.child,l=S.sibling,x=ri(S,{mode:"visible",children:x.children}),(d.mode&1)===0&&(x.lanes=p),x.return=d,x.sibling=null,l!==null&&(p=d.deletions,p===null?(d.deletions=[l],d.flags|=16):p.push(l)),d.child=x,d.memoizedState=null,x}function Zp(l,d){return d=ju({mode:"visible",children:d},l.mode,0,null),d.return=l,l.child=d}function du(l,d,p,x){return x!==null&&Cp(x),ol(d,l.child,null,p),l=Zp(d,d.pendingProps.children),l.flags|=2,d.memoizedState=null,l}function q3(l,d,p,x,j,S,M){if(p)return d.flags&256?(d.flags&=-257,x=qp(Error(n(422))),du(l,d,M,x)):d.memoizedState!==null?(d.child=l.child,d.flags|=128,null):(S=x.fallback,j=d.mode,x=ju({mode:"visible",children:x.children},j,0,null),S=lo(S,j,M,null),S.flags|=2,x.return=d,S.return=d,x.sibling=S,d.child=x,(d.mode&1)!==0&&ol(d,l.child,null,M),d.child.memoizedState=Xp(M),d.memoizedState=Qp,S);if((d.mode&1)===0)return du(l,d,M,null);if(j.data==="$!"){if(x=j.nextSibling&&j.nextSibling.dataset,x)var H=x.dgst;return x=H,S=Error(n(419)),x=qp(S,x,void 0),du(l,d,M,x)}if(H=(M&l.childLanes)!==0,kr||H){if(x=Pn,x!==null){switch(M&-M){case 4:j=2;break;case 16:j=8;break;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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:j=32;break;case 536870912:j=268435456;break;default:j=0}j=(j&(x.suspendedLanes|M))!==0?0:j,j!==0&&j!==S.retryLane&&(S.retryLane=j,ca(l,j),xs(x,l,j,-1))}return mm(),x=qp(Error(n(421))),du(l,d,M,x)}return j.data==="$?"?(d.flags|=128,d.child=l.child,d=iE.bind(null,l),j._reactRetry=d,null):(l=S.treeContext,Pr=Ka(j.nextSibling),Rr=d,Jt=!0,fs=null,l!==null&&(Wr[Ur++]=oa,Wr[Ur++]=la,Wr[Ur++]=Zi,oa=l.id,la=l.overflow,Zi=d),d=Zp(d,x.children),d.flags|=4096,d)}function Wb(l,d,p){l.lanes|=d;var x=l.alternate;x!==null&&(x.lanes|=d),Ap(l.return,d,p)}function em(l,d,p,x,j){var S=l.memoizedState;S===null?l.memoizedState={isBackwards:d,rendering:null,renderingStartTime:0,last:x,tail:p,tailMode:j}:(S.isBackwards=d,S.rendering=null,S.renderingStartTime=0,S.last=x,S.tail=p,S.tailMode=j)}function Ub(l,d,p){var x=d.pendingProps,j=x.revealOrder,S=x.tail;if(ur(l,d,x.children,p),x=Zt.current,(x&2)!==0)x=x&1|2,d.flags|=128;else{if(l!==null&&(l.flags&128)!==0)e:for(l=d.child;l!==null;){if(l.tag===13)l.memoizedState!==null&&Wb(l,p,d);else if(l.tag===19)Wb(l,p,d);else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===d)break e;for(;l.sibling===null;){if(l.return===null||l.return===d)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}x&=1}if(_t(Zt,x),(d.mode&1)===0)d.memoizedState=null;else switch(j){case"forwards":for(p=d.child,j=null;p!==null;)l=p.alternate,l!==null&&ru(l)===null&&(j=p),p=p.sibling;p=j,p===null?(j=d.child,d.child=null):(j=p.sibling,p.sibling=null),em(d,!1,j,p,S);break;case"backwards":for(p=null,j=d.child,d.child=null;j!==null;){if(l=j.alternate,l!==null&&ru(l)===null){d.child=j;break}l=j.sibling,j.sibling=p,p=j,j=l}em(d,!0,p,null,S);break;case"together":em(d,!1,null,null,void 0);break;default:d.memoizedState=null}return d.child}function uu(l,d){(d.mode&1)===0&&l!==null&&(l.alternate=null,d.alternate=null,d.flags|=2)}function ua(l,d,p){if(l!==null&&(d.dependencies=l.dependencies),so|=d.lanes,(p&d.childLanes)===0)return null;if(l!==null&&d.child!==l.child)throw Error(n(153));if(d.child!==null){for(l=d.child,p=ri(l,l.pendingProps),d.child=p,p.return=d;l.sibling!==null;)l=l.sibling,p=p.sibling=ri(l,l.pendingProps),p.return=d;p.sibling=null}return d.child}function G3(l,d,p){switch(d.tag){case 3:Bb(d),il();break;case 5:ab(d);break;case 1:jr(d.type)&&qd(d);break;case 4:Pp(d,d.stateNode.containerInfo);break;case 10:var x=d.type._context,j=d.memoizedProps.value;_t(Zd,x._currentValue),x._currentValue=j;break;case 13:if(x=d.memoizedState,x!==null)return x.dehydrated!==null?(_t(Zt,Zt.current&1),d.flags|=128,null):(p&d.child.childLanes)!==0?Hb(l,d,p):(_t(Zt,Zt.current&1),l=ua(l,d,p),l!==null?l.sibling:null);_t(Zt,Zt.current&1);break;case 19:if(x=(p&d.childLanes)!==0,(l.flags&128)!==0){if(x)return Ub(l,d,p);d.flags|=128}if(j=d.memoizedState,j!==null&&(j.rendering=null,j.tail=null,j.lastEffect=null),_t(Zt,Zt.current),x)break;return null;case 22:case 23:return d.lanes=0,zb(l,d,p)}return ua(l,d,p)}var Kb,tm,qb,Gb;Kb=function(l,d){for(var p=d.child;p!==null;){if(p.tag===5||p.tag===6)l.appendChild(p.stateNode);else if(p.tag!==4&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===d)break;for(;p.sibling===null;){if(p.return===null||p.return===d)return;p=p.return}p.sibling.return=p.return,p=p.sibling}},tm=function(){},qb=function(l,d,p,x){var j=l.memoizedProps;if(j!==x){l=d.stateNode,no(zs.current);var S=null;switch(p){case"input":j=Dt(l,j),x=Dt(l,x),S=[];break;case"select":j=Y({},j,{value:void 0}),x=Y({},x,{value:void 0}),S=[];break;case"textarea":j=ft(l,j),x=ft(l,x),S=[];break;default:typeof j.onClick!="function"&&typeof x.onClick=="function"&&(l.onclick=Wd)}Ts(p,x);var M;p=null;for(pe in j)if(!x.hasOwnProperty(pe)&&j.hasOwnProperty(pe)&&j[pe]!=null)if(pe==="style"){var H=j[pe];for(M in H)H.hasOwnProperty(M)&&(p||(p={}),p[M]="")}else pe!=="dangerouslySetInnerHTML"&&pe!=="children"&&pe!=="suppressContentEditableWarning"&&pe!=="suppressHydrationWarning"&&pe!=="autoFocus"&&(a.hasOwnProperty(pe)?S||(S=[]):(S=S||[]).push(pe,null));for(pe in x){var J=x[pe];if(H=j!=null?j[pe]:void 0,x.hasOwnProperty(pe)&&J!==H&&(J!=null||H!=null))if(pe==="style")if(H){for(M in H)!H.hasOwnProperty(M)||J&&J.hasOwnProperty(M)||(p||(p={}),p[M]="");for(M in J)J.hasOwnProperty(M)&&H[M]!==J[M]&&(p||(p={}),p[M]=J[M])}else p||(S||(S=[]),S.push(pe,p)),p=J;else pe==="dangerouslySetInnerHTML"?(J=J?J.__html:void 0,H=H?H.__html:void 0,J!=null&&H!==J&&(S=S||[]).push(pe,J)):pe==="children"?typeof J!="string"&&typeof J!="number"||(S=S||[]).push(pe,""+J):pe!=="suppressContentEditableWarning"&&pe!=="suppressHydrationWarning"&&(a.hasOwnProperty(pe)?(J!=null&&pe==="onScroll"&&Kt("scroll",l),S||H===J||(S=[])):(S=S||[]).push(pe,J))}p&&(S=S||[]).push("style",p);var pe=S;(d.updateQueue=pe)&&(d.flags|=4)}},Gb=function(l,d,p,x){p!==x&&(d.flags|=4)};function Cc(l,d){if(!Jt)switch(l.tailMode){case"hidden":d=l.tail;for(var p=null;d!==null;)d.alternate!==null&&(p=d),d=d.sibling;p===null?l.tail=null:p.sibling=null;break;case"collapsed":p=l.tail;for(var x=null;p!==null;)p.alternate!==null&&(x=p),p=p.sibling;x===null?d||l.tail===null?l.tail=null:l.tail.sibling=null:x.sibling=null}}function Xn(l){var d=l.alternate!==null&&l.alternate.child===l.child,p=0,x=0;if(d)for(var j=l.child;j!==null;)p|=j.lanes|j.childLanes,x|=j.subtreeFlags&14680064,x|=j.flags&14680064,j.return=l,j=j.sibling;else for(j=l.child;j!==null;)p|=j.lanes|j.childLanes,x|=j.subtreeFlags,x|=j.flags,j.return=l,j=j.sibling;return l.subtreeFlags|=x,l.childLanes=p,d}function J3(l,d,p){var x=d.pendingProps;switch(jp(d),d.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Xn(d),null;case 1:return jr(d.type)&&Kd(),Xn(d),null;case 3:return x=d.stateNode,dl(),qt(wr),qt(Yn),Lp(),x.pendingContext&&(x.context=x.pendingContext,x.pendingContext=null),(l===null||l.child===null)&&(Qd(d)?d.flags|=4:l===null||l.memoizedState.isDehydrated&&(d.flags&256)===0||(d.flags|=1024,fs!==null&&(hm(fs),fs=null))),tm(l,d),Xn(d),null;case 5:Op(d);var j=no(Nc.current);if(p=d.type,l!==null&&d.stateNode!=null)qb(l,d,p,x,j),l.ref!==d.ref&&(d.flags|=512,d.flags|=2097152);else{if(!x){if(d.stateNode===null)throw Error(n(166));return Xn(d),null}if(l=no(zs.current),Qd(d)){x=d.stateNode,p=d.type;var S=d.memoizedProps;switch(x[_s]=d,x[gc]=S,l=(d.mode&1)!==0,p){case"dialog":Kt("cancel",x),Kt("close",x);break;case"iframe":case"object":case"embed":Kt("load",x);break;case"video":case"audio":for(j=0;j<\/script>",l=l.removeChild(l.firstChild)):typeof x.is=="string"?l=M.createElement(p,{is:x.is}):(l=M.createElement(p),p==="select"&&(M=l,x.multiple?M.multiple=!0:x.size&&(M.size=x.size))):l=M.createElementNS(l,p),l[_s]=d,l[gc]=x,Kb(l,d,!1,!1),d.stateNode=l;e:{switch(M=Pa(p,x),p){case"dialog":Kt("cancel",l),Kt("close",l),j=x;break;case"iframe":case"object":case"embed":Kt("load",l),j=x;break;case"video":case"audio":for(j=0;jpl&&(d.flags|=128,x=!0,Cc(S,!1),d.lanes=4194304)}else{if(!x)if(l=ru(M),l!==null){if(d.flags|=128,x=!0,p=l.updateQueue,p!==null&&(d.updateQueue=p,d.flags|=4),Cc(S,!0),S.tail===null&&S.tailMode==="hidden"&&!M.alternate&&!Jt)return Xn(d),null}else 2*It()-S.renderingStartTime>pl&&p!==1073741824&&(d.flags|=128,x=!0,Cc(S,!1),d.lanes=4194304);S.isBackwards?(M.sibling=d.child,d.child=M):(p=S.last,p!==null?p.sibling=M:d.child=M,S.last=M)}return S.tail!==null?(d=S.tail,S.rendering=d,S.tail=d.sibling,S.renderingStartTime=It(),d.sibling=null,p=Zt.current,_t(Zt,x?p&1|2:p&1),d):(Xn(d),null);case 22:case 23:return pm(),x=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==x&&(d.flags|=8192),x&&(d.mode&1)!==0?(Or&1073741824)!==0&&(Xn(d),d.subtreeFlags&6&&(d.flags|=8192)):Xn(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function Y3(l,d){switch(jp(d),d.tag){case 1:return jr(d.type)&&Kd(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return dl(),qt(wr),qt(Yn),Lp(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return Op(d),null;case 13:if(qt(Zt),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));il()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return qt(Zt),null;case 4:return dl(),null;case 10:return Mp(d.type._context),null;case 22:case 23:return pm(),null;case 24:return null;default:return null}}var hu=!1,Zn=!1,Q3=typeof WeakSet=="function"?WeakSet:Set,Le=null;function hl(l,d){var p=l.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(x){sn(l,d,x)}else p.current=null}function nm(l,d,p){try{p()}catch(x){sn(l,d,x)}}var Jb=!1;function X3(l,d){if(pp=Rd,l=Ey(),ip(l)){if("selectionStart"in l)var p={start:l.selectionStart,end:l.selectionEnd};else e:{p=(p=l.ownerDocument)&&p.defaultView||window;var x=p.getSelection&&p.getSelection();if(x&&x.rangeCount!==0){p=x.anchorNode;var j=x.anchorOffset,S=x.focusNode;x=x.focusOffset;try{p.nodeType,S.nodeType}catch{p=null;break e}var M=0,H=-1,J=-1,pe=0,we=0,je=l,ve=null;t:for(;;){for(var Oe;je!==p||j!==0&&je.nodeType!==3||(H=M+j),je!==S||x!==0&&je.nodeType!==3||(J=M+x),je.nodeType===3&&(M+=je.nodeValue.length),(Oe=je.firstChild)!==null;)ve=je,je=Oe;for(;;){if(je===l)break t;if(ve===p&&++pe===j&&(H=M),ve===S&&++we===x&&(J=M),(Oe=je.nextSibling)!==null)break;je=ve,ve=je.parentNode}je=Oe}p=H===-1||J===-1?null:{start:H,end:J}}else p=null}p=p||{start:0,end:0}}else p=null;for(mp={focusedElem:l,selectionRange:p},Rd=!1,Le=d;Le!==null;)if(d=Le,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,Le=l;else for(;Le!==null;){d=Le;try{var _e=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(_e!==null){var Fe=_e.memoizedProps,fn=_e.memoizedState,ae=d.stateNode,Z=ae.getSnapshotBeforeUpdate(d.elementType===d.type?Fe:ps(d.type,Fe),fn);ae.__reactInternalSnapshotBeforeUpdate=Z}break;case 3:var de=d.stateNode.containerInfo;de.nodeType===1?de.textContent="":de.nodeType===9&&de.documentElement&&de.removeChild(de.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ie){sn(d,d.return,Ie)}if(l=d.sibling,l!==null){l.return=d.return,Le=l;break}Le=d.return}return _e=Jb,Jb=!1,_e}function Ec(l,d,p){var x=d.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var j=x=x.next;do{if((j.tag&l)===l){var S=j.destroy;j.destroy=void 0,S!==void 0&&nm(d,p,S)}j=j.next}while(j!==x)}}function fu(l,d){if(d=d.updateQueue,d=d!==null?d.lastEffect:null,d!==null){var p=d=d.next;do{if((p.tag&l)===l){var x=p.create;p.destroy=x()}p=p.next}while(p!==d)}}function rm(l){var d=l.ref;if(d!==null){var p=l.stateNode;switch(l.tag){case 5:l=p;break;default:l=p}typeof d=="function"?d(l):d.current=l}}function Yb(l){var d=l.alternate;d!==null&&(l.alternate=null,Yb(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[_s],delete d[gc],delete d[bp],delete d[O3],delete d[D3])),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function Qb(l){return l.tag===5||l.tag===3||l.tag===4}function Xb(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||Qb(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function sm(l,d,p){var x=l.tag;if(x===5||x===6)l=l.stateNode,d?p.nodeType===8?p.parentNode.insertBefore(l,d):p.insertBefore(l,d):(p.nodeType===8?(d=p.parentNode,d.insertBefore(l,p)):(d=p,d.appendChild(l)),p=p._reactRootContainer,p!=null||d.onclick!==null||(d.onclick=Wd));else if(x!==4&&(l=l.child,l!==null))for(sm(l,d,p),l=l.sibling;l!==null;)sm(l,d,p),l=l.sibling}function am(l,d,p){var x=l.tag;if(x===5||x===6)l=l.stateNode,d?p.insertBefore(l,d):p.appendChild(l);else if(x!==4&&(l=l.child,l!==null))for(am(l,d,p),l=l.sibling;l!==null;)am(l,d,p),l=l.sibling}var Fn=null,ms=!1;function Xa(l,d,p){for(p=p.child;p!==null;)Zb(l,d,p),p=p.sibling}function Zb(l,d,p){if(dr&&typeof dr.onCommitFiberUnmount=="function")try{dr.onCommitFiberUnmount($a,p)}catch{}switch(p.tag){case 5:Zn||hl(p,d);case 6:var x=Fn,j=ms;Fn=null,Xa(l,d,p),Fn=x,ms=j,Fn!==null&&(ms?(l=Fn,p=p.stateNode,l.nodeType===8?l.parentNode.removeChild(p):l.removeChild(p)):Fn.removeChild(p.stateNode));break;case 18:Fn!==null&&(ms?(l=Fn,p=p.stateNode,l.nodeType===8?yp(l.parentNode,p):l.nodeType===1&&yp(l,p),Ha(l)):yp(Fn,p.stateNode));break;case 4:x=Fn,j=ms,Fn=p.stateNode.containerInfo,ms=!0,Xa(l,d,p),Fn=x,ms=j;break;case 0:case 11:case 14:case 15:if(!Zn&&(x=p.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){j=x=x.next;do{var S=j,M=S.destroy;S=S.tag,M!==void 0&&((S&2)!==0||(S&4)!==0)&&nm(p,d,M),j=j.next}while(j!==x)}Xa(l,d,p);break;case 1:if(!Zn&&(hl(p,d),x=p.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=p.memoizedProps,x.state=p.memoizedState,x.componentWillUnmount()}catch(H){sn(p,d,H)}Xa(l,d,p);break;case 21:Xa(l,d,p);break;case 22:p.mode&1?(Zn=(x=Zn)||p.memoizedState!==null,Xa(l,d,p),Zn=x):Xa(l,d,p);break;default:Xa(l,d,p)}}function ev(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var p=l.stateNode;p===null&&(p=l.stateNode=new Q3),d.forEach(function(x){var j=oE.bind(null,l,x);p.has(x)||(p.add(x),x.then(j,j))})}}function gs(l,d){var p=d.deletions;if(p!==null)for(var x=0;xj&&(j=M),x&=~S}if(x=j,x=It()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*eE(x/1960))-x,10l?16:l,ei===null)var x=!1;else{if(l=ei,ei=null,yu=0,(mt&6)!==0)throw Error(n(331));var j=mt;for(mt|=4,Le=l.current;Le!==null;){var S=Le,M=S.child;if((Le.flags&16)!==0){var H=S.deletions;if(H!==null){for(var J=0;JIt()-lm?io(l,0):om|=p),Cr(l,d)}function fv(l,d){d===0&&((l.mode&1)===0?d=1:(d=Ps,Ps<<=1,(Ps&130023424)===0&&(Ps=4194304)));var p=hr();l=ca(l,d),l!==null&&(kn(l,d,p),Cr(l,p))}function iE(l){var d=l.memoizedState,p=0;d!==null&&(p=d.retryLane),fv(l,p)}function oE(l,d){var p=0;switch(l.tag){case 13:var x=l.stateNode,j=l.memoizedState;j!==null&&(p=j.retryLane);break;case 19:x=l.stateNode;break;default:throw Error(n(314))}x!==null&&x.delete(d),fv(l,p)}var pv;pv=function(l,d,p){if(l!==null)if(l.memoizedProps!==d.pendingProps||wr.current)kr=!0;else{if((l.lanes&p)===0&&(d.flags&128)===0)return kr=!1,G3(l,d,p);kr=(l.flags&131072)!==0}else kr=!1,Jt&&(d.flags&1048576)!==0&&qy(d,Yd,d.index);switch(d.lanes=0,d.tag){case 2:var x=d.type;uu(l,d),l=d.pendingProps;var j=rl(d,Yn.current);cl(d,p),j=$p(null,d,x,l,j,p);var S=Fp();return d.flags|=1,typeof j=="object"&&j!==null&&typeof j.render=="function"&&j.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,jr(x)?(S=!0,qd(d)):S=!1,d.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,Rp(d),j.updater=cu,d.stateNode=j,j._reactInternals=d,Kp(d,x,l,p),d=Yp(null,d,x,!0,S,p)):(d.tag=0,Jt&&S&&wp(d),ur(null,d,j,p),d=d.child),d;case 16:x=d.elementType;e:{switch(uu(l,d),l=d.pendingProps,j=x._init,x=j(x._payload),d.type=x,j=d.tag=cE(x),l=ps(x,l),j){case 0:d=Jp(null,d,x,l,p);break e;case 1:d=Fb(null,d,x,l,p);break e;case 11:d=Db(null,d,x,l,p);break e;case 14:d=Lb(null,d,x,ps(x.type,l),p);break e}throw Error(n(306,x,""))}return d;case 0:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:ps(x,j),Jp(l,d,x,j,p);case 1:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:ps(x,j),Fb(l,d,x,j,p);case 3:e:{if(Bb(d),l===null)throw Error(n(387));x=d.pendingProps,S=d.memoizedState,j=S.element,nb(l,d),nu(d,x,null,p);var M=d.memoizedState;if(x=M.element,S.isDehydrated)if(S={element:x,isDehydrated:!1,cache:M.cache,pendingSuspenseBoundaries:M.pendingSuspenseBoundaries,transitions:M.transitions},d.updateQueue.baseState=S,d.memoizedState=S,d.flags&256){j=ul(Error(n(423)),d),d=Vb(l,d,x,p,j);break e}else if(x!==j){j=ul(Error(n(424)),d),d=Vb(l,d,x,p,j);break e}else for(Pr=Ka(d.stateNode.containerInfo.firstChild),Rr=d,Jt=!0,fs=null,p=eb(d,null,x,p),d.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(il(),x===j){d=ua(l,d,p);break e}ur(l,d,x,p)}d=d.child}return d;case 5:return ab(d),l===null&&Sp(d),x=d.type,j=d.pendingProps,S=l!==null?l.memoizedProps:null,M=j.children,gp(x,j)?M=null:S!==null&&gp(x,S)&&(d.flags|=32),$b(l,d),ur(l,d,M,p),d.child;case 6:return l===null&&Sp(d),null;case 13:return Hb(l,d,p);case 4:return Pp(d,d.stateNode.containerInfo),x=d.pendingProps,l===null?d.child=ol(d,null,x,p):ur(l,d,x,p),d.child;case 11:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:ps(x,j),Db(l,d,x,j,p);case 7:return ur(l,d,d.pendingProps,p),d.child;case 8:return ur(l,d,d.pendingProps.children,p),d.child;case 12:return ur(l,d,d.pendingProps.children,p),d.child;case 10:e:{if(x=d.type._context,j=d.pendingProps,S=d.memoizedProps,M=j.value,_t(Zd,x._currentValue),x._currentValue=M,S!==null)if(hs(S.value,M)){if(S.children===j.children&&!wr.current){d=ua(l,d,p);break e}}else for(S=d.child,S!==null&&(S.return=d);S!==null;){var H=S.dependencies;if(H!==null){M=S.child;for(var J=H.firstContext;J!==null;){if(J.context===x){if(S.tag===1){J=da(-1,p&-p),J.tag=2;var pe=S.updateQueue;if(pe!==null){pe=pe.shared;var we=pe.pending;we===null?J.next=J:(J.next=we.next,we.next=J),pe.pending=J}}S.lanes|=p,J=S.alternate,J!==null&&(J.lanes|=p),Ap(S.return,p,d),H.lanes|=p;break}J=J.next}}else if(S.tag===10)M=S.type===d.type?null:S.child;else if(S.tag===18){if(M=S.return,M===null)throw Error(n(341));M.lanes|=p,H=M.alternate,H!==null&&(H.lanes|=p),Ap(M,p,d),M=S.sibling}else M=S.child;if(M!==null)M.return=S;else for(M=S;M!==null;){if(M===d){M=null;break}if(S=M.sibling,S!==null){S.return=M.return,M=S;break}M=M.return}S=M}ur(l,d,j.children,p),d=d.child}return d;case 9:return j=d.type,x=d.pendingProps.children,cl(d,p),j=Kr(j),x=x(j),d.flags|=1,ur(l,d,x,p),d.child;case 14:return x=d.type,j=ps(x,d.pendingProps),j=ps(x.type,j),Lb(l,d,x,j,p);case 15:return _b(l,d,d.type,d.pendingProps,p);case 17:return x=d.type,j=d.pendingProps,j=d.elementType===x?j:ps(x,j),uu(l,d),d.tag=1,jr(x)?(l=!0,qd(d)):l=!1,cl(d,p),Tb(d,x,j),Kp(d,x,j,p),Yp(null,d,x,!0,l,p);case 19:return Ub(l,d,p);case 22:return zb(l,d,p)}throw Error(n(156,d.tag))};function mv(l,d){return un(l,d)}function lE(l,d,p,x){this.tag=l,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Jr(l,d,p,x){return new lE(l,d,p,x)}function gm(l){return l=l.prototype,!(!l||!l.isReactComponent)}function cE(l){if(typeof l=="function")return gm(l)?1:0;if(l!=null){if(l=l.$$typeof,l===U)return 11;if(l===R)return 14}return 2}function ri(l,d){var p=l.alternate;return p===null?(p=Jr(l.tag,d,l.key,l.mode),p.elementType=l.elementType,p.type=l.type,p.stateNode=l.stateNode,p.alternate=l,l.alternate=p):(p.pendingProps=d,p.type=l.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=l.flags&14680064,p.childLanes=l.childLanes,p.lanes=l.lanes,p.child=l.child,p.memoizedProps=l.memoizedProps,p.memoizedState=l.memoizedState,p.updateQueue=l.updateQueue,d=l.dependencies,p.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},p.sibling=l.sibling,p.index=l.index,p.ref=l.ref,p}function wu(l,d,p,x,j,S){var M=2;if(x=l,typeof l=="function")gm(l)&&(M=1);else if(typeof l=="string")M=5;else e:switch(l){case _:return lo(p.children,j,S,d);case P:M=8,j|=8;break;case L:return l=Jr(12,p,d,j|2),l.elementType=L,l.lanes=S,l;case he:return l=Jr(13,p,d,j),l.elementType=he,l.lanes=S,l;case me:return l=Jr(19,p,d,j),l.elementType=me,l.lanes=S,l;case X:return ju(p,j,S,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case z:M=10;break e;case ee:M=9;break e;case U:M=11;break e;case R:M=14;break e;case O:M=16,x=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=Jr(M,p,d,j),d.elementType=l,d.type=x,d.lanes=S,d}function lo(l,d,p,x){return l=Jr(7,l,x,d),l.lanes=p,l}function ju(l,d,p,x){return l=Jr(22,l,x,d),l.elementType=X,l.lanes=p,l.stateNode={isHidden:!1},l}function xm(l,d,p){return l=Jr(6,l,null,d),l.lanes=p,l}function ym(l,d,p){return d=Jr(4,l.children!==null?l.children:[],l.key,d),d.lanes=p,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function dE(l,d,p,x,j){this.tag=d,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=xn(0),this.expirationTimes=xn(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=xn(0),this.identifierPrefix=x,this.onRecoverableError=j,this.mutableSourceEagerHydrationData=null}function bm(l,d,p,x,j,S,M,H,J){return l=new dE(l,d,p,H,J),d===1?(d=1,S===!0&&(d|=8)):d=0,S=Jr(3,null,null,d),l.current=S,S.stateNode=l,S.memoizedState={element:x,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},Rp(S),l}function uE(l,d,p){var x=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Sm.exports=jE(),Sm.exports}var Mv;function kE(){if(Mv)return Au;Mv=1;var t=Ow();return Au.createRoot=t.createRoot,Au.hydrateRoot=t.hydrateRoot,Au}var SE=kE(),jd=Ow();const Dw=Pw(jd);/** * @remix-run/router v1.23.2 * * Copyright (c) Remix Software Inc. @@ -549,7 +549,7 @@ Error generating stack: `+S.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const s5=[["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"}]],yi=Te("zap",s5),Ux="admin_token";function Kx(){try{return localStorage.getItem(Ux)}catch{return null}}function a5(t){try{localStorage.setItem(Ux,t)}catch{}}function i5(){try{localStorage.removeItem(Ux)}catch{}}const o5="https://soulapi.quwanzhi.com",l5=15e3,c5=()=>{const t="https://soulapi.quwanzhi.com";return t.length>0?t.replace(/\/$/,""):o5};function ja(t){const e=c5(),n=t.startsWith("/")?t:`/${t}`;return e?`${e}${n}`:n}async function bf(t,e={}){const{data:n,...r}=e,a=ja(t),i=new Headers(r.headers),o=Kx();o&&i.set("Authorization",`Bearer ${o}`),n!=null&&!i.has("Content-Type")&&i.set("Content-Type","application/json");const c=n!=null?JSON.stringify(n):r.body,u=new AbortController,h=setTimeout(()=>u.abort(),l5),f=await fetch(a,{...r,headers:i,body:c,credentials:"include",signal:u.signal}).finally(()=>clearTimeout(h)),g=(f.headers.get("Content-Type")||"").includes("application/json")?await f.json():f;if(!f.ok){const y=new Error((g==null?void 0:g.error)||`HTTP ${f.status}`);throw y.status=f.status,y.data=g,y}return g}function De(t,e){return bf(t,{...e,method:"GET"})}function Nt(t,e,n){return bf(t,{...n,method:"POST",data:e})}function Tt(t,e,n){return bf(t,{...n,method:"PUT",data:e})}function wa(t,e){return bf(t,{...e,method:"DELETE"})}const d5=[{icon:KM,label:"数据概览",href:"/dashboard"},{icon:$r,label:"内容管理",href:"/content"},{icon:Mn,label:"用户管理",href:"/users"},{icon:kM,label:"找伙伴",href:"/find-partner"},{icon:Ll,label:"推广中心",href:"/distribution"}];function u5(){const t=Oi(),e=Di(),[n,r]=b.useState(!1),[a,i]=b.useState(!1);b.useEffect(()=>{r(!0)},[]),b.useEffect(()=>{if(!n)return;i(!1);let c=!1;return De("/api/admin").then(u=>{c||(u&&u.success!==!1?i(!0):e("/login",{replace:!0}))}).catch(()=>{c||e("/login",{replace:!0})}),()=>{c=!0}},[n,e]);const o=async()=>{i5();try{await Nt("/api/admin/logout",{})}catch{}e("/login",{replace:!0})};return!n||!a?s.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[s.jsx("div",{className:"w-64 bg-[#0f2137] border-r border-gray-700/50"}),s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-[#38bdac]",children:"加载中..."})})]}):s.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[s.jsxs("div",{className:"w-64 bg-[#0f2137] flex flex-col border-r border-gray-700/50 shadow-xl",children:[s.jsxs("div",{className:"p-6 border-b border-gray-700/50",children:[s.jsx("h1",{className:"text-xl font-bold text-[#38bdac]",children:"管理后台"}),s.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Soul创业派对"})]}),s.jsx("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:d5.map(c=>{const u=t.pathname===c.href;return s.jsxs(Ag,{to:c.href,className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${u?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[s.jsx(c.icon,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"text-sm",children:c.label})]},c.href)})}),s.jsxs("div",{className:"p-4 border-t border-gray-700/50 space-y-1",children:[s.jsxs(Ag,{to:"/settings",className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${t.pathname==="/settings"?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[s.jsx(bo,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"text-sm",children:"系统设置"})]}),s.jsxs("button",{type:"button",onClick:o,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:[s.jsx(nA,{className:"w-5 h-5"}),s.jsx("span",{className:"text-sm",children:"退出登录"})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto bg-[#0a1628] min-w-0",children:s.jsx("div",{className:"w-full min-w-[1024px] min-h-full",children:s.jsx(yT,{})})})]})}function Uv(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function qx(...t){return e=>{let n=!1;const r=t.map(a=>{const i=Uv(a,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a{let{children:i,...o}=r;nj(i)&&typeof gh=="function"&&(i=gh(i._payload));const c=b.Children.toArray(i),u=c.find(g5);if(u){const h=u.props.children,f=c.map(m=>m===u?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:a,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:a,children:i})});return n.displayName=`${t}.Slot`,n}var sj=rj("Slot");function p5(t){const e=b.forwardRef((n,r)=>{let{children:a,...i}=n;if(nj(a)&&typeof gh=="function"&&(a=gh(a._payload)),b.isValidElement(a)){const o=y5(a),c=x5(i,a.props);return a.type!==b.Fragment&&(c.ref=r?qx(r,o):o),b.cloneElement(a,c)}return b.Children.count(a)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var m5=Symbol("radix.slottable");function g5(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===m5}function x5(t,e){const n={...e};for(const r in e){const a=t[r],i=e[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...c)=>{const u=i(...c);return a(...c),u}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...t,...n}}function y5(t){var r,a;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function aj(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;etypeof t=="boolean"?`${t}`:t===0?"0":t,qv=ij,oj=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return qv(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:i}=e,o=Object.keys(a).map(h=>{const f=n==null?void 0:n[h],m=i==null?void 0:i[h];if(f===null)return null;const g=Kv(f)||Kv(m);return a[h][g]}),c=n&&Object.entries(n).reduce((h,f)=>{let[m,g]=f;return g===void 0||(h[m]=g),h},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,f)=>{let{class:m,className:g,...y}=f;return Object.entries(y).every(v=>{let[w,N]=v;return Array.isArray(N)?N.includes({...i,...c}[w]):{...i,...c}[w]===N})?[...h,m,g]:h},[]);return qv(t,o,u,n==null?void 0:n.class,n==null?void 0:n.className)},b5=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),lj=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),xh="-",Gv=[],N5="arbitrary..",w5=t=>{const e=k5(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return j5(o);const c=o.split(xh),u=c[0]===""&&c.length>1?1:0;return cj(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=r[o],h=n[o];return u?h?b5(h,u):u:h||Gv}return n[o]||Gv}}},cj=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const a=t[e],i=n.nextPart.get(a);if(i){const h=cj(t,e+1,i);if(h)return h}const o=n.validators;if(o===null)return;const c=e===0?t.join(xh):t.slice(e).join(xh),u=o.length;for(let h=0;ht.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?N5+r:void 0})(),k5=t=>{const{theme:e,classGroups:n}=t;return S5(n,e)},S5=(t,e)=>{const n=lj();for(const r in t){const a=t[r];Gx(a,n,r,e)}return n},Gx=(t,e,n,r)=>{const a=t.length;for(let i=0;i{if(typeof t=="string"){E5(t,e,n);return}if(typeof t=="function"){T5(t,e,n,r);return}M5(t,e,n,r)},E5=(t,e,n)=>{const r=t===""?e:dj(e,t);r.classGroupId=n},T5=(t,e,n,r)=>{if(A5(t)){Gx(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(v5(n,t))},M5=(t,e,n,r)=>{const a=Object.entries(t),i=a.length;for(let o=0;o{let n=t;const r=e.split(xh),a=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,I5=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const a=(i,o)=>{n[i]=o,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let o=n[i];if(o!==void 0)return o;if((o=r[i])!==void 0)return a(i,o),o},set(i,o){i in n?n[i]=o:a(i,o)}}},Fg="!",Jv=":",R5=[],Yv=(t,e,n,r,a)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),P5=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=a=>{const i=[];let o=0,c=0,u=0,h;const f=a.length;for(let w=0;wu?h-u:void 0;return Yv(i,y,g,v)};if(e){const a=e+Jv,i=r;r=o=>o.startsWith(a)?i(o.slice(a.length)):Yv(R5,!1,o,void 0,!0)}if(n){const a=r;r=i=>n({className:i,parseClassName:a})}return r},O5=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let a=[];for(let i=0;i0&&(a.sort(),r.push(...a),a=[]),r.push(o)):a.push(o)}return a.length>0&&(a.sort(),r.push(...a)),r}},D5=t=>({cache:I5(t.cacheSize),parseClassName:P5(t),sortModifiers:O5(t),...w5(t)}),L5=/\s+/,_5=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:i}=e,o=[],c=t.trim().split(L5);let u="";for(let h=c.length-1;h>=0;h-=1){const f=c[h],{isExternal:m,modifiers:g,hasImportantModifier:y,baseClassName:v,maybePostfixModifierPosition:w}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let N=!!w,k=r(N?v.substring(0,w):v);if(!k){if(!N){u=f+(u.length>0?" "+u:u);continue}if(k=r(v),!k){u=f+(u.length>0?" "+u:u);continue}N=!1}const C=g.length===0?"":g.length===1?g[0]:i(g).join(":"),E=y?C+Fg:C,A=E+k;if(o.indexOf(A)>-1)continue;o.push(A);const I=a(k,N);for(let D=0;D0?" "+u:u)}return u},z5=(...t)=>{let e=0,n,r,a="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,a,i;const o=u=>{const h=e.reduce((f,m)=>m(f),t());return n=D5(h),r=n.cache.get,a=n.cache.set,i=c,c(u)},c=u=>{const h=r(u);if(h)return h;const f=_5(u,n);return a(u,f),f};return i=o,(...u)=>i(z5(...u))},F5=[],En=t=>{const e=n=>n[t]||F5;return e.isThemeGetter=!0,e},hj=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,fj=/^\((?:(\w[\w-]*):)?(.+)\)$/i,B5=/^\d+\/\d+$/,V5=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,H5=/\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$/,W5=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,U5=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,K5=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,gl=t=>B5.test(t),dt=t=>!!t&&!Number.isNaN(Number(t)),ai=t=>!!t&&Number.isInteger(Number(t)),Rm=t=>t.endsWith("%")&&dt(t.slice(0,-1)),pa=t=>V5.test(t),q5=()=>!0,G5=t=>H5.test(t)&&!W5.test(t),pj=()=>!1,J5=t=>U5.test(t),Y5=t=>K5.test(t),Q5=t=>!ze(t)&&!$e(t),X5=t=>ql(t,xj,pj),ze=t=>hj.test(t),co=t=>ql(t,yj,G5),Pm=t=>ql(t,rI,dt),Qv=t=>ql(t,mj,pj),Z5=t=>ql(t,gj,Y5),Ru=t=>ql(t,bj,J5),$e=t=>fj.test(t),Pc=t=>Gl(t,yj),eI=t=>Gl(t,sI),Xv=t=>Gl(t,mj),tI=t=>Gl(t,xj),nI=t=>Gl(t,gj),Pu=t=>Gl(t,bj,!0),ql=(t,e,n)=>{const r=hj.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Gl=(t,e,n=!1)=>{const r=fj.exec(t);return r?r[1]?e(r[1]):n:!1},mj=t=>t==="position"||t==="percentage",gj=t=>t==="image"||t==="url",xj=t=>t==="length"||t==="size"||t==="bg-size",yj=t=>t==="length",rI=t=>t==="number",sI=t=>t==="family-name",bj=t=>t==="shadow",aI=()=>{const t=En("color"),e=En("font"),n=En("text"),r=En("font-weight"),a=En("tracking"),i=En("leading"),o=En("breakpoint"),c=En("container"),u=En("spacing"),h=En("radius"),f=En("shadow"),m=En("inset-shadow"),g=En("text-shadow"),y=En("drop-shadow"),v=En("blur"),w=En("perspective"),N=En("aspect"),k=En("ease"),C=En("animate"),E=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],I=()=>[...A(),$e,ze],D=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],P=()=>[$e,ze,u],L=()=>[gl,"full","auto",...P()],z=()=>[ai,"none","subgrid",$e,ze],ee=()=>["auto",{span:["full",ai,$e,ze]},ai,$e,ze],U=()=>[ai,"auto",$e,ze],he=()=>["auto","min","max","fr",$e,ze],me=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],R=()=>["start","end","center","stretch","center-safe","end-safe"],O=()=>["auto",...P()],X=()=>[gl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],$=()=>[t,$e,ze],ce=()=>[...A(),Xv,Qv,{position:[$e,ze]}],Y=()=>["no-repeat",{repeat:["","x","y","space","round"]}],F=()=>["auto","cover","contain",tI,X5,{size:[$e,ze]}],W=()=>[Rm,Pc,co],K=()=>["","none","full",h,$e,ze],B=()=>["",dt,Pc,co],oe=()=>["solid","dashed","dotted","double"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Q=()=>[dt,Rm,Xv,Qv],se=()=>["","none",v,$e,ze],ye=()=>["none",dt,$e,ze],Me=()=>["none",dt,$e,ze],Be=()=>[dt,$e,ze],He=()=>[gl,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[pa],breakpoint:[pa],color:[q5],container:[pa],"drop-shadow":[pa],ease:["in","out","in-out"],font:[Q5],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[pa],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[pa],shadow:[pa],spacing:["px",dt],text:[pa],"text-shadow":[pa],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",gl,ze,$e,N]}],container:["container"],columns:[{columns:[dt,ze,$e,c]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"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:I()}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{start:L()}],end:[{end:L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[ai,"auto",$e,ze]}],basis:[{basis:[gl,"full","auto",c,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[dt,gl,"auto","initial","none",ze]}],grow:[{grow:["",dt,$e,ze]}],shrink:[{shrink:["",dt,$e,ze]}],order:[{order:[ai,"first","last","none",$e,ze]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:ee()}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:ee()}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":he()}],"auto-rows":[{"auto-rows":he()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...me(),"normal"]}],"justify-items":[{"justify-items":[...R(),"normal"]}],"justify-self":[{"justify-self":["auto",...R()]}],"align-content":[{content:["normal",...me()]}],"align-items":[{items:[...R(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...R(),{baseline:["","last"]}]}],"place-content":[{"place-content":me()}],"place-items":[{"place-items":[...R(),"baseline"]}],"place-self":[{"place-self":["auto",...R()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:O()}],mx:[{mx:O()}],my:[{my:O()}],ms:[{ms:O()}],me:[{me:O()}],mt:[{mt:O()}],mr:[{mr:O()}],mb:[{mb:O()}],ml:[{ml:O()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:X()}],w:[{w:[c,"screen",...X()]}],"min-w":[{"min-w":[c,"screen","none",...X()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...X()]}],h:[{h:["screen","lh",...X()]}],"min-h":[{"min-h":["screen","lh","none",...X()]}],"max-h":[{"max-h":["screen","lh",...X()]}],"font-size":[{text:["base",n,Pc,co]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,$e,Pm]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Rm,ze]}],"font-family":[{font:[eI,ze,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,$e,ze]}],"line-clamp":[{"line-clamp":[dt,"none",$e,Pm]}],leading:[{leading:[i,...P()]}],"list-image":[{"list-image":["none",$e,ze]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",$e,ze]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:$()}],"text-color":[{text:$()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:[dt,"from-font","auto",$e,co]}],"text-decoration-color":[{decoration:$()}],"underline-offset":[{"underline-offset":[dt,"auto",$e,ze]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",$e,ze]}],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",$e,ze]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ce()}],"bg-repeat":[{bg:Y()}],"bg-size":[{bg:F()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ai,$e,ze],radial:["",$e,ze],conic:[ai,$e,ze]},nI,Z5]}],"bg-color":[{bg:$()}],"gradient-from-pos":[{from:W()}],"gradient-via-pos":[{via:W()}],"gradient-to-pos":[{to:W()}],"gradient-from":[{from:$()}],"gradient-via":[{via:$()}],"gradient-to":[{to:$()}],rounded:[{rounded:K()}],"rounded-s":[{"rounded-s":K()}],"rounded-e":[{"rounded-e":K()}],"rounded-t":[{"rounded-t":K()}],"rounded-r":[{"rounded-r":K()}],"rounded-b":[{"rounded-b":K()}],"rounded-l":[{"rounded-l":K()}],"rounded-ss":[{"rounded-ss":K()}],"rounded-se":[{"rounded-se":K()}],"rounded-ee":[{"rounded-ee":K()}],"rounded-es":[{"rounded-es":K()}],"rounded-tl":[{"rounded-tl":K()}],"rounded-tr":[{"rounded-tr":K()}],"rounded-br":[{"rounded-br":K()}],"rounded-bl":[{"rounded-bl":K()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":B()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...oe(),"hidden","none"]}],"divide-style":[{divide:[...oe(),"hidden","none"]}],"border-color":[{border:$()}],"border-color-x":[{"border-x":$()}],"border-color-y":[{"border-y":$()}],"border-color-s":[{"border-s":$()}],"border-color-e":[{"border-e":$()}],"border-color-t":[{"border-t":$()}],"border-color-r":[{"border-r":$()}],"border-color-b":[{"border-b":$()}],"border-color-l":[{"border-l":$()}],"divide-color":[{divide:$()}],"outline-style":[{outline:[...oe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[dt,$e,ze]}],"outline-w":[{outline:["",dt,Pc,co]}],"outline-color":[{outline:$()}],shadow:[{shadow:["","none",f,Pu,Ru]}],"shadow-color":[{shadow:$()}],"inset-shadow":[{"inset-shadow":["none",m,Pu,Ru]}],"inset-shadow-color":[{"inset-shadow":$()}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:$()}],"ring-offset-w":[{"ring-offset":[dt,co]}],"ring-offset-color":[{"ring-offset":$()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":$()}],"text-shadow":[{"text-shadow":["none",g,Pu,Ru]}],"text-shadow-color":[{"text-shadow":$()}],opacity:[{opacity:[dt,$e,ze]}],"mix-blend":[{"mix-blend":[...G(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":G()}],"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":[dt]}],"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":$()}],"mask-image-linear-to-color":[{"mask-linear-to":$()}],"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":$()}],"mask-image-t-to-color":[{"mask-t-to":$()}],"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":$()}],"mask-image-r-to-color":[{"mask-r-to":$()}],"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":$()}],"mask-image-b-to-color":[{"mask-b-to":$()}],"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":$()}],"mask-image-l-to-color":[{"mask-l-to":$()}],"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":$()}],"mask-image-x-to-color":[{"mask-x-to":$()}],"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":$()}],"mask-image-y-to-color":[{"mask-y-to":$()}],"mask-image-radial":[{"mask-radial":[$e,ze]}],"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":$()}],"mask-image-radial-to-color":[{"mask-radial-to":$()}],"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":A()}],"mask-image-conic-pos":[{"mask-conic":[dt]}],"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":$()}],"mask-image-conic-to-color":[{"mask-conic-to":$()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ce()}],"mask-repeat":[{mask:Y()}],"mask-size":[{mask:F()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",$e,ze]}],filter:[{filter:["","none",$e,ze]}],blur:[{blur:se()}],brightness:[{brightness:[dt,$e,ze]}],contrast:[{contrast:[dt,$e,ze]}],"drop-shadow":[{"drop-shadow":["","none",y,Pu,Ru]}],"drop-shadow-color":[{"drop-shadow":$()}],grayscale:[{grayscale:["",dt,$e,ze]}],"hue-rotate":[{"hue-rotate":[dt,$e,ze]}],invert:[{invert:["",dt,$e,ze]}],saturate:[{saturate:[dt,$e,ze]}],sepia:[{sepia:["",dt,$e,ze]}],"backdrop-filter":[{"backdrop-filter":["","none",$e,ze]}],"backdrop-blur":[{"backdrop-blur":se()}],"backdrop-brightness":[{"backdrop-brightness":[dt,$e,ze]}],"backdrop-contrast":[{"backdrop-contrast":[dt,$e,ze]}],"backdrop-grayscale":[{"backdrop-grayscale":["",dt,$e,ze]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[dt,$e,ze]}],"backdrop-invert":[{"backdrop-invert":["",dt,$e,ze]}],"backdrop-opacity":[{"backdrop-opacity":[dt,$e,ze]}],"backdrop-saturate":[{"backdrop-saturate":[dt,$e,ze]}],"backdrop-sepia":[{"backdrop-sepia":["",dt,$e,ze]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",$e,ze]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[dt,"initial",$e,ze]}],ease:[{ease:["linear","initial",k,$e,ze]}],delay:[{delay:[dt,$e,ze]}],animate:[{animate:["none",C,$e,ze]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,$e,ze]}],"perspective-origin":[{"perspective-origin":I()}],rotate:[{rotate:ye()}],"rotate-x":[{"rotate-x":ye()}],"rotate-y":[{"rotate-y":ye()}],"rotate-z":[{"rotate-z":ye()}],scale:[{scale:Me()}],"scale-x":[{"scale-x":Me()}],"scale-y":[{"scale-y":Me()}],"scale-z":[{"scale-z":Me()}],"scale-3d":["scale-3d"],skew:[{skew:Be()}],"skew-x":[{"skew-x":Be()}],"skew-y":[{"skew-y":Be()}],transform:[{transform:[$e,ze,"","none","gpu","cpu"]}],"transform-origin":[{origin:I()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:He()}],"translate-x":[{"translate-x":He()}],"translate-y":[{"translate-y":He()}],"translate-z":[{"translate-z":He()}],"translate-none":["translate-none"],accent:[{accent:$()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:$()}],"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",$e,ze]}],"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":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"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",$e,ze]}],fill:[{fill:["none",...$()]}],"stroke-w":[{stroke:[dt,Pc,co,Pm]}],stroke:[{stroke:["none",...$()]}],"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"]}},iI=$5(aI);function Ct(...t){return iI(ij(t))}function ts(t){if(!t)return"";let e=t.trim();return e?(e=e.replace(/^(https?)\/\//,"$1://"),e):""}const oI=oj("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 ne({className:t,variant:e,size:n,asChild:r=!1,...a}){const i=r?sj:"button";return s.jsx(i,{"data-slot":"button",className:Ct(oI({variant:e,size:n,className:t})),...a})}function ie({className:t,type:e,...n}){return s.jsx("input",{type:e,"data-slot":"input",className:Ct("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs outline-none placeholder:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 md:text-sm focus-visible:ring-2 focus-visible:ring-ring",t),...n})}function lI(){const t=Di(),[e,n]=b.useState(""),[r,a]=b.useState(""),[i,o]=b.useState(""),[c,u]=b.useState(!1),h=async()=>{o(""),u(!0);try{const f=await Nt("/api/admin",{username:e.trim(),password:r});if((f==null?void 0:f.success)!==!1&&(f!=null&&f.token)){a5(f.token),t("/dashboard",{replace:!0});return}o(f.error||"用户名或密码错误")}catch(f){const m=f;o(m.status===401?"用户名或密码错误":(m==null?void 0:m.message)||"网络错误,请重试")}finally{u(!1)}};return s.jsxs("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-4",children:[s.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[s.jsx("div",{className:"absolute top-1/4 left-1/4 w-96 h-96 bg-[#38bdac]/5 rounded-full blur-3xl"}),s.jsx("div",{className:"absolute bottom-1/4 right-1/4 w-96 h-96 bg-blue-500/5 rounded-full blur-3xl"})]}),s.jsxs("div",{className:"w-full max-w-md relative z-10",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.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:s.jsx(Wx,{className:"w-8 h-8 text-[#38bdac]"})}),s.jsx("h1",{className:"text-2xl font-bold text-white mb-2",children:"管理后台"}),s.jsx("p",{className:"text-gray-400",children:"一场SOUL的创业实验场"})]}),s.jsxs("div",{className:"bg-[#0f2137] rounded-2xl p-8 shadow-xl border border-gray-700/50 backdrop-blur-xl",children:[s.jsx("h2",{className:"text-xl font-semibold text-white mb-6 text-center",children:"管理员登录"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"用户名"}),s.jsxs("div",{className:"relative",children:[s.jsx(No,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(ie,{type:"text",value:e,onChange:f=>n(f.target.value),placeholder:"请输入用户名",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"密码"}),s.jsxs("div",{className:"relative",children:[s.jsx(eA,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(ie,{type:"password",value:r,onChange:f=>a(f.target.value),placeholder:"请输入密码",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]",onKeyDown:f=>f.key==="Enter"&&h()})]})]}),i&&s.jsx("div",{className:"bg-red-500/10 text-red-400 text-sm p-3 rounded-lg border border-red-500/20",children:i}),s.jsx(ne,{onClick:h,disabled:c,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white py-5 disabled:opacity-50",children:c?"登录中...":"登录"})]})]}),s.jsx("p",{className:"text-center text-gray-500 text-xs mt-6",children:"Soul创业实验场 · 后台管理系统"})]})]})}const Se=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ct("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Se.displayName="Card";const qe=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ct("flex flex-col space-y-1.5 p-6",t),...e}));qe.displayName="CardHeader";const Ge=b.forwardRef(({className:t,...e},n)=>s.jsx("h3",{ref:n,className:Ct("font-semibold leading-none tracking-tight",t),...e}));Ge.displayName="CardTitle";const Ht=b.forwardRef(({className:t,...e},n)=>s.jsx("p",{ref:n,className:Ct("text-sm text-muted-foreground",t),...e}));Ht.displayName="CardDescription";const Ce=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ct("p-6 pt-0",t),...e}));Ce.displayName="CardContent";const cI=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ct("flex items-center p-6 pt-0",t),...e}));cI.displayName="CardFooter";const dI={success:{bg:"#f0fdf4",border:"#22c55e",icon:"✓"},error:{bg:"#fef2f2",border:"#ef4444",icon:"✕"},info:{bg:"#eff6ff",border:"#3b82f6",icon:"ℹ"}};function Om(t,e="info",n=3e3){const r=`toast-${Date.now()}`,a=dI[e],i=document.createElement("div");i.id=r,i.setAttribute("role","alert"),Object.assign(i.style,{position:"fixed",top:"24px",right:"24px",zIndex:"9999",display:"flex",alignItems:"center",gap:"10px",padding:"12px 18px",borderRadius:"10px",background:a.bg,border:`1.5px solid ${a.border}`,boxShadow:"0 4px 20px rgba(0,0,0,.12)",fontSize:"14px",color:"#1a1a1a",fontWeight:"500",maxWidth:"380px",lineHeight:"1.5",opacity:"0",transform:"translateY(-8px)",transition:"opacity .22s ease, transform .22s ease",pointerEvents:"none"});const o=document.createElement("span");Object.assign(o.style,{width:"20px",height:"20px",borderRadius:"50%",background:a.border,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:"700",flexShrink:"0"}),o.textContent=a.icon;const c=document.createElement("span");c.textContent=t,i.appendChild(o),i.appendChild(c),document.body.appendChild(i),requestAnimationFrame(()=>{i.style.opacity="1",i.style.transform="translateY(0)"});const u=setTimeout(()=>h(r),n);function h(f){clearTimeout(u);const m=document.getElementById(f);m&&(m.style.opacity="0",m.style.transform="translateY(-8px)",setTimeout(()=>{var g;return(g=m.parentNode)==null?void 0:g.removeChild(m)},250))}}const le={success:(t,e)=>Om(t,"success",e),error:(t,e)=>Om(t,"error",e),info:(t,e)=>Om(t,"info",e)};function at(t,e,{checkForDefaultPrevented:n=!0}={}){return function(a){if(t==null||t(a),n===!1||!a.defaultPrevented)return e==null?void 0:e(a)}}function uI(t,e){const n=b.createContext(e),r=i=>{const{children:o,...c}=i,u=b.useMemo(()=>c,Object.values(c));return s.jsx(n.Provider,{value:u,children:o})};r.displayName=t+"Provider";function a(i){const o=b.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${i}\` must be used within \`${t}\``)}return[r,a]}function Li(t,e=[]){let n=[];function r(i,o){const c=b.createContext(o),u=n.length;n=[...n,o];const h=m=>{var k;const{scope:g,children:y,...v}=m,w=((k=g==null?void 0:g[t])==null?void 0:k[u])||c,N=b.useMemo(()=>v,Object.values(v));return s.jsx(w.Provider,{value:N,children:y})};h.displayName=i+"Provider";function f(m,g){var w;const y=((w=g==null?void 0:g[t])==null?void 0:w[u])||c,v=b.useContext(y);if(v)return v;if(o!==void 0)return o;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[h,f]}const a=()=>{const i=n.map(o=>b.createContext(o));return function(c){const u=(c==null?void 0:c[t])||i;return b.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])}};return a.scopeName=t,[r,hI(a,...e)]}function hI(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const o=r.reduce((c,{useScope:u,scopeName:h})=>{const m=u(i)[`__scope${h}`];return{...c,...m}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var rr=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},fI=gf[" useId ".trim().toString()]||(()=>{}),pI=0;function ji(t){const[e,n]=b.useState(fI());return rr(()=>{n(r=>r??String(pI++))},[t]),e?`radix-${e}`:""}var mI=gf[" useInsertionEffect ".trim().toString()]||rr;function Eo({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[a,i,o]=gI({defaultProp:e,onChange:n}),c=t!==void 0,u=c?t:a;{const f=b.useRef(t!==void 0);b.useEffect(()=>{const m=f.current;m!==c&&console.warn(`${r} is changing from ${m?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=c},[c,r])}const h=b.useCallback(f=>{var m;if(c){const g=xI(f)?f(t):f;g!==t&&((m=o.current)==null||m.call(o,g))}else i(f)},[c,t,i,o]);return[u,h]}function gI({defaultProp:t,onChange:e}){const[n,r]=b.useState(t),a=b.useRef(n),i=b.useRef(e);return mI(()=>{i.current=e},[e]),b.useEffect(()=>{var o;a.current!==n&&((o=i.current)==null||o.call(i,n),a.current=n)},[n,a]),[n,r,i]}function xI(t){return typeof t=="function"}function ld(t){const e=yI(t),n=b.forwardRef((r,a)=>{const{children:i,...o}=r,c=b.Children.toArray(i),u=c.find(vI);if(u){const h=u.props.children,f=c.map(m=>m===u?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:a,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:a,children:i})});return n.displayName=`${t}.Slot`,n}function yI(t){const e=b.forwardRef((n,r)=>{const{children:a,...i}=n;if(b.isValidElement(a)){const o=wI(a),c=NI(i,a.props);return a.type!==b.Fragment&&(c.ref=r?qx(r,o):o),b.cloneElement(a,c)}return b.Children.count(a)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var bI=Symbol("radix.slottable");function vI(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===bI}function NI(t,e){const n={...e};for(const r in e){const a=t[r],i=e[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...c)=>{const u=i(...c);return a(...c),u}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...t,...n}}function wI(t){var r,a;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var jI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ut=jI.reduce((t,e)=>{const n=ld(`Primitive.${e}`),r=b.forwardRef((a,i)=>{const{asChild:o,...c}=a,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function kI(t,e){t&&jd.flushSync(()=>t.dispatchEvent(e))}function Ti(t){const e=b.useRef(t);return b.useEffect(()=>{e.current=t}),b.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function SI(t,e=globalThis==null?void 0:globalThis.document){const n=Ti(t);b.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var CI="DismissableLayer",Bg="dismissableLayer.update",EI="dismissableLayer.pointerDownOutside",TI="dismissableLayer.focusOutside",Zv,vj=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Jx=b.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,onDismiss:c,...u}=t,h=b.useContext(vj),[f,m]=b.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=b.useState({}),v=St(e,_=>m(_)),w=Array.from(h.layers),[N]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),k=w.indexOf(N),C=f?w.indexOf(f):-1,E=h.layersWithOutsidePointerEventsDisabled.size>0,A=C>=k,I=II(_=>{const P=_.target,L=[...h.branches].some(z=>z.contains(P));!A||L||(a==null||a(_),o==null||o(_),_.defaultPrevented||c==null||c())},g),D=RI(_=>{const P=_.target;[...h.branches].some(z=>z.contains(P))||(i==null||i(_),o==null||o(_),_.defaultPrevented||c==null||c())},g);return SI(_=>{C===h.layers.size-1&&(r==null||r(_),!_.defaultPrevented&&c&&(_.preventDefault(),c()))},g),b.useEffect(()=>{if(f)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(Zv=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),e1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=Zv)}},[f,g,n,h]),b.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),e1())},[f,h]),b.useEffect(()=>{const _=()=>y({});return document.addEventListener(Bg,_),()=>document.removeEventListener(Bg,_)},[]),s.jsx(ut.div,{...u,ref:v,style:{pointerEvents:E?A?"auto":"none":void 0,...t.style},onFocusCapture:at(t.onFocusCapture,D.onFocusCapture),onBlurCapture:at(t.onBlurCapture,D.onBlurCapture),onPointerDownCapture:at(t.onPointerDownCapture,I.onPointerDownCapture)})});Jx.displayName=CI;var MI="DismissableLayerBranch",AI=b.forwardRef((t,e)=>{const n=b.useContext(vj),r=b.useRef(null),a=St(e,r);return b.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),s.jsx(ut.div,{...t,ref:a})});AI.displayName=MI;function II(t,e=globalThis==null?void 0:globalThis.document){const n=Ti(t),r=b.useRef(!1),a=b.useRef(()=>{});return b.useEffect(()=>{const i=c=>{if(c.target&&!r.current){let u=function(){Nj(EI,n,h,{discrete:!0})};const h={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",a.current),a.current=u,e.addEventListener("click",a.current,{once:!0})):u()}else e.removeEventListener("click",a.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",i),e.removeEventListener("click",a.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function RI(t,e=globalThis==null?void 0:globalThis.document){const n=Ti(t),r=b.useRef(!1);return b.useEffect(()=>{const a=i=>{i.target&&!r.current&&Nj(TI,n,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",a),()=>e.removeEventListener("focusin",a)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function e1(){const t=new CustomEvent(Bg);document.dispatchEvent(t)}function Nj(t,e,n,{discrete:r}){const a=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&a.addEventListener(t,e,{once:!0}),r?kI(a,i):a.dispatchEvent(i)}var Dm="focusScope.autoFocusOnMount",Lm="focusScope.autoFocusOnUnmount",t1={bubbles:!1,cancelable:!0},PI="FocusScope",Yx=b.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=t,[c,u]=b.useState(null),h=Ti(a),f=Ti(i),m=b.useRef(null),g=St(e,w=>u(w)),y=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(r){let w=function(E){if(y.paused||!c)return;const A=E.target;c.contains(A)?m.current=A:li(m.current,{select:!0})},N=function(E){if(y.paused||!c)return;const A=E.relatedTarget;A!==null&&(c.contains(A)||li(m.current,{select:!0}))},k=function(E){if(document.activeElement===document.body)for(const I of E)I.removedNodes.length>0&&li(c)};document.addEventListener("focusin",w),document.addEventListener("focusout",N);const C=new MutationObserver(k);return c&&C.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",N),C.disconnect()}}},[r,c,y.paused]),b.useEffect(()=>{if(c){r1.add(y);const w=document.activeElement;if(!c.contains(w)){const k=new CustomEvent(Dm,t1);c.addEventListener(Dm,h),c.dispatchEvent(k),k.defaultPrevented||(OI($I(wj(c)),{select:!0}),document.activeElement===w&&li(c))}return()=>{c.removeEventListener(Dm,h),setTimeout(()=>{const k=new CustomEvent(Lm,t1);c.addEventListener(Lm,f),c.dispatchEvent(k),k.defaultPrevented||li(w??document.body,{select:!0}),c.removeEventListener(Lm,f),r1.remove(y)},0)}}},[c,h,f,y]);const v=b.useCallback(w=>{if(!n&&!r||y.paused)return;const N=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,k=document.activeElement;if(N&&k){const C=w.currentTarget,[E,A]=DI(C);E&&A?!w.shiftKey&&k===A?(w.preventDefault(),n&&li(E,{select:!0})):w.shiftKey&&k===E&&(w.preventDefault(),n&&li(A,{select:!0})):k===C&&w.preventDefault()}},[n,r,y.paused]);return s.jsx(ut.div,{tabIndex:-1,...o,ref:g,onKeyDown:v})});Yx.displayName=PI;function OI(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(li(r,{select:e}),document.activeElement!==n)return}function DI(t){const e=wj(t),n=n1(e,t),r=n1(e.reverse(),t);return[n,r]}function wj(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function n1(t,e){for(const n of t)if(!LI(n,{upTo:e}))return n}function LI(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function _I(t){return t instanceof HTMLInputElement&&"select"in t}function li(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&_I(t)&&e&&t.select()}}var r1=zI();function zI(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=s1(t,e),t.unshift(e)},remove(e){var n;t=s1(t,e),(n=t[0])==null||n.resume()}}}function s1(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function $I(t){return t.filter(e=>e.tagName!=="A")}var FI="Portal",Qx=b.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[a,i]=b.useState(!1);rr(()=>i(!0),[]);const o=n||a&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return o?Dw.createPortal(s.jsx(ut.div,{...r,ref:e}),o):null});Qx.displayName=FI;function BI(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}var kd=t=>{const{present:e,children:n}=t,r=VI(e),a=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),i=St(r.ref,HI(a));return typeof n=="function"||r.isPresent?b.cloneElement(a,{ref:i}):null};kd.displayName="Presence";function VI(t){const[e,n]=b.useState(),r=b.useRef(null),a=b.useRef(t),i=b.useRef("none"),o=t?"mounted":"unmounted",[c,u]=BI(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const h=Ou(r.current);i.current=c==="mounted"?h:"none"},[c]),rr(()=>{const h=r.current,f=a.current;if(f!==t){const g=i.current,y=Ou(h);t?u("MOUNT"):y==="none"||(h==null?void 0:h.display)==="none"?u("UNMOUNT"):u(f&&g!==y?"ANIMATION_OUT":"UNMOUNT"),a.current=t}},[t,u]),rr(()=>{if(e){let h;const f=e.ownerDocument.defaultView??window,m=y=>{const w=Ou(r.current).includes(CSS.escape(y.animationName));if(y.target===e&&w&&(u("ANIMATION_END"),!a.current)){const N=e.style.animationFillMode;e.style.animationFillMode="forwards",h=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=N)})}},g=y=>{y.target===e&&(i.current=Ou(r.current))};return e.addEventListener("animationstart",g),e.addEventListener("animationcancel",m),e.addEventListener("animationend",m),()=>{f.clearTimeout(h),e.removeEventListener("animationstart",g),e.removeEventListener("animationcancel",m),e.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:b.useCallback(h=>{r.current=h?getComputedStyle(h):null,n(h)},[])}}function Ou(t){return(t==null?void 0:t.animationName)||"none"}function HI(t){var r,a;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var _m=0;function jj(){b.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??a1()),document.body.insertAdjacentElement("beforeend",t[1]??a1()),_m++,()=>{_m===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),_m--}},[])}function a1(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Hs=function(){return Hs=Object.assign||function(e){for(var n,r=1,a=arguments.length;r"u")return iR;var e=oR(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},cR=Ej(),Il="data-scroll-locked",dR=function(t,e,n,r){var a=t.left,i=t.top,o=t.right,c=t.gap;return n===void 0&&(n="margin"),` + */const s5=[["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"}]],yi=Te("zap",s5),Ux="admin_token";function Kx(){try{return localStorage.getItem(Ux)}catch{return null}}function a5(t){try{localStorage.setItem(Ux,t)}catch{}}function i5(){try{localStorage.removeItem(Ux)}catch{}}const o5="https://soulapi.quwanzhi.com",l5=15e3,c5=()=>{const t="https://soulapi.quwanzhi.com";return t.length>0?t.replace(/\/$/,""):o5};function ja(t){const e=c5(),n=t.startsWith("/")?t:`/${t}`;return e?`${e}${n}`:n}async function bf(t,e={}){const{data:n,...r}=e,a=ja(t),i=new Headers(r.headers),o=Kx();o&&i.set("Authorization",`Bearer ${o}`),n!=null&&!i.has("Content-Type")&&i.set("Content-Type","application/json");const c=n!=null?JSON.stringify(n):r.body,u=new AbortController,h=setTimeout(()=>u.abort(),l5),f=await fetch(a,{...r,headers:i,body:c,credentials:"include",signal:u.signal}).finally(()=>clearTimeout(h)),g=(f.headers.get("Content-Type")||"").includes("application/json")?await f.json():f;if(!f.ok){const y=new Error((g==null?void 0:g.error)||`HTTP ${f.status}`);throw y.status=f.status,y.data=g,y}return g}function De(t,e){return bf(t,{...e,method:"GET"})}function vt(t,e,n){return bf(t,{...n,method:"POST",data:e})}function Tt(t,e,n){return bf(t,{...n,method:"PUT",data:e})}function wa(t,e){return bf(t,{...e,method:"DELETE"})}const d5=[{icon:KM,label:"数据概览",href:"/dashboard"},{icon:$r,label:"内容管理",href:"/content"},{icon:Mn,label:"用户管理",href:"/users"},{icon:kM,label:"找伙伴",href:"/find-partner"},{icon:Ll,label:"推广中心",href:"/distribution"}];function u5(){const t=Oi(),e=Di(),[n,r]=b.useState(!1),[a,i]=b.useState(!1);b.useEffect(()=>{r(!0)},[]),b.useEffect(()=>{if(!n)return;i(!1);let c=!1;return De("/api/admin").then(u=>{c||(u&&u.success!==!1?i(!0):e("/login",{replace:!0}))}).catch(()=>{c||e("/login",{replace:!0})}),()=>{c=!0}},[n,e]);const o=async()=>{i5();try{await vt("/api/admin/logout",{})}catch{}e("/login",{replace:!0})};return!n||!a?s.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[s.jsx("div",{className:"w-64 bg-[#0f2137] border-r border-gray-700/50"}),s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-[#38bdac]",children:"加载中..."})})]}):s.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[s.jsxs("div",{className:"w-64 bg-[#0f2137] flex flex-col border-r border-gray-700/50 shadow-xl",children:[s.jsxs("div",{className:"p-6 border-b border-gray-700/50",children:[s.jsx("h1",{className:"text-xl font-bold text-[#38bdac]",children:"管理后台"}),s.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Soul创业派对"})]}),s.jsx("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:d5.map(c=>{const u=t.pathname===c.href;return s.jsxs(Ag,{to:c.href,className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${u?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[s.jsx(c.icon,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"text-sm",children:c.label})]},c.href)})}),s.jsxs("div",{className:"p-4 border-t border-gray-700/50 space-y-1",children:[s.jsxs(Ag,{to:"/settings",className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${t.pathname==="/settings"?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[s.jsx(bo,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"text-sm",children:"系统设置"})]}),s.jsxs("button",{type:"button",onClick:o,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:[s.jsx(nA,{className:"w-5 h-5"}),s.jsx("span",{className:"text-sm",children:"退出登录"})]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto bg-[#0a1628] min-w-0",children:s.jsx("div",{className:"w-full min-w-[1024px] min-h-full",children:s.jsx(yT,{})})})]})}function Uv(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function qx(...t){return e=>{let n=!1;const r=t.map(a=>{const i=Uv(a,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a{let{children:i,...o}=r;nj(i)&&typeof gh=="function"&&(i=gh(i._payload));const c=b.Children.toArray(i),u=c.find(g5);if(u){const h=u.props.children,f=c.map(m=>m===u?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:a,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:a,children:i})});return n.displayName=`${t}.Slot`,n}var sj=rj("Slot");function p5(t){const e=b.forwardRef((n,r)=>{let{children:a,...i}=n;if(nj(a)&&typeof gh=="function"&&(a=gh(a._payload)),b.isValidElement(a)){const o=y5(a),c=x5(i,a.props);return a.type!==b.Fragment&&(c.ref=r?qx(r,o):o),b.cloneElement(a,c)}return b.Children.count(a)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var m5=Symbol("radix.slottable");function g5(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===m5}function x5(t,e){const n={...e};for(const r in e){const a=t[r],i=e[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...c)=>{const u=i(...c);return a(...c),u}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...t,...n}}function y5(t){var r,a;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function aj(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;etypeof t=="boolean"?`${t}`:t===0?"0":t,qv=ij,oj=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return qv(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:i}=e,o=Object.keys(a).map(h=>{const f=n==null?void 0:n[h],m=i==null?void 0:i[h];if(f===null)return null;const g=Kv(f)||Kv(m);return a[h][g]}),c=n&&Object.entries(n).reduce((h,f)=>{let[m,g]=f;return g===void 0||(h[m]=g),h},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,f)=>{let{class:m,className:g,...y}=f;return Object.entries(y).every(v=>{let[w,N]=v;return Array.isArray(N)?N.includes({...i,...c}[w]):{...i,...c}[w]===N})?[...h,m,g]:h},[]);return qv(t,o,u,n==null?void 0:n.class,n==null?void 0:n.className)},b5=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),lj=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),xh="-",Gv=[],N5="arbitrary..",w5=t=>{const e=k5(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return j5(o);const c=o.split(xh),u=c[0]===""&&c.length>1?1:0;return cj(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=r[o],h=n[o];return u?h?b5(h,u):u:h||Gv}return n[o]||Gv}}},cj=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const a=t[e],i=n.nextPart.get(a);if(i){const h=cj(t,e+1,i);if(h)return h}const o=n.validators;if(o===null)return;const c=e===0?t.join(xh):t.slice(e).join(xh),u=o.length;for(let h=0;ht.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?N5+r:void 0})(),k5=t=>{const{theme:e,classGroups:n}=t;return S5(n,e)},S5=(t,e)=>{const n=lj();for(const r in t){const a=t[r];Gx(a,n,r,e)}return n},Gx=(t,e,n,r)=>{const a=t.length;for(let i=0;i{if(typeof t=="string"){E5(t,e,n);return}if(typeof t=="function"){T5(t,e,n,r);return}M5(t,e,n,r)},E5=(t,e,n)=>{const r=t===""?e:dj(e,t);r.classGroupId=n},T5=(t,e,n,r)=>{if(A5(t)){Gx(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(v5(n,t))},M5=(t,e,n,r)=>{const a=Object.entries(t),i=a.length;for(let o=0;o{let n=t;const r=e.split(xh),a=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,I5=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const a=(i,o)=>{n[i]=o,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let o=n[i];if(o!==void 0)return o;if((o=r[i])!==void 0)return a(i,o),o},set(i,o){i in n?n[i]=o:a(i,o)}}},Fg="!",Jv=":",R5=[],Yv=(t,e,n,r,a)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),P5=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=a=>{const i=[];let o=0,c=0,u=0,h;const f=a.length;for(let w=0;wu?h-u:void 0;return Yv(i,y,g,v)};if(e){const a=e+Jv,i=r;r=o=>o.startsWith(a)?i(o.slice(a.length)):Yv(R5,!1,o,void 0,!0)}if(n){const a=r;r=i=>n({className:i,parseClassName:a})}return r},O5=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let a=[];for(let i=0;i0&&(a.sort(),r.push(...a),a=[]),r.push(o)):a.push(o)}return a.length>0&&(a.sort(),r.push(...a)),r}},D5=t=>({cache:I5(t.cacheSize),parseClassName:P5(t),sortModifiers:O5(t),...w5(t)}),L5=/\s+/,_5=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:i}=e,o=[],c=t.trim().split(L5);let u="";for(let h=c.length-1;h>=0;h-=1){const f=c[h],{isExternal:m,modifiers:g,hasImportantModifier:y,baseClassName:v,maybePostfixModifierPosition:w}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let N=!!w,k=r(N?v.substring(0,w):v);if(!k){if(!N){u=f+(u.length>0?" "+u:u);continue}if(k=r(v),!k){u=f+(u.length>0?" "+u:u);continue}N=!1}const C=g.length===0?"":g.length===1?g[0]:i(g).join(":"),E=y?C+Fg:C,A=E+k;if(o.indexOf(A)>-1)continue;o.push(A);const I=a(k,N);for(let D=0;D0?" "+u:u)}return u},z5=(...t)=>{let e=0,n,r,a="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,a,i;const o=u=>{const h=e.reduce((f,m)=>m(f),t());return n=D5(h),r=n.cache.get,a=n.cache.set,i=c,c(u)},c=u=>{const h=r(u);if(h)return h;const f=_5(u,n);return a(u,f),f};return i=o,(...u)=>i(z5(...u))},F5=[],En=t=>{const e=n=>n[t]||F5;return e.isThemeGetter=!0,e},hj=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,fj=/^\((?:(\w[\w-]*):)?(.+)\)$/i,B5=/^\d+\/\d+$/,V5=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,H5=/\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$/,W5=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,U5=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,K5=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,gl=t=>B5.test(t),dt=t=>!!t&&!Number.isNaN(Number(t)),ai=t=>!!t&&Number.isInteger(Number(t)),Rm=t=>t.endsWith("%")&&dt(t.slice(0,-1)),pa=t=>V5.test(t),q5=()=>!0,G5=t=>H5.test(t)&&!W5.test(t),pj=()=>!1,J5=t=>U5.test(t),Y5=t=>K5.test(t),Q5=t=>!ze(t)&&!$e(t),X5=t=>ql(t,xj,pj),ze=t=>hj.test(t),co=t=>ql(t,yj,G5),Pm=t=>ql(t,rI,dt),Qv=t=>ql(t,mj,pj),Z5=t=>ql(t,gj,Y5),Ru=t=>ql(t,bj,J5),$e=t=>fj.test(t),Pc=t=>Gl(t,yj),eI=t=>Gl(t,sI),Xv=t=>Gl(t,mj),tI=t=>Gl(t,xj),nI=t=>Gl(t,gj),Pu=t=>Gl(t,bj,!0),ql=(t,e,n)=>{const r=hj.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Gl=(t,e,n=!1)=>{const r=fj.exec(t);return r?r[1]?e(r[1]):n:!1},mj=t=>t==="position"||t==="percentage",gj=t=>t==="image"||t==="url",xj=t=>t==="length"||t==="size"||t==="bg-size",yj=t=>t==="length",rI=t=>t==="number",sI=t=>t==="family-name",bj=t=>t==="shadow",aI=()=>{const t=En("color"),e=En("font"),n=En("text"),r=En("font-weight"),a=En("tracking"),i=En("leading"),o=En("breakpoint"),c=En("container"),u=En("spacing"),h=En("radius"),f=En("shadow"),m=En("inset-shadow"),g=En("text-shadow"),y=En("drop-shadow"),v=En("blur"),w=En("perspective"),N=En("aspect"),k=En("ease"),C=En("animate"),E=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],I=()=>[...A(),$e,ze],D=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],P=()=>[$e,ze,u],L=()=>[gl,"full","auto",...P()],z=()=>[ai,"none","subgrid",$e,ze],ee=()=>["auto",{span:["full",ai,$e,ze]},ai,$e,ze],U=()=>[ai,"auto",$e,ze],he=()=>["auto","min","max","fr",$e,ze],me=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],R=()=>["start","end","center","stretch","center-safe","end-safe"],O=()=>["auto",...P()],X=()=>[gl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],$=()=>[t,$e,ze],ce=()=>[...A(),Xv,Qv,{position:[$e,ze]}],Y=()=>["no-repeat",{repeat:["","x","y","space","round"]}],F=()=>["auto","cover","contain",tI,X5,{size:[$e,ze]}],W=()=>[Rm,Pc,co],K=()=>["","none","full",h,$e,ze],B=()=>["",dt,Pc,co],oe=()=>["solid","dashed","dotted","double"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Q=()=>[dt,Rm,Xv,Qv],se=()=>["","none",v,$e,ze],ye=()=>["none",dt,$e,ze],Me=()=>["none",dt,$e,ze],Be=()=>[dt,$e,ze],He=()=>[gl,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[pa],breakpoint:[pa],color:[q5],container:[pa],"drop-shadow":[pa],ease:["in","out","in-out"],font:[Q5],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[pa],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[pa],shadow:[pa],spacing:["px",dt],text:[pa],"text-shadow":[pa],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",gl,ze,$e,N]}],container:["container"],columns:[{columns:[dt,ze,$e,c]}],"break-after":[{"break-after":E()}],"break-before":[{"break-before":E()}],"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:I()}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{start:L()}],end:[{end:L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[ai,"auto",$e,ze]}],basis:[{basis:[gl,"full","auto",c,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[dt,gl,"auto","initial","none",ze]}],grow:[{grow:["",dt,$e,ze]}],shrink:[{shrink:["",dt,$e,ze]}],order:[{order:[ai,"first","last","none",$e,ze]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:ee()}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:ee()}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":he()}],"auto-rows":[{"auto-rows":he()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...me(),"normal"]}],"justify-items":[{"justify-items":[...R(),"normal"]}],"justify-self":[{"justify-self":["auto",...R()]}],"align-content":[{content:["normal",...me()]}],"align-items":[{items:[...R(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...R(),{baseline:["","last"]}]}],"place-content":[{"place-content":me()}],"place-items":[{"place-items":[...R(),"baseline"]}],"place-self":[{"place-self":["auto",...R()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:O()}],mx:[{mx:O()}],my:[{my:O()}],ms:[{ms:O()}],me:[{me:O()}],mt:[{mt:O()}],mr:[{mr:O()}],mb:[{mb:O()}],ml:[{ml:O()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:X()}],w:[{w:[c,"screen",...X()]}],"min-w":[{"min-w":[c,"screen","none",...X()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...X()]}],h:[{h:["screen","lh",...X()]}],"min-h":[{"min-h":["screen","lh","none",...X()]}],"max-h":[{"max-h":["screen","lh",...X()]}],"font-size":[{text:["base",n,Pc,co]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,$e,Pm]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Rm,ze]}],"font-family":[{font:[eI,ze,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,$e,ze]}],"line-clamp":[{"line-clamp":[dt,"none",$e,Pm]}],leading:[{leading:[i,...P()]}],"list-image":[{"list-image":["none",$e,ze]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",$e,ze]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:$()}],"text-color":[{text:$()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:[dt,"from-font","auto",$e,co]}],"text-decoration-color":[{decoration:$()}],"underline-offset":[{"underline-offset":[dt,"auto",$e,ze]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",$e,ze]}],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",$e,ze]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ce()}],"bg-repeat":[{bg:Y()}],"bg-size":[{bg:F()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ai,$e,ze],radial:["",$e,ze],conic:[ai,$e,ze]},nI,Z5]}],"bg-color":[{bg:$()}],"gradient-from-pos":[{from:W()}],"gradient-via-pos":[{via:W()}],"gradient-to-pos":[{to:W()}],"gradient-from":[{from:$()}],"gradient-via":[{via:$()}],"gradient-to":[{to:$()}],rounded:[{rounded:K()}],"rounded-s":[{"rounded-s":K()}],"rounded-e":[{"rounded-e":K()}],"rounded-t":[{"rounded-t":K()}],"rounded-r":[{"rounded-r":K()}],"rounded-b":[{"rounded-b":K()}],"rounded-l":[{"rounded-l":K()}],"rounded-ss":[{"rounded-ss":K()}],"rounded-se":[{"rounded-se":K()}],"rounded-ee":[{"rounded-ee":K()}],"rounded-es":[{"rounded-es":K()}],"rounded-tl":[{"rounded-tl":K()}],"rounded-tr":[{"rounded-tr":K()}],"rounded-br":[{"rounded-br":K()}],"rounded-bl":[{"rounded-bl":K()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":B()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...oe(),"hidden","none"]}],"divide-style":[{divide:[...oe(),"hidden","none"]}],"border-color":[{border:$()}],"border-color-x":[{"border-x":$()}],"border-color-y":[{"border-y":$()}],"border-color-s":[{"border-s":$()}],"border-color-e":[{"border-e":$()}],"border-color-t":[{"border-t":$()}],"border-color-r":[{"border-r":$()}],"border-color-b":[{"border-b":$()}],"border-color-l":[{"border-l":$()}],"divide-color":[{divide:$()}],"outline-style":[{outline:[...oe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[dt,$e,ze]}],"outline-w":[{outline:["",dt,Pc,co]}],"outline-color":[{outline:$()}],shadow:[{shadow:["","none",f,Pu,Ru]}],"shadow-color":[{shadow:$()}],"inset-shadow":[{"inset-shadow":["none",m,Pu,Ru]}],"inset-shadow-color":[{"inset-shadow":$()}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:$()}],"ring-offset-w":[{"ring-offset":[dt,co]}],"ring-offset-color":[{"ring-offset":$()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":$()}],"text-shadow":[{"text-shadow":["none",g,Pu,Ru]}],"text-shadow-color":[{"text-shadow":$()}],opacity:[{opacity:[dt,$e,ze]}],"mix-blend":[{"mix-blend":[...G(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":G()}],"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":[dt]}],"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":$()}],"mask-image-linear-to-color":[{"mask-linear-to":$()}],"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":$()}],"mask-image-t-to-color":[{"mask-t-to":$()}],"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":$()}],"mask-image-r-to-color":[{"mask-r-to":$()}],"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":$()}],"mask-image-b-to-color":[{"mask-b-to":$()}],"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":$()}],"mask-image-l-to-color":[{"mask-l-to":$()}],"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":$()}],"mask-image-x-to-color":[{"mask-x-to":$()}],"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":$()}],"mask-image-y-to-color":[{"mask-y-to":$()}],"mask-image-radial":[{"mask-radial":[$e,ze]}],"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":$()}],"mask-image-radial-to-color":[{"mask-radial-to":$()}],"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":A()}],"mask-image-conic-pos":[{"mask-conic":[dt]}],"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":$()}],"mask-image-conic-to-color":[{"mask-conic-to":$()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ce()}],"mask-repeat":[{mask:Y()}],"mask-size":[{mask:F()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",$e,ze]}],filter:[{filter:["","none",$e,ze]}],blur:[{blur:se()}],brightness:[{brightness:[dt,$e,ze]}],contrast:[{contrast:[dt,$e,ze]}],"drop-shadow":[{"drop-shadow":["","none",y,Pu,Ru]}],"drop-shadow-color":[{"drop-shadow":$()}],grayscale:[{grayscale:["",dt,$e,ze]}],"hue-rotate":[{"hue-rotate":[dt,$e,ze]}],invert:[{invert:["",dt,$e,ze]}],saturate:[{saturate:[dt,$e,ze]}],sepia:[{sepia:["",dt,$e,ze]}],"backdrop-filter":[{"backdrop-filter":["","none",$e,ze]}],"backdrop-blur":[{"backdrop-blur":se()}],"backdrop-brightness":[{"backdrop-brightness":[dt,$e,ze]}],"backdrop-contrast":[{"backdrop-contrast":[dt,$e,ze]}],"backdrop-grayscale":[{"backdrop-grayscale":["",dt,$e,ze]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[dt,$e,ze]}],"backdrop-invert":[{"backdrop-invert":["",dt,$e,ze]}],"backdrop-opacity":[{"backdrop-opacity":[dt,$e,ze]}],"backdrop-saturate":[{"backdrop-saturate":[dt,$e,ze]}],"backdrop-sepia":[{"backdrop-sepia":["",dt,$e,ze]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",$e,ze]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[dt,"initial",$e,ze]}],ease:[{ease:["linear","initial",k,$e,ze]}],delay:[{delay:[dt,$e,ze]}],animate:[{animate:["none",C,$e,ze]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,$e,ze]}],"perspective-origin":[{"perspective-origin":I()}],rotate:[{rotate:ye()}],"rotate-x":[{"rotate-x":ye()}],"rotate-y":[{"rotate-y":ye()}],"rotate-z":[{"rotate-z":ye()}],scale:[{scale:Me()}],"scale-x":[{"scale-x":Me()}],"scale-y":[{"scale-y":Me()}],"scale-z":[{"scale-z":Me()}],"scale-3d":["scale-3d"],skew:[{skew:Be()}],"skew-x":[{"skew-x":Be()}],"skew-y":[{"skew-y":Be()}],transform:[{transform:[$e,ze,"","none","gpu","cpu"]}],"transform-origin":[{origin:I()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:He()}],"translate-x":[{"translate-x":He()}],"translate-y":[{"translate-y":He()}],"translate-z":[{"translate-z":He()}],"translate-none":["translate-none"],accent:[{accent:$()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:$()}],"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",$e,ze]}],"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":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"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",$e,ze]}],fill:[{fill:["none",...$()]}],"stroke-w":[{stroke:[dt,Pc,co,Pm]}],stroke:[{stroke:["none",...$()]}],"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"]}},iI=$5(aI);function Ct(...t){return iI(ij(t))}function ns(t){if(!t)return"";let e=t.trim();return e?(e=e.replace(/^(https?)\/\//,"$1://"),e):""}const oI=oj("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 ne({className:t,variant:e,size:n,asChild:r=!1,...a}){const i=r?sj:"button";return s.jsx(i,{"data-slot":"button",className:Ct(oI({variant:e,size:n,className:t})),...a})}function ie({className:t,type:e,...n}){return s.jsx("input",{type:e,"data-slot":"input",className:Ct("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs outline-none placeholder:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 md:text-sm focus-visible:ring-2 focus-visible:ring-ring",t),...n})}function lI(){const t=Di(),[e,n]=b.useState(""),[r,a]=b.useState(""),[i,o]=b.useState(""),[c,u]=b.useState(!1),h=async()=>{o(""),u(!0);try{const f=await vt("/api/admin",{username:e.trim(),password:r});if((f==null?void 0:f.success)!==!1&&(f!=null&&f.token)){a5(f.token),t("/dashboard",{replace:!0});return}o(f.error||"用户名或密码错误")}catch(f){const m=f;o(m.status===401?"用户名或密码错误":(m==null?void 0:m.message)||"网络错误,请重试")}finally{u(!1)}};return s.jsxs("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-4",children:[s.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[s.jsx("div",{className:"absolute top-1/4 left-1/4 w-96 h-96 bg-[#38bdac]/5 rounded-full blur-3xl"}),s.jsx("div",{className:"absolute bottom-1/4 right-1/4 w-96 h-96 bg-blue-500/5 rounded-full blur-3xl"})]}),s.jsxs("div",{className:"w-full max-w-md relative z-10",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.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:s.jsx(Wx,{className:"w-8 h-8 text-[#38bdac]"})}),s.jsx("h1",{className:"text-2xl font-bold text-white mb-2",children:"管理后台"}),s.jsx("p",{className:"text-gray-400",children:"一场SOUL的创业实验场"})]}),s.jsxs("div",{className:"bg-[#0f2137] rounded-2xl p-8 shadow-xl border border-gray-700/50 backdrop-blur-xl",children:[s.jsx("h2",{className:"text-xl font-semibold text-white mb-6 text-center",children:"管理员登录"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"用户名"}),s.jsxs("div",{className:"relative",children:[s.jsx(No,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(ie,{type:"text",value:e,onChange:f=>n(f.target.value),placeholder:"请输入用户名",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"密码"}),s.jsxs("div",{className:"relative",children:[s.jsx(eA,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(ie,{type:"password",value:r,onChange:f=>a(f.target.value),placeholder:"请输入密码",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]",onKeyDown:f=>f.key==="Enter"&&h()})]})]}),i&&s.jsx("div",{className:"bg-red-500/10 text-red-400 text-sm p-3 rounded-lg border border-red-500/20",children:i}),s.jsx(ne,{onClick:h,disabled:c,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white py-5 disabled:opacity-50",children:c?"登录中...":"登录"})]})]}),s.jsx("p",{className:"text-center text-gray-500 text-xs mt-6",children:"Soul创业实验场 · 后台管理系统"})]})]})}const Se=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ct("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Se.displayName="Card";const qe=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ct("flex flex-col space-y-1.5 p-6",t),...e}));qe.displayName="CardHeader";const Ge=b.forwardRef(({className:t,...e},n)=>s.jsx("h3",{ref:n,className:Ct("font-semibold leading-none tracking-tight",t),...e}));Ge.displayName="CardTitle";const Ht=b.forwardRef(({className:t,...e},n)=>s.jsx("p",{ref:n,className:Ct("text-sm text-muted-foreground",t),...e}));Ht.displayName="CardDescription";const Ce=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ct("p-6 pt-0",t),...e}));Ce.displayName="CardContent";const cI=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ct("flex items-center p-6 pt-0",t),...e}));cI.displayName="CardFooter";const dI={success:{bg:"#f0fdf4",border:"#22c55e",icon:"✓"},error:{bg:"#fef2f2",border:"#ef4444",icon:"✕"},info:{bg:"#eff6ff",border:"#3b82f6",icon:"ℹ"}};function Om(t,e="info",n=3e3){const r=`toast-${Date.now()}`,a=dI[e],i=document.createElement("div");i.id=r,i.setAttribute("role","alert"),Object.assign(i.style,{position:"fixed",top:"24px",right:"24px",zIndex:"9999",display:"flex",alignItems:"center",gap:"10px",padding:"12px 18px",borderRadius:"10px",background:a.bg,border:`1.5px solid ${a.border}`,boxShadow:"0 4px 20px rgba(0,0,0,.12)",fontSize:"14px",color:"#1a1a1a",fontWeight:"500",maxWidth:"380px",lineHeight:"1.5",opacity:"0",transform:"translateY(-8px)",transition:"opacity .22s ease, transform .22s ease",pointerEvents:"none"});const o=document.createElement("span");Object.assign(o.style,{width:"20px",height:"20px",borderRadius:"50%",background:a.border,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:"700",flexShrink:"0"}),o.textContent=a.icon;const c=document.createElement("span");c.textContent=t,i.appendChild(o),i.appendChild(c),document.body.appendChild(i),requestAnimationFrame(()=>{i.style.opacity="1",i.style.transform="translateY(0)"});const u=setTimeout(()=>h(r),n);function h(f){clearTimeout(u);const m=document.getElementById(f);m&&(m.style.opacity="0",m.style.transform="translateY(-8px)",setTimeout(()=>{var g;return(g=m.parentNode)==null?void 0:g.removeChild(m)},250))}}const le={success:(t,e)=>Om(t,"success",e),error:(t,e)=>Om(t,"error",e),info:(t,e)=>Om(t,"info",e)};function at(t,e,{checkForDefaultPrevented:n=!0}={}){return function(a){if(t==null||t(a),n===!1||!a.defaultPrevented)return e==null?void 0:e(a)}}function uI(t,e){const n=b.createContext(e),r=i=>{const{children:o,...c}=i,u=b.useMemo(()=>c,Object.values(c));return s.jsx(n.Provider,{value:u,children:o})};r.displayName=t+"Provider";function a(i){const o=b.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${i}\` must be used within \`${t}\``)}return[r,a]}function Li(t,e=[]){let n=[];function r(i,o){const c=b.createContext(o),u=n.length;n=[...n,o];const h=m=>{var k;const{scope:g,children:y,...v}=m,w=((k=g==null?void 0:g[t])==null?void 0:k[u])||c,N=b.useMemo(()=>v,Object.values(v));return s.jsx(w.Provider,{value:N,children:y})};h.displayName=i+"Provider";function f(m,g){var w;const y=((w=g==null?void 0:g[t])==null?void 0:w[u])||c,v=b.useContext(y);if(v)return v;if(o!==void 0)return o;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[h,f]}const a=()=>{const i=n.map(o=>b.createContext(o));return function(c){const u=(c==null?void 0:c[t])||i;return b.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])}};return a.scopeName=t,[r,hI(a,...e)]}function hI(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const o=r.reduce((c,{useScope:u,scopeName:h})=>{const m=u(i)[`__scope${h}`];return{...c,...m}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var rr=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},fI=gf[" useId ".trim().toString()]||(()=>{}),pI=0;function ji(t){const[e,n]=b.useState(fI());return rr(()=>{n(r=>r??String(pI++))},[t]),e?`radix-${e}`:""}var mI=gf[" useInsertionEffect ".trim().toString()]||rr;function Eo({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[a,i,o]=gI({defaultProp:e,onChange:n}),c=t!==void 0,u=c?t:a;{const f=b.useRef(t!==void 0);b.useEffect(()=>{const m=f.current;m!==c&&console.warn(`${r} is changing from ${m?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=c},[c,r])}const h=b.useCallback(f=>{var m;if(c){const g=xI(f)?f(t):f;g!==t&&((m=o.current)==null||m.call(o,g))}else i(f)},[c,t,i,o]);return[u,h]}function gI({defaultProp:t,onChange:e}){const[n,r]=b.useState(t),a=b.useRef(n),i=b.useRef(e);return mI(()=>{i.current=e},[e]),b.useEffect(()=>{var o;a.current!==n&&((o=i.current)==null||o.call(i,n),a.current=n)},[n,a]),[n,r,i]}function xI(t){return typeof t=="function"}function ld(t){const e=yI(t),n=b.forwardRef((r,a)=>{const{children:i,...o}=r,c=b.Children.toArray(i),u=c.find(vI);if(u){const h=u.props.children,f=c.map(m=>m===u?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:a,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:a,children:i})});return n.displayName=`${t}.Slot`,n}function yI(t){const e=b.forwardRef((n,r)=>{const{children:a,...i}=n;if(b.isValidElement(a)){const o=wI(a),c=NI(i,a.props);return a.type!==b.Fragment&&(c.ref=r?qx(r,o):o),b.cloneElement(a,c)}return b.Children.count(a)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var bI=Symbol("radix.slottable");function vI(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===bI}function NI(t,e){const n={...e};for(const r in e){const a=t[r],i=e[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...c)=>{const u=i(...c);return a(...c),u}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...t,...n}}function wI(t){var r,a;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var jI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ut=jI.reduce((t,e)=>{const n=ld(`Primitive.${e}`),r=b.forwardRef((a,i)=>{const{asChild:o,...c}=a,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function kI(t,e){t&&jd.flushSync(()=>t.dispatchEvent(e))}function Ti(t){const e=b.useRef(t);return b.useEffect(()=>{e.current=t}),b.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function SI(t,e=globalThis==null?void 0:globalThis.document){const n=Ti(t);b.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var CI="DismissableLayer",Bg="dismissableLayer.update",EI="dismissableLayer.pointerDownOutside",TI="dismissableLayer.focusOutside",Zv,vj=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Jx=b.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,onDismiss:c,...u}=t,h=b.useContext(vj),[f,m]=b.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=b.useState({}),v=St(e,_=>m(_)),w=Array.from(h.layers),[N]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),k=w.indexOf(N),C=f?w.indexOf(f):-1,E=h.layersWithOutsidePointerEventsDisabled.size>0,A=C>=k,I=II(_=>{const P=_.target,L=[...h.branches].some(z=>z.contains(P));!A||L||(a==null||a(_),o==null||o(_),_.defaultPrevented||c==null||c())},g),D=RI(_=>{const P=_.target;[...h.branches].some(z=>z.contains(P))||(i==null||i(_),o==null||o(_),_.defaultPrevented||c==null||c())},g);return SI(_=>{C===h.layers.size-1&&(r==null||r(_),!_.defaultPrevented&&c&&(_.preventDefault(),c()))},g),b.useEffect(()=>{if(f)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(Zv=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),e1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=Zv)}},[f,g,n,h]),b.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),e1())},[f,h]),b.useEffect(()=>{const _=()=>y({});return document.addEventListener(Bg,_),()=>document.removeEventListener(Bg,_)},[]),s.jsx(ut.div,{...u,ref:v,style:{pointerEvents:E?A?"auto":"none":void 0,...t.style},onFocusCapture:at(t.onFocusCapture,D.onFocusCapture),onBlurCapture:at(t.onBlurCapture,D.onBlurCapture),onPointerDownCapture:at(t.onPointerDownCapture,I.onPointerDownCapture)})});Jx.displayName=CI;var MI="DismissableLayerBranch",AI=b.forwardRef((t,e)=>{const n=b.useContext(vj),r=b.useRef(null),a=St(e,r);return b.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),s.jsx(ut.div,{...t,ref:a})});AI.displayName=MI;function II(t,e=globalThis==null?void 0:globalThis.document){const n=Ti(t),r=b.useRef(!1),a=b.useRef(()=>{});return b.useEffect(()=>{const i=c=>{if(c.target&&!r.current){let u=function(){Nj(EI,n,h,{discrete:!0})};const h={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",a.current),a.current=u,e.addEventListener("click",a.current,{once:!0})):u()}else e.removeEventListener("click",a.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",i),e.removeEventListener("click",a.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function RI(t,e=globalThis==null?void 0:globalThis.document){const n=Ti(t),r=b.useRef(!1);return b.useEffect(()=>{const a=i=>{i.target&&!r.current&&Nj(TI,n,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",a),()=>e.removeEventListener("focusin",a)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function e1(){const t=new CustomEvent(Bg);document.dispatchEvent(t)}function Nj(t,e,n,{discrete:r}){const a=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&a.addEventListener(t,e,{once:!0}),r?kI(a,i):a.dispatchEvent(i)}var Dm="focusScope.autoFocusOnMount",Lm="focusScope.autoFocusOnUnmount",t1={bubbles:!1,cancelable:!0},PI="FocusScope",Yx=b.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=t,[c,u]=b.useState(null),h=Ti(a),f=Ti(i),m=b.useRef(null),g=St(e,w=>u(w)),y=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(r){let w=function(E){if(y.paused||!c)return;const A=E.target;c.contains(A)?m.current=A:li(m.current,{select:!0})},N=function(E){if(y.paused||!c)return;const A=E.relatedTarget;A!==null&&(c.contains(A)||li(m.current,{select:!0}))},k=function(E){if(document.activeElement===document.body)for(const I of E)I.removedNodes.length>0&&li(c)};document.addEventListener("focusin",w),document.addEventListener("focusout",N);const C=new MutationObserver(k);return c&&C.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",N),C.disconnect()}}},[r,c,y.paused]),b.useEffect(()=>{if(c){r1.add(y);const w=document.activeElement;if(!c.contains(w)){const k=new CustomEvent(Dm,t1);c.addEventListener(Dm,h),c.dispatchEvent(k),k.defaultPrevented||(OI($I(wj(c)),{select:!0}),document.activeElement===w&&li(c))}return()=>{c.removeEventListener(Dm,h),setTimeout(()=>{const k=new CustomEvent(Lm,t1);c.addEventListener(Lm,f),c.dispatchEvent(k),k.defaultPrevented||li(w??document.body,{select:!0}),c.removeEventListener(Lm,f),r1.remove(y)},0)}}},[c,h,f,y]);const v=b.useCallback(w=>{if(!n&&!r||y.paused)return;const N=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,k=document.activeElement;if(N&&k){const C=w.currentTarget,[E,A]=DI(C);E&&A?!w.shiftKey&&k===A?(w.preventDefault(),n&&li(E,{select:!0})):w.shiftKey&&k===E&&(w.preventDefault(),n&&li(A,{select:!0})):k===C&&w.preventDefault()}},[n,r,y.paused]);return s.jsx(ut.div,{tabIndex:-1,...o,ref:g,onKeyDown:v})});Yx.displayName=PI;function OI(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(li(r,{select:e}),document.activeElement!==n)return}function DI(t){const e=wj(t),n=n1(e,t),r=n1(e.reverse(),t);return[n,r]}function wj(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function n1(t,e){for(const n of t)if(!LI(n,{upTo:e}))return n}function LI(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function _I(t){return t instanceof HTMLInputElement&&"select"in t}function li(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&_I(t)&&e&&t.select()}}var r1=zI();function zI(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=s1(t,e),t.unshift(e)},remove(e){var n;t=s1(t,e),(n=t[0])==null||n.resume()}}}function s1(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function $I(t){return t.filter(e=>e.tagName!=="A")}var FI="Portal",Qx=b.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[a,i]=b.useState(!1);rr(()=>i(!0),[]);const o=n||a&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return o?Dw.createPortal(s.jsx(ut.div,{...r,ref:e}),o):null});Qx.displayName=FI;function BI(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}var kd=t=>{const{present:e,children:n}=t,r=VI(e),a=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),i=St(r.ref,HI(a));return typeof n=="function"||r.isPresent?b.cloneElement(a,{ref:i}):null};kd.displayName="Presence";function VI(t){const[e,n]=b.useState(),r=b.useRef(null),a=b.useRef(t),i=b.useRef("none"),o=t?"mounted":"unmounted",[c,u]=BI(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const h=Ou(r.current);i.current=c==="mounted"?h:"none"},[c]),rr(()=>{const h=r.current,f=a.current;if(f!==t){const g=i.current,y=Ou(h);t?u("MOUNT"):y==="none"||(h==null?void 0:h.display)==="none"?u("UNMOUNT"):u(f&&g!==y?"ANIMATION_OUT":"UNMOUNT"),a.current=t}},[t,u]),rr(()=>{if(e){let h;const f=e.ownerDocument.defaultView??window,m=y=>{const w=Ou(r.current).includes(CSS.escape(y.animationName));if(y.target===e&&w&&(u("ANIMATION_END"),!a.current)){const N=e.style.animationFillMode;e.style.animationFillMode="forwards",h=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=N)})}},g=y=>{y.target===e&&(i.current=Ou(r.current))};return e.addEventListener("animationstart",g),e.addEventListener("animationcancel",m),e.addEventListener("animationend",m),()=>{f.clearTimeout(h),e.removeEventListener("animationstart",g),e.removeEventListener("animationcancel",m),e.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:b.useCallback(h=>{r.current=h?getComputedStyle(h):null,n(h)},[])}}function Ou(t){return(t==null?void 0:t.animationName)||"none"}function HI(t){var r,a;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(a=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:a.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var _m=0;function jj(){b.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??a1()),document.body.insertAdjacentElement("beforeend",t[1]??a1()),_m++,()=>{_m===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),_m--}},[])}function a1(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Hs=function(){return Hs=Object.assign||function(e){for(var n,r=1,a=arguments.length;r"u")return iR;var e=oR(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},cR=Ej(),Il="data-scroll-locked",dR=function(t,e,n,r){var a=t.left,i=t.top,o=t.right,c=t.gap;return n===void 0&&(n="margin"),` .`.concat(UI,` { overflow: hidden `).concat(r,`; padding-right: `).concat(c,"px ").concat(r,`; @@ -593,16 +593,16 @@ Error generating stack: `+S.message+` If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component. -For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return b.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},_R="DialogDescriptionWarning",zR=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${qj(_R).contentName}}.`;return b.useEffect(()=>{var i;const a=(i=t.current)==null?void 0:i.getAttribute("aria-describedby");e&&a&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},$R=Oj,FR=_j,BR=zj,VR=$j,HR=Bj,WR=Hj,UR=Uj;function Ft(t){return s.jsx($R,{"data-slot":"dialog",...t})}function KR(t){return s.jsx(FR,{...t})}const Gj=b.forwardRef(({className:t,...e},n)=>s.jsx(BR,{ref:n,className:Ct("fixed inset-0 z-50 bg-black/50",t),...e}));Gj.displayName="DialogOverlay";const Rt=b.forwardRef(({className:t,children:e,showCloseButton:n=!0,...r},a)=>s.jsxs(KR,{children:[s.jsx(Gj,{}),s.jsxs(VR,{ref:a,"aria-describedby":void 0,className:Ct("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",t),...r,children:[e,n&&s.jsxs(UR,{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:[s.jsx(nr,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Rt.displayName="DialogContent";function Bt({className:t,...e}){return s.jsx("div",{className:Ct("flex flex-col gap-2 text-center sm:text-left",t),...e})}function ln({className:t,...e}){return s.jsx("div",{className:Ct("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function Vt(t){return s.jsx(HR,{className:"text-lg font-semibold leading-none",...t})}function Jj(t){return s.jsx(WR,{className:"text-sm text-muted-foreground",...t})}const qR=oj("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 Ke({className:t,variant:e,asChild:n=!1,...r}){const a=n?sj:"span";return s.jsx(a,{className:Ct(qR({variant:e}),t),...r})}var GR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],JR=GR.reduce((t,e)=>{const n=rj(`Primitive.${e}`),r=b.forwardRef((a,i)=>{const{asChild:o,...c}=a,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),YR="Label",Yj=b.forwardRef((t,e)=>s.jsx(JR.label,{...t,ref:e,onMouseDown:n=>{var a;n.target.closest("button, input, select, textarea")||((a=t.onMouseDown)==null||a.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Yj.displayName=YR;var Qj=Yj;const te=b.forwardRef(({className:t,...e},n)=>s.jsx(Qj,{ref:n,className:Ct("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));te.displayName=Qj.displayName;function n0(t){const e=t+"CollectionProvider",[n,r]=Li(e),[a,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=w=>{const{scope:N,children:k}=w,C=fr.useRef(null),E=fr.useRef(new Map).current;return s.jsx(a,{scope:N,itemMap:E,collectionRef:C,children:k})};o.displayName=e;const c=t+"CollectionSlot",u=ld(c),h=fr.forwardRef((w,N)=>{const{scope:k,children:C}=w,E=i(c,k),A=St(N,E.collectionRef);return s.jsx(u,{ref:A,children:C})});h.displayName=c;const f=t+"CollectionItemSlot",m="data-radix-collection-item",g=ld(f),y=fr.forwardRef((w,N)=>{const{scope:k,children:C,...E}=w,A=fr.useRef(null),I=St(N,A),D=i(f,k);return fr.useEffect(()=>(D.itemMap.set(A,{ref:A,...E}),()=>void D.itemMap.delete(A))),s.jsx(g,{[m]:"",ref:I,children:C})});y.displayName=f;function v(w){const N=i(t+"CollectionConsumer",w);return fr.useCallback(()=>{const C=N.collectionRef.current;if(!C)return[];const E=Array.from(C.querySelectorAll(`[${m}]`));return Array.from(N.itemMap.values()).sort((D,_)=>E.indexOf(D.ref.current)-E.indexOf(_.ref.current))},[N.collectionRef,N.itemMap])}return[{Provider:o,Slot:h,ItemSlot:y},v,r]}var QR=b.createContext(void 0);function wf(t){const e=b.useContext(QR);return t||e||"ltr"}var Vm="rovingFocusGroup.onEntryFocus",XR={bubbles:!1,cancelable:!0},Sd="RovingFocusGroup",[Hg,Xj,ZR]=n0(Sd),[eP,Zj]=Li(Sd,[ZR]),[tP,nP]=eP(Sd),ek=b.forwardRef((t,e)=>s.jsx(Hg.Provider,{scope:t.__scopeRovingFocusGroup,children:s.jsx(Hg.Slot,{scope:t.__scopeRovingFocusGroup,children:s.jsx(rP,{...t,ref:e})})}));ek.displayName=Sd;var rP=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,g=b.useRef(null),y=St(e,g),v=wf(i),[w,N]=Eo({prop:o,defaultProp:c??null,onChange:u,caller:Sd}),[k,C]=b.useState(!1),E=Ti(h),A=Xj(n),I=b.useRef(!1),[D,_]=b.useState(0);return b.useEffect(()=>{const P=g.current;if(P)return P.addEventListener(Vm,E),()=>P.removeEventListener(Vm,E)},[E]),s.jsx(tP,{scope:n,orientation:r,dir:v,loop:a,currentTabStopId:w,onItemFocus:b.useCallback(P=>N(P),[N]),onItemShiftTab:b.useCallback(()=>C(!0),[]),onFocusableItemAdd:b.useCallback(()=>_(P=>P+1),[]),onFocusableItemRemove:b.useCallback(()=>_(P=>P-1),[]),children:s.jsx(ut.div,{tabIndex:k||D===0?-1:0,"data-orientation":r,...m,ref:y,style:{outline:"none",...t.style},onMouseDown:at(t.onMouseDown,()=>{I.current=!0}),onFocus:at(t.onFocus,P=>{const L=!I.current;if(P.target===P.currentTarget&&L&&!k){const z=new CustomEvent(Vm,XR);if(P.currentTarget.dispatchEvent(z),!z.defaultPrevented){const ee=A().filter(O=>O.focusable),U=ee.find(O=>O.active),he=ee.find(O=>O.id===w),R=[U,he,...ee].filter(Boolean).map(O=>O.ref.current);rk(R,f)}}I.current=!1}),onBlur:at(t.onBlur,()=>C(!1))})})}),tk="RovingFocusGroupItem",nk=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:i,children:o,...c}=t,u=ji(),h=i||u,f=nP(tk,n),m=f.currentTabStopId===h,g=Xj(n),{onFocusableItemAdd:y,onFocusableItemRemove:v,currentTabStopId:w}=f;return b.useEffect(()=>{if(r)return y(),()=>v()},[r,y,v]),s.jsx(Hg.ItemSlot,{scope:n,id:h,focusable:r,active:a,children:s.jsx(ut.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:at(t.onMouseDown,N=>{r?f.onItemFocus(h):N.preventDefault()}),onFocus:at(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:at(t.onKeyDown,N=>{if(N.key==="Tab"&&N.shiftKey){f.onItemShiftTab();return}if(N.target!==N.currentTarget)return;const k=iP(N,f.orientation,f.dir);if(k!==void 0){if(N.metaKey||N.ctrlKey||N.altKey||N.shiftKey)return;N.preventDefault();let E=g().filter(A=>A.focusable).map(A=>A.ref.current);if(k==="last")E.reverse();else if(k==="prev"||k==="next"){k==="prev"&&E.reverse();const A=E.indexOf(N.currentTarget);E=f.loop?oP(E,A+1):E.slice(A+1)}setTimeout(()=>rk(E))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:w!=null}):o})})});nk.displayName=tk;var sP={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function aP(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function iP(t,e,n){const r=aP(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return sP[r]}function rk(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function oP(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var lP=ek,cP=nk,jf="Tabs",[dP]=Li(jf,[Zj]),sk=Zj(),[uP,r0]=dP(jf),ak=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:i,orientation:o="horizontal",dir:c,activationMode:u="automatic",...h}=t,f=wf(c),[m,g]=Eo({prop:r,onChange:a,defaultProp:i??"",caller:jf});return s.jsx(uP,{scope:n,baseId:ji(),value:m,onValueChange:g,orientation:o,dir:f,activationMode:u,children:s.jsx(ut.div,{dir:f,"data-orientation":o,...h,ref:e})})});ak.displayName=jf;var ik="TabsList",ok=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...a}=t,i=r0(ik,n),o=sk(n);return s.jsx(lP,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:s.jsx(ut.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:e})})});ok.displayName=ik;var lk="TabsTrigger",ck=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...i}=t,o=r0(lk,n),c=sk(n),u=hk(o.baseId,r),h=fk(o.baseId,r),f=r===o.value;return s.jsx(cP,{asChild:!0,...c,focusable:!a,active:f,children:s.jsx(ut.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":h,"data-state":f?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:u,...i,ref:e,onMouseDown:at(t.onMouseDown,m=>{!a&&m.button===0&&m.ctrlKey===!1?o.onValueChange(r):m.preventDefault()}),onKeyDown:at(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&o.onValueChange(r)}),onFocus:at(t.onFocus,()=>{const m=o.activationMode!=="manual";!f&&!a&&m&&o.onValueChange(r)})})})});ck.displayName=lk;var dk="TabsContent",uk=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:a,children:i,...o}=t,c=r0(dk,n),u=hk(c.baseId,r),h=fk(c.baseId,r),f=r===c.value,m=b.useRef(f);return b.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),s.jsx(kd,{present:a||f,children:({present:g})=>s.jsx(ut.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!g,id:h,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:g&&i})})});uk.displayName=dk;function hk(t,e){return`${t}-trigger-${e}`}function fk(t,e){return`${t}-content-${e}`}var hP=ak,pk=ok,mk=ck,gk=uk;const Cd=hP,Jl=b.forwardRef(({className:t,...e},n)=>s.jsx(pk,{ref:n,className:Ct("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));Jl.displayName=pk.displayName;const tn=b.forwardRef(({className:t,...e},n)=>s.jsx(mk,{ref:n,className:Ct("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...e}));tn.displayName=mk.displayName;const nn=b.forwardRef(({className:t,...e},n)=>s.jsx(gk,{ref:n,className:Ct("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));nn.displayName=gk.displayName;function s0(t){const e=b.useRef({value:t,previous:t});return b.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function a0(t){const[e,n]=b.useState(void 0);return rr(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let o,c;if("borderBoxSize"in i){const u=i.borderBoxSize,h=Array.isArray(u)?u[0]:u;o=h.inlineSize,c=h.blockSize}else o=t.offsetWidth,c=t.offsetHeight;n({width:o,height:c})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var kf="Switch",[fP]=Li(kf),[pP,mP]=fP(kf),xk=b.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:i,required:o,disabled:c,value:u="on",onCheckedChange:h,form:f,...m}=t,[g,y]=b.useState(null),v=St(e,E=>y(E)),w=b.useRef(!1),N=g?f||!!g.closest("form"):!0,[k,C]=Eo({prop:a,defaultProp:i??!1,onChange:h,caller:kf});return s.jsxs(pP,{scope:n,checked:k,disabled:c,children:[s.jsx(ut.button,{type:"button",role:"switch","aria-checked":k,"aria-required":o,"data-state":Nk(k),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:v,onClick:at(t.onClick,E=>{C(A=>!A),N&&(w.current=E.isPropagationStopped(),w.current||E.stopPropagation())})}),N&&s.jsx(vk,{control:g,bubbles:!w.current,name:r,value:u,checked:k,required:o,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});xk.displayName=kf;var yk="SwitchThumb",bk=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,a=mP(yk,n);return s.jsx(ut.span,{"data-state":Nk(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:e})});bk.displayName=yk;var gP="SwitchBubbleInput",vk=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...a},i)=>{const o=b.useRef(null),c=St(o,i),u=s0(n),h=a0(e);return b.useEffect(()=>{const f=o.current;if(!f)return;const m=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&y){const v=new Event("click",{bubbles:r});y.call(f,n),f.dispatchEvent(v)}},[u,n,r]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:c,style:{...a.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});vk.displayName=gP;function Nk(t){return t?"checked":"unchecked"}var wk=xk,xP=bk;const Et=b.forwardRef(({className:t,...e},n)=>s.jsx(wk,{className:Ct("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#38bdac] focus-visible:ring-offset-2 focus-visible:ring-offset-[#0a1628] disabled:cursor-not-allowed disabled:opacity-50 data-[state=unchecked]:bg-gray-600 data-[state=checked]:bg-[#38bdac]",t),...e,ref:n,children:s.jsx(xP,{className:Ct("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")})}));Et.displayName=wk.displayName;function i0({open:t,onClose:e,userId:n,onUserUpdated:r}){var or;const[a,i]=b.useState(null),[o,c]=b.useState([]),[u,h]=b.useState([]),[f,m]=b.useState(!1),[g,y]=b.useState(!1),[v,w]=b.useState(!1),[N,k]=b.useState("info"),[C,E]=b.useState(""),[A,I]=b.useState(""),[D,_]=b.useState([]),[P,L]=b.useState(""),[z,ee]=b.useState(""),[U,he]=b.useState(""),[me,R]=b.useState(!1),[O,X]=b.useState({isVip:!1,vipExpireDate:"",vipRole:"",vipName:"",vipProject:"",vipContact:"",vipBio:""}),[$,ce]=b.useState([]),[Y,F]=b.useState(!1),[W,K]=b.useState(!1),[B,oe]=b.useState(null),[G,Q]=b.useState(null),[se,ye]=b.useState(""),[Me,Be]=b.useState(""),[He,gt]=b.useState(""),[Dt,jn]=b.useState(!1),[it,Mt]=b.useState(null),[re,Pe]=b.useState("");b.useEffect(()=>{t&&n&&(k("info"),oe(null),Q(null),Mt(null),Pe(""),ee(""),he(""),et(),De("/api/db/vip-roles").then(ge=>{ge!=null&&ge.success&&ge.data&&ce(ge.data)}).catch(()=>{}))},[t,n]);async function et(){if(n){m(!0);try{const ge=await De(`/api/db/users?id=${encodeURIComponent(n)}`);if(ge!=null&&ge.success&&ge.user){const Ne=ge.user;i(Ne),E(Ne.phone||""),I(Ne.nickname||""),ye(Ne.phone||""),Be(Ne.wechatId||""),gt(Ne.openId||"");try{_(typeof Ne.tags=="string"?JSON.parse(Ne.tags||"[]"):[])}catch{_([])}X({isVip:!!(Ne.isVip??!1),vipExpireDate:Ne.vipExpireDate?String(Ne.vipExpireDate).slice(0,10):"",vipRole:String(Ne.vipRole??""),vipName:String(Ne.vipName??""),vipProject:String(Ne.vipProject??""),vipContact:String(Ne.vipContact??""),vipBio:String(Ne.vipBio??"")})}try{const Ne=await De(`/api/user/track?userId=${encodeURIComponent(n)}&limit=50`);Ne!=null&&Ne.success&&Ne.tracks&&c(Ne.tracks)}catch{c([])}try{const Ne=await De(`/api/db/users/referrals?userId=${encodeURIComponent(n)}`);Ne!=null&&Ne.success&&Ne.referrals&&h(Ne.referrals)}catch{h([])}}catch(ge){console.error("Load user detail error:",ge)}finally{m(!1)}}}async function xt(){if(!(a!=null&&a.phone)){le.info("用户未绑定手机号,无法同步");return}y(!0);try{const ge=await Nt("/api/ckb/sync",{action:"full_sync",phone:a.phone,userId:a.id});ge!=null&&ge.success?(le.success("同步成功"),et()):le.error("同步失败: "+(ge==null?void 0:ge.error))}catch(ge){console.error("Sync CKB error:",ge),le.error("同步失败")}finally{y(!1)}}async function ft(){if(a){w(!0);try{const ge={id:a.id,phone:C||void 0,nickname:A||void 0,tags:JSON.stringify(D)},Ne=await Tt("/api/db/users",ge);Ne!=null&&Ne.success?(le.success("保存成功"),et(),r==null||r()):le.error("保存失败: "+(Ne==null?void 0:Ne.error))}catch(ge){console.error("Save user error:",ge),le.error("保存失败")}finally{w(!1)}}}const pt=()=>{P&&!D.includes(P)&&(_([...D,P]),L(""))},wt=ge=>_(D.filter(Ne=>Ne!==ge));async function Qt(){if(a){if(!z){le.error("请输入新密码");return}if(z!==U){le.error("两次密码不一致");return}if(z.length<6){le.error("密码至少 6 位");return}R(!0);try{const ge=await Tt("/api/db/users",{id:a.id,password:z});ge!=null&&ge.success?(le.success("修改成功"),ee(""),he("")):le.error("修改失败: "+((ge==null?void 0:ge.error)||""))}catch{le.error("修改失败")}finally{R(!1)}}}async function Lt(){if(a){if(O.isVip&&!O.vipExpireDate.trim()){le.error("开启 VIP 请填写有效到期日");return}F(!0);try{const ge={id:a.id,isVip:O.isVip,vipExpireDate:O.isVip?O.vipExpireDate:void 0,vipRole:O.vipRole||void 0,vipName:O.vipName||void 0,vipProject:O.vipProject||void 0,vipContact:O.vipContact||void 0,vipBio:O.vipBio||void 0},Ne=await Tt("/api/db/users",ge);Ne!=null&&Ne.success?(le.success("VIP 设置已保存"),et(),r==null||r()):le.error("保存失败: "+((Ne==null?void 0:Ne.error)||""))}catch{le.error("保存失败")}finally{F(!1)}}}async function An(){if(!se&&!He&&!Me){Q("请至少输入手机号、微信号或 OpenID 中的一项");return}K(!0),Q(null),oe(null);try{const ge=new URLSearchParams;se&&ge.set("phone",se),He&&ge.set("openId",He),Me&&ge.set("wechatId",Me);const Ne=await De(`/api/admin/shensheshou/query?${ge}`);Ne!=null&&Ne.success&&Ne.data?(oe(Ne.data),a&&await At(Ne.data)):Q((Ne==null?void 0:Ne.error)||"未查询到数据,该用户可能未在神射手收录")}catch(ge){console.error("SSS query error:",ge),Q("请求失败,请检查神射手接口配置")}finally{K(!1)}}async function At(ge){if(a)try{await Nt("/api/admin/shensheshou/enrich",{userId:a.id,phone:se||a.phone||"",openId:He||a.openId||"",wechatId:Me||a.wechatId||""}),et()}catch(Ne){console.error("SSS enrich error:",Ne)}}async function Kn(){if(a){jn(!0),Mt(null);try{const ge={users:[{phone:a.phone||"",name:a.nickname||"",openId:a.openId||"",tags:D}]},Ne=await Nt("/api/admin/shensheshou/ingest",ge);Ne!=null&&Ne.success&&Ne.data?Mt(Ne.data):Mt({error:(Ne==null?void 0:Ne.error)||"推送失败"})}catch(ge){console.error("SSS ingest error:",ge),Mt({error:"请求失败"})}finally{jn(!1)}}}const ns=ge=>{const qn={view_chapter:$r,purchase:_g,match:Mn,login:No,register:No,share:Ns,bind_phone:bA,bind_wechat:oA,fill_profile:qc,visit_page:Tl}[ge]||Pg;return s.jsx(qn,{className:"w-4 h-4"})};return t?s.jsx(Ft,{open:t,onOpenChange:()=>e(),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-hidden flex flex-col",children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(No,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(a==null?void 0:a.phone)&&s.jsx(Ke,{className:"bg-green-500/20 text-green-400 border-0 ml-2",children:"已绑定手机"}),(a==null?void 0:a.isVip)&&s.jsx(Ke,{className:"bg-amber-500/20 text-amber-400 border-0",children:"VIP"})]})}),f?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):a?s.jsxs("div",{className:"flex flex-col min-h-0 flex-1 overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-4 p-4 bg-[#0a1628] rounded-lg mb-3",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-2xl text-[#38bdac] shrink-0",children:a.avatar?s.jsx("img",{src:ts(a.avatar),className:"w-full h-full rounded-full object-cover",alt:""}):((or=a.nickname)==null?void 0:or.charAt(0))||"?"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("h3",{className:"text-lg font-bold text-white",children:a.nickname}),a.isAdmin&&s.jsx(Ke,{className:"bg-purple-500/20 text-purple-400 border-0",children:"管理员"}),a.hasFullBook&&s.jsx(Ke,{className:"bg-green-500/20 text-green-400 border-0",children:"全书已购"}),a.vipRole&&s.jsx(Ke,{className:"bg-amber-500/20 text-amber-400 border-0",children:a.vipRole})]}),s.jsxs("p",{className:"text-gray-400 text-sm mt-1",children:[a.phone?`📱 ${a.phone}`:"未绑定手机",a.wechatId&&` · 💬 ${a.wechatId}`,a.mbti&&` · ${a.mbti}`]}),s.jsxs("div",{className:"flex items-center gap-4 mt-1",children:[s.jsxs("p",{className:"text-gray-600 text-xs",children:["ID: ",a.id.slice(0,16),"…"]}),a.referralCode&&s.jsxs("p",{className:"text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"推广码:"}),s.jsx("code",{className:"text-[#38bdac] bg-[#38bdac]/10 px-1.5 py-0.5 rounded",children:a.referralCode})]})]})]}),s.jsxs("div",{className:"text-right shrink-0",children:[s.jsxs("p",{className:"text-[#38bdac] font-bold text-lg",children:["¥",(a.earnings||0).toFixed(2)]}),s.jsx("p",{className:"text-gray-500 text-xs",children:"累计收益"})]})]}),s.jsxs(Cd,{value:N,onValueChange:k,className:"flex-1 flex flex-col overflow-hidden",children:[s.jsxs(Jl,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-3 flex-wrap h-auto gap-1",children:[s.jsx(tn,{value:"info",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"基础信息"}),s.jsx(tn,{value:"tags",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"标签体系"}),s.jsxs(tn,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[s.jsx(Tl,{className:"w-3 h-3 mr-1"}),"用户旅程"]}),s.jsx(tn,{value:"relations",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"关系链路"}),s.jsxs(tn,{value:"shensheshou",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[s.jsx(yi,{className:"w-3 h-3 mr-1"}),"用户资料完善"]})]}),s.jsxs(nn,{value:"info",className:"flex-1 overflow-auto space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"手机号"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入手机号",value:C,onChange:ge=>E(ge.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"昵称"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入昵称",value:A,onChange:ge=>I(ge.target.value)})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[a.openId&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"微信 OpenID"}),s.jsx("p",{className:"text-gray-300 font-mono text-xs break-all",children:a.openId})]}),a.region&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[s.jsx(ej,{className:"w-4 h-4 text-gray-500"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs",children:"地区"}),s.jsx("p",{className:"text-white",children:a.region})]})]}),a.industry&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"行业"}),s.jsx("p",{className:"text-white",children:a.industry})]}),a.position&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"职位"}),s.jsx("p",{className:"text-white",children:a.position})]})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"推荐人数"}),s.jsx("p",{className:"text-2xl font-bold text-white",children:a.referralCount??0})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"待提现"}),s.jsxs("p",{className:"text-2xl font-bold text-yellow-400",children:["¥",(a.pendingEarnings??0).toFixed(2)]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"创建时间"}),s.jsx("p",{className:"text-sm text-white",children:a.createdAt?new Date(a.createdAt).toLocaleDateString():"-"})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(Zw,{className:"w-4 h-4 text-yellow-400"}),s.jsx("span",{className:"text-white font-medium",children:"修改密码"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ie,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"新密码(至少6位)",value:z,onChange:ge=>ee(ge.target.value)}),s.jsx(ie,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"确认密码",value:U,onChange:ge=>he(ge.target.value)}),s.jsx(ne,{size:"sm",onClick:Qt,disabled:me||!z||!U,className:"bg-yellow-500/20 hover:bg-yellow-500/30 text-yellow-400 border border-yellow-500/40",children:me?"保存中...":"确认修改"})]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(Al,{className:"w-4 h-4 text-amber-400"}),s.jsx("span",{className:"text-white font-medium",children:"设成超级个体"})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(te,{className:"text-gray-400 text-sm",children:"VIP 会员"}),s.jsx(Et,{checked:O.isVip,onCheckedChange:ge=>X(Ne=>({...Ne,isVip:ge}))})]}),O.isVip&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"到期日"}),s.jsx(ie,{type:"date",className:"bg-[#162840] border-gray-700 text-white text-sm",value:O.vipExpireDate,onChange:ge=>X(Ne=>({...Ne,vipExpireDate:ge.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"角色"}),s.jsxs("select",{className:"w-full bg-[#162840] border border-gray-700 text-white rounded px-2 py-1.5 text-sm",value:O.vipRole,onChange:ge=>X(Ne=>({...Ne,vipRole:ge.target.value})),children:[s.jsx("option",{value:"",children:"请选择"}),$.map(ge=>s.jsx("option",{value:ge.name,children:ge.name},ge.id))]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"展示名"}),s.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white text-sm",placeholder:"创业老板排行展示名",value:O.vipName,onChange:ge=>X(Ne=>({...Ne,vipName:ge.target.value}))})]}),s.jsx(ne,{size:"sm",onClick:Lt,disabled:Y,className:"bg-amber-500/20 hover:bg-amber-500/30 text-amber-400 border border-amber-500/40",children:Y?"保存中...":"保存 VIP"})]})]})]}),a.isVip&&s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(Al,{className:"w-4 h-4 text-amber-400"}),s.jsx("span",{className:"text-white font-medium",children:"VIP 信息"}),s.jsx(Ke,{className:"bg-amber-500/20 text-amber-400 border-0 text-xs",children:a.vipRole||"VIP"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[a.vipName&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"展示名:"}),s.jsx("span",{className:"text-white",children:a.vipName})]}),a.vipProject&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"项目:"}),s.jsx("span",{className:"text-white",children:a.vipProject})]}),a.vipContact&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"联系方式:"}),s.jsx("span",{className:"text-white",children:a.vipContact})]}),a.vipExpireDate&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"到期时间:"}),s.jsx("span",{className:"text-white",children:new Date(a.vipExpireDate).toLocaleDateString()})]})]}),a.vipBio&&s.jsx("p",{className:"text-gray-400 text-sm mt-2",children:a.vipBio})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-purple-500/20",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(Dl,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"微信归属"}),s.jsx("span",{className:"text-gray-500 text-xs",children:"该用户归属在哪个微信号下"})]}),s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"输入归属微信号(如 wxid_xxxx)",value:re,onChange:ge=>Pe(ge.target.value)}),s.jsxs(ne,{size:"sm",onClick:async()=>{if(!(!re||!a))try{await Tt("/api/db/users",{id:a.id,wechatId:re}),le.success("已保存微信归属"),et()}catch{le.error("保存失败")}},className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-400 border border-purple-500/30 shrink-0",children:[s.jsx(mn,{className:"w-4 h-4 mr-1"})," 保存"]})]}),a.wechatId&&s.jsxs("p",{className:"text-gray-500 text-xs mt-2",children:["当前归属:",s.jsx("span",{className:"text-purple-400",children:a.wechatId})]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ns,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"存客宝同步"})]}),s.jsx(ne,{size:"sm",onClick:xt,disabled:g||!a.phone,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-1 animate-spin"})," 同步中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-1"})," 同步数据"]})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"同步状态:"}),a.ckbSyncedAt?s.jsx(Ke,{className:"bg-green-500/20 text-green-400 border-0 ml-1",children:"已同步"}):s.jsx(Ke,{className:"bg-gray-500/20 text-gray-400 border-0 ml-1",children:"未同步"})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"最后同步:"}),s.jsx("span",{className:"text-gray-300 ml-1",children:a.ckbSyncedAt?new Date(a.ckbSyncedAt).toLocaleString():"-"})]})]})]})]}),s.jsxs(nn,{value:"tags",className:"flex-1 overflow-auto space-y-4",children:[s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(qc,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"用户标签"}),s.jsx("span",{className:"text-gray-500 text-xs",children:"基于《一场 Soul 的创业实验》维度打标"})]}),s.jsxs("div",{className:"mb-3 p-2.5 bg-[#38bdac]/5 border border-[#38bdac]/20 rounded-lg flex items-center gap-2 text-xs text-gray-400",children:[s.jsx(Rg,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0"}),"命中的标签自动高亮 · 系统根据行为轨迹和填写资料自动打标 · 手动点击补充或取消"]}),s.jsx("div",{className:"mb-4 space-y-3",children:[{category:"身份类型",tags:["创业者","打工人","自由职业","学生","投资人","合伙人"]},{category:"行业背景",tags:["电商","内容","传统行业","科技/AI","金融","教育","餐饮"]},{category:"痛点标签",tags:["找资源","找方向","找合伙人","想赚钱","想学习","找情感出口"]},{category:"付费意愿",tags:["高意向","已付费","观望中","薅羊毛"]},{category:"MBTI",tags:["ENTJ","INTJ","ENFP","INFP","ENTP","INTP","ESTJ","ISFJ"]}].map(ge=>s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1.5",children:ge.category}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:ge.tags.map(Ne=>s.jsxs("button",{type:"button",onClick:()=>{D.includes(Ne)?wt(Ne):_([...D,Ne])},className:`px-2 py-0.5 rounded text-xs border transition-all ${D.includes(Ne)?"bg-[#38bdac]/20 border-[#38bdac]/50 text-[#38bdac]":"bg-transparent border-gray-700 text-gray-500 hover:border-gray-500 hover:text-gray-300"}`,children:[D.includes(Ne)?"✓ ":"",Ne]},Ne))})]},ge.category))}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-3",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-2",children:"已选标签"}),s.jsxs("div",{className:"flex flex-wrap gap-2 mb-3 min-h-[32px]",children:[D.map((ge,Ne)=>s.jsxs(Ke,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1",children:[ge,s.jsx("button",{type:"button",onClick:()=>wt(ge),className:"ml-1 hover:text-red-400",children:s.jsx(nr,{className:"w-3 h-3"})})]},Ne)),D.length===0&&s.jsx("span",{className:"text-gray-600 text-sm",children:"暂未选择标签"})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"自定义标签(回车添加)",value:P,onChange:ge=>L(ge.target.value),onKeyDown:ge=>ge.key==="Enter"&&pt()}),s.jsx(ne,{onClick:pt,className:"bg-[#38bdac] hover:bg-[#2da396]",children:"添加"})]})]})]}),a.ckbTags&&s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(qc,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"存客宝标签"})]}),s.jsx("div",{className:"flex flex-wrap gap-2",children:(typeof a.ckbTags=="string"?a.ckbTags.split(","):[]).map((ge,Ne)=>s.jsx(Ke,{className:"bg-purple-500/20 text-purple-400 border-0",children:ge.trim()},Ne))})]})]}),s.jsxs(nn,{value:"journey",className:"flex-1 overflow-auto",children:[s.jsxs("div",{className:"mb-3 p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[s.jsx(Tl,{className:"w-4 h-4 text-[#38bdac]"}),s.jsxs("span",{className:"text-gray-400 text-sm",children:["记录用户从注册到付费的完整行动路径,共 ",o.length," 条记录"]})]}),s.jsx("div",{className:"space-y-2",children:o.length>0?o.map((ge,Ne)=>s.jsxs("div",{className:"flex items-start gap-3 p-3 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-[#38bdac]",children:ns(ge.action)}),Ne0?u.map((ge,Ne)=>{var Es;const qn=ge;return s.jsxs("div",{className:"flex items-center justify-between p-2 bg-[#162840] rounded",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-6 h-6 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-xs text-[#38bdac]",children:((Es=qn.nickname)==null?void 0:Es.charAt(0))||"?"}),s.jsx("span",{className:"text-white text-sm",children:qn.nickname})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[qn.status==="vip"&&s.jsx(Ke,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"已购"}),s.jsx("span",{className:"text-gray-500 text-xs",children:qn.createdAt?new Date(qn.createdAt).toLocaleDateString():""})]})]},qn.id||Ne)}):s.jsx("p",{className:"text-gray-500 text-sm text-center py-4",children:"暂无推荐用户"})})]})}),s.jsxs(nn,{value:"shensheshou",className:"flex-1 overflow-auto space-y-4",children:[s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(yi,{className:"w-5 h-5 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"用户资料完善"}),s.jsx("span",{className:"text-gray-500 text-xs",children:"通过多维度查询神射手数据,自动回填用户基础信息"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-3",children:[s.jsxs("div",{children:[s.jsx(te,{className:"text-gray-500 text-xs mb-1 block",children:"手机号"}),s.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"11位手机号",value:se,onChange:ge=>ye(ge.target.value)})]}),s.jsxs("div",{children:[s.jsx(te,{className:"text-gray-500 text-xs mb-1 block",children:"微信号"}),s.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"微信 ID",value:Me,onChange:ge=>Be(ge.target.value)})]}),s.jsxs("div",{className:"col-span-2",children:[s.jsx(te,{className:"text-gray-500 text-xs mb-1 block",children:"微信 OpenID"}),s.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"openid_xxxx(自动填入)",value:He,onChange:ge=>gt(ge.target.value)})]})]}),s.jsx(ne,{onClick:An,disabled:W,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:W?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-1 animate-spin"})," 查询并自动回填中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Sa,{className:"w-4 h-4 mr-1"})," 查询并自动完善用户资料"]})}),s.jsx("p",{className:"text-gray-600 text-xs mt-2",children:"查询成功后,神射手返回的标签将自动同步到该用户"}),G&&s.jsx("div",{className:"mt-3 p-3 bg-red-500/10 border border-red-500/30 rounded-lg text-red-400 text-sm",children:G}),B&&s.jsxs("div",{className:"mt-3 space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"神射手 RFM 分"}),s.jsx("p",{className:"text-2xl font-bold text-[#38bdac]",children:B.rfm_score??"-"})]}),s.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"用户等级"}),s.jsx("p",{className:"text-2xl font-bold text-white",children:B.user_level??"-"})]})]}),B.tags&&B.tags.length>0&&s.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-2",children:"神射手标签"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:B.tags.map((ge,Ne)=>s.jsx(Ke,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/20",children:ge},Ne))})]}),B.last_active&&s.jsxs("div",{className:"text-sm text-gray-500",children:["最近活跃:",B.last_active]})]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx(yi,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"推送用户数据到神射手"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:"将本用户信息(手机号、昵称、标签等)同步至神射手,自动完善用户画像"})]}),s.jsx(ne,{onClick:Kn,disabled:Dt||!a.phone,variant:"outline",className:"border-purple-500/40 text-purple-400 hover:bg-purple-500/10 bg-transparent shrink-0 ml-4",children:Dt?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-1 animate-spin"})," 推送中"]}):s.jsxs(s.Fragment,{children:[s.jsx(yi,{className:"w-4 h-4 mr-1"})," 推送"]})})]}),!a.phone&&s.jsx("p",{className:"text-yellow-500/70 text-xs",children:"⚠ 用户未绑定手机号,无法推送"}),it&&s.jsx("div",{className:"mt-3 p-3 bg-[#162840] rounded-lg text-sm",children:it.error?s.jsx("p",{className:"text-red-400",children:String(it.error)}):s.jsxs("div",{className:"space-y-1",children:[s.jsxs("p",{className:"text-green-400 flex items-center gap-1",children:[s.jsx(Rg,{className:"w-4 h-4"})," 推送成功"]}),it.enriched!==void 0&&s.jsxs("p",{className:"text-gray-400",children:["自动补全标签数:",String(it.new_tags_added??0)]})]})})]})]})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-gray-700 mt-3 shrink-0",children:[s.jsxs(ne,{variant:"outline",onClick:e,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(nr,{className:"w-4 h-4 mr-2"}),"关闭"]}),s.jsxs(ne,{onClick:ft,disabled:v,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),v?"保存中...":"保存修改"]})]})]}):s.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}):null}function yP(){const t=Di(),[e,n]=b.useState(!0),[r,a]=b.useState(!0),[i,o]=b.useState(!0),[c,u]=b.useState([]),[h,f]=b.useState([]),[m,g]=b.useState(0),[y,v]=b.useState(0),[w,N]=b.useState(0),[k,C]=b.useState(0),[E,A]=b.useState(0),[I,D]=b.useState(null),[_,P]=b.useState(null),[L,z]=b.useState(!1),[ee,U]=b.useState("today"),[he,me]=b.useState(null),[R,O]=b.useState(!1),X=K=>{const B=K;if((B==null?void 0:B.status)===401)D("登录已过期,请重新登录");else{if((B==null?void 0:B.name)==="AbortError")return;D("加载失败,请检查网络或联系管理员")}};async function $(K){const B=K?{signal:K}:void 0;n(!0),D(null);try{const Q=await De("/api/admin/dashboard/stats",B);Q!=null&&Q.success&&(g(Q.totalUsers??0),v(Q.paidOrderCount??0),N(Q.totalRevenue??0),C(Q.conversionRate??0))}catch(Q){if((Q==null?void 0:Q.name)!=="AbortError"){console.error("stats 失败,尝试 overview 降级",Q);try{const se=await De("/api/admin/dashboard/overview",B);se!=null&&se.success&&(g(se.totalUsers??0),v(se.paidOrderCount??0),N(se.totalRevenue??0),C(se.conversionRate??0))}catch(se){X(se)}}}finally{n(!1)}try{const Q=await De("/api/admin/balance/summary",B);Q!=null&&Q.success&&Q.data&&A(Q.data.totalGifted??0)}catch{}a(!0),o(!0);const oe=async()=>{try{const Q=await De("/api/admin/dashboard/recent-orders",B);if(Q!=null&&Q.success&&Q.recentOrders)f(Q.recentOrders);else throw new Error("no data")}catch(Q){if((Q==null?void 0:Q.name)!=="AbortError")try{const se=await De("/api/admin/orders?page=1&pageSize=20&status=paid",B),Me=((se==null?void 0:se.orders)??[]).filter(Be=>["paid","completed","success"].includes(Be.status||""));f(Me.slice(0,5))}catch{f([])}}finally{a(!1)}},G=async()=>{try{const Q=await De("/api/admin/dashboard/new-users",B);if(Q!=null&&Q.success&&Q.newUsers)u(Q.newUsers);else throw new Error("no data")}catch(Q){if((Q==null?void 0:Q.name)!=="AbortError")try{const se=await De("/api/db/users?page=1&pageSize=10",B);u((se==null?void 0:se.users)??[])}catch{u([])}}finally{o(!1)}};await Promise.all([oe(),G()])}async function ce(K){const B=K||ee;O(!0);try{const oe=await De(`/api/admin/track/stats?period=${B}`);oe!=null&&oe.success&&me({total:oe.total??0,byModule:oe.byModule??{}})}catch{me(null)}finally{O(!1)}}b.useEffect(()=>{const K=new AbortController;$(K.signal),ce();const B=setInterval(()=>{$(),ce()},3e4);return()=>{K.abort(),clearInterval(B)}},[]);const Y=m,F=K=>{const B=K.productType||"",oe=K.description||"";if(oe){if(B==="section"&&oe.includes("章节")){if(oe.includes("-")){const G=oe.split("-");if(G.length>=3)return{title:`第${G[1]}章 第${G[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:oe,subtitle:"章节购买"}}return B==="fullbook"||oe.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:B==="match"||oe.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:oe,subtitle:B==="section"?"单章":B==="fullbook"?"全书":"其他"}}return B==="section"?{title:`章节 ${K.productId||""}`,subtitle:"单章购买"}:B==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:B==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:B||"其他"}},W=[{title:"总用户数",value:e?null:Y,sub:null,icon:Mn,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:e?null:`¥${(w??0).toFixed(2)}`,sub:E>0?`含代付 ¥${E.toFixed(2)}`:null,icon:vo,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:e?null:y,sub:null,icon:_g,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:e?null:`${k.toFixed(1)}%`,sub:null,icon:vo,color:"text-amber-400",bg:"bg-amber-500/20",link:"/users"}];return s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),I&&s.jsxs("div",{className:"mb-6 px-4 py-3 rounded-lg bg-amber-500/20 border border-amber-500/50 text-amber-200 text-sm flex items-center justify-between",children:[s.jsx("span",{children:I}),s.jsx("button",{type:"button",onClick:()=>$(),className:"text-amber-400 hover:text-amber-300 underline",children:"重试"})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-6",children:W.map((K,B)=>s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>K.link&&t(K.link),children:[s.jsxs(qe,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsx(Ge,{className:"text-sm font-medium text-gray-400",children:K.title}),s.jsx("div",{className:`p-2 rounded-lg ${K.bg}`,children:s.jsx(K.icon,{className:`w-4 h-4 ${K.color}`})})]}),s.jsx(Ce,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-2xl font-bold text-white min-h-8 flex items-center",children:K.value!=null?K.value:s.jsxs("span",{className:"inline-flex items-center gap-2 text-gray-500",children:[s.jsx(Ue,{className:"w-4 h-4 animate-spin"}),"加载中"]})}),K.sub&&s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:K.sub})]}),s.jsx(El,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},B))}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{className:"flex flex-row items-center justify-between",children:[s.jsx(Ge,{className:"text-white",children:"最近订单"}),s.jsxs("button",{type:"button",onClick:()=>$(),disabled:r||i,className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1 disabled:opacity-50",title:"刷新",children:[r||i?s.jsx(Ue,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(Ue,{className:"w-3.5 h-3.5"}),"刷新(每 30 秒自动更新)"]})]}),s.jsx(Ce,{children:s.jsx("div",{className:"space-y-3",children:r&&h.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(Ue,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[h.slice(0,5).map(K=>{var se;const B=K.referrerId?c.find(ye=>ye.id===K.referrerId):void 0,oe=K.referralCode||(B==null?void 0:B.referralCode)||(B==null?void 0:B.nickname)||(K.referrerId?String(K.referrerId).slice(0,8):""),G=F(K),Q=K.userNickname||((se=c.find(ye=>ye.id===K.userId))==null?void 0:se.nickname)||"匿名用户";return s.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:[s.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[K.userAvatar?s.jsx("img",{src:ts(K.userAvatar),alt:Q,className:"w-9 h-9 rounded-full object-cover flex-shrink-0 mt-0.5",onError:ye=>{ye.currentTarget.style.display="none";const Me=ye.currentTarget.nextElementSibling;Me&&Me.classList.remove("hidden")}}):null,s.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 ${K.userAvatar?"hidden":""}`,children:Q.charAt(0)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("button",{type:"button",onClick:()=>{K.userId&&(P(K.userId),z(!0))},className:"text-sm text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:Q}),s.jsx("span",{className:"text-gray-600",children:"·"}),s.jsx("span",{className:"text-sm font-medium text-white truncate",children:G.title})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[G.subtitle&&G.subtitle!=="章节购买"&&s.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:G.subtitle}),s.jsx("span",{children:new Date(K.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),oe&&s.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",oe]})]})]}),s.jsxs("div",{className:"text-right ml-4 flex-shrink-0",children:[s.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(K.amount).toFixed(2)]}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:K.paymentMethod||"微信"})]})]},K.id)}),h.length===0&&!r&&s.jsxs("div",{className:"text-center py-12",children:[s.jsx(_g,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(qe,{children:s.jsx(Ge,{className:"text-white",children:"新注册用户"})}),s.jsx(Ce,{children:s.jsx("div",{className:"space-y-3",children:i&&c.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(Ue,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[c.slice(0,5).map(K=>{var B;return s.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:((B=K.nickname)==null?void 0:B.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("button",{type:"button",onClick:()=>{P(K.id),z(!0)},className:"text-sm font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:K.nickname||"匿名用户"}),s.jsx("p",{className:"text-xs text-gray-500",children:K.phone||"-"})]})]}),s.jsx("p",{className:"text-xs text-gray-400",children:K.createdAt?new Date(K.createdAt).toLocaleDateString():"-"})]},K.id)}),c.length===0&&!i&&s.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mt-8",children:[s.jsxs(qe,{className:"flex flex-row items-center justify-between",children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(Ig,{className:"w-5 h-5 text-[#38bdac]"}),"分类标签点击统计"]}),s.jsx("div",{className:"flex items-center gap-2",children:["today","week","month","all"].map(K=>s.jsx("button",{type:"button",onClick:()=>{U(K),ce(K)},className:`px-3 py-1 text-xs rounded-full transition-colors ${ee===K?"bg-[#38bdac] text-white":"bg-gray-700/50 text-gray-400 hover:bg-gray-700"}`,children:{today:"今日",week:"本周",month:"本月",all:"全部"}[K]},K))})]}),s.jsx(Ce,{children:R&&!he?s.jsxs("div",{className:"flex items-center justify-center py-12 text-gray-500",children:[s.jsx(Ue,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):he&&Object.keys(he.byModule).length>0?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("p",{className:"text-sm text-gray-400",children:["总点击 ",s.jsx("span",{className:"text-white font-bold text-lg",children:he.total})," 次"]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Object.entries(he.byModule).sort((K,B)=>B[1].reduce((oe,G)=>oe+G.count,0)-K[1].reduce((oe,G)=>oe+G.count,0)).map(([K,B])=>{const oe=B.reduce((Q,se)=>Q+se.count,0),G={home:"首页",chapters:"目录",read:"阅读",my:"我的",vip:"VIP",wallet:"钱包",match:"找伙伴",referral:"推广",search:"搜索",settings:"设置",about:"关于",other:"其他"};return s.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("span",{className:"text-sm font-medium text-[#38bdac]",children:G[K]||K}),s.jsxs("span",{className:"text-xs text-gray-500",children:[oe," 次"]})]}),s.jsx("div",{className:"space-y-2",children:B.sort((Q,se)=>se.count-Q.count).slice(0,8).map((Q,se)=>s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-gray-300 truncate mr-2",title:`${Q.action}: ${Q.target}`,children:Q.target||Q.action}),s.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[s.jsx("div",{className:"w-16 h-1.5 bg-gray-700 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-[#38bdac] rounded-full",style:{width:`${oe>0?Q.count/oe*100:0}%`}})}),s.jsx("span",{className:"text-gray-400 w-8 text-right",children:Q.count})]})]},se))})]},K)})})]}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Ig,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无点击数据"}),s.jsx("p",{className:"text-gray-600 text-xs mt-1",children:"小程序端接入埋点后,数据将在此实时展示"})]})})]}),s.jsx(i0,{open:L,onClose:()=>{z(!1),P(null)},userId:_,onUserUpdated:()=>$()})]})}const pr=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{className:"relative w-full overflow-auto",children:s.jsx("table",{ref:n,className:Ct("w-full caption-bottom text-sm",t),...e})}));pr.displayName="Table";const mr=b.forwardRef(({className:t,...e},n)=>s.jsx("thead",{ref:n,className:Ct("[&_tr]:border-b",t),...e}));mr.displayName="TableHeader";const gr=b.forwardRef(({className:t,...e},n)=>s.jsx("tbody",{ref:n,className:Ct("[&_tr:last-child]:border-0",t),...e}));gr.displayName="TableBody";const lt=b.forwardRef(({className:t,...e},n)=>s.jsx("tr",{ref:n,className:Ct("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));lt.displayName="TableRow";const Ee=b.forwardRef(({className:t,...e},n)=>s.jsx("th",{ref:n,className:Ct("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));Ee.displayName="TableHead";const be=b.forwardRef(({className:t,...e},n)=>s.jsx("td",{ref:n,className:Ct("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));be.displayName="TableCell";function o0(t,e){const[n,r]=b.useState(t);return b.useEffect(()=>{const a=setTimeout(()=>r(t),e);return()=>clearTimeout(a)},[t,e]),n}function ws({page:t,totalPages:e,total:n,pageSize:r,onPageChange:a,onPageSizeChange:i,pageSizeOptions:o=[10,20,50,100]}){return e<=1&&!i?null:s.jsxs("div",{className:"flex items-center justify-between gap-4 py-4 px-5 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[s.jsxs("span",{children:["共 ",n," 条"]}),i&&s.jsx("select",{value:r,onChange:c=>i(Number(c.target.value)),className:"bg-[#0f2137] border border-gray-600 rounded px-2 py-1 text-gray-300 text-sm",children:o.map(c=>s.jsxs("option",{value:c,children:[c," 条/页"]},c))})]}),e>1&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>a(1),disabled:t<=1,className:"px-2 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"首页"}),s.jsx("button",{type:"button",onClick:()=>a(t-1),disabled:t<=1,className:"px-3 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"上一页"}),s.jsxs("span",{className:"px-3 py-1 text-gray-400 text-sm",children:[t," / ",e]}),s.jsx("button",{type:"button",onClick:()=>a(t+1),disabled:t>=e,className:"px-3 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"下一页"}),s.jsx("button",{type:"button",onClick:()=>a(e),disabled:t>=e,className:"px-2 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"末页"})]})]})}function bP(){const[t,e]=b.useState([]),[n,r]=b.useState([]),[a,i]=b.useState(0),[o,c]=b.useState(0),[u,h]=b.useState(0),[f,m]=b.useState(1),[g,y]=b.useState(10),[v,w]=b.useState(""),N=o0(v,300),[k,C]=b.useState("all"),[E,A]=b.useState(!0),[I,D]=b.useState(null),[_,P]=b.useState(null),[L,z]=b.useState(""),[ee,U]=b.useState(!1);async function he(){A(!0),D(null);try{const Y=k==="all"?"":k==="completed"?"completed":k,F=new URLSearchParams({page:String(f),pageSize:String(g),...Y&&{status:Y},...N&&{search:N}}),[W,K]=await Promise.all([De(`/api/admin/orders?${F}`),De("/api/db/users?page=1&pageSize=500")]);W!=null&&W.success&&(e(W.orders||[]),i(W.total??0),c(W.totalRevenue??0),h(W.todayRevenue??0)),K!=null&&K.success&&K.users&&r(K.users)}catch(Y){console.error("加载订单失败",Y),D("加载订单失败,请检查网络后重试")}finally{A(!1)}}b.useEffect(()=>{m(1)},[N,k]),b.useEffect(()=>{he()},[f,g,N,k]);const me=Y=>{var F;return Y.userNickname||((F=n.find(W=>W.id===Y.userId))==null?void 0:F.nickname)||"匿名用户"},R=Y=>{var F;return((F=n.find(W=>W.id===Y))==null?void 0:F.phone)||"-"},O=Y=>{const F=Y.productType||Y.type||"",W=Y.description||"";if(W){if(F==="section"&&W.includes("章节")){if(W.includes("-")){const K=W.split("-");if(K.length>=3)return{name:`第${K[1]}章 第${K[2]}节`,type:"《一场Soul的创业实验》"}}return{name:W,type:"章节购买"}}return F==="fullbook"||W.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:F==="vip"||W.includes("VIP")?{name:"VIP年度会员",type:"VIP"}:F==="match"||W.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:W,type:"其他"}}return F==="section"?{name:`章节 ${Y.productId||Y.sectionId||""}`,type:"单章"}:F==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:F==="vip"?{name:"VIP年度会员",type:"VIP"}:F==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:F||"其他"}},X=Math.ceil(a/g)||1;async function $(){var Y;if(!(!(_!=null&&_.orderSn)&&!(_!=null&&_.id))){U(!0),D(null);try{const F=await Tt("/api/admin/orders/refund",{orderSn:_.orderSn||_.id,reason:L||void 0});F!=null&&F.success?(P(null),z(""),he()):D((F==null?void 0:F.error)||"退款失败")}catch(F){const W=F;D(((Y=W==null?void 0:W.data)==null?void 0:Y.error)||"退款失败,请检查网络后重试")}finally{U(!1)}}}function ce(){if(t.length===0){le.info("暂无数据可导出");return}const Y=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],F=t.map(G=>{const Q=O(G);return[G.orderSn||G.id||"",me(G),R(G.userId),Q.name,Number(G.amount||0).toFixed(2),G.paymentMethod==="wechat"?"微信支付":G.paymentMethod==="alipay"?"支付宝":G.paymentMethod||"微信支付",G.status==="refunded"?"已退款":G.status==="paid"||G.status==="completed"?"已完成":G.status==="pending"||G.status==="created"?"待支付":"已失败",G.status==="refunded"&&G.refundReason?G.refundReason:"-",G.referrerEarnings?Number(G.referrerEarnings).toFixed(2):"-",G.createdAt?new Date(G.createdAt).toLocaleString("zh-CN"):""].join(",")}),W="\uFEFF"+[Y.join(","),...F].join(` -`),K=new Blob([W],{type:"text/csv;charset=utf-8"}),B=URL.createObjectURL(K),oe=document.createElement("a");oe.href=B,oe.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,oe.click(),URL.revokeObjectURL(B)}return s.jsxs("div",{className:"p-8 w-full",children:[I&&s.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:[s.jsx("span",{children:I}),s.jsx("button",{type:"button",onClick:()=>D(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"订单管理"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",t.length," 笔订单"]})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs(ne,{variant:"outline",onClick:he,disabled:E,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${E?"animate-spin":""}`}),"刷新"]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsx("span",{className:"text-gray-400",children:"总收入:"}),s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",o.toFixed(2)]}),s.jsx("span",{className:"text-gray-600",children:"|"}),s.jsx("span",{className:"text-gray-400",children:"今日:"}),s.jsxs("span",{className:"text-[#FFD700] font-bold",children:["¥",u.toFixed(2)]})]})]})]}),s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsxs("div",{className:"relative flex-1 max-w-md",children:[s.jsx(Sa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(ie,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:v,onChange:Y=>w(Y.target.value)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Qw,{className:"w-4 h-4 text-gray-400"}),s.jsxs("select",{value:k,onChange:Y=>C(Y.target.value),className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"pending",children:"待支付"}),s.jsx("option",{value:"created",children:"已创建"}),s.jsx("option",{value:"failed",children:"已失败"}),s.jsx("option",{value:"refunded",children:"已退款"})]})]}),s.jsxs(ne,{variant:"outline",onClick:ce,disabled:t.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(mM,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ce,{className:"p-0",children:E?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400",children:"订单号"}),s.jsx(Ee,{className:"text-gray-400",children:"用户"}),s.jsx(Ee,{className:"text-gray-400",children:"商品"}),s.jsx(Ee,{className:"text-gray-400",children:"金额"}),s.jsx(Ee,{className:"text-gray-400",children:"支付方式"}),s.jsx(Ee,{className:"text-gray-400",children:"状态"}),s.jsx(Ee,{className:"text-gray-400",children:"退款原因"}),s.jsx(Ee,{className:"text-gray-400",children:"分销佣金"}),s.jsx(Ee,{className:"text-gray-400",children:"下单时间"}),s.jsx(Ee,{className:"text-gray-400",children:"操作"})]})}),s.jsxs(gr,{children:[t.map(Y=>{const F=O(Y);return s.jsxs(lt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsxs(be,{className:"font-mono text-xs text-gray-400",children:[(Y.orderSn||Y.id||"").slice(0,12),"..."]}),s.jsx(be,{children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:me(Y)}),s.jsx("p",{className:"text-gray-500 text-xs",children:R(Y.userId)})]})}),s.jsx(be,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[F.name,(Y.productType||Y.type)==="vip"&&s.jsx(Ke,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"VIP"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:F.type})]})}),s.jsxs(be,{className:"text-[#38bdac] font-bold",children:["¥",Number(Y.amount||0).toFixed(2)]}),s.jsx(be,{className:"text-gray-300",children:Y.paymentMethod==="wechat"?"微信支付":Y.paymentMethod==="alipay"?"支付宝":Y.paymentMethod||"微信支付"}),s.jsx(be,{children:Y.status==="refunded"?s.jsx(Ke,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):Y.status==="paid"||Y.status==="completed"?s.jsx(Ke,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):Y.status==="pending"||Y.status==="created"?s.jsx(Ke,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):s.jsx(Ke,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"})}),s.jsx(be,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:Y.refundReason,children:Y.status==="refunded"&&Y.refundReason?Y.refundReason:"-"}),s.jsx(be,{className:"text-[#FFD700]",children:Y.referrerEarnings?`¥${Number(Y.referrerEarnings).toFixed(2)}`:"-"}),s.jsx(be,{className:"text-gray-400 text-sm",children:new Date(Y.createdAt).toLocaleString("zh-CN")}),s.jsx(be,{children:(Y.status==="paid"||Y.status==="completed")&&s.jsxs(ne,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{P(Y),z("")},children:[s.jsx(tj,{className:"w-3 h-3 mr-1"}),"退款"]})})]},Y.id)}),t.length===0&&s.jsx(lt,{children:s.jsx(be,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),s.jsx(ws,{page:f,totalPages:X,total:a,pageSize:g,onPageChange:m,onPageSizeChange:Y=>{y(Y),m(1)}})]})})}),s.jsx(Ft,{open:!!_,onOpenChange:Y=>!Y&&P(null),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Bt,{children:s.jsx(Vt,{className:"text-white",children:"订单退款"})}),_&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",_.orderSn||_.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(_.amount||0).toFixed(2)]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),s.jsx("div",{className:"form-input",children:s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:L,onChange:Y=>z(Y.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(ln,{children:[s.jsx(ne,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>P(null),disabled:ee,children:"取消"}),s.jsx(ne,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:$,disabled:ee,children:ee?"退款中...":"确认退款"})]})]})})]})}const Yl=b.forwardRef(({className:t,...e},n)=>s.jsx("textarea",{className:Ct("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...e}));Yl.displayName="Textarea";const Oc=[{id:"register",label:"注册/登录",icon:"👤",color:"bg-blue-500/20 border-blue-500/40 text-blue-400",desc:"微信授权登录或手机号注册"},{id:"browse",label:"浏览章节",icon:"📖",color:"bg-purple-500/20 border-purple-500/40 text-purple-400",desc:"点击免费/付费章节预览"},{id:"bind_phone",label:"绑定手机",icon:"📱",color:"bg-cyan-500/20 border-cyan-500/40 text-cyan-400",desc:"触发付费章节后绑定手机"},{id:"first_pay",label:"首次付款",icon:"💳",color:"bg-green-500/20 border-green-500/40 text-green-400",desc:"购买单章或全书"},{id:"fill_profile",label:"完善资料",icon:"✍️",color:"bg-yellow-500/20 border-yellow-500/40 text-yellow-400",desc:"填写头像、MBTI、行业等"},{id:"match",label:"派对房匹配",icon:"🤝",color:"bg-orange-500/20 border-orange-500/40 text-orange-400",desc:"参与 Soul 派对房"},{id:"vip",label:"升级 VIP",icon:"👑",color:"bg-amber-500/20 border-amber-500/40 text-amber-400",desc:"付款 ¥1980 购买全书"},{id:"distribution",label:"开启分销",icon:"🔗",color:"bg-[#38bdac]/20 border-[#38bdac]/40 text-[#38bdac]",desc:"生成推广码并推荐好友"}];function vP(){var Fa,na,Rs,Ps,Os,Ds;const[t,e]=Uw(),n=t.get("pool"),[r,a]=b.useState([]),[i,o]=b.useState(0),[c,u]=b.useState(1),[h,f]=b.useState(10),[m,g]=b.useState(""),y=o0(m,300),v=n==="vip"?"vip":n==="complete"?"complete":"all",[w,N]=b.useState(v),[k,C]=b.useState(!0),[E,A]=b.useState(!1),[I,D]=b.useState(null),[_,P]=b.useState(!1),[L,z]=b.useState("desc");b.useEffect(()=>{n==="vip"?N("vip"):n==="complete"?N("complete"):n==="all"&&N("all")},[n]);const[ee,U]=b.useState(!1),[he,me]=b.useState(null),[R,O]=b.useState(!1),[X,$]=b.useState(!1),[ce,Y]=b.useState({referrals:[],stats:{}}),[F,W]=b.useState(!1),[K,B]=b.useState(null),[oe,G]=b.useState(!1),[Q,se]=b.useState(null),[ye,Me]=b.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),[Be,He]=b.useState([]),[gt,Dt]=b.useState(!1),[jn,it]=b.useState(!1),[Mt,re]=b.useState(null),[Pe,et]=b.useState({title:"",description:"",trigger:"",sort:0,enabled:!0}),[xt,ft]=b.useState([]),[pt,wt]=b.useState(!1),[Qt,Lt]=b.useState(null),[An,At]=b.useState(null),[Kn,ns]=b.useState({}),[or,ge]=b.useState(!1),[Ne,qn]=b.useState(null),[Es,Ts]=b.useState([]),[Pa,br]=b.useState(!1),[Vi,vr]=b.useState(!1);async function lr(V=!1){var Ae;C(!0),V&&A(!0),D(null);try{if(_){const Ye=new URLSearchParams({search:y,limit:String(h*5)}),ct=await De(`/api/db/users/rfm?${Ye}`);if(ct!=null&&ct.success){let xn=ct.users||[];L==="asc"&&(xn=[...xn].reverse());const kn=(c-1)*h;a(xn.slice(kn,kn+h)),o(((Ae=ct.users)==null?void 0:Ae.length)??0),xn.length===0&&(P(!1),D("暂无订单数据,RFM 排序需要用户有购买记录后才能生效"))}else P(!1),D((ct==null?void 0:ct.error)||"RFM 加载失败,已切回普通模式")}else{const Ye=new URLSearchParams({page:String(c),pageSize:String(h),search:y,...w==="vip"&&{vip:"true"},...w==="complete"&&{pool:"complete"}}),ct=await De(`/api/db/users?${Ye}`);ct!=null&&ct.success?(a(ct.users||[]),o(ct.total??0)):D((ct==null?void 0:ct.error)||"加载失败")}}catch(Ye){console.error("Load users error:",Ye),D("网络错误")}finally{C(!1),V&&A(!1)}}b.useEffect(()=>{u(1)},[y,w,_]),b.useEffect(()=>{lr()},[c,h,y,w,_,L]);const Ms=Math.ceil(i/h)||1,Oa=()=>{_?L==="desc"?z("asc"):(P(!1),z("desc")):(P(!0),z("desc"))},Hi=V=>({S:"bg-amber-500/20 text-amber-400",A:"bg-green-500/20 text-green-400",B:"bg-blue-500/20 text-blue-400",C:"bg-gray-500/20 text-gray-400",D:"bg-red-500/20 text-red-400"})[V||""]||"bg-gray-500/20 text-gray-400";async function Xs(V){if(confirm("确定要删除这个用户吗?"))try{const Ae=await wa(`/api/db/users?id=${encodeURIComponent(V)}`);Ae!=null&&Ae.success?lr():le.error("删除失败: "+((Ae==null?void 0:Ae.error)||""))}catch{le.error("删除失败")}}const vt=V=>{me(V),Me({phone:V.phone||"",nickname:V.nickname||"",password:"",isAdmin:!!(V.isAdmin??!1),hasFullBook:!!(V.hasFullBook??!1)}),U(!0)},Gn=()=>{me(null),Me({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),U(!0)};async function Da(){if(!ye.phone||!ye.nickname){le.error("请填写手机号和昵称");return}O(!0);try{if(he){const V=await Tt("/api/db/users",{id:he.id,nickname:ye.nickname,isAdmin:ye.isAdmin,hasFullBook:ye.hasFullBook,...ye.password&&{password:ye.password}});if(!(V!=null&&V.success)){le.error("更新失败: "+((V==null?void 0:V.error)||""));return}}else{const V=await Nt("/api/db/users",{phone:ye.phone,nickname:ye.nickname,password:ye.password,isAdmin:ye.isAdmin});if(!(V!=null&&V.success)){le.error("创建失败: "+((V==null?void 0:V.error)||""));return}}U(!1),lr()}catch{le.error("保存失败")}finally{O(!1)}}async function As(V){B(V),$(!0),W(!0);try{const Ae=await De(`/api/db/users/referrals?userId=${encodeURIComponent(V.id)}`);Ae!=null&&Ae.success?Y({referrals:Ae.referrals||[],stats:Ae.stats||{}}):Y({referrals:[],stats:{}})}catch{Y({referrals:[],stats:{}})}finally{W(!1)}}const Nr=b.useCallback(async()=>{Dt(!0);try{const V=await De("/api/db/user-rules");V!=null&&V.success&&He(V.rules||[])}catch{}finally{Dt(!1)}},[]);async function Wi(){if(!Pe.title){le.error("请填写规则标题");return}O(!0);try{if(Mt){const V=await Tt("/api/db/user-rules",{id:Mt.id,...Pe});if(!(V!=null&&V.success)){le.error("更新失败: "+((V==null?void 0:V.error)||"未知错误"));return}le.success("规则已更新")}else{const V=await Nt("/api/db/user-rules",Pe);if(!(V!=null&&V.success)){le.error("创建失败: "+((V==null?void 0:V.error)||"未知错误"));return}le.success("规则已创建")}it(!1),Nr()}catch(V){const Ae=V;(Ae==null?void 0:Ae.status)===401?le.error("登录已过期,请重新登录"):(Ae==null?void 0:Ae.status)===404?le.error("接口不存在,请确认后端已部署最新版本"):le.error("保存失败: "+((Ae==null?void 0:Ae.message)||"网络错误"))}finally{O(!1)}}async function Zs(V){if(confirm("确定删除?"))try{const Ae=await wa(`/api/db/user-rules?id=${V}`);Ae!=null&&Ae.success&&Nr()}catch{}}async function nc(V){try{await Tt("/api/db/user-rules",{id:V.id,enabled:!V.enabled}),Nr()}catch{}}const Jn=b.useCallback(async()=>{wt(!0);try{const V=await De("/api/db/vip-members?limit=500");if(V!=null&&V.success&&V.data){const Ae=[...V.data].map((Ye,ct)=>({...Ye,vipSort:typeof Ye.vipSort=="number"?Ye.vipSort:ct+1}));Ae.sort((Ye,ct)=>(Ye.vipSort??999999)-(ct.vipSort??999999)),ft(Ae)}else V&&V.error&&le.error(V.error)}catch{le.error("加载超级个体列表失败")}finally{wt(!1)}},[]),[ea,rs]=b.useState(!1),[Ar,La]=b.useState(null),[ta,Ui]=b.useState(""),[cr,Ki]=b.useState(!1),ss=["创业者","资源整合者","技术达人","投资人","产品经理","流量操盘手"],rc=V=>{La(V),Ui(V.vipRole||""),rs(!0)},Vo=async V=>{const Ae=V.trim();if(Ar){if(!Ae){le.error("请选择或输入标签");return}Ki(!0);try{const Ye=await Tt("/api/db/users",{id:Ar.id,vipRole:Ae});if(!(Ye!=null&&Ye.success)){le.error((Ye==null?void 0:Ye.error)||"更新超级个体标签失败");return}le.success("已更新超级个体标签"),rs(!1),La(null),await Jn()}catch{le.error("更新超级个体标签失败")}finally{Ki(!1)}}},[qi,un]=b.useState(!1),[as,Is]=b.useState(null),[_a,It]=b.useState(""),[zn,Vr]=b.useState(!1),Ho=V=>{Is(V),It(V.vipSort!=null?String(V.vipSort):""),un(!0)},za=async()=>{if(!as)return;const V=Number(_a);if(!Number.isFinite(V)){le.error("请输入有效的数字序号");return}Vr(!0);try{const Ae=await Tt("/api/db/users",{id:as.id,vipSort:V});if(!(Ae!=null&&Ae.success)){le.error((Ae==null?void 0:Ae.error)||"更新排序序号失败");return}le.success("已更新排序序号"),un(!1),Is(null),await Jn()}catch{le.error("更新排序序号失败")}finally{Vr(!1)}},sc=(V,Ae)=>{V.dataTransfer.effectAllowed="move",V.dataTransfer.setData("text/plain",Ae),Lt(Ae)},Gi=(V,Ae)=>{V.preventDefault(),An!==Ae&&At(Ae)},$a=()=>{Lt(null),At(null)},dr=async(V,Ae)=>{V.preventDefault();const Ye=V.dataTransfer.getData("text/plain")||Qt;if(Lt(null),At(null),!Ye||Ye===Ae)return;const ct=xt.find(Xt=>Xt.id===Ye),xn=xt.find(Xt=>Xt.id===Ae);if(!ct||!xn)return;const kn=ct.vipSort??xt.findIndex(Xt=>Xt.id===Ye)+1,Uo=xn.vipSort??xt.findIndex(Xt=>Xt.id===Ae)+1;ft(Xt=>{const st=[...Xt],Ba=st.findIndex(ra=>ra.id===Ye),Va=st.findIndex(ra=>ra.id===Ae);if(Ba===-1||Va===-1)return Xt;const ls=[...st],[Ko,qo]=[ls[Ba],ls[Va]];return ls[Ba]={...qo,vipSort:kn},ls[Va]={...Ko,vipSort:Uo},ls});try{const[Xt,st]=await Promise.all([Tt("/api/db/users",{id:Ye,vipSort:Uo}),Tt("/api/db/users",{id:Ae,vipSort:kn})]);if(!(Xt!=null&&Xt.success)||!(st!=null&&st.success)){le.error((Xt==null?void 0:Xt.error)||(st==null?void 0:st.error)||"更新排序失败"),await Jn();return}le.success("已更新排序"),await Jn()}catch{le.error("更新排序失败"),await Jn()}},is=b.useCallback(async()=>{ge(!0);try{const V=await De("/api/db/users/journey-stats");V!=null&&V.success&&V.stats&&ns(V.stats)}catch{}finally{ge(!1)}},[]);async function $n(V){qn(V),br(!0);try{const Ae=await De(`/api/db/users/journey-users?stage=${encodeURIComponent(V)}&limit=20`);Ae!=null&&Ae.success&&Ae.users?Ts(Ae.users):Ts([])}catch{Ts([])}finally{br(!1)}}async function Wo(V){if(!V.hasFullBook){le.error("仅 VIP 用户可置顶到超级个体");return}if(confirm("确定将该用户置顶到首页超级个体位?(最多4位)"))try{const Ae=await Tt("/api/db/users",{id:V.id,vipSort:1});if(!(Ae!=null&&Ae.success)){le.error((Ae==null?void 0:Ae.error)||"置顶失败");return}le.success("已置顶到超级个体"),lr()}catch{le.error("置顶失败")}}return s.jsxs("div",{className:"p-8 w-full",children:[I&&s.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:[s.jsx("span",{children:I}),s.jsx("button",{type:"button",onClick:()=>D(null),children:"×"})]}),s.jsx("div",{className:"flex justify-between items-center mb-6",children:s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"用户管理"}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>vr(!0),className:"text-gray-500 hover:text-[#38bdac] h-8 w-8 p-0",title:"RFM 算法说明",children:s.jsx($c,{className:"w-4 h-4"})})]}),s.jsxs("p",{className:"text-gray-400 mt-1 text-sm",children:["共 ",i," 位注册用户",_&&" · RFM 排序中"]})]})}),s.jsxs(Cd,{defaultValue:"users",className:"w-full",children:[s.jsxs(Jl,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-6 flex-wrap h-auto gap-1",children:[s.jsxs(tn,{value:"users",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",children:[s.jsx(Mn,{className:"w-4 h-4"})," 用户列表"]}),s.jsxs(tn,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:is,children:[s.jsx(Tl,{className:"w-4 h-4"})," 用户旅程总览"]}),s.jsxs(tn,{value:"rules",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Nr,children:[s.jsx(bo,{className:"w-4 h-4"})," 规则配置"]}),s.jsxs(tn,{value:"vip-roles",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Jn,children:[s.jsx(Al,{className:"w-4 h-4"})," 超级个体列表"]})]}),s.jsxs(nn,{value:"users",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4 justify-end flex-wrap",children:[s.jsxs(ne,{variant:"outline",onClick:()=>lr(!0),disabled:E,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${E?"animate-spin":""}`})," 刷新"]}),s.jsxs("select",{value:w,onChange:V=>{const Ae=V.target.value;N(Ae),u(1),n&&(t.delete("pool"),e(t))},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",disabled:_,children:[s.jsx("option",{value:"all",children:"全部用户"}),s.jsx("option",{value:"vip",children:"VIP会员(超级个体)"}),s.jsx("option",{value:"complete",children:"完善资料用户"})]}),s.jsxs("div",{className:"relative",children:[s.jsx(Sa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(ie,{type:"text",placeholder:"搜索用户...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500 w-56",value:m,onChange:V=>g(V.target.value)})]}),s.jsxs(ne,{onClick:Gn,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx($g,{className:"w-4 h-4 mr-2"})," 添加用户"]})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ce,{className:"p-0",children:k?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400",children:"用户信息"}),s.jsx(Ee,{className:"text-gray-400",children:"绑定信息"}),s.jsx(Ee,{className:"text-gray-400",children:"购买状态"}),s.jsx(Ee,{className:"text-gray-400",children:"分销收益"}),s.jsx(Ee,{className:"text-gray-400",children:"余额/提现"}),s.jsxs(Ee,{className:"text-gray-400 cursor-pointer select-none",onClick:Oa,children:[s.jsxs("div",{className:"flex items-center gap-1 group",children:[s.jsx(vo,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"RFM分值"}),_?L==="desc"?s.jsx(od,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(qw,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(Am,{className:"w-3.5 h-3.5 text-gray-600 group-hover:text-gray-400"})]}),_&&s.jsx("div",{className:"text-[10px] text-[#38bdac] font-normal mt-0.5",children:"点击切换方向/关闭"})]}),s.jsx(Ee,{className:"text-gray-400",children:"注册时间"}),s.jsx(Ee,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(gr,{children:[r.map(V=>{var Ae,Ye,ct;return s.jsxs(lt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:V.avatar?s.jsx("img",{src:ts(V.avatar),className:"w-full h-full rounded-full object-cover",alt:""}):((Ae=V.nickname)==null?void 0:Ae.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("button",{type:"button",onClick:()=>{se(V.id),G(!0)},className:"font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:V.nickname}),V.isAdmin&&s.jsx(Ke,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),V.openId&&!((Ye=V.id)!=null&&Ye.startsWith("user_"))&&s.jsx(Ke,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0 text-xs",children:"微信"})]}),s.jsx("p",{className:"text-xs text-gray-500 font-mono",children:V.openId?V.openId.slice(0,12)+"...":(ct=V.id)==null?void 0:ct.slice(0,12)})]})]})}),s.jsx(be,{children:s.jsxs("div",{className:"space-y-1",children:[V.phone&&s.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"📱"}),s.jsx("span",{className:"text-gray-300",children:V.phone})]}),V.wechatId&&s.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"💬"}),s.jsx("span",{className:"text-gray-300",children:V.wechatId})]}),V.openId&&s.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"🔗"}),s.jsxs("span",{className:"text-gray-500 truncate max-w-[100px]",title:V.openId,children:[V.openId.slice(0,12),"..."]})]}),!V.phone&&!V.wechatId&&!V.openId&&s.jsx("span",{className:"text-gray-600 text-xs",children:"未绑定"})]})}),s.jsx(be,{children:V.hasFullBook?s.jsx(Ke,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:"VIP"}):s.jsx(Ke,{variant:"outline",className:"text-gray-500 border-gray-600",children:"未购买"})}),s.jsx(be,{children:s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(V.earnings||0)).toFixed(2)]}),parseFloat(String(V.pendingEarnings||0))>0&&s.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String(V.pendingEarnings||0)).toFixed(2)]}),s.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>As(V),role:"button",tabIndex:0,onKeyDown:xn=>xn.key==="Enter"&&As(V),children:[s.jsx(Mn,{className:"w-3 h-3"})," 绑定",V.referralCount||0,"人"]})]})}),s.jsx(be,{children:s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(V.walletBalance||0)).toFixed(2)]}),parseFloat(String(V.withdrawnEarnings||0))>0&&s.jsxs("div",{className:"text-xs text-gray-400",children:["已提现: ¥",parseFloat(String(V.withdrawnEarnings||0)).toFixed(2)]})]})}),s.jsx(be,{children:V.rfmScore!==void 0?s.jsx("div",{className:"flex flex-col gap-1",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-white font-bold text-base",children:V.rfmScore}),s.jsx(Ke,{className:`border-0 text-xs ${Hi(V.rfmLevel)}`,children:V.rfmLevel})]})}):s.jsxs("span",{className:"text-gray-600 text-sm",children:["— ",s.jsx("span",{className:"text-xs text-gray-700",children:"点列头排序"})]})}),s.jsx(be,{className:"text-gray-400",children:V.createdAt?new Date(V.createdAt).toLocaleDateString():"-"}),s.jsx(be,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>{se(V.id),G(!0)},className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"用户详情",children:s.jsx(Og,{className:"w-4 h-4"})}),V.hasFullBook&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>Wo(V),className:"text-gray-400 hover:text-orange-400 hover:bg-orange-400/10",title:"置顶超级个体",children:s.jsx(xi,{className:"w-4 h-4"})}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>vt(V),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑用户",children:s.jsx($t,{className:"w-4 h-4"})}),s.jsx(ne,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>Xs(V.id),title:"删除",children:s.jsx(er,{className:"w-4 h-4"})})]})})]},V.id)}),r.length===0&&s.jsx(lt,{children:s.jsx(be,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),s.jsx(ws,{page:c,totalPages:Ms,total:i,pageSize:h,onPageChange:u,onPageSizeChange:V=>{f(V),u(1)}})]})})})]}),s.jsxs(nn,{value:"journey",children:[s.jsxs("div",{className:"flex items-center justify-between mb-5",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"用户从注册到 VIP 的完整行动路径,点击各阶段查看用户动态"}),s.jsxs(ne,{variant:"outline",onClick:is,disabled:or,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${or?"animate-spin":""}`})," 刷新数据"]})]}),s.jsxs("div",{className:"relative mb-8",children:[s.jsx("div",{className:"absolute top-16 left-0 right-0 h-0.5 bg-gradient-to-r from-blue-500/20 via-[#38bdac]/30 to-amber-500/20 mx-20"}),s.jsx("div",{className:"grid grid-cols-4 gap-4 lg:grid-cols-8",children:Oc.map((V,Ae)=>s.jsxs("div",{className:"relative flex flex-col items-center",children:[s.jsxs("div",{role:"button",tabIndex:0,className:`relative w-full p-3 rounded-xl border ${V.color} text-center cursor-pointer`,onClick:()=>$n(V.id),onKeyDown:Ye=>Ye.key==="Enter"&&$n(V.id),children:[s.jsx("div",{className:"text-2xl mb-1",children:V.icon}),s.jsx("div",{className:`text-xs font-medium ${V.color.split(" ").find(Ye=>Ye.startsWith("text-"))}`,children:V.label}),Kn[V.id]!==void 0&&s.jsxs("div",{className:"mt-1.5 text-xs text-gray-400",children:[s.jsx("span",{className:"font-bold text-white",children:Kn[V.id]})," 人"]}),s.jsx("div",{className:"absolute -top-2.5 -left-2.5 w-5 h-5 rounded-full bg-[#0a1628] border border-gray-700 flex items-center justify-center text-[10px] text-gray-500",children:Ae+1})]}),AeV.id===Ne))==null?void 0:Fa.label," — 用户列表"]}),s.jsxs(ne,{variant:"ghost",size:"sm",onClick:()=>qn(null),className:"text-gray-500 hover:text-white",children:[s.jsx(nr,{className:"w-4 h-4"})," 关闭"]})]}),Pa?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(Ue,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Es.length>0?s.jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:Es.map(V=>s.jsxs("div",{className:"flex items-center justify-between py-2 px-3 bg-[#0a1628] rounded-lg hover:bg-[#0a1628]/80 cursor-pointer",onClick:()=>{se(V.id),G(!0)},onKeyDown:Ae=>Ae.key==="Enter"&&(se(V.id),G(!0)),role:"button",tabIndex:0,children:[s.jsx("span",{className:"text-white font-medium",children:V.nickname}),s.jsx("span",{className:"text-gray-400 text-sm",children:V.phone||"—"}),s.jsx("span",{className:"text-gray-500 text-xs",children:V.createdAt?new Date(V.createdAt).toLocaleDateString():"—"})]},V.id))}):s.jsx("p",{className:"text-gray-500 text-sm py-4",children:"暂无用户"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/50 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(Tl,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"旅程关键节点"})]}),s.jsx("div",{className:"space-y-2 text-sm",children:[{step:"① 注册",action:"微信 OAuth 或手机号注册",next:"引导填写头像"},{step:"② 浏览",action:"点击章节/阅读免费内容",next:"触发绑定手机"},{step:"③ 首付",action:"购买单章或全书",next:"推送分销功能"},{step:"④ VIP",action:"¥1980 购买全书",next:"进入 VIP 私域群"},{step:"⑤ 分销",action:"推广好友购买",next:"提现分销收益"}].map(V=>s.jsxs("div",{className:"flex items-start gap-3 p-2 bg-[#0a1628] rounded",children:[s.jsx("span",{className:"text-[#38bdac] font-mono text-xs shrink-0 mt-0.5",children:V.step}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-300",children:V.action}),s.jsxs("p",{className:"text-gray-600 text-xs",children:["→ ",V.next]})]})]},V.step))})]}),s.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/50 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx($r,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"行为锚点统计"}),s.jsx("span",{className:"text-gray-500 text-xs ml-auto",children:"实时更新"})]}),or?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(Ue,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Object.keys(Kn).length>0?s.jsx("div",{className:"space-y-2",children:Oc.map(V=>{const Ae=Kn[V.id]||0,Ye=Math.max(...Oc.map(xn=>Kn[xn.id]||0),1),ct=Math.round(Ae/Ye*100);return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-gray-500 text-xs w-20 shrink-0",children:[V.icon," ",V.label]}),s.jsx("div",{className:"flex-1 h-2 bg-[#0a1628] rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-[#38bdac]/60 rounded-full transition-all",style:{width:`${ct}%`}})}),s.jsx("span",{className:"text-gray-400 text-xs w-10 text-right",children:Ae})]},V.id)})}):s.jsx("div",{className:"text-center py-8",children:s.jsx("p",{className:"text-gray-500 text-sm",children:"点击「刷新数据」加载统计"})})]})]})]}),s.jsxs(nn,{value:"rules",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"用户旅程引导规则,定义各行为节点的触发条件与引导内容"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(ne,{variant:"outline",onClick:Nr,disabled:gt,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${gt?"animate-spin":""}`})," 刷新"]}),s.jsxs(ne,{onClick:()=>{re(null),et({title:"",description:"",trigger:"",sort:0,enabled:!0}),it(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(pn,{className:"w-4 h-4 mr-2"})," 添加规则"]})]})]}),gt?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):Be.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx($r,{className:"w-12 h-12 text-[#38bdac]/30 mx-auto mb-4"}),s.jsx("p",{className:"text-gray-400 mb-4",children:"暂无规则(重启服务将自动写入10条默认规则)"}),s.jsxs(ne,{onClick:Nr,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Ue,{className:"w-4 h-4 mr-2"})," 重新加载"]})]}):s.jsx("div",{className:"space-y-2",children:Be.map(V=>s.jsx("div",{className:`p-4 rounded-lg border transition-all ${V.enabled?"bg-[#0f2137] border-gray-700/50":"bg-[#0a1628]/50 border-gray-700/30 opacity-55"}`,children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[s.jsx($t,{className:"w-4 h-4 text-[#38bdac] shrink-0"}),s.jsx("span",{className:"text-white font-medium",children:V.title}),V.trigger&&s.jsxs(Ke,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-xs",children:["触发:",V.trigger]}),s.jsx(Ke,{className:`text-xs border-0 ${V.enabled?"bg-green-500/20 text-green-400":"bg-gray-500/20 text-gray-400"}`,children:V.enabled?"启用":"禁用"})]}),V.description&&s.jsx("p",{className:"text-gray-400 text-sm ml-6",children:V.description})]}),s.jsxs("div",{className:"flex items-center gap-2 ml-4 shrink-0",children:[s.jsx(Et,{checked:V.enabled,onCheckedChange:()=>nc(V)}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>{re(V),et({title:V.title,description:V.description,trigger:V.trigger,sort:V.sort,enabled:V.enabled}),it(!0)},className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx($t,{className:"w-4 h-4"})}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>Zs(V.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(er,{className:"w-4 h-4"})})]})]})},V.id))})]}),s.jsxs(nn,{value:"vip-roles",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"展示当前所有有效的超级个体(VIP 用户),用于检查会员信息与排序值。"}),s.jsx("p",{className:"text-xs text-[#38bdac]",children:"提示:按住任意一行即可拖拽排序,释放后将同步更新小程序展示顺序。"})]}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs(ne,{variant:"outline",onClick:Jn,disabled:pt,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${pt?"animate-spin":""}`})," ","刷新"]})})]}),pt?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):xt.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(Al,{className:"w-12 h-12 text-amber-400/30 mx-auto mb-4"}),s.jsx("p",{className:"text-gray-400 mb-4",children:"当前没有有效的超级个体用户。"})]}):s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ce,{className:"p-0",children:s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400 w-16",children:"序号"}),s.jsx(Ee,{className:"text-gray-400",children:"成员"}),s.jsx(Ee,{className:"text-gray-400 min-w-48",children:"超级个体标签"}),s.jsx(Ee,{className:"text-gray-400 w-24",children:"排序值"}),s.jsx(Ee,{className:"text-gray-400 w-40 text-right",children:"操作"})]})}),s.jsx(gr,{children:xt.map((V,Ae)=>{var xn;const Ye=Qt===V.id,ct=An===V.id;return s.jsxs(lt,{draggable:!0,onDragStart:kn=>sc(kn,V.id),onDragOver:kn=>Gi(kn,V.id),onDrop:kn=>dr(kn,V.id),onDragEnd:$a,className:`border-gray-700/50 cursor-grab active:cursor-grabbing select-none ${Ye?"opacity-60":""} ${ct?"bg-[#38bdac]/10":""}`,children:[s.jsx(be,{className:"text-gray-300",children:Ae+1}),s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[V.avatar?s.jsx("img",{src:ts(V.avatar),className:"w-8 h-8 rounded-full object-cover border border-amber-400/60"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/20 border border-amber-400/60 flex items-center justify-center text-amber-300 text-sm",children:((xn=V.name)==null?void 0:xn[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:V.name})})]})}),s.jsx(be,{className:"text-gray-300 whitespace-nowrap",children:V.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置超级个体标签)"})}),s.jsx(be,{className:"text-gray-300",children:V.vipSort??Ae+1}),s.jsx(be,{className:"text-right text-xs text-gray-300",children:s.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[s.jsx(ne,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-amber-300 hover:text-amber-200",onClick:()=>rc(V),title:"设置超级个体标签",children:s.jsx(qc,{className:"w-3.5 h-3.5"})}),s.jsx(ne,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-[#38bdac] hover:text-[#5fe0cd]",onClick:()=>{se(V.id),G(!0)},title:"编辑资料",children:s.jsx($t,{className:"w-3.5 h-3.5"})}),s.jsx(ne,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-sky-300 hover:text-sky-200",onClick:()=>Ho(V),title:"设置排序序号",children:s.jsx(Am,{className:"w-3.5 h-3.5"})})]})})]},V.id)})})]})})})]})]}),s.jsx(Ft,{open:qi,onOpenChange:V=>{un(V),V||Is(null)},children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(Am,{className:"w-5 h-5 text-[#38bdac]"}),"设置排序 — ",as==null?void 0:as.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(te,{className:"text-gray-300 text-sm",children:"排序序号(数字越小越靠前)"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:1",value:_a,onChange:V=>It(V.target.value)})]}),s.jsxs(ln,{children:[s.jsxs(ne,{variant:"outline",onClick:()=>un(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(nr,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(ne,{onClick:za,disabled:zn,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),zn?"保存中...":"保存"]})]})]})}),s.jsx(Ft,{open:ea,onOpenChange:V=>{rs(V),V||La(null)},children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(Al,{className:"w-5 h-5 text-amber-400"}),"设置超级个体标签 — ",Ar==null?void 0:Ar.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(te,{className:"text-gray-300 text-sm",children:"选择或输入标签"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:ss.map(V=>s.jsx(ne,{variant:ta===V?"default":"outline",size:"sm",className:ta===V?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50",onClick:()=>Ui(V),children:V},V))}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"或手动输入"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创业者、资源整合者等",value:ta,onChange:V=>Ui(V.target.value)})]})]}),s.jsxs(ln,{children:[s.jsxs(ne,{variant:"outline",onClick:()=>rs(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(nr,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(ne,{onClick:()=>Vo(ta),disabled:cr,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),cr?"保存中...":"保存"]})]})]})}),s.jsx(Ft,{open:ee,onOpenChange:U,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[he?s.jsx($t,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx($g,{className:"w-5 h-5 text-[#38bdac]"}),he?"编辑用户":"添加用户"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"手机号"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:ye.phone,onChange:V=>Me({...ye,phone:V.target.value}),disabled:!!he})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"昵称"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:ye.nickname,onChange:V=>Me({...ye,nickname:V.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:he?"新密码 (留空则不修改)":"密码"}),s.jsx(ie,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:he?"留空则不修改":"请输入密码",value:ye.password,onChange:V=>Me({...ye,password:V.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(te,{className:"text-gray-300",children:"管理员权限"}),s.jsx(Et,{checked:ye.isAdmin,onCheckedChange:V=>Me({...ye,isAdmin:V})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(te,{className:"text-gray-300",children:"已购全书"}),s.jsx(Et,{checked:ye.hasFullBook,onCheckedChange:V=>Me({...ye,hasFullBook:V})})]})]}),s.jsxs(ln,{children:[s.jsxs(ne,{variant:"outline",onClick:()=>U(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(nr,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(ne,{onClick:Da,disabled:R,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),R?"保存中...":"保存"]})]})]})}),s.jsx(Ft,{open:jn,onOpenChange:it,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx($t,{className:"w-5 h-5 text-[#38bdac]"}),Mt?"编辑规则":"添加规则"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"规则标题 *"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:匹配后填写头像、付款1980需填写信息",value:Pe.title,onChange:V=>et({...Pe,title:V.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"规则描述"}),s.jsx(Yl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[80px] resize-none",placeholder:"详细说明规则内容...",value:Pe.description,onChange:V=>et({...Pe,description:V.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"触发条件"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:完成匹配、付款后、注册时",value:Pe.trigger,onChange:V=>et({...Pe,trigger:V.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{children:s.jsx(te,{className:"text-gray-300",children:"启用状态"})}),s.jsx(Et,{checked:Pe.enabled,onCheckedChange:V=>et({...Pe,enabled:V})})]})]}),s.jsxs(ln,{children:[s.jsxs(ne,{variant:"outline",onClick:()=>it(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(nr,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(ne,{onClick:Wi,disabled:R,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),R?"保存中...":"保存"]})]})]})}),s.jsx(Ft,{open:X,onOpenChange:$,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(Mn,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系 - ",K==null?void 0:K.nickname]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsx("div",{className:"text-2xl font-bold text-[#38bdac]",children:((na=ce.stats)==null?void 0:na.total)||0}),s.jsx("div",{className:"text-xs text-gray-400",children:"绑定总数"})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsx("div",{className:"text-2xl font-bold text-green-400",children:((Rs=ce.stats)==null?void 0:Rs.purchased)||0}),s.jsx("div",{className:"text-xs text-gray-400",children:"已付费"})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsxs("div",{className:"text-2xl font-bold text-yellow-400",children:["¥",(((Ps=ce.stats)==null?void 0:Ps.earnings)||0).toFixed(2)]}),s.jsx("div",{className:"text-xs text-gray-400",children:"累计收益"})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsxs("div",{className:"text-2xl font-bold text-orange-400",children:["¥",(((Os=ce.stats)==null?void 0:Os.pendingEarnings)||0).toFixed(2)]}),s.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),F?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(Ue,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((Ds=ce.referrals)==null?void 0:Ds.length)??0)>0?s.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(ce.referrals??[]).map((V,Ae)=>{var ct;const Ye=V;return s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg p-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:((ct=Ye.nickname)==null?void 0:ct.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white text-sm",children:Ye.nickname}),s.jsx("div",{className:"text-xs text-gray-500",children:Ye.phone||(Ye.hasOpenId?"微信用户":"未绑定")})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[Ye.status==="vip"&&s.jsx(Ke,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),Ye.status==="paid"&&s.jsxs(Ke,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",Ye.purchasedSections,"章"]}),Ye.status==="free"&&s.jsx(Ke,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),s.jsx("span",{className:"text-xs text-gray-500",children:Ye.createdAt?new Date(Ye.createdAt).toLocaleDateString():""})]})]},Ye.id||Ae)})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),s.jsx(ln,{children:s.jsx(ne,{variant:"outline",onClick:()=>$(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),s.jsx(Ft,{open:Vi,onOpenChange:vr,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(vo,{className:"w-5 h-5 text-[#38bdac]"}),"RFM 算法说明"]})}),s.jsxs("div",{className:"space-y-3 py-4 text-sm text-gray-300",children:[s.jsxs("p",{children:[s.jsx("span",{className:"text-[#38bdac] font-medium",children:"R(Recency)"}),":距最近购买天数,越近分越高,权重 40%"]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-[#38bdac] font-medium",children:"F(Frequency)"}),":购买频次,越多分越高,权重 30%"]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-[#38bdac] font-medium",children:"M(Monetary)"}),":消费金额,越高分越高,权重 30%"]}),s.jsx("p",{className:"text-gray-400",children:"综合分 = R×40% + F×30% + M×30%,归一化到 0-100"}),s.jsxs("p",{className:"text-gray-400",children:["等级:",s.jsx("span",{className:"text-amber-400",children:"S"}),"(≥85)、",s.jsx("span",{className:"text-green-400",children:"A"}),"(≥70)、",s.jsx("span",{className:"text-blue-400",children:"B"}),"(≥50)、",s.jsx("span",{className:"text-gray-400",children:"C"}),"(≥30)、",s.jsx("span",{className:"text-red-400",children:"D"}),"(<30)"]})]}),s.jsx(ln,{children:s.jsx(ne,{variant:"outline",onClick:()=>vr(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),s.jsx(i0,{open:oe,onClose:()=>G(!1),userId:Q,onUserUpdated:lr})]})}function bh(t,[e,n]){return Math.min(n,Math.max(e,t))}var jk=["PageUp","PageDown"],kk=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Sk={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Ql="Slider",[Wg,NP,wP]=n0(Ql),[Ck]=Li(Ql,[wP]),[jP,Sf]=Ck(Ql),Ek=b.forwardRef((t,e)=>{const{name:n,min:r=0,max:a=100,step:i=1,orientation:o="horizontal",disabled:c=!1,minStepsBetweenThumbs:u=0,defaultValue:h=[r],value:f,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:y=!1,form:v,...w}=t,N=b.useRef(new Set),k=b.useRef(0),E=o==="horizontal"?kP:SP,[A=[],I]=Eo({prop:f,defaultProp:h,onChange:ee=>{var he;(he=[...N.current][k.current])==null||he.focus(),m(ee)}}),D=b.useRef(A);function _(ee){const U=AP(A,ee);z(ee,U)}function P(ee){z(ee,k.current)}function L(){const ee=D.current[k.current];A[k.current]!==ee&&g(A)}function z(ee,U,{commit:he}={commit:!1}){const me=OP(i),R=DP(Math.round((ee-r)/i)*i+r,me),O=bh(R,[r,a]);I((X=[])=>{const $=TP(X,O,U);if(PP($,u*i)){k.current=$.indexOf(O);const ce=String($)!==String(X);return ce&&he&&g($),ce?$:X}else return X})}return s.jsx(jP,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:a,valueIndexToChangeRef:k,thumbs:N.current,values:A,orientation:o,form:v,children:s.jsx(Wg.Provider,{scope:t.__scopeSlider,children:s.jsx(Wg.Slot,{scope:t.__scopeSlider,children:s.jsx(E,{"aria-disabled":c,"data-disabled":c?"":void 0,...w,ref:e,onPointerDown:at(w.onPointerDown,()=>{c||(D.current=A)}),min:r,max:a,inverted:y,onSlideStart:c?void 0:_,onSlideMove:c?void 0:P,onSlideEnd:c?void 0:L,onHomeKeyDown:()=>!c&&z(r,0,{commit:!0}),onEndKeyDown:()=>!c&&z(a,A.length-1,{commit:!0}),onStepKeyDown:({event:ee,direction:U})=>{if(!c){const R=jk.includes(ee.key)||ee.shiftKey&&kk.includes(ee.key)?10:1,O=k.current,X=A[O],$=i*R*U;z(X+$,O,{commit:!0})}}})})})})});Ek.displayName=Ql;var[Tk,Mk]=Ck(Ql,{startEdge:"left",endEdge:"right",size:"width",direction:1}),kP=b.forwardRef((t,e)=>{const{min:n,max:r,dir:a,inverted:i,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onStepKeyDown:h,...f}=t,[m,g]=b.useState(null),y=St(e,E=>g(E)),v=b.useRef(void 0),w=wf(a),N=w==="ltr",k=N&&!i||!N&&i;function C(E){const A=v.current||m.getBoundingClientRect(),I=[0,A.width],_=l0(I,k?[n,r]:[r,n]);return v.current=A,_(E-A.left)}return s.jsx(Tk,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:s.jsx(Ak,{dir:w,"data-orientation":"horizontal",...f,ref:y,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:E=>{const A=C(E.clientX);o==null||o(A)},onSlideMove:E=>{const A=C(E.clientX);c==null||c(A)},onSlideEnd:()=>{v.current=void 0,u==null||u()},onStepKeyDown:E=>{const I=Sk[k?"from-left":"from-right"].includes(E.key);h==null||h({event:E,direction:I?-1:1})}})})}),SP=b.forwardRef((t,e)=>{const{min:n,max:r,inverted:a,onSlideStart:i,onSlideMove:o,onSlideEnd:c,onStepKeyDown:u,...h}=t,f=b.useRef(null),m=St(e,f),g=b.useRef(void 0),y=!a;function v(w){const N=g.current||f.current.getBoundingClientRect(),k=[0,N.height],E=l0(k,y?[r,n]:[n,r]);return g.current=N,E(w-N.top)}return s.jsx(Tk,{scope:t.__scopeSlider,startEdge:y?"bottom":"top",endEdge:y?"top":"bottom",size:"height",direction:y?1:-1,children:s.jsx(Ak,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:w=>{const N=v(w.clientY);i==null||i(N)},onSlideMove:w=>{const N=v(w.clientY);o==null||o(N)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:w=>{const k=Sk[y?"from-bottom":"from-top"].includes(w.key);u==null||u({event:w,direction:k?-1:1})}})})}),Ak=b.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:a,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:c,onStepKeyDown:u,...h}=t,f=Sf(Ql,n);return s.jsx(ut.span,{...h,ref:e,onKeyDown:at(t.onKeyDown,m=>{m.key==="Home"?(o(m),m.preventDefault()):m.key==="End"?(c(m),m.preventDefault()):jk.concat(kk).includes(m.key)&&(u(m),m.preventDefault())}),onPointerDown:at(t.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(g)?g.focus():r(m)}),onPointerMove:at(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&a(m)}),onPointerUp:at(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),i(m))})})}),Ik="SliderTrack",Rk=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=Sf(Ik,n);return s.jsx(ut.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...r,ref:e})});Rk.displayName=Ik;var Ug="SliderRange",Pk=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=Sf(Ug,n),i=Mk(Ug,n),o=b.useRef(null),c=St(e,o),u=a.values.length,h=a.values.map(g=>Lk(g,a.min,a.max)),f=u>1?Math.min(...h):0,m=100-Math.max(...h);return s.jsx(ut.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...r,ref:c,style:{...t.style,[i.startEdge]:f+"%",[i.endEdge]:m+"%"}})});Pk.displayName=Ug;var Kg="SliderThumb",Ok=b.forwardRef((t,e)=>{const n=NP(t.__scopeSlider),[r,a]=b.useState(null),i=St(e,c=>a(c)),o=b.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return s.jsx(CP,{...t,ref:i,index:o})}),CP=b.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:a,...i}=t,o=Sf(Kg,n),c=Mk(Kg,n),[u,h]=b.useState(null),f=St(e,C=>h(C)),m=u?o.form||!!u.closest("form"):!0,g=a0(u),y=o.values[r],v=y===void 0?0:Lk(y,o.min,o.max),w=MP(r,o.values.length),N=g==null?void 0:g[c.size],k=N?IP(N,v,c.direction):0;return b.useEffect(()=>{if(u)return o.thumbs.add(u),()=>{o.thumbs.delete(u)}},[u,o.thumbs]),s.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${v}% + ${k}px)`},children:[s.jsx(Wg.ItemSlot,{scope:t.__scopeSlider,children:s.jsx(ut.span,{role:"slider","aria-label":t["aria-label"]||w,"aria-valuemin":o.min,"aria-valuenow":y,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...i,ref:f,style:y===void 0?{display:"none"}:t.style,onFocus:at(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),m&&s.jsx(Dk,{name:a??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:y},r)]})});Ok.displayName=Kg;var EP="RadioBubbleInput",Dk=b.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const a=b.useRef(null),i=St(a,r),o=s0(e);return b.useEffect(()=>{const c=a.current;if(!c)return;const u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(o!==e&&f){const m=new Event("input",{bubbles:!0});f.call(c,e),c.dispatchEvent(m)}},[o,e]),s.jsx(ut.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});Dk.displayName=EP;function TP(t=[],e,n){const r=[...t];return r[n]=e,r.sort((a,i)=>a-i)}function Lk(t,e,n){const i=100/(n-e)*(t-e);return bh(i,[0,100])}function MP(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function AP(t,e){if(t.length===1)return 0;const n=t.map(a=>Math.abs(a-e)),r=Math.min(...n);return n.indexOf(r)}function IP(t,e,n){const r=t/2,i=l0([0,50],[0,r]);return(r-i(e)*n)*n}function RP(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function PP(t,e){if(e>0){const n=RP(t);return Math.min(...n)>=e}return!0}function l0(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function OP(t){return(String(t).split(".")[1]||"").length}function DP(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var LP=Ek,_P=Rk,zP=Pk,$P=Ok;function FP({className:t,defaultValue:e,value:n,min:r=0,max:a=100,...i}){const o=b.useMemo(()=>Array.isArray(n)?n:Array.isArray(e)?e:[r,a],[n,e,r,a]);return s.jsxs(LP,{defaultValue:e,value:n,min:r,max:a,className:Ct("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",t),...i,children:[s.jsx(_P,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:s.jsx(zP,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:o.length},(c,u)=>s.jsx($P,{className:"block size-4 shrink-0 rounded-full border-2 border-[#38bdac] bg-white shadow-sm focus-visible:ring-2 focus-visible:ring-[#38bdac] focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"},u))]})}const BP={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function _k(t){const[e,n]=b.useState(BP),[r,a]=b.useState(!0),[i,o]=b.useState(!1);b.useEffect(()=>{De("/api/admin/referral-settings").then(h=>{const f=h==null?void 0:h.data;f&&typeof f=="object"&&n({distributorShare:f.distributorShare??90,minWithdrawAmount:f.minWithdrawAmount??10,bindingDays:f.bindingDays??30,userDiscount:f.userDiscount??5,enableAutoWithdraw:f.enableAutoWithdraw??!1,vipOrderShareVip:f.vipOrderShareVip??20,vipOrderShareNonVip:f.vipOrderShareNonVip??10})}).catch(console.error).finally(()=>a(!1))},[]);const c=async()=>{o(!0);try{const h={distributorShare:Number(e.distributorShare)||0,minWithdrawAmount:Number(e.minWithdrawAmount)||0,bindingDays:Number(e.bindingDays)||0,userDiscount:Number(e.userDiscount)||0,enableAutoWithdraw:!!e.enableAutoWithdraw,vipOrderShareVip:Number(e.vipOrderShareVip)||20,vipOrderShareNonVip:Number(e.vipOrderShareNonVip)||10},f=await Nt("/api/admin/referral-settings",h);if(!f||f.success===!1){le.error("保存失败: "+(f&&typeof f=="object"&&"error"in f?f.error:""));return}le.success(`✅ 分销配置已保存成功! +For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return b.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},_R="DialogDescriptionWarning",zR=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${qj(_R).contentName}}.`;return b.useEffect(()=>{var i;const a=(i=t.current)==null?void 0:i.getAttribute("aria-describedby");e&&a&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},$R=Oj,FR=_j,BR=zj,VR=$j,HR=Bj,WR=Hj,UR=Uj;function Ft(t){return s.jsx($R,{"data-slot":"dialog",...t})}function KR(t){return s.jsx(FR,{...t})}const Gj=b.forwardRef(({className:t,...e},n)=>s.jsx(BR,{ref:n,className:Ct("fixed inset-0 z-50 bg-black/50",t),...e}));Gj.displayName="DialogOverlay";const Rt=b.forwardRef(({className:t,children:e,showCloseButton:n=!0,...r},a)=>s.jsxs(KR,{children:[s.jsx(Gj,{}),s.jsxs(VR,{ref:a,"aria-describedby":void 0,className:Ct("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",t),...r,children:[e,n&&s.jsxs(UR,{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:[s.jsx(nr,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Rt.displayName="DialogContent";function Bt({className:t,...e}){return s.jsx("div",{className:Ct("flex flex-col gap-2 text-center sm:text-left",t),...e})}function ln({className:t,...e}){return s.jsx("div",{className:Ct("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function Vt(t){return s.jsx(HR,{className:"text-lg font-semibold leading-none",...t})}function Jj(t){return s.jsx(WR,{className:"text-sm text-muted-foreground",...t})}const qR=oj("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 Ke({className:t,variant:e,asChild:n=!1,...r}){const a=n?sj:"span";return s.jsx(a,{className:Ct(qR({variant:e}),t),...r})}var GR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],JR=GR.reduce((t,e)=>{const n=rj(`Primitive.${e}`),r=b.forwardRef((a,i)=>{const{asChild:o,...c}=a,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),YR="Label",Yj=b.forwardRef((t,e)=>s.jsx(JR.label,{...t,ref:e,onMouseDown:n=>{var a;n.target.closest("button, input, select, textarea")||((a=t.onMouseDown)==null||a.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Yj.displayName=YR;var Qj=Yj;const te=b.forwardRef(({className:t,...e},n)=>s.jsx(Qj,{ref:n,className:Ct("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));te.displayName=Qj.displayName;function n0(t){const e=t+"CollectionProvider",[n,r]=Li(e),[a,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=w=>{const{scope:N,children:k}=w,C=fr.useRef(null),E=fr.useRef(new Map).current;return s.jsx(a,{scope:N,itemMap:E,collectionRef:C,children:k})};o.displayName=e;const c=t+"CollectionSlot",u=ld(c),h=fr.forwardRef((w,N)=>{const{scope:k,children:C}=w,E=i(c,k),A=St(N,E.collectionRef);return s.jsx(u,{ref:A,children:C})});h.displayName=c;const f=t+"CollectionItemSlot",m="data-radix-collection-item",g=ld(f),y=fr.forwardRef((w,N)=>{const{scope:k,children:C,...E}=w,A=fr.useRef(null),I=St(N,A),D=i(f,k);return fr.useEffect(()=>(D.itemMap.set(A,{ref:A,...E}),()=>void D.itemMap.delete(A))),s.jsx(g,{[m]:"",ref:I,children:C})});y.displayName=f;function v(w){const N=i(t+"CollectionConsumer",w);return fr.useCallback(()=>{const C=N.collectionRef.current;if(!C)return[];const E=Array.from(C.querySelectorAll(`[${m}]`));return Array.from(N.itemMap.values()).sort((D,_)=>E.indexOf(D.ref.current)-E.indexOf(_.ref.current))},[N.collectionRef,N.itemMap])}return[{Provider:o,Slot:h,ItemSlot:y},v,r]}var QR=b.createContext(void 0);function wf(t){const e=b.useContext(QR);return t||e||"ltr"}var Vm="rovingFocusGroup.onEntryFocus",XR={bubbles:!1,cancelable:!0},Sd="RovingFocusGroup",[Hg,Xj,ZR]=n0(Sd),[eP,Zj]=Li(Sd,[ZR]),[tP,nP]=eP(Sd),ek=b.forwardRef((t,e)=>s.jsx(Hg.Provider,{scope:t.__scopeRovingFocusGroup,children:s.jsx(Hg.Slot,{scope:t.__scopeRovingFocusGroup,children:s.jsx(rP,{...t,ref:e})})}));ek.displayName=Sd;var rP=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,g=b.useRef(null),y=St(e,g),v=wf(i),[w,N]=Eo({prop:o,defaultProp:c??null,onChange:u,caller:Sd}),[k,C]=b.useState(!1),E=Ti(h),A=Xj(n),I=b.useRef(!1),[D,_]=b.useState(0);return b.useEffect(()=>{const P=g.current;if(P)return P.addEventListener(Vm,E),()=>P.removeEventListener(Vm,E)},[E]),s.jsx(tP,{scope:n,orientation:r,dir:v,loop:a,currentTabStopId:w,onItemFocus:b.useCallback(P=>N(P),[N]),onItemShiftTab:b.useCallback(()=>C(!0),[]),onFocusableItemAdd:b.useCallback(()=>_(P=>P+1),[]),onFocusableItemRemove:b.useCallback(()=>_(P=>P-1),[]),children:s.jsx(ut.div,{tabIndex:k||D===0?-1:0,"data-orientation":r,...m,ref:y,style:{outline:"none",...t.style},onMouseDown:at(t.onMouseDown,()=>{I.current=!0}),onFocus:at(t.onFocus,P=>{const L=!I.current;if(P.target===P.currentTarget&&L&&!k){const z=new CustomEvent(Vm,XR);if(P.currentTarget.dispatchEvent(z),!z.defaultPrevented){const ee=A().filter(O=>O.focusable),U=ee.find(O=>O.active),he=ee.find(O=>O.id===w),R=[U,he,...ee].filter(Boolean).map(O=>O.ref.current);rk(R,f)}}I.current=!1}),onBlur:at(t.onBlur,()=>C(!1))})})}),tk="RovingFocusGroupItem",nk=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:i,children:o,...c}=t,u=ji(),h=i||u,f=nP(tk,n),m=f.currentTabStopId===h,g=Xj(n),{onFocusableItemAdd:y,onFocusableItemRemove:v,currentTabStopId:w}=f;return b.useEffect(()=>{if(r)return y(),()=>v()},[r,y,v]),s.jsx(Hg.ItemSlot,{scope:n,id:h,focusable:r,active:a,children:s.jsx(ut.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:at(t.onMouseDown,N=>{r?f.onItemFocus(h):N.preventDefault()}),onFocus:at(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:at(t.onKeyDown,N=>{if(N.key==="Tab"&&N.shiftKey){f.onItemShiftTab();return}if(N.target!==N.currentTarget)return;const k=iP(N,f.orientation,f.dir);if(k!==void 0){if(N.metaKey||N.ctrlKey||N.altKey||N.shiftKey)return;N.preventDefault();let E=g().filter(A=>A.focusable).map(A=>A.ref.current);if(k==="last")E.reverse();else if(k==="prev"||k==="next"){k==="prev"&&E.reverse();const A=E.indexOf(N.currentTarget);E=f.loop?oP(E,A+1):E.slice(A+1)}setTimeout(()=>rk(E))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:w!=null}):o})})});nk.displayName=tk;var sP={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function aP(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function iP(t,e,n){const r=aP(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return sP[r]}function rk(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function oP(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var lP=ek,cP=nk,jf="Tabs",[dP]=Li(jf,[Zj]),sk=Zj(),[uP,r0]=dP(jf),ak=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:i,orientation:o="horizontal",dir:c,activationMode:u="automatic",...h}=t,f=wf(c),[m,g]=Eo({prop:r,onChange:a,defaultProp:i??"",caller:jf});return s.jsx(uP,{scope:n,baseId:ji(),value:m,onValueChange:g,orientation:o,dir:f,activationMode:u,children:s.jsx(ut.div,{dir:f,"data-orientation":o,...h,ref:e})})});ak.displayName=jf;var ik="TabsList",ok=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...a}=t,i=r0(ik,n),o=sk(n);return s.jsx(lP,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:s.jsx(ut.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:e})})});ok.displayName=ik;var lk="TabsTrigger",ck=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...i}=t,o=r0(lk,n),c=sk(n),u=hk(o.baseId,r),h=fk(o.baseId,r),f=r===o.value;return s.jsx(cP,{asChild:!0,...c,focusable:!a,active:f,children:s.jsx(ut.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":h,"data-state":f?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:u,...i,ref:e,onMouseDown:at(t.onMouseDown,m=>{!a&&m.button===0&&m.ctrlKey===!1?o.onValueChange(r):m.preventDefault()}),onKeyDown:at(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&o.onValueChange(r)}),onFocus:at(t.onFocus,()=>{const m=o.activationMode!=="manual";!f&&!a&&m&&o.onValueChange(r)})})})});ck.displayName=lk;var dk="TabsContent",uk=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:a,children:i,...o}=t,c=r0(dk,n),u=hk(c.baseId,r),h=fk(c.baseId,r),f=r===c.value,m=b.useRef(f);return b.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),s.jsx(kd,{present:a||f,children:({present:g})=>s.jsx(ut.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!g,id:h,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:g&&i})})});uk.displayName=dk;function hk(t,e){return`${t}-trigger-${e}`}function fk(t,e){return`${t}-content-${e}`}var hP=ak,pk=ok,mk=ck,gk=uk;const Cd=hP,Jl=b.forwardRef(({className:t,...e},n)=>s.jsx(pk,{ref:n,className:Ct("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));Jl.displayName=pk.displayName;const tn=b.forwardRef(({className:t,...e},n)=>s.jsx(mk,{ref:n,className:Ct("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...e}));tn.displayName=mk.displayName;const nn=b.forwardRef(({className:t,...e},n)=>s.jsx(gk,{ref:n,className:Ct("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));nn.displayName=gk.displayName;function s0(t){const e=b.useRef({value:t,previous:t});return b.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function a0(t){const[e,n]=b.useState(void 0);return rr(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let o,c;if("borderBoxSize"in i){const u=i.borderBoxSize,h=Array.isArray(u)?u[0]:u;o=h.inlineSize,c=h.blockSize}else o=t.offsetWidth,c=t.offsetHeight;n({width:o,height:c})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var kf="Switch",[fP]=Li(kf),[pP,mP]=fP(kf),xk=b.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:i,required:o,disabled:c,value:u="on",onCheckedChange:h,form:f,...m}=t,[g,y]=b.useState(null),v=St(e,E=>y(E)),w=b.useRef(!1),N=g?f||!!g.closest("form"):!0,[k,C]=Eo({prop:a,defaultProp:i??!1,onChange:h,caller:kf});return s.jsxs(pP,{scope:n,checked:k,disabled:c,children:[s.jsx(ut.button,{type:"button",role:"switch","aria-checked":k,"aria-required":o,"data-state":Nk(k),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:v,onClick:at(t.onClick,E=>{C(A=>!A),N&&(w.current=E.isPropagationStopped(),w.current||E.stopPropagation())})}),N&&s.jsx(vk,{control:g,bubbles:!w.current,name:r,value:u,checked:k,required:o,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});xk.displayName=kf;var yk="SwitchThumb",bk=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,a=mP(yk,n);return s.jsx(ut.span,{"data-state":Nk(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:e})});bk.displayName=yk;var gP="SwitchBubbleInput",vk=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...a},i)=>{const o=b.useRef(null),c=St(o,i),u=s0(n),h=a0(e);return b.useEffect(()=>{const f=o.current;if(!f)return;const m=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&y){const v=new Event("click",{bubbles:r});y.call(f,n),f.dispatchEvent(v)}},[u,n,r]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:c,style:{...a.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});vk.displayName=gP;function Nk(t){return t?"checked":"unchecked"}var wk=xk,xP=bk;const Et=b.forwardRef(({className:t,...e},n)=>s.jsx(wk,{className:Ct("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#38bdac] focus-visible:ring-offset-2 focus-visible:ring-offset-[#0a1628] disabled:cursor-not-allowed disabled:opacity-50 data-[state=unchecked]:bg-gray-600 data-[state=checked]:bg-[#38bdac]",t),...e,ref:n,children:s.jsx(xP,{className:Ct("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")})}));Et.displayName=wk.displayName;function i0({open:t,onClose:e,userId:n,onUserUpdated:r}){var or;const[a,i]=b.useState(null),[o,c]=b.useState([]),[u,h]=b.useState([]),[f,m]=b.useState(!1),[g,y]=b.useState(!1),[v,w]=b.useState(!1),[N,k]=b.useState("info"),[C,E]=b.useState(""),[A,I]=b.useState(""),[D,_]=b.useState([]),[P,L]=b.useState(""),[z,ee]=b.useState(""),[U,he]=b.useState(""),[me,R]=b.useState(!1),[O,X]=b.useState({isVip:!1,vipExpireDate:"",vipRole:"",vipName:"",vipProject:"",vipContact:"",vipBio:""}),[$,ce]=b.useState([]),[Y,F]=b.useState(!1),[W,K]=b.useState(!1),[B,oe]=b.useState(null),[G,Q]=b.useState(null),[se,ye]=b.useState(""),[Me,Be]=b.useState(""),[He,gt]=b.useState(""),[Dt,jn]=b.useState(!1),[it,Mt]=b.useState(null),[re,Pe]=b.useState("");b.useEffect(()=>{t&&n&&(k("info"),oe(null),Q(null),Mt(null),Pe(""),ee(""),he(""),et(),De("/api/db/vip-roles").then(ge=>{ge!=null&&ge.success&&ge.data&&ce(ge.data)}).catch(()=>{}))},[t,n]);async function et(){if(n){m(!0);try{const ge=await De(`/api/db/users?id=${encodeURIComponent(n)}`);if(ge!=null&&ge.success&&ge.user){const Ne=ge.user;i(Ne),E(Ne.phone||""),I(Ne.nickname||""),ye(Ne.phone||""),Be(Ne.wechatId||""),gt(Ne.openId||"");try{_(typeof Ne.tags=="string"?JSON.parse(Ne.tags||"[]"):[])}catch{_([])}X({isVip:!!(Ne.isVip??!1),vipExpireDate:Ne.vipExpireDate?String(Ne.vipExpireDate).slice(0,10):"",vipRole:String(Ne.vipRole??""),vipName:String(Ne.vipName??""),vipProject:String(Ne.vipProject??""),vipContact:String(Ne.vipContact??""),vipBio:String(Ne.vipBio??"")})}try{const Ne=await De(`/api/user/track?userId=${encodeURIComponent(n)}&limit=50`);Ne!=null&&Ne.success&&Ne.tracks&&c(Ne.tracks)}catch{c([])}try{const Ne=await De(`/api/db/users/referrals?userId=${encodeURIComponent(n)}`);Ne!=null&&Ne.success&&Ne.referrals&&h(Ne.referrals)}catch{h([])}}catch(ge){console.error("Load user detail error:",ge)}finally{m(!1)}}}async function xt(){if(!(a!=null&&a.phone)){le.info("用户未绑定手机号,无法同步");return}y(!0);try{const ge=await vt("/api/ckb/sync",{action:"full_sync",phone:a.phone,userId:a.id});ge!=null&&ge.success?(le.success("同步成功"),et()):le.error("同步失败: "+(ge==null?void 0:ge.error))}catch(ge){console.error("Sync CKB error:",ge),le.error("同步失败")}finally{y(!1)}}async function ft(){if(a){w(!0);try{const ge={id:a.id,phone:C||void 0,nickname:A||void 0,tags:JSON.stringify(D)},Ne=await Tt("/api/db/users",ge);Ne!=null&&Ne.success?(le.success("保存成功"),et(),r==null||r()):le.error("保存失败: "+(Ne==null?void 0:Ne.error))}catch(ge){console.error("Save user error:",ge),le.error("保存失败")}finally{w(!1)}}}const pt=()=>{P&&!D.includes(P)&&(_([...D,P]),L(""))},wt=ge=>_(D.filter(Ne=>Ne!==ge));async function Qt(){if(a){if(!z){le.error("请输入新密码");return}if(z!==U){le.error("两次密码不一致");return}if(z.length<6){le.error("密码至少 6 位");return}R(!0);try{const ge=await Tt("/api/db/users",{id:a.id,password:z});ge!=null&&ge.success?(le.success("修改成功"),ee(""),he("")):le.error("修改失败: "+((ge==null?void 0:ge.error)||""))}catch{le.error("修改失败")}finally{R(!1)}}}async function Lt(){if(a){if(O.isVip&&!O.vipExpireDate.trim()){le.error("开启 VIP 请填写有效到期日");return}F(!0);try{const ge={id:a.id,isVip:O.isVip,vipExpireDate:O.isVip?O.vipExpireDate:void 0,vipRole:O.vipRole||void 0,vipName:O.vipName||void 0,vipProject:O.vipProject||void 0,vipContact:O.vipContact||void 0,vipBio:O.vipBio||void 0},Ne=await Tt("/api/db/users",ge);Ne!=null&&Ne.success?(le.success("VIP 设置已保存"),et(),r==null||r()):le.error("保存失败: "+((Ne==null?void 0:Ne.error)||""))}catch{le.error("保存失败")}finally{F(!1)}}}async function An(){if(!se&&!He&&!Me){Q("请至少输入手机号、微信号或 OpenID 中的一项");return}K(!0),Q(null),oe(null);try{const ge=new URLSearchParams;se&&ge.set("phone",se),He&&ge.set("openId",He),Me&&ge.set("wechatId",Me);const Ne=await De(`/api/admin/shensheshou/query?${ge}`);Ne!=null&&Ne.success&&Ne.data?(oe(Ne.data),a&&await At(Ne.data)):Q((Ne==null?void 0:Ne.error)||"未查询到数据,该用户可能未在神射手收录")}catch(ge){console.error("SSS query error:",ge),Q("请求失败,请检查神射手接口配置")}finally{K(!1)}}async function At(ge){if(a)try{await vt("/api/admin/shensheshou/enrich",{userId:a.id,phone:se||a.phone||"",openId:He||a.openId||"",wechatId:Me||a.wechatId||""}),et()}catch(Ne){console.error("SSS enrich error:",Ne)}}async function Kn(){if(a){jn(!0),Mt(null);try{const ge={users:[{phone:a.phone||"",name:a.nickname||"",openId:a.openId||"",tags:D}]},Ne=await vt("/api/admin/shensheshou/ingest",ge);Ne!=null&&Ne.success&&Ne.data?Mt(Ne.data):Mt({error:(Ne==null?void 0:Ne.error)||"推送失败"})}catch(ge){console.error("SSS ingest error:",ge),Mt({error:"请求失败"})}finally{jn(!1)}}}const rs=ge=>{const qn={view_chapter:$r,purchase:_g,match:Mn,login:No,register:No,share:Ns,bind_phone:bA,bind_wechat:oA,fill_profile:qc,visit_page:Tl}[ge]||Pg;return s.jsx(qn,{className:"w-4 h-4"})};return t?s.jsx(Ft,{open:t,onOpenChange:()=>e(),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-hidden flex flex-col",children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(No,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(a==null?void 0:a.phone)&&s.jsx(Ke,{className:"bg-green-500/20 text-green-400 border-0 ml-2",children:"已绑定手机"}),(a==null?void 0:a.isVip)&&s.jsx(Ke,{className:"bg-amber-500/20 text-amber-400 border-0",children:"VIP"})]})}),f?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):a?s.jsxs("div",{className:"flex flex-col min-h-0 flex-1 overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-4 p-4 bg-[#0a1628] rounded-lg mb-3",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-2xl text-[#38bdac] shrink-0",children:a.avatar?s.jsx("img",{src:ns(a.avatar),className:"w-full h-full rounded-full object-cover",alt:""}):((or=a.nickname)==null?void 0:or.charAt(0))||"?"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("h3",{className:"text-lg font-bold text-white",children:a.nickname}),a.isAdmin&&s.jsx(Ke,{className:"bg-purple-500/20 text-purple-400 border-0",children:"管理员"}),a.hasFullBook&&s.jsx(Ke,{className:"bg-green-500/20 text-green-400 border-0",children:"全书已购"}),a.vipRole&&s.jsx(Ke,{className:"bg-amber-500/20 text-amber-400 border-0",children:a.vipRole})]}),s.jsxs("p",{className:"text-gray-400 text-sm mt-1",children:[a.phone?`📱 ${a.phone}`:"未绑定手机",a.wechatId&&` · 💬 ${a.wechatId}`,a.mbti&&` · ${a.mbti}`]}),s.jsxs("div",{className:"flex items-center gap-4 mt-1",children:[s.jsxs("p",{className:"text-gray-600 text-xs",children:["ID: ",a.id.slice(0,16),"…"]}),a.referralCode&&s.jsxs("p",{className:"text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"推广码:"}),s.jsx("code",{className:"text-[#38bdac] bg-[#38bdac]/10 px-1.5 py-0.5 rounded",children:a.referralCode})]})]})]}),s.jsxs("div",{className:"text-right shrink-0",children:[s.jsxs("p",{className:"text-[#38bdac] font-bold text-lg",children:["¥",(a.earnings||0).toFixed(2)]}),s.jsx("p",{className:"text-gray-500 text-xs",children:"累计收益"})]})]}),s.jsxs(Cd,{value:N,onValueChange:k,className:"flex-1 flex flex-col overflow-hidden",children:[s.jsxs(Jl,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-3 flex-wrap h-auto gap-1",children:[s.jsx(tn,{value:"info",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"基础信息"}),s.jsx(tn,{value:"tags",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"标签体系"}),s.jsxs(tn,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[s.jsx(Tl,{className:"w-3 h-3 mr-1"}),"用户旅程"]}),s.jsx(tn,{value:"relations",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:"关系链路"}),s.jsxs(tn,{value:"shensheshou",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-xs",children:[s.jsx(yi,{className:"w-3 h-3 mr-1"}),"用户资料完善"]})]}),s.jsxs(nn,{value:"info",className:"flex-1 overflow-auto space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"手机号"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入手机号",value:C,onChange:ge=>E(ge.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"昵称"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入昵称",value:A,onChange:ge=>I(ge.target.value)})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[a.openId&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"微信 OpenID"}),s.jsx("p",{className:"text-gray-300 font-mono text-xs break-all",children:a.openId})]}),a.region&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[s.jsx(ej,{className:"w-4 h-4 text-gray-500"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs",children:"地区"}),s.jsx("p",{className:"text-white",children:a.region})]})]}),a.industry&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"行业"}),s.jsx("p",{className:"text-white",children:a.industry})]}),a.position&&s.jsxs("div",{className:"p-3 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"职位"}),s.jsx("p",{className:"text-white",children:a.position})]})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"推荐人数"}),s.jsx("p",{className:"text-2xl font-bold text-white",children:a.referralCount??0})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"待提现"}),s.jsxs("p",{className:"text-2xl font-bold text-yellow-400",children:["¥",(a.pendingEarnings??0).toFixed(2)]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"创建时间"}),s.jsx("p",{className:"text-sm text-white",children:a.createdAt?new Date(a.createdAt).toLocaleDateString():"-"})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(Zw,{className:"w-4 h-4 text-yellow-400"}),s.jsx("span",{className:"text-white font-medium",children:"修改密码"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ie,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"新密码(至少6位)",value:z,onChange:ge=>ee(ge.target.value)}),s.jsx(ie,{type:"password",className:"bg-[#162840] border-gray-700 text-white",placeholder:"确认密码",value:U,onChange:ge=>he(ge.target.value)}),s.jsx(ne,{size:"sm",onClick:Qt,disabled:me||!z||!U,className:"bg-yellow-500/20 hover:bg-yellow-500/30 text-yellow-400 border border-yellow-500/40",children:me?"保存中...":"确认修改"})]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(Al,{className:"w-4 h-4 text-amber-400"}),s.jsx("span",{className:"text-white font-medium",children:"设成超级个体"})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(te,{className:"text-gray-400 text-sm",children:"VIP 会员"}),s.jsx(Et,{checked:O.isVip,onCheckedChange:ge=>X(Ne=>({...Ne,isVip:ge}))})]}),O.isVip&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"到期日"}),s.jsx(ie,{type:"date",className:"bg-[#162840] border-gray-700 text-white text-sm",value:O.vipExpireDate,onChange:ge=>X(Ne=>({...Ne,vipExpireDate:ge.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"角色"}),s.jsxs("select",{className:"w-full bg-[#162840] border border-gray-700 text-white rounded px-2 py-1.5 text-sm",value:O.vipRole,onChange:ge=>X(Ne=>({...Ne,vipRole:ge.target.value})),children:[s.jsx("option",{value:"",children:"请选择"}),$.map(ge=>s.jsx("option",{value:ge.name,children:ge.name},ge.id))]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"展示名"}),s.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white text-sm",placeholder:"创业老板排行展示名",value:O.vipName,onChange:ge=>X(Ne=>({...Ne,vipName:ge.target.value}))})]}),s.jsx(ne,{size:"sm",onClick:Lt,disabled:Y,className:"bg-amber-500/20 hover:bg-amber-500/30 text-amber-400 border border-amber-500/40",children:Y?"保存中...":"保存 VIP"})]})]})]}),a.isVip&&s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(Al,{className:"w-4 h-4 text-amber-400"}),s.jsx("span",{className:"text-white font-medium",children:"VIP 信息"}),s.jsx(Ke,{className:"bg-amber-500/20 text-amber-400 border-0 text-xs",children:a.vipRole||"VIP"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[a.vipName&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"展示名:"}),s.jsx("span",{className:"text-white",children:a.vipName})]}),a.vipProject&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"项目:"}),s.jsx("span",{className:"text-white",children:a.vipProject})]}),a.vipContact&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"联系方式:"}),s.jsx("span",{className:"text-white",children:a.vipContact})]}),a.vipExpireDate&&s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"到期时间:"}),s.jsx("span",{className:"text-white",children:new Date(a.vipExpireDate).toLocaleDateString()})]})]}),a.vipBio&&s.jsx("p",{className:"text-gray-400 text-sm mt-2",children:a.vipBio})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg border border-purple-500/20",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(Dl,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"微信归属"}),s.jsx("span",{className:"text-gray-500 text-xs",children:"该用户归属在哪个微信号下"})]}),s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"输入归属微信号(如 wxid_xxxx)",value:re,onChange:ge=>Pe(ge.target.value)}),s.jsxs(ne,{size:"sm",onClick:async()=>{if(!(!re||!a))try{await Tt("/api/db/users",{id:a.id,wechatId:re}),le.success("已保存微信归属"),et()}catch{le.error("保存失败")}},className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-400 border border-purple-500/30 shrink-0",children:[s.jsx(mn,{className:"w-4 h-4 mr-1"})," 保存"]})]}),a.wechatId&&s.jsxs("p",{className:"text-gray-500 text-xs mt-2",children:["当前归属:",s.jsx("span",{className:"text-purple-400",children:a.wechatId})]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ns,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"存客宝同步"})]}),s.jsx(ne,{size:"sm",onClick:xt,disabled:g||!a.phone,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-1 animate-spin"})," 同步中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-1"})," 同步数据"]})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"同步状态:"}),a.ckbSyncedAt?s.jsx(Ke,{className:"bg-green-500/20 text-green-400 border-0 ml-1",children:"已同步"}):s.jsx(Ke,{className:"bg-gray-500/20 text-gray-400 border-0 ml-1",children:"未同步"})]}),s.jsxs("div",{children:[s.jsx("span",{className:"text-gray-500",children:"最后同步:"}),s.jsx("span",{className:"text-gray-300 ml-1",children:a.ckbSyncedAt?new Date(a.ckbSyncedAt).toLocaleString():"-"})]})]})]})]}),s.jsxs(nn,{value:"tags",className:"flex-1 overflow-auto space-y-4",children:[s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(qc,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"用户标签"}),s.jsx("span",{className:"text-gray-500 text-xs",children:"基于《一场 Soul 的创业实验》维度打标"})]}),s.jsxs("div",{className:"mb-3 p-2.5 bg-[#38bdac]/5 border border-[#38bdac]/20 rounded-lg flex items-center gap-2 text-xs text-gray-400",children:[s.jsx(Rg,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0"}),"命中的标签自动高亮 · 系统根据行为轨迹和填写资料自动打标 · 手动点击补充或取消"]}),s.jsx("div",{className:"mb-4 space-y-3",children:[{category:"身份类型",tags:["创业者","打工人","自由职业","学生","投资人","合伙人"]},{category:"行业背景",tags:["电商","内容","传统行业","科技/AI","金融","教育","餐饮"]},{category:"痛点标签",tags:["找资源","找方向","找合伙人","想赚钱","想学习","找情感出口"]},{category:"付费意愿",tags:["高意向","已付费","观望中","薅羊毛"]},{category:"MBTI",tags:["ENTJ","INTJ","ENFP","INFP","ENTP","INTP","ESTJ","ISFJ"]}].map(ge=>s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1.5",children:ge.category}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:ge.tags.map(Ne=>s.jsxs("button",{type:"button",onClick:()=>{D.includes(Ne)?wt(Ne):_([...D,Ne])},className:`px-2 py-0.5 rounded text-xs border transition-all ${D.includes(Ne)?"bg-[#38bdac]/20 border-[#38bdac]/50 text-[#38bdac]":"bg-transparent border-gray-700 text-gray-500 hover:border-gray-500 hover:text-gray-300"}`,children:[D.includes(Ne)?"✓ ":"",Ne]},Ne))})]},ge.category))}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-3",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-2",children:"已选标签"}),s.jsxs("div",{className:"flex flex-wrap gap-2 mb-3 min-h-[32px]",children:[D.map((ge,Ne)=>s.jsxs(Ke,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1",children:[ge,s.jsx("button",{type:"button",onClick:()=>wt(ge),className:"ml-1 hover:text-red-400",children:s.jsx(nr,{className:"w-3 h-3"})})]},Ne)),D.length===0&&s.jsx("span",{className:"text-gray-600 text-sm",children:"暂未选择标签"})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white flex-1",placeholder:"自定义标签(回车添加)",value:P,onChange:ge=>L(ge.target.value),onKeyDown:ge=>ge.key==="Enter"&&pt()}),s.jsx(ne,{onClick:pt,className:"bg-[#38bdac] hover:bg-[#2da396]",children:"添加"})]})]})]}),a.ckbTags&&s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx(qc,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"存客宝标签"})]}),s.jsx("div",{className:"flex flex-wrap gap-2",children:(typeof a.ckbTags=="string"?a.ckbTags.split(","):[]).map((ge,Ne)=>s.jsx(Ke,{className:"bg-purple-500/20 text-purple-400 border-0",children:ge.trim()},Ne))})]})]}),s.jsxs(nn,{value:"journey",className:"flex-1 overflow-auto",children:[s.jsxs("div",{className:"mb-3 p-3 bg-[#0a1628] rounded-lg flex items-center gap-2",children:[s.jsx(Tl,{className:"w-4 h-4 text-[#38bdac]"}),s.jsxs("span",{className:"text-gray-400 text-sm",children:["记录用户从注册到付费的完整行动路径,共 ",o.length," 条记录"]})]}),s.jsx("div",{className:"space-y-2",children:o.length>0?o.map((ge,Ne)=>s.jsxs("div",{className:"flex items-start gap-3 p-3 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-[#38bdac]",children:rs(ge.action)}),Ne0?u.map((ge,Ne)=>{var Es;const qn=ge;return s.jsxs("div",{className:"flex items-center justify-between p-2 bg-[#162840] rounded",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-6 h-6 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-xs text-[#38bdac]",children:((Es=qn.nickname)==null?void 0:Es.charAt(0))||"?"}),s.jsx("span",{className:"text-white text-sm",children:qn.nickname})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[qn.status==="vip"&&s.jsx(Ke,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"已购"}),s.jsx("span",{className:"text-gray-500 text-xs",children:qn.createdAt?new Date(qn.createdAt).toLocaleDateString():""})]})]},qn.id||Ne)}):s.jsx("p",{className:"text-gray-500 text-sm text-center py-4",children:"暂无推荐用户"})})]})}),s.jsxs(nn,{value:"shensheshou",className:"flex-1 overflow-auto space-y-4",children:[s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(yi,{className:"w-5 h-5 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"用户资料完善"}),s.jsx("span",{className:"text-gray-500 text-xs",children:"通过多维度查询神射手数据,自动回填用户基础信息"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-3",children:[s.jsxs("div",{children:[s.jsx(te,{className:"text-gray-500 text-xs mb-1 block",children:"手机号"}),s.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"11位手机号",value:se,onChange:ge=>ye(ge.target.value)})]}),s.jsxs("div",{children:[s.jsx(te,{className:"text-gray-500 text-xs mb-1 block",children:"微信号"}),s.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"微信 ID",value:Me,onChange:ge=>Be(ge.target.value)})]}),s.jsxs("div",{className:"col-span-2",children:[s.jsx(te,{className:"text-gray-500 text-xs mb-1 block",children:"微信 OpenID"}),s.jsx(ie,{className:"bg-[#162840] border-gray-700 text-white",placeholder:"openid_xxxx(自动填入)",value:He,onChange:ge=>gt(ge.target.value)})]})]}),s.jsx(ne,{onClick:An,disabled:W,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:W?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-1 animate-spin"})," 查询并自动回填中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Sa,{className:"w-4 h-4 mr-1"})," 查询并自动完善用户资料"]})}),s.jsx("p",{className:"text-gray-600 text-xs mt-2",children:"查询成功后,神射手返回的标签将自动同步到该用户"}),G&&s.jsx("div",{className:"mt-3 p-3 bg-red-500/10 border border-red-500/30 rounded-lg text-red-400 text-sm",children:G}),B&&s.jsxs("div",{className:"mt-3 space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"神射手 RFM 分"}),s.jsx("p",{className:"text-2xl font-bold text-[#38bdac]",children:B.rfm_score??"-"})]}),s.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"用户等级"}),s.jsx("p",{className:"text-2xl font-bold text-white",children:B.user_level??"-"})]})]}),B.tags&&B.tags.length>0&&s.jsxs("div",{className:"p-3 bg-[#162840] rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs mb-2",children:"神射手标签"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:B.tags.map((ge,Ne)=>s.jsx(Ke,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/20",children:ge},Ne))})]}),B.last_active&&s.jsxs("div",{className:"text-sm text-gray-500",children:["最近活跃:",B.last_active]})]})]}),s.jsxs("div",{className:"p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx(yi,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"推送用户数据到神射手"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:"将本用户信息(手机号、昵称、标签等)同步至神射手,自动完善用户画像"})]}),s.jsx(ne,{onClick:Kn,disabled:Dt||!a.phone,variant:"outline",className:"border-purple-500/40 text-purple-400 hover:bg-purple-500/10 bg-transparent shrink-0 ml-4",children:Dt?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-1 animate-spin"})," 推送中"]}):s.jsxs(s.Fragment,{children:[s.jsx(yi,{className:"w-4 h-4 mr-1"})," 推送"]})})]}),!a.phone&&s.jsx("p",{className:"text-yellow-500/70 text-xs",children:"⚠ 用户未绑定手机号,无法推送"}),it&&s.jsx("div",{className:"mt-3 p-3 bg-[#162840] rounded-lg text-sm",children:it.error?s.jsx("p",{className:"text-red-400",children:String(it.error)}):s.jsxs("div",{className:"space-y-1",children:[s.jsxs("p",{className:"text-green-400 flex items-center gap-1",children:[s.jsx(Rg,{className:"w-4 h-4"})," 推送成功"]}),it.enriched!==void 0&&s.jsxs("p",{className:"text-gray-400",children:["自动补全标签数:",String(it.new_tags_added??0)]})]})})]})]})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-gray-700 mt-3 shrink-0",children:[s.jsxs(ne,{variant:"outline",onClick:e,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(nr,{className:"w-4 h-4 mr-2"}),"关闭"]}),s.jsxs(ne,{onClick:ft,disabled:v,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),v?"保存中...":"保存修改"]})]})]}):s.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}):null}function yP(){const t=Di(),[e,n]=b.useState(!0),[r,a]=b.useState(!0),[i,o]=b.useState(!0),[c,u]=b.useState([]),[h,f]=b.useState([]),[m,g]=b.useState(0),[y,v]=b.useState(0),[w,N]=b.useState(0),[k,C]=b.useState(0),[E,A]=b.useState(0),[I,D]=b.useState(null),[_,P]=b.useState(null),[L,z]=b.useState(!1),[ee,U]=b.useState("today"),[he,me]=b.useState(null),[R,O]=b.useState(!1),X=K=>{const B=K;if((B==null?void 0:B.status)===401)D("登录已过期,请重新登录");else{if((B==null?void 0:B.name)==="AbortError")return;D("加载失败,请检查网络或联系管理员")}};async function $(K){const B=K?{signal:K}:void 0;n(!0),D(null);try{const Q=await De("/api/admin/dashboard/stats",B);Q!=null&&Q.success&&(g(Q.totalUsers??0),v(Q.paidOrderCount??0),N(Q.totalRevenue??0),C(Q.conversionRate??0))}catch(Q){if((Q==null?void 0:Q.name)!=="AbortError"){console.error("stats 失败,尝试 overview 降级",Q);try{const se=await De("/api/admin/dashboard/overview",B);se!=null&&se.success&&(g(se.totalUsers??0),v(se.paidOrderCount??0),N(se.totalRevenue??0),C(se.conversionRate??0))}catch(se){X(se)}}}finally{n(!1)}try{const Q=await De("/api/admin/balance/summary",B);Q!=null&&Q.success&&Q.data&&A(Q.data.totalGifted??0)}catch{}a(!0),o(!0);const oe=async()=>{try{const Q=await De("/api/admin/dashboard/recent-orders",B);if(Q!=null&&Q.success&&Q.recentOrders)f(Q.recentOrders);else throw new Error("no data")}catch(Q){if((Q==null?void 0:Q.name)!=="AbortError")try{const se=await De("/api/admin/orders?page=1&pageSize=20&status=paid",B),Me=((se==null?void 0:se.orders)??[]).filter(Be=>["paid","completed","success"].includes(Be.status||""));f(Me.slice(0,5))}catch{f([])}}finally{a(!1)}},G=async()=>{try{const Q=await De("/api/admin/dashboard/new-users",B);if(Q!=null&&Q.success&&Q.newUsers)u(Q.newUsers);else throw new Error("no data")}catch(Q){if((Q==null?void 0:Q.name)!=="AbortError")try{const se=await De("/api/db/users?page=1&pageSize=10",B);u((se==null?void 0:se.users)??[])}catch{u([])}}finally{o(!1)}};await Promise.all([oe(),G()])}async function ce(K){const B=K||ee;O(!0);try{const oe=await De(`/api/admin/track/stats?period=${B}`);oe!=null&&oe.success&&me({total:oe.total??0,byModule:oe.byModule??{}})}catch{me(null)}finally{O(!1)}}b.useEffect(()=>{const K=new AbortController;$(K.signal),ce();const B=setInterval(()=>{$(),ce()},3e4);return()=>{K.abort(),clearInterval(B)}},[]);const Y=m,F=K=>{const B=K.productType||"",oe=K.description||"";if(oe){if(B==="section"&&oe.includes("章节")){if(oe.includes("-")){const G=oe.split("-");if(G.length>=3)return{title:`第${G[1]}章 第${G[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:oe,subtitle:"章节购买"}}return B==="fullbook"||oe.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:B==="match"||oe.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:oe,subtitle:B==="section"?"单章":B==="fullbook"?"全书":"其他"}}return B==="section"?{title:`章节 ${K.productId||""}`,subtitle:"单章购买"}:B==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:B==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:B||"其他"}},W=[{title:"总用户数",value:e?null:Y,sub:null,icon:Mn,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:e?null:`¥${(w??0).toFixed(2)}`,sub:E>0?`含代付 ¥${E.toFixed(2)}`:null,icon:vo,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:e?null:y,sub:null,icon:_g,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:e?null:`${k.toFixed(1)}%`,sub:null,icon:vo,color:"text-amber-400",bg:"bg-amber-500/20",link:"/users"}];return s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),I&&s.jsxs("div",{className:"mb-6 px-4 py-3 rounded-lg bg-amber-500/20 border border-amber-500/50 text-amber-200 text-sm flex items-center justify-between",children:[s.jsx("span",{children:I}),s.jsx("button",{type:"button",onClick:()=>$(),className:"text-amber-400 hover:text-amber-300 underline",children:"重试"})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-6",children:W.map((K,B)=>s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>K.link&&t(K.link),children:[s.jsxs(qe,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsx(Ge,{className:"text-sm font-medium text-gray-400",children:K.title}),s.jsx("div",{className:`p-2 rounded-lg ${K.bg}`,children:s.jsx(K.icon,{className:`w-4 h-4 ${K.color}`})})]}),s.jsx(Ce,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-2xl font-bold text-white min-h-8 flex items-center",children:K.value!=null?K.value:s.jsxs("span",{className:"inline-flex items-center gap-2 text-gray-500",children:[s.jsx(Ue,{className:"w-4 h-4 animate-spin"}),"加载中"]})}),K.sub&&s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:K.sub})]}),s.jsx(El,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},B))}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{className:"flex flex-row items-center justify-between",children:[s.jsx(Ge,{className:"text-white",children:"最近订单"}),s.jsxs("button",{type:"button",onClick:()=>$(),disabled:r||i,className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1 disabled:opacity-50",title:"刷新",children:[r||i?s.jsx(Ue,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(Ue,{className:"w-3.5 h-3.5"}),"刷新(每 30 秒自动更新)"]})]}),s.jsx(Ce,{children:s.jsx("div",{className:"space-y-3",children:r&&h.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(Ue,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[h.slice(0,5).map(K=>{var se;const B=K.referrerId?c.find(ye=>ye.id===K.referrerId):void 0,oe=K.referralCode||(B==null?void 0:B.referralCode)||(B==null?void 0:B.nickname)||(K.referrerId?String(K.referrerId).slice(0,8):""),G=F(K),Q=K.userNickname||((se=c.find(ye=>ye.id===K.userId))==null?void 0:se.nickname)||"匿名用户";return s.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:[s.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[K.userAvatar?s.jsx("img",{src:ns(K.userAvatar),alt:Q,className:"w-9 h-9 rounded-full object-cover flex-shrink-0 mt-0.5",onError:ye=>{ye.currentTarget.style.display="none";const Me=ye.currentTarget.nextElementSibling;Me&&Me.classList.remove("hidden")}}):null,s.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 ${K.userAvatar?"hidden":""}`,children:Q.charAt(0)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("button",{type:"button",onClick:()=>{K.userId&&(P(K.userId),z(!0))},className:"text-sm text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:Q}),s.jsx("span",{className:"text-gray-600",children:"·"}),s.jsx("span",{className:"text-sm font-medium text-white truncate",children:G.title})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[G.subtitle&&G.subtitle!=="章节购买"&&s.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:G.subtitle}),s.jsx("span",{children:new Date(K.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),oe&&s.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",oe]})]})]}),s.jsxs("div",{className:"text-right ml-4 flex-shrink-0",children:[s.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(K.amount).toFixed(2)]}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:K.paymentMethod||"微信"})]})]},K.id)}),h.length===0&&!r&&s.jsxs("div",{className:"text-center py-12",children:[s.jsx(_g,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(qe,{children:s.jsx(Ge,{className:"text-white",children:"新注册用户"})}),s.jsx(Ce,{children:s.jsx("div",{className:"space-y-3",children:i&&c.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(Ue,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[c.slice(0,5).map(K=>{var B;return s.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:((B=K.nickname)==null?void 0:B.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("button",{type:"button",onClick:()=>{P(K.id),z(!0)},className:"text-sm font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:K.nickname||"匿名用户"}),s.jsx("p",{className:"text-xs text-gray-500",children:K.phone||"-"})]})]}),s.jsx("p",{className:"text-xs text-gray-400",children:K.createdAt?new Date(K.createdAt).toLocaleDateString():"-"})]},K.id)}),c.length===0&&!i&&s.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mt-8",children:[s.jsxs(qe,{className:"flex flex-row items-center justify-between",children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(Ig,{className:"w-5 h-5 text-[#38bdac]"}),"分类标签点击统计"]}),s.jsx("div",{className:"flex items-center gap-2",children:["today","week","month","all"].map(K=>s.jsx("button",{type:"button",onClick:()=>{U(K),ce(K)},className:`px-3 py-1 text-xs rounded-full transition-colors ${ee===K?"bg-[#38bdac] text-white":"bg-gray-700/50 text-gray-400 hover:bg-gray-700"}`,children:{today:"今日",week:"本周",month:"本月",all:"全部"}[K]},K))})]}),s.jsx(Ce,{children:R&&!he?s.jsxs("div",{className:"flex items-center justify-center py-12 text-gray-500",children:[s.jsx(Ue,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):he&&Object.keys(he.byModule).length>0?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("p",{className:"text-sm text-gray-400",children:["总点击 ",s.jsx("span",{className:"text-white font-bold text-lg",children:he.total})," 次"]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Object.entries(he.byModule).sort((K,B)=>B[1].reduce((oe,G)=>oe+G.count,0)-K[1].reduce((oe,G)=>oe+G.count,0)).map(([K,B])=>{const oe=B.reduce((Q,se)=>Q+se.count,0),G={home:"首页",chapters:"目录",read:"阅读",my:"我的",vip:"VIP",wallet:"钱包",match:"找伙伴",referral:"推广",search:"搜索",settings:"设置",about:"关于",other:"其他"};return s.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("span",{className:"text-sm font-medium text-[#38bdac]",children:G[K]||K}),s.jsxs("span",{className:"text-xs text-gray-500",children:[oe," 次"]})]}),s.jsx("div",{className:"space-y-2",children:B.sort((Q,se)=>se.count-Q.count).slice(0,8).map((Q,se)=>s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-gray-300 truncate mr-2",title:`${Q.action}: ${Q.target}`,children:Q.target||Q.action}),s.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[s.jsx("div",{className:"w-16 h-1.5 bg-gray-700 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-[#38bdac] rounded-full",style:{width:`${oe>0?Q.count/oe*100:0}%`}})}),s.jsx("span",{className:"text-gray-400 w-8 text-right",children:Q.count})]})]},se))})]},K)})})]}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Ig,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无点击数据"}),s.jsx("p",{className:"text-gray-600 text-xs mt-1",children:"小程序端接入埋点后,数据将在此实时展示"})]})})]}),s.jsx(i0,{open:L,onClose:()=>{z(!1),P(null)},userId:_,onUserUpdated:()=>$()})]})}const pr=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{className:"relative w-full overflow-auto",children:s.jsx("table",{ref:n,className:Ct("w-full caption-bottom text-sm",t),...e})}));pr.displayName="Table";const mr=b.forwardRef(({className:t,...e},n)=>s.jsx("thead",{ref:n,className:Ct("[&_tr]:border-b",t),...e}));mr.displayName="TableHeader";const gr=b.forwardRef(({className:t,...e},n)=>s.jsx("tbody",{ref:n,className:Ct("[&_tr:last-child]:border-0",t),...e}));gr.displayName="TableBody";const lt=b.forwardRef(({className:t,...e},n)=>s.jsx("tr",{ref:n,className:Ct("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));lt.displayName="TableRow";const Ee=b.forwardRef(({className:t,...e},n)=>s.jsx("th",{ref:n,className:Ct("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));Ee.displayName="TableHead";const be=b.forwardRef(({className:t,...e},n)=>s.jsx("td",{ref:n,className:Ct("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));be.displayName="TableCell";function o0(t,e){const[n,r]=b.useState(t);return b.useEffect(()=>{const a=setTimeout(()=>r(t),e);return()=>clearTimeout(a)},[t,e]),n}function ws({page:t,totalPages:e,total:n,pageSize:r,onPageChange:a,onPageSizeChange:i,pageSizeOptions:o=[10,20,50,100]}){return e<=1&&!i?null:s.jsxs("div",{className:"flex items-center justify-between gap-4 py-4 px-5 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-400",children:[s.jsxs("span",{children:["共 ",n," 条"]}),i&&s.jsx("select",{value:r,onChange:c=>i(Number(c.target.value)),className:"bg-[#0f2137] border border-gray-600 rounded px-2 py-1 text-gray-300 text-sm",children:o.map(c=>s.jsxs("option",{value:c,children:[c," 条/页"]},c))})]}),e>1&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>a(1),disabled:t<=1,className:"px-2 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"首页"}),s.jsx("button",{type:"button",onClick:()=>a(t-1),disabled:t<=1,className:"px-3 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"上一页"}),s.jsxs("span",{className:"px-3 py-1 text-gray-400 text-sm",children:[t," / ",e]}),s.jsx("button",{type:"button",onClick:()=>a(t+1),disabled:t>=e,className:"px-3 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"下一页"}),s.jsx("button",{type:"button",onClick:()=>a(e),disabled:t>=e,className:"px-2 py-1 rounded border border-gray-600 text-gray-400 hover:bg-gray-700/50 disabled:opacity-40 text-sm",children:"末页"})]})]})}function bP(){const[t,e]=b.useState([]),[n,r]=b.useState([]),[a,i]=b.useState(0),[o,c]=b.useState(0),[u,h]=b.useState(0),[f,m]=b.useState(1),[g,y]=b.useState(10),[v,w]=b.useState(""),N=o0(v,300),[k,C]=b.useState("all"),[E,A]=b.useState(!0),[I,D]=b.useState(null),[_,P]=b.useState(null),[L,z]=b.useState(""),[ee,U]=b.useState(!1);async function he(){A(!0),D(null);try{const Y=k==="all"?"":k==="completed"?"completed":k,F=new URLSearchParams({page:String(f),pageSize:String(g),...Y&&{status:Y},...N&&{search:N}}),[W,K]=await Promise.all([De(`/api/admin/orders?${F}`),De("/api/db/users?page=1&pageSize=500")]);W!=null&&W.success&&(e(W.orders||[]),i(W.total??0),c(W.totalRevenue??0),h(W.todayRevenue??0)),K!=null&&K.success&&K.users&&r(K.users)}catch(Y){console.error("加载订单失败",Y),D("加载订单失败,请检查网络后重试")}finally{A(!1)}}b.useEffect(()=>{m(1)},[N,k]),b.useEffect(()=>{he()},[f,g,N,k]);const me=Y=>{var F;return Y.userNickname||((F=n.find(W=>W.id===Y.userId))==null?void 0:F.nickname)||"匿名用户"},R=Y=>{var F;return((F=n.find(W=>W.id===Y))==null?void 0:F.phone)||"-"},O=Y=>{const F=Y.productType||Y.type||"",W=Y.description||"";if(W){if(F==="section"&&W.includes("章节")){if(W.includes("-")){const K=W.split("-");if(K.length>=3)return{name:`第${K[1]}章 第${K[2]}节`,type:"《一场Soul的创业实验》"}}return{name:W,type:"章节购买"}}return F==="fullbook"||W.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:F==="vip"||W.includes("VIP")?{name:"VIP年度会员",type:"VIP"}:F==="match"||W.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:W,type:"其他"}}return F==="section"?{name:`章节 ${Y.productId||Y.sectionId||""}`,type:"单章"}:F==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:F==="vip"?{name:"VIP年度会员",type:"VIP"}:F==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:F||"其他"}},X=Math.ceil(a/g)||1;async function $(){var Y;if(!(!(_!=null&&_.orderSn)&&!(_!=null&&_.id))){U(!0),D(null);try{const F=await Tt("/api/admin/orders/refund",{orderSn:_.orderSn||_.id,reason:L||void 0});F!=null&&F.success?(P(null),z(""),he()):D((F==null?void 0:F.error)||"退款失败")}catch(F){const W=F;D(((Y=W==null?void 0:W.data)==null?void 0:Y.error)||"退款失败,请检查网络后重试")}finally{U(!1)}}}function ce(){if(t.length===0){le.info("暂无数据可导出");return}const Y=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],F=t.map(G=>{const Q=O(G);return[G.orderSn||G.id||"",me(G),R(G.userId),Q.name,Number(G.amount||0).toFixed(2),G.paymentMethod==="wechat"?"微信支付":G.paymentMethod==="alipay"?"支付宝":G.paymentMethod||"微信支付",G.status==="refunded"?"已退款":G.status==="paid"||G.status==="completed"?"已完成":G.status==="pending"||G.status==="created"?"待支付":"已失败",G.status==="refunded"&&G.refundReason?G.refundReason:"-",G.referrerEarnings?Number(G.referrerEarnings).toFixed(2):"-",G.createdAt?new Date(G.createdAt).toLocaleString("zh-CN"):""].join(",")}),W="\uFEFF"+[Y.join(","),...F].join(` +`),K=new Blob([W],{type:"text/csv;charset=utf-8"}),B=URL.createObjectURL(K),oe=document.createElement("a");oe.href=B,oe.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,oe.click(),URL.revokeObjectURL(B)}return s.jsxs("div",{className:"p-8 w-full",children:[I&&s.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:[s.jsx("span",{children:I}),s.jsx("button",{type:"button",onClick:()=>D(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"订单管理"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",t.length," 笔订单"]})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs(ne,{variant:"outline",onClick:he,disabled:E,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${E?"animate-spin":""}`}),"刷新"]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsx("span",{className:"text-gray-400",children:"总收入:"}),s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",o.toFixed(2)]}),s.jsx("span",{className:"text-gray-600",children:"|"}),s.jsx("span",{className:"text-gray-400",children:"今日:"}),s.jsxs("span",{className:"text-[#FFD700] font-bold",children:["¥",u.toFixed(2)]})]})]})]}),s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsxs("div",{className:"relative flex-1 max-w-md",children:[s.jsx(Sa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(ie,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:v,onChange:Y=>w(Y.target.value)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Qw,{className:"w-4 h-4 text-gray-400"}),s.jsxs("select",{value:k,onChange:Y=>C(Y.target.value),className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"pending",children:"待支付"}),s.jsx("option",{value:"created",children:"已创建"}),s.jsx("option",{value:"failed",children:"已失败"}),s.jsx("option",{value:"refunded",children:"已退款"})]})]}),s.jsxs(ne,{variant:"outline",onClick:ce,disabled:t.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(mM,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ce,{className:"p-0",children:E?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400",children:"订单号"}),s.jsx(Ee,{className:"text-gray-400",children:"用户"}),s.jsx(Ee,{className:"text-gray-400",children:"商品"}),s.jsx(Ee,{className:"text-gray-400",children:"金额"}),s.jsx(Ee,{className:"text-gray-400",children:"支付方式"}),s.jsx(Ee,{className:"text-gray-400",children:"状态"}),s.jsx(Ee,{className:"text-gray-400",children:"退款原因"}),s.jsx(Ee,{className:"text-gray-400",children:"分销佣金"}),s.jsx(Ee,{className:"text-gray-400",children:"下单时间"}),s.jsx(Ee,{className:"text-gray-400",children:"操作"})]})}),s.jsxs(gr,{children:[t.map(Y=>{const F=O(Y);return s.jsxs(lt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsxs(be,{className:"font-mono text-xs text-gray-400",children:[(Y.orderSn||Y.id||"").slice(0,12),"..."]}),s.jsx(be,{children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:me(Y)}),s.jsx("p",{className:"text-gray-500 text-xs",children:R(Y.userId)})]})}),s.jsx(be,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[F.name,(Y.productType||Y.type)==="vip"&&s.jsx(Ke,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"VIP"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:F.type})]})}),s.jsxs(be,{className:"text-[#38bdac] font-bold",children:["¥",Number(Y.amount||0).toFixed(2)]}),s.jsx(be,{className:"text-gray-300",children:Y.paymentMethod==="wechat"?"微信支付":Y.paymentMethod==="alipay"?"支付宝":Y.paymentMethod||"微信支付"}),s.jsx(be,{children:Y.status==="refunded"?s.jsx(Ke,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):Y.status==="paid"||Y.status==="completed"?s.jsx(Ke,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):Y.status==="pending"||Y.status==="created"?s.jsx(Ke,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):s.jsx(Ke,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"})}),s.jsx(be,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:Y.refundReason,children:Y.status==="refunded"&&Y.refundReason?Y.refundReason:"-"}),s.jsx(be,{className:"text-[#FFD700]",children:Y.referrerEarnings?`¥${Number(Y.referrerEarnings).toFixed(2)}`:"-"}),s.jsx(be,{className:"text-gray-400 text-sm",children:new Date(Y.createdAt).toLocaleString("zh-CN")}),s.jsx(be,{children:(Y.status==="paid"||Y.status==="completed")&&s.jsxs(ne,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{P(Y),z("")},children:[s.jsx(tj,{className:"w-3 h-3 mr-1"}),"退款"]})})]},Y.id)}),t.length===0&&s.jsx(lt,{children:s.jsx(be,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),s.jsx(ws,{page:f,totalPages:X,total:a,pageSize:g,onPageChange:m,onPageSizeChange:Y=>{y(Y),m(1)}})]})})}),s.jsx(Ft,{open:!!_,onOpenChange:Y=>!Y&&P(null),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Bt,{children:s.jsx(Vt,{className:"text-white",children:"订单退款"})}),_&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",_.orderSn||_.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(_.amount||0).toFixed(2)]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),s.jsx("div",{className:"form-input",children:s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:L,onChange:Y=>z(Y.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(ln,{children:[s.jsx(ne,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>P(null),disabled:ee,children:"取消"}),s.jsx(ne,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:$,disabled:ee,children:ee?"退款中...":"确认退款"})]})]})})]})}const Yl=b.forwardRef(({className:t,...e},n)=>s.jsx("textarea",{className:Ct("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...e}));Yl.displayName="Textarea";const Oc=[{id:"register",label:"注册/登录",icon:"👤",color:"bg-blue-500/20 border-blue-500/40 text-blue-400",desc:"微信授权登录或手机号注册"},{id:"browse",label:"浏览章节",icon:"📖",color:"bg-purple-500/20 border-purple-500/40 text-purple-400",desc:"点击免费/付费章节预览"},{id:"bind_phone",label:"绑定手机",icon:"📱",color:"bg-cyan-500/20 border-cyan-500/40 text-cyan-400",desc:"触发付费章节后绑定手机"},{id:"first_pay",label:"首次付款",icon:"💳",color:"bg-green-500/20 border-green-500/40 text-green-400",desc:"购买单章或全书"},{id:"fill_profile",label:"完善资料",icon:"✍️",color:"bg-yellow-500/20 border-yellow-500/40 text-yellow-400",desc:"填写头像、MBTI、行业等"},{id:"match",label:"派对房匹配",icon:"🤝",color:"bg-orange-500/20 border-orange-500/40 text-orange-400",desc:"参与 Soul 派对房"},{id:"vip",label:"升级 VIP",icon:"👑",color:"bg-amber-500/20 border-amber-500/40 text-amber-400",desc:"付款 ¥1980 购买全书"},{id:"distribution",label:"开启分销",icon:"🔗",color:"bg-[#38bdac]/20 border-[#38bdac]/40 text-[#38bdac]",desc:"生成推广码并推荐好友"}];function vP(){var Fa,na,Rs,Ps,Os,Ds;const[t,e]=Uw(),n=t.get("pool"),[r,a]=b.useState([]),[i,o]=b.useState(0),[c,u]=b.useState(1),[h,f]=b.useState(10),[m,g]=b.useState(""),y=o0(m,300),v=n==="vip"?"vip":n==="complete"?"complete":"all",[w,N]=b.useState(v),[k,C]=b.useState(!0),[E,A]=b.useState(!1),[I,D]=b.useState(null),[_,P]=b.useState(!1),[L,z]=b.useState("desc");b.useEffect(()=>{n==="vip"?N("vip"):n==="complete"?N("complete"):n==="all"&&N("all")},[n]);const[ee,U]=b.useState(!1),[he,me]=b.useState(null),[R,O]=b.useState(!1),[X,$]=b.useState(!1),[ce,Y]=b.useState({referrals:[],stats:{}}),[F,W]=b.useState(!1),[K,B]=b.useState(null),[oe,G]=b.useState(!1),[Q,se]=b.useState(null),[ye,Me]=b.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),[Be,He]=b.useState([]),[gt,Dt]=b.useState(!1),[jn,it]=b.useState(!1),[Mt,re]=b.useState(null),[Pe,et]=b.useState({title:"",description:"",trigger:"",sort:0,enabled:!0}),[xt,ft]=b.useState([]),[pt,wt]=b.useState(!1),[Qt,Lt]=b.useState(null),[An,At]=b.useState(null),[Kn,rs]=b.useState({}),[or,ge]=b.useState(!1),[Ne,qn]=b.useState(null),[Es,Ts]=b.useState([]),[Pa,br]=b.useState(!1),[Vi,vr]=b.useState(!1);async function lr(V=!1){var Ae;C(!0),V&&A(!0),D(null);try{if(_){const Ye=new URLSearchParams({search:y,limit:String(h*5)}),ct=await De(`/api/db/users/rfm?${Ye}`);if(ct!=null&&ct.success){let xn=ct.users||[];L==="asc"&&(xn=[...xn].reverse());const kn=(c-1)*h;a(xn.slice(kn,kn+h)),o(((Ae=ct.users)==null?void 0:Ae.length)??0),xn.length===0&&(P(!1),D("暂无订单数据,RFM 排序需要用户有购买记录后才能生效"))}else P(!1),D((ct==null?void 0:ct.error)||"RFM 加载失败,已切回普通模式")}else{const Ye=new URLSearchParams({page:String(c),pageSize:String(h),search:y,...w==="vip"&&{vip:"true"},...w==="complete"&&{pool:"complete"}}),ct=await De(`/api/db/users?${Ye}`);ct!=null&&ct.success?(a(ct.users||[]),o(ct.total??0)):D((ct==null?void 0:ct.error)||"加载失败")}}catch(Ye){console.error("Load users error:",Ye),D("网络错误")}finally{C(!1),V&&A(!1)}}b.useEffect(()=>{u(1)},[y,w,_]),b.useEffect(()=>{lr()},[c,h,y,w,_,L]);const Ms=Math.ceil(i/h)||1,Oa=()=>{_?L==="desc"?z("asc"):(P(!1),z("desc")):(P(!0),z("desc"))},Hi=V=>({S:"bg-amber-500/20 text-amber-400",A:"bg-green-500/20 text-green-400",B:"bg-blue-500/20 text-blue-400",C:"bg-gray-500/20 text-gray-400",D:"bg-red-500/20 text-red-400"})[V||""]||"bg-gray-500/20 text-gray-400";async function Xs(V){if(confirm("确定要删除这个用户吗?"))try{const Ae=await wa(`/api/db/users?id=${encodeURIComponent(V)}`);Ae!=null&&Ae.success?lr():le.error("删除失败: "+((Ae==null?void 0:Ae.error)||""))}catch{le.error("删除失败")}}const Nt=V=>{me(V),Me({phone:V.phone||"",nickname:V.nickname||"",password:"",isAdmin:!!(V.isAdmin??!1),hasFullBook:!!(V.hasFullBook??!1)}),U(!0)},Gn=()=>{me(null),Me({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),U(!0)};async function Da(){if(!ye.phone||!ye.nickname){le.error("请填写手机号和昵称");return}O(!0);try{if(he){const V=await Tt("/api/db/users",{id:he.id,nickname:ye.nickname,isAdmin:ye.isAdmin,hasFullBook:ye.hasFullBook,...ye.password&&{password:ye.password}});if(!(V!=null&&V.success)){le.error("更新失败: "+((V==null?void 0:V.error)||""));return}}else{const V=await vt("/api/db/users",{phone:ye.phone,nickname:ye.nickname,password:ye.password,isAdmin:ye.isAdmin});if(!(V!=null&&V.success)){le.error("创建失败: "+((V==null?void 0:V.error)||""));return}}U(!1),lr()}catch{le.error("保存失败")}finally{O(!1)}}async function As(V){B(V),$(!0),W(!0);try{const Ae=await De(`/api/db/users/referrals?userId=${encodeURIComponent(V.id)}`);Ae!=null&&Ae.success?Y({referrals:Ae.referrals||[],stats:Ae.stats||{}}):Y({referrals:[],stats:{}})}catch{Y({referrals:[],stats:{}})}finally{W(!1)}}const Nr=b.useCallback(async()=>{Dt(!0);try{const V=await De("/api/db/user-rules");V!=null&&V.success&&He(V.rules||[])}catch{}finally{Dt(!1)}},[]);async function Wi(){if(!Pe.title){le.error("请填写规则标题");return}O(!0);try{if(Mt){const V=await Tt("/api/db/user-rules",{id:Mt.id,...Pe});if(!(V!=null&&V.success)){le.error("更新失败: "+((V==null?void 0:V.error)||"未知错误"));return}le.success("规则已更新")}else{const V=await vt("/api/db/user-rules",Pe);if(!(V!=null&&V.success)){le.error("创建失败: "+((V==null?void 0:V.error)||"未知错误"));return}le.success("规则已创建")}it(!1),Nr()}catch(V){const Ae=V;(Ae==null?void 0:Ae.status)===401?le.error("登录已过期,请重新登录"):(Ae==null?void 0:Ae.status)===404?le.error("接口不存在,请确认后端已部署最新版本"):le.error("保存失败: "+((Ae==null?void 0:Ae.message)||"网络错误"))}finally{O(!1)}}async function Zs(V){if(confirm("确定删除?"))try{const Ae=await wa(`/api/db/user-rules?id=${V}`);Ae!=null&&Ae.success&&Nr()}catch{}}async function nc(V){try{await Tt("/api/db/user-rules",{id:V.id,enabled:!V.enabled}),Nr()}catch{}}const Jn=b.useCallback(async()=>{wt(!0);try{const V=await De("/api/db/vip-members?limit=500");if(V!=null&&V.success&&V.data){const Ae=[...V.data].map((Ye,ct)=>({...Ye,vipSort:typeof Ye.vipSort=="number"?Ye.vipSort:ct+1}));Ae.sort((Ye,ct)=>(Ye.vipSort??999999)-(ct.vipSort??999999)),ft(Ae)}else V&&V.error&&le.error(V.error)}catch{le.error("加载超级个体列表失败")}finally{wt(!1)}},[]),[ea,ss]=b.useState(!1),[Ar,La]=b.useState(null),[ta,Ui]=b.useState(""),[cr,Ki]=b.useState(!1),as=["创业者","资源整合者","技术达人","投资人","产品经理","流量操盘手"],rc=V=>{La(V),Ui(V.vipRole||""),ss(!0)},Vo=async V=>{const Ae=V.trim();if(Ar){if(!Ae){le.error("请选择或输入标签");return}Ki(!0);try{const Ye=await Tt("/api/db/users",{id:Ar.id,vipRole:Ae});if(!(Ye!=null&&Ye.success)){le.error((Ye==null?void 0:Ye.error)||"更新超级个体标签失败");return}le.success("已更新超级个体标签"),ss(!1),La(null),await Jn()}catch{le.error("更新超级个体标签失败")}finally{Ki(!1)}}},[qi,un]=b.useState(!1),[is,Is]=b.useState(null),[_a,It]=b.useState(""),[zn,Vr]=b.useState(!1),Ho=V=>{Is(V),It(V.vipSort!=null?String(V.vipSort):""),un(!0)},za=async()=>{if(!is)return;const V=Number(_a);if(!Number.isFinite(V)){le.error("请输入有效的数字序号");return}Vr(!0);try{const Ae=await Tt("/api/db/users",{id:is.id,vipSort:V});if(!(Ae!=null&&Ae.success)){le.error((Ae==null?void 0:Ae.error)||"更新排序序号失败");return}le.success("已更新排序序号"),un(!1),Is(null),await Jn()}catch{le.error("更新排序序号失败")}finally{Vr(!1)}},sc=(V,Ae)=>{V.dataTransfer.effectAllowed="move",V.dataTransfer.setData("text/plain",Ae),Lt(Ae)},Gi=(V,Ae)=>{V.preventDefault(),An!==Ae&&At(Ae)},$a=()=>{Lt(null),At(null)},dr=async(V,Ae)=>{V.preventDefault();const Ye=V.dataTransfer.getData("text/plain")||Qt;if(Lt(null),At(null),!Ye||Ye===Ae)return;const ct=xt.find(Xt=>Xt.id===Ye),xn=xt.find(Xt=>Xt.id===Ae);if(!ct||!xn)return;const kn=ct.vipSort??xt.findIndex(Xt=>Xt.id===Ye)+1,Uo=xn.vipSort??xt.findIndex(Xt=>Xt.id===Ae)+1;ft(Xt=>{const st=[...Xt],Ba=st.findIndex(ra=>ra.id===Ye),Va=st.findIndex(ra=>ra.id===Ae);if(Ba===-1||Va===-1)return Xt;const ls=[...st],[Ko,qo]=[ls[Ba],ls[Va]];return ls[Ba]={...qo,vipSort:kn},ls[Va]={...Ko,vipSort:Uo},ls});try{const[Xt,st]=await Promise.all([Tt("/api/db/users",{id:Ye,vipSort:Uo}),Tt("/api/db/users",{id:Ae,vipSort:kn})]);if(!(Xt!=null&&Xt.success)||!(st!=null&&st.success)){le.error((Xt==null?void 0:Xt.error)||(st==null?void 0:st.error)||"更新排序失败"),await Jn();return}le.success("已更新排序"),await Jn()}catch{le.error("更新排序失败"),await Jn()}},Hr=b.useCallback(async()=>{ge(!0);try{const V=await De("/api/db/users/journey-stats");V!=null&&V.success&&V.stats&&rs(V.stats)}catch{}finally{ge(!1)}},[]);async function $n(V){qn(V),br(!0);try{const Ae=await De(`/api/db/users/journey-users?stage=${encodeURIComponent(V)}&limit=20`);Ae!=null&&Ae.success&&Ae.users?Ts(Ae.users):Ts([])}catch{Ts([])}finally{br(!1)}}async function Wo(V){if(!V.hasFullBook){le.error("仅 VIP 用户可置顶到超级个体");return}if(confirm("确定将该用户置顶到首页超级个体位?(最多4位)"))try{const Ae=await Tt("/api/db/users",{id:V.id,vipSort:1});if(!(Ae!=null&&Ae.success)){le.error((Ae==null?void 0:Ae.error)||"置顶失败");return}le.success("已置顶到超级个体"),lr()}catch{le.error("置顶失败")}}return s.jsxs("div",{className:"p-8 w-full",children:[I&&s.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:[s.jsx("span",{children:I}),s.jsx("button",{type:"button",onClick:()=>D(null),children:"×"})]}),s.jsx("div",{className:"flex justify-between items-center mb-6",children:s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"用户管理"}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>vr(!0),className:"text-gray-500 hover:text-[#38bdac] h-8 w-8 p-0",title:"RFM 算法说明",children:s.jsx($c,{className:"w-4 h-4"})})]}),s.jsxs("p",{className:"text-gray-400 mt-1 text-sm",children:["共 ",i," 位注册用户",_&&" · RFM 排序中"]})]})}),s.jsxs(Cd,{defaultValue:"users",className:"w-full",children:[s.jsxs(Jl,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-6 flex-wrap h-auto gap-1",children:[s.jsxs(tn,{value:"users",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",children:[s.jsx(Mn,{className:"w-4 h-4"})," 用户列表"]}),s.jsxs(tn,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Hr,children:[s.jsx(Tl,{className:"w-4 h-4"})," 用户旅程总览"]}),s.jsxs(tn,{value:"rules",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Nr,children:[s.jsx(bo,{className:"w-4 h-4"})," 规则配置"]}),s.jsxs(tn,{value:"vip-roles",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Jn,children:[s.jsx(Al,{className:"w-4 h-4"})," 超级个体列表"]})]}),s.jsxs(nn,{value:"users",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4 justify-end flex-wrap",children:[s.jsxs(ne,{variant:"outline",onClick:()=>lr(!0),disabled:E,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${E?"animate-spin":""}`})," 刷新"]}),s.jsxs("select",{value:w,onChange:V=>{const Ae=V.target.value;N(Ae),u(1),n&&(t.delete("pool"),e(t))},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",disabled:_,children:[s.jsx("option",{value:"all",children:"全部用户"}),s.jsx("option",{value:"vip",children:"VIP会员(超级个体)"}),s.jsx("option",{value:"complete",children:"完善资料用户"})]}),s.jsxs("div",{className:"relative",children:[s.jsx(Sa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(ie,{type:"text",placeholder:"搜索用户...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500 w-56",value:m,onChange:V=>g(V.target.value)})]}),s.jsxs(ne,{onClick:Gn,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx($g,{className:"w-4 h-4 mr-2"})," 添加用户"]})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ce,{className:"p-0",children:k?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400",children:"用户信息"}),s.jsx(Ee,{className:"text-gray-400",children:"绑定信息"}),s.jsx(Ee,{className:"text-gray-400",children:"购买状态"}),s.jsx(Ee,{className:"text-gray-400",children:"分销收益"}),s.jsx(Ee,{className:"text-gray-400",children:"余额/提现"}),s.jsxs(Ee,{className:"text-gray-400 cursor-pointer select-none",onClick:Oa,children:[s.jsxs("div",{className:"flex items-center gap-1 group",children:[s.jsx(vo,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"RFM分值"}),_?L==="desc"?s.jsx(od,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(qw,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(Am,{className:"w-3.5 h-3.5 text-gray-600 group-hover:text-gray-400"})]}),_&&s.jsx("div",{className:"text-[10px] text-[#38bdac] font-normal mt-0.5",children:"点击切换方向/关闭"})]}),s.jsx(Ee,{className:"text-gray-400",children:"注册时间"}),s.jsx(Ee,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(gr,{children:[r.map(V=>{var Ae,Ye,ct;return s.jsxs(lt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac]",children:V.avatar?s.jsx("img",{src:ns(V.avatar),className:"w-full h-full rounded-full object-cover",alt:""}):((Ae=V.nickname)==null?void 0:Ae.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("button",{type:"button",onClick:()=>{se(V.id),G(!0)},className:"font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:V.nickname}),V.isAdmin&&s.jsx(Ke,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),V.openId&&!((Ye=V.id)!=null&&Ye.startsWith("user_"))&&s.jsx(Ke,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0 text-xs",children:"微信"})]}),s.jsx("p",{className:"text-xs text-gray-500 font-mono",children:V.openId?V.openId.slice(0,12)+"...":(ct=V.id)==null?void 0:ct.slice(0,12)})]})]})}),s.jsx(be,{children:s.jsxs("div",{className:"space-y-1",children:[V.phone&&s.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"📱"}),s.jsx("span",{className:"text-gray-300",children:V.phone})]}),V.wechatId&&s.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"💬"}),s.jsx("span",{className:"text-gray-300",children:V.wechatId})]}),V.openId&&s.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[s.jsx("span",{className:"text-gray-500",children:"🔗"}),s.jsxs("span",{className:"text-gray-500 truncate max-w-[100px]",title:V.openId,children:[V.openId.slice(0,12),"..."]})]}),!V.phone&&!V.wechatId&&!V.openId&&s.jsx("span",{className:"text-gray-600 text-xs",children:"未绑定"})]})}),s.jsx(be,{children:V.hasFullBook?s.jsx(Ke,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:"VIP"}):s.jsx(Ke,{variant:"outline",className:"text-gray-500 border-gray-600",children:"未购买"})}),s.jsx(be,{children:s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(V.earnings||0)).toFixed(2)]}),parseFloat(String(V.pendingEarnings||0))>0&&s.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String(V.pendingEarnings||0)).toFixed(2)]}),s.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>As(V),role:"button",tabIndex:0,onKeyDown:xn=>xn.key==="Enter"&&As(V),children:[s.jsx(Mn,{className:"w-3 h-3"})," 绑定",V.referralCount||0,"人"]})]})}),s.jsx(be,{children:s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(V.walletBalance||0)).toFixed(2)]}),parseFloat(String(V.withdrawnEarnings||0))>0&&s.jsxs("div",{className:"text-xs text-gray-400",children:["已提现: ¥",parseFloat(String(V.withdrawnEarnings||0)).toFixed(2)]})]})}),s.jsx(be,{children:V.rfmScore!==void 0?s.jsx("div",{className:"flex flex-col gap-1",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-white font-bold text-base",children:V.rfmScore}),s.jsx(Ke,{className:`border-0 text-xs ${Hi(V.rfmLevel)}`,children:V.rfmLevel})]})}):s.jsxs("span",{className:"text-gray-600 text-sm",children:["— ",s.jsx("span",{className:"text-xs text-gray-700",children:"点列头排序"})]})}),s.jsx(be,{className:"text-gray-400",children:V.createdAt?new Date(V.createdAt).toLocaleDateString():"-"}),s.jsx(be,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>{se(V.id),G(!0)},className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"用户详情",children:s.jsx(Og,{className:"w-4 h-4"})}),V.hasFullBook&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>Wo(V),className:"text-gray-400 hover:text-orange-400 hover:bg-orange-400/10",title:"置顶超级个体",children:s.jsx(xi,{className:"w-4 h-4"})}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>Nt(V),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑用户",children:s.jsx($t,{className:"w-4 h-4"})}),s.jsx(ne,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>Xs(V.id),title:"删除",children:s.jsx(er,{className:"w-4 h-4"})})]})})]},V.id)}),r.length===0&&s.jsx(lt,{children:s.jsx(be,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),s.jsx(ws,{page:c,totalPages:Ms,total:i,pageSize:h,onPageChange:u,onPageSizeChange:V=>{f(V),u(1)}})]})})})]}),s.jsxs(nn,{value:"journey",children:[s.jsxs("div",{className:"flex items-center justify-between mb-5",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"用户从注册到 VIP 的完整行动路径,点击各阶段查看用户动态"}),s.jsxs(ne,{variant:"outline",onClick:Hr,disabled:or,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${or?"animate-spin":""}`})," 刷新数据"]})]}),s.jsxs("div",{className:"relative mb-8",children:[s.jsx("div",{className:"absolute top-16 left-0 right-0 h-0.5 bg-gradient-to-r from-blue-500/20 via-[#38bdac]/30 to-amber-500/20 mx-20"}),s.jsx("div",{className:"grid grid-cols-4 gap-4 lg:grid-cols-8",children:Oc.map((V,Ae)=>s.jsxs("div",{className:"relative flex flex-col items-center",children:[s.jsxs("div",{role:"button",tabIndex:0,className:`relative w-full p-3 rounded-xl border ${V.color} text-center cursor-pointer`,onClick:()=>$n(V.id),onKeyDown:Ye=>Ye.key==="Enter"&&$n(V.id),children:[s.jsx("div",{className:"text-2xl mb-1",children:V.icon}),s.jsx("div",{className:`text-xs font-medium ${V.color.split(" ").find(Ye=>Ye.startsWith("text-"))}`,children:V.label}),Kn[V.id]!==void 0&&s.jsxs("div",{className:"mt-1.5 text-xs text-gray-400",children:[s.jsx("span",{className:"font-bold text-white",children:Kn[V.id]})," 人"]}),s.jsx("div",{className:"absolute -top-2.5 -left-2.5 w-5 h-5 rounded-full bg-[#0a1628] border border-gray-700 flex items-center justify-center text-[10px] text-gray-500",children:Ae+1})]}),AeV.id===Ne))==null?void 0:Fa.label," — 用户列表"]}),s.jsxs(ne,{variant:"ghost",size:"sm",onClick:()=>qn(null),className:"text-gray-500 hover:text-white",children:[s.jsx(nr,{className:"w-4 h-4"})," 关闭"]})]}),Pa?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(Ue,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Es.length>0?s.jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:Es.map(V=>s.jsxs("div",{className:"flex items-center justify-between py-2 px-3 bg-[#0a1628] rounded-lg hover:bg-[#0a1628]/80 cursor-pointer",onClick:()=>{se(V.id),G(!0)},onKeyDown:Ae=>Ae.key==="Enter"&&(se(V.id),G(!0)),role:"button",tabIndex:0,children:[s.jsx("span",{className:"text-white font-medium",children:V.nickname}),s.jsx("span",{className:"text-gray-400 text-sm",children:V.phone||"—"}),s.jsx("span",{className:"text-gray-500 text-xs",children:V.createdAt?new Date(V.createdAt).toLocaleDateString():"—"})]},V.id))}):s.jsx("p",{className:"text-gray-500 text-sm py-4",children:"暂无用户"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/50 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(Tl,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"旅程关键节点"})]}),s.jsx("div",{className:"space-y-2 text-sm",children:[{step:"① 注册",action:"微信 OAuth 或手机号注册",next:"引导填写头像"},{step:"② 浏览",action:"点击章节/阅读免费内容",next:"触发绑定手机"},{step:"③ 首付",action:"购买单章或全书",next:"推送分销功能"},{step:"④ VIP",action:"¥1980 购买全书",next:"进入 VIP 私域群"},{step:"⑤ 分销",action:"推广好友购买",next:"提现分销收益"}].map(V=>s.jsxs("div",{className:"flex items-start gap-3 p-2 bg-[#0a1628] rounded",children:[s.jsx("span",{className:"text-[#38bdac] font-mono text-xs shrink-0 mt-0.5",children:V.step}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-300",children:V.action}),s.jsxs("p",{className:"text-gray-600 text-xs",children:["→ ",V.next]})]})]},V.step))})]}),s.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/50 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx($r,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"行为锚点统计"}),s.jsx("span",{className:"text-gray-500 text-xs ml-auto",children:"实时更新"})]}),or?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(Ue,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Object.keys(Kn).length>0?s.jsx("div",{className:"space-y-2",children:Oc.map(V=>{const Ae=Kn[V.id]||0,Ye=Math.max(...Oc.map(xn=>Kn[xn.id]||0),1),ct=Math.round(Ae/Ye*100);return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-gray-500 text-xs w-20 shrink-0",children:[V.icon," ",V.label]}),s.jsx("div",{className:"flex-1 h-2 bg-[#0a1628] rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-[#38bdac]/60 rounded-full transition-all",style:{width:`${ct}%`}})}),s.jsx("span",{className:"text-gray-400 text-xs w-10 text-right",children:Ae})]},V.id)})}):s.jsx("div",{className:"text-center py-8",children:s.jsx("p",{className:"text-gray-500 text-sm",children:"点击「刷新数据」加载统计"})})]})]})]}),s.jsxs(nn,{value:"rules",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"用户旅程引导规则,定义各行为节点的触发条件与引导内容"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(ne,{variant:"outline",onClick:Nr,disabled:gt,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${gt?"animate-spin":""}`})," 刷新"]}),s.jsxs(ne,{onClick:()=>{re(null),et({title:"",description:"",trigger:"",sort:0,enabled:!0}),it(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(pn,{className:"w-4 h-4 mr-2"})," 添加规则"]})]})]}),gt?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):Be.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx($r,{className:"w-12 h-12 text-[#38bdac]/30 mx-auto mb-4"}),s.jsx("p",{className:"text-gray-400 mb-4",children:"暂无规则(重启服务将自动写入10条默认规则)"}),s.jsxs(ne,{onClick:Nr,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Ue,{className:"w-4 h-4 mr-2"})," 重新加载"]})]}):s.jsx("div",{className:"space-y-2",children:Be.map(V=>s.jsx("div",{className:`p-4 rounded-lg border transition-all ${V.enabled?"bg-[#0f2137] border-gray-700/50":"bg-[#0a1628]/50 border-gray-700/30 opacity-55"}`,children:s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[s.jsx($t,{className:"w-4 h-4 text-[#38bdac] shrink-0"}),s.jsx("span",{className:"text-white font-medium",children:V.title}),V.trigger&&s.jsxs(Ke,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-xs",children:["触发:",V.trigger]}),s.jsx(Ke,{className:`text-xs border-0 ${V.enabled?"bg-green-500/20 text-green-400":"bg-gray-500/20 text-gray-400"}`,children:V.enabled?"启用":"禁用"})]}),V.description&&s.jsx("p",{className:"text-gray-400 text-sm ml-6",children:V.description})]}),s.jsxs("div",{className:"flex items-center gap-2 ml-4 shrink-0",children:[s.jsx(Et,{checked:V.enabled,onCheckedChange:()=>nc(V)}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>{re(V),et({title:V.title,description:V.description,trigger:V.trigger,sort:V.sort,enabled:V.enabled}),it(!0)},className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx($t,{className:"w-4 h-4"})}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>Zs(V.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(er,{className:"w-4 h-4"})})]})]})},V.id))})]}),s.jsxs(nn,{value:"vip-roles",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"展示当前所有有效的超级个体(VIP 用户),用于检查会员信息与排序值。"}),s.jsx("p",{className:"text-xs text-[#38bdac]",children:"提示:按住任意一行即可拖拽排序,释放后将同步更新小程序展示顺序。"})]}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs(ne,{variant:"outline",onClick:Jn,disabled:pt,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${pt?"animate-spin":""}`})," ","刷新"]})})]}),pt?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):xt.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(Al,{className:"w-12 h-12 text-amber-400/30 mx-auto mb-4"}),s.jsx("p",{className:"text-gray-400 mb-4",children:"当前没有有效的超级个体用户。"})]}):s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ce,{className:"p-0",children:s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400 w-16",children:"序号"}),s.jsx(Ee,{className:"text-gray-400",children:"成员"}),s.jsx(Ee,{className:"text-gray-400 min-w-48",children:"超级个体标签"}),s.jsx(Ee,{className:"text-gray-400 w-24",children:"排序值"}),s.jsx(Ee,{className:"text-gray-400 w-40 text-right",children:"操作"})]})}),s.jsx(gr,{children:xt.map((V,Ae)=>{var xn;const Ye=Qt===V.id,ct=An===V.id;return s.jsxs(lt,{draggable:!0,onDragStart:kn=>sc(kn,V.id),onDragOver:kn=>Gi(kn,V.id),onDrop:kn=>dr(kn,V.id),onDragEnd:$a,className:`border-gray-700/50 cursor-grab active:cursor-grabbing select-none ${Ye?"opacity-60":""} ${ct?"bg-[#38bdac]/10":""}`,children:[s.jsx(be,{className:"text-gray-300",children:Ae+1}),s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[V.avatar?s.jsx("img",{src:ns(V.avatar),className:"w-8 h-8 rounded-full object-cover border border-amber-400/60"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/20 border border-amber-400/60 flex items-center justify-center text-amber-300 text-sm",children:((xn=V.name)==null?void 0:xn[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:V.name})})]})}),s.jsx(be,{className:"text-gray-300 whitespace-nowrap",children:V.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置超级个体标签)"})}),s.jsx(be,{className:"text-gray-300",children:V.vipSort??Ae+1}),s.jsx(be,{className:"text-right text-xs text-gray-300",children:s.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[s.jsx(ne,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-amber-300 hover:text-amber-200",onClick:()=>rc(V),title:"设置超级个体标签",children:s.jsx(qc,{className:"w-3.5 h-3.5"})}),s.jsx(ne,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-[#38bdac] hover:text-[#5fe0cd]",onClick:()=>{se(V.id),G(!0)},title:"编辑资料",children:s.jsx($t,{className:"w-3.5 h-3.5"})}),s.jsx(ne,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-sky-300 hover:text-sky-200",onClick:()=>Ho(V),title:"设置排序序号",children:s.jsx(Am,{className:"w-3.5 h-3.5"})})]})})]},V.id)})})]})})})]})]}),s.jsx(Ft,{open:qi,onOpenChange:V=>{un(V),V||Is(null)},children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(Am,{className:"w-5 h-5 text-[#38bdac]"}),"设置排序 — ",is==null?void 0:is.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(te,{className:"text-gray-300 text-sm",children:"排序序号(数字越小越靠前)"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:1",value:_a,onChange:V=>It(V.target.value)})]}),s.jsxs(ln,{children:[s.jsxs(ne,{variant:"outline",onClick:()=>un(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(nr,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(ne,{onClick:za,disabled:zn,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),zn?"保存中...":"保存"]})]})]})}),s.jsx(Ft,{open:ea,onOpenChange:V=>{ss(V),V||La(null)},children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(Al,{className:"w-5 h-5 text-amber-400"}),"设置超级个体标签 — ",Ar==null?void 0:Ar.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(te,{className:"text-gray-300 text-sm",children:"选择或输入标签"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:as.map(V=>s.jsx(ne,{variant:ta===V?"default":"outline",size:"sm",className:ta===V?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50",onClick:()=>Ui(V),children:V},V))}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"或手动输入"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创业者、资源整合者等",value:ta,onChange:V=>Ui(V.target.value)})]})]}),s.jsxs(ln,{children:[s.jsxs(ne,{variant:"outline",onClick:()=>ss(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(nr,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(ne,{onClick:()=>Vo(ta),disabled:cr,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),cr?"保存中...":"保存"]})]})]})}),s.jsx(Ft,{open:ee,onOpenChange:U,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[he?s.jsx($t,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx($g,{className:"w-5 h-5 text-[#38bdac]"}),he?"编辑用户":"添加用户"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"手机号"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:ye.phone,onChange:V=>Me({...ye,phone:V.target.value}),disabled:!!he})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"昵称"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:ye.nickname,onChange:V=>Me({...ye,nickname:V.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:he?"新密码 (留空则不修改)":"密码"}),s.jsx(ie,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:he?"留空则不修改":"请输入密码",value:ye.password,onChange:V=>Me({...ye,password:V.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(te,{className:"text-gray-300",children:"管理员权限"}),s.jsx(Et,{checked:ye.isAdmin,onCheckedChange:V=>Me({...ye,isAdmin:V})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(te,{className:"text-gray-300",children:"已购全书"}),s.jsx(Et,{checked:ye.hasFullBook,onCheckedChange:V=>Me({...ye,hasFullBook:V})})]})]}),s.jsxs(ln,{children:[s.jsxs(ne,{variant:"outline",onClick:()=>U(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(nr,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(ne,{onClick:Da,disabled:R,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),R?"保存中...":"保存"]})]})]})}),s.jsx(Ft,{open:jn,onOpenChange:it,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx($t,{className:"w-5 h-5 text-[#38bdac]"}),Mt?"编辑规则":"添加规则"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"规则标题 *"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:匹配后填写头像、付款1980需填写信息",value:Pe.title,onChange:V=>et({...Pe,title:V.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"规则描述"}),s.jsx(Yl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[80px] resize-none",placeholder:"详细说明规则内容...",value:Pe.description,onChange:V=>et({...Pe,description:V.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"触发条件"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:完成匹配、付款后、注册时",value:Pe.trigger,onChange:V=>et({...Pe,trigger:V.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{children:s.jsx(te,{className:"text-gray-300",children:"启用状态"})}),s.jsx(Et,{checked:Pe.enabled,onCheckedChange:V=>et({...Pe,enabled:V})})]})]}),s.jsxs(ln,{children:[s.jsxs(ne,{variant:"outline",onClick:()=>it(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(nr,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(ne,{onClick:Wi,disabled:R,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),R?"保存中...":"保存"]})]})]})}),s.jsx(Ft,{open:X,onOpenChange:$,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(Mn,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系 - ",K==null?void 0:K.nickname]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsx("div",{className:"text-2xl font-bold text-[#38bdac]",children:((na=ce.stats)==null?void 0:na.total)||0}),s.jsx("div",{className:"text-xs text-gray-400",children:"绑定总数"})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsx("div",{className:"text-2xl font-bold text-green-400",children:((Rs=ce.stats)==null?void 0:Rs.purchased)||0}),s.jsx("div",{className:"text-xs text-gray-400",children:"已付费"})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsxs("div",{className:"text-2xl font-bold text-yellow-400",children:["¥",(((Ps=ce.stats)==null?void 0:Ps.earnings)||0).toFixed(2)]}),s.jsx("div",{className:"text-xs text-gray-400",children:"累计收益"})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 text-center",children:[s.jsxs("div",{className:"text-2xl font-bold text-orange-400",children:["¥",(((Os=ce.stats)==null?void 0:Os.pendingEarnings)||0).toFixed(2)]}),s.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),F?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(Ue,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((Ds=ce.referrals)==null?void 0:Ds.length)??0)>0?s.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(ce.referrals??[]).map((V,Ae)=>{var ct;const Ye=V;return s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg p-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:((ct=Ye.nickname)==null?void 0:ct.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white text-sm",children:Ye.nickname}),s.jsx("div",{className:"text-xs text-gray-500",children:Ye.phone||(Ye.hasOpenId?"微信用户":"未绑定")})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[Ye.status==="vip"&&s.jsx(Ke,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),Ye.status==="paid"&&s.jsxs(Ke,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",Ye.purchasedSections,"章"]}),Ye.status==="free"&&s.jsx(Ke,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),s.jsx("span",{className:"text-xs text-gray-500",children:Ye.createdAt?new Date(Ye.createdAt).toLocaleDateString():""})]})]},Ye.id||Ae)})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),s.jsx(ln,{children:s.jsx(ne,{variant:"outline",onClick:()=>$(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),s.jsx(Ft,{open:Vi,onOpenChange:vr,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(vo,{className:"w-5 h-5 text-[#38bdac]"}),"RFM 算法说明"]})}),s.jsxs("div",{className:"space-y-3 py-4 text-sm text-gray-300",children:[s.jsxs("p",{children:[s.jsx("span",{className:"text-[#38bdac] font-medium",children:"R(Recency)"}),":距最近购买天数,越近分越高,权重 40%"]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-[#38bdac] font-medium",children:"F(Frequency)"}),":购买频次,越多分越高,权重 30%"]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-[#38bdac] font-medium",children:"M(Monetary)"}),":消费金额,越高分越高,权重 30%"]}),s.jsx("p",{className:"text-gray-400",children:"综合分 = R×40% + F×30% + M×30%,归一化到 0-100"}),s.jsxs("p",{className:"text-gray-400",children:["等级:",s.jsx("span",{className:"text-amber-400",children:"S"}),"(≥85)、",s.jsx("span",{className:"text-green-400",children:"A"}),"(≥70)、",s.jsx("span",{className:"text-blue-400",children:"B"}),"(≥50)、",s.jsx("span",{className:"text-gray-400",children:"C"}),"(≥30)、",s.jsx("span",{className:"text-red-400",children:"D"}),"(<30)"]})]}),s.jsx(ln,{children:s.jsx(ne,{variant:"outline",onClick:()=>vr(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),s.jsx(i0,{open:oe,onClose:()=>G(!1),userId:Q,onUserUpdated:lr})]})}function bh(t,[e,n]){return Math.min(n,Math.max(e,t))}var jk=["PageUp","PageDown"],kk=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Sk={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Ql="Slider",[Wg,NP,wP]=n0(Ql),[Ck]=Li(Ql,[wP]),[jP,Sf]=Ck(Ql),Ek=b.forwardRef((t,e)=>{const{name:n,min:r=0,max:a=100,step:i=1,orientation:o="horizontal",disabled:c=!1,minStepsBetweenThumbs:u=0,defaultValue:h=[r],value:f,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:y=!1,form:v,...w}=t,N=b.useRef(new Set),k=b.useRef(0),E=o==="horizontal"?kP:SP,[A=[],I]=Eo({prop:f,defaultProp:h,onChange:ee=>{var he;(he=[...N.current][k.current])==null||he.focus(),m(ee)}}),D=b.useRef(A);function _(ee){const U=AP(A,ee);z(ee,U)}function P(ee){z(ee,k.current)}function L(){const ee=D.current[k.current];A[k.current]!==ee&&g(A)}function z(ee,U,{commit:he}={commit:!1}){const me=OP(i),R=DP(Math.round((ee-r)/i)*i+r,me),O=bh(R,[r,a]);I((X=[])=>{const $=TP(X,O,U);if(PP($,u*i)){k.current=$.indexOf(O);const ce=String($)!==String(X);return ce&&he&&g($),ce?$:X}else return X})}return s.jsx(jP,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:a,valueIndexToChangeRef:k,thumbs:N.current,values:A,orientation:o,form:v,children:s.jsx(Wg.Provider,{scope:t.__scopeSlider,children:s.jsx(Wg.Slot,{scope:t.__scopeSlider,children:s.jsx(E,{"aria-disabled":c,"data-disabled":c?"":void 0,...w,ref:e,onPointerDown:at(w.onPointerDown,()=>{c||(D.current=A)}),min:r,max:a,inverted:y,onSlideStart:c?void 0:_,onSlideMove:c?void 0:P,onSlideEnd:c?void 0:L,onHomeKeyDown:()=>!c&&z(r,0,{commit:!0}),onEndKeyDown:()=>!c&&z(a,A.length-1,{commit:!0}),onStepKeyDown:({event:ee,direction:U})=>{if(!c){const R=jk.includes(ee.key)||ee.shiftKey&&kk.includes(ee.key)?10:1,O=k.current,X=A[O],$=i*R*U;z(X+$,O,{commit:!0})}}})})})})});Ek.displayName=Ql;var[Tk,Mk]=Ck(Ql,{startEdge:"left",endEdge:"right",size:"width",direction:1}),kP=b.forwardRef((t,e)=>{const{min:n,max:r,dir:a,inverted:i,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onStepKeyDown:h,...f}=t,[m,g]=b.useState(null),y=St(e,E=>g(E)),v=b.useRef(void 0),w=wf(a),N=w==="ltr",k=N&&!i||!N&&i;function C(E){const A=v.current||m.getBoundingClientRect(),I=[0,A.width],_=l0(I,k?[n,r]:[r,n]);return v.current=A,_(E-A.left)}return s.jsx(Tk,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:s.jsx(Ak,{dir:w,"data-orientation":"horizontal",...f,ref:y,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:E=>{const A=C(E.clientX);o==null||o(A)},onSlideMove:E=>{const A=C(E.clientX);c==null||c(A)},onSlideEnd:()=>{v.current=void 0,u==null||u()},onStepKeyDown:E=>{const I=Sk[k?"from-left":"from-right"].includes(E.key);h==null||h({event:E,direction:I?-1:1})}})})}),SP=b.forwardRef((t,e)=>{const{min:n,max:r,inverted:a,onSlideStart:i,onSlideMove:o,onSlideEnd:c,onStepKeyDown:u,...h}=t,f=b.useRef(null),m=St(e,f),g=b.useRef(void 0),y=!a;function v(w){const N=g.current||f.current.getBoundingClientRect(),k=[0,N.height],E=l0(k,y?[r,n]:[n,r]);return g.current=N,E(w-N.top)}return s.jsx(Tk,{scope:t.__scopeSlider,startEdge:y?"bottom":"top",endEdge:y?"top":"bottom",size:"height",direction:y?1:-1,children:s.jsx(Ak,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:w=>{const N=v(w.clientY);i==null||i(N)},onSlideMove:w=>{const N=v(w.clientY);o==null||o(N)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:w=>{const k=Sk[y?"from-bottom":"from-top"].includes(w.key);u==null||u({event:w,direction:k?-1:1})}})})}),Ak=b.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:a,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:c,onStepKeyDown:u,...h}=t,f=Sf(Ql,n);return s.jsx(ut.span,{...h,ref:e,onKeyDown:at(t.onKeyDown,m=>{m.key==="Home"?(o(m),m.preventDefault()):m.key==="End"?(c(m),m.preventDefault()):jk.concat(kk).includes(m.key)&&(u(m),m.preventDefault())}),onPointerDown:at(t.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(g)?g.focus():r(m)}),onPointerMove:at(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&a(m)}),onPointerUp:at(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),i(m))})})}),Ik="SliderTrack",Rk=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=Sf(Ik,n);return s.jsx(ut.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...r,ref:e})});Rk.displayName=Ik;var Ug="SliderRange",Pk=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=Sf(Ug,n),i=Mk(Ug,n),o=b.useRef(null),c=St(e,o),u=a.values.length,h=a.values.map(g=>Lk(g,a.min,a.max)),f=u>1?Math.min(...h):0,m=100-Math.max(...h);return s.jsx(ut.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...r,ref:c,style:{...t.style,[i.startEdge]:f+"%",[i.endEdge]:m+"%"}})});Pk.displayName=Ug;var Kg="SliderThumb",Ok=b.forwardRef((t,e)=>{const n=NP(t.__scopeSlider),[r,a]=b.useState(null),i=St(e,c=>a(c)),o=b.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return s.jsx(CP,{...t,ref:i,index:o})}),CP=b.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:a,...i}=t,o=Sf(Kg,n),c=Mk(Kg,n),[u,h]=b.useState(null),f=St(e,C=>h(C)),m=u?o.form||!!u.closest("form"):!0,g=a0(u),y=o.values[r],v=y===void 0?0:Lk(y,o.min,o.max),w=MP(r,o.values.length),N=g==null?void 0:g[c.size],k=N?IP(N,v,c.direction):0;return b.useEffect(()=>{if(u)return o.thumbs.add(u),()=>{o.thumbs.delete(u)}},[u,o.thumbs]),s.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${v}% + ${k}px)`},children:[s.jsx(Wg.ItemSlot,{scope:t.__scopeSlider,children:s.jsx(ut.span,{role:"slider","aria-label":t["aria-label"]||w,"aria-valuemin":o.min,"aria-valuenow":y,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...i,ref:f,style:y===void 0?{display:"none"}:t.style,onFocus:at(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),m&&s.jsx(Dk,{name:a??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:y},r)]})});Ok.displayName=Kg;var EP="RadioBubbleInput",Dk=b.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const a=b.useRef(null),i=St(a,r),o=s0(e);return b.useEffect(()=>{const c=a.current;if(!c)return;const u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(o!==e&&f){const m=new Event("input",{bubbles:!0});f.call(c,e),c.dispatchEvent(m)}},[o,e]),s.jsx(ut.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});Dk.displayName=EP;function TP(t=[],e,n){const r=[...t];return r[n]=e,r.sort((a,i)=>a-i)}function Lk(t,e,n){const i=100/(n-e)*(t-e);return bh(i,[0,100])}function MP(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function AP(t,e){if(t.length===1)return 0;const n=t.map(a=>Math.abs(a-e)),r=Math.min(...n);return n.indexOf(r)}function IP(t,e,n){const r=t/2,i=l0([0,50],[0,r]);return(r-i(e)*n)*n}function RP(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function PP(t,e){if(e>0){const n=RP(t);return Math.min(...n)>=e}return!0}function l0(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function OP(t){return(String(t).split(".")[1]||"").length}function DP(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var LP=Ek,_P=Rk,zP=Pk,$P=Ok;function FP({className:t,defaultValue:e,value:n,min:r=0,max:a=100,...i}){const o=b.useMemo(()=>Array.isArray(n)?n:Array.isArray(e)?e:[r,a],[n,e,r,a]);return s.jsxs(LP,{defaultValue:e,value:n,min:r,max:a,className:Ct("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",t),...i,children:[s.jsx(_P,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:s.jsx(zP,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:o.length},(c,u)=>s.jsx($P,{className:"block size-4 shrink-0 rounded-full border-2 border-[#38bdac] bg-white shadow-sm focus-visible:ring-2 focus-visible:ring-[#38bdac] focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"},u))]})}const BP={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function _k(t){const[e,n]=b.useState(BP),[r,a]=b.useState(!0),[i,o]=b.useState(!1);b.useEffect(()=>{De("/api/admin/referral-settings").then(h=>{const f=h==null?void 0:h.data;f&&typeof f=="object"&&n({distributorShare:f.distributorShare??90,minWithdrawAmount:f.minWithdrawAmount??10,bindingDays:f.bindingDays??30,userDiscount:f.userDiscount??5,enableAutoWithdraw:f.enableAutoWithdraw??!1,vipOrderShareVip:f.vipOrderShareVip??20,vipOrderShareNonVip:f.vipOrderShareNonVip??10})}).catch(console.error).finally(()=>a(!1))},[]);const c=async()=>{o(!0);try{const h={distributorShare:Number(e.distributorShare)||0,minWithdrawAmount:Number(e.minWithdrawAmount)||0,bindingDays:Number(e.bindingDays)||0,userDiscount:Number(e.userDiscount)||0,enableAutoWithdraw:!!e.enableAutoWithdraw,vipOrderShareVip:Number(e.vipOrderShareVip)||20,vipOrderShareNonVip:Number(e.vipOrderShareNonVip)||10},f=await vt("/api/admin/referral-settings",h);if(!f||f.success===!1){le.error("保存失败: "+(f&&typeof f=="object"&&"error"in f?f.error:""));return}le.success(`✅ 分销配置已保存成功! • 小程序与网站的推广规则会一起生效 • 绑定关系会使用新的天数配置 • 佣金比例会立即应用到新订单 -如有缓存,请刷新前台/小程序页面。`)}catch(h){console.error(h),le.error("保存失败: "+(h instanceof Error?h.message:String(h)))}finally{o(!1)}},u=h=>f=>{const m=parseFloat(f.target.value||"0");n(g=>({...g,[h]:isNaN(m)?0:m}))};return r?s.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Ll,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置。"})]}),s.jsxs(ne,{onClick:c,disabled:i||r,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),i?"保存中...":"保存配置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"flex items-center gap-2 text-white",children:[s.jsx(xA,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),s.jsx(Ht,{className:"text-gray-400",children:"这三项会直接体现在小程序「推广规则」卡片上,同时影响实收佣金计算。"})]}),s.jsx(Ce,{className:"space-y-6",children:s.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx($c,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),s.jsx(ie,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.userDiscount,onChange:u("userDiscount")}),s.jsx("p",{className:"text-xs text-gray-500",children:"例如 5 表示好友立减 5%(在价格配置基础上生效)。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Mn,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(FP,{className:"flex-1",min:10,max:100,step:1,value:[e.distributorShare],onValueChange:([h])=>n(f=>({...f,distributorShare:h}))}),s.jsx(ie,{type:"number",min:0,max:100,className:"w-20 bg-[#0a1628] border-gray-700 text-white text-center",value:e.distributorShare,onChange:u("distributorShare")})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["内容订单佣金 = 订单金额 ×"," ",s.jsxs("span",{className:"text-[#38bdac] font-mono",children:[e.distributorShare,"%"]}),";会员订单见下方。"]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx($c,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),s.jsx(ie,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.vipOrderShareVip,onChange:u("vipOrderShareVip")}),s.jsx("p",{className:"text-xs text-gray-500",children:"推广者已是会员时,会员订单佣金比例,默认 20%。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx($c,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),s.jsx(ie,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.vipOrderShareNonVip,onChange:u("vipOrderShareNonVip")}),s.jsx("p",{className:"text-xs text-gray-500",children:"推广者非会员时,会员订单佣金比例,默认 10%。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Mn,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),s.jsx(ie,{type:"number",min:1,max:365,className:"bg-[#0a1628] border-gray-700 text-white",value:e.bindingDays,onChange:u("bindingDays")}),s.jsx("p",{className:"text-xs text-gray-500",children:"好友通过你的链接进来并登录后,绑定在你名下的天数。"})]})]})})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"flex items-center gap-2 text-white",children:[s.jsx(Ll,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),s.jsx(Ht,{className:"text-gray-400",children:"与「提现中心」「自动提现」相关的参数,影响推广者看到的可提现金额和最低门槛。"})]}),s.jsx(Ce,{className:"space-y-6",children:s.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"最低提现金额(元)"}),s.jsx(ie,{type:"number",min:0,step:1,className:"bg-[#0a1628] border-gray-700 text-white",value:e.minWithdrawAmount,onChange:u("minWithdrawAmount")}),s.jsx("p",{className:"text-xs text-gray-500",children:"小程序「满 X 元可提现」展示的门槛,同时用于后端接口校验。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:["自动提现开关",s.jsx(Ke,{variant:"outline",className:"border-[#38bdac]/40 text-[#38bdac] text-[10px]",children:"预留"})]}),s.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[s.jsx(Et,{checked:e.enableAutoWithdraw,onCheckedChange:h=>n(f=>({...f,enableAutoWithdraw:h}))}),s.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(qe,{children:s.jsxs(Ge,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[s.jsx($c,{className:"w-4 h-4 text-[#38bdac]"}),"使用说明"]})}),s.jsxs(Ce,{className:"space-y-2 text-xs text-gray-400 leading-relaxed",children:[s.jsxs("p",{children:["1. 以上配置会写入"," ",s.jsx("code",{className:"font-mono text-[11px] text-[#38bdac]",children:"system_config.referral_config"}),",小程序「推广中心」、Web 推广页以及支付回调都会读取同一份配置。"]}),s.jsx("p",{children:"2. 修改后新订单立即生效;旧订单的历史佣金不会自动重算,只影响之后产生的订单。"}),s.jsx("p",{children:"3. 如遇前端展示与实际结算不一致,优先以此处配置为准,再排查缓存和小程序版本。"})]})]})]})]})}function VP(){var Mt;const[t,e]=b.useState("overview"),[n,r]=b.useState([]),[a,i]=b.useState(null),[o,c]=b.useState([]),[u,h]=b.useState([]),[f,m]=b.useState([]),[g,y]=b.useState(!0),[v,w]=b.useState(null),[N,k]=b.useState(""),[C,E]=b.useState("all"),[A,I]=b.useState(1),[D,_]=b.useState(10),[P,L]=b.useState(0),[z,ee]=b.useState(new Set),[U,he]=b.useState(null),[me,R]=b.useState(""),[O,X]=b.useState(!1),[$,ce]=b.useState(null),[Y,F]=b.useState(""),[W,K]=b.useState(!1);b.useEffect(()=>{B()},[]),b.useEffect(()=>{I(1)},[t,C]),b.useEffect(()=>{oe(t)},[t]),b.useEffect(()=>{["orders","bindings","withdrawals"].includes(t)&&oe(t,!0)},[A,D,C,N]);async function B(){w(null);try{const re=await De("/api/admin/distribution/overview");re!=null&&re.success&&re.overview&&i(re.overview)}catch(re){console.error("[Admin] 概览接口异常:",re),w("加载概览失败")}try{const re=await De("/api/db/users");m((re==null?void 0:re.users)||[])}catch(re){console.error("[Admin] 用户数据加载失败:",re)}}async function oe(re,Pe=!1){var et;if(!(!Pe&&z.has(re))){y(!0);try{const xt=f;switch(re){case"overview":break;case"orders":{try{const ft=new URLSearchParams({page:String(A),pageSize:String(D),...C!=="all"&&{status:C},...N&&{search:N}}),pt=await De(`/api/admin/orders?${ft}`);if(pt!=null&&pt.success&&pt.orders){const wt=pt.orders.map(Qt=>{const Lt=xt.find(At=>At.id===Qt.userId),An=Qt.referrerId?xt.find(At=>At.id===Qt.referrerId):null;return{...Qt,amount:parseFloat(String(Qt.amount))||0,userNickname:(Lt==null?void 0:Lt.nickname)||Qt.userNickname||"未知用户",userPhone:(Lt==null?void 0:Lt.phone)||Qt.userPhone||"-",referrerNickname:(An==null?void 0:An.nickname)||null,referrerCode:(An==null?void 0:An.referralCode)??null,type:Qt.productType||Qt.type}});r(wt),L(pt.total??wt.length)}else r([]),L(0)}catch(ft){console.error(ft),w("加载订单失败"),r([])}break}case"bindings":{try{const ft=new URLSearchParams({page:String(A),pageSize:String(D),...C!=="all"&&{status:C}}),pt=await De(`/api/db/distribution?${ft}`);c((pt==null?void 0:pt.bindings)||[]),L((pt==null?void 0:pt.total)??((et=pt==null?void 0:pt.bindings)==null?void 0:et.length)??0)}catch(ft){console.error(ft),w("加载绑定数据失败"),c([])}break}case"withdrawals":{try{const ft=C==="completed"?"success":C==="rejected"?"failed":C,pt=new URLSearchParams({...ft&&ft!=="all"&&{status:ft},page:String(A),pageSize:String(D)}),wt=await De(`/api/admin/withdrawals?${pt}`);if(wt!=null&&wt.success&&wt.withdrawals){const Qt=wt.withdrawals.map(Lt=>({...Lt,account:Lt.account??"未绑定微信号",status:Lt.status==="success"?"completed":Lt.status==="failed"?"rejected":Lt.status}));h(Qt),L((wt==null?void 0:wt.total)??Qt.length)}else wt!=null&&wt.success||w(`获取提现记录失败: ${(wt==null?void 0:wt.error)||"未知错误"}`),h([])}catch(ft){console.error(ft),w("加载提现数据失败"),h([])}break}}ee(ft=>new Set(ft).add(re))}catch(xt){console.error(xt)}finally{y(!1)}}}async function G(){w(null),ee(re=>{const Pe=new Set(re);return Pe.delete(t),Pe}),t==="overview"&&B(),await oe(t,!0)}async function Q(re){if(confirm("确认审核通过并打款?"))try{const Pe=await Tt("/api/admin/withdrawals",{id:re,action:"approve"});if(!(Pe!=null&&Pe.success)){const et=(Pe==null?void 0:Pe.message)||(Pe==null?void 0:Pe.error)||"操作失败";le.error(et);return}await G()}catch(Pe){console.error(Pe),le.error("操作失败")}}function se(re){ce(re),F("")}async function ye(){const re=$;if(!re)return;const Pe=Y.trim();if(!Pe){le.error("请填写拒绝原因");return}K(!0);try{const et=await Tt("/api/admin/withdrawals",{id:re,action:"reject",errorMessage:Pe});if(!(et!=null&&et.success)){le.error((et==null?void 0:et.error)||"操作失败");return}le.success("已拒绝该提现申请"),ce(null),F(""),await G()}catch(et){console.error(et),le.error("操作失败")}finally{K(!1)}}function Me(){$&&le.info("已取消操作"),ce(null),F("")}async function Be(){var re;if(!(!(U!=null&&U.orderSn)&&!(U!=null&&U.id))){X(!0),w(null);try{const Pe=await Tt("/api/admin/orders/refund",{orderSn:U.orderSn||U.id,reason:me||void 0});Pe!=null&&Pe.success?(he(null),R(""),await oe("orders",!0)):w((Pe==null?void 0:Pe.error)||"退款失败")}catch(Pe){const et=Pe;w(((re=et==null?void 0:et.data)==null?void 0:re.error)||"退款失败,请检查网络后重试")}finally{X(!1)}}}function He(re){const Pe={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"},et={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return s.jsx(Ke,{className:`${Pe[re]||"bg-gray-500/20 text-gray-400"} border-0`,children:et[re]||re})}const gt=Math.ceil(P/D)||1,Dt=n,jn=o.filter(re=>{var et,xt,ft,pt;if(!N)return!0;const Pe=N.toLowerCase();return((et=re.refereeNickname)==null?void 0:et.toLowerCase().includes(Pe))||((xt=re.refereePhone)==null?void 0:xt.includes(Pe))||((ft=re.referrerName)==null?void 0:ft.toLowerCase().includes(Pe))||((pt=re.referrerCode)==null?void 0:pt.toLowerCase().includes(Pe))}),it=u.filter(re=>{var et;if(!N)return!0;const Pe=N.toLowerCase();return((et=re.userName)==null?void 0:et.toLowerCase().includes(Pe))||re.account&&re.account.toLowerCase().includes(Pe)});return s.jsxs("div",{className:"p-8 w-full",children:[v&&s.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:[s.jsx("span",{children:v}),s.jsx("button",{type:"button",onClick:()=>w(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex items-center justify-between mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold text-white",children:"推广中心"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理:订单、分销绑定、提现审核"})]}),s.jsxs(ne,{onClick:G,disabled:g,variant:"outline",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${g?"animate-spin":""}`}),"刷新数据"]})]}),s.jsx("div",{className:"flex gap-2 mb-6 border-b border-gray-700 pb-4 flex-wrap",children:[{key:"overview",label:"数据概览",icon:vo},{key:"orders",label:"订单管理",icon:ph},{key:"bindings",label:"绑定管理",icon:Ns},{key:"withdrawals",label:"提现审核",icon:Ll},{key:"settings",label:"推广设置",icon:bo}].map(re=>s.jsxs("button",{type:"button",onClick:()=>{e(re.key),E("all"),k("")},className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${t===re.key?"bg-[#38bdac] text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,children:[s.jsx(re.icon,{className:"w-4 h-4"}),re.label]},re.key))}),g?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(Ue,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[t==="overview"&&a&&s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ce,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日点击"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:a.todayClicks}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"总点击次数(实时)"})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:s.jsx(Og,{className:"w-6 h-6 text-blue-400"})})]})})}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ce,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日独立用户"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:a.todayUniqueVisitors??0}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"去重访客数(实时)"})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-cyan-500/20 flex items-center justify-center",children:s.jsx(Mn,{className:"w-6 h-6 text-cyan-400"})})]})})}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ce,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日总文章点击率"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(a.todayClickRate??0).toFixed(2)}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"人均点击(总点击/独立用户)"})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-amber-500/20 flex items-center justify-center",children:s.jsx(vo,{className:"w-6 h-6 text-amber-400"})})]})})}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ce,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日绑定"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:a.todayBindings})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-green-500/20 flex items-center justify-center",children:s.jsx(Ns,{className:"w-6 h-6 text-green-400"})})]})})}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ce,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日转化"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:a.todayConversions})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-purple-500/20 flex items-center justify-center",children:s.jsx(Bv,{className:"w-6 h-6 text-purple-400"})})]})})}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ce,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日佣金"}),s.jsxs("p",{className:"text-2xl font-bold text-[#38bdac] mt-1",children:["¥",a.todayEarnings.toFixed(2)]})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac]/20 flex items-center justify-center",children:s.jsx(ph,{className:"w-6 h-6 text-[#38bdac]"})})]})})})]}),(((Mt=a.todayClicksByPage)==null?void 0:Mt.length)??0)>0&&s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(Og,{className:"w-5 h-5 text-[#38bdac]"}),"每篇文章今日点击(按来源页/文章统计)"]}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"实际用户与实际文章的点击均计入;今日总点击与上表一致"})]}),s.jsx(Ce,{children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-700 text-left text-gray-400",children:[s.jsx("th",{className:"pb-3 pr-4",children:"来源页/文章"}),s.jsx("th",{className:"pb-3 pr-4 text-right",children:"今日点击"}),s.jsx("th",{className:"pb-3 text-right",children:"占比"})]})}),s.jsx("tbody",{children:[...a.todayClicksByPage??[]].sort((re,Pe)=>Pe.clicks-re.clicks).map((re,Pe)=>s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("td",{className:"py-2 pr-4 text-white font-mono",children:re.page||"(未区分)"}),s.jsx("td",{className:"py-2 pr-4 text-right text-white",children:re.clicks}),s.jsxs("td",{className:"py-2 text-right text-gray-400",children:[a.todayClicks>0?(re.clicks/a.todayClicks*100).toFixed(1):0,"%"]})]},Pe))})]})})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Se,{className:"bg-orange-500/10 border-orange-500/30",children:s.jsx(Ce,{className:"p-6",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-orange-500/20 flex items-center justify-center",children:s.jsx(Pg,{className:"w-6 h-6 text-orange-400"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-orange-300 font-medium",children:"即将过期绑定"}),s.jsxs("p",{className:"text-2xl font-bold text-white",children:[a.expiringBindings," 个"]}),s.jsx("p",{className:"text-orange-300/60 text-sm",children:"7天内到期,需关注转化"})]})]})})}),s.jsx(Se,{className:"bg-blue-500/10 border-blue-500/30",children:s.jsx(Ce,{className:"p-6",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:s.jsx(Ll,{className:"w-6 h-6 text-blue-400"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-blue-300 font-medium",children:"待审核提现"}),s.jsxs("p",{className:"text-2xl font-bold text-white",children:[a.pendingWithdrawals," 笔"]}),s.jsxs("p",{className:"text-blue-300/60 text-sm",children:["共 ¥",a.pendingWithdrawAmount.toFixed(2)]})]}),s.jsx(ne,{onClick:()=>e("withdrawals"),variant:"outline",className:"border-blue-500/50 text-blue-400 hover:bg-blue-500/20",children:"去审核"})]})})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(qe,{children:s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(fh,{className:"w-5 h-5 text-[#38bdac]"}),"本月统计"]})}),s.jsx(Ce,{children:s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"点击量"}),s.jsx("p",{className:"text-xl font-bold text-white",children:a.monthClicks})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"绑定数"}),s.jsx("p",{className:"text-xl font-bold text-white",children:a.monthBindings})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"转化数"}),s.jsx("p",{className:"text-xl font-bold text-white",children:a.monthConversions})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"佣金"}),s.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",a.monthEarnings.toFixed(2)]})]})]})})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(qe,{children:s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(vo,{className:"w-5 h-5 text-[#38bdac]"}),"累计统计"]})}),s.jsxs(Ce,{children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"总点击"}),s.jsx("p",{className:"text-xl font-bold text-white",children:a.totalClicks.toLocaleString()})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"总绑定"}),s.jsx("p",{className:"text-xl font-bold text-white",children:a.totalBindings.toLocaleString()})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"总转化"}),s.jsx("p",{className:"text-xl font-bold text-white",children:a.totalConversions})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"总佣金"}),s.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",a.totalEarnings.toFixed(2)]})]})]}),s.jsxs("div",{className:"mt-4 p-4 bg-[#38bdac]/10 rounded-lg flex items-center justify-between",children:[s.jsx("span",{className:"text-gray-300",children:"点击转化率"}),s.jsxs("span",{className:"text-[#38bdac] font-bold text-xl",children:[a.conversionRate,"%"]})]})]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(qe,{children:s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(Mn,{className:"w-5 h-5 text-[#38bdac]"}),"推广统计"]})}),s.jsx(Ce,{children:s.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[s.jsx("p",{className:"text-3xl font-bold text-white",children:a.totalDistributors}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"推广用户数"})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[s.jsx("p",{className:"text-3xl font-bold text-green-400",children:a.activeDistributors}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"有收益用户"})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[s.jsx("p",{className:"text-3xl font-bold text-[#38bdac]",children:"90%"}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"佣金比例"})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[s.jsx("p",{className:"text-3xl font-bold text-orange-400",children:"30天"}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"绑定有效期"})]})]})})]})]}),t==="orders"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(Sa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ie,{value:N,onChange:re=>k(re.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:C,onChange:re=>E(re.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"pending",children:"待支付"}),s.jsx("option",{value:"failed",children:"已失败"}),s.jsx("option",{value:"refunded",children:"已退款"})]})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ce,{className:"p-0",children:[n.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无订单数据"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"订单号"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"商品"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"支付方式"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"退款原因"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"推荐人/邀请码"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"分销佣金"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"下单时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Dt.map(re=>{var Pe,et;return s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsxs("td",{className:"p-4 font-mono text-xs text-gray-400",children:[(Pe=re.id)==null?void 0:Pe.slice(0,12),"..."]}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:re.userNickname}),s.jsx("p",{className:"text-gray-500 text-xs",children:re.userPhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:(()=>{const xt=re.productType||re.type;return xt==="fullbook"?`${re.bookName||"《底层逻辑》"} - 全本`:xt==="match"?"匹配次数购买":`${re.bookName||"《底层逻辑》"} - ${re.sectionTitle||re.chapterTitle||`章节${re.productId||re.sectionId||""}`}`})()}),s.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const xt=re.productType||re.type;return xt==="fullbook"?"全书解锁":xt==="match"?"功能权益":re.chapterTitle||"单章购买"})()})]})}),s.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof re.amount=="number"?re.amount.toFixed(2):parseFloat(String(re.amount||"0")).toFixed(2)]}),s.jsx("td",{className:"p-4 text-gray-300",children:re.paymentMethod==="wechat"?"微信支付":re.paymentMethod==="alipay"?"支付宝":re.paymentMethod||"微信支付"}),s.jsx("td",{className:"p-4",children:re.status==="refunded"?s.jsx(Ke,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):re.status==="completed"||re.status==="paid"?s.jsx(Ke,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):re.status==="pending"||re.status==="created"?s.jsx(Ke,{className:"bg-yellow-500/20 text-yellow-400 border-0",children:"待支付"}):s.jsx(Ke,{className:"bg-red-500/20 text-red-400 border-0",children:"已失败"})}),s.jsx("td",{className:"p-4 text-gray-400 text-sm max-w-[120px]",title:re.refundReason,children:re.status==="refunded"&&re.refundReason?re.refundReason:"-"}),s.jsx("td",{className:"p-4 text-gray-300 text-sm",children:re.referrerId||re.referralCode?s.jsxs("span",{title:re.referralCode||re.referrerCode||re.referrerId||"",children:[re.referrerNickname||re.referralCode||re.referrerCode||((et=re.referrerId)==null?void 0:et.slice(0,8)),(re.referralCode||re.referrerCode)&&` (${re.referralCode||re.referrerCode})`]}):"-"}),s.jsx("td",{className:"p-4 text-[#FFD700]",children:re.referrerEarnings?`¥${(typeof re.referrerEarnings=="number"?re.referrerEarnings:parseFloat(String(re.referrerEarnings))).toFixed(2)}`:"-"}),s.jsx("td",{className:"p-4 text-gray-400 text-sm",children:re.createdAt?new Date(re.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:(re.status==="paid"||re.status==="completed")&&s.jsxs(ne,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{he(re),R("")},children:[s.jsx(tj,{className:"w-3 h-3 mr-1"}),"退款"]})})]},re.id)})})]})}),t==="orders"&&s.jsx(ws,{page:A,totalPages:gt,total:P,pageSize:D,onPageChange:I,onPageSizeChange:re=>{_(re),I(1)}})]})})]}),t==="bindings"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(Sa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ie,{value:N,onChange:re=>k(re.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:C,onChange:re=>E(re.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"active",children:"有效"}),s.jsx("option",{value:"converted",children:"已转化"}),s.jsx("option",{value:"expired",children:"已过期"})]})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ce,{className:"p-0",children:[jn.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无绑定数据"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"访客"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"分销商"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"绑定时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"到期时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"佣金"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:jn.map(re=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-medium",children:re.refereeNickname||"匿名用户"}),s.jsx("p",{className:"text-gray-500 text-xs",children:re.refereePhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white",children:re.referrerName||"-"}),s.jsx("p",{className:"text-gray-500 text-xs font-mono",children:re.referrerCode})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:re.boundAt?new Date(re.boundAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:re.expiresAt?new Date(re.expiresAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:He(re.status)}),s.jsx("td",{className:"p-4",children:re.commission?s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",re.commission.toFixed(2)]}):s.jsx("span",{className:"text-gray-500",children:"-"})})]},re.id))})]})}),t==="bindings"&&s.jsx(ws,{page:A,totalPages:gt,total:P,pageSize:D,onPageChange:I,onPageSizeChange:re=>{_(re),I(1)}})]})})]}),t==="withdrawals"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(Sa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ie,{value:N,onChange:re=>k(re.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:C,onChange:re=>E(re.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"pending",children:"待审核"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"rejected",children:"已拒绝"})]})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ce,{className:"p-0",children:[it.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无提现记录"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"申请人"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"收款方式"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"收款账号"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:it.map(re=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[re.userAvatar?s.jsx("img",{src:ts(re.userAvatar),alt:"",className:"w-8 h-8 rounded-full object-cover"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-600 flex items-center justify-center text-white text-sm font-medium",children:(re.userName||re.name||"?").slice(0,1)}),s.jsx("p",{className:"text-white font-medium",children:re.userName||re.name})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",re.amount.toFixed(2)]})}),s.jsx("td",{className:"p-4",children:s.jsx(Ke,{className:re.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:re.method==="wechat"?"微信":"支付宝"})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-mono text-xs",children:re.account}),s.jsx("p",{className:"text-gray-500 text-xs",children:re.name})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:re.createdAt?new Date(re.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:He(re.status)}),s.jsx("td",{className:"p-4 text-right",children:re.status==="pending"&&s.jsxs("div",{className:"flex gap-2 justify-end",children:[s.jsxs(ne,{size:"sm",onClick:()=>Q(re.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Bv,{className:"w-4 h-4 mr-1"}),"通过"]}),s.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>se(re.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[s.jsx(Jw,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},re.id))})]})}),t==="withdrawals"&&s.jsx(ws,{page:A,totalPages:gt,total:P,pageSize:D,onPageChange:I,onPageSizeChange:re=>{_(re),I(1)}})]})})]})]}),s.jsx(Ft,{open:!!U,onOpenChange:re=>!re&&he(null),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Bt,{children:s.jsx(Vt,{className:"text-white",children:"订单退款"})}),U&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",U.orderSn||U.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof U.amount=="number"?U.amount.toFixed(2):parseFloat(String(U.amount||"0")).toFixed(2)]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),s.jsx("div",{className:"form-input",children:s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:me,onChange:re=>R(re.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(ln,{children:[s.jsx(ne,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>he(null),disabled:O,children:"取消"}),s.jsx(ne,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:Be,disabled:O,children:O?"退款中...":"确认退款"})]})]})}),s.jsx(Ft,{open:!!$,onOpenChange:re=>!re&&Me(),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Bt,{children:s.jsx(Vt,{className:"text-white",children:"拒绝提现"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"拒绝后该笔提现金额将返还用户余额。"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"拒绝原因(必填)"}),s.jsx("div",{className:"form-input",children:s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:Y,onChange:re=>F(re.target.value)})})]})]}),s.jsxs(ln,{children:[s.jsx(ne,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:Me,disabled:W,children:"取消"}),s.jsx(ne,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:ye,disabled:W||!Y.trim(),children:W?"提交中...":"确认拒绝"})]})]})}),t==="settings"&&s.jsx("div",{className:"-mx-8 -mt-6",children:s.jsx(_k,{embedded:!0})})]})}function HP(){const[t,e]=b.useState([]),[n,r]=b.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[a,i]=b.useState(!0),[o,c]=b.useState(null),[u,h]=b.useState("all"),[f,m]=b.useState(1),[g,y]=b.useState(10),[v,w]=b.useState(0),[N,k]=b.useState(null),[C,E]=b.useState(null),[A,I]=b.useState(""),[D,_]=b.useState(!1);async function P(){var R,O,X,$,ce,Y,F;i(!0),c(null);try{const W=new URLSearchParams({status:u,page:String(f),pageSize:String(g)}),K=await De(`/api/admin/withdrawals?${W}`);if(K!=null&&K.success){const B=K.withdrawals||[];e(B),w(K.total??((R=K.stats)==null?void 0:R.total)??B.length),r({total:((O=K.stats)==null?void 0:O.total)??K.total??B.length,pendingCount:((X=K.stats)==null?void 0:X.pendingCount)??0,pendingAmount:(($=K.stats)==null?void 0:$.pendingAmount)??0,successCount:((ce=K.stats)==null?void 0:ce.successCount)??0,successAmount:((Y=K.stats)==null?void 0:Y.successAmount)??0,failedCount:((F=K.stats)==null?void 0:F.failedCount)??0})}else c("加载提现记录失败")}catch(W){console.error("Load withdrawals error:",W),c("加载失败,请检查网络后重试")}finally{i(!1)}}b.useEffect(()=>{m(1)},[u]),b.useEffect(()=>{P()},[u,f,g]);const L=Math.ceil(v/g)||1;async function z(R){const O=t.find(X=>X.id===R);if(O!=null&&O.userCommissionInfo&&O.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${O.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。 +如有缓存,请刷新前台/小程序页面。`)}catch(h){console.error(h),le.error("保存失败: "+(h instanceof Error?h.message:String(h)))}finally{o(!1)}},u=h=>f=>{const m=parseFloat(f.target.value||"0");n(g=>({...g,[h]:isNaN(m)?0:m}))};return r?s.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Ll,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置。"})]}),s.jsxs(ne,{onClick:c,disabled:i||r,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),i?"保存中...":"保存配置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"flex items-center gap-2 text-white",children:[s.jsx(xA,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),s.jsx(Ht,{className:"text-gray-400",children:"这三项会直接体现在小程序「推广规则」卡片上,同时影响实收佣金计算。"})]}),s.jsx(Ce,{className:"space-y-6",children:s.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx($c,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),s.jsx(ie,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.userDiscount,onChange:u("userDiscount")}),s.jsx("p",{className:"text-xs text-gray-500",children:"例如 5 表示好友立减 5%(在价格配置基础上生效)。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Mn,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(FP,{className:"flex-1",min:10,max:100,step:1,value:[e.distributorShare],onValueChange:([h])=>n(f=>({...f,distributorShare:h}))}),s.jsx(ie,{type:"number",min:0,max:100,className:"w-20 bg-[#0a1628] border-gray-700 text-white text-center",value:e.distributorShare,onChange:u("distributorShare")})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["内容订单佣金 = 订单金额 ×"," ",s.jsxs("span",{className:"text-[#38bdac] font-mono",children:[e.distributorShare,"%"]}),";会员订单见下方。"]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx($c,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),s.jsx(ie,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.vipOrderShareVip,onChange:u("vipOrderShareVip")}),s.jsx("p",{className:"text-xs text-gray-500",children:"推广者已是会员时,会员订单佣金比例,默认 20%。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx($c,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),s.jsx(ie,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.vipOrderShareNonVip,onChange:u("vipOrderShareNonVip")}),s.jsx("p",{className:"text-xs text-gray-500",children:"推广者非会员时,会员订单佣金比例,默认 10%。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Mn,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),s.jsx(ie,{type:"number",min:1,max:365,className:"bg-[#0a1628] border-gray-700 text-white",value:e.bindingDays,onChange:u("bindingDays")}),s.jsx("p",{className:"text-xs text-gray-500",children:"好友通过你的链接进来并登录后,绑定在你名下的天数。"})]})]})})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"flex items-center gap-2 text-white",children:[s.jsx(Ll,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),s.jsx(Ht,{className:"text-gray-400",children:"与「提现中心」「自动提现」相关的参数,影响推广者看到的可提现金额和最低门槛。"})]}),s.jsx(Ce,{className:"space-y-6",children:s.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"最低提现金额(元)"}),s.jsx(ie,{type:"number",min:0,step:1,className:"bg-[#0a1628] border-gray-700 text-white",value:e.minWithdrawAmount,onChange:u("minWithdrawAmount")}),s.jsx("p",{className:"text-xs text-gray-500",children:"小程序「满 X 元可提现」展示的门槛,同时用于后端接口校验。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:["自动提现开关",s.jsx(Ke,{variant:"outline",className:"border-[#38bdac]/40 text-[#38bdac] text-[10px]",children:"预留"})]}),s.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[s.jsx(Et,{checked:e.enableAutoWithdraw,onCheckedChange:h=>n(f=>({...f,enableAutoWithdraw:h}))}),s.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(qe,{children:s.jsxs(Ge,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[s.jsx($c,{className:"w-4 h-4 text-[#38bdac]"}),"使用说明"]})}),s.jsxs(Ce,{className:"space-y-2 text-xs text-gray-400 leading-relaxed",children:[s.jsxs("p",{children:["1. 以上配置会写入"," ",s.jsx("code",{className:"font-mono text-[11px] text-[#38bdac]",children:"system_config.referral_config"}),",小程序「推广中心」、Web 推广页以及支付回调都会读取同一份配置。"]}),s.jsx("p",{children:"2. 修改后新订单立即生效;旧订单的历史佣金不会自动重算,只影响之后产生的订单。"}),s.jsx("p",{children:"3. 如遇前端展示与实际结算不一致,优先以此处配置为准,再排查缓存和小程序版本。"})]})]})]})]})}function VP(){var Mt;const[t,e]=b.useState("overview"),[n,r]=b.useState([]),[a,i]=b.useState(null),[o,c]=b.useState([]),[u,h]=b.useState([]),[f,m]=b.useState([]),[g,y]=b.useState(!0),[v,w]=b.useState(null),[N,k]=b.useState(""),[C,E]=b.useState("all"),[A,I]=b.useState(1),[D,_]=b.useState(10),[P,L]=b.useState(0),[z,ee]=b.useState(new Set),[U,he]=b.useState(null),[me,R]=b.useState(""),[O,X]=b.useState(!1),[$,ce]=b.useState(null),[Y,F]=b.useState(""),[W,K]=b.useState(!1);b.useEffect(()=>{B()},[]),b.useEffect(()=>{I(1)},[t,C]),b.useEffect(()=>{oe(t)},[t]),b.useEffect(()=>{["orders","bindings","withdrawals"].includes(t)&&oe(t,!0)},[A,D,C,N]);async function B(){w(null);try{const re=await De("/api/admin/distribution/overview");re!=null&&re.success&&re.overview&&i(re.overview)}catch(re){console.error("[Admin] 概览接口异常:",re),w("加载概览失败")}try{const re=await De("/api/db/users");m((re==null?void 0:re.users)||[])}catch(re){console.error("[Admin] 用户数据加载失败:",re)}}async function oe(re,Pe=!1){var et;if(!(!Pe&&z.has(re))){y(!0);try{const xt=f;switch(re){case"overview":break;case"orders":{try{const ft=new URLSearchParams({page:String(A),pageSize:String(D),...C!=="all"&&{status:C},...N&&{search:N}}),pt=await De(`/api/admin/orders?${ft}`);if(pt!=null&&pt.success&&pt.orders){const wt=pt.orders.map(Qt=>{const Lt=xt.find(At=>At.id===Qt.userId),An=Qt.referrerId?xt.find(At=>At.id===Qt.referrerId):null;return{...Qt,amount:parseFloat(String(Qt.amount))||0,userNickname:(Lt==null?void 0:Lt.nickname)||Qt.userNickname||"未知用户",userPhone:(Lt==null?void 0:Lt.phone)||Qt.userPhone||"-",referrerNickname:(An==null?void 0:An.nickname)||null,referrerCode:(An==null?void 0:An.referralCode)??null,type:Qt.productType||Qt.type}});r(wt),L(pt.total??wt.length)}else r([]),L(0)}catch(ft){console.error(ft),w("加载订单失败"),r([])}break}case"bindings":{try{const ft=new URLSearchParams({page:String(A),pageSize:String(D),...C!=="all"&&{status:C}}),pt=await De(`/api/db/distribution?${ft}`);c((pt==null?void 0:pt.bindings)||[]),L((pt==null?void 0:pt.total)??((et=pt==null?void 0:pt.bindings)==null?void 0:et.length)??0)}catch(ft){console.error(ft),w("加载绑定数据失败"),c([])}break}case"withdrawals":{try{const ft=C==="completed"?"success":C==="rejected"?"failed":C,pt=new URLSearchParams({...ft&&ft!=="all"&&{status:ft},page:String(A),pageSize:String(D)}),wt=await De(`/api/admin/withdrawals?${pt}`);if(wt!=null&&wt.success&&wt.withdrawals){const Qt=wt.withdrawals.map(Lt=>({...Lt,account:Lt.account??"未绑定微信号",status:Lt.status==="success"?"completed":Lt.status==="failed"?"rejected":Lt.status}));h(Qt),L((wt==null?void 0:wt.total)??Qt.length)}else wt!=null&&wt.success||w(`获取提现记录失败: ${(wt==null?void 0:wt.error)||"未知错误"}`),h([])}catch(ft){console.error(ft),w("加载提现数据失败"),h([])}break}}ee(ft=>new Set(ft).add(re))}catch(xt){console.error(xt)}finally{y(!1)}}}async function G(){w(null),ee(re=>{const Pe=new Set(re);return Pe.delete(t),Pe}),t==="overview"&&B(),await oe(t,!0)}async function Q(re){if(confirm("确认审核通过并打款?"))try{const Pe=await Tt("/api/admin/withdrawals",{id:re,action:"approve"});if(!(Pe!=null&&Pe.success)){const et=(Pe==null?void 0:Pe.message)||(Pe==null?void 0:Pe.error)||"操作失败";le.error(et);return}await G()}catch(Pe){console.error(Pe),le.error("操作失败")}}function se(re){ce(re),F("")}async function ye(){const re=$;if(!re)return;const Pe=Y.trim();if(!Pe){le.error("请填写拒绝原因");return}K(!0);try{const et=await Tt("/api/admin/withdrawals",{id:re,action:"reject",errorMessage:Pe});if(!(et!=null&&et.success)){le.error((et==null?void 0:et.error)||"操作失败");return}le.success("已拒绝该提现申请"),ce(null),F(""),await G()}catch(et){console.error(et),le.error("操作失败")}finally{K(!1)}}function Me(){$&&le.info("已取消操作"),ce(null),F("")}async function Be(){var re;if(!(!(U!=null&&U.orderSn)&&!(U!=null&&U.id))){X(!0),w(null);try{const Pe=await Tt("/api/admin/orders/refund",{orderSn:U.orderSn||U.id,reason:me||void 0});Pe!=null&&Pe.success?(he(null),R(""),await oe("orders",!0)):w((Pe==null?void 0:Pe.error)||"退款失败")}catch(Pe){const et=Pe;w(((re=et==null?void 0:et.data)==null?void 0:re.error)||"退款失败,请检查网络后重试")}finally{X(!1)}}}function He(re){const Pe={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"},et={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return s.jsx(Ke,{className:`${Pe[re]||"bg-gray-500/20 text-gray-400"} border-0`,children:et[re]||re})}const gt=Math.ceil(P/D)||1,Dt=n,jn=o.filter(re=>{var et,xt,ft,pt;if(!N)return!0;const Pe=N.toLowerCase();return((et=re.refereeNickname)==null?void 0:et.toLowerCase().includes(Pe))||((xt=re.refereePhone)==null?void 0:xt.includes(Pe))||((ft=re.referrerName)==null?void 0:ft.toLowerCase().includes(Pe))||((pt=re.referrerCode)==null?void 0:pt.toLowerCase().includes(Pe))}),it=u.filter(re=>{var et;if(!N)return!0;const Pe=N.toLowerCase();return((et=re.userName)==null?void 0:et.toLowerCase().includes(Pe))||re.account&&re.account.toLowerCase().includes(Pe)});return s.jsxs("div",{className:"p-8 w-full",children:[v&&s.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:[s.jsx("span",{children:v}),s.jsx("button",{type:"button",onClick:()=>w(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex items-center justify-between mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold text-white",children:"推广中心"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"统一管理:订单、分销绑定、提现审核"})]}),s.jsxs(ne,{onClick:G,disabled:g,variant:"outline",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${g?"animate-spin":""}`}),"刷新数据"]})]}),s.jsx("div",{className:"flex gap-2 mb-6 border-b border-gray-700 pb-4 flex-wrap",children:[{key:"overview",label:"数据概览",icon:vo},{key:"orders",label:"订单管理",icon:ph},{key:"bindings",label:"绑定管理",icon:Ns},{key:"withdrawals",label:"提现审核",icon:Ll},{key:"settings",label:"推广设置",icon:bo}].map(re=>s.jsxs("button",{type:"button",onClick:()=>{e(re.key),E("all"),k("")},className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors ${t===re.key?"bg-[#38bdac] text-white":"text-gray-400 hover:text-white hover:bg-gray-800"}`,children:[s.jsx(re.icon,{className:"w-4 h-4"}),re.label]},re.key))}),g?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(Ue,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[t==="overview"&&a&&s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ce,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日点击"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:a.todayClicks}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"总点击次数(实时)"})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:s.jsx(Og,{className:"w-6 h-6 text-blue-400"})})]})})}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ce,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日独立用户"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:a.todayUniqueVisitors??0}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"去重访客数(实时)"})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-cyan-500/20 flex items-center justify-center",children:s.jsx(Mn,{className:"w-6 h-6 text-cyan-400"})})]})})}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ce,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日总文章点击率"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(a.todayClickRate??0).toFixed(2)}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"人均点击(总点击/独立用户)"})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-amber-500/20 flex items-center justify-center",children:s.jsx(vo,{className:"w-6 h-6 text-amber-400"})})]})})}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ce,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日绑定"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:a.todayBindings})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-green-500/20 flex items-center justify-center",children:s.jsx(Ns,{className:"w-6 h-6 text-green-400"})})]})})}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ce,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日转化"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:a.todayConversions})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-purple-500/20 flex items-center justify-center",children:s.jsx(Bv,{className:"w-6 h-6 text-purple-400"})})]})})}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ce,{className:"p-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"今日佣金"}),s.jsxs("p",{className:"text-2xl font-bold text-[#38bdac] mt-1",children:["¥",a.todayEarnings.toFixed(2)]})]}),s.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac]/20 flex items-center justify-center",children:s.jsx(ph,{className:"w-6 h-6 text-[#38bdac]"})})]})})})]}),(((Mt=a.todayClicksByPage)==null?void 0:Mt.length)??0)>0&&s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(Og,{className:"w-5 h-5 text-[#38bdac]"}),"每篇文章今日点击(按来源页/文章统计)"]}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"实际用户与实际文章的点击均计入;今日总点击与上表一致"})]}),s.jsx(Ce,{children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-700 text-left text-gray-400",children:[s.jsx("th",{className:"pb-3 pr-4",children:"来源页/文章"}),s.jsx("th",{className:"pb-3 pr-4 text-right",children:"今日点击"}),s.jsx("th",{className:"pb-3 text-right",children:"占比"})]})}),s.jsx("tbody",{children:[...a.todayClicksByPage??[]].sort((re,Pe)=>Pe.clicks-re.clicks).map((re,Pe)=>s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("td",{className:"py-2 pr-4 text-white font-mono",children:re.page||"(未区分)"}),s.jsx("td",{className:"py-2 pr-4 text-right text-white",children:re.clicks}),s.jsxs("td",{className:"py-2 text-right text-gray-400",children:[a.todayClicks>0?(re.clicks/a.todayClicks*100).toFixed(1):0,"%"]})]},Pe))})]})})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(Se,{className:"bg-orange-500/10 border-orange-500/30",children:s.jsx(Ce,{className:"p-6",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-orange-500/20 flex items-center justify-center",children:s.jsx(Pg,{className:"w-6 h-6 text-orange-400"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-orange-300 font-medium",children:"即将过期绑定"}),s.jsxs("p",{className:"text-2xl font-bold text-white",children:[a.expiringBindings," 个"]}),s.jsx("p",{className:"text-orange-300/60 text-sm",children:"7天内到期,需关注转化"})]})]})})}),s.jsx(Se,{className:"bg-blue-500/10 border-blue-500/30",children:s.jsx(Ce,{className:"p-6",children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-500/20 flex items-center justify-center",children:s.jsx(Ll,{className:"w-6 h-6 text-blue-400"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-blue-300 font-medium",children:"待审核提现"}),s.jsxs("p",{className:"text-2xl font-bold text-white",children:[a.pendingWithdrawals," 笔"]}),s.jsxs("p",{className:"text-blue-300/60 text-sm",children:["共 ¥",a.pendingWithdrawAmount.toFixed(2)]})]}),s.jsx(ne,{onClick:()=>e("withdrawals"),variant:"outline",className:"border-blue-500/50 text-blue-400 hover:bg-blue-500/20",children:"去审核"})]})})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(qe,{children:s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(fh,{className:"w-5 h-5 text-[#38bdac]"}),"本月统计"]})}),s.jsx(Ce,{children:s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"点击量"}),s.jsx("p",{className:"text-xl font-bold text-white",children:a.monthClicks})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"绑定数"}),s.jsx("p",{className:"text-xl font-bold text-white",children:a.monthBindings})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"转化数"}),s.jsx("p",{className:"text-xl font-bold text-white",children:a.monthConversions})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"佣金"}),s.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",a.monthEarnings.toFixed(2)]})]})]})})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(qe,{children:s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(vo,{className:"w-5 h-5 text-[#38bdac]"}),"累计统计"]})}),s.jsxs(Ce,{children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"总点击"}),s.jsx("p",{className:"text-xl font-bold text-white",children:a.totalClicks.toLocaleString()})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"总绑定"}),s.jsx("p",{className:"text-xl font-bold text-white",children:a.totalBindings.toLocaleString()})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"总转化"}),s.jsx("p",{className:"text-xl font-bold text-white",children:a.totalConversions})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"总佣金"}),s.jsxs("p",{className:"text-xl font-bold text-[#38bdac]",children:["¥",a.totalEarnings.toFixed(2)]})]})]}),s.jsxs("div",{className:"mt-4 p-4 bg-[#38bdac]/10 rounded-lg flex items-center justify-between",children:[s.jsx("span",{className:"text-gray-300",children:"点击转化率"}),s.jsxs("span",{className:"text-[#38bdac] font-bold text-xl",children:[a.conversionRate,"%"]})]})]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(qe,{children:s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(Mn,{className:"w-5 h-5 text-[#38bdac]"}),"推广统计"]})}),s.jsx(Ce,{children:s.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[s.jsx("p",{className:"text-3xl font-bold text-white",children:a.totalDistributors}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"推广用户数"})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[s.jsx("p",{className:"text-3xl font-bold text-green-400",children:a.activeDistributors}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"有收益用户"})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[s.jsx("p",{className:"text-3xl font-bold text-[#38bdac]",children:"90%"}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"佣金比例"})]}),s.jsxs("div",{className:"p-4 bg-white/5 rounded-lg text-center",children:[s.jsx("p",{className:"text-3xl font-bold text-orange-400",children:"30天"}),s.jsx("p",{className:"text-gray-400 text-sm mt-1",children:"绑定有效期"})]})]})})]})]}),t==="orders"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(Sa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ie,{value:N,onChange:re=>k(re.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:C,onChange:re=>E(re.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"pending",children:"待支付"}),s.jsx("option",{value:"failed",children:"已失败"}),s.jsx("option",{value:"refunded",children:"已退款"})]})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ce,{className:"p-0",children:[n.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无订单数据"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"订单号"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"商品"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"支付方式"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"退款原因"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"推荐人/邀请码"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"分销佣金"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"下单时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Dt.map(re=>{var Pe,et;return s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsxs("td",{className:"p-4 font-mono text-xs text-gray-400",children:[(Pe=re.id)==null?void 0:Pe.slice(0,12),"..."]}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:re.userNickname}),s.jsx("p",{className:"text-gray-500 text-xs",children:re.userPhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:(()=>{const xt=re.productType||re.type;return xt==="fullbook"?`${re.bookName||"《底层逻辑》"} - 全本`:xt==="match"?"匹配次数购买":`${re.bookName||"《底层逻辑》"} - ${re.sectionTitle||re.chapterTitle||`章节${re.productId||re.sectionId||""}`}`})()}),s.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const xt=re.productType||re.type;return xt==="fullbook"?"全书解锁":xt==="match"?"功能权益":re.chapterTitle||"单章购买"})()})]})}),s.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof re.amount=="number"?re.amount.toFixed(2):parseFloat(String(re.amount||"0")).toFixed(2)]}),s.jsx("td",{className:"p-4 text-gray-300",children:re.paymentMethod==="wechat"?"微信支付":re.paymentMethod==="alipay"?"支付宝":re.paymentMethod||"微信支付"}),s.jsx("td",{className:"p-4",children:re.status==="refunded"?s.jsx(Ke,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):re.status==="completed"||re.status==="paid"?s.jsx(Ke,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):re.status==="pending"||re.status==="created"?s.jsx(Ke,{className:"bg-yellow-500/20 text-yellow-400 border-0",children:"待支付"}):s.jsx(Ke,{className:"bg-red-500/20 text-red-400 border-0",children:"已失败"})}),s.jsx("td",{className:"p-4 text-gray-400 text-sm max-w-[120px]",title:re.refundReason,children:re.status==="refunded"&&re.refundReason?re.refundReason:"-"}),s.jsx("td",{className:"p-4 text-gray-300 text-sm",children:re.referrerId||re.referralCode?s.jsxs("span",{title:re.referralCode||re.referrerCode||re.referrerId||"",children:[re.referrerNickname||re.referralCode||re.referrerCode||((et=re.referrerId)==null?void 0:et.slice(0,8)),(re.referralCode||re.referrerCode)&&` (${re.referralCode||re.referrerCode})`]}):"-"}),s.jsx("td",{className:"p-4 text-[#FFD700]",children:re.referrerEarnings?`¥${(typeof re.referrerEarnings=="number"?re.referrerEarnings:parseFloat(String(re.referrerEarnings))).toFixed(2)}`:"-"}),s.jsx("td",{className:"p-4 text-gray-400 text-sm",children:re.createdAt?new Date(re.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:(re.status==="paid"||re.status==="completed")&&s.jsxs(ne,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{he(re),R("")},children:[s.jsx(tj,{className:"w-3 h-3 mr-1"}),"退款"]})})]},re.id)})})]})}),t==="orders"&&s.jsx(ws,{page:A,totalPages:gt,total:P,pageSize:D,onPageChange:I,onPageSizeChange:re=>{_(re),I(1)}})]})})]}),t==="bindings"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(Sa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ie,{value:N,onChange:re=>k(re.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:C,onChange:re=>E(re.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"active",children:"有效"}),s.jsx("option",{value:"converted",children:"已转化"}),s.jsx("option",{value:"expired",children:"已过期"})]})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ce,{className:"p-0",children:[jn.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无绑定数据"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"访客"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"分销商"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"绑定时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"到期时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"佣金"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:jn.map(re=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-medium",children:re.refereeNickname||"匿名用户"}),s.jsx("p",{className:"text-gray-500 text-xs",children:re.refereePhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white",children:re.referrerName||"-"}),s.jsx("p",{className:"text-gray-500 text-xs font-mono",children:re.referrerCode})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:re.boundAt?new Date(re.boundAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:re.expiresAt?new Date(re.expiresAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:He(re.status)}),s.jsx("td",{className:"p-4",children:re.commission?s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",re.commission.toFixed(2)]}):s.jsx("span",{className:"text-gray-500",children:"-"})})]},re.id))})]})}),t==="bindings"&&s.jsx(ws,{page:A,totalPages:gt,total:P,pageSize:D,onPageChange:I,onPageSizeChange:re=>{_(re),I(1)}})]})})]}),t==="withdrawals"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-4",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(Sa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ie,{value:N,onChange:re=>k(re.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:C,onChange:re=>E(re.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"pending",children:"待审核"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"rejected",children:"已拒绝"})]})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ce,{className:"p-0",children:[it.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无提现记录"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"申请人"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"收款方式"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"收款账号"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:it.map(re=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[re.userAvatar?s.jsx("img",{src:ns(re.userAvatar),alt:"",className:"w-8 h-8 rounded-full object-cover"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-600 flex items-center justify-center text-white text-sm font-medium",children:(re.userName||re.name||"?").slice(0,1)}),s.jsx("p",{className:"text-white font-medium",children:re.userName||re.name})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",re.amount.toFixed(2)]})}),s.jsx("td",{className:"p-4",children:s.jsx(Ke,{className:re.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:re.method==="wechat"?"微信":"支付宝"})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-mono text-xs",children:re.account}),s.jsx("p",{className:"text-gray-500 text-xs",children:re.name})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:re.createdAt?new Date(re.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:He(re.status)}),s.jsx("td",{className:"p-4 text-right",children:re.status==="pending"&&s.jsxs("div",{className:"flex gap-2 justify-end",children:[s.jsxs(ne,{size:"sm",onClick:()=>Q(re.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Bv,{className:"w-4 h-4 mr-1"}),"通过"]}),s.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>se(re.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[s.jsx(Jw,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},re.id))})]})}),t==="withdrawals"&&s.jsx(ws,{page:A,totalPages:gt,total:P,pageSize:D,onPageChange:I,onPageSizeChange:re=>{_(re),I(1)}})]})})]})]}),s.jsx(Ft,{open:!!U,onOpenChange:re=>!re&&he(null),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Bt,{children:s.jsx(Vt,{className:"text-white",children:"订单退款"})}),U&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",U.orderSn||U.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof U.amount=="number"?U.amount.toFixed(2):parseFloat(String(U.amount||"0")).toFixed(2)]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),s.jsx("div",{className:"form-input",children:s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:me,onChange:re=>R(re.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(ln,{children:[s.jsx(ne,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>he(null),disabled:O,children:"取消"}),s.jsx(ne,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:Be,disabled:O,children:O?"退款中...":"确认退款"})]})]})}),s.jsx(Ft,{open:!!$,onOpenChange:re=>!re&&Me(),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Bt,{children:s.jsx(Vt,{className:"text-white",children:"拒绝提现"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"拒绝后该笔提现金额将返还用户余额。"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"拒绝原因(必填)"}),s.jsx("div",{className:"form-input",children:s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:Y,onChange:re=>F(re.target.value)})})]})]}),s.jsxs(ln,{children:[s.jsx(ne,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:Me,disabled:W,children:"取消"}),s.jsx(ne,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:ye,disabled:W||!Y.trim(),children:W?"提交中...":"确认拒绝"})]})]})}),t==="settings"&&s.jsx("div",{className:"-mx-8 -mt-6",children:s.jsx(_k,{embedded:!0})})]})}function HP(){const[t,e]=b.useState([]),[n,r]=b.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[a,i]=b.useState(!0),[o,c]=b.useState(null),[u,h]=b.useState("all"),[f,m]=b.useState(1),[g,y]=b.useState(10),[v,w]=b.useState(0),[N,k]=b.useState(null),[C,E]=b.useState(null),[A,I]=b.useState(""),[D,_]=b.useState(!1);async function P(){var R,O,X,$,ce,Y,F;i(!0),c(null);try{const W=new URLSearchParams({status:u,page:String(f),pageSize:String(g)}),K=await De(`/api/admin/withdrawals?${W}`);if(K!=null&&K.success){const B=K.withdrawals||[];e(B),w(K.total??((R=K.stats)==null?void 0:R.total)??B.length),r({total:((O=K.stats)==null?void 0:O.total)??K.total??B.length,pendingCount:((X=K.stats)==null?void 0:X.pendingCount)??0,pendingAmount:(($=K.stats)==null?void 0:$.pendingAmount)??0,successCount:((ce=K.stats)==null?void 0:ce.successCount)??0,successAmount:((Y=K.stats)==null?void 0:Y.successAmount)??0,failedCount:((F=K.stats)==null?void 0:F.failedCount)??0})}else c("加载提现记录失败")}catch(W){console.error("Load withdrawals error:",W),c("加载失败,请检查网络后重试")}finally{i(!1)}}b.useEffect(()=>{m(1)},[u]),b.useEffect(()=>{P()},[u,f,g]);const L=Math.ceil(v/g)||1;async function z(R){const O=t.find(X=>X.id===R);if(O!=null&&O.userCommissionInfo&&O.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${O.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。 -确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;k(R);try{const X=await Tt("/api/admin/withdrawals",{id:R,action:"approve"});X!=null&&X.success?P():le.error("操作失败: "+((X==null?void 0:X.error)??""))}catch{le.error("操作失败")}finally{k(null)}}function ee(R){E(R),I("")}async function U(){const R=C;if(!R)return;const O=A.trim();if(!O){le.error("请填写拒绝原因");return}_(!0);try{const X=await Tt("/api/admin/withdrawals",{id:R,action:"reject",errorMessage:O});X!=null&&X.success?(le.success("已拒绝该提现申请"),E(null),I(""),P()):le.error("操作失败: "+((X==null?void 0:X.error)??""))}catch{le.error("操作失败")}finally{_(!1)}}function he(){C&&le.info("已取消操作"),E(null),I("")}function me(R){switch(R){case"pending":return s.jsx(Ke,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待处理"});case"pending_confirm":return s.jsx(Ke,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待用户确认"});case"processing":return s.jsx(Ke,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:"已审批等待打款"});case"success":case"completed":return s.jsx(Ke,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"});case"failed":case"rejected":return s.jsx(Ke,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已拒绝"});default:return s.jsx(Ke,{className:"bg-gray-500/20 text-gray-400 border-0",children:R})}}return s.jsxs("div",{className:"p-8 w-full",children:[o&&s.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:[s.jsx("span",{children:o}),s.jsx("button",{type:"button",onClick:()=>c(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-start mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold text-white",children:"分账提现管理"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"管理用户分销收益的提现申请"})]}),s.jsxs(ne,{variant:"outline",onClick:P,disabled:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${a?"animate-spin":""}`}),"刷新"]})]}),s.jsx(Se,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:s.jsx(Ce,{className:"p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(ph,{className:"w-5 h-5 text-[#38bdac] mt-0.5"}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-white font-medium mb-2",children:"自动分账规则"}),s.jsxs("div",{className:"text-sm text-gray-400 space-y-1",children:[s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"分销比例"}),":推广者获得订单金额的"," ",s.jsx("span",{className:"text-white font-medium",children:"90%"})]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"结算方式"}),":用户付款后,分销收益自动计入推广者账户"]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"提现方式"}),":用户在小程序端点击提现,系统自动转账到微信零钱"]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"审批流程"}),":待处理的提现需管理员手动确认打款后批准"]})]})]})]})})}),s.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ce,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-[#38bdac]",children:n.total}),s.jsx("div",{className:"text-sm text-gray-400",children:"总申请"})]})}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ce,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-orange-400",children:n.pendingCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"待处理"}),s.jsxs("div",{className:"text-xs text-orange-400 mt-1",children:["¥",n.pendingAmount.toFixed(2)]})]})}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ce,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-green-400",children:n.successCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"已完成"}),s.jsxs("div",{className:"text-xs text-green-400 mt-1",children:["¥",n.successAmount.toFixed(2)]})]})}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ce,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-red-400",children:n.failedCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"已拒绝"})]})})]}),s.jsx("div",{className:"flex gap-2 mb-4",children:["all","pending","success","failed"].map(R=>s.jsx(ne,{variant:u===R?"default":"outline",size:"sm",onClick:()=>h(R),className:u===R?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:R==="all"?"全部":R==="pending"?"待处理":R==="success"?"已完成":"已拒绝"},R))}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ce,{className:"p-0",children:a?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.length===0?s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Ll,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无提现记录"})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"提现金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"用户佣金信息"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"处理时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"确认收款"}),s.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:t.map(R=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4 text-gray-400",children:new Date(R.createdAt??"").toLocaleString()}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[R.userAvatar?s.jsx("img",{src:ts(R.userAvatar),alt:R.userName??"",className:"w-8 h-8 rounded-full object-cover"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:(R.userName??"?").charAt(0)}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-white",children:R.userName??"未知"}),s.jsx("p",{className:"text-xs text-gray-500",children:R.userPhone??R.referralCode??(R.userId??"").slice(0,10)})]})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(R.amount).toFixed(2)]})}),s.jsx("td",{className:"p-4",children:R.userCommissionInfo?s.jsxs("div",{className:"text-xs space-y-1",children:[s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"累计佣金:"}),s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",R.userCommissionInfo.totalCommission.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"已提现:"}),s.jsxs("span",{className:"text-gray-400",children:["¥",R.userCommissionInfo.withdrawnEarnings.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"待审核:"}),s.jsxs("span",{className:"text-orange-400",children:["¥",R.userCommissionInfo.pendingWithdrawals.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4 pt-1 border-t border-gray-700/30",children:[s.jsx("span",{className:"text-gray-500",children:"审核后余额:"}),s.jsxs("span",{className:R.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",R.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):s.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),s.jsxs("td",{className:"p-4",children:[me(R.status),R.errorMessage&&s.jsx("p",{className:"text-xs text-red-400 mt-1",children:R.errorMessage})]}),s.jsx("td",{className:"p-4 text-gray-400",children:R.processedAt?new Date(R.processedAt).toLocaleString():"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:R.userConfirmedAt?s.jsxs("span",{className:"text-green-400",title:R.userConfirmedAt,children:["已确认 ",new Date(R.userConfirmedAt).toLocaleString()]}):"-"}),s.jsxs("td",{className:"p-4 text-right",children:[(R.status==="pending"||R.status==="pending_confirm")&&s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsxs(ne,{size:"sm",onClick:()=>z(R.id),disabled:N===R.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[s.jsx(yf,{className:"w-4 h-4 mr-1"}),"批准"]}),s.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>ee(R.id),disabled:N===R.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[s.jsx(nr,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(R.status==="success"||R.status==="completed")&&R.transactionId&&s.jsx("span",{className:"text-xs text-gray-500 font-mono",children:R.transactionId})]})]},R.id))})]})}),s.jsx(ws,{page:f,totalPages:L,total:v,pageSize:g,onPageChange:m,onPageSizeChange:R=>{y(R),m(1)}})]})})}),s.jsx(Ft,{open:!!C,onOpenChange:R=>!R&&he(),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Bt,{children:s.jsx(Vt,{className:"text-white",children:"拒绝提现"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"拒绝后该笔提现金额将返还用户余额。"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"拒绝原因(必填)"}),s.jsx("div",{className:"form-input",children:s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:A,onChange:R=>I(R.target.value)})})]})]}),s.jsxs(ln,{children:[s.jsx(ne,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:he,disabled:D,children:"取消"}),s.jsx(ne,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:U,disabled:D||!A.trim(),children:D?"提交中...":"确认拒绝"})]})]})})]})}var Hm={exports:{}},Wm={};/** +确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;k(R);try{const X=await Tt("/api/admin/withdrawals",{id:R,action:"approve"});X!=null&&X.success?P():le.error("操作失败: "+((X==null?void 0:X.error)??""))}catch{le.error("操作失败")}finally{k(null)}}function ee(R){E(R),I("")}async function U(){const R=C;if(!R)return;const O=A.trim();if(!O){le.error("请填写拒绝原因");return}_(!0);try{const X=await Tt("/api/admin/withdrawals",{id:R,action:"reject",errorMessage:O});X!=null&&X.success?(le.success("已拒绝该提现申请"),E(null),I(""),P()):le.error("操作失败: "+((X==null?void 0:X.error)??""))}catch{le.error("操作失败")}finally{_(!1)}}function he(){C&&le.info("已取消操作"),E(null),I("")}function me(R){switch(R){case"pending":return s.jsx(Ke,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待处理"});case"pending_confirm":return s.jsx(Ke,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待用户确认"});case"processing":return s.jsx(Ke,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:"已审批等待打款"});case"success":case"completed":return s.jsx(Ke,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"});case"failed":case"rejected":return s.jsx(Ke,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已拒绝"});default:return s.jsx(Ke,{className:"bg-gray-500/20 text-gray-400 border-0",children:R})}}return s.jsxs("div",{className:"p-8 w-full",children:[o&&s.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:[s.jsx("span",{children:o}),s.jsx("button",{type:"button",onClick:()=>c(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-start mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold text-white",children:"分账提现管理"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"管理用户分销收益的提现申请"})]}),s.jsxs(ne,{variant:"outline",onClick:P,disabled:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${a?"animate-spin":""}`}),"刷新"]})]}),s.jsx(Se,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:s.jsx(Ce,{className:"p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(ph,{className:"w-5 h-5 text-[#38bdac] mt-0.5"}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-white font-medium mb-2",children:"自动分账规则"}),s.jsxs("div",{className:"text-sm text-gray-400 space-y-1",children:[s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"分销比例"}),":推广者获得订单金额的"," ",s.jsx("span",{className:"text-white font-medium",children:"90%"})]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"结算方式"}),":用户付款后,分销收益自动计入推广者账户"]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"提现方式"}),":用户在小程序端点击提现,系统自动转账到微信零钱"]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"审批流程"}),":待处理的提现需管理员手动确认打款后批准"]})]})]})]})})}),s.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ce,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-[#38bdac]",children:n.total}),s.jsx("div",{className:"text-sm text-gray-400",children:"总申请"})]})}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ce,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-orange-400",children:n.pendingCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"待处理"}),s.jsxs("div",{className:"text-xs text-orange-400 mt-1",children:["¥",n.pendingAmount.toFixed(2)]})]})}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ce,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-green-400",children:n.successCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"已完成"}),s.jsxs("div",{className:"text-xs text-green-400 mt-1",children:["¥",n.successAmount.toFixed(2)]})]})}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(Ce,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-red-400",children:n.failedCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"已拒绝"})]})})]}),s.jsx("div",{className:"flex gap-2 mb-4",children:["all","pending","success","failed"].map(R=>s.jsx(ne,{variant:u===R?"default":"outline",size:"sm",onClick:()=>h(R),className:u===R?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:R==="all"?"全部":R==="pending"?"待处理":R==="success"?"已完成":"已拒绝"},R))}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ce,{className:"p-0",children:a?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.length===0?s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Ll,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无提现记录"})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"提现金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"用户佣金信息"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"处理时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"确认收款"}),s.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:t.map(R=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4 text-gray-400",children:new Date(R.createdAt??"").toLocaleString()}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[R.userAvatar?s.jsx("img",{src:ns(R.userAvatar),alt:R.userName??"",className:"w-8 h-8 rounded-full object-cover"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:(R.userName??"?").charAt(0)}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-white",children:R.userName??"未知"}),s.jsx("p",{className:"text-xs text-gray-500",children:R.userPhone??R.referralCode??(R.userId??"").slice(0,10)})]})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(R.amount).toFixed(2)]})}),s.jsx("td",{className:"p-4",children:R.userCommissionInfo?s.jsxs("div",{className:"text-xs space-y-1",children:[s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"累计佣金:"}),s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",R.userCommissionInfo.totalCommission.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"已提现:"}),s.jsxs("span",{className:"text-gray-400",children:["¥",R.userCommissionInfo.withdrawnEarnings.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"待审核:"}),s.jsxs("span",{className:"text-orange-400",children:["¥",R.userCommissionInfo.pendingWithdrawals.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4 pt-1 border-t border-gray-700/30",children:[s.jsx("span",{className:"text-gray-500",children:"审核后余额:"}),s.jsxs("span",{className:R.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",R.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):s.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),s.jsxs("td",{className:"p-4",children:[me(R.status),R.errorMessage&&s.jsx("p",{className:"text-xs text-red-400 mt-1",children:R.errorMessage})]}),s.jsx("td",{className:"p-4 text-gray-400",children:R.processedAt?new Date(R.processedAt).toLocaleString():"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:R.userConfirmedAt?s.jsxs("span",{className:"text-green-400",title:R.userConfirmedAt,children:["已确认 ",new Date(R.userConfirmedAt).toLocaleString()]}):"-"}),s.jsxs("td",{className:"p-4 text-right",children:[(R.status==="pending"||R.status==="pending_confirm")&&s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsxs(ne,{size:"sm",onClick:()=>z(R.id),disabled:N===R.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[s.jsx(yf,{className:"w-4 h-4 mr-1"}),"批准"]}),s.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>ee(R.id),disabled:N===R.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[s.jsx(nr,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(R.status==="success"||R.status==="completed")&&R.transactionId&&s.jsx("span",{className:"text-xs text-gray-500 font-mono",children:R.transactionId})]})]},R.id))})]})}),s.jsx(ws,{page:f,totalPages:L,total:v,pageSize:g,onPageChange:m,onPageSizeChange:R=>{y(R),m(1)}})]})})}),s.jsx(Ft,{open:!!C,onOpenChange:R=>!R&&he(),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Bt,{children:s.jsx(Vt,{className:"text-white",children:"拒绝提现"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"拒绝后该笔提现金额将返还用户余额。"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"拒绝原因(必填)"}),s.jsx("div",{className:"form-input",children:s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:A,onChange:R=>I(R.target.value)})})]})]}),s.jsxs(ln,{children:[s.jsx(ne,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:he,disabled:D,children:"取消"}),s.jsx(ne,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:U,disabled:D||!A.trim(),children:D?"提交中...":"确认拒绝"})]})]})})]})}var Hm={exports:{}},Wm={};/** * @license React * use-sync-external-store-shim.production.js * @@ -615,11 +615,11 @@ For more information, see https://radix-ui.com/primitives/docs/components/${e.do `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let c=r.split(/\r?\n|\r/);for(let u=0;u!u.clearMark(h)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)c=u;else break}}return n}addElementByRule(e,n,r,a){let i,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let u=this.enter(o,n.attrs||null,r,n.preserveWhitespace);u&&(i=!0,r=u)}else{let u=this.parser.schema.marks[n.mark];r=r.concat(u.create(n.attrs))}let c=this.top;if(o&&o.isLeaf)this.findInside(e);else if(a)this.addElement(e,r,a);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(u=>this.insertNode(u,r,!1));else{let u=e;typeof n.contentElement=="string"?u=e.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(e):n.contentElement&&(u=n.contentElement),this.findAround(e,u,!0),this.addAll(u,r),this.findAround(e,u,!1)}i&&this.sync(c)&&this.open--}addAll(e,n,r,a){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,c=a==null?null:e.childNodes[a];o!=c;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,n);this.findAtPoint(e,i)}findPlace(e,n,r){let a,i;for(let o=this.open,c=0;o>=0;o--){let u=this.nodes[o],h=u.findWrapping(e);if(h&&(!a||a.length>h.length+c)&&(a=h,i=u,!h.length))break;if(u.solid){if(r)break;c+=2}}if(!a)return null;this.sync(i);for(let o=0;o(o.type?o.type.allowsMarkType(h.type):N1(h.type,e))?(u=h.addToSet(u),!1):!0),this.nodes.push(new Fu(e,n,u,a,null,c)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=dd)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let a=r.length-1;a>=0;a--)e+=r[a].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,a=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(a?0:1),o=(c,u)=>{for(;c>=0;c--){let h=n[c];if(h==""){if(c==n.length-1||c==0)continue;for(;u>=i;u--)if(o(c-1,u))return!0;return!1}else{let f=u>0||u==0&&a?this.nodes[u].type:r&&u>=i?r.node(u-i).type:null;if(!f||f.name!=h&&!f.isInGroup(h))return!1;u--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function dO(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&rS.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function uO(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function v1(t){let e={};for(let n in t)e[n]=t[n];return e}function N1(t,e){let n=e.schema.nodes;for(let r in n){let a=n[r];if(!a.allowsMarkType(t))continue;let i=[],o=c=>{i.push(c);for(let u=0;u{if(i.length||o.marks.length){let c=0,u=0;for(;c=0;a--){let i=this.serializeMark(e.marks[a],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let a=this.marks[e.type.name];return a&&sh(Km(r),a(e,n),null,e.attrs)}static renderSpec(e,n,r=null,a){return sh(e,n,r,a)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new $o(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=w1(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return w1(e.marks)}}function w1(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Km(t){return t.document||window.document}const j1=new WeakMap;function hO(t){let e=j1.get(t);return e===void 0&&j1.set(t,e=fO(t)),e}function fO(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let a=0;a-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=a.indexOf(" ");o>0&&(n=a.slice(0,o),a=a.slice(o+1));let c,u=n?t.createElementNS(n,a):t.createElement(a),h=e[1],f=1;if(h&&typeof h=="object"&&h.nodeType==null&&!Array.isArray(h)){f=2;for(let m in h)if(h[m]!=null){let g=m.indexOf(" ");g>0?u.setAttributeNS(m.slice(0,g),m.slice(g+1),h[m]):m=="style"&&u.style?u.style.cssText=h[m]:u.setAttribute(m,h[m])}}for(let m=f;mf)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:y,contentDOM:v}=sh(t,g,n,r);if(u.appendChild(y),v){if(c)throw new RangeError("Multiple content holes");c=v}}}return{dom:u,contentDOM:c}}const sS=65535,aS=Math.pow(2,16);function pO(t,e){return t+e*aS}function k1(t){return t&sS}function mO(t){return(t-(t&sS))/aS}const iS=1,oS=2,ah=4,lS=8;class Qg{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&lS)>0}get deletedBefore(){return(this.delInfo&(iS|ah))>0}get deletedAfter(){return(this.delInfo&(oS|ah))>0}get deletedAcross(){return(this.delInfo&ah)>0}}class _r{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&_r.empty)return _r.empty}recover(e){let n=0,r=k1(e);if(!this.inverted)for(let a=0;ae)break;let h=this.ranges[c+i],f=this.ranges[c+o],m=u+h;if(e<=m){let g=h?e==u?-1:e==m?1:n:n,y=u+a+(g<0?0:f);if(r)return y;let v=e==(n<0?u:m)?null:pO(c/3,e-u),w=e==u?oS:e==m?iS:ah;return(n<0?e!=u:e!=m)&&(w|=lS),new Qg(y,w,v)}a+=f-h}return r?e+a:new Qg(e+a,0,null)}touches(e,n){let r=0,a=k1(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let c=0;ce)break;let h=this.ranges[c+i],f=u+h;if(e<=f&&c==a*3)return!0;r+=this.ranges[c+o]-h}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let a=0,i=0;a=0;n--){let a=e.getMirror(n);this.appendMap(e._maps[n].invert(),a!=null&&a>n?r-a-1:void 0)}}invert(){let e=new ud;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;ri&&u!o.isAtom||!c.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),a),n.openStart,n.openEnd);return vn.fromReplace(e,this.from,this.to,i)}invert(){return new vs(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new bi(n.pos,r.pos,this.mark)}merge(e){return e instanceof bi&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new bi(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new bi(n.from,n.to,e.markFromJSON(n.mark))}}ir.jsonID("addMark",bi);class vs extends ir{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new Re(c0(n.content,a=>a.mark(this.mark.removeFromSet(a.marks)),e),n.openStart,n.openEnd);return vn.fromReplace(e,this.from,this.to,r)}invert(){return new bi(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new vs(n.pos,r.pos,this.mark)}merge(e){return e instanceof vs&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new vs(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new vs(n.from,n.to,e.markFromJSON(n.mark))}}ir.jsonID("removeMark",vs);class vi extends ir{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return vn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return vn.fromReplace(e,this.pos,this.pos+1,new Re(xe.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let a=0;ar.pos?null:new Ln(n.pos,r.pos,a,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ln(n.from,n.to,n.gapFrom,n.gapTo,Re.fromJSON(e,n.slice),n.insert,!!n.structure)}}ir.jsonID("replaceAround",Ln);function Xg(t,e,n){let r=t.resolve(e),a=n-e,i=r.depth;for(;a>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,a--;if(a>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;a>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,a--}}return!1}function gO(t,e,n,r){let a=[],i=[],o,c;t.doc.nodesBetween(e,n,(u,h,f)=>{if(!u.isInline)return;let m=u.marks;if(!r.isInSet(m)&&f.type.allowsMarkType(r.type)){let g=Math.max(h,e),y=Math.min(h+u.nodeSize,n),v=r.addToSet(m);for(let w=0;wt.step(u)),i.forEach(u=>t.step(u))}function xO(t,e,n,r){let a=[],i=0;t.doc.nodesBetween(e,n,(o,c)=>{if(!o.isInline)return;i++;let u=null;if(r instanceof Cf){let h=o.marks,f;for(;f=r.isInSet(h);)(u||(u=[])).push(f),h=f.removeFromSet(h)}else r?r.isInSet(o.marks)&&(u=[r]):u=o.marks;if(u&&u.length){let h=Math.min(c+o.nodeSize,n);for(let f=0;ft.step(new vs(o.from,o.to,o.style)))}function d0(t,e,n,r=n.contentMatch,a=!0){let i=t.doc.nodeAt(e),o=[],c=e+1;for(let u=0;u=0;u--)t.step(o[u])}function yO(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Xl(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,a=0,i=0;;--r){let o=t.$from.node(r),c=t.$from.index(r)+a,u=t.$to.indexAfter(r)-i;if(rn;v--)w||r.index(v)>0?(w=!0,f=xe.from(r.node(v).copy(f)),m++):u--;let g=xe.empty,y=0;for(let v=i,w=!1;v>n;v--)w||a.after(v+1)=0;o--){if(r.size){let c=n[o].type.contentMatch.matchFragment(r);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=xe.from(n[o].type.create(n[o].attrs,r))}let a=e.start,i=e.end;t.step(new Ln(a,i,a,i,new Re(r,0,0),n.length,!0))}function jO(t,e,n,r,a){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(o,c)=>{let u=typeof a=="function"?a(o):a;if(o.isTextblock&&!o.hasMarkup(r,u)&&kO(t.doc,t.mapping.slice(i).map(c),r)){let h=null;if(r.schema.linebreakReplacement){let y=r.whitespace=="pre",v=!!r.contentMatch.matchType(r.schema.linebreakReplacement);y&&!v?h=!1:!y&&v&&(h=!0)}h===!1&&dS(t,o,c,i),d0(t,t.mapping.slice(i).map(c,1),r,void 0,h===null);let f=t.mapping.slice(i),m=f.map(c,1),g=f.map(c+o.nodeSize,1);return t.step(new Ln(m,g,m+1,g-1,new Re(xe.from(r.create(u,null,o.marks)),0,0),1,!0)),h===!0&&cS(t,o,c,i),!1}})}function cS(t,e,n,r){e.forEach((a,i)=>{if(a.isText){let o,c=/\r?\n|\r/g;for(;o=c.exec(a.text);){let u=t.mapping.slice(r).map(n+1+i+o.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function dS(t,e,n,r){e.forEach((a,i)=>{if(a.type==a.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+i);t.replaceWith(o,o+1,e.type.schema.text(` `))}})}function kO(t,e,n){let r=t.resolve(e),a=r.index();return r.parent.canReplaceWith(a,a+1,n)}function SO(t,e,n,r,a){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let o=n.create(r,null,a||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,o);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Ln(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new Re(xe.from(o),0,0),1,!0))}function Ea(t,e,n=1,r){let a=t.resolve(e),i=a.depth-n,o=r&&r[r.length-1]||a.parent;if(i<0||a.parent.type.spec.isolating||!a.parent.canReplace(a.index(),a.parent.childCount)||!o.type.validContent(a.parent.content.cutByIndex(a.index(),a.parent.childCount)))return!1;for(let h=a.depth-1,f=n-2;h>i;h--,f--){let m=a.node(h),g=a.index(h);if(m.type.spec.isolating)return!1;let y=m.content.cutByIndex(g,m.childCount),v=r&&r[f+1];v&&(y=y.replaceChild(0,v.type.create(v.attrs)));let w=r&&r[f]||m;if(!m.canReplace(g+1,m.childCount)||!w.type.validContent(y))return!1}let c=a.indexAfter(i),u=r&&r[0];return a.node(i).canReplaceWith(c,c,u?u.type:a.node(i+1).type)}function CO(t,e,n=1,r){let a=t.doc.resolve(e),i=xe.empty,o=xe.empty;for(let c=a.depth,u=a.depth-n,h=n-1;c>u;c--,h--){i=xe.from(a.node(c).copy(i));let f=r&&r[h];o=xe.from(f?f.type.create(f.attrs,o):a.node(c).copy(o))}t.step(new Dn(e,e,new Re(i.append(o),n,n),!0))}function _i(t,e){let n=t.resolve(e),r=n.index();return uS(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function EO(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let a=0;a0?(i=r.node(a+1),c++,o=r.node(a).maybeChild(c)):(i=r.node(a).maybeChild(c-1),o=r.node(a+1)),i&&!i.isTextblock&&uS(i,o)&&r.node(a).canReplace(c,c+1))return e;if(a==0)break;e=n<0?r.before(a):r.after(a)}}function TO(t,e,n){let r=null,{linebreakReplacement:a}=t.doc.type.schema,i=t.doc.resolve(e-n),o=i.node().type;if(a&&o.inlineContent){let f=o.whitespace=="pre",m=!!o.contentMatch.matchType(a);f&&!m?r=!1:!f&&m&&(r=!0)}let c=t.steps.length;if(r===!1){let f=t.doc.resolve(e+n);dS(t,f.node(),f.before(),c)}o.inlineContent&&d0(t,e+n-1,o,i.node().contentMatchAt(i.index()),r==null);let u=t.mapping.slice(c),h=u.map(e-n);if(t.step(new Dn(h,u.map(e+n,-1),Re.empty,!0)),r===!0){let f=t.doc.resolve(h);cS(t,f.node(),f.before(),t.steps.length)}return t}function MO(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let a=r.depth-1;a>=0;a--){let i=r.index(a);if(r.node(a).canReplaceWith(i,i,n))return r.before(a+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let a=r.depth-1;a>=0;a--){let i=r.indexAfter(a);if(r.node(a).canReplaceWith(i,i,n))return r.after(a+1);if(i=0;o--){let c=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,u=r.index(o)+(c>0?1:0),h=r.node(o),f=!1;if(i==1)f=h.canReplace(u,u,a);else{let m=h.contentMatchAt(u).findWrapping(a.firstChild.type);f=m&&h.canReplaceWith(u,u,m[0])}if(f)return c==0?r.pos:c<0?r.before(o+1):r.after(o+1)}return null}function Tf(t,e,n=e,r=Re.empty){if(e==n&&!r.size)return null;let a=t.resolve(e),i=t.resolve(n);return fS(a,i,r)?new Dn(e,n,r):new AO(a,i,r).fit()}function fS(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class AO{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=xe.empty;for(let a=0;a<=e.depth;a++){let i=e.node(a);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(a))})}for(let a=e.depth;a>0;a--)this.placed=xe.from(e.node(a).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let h=this.findFittable();h?this.placeNodes(h):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,a=this.close(e<0?this.$to:r.doc.resolve(e));if(!a)return null;let i=this.placed,o=r.depth,c=a.depth;for(;o&&c&&i.childCount==1;)i=i.firstChild.content,o--,c--;let u=new Re(i,o,c);return e>-1?new Ln(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new Dn(r.pos,a.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,a=this.unplaced.openEnd;r1&&(a=0),i.type.spec.isolating&&a<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let a,i=null;r?(i=Gm(this.unplaced.content,r-1).firstChild,a=i.content):a=this.unplaced.content;let o=a.firstChild;for(let c=this.depth;c>=0;c--){let{type:u,match:h}=this.frontier[c],f,m=null;if(n==1&&(o?h.matchType(o.type)||(m=h.fillBefore(xe.from(o),!1)):i&&u.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:c,parent:i,inject:m};if(n==2&&o&&(f=h.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:c,parent:i,wrap:f};if(i&&h.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,a=Gm(e,n);return!a.childCount||a.firstChild.isLeaf?!1:(this.unplaced=new Re(e,n+1,Math.max(r,a.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,a=Gm(e,n);if(a.childCount<=1&&n>0){let i=e.size-n<=n+a.size;this.unplaced=new Re(Fc(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new Re(Fc(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:a,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let w=0;w1||u==0||w.content.size)&&(m=N,f.push(pS(w.mark(g.allowedMarks(w.marks)),h==1?u:0,h==c.childCount?y:-1)))}let v=h==c.childCount;v||(y=-1),this.placed=Bc(this.placed,n,xe.from(f)),this.frontier[n].match=m,v&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let w=0,N=c;w1&&a==this.$to.end(--r);)++a;return a}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:a}=this.frontier[n],i=n=0;c--){let{match:u,type:h}=this.frontier[c],f=Jm(e,c,h,u,!0);if(!f||f.childCount)continue e}return{depth:n,fit:o,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Bc(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let a=e.node(r),i=a.type.contentMatch.fillBefore(a.content,!0,e.index(r));this.openFrontierNode(a.type,a.attrs,i)}return e}openFrontierNode(e,n=null,r){let a=this.frontier[this.depth];a.match=a.match.matchType(e),this.placed=Bc(this.placed,this.depth,xe.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(xe.empty,!0);n.childCount&&(this.placed=Bc(this.placed,this.frontier.length,n))}}function Fc(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Fc(t.firstChild.content,e-1,n)))}function Bc(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Bc(t.lastChild.content,e-1,n)))}function Gm(t,e){for(let n=0;n1&&(r=r.replaceChild(0,pS(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(xe.empty,!0)))),t.copy(r)}function Jm(t,e,n,r,a){let i=t.node(e),o=a?t.indexAfter(e):t.index(e);if(o==i.childCount&&!n.compatibleContent(i.type))return null;let c=r.fillBefore(i.content,!0,o);return c&&!IO(n,i.content,o)?c:null}function IO(t,e,n){for(let r=n;r0;g--,y--){let v=a.node(g).type.spec;if(v.defining||v.definingAsContext||v.isolating)break;o.indexOf(g)>-1?c=g:a.before(g)==y&&o.splice(1,0,-g)}let u=o.indexOf(c),h=[],f=r.openStart;for(let g=r.content,y=0;;y++){let v=g.firstChild;if(h.push(v),y==r.openStart)break;g=v.content}for(let g=f-1;g>=0;g--){let y=h[g],v=RO(y.type);if(v&&!y.sameMarkup(a.node(Math.abs(c)-1)))f=g;else if(v||!y.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let y=(g+f+1)%(r.openStart+1),v=h[y];if(v)for(let w=0;w=0&&(t.replace(e,n,r),!(t.steps.length>m));g--){let y=o[g];y<0||(e=a.before(y),n=i.after(y))}}function mS(t,e,n,r,a){if(er){let i=a.contentMatchAt(0),o=i.fillBefore(t).append(t);t=o.append(i.matchFragment(o).fillBefore(xe.empty,!0))}return t}function OO(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let a=MO(t.doc,e,r.type);a!=null&&(e=n=a)}t.replaceRange(e,n,new Re(xe.from(r),0,0))}function DO(t,e,n){let r=t.doc.resolve(e),a=t.doc.resolve(n),i=gS(r,a);for(let o=0;o0&&(u||r.node(c-1).canReplace(r.index(c-1),a.indexAfter(c-1))))return t.delete(r.before(c),a.after(c))}for(let o=1;o<=r.depth&&o<=a.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&a.end(o)-n!=a.depth-o&&r.start(o-1)==a.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),a.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function gS(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let a=r;a>=0;a--){let i=t.start(a);if(ie.pos+(e.depth-a)||t.node(a).type.spec.isolating||e.node(a).type.spec.isolating)break;(i==e.start(a)||a==t.depth&&a==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&a&&e.start(a-1)==i-1)&&n.push(a)}return n}class Rl extends ir{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return vn.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let a=n.type.create(r,null,n.marks);return vn.fromReplace(e,this.pos,this.pos+1,new Re(xe.from(a),0,n.isLeaf?0:1))}getMap(){return _r.empty}invert(e){return new Rl(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Rl(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Rl(n.pos,n.attr,n.value)}}ir.jsonID("attr",Rl);class hd extends ir{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let a in e.attrs)n[a]=e.attrs[a];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return vn.ok(r)}getMap(){return _r.empty}invert(e){return new hd(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new hd(n.attr,n.value)}}ir.jsonID("docAttr",hd);let _l=class extends Error{};_l=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};_l.prototype=Object.create(Error.prototype);_l.prototype.constructor=_l;_l.prototype.name="TransformError";class h0{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ud}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new _l(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r{e=Math.min(e,c),n=Math.max(n,u)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=Re.empty){let a=Tf(this.doc,e,n,r);return a&&this.step(a),this}replaceWith(e,n,r){return this.replace(e,n,new Re(xe.from(r),0,0))}delete(e,n){return this.replace(e,n,Re.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return PO(this,e,n,r),this}replaceRangeWith(e,n,r){return OO(this,e,n,r),this}deleteRange(e,n){return DO(this,e,n),this}lift(e,n){return bO(this,e,n),this}join(e,n=1){return TO(this,e,n),this}wrap(e,n){return wO(this,e,n),this}setBlockType(e,n=e,r,a=null){return jO(this,e,n,r,a),this}setNodeMarkup(e,n,r=null,a){return SO(this,e,n,r,a),this}setNodeAttribute(e,n,r){return this.step(new Rl(e,n,r)),this}setDocAttribute(e,n){return this.step(new hd(e,n)),this}addNodeMark(e,n){return this.step(new vi(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof Ot)n.isInSet(r.marks)&&this.step(new Ao(e,n));else{let a=r.marks,i,o=[];for(;i=n.isInSet(a);)o.push(new Ao(e,i)),a=i.removeFromSet(a);for(let c=o.length-1;c>=0;c--)this.step(o[c])}return this}split(e,n=1,r){return CO(this,e,n,r),this}addMark(e,n,r){return gO(this,e,n,r),this}removeMark(e,n,r){return xO(this,e,n,r),this}clearIncompatible(e,n,r){return d0(this,e,n,r),this}}const Ym=Object.create(null);class tt{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new xS(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n=0;i--){let o=n<0?wl(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):wl(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Fr(e.node(0))}static atStart(e){return wl(e,e,0,0,1)||new Fr(e)}static atEnd(e){return wl(e,e,e.content.size,e.childCount,-1)||new Fr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ym[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Ym)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ym[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Qe.between(this.$anchor,this.$head).getBookmark()}}tt.prototype.visible=!0;class xS{constructor(e,n){this.$from=e,this.$to=n}}let C1=!1;function E1(t){!C1&&!t.parent.inlineContent&&(C1=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Qe extends tt{constructor(e,n=e){E1(e),E1(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return tt.near(r);let a=e.resolve(n.map(this.anchor));return new Qe(a.parent.inlineContent?a:r,r)}replace(e,n=Re.empty){if(super.replace(e,n),n==Re.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Qe&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Mf(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Qe(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let a=e.resolve(n);return new this(a,r==n?a:e.resolve(r))}static between(e,n,r){let a=e.pos-n.pos;if((!r||a)&&(r=a>=0?1:-1),!n.parent.inlineContent){let i=tt.findFrom(n,r,!0)||tt.findFrom(n,-r,!0);if(i)n=i.$head;else return tt.near(n,r)}return e.parent.inlineContent||(a==0?e=n:(e=(tt.findFrom(e,-r,!0)||tt.findFrom(e,r,!0)).$anchor,e.pos0?0:1);a>0?o=0;o+=a){let c=e.child(o);if(c.isAtom){if(!i&&Je.isSelectable(c))return Je.create(t,n-(a<0?c.nodeSize:0))}else{let u=wl(t,c,n+a,a<0?c.childCount:0,a,i);if(u)return u}n+=c.nodeSize*a}return null}function T1(t,e,n){let r=t.steps.length-1;if(r{o==null&&(o=f)}),t.setSelection(tt.near(t.doc.resolve(o),n))}const M1=1,Bu=2,A1=4;class _O extends h0{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Bu,this}ensureMarks(e){return Ot.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Bu)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Bu,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Ot.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let a=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(a.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(n);i=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,a.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(tt.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=A1,this}get scrolledIntoView(){return(this.updated&A1)>0}}function I1(t,e){return!e||!t?t:t.bind(e)}class Vc{constructor(e,n,r){this.name=e,this.init=I1(n.init,r),this.apply=I1(n.apply,r)}}const zO=[new Vc("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Vc("selection",{init(t,e){return t.selection||tt.atStart(e.doc)},apply(t){return t.selection}}),new Vc("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Vc("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Qm{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=zO.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Vc(r.key,r.spec.state,r))})}}class Ml{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let a=e[r],i=a.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(a,this[a.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let a=new Qm(e.schema,e.plugins),i=new Ml(a);return a.fields.forEach(o=>{if(o.name=="doc")i.doc=Ca.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=tt.fromJSON(i.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let c in r){let u=r[c],h=u.spec.state;if(u.key==o.name&&h&&h.fromJSON&&Object.prototype.hasOwnProperty.call(n,c)){i[o.name]=h.fromJSON.call(u,e,n[c],i);return}}i[o.name]=o.init(e,i)}}),i}}function yS(t,e,n){for(let r in t){let a=t[r];a instanceof Function?a=a.bind(e):r=="handleDOMEvents"&&(a=yS(a,e,{})),n[r]=a}return n}class Ut{constructor(e){this.spec=e,this.props={},e.props&&yS(e.props,this,this.props),this.key=e.key?e.key.key:bS("plugin")}getState(e){return e[this.key]}}const Xm=Object.create(null);function bS(t){return t in Xm?t+"$"+ ++Xm[t]:(Xm[t]=0,t+"$")}class Yt{constructor(e="key"){this.key=bS(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const p0=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function vS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const NS=(t,e,n)=>{let r=vS(t,n);if(!r)return!1;let a=m0(r);if(!a){let o=r.blockRange(),c=o&&Xl(o);return c==null?!1:(e&&e(t.tr.lift(o,c).scrollIntoView()),!0)}let i=a.nodeBefore;if(AS(t,a,e,-1))return!0;if(r.parent.content.size==0&&(zl(i,"end")||Je.isSelectable(i)))for(let o=r.depth;;o--){let c=Tf(t.doc,r.before(o),r.after(o),Re.empty);if(c&&c.slice.size1)break}return i.isAtom&&a.depth==r.depth-1?(e&&e(t.tr.delete(a.pos-i.nodeSize,a.pos).scrollIntoView()),!0):!1},$O=(t,e,n)=>{let r=vS(t,n);if(!r)return!1;let a=m0(r);return a?wS(t,a,e):!1},FO=(t,e,n)=>{let r=kS(t,n);if(!r)return!1;let a=g0(r);return a?wS(t,a,e):!1};function wS(t,e,n){let r=e.nodeBefore,a=r,i=e.pos-1;for(;!a.isTextblock;i--){if(a.type.spec.isolating)return!1;let f=a.lastChild;if(!f)return!1;a=f}let o=e.nodeAfter,c=o,u=e.pos+1;for(;!c.isTextblock;u++){if(c.type.spec.isolating)return!1;let f=c.firstChild;if(!f)return!1;c=f}let h=Tf(t.doc,i,u,Re.empty);if(!h||h.from!=i||h instanceof Dn&&h.slice.size>=u-i)return!1;if(n){let f=t.tr.step(h);f.setSelection(Qe.create(f.doc,i)),n(f.scrollIntoView())}return!0}function zl(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const jS=(t,e,n)=>{let{$head:r,empty:a}=t.selection,i=r;if(!a)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=m0(r)}let o=i&&i.nodeBefore;return!o||!Je.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Je.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function m0(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function kS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=kS(t,n);if(!r)return!1;let a=g0(r);if(!a)return!1;let i=a.nodeAfter;if(AS(t,a,e,1))return!0;if(r.parent.content.size==0&&(zl(i,"start")||Je.isSelectable(i))){let o=Tf(t.doc,r.before(),r.after(),Re.empty);if(o&&o.slice.size{let{$head:r,empty:a}=t.selection,i=r;if(!a)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let n=t.selection,r=n instanceof Je,a;if(r){if(n.node.isTextblock||!_i(t.doc,n.from))return!1;a=n.from}else if(a=Ef(t.doc,n.from,-1),a==null)return!1;if(e){let i=t.tr.join(a);r&&i.setSelection(Je.create(i.doc,a-t.doc.resolve(a).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},VO=(t,e)=>{let n=t.selection,r;if(n instanceof Je){if(n.node.isTextblock||!_i(t.doc,n.to))return!1;r=n.to}else if(r=Ef(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},HO=(t,e)=>{let{$from:n,$to:r}=t.selection,a=n.blockRange(r),i=a&&Xl(a);return i==null?!1:(e&&e(t.tr.lift(a,i).scrollIntoView()),!0)},ES=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(` -`).scrollIntoView()),!0)};function x0(t){for(let e=0;e{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let a=n.node(-1),i=n.indexAfter(-1),o=x0(a.contentMatchAt(i));if(!o||!a.canReplaceWith(i,i,o))return!1;if(e){let c=n.after(),u=t.tr.replaceWith(c,c,o.createAndFill());u.setSelection(tt.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},TS=(t,e)=>{let n=t.selection,{$from:r,$to:a}=n;if(n instanceof Fr||r.parent.inlineContent||a.parent.inlineContent)return!1;let i=x0(a.parent.contentMatchAt(a.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&a.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Ea(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),a=r&&Xl(r);return a==null?!1:(e&&e(t.tr.lift(r,a).scrollIntoView()),!0)};function UO(t){return(e,n)=>{let{$from:r,$to:a}=e.selection;if(e.selection instanceof Je&&e.selection.node.isBlock)return!r.parentOffset||!Ea(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],o,c,u=!1,h=!1;for(let y=r.depth;;y--)if(r.node(y).isBlock){u=r.end(y)==r.pos+(r.depth-y),h=r.start(y)==r.pos-(r.depth-y),c=x0(r.node(y-1).contentMatchAt(r.indexAfter(y-1))),i.unshift(u&&c?{type:c}:null),o=y;break}else{if(y==1)return!1;i.unshift(null)}let f=e.tr;(e.selection instanceof Qe||e.selection instanceof Fr)&&f.deleteSelection();let m=f.mapping.map(r.pos),g=Ea(f.doc,m,i.length,i);if(g||(i[0]=c?{type:c}:null,g=Ea(f.doc,m,i.length,i)),!g)return!1;if(f.split(m,i.length,i),!u&&h&&r.node(o).type!=c){let y=f.mapping.map(r.before(o)),v=f.doc.resolve(y);c&&r.node(o-1).canReplaceWith(v.index(),v.index()+1,c)&&f.setNodeMarkup(f.mapping.map(r.before(o)),c)}return n&&n(f.scrollIntoView()),!0}}const KO=UO(),qO=(t,e)=>{let{$from:n,to:r}=t.selection,a,i=n.sharedDepth(r);return i==0?!1:(a=n.before(i),e&&e(t.tr.setSelection(Je.create(t.doc,a))),!0)};function GO(t,e,n){let r=e.nodeBefore,a=e.nodeAfter,i=e.index();return!r||!a||!r.type.compatibleContent(a.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(a.isTextblock||_i(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function AS(t,e,n,r){let a=e.nodeBefore,i=e.nodeAfter,o,c,u=a.type.spec.isolating||i.type.spec.isolating;if(!u&&GO(t,e,n))return!0;let h=!u&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(o=(c=a.contentMatchAt(a.childCount)).findWrapping(i.type))&&c.matchType(o[0]||i.type).validEnd){if(n){let y=e.pos+i.nodeSize,v=xe.empty;for(let k=o.length-1;k>=0;k--)v=xe.from(o[k].create(null,v));v=xe.from(a.copy(v));let w=t.tr.step(new Ln(e.pos-1,y,e.pos,y,new Re(v,1,0),o.length,!0)),N=w.doc.resolve(y+2*o.length);N.nodeAfter&&N.nodeAfter.type==a.type&&_i(w.doc,N.pos)&&w.join(N.pos),n(w.scrollIntoView())}return!0}let f=i.type.spec.isolating||r>0&&u?null:tt.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),g=m&&Xl(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(h&&zl(i,"start",!0)&&zl(a,"end")){let y=a,v=[];for(;v.push(y),!y.isTextblock;)y=y.lastChild;let w=i,N=1;for(;!w.isTextblock;w=w.firstChild)N++;if(y.canReplace(y.childCount,y.childCount,w.content)){if(n){let k=xe.empty;for(let E=v.length-1;E>=0;E--)k=xe.from(v[E].copy(k));let C=t.tr.step(new Ln(e.pos-v.length,e.pos+i.nodeSize,e.pos+N,e.pos+i.nodeSize-N,new Re(k,v.length,0),0,!0));n(C.scrollIntoView())}return!0}}return!1}function IS(t){return function(e,n){let r=e.selection,a=t<0?r.$from:r.$to,i=a.depth;for(;a.node(i).isInline;){if(!i)return!1;i--}return a.node(i).isTextblock?(n&&n(e.tr.setSelection(Qe.create(e.doc,t<0?a.start(i):a.end(i)))),!0):!1}}const JO=IS(-1),YO=IS(1);function QO(t,e=null){return function(n,r){let{$from:a,$to:i}=n.selection,o=a.blockRange(i),c=o&&u0(o,t,e);return c?(r&&r(n.tr.wrap(o,c).scrollIntoView()),!0):!1}}function R1(t,e=null){return function(n,r){let a=!1;for(let i=0;i{if(a)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)a=!0;else{let f=n.doc.resolve(h),m=f.index();a=f.parent.canReplaceWith(m,m+1,t)}})}if(!a)return!1;if(r){let i=n.tr;for(let o=0;o=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let u=o.resolve(e.start-2);i=new jh(u,u,e.depth),e.endIndex=0;f--)i=xe.from(n[f].type.create(n[f].attrs,i));t.step(new Ln(e.start-(r?2:0),e.end,e.start,e.end,new Re(i,0,0),n.length,!0));let o=0;for(let f=0;fo.childCount>0&&o.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?nD(e,n,t,i):rD(e,n,i):!0:!1}}function nD(t,e,n,r){let a=t.tr,i=r.end,o=r.$to.end(r.depth);iw;v--)y-=a.child(v).nodeSize,r.delete(y-1,y+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,u=n.endIndex==a.childCount,h=i.node(-1),f=i.index(-1);if(!h.canReplace(f+(c?0:1),f+1,o.content.append(u?xe.empty:xe.from(a))))return!1;let m=i.pos,g=m+o.nodeSize;return r.step(new Ln(m-(c?1:0),g+(u?1:0),m+1,g-1,new Re((c?xe.empty:xe.from(a.copy(xe.empty))).append(u?xe.empty:xe.from(a.copy(xe.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function sD(t){return function(e,n){let{$from:r,$to:a}=e.selection,i=r.blockRange(a,h=>h.childCount>0&&h.firstChild.type==t);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let c=i.parent,u=c.child(o-1);if(u.type!=t)return!1;if(n){let h=u.lastChild&&u.lastChild.type==c.type,f=xe.from(h?t.create():null),m=new Re(xe.from(t.create(null,xe.from(c.type.create(null,f)))),h?3:1,0),g=i.start,y=i.end;n(e.tr.step(new Ln(g-(h?3:1),y,g,y,m,1,!0)).scrollIntoView())}return!0}}const Hn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},$l=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Zg=null;const va=function(t,e,n){let r=Zg||(Zg=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},aD=function(){Zg=null},Io=function(t,e,n,r){return n&&(P1(t,e,n,r,-1)||P1(t,e,n,r,1))},iD=/^(img|br|input|textarea|hr)$/i;function P1(t,e,n,r,a){for(var i;;){if(t==n&&e==r)return!0;if(e==(a<0?0:Xr(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Ed(t)||iD.test(t.nodeName)||t.contentEditable=="false")return!1;e=Hn(t)+(a<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(a<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=a;else return!1;else t=o,e=a<0?Xr(t):0}else return!1}}function Xr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function oD(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Xr(t)}else if(t.parentNode&&!Ed(t))e=Hn(t),t=t.parentNode;else return null}}function lD(t,e){for(;;){if(t.nodeType==3&&e2),Qr=Fl||(qs?/Mac/.test(qs.platform):!1),OS=qs?/Win/.test(qs.platform):!1,ka=/Android \d/.test(zi),Td=!!O1&&"webkitFontSmoothing"in O1.documentElement.style,hD=Td?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function fD(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function ma(t,e){return typeof t=="number"?t:t[e]}function pD(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function D1(t,e,n){let r=t.someProp("scrollThreshold")||0,a=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=$l(o);continue}let c=o,u=c==i.body,h=u?fD(i):pD(c),f=0,m=0;if(e.toph.bottom-ma(r,"bottom")&&(m=e.bottom-e.top>h.bottom-h.top?e.top+ma(a,"top")-h.top:e.bottom-h.bottom+ma(a,"bottom")),e.lefth.right-ma(r,"right")&&(f=e.right-h.right+ma(a,"right")),f||m)if(u)i.defaultView.scrollBy(f,m);else{let y=c.scrollLeft,v=c.scrollTop;m&&(c.scrollTop+=m),f&&(c.scrollLeft+=f);let w=c.scrollLeft-y,N=c.scrollTop-v;e={left:e.left-w,top:e.top-N,right:e.right-w,bottom:e.bottom-N}}let g=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(g))break;o=g=="absolute"?o.offsetParent:$l(o)}}function mD(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,a;for(let i=(e.left+e.right)/2,o=n+1;o=n-20){r=c,a=u.top;break}}return{refDOM:r,refTop:a,stack:DS(t.dom)}}function DS(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=$l(r));return e}function gD({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;LS(n,r==0?0:r-e)}function LS(t,e){for(let n=0;n=c){o=Math.max(v.bottom,o),c=Math.min(v.top,c);let w=v.left>e.left?v.left-e.left:v.right=(v.left+v.right)/2?1:0));continue}}else v.top>e.top&&!u&&v.left<=e.left&&v.right>=e.left&&(u=f,h={left:Math.max(v.left,Math.min(v.right,e.left)),top:v.top});!n&&(e.left>=v.right&&e.top>=v.top||e.left>=v.left&&e.top>=v.bottom)&&(i=m+1)}}return!n&&u&&(n=u,a=h,r=0),n&&n.nodeType==3?yD(n,a):!n||r&&n.nodeType==1?{node:t,offset:i}:_S(n,a)}function yD(t,e){let n=t.nodeValue.length,r=document.createRange(),a;for(let i=0;i=(o.left+o.right)/2?1:0)};break}}return r.detach(),a||{node:t,offset:0}}function b0(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function bD(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,a,i)}function ND(t,e,n,r){let a=-1;for(let i=e,o=!1;i!=t.dom;){let c=t.docView.nearestDesc(i,!0),u;if(!c)return null;if(c.dom.nodeType==1&&(c.node.isBlock&&c.parent||!c.contentDOM)&&((u=c.dom.getBoundingClientRect()).width||u.height)&&(c.node.isBlock&&c.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(c.dom.nodeName)&&(!o&&u.left>r.left||u.top>r.top?a=c.posBefore:(!o&&u.right-1?a:t.docView.posFromDOM(e,n,-1)}function zS(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&a++}let h;Td&&a&&r.nodeType==1&&(h=r.childNodes[a-1]).nodeType==1&&h.contentEditable=="false"&&h.getBoundingClientRect().top>=e.top&&a--,r==t.dom&&a==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?c=t.state.doc.content.size:(a==0||r.nodeType!=1||r.childNodes[a-1].nodeName!="BR")&&(c=ND(t,r,a,e))}c==null&&(c=vD(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function L1(t){return t.top=0&&a==r.nodeValue.length?(u--,f=1):n<0?u--:h++,Dc(ci(va(r,u,h),f),f<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&a&&(n<0||a==Xr(r))){let u=r.childNodes[a-1];if(u.nodeType==1)return Zm(u.getBoundingClientRect(),!1)}if(i==null&&a=0)}if(i==null&&a&&(n<0||a==Xr(r))){let u=r.childNodes[a-1],h=u.nodeType==3?va(u,Xr(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(h)return Dc(ci(h,1),!1)}if(i==null&&a=0)}function Dc(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Zm(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function FS(t,e,n){let r=t.state,a=t.root.activeElement;r!=e&&t.updateState(e),a!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),a!=t.dom&&a&&a.focus()}}function kD(t,e,n){let r=e.selection,a=n=="up"?r.$from:r.$to;return FS(t,e,()=>{let{node:i}=t.docView.domFromPos(a.pos,n=="up"?-1:1);for(;;){let c=t.docView.nearestDesc(i,!0);if(!c)break;if(c.node.isBlock){i=c.contentDOM||c.dom;break}i=c.dom.parentNode}let o=$S(t,a.pos,1);for(let c=i.firstChild;c;c=c.nextSibling){let u;if(c.nodeType==1)u=c.getClientRects();else if(c.nodeType==3)u=va(c,0,c.nodeValue.length).getClientRects();else continue;for(let h=0;hf.top+1&&(n=="up"?o.top-f.top>(f.bottom-o.top)*2:f.bottom-o.bottom>(o.bottom-f.top)*2))return!1}}return!0})}const SD=/[\u0590-\u08ac]/;function CD(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let a=r.parentOffset,i=!a,o=a==r.parent.content.size,c=t.domSelection();return c?!SD.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?i:o:FS(t,e,()=>{let{focusNode:u,focusOffset:h,anchorNode:f,anchorOffset:m}=t.domSelectionRange(),g=c.caretBidiLevel;c.modify("move",n,"character");let y=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:v,focusOffset:w}=t.domSelectionRange(),N=v&&!y.contains(v.nodeType==1?v:v.parentNode)||u==v&&h==w;try{c.collapse(f,m),u&&(u!=f||h!=m)&&c.extend&&c.extend(u,h)}catch{}return g!=null&&(c.caretBidiLevel=g),N}):r.pos==r.start()||r.pos==r.end()}let _1=null,z1=null,$1=!1;function ED(t,e,n){return _1==e&&z1==n?$1:(_1=e,z1=n,$1=n=="up"||n=="down"?kD(t,e,n):CD(t,e,n))}const es=0,F1=1,mo=2,Gs=3;class Md{constructor(e,n,r,a){this.parent=e,this.children=n,this.dom=r,this.contentDOM=a,this.dirty=es,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;nHn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){a=!1;break}if(i.previousSibling)break}if(a==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){a=!0;break}if(i.nextSibling)break}}return a??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,a=e;a;a=a.parentNode){let i=this.getDesc(a),o;if(i&&(!n||i.node))if(r&&(o=i.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let a=e;a;a=a.parentNode){let i=this.getDesc(a);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;ne||o instanceof VS){a=e-i;break}i=c}if(a)return this.children[r].domFromPos(a-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof BS&&i.side>=0;r--);if(n<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&n&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?Hn(i.dom)+1:0}}else{let i,o=!0;for(;i=r=f&&n<=h-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,f);e=o;for(let m=c;m>0;m--){let g=this.children[m-1];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(1)){a=Hn(g.dom)+1;break}e-=g.size}a==-1&&(a=0)}if(a>-1&&(h>n||c==this.children.length-1)){n=h;for(let f=c+1;fv&&on){let v=c;c=u,u=v}let y=document.createRange();y.setEnd(u.node,u.offset),y.setStart(c.node,c.offset),h.removeAllRanges(),h.addRange(y)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,a=0;a=r:er){let c=r+i.border,u=o-i.border;if(e>=c&&n<=u){this.dirty=e==r||n==o?mo:F1,e==c&&n==u&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Gs:i.markDirty(e-c,n-c);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?mo:Gs}r=o}this.dirty=mo}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?mo:F1;n.dirty{if(!i)return a;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(o.nodeType!=1){let c=document.createElement("span");c.appendChild(o),o=c}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==es&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class TD extends Md{constructor(e,n,r,a){super(e,[],n,null),this.textDOM=r,this.text=a}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Ro extends Md{constructor(e,n,r,a,i){super(e,[],r,a),this.mark=n,this.spec=i}static create(e,n,r,a){let i=a.nodeViews[n.type.name],o=i&&i(n,a,r);return(!o||!o.dom)&&(o=$o.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Ro(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Gs||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Gs&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=es){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(i=sx(i,0,e,r));for(let c=0;c{if(!u)return o;if(u.parent)return u.parent.posBeforeChild(u)},r,a),f=h&&h.dom,m=h&&h.contentDOM;if(n.isText){if(!f)f=document.createTextNode(n.text);else if(f.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else f||({dom:f,contentDOM:m}=$o.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!m&&!n.isText&&f.nodeName!="BR"&&(f.hasAttribute("contenteditable")||(f.contentEditable="false"),n.type.spec.draggable&&(f.draggable=!0));let g=f;return f=US(f,r,n),h?u=new MD(e,n,r,a,f,m||null,g,h,i,o+1):n.isText?new If(e,n,r,a,f,g,i):new Ci(e,n,r,a,f,m||null,g,i,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>xe.empty)}return e}matchesNode(e,n,r){return this.dirty==es&&e.eq(this.node)&&Sh(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,a=n,i=e.composing?this.localCompositionInfo(e,n):null,o=i&&i.pos>-1?i:null,c=i&&i.pos<0,u=new ID(this,o&&o.node,e);OD(this.node,this.innerDeco,(h,f,m)=>{h.spec.marks?u.syncToMarks(h.spec.marks,r,e,f):h.type.side>=0&&!m&&u.syncToMarks(f==this.node.childCount?Ot.none:this.node.child(f).marks,r,e,f),u.placeWidget(h,e,a)},(h,f,m,g)=>{u.syncToMarks(h.marks,r,e,g);let y;u.findNodeMatch(h,f,m,g)||c&&e.state.selection.from>a&&e.state.selection.to-1&&u.updateNodeAt(h,f,m,y,e)||u.updateNextNode(h,f,m,e,g,a)||u.addNode(h,f,m,e,a),a+=h.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==mo)&&(o&&this.protectLocalComposition(e,o),HS(this.contentDOM,this.children,e),Fl&&DD(this.dom))}localCompositionInfo(e,n){let{from:r,to:a}=e.state.selection;if(!(e.state.selection instanceof Qe)||rn+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,c=LD(this.node.content,o,r-n,a-n);return c<0?null:{node:i,pos:c,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:a}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new TD(this,i,n,a);e.input.compositionNodes.push(o),this.children=sx(this.children,r,r+a.length,e,o)}update(e,n,r,a){return this.dirty==Gs||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,a),!0)}updateInner(e,n,r,a){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(a,this.posAtStart),this.dirty=es}updateOuterDeco(e){if(Sh(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=WS(this.dom,this.nodeDOM,rx(this.outerDeco,this.node,n),rx(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function B1(t,e,n,r,a){US(r,e,t);let i=new Ci(void 0,t,e,n,r,r,r,a,0);return i.contentDOM&&i.updateChildren(a,0),i}class If extends Ci{constructor(e,n,r,a,i,o,c){super(e,n,r,a,i,null,o,c,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,a){return this.dirty==Gs||this.dirty!=es&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=es||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,a.trackWrites==this.nodeDOM&&(a.trackWrites=null)),this.node=e,this.dirty=es,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let a=this.node.cut(e,n),i=document.createTextNode(a.text);return new If(this.parent,a,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Gs)}get domAtom(){return!1}isText(e){return this.node.text==e}}class VS extends Md{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==es&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class MD extends Ci{constructor(e,n,r,a,i,o,c,u,h,f){super(e,n,r,a,i,o,c,h,f),this.spec=u}update(e,n,r,a){if(this.dirty==Gs)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,a),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,a)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,a){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,a)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function HS(t,e,n){let r=t.firstChild,a=!1;for(let i=0;i>1,c=Math.min(o,e.length);for(;i-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let f=Ro.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,f),this.top=f,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,a){let i=-1,o;if(a>=this.preMatch.index&&(o=this.preMatch.matches[a-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))i=this.top.children.indexOf(o,this.index);else for(let c=this.index,u=Math.min(this.top.children.length,c+5);c0;){let c;for(;;)if(r){let h=n.children[r-1];if(h instanceof Ro)n=h,r=h.children.length;else{c=h,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=c.node;if(u){if(u!=t.child(a-1))break;--a,i.set(c,a),o.push(c)}}return{index:a,matched:i,matches:o.reverse()}}function PD(t,e){return t.type.side-e.type.side}function OD(t,e,n,r){let a=e.locals(t),i=0;if(a.length==0){for(let h=0;hi;)c.push(a[o++]);let v=i+g.nodeSize;if(g.isText){let N=v;o!N.inline):c.slice();r(g,w,e.forChild(i,g),y),i=v}}function DD(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function LD(t,e,n,r){for(let a=0,i=0;a=n){if(i>=r&&u.slice(r-e.length-c,r-c)==e)return r-e.length;let h=c=0&&h+e.length+c>=n)return c+h;if(n==r&&u.length>=r+e.length-c&&u.slice(r-c,r-c+e.length)==e)return r}}return-1}function sx(t,e,n,r,a){let i=[];for(let o=0,c=0;o=n||f<=e?i.push(u):(hn&&i.push(u.slice(n-h,u.size,r)))}return i}function v0(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let a=t.docView.nearestDesc(n.focusNode),i=a&&a.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let c=r.resolve(o),u,h;if(Af(n)){for(u=o;a&&!a.node;)a=a.parent;let m=a.node;if(a&&m.isAtom&&Je.isSelectable(m)&&a.parent&&!(m.isInline&&cD(n.focusNode,n.focusOffset,a.dom))){let g=a.posBefore;h=new Je(o==g?c:r.resolve(g))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let m=o,g=o;for(let y=0;y{(n.anchorNode!=r||n.anchorOffset!=a)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!KS(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function zD(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Hn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&Mr&&Si<=11&&(n.disabled=!0,n.disabled=!1)}function qS(t,e){if(e instanceof Je){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(K1(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else K1(t)}function K1(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function N0(t,e,n,r){return t.someProp("createSelectionBetween",a=>a(t,e,n))||Qe.between(e,n,r)}function q1(t){return t.editable&&!t.hasFocus()?!1:GS(t)}function GS(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function $D(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Io(e.node,e.offset,n.anchorNode,n.anchorOffset)}function ax(t,e){let{$anchor:n,$head:r}=t.selection,a=e>0?n.max(r):n.min(r),i=a.parent.inlineContent?a.depth?t.doc.resolve(e>0?a.after():a.before()):null:a;return i&&tt.findFrom(i,e)}function di(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function G1(t,e,n){let r=t.state.selection;if(r instanceof Qe)if(n.indexOf("s")>-1){let{$head:a}=r,i=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(a.pos+i.nodeSize*(e<0?-1:1));return di(t,new Qe(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let a=ax(t.state,e);return a&&a instanceof Je?di(t,a):!1}else if(!(Qr&&n.indexOf("m")>-1)){let a=r.$head,i=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter,o;if(!i||i.isText)return!1;let c=e<0?a.pos-i.nodeSize:a.pos;return i.isAtom||(o=t.docView.descAt(c))&&!o.contentDOM?Je.isSelectable(i)?di(t,new Je(e<0?t.state.doc.resolve(a.pos-i.nodeSize):a)):Td?di(t,new Qe(t.state.doc.resolve(e<0?c:c+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Je&&r.node.isInline)return di(t,new Qe(e>0?r.$to:r.$from));{let a=ax(t.state,e);return a?di(t,a):!1}}}function Ch(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Qc(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Nl(t,e){return e<0?FD(t):BD(t)}function FD(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a,i,o=!1;for(Zr&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(Qc(c,-1))a=n,i=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(JS(n))break;{let c=n.previousSibling;for(;c&&Qc(c,-1);)a=n.parentNode,i=Hn(c),c=c.previousSibling;if(c)n=c,r=Ch(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?ix(t,n,r):a&&ix(t,a,i)}function BD(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a=Ch(n),i,o;for(;;)if(r{t.state==a&&Ta(t)},50)}function J1(t,e){let n=t.state.doc.resolve(e);if(!(Un||OS)&&n.parent.inlineContent){let a=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>a.top&&o1)return i.lefta.top&&o1)return i.left>a.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Y1(t,e,n){let r=t.state.selection;if(r instanceof Qe&&!r.empty||n.indexOf("s")>-1||Qr&&n.indexOf("m")>-1)return!1;let{$from:a,$to:i}=r;if(!a.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=ax(t.state,e);if(o&&o instanceof Je)return di(t,o)}if(!a.parent.inlineContent){let o=e<0?a:i,c=r instanceof Fr?tt.near(o,e):tt.findFrom(o,e);return c?di(t,c):!1}return!1}function Q1(t,e){if(!(t.state.selection instanceof Qe))return!0;let{$head:n,$anchor:r,empty:a}=t.state.selection;if(!n.sameParent(r))return!0;if(!a)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function X1(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function WD(t){if(!sr||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;X1(t,r,"true"),setTimeout(()=>X1(t,r,"false"),20)}return!1}function UD(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function KD(t,e){let n=e.keyCode,r=UD(e);if(n==8||Qr&&n==72&&r=="c")return Q1(t,-1)||Nl(t,-1);if(n==46&&!e.shiftKey||Qr&&n==68&&r=="c")return Q1(t,1)||Nl(t,1);if(n==13||n==27)return!0;if(n==37||Qr&&n==66&&r=="c"){let a=n==37?J1(t,t.state.selection.from)=="ltr"?-1:1:-1;return G1(t,a,r)||Nl(t,a)}else if(n==39||Qr&&n==70&&r=="c"){let a=n==39?J1(t,t.state.selection.from)=="ltr"?1:-1:1;return G1(t,a,r)||Nl(t,a)}else{if(n==38||Qr&&n==80&&r=="c")return Y1(t,-1,r)||Nl(t,-1);if(n==40||Qr&&n==78&&r=="c")return WD(t)||Y1(t,1,r)||Nl(t,1);if(r==(Qr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function w0(t,e){t.someProp("transformCopied",y=>{e=y(e,t)});let n=[],{content:r,openStart:a,openEnd:i}=e;for(;a>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){a--,i--;let y=r.firstChild;n.push(y.type.name,y.attrs!=y.type.defaultAttrs?y.attrs:null),r=y.content}let o=t.someProp("clipboardSerializer")||$o.fromSchema(t.state.schema),c=t2(),u=c.createElement("div");u.appendChild(o.serializeFragment(r,{document:c}));let h=u.firstChild,f,m=0;for(;h&&h.nodeType==1&&(f=e2[h.nodeName.toLowerCase()]);){for(let y=f.length-1;y>=0;y--){let v=c.createElement(f[y]);for(;u.firstChild;)v.appendChild(u.firstChild);u.appendChild(v),m++}h=u.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${a} ${i}${m?` -${m}`:""} ${JSON.stringify(n)}`);let g=t.someProp("clipboardTextSerializer",y=>y(e,t))||e.content.textBetween(0,e.content.size,` +`).scrollIntoView()),!0)};function x0(t){for(let e=0;e{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let a=n.node(-1),i=n.indexAfter(-1),o=x0(a.contentMatchAt(i));if(!o||!a.canReplaceWith(i,i,o))return!1;if(e){let c=n.after(),u=t.tr.replaceWith(c,c,o.createAndFill());u.setSelection(tt.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},TS=(t,e)=>{let n=t.selection,{$from:r,$to:a}=n;if(n instanceof Fr||r.parent.inlineContent||a.parent.inlineContent)return!1;let i=x0(a.parent.contentMatchAt(a.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&a.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Ea(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),a=r&&Xl(r);return a==null?!1:(e&&e(t.tr.lift(r,a).scrollIntoView()),!0)};function UO(t){return(e,n)=>{let{$from:r,$to:a}=e.selection;if(e.selection instanceof Je&&e.selection.node.isBlock)return!r.parentOffset||!Ea(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],o,c,u=!1,h=!1;for(let y=r.depth;;y--)if(r.node(y).isBlock){u=r.end(y)==r.pos+(r.depth-y),h=r.start(y)==r.pos-(r.depth-y),c=x0(r.node(y-1).contentMatchAt(r.indexAfter(y-1))),i.unshift(u&&c?{type:c}:null),o=y;break}else{if(y==1)return!1;i.unshift(null)}let f=e.tr;(e.selection instanceof Qe||e.selection instanceof Fr)&&f.deleteSelection();let m=f.mapping.map(r.pos),g=Ea(f.doc,m,i.length,i);if(g||(i[0]=c?{type:c}:null,g=Ea(f.doc,m,i.length,i)),!g)return!1;if(f.split(m,i.length,i),!u&&h&&r.node(o).type!=c){let y=f.mapping.map(r.before(o)),v=f.doc.resolve(y);c&&r.node(o-1).canReplaceWith(v.index(),v.index()+1,c)&&f.setNodeMarkup(f.mapping.map(r.before(o)),c)}return n&&n(f.scrollIntoView()),!0}}const KO=UO(),qO=(t,e)=>{let{$from:n,to:r}=t.selection,a,i=n.sharedDepth(r);return i==0?!1:(a=n.before(i),e&&e(t.tr.setSelection(Je.create(t.doc,a))),!0)};function GO(t,e,n){let r=e.nodeBefore,a=e.nodeAfter,i=e.index();return!r||!a||!r.type.compatibleContent(a.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(a.isTextblock||_i(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function AS(t,e,n,r){let a=e.nodeBefore,i=e.nodeAfter,o,c,u=a.type.spec.isolating||i.type.spec.isolating;if(!u&&GO(t,e,n))return!0;let h=!u&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(o=(c=a.contentMatchAt(a.childCount)).findWrapping(i.type))&&c.matchType(o[0]||i.type).validEnd){if(n){let y=e.pos+i.nodeSize,v=xe.empty;for(let k=o.length-1;k>=0;k--)v=xe.from(o[k].create(null,v));v=xe.from(a.copy(v));let w=t.tr.step(new Ln(e.pos-1,y,e.pos,y,new Re(v,1,0),o.length,!0)),N=w.doc.resolve(y+2*o.length);N.nodeAfter&&N.nodeAfter.type==a.type&&_i(w.doc,N.pos)&&w.join(N.pos),n(w.scrollIntoView())}return!0}let f=i.type.spec.isolating||r>0&&u?null:tt.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),g=m&&Xl(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(h&&zl(i,"start",!0)&&zl(a,"end")){let y=a,v=[];for(;v.push(y),!y.isTextblock;)y=y.lastChild;let w=i,N=1;for(;!w.isTextblock;w=w.firstChild)N++;if(y.canReplace(y.childCount,y.childCount,w.content)){if(n){let k=xe.empty;for(let E=v.length-1;E>=0;E--)k=xe.from(v[E].copy(k));let C=t.tr.step(new Ln(e.pos-v.length,e.pos+i.nodeSize,e.pos+N,e.pos+i.nodeSize-N,new Re(k,v.length,0),0,!0));n(C.scrollIntoView())}return!0}}return!1}function IS(t){return function(e,n){let r=e.selection,a=t<0?r.$from:r.$to,i=a.depth;for(;a.node(i).isInline;){if(!i)return!1;i--}return a.node(i).isTextblock?(n&&n(e.tr.setSelection(Qe.create(e.doc,t<0?a.start(i):a.end(i)))),!0):!1}}const JO=IS(-1),YO=IS(1);function QO(t,e=null){return function(n,r){let{$from:a,$to:i}=n.selection,o=a.blockRange(i),c=o&&u0(o,t,e);return c?(r&&r(n.tr.wrap(o,c).scrollIntoView()),!0):!1}}function R1(t,e=null){return function(n,r){let a=!1;for(let i=0;i{if(a)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)a=!0;else{let f=n.doc.resolve(h),m=f.index();a=f.parent.canReplaceWith(m,m+1,t)}})}if(!a)return!1;if(r){let i=n.tr;for(let o=0;o=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let u=o.resolve(e.start-2);i=new jh(u,u,e.depth),e.endIndex=0;f--)i=xe.from(n[f].type.create(n[f].attrs,i));t.step(new Ln(e.start-(r?2:0),e.end,e.start,e.end,new Re(i,0,0),n.length,!0));let o=0;for(let f=0;fo.childCount>0&&o.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?nD(e,n,t,i):rD(e,n,i):!0:!1}}function nD(t,e,n,r){let a=t.tr,i=r.end,o=r.$to.end(r.depth);iw;v--)y-=a.child(v).nodeSize,r.delete(y-1,y+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,u=n.endIndex==a.childCount,h=i.node(-1),f=i.index(-1);if(!h.canReplace(f+(c?0:1),f+1,o.content.append(u?xe.empty:xe.from(a))))return!1;let m=i.pos,g=m+o.nodeSize;return r.step(new Ln(m-(c?1:0),g+(u?1:0),m+1,g-1,new Re((c?xe.empty:xe.from(a.copy(xe.empty))).append(u?xe.empty:xe.from(a.copy(xe.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function sD(t){return function(e,n){let{$from:r,$to:a}=e.selection,i=r.blockRange(a,h=>h.childCount>0&&h.firstChild.type==t);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let c=i.parent,u=c.child(o-1);if(u.type!=t)return!1;if(n){let h=u.lastChild&&u.lastChild.type==c.type,f=xe.from(h?t.create():null),m=new Re(xe.from(t.create(null,xe.from(c.type.create(null,f)))),h?3:1,0),g=i.start,y=i.end;n(e.tr.step(new Ln(g-(h?3:1),y,g,y,m,1,!0)).scrollIntoView())}return!0}}const Hn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},$l=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Zg=null;const va=function(t,e,n){let r=Zg||(Zg=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},aD=function(){Zg=null},Io=function(t,e,n,r){return n&&(P1(t,e,n,r,-1)||P1(t,e,n,r,1))},iD=/^(img|br|input|textarea|hr)$/i;function P1(t,e,n,r,a){for(var i;;){if(t==n&&e==r)return!0;if(e==(a<0?0:Zr(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Ed(t)||iD.test(t.nodeName)||t.contentEditable=="false")return!1;e=Hn(t)+(a<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(a<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=a;else return!1;else t=o,e=a<0?Zr(t):0}else return!1}}function Zr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function oD(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Zr(t)}else if(t.parentNode&&!Ed(t))e=Hn(t),t=t.parentNode;else return null}}function lD(t,e){for(;;){if(t.nodeType==3&&e2),Xr=Fl||(qs?/Mac/.test(qs.platform):!1),OS=qs?/Win/.test(qs.platform):!1,ka=/Android \d/.test(zi),Td=!!O1&&"webkitFontSmoothing"in O1.documentElement.style,hD=Td?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function fD(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function ma(t,e){return typeof t=="number"?t:t[e]}function pD(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function D1(t,e,n){let r=t.someProp("scrollThreshold")||0,a=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=$l(o);continue}let c=o,u=c==i.body,h=u?fD(i):pD(c),f=0,m=0;if(e.toph.bottom-ma(r,"bottom")&&(m=e.bottom-e.top>h.bottom-h.top?e.top+ma(a,"top")-h.top:e.bottom-h.bottom+ma(a,"bottom")),e.lefth.right-ma(r,"right")&&(f=e.right-h.right+ma(a,"right")),f||m)if(u)i.defaultView.scrollBy(f,m);else{let y=c.scrollLeft,v=c.scrollTop;m&&(c.scrollTop+=m),f&&(c.scrollLeft+=f);let w=c.scrollLeft-y,N=c.scrollTop-v;e={left:e.left-w,top:e.top-N,right:e.right-w,bottom:e.bottom-N}}let g=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(g))break;o=g=="absolute"?o.offsetParent:$l(o)}}function mD(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,a;for(let i=(e.left+e.right)/2,o=n+1;o=n-20){r=c,a=u.top;break}}return{refDOM:r,refTop:a,stack:DS(t.dom)}}function DS(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=$l(r));return e}function gD({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;LS(n,r==0?0:r-e)}function LS(t,e){for(let n=0;n=c){o=Math.max(v.bottom,o),c=Math.min(v.top,c);let w=v.left>e.left?v.left-e.left:v.right=(v.left+v.right)/2?1:0));continue}}else v.top>e.top&&!u&&v.left<=e.left&&v.right>=e.left&&(u=f,h={left:Math.max(v.left,Math.min(v.right,e.left)),top:v.top});!n&&(e.left>=v.right&&e.top>=v.top||e.left>=v.left&&e.top>=v.bottom)&&(i=m+1)}}return!n&&u&&(n=u,a=h,r=0),n&&n.nodeType==3?yD(n,a):!n||r&&n.nodeType==1?{node:t,offset:i}:_S(n,a)}function yD(t,e){let n=t.nodeValue.length,r=document.createRange(),a;for(let i=0;i=(o.left+o.right)/2?1:0)};break}}return r.detach(),a||{node:t,offset:0}}function b0(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function bD(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,a,i)}function ND(t,e,n,r){let a=-1;for(let i=e,o=!1;i!=t.dom;){let c=t.docView.nearestDesc(i,!0),u;if(!c)return null;if(c.dom.nodeType==1&&(c.node.isBlock&&c.parent||!c.contentDOM)&&((u=c.dom.getBoundingClientRect()).width||u.height)&&(c.node.isBlock&&c.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(c.dom.nodeName)&&(!o&&u.left>r.left||u.top>r.top?a=c.posBefore:(!o&&u.right-1?a:t.docView.posFromDOM(e,n,-1)}function zS(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&a++}let h;Td&&a&&r.nodeType==1&&(h=r.childNodes[a-1]).nodeType==1&&h.contentEditable=="false"&&h.getBoundingClientRect().top>=e.top&&a--,r==t.dom&&a==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?c=t.state.doc.content.size:(a==0||r.nodeType!=1||r.childNodes[a-1].nodeName!="BR")&&(c=ND(t,r,a,e))}c==null&&(c=vD(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function L1(t){return t.top=0&&a==r.nodeValue.length?(u--,f=1):n<0?u--:h++,Dc(ci(va(r,u,h),f),f<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&a&&(n<0||a==Zr(r))){let u=r.childNodes[a-1];if(u.nodeType==1)return Zm(u.getBoundingClientRect(),!1)}if(i==null&&a=0)}if(i==null&&a&&(n<0||a==Zr(r))){let u=r.childNodes[a-1],h=u.nodeType==3?va(u,Zr(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(h)return Dc(ci(h,1),!1)}if(i==null&&a=0)}function Dc(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Zm(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function FS(t,e,n){let r=t.state,a=t.root.activeElement;r!=e&&t.updateState(e),a!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),a!=t.dom&&a&&a.focus()}}function kD(t,e,n){let r=e.selection,a=n=="up"?r.$from:r.$to;return FS(t,e,()=>{let{node:i}=t.docView.domFromPos(a.pos,n=="up"?-1:1);for(;;){let c=t.docView.nearestDesc(i,!0);if(!c)break;if(c.node.isBlock){i=c.contentDOM||c.dom;break}i=c.dom.parentNode}let o=$S(t,a.pos,1);for(let c=i.firstChild;c;c=c.nextSibling){let u;if(c.nodeType==1)u=c.getClientRects();else if(c.nodeType==3)u=va(c,0,c.nodeValue.length).getClientRects();else continue;for(let h=0;hf.top+1&&(n=="up"?o.top-f.top>(f.bottom-o.top)*2:f.bottom-o.bottom>(o.bottom-f.top)*2))return!1}}return!0})}const SD=/[\u0590-\u08ac]/;function CD(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let a=r.parentOffset,i=!a,o=a==r.parent.content.size,c=t.domSelection();return c?!SD.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?i:o:FS(t,e,()=>{let{focusNode:u,focusOffset:h,anchorNode:f,anchorOffset:m}=t.domSelectionRange(),g=c.caretBidiLevel;c.modify("move",n,"character");let y=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:v,focusOffset:w}=t.domSelectionRange(),N=v&&!y.contains(v.nodeType==1?v:v.parentNode)||u==v&&h==w;try{c.collapse(f,m),u&&(u!=f||h!=m)&&c.extend&&c.extend(u,h)}catch{}return g!=null&&(c.caretBidiLevel=g),N}):r.pos==r.start()||r.pos==r.end()}let _1=null,z1=null,$1=!1;function ED(t,e,n){return _1==e&&z1==n?$1:(_1=e,z1=n,$1=n=="up"||n=="down"?kD(t,e,n):CD(t,e,n))}const ts=0,F1=1,mo=2,Gs=3;class Md{constructor(e,n,r,a){this.parent=e,this.children=n,this.dom=r,this.contentDOM=a,this.dirty=ts,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;nHn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){a=!1;break}if(i.previousSibling)break}if(a==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){a=!0;break}if(i.nextSibling)break}}return a??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,a=e;a;a=a.parentNode){let i=this.getDesc(a),o;if(i&&(!n||i.node))if(r&&(o=i.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let a=e;a;a=a.parentNode){let i=this.getDesc(a);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;ne||o instanceof VS){a=e-i;break}i=c}if(a)return this.children[r].domFromPos(a-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof BS&&i.side>=0;r--);if(n<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&n&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?Hn(i.dom)+1:0}}else{let i,o=!0;for(;i=r=f&&n<=h-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,f);e=o;for(let m=c;m>0;m--){let g=this.children[m-1];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(1)){a=Hn(g.dom)+1;break}e-=g.size}a==-1&&(a=0)}if(a>-1&&(h>n||c==this.children.length-1)){n=h;for(let f=c+1;fv&&on){let v=c;c=u,u=v}let y=document.createRange();y.setEnd(u.node,u.offset),y.setStart(c.node,c.offset),h.removeAllRanges(),h.addRange(y)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,a=0;a=r:er){let c=r+i.border,u=o-i.border;if(e>=c&&n<=u){this.dirty=e==r||n==o?mo:F1,e==c&&n==u&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Gs:i.markDirty(e-c,n-c);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?mo:Gs}r=o}this.dirty=mo}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?mo:F1;n.dirty{if(!i)return a;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(o.nodeType!=1){let c=document.createElement("span");c.appendChild(o),o=c}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==ts&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class TD extends Md{constructor(e,n,r,a){super(e,[],n,null),this.textDOM=r,this.text=a}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Ro extends Md{constructor(e,n,r,a,i){super(e,[],r,a),this.mark=n,this.spec=i}static create(e,n,r,a){let i=a.nodeViews[n.type.name],o=i&&i(n,a,r);return(!o||!o.dom)&&(o=$o.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Ro(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Gs||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Gs&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=ts){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(i=sx(i,0,e,r));for(let c=0;c{if(!u)return o;if(u.parent)return u.parent.posBeforeChild(u)},r,a),f=h&&h.dom,m=h&&h.contentDOM;if(n.isText){if(!f)f=document.createTextNode(n.text);else if(f.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else f||({dom:f,contentDOM:m}=$o.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!m&&!n.isText&&f.nodeName!="BR"&&(f.hasAttribute("contenteditable")||(f.contentEditable="false"),n.type.spec.draggable&&(f.draggable=!0));let g=f;return f=US(f,r,n),h?u=new MD(e,n,r,a,f,m||null,g,h,i,o+1):n.isText?new If(e,n,r,a,f,g,i):new Ci(e,n,r,a,f,m||null,g,i,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>xe.empty)}return e}matchesNode(e,n,r){return this.dirty==ts&&e.eq(this.node)&&Sh(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,a=n,i=e.composing?this.localCompositionInfo(e,n):null,o=i&&i.pos>-1?i:null,c=i&&i.pos<0,u=new ID(this,o&&o.node,e);OD(this.node,this.innerDeco,(h,f,m)=>{h.spec.marks?u.syncToMarks(h.spec.marks,r,e,f):h.type.side>=0&&!m&&u.syncToMarks(f==this.node.childCount?Ot.none:this.node.child(f).marks,r,e,f),u.placeWidget(h,e,a)},(h,f,m,g)=>{u.syncToMarks(h.marks,r,e,g);let y;u.findNodeMatch(h,f,m,g)||c&&e.state.selection.from>a&&e.state.selection.to-1&&u.updateNodeAt(h,f,m,y,e)||u.updateNextNode(h,f,m,e,g,a)||u.addNode(h,f,m,e,a),a+=h.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==mo)&&(o&&this.protectLocalComposition(e,o),HS(this.contentDOM,this.children,e),Fl&&DD(this.dom))}localCompositionInfo(e,n){let{from:r,to:a}=e.state.selection;if(!(e.state.selection instanceof Qe)||rn+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,c=LD(this.node.content,o,r-n,a-n);return c<0?null:{node:i,pos:c,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:a}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new TD(this,i,n,a);e.input.compositionNodes.push(o),this.children=sx(this.children,r,r+a.length,e,o)}update(e,n,r,a){return this.dirty==Gs||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,a),!0)}updateInner(e,n,r,a){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(a,this.posAtStart),this.dirty=ts}updateOuterDeco(e){if(Sh(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=WS(this.dom,this.nodeDOM,rx(this.outerDeco,this.node,n),rx(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function B1(t,e,n,r,a){US(r,e,t);let i=new Ci(void 0,t,e,n,r,r,r,a,0);return i.contentDOM&&i.updateChildren(a,0),i}class If extends Ci{constructor(e,n,r,a,i,o,c){super(e,n,r,a,i,null,o,c,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,a){return this.dirty==Gs||this.dirty!=ts&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=ts||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,a.trackWrites==this.nodeDOM&&(a.trackWrites=null)),this.node=e,this.dirty=ts,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let a=this.node.cut(e,n),i=document.createTextNode(a.text);return new If(this.parent,a,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Gs)}get domAtom(){return!1}isText(e){return this.node.text==e}}class VS extends Md{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ts&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class MD extends Ci{constructor(e,n,r,a,i,o,c,u,h,f){super(e,n,r,a,i,o,c,h,f),this.spec=u}update(e,n,r,a){if(this.dirty==Gs)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,a),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,a)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,a){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,a)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function HS(t,e,n){let r=t.firstChild,a=!1;for(let i=0;i>1,c=Math.min(o,e.length);for(;i-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let f=Ro.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,f),this.top=f,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,a){let i=-1,o;if(a>=this.preMatch.index&&(o=this.preMatch.matches[a-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))i=this.top.children.indexOf(o,this.index);else for(let c=this.index,u=Math.min(this.top.children.length,c+5);c0;){let c;for(;;)if(r){let h=n.children[r-1];if(h instanceof Ro)n=h,r=h.children.length;else{c=h,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=c.node;if(u){if(u!=t.child(a-1))break;--a,i.set(c,a),o.push(c)}}return{index:a,matched:i,matches:o.reverse()}}function PD(t,e){return t.type.side-e.type.side}function OD(t,e,n,r){let a=e.locals(t),i=0;if(a.length==0){for(let h=0;hi;)c.push(a[o++]);let v=i+g.nodeSize;if(g.isText){let N=v;o!N.inline):c.slice();r(g,w,e.forChild(i,g),y),i=v}}function DD(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function LD(t,e,n,r){for(let a=0,i=0;a=n){if(i>=r&&u.slice(r-e.length-c,r-c)==e)return r-e.length;let h=c=0&&h+e.length+c>=n)return c+h;if(n==r&&u.length>=r+e.length-c&&u.slice(r-c,r-c+e.length)==e)return r}}return-1}function sx(t,e,n,r,a){let i=[];for(let o=0,c=0;o=n||f<=e?i.push(u):(hn&&i.push(u.slice(n-h,u.size,r)))}return i}function v0(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let a=t.docView.nearestDesc(n.focusNode),i=a&&a.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let c=r.resolve(o),u,h;if(Af(n)){for(u=o;a&&!a.node;)a=a.parent;let m=a.node;if(a&&m.isAtom&&Je.isSelectable(m)&&a.parent&&!(m.isInline&&cD(n.focusNode,n.focusOffset,a.dom))){let g=a.posBefore;h=new Je(o==g?c:r.resolve(g))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let m=o,g=o;for(let y=0;y{(n.anchorNode!=r||n.anchorOffset!=a)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!KS(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function zD(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Hn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&Mr&&Si<=11&&(n.disabled=!0,n.disabled=!1)}function qS(t,e){if(e instanceof Je){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(K1(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else K1(t)}function K1(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function N0(t,e,n,r){return t.someProp("createSelectionBetween",a=>a(t,e,n))||Qe.between(e,n,r)}function q1(t){return t.editable&&!t.hasFocus()?!1:GS(t)}function GS(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function $D(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Io(e.node,e.offset,n.anchorNode,n.anchorOffset)}function ax(t,e){let{$anchor:n,$head:r}=t.selection,a=e>0?n.max(r):n.min(r),i=a.parent.inlineContent?a.depth?t.doc.resolve(e>0?a.after():a.before()):null:a;return i&&tt.findFrom(i,e)}function di(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function G1(t,e,n){let r=t.state.selection;if(r instanceof Qe)if(n.indexOf("s")>-1){let{$head:a}=r,i=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(a.pos+i.nodeSize*(e<0?-1:1));return di(t,new Qe(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let a=ax(t.state,e);return a&&a instanceof Je?di(t,a):!1}else if(!(Xr&&n.indexOf("m")>-1)){let a=r.$head,i=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter,o;if(!i||i.isText)return!1;let c=e<0?a.pos-i.nodeSize:a.pos;return i.isAtom||(o=t.docView.descAt(c))&&!o.contentDOM?Je.isSelectable(i)?di(t,new Je(e<0?t.state.doc.resolve(a.pos-i.nodeSize):a)):Td?di(t,new Qe(t.state.doc.resolve(e<0?c:c+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Je&&r.node.isInline)return di(t,new Qe(e>0?r.$to:r.$from));{let a=ax(t.state,e);return a?di(t,a):!1}}}function Ch(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Qc(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Nl(t,e){return e<0?FD(t):BD(t)}function FD(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a,i,o=!1;for(es&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(Qc(c,-1))a=n,i=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(JS(n))break;{let c=n.previousSibling;for(;c&&Qc(c,-1);)a=n.parentNode,i=Hn(c),c=c.previousSibling;if(c)n=c,r=Ch(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?ix(t,n,r):a&&ix(t,a,i)}function BD(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a=Ch(n),i,o;for(;;)if(r{t.state==a&&Ta(t)},50)}function J1(t,e){let n=t.state.doc.resolve(e);if(!(Un||OS)&&n.parent.inlineContent){let a=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>a.top&&o1)return i.lefta.top&&o1)return i.left>a.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Y1(t,e,n){let r=t.state.selection;if(r instanceof Qe&&!r.empty||n.indexOf("s")>-1||Xr&&n.indexOf("m")>-1)return!1;let{$from:a,$to:i}=r;if(!a.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=ax(t.state,e);if(o&&o instanceof Je)return di(t,o)}if(!a.parent.inlineContent){let o=e<0?a:i,c=r instanceof Fr?tt.near(o,e):tt.findFrom(o,e);return c?di(t,c):!1}return!1}function Q1(t,e){if(!(t.state.selection instanceof Qe))return!0;let{$head:n,$anchor:r,empty:a}=t.state.selection;if(!n.sameParent(r))return!0;if(!a)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function X1(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function WD(t){if(!sr||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;X1(t,r,"true"),setTimeout(()=>X1(t,r,"false"),20)}return!1}function UD(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function KD(t,e){let n=e.keyCode,r=UD(e);if(n==8||Xr&&n==72&&r=="c")return Q1(t,-1)||Nl(t,-1);if(n==46&&!e.shiftKey||Xr&&n==68&&r=="c")return Q1(t,1)||Nl(t,1);if(n==13||n==27)return!0;if(n==37||Xr&&n==66&&r=="c"){let a=n==37?J1(t,t.state.selection.from)=="ltr"?-1:1:-1;return G1(t,a,r)||Nl(t,a)}else if(n==39||Xr&&n==70&&r=="c"){let a=n==39?J1(t,t.state.selection.from)=="ltr"?1:-1:1;return G1(t,a,r)||Nl(t,a)}else{if(n==38||Xr&&n==80&&r=="c")return Y1(t,-1,r)||Nl(t,-1);if(n==40||Xr&&n==78&&r=="c")return WD(t)||Y1(t,1,r)||Nl(t,1);if(r==(Xr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function w0(t,e){t.someProp("transformCopied",y=>{e=y(e,t)});let n=[],{content:r,openStart:a,openEnd:i}=e;for(;a>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){a--,i--;let y=r.firstChild;n.push(y.type.name,y.attrs!=y.type.defaultAttrs?y.attrs:null),r=y.content}let o=t.someProp("clipboardSerializer")||$o.fromSchema(t.state.schema),c=t2(),u=c.createElement("div");u.appendChild(o.serializeFragment(r,{document:c}));let h=u.firstChild,f,m=0;for(;h&&h.nodeType==1&&(f=e2[h.nodeName.toLowerCase()]);){for(let y=f.length-1;y>=0;y--){let v=c.createElement(f[y]);for(;u.firstChild;)v.appendChild(u.firstChild);u.appendChild(v),m++}h=u.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${a} ${i}${m?` -${m}`:""} ${JSON.stringify(n)}`);let g=t.someProp("clipboardTextSerializer",y=>y(e,t))||e.content.textBetween(0,e.content.size,` `);return{dom:u,text:g,slice:e}}function YS(t,e,n,r,a){let i=a.parent.type.spec.code,o,c;if(!n&&!e)return null;let u=!!e&&(r||i||!n);if(u){if(t.someProp("transformPastedText",g=>{e=g(e,i||r,t)}),i)return c=new Re(xe.from(t.state.schema.text(e.replace(/\r\n?/g,` -`))),0,0),t.someProp("transformPasted",g=>{c=g(c,t,!0)}),c;let m=t.someProp("clipboardTextParser",g=>g(e,a,r,t));if(m)c=m;else{let g=a.marks(),{schema:y}=t.state,v=$o.fromSchema(y);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(w=>{let N=o.appendChild(document.createElement("p"));w&&N.appendChild(v.serializeNode(y.text(w,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),o=YD(n),Td&&QD(o);let h=o&&o.querySelector("[data-pm-slice]"),f=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(f&&f[3])for(let m=+f[3];m>0;m--){let g=o.firstChild;for(;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;o=g}if(c||(c=(t.someProp("clipboardParser")||t.someProp("domParser")||ki.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||f),context:a,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!qD.test(g.parentNode.nodeName)?{ignore:!0}:null}})),f)c=XD(Z1(c,+f[1],+f[2]),f[4]);else if(c=Re.maxOpen(GD(c.content,a),!0),c.openStart||c.openEnd){let m=0,g=0;for(let y=c.content.firstChild;m{c=m(c,t,u)}),c}const qD=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function GD(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let a=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(c=>{if(!o)return;let u=a.findWrapping(c.type),h;if(!u)return o=null;if(h=o.length&&i.length&&XS(u,i,c,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=ZS(o[o.length-1],i.length));let f=QS(c,u);o.push(f),a=a.matchType(f.type),i=u}}),o)return xe.from(o)}return t}function QS(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,xe.from(t));return t}function XS(t,e,n,r,a){if(a1&&(i=0),a=n&&(c=e<0?o.contentMatchAt(0).fillBefore(c,i<=a).append(c):c.append(o.contentMatchAt(o.childCount).fillBefore(xe.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(c))}function Z1(t,e,n){return en})),tg.createHTML(t)):t}function YD(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=t2().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),a;if((a=r&&e2[r[1].toLowerCase()])&&(t=a.map(i=>"<"+i+">").join("")+t+a.map(i=>"").reverse().join("")),n.innerHTML=JD(t),a)for(let i=0;i=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;a=xe.from(u.create(r[c+1],a)),i++,o++}return new Re(a,i,o)}const xr={},yr={},ZD={touchstart:!0,touchmove:!0};class eL{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function tL(t){for(let e in xr){let n=xr[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{rL(t,r)&&!j0(t,r)&&(t.editable||!(r.type in yr))&&n(t,r)},ZD[e]?{passive:!0}:void 0)}sr&&t.dom.addEventListener("input",()=>null),lx(t)}function Ni(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function nL(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function lx(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>j0(t,r))})}function j0(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function rL(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function sL(t,e){!j0(t,e)&&xr[e.type]&&(t.editable||!(e.type in yr))&&xr[e.type](t,e)}yr.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!r2(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(ka&&Un&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Fl&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",a=>a(t,ho(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||KD(t,n)?n.preventDefault():Ni(t,"key")};yr.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};yr.keypress=(t,e)=>{let n=e;if(r2(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Qr&&n.metaKey)return;if(t.someProp("handleKeyPress",a=>a(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Qe)||!r.$from.sameParent(r.$to)){let a=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(a).scrollIntoView();!/[\r\n]/.test(a)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,a,i))&&t.dispatch(i()),n.preventDefault()}};function Rf(t){return{left:t.clientX,top:t.clientY}}function aL(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function k0(t,e,n,r,a){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,c=>o>i.depth?c(t,n,i.nodeAfter,i.before(o),a,!0):c(t,n,i.node(o),i.before(o),a,!1)))return!0;return!1}function Pl(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function iL(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Je.isSelectable(r)?(Pl(t,new Je(n)),!0):!1}function oL(t,e){if(e==-1)return!1;let n=t.state.selection,r,a;n instanceof Je&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let c=o>i.depth?i.nodeAfter:i.node(o);if(Je.isSelectable(c)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?a=i.before(n.$from.depth):a=i.before(o);break}}return a!=null?(Pl(t,Je.create(t.state.doc,a)),!0):!1}function lL(t,e,n,r,a){return k0(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(a?oL(t,n):iL(t,n))}function cL(t,e,n,r){return k0(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",a=>a(t,e,r))}function dL(t,e,n,r){return k0(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",a=>a(t,e,r))||uL(t,n,r)}function uL(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Pl(t,Qe.create(r,0,r.content.size)),!0):!1;let a=r.resolve(e);for(let i=a.depth+1;i>0;i--){let o=i>a.depth?a.nodeAfter:a.node(i),c=a.before(i);if(o.inlineContent)Pl(t,Qe.create(r,c+1,c+1+o.content.size));else if(Je.isSelectable(o))Pl(t,Je.create(r,c));else continue;return!0}}function S0(t){return Eh(t)}const n2=Qr?"metaKey":"ctrlKey";xr.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=S0(t),a=Date.now(),i="singleClick";a-t.input.lastClick.time<500&&aL(n,t.input.lastClick)&&!n[n2]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:a,x:n.clientX,y:n.clientY,type:i,button:n.button};let o=t.posAtCoords(Rf(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new hL(t,o,n,!!r)):(i=="doubleClick"?cL:dL)(t,o.pos,o.inside,n)?n.preventDefault():Ni(t,"pointer"))};class hL{constructor(e,n,r,a){this.view=e,this.pos=n,this.event=r,this.flushed=a,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[n2],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let f=e.state.doc.resolve(n.pos);i=f.parent,o=f.depth?f.before():0}const c=a?null:r.target,u=c?e.docView.nearestDesc(c,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:h}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||h instanceof Je&&h.from<=o&&h.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Zr&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Ni(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Ta(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Rf(e))),this.updateAllowDefault(e),this.allowDefault||!n?Ni(this.view,"pointer"):lL(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||sr&&this.mightDrag&&!this.mightDrag.node.isAtom||Un&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Pl(this.view,tt.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Ni(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ni(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}xr.touchstart=t=>{t.input.lastTouch=Date.now(),S0(t),Ni(t,"pointer")};xr.touchmove=t=>{t.input.lastTouch=Date.now(),Ni(t,"pointer")};xr.contextmenu=t=>S0(t);function r2(t,e){return t.composing?!0:sr&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const fL=ka?5e3:-1;yr.compositionstart=yr.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Qe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Un&&OS&&pL(t)))t.markCursor=t.state.storedMarks||n.marks(),Eh(t,!0),t.markCursor=null;else if(Eh(t,!e.selection.empty),Zr&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let a=r.focusNode,i=r.focusOffset;a&&a.nodeType==1&&i!=0;){let o=i<0?a.lastChild:a.childNodes[i-1];if(!o)break;if(o.nodeType==3){let c=t.domSelection();c&&c.collapse(o,o.nodeValue.length);break}else a=o,i=-1}}t.input.composing=!0}s2(t,fL)};function pL(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}yr.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,s2(t,20))};function s2(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Eh(t),e))}function a2(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=gL());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function mL(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=oD(e.focusNode,e.focusOffset),r=lD(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let a=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!a||!a.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function gL(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Eh(t,e=!1){if(!(ka&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),a2(t),e||t.docView&&t.docView.dirty){let n=v0(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function xL(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),a=document.createRange();a.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(a),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const fd=Mr&&Si<15||Fl&&hD<604;xr.copy=yr.cut=(t,e)=>{let n=e,r=t.state.selection,a=n.type=="cut";if(r.empty)return;let i=fd?null:n.clipboardData,o=r.content(),{dom:c,text:u}=w0(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",c.innerHTML),i.setData("text/plain",u)):xL(t,c),a&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function yL(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function bL(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let a=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?pd(t,r.value,null,a,e):pd(t,r.textContent,r.innerHTML,a,e)},50)}function pd(t,e,n,r,a){let i=YS(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,a,i||Re.empty)))return!0;if(!i)return!1;let o=yL(i),c=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(i);return t.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function i2(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}yr.paste=(t,e)=>{let n=e;if(t.composing&&!ka)return;let r=fd?null:n.clipboardData,a=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&pd(t,i2(r),r.getData("text/html"),a,n)?n.preventDefault():bL(t,n)};class o2{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const vL=Qr?"altKey":"ctrlKey";function l2(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[vL]}xr.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let a=t.state.selection,i=a.empty?null:t.posAtCoords(Rf(n)),o;if(!(i&&i.pos>=a.from&&i.pos<=(a instanceof Je?a.to-1:a.to))){if(r&&r.mightDrag)o=Je.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let m=t.docView.nearestDesc(n.target,!0);m&&m.node.type.spec.draggable&&m!=t.docView&&(o=Je.create(t.state.doc,m.posBefore))}}let c=(o||t.state.selection).content(),{dom:u,text:h,slice:f}=w0(t,c);(!n.dataTransfer.files.length||!Un||PS>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(fd?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",fd||n.dataTransfer.setData("text/plain",h),t.dragging=new o2(f,l2(t,n),o)};xr.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};yr.dragover=yr.dragenter=(t,e)=>e.preventDefault();yr.drop=(t,e)=>{try{NL(t,e,t.dragging)}finally{t.dragging=null}};function NL(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Rf(e));if(!r)return;let a=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",y=>{i=y(i,t,!1)}):i=YS(t,i2(e.dataTransfer),fd?null:e.dataTransfer.getData("text/html"),!1,a);let o=!!(n&&l2(t,e));if(t.someProp("handleDrop",y=>y(t,e,i||Re.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let c=i?hS(t.state.doc,a.pos,i):a.pos;c==null&&(c=a.pos);let u=t.state.tr;if(o){let{node:y}=n;y?y.replace(u):u.deleteSelection()}let h=u.mapping.map(c),f=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,m=u.doc;if(f?u.replaceRangeWith(h,h,i.content.firstChild):u.replaceRange(h,h,i),u.doc.eq(m))return;let g=u.doc.resolve(h);if(f&&Je.isSelectable(i.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(i.content.firstChild))u.setSelection(new Je(g));else{let y=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((v,w,N,k)=>y=k),u.setSelection(N0(t,g,u.doc.resolve(y)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}xr.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Ta(t)},20))};xr.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};xr.beforeinput=(t,e)=>{if(Un&&ka&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,ho(8,"Backspace")))))return;let{$cursor:a}=t.state.selection;a&&a.pos>0&&t.dispatch(t.state.tr.delete(a.pos-1,a.pos).scrollIntoView())},50)}};for(let t in yr)xr[t]=yr[t];function md(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Th{constructor(e,n){this.toDOM=e,this.spec=n||ko,this.side=this.spec.side||0}map(e,n,r,a){let{pos:i,deleted:o}=e.mapResult(n.from+a,this.side<0?-1:1);return o?null:new Tn(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Th&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&md(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Ei{constructor(e,n){this.attrs=e,this.spec=n||ko}map(e,n,r,a){let i=e.map(n.from+a,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+a,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new Tn(i,o,this)}valid(e,n){return n.from=e&&(!i||i(c.spec))&&r.push(c.copy(c.from+a,c.to+a))}for(let o=0;oe){let c=this.children[o]+1;this.children[o+2].findInner(e-c,n-c,r,a+c,i)}}map(e,n,r){return this==tr||e.maps.length==0?this:this.mapInner(e,n,0,0,r||ko)}mapInner(e,n,r,a,i){let o;for(let c=0;c{let h=u+r,f;if(f=d2(n,c,h)){for(a||(a=this.children.slice());ic&&m.to=e){this.children[c]==e&&(r=this.children[c+2]);break}let i=e+1,o=i+n.content.size;for(let c=0;ci&&u.type instanceof Ei){let h=Math.max(i,u.from)-i,f=Math.min(o,u.to)-i;ha.map(e,n,ko));return fi.from(r)}forChild(e,n){if(n.isLeaf)return Pt.empty;let r=[];for(let a=0;an instanceof Pt)?e:e.reduce((n,r)=>n.concat(r instanceof Pt?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let N=w-v-(y-g);for(let k=0;kC+f-m)continue;let E=c[k]+f-m;y>=E?c[k+1]=g<=E?-2:-1:g>=f&&N&&(c[k]+=N,c[k+1]+=N)}m+=N}),f=n.maps[h].map(f,-1)}let u=!1;for(let h=0;h=r.content.size){u=!0;continue}let g=n.map(t[h+1]+i,-1),y=g-a,{index:v,offset:w}=r.content.findIndex(m),N=r.maybeChild(v);if(N&&w==m&&w+N.nodeSize==y){let k=c[h+2].mapInner(n,N,f+1,t[h]+i+1,o);k!=tr?(c[h]=m,c[h+1]=y,c[h+2]=k):(c[h+1]=-2,u=!0)}else u=!0}if(u){let h=jL(c,t,e,n,a,i,o),f=Mh(h,r,0,o);e=f.local;for(let m=0;mn&&o.to{let h=d2(t,c,u+n);if(h){i=!0;let f=Mh(h,c,n+u+1,r);f!=tr&&a.push(u,u+c.nodeSize,f)}});let o=c2(i?u2(t):t,-n).sort(So);for(let c=0;c0;)e++;t.splice(e,0,n)}function ng(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=tr&&e.push(r)}),t.cursorWrapper&&e.push(Pt.create(t.state.doc,[t.cursorWrapper.deco])),fi.from(e)}const kL={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},SL=Mr&&Si<=11;class CL{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class EL{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new CL,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let a=0;aa.type=="childList"&&a.removedNodes.length||a.type=="characterData"&&a.oldValue.length>a.target.nodeValue.length)?this.flushSoon():sr&&e.composing&&r.some(a=>a.type=="childList"&&a.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),SL&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,kL)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;nthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(q1(this.view)){if(this.suppressingSelectionUpdates)return Ta(this.view);if(Mr&&Si<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Io(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=$l(i))n.add(i);for(let i=e.anchorNode;i;i=$l(i))if(n.has(i)){r=i;break}let a=r&&this.view.docView.nearestDesc(r);if(a&&a.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),a=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&q1(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,c=!1,u=[];if(e.editable)for(let f=0;ff.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let f of u)if(f.nodeName=="BR"&&f.parentNode){let m=f.nextSibling;m&&m.nodeType==1&&m.contentEditable=="false"&&f.parentNode.removeChild(f)}}else if(Zr&&u.length){let f=u.filter(m=>m.nodeName=="BR");if(f.length==2){let[m,g]=f;m.parentNode&&m.parentNode.parentNode==g.parentNode?g.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let g of f){let y=g.parentNode;y&&y.nodeName=="LI"&&(!m||AL(e,m)!=y)&&g.remove()}}}let h=null;i<0&&a&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||a)&&(i>-1&&(e.docView.markDirty(i,o),TL(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,IL(e,u)),this.handleDOMChange(i,o,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Ta(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let f=0;fa;N--){let k=r.childNodes[N-1],C=k.pmViewDesc;if(k.nodeName=="BR"&&!C){i=N;break}if(!C||C.size)break}let m=t.state.doc,g=t.someProp("domParser")||ki.fromSchema(t.state.schema),y=m.resolve(o),v=null,w=g.parse(r,{topNode:y.parent,topMatch:y.parent.contentMatchAt(y.index()),topOpen:!0,from:a,to:i,preserveWhitespace:y.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:PL,context:y});if(h&&h[0].pos!=null){let N=h[0].pos,k=h[1]&&h[1].pos;k==null&&(k=N),v={anchor:N+o,head:k+o}}return{doc:w,sel:v,from:o,to:c}}function PL(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(sr&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||sr&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const OL=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function DL(t,e,n,r,a){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let _=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,P=v0(t,_);if(P&&!t.state.selection.eq(P)){if(Un&&ka&&t.input.lastKeyCode===13&&Date.now()-100z(t,ho(13,"Enter"))))return;let L=t.state.tr.setSelection(P);_=="pointer"?L.setMeta("pointer",!0):_=="key"&&L.scrollIntoView(),i&&L.setMeta("composition",i),t.dispatch(L)}return}let o=t.state.doc.resolve(e),c=o.sharedDepth(n);e=o.before(c+1),n=t.state.doc.resolve(n).after(c+1);let u=t.state.selection,h=RL(t,e,n),f=t.state.doc,m=f.slice(h.from,h.to),g,y;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||ka)&&a.some(_=>_.nodeType==1&&!OL.test(_.nodeName))&&(!v||v.endA>=v.endB)&&t.someProp("handleKeyDown",_=>_(t,ho(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!v)if(r&&u instanceof Qe&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(h.sel&&h.sel.anchor!=h.sel.head))v={start:u.from,endA:u.to,endB:u.to};else{if(h.sel){let _=aN(t,t.state.doc,h.sel);if(_&&!_.eq(t.state.selection)){let P=t.state.tr.setSelection(_);i&&P.setMeta("composition",i),t.dispatch(P)}}return}t.state.selection.fromt.state.selection.from&&v.start<=t.state.selection.from+2&&t.state.selection.from>=h.from?v.start=t.state.selection.from:v.endA=t.state.selection.to-2&&t.state.selection.to<=h.to&&(v.endB+=t.state.selection.to-v.endA,v.endA=t.state.selection.to)),Mr&&Si<=11&&v.endB==v.start+1&&v.endA==v.start&&v.start>h.from&&h.doc.textBetween(v.start-h.from-1,v.start-h.from+1)=="  "&&(v.start--,v.endA--,v.endB--);let w=h.doc.resolveNoCache(v.start-h.from),N=h.doc.resolveNoCache(v.endB-h.from),k=f.resolve(v.start),C=w.sameParent(N)&&w.parent.inlineContent&&k.end()>=v.endA;if((Fl&&t.input.lastIOSEnter>Date.now()-225&&(!C||a.some(_=>_.nodeName=="DIV"||_.nodeName=="P"))||!C&&w.pos_(t,ho(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>v.start&&_L(f,v.start,v.endA,w,N)&&t.someProp("handleKeyDown",_=>_(t,ho(8,"Backspace")))){ka&&Un&&t.domObserver.suppressSelectionUpdates();return}Un&&v.endB==v.start&&(t.input.lastChromeDelete=Date.now()),ka&&!C&&w.start()!=N.start()&&N.parentOffset==0&&w.depth==N.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==v.endA&&(v.endB-=2,N=h.doc.resolveNoCache(v.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function(_){return _(t,ho(13,"Enter"))})},20));let E=v.start,A=v.endA,I=_=>{let P=_||t.state.tr.replace(E,A,h.doc.slice(v.start-h.from,v.endB-h.from));if(h.sel){let L=aN(t,P.doc,h.sel);L&&!(Un&&t.composing&&L.empty&&(v.start!=v.endB||t.input.lastChromeDeleteTa(t),20));let _=I(t.state.tr.delete(E,A)),P=f.resolve(v.start).marksAcross(f.resolve(v.endA));P&&_.ensureMarks(P),t.dispatch(_)}else if(v.endA==v.endB&&(D=LL(w.parent.content.cut(w.parentOffset,N.parentOffset),k.parent.content.cut(k.parentOffset,v.endA-k.start())))){let _=I(t.state.tr);D.type=="add"?_.addMark(E,A,D.mark):_.removeMark(E,A,D.mark),t.dispatch(_)}else if(w.parent.child(w.index()).isText&&w.index()==N.index()-(N.textOffset?0:1)){let _=w.parent.textBetween(w.parentOffset,N.parentOffset),P=()=>I(t.state.tr.insertText(_,E,A));t.someProp("handleTextInput",L=>L(t,E,A,_,P))||t.dispatch(P())}else t.dispatch(I());else t.dispatch(I())}function aN(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:N0(t,e.resolve(n.anchor),e.resolve(n.head))}function LL(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,a=n,i=r,o,c,u;for(let f=0;ff.mark(c.addToSet(f.marks));else if(a.length==0&&i.length==1)c=i[0],o="remove",u=f=>f.mark(c.removeFromSet(f.marks));else return null;let h=[];for(let f=0;fn||rg(o,!0,!1)0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,a++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,a++}return a}function zL(t,e,n,r,a){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:o,b:c}=t.findDiffEnd(e,n+t.size,n+e.size);if(a=="end"){let u=Math.max(0,i-Math.min(o,c));r-=o+u-i}if(o=o?i-r:0;i-=u,i&&i=c?i-r:0;i-=u,i&&i=56320&&e<=57343&&n>=55296&&n<=56319}class h2{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new eL,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(uN),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=cN(this),lN(this),this.nodeViews=dN(this),this.docView=B1(this.state.doc,oN(this),ng(this),this.dom,this),this.domObserver=new EL(this,(r,a,i,o)=>DL(this,r,a,i,o)),this.domObserver.start(),tL(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&lx(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(uN),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let a=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(a2(this),o=!0),this.state=e;let c=a.plugins!=e.plugins||this._props.plugins!=n.plugins;if(c||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let y=dN(this);FL(y,this.nodeViews)&&(this.nodeViews=y,i=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&lx(this),this.editable=cN(this),lN(this);let u=ng(this),h=oN(this),f=a.plugins!=e.plugins&&!a.doc.eq(e.doc)?"reset":e.scrollToSelection>a.scrollToSelection?"to selection":"preserve",m=i||!this.docView.matchesNode(e.doc,h,u);(m||!e.selection.eq(a.selection))&&(o=!0);let g=f=="preserve"&&o&&this.dom.style.overflowAnchor==null&&mD(this);if(o){this.domObserver.stop();let y=m&&(Mr||Un)&&!this.composing&&!a.selection.empty&&!e.selection.empty&&$L(a.selection,e.selection);if(m){let v=Un?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=mL(this)),(i||!this.docView.update(e.doc,h,u,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=B1(e.doc,h,u,this.dom,this)),v&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(y=!0)}y||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&$D(this))?Ta(this,y):(qS(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(a),!((r=this.dragging)===null||r===void 0)&&r.node&&!a.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,a),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():g&&gD(g)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Je){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&D1(this,n.getBoundingClientRect(),e)}else D1(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n0&&this.state.doc.nodeAt(i))==r.node&&(a=i)}this.dragging=new o2(e.slice,e.move,a<0?void 0:Je.create(this.state.doc,a))}someProp(e,n){let r=this._props&&this._props[e],a;if(r!=null&&(a=n?n(r):r))return a;for(let o=0;on.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return wD(this,e)}coordsAtPos(e,n=1){return $S(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let a=this.docView.posFromDOM(e,n,r);if(a==null)throw new RangeError("DOM position not inside the editor");return a}endOfTextblock(e,n){return ED(this,n||this.state,e)}pasteHTML(e,n){return pd(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return pd(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return w0(this,e)}destroy(){this.docView&&(nL(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ng(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,aD())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return sL(this,e)}domSelectionRange(){let e=this.domSelection();return e?sr&&this.root.nodeType===11&&dD(this.dom.ownerDocument)==this.dom&&ML(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}h2.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function oN(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Tn.node(0,t.state.doc.content.size,e)]}function lN(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Tn.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function cN(t){return!t.someProp("editable",e=>e(t.state)===!1)}function $L(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function dN(t){let e=Object.create(null);function n(r){for(let a in r)Object.prototype.hasOwnProperty.call(e,a)||(e[a]=r[a])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function FL(t,e){let n=0,r=0;for(let a in t){if(t[a]!=e[a])return!0;n++}for(let a in e)r++;return n!=r}function uN(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Mi={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Ah={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},BL=typeof navigator<"u"&&/Mac/.test(navigator.platform),VL=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Wn=0;Wn<10;Wn++)Mi[48+Wn]=Mi[96+Wn]=String(Wn);for(var Wn=1;Wn<=24;Wn++)Mi[Wn+111]="F"+Wn;for(var Wn=65;Wn<=90;Wn++)Mi[Wn]=String.fromCharCode(Wn+32),Ah[Wn]=String.fromCharCode(Wn);for(var sg in Mi)Ah.hasOwnProperty(sg)||(Ah[sg]=Mi[sg]);function HL(t){var e=BL&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||VL&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Ah:Mi)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const WL=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),UL=typeof navigator<"u"&&/Win/.test(navigator.platform);function KL(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,a,i,o;for(let c=0;c{for(var n in e)JL(t,n,{get:e[n],enumerable:!0})};function Pf(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:a}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return a},get tr(){return r=n.selection,a=n.doc,i=n.storedMarks,n}}}var Of=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:a}=n,i=this.buildProps(a);return Object.fromEntries(Object.entries(t).map(([o,c])=>[o,(...h)=>{const f=c(...h)(i);return!a.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(a),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:a}=this,{view:i}=r,o=[],c=!!t,u=t||a.tr,h=()=>(!c&&e&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(u),o.every(m=>m===!0)),f={...Object.fromEntries(Object.entries(n).map(([m,g])=>[m,(...v)=>{const w=this.buildProps(u,e),N=g(...v)(w);return o.push(N),f}])),run:h};return f}createCan(t){const{rawCommands:e,state:n}=this,r=!1,a=t||n.tr,i=this.buildProps(a,r);return{...Object.fromEntries(Object.entries(e).map(([c,u])=>[c,(...h)=>u(...h)({...i,dispatch:void 0})])),chain:()=>this.createChain(a,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:a}=this,{view:i}=r,o={tr:t,editor:r,view:i,state:Pf({state:a,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([c,u])=>[c,(...h)=>u(...h)(o)]))}};return o}},f2={};M0(f2,{blur:()=>YL,clearContent:()=>QL,clearNodes:()=>XL,command:()=>ZL,createParagraphNear:()=>e8,cut:()=>t8,deleteCurrentNode:()=>n8,deleteNode:()=>r8,deleteRange:()=>s8,deleteSelection:()=>a8,enter:()=>i8,exitCode:()=>o8,extendMarkRange:()=>l8,first:()=>c8,focus:()=>u8,forEach:()=>h8,insertContent:()=>f8,insertContentAt:()=>g8,joinBackward:()=>b8,joinDown:()=>y8,joinForward:()=>v8,joinItemBackward:()=>N8,joinItemForward:()=>w8,joinTextblockBackward:()=>j8,joinTextblockForward:()=>k8,joinUp:()=>x8,keyboardShortcut:()=>C8,lift:()=>E8,liftEmptyBlock:()=>T8,liftListItem:()=>M8,newlineInCode:()=>A8,resetAttributes:()=>I8,scrollIntoView:()=>R8,selectAll:()=>P8,selectNodeBackward:()=>O8,selectNodeForward:()=>D8,selectParentNode:()=>L8,selectTextblockEnd:()=>_8,selectTextblockStart:()=>z8,setContent:()=>$8,setMark:()=>a6,setMeta:()=>i6,setNode:()=>o6,setNodeSelection:()=>l6,setTextDirection:()=>c6,setTextSelection:()=>d6,sinkListItem:()=>u6,splitBlock:()=>h6,splitListItem:()=>f6,toggleList:()=>p6,toggleMark:()=>m6,toggleNode:()=>g6,toggleWrap:()=>x6,undoInputRule:()=>y6,unsetAllMarks:()=>b6,unsetMark:()=>v6,unsetTextDirection:()=>N6,updateAttributes:()=>w6,wrapIn:()=>j6,wrapInList:()=>k6});var YL=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),QL=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),XL=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:a}=r;return n&&a.forEach(({$from:i,$to:o})=>{t.doc.nodesBetween(i.pos,o.pos,(c,u)=>{if(c.type.isText)return;const{doc:h,mapping:f}=e,m=h.resolve(f.map(u)),g=h.resolve(f.map(u+c.nodeSize)),y=m.blockRange(g);if(!y)return;const v=Xl(y);if(c.type.isTextblock){const{defaultType:w}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(y.start,w)}(v||v===0)&&e.lift(y,v)})}),!0},ZL=t=>e=>t(e),e8=()=>({state:t,dispatch:e})=>TS(t,e),t8=(t,e)=>({editor:n,tr:r})=>{const{state:a}=n,i=a.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new Qe(r.doc.resolve(Math.max(o-1,0)))),!0},n8=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const a=t.selection.$anchor;for(let i=a.depth;i>0;i-=1)if(a.node(i).type===r.type){if(e){const c=a.before(i),u=a.after(i);t.delete(c,u).scrollIntoView()}return!0}return!1};function Nn(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var r8=t=>({tr:e,state:n,dispatch:r})=>{const a=Nn(t,n.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===a){if(r){const u=i.before(o),h=i.after(o);e.delete(u,h).scrollIntoView()}return!0}return!1},s8=t=>({tr:e,dispatch:n})=>{const{from:r,to:a}=t;return n&&e.delete(r,a),!0},a8=()=>({state:t,dispatch:e})=>p0(t,e),i8=()=>({commands:t})=>t.keyboardShortcut("Enter"),o8=()=>({state:t,dispatch:e})=>WO(t,e);function A0(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Ih(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(a=>n.strict?e[a]===t[a]:A0(e[a])?e[a].test(t[a]):e[a]===t[a]):!0}function p2(t,e,n={}){return t.find(r=>r.type===e&&Ih(Object.fromEntries(Object.keys(n).map(a=>[a,r.attrs[a]])),n))}function hN(t,e,n={}){return!!p2(t,e,n)}function I0(t,e,n){var r;if(!t||!e)return;let a=t.parent.childAfter(t.parentOffset);if((!a.node||!a.node.marks.some(f=>f.type===e))&&(a=t.parent.childBefore(t.parentOffset)),!a.node||!a.node.marks.some(f=>f.type===e)||(n=n||((r=a.node.marks[0])==null?void 0:r.attrs),!p2([...a.node.marks],e,n)))return;let o=a.index,c=t.start()+a.offset,u=o+1,h=c+a.node.nodeSize;for(;o>0&&hN([...t.parent.child(o-1).marks],e,n);)o-=1,c-=t.parent.child(o).nodeSize;for(;u({tr:n,state:r,dispatch:a})=>{const i=Ra(t,r.schema),{doc:o,selection:c}=n,{$from:u,from:h,to:f}=c;if(a){const m=I0(u,i,e);if(m&&m.from<=h&&m.to>=f){const g=Qe.create(o,m.from,m.to);n.setSelection(g)}}return!0},c8=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r({editor:n,view:r,tr:a,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(Rh()||fN())&&r.dom.focus(),d8()&&!Rh()&&!fN()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(i&&t===null&&!m2(n.state.selection))return o(),!0;const c=g2(a.doc,t)||n.state.selection,u=n.state.selection.eq(c);return i&&(u||a.setSelection(c),u&&a.storedMarks&&a.setStoredMarks(a.storedMarks),o()),!0},h8=(t,e)=>n=>t.every((r,a)=>e(r,{...n,index:a})),f8=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),x2=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&x2(r)}return t};function Vu(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`${t}`,n=new window.DOMParser().parseFromString(e,"text/html").body;return x2(n)}function gd(t,e,n){if(t instanceof Ca||t instanceof xe)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,a=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return xe.fromArray(t.map(c=>e.nodeFromJSON(c)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),gd("",e,n)}if(a){if(n.errorOnInvalidContent){let o=!1,c="";const u=new tS({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:h=>(o=!0,c=typeof h=="string"?h:h.outerHTML,null)}]}})});if(n.slice?ki.fromSchema(u).parseSlice(Vu(t),n.parseOptions):ki.fromSchema(u).parse(Vu(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const i=ki.fromSchema(e);return n.slice?i.parseSlice(Vu(t),n.parseOptions).content:i.parse(Vu(t),n.parseOptions)}return gd("",e,n)}function p8(t,e,n){const r=t.steps.length-1;if(r{o===0&&(o=f)}),t.setSelection(tt.near(t.doc.resolve(o),n))}var m8=t=>!("type"in t),g8=(t,e,n)=>({tr:r,dispatch:a,editor:i})=>{var o;if(a){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const u=N=>{i.emit("contentError",{editor:i,error:N,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},h={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{gd(e,i.schema,{parseOptions:h,errorOnInvalidContent:!0})}catch(N){u(N)}try{c=gd(e,i.schema,{parseOptions:h,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(N){return u(N),!1}let{from:f,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,y=!0;if((m8(c)?c:[c]).forEach(N=>{N.check(),g=g?N.isText&&N.marks.length===0:!1,y=y?N.isBlock:!1}),f===m&&y){const{parent:N}=r.doc.resolve(f);N.isTextblock&&!N.type.spec.code&&!N.childCount&&(f-=1,m+=1)}let w;if(g){if(Array.isArray(e))w=e.map(N=>N.text||"").join("");else if(e instanceof xe){let N="";e.forEach(k=>{k.text&&(N+=k.text)}),w=N}else typeof e=="object"&&e&&e.text?w=e.text:w=e;r.insertText(w,f,m)}else{w=c;const N=r.doc.resolve(f),k=N.node(),C=N.parentOffset===0,E=k.isText||k.isTextblock,A=k.content.size>0;C&&E&&A&&(f=Math.max(0,f-1)),r.replaceWith(f,m,w)}n.updateSelection&&p8(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:f,text:w}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:f,text:w})}return!0},x8=()=>({state:t,dispatch:e})=>BO(t,e),y8=()=>({state:t,dispatch:e})=>VO(t,e),b8=()=>({state:t,dispatch:e})=>NS(t,e),v8=()=>({state:t,dispatch:e})=>SS(t,e),N8=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Ef(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},w8=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Ef(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},j8=()=>({state:t,dispatch:e})=>$O(t,e),k8=()=>({state:t,dispatch:e})=>FO(t,e);function y2(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function S8(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,a,i,o;for(let c=0;c({editor:e,view:n,tr:r,dispatch:a})=>{const i=S8(t).split(/-(?!$)/),o=i.find(h=>!["Alt","Ctrl","Meta","Shift"].includes(h)),c=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",h=>h(n,c))});return u==null||u.steps.forEach(h=>{const f=h.map(r.mapping);f&&a&&r.maybeStep(f)}),!0};function Ai(t,e,n={}){const{from:r,to:a,empty:i}=t.selection,o=e?Nn(e,t.schema):null,c=[];t.doc.nodesBetween(r,a,(m,g)=>{if(m.isText)return;const y=Math.max(r,g),v=Math.min(a,g+m.nodeSize);c.push({node:m,from:y,to:v})});const u=a-r,h=c.filter(m=>o?o.name===m.node.type.name:!0).filter(m=>Ih(m.node.attrs,n,{strict:!1}));return i?!!h.length:h.reduce((m,g)=>m+g.to-g.from,0)>=u}var E8=(t,e={})=>({state:n,dispatch:r})=>{const a=Nn(t,n.schema);return Ai(n,a,e)?HO(n,r):!1},T8=()=>({state:t,dispatch:e})=>MS(t,e),M8=t=>({state:e,dispatch:n})=>{const r=Nn(t,e.schema);return tD(r)(e,n)},A8=()=>({state:t,dispatch:e})=>ES(t,e);function Df(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function pN(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,a)=>(n.includes(a)||(r[a]=t[a]),r),{})}var I8=(t,e)=>({tr:n,state:r,dispatch:a})=>{let i=null,o=null;const c=Df(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(i=Nn(t,r.schema)),c==="mark"&&(o=Ra(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{r.doc.nodesBetween(h.$from.pos,h.$to.pos,(f,m)=>{i&&i===f.type&&(u=!0,a&&n.setNodeMarkup(m,void 0,pN(f.attrs,e))),o&&f.marks.length&&f.marks.forEach(g=>{o===g.type&&(u=!0,a&&n.addMark(m,m+f.nodeSize,o.create(pN(g.attrs,e))))})})}),u},R8=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),P8=()=>({tr:t,dispatch:e})=>{if(e){const n=new Fr(t.doc);t.setSelection(n)}return!0},O8=()=>({state:t,dispatch:e})=>jS(t,e),D8=()=>({state:t,dispatch:e})=>CS(t,e),L8=()=>({state:t,dispatch:e})=>qO(t,e),_8=()=>({state:t,dispatch:e})=>YO(t,e),z8=()=>({state:t,dispatch:e})=>JO(t,e);function cx(t,e,n={},r={}){return gd(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var $8=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:a,tr:i,dispatch:o,commands:c})=>{const{doc:u}=i;if(r.preserveWhitespace!=="full"){const h=cx(t,a.schema,r,{errorOnInvalidContent:e??a.options.enableContentCheck});return o&&i.replaceWith(0,u.content.size,h).setMeta("preventUpdate",!n),!0}return o&&i.setMeta("preventUpdate",!n),c.insertContentAt({from:0,to:u.content.size},t,{parseOptions:r,errorOnInvalidContent:e??a.options.enableContentCheck})};function b2(t,e){const n=Ra(e,t.schema),{from:r,to:a,empty:i}=t.selection,o=[];i?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,a,u=>{o.push(...u.marks)});const c=o.find(u=>u.type.name===n.name);return c?{...c.attrs}:{}}function v2(t,e){const n=new h0(t);return e.forEach(r=>{r.steps.forEach(a=>{n.step(a)})}),n}function F8(t){for(let e=0;e{n(a)&&r.push({node:a,pos:i})}),r}function N2(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Lf(t){return e=>N2(e.$from,t)}function We(t,e,n){return t.config[e]===void 0&&t.parent?We(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?We(t.parent,e,n):null}):t.config[e]}function R0(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=We(e,"addExtensions",n);return r?[e,...R0(r())]:e}).flat(10)}function P0(t,e){const n=$o.fromSchema(e).serializeFragment(t),a=document.implementation.createHTMLDocument().createElement("div");return a.appendChild(n),a.innerHTML}function w2(t){return typeof t=="function"}function jt(t,e=void 0,...n){return w2(t)?e?t.bind(e)(...n):t(...n):t}function V8(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Bl(t){const e=t.filter(a=>a.type==="extension"),n=t.filter(a=>a.type==="node"),r=t.filter(a=>a.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function j2(t){const e=[],{nodeExtensions:n,markExtensions:r}=Bl(t),a=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(h=>h.name!=="text").map(h=>h.name),c=r.map(h=>h.name),u=[...o,...c];return t.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage,extensions:a},m=We(h,"addGlobalAttributes",f);if(!m)return;m().forEach(y=>{let v;Array.isArray(y.types)?v=y.types:y.types==="*"?v=u:y.types==="nodes"?v=o:y.types==="marks"?v=c:v=[],v.forEach(w=>{Object.entries(y.attributes).forEach(([N,k])=>{e.push({type:w,name:N,attribute:{...i,...k}})})})})}),a.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage},m=We(h,"addAttributes",f);if(!m)return;const g=m();Object.entries(g).forEach(([y,v])=>{const w={...i,...v};typeof(w==null?void 0:w.default)=="function"&&(w.default=w.default()),w!=null&&w.isRequired&&(w==null?void 0:w.default)===void 0&&delete w.default,e.push({type:h.name,name:y,attribute:w})})}),e}function H8(t){const e=[];let n="",r=!1,a=!1,i=0;const o=t.length;for(let c=0;c0){i-=1,n+=u;continue}if(u===";"&&i===0){e.push(n),n="";continue}}n+=u}return n&&e.push(n),e}function mN(t){const e=[],n=H8(t||""),r=n.length;for(let a=0;a!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([a,i])=>{if(!r[a]){r[a]=i;return}if(a==="class"){const c=i?String(i).split(" "):[],u=r[a]?r[a].split(" "):[],h=c.filter(f=>!u.includes(f));r[a]=[...u,...h].join(" ")}else if(a==="style"){const c=new Map([...mN(r[a]),...mN(i)]);r[a]=Array.from(c.entries()).map(([u,h])=>`${u}: ${h}`).join("; ")}else r[a]=i}),r},{})}function xd(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>kt(n,r),{})}function W8(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function gN(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const a=e.reduce((i,o)=>{const c=o.attribute.parseHTML?o.attribute.parseHTML(n):W8(n.getAttribute(o.name));return c==null?i:{...i,[o.name]:c}},{});return{...r,...a}}}}function xN(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&V8(n)?!1:n!=null))}function yN(t){var e,n;const r={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function U8(t,e){var n;const r=j2(t),{nodeExtensions:a,markExtensions:i}=Bl(t),o=(n=a.find(h=>We(h,"topNode")))==null?void 0:n.name,c=Object.fromEntries(a.map(h=>{const f=r.filter(k=>k.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((k,C)=>{const E=We(C,"extendNodeSchema",m);return{...k,...E?E(h):{}}},{}),y=xN({...g,content:jt(We(h,"content",m)),marks:jt(We(h,"marks",m)),group:jt(We(h,"group",m)),inline:jt(We(h,"inline",m)),atom:jt(We(h,"atom",m)),selectable:jt(We(h,"selectable",m)),draggable:jt(We(h,"draggable",m)),code:jt(We(h,"code",m)),whitespace:jt(We(h,"whitespace",m)),linebreakReplacement:jt(We(h,"linebreakReplacement",m)),defining:jt(We(h,"defining",m)),isolating:jt(We(h,"isolating",m)),attrs:Object.fromEntries(f.map(yN))}),v=jt(We(h,"parseHTML",m));v&&(y.parseDOM=v.map(k=>gN(k,f)));const w=We(h,"renderHTML",m);w&&(y.toDOM=k=>w({node:k,HTMLAttributes:xd(k,f)}));const N=We(h,"renderText",m);return N&&(y.toText=N),[h.name,y]})),u=Object.fromEntries(i.map(h=>{const f=r.filter(N=>N.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((N,k)=>{const C=We(k,"extendMarkSchema",m);return{...N,...C?C(h):{}}},{}),y=xN({...g,inclusive:jt(We(h,"inclusive",m)),excludes:jt(We(h,"excludes",m)),group:jt(We(h,"group",m)),spanning:jt(We(h,"spanning",m)),code:jt(We(h,"code",m)),attrs:Object.fromEntries(f.map(yN))}),v=jt(We(h,"parseHTML",m));v&&(y.parseDOM=v.map(N=>gN(N,f)));const w=We(h,"renderHTML",m);return w&&(y.toDOM=N=>w({mark:N,HTMLAttributes:xd(N,f)})),[h.name,y]}));return new tS({topNode:o,nodes:c,marks:u})}function K8(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Xc(t){return t.sort((n,r)=>{const a=We(n,"priority")||100,i=We(r,"priority")||100;return a>i?-1:ar.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function S2(t,e,n){const{from:r,to:a}=e,{blockSeparator:i=` +`))),0,0),t.someProp("transformPasted",g=>{c=g(c,t,!0)}),c;let m=t.someProp("clipboardTextParser",g=>g(e,a,r,t));if(m)c=m;else{let g=a.marks(),{schema:y}=t.state,v=$o.fromSchema(y);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(w=>{let N=o.appendChild(document.createElement("p"));w&&N.appendChild(v.serializeNode(y.text(w,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),o=YD(n),Td&&QD(o);let h=o&&o.querySelector("[data-pm-slice]"),f=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(f&&f[3])for(let m=+f[3];m>0;m--){let g=o.firstChild;for(;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;o=g}if(c||(c=(t.someProp("clipboardParser")||t.someProp("domParser")||ki.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||f),context:a,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!qD.test(g.parentNode.nodeName)?{ignore:!0}:null}})),f)c=XD(Z1(c,+f[1],+f[2]),f[4]);else if(c=Re.maxOpen(GD(c.content,a),!0),c.openStart||c.openEnd){let m=0,g=0;for(let y=c.content.firstChild;m{c=m(c,t,u)}),c}const qD=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function GD(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let a=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(c=>{if(!o)return;let u=a.findWrapping(c.type),h;if(!u)return o=null;if(h=o.length&&i.length&&XS(u,i,c,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=ZS(o[o.length-1],i.length));let f=QS(c,u);o.push(f),a=a.matchType(f.type),i=u}}),o)return xe.from(o)}return t}function QS(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,xe.from(t));return t}function XS(t,e,n,r,a){if(a1&&(i=0),a=n&&(c=e<0?o.contentMatchAt(0).fillBefore(c,i<=a).append(c):c.append(o.contentMatchAt(o.childCount).fillBefore(xe.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(c))}function Z1(t,e,n){return en})),tg.createHTML(t)):t}function YD(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=t2().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),a;if((a=r&&e2[r[1].toLowerCase()])&&(t=a.map(i=>"<"+i+">").join("")+t+a.map(i=>"").reverse().join("")),n.innerHTML=JD(t),a)for(let i=0;i=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;a=xe.from(u.create(r[c+1],a)),i++,o++}return new Re(a,i,o)}const xr={},yr={},ZD={touchstart:!0,touchmove:!0};class eL{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function tL(t){for(let e in xr){let n=xr[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{rL(t,r)&&!j0(t,r)&&(t.editable||!(r.type in yr))&&n(t,r)},ZD[e]?{passive:!0}:void 0)}sr&&t.dom.addEventListener("input",()=>null),lx(t)}function Ni(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function nL(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function lx(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>j0(t,r))})}function j0(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function rL(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function sL(t,e){!j0(t,e)&&xr[e.type]&&(t.editable||!(e.type in yr))&&xr[e.type](t,e)}yr.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!r2(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(ka&&Un&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Fl&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",a=>a(t,ho(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||KD(t,n)?n.preventDefault():Ni(t,"key")};yr.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};yr.keypress=(t,e)=>{let n=e;if(r2(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Xr&&n.metaKey)return;if(t.someProp("handleKeyPress",a=>a(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Qe)||!r.$from.sameParent(r.$to)){let a=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(a).scrollIntoView();!/[\r\n]/.test(a)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,a,i))&&t.dispatch(i()),n.preventDefault()}};function Rf(t){return{left:t.clientX,top:t.clientY}}function aL(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function k0(t,e,n,r,a){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,c=>o>i.depth?c(t,n,i.nodeAfter,i.before(o),a,!0):c(t,n,i.node(o),i.before(o),a,!1)))return!0;return!1}function Pl(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function iL(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Je.isSelectable(r)?(Pl(t,new Je(n)),!0):!1}function oL(t,e){if(e==-1)return!1;let n=t.state.selection,r,a;n instanceof Je&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let c=o>i.depth?i.nodeAfter:i.node(o);if(Je.isSelectable(c)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?a=i.before(n.$from.depth):a=i.before(o);break}}return a!=null?(Pl(t,Je.create(t.state.doc,a)),!0):!1}function lL(t,e,n,r,a){return k0(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(a?oL(t,n):iL(t,n))}function cL(t,e,n,r){return k0(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",a=>a(t,e,r))}function dL(t,e,n,r){return k0(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",a=>a(t,e,r))||uL(t,n,r)}function uL(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Pl(t,Qe.create(r,0,r.content.size)),!0):!1;let a=r.resolve(e);for(let i=a.depth+1;i>0;i--){let o=i>a.depth?a.nodeAfter:a.node(i),c=a.before(i);if(o.inlineContent)Pl(t,Qe.create(r,c+1,c+1+o.content.size));else if(Je.isSelectable(o))Pl(t,Je.create(r,c));else continue;return!0}}function S0(t){return Eh(t)}const n2=Xr?"metaKey":"ctrlKey";xr.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=S0(t),a=Date.now(),i="singleClick";a-t.input.lastClick.time<500&&aL(n,t.input.lastClick)&&!n[n2]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:a,x:n.clientX,y:n.clientY,type:i,button:n.button};let o=t.posAtCoords(Rf(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new hL(t,o,n,!!r)):(i=="doubleClick"?cL:dL)(t,o.pos,o.inside,n)?n.preventDefault():Ni(t,"pointer"))};class hL{constructor(e,n,r,a){this.view=e,this.pos=n,this.event=r,this.flushed=a,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[n2],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let f=e.state.doc.resolve(n.pos);i=f.parent,o=f.depth?f.before():0}const c=a?null:r.target,u=c?e.docView.nearestDesc(c,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:h}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||h instanceof Je&&h.from<=o&&h.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&es&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Ni(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Ta(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Rf(e))),this.updateAllowDefault(e),this.allowDefault||!n?Ni(this.view,"pointer"):lL(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||sr&&this.mightDrag&&!this.mightDrag.node.isAtom||Un&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Pl(this.view,tt.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Ni(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ni(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}xr.touchstart=t=>{t.input.lastTouch=Date.now(),S0(t),Ni(t,"pointer")};xr.touchmove=t=>{t.input.lastTouch=Date.now(),Ni(t,"pointer")};xr.contextmenu=t=>S0(t);function r2(t,e){return t.composing?!0:sr&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const fL=ka?5e3:-1;yr.compositionstart=yr.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Qe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Un&&OS&&pL(t)))t.markCursor=t.state.storedMarks||n.marks(),Eh(t,!0),t.markCursor=null;else if(Eh(t,!e.selection.empty),es&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let a=r.focusNode,i=r.focusOffset;a&&a.nodeType==1&&i!=0;){let o=i<0?a.lastChild:a.childNodes[i-1];if(!o)break;if(o.nodeType==3){let c=t.domSelection();c&&c.collapse(o,o.nodeValue.length);break}else a=o,i=-1}}t.input.composing=!0}s2(t,fL)};function pL(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}yr.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,s2(t,20))};function s2(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Eh(t),e))}function a2(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=gL());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function mL(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=oD(e.focusNode,e.focusOffset),r=lD(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let a=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!a||!a.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function gL(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Eh(t,e=!1){if(!(ka&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),a2(t),e||t.docView&&t.docView.dirty){let n=v0(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function xL(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),a=document.createRange();a.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(a),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const fd=Mr&&Si<15||Fl&&hD<604;xr.copy=yr.cut=(t,e)=>{let n=e,r=t.state.selection,a=n.type=="cut";if(r.empty)return;let i=fd?null:n.clipboardData,o=r.content(),{dom:c,text:u}=w0(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",c.innerHTML),i.setData("text/plain",u)):xL(t,c),a&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function yL(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function bL(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let a=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?pd(t,r.value,null,a,e):pd(t,r.textContent,r.innerHTML,a,e)},50)}function pd(t,e,n,r,a){let i=YS(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,a,i||Re.empty)))return!0;if(!i)return!1;let o=yL(i),c=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(i);return t.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function i2(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}yr.paste=(t,e)=>{let n=e;if(t.composing&&!ka)return;let r=fd?null:n.clipboardData,a=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&pd(t,i2(r),r.getData("text/html"),a,n)?n.preventDefault():bL(t,n)};class o2{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const vL=Xr?"altKey":"ctrlKey";function l2(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[vL]}xr.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let a=t.state.selection,i=a.empty?null:t.posAtCoords(Rf(n)),o;if(!(i&&i.pos>=a.from&&i.pos<=(a instanceof Je?a.to-1:a.to))){if(r&&r.mightDrag)o=Je.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let m=t.docView.nearestDesc(n.target,!0);m&&m.node.type.spec.draggable&&m!=t.docView&&(o=Je.create(t.state.doc,m.posBefore))}}let c=(o||t.state.selection).content(),{dom:u,text:h,slice:f}=w0(t,c);(!n.dataTransfer.files.length||!Un||PS>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(fd?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",fd||n.dataTransfer.setData("text/plain",h),t.dragging=new o2(f,l2(t,n),o)};xr.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};yr.dragover=yr.dragenter=(t,e)=>e.preventDefault();yr.drop=(t,e)=>{try{NL(t,e,t.dragging)}finally{t.dragging=null}};function NL(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Rf(e));if(!r)return;let a=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",y=>{i=y(i,t,!1)}):i=YS(t,i2(e.dataTransfer),fd?null:e.dataTransfer.getData("text/html"),!1,a);let o=!!(n&&l2(t,e));if(t.someProp("handleDrop",y=>y(t,e,i||Re.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let c=i?hS(t.state.doc,a.pos,i):a.pos;c==null&&(c=a.pos);let u=t.state.tr;if(o){let{node:y}=n;y?y.replace(u):u.deleteSelection()}let h=u.mapping.map(c),f=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,m=u.doc;if(f?u.replaceRangeWith(h,h,i.content.firstChild):u.replaceRange(h,h,i),u.doc.eq(m))return;let g=u.doc.resolve(h);if(f&&Je.isSelectable(i.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(i.content.firstChild))u.setSelection(new Je(g));else{let y=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((v,w,N,k)=>y=k),u.setSelection(N0(t,g,u.doc.resolve(y)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}xr.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Ta(t)},20))};xr.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};xr.beforeinput=(t,e)=>{if(Un&&ka&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,ho(8,"Backspace")))))return;let{$cursor:a}=t.state.selection;a&&a.pos>0&&t.dispatch(t.state.tr.delete(a.pos-1,a.pos).scrollIntoView())},50)}};for(let t in yr)xr[t]=yr[t];function md(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Th{constructor(e,n){this.toDOM=e,this.spec=n||ko,this.side=this.spec.side||0}map(e,n,r,a){let{pos:i,deleted:o}=e.mapResult(n.from+a,this.side<0?-1:1);return o?null:new Tn(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Th&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&md(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Ei{constructor(e,n){this.attrs=e,this.spec=n||ko}map(e,n,r,a){let i=e.map(n.from+a,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+a,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new Tn(i,o,this)}valid(e,n){return n.from=e&&(!i||i(c.spec))&&r.push(c.copy(c.from+a,c.to+a))}for(let o=0;oe){let c=this.children[o]+1;this.children[o+2].findInner(e-c,n-c,r,a+c,i)}}map(e,n,r){return this==tr||e.maps.length==0?this:this.mapInner(e,n,0,0,r||ko)}mapInner(e,n,r,a,i){let o;for(let c=0;c{let h=u+r,f;if(f=d2(n,c,h)){for(a||(a=this.children.slice());ic&&m.to=e){this.children[c]==e&&(r=this.children[c+2]);break}let i=e+1,o=i+n.content.size;for(let c=0;ci&&u.type instanceof Ei){let h=Math.max(i,u.from)-i,f=Math.min(o,u.to)-i;ha.map(e,n,ko));return fi.from(r)}forChild(e,n){if(n.isLeaf)return Pt.empty;let r=[];for(let a=0;an instanceof Pt)?e:e.reduce((n,r)=>n.concat(r instanceof Pt?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let N=w-v-(y-g);for(let k=0;kC+f-m)continue;let E=c[k]+f-m;y>=E?c[k+1]=g<=E?-2:-1:g>=f&&N&&(c[k]+=N,c[k+1]+=N)}m+=N}),f=n.maps[h].map(f,-1)}let u=!1;for(let h=0;h=r.content.size){u=!0;continue}let g=n.map(t[h+1]+i,-1),y=g-a,{index:v,offset:w}=r.content.findIndex(m),N=r.maybeChild(v);if(N&&w==m&&w+N.nodeSize==y){let k=c[h+2].mapInner(n,N,f+1,t[h]+i+1,o);k!=tr?(c[h]=m,c[h+1]=y,c[h+2]=k):(c[h+1]=-2,u=!0)}else u=!0}if(u){let h=jL(c,t,e,n,a,i,o),f=Mh(h,r,0,o);e=f.local;for(let m=0;mn&&o.to{let h=d2(t,c,u+n);if(h){i=!0;let f=Mh(h,c,n+u+1,r);f!=tr&&a.push(u,u+c.nodeSize,f)}});let o=c2(i?u2(t):t,-n).sort(So);for(let c=0;c0;)e++;t.splice(e,0,n)}function ng(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=tr&&e.push(r)}),t.cursorWrapper&&e.push(Pt.create(t.state.doc,[t.cursorWrapper.deco])),fi.from(e)}const kL={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},SL=Mr&&Si<=11;class CL{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class EL{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new CL,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let a=0;aa.type=="childList"&&a.removedNodes.length||a.type=="characterData"&&a.oldValue.length>a.target.nodeValue.length)?this.flushSoon():sr&&e.composing&&r.some(a=>a.type=="childList"&&a.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),SL&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,kL)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;nthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(q1(this.view)){if(this.suppressingSelectionUpdates)return Ta(this.view);if(Mr&&Si<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Io(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=$l(i))n.add(i);for(let i=e.anchorNode;i;i=$l(i))if(n.has(i)){r=i;break}let a=r&&this.view.docView.nearestDesc(r);if(a&&a.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),a=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&q1(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,c=!1,u=[];if(e.editable)for(let f=0;ff.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let f of u)if(f.nodeName=="BR"&&f.parentNode){let m=f.nextSibling;m&&m.nodeType==1&&m.contentEditable=="false"&&f.parentNode.removeChild(f)}}else if(es&&u.length){let f=u.filter(m=>m.nodeName=="BR");if(f.length==2){let[m,g]=f;m.parentNode&&m.parentNode.parentNode==g.parentNode?g.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let g of f){let y=g.parentNode;y&&y.nodeName=="LI"&&(!m||AL(e,m)!=y)&&g.remove()}}}let h=null;i<0&&a&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||a)&&(i>-1&&(e.docView.markDirty(i,o),TL(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,IL(e,u)),this.handleDOMChange(i,o,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Ta(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let f=0;fa;N--){let k=r.childNodes[N-1],C=k.pmViewDesc;if(k.nodeName=="BR"&&!C){i=N;break}if(!C||C.size)break}let m=t.state.doc,g=t.someProp("domParser")||ki.fromSchema(t.state.schema),y=m.resolve(o),v=null,w=g.parse(r,{topNode:y.parent,topMatch:y.parent.contentMatchAt(y.index()),topOpen:!0,from:a,to:i,preserveWhitespace:y.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:PL,context:y});if(h&&h[0].pos!=null){let N=h[0].pos,k=h[1]&&h[1].pos;k==null&&(k=N),v={anchor:N+o,head:k+o}}return{doc:w,sel:v,from:o,to:c}}function PL(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(sr&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||sr&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const OL=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function DL(t,e,n,r,a){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let _=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,P=v0(t,_);if(P&&!t.state.selection.eq(P)){if(Un&&ka&&t.input.lastKeyCode===13&&Date.now()-100z(t,ho(13,"Enter"))))return;let L=t.state.tr.setSelection(P);_=="pointer"?L.setMeta("pointer",!0):_=="key"&&L.scrollIntoView(),i&&L.setMeta("composition",i),t.dispatch(L)}return}let o=t.state.doc.resolve(e),c=o.sharedDepth(n);e=o.before(c+1),n=t.state.doc.resolve(n).after(c+1);let u=t.state.selection,h=RL(t,e,n),f=t.state.doc,m=f.slice(h.from,h.to),g,y;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||ka)&&a.some(_=>_.nodeType==1&&!OL.test(_.nodeName))&&(!v||v.endA>=v.endB)&&t.someProp("handleKeyDown",_=>_(t,ho(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!v)if(r&&u instanceof Qe&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(h.sel&&h.sel.anchor!=h.sel.head))v={start:u.from,endA:u.to,endB:u.to};else{if(h.sel){let _=aN(t,t.state.doc,h.sel);if(_&&!_.eq(t.state.selection)){let P=t.state.tr.setSelection(_);i&&P.setMeta("composition",i),t.dispatch(P)}}return}t.state.selection.fromt.state.selection.from&&v.start<=t.state.selection.from+2&&t.state.selection.from>=h.from?v.start=t.state.selection.from:v.endA=t.state.selection.to-2&&t.state.selection.to<=h.to&&(v.endB+=t.state.selection.to-v.endA,v.endA=t.state.selection.to)),Mr&&Si<=11&&v.endB==v.start+1&&v.endA==v.start&&v.start>h.from&&h.doc.textBetween(v.start-h.from-1,v.start-h.from+1)=="  "&&(v.start--,v.endA--,v.endB--);let w=h.doc.resolveNoCache(v.start-h.from),N=h.doc.resolveNoCache(v.endB-h.from),k=f.resolve(v.start),C=w.sameParent(N)&&w.parent.inlineContent&&k.end()>=v.endA;if((Fl&&t.input.lastIOSEnter>Date.now()-225&&(!C||a.some(_=>_.nodeName=="DIV"||_.nodeName=="P"))||!C&&w.pos_(t,ho(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>v.start&&_L(f,v.start,v.endA,w,N)&&t.someProp("handleKeyDown",_=>_(t,ho(8,"Backspace")))){ka&&Un&&t.domObserver.suppressSelectionUpdates();return}Un&&v.endB==v.start&&(t.input.lastChromeDelete=Date.now()),ka&&!C&&w.start()!=N.start()&&N.parentOffset==0&&w.depth==N.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==v.endA&&(v.endB-=2,N=h.doc.resolveNoCache(v.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function(_){return _(t,ho(13,"Enter"))})},20));let E=v.start,A=v.endA,I=_=>{let P=_||t.state.tr.replace(E,A,h.doc.slice(v.start-h.from,v.endB-h.from));if(h.sel){let L=aN(t,P.doc,h.sel);L&&!(Un&&t.composing&&L.empty&&(v.start!=v.endB||t.input.lastChromeDeleteTa(t),20));let _=I(t.state.tr.delete(E,A)),P=f.resolve(v.start).marksAcross(f.resolve(v.endA));P&&_.ensureMarks(P),t.dispatch(_)}else if(v.endA==v.endB&&(D=LL(w.parent.content.cut(w.parentOffset,N.parentOffset),k.parent.content.cut(k.parentOffset,v.endA-k.start())))){let _=I(t.state.tr);D.type=="add"?_.addMark(E,A,D.mark):_.removeMark(E,A,D.mark),t.dispatch(_)}else if(w.parent.child(w.index()).isText&&w.index()==N.index()-(N.textOffset?0:1)){let _=w.parent.textBetween(w.parentOffset,N.parentOffset),P=()=>I(t.state.tr.insertText(_,E,A));t.someProp("handleTextInput",L=>L(t,E,A,_,P))||t.dispatch(P())}else t.dispatch(I());else t.dispatch(I())}function aN(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:N0(t,e.resolve(n.anchor),e.resolve(n.head))}function LL(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,a=n,i=r,o,c,u;for(let f=0;ff.mark(c.addToSet(f.marks));else if(a.length==0&&i.length==1)c=i[0],o="remove",u=f=>f.mark(c.removeFromSet(f.marks));else return null;let h=[];for(let f=0;fn||rg(o,!0,!1)0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,a++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,a++}return a}function zL(t,e,n,r,a){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:o,b:c}=t.findDiffEnd(e,n+t.size,n+e.size);if(a=="end"){let u=Math.max(0,i-Math.min(o,c));r-=o+u-i}if(o=o?i-r:0;i-=u,i&&i=c?i-r:0;i-=u,i&&i=56320&&e<=57343&&n>=55296&&n<=56319}class h2{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new eL,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(uN),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=cN(this),lN(this),this.nodeViews=dN(this),this.docView=B1(this.state.doc,oN(this),ng(this),this.dom,this),this.domObserver=new EL(this,(r,a,i,o)=>DL(this,r,a,i,o)),this.domObserver.start(),tL(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&lx(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(uN),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let a=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(a2(this),o=!0),this.state=e;let c=a.plugins!=e.plugins||this._props.plugins!=n.plugins;if(c||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let y=dN(this);FL(y,this.nodeViews)&&(this.nodeViews=y,i=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&lx(this),this.editable=cN(this),lN(this);let u=ng(this),h=oN(this),f=a.plugins!=e.plugins&&!a.doc.eq(e.doc)?"reset":e.scrollToSelection>a.scrollToSelection?"to selection":"preserve",m=i||!this.docView.matchesNode(e.doc,h,u);(m||!e.selection.eq(a.selection))&&(o=!0);let g=f=="preserve"&&o&&this.dom.style.overflowAnchor==null&&mD(this);if(o){this.domObserver.stop();let y=m&&(Mr||Un)&&!this.composing&&!a.selection.empty&&!e.selection.empty&&$L(a.selection,e.selection);if(m){let v=Un?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=mL(this)),(i||!this.docView.update(e.doc,h,u,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=B1(e.doc,h,u,this.dom,this)),v&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(y=!0)}y||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&$D(this))?Ta(this,y):(qS(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(a),!((r=this.dragging)===null||r===void 0)&&r.node&&!a.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,a),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():g&&gD(g)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Je){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&D1(this,n.getBoundingClientRect(),e)}else D1(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n0&&this.state.doc.nodeAt(i))==r.node&&(a=i)}this.dragging=new o2(e.slice,e.move,a<0?void 0:Je.create(this.state.doc,a))}someProp(e,n){let r=this._props&&this._props[e],a;if(r!=null&&(a=n?n(r):r))return a;for(let o=0;on.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return wD(this,e)}coordsAtPos(e,n=1){return $S(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let a=this.docView.posFromDOM(e,n,r);if(a==null)throw new RangeError("DOM position not inside the editor");return a}endOfTextblock(e,n){return ED(this,n||this.state,e)}pasteHTML(e,n){return pd(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return pd(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return w0(this,e)}destroy(){this.docView&&(nL(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ng(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,aD())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return sL(this,e)}domSelectionRange(){let e=this.domSelection();return e?sr&&this.root.nodeType===11&&dD(this.dom.ownerDocument)==this.dom&&ML(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}h2.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function oN(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Tn.node(0,t.state.doc.content.size,e)]}function lN(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Tn.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function cN(t){return!t.someProp("editable",e=>e(t.state)===!1)}function $L(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function dN(t){let e=Object.create(null);function n(r){for(let a in r)Object.prototype.hasOwnProperty.call(e,a)||(e[a]=r[a])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function FL(t,e){let n=0,r=0;for(let a in t){if(t[a]!=e[a])return!0;n++}for(let a in e)r++;return n!=r}function uN(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Mi={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Ah={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},BL=typeof navigator<"u"&&/Mac/.test(navigator.platform),VL=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Wn=0;Wn<10;Wn++)Mi[48+Wn]=Mi[96+Wn]=String(Wn);for(var Wn=1;Wn<=24;Wn++)Mi[Wn+111]="F"+Wn;for(var Wn=65;Wn<=90;Wn++)Mi[Wn]=String.fromCharCode(Wn+32),Ah[Wn]=String.fromCharCode(Wn);for(var sg in Mi)Ah.hasOwnProperty(sg)||(Ah[sg]=Mi[sg]);function HL(t){var e=BL&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||VL&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Ah:Mi)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const WL=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),UL=typeof navigator<"u"&&/Win/.test(navigator.platform);function KL(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,a,i,o;for(let c=0;c{for(var n in e)JL(t,n,{get:e[n],enumerable:!0})};function Pf(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:a}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return a},get tr(){return r=n.selection,a=n.doc,i=n.storedMarks,n}}}var Of=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:a}=n,i=this.buildProps(a);return Object.fromEntries(Object.entries(t).map(([o,c])=>[o,(...h)=>{const f=c(...h)(i);return!a.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(a),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:a}=this,{view:i}=r,o=[],c=!!t,u=t||a.tr,h=()=>(!c&&e&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(u),o.every(m=>m===!0)),f={...Object.fromEntries(Object.entries(n).map(([m,g])=>[m,(...v)=>{const w=this.buildProps(u,e),N=g(...v)(w);return o.push(N),f}])),run:h};return f}createCan(t){const{rawCommands:e,state:n}=this,r=!1,a=t||n.tr,i=this.buildProps(a,r);return{...Object.fromEntries(Object.entries(e).map(([c,u])=>[c,(...h)=>u(...h)({...i,dispatch:void 0})])),chain:()=>this.createChain(a,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:a}=this,{view:i}=r,o={tr:t,editor:r,view:i,state:Pf({state:a,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([c,u])=>[c,(...h)=>u(...h)(o)]))}};return o}},f2={};M0(f2,{blur:()=>YL,clearContent:()=>QL,clearNodes:()=>XL,command:()=>ZL,createParagraphNear:()=>e8,cut:()=>t8,deleteCurrentNode:()=>n8,deleteNode:()=>r8,deleteRange:()=>s8,deleteSelection:()=>a8,enter:()=>i8,exitCode:()=>o8,extendMarkRange:()=>l8,first:()=>c8,focus:()=>u8,forEach:()=>h8,insertContent:()=>f8,insertContentAt:()=>g8,joinBackward:()=>b8,joinDown:()=>y8,joinForward:()=>v8,joinItemBackward:()=>N8,joinItemForward:()=>w8,joinTextblockBackward:()=>j8,joinTextblockForward:()=>k8,joinUp:()=>x8,keyboardShortcut:()=>C8,lift:()=>E8,liftEmptyBlock:()=>T8,liftListItem:()=>M8,newlineInCode:()=>A8,resetAttributes:()=>I8,scrollIntoView:()=>R8,selectAll:()=>P8,selectNodeBackward:()=>O8,selectNodeForward:()=>D8,selectParentNode:()=>L8,selectTextblockEnd:()=>_8,selectTextblockStart:()=>z8,setContent:()=>$8,setMark:()=>a6,setMeta:()=>i6,setNode:()=>o6,setNodeSelection:()=>l6,setTextDirection:()=>c6,setTextSelection:()=>d6,sinkListItem:()=>u6,splitBlock:()=>h6,splitListItem:()=>f6,toggleList:()=>p6,toggleMark:()=>m6,toggleNode:()=>g6,toggleWrap:()=>x6,undoInputRule:()=>y6,unsetAllMarks:()=>b6,unsetMark:()=>v6,unsetTextDirection:()=>N6,updateAttributes:()=>w6,wrapIn:()=>j6,wrapInList:()=>k6});var YL=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),QL=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),XL=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:a}=r;return n&&a.forEach(({$from:i,$to:o})=>{t.doc.nodesBetween(i.pos,o.pos,(c,u)=>{if(c.type.isText)return;const{doc:h,mapping:f}=e,m=h.resolve(f.map(u)),g=h.resolve(f.map(u+c.nodeSize)),y=m.blockRange(g);if(!y)return;const v=Xl(y);if(c.type.isTextblock){const{defaultType:w}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(y.start,w)}(v||v===0)&&e.lift(y,v)})}),!0},ZL=t=>e=>t(e),e8=()=>({state:t,dispatch:e})=>TS(t,e),t8=(t,e)=>({editor:n,tr:r})=>{const{state:a}=n,i=a.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new Qe(r.doc.resolve(Math.max(o-1,0)))),!0},n8=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const a=t.selection.$anchor;for(let i=a.depth;i>0;i-=1)if(a.node(i).type===r.type){if(e){const c=a.before(i),u=a.after(i);t.delete(c,u).scrollIntoView()}return!0}return!1};function Nn(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var r8=t=>({tr:e,state:n,dispatch:r})=>{const a=Nn(t,n.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===a){if(r){const u=i.before(o),h=i.after(o);e.delete(u,h).scrollIntoView()}return!0}return!1},s8=t=>({tr:e,dispatch:n})=>{const{from:r,to:a}=t;return n&&e.delete(r,a),!0},a8=()=>({state:t,dispatch:e})=>p0(t,e),i8=()=>({commands:t})=>t.keyboardShortcut("Enter"),o8=()=>({state:t,dispatch:e})=>WO(t,e);function A0(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Ih(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(a=>n.strict?e[a]===t[a]:A0(e[a])?e[a].test(t[a]):e[a]===t[a]):!0}function p2(t,e,n={}){return t.find(r=>r.type===e&&Ih(Object.fromEntries(Object.keys(n).map(a=>[a,r.attrs[a]])),n))}function hN(t,e,n={}){return!!p2(t,e,n)}function I0(t,e,n){var r;if(!t||!e)return;let a=t.parent.childAfter(t.parentOffset);if((!a.node||!a.node.marks.some(f=>f.type===e))&&(a=t.parent.childBefore(t.parentOffset)),!a.node||!a.node.marks.some(f=>f.type===e)||(n=n||((r=a.node.marks[0])==null?void 0:r.attrs),!p2([...a.node.marks],e,n)))return;let o=a.index,c=t.start()+a.offset,u=o+1,h=c+a.node.nodeSize;for(;o>0&&hN([...t.parent.child(o-1).marks],e,n);)o-=1,c-=t.parent.child(o).nodeSize;for(;u({tr:n,state:r,dispatch:a})=>{const i=Ra(t,r.schema),{doc:o,selection:c}=n,{$from:u,from:h,to:f}=c;if(a){const m=I0(u,i,e);if(m&&m.from<=h&&m.to>=f){const g=Qe.create(o,m.from,m.to);n.setSelection(g)}}return!0},c8=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r({editor:n,view:r,tr:a,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(Rh()||fN())&&r.dom.focus(),d8()&&!Rh()&&!fN()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(i&&t===null&&!m2(n.state.selection))return o(),!0;const c=g2(a.doc,t)||n.state.selection,u=n.state.selection.eq(c);return i&&(u||a.setSelection(c),u&&a.storedMarks&&a.setStoredMarks(a.storedMarks),o()),!0},h8=(t,e)=>n=>t.every((r,a)=>e(r,{...n,index:a})),f8=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),x2=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&x2(r)}return t};function Vu(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`${t}`,n=new window.DOMParser().parseFromString(e,"text/html").body;return x2(n)}function gd(t,e,n){if(t instanceof Ca||t instanceof xe)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,a=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return xe.fromArray(t.map(c=>e.nodeFromJSON(c)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),gd("",e,n)}if(a){if(n.errorOnInvalidContent){let o=!1,c="";const u=new tS({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:h=>(o=!0,c=typeof h=="string"?h:h.outerHTML,null)}]}})});if(n.slice?ki.fromSchema(u).parseSlice(Vu(t),n.parseOptions):ki.fromSchema(u).parse(Vu(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const i=ki.fromSchema(e);return n.slice?i.parseSlice(Vu(t),n.parseOptions).content:i.parse(Vu(t),n.parseOptions)}return gd("",e,n)}function p8(t,e,n){const r=t.steps.length-1;if(r{o===0&&(o=f)}),t.setSelection(tt.near(t.doc.resolve(o),n))}var m8=t=>!("type"in t),g8=(t,e,n)=>({tr:r,dispatch:a,editor:i})=>{var o;if(a){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const u=N=>{i.emit("contentError",{editor:i,error:N,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},h={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{gd(e,i.schema,{parseOptions:h,errorOnInvalidContent:!0})}catch(N){u(N)}try{c=gd(e,i.schema,{parseOptions:h,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(N){return u(N),!1}let{from:f,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,y=!0;if((m8(c)?c:[c]).forEach(N=>{N.check(),g=g?N.isText&&N.marks.length===0:!1,y=y?N.isBlock:!1}),f===m&&y){const{parent:N}=r.doc.resolve(f);N.isTextblock&&!N.type.spec.code&&!N.childCount&&(f-=1,m+=1)}let w;if(g){if(Array.isArray(e))w=e.map(N=>N.text||"").join("");else if(e instanceof xe){let N="";e.forEach(k=>{k.text&&(N+=k.text)}),w=N}else typeof e=="object"&&e&&e.text?w=e.text:w=e;r.insertText(w,f,m)}else{w=c;const N=r.doc.resolve(f),k=N.node(),C=N.parentOffset===0,E=k.isText||k.isTextblock,A=k.content.size>0;C&&E&&A&&(f=Math.max(0,f-1)),r.replaceWith(f,m,w)}n.updateSelection&&p8(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:f,text:w}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:f,text:w})}return!0},x8=()=>({state:t,dispatch:e})=>BO(t,e),y8=()=>({state:t,dispatch:e})=>VO(t,e),b8=()=>({state:t,dispatch:e})=>NS(t,e),v8=()=>({state:t,dispatch:e})=>SS(t,e),N8=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Ef(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},w8=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Ef(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},j8=()=>({state:t,dispatch:e})=>$O(t,e),k8=()=>({state:t,dispatch:e})=>FO(t,e);function y2(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function S8(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,a,i,o;for(let c=0;c({editor:e,view:n,tr:r,dispatch:a})=>{const i=S8(t).split(/-(?!$)/),o=i.find(h=>!["Alt","Ctrl","Meta","Shift"].includes(h)),c=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",h=>h(n,c))});return u==null||u.steps.forEach(h=>{const f=h.map(r.mapping);f&&a&&r.maybeStep(f)}),!0};function Ai(t,e,n={}){const{from:r,to:a,empty:i}=t.selection,o=e?Nn(e,t.schema):null,c=[];t.doc.nodesBetween(r,a,(m,g)=>{if(m.isText)return;const y=Math.max(r,g),v=Math.min(a,g+m.nodeSize);c.push({node:m,from:y,to:v})});const u=a-r,h=c.filter(m=>o?o.name===m.node.type.name:!0).filter(m=>Ih(m.node.attrs,n,{strict:!1}));return i?!!h.length:h.reduce((m,g)=>m+g.to-g.from,0)>=u}var E8=(t,e={})=>({state:n,dispatch:r})=>{const a=Nn(t,n.schema);return Ai(n,a,e)?HO(n,r):!1},T8=()=>({state:t,dispatch:e})=>MS(t,e),M8=t=>({state:e,dispatch:n})=>{const r=Nn(t,e.schema);return tD(r)(e,n)},A8=()=>({state:t,dispatch:e})=>ES(t,e);function Df(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function pN(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,a)=>(n.includes(a)||(r[a]=t[a]),r),{})}var I8=(t,e)=>({tr:n,state:r,dispatch:a})=>{let i=null,o=null;const c=Df(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(i=Nn(t,r.schema)),c==="mark"&&(o=Ra(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{r.doc.nodesBetween(h.$from.pos,h.$to.pos,(f,m)=>{i&&i===f.type&&(u=!0,a&&n.setNodeMarkup(m,void 0,pN(f.attrs,e))),o&&f.marks.length&&f.marks.forEach(g=>{o===g.type&&(u=!0,a&&n.addMark(m,m+f.nodeSize,o.create(pN(g.attrs,e))))})})}),u},R8=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),P8=()=>({tr:t,dispatch:e})=>{if(e){const n=new Fr(t.doc);t.setSelection(n)}return!0},O8=()=>({state:t,dispatch:e})=>jS(t,e),D8=()=>({state:t,dispatch:e})=>CS(t,e),L8=()=>({state:t,dispatch:e})=>qO(t,e),_8=()=>({state:t,dispatch:e})=>YO(t,e),z8=()=>({state:t,dispatch:e})=>JO(t,e);function cx(t,e,n={},r={}){return gd(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var $8=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:a,tr:i,dispatch:o,commands:c})=>{const{doc:u}=i;if(r.preserveWhitespace!=="full"){const h=cx(t,a.schema,r,{errorOnInvalidContent:e??a.options.enableContentCheck});return o&&i.replaceWith(0,u.content.size,h).setMeta("preventUpdate",!n),!0}return o&&i.setMeta("preventUpdate",!n),c.insertContentAt({from:0,to:u.content.size},t,{parseOptions:r,errorOnInvalidContent:e??a.options.enableContentCheck})};function b2(t,e){const n=Ra(e,t.schema),{from:r,to:a,empty:i}=t.selection,o=[];i?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,a,u=>{o.push(...u.marks)});const c=o.find(u=>u.type.name===n.name);return c?{...c.attrs}:{}}function v2(t,e){const n=new h0(t);return e.forEach(r=>{r.steps.forEach(a=>{n.step(a)})}),n}function F8(t){for(let e=0;e{n(a)&&r.push({node:a,pos:i})}),r}function N2(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Lf(t){return e=>N2(e.$from,t)}function We(t,e,n){return t.config[e]===void 0&&t.parent?We(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?We(t.parent,e,n):null}):t.config[e]}function R0(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=We(e,"addExtensions",n);return r?[e,...R0(r())]:e}).flat(10)}function P0(t,e){const n=$o.fromSchema(e).serializeFragment(t),a=document.implementation.createHTMLDocument().createElement("div");return a.appendChild(n),a.innerHTML}function w2(t){return typeof t=="function"}function jt(t,e=void 0,...n){return w2(t)?e?t.bind(e)(...n):t(...n):t}function V8(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Bl(t){const e=t.filter(a=>a.type==="extension"),n=t.filter(a=>a.type==="node"),r=t.filter(a=>a.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function j2(t){const e=[],{nodeExtensions:n,markExtensions:r}=Bl(t),a=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(h=>h.name!=="text").map(h=>h.name),c=r.map(h=>h.name),u=[...o,...c];return t.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage,extensions:a},m=We(h,"addGlobalAttributes",f);if(!m)return;m().forEach(y=>{let v;Array.isArray(y.types)?v=y.types:y.types==="*"?v=u:y.types==="nodes"?v=o:y.types==="marks"?v=c:v=[],v.forEach(w=>{Object.entries(y.attributes).forEach(([N,k])=>{e.push({type:w,name:N,attribute:{...i,...k}})})})})}),a.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage},m=We(h,"addAttributes",f);if(!m)return;const g=m();Object.entries(g).forEach(([y,v])=>{const w={...i,...v};typeof(w==null?void 0:w.default)=="function"&&(w.default=w.default()),w!=null&&w.isRequired&&(w==null?void 0:w.default)===void 0&&delete w.default,e.push({type:h.name,name:y,attribute:w})})}),e}function H8(t){const e=[];let n="",r=!1,a=!1,i=0;const o=t.length;for(let c=0;c0){i-=1,n+=u;continue}if(u===";"&&i===0){e.push(n),n="";continue}}n+=u}return n&&e.push(n),e}function mN(t){const e=[],n=H8(t||""),r=n.length;for(let a=0;a!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([a,i])=>{if(!r[a]){r[a]=i;return}if(a==="class"){const c=i?String(i).split(" "):[],u=r[a]?r[a].split(" "):[],h=c.filter(f=>!u.includes(f));r[a]=[...u,...h].join(" ")}else if(a==="style"){const c=new Map([...mN(r[a]),...mN(i)]);r[a]=Array.from(c.entries()).map(([u,h])=>`${u}: ${h}`).join("; ")}else r[a]=i}),r},{})}function xd(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>kt(n,r),{})}function W8(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function gN(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const a=e.reduce((i,o)=>{const c=o.attribute.parseHTML?o.attribute.parseHTML(n):W8(n.getAttribute(o.name));return c==null?i:{...i,[o.name]:c}},{});return{...r,...a}}}}function xN(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&V8(n)?!1:n!=null))}function yN(t){var e,n;const r={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function U8(t,e){var n;const r=j2(t),{nodeExtensions:a,markExtensions:i}=Bl(t),o=(n=a.find(h=>We(h,"topNode")))==null?void 0:n.name,c=Object.fromEntries(a.map(h=>{const f=r.filter(k=>k.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((k,C)=>{const E=We(C,"extendNodeSchema",m);return{...k,...E?E(h):{}}},{}),y=xN({...g,content:jt(We(h,"content",m)),marks:jt(We(h,"marks",m)),group:jt(We(h,"group",m)),inline:jt(We(h,"inline",m)),atom:jt(We(h,"atom",m)),selectable:jt(We(h,"selectable",m)),draggable:jt(We(h,"draggable",m)),code:jt(We(h,"code",m)),whitespace:jt(We(h,"whitespace",m)),linebreakReplacement:jt(We(h,"linebreakReplacement",m)),defining:jt(We(h,"defining",m)),isolating:jt(We(h,"isolating",m)),attrs:Object.fromEntries(f.map(yN))}),v=jt(We(h,"parseHTML",m));v&&(y.parseDOM=v.map(k=>gN(k,f)));const w=We(h,"renderHTML",m);w&&(y.toDOM=k=>w({node:k,HTMLAttributes:xd(k,f)}));const N=We(h,"renderText",m);return N&&(y.toText=N),[h.name,y]})),u=Object.fromEntries(i.map(h=>{const f=r.filter(N=>N.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((N,k)=>{const C=We(k,"extendMarkSchema",m);return{...N,...C?C(h):{}}},{}),y=xN({...g,inclusive:jt(We(h,"inclusive",m)),excludes:jt(We(h,"excludes",m)),group:jt(We(h,"group",m)),spanning:jt(We(h,"spanning",m)),code:jt(We(h,"code",m)),attrs:Object.fromEntries(f.map(yN))}),v=jt(We(h,"parseHTML",m));v&&(y.parseDOM=v.map(N=>gN(N,f)));const w=We(h,"renderHTML",m);return w&&(y.toDOM=N=>w({mark:N,HTMLAttributes:xd(N,f)})),[h.name,y]}));return new tS({topNode:o,nodes:c,marks:u})}function K8(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Xc(t){return t.sort((n,r)=>{const a=We(n,"priority")||100,i=We(r,"priority")||100;return a>i?-1:ar.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function S2(t,e,n){const{from:r,to:a}=e,{blockSeparator:i=` `,textSerializers:o={}}=n||{};let c="";return t.nodesBetween(r,a,(u,h,f,m)=>{var g;u.isBlock&&h>r&&(c+=i);const y=o==null?void 0:o[u.type.name];if(y)return f&&(c+=y({node:u,pos:h,parent:f,index:m,range:e})),!1;u.isText&&(c+=(g=u==null?void 0:u.text)==null?void 0:g.slice(Math.max(r,h)-h,a-h))}),c}function q8(t,e){const n={from:0,to:t.content.size};return S2(t,n,e)}function C2(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function G8(t,e){const n=Nn(e,t.schema),{from:r,to:a}=t.selection,i=[];t.doc.nodesBetween(r,a,c=>{i.push(c)});const o=i.reverse().find(c=>c.type.name===n.name);return o?{...o.attrs}:{}}function E2(t,e){const n=Df(typeof e=="string"?e:e.name,t.schema);return n==="node"?G8(t,e):n==="mark"?b2(t,e):{}}function J8(t,e=JSON.stringify){const n={};return t.filter(r=>{const a=e(r);return Object.prototype.hasOwnProperty.call(n,a)?!1:n[a]=!0})}function Y8(t){const e=J8(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,o)=>o!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function T2(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((a,i)=>{const o=[];if(a.ranges.length)a.forEach((c,u)=>{o.push({from:c,to:u})});else{const{from:c,to:u}=n[i];if(c===void 0||u===void 0)return;o.push({from:c,to:u})}o.forEach(({from:c,to:u})=>{const h=e.slice(i).map(c,-1),f=e.slice(i).map(u),m=e.invert().map(h,-1),g=e.invert().map(f);r.push({oldRange:{from:m,to:g},newRange:{from:h,to:f}})})}),Y8(r)}function O0(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(a=>{const i=n.resolve(t),o=I0(i,a.type);o&&r.push({mark:a,...o})}):n.nodesBetween(t,e,(a,i)=>{!a||(a==null?void 0:a.nodeSize)===void 0||r.push(...a.marks.map(o=>({from:i,to:i+a.nodeSize,mark:o})))}),r}var Q8=(t,e,n,r=20)=>{const a=t.doc.resolve(n);let i=r,o=null;for(;i>0&&o===null;){const c=a.node(i);(c==null?void 0:c.type.name)===e?o=c:i-=1}return[o,i]};function Lc(t,e){return e.nodes[t]||e.marks[t]||null}function ih(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const a=t.find(i=>i.type===e&&i.name===r);return a?a.attribute.keepOnSplit:!1}))}var X8=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(a,i,o,c)=>{var u,h;const f=((h=(u=a.type.spec).toText)==null?void 0:h.call(u,{node:a,pos:i,parent:o,index:c}))||a.textContent||"%leaf%";n+=a.isAtom&&!a.isText?f:f.slice(0,Math.max(0,r-i))}),n};function dx(t,e,n={}){const{empty:r,ranges:a}=t.selection,i=e?Ra(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>i?i.name===m.type.name:!0).find(m=>Ih(m.attrs,n,{strict:!1}));let o=0;const c=[];if(a.forEach(({$from:m,$to:g})=>{const y=m.pos,v=g.pos;t.doc.nodesBetween(y,v,(w,N)=>{if(i&&w.inlineContent&&!w.type.allowsMarkType(i))return!1;if(!w.isText&&!w.marks.length)return;const k=Math.max(y,N),C=Math.min(v,N+w.nodeSize),E=C-k;o+=E,c.push(...w.marks.map(A=>({mark:A,from:k,to:C})))})}),o===0)return!1;const u=c.filter(m=>i?i.name===m.mark.type.name:!0).filter(m=>Ih(m.mark.attrs,n,{strict:!1})).reduce((m,g)=>m+g.to-g.from,0),h=c.filter(m=>i?m.mark.type!==i&&m.mark.type.excludes(i):!0).reduce((m,g)=>m+g.to-g.from,0);return(u>0?u+h:u)>=o}function Z8(t,e,n={}){if(!e)return Ai(t,null,n)||dx(t,null,n);const r=Df(e,t.schema);return r==="node"?Ai(t,e,n):r==="mark"?dx(t,e,n):!1}var e6=(t,e)=>{const{$from:n,$to:r,$anchor:a}=t.selection;if(e){const i=Lf(c=>c.type.name===e)(t.selection);if(!i)return!1;const o=t.doc.resolve(i.pos+1);return a.pos+1===o.end()}return!(r.parentOffset{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function bN(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function vN(t,e){const{nodeExtensions:n}=Bl(e),r=n.find(o=>o.name===t);if(!r)return!1;const a={name:r.name,options:r.options,storage:r.storage},i=jt(We(r,"group",a));return typeof i!="string"?!1:i.split(" ").includes("list")}function _f(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let a=!0;return t.content.forEach(i=>{a!==!1&&(_f(i,{ignoreWhitespace:n,checkChildren:e})||(a=!1))}),a}return!1}function M2(t){return t instanceof Je}var A2=class I2{constructor(e){this.position=e}static fromJSON(e){return new I2(e.position)}toJSON(){return{position:this.position}}};function n6(t,e){const n=e.mapping.mapResult(t.position);return{position:new A2(n.pos),mapResult:n}}function r6(t){return new A2(t)}function s6(t,e,n){var r;const{selection:a}=e;let i=null;if(m2(a)&&(i=a.$cursor),i){const c=(r=t.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(c)||!c.some(h=>h.type.excludes(n)))}const{ranges:o}=a;return o.some(({$from:c,$to:u})=>{let h=c.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(c.pos,u.pos,(f,m,g)=>{if(h)return!1;if(f.isInline){const y=!g||g.type.allowsMarkType(n),v=!!n.isInSet(f.marks)||!f.marks.some(w=>w.type.excludes(n));h=y&&v}return!h}),h})}var a6=(t,e={})=>({tr:n,state:r,dispatch:a})=>{const{selection:i}=n,{empty:o,ranges:c}=i,u=Ra(t,r.schema);if(a)if(o){const h=b2(r,u);n.addStoredMark(u.create({...h,...e}))}else c.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;r.doc.nodesBetween(f,m,(g,y)=>{const v=Math.max(y,f),w=Math.min(y+g.nodeSize,m);g.marks.find(k=>k.type===u)?g.marks.forEach(k=>{u===k.type&&n.addMark(v,w,u.create({...k.attrs,...e}))}):n.addMark(v,w,u.create(e))})});return s6(r,n,u)},i6=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),o6=(t,e={})=>({state:n,dispatch:r,chain:a})=>{const i=Nn(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),i.isTextblock?a().command(({commands:c})=>R1(i,{...o,...e})(n)?!0:c.clearNodes()).command(({state:c})=>R1(i,{...o,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},l6=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,a=xo(t,0,r.content.size),i=Je.create(r,a);e.setSelection(i)}return!0},c6=(t,e)=>({tr:n,state:r,dispatch:a})=>{const{selection:i}=r;let o,c;return typeof e=="number"?(o=e,c=e):e&&"from"in e&&"to"in e?(o=e.from,c=e.to):(o=i.from,c=i.to),a&&n.doc.nodesBetween(o,c,(u,h)=>{u.isText||n.setNodeMarkup(h,void 0,{...u.attrs,dir:t})}),!0},d6=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:a,to:i}=typeof t=="number"?{from:t,to:t}:t,o=Qe.atStart(r).from,c=Qe.atEnd(r).to,u=xo(a,o,c),h=xo(i,o,c),f=Qe.create(r,u,h);e.setSelection(f)}return!0},u6=t=>({state:e,dispatch:n})=>{const r=Nn(t,e.schema);return sD(r)(e,n)};function NN(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(a=>e==null?void 0:e.includes(a.type.name));t.tr.ensureMarks(r)}}var h6=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:a})=>{const{selection:i,doc:o}=e,{$from:c,$to:u}=i,h=a.extensionManager.attributes,f=ih(h,c.node().type.name,c.node().attrs);if(i instanceof Je&&i.node.isBlock)return!c.parentOffset||!Ea(o,c.pos)?!1:(r&&(t&&NN(n,a.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const m=u.parentOffset===u.parent.content.size,g=c.depth===0?void 0:F8(c.node(-1).contentMatchAt(c.indexAfter(-1)));let y=m&&g?[{type:g,attrs:f}]:void 0,v=Ea(e.doc,e.mapping.map(c.pos),1,y);if(!y&&!v&&Ea(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(v=!0,y=g?[{type:g,attrs:f}]:void 0),r){if(v&&(i instanceof Qe&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,y),g&&!m&&!c.parentOffset&&c.parent.type!==g)){const w=e.mapping.map(c.before()),N=e.doc.resolve(w);c.node(-1).canReplaceWith(N.index(),N.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}t&&NN(n,a.extensionManager.splittableMarks),e.scrollIntoView()}return v},f6=(t,e={})=>({tr:n,state:r,dispatch:a,editor:i})=>{var o;const c=Nn(t,r.schema),{$from:u,$to:h}=r.selection,f=r.selection.node;if(f&&f.isBlock||u.depth<2||!u.sameParent(h))return!1;const m=u.node(-1);if(m.type!==c)return!1;const g=i.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==c||u.index(-2)!==u.node(-2).childCount-1)return!1;if(a){let k=xe.empty;const C=u.index(-1)?1:u.index(-2)?2:3;for(let P=u.depth-C;P>=u.depth-3;P-=1)k=xe.from(u.node(P).copy(k));const E=u.indexAfter(-1){if(_>-1)return!1;P.isTextblock&&P.content.size===0&&(_=L+1)}),_>-1&&n.setSelection(Qe.near(n.doc.resolve(_))),n.scrollIntoView()}return!0}const y=h.pos===u.end()?m.contentMatchAt(0).defaultType:null,v={...ih(g,m.type.name,m.attrs),...e},w={...ih(g,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,h.pos);const N=y?[{type:c,attrs:v},{type:y,attrs:w}]:[{type:c,attrs:v}];if(!Ea(n.doc,u.pos,2))return!1;if(a){const{selection:k,storedMarks:C}=r,{splittableMarks:E}=i.extensionManager,A=C||k.$to.parentOffset&&k.$from.marks();if(n.split(u.pos,2,N).scrollIntoView(),!A||!a)return!0;const I=A.filter(D=>E.includes(D.type.name));n.ensureMarks(I)}return!0},ig=(t,e)=>{const n=Lf(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const a=t.doc.nodeAt(r);return n.node.type===(a==null?void 0:a.type)&&_i(t.doc,n.pos)&&t.join(n.pos),!0},og=(t,e)=>{const n=Lf(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const a=t.doc.nodeAt(r);return n.node.type===(a==null?void 0:a.type)&&_i(t.doc,r)&&t.join(r),!0},p6=(t,e,n,r={})=>({editor:a,tr:i,state:o,dispatch:c,chain:u,commands:h,can:f})=>{const{extensions:m,splittableMarks:g}=a.extensionManager,y=Nn(t,o.schema),v=Nn(e,o.schema),{selection:w,storedMarks:N}=o,{$from:k,$to:C}=w,E=k.blockRange(C),A=N||w.$to.parentOffset&&w.$from.marks();if(!E)return!1;const I=Lf(D=>vN(D.type.name,m))(w);if(E.depth>=1&&I&&E.depth-I.depth<=1){if(I.node.type===y)return h.liftListItem(v);if(vN(I.node.type.name,m)&&y.validContent(I.node.content)&&c)return u().command(()=>(i.setNodeMarkup(I.pos,y),!0)).command(()=>ig(i,y)).command(()=>og(i,y)).run()}return!n||!A||!c?u().command(()=>f().wrapInList(y,r)?!0:h.clearNodes()).wrapInList(y,r).command(()=>ig(i,y)).command(()=>og(i,y)).run():u().command(()=>{const D=f().wrapInList(y,r),_=A.filter(P=>g.includes(P.type.name));return i.ensureMarks(_),D?!0:h.clearNodes()}).wrapInList(y,r).command(()=>ig(i,y)).command(()=>og(i,y)).run()},m6=(t,e={},n={})=>({state:r,commands:a})=>{const{extendEmptyMarkRange:i=!1}=n,o=Ra(t,r.schema);return dx(r,o,e)?a.unsetMark(o,{extendEmptyMarkRange:i}):a.setMark(o,e)},g6=(t,e,n={})=>({state:r,commands:a})=>{const i=Nn(t,r.schema),o=Nn(e,r.schema),c=Ai(r,i,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),c?a.setNode(o,u):a.setNode(i,{...u,...n})},x6=(t,e={})=>({state:n,commands:r})=>{const a=Nn(t,n.schema);return Ai(n,a,e)?r.lift(a):r.wrapIn(a,e)},y6=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r=0;u-=1)o.step(c.steps[u].invert(c.docs[u]));if(i.text){const u=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,t.schema.text(i.text,u))}else o.delete(i.from,i.to)}return!0}}return!1},b6=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:a}=n;return r||e&&a.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},v6=(t,e={})=>({tr:n,state:r,dispatch:a})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:c}=n,u=Ra(t,r.schema),{$from:h,empty:f,ranges:m}=c;if(!a)return!0;if(f&&o){let{from:g,to:y}=c;const v=(i=h.marks().find(N=>N.type===u))==null?void 0:i.attrs,w=I0(h,u,v);w&&(g=w.from,y=w.to),n.removeMark(g,y,u)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,u)});return n.removeStoredMark(u),!0},N6=t=>({tr:e,state:n,dispatch:r})=>{const{selection:a}=n;let i,o;return typeof t=="number"?(i=t,o=t):t&&"from"in t&&"to"in t?(i=t.from,o=t.to):(i=a.from,o=a.to),r&&e.doc.nodesBetween(i,o,(c,u)=>{if(c.isText)return;const h={...c.attrs};delete h.dir,e.setNodeMarkup(u,void 0,h)}),!0},w6=(t,e={})=>({tr:n,state:r,dispatch:a})=>{let i=null,o=null;const c=Df(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(i=Nn(t,r.schema)),c==="mark"&&(o=Ra(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;let g,y,v,w;n.selection.empty?r.doc.nodesBetween(f,m,(N,k)=>{i&&i===N.type&&(u=!0,v=Math.max(k,f),w=Math.min(k+N.nodeSize,m),g=k,y=N)}):r.doc.nodesBetween(f,m,(N,k)=>{k=f&&k<=m&&(i&&i===N.type&&(u=!0,a&&n.setNodeMarkup(k,void 0,{...N.attrs,...e})),o&&N.marks.length&&N.marks.forEach(C=>{if(o===C.type&&(u=!0,a)){const E=Math.max(k,f),A=Math.min(k+N.nodeSize,m);n.addMark(E,A,o.create({...C.attrs,...e}))}}))}),y&&(g!==void 0&&a&&n.setNodeMarkup(g,void 0,{...y.attrs,...e}),o&&y.marks.length&&y.marks.forEach(N=>{o===N.type&&a&&n.addMark(v,w,o.create({...N.attrs,...e}))}))}),u},j6=(t,e={})=>({state:n,dispatch:r})=>{const a=Nn(t,n.schema);return QO(a,e)(n,r)},k6=(t,e={})=>({state:n,dispatch:r})=>{const a=Nn(t,n.schema);return XO(a,e)(n,r)},S6=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},zf=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},C6=(t,e)=>{if(A0(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function Hu(t){var e;const{editor:n,from:r,to:a,text:i,rules:o,plugin:c}=t,{view:u}=n;if(u.composing)return!1;const h=u.state.doc.resolve(r);if(h.parent.type.spec.code||(e=h.nodeBefore||h.nodeAfter)!=null&&e.marks.find(g=>g.type.spec.code))return!1;let f=!1;const m=X8(h)+i;return o.forEach(g=>{if(f)return;const y=C6(m,g.find);if(!y)return;const v=u.state.tr,w=Pf({state:u.state,transaction:v}),N={from:r-(y[0].length-i.length),to:a},{commands:k,chain:C,can:E}=new Of({editor:n,state:w});g.handler({state:w,range:N,match:y,commands:k,chain:C,can:E})===null||!v.steps.length||(g.undoable&&v.setMeta(c,{transform:v,from:r,to:a,text:i}),u.dispatch(v),f=!0)}),f}function E6(t){const{editor:e,rules:n}=t,r=new Ut({state:{init(){return null},apply(a,i,o){const c=a.getMeta(r);if(c)return c;const u=a.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:f}=u;typeof f=="string"?f=f:f=P0(xe.from(f),o.schema);const{from:m}=u,g=m+f.length;Hu({editor:e,from:m,to:g,text:f,rules:n,plugin:r})}),a.selectionSet||a.docChanged?null:i}},props:{handleTextInput(a,i,o,c){return Hu({editor:e,from:i,to:o,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:a=>(setTimeout(()=>{const{$cursor:i}=a.state.selection;i&&Hu({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(a,i){if(i.key!=="Enter")return!1;const{$cursor:o}=a.state.selection;return o?Hu({editor:e,from:o.pos,to:o.pos,text:` `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function T6(t){return Object.prototype.toString.call(t).slice(8,-1)}function Wu(t){return T6(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function R2(t,e){const n={...t};return Wu(t)&&Wu(e)&&Object.keys(e).forEach(r=>{Wu(e[r])&&Wu(t[r])?n[r]=R2(t[r],e[r]):n[r]=e[r]}),n}var D0=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...jt(We(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...jt(We(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>R2(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Fo=class P2 extends D0{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new P2(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,a=e.state.selection.$from;if(a.pos===a.end()){const o=a.marks();if(!!!o.find(h=>(h==null?void 0:h.type.name)===n.name))return!1;const u=o.find(h=>(h==null?void 0:h.type.name)===n.name);return u&&r.removeStoredMark(u),r.insertText(" ",a.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function M6(t){return typeof t=="number"}var A6=class{constructor(t){this.find=t.find,this.handler=t.handler}},I6=(t,e,n)=>{if(A0(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(a=>{const i=[a.text];return i.index=a.index,i.input=t,i.data=a.data,a.replaceWith&&(a.text.includes(a.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(a.replaceWith)),i}):[]};function R6(t){const{editor:e,state:n,from:r,to:a,rule:i,pasteEvent:o,dropEvent:c}=t,{commands:u,chain:h,can:f}=new Of({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,a,(y,v)=>{var w,N,k,C,E;if((N=(w=y.type)==null?void 0:w.spec)!=null&&N.code||!(y.isText||y.isTextblock||y.isInline))return;const A=(E=(C=(k=y.content)==null?void 0:k.size)!=null?C:y.nodeSize)!=null?E:0,I=Math.max(r,v),D=Math.min(a,v+A);if(I>=D)return;const _=y.isText?y.text||"":y.textBetween(I-v,D-v,void 0,"");I6(_,i.find,o).forEach(L=>{if(L.index===void 0)return;const z=I+L.index+1,ee=z+L[0].length,U={from:n.tr.mapping.map(z),to:n.tr.mapping.map(ee)},he=i.handler({state:n,range:U,match:L,commands:u,chain:h,can:f,pasteEvent:o,dropEvent:c});m.push(he)})}),m.every(y=>y!==null)}var Uu=null,P6=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function O6(t){const{editor:e,rules:n}=t;let r=null,a=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const u=({state:f,from:m,to:g,rule:y,pasteEvt:v})=>{const w=f.tr,N=Pf({state:f,transaction:w});if(!(!R6({editor:e,state:N,from:Math.max(m-1,0),to:g.b-1,rule:y,pasteEvent:v,dropEvent:c})||!w.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,w}};return n.map(f=>new Ut({view(m){const g=v=>{var w;r=(w=m.dom.parentElement)!=null&&w.contains(v.target)?m.dom.parentElement:null,r&&(Uu=e)},y=()=>{Uu&&(Uu=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",y),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",y)}}},props:{handleDOMEvents:{drop:(m,g)=>{if(i=r===m.dom.parentElement,c=g,!i){const y=Uu;y!=null&&y.isEditable&&setTimeout(()=>{const v=y.state.selection;v&&y.commands.deleteRange({from:v.from,to:v.to})},10)}return!1},paste:(m,g)=>{var y;const v=(y=g.clipboardData)==null?void 0:y.getData("text/html");return o=g,a=!!(v!=null&&v.includes("data-pm-slice")),!1}}},appendTransaction:(m,g,y)=>{const v=m[0],w=v.getMeta("uiEvent")==="paste"&&!a,N=v.getMeta("uiEvent")==="drop"&&!i,k=v.getMeta("applyPasteRules"),C=!!k;if(!w&&!N&&!C)return;if(C){let{text:I}=k;typeof I=="string"?I=I:I=P0(xe.from(I),y.schema);const{from:D}=k,_=D+I.length,P=P6(I);return u({rule:f,state:y,from:D,to:{b:_},pasteEvt:P})}const E=g.doc.content.findDiffStart(y.doc.content),A=g.doc.content.findDiffEnd(y.doc.content);if(!(!M6(E)||!A||E===A.b))return u({rule:f,state:y,from:E,to:A,pasteEvt:o})}}))}var $f=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=k2(t),this.schema=U8(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Lc(e.name,this.schema)},r=We(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return Xc([...this.extensions].reverse()).flatMap(r=>{const a={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Lc(r.name,this.schema)},i=[],o=We(r,"addKeyboardShortcuts",a);let c={};if(r.type==="mark"&&We(r,"exitable",a)&&(c.ArrowRight=()=>Fo.handleExit({editor:t,mark:r})),o){const g=Object.fromEntries(Object.entries(o()).map(([y,v])=>[y,()=>v({editor:t})]));c={...c,...g}}const u=GL(c);i.push(u);const h=We(r,"addInputRules",a);if(bN(r,t.options.enableInputRules)&&h){const g=h();if(g&&g.length){const y=E6({editor:t,rules:g}),v=Array.isArray(y)?y:[y];i.push(...v)}}const f=We(r,"addPasteRules",a);if(bN(r,t.options.enablePasteRules)&&f){const g=f();if(g&&g.length){const y=O6({editor:t,rules:g});i.push(...y)}}const m=We(r,"addProseMirrorPlugins",a);if(m){const g=m();i.push(...g)}return i})}get attributes(){return j2(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Bl(this.extensions);return Object.fromEntries(e.filter(n=>!!We(n,"addNodeView")).map(n=>{const r=this.attributes.filter(u=>u.type===n.name),a={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Nn(n.name,this.schema)},i=We(n,"addNodeView",a);if(!i)return[];const o=i();if(!o)return[];const c=(u,h,f,m,g)=>{const y=xd(u,r);return o({node:u,view:h,getPos:f,decorations:m,innerDecorations:g,editor:t,extension:n,HTMLAttributes:y})};return[n.name,c]}))}dispatchTransaction(t){const{editor:e}=this;return Xc([...this.extensions].reverse()).reduceRight((r,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:Lc(a.name,this.schema)},o=We(a,"dispatchTransaction",i);return o?c=>{o.call(i,{transaction:c,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return Xc([...this.extensions]).reduce((r,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:Lc(a.name,this.schema)},o=We(a,"transformPastedHTML",i);return o?(c,u)=>{const h=r(c,u);return o.call(i,h)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=Bl(this.extensions);return Object.fromEntries(e.filter(n=>!!We(n,"addMarkView")).map(n=>{const r=this.attributes.filter(c=>c.type===n.name),a={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Ra(n.name,this.schema)},i=We(n,"addMarkView",a);if(!i)return[];const o=(c,u,h)=>{const f=xd(c,r);return i()({mark:c,view:u,inline:h,editor:t,extension:n,HTMLAttributes:f,updateAttributes:m=>{J6(c,t,m)}})};return[n.name,o]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Lc(e.name,this.schema)};e.type==="mark"&&((n=jt(We(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const a=We(e,"onBeforeCreate",r),i=We(e,"onCreate",r),o=We(e,"onUpdate",r),c=We(e,"onSelectionUpdate",r),u=We(e,"onTransaction",r),h=We(e,"onFocus",r),f=We(e,"onBlur",r),m=We(e,"onDestroy",r);a&&this.editor.on("beforeCreate",a),i&&this.editor.on("create",i),o&&this.editor.on("update",o),c&&this.editor.on("selectionUpdate",c),u&&this.editor.on("transaction",u),h&&this.editor.on("focus",h),f&&this.editor.on("blur",f),m&&this.editor.on("destroy",m)})}};$f.resolve=k2;$f.sort=Xc;$f.flatten=R0;var D6={};M0(D6,{ClipboardTextSerializer:()=>D2,Commands:()=>L2,Delete:()=>_2,Drop:()=>z2,Editable:()=>$2,FocusEvents:()=>B2,Keymap:()=>V2,Paste:()=>H2,Tabindex:()=>W2,TextDirection:()=>U2,focusEventsPluginKey:()=>F2});var dn=class O2 extends D0{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new O2(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},D2=dn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ut({key:new Yt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:a}=e,{ranges:i}=a,o=Math.min(...i.map(f=>f.$from.pos)),c=Math.max(...i.map(f=>f.$to.pos)),u=C2(n);return S2(r,{from:o,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),L2=dn.create({name:"commands",addCommands(){return{...f2}}}),_2=dn.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,a;const i=()=>{var o,c,u,h;if((h=(u=(c=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:c.filterTransaction)==null?void 0:u.call(c,t))!=null?h:t.getMeta("y-sync$"))return;const f=v2(t.before,[t,...e]);T2(f).forEach(y=>{f.mapping.mapResult(y.oldRange.from).deletedAfter&&f.mapping.mapResult(y.oldRange.to).deletedBefore&&f.before.nodesBetween(y.oldRange.from,y.oldRange.to,(v,w)=>{const N=w+v.nodeSize-2,k=y.oldRange.from<=w&&N<=y.oldRange.to;this.editor.emit("delete",{type:"node",node:v,from:w,to:N,newFrom:f.mapping.map(w),newTo:f.mapping.map(N),deletedRange:y.oldRange,newRange:y.newRange,partial:!k,editor:this.editor,transaction:t,combinedTransform:f})})});const g=f.mapping;f.steps.forEach((y,v)=>{var w,N;if(y instanceof vs){const k=g.slice(v).map(y.from,-1),C=g.slice(v).map(y.to),E=g.invert().map(k,-1),A=g.invert().map(C),I=(w=f.doc.nodeAt(k-1))==null?void 0:w.marks.some(_=>_.eq(y.mark)),D=(N=f.doc.nodeAt(C))==null?void 0:N.marks.some(_=>_.eq(y.mark));this.editor.emit("delete",{type:"mark",mark:y.mark,from:y.from,to:y.to,deletedRange:{from:E,to:A},newRange:{from:k,to:C},partial:!!(D||I),editor:this.editor,transaction:t,combinedTransform:f})}})};(a=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||a?setTimeout(i,0):i()}}),z2=dn.create({name:"drop",addProseMirrorPlugins(){return[new Ut({key:new Yt("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),$2=dn.create({name:"editable",addProseMirrorPlugins(){return[new Ut({key:new Yt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),F2=new Yt("focusEvents"),B2=dn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ut({key:F2,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),V2=dn.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:c})=>{const{selection:u,doc:h}=c,{empty:f,$anchor:m}=u,{pos:g,parent:y}=m,v=m.parent.isTextblock&&g>0?c.doc.resolve(g-1):m,w=v.parent.type.spec.isolating,N=m.pos-m.parentOffset,k=w&&v.parent.childCount===1?N===m.pos:tt.atStart(h).from===g;return!f||!y.type.isTextblock||y.textContent.length||!k||k&&m.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},a={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Rh()||y2()?i:a},addProseMirrorPlugins(){return[new Ut({key:new Yt("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(w=>w.getMeta("composition")))return;const r=t.some(w=>w.docChanged)&&!e.doc.eq(n.doc),a=t.some(w=>w.getMeta("preventClearDocument"));if(!r||a)return;const{empty:i,from:o,to:c}=e.selection,u=tt.atStart(e.doc).from,h=tt.atEnd(e.doc).to;if(i||!(o===u&&c===h)||!_f(n.doc))return;const g=n.tr,y=Pf({state:n,transaction:g}),{commands:v}=new Of({editor:this.editor,state:y});if(v.clearNodes(),!!g.steps.length)return g}})]}}),H2=dn.create({name:"paste",addProseMirrorPlugins(){return[new Ut({key:new Yt("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),W2=dn.create({name:"tabindex",addProseMirrorPlugins(){return[new Ut({key:new Yt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),U2=dn.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Bl(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Ut({key:new Yt("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),L6=class Hc{constructor(e,n,r=!1,a=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=a}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Hc(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Hc(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Hc(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const a=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,o=n.isInline,c=this.pos+r+(i?0:1);if(c<0||c>this.resolvedPos.doc.nodeSize-2)return;const u=this.resolvedPos.doc.resolve(c);if(!a&&!o&&u.depth<=this.depth)return;const h=new Hc(u,this.editor,a,a||o?n:null);a&&(h.actualDepth=this.depth+1),e.push(h)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,a=this.parent;for(;a&&!r;){if(a.node.type.name===e)if(Object.keys(n).length>0){const i=a.node.attrs,o=Object.keys(n);for(let c=0;c{r&&a.length>0||(o.node.type.name===e&&i.every(u=>n[u]===o.node.attrs[u])&&a.push(o),!(r&&a.length>0)&&(a=a.concat(o.querySelectorAll(e,n,r))))}),a}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},_6=`.ProseMirror { @@ -742,8 +742,8 @@ ${n} `):""}),f7=wn.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",kt(this.options.HTMLAttributes,t)]},renderText(){return` `},renderMarkdown:()=>` -`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:a,storedMarks:i}=n;if(a.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:c}=r.extensionManager,u=i||a.$to.parentOffset&&a.$from.marks();return e().insertContent({type:this.name}).command(({tr:h,dispatch:f})=>{if(f&&u&&o){const m=u.filter(g=>c.includes(g.type.name));h.ensureMarks(m)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),p7=wn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,kt(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,a="#".repeat(r);return t.content?`${a} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>ux({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),m7=wn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",kt(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!V6(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,a=t();return M2(n)?a.insertContentAt(r.pos,{type:this.name}):a.insertContent({type:this.name}),a.command(({state:i,tr:o,dispatch:c})=>{if(c){const{$to:u}=o.selection,h=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?o.setSelection(Qe.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(Je.create(o.doc,u.pos)):o.setSelection(Qe.create(o.doc,u.pos));else{const f=i.schema.nodes[this.options.nextNodeType]||u.parent.type.contentMatch.defaultType,m=f==null?void 0:f.create();m&&(o.insert(h,m),o.setSelection(Qe.create(o.doc,h+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[K2({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),g7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,x7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,y7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,b7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,v7=Fo.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",kt(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Vl({find:g7,type:this.type}),Vl({find:y7,type:this.type})]},addPasteRules(){return[Po({find:x7,type:this.type}),Po({find:b7,type:this.type})]}});const N7="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",w7="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",px="numeric",mx="ascii",gx="alpha",Zc="asciinumeric",Wc="alphanumeric",xx="domain",tC="emoji",j7="scheme",k7="slashscheme",hg="whitespace";function S7(t,e){return t in e||(e[t]=[]),e[t]}function yo(t,e,n){e[px]&&(e[Zc]=!0,e[Wc]=!0),e[mx]&&(e[Zc]=!0,e[gx]=!0),e[Zc]&&(e[Wc]=!0),e[gx]&&(e[Wc]=!0),e[Wc]&&(e[xx]=!0),e[tC]&&(e[xx]=!0);for(const r in e){const a=S7(r,n);a.indexOf(t)<0&&a.push(t)}}function C7(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Tr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Tr.groups={};Tr.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;rt.ta(e,n,r,a),an=(t,e,n,r,a)=>t.tr(e,n,r,a),MN=(t,e,n,r,a)=>t.ts(e,n,r,a),ke=(t,e,n,r,a)=>t.tt(e,n,r,a),ya="WORD",yx="UWORD",nC="ASCIINUMERICAL",rC="ALPHANUMERICAL",yd="LOCALHOST",bx="TLD",vx="UTLD",oh="SCHEME",kl="SLASH_SCHEME",F0="NUM",Nx="WS",B0="NL",ed="OPENBRACE",td="CLOSEBRACE",Dh="OPENBRACKET",Lh="CLOSEBRACKET",_h="OPENPAREN",zh="CLOSEPAREN",$h="OPENANGLEBRACKET",Fh="CLOSEANGLEBRACKET",Bh="FULLWIDTHLEFTPAREN",Vh="FULLWIDTHRIGHTPAREN",Hh="LEFTCORNERBRACKET",Wh="RIGHTCORNERBRACKET",Uh="LEFTWHITECORNERBRACKET",Kh="RIGHTWHITECORNERBRACKET",qh="FULLWIDTHLESSTHAN",Gh="FULLWIDTHGREATERTHAN",Jh="AMPERSAND",Yh="APOSTROPHE",Qh="ASTERISK",ui="AT",Xh="BACKSLASH",Zh="BACKTICK",ef="CARET",pi="COLON",V0="COMMA",tf="DOLLAR",Bs="DOT",nf="EQUALS",H0="EXCLAMATION",Yr="HYPHEN",nd="PERCENT",rf="PIPE",sf="PLUS",af="POUND",rd="QUERY",W0="QUOTE",sC="FULLWIDTHMIDDLEDOT",U0="SEMI",Vs="SLASH",sd="TILDE",of="UNDERSCORE",aC="EMOJI",lf="SYM";var iC=Object.freeze({__proto__:null,ALPHANUMERICAL:rC,AMPERSAND:Jh,APOSTROPHE:Yh,ASCIINUMERICAL:nC,ASTERISK:Qh,AT:ui,BACKSLASH:Xh,BACKTICK:Zh,CARET:ef,CLOSEANGLEBRACKET:Fh,CLOSEBRACE:td,CLOSEBRACKET:Lh,CLOSEPAREN:zh,COLON:pi,COMMA:V0,DOLLAR:tf,DOT:Bs,EMOJI:aC,EQUALS:nf,EXCLAMATION:H0,FULLWIDTHGREATERTHAN:Gh,FULLWIDTHLEFTPAREN:Bh,FULLWIDTHLESSTHAN:qh,FULLWIDTHMIDDLEDOT:sC,FULLWIDTHRIGHTPAREN:Vh,HYPHEN:Yr,LEFTCORNERBRACKET:Hh,LEFTWHITECORNERBRACKET:Uh,LOCALHOST:yd,NL:B0,NUM:F0,OPENANGLEBRACKET:$h,OPENBRACE:ed,OPENBRACKET:Dh,OPENPAREN:_h,PERCENT:nd,PIPE:rf,PLUS:sf,POUND:af,QUERY:rd,QUOTE:W0,RIGHTCORNERBRACKET:Wh,RIGHTWHITECORNERBRACKET:Kh,SCHEME:oh,SEMI:U0,SLASH:Vs,SLASH_SCHEME:kl,SYM:lf,TILDE:sd,TLD:bx,UNDERSCORE:of,UTLD:vx,UWORD:yx,WORD:ya,WS:Nx});const ga=/[a-z]/,zc=new RegExp("\\p{L}","u"),fg=new RegExp("\\p{Emoji}","u"),xa=/\d/,pg=/\s/,AN="\r",mg=` -`,E7="️",T7="‍",gg="";let qu=null,Gu=null;function M7(t=[]){const e={};Tr.groups=e;const n=new Tr;qu==null&&(qu=IN(N7)),Gu==null&&(Gu=IN(w7)),ke(n,"'",Yh),ke(n,"{",ed),ke(n,"}",td),ke(n,"[",Dh),ke(n,"]",Lh),ke(n,"(",_h),ke(n,")",zh),ke(n,"<",$h),ke(n,">",Fh),ke(n,"(",Bh),ke(n,")",Vh),ke(n,"「",Hh),ke(n,"」",Wh),ke(n,"『",Uh),ke(n,"』",Kh),ke(n,"<",qh),ke(n,">",Gh),ke(n,"&",Jh),ke(n,"*",Qh),ke(n,"@",ui),ke(n,"`",Zh),ke(n,"^",ef),ke(n,":",pi),ke(n,",",V0),ke(n,"$",tf),ke(n,".",Bs),ke(n,"=",nf),ke(n,"!",H0),ke(n,"-",Yr),ke(n,"%",nd),ke(n,"|",rf),ke(n,"+",sf),ke(n,"#",af),ke(n,"?",rd),ke(n,'"',W0),ke(n,"/",Vs),ke(n,";",U0),ke(n,"~",sd),ke(n,"_",of),ke(n,"\\",Xh),ke(n,"・",sC);const r=an(n,xa,F0,{[px]:!0});an(r,xa,r);const a=an(r,ga,nC,{[Zc]:!0}),i=an(r,zc,rC,{[Wc]:!0}),o=an(n,ga,ya,{[mx]:!0});an(o,xa,a),an(o,ga,o),an(a,xa,a),an(a,ga,a);const c=an(n,zc,yx,{[gx]:!0});an(c,ga),an(c,xa,i),an(c,zc,c),an(i,xa,i),an(i,ga),an(i,zc,i);const u=ke(n,mg,B0,{[hg]:!0}),h=ke(n,AN,Nx,{[hg]:!0}),f=an(n,pg,Nx,{[hg]:!0});ke(n,gg,f),ke(h,mg,u),ke(h,gg,f),an(h,pg,f),ke(f,AN),ke(f,mg),an(f,pg,f),ke(f,gg,f);const m=an(n,fg,aC,{[tC]:!0});ke(m,"#"),an(m,fg,m),ke(m,E7,m);const g=ke(m,T7);ke(g,"#"),an(g,fg,m);const y=[[ga,o],[xa,a]],v=[[ga,null],[zc,c],[xa,i]];for(let w=0;ww[0]>N[0]?1:-1);for(let w=0;w=0?C[xx]=!0:ga.test(N)?xa.test(N)?C[Zc]=!0:C[mx]=!0:C[px]=!0,MN(n,N,N,C)}return MN(n,"localhost",yd,{ascii:!0}),n.jd=new Tr(lf),{start:n,tokens:Object.assign({groups:e},iC)}}function oC(t,e){const n=A7(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,a=[];let i=0,o=0;for(;o=0&&(m+=n[o].length,g++),h+=n[o].length,i+=n[o].length,o++;i-=m,o-=g,h-=m,a.push({t:f.t,v:e.slice(i-h,i),s:i-h,e:i})}return a}function A7(t){const e=[],n=t.length;let r=0;for(;r56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function ii(t,e,n,r,a){let i;const o=e.length;for(let c=0;c=0;)i++;if(i>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+i),10);o>0;o--)n.pop();r+=i}else n.push(t[r]),r++}return e}const bd={defaultProtocol:"http",events:null,format:RN,formatHref:RN,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function K0(t,e=null){let n=Object.assign({},bd);t&&(n=Object.assign(n,t instanceof K0?t.o:t));const r=n.ignoreTags,a=[];for(let i=0;in?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=bd.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),a=t.get("tagName",n,e),i=this.toFormattedString(t),o={},c=t.get("className",n,e),u=t.get("target",n,e),h=t.get("rel",n,e),f=t.getObj("attributes",n,e),m=t.getObj("events",n,e);return o.href=r,c&&(o.class=c),u&&(o.target=u),h&&(o.rel=h),f&&Object.assign(o,f),{tagName:a,attributes:o,content:i,eventListeners:m}}};function Ff(t,e){class n extends lC{constructor(a,i){super(a,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const PN=Ff("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ON=Ff("text"),I7=Ff("nl"),Ju=Ff("url",{isLink:!0,toHref(t=bd.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==yd&&t[1].t===pi}}),Jr=t=>new Tr(t);function R7({groups:t}){const e=t.domain.concat([Jh,Qh,ui,Xh,Zh,ef,tf,nf,Yr,F0,nd,rf,sf,af,Vs,lf,sd,of]),n=[Yh,pi,V0,Bs,H0,nd,rd,W0,U0,$h,Fh,ed,td,Lh,Dh,_h,zh,Bh,Vh,Hh,Wh,Uh,Kh,qh,Gh],r=[Jh,Yh,Qh,Xh,Zh,ef,tf,nf,Yr,ed,td,nd,rf,sf,af,rd,Vs,lf,sd,of],a=Jr(),i=ke(a,sd);ot(i,r,i),ot(i,t.domain,i);const o=Jr(),c=Jr(),u=Jr();ot(a,t.domain,o),ot(a,t.scheme,c),ot(a,t.slashscheme,u),ot(o,r,i),ot(o,t.domain,o);const h=ke(o,ui);ke(i,ui,h),ke(c,ui,h),ke(u,ui,h);const f=ke(i,Bs);ot(f,r,i),ot(f,t.domain,i);const m=Jr();ot(h,t.domain,m),ot(m,t.domain,m);const g=ke(m,Bs);ot(g,t.domain,m);const y=Jr(PN);ot(g,t.tld,y),ot(g,t.utld,y),ke(h,yd,y);const v=ke(m,Yr);ke(v,Yr,v),ot(v,t.domain,m),ot(y,t.domain,m),ke(y,Bs,g),ke(y,Yr,v);const w=ke(y,pi);ot(w,t.numeric,PN);const N=ke(o,Yr),k=ke(o,Bs);ke(N,Yr,N),ot(N,t.domain,o),ot(k,r,i),ot(k,t.domain,o);const C=Jr(Ju);ot(k,t.tld,C),ot(k,t.utld,C),ot(C,t.domain,o),ot(C,r,i),ke(C,Bs,k),ke(C,Yr,N),ke(C,ui,h);const E=ke(C,pi),A=Jr(Ju);ot(E,t.numeric,A);const I=Jr(Ju),D=Jr();ot(I,e,I),ot(I,n,D),ot(D,e,I),ot(D,n,D),ke(C,Vs,I),ke(A,Vs,I);const _=ke(c,pi),P=ke(u,pi),L=ke(P,Vs),z=ke(L,Vs);ot(c,t.domain,o),ke(c,Bs,k),ke(c,Yr,N),ot(u,t.domain,o),ke(u,Bs,k),ke(u,Yr,N),ot(_,t.domain,I),ke(_,Vs,I),ke(_,rd,I),ot(z,t.domain,I),ot(z,e,I),ke(z,Vs,I);const ee=[[ed,td],[Dh,Lh],[_h,zh],[$h,Fh],[Bh,Vh],[Hh,Wh],[Uh,Kh],[qh,Gh]];for(let U=0;U=0&&g++,a++,f++;if(g<0)a-=f,a0&&(i.push(xg(ON,e,o)),o=[]),a-=g,f-=g;const y=m.t,v=n.slice(a-f,a);i.push(xg(y,e,v))}}return o.length>0&&i.push(xg(ON,e,o)),i}function xg(t,e,n){const r=n[0].s,a=n[n.length-1].e,i=e.slice(r,a);return new t(i,n)}const O7=typeof console<"u"&&console&&console.warn||(()=>{}),D7="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Gt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function L7(){return Tr.groups={},Gt.scanner=null,Gt.parser=null,Gt.tokenQueue=[],Gt.pluginQueue=[],Gt.customSchemes=[],Gt.initialized=!1,Gt}function DN(t,e=!1){if(Gt.initialized&&O7(`linkifyjs: already initialized - will not register custom scheme "${t}" ${D7}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format. +`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:a,storedMarks:i}=n;if(a.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:c}=r.extensionManager,u=i||a.$to.parentOffset&&a.$from.marks();return e().insertContent({type:this.name}).command(({tr:h,dispatch:f})=>{if(f&&u&&o){const m=u.filter(g=>c.includes(g.type.name));h.ensureMarks(m)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),p7=wn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,kt(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,a="#".repeat(r);return t.content?`${a} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>ux({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),m7=wn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",kt(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!V6(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,a=t();return M2(n)?a.insertContentAt(r.pos,{type:this.name}):a.insertContent({type:this.name}),a.command(({state:i,tr:o,dispatch:c})=>{if(c){const{$to:u}=o.selection,h=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?o.setSelection(Qe.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(Je.create(o.doc,u.pos)):o.setSelection(Qe.create(o.doc,u.pos));else{const f=i.schema.nodes[this.options.nextNodeType]||u.parent.type.contentMatch.defaultType,m=f==null?void 0:f.create();m&&(o.insert(h,m),o.setSelection(Qe.create(o.doc,h+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[K2({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),g7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,x7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,y7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,b7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,v7=Fo.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",kt(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Vl({find:g7,type:this.type}),Vl({find:y7,type:this.type})]},addPasteRules(){return[Po({find:x7,type:this.type}),Po({find:b7,type:this.type})]}});const N7="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",w7="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",px="numeric",mx="ascii",gx="alpha",Zc="asciinumeric",Wc="alphanumeric",xx="domain",tC="emoji",j7="scheme",k7="slashscheme",hg="whitespace";function S7(t,e){return t in e||(e[t]=[]),e[t]}function yo(t,e,n){e[px]&&(e[Zc]=!0,e[Wc]=!0),e[mx]&&(e[Zc]=!0,e[gx]=!0),e[Zc]&&(e[Wc]=!0),e[gx]&&(e[Wc]=!0),e[Wc]&&(e[xx]=!0),e[tC]&&(e[xx]=!0);for(const r in e){const a=S7(r,n);a.indexOf(t)<0&&a.push(t)}}function C7(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Tr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Tr.groups={};Tr.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;rt.ta(e,n,r,a),an=(t,e,n,r,a)=>t.tr(e,n,r,a),MN=(t,e,n,r,a)=>t.ts(e,n,r,a),ke=(t,e,n,r,a)=>t.tt(e,n,r,a),ya="WORD",yx="UWORD",nC="ASCIINUMERICAL",rC="ALPHANUMERICAL",yd="LOCALHOST",bx="TLD",vx="UTLD",oh="SCHEME",kl="SLASH_SCHEME",F0="NUM",Nx="WS",B0="NL",ed="OPENBRACE",td="CLOSEBRACE",Dh="OPENBRACKET",Lh="CLOSEBRACKET",_h="OPENPAREN",zh="CLOSEPAREN",$h="OPENANGLEBRACKET",Fh="CLOSEANGLEBRACKET",Bh="FULLWIDTHLEFTPAREN",Vh="FULLWIDTHRIGHTPAREN",Hh="LEFTCORNERBRACKET",Wh="RIGHTCORNERBRACKET",Uh="LEFTWHITECORNERBRACKET",Kh="RIGHTWHITECORNERBRACKET",qh="FULLWIDTHLESSTHAN",Gh="FULLWIDTHGREATERTHAN",Jh="AMPERSAND",Yh="APOSTROPHE",Qh="ASTERISK",ui="AT",Xh="BACKSLASH",Zh="BACKTICK",ef="CARET",pi="COLON",V0="COMMA",tf="DOLLAR",Bs="DOT",nf="EQUALS",H0="EXCLAMATION",Qr="HYPHEN",nd="PERCENT",rf="PIPE",sf="PLUS",af="POUND",rd="QUERY",W0="QUOTE",sC="FULLWIDTHMIDDLEDOT",U0="SEMI",Vs="SLASH",sd="TILDE",of="UNDERSCORE",aC="EMOJI",lf="SYM";var iC=Object.freeze({__proto__:null,ALPHANUMERICAL:rC,AMPERSAND:Jh,APOSTROPHE:Yh,ASCIINUMERICAL:nC,ASTERISK:Qh,AT:ui,BACKSLASH:Xh,BACKTICK:Zh,CARET:ef,CLOSEANGLEBRACKET:Fh,CLOSEBRACE:td,CLOSEBRACKET:Lh,CLOSEPAREN:zh,COLON:pi,COMMA:V0,DOLLAR:tf,DOT:Bs,EMOJI:aC,EQUALS:nf,EXCLAMATION:H0,FULLWIDTHGREATERTHAN:Gh,FULLWIDTHLEFTPAREN:Bh,FULLWIDTHLESSTHAN:qh,FULLWIDTHMIDDLEDOT:sC,FULLWIDTHRIGHTPAREN:Vh,HYPHEN:Qr,LEFTCORNERBRACKET:Hh,LEFTWHITECORNERBRACKET:Uh,LOCALHOST:yd,NL:B0,NUM:F0,OPENANGLEBRACKET:$h,OPENBRACE:ed,OPENBRACKET:Dh,OPENPAREN:_h,PERCENT:nd,PIPE:rf,PLUS:sf,POUND:af,QUERY:rd,QUOTE:W0,RIGHTCORNERBRACKET:Wh,RIGHTWHITECORNERBRACKET:Kh,SCHEME:oh,SEMI:U0,SLASH:Vs,SLASH_SCHEME:kl,SYM:lf,TILDE:sd,TLD:bx,UNDERSCORE:of,UTLD:vx,UWORD:yx,WORD:ya,WS:Nx});const ga=/[a-z]/,zc=new RegExp("\\p{L}","u"),fg=new RegExp("\\p{Emoji}","u"),xa=/\d/,pg=/\s/,AN="\r",mg=` +`,E7="️",T7="‍",gg="";let qu=null,Gu=null;function M7(t=[]){const e={};Tr.groups=e;const n=new Tr;qu==null&&(qu=IN(N7)),Gu==null&&(Gu=IN(w7)),ke(n,"'",Yh),ke(n,"{",ed),ke(n,"}",td),ke(n,"[",Dh),ke(n,"]",Lh),ke(n,"(",_h),ke(n,")",zh),ke(n,"<",$h),ke(n,">",Fh),ke(n,"(",Bh),ke(n,")",Vh),ke(n,"「",Hh),ke(n,"」",Wh),ke(n,"『",Uh),ke(n,"』",Kh),ke(n,"<",qh),ke(n,">",Gh),ke(n,"&",Jh),ke(n,"*",Qh),ke(n,"@",ui),ke(n,"`",Zh),ke(n,"^",ef),ke(n,":",pi),ke(n,",",V0),ke(n,"$",tf),ke(n,".",Bs),ke(n,"=",nf),ke(n,"!",H0),ke(n,"-",Qr),ke(n,"%",nd),ke(n,"|",rf),ke(n,"+",sf),ke(n,"#",af),ke(n,"?",rd),ke(n,'"',W0),ke(n,"/",Vs),ke(n,";",U0),ke(n,"~",sd),ke(n,"_",of),ke(n,"\\",Xh),ke(n,"・",sC);const r=an(n,xa,F0,{[px]:!0});an(r,xa,r);const a=an(r,ga,nC,{[Zc]:!0}),i=an(r,zc,rC,{[Wc]:!0}),o=an(n,ga,ya,{[mx]:!0});an(o,xa,a),an(o,ga,o),an(a,xa,a),an(a,ga,a);const c=an(n,zc,yx,{[gx]:!0});an(c,ga),an(c,xa,i),an(c,zc,c),an(i,xa,i),an(i,ga),an(i,zc,i);const u=ke(n,mg,B0,{[hg]:!0}),h=ke(n,AN,Nx,{[hg]:!0}),f=an(n,pg,Nx,{[hg]:!0});ke(n,gg,f),ke(h,mg,u),ke(h,gg,f),an(h,pg,f),ke(f,AN),ke(f,mg),an(f,pg,f),ke(f,gg,f);const m=an(n,fg,aC,{[tC]:!0});ke(m,"#"),an(m,fg,m),ke(m,E7,m);const g=ke(m,T7);ke(g,"#"),an(g,fg,m);const y=[[ga,o],[xa,a]],v=[[ga,null],[zc,c],[xa,i]];for(let w=0;ww[0]>N[0]?1:-1);for(let w=0;w=0?C[xx]=!0:ga.test(N)?xa.test(N)?C[Zc]=!0:C[mx]=!0:C[px]=!0,MN(n,N,N,C)}return MN(n,"localhost",yd,{ascii:!0}),n.jd=new Tr(lf),{start:n,tokens:Object.assign({groups:e},iC)}}function oC(t,e){const n=A7(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,a=[];let i=0,o=0;for(;o=0&&(m+=n[o].length,g++),h+=n[o].length,i+=n[o].length,o++;i-=m,o-=g,h-=m,a.push({t:f.t,v:e.slice(i-h,i),s:i-h,e:i})}return a}function A7(t){const e=[],n=t.length;let r=0;for(;r56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function ii(t,e,n,r,a){let i;const o=e.length;for(let c=0;c=0;)i++;if(i>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+i),10);o>0;o--)n.pop();r+=i}else n.push(t[r]),r++}return e}const bd={defaultProtocol:"http",events:null,format:RN,formatHref:RN,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function K0(t,e=null){let n=Object.assign({},bd);t&&(n=Object.assign(n,t instanceof K0?t.o:t));const r=n.ignoreTags,a=[];for(let i=0;in?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=bd.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),a=t.get("tagName",n,e),i=this.toFormattedString(t),o={},c=t.get("className",n,e),u=t.get("target",n,e),h=t.get("rel",n,e),f=t.getObj("attributes",n,e),m=t.getObj("events",n,e);return o.href=r,c&&(o.class=c),u&&(o.target=u),h&&(o.rel=h),f&&Object.assign(o,f),{tagName:a,attributes:o,content:i,eventListeners:m}}};function Ff(t,e){class n extends lC{constructor(a,i){super(a,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const PN=Ff("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ON=Ff("text"),I7=Ff("nl"),Ju=Ff("url",{isLink:!0,toHref(t=bd.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==yd&&t[1].t===pi}}),Yr=t=>new Tr(t);function R7({groups:t}){const e=t.domain.concat([Jh,Qh,ui,Xh,Zh,ef,tf,nf,Qr,F0,nd,rf,sf,af,Vs,lf,sd,of]),n=[Yh,pi,V0,Bs,H0,nd,rd,W0,U0,$h,Fh,ed,td,Lh,Dh,_h,zh,Bh,Vh,Hh,Wh,Uh,Kh,qh,Gh],r=[Jh,Yh,Qh,Xh,Zh,ef,tf,nf,Qr,ed,td,nd,rf,sf,af,rd,Vs,lf,sd,of],a=Yr(),i=ke(a,sd);ot(i,r,i),ot(i,t.domain,i);const o=Yr(),c=Yr(),u=Yr();ot(a,t.domain,o),ot(a,t.scheme,c),ot(a,t.slashscheme,u),ot(o,r,i),ot(o,t.domain,o);const h=ke(o,ui);ke(i,ui,h),ke(c,ui,h),ke(u,ui,h);const f=ke(i,Bs);ot(f,r,i),ot(f,t.domain,i);const m=Yr();ot(h,t.domain,m),ot(m,t.domain,m);const g=ke(m,Bs);ot(g,t.domain,m);const y=Yr(PN);ot(g,t.tld,y),ot(g,t.utld,y),ke(h,yd,y);const v=ke(m,Qr);ke(v,Qr,v),ot(v,t.domain,m),ot(y,t.domain,m),ke(y,Bs,g),ke(y,Qr,v);const w=ke(y,pi);ot(w,t.numeric,PN);const N=ke(o,Qr),k=ke(o,Bs);ke(N,Qr,N),ot(N,t.domain,o),ot(k,r,i),ot(k,t.domain,o);const C=Yr(Ju);ot(k,t.tld,C),ot(k,t.utld,C),ot(C,t.domain,o),ot(C,r,i),ke(C,Bs,k),ke(C,Qr,N),ke(C,ui,h);const E=ke(C,pi),A=Yr(Ju);ot(E,t.numeric,A);const I=Yr(Ju),D=Yr();ot(I,e,I),ot(I,n,D),ot(D,e,I),ot(D,n,D),ke(C,Vs,I),ke(A,Vs,I);const _=ke(c,pi),P=ke(u,pi),L=ke(P,Vs),z=ke(L,Vs);ot(c,t.domain,o),ke(c,Bs,k),ke(c,Qr,N),ot(u,t.domain,o),ke(u,Bs,k),ke(u,Qr,N),ot(_,t.domain,I),ke(_,Vs,I),ke(_,rd,I),ot(z,t.domain,I),ot(z,e,I),ke(z,Vs,I);const ee=[[ed,td],[Dh,Lh],[_h,zh],[$h,Fh],[Bh,Vh],[Hh,Wh],[Uh,Kh],[qh,Gh]];for(let U=0;U=0&&g++,a++,f++;if(g<0)a-=f,a0&&(i.push(xg(ON,e,o)),o=[]),a-=g,f-=g;const y=m.t,v=n.slice(a-f,a);i.push(xg(y,e,v))}}return o.length>0&&i.push(xg(ON,e,o)),i}function xg(t,e,n){const r=n[0].s,a=n[n.length-1].e,i=e.slice(r,a);return new t(i,n)}const O7=typeof console<"u"&&console&&console.warn||(()=>{}),D7="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Gt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function L7(){return Tr.groups={},Gt.scanner=null,Gt.parser=null,Gt.tokenQueue=[],Gt.pluginQueue=[],Gt.customSchemes=[],Gt.initialized=!1,Gt}function DN(t,e=!1){if(Gt.initialized&&O7(`linkifyjs: already initialized - will not register custom scheme "${t}" ${D7}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format. 1. Must only contain digits, lowercase ASCII letters or "-" 2. Cannot start or end with "-" 3. "-" cannot repeat`);Gt.customSchemes.push([t,e])}function _7(){Gt.scanner=M7(Gt.customSchemes);for(let t=0;t{const a=e.some(h=>h.docChanged)&&!n.doc.eq(r.doc),i=e.some(h=>h.getMeta("preventAutolink"));if(!a||i)return;const{tr:o}=r,c=v2(n.doc,[...e]);if(T2(c).forEach(({newRange:h})=>{const f=B8(r.doc,h,y=>y.isTextblock);let m,g;if(f.length>1)m=f[0],g=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(f.length){const y=r.doc.textBetween(h.from,h.to," "," ");if(!$7.test(y))return;m=f[0],g=r.doc.textBetween(m.pos,h.to,void 0," ")}if(m&&g){const y=g.split(z7).filter(Boolean);if(y.length<=0)return!1;const v=y[y.length-1],w=m.pos+g.lastIndexOf(v);if(!v)return!1;const N=q0(v).map(k=>k.toObject(t.defaultProtocol));if(!B7(N))return!1;N.filter(k=>k.isLink).map(k=>({...k,from:w+k.start+1,to:w+k.end+1})).filter(k=>r.schema.marks.code?!r.doc.rangeHasMark(k.from,k.to,r.schema.marks.code):!0).filter(k=>t.validate(k.value)).filter(k=>t.shouldAutoLink(k.value)).forEach(k=>{O0(k.from,k.to,r.doc).some(C=>C.mark.type===t.type)||o.addMark(k.from,k.to,t.type.create({href:k.href}))})}}),!!o.steps.length)return o}})}function H7(t){return new Ut({key:new Yt("handleClickLink"),props:{handleClick:(e,n,r)=>{var a,i;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const u=r.target;if(!u)return!1;const h=t.editor.view.dom;o=u.closest("a"),o&&!h.contains(o)&&(o=null)}if(!o)return!1;let c=!1;if(t.enableClickSelection&&(c=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const u=E2(e.state,t.type.name),h=(a=o.href)!=null?a:u.href,f=(i=o.target)!=null?i:u.target;h&&(window.open(h,f),c=!0)}return c}}})}function W7(t){return new Ut({key:new Yt("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:a}=t,{state:i}=e,{selection:o}=i,{empty:c}=o;if(c)return!1;let u="";r.content.forEach(f=>{u+=f.textContent});const h=cC(u,{defaultProtocol:t.defaultProtocol}).find(f=>f.isLink&&f.value===u);return!u||!h||a!==void 0&&!a(h.value)?!1:t.editor.commands.setMark(t.type,{href:h.href})}}})}function uo(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const a=typeof r=="string"?r:r.scheme;a&&n.push(a)}),!t||t.replace(F7,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var dC=Fo.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){DN(t);return}DN(t.scheme,t.optionalSlashes)})},onDestroy(){L7()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!uo(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const a=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(a)||!/\./.test(a))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!uo(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!uo(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",kt(this.options.HTMLAttributes,t),0]:["a",kt(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,a,i;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",c=(i=(a=t.attrs)==null?void 0:a.title)!=null?i:"",u=e.renderChildren(t);return c?`[${u}](${o} "${c}")`:`[${u}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!uo(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!uo(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Po({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,a=cC(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!uo(o,n),protocols:n,defaultProtocol:r}));a.length&&a.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(V7({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:a=>!!uo(a,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(H7({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(W7({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),U7=dC,K7=Object.defineProperty,q7=(t,e)=>{for(var n in e)K7(t,n,{get:e[n],enumerable:!0})},G7="listItem",LN="textStyle",_N=/^\s*([-+*])\s$/,uC=wn.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",kt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` @@ -782,7 +782,7 @@ ${y.slice(h+2)}`,m+=1;else break}e.push({indent:h,number:parseInt(c,10),content: `),r=[];for(const a of n){const i=a.trim();i&&(/^<(?:h[1-6]|blockquote|hr|li|ul|ol|table|img)/.test(i)?r.push(i):r.push(`

${i}

`))}return r.join("")}const nF=wn.create({name:"linkTag",group:"inline",inline:!0,selectable:!0,atom:!0,addAttributes(){return{label:{default:""},url:{default:""},tagType:{default:"url",parseHTML:t=>t.getAttribute("data-tag-type")||"url"},tagId:{default:"",parseHTML:t=>t.getAttribute("data-tag-id")||""},pagePath:{default:"",parseHTML:t=>t.getAttribute("data-page-path")||""},appId:{default:"",parseHTML:t=>t.getAttribute("data-app-id")||""},mpKey:{default:"",parseHTML:t=>t.getAttribute("data-mp-key")||""}}},parseHTML(){return[{tag:'span[data-type="linkTag"]',getAttrs:t=>{var e;return{label:((e=t.textContent)==null?void 0:e.replace(/^#/,"").trim())||"",url:t.getAttribute("data-url")||"",tagType:t.getAttribute("data-tag-type")||"url",tagId:t.getAttribute("data-tag-id")||"",pagePath:t.getAttribute("data-page-path")||"",appId:t.getAttribute("data-app-id")||"",mpKey:t.getAttribute("data-mp-key")||""}}}]},renderHTML({node:t,HTMLAttributes:e}){return["span",kt(e,{"data-type":"linkTag","data-url":t.attrs.url,"data-tag-type":t.attrs.tagType,"data-tag-id":t.attrs.tagId,"data-page-path":t.attrs.pagePath,"data-app-id":t.attrs.appId||"","data-mp-key":t.attrs.mpKey||t.attrs.appId||"",class:"link-tag-node"}),`#${t.attrs.label}`]}}),rF=(t,e)=>({items:({query:n})=>{const r=t.current||[],a=n.toLowerCase().trim(),i=r.filter(o=>o.name.toLowerCase().includes(a)||o.id.includes(a)?!0:o.aliases?o.aliases.split(",").some(c=>c.trim().toLowerCase().includes(a)):!1).slice(0,8);return a.length>=1&&!r.some(o=>o.name.toLowerCase()===a)&&i.push({id:"__new__",name:`+ 新增「${n.trim()}」`,_newName:n.trim()}),i},render:()=>{let n=null,r=0,a=[],i=null;const o=async u=>{const h=a[u];if(!h||!i)return;const f=h;if(f.id==="__new__"&&f._newName&&e.current)try{const m=await e.current(f._newName);m&&i({id:m.id,label:m.name})}catch{}else i({id:h.id,label:h.name})},c=()=>{n&&(n.innerHTML=a.map((u,h)=>`
@${u.name} ${u.id==="__new__"?"":u.label||u.id} -
`).join(""),n.querySelectorAll(".mention-item").forEach(u=>{u.addEventListener("click",()=>{const h=parseInt(u.getAttribute("data-index")||"0");o(h)})}))};return{onStart:u=>{if(n=document.createElement("div"),n.className="mention-popup",document.body.appendChild(n),a=u.items,i=u.command,r=0,c(),u.clientRect){const h=u.clientRect();h&&(n.style.top=`${h.bottom+4}px`,n.style.left=`${h.left}px`)}},onUpdate:u=>{if(a=u.items,i=u.command,r=0,c(),u.clientRect&&n){const h=u.clientRect();h&&(n.style.top=`${h.bottom+4}px`,n.style.left=`${h.left}px`)}},onKeyDown:u=>u.event.key==="ArrowUp"?(r=Math.max(0,r-1),c(),!0):u.event.key==="ArrowDown"?(r=Math.min(a.length-1,r+1),c(),!0):u.event.key==="Enter"?(o(r),!0):u.event.key==="Escape"?(n==null||n.remove(),n=null,!0):!1,onExit:()=>{n==null||n.remove(),n=null}}}}),Ax=b.forwardRef(({content:t,onChange:e,onImageUpload:n,onVideoUpload:r,persons:a=[],linkTags:i=[],onPersonCreate:o,placeholder:c="开始编辑内容...",className:u},h)=>{const f=b.useRef(null),m=b.useRef(null),[g,y]=b.useState(!1),[v,w]=b.useState(""),[N,k]=b.useState(!1),[C,E]=b.useState(!1),[A,I]=b.useState(0),D=b.useRef(Ng(ow(t),a,i)),_=b.useRef(e);_.current=e;const P=b.useRef(a);P.current=a;const L=b.useRef(i);L.current=i;const z=b.useRef(o);z.current=o;const ee=b.useRef(),U=J_({extensions:[Lz,$z.configure({inline:!0,allowBase64:!0}),U7.configure({openOnClick:!1,HTMLAttributes:{class:"rich-link"}}),Uz.configure({HTMLAttributes:{class:"mention-tag"},suggestion:{...rF(P,z),allowedPrefixes:null}}),nF,Kz.configure({placeholder:c}),FC.configure({resizable:!0}),$C,_C,zC],content:D.current,onUpdate:({editor:$})=>{ee.current&&clearTimeout(ee.current),ee.current=setTimeout(()=>{const ce=$.getHTML(),Y=Ng(ce,P.current||[],L.current||[]);if(Y!==ce){$.commands.setContent(Y,{emitUpdate:!1}),_.current(Y);return}_.current(ce)},300)},editorProps:{attributes:{class:"rich-editor-content"}}});b.useImperativeHandle(h,()=>({getHTML:()=>(U==null?void 0:U.getHTML())||"",getMarkdown:()=>tF((U==null?void 0:U.getHTML())||"")})),b.useEffect(()=>{if(!U)return;const $=Ng(ow(t),P.current||[],L.current||[]);$!==U.getHTML()&&U.commands.setContent($,{emitUpdate:!1})},[t,U,a,i]);const he=b.useCallback(async $=>{var Y;const ce=(Y=$.target.files)==null?void 0:Y[0];if(!(!ce||!U)){if(n){E(!0),I(10);const F=setInterval(()=>{I(W=>Math.min(W+15,90))},300);try{const W=await n(ce);clearInterval(F),I(100),W&&U.chain().focus().setImage({src:W}).run()}finally{clearInterval(F),setTimeout(()=>{E(!1),I(0)},500)}}else{const F=new FileReader;F.onload=()=>{typeof F.result=="string"&&U.chain().focus().setImage({src:F.result}).run()},F.readAsDataURL(ce)}$.target.value=""}},[U,n]),me=b.useCallback(async $=>{var Y;const ce=(Y=$.target.files)==null?void 0:Y[0];if(!(!ce||!U)){if(r){y(!0),I(5);const F=setInterval(()=>{I(W=>Math.min(W+8,90))},500);try{const W=await r(ce);clearInterval(F),I(100),W&&U.chain().focus().insertContent(`

`).run()}finally{clearInterval(F),setTimeout(()=>{y(!1),I(0)},500)}}$.target.value=""}},[U,r]),R=b.useCallback(()=>{U&&U.chain().focus().insertContent("@").run()},[U]),O=b.useCallback($=>{U&&U.chain().focus().insertContent({type:"linkTag",attrs:{label:$.label,url:$.url||"",tagType:$.type||"url",tagId:$.id||"",pagePath:$.pagePath||"",appId:$.appId||"",mpKey:$.type==="miniprogram"&&$.appId||""}}).run()},[U]),X=b.useCallback(()=>{!U||!v||(U.chain().focus().setLink({href:v}).run(),w(""),k(!1))},[U,v]);return U?s.jsxs("div",{className:`rich-editor-wrapper ${u||""}`,children:[s.jsxs("div",{className:"rich-editor-toolbar",children:[s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>U.chain().focus().toggleBold().run(),className:U.isActive("bold")?"is-active":"",type:"button",children:s.jsx(VT,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>U.chain().focus().toggleItalic().run(),className:U.isActive("italic")?"is-active":"",type:"button",children:s.jsx(HM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>U.chain().focus().toggleStrike().run(),className:U.isActive("strike")?"is-active":"",type:"button",children:s.jsx(FA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>U.chain().focus().toggleCode().run(),className:U.isActive("code")?"is-active":"",type:"button",children:s.jsx(cM,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>U.chain().focus().toggleHeading({level:1}).run(),className:U.isActive("heading",{level:1})?"is-active":"",type:"button",children:s.jsx(PM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>U.chain().focus().toggleHeading({level:2}).run(),className:U.isActive("heading",{level:2})?"is-active":"",type:"button",children:s.jsx(DM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>U.chain().focus().toggleHeading({level:3}).run(),className:U.isActive("heading",{level:3})?"is-active":"",type:"button",children:s.jsx(_M,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>U.chain().focus().toggleBulletList().run(),className:U.isActive("bulletList")?"is-active":"",type:"button",children:s.jsx(XM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>U.chain().focus().toggleOrderedList().run(),className:U.isActive("orderedList")?"is-active":"",type:"button",children:s.jsx(YM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>U.chain().focus().toggleBlockquote().run(),className:U.isActive("blockquote")?"is-active":"",type:"button",children:s.jsx(SA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>U.chain().focus().setHorizontalRule().run(),type:"button",children:s.jsx(cA,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("input",{ref:f,type:"file",accept:"image/*",onChange:he,className:"hidden"}),s.jsx("button",{onClick:()=>{var $;return($=f.current)==null?void 0:$.click()},type:"button",title:"插入图片",children:s.jsx(Xw,{className:"w-4 h-4"})}),s.jsx("input",{ref:m,type:"file",accept:"video/mp4,video/quicktime,video/webm,.mp4,.mov,.webm",onChange:me,className:"hidden"}),s.jsx("button",{onClick:()=>{var $;return($=m.current)==null?void 0:$.click()},disabled:g||!r,type:"button",title:"插入视频",className:g?"opacity-50":"",children:s.jsx(t5,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>k(!N),className:U.isActive("link")?"is-active":"",type:"button",title:"插入链接",children:s.jsx(Lg,{className:"w-4 h-4"})}),s.jsx("button",{onClick:R,type:"button",title:"@ 指定人物",className:"mention-trigger-btn",children:s.jsx($T,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>U.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),type:"button",children:s.jsx(VA,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>U.chain().focus().undo().run(),disabled:!U.can().undo(),type:"button",children:s.jsx(JA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>U.chain().focus().redo().run(),disabled:!U.can().redo(),type:"button",children:s.jsx(EA,{className:"w-4 h-4"})})]}),i.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"toolbar-divider"}),s.jsx("div",{className:"toolbar-group",children:s.jsxs("select",{className:"link-tag-select",onChange:$=>{const ce=i.find(Y=>Y.id===$.target.value);ce&&O(ce),$.target.value=""},defaultValue:"",children:[s.jsx("option",{value:"",disabled:!0,children:"# 插入链接标签"}),i.map($=>s.jsx("option",{value:$.id,children:$.label},$.id))]})})]})]}),N&&s.jsxs("div",{className:"link-input-bar",children:[s.jsx("input",{type:"url",placeholder:"输入链接地址...",value:v,onChange:$=>w($.target.value),onKeyDown:$=>$.key==="Enter"&&X(),className:"link-input"}),s.jsx("button",{onClick:X,className:"link-confirm",type:"button",children:"确定"}),s.jsx("button",{onClick:()=>{U.chain().focus().unsetLink().run(),k(!1)},className:"link-remove",type:"button",children:"移除"})]}),(C||g)&&s.jsxs("div",{className:"upload-progress-bar",children:[s.jsx("div",{className:"upload-progress-track",children:s.jsx("div",{className:"upload-progress-fill",style:{width:`${A}%`}})}),s.jsxs("span",{className:"upload-progress-text",children:[g?"视频":"图片","上传中 ",A,"%"]})]}),s.jsx(Y2,{editor:U})]}):null});Ax.displayName="RichEditor";const sF=["top","right","bottom","left"],Ii=Math.min,Lr=Math.max,uf=Math.round,th=Math.floor,Us=t=>({x:t,y:t}),aF={left:"right",right:"left",bottom:"top",top:"bottom"},iF={start:"end",end:"start"};function Ix(t,e,n){return Lr(t,Ii(e,n))}function Ma(t,e){return typeof t=="function"?t(e):t}function Aa(t){return t.split("-")[0]}function Zl(t){return t.split("-")[1]}function X0(t){return t==="x"?"y":"x"}function Z0(t){return t==="y"?"height":"width"}const oF=new Set(["top","bottom"]);function Ws(t){return oF.has(Aa(t))?"y":"x"}function ey(t){return X0(Ws(t))}function lF(t,e,n){n===void 0&&(n=!1);const r=Zl(t),a=ey(t),i=Z0(a);let o=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=hf(o)),[o,hf(o)]}function cF(t){const e=hf(t);return[Rx(t),e,Rx(e)]}function Rx(t){return t.replace(/start|end/g,e=>iF[e])}const lw=["left","right"],cw=["right","left"],dF=["top","bottom"],uF=["bottom","top"];function hF(t,e,n){switch(t){case"top":case"bottom":return n?e?cw:lw:e?lw:cw;case"left":case"right":return e?dF:uF;default:return[]}}function fF(t,e,n,r){const a=Zl(t);let i=hF(Aa(t),n==="start",r);return a&&(i=i.map(o=>o+"-"+a),e&&(i=i.concat(i.map(Rx)))),i}function hf(t){return t.replace(/left|right|bottom|top/g,e=>aF[e])}function pF(t){return{top:0,right:0,bottom:0,left:0,...t}}function BC(t){return typeof t!="number"?pF(t):{top:t,right:t,bottom:t,left:t}}function ff(t){const{x:e,y:n,width:r,height:a}=t;return{width:r,height:a,top:n,left:e,right:e+r,bottom:n+a,x:e,y:n}}function dw(t,e,n){let{reference:r,floating:a}=t;const i=Ws(e),o=ey(e),c=Z0(o),u=Aa(e),h=i==="y",f=r.x+r.width/2-a.width/2,m=r.y+r.height/2-a.height/2,g=r[c]/2-a[c]/2;let y;switch(u){case"top":y={x:f,y:r.y-a.height};break;case"bottom":y={x:f,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:m};break;case"left":y={x:r.x-a.width,y:m};break;default:y={x:r.x,y:r.y}}switch(Zl(e)){case"start":y[o]-=g*(n&&h?-1:1);break;case"end":y[o]+=g*(n&&h?-1:1);break}return y}async function mF(t,e){var n;e===void 0&&(e={});const{x:r,y:a,platform:i,rects:o,elements:c,strategy:u}=t,{boundary:h="clippingAncestors",rootBoundary:f="viewport",elementContext:m="floating",altBoundary:g=!1,padding:y=0}=Ma(e,t),v=BC(y),N=c[g?m==="floating"?"reference":"floating":m],k=ff(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(N)))==null||n?N:N.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:h,rootBoundary:f,strategy:u})),C=m==="floating"?{x:r,y:a,width:o.floating.width,height:o.floating.height}:o.reference,E=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),A=await(i.isElement==null?void 0:i.isElement(E))?await(i.getScale==null?void 0:i.getScale(E))||{x:1,y:1}:{x:1,y:1},I=ff(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:C,offsetParent:E,strategy:u}):C);return{top:(k.top-I.top+v.top)/A.y,bottom:(I.bottom-k.bottom+v.bottom)/A.y,left:(k.left-I.left+v.left)/A.x,right:(I.right-k.right+v.right)/A.x}}const gF=async(t,e,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:i=[],platform:o}=n,c=i.filter(Boolean),u=await(o.isRTL==null?void 0:o.isRTL(e));let h=await o.getElementRects({reference:t,floating:e,strategy:a}),{x:f,y:m}=dw(h,r,u),g=r,y={},v=0;for(let N=0;N({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:a,rects:i,platform:o,elements:c,middlewareData:u}=e,{element:h,padding:f=0}=Ma(t,e)||{};if(h==null)return{};const m=BC(f),g={x:n,y:r},y=ey(a),v=Z0(y),w=await o.getDimensions(h),N=y==="y",k=N?"top":"left",C=N?"bottom":"right",E=N?"clientHeight":"clientWidth",A=i.reference[v]+i.reference[y]-g[y]-i.floating[v],I=g[y]-i.reference[y],D=await(o.getOffsetParent==null?void 0:o.getOffsetParent(h));let _=D?D[E]:0;(!_||!await(o.isElement==null?void 0:o.isElement(D)))&&(_=c.floating[E]||i.floating[v]);const P=A/2-I/2,L=_/2-w[v]/2-1,z=Ii(m[k],L),ee=Ii(m[C],L),U=z,he=_-w[v]-ee,me=_/2-w[v]/2+P,R=Ix(U,me,he),O=!u.arrow&&Zl(a)!=null&&me!==R&&i.reference[v]/2-(meme<=0)){var ee,U;const me=(((ee=i.flip)==null?void 0:ee.index)||0)+1,R=_[me];if(R&&(!(m==="alignment"?C!==Ws(R):!1)||z.every($=>Ws($.placement)===C?$.overflows[0]>0:!0)))return{data:{index:me,overflows:z},reset:{placement:R}};let O=(U=z.filter(X=>X.overflows[0]<=0).sort((X,$)=>X.overflows[1]-$.overflows[1])[0])==null?void 0:U.placement;if(!O)switch(y){case"bestFit":{var he;const X=(he=z.filter($=>{if(D){const ce=Ws($.placement);return ce===C||ce==="y"}return!0}).map($=>[$.placement,$.overflows.filter(ce=>ce>0).reduce((ce,Y)=>ce+Y,0)]).sort(($,ce)=>$[1]-ce[1])[0])==null?void 0:he[0];X&&(O=X);break}case"initialPlacement":O=c;break}if(a!==O)return{reset:{placement:O}}}return{}}}};function uw(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function hw(t){return sF.some(e=>t[e]>=0)}const bF=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:a="referenceHidden",...i}=Ma(t,e);switch(a){case"referenceHidden":{const o=await r.detectOverflow(e,{...i,elementContext:"reference"}),c=uw(o,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:hw(c)}}}case"escaped":{const o=await r.detectOverflow(e,{...i,altBoundary:!0}),c=uw(o,n.floating);return{data:{escapedOffsets:c,escaped:hw(c)}}}default:return{}}}}},VC=new Set(["left","top"]);async function vF(t,e){const{placement:n,platform:r,elements:a}=t,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),o=Aa(n),c=Zl(n),u=Ws(n)==="y",h=VC.has(o)?-1:1,f=i&&u?-1:1,m=Ma(e,t);let{mainAxis:g,crossAxis:y,alignmentAxis:v}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof v=="number"&&(y=c==="end"?v*-1:v),u?{x:y*f,y:g*h}:{x:g*h,y:y*f}}const NF=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:a,y:i,placement:o,middlewareData:c}=e,u=await vF(e,t);return o===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:a+u.x,y:i+u.y,data:{...u,placement:o}}}}},wF=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:a,platform:i}=e,{mainAxis:o=!0,crossAxis:c=!1,limiter:u={fn:k=>{let{x:C,y:E}=k;return{x:C,y:E}}},...h}=Ma(t,e),f={x:n,y:r},m=await i.detectOverflow(e,h),g=Ws(Aa(a)),y=X0(g);let v=f[y],w=f[g];if(o){const k=y==="y"?"top":"left",C=y==="y"?"bottom":"right",E=v+m[k],A=v-m[C];v=Ix(E,v,A)}if(c){const k=g==="y"?"top":"left",C=g==="y"?"bottom":"right",E=w+m[k],A=w-m[C];w=Ix(E,w,A)}const N=u.fn({...e,[y]:v,[g]:w});return{...N,data:{x:N.x-n,y:N.y-r,enabled:{[y]:o,[g]:c}}}}}},jF=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:a,rects:i,middlewareData:o}=e,{offset:c=0,mainAxis:u=!0,crossAxis:h=!0}=Ma(t,e),f={x:n,y:r},m=Ws(a),g=X0(m);let y=f[g],v=f[m];const w=Ma(c,e),N=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(u){const E=g==="y"?"height":"width",A=i.reference[g]-i.floating[E]+N.mainAxis,I=i.reference[g]+i.reference[E]-N.mainAxis;yI&&(y=I)}if(h){var k,C;const E=g==="y"?"width":"height",A=VC.has(Aa(a)),I=i.reference[m]-i.floating[E]+(A&&((k=o.offset)==null?void 0:k[m])||0)+(A?0:N.crossAxis),D=i.reference[m]+i.reference[E]+(A?0:((C=o.offset)==null?void 0:C[m])||0)-(A?N.crossAxis:0);vD&&(v=D)}return{[g]:y,[m]:v}}}},kF=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:a,rects:i,platform:o,elements:c}=e,{apply:u=()=>{},...h}=Ma(t,e),f=await o.detectOverflow(e,h),m=Aa(a),g=Zl(a),y=Ws(a)==="y",{width:v,height:w}=i.floating;let N,k;m==="top"||m==="bottom"?(N=m,k=g===(await(o.isRTL==null?void 0:o.isRTL(c.floating))?"start":"end")?"left":"right"):(k=m,N=g==="end"?"top":"bottom");const C=w-f.top-f.bottom,E=v-f.left-f.right,A=Ii(w-f[N],C),I=Ii(v-f[k],E),D=!e.middlewareData.shift;let _=A,P=I;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(P=E),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(_=C),D&&!g){const z=Lr(f.left,0),ee=Lr(f.right,0),U=Lr(f.top,0),he=Lr(f.bottom,0);y?P=v-2*(z!==0||ee!==0?z+ee:Lr(f.left,f.right)):_=w-2*(U!==0||he!==0?U+he:Lr(f.top,f.bottom))}await u({...e,availableWidth:P,availableHeight:_});const L=await o.getDimensions(c.floating);return v!==L.width||w!==L.height?{reset:{rects:!0}}:{}}}};function Vf(){return typeof window<"u"}function ec(t){return HC(t)?(t.nodeName||"").toLowerCase():"#document"}function Br(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Qs(t){var e;return(e=(HC(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function HC(t){return Vf()?t instanceof Node||t instanceof Br(t).Node:!1}function js(t){return Vf()?t instanceof Element||t instanceof Br(t).Element:!1}function Js(t){return Vf()?t instanceof HTMLElement||t instanceof Br(t).HTMLElement:!1}function fw(t){return!Vf()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Br(t).ShadowRoot}const SF=new Set(["inline","contents"]);function Id(t){const{overflow:e,overflowX:n,overflowY:r,display:a}=ks(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!SF.has(a)}const CF=new Set(["table","td","th"]);function EF(t){return CF.has(ec(t))}const TF=[":popover-open",":modal"];function Hf(t){return TF.some(e=>{try{return t.matches(e)}catch{return!1}})}const MF=["transform","translate","scale","rotate","perspective"],AF=["transform","translate","scale","rotate","perspective","filter"],IF=["paint","layout","strict","content"];function ty(t){const e=ny(),n=js(t)?ks(t):t;return MF.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||AF.some(r=>(n.willChange||"").includes(r))||IF.some(r=>(n.contain||"").includes(r))}function RF(t){let e=Ri(t);for(;Js(e)&&!Wl(e);){if(ty(e))return e;if(Hf(e))return null;e=Ri(e)}return null}function ny(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const PF=new Set(["html","body","#document"]);function Wl(t){return PF.has(ec(t))}function ks(t){return Br(t).getComputedStyle(t)}function Wf(t){return js(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ri(t){if(ec(t)==="html")return t;const e=t.assignedSlot||t.parentNode||fw(t)&&t.host||Qs(t);return fw(e)?e.host:e}function WC(t){const e=Ri(t);return Wl(e)?t.ownerDocument?t.ownerDocument.body:t.body:Js(e)&&Id(e)?e:WC(e)}function Nd(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const a=WC(t),i=a===((r=t.ownerDocument)==null?void 0:r.body),o=Br(a);if(i){const c=Px(o);return e.concat(o,o.visualViewport||[],Id(a)?a:[],c&&n?Nd(c):[])}return e.concat(a,Nd(a,[],n))}function Px(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function UC(t){const e=ks(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const a=Js(t),i=a?t.offsetWidth:n,o=a?t.offsetHeight:r,c=uf(n)!==i||uf(r)!==o;return c&&(n=i,r=o),{width:n,height:r,$:c}}function ry(t){return js(t)?t:t.contextElement}function Ol(t){const e=ry(t);if(!Js(e))return Us(1);const n=e.getBoundingClientRect(),{width:r,height:a,$:i}=UC(e);let o=(i?uf(n.width):n.width)/r,c=(i?uf(n.height):n.height)/a;return(!o||!Number.isFinite(o))&&(o=1),(!c||!Number.isFinite(c))&&(c=1),{x:o,y:c}}const OF=Us(0);function KC(t){const e=Br(t);return!ny()||!e.visualViewport?OF:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function DF(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Br(t)?!1:e}function Lo(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const a=t.getBoundingClientRect(),i=ry(t);let o=Us(1);e&&(r?js(r)&&(o=Ol(r)):o=Ol(t));const c=DF(i,n,r)?KC(i):Us(0);let u=(a.left+c.x)/o.x,h=(a.top+c.y)/o.y,f=a.width/o.x,m=a.height/o.y;if(i){const g=Br(i),y=r&&js(r)?Br(r):r;let v=g,w=Px(v);for(;w&&r&&y!==v;){const N=Ol(w),k=w.getBoundingClientRect(),C=ks(w),E=k.left+(w.clientLeft+parseFloat(C.paddingLeft))*N.x,A=k.top+(w.clientTop+parseFloat(C.paddingTop))*N.y;u*=N.x,h*=N.y,f*=N.x,m*=N.y,u+=E,h+=A,v=Br(w),w=Px(v)}}return ff({width:f,height:m,x:u,y:h})}function Uf(t,e){const n=Wf(t).scrollLeft;return e?e.left+n:Lo(Qs(t)).left+n}function qC(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-Uf(t,n),a=n.top+e.scrollTop;return{x:r,y:a}}function LF(t){let{elements:e,rect:n,offsetParent:r,strategy:a}=t;const i=a==="fixed",o=Qs(r),c=e?Hf(e.floating):!1;if(r===o||c&&i)return n;let u={scrollLeft:0,scrollTop:0},h=Us(1);const f=Us(0),m=Js(r);if((m||!m&&!i)&&((ec(r)!=="body"||Id(o))&&(u=Wf(r)),Js(r))){const y=Lo(r);h=Ol(r),f.x=y.x+r.clientLeft,f.y=y.y+r.clientTop}const g=o&&!m&&!i?qC(o,u):Us(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-u.scrollLeft*h.x+f.x+g.x,y:n.y*h.y-u.scrollTop*h.y+f.y+g.y}}function _F(t){return Array.from(t.getClientRects())}function zF(t){const e=Qs(t),n=Wf(t),r=t.ownerDocument.body,a=Lr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=Lr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Uf(t);const c=-n.scrollTop;return ks(r).direction==="rtl"&&(o+=Lr(e.clientWidth,r.clientWidth)-a),{width:a,height:i,x:o,y:c}}const pw=25;function $F(t,e){const n=Br(t),r=Qs(t),a=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,c=0,u=0;if(a){i=a.width,o=a.height;const f=ny();(!f||f&&e==="fixed")&&(c=a.offsetLeft,u=a.offsetTop)}const h=Uf(r);if(h<=0){const f=r.ownerDocument,m=f.body,g=getComputedStyle(m),y=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,v=Math.abs(r.clientWidth-m.clientWidth-y);v<=pw&&(i-=v)}else h<=pw&&(i+=h);return{width:i,height:o,x:c,y:u}}const FF=new Set(["absolute","fixed"]);function BF(t,e){const n=Lo(t,!0,e==="fixed"),r=n.top+t.clientTop,a=n.left+t.clientLeft,i=Js(t)?Ol(t):Us(1),o=t.clientWidth*i.x,c=t.clientHeight*i.y,u=a*i.x,h=r*i.y;return{width:o,height:c,x:u,y:h}}function mw(t,e,n){let r;if(e==="viewport")r=$F(t,n);else if(e==="document")r=zF(Qs(t));else if(js(e))r=BF(e,n);else{const a=KC(t);r={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return ff(r)}function GC(t,e){const n=Ri(t);return n===e||!js(n)||Wl(n)?!1:ks(n).position==="fixed"||GC(n,e)}function VF(t,e){const n=e.get(t);if(n)return n;let r=Nd(t,[],!1).filter(c=>js(c)&&ec(c)!=="body"),a=null;const i=ks(t).position==="fixed";let o=i?Ri(t):t;for(;js(o)&&!Wl(o);){const c=ks(o),u=ty(o);!u&&c.position==="fixed"&&(a=null),(i?!u&&!a:!u&&c.position==="static"&&!!a&&FF.has(a.position)||Id(o)&&!u&&GC(t,o))?r=r.filter(f=>f!==o):a=c,o=Ri(o)}return e.set(t,r),r}function HF(t){let{element:e,boundary:n,rootBoundary:r,strategy:a}=t;const o=[...n==="clippingAncestors"?Hf(e)?[]:VF(e,this._c):[].concat(n),r],c=o[0],u=o.reduce((h,f)=>{const m=mw(e,f,a);return h.top=Lr(m.top,h.top),h.right=Ii(m.right,h.right),h.bottom=Ii(m.bottom,h.bottom),h.left=Lr(m.left,h.left),h},mw(e,c,a));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function WF(t){const{width:e,height:n}=UC(t);return{width:e,height:n}}function UF(t,e,n){const r=Js(e),a=Qs(e),i=n==="fixed",o=Lo(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const u=Us(0);function h(){u.x=Uf(a)}if(r||!r&&!i)if((ec(e)!=="body"||Id(a))&&(c=Wf(e)),r){const y=Lo(e,!0,i,e);u.x=y.x+e.clientLeft,u.y=y.y+e.clientTop}else a&&h();i&&!r&&a&&h();const f=a&&!r&&!i?qC(a,c):Us(0),m=o.left+c.scrollLeft-u.x-f.x,g=o.top+c.scrollTop-u.y-f.y;return{x:m,y:g,width:o.width,height:o.height}}function wg(t){return ks(t).position==="static"}function gw(t,e){if(!Js(t)||ks(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Qs(t)===n&&(n=n.ownerDocument.body),n}function JC(t,e){const n=Br(t);if(Hf(t))return n;if(!Js(t)){let a=Ri(t);for(;a&&!Wl(a);){if(js(a)&&!wg(a))return a;a=Ri(a)}return n}let r=gw(t,e);for(;r&&EF(r)&&wg(r);)r=gw(r,e);return r&&Wl(r)&&wg(r)&&!ty(r)?n:r||RF(t)||n}const KF=async function(t){const e=this.getOffsetParent||JC,n=this.getDimensions,r=await n(t.floating);return{reference:UF(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function qF(t){return ks(t).direction==="rtl"}const GF={convertOffsetParentRelativeRectToViewportRelativeRect:LF,getDocumentElement:Qs,getClippingRect:HF,getOffsetParent:JC,getElementRects:KF,getClientRects:_F,getDimensions:WF,getScale:Ol,isElement:js,isRTL:qF};function YC(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function JF(t,e){let n=null,r;const a=Qs(t);function i(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function o(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),i();const h=t.getBoundingClientRect(),{left:f,top:m,width:g,height:y}=h;if(c||e(),!g||!y)return;const v=th(m),w=th(a.clientWidth-(f+g)),N=th(a.clientHeight-(m+y)),k=th(f),E={rootMargin:-v+"px "+-w+"px "+-N+"px "+-k+"px",threshold:Lr(0,Ii(1,u))||1};let A=!0;function I(D){const _=D[0].intersectionRatio;if(_!==u){if(!A)return o();_?o(!1,_):r=setTimeout(()=>{o(!1,1e-7)},1e3)}_===1&&!YC(h,t.getBoundingClientRect())&&o(),A=!1}try{n=new IntersectionObserver(I,{...E,root:a.ownerDocument})}catch{n=new IntersectionObserver(I,E)}n.observe(t)}return o(!0),i}function YF(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,h=ry(t),f=a||i?[...h?Nd(h):[],...Nd(e)]:[];f.forEach(k=>{a&&k.addEventListener("scroll",n,{passive:!0}),i&&k.addEventListener("resize",n)});const m=h&&c?JF(h,n):null;let g=-1,y=null;o&&(y=new ResizeObserver(k=>{let[C]=k;C&&C.target===h&&y&&(y.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var E;(E=y)==null||E.observe(e)})),n()}),h&&!u&&y.observe(h),y.observe(e));let v,w=u?Lo(t):null;u&&N();function N(){const k=Lo(t);w&&!YC(w,k)&&n(),w=k,v=requestAnimationFrame(N)}return n(),()=>{var k;f.forEach(C=>{a&&C.removeEventListener("scroll",n),i&&C.removeEventListener("resize",n)}),m==null||m(),(k=y)==null||k.disconnect(),y=null,u&&cancelAnimationFrame(v)}}const QF=NF,XF=wF,ZF=yF,eB=kF,tB=bF,xw=xF,nB=jF,rB=(t,e,n)=>{const r=new Map,a={platform:GF,...n},i={...a.platform,_c:r};return gF(t,e,{...a,platform:i})};var sB=typeof document<"u",aB=function(){},uh=sB?b.useLayoutEffect:aB;function pf(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,a;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!pf(t[r],e[r]))return!1;return!0}if(a=Object.keys(t),n=a.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,a[r]))return!1;for(r=n;r--!==0;){const i=a[r];if(!(i==="_owner"&&t.$$typeof)&&!pf(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function QC(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function yw(t,e){const n=QC(t);return Math.round(e*n)/n}function jg(t){const e=b.useRef(t);return uh(()=>{e.current=t}),e}function iB(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:i,floating:o}={},transform:c=!0,whileElementsMounted:u,open:h}=t,[f,m]=b.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[g,y]=b.useState(r);pf(g,r)||y(r);const[v,w]=b.useState(null),[N,k]=b.useState(null),C=b.useCallback($=>{$!==D.current&&(D.current=$,w($))},[]),E=b.useCallback($=>{$!==_.current&&(_.current=$,k($))},[]),A=i||v,I=o||N,D=b.useRef(null),_=b.useRef(null),P=b.useRef(f),L=u!=null,z=jg(u),ee=jg(a),U=jg(h),he=b.useCallback(()=>{if(!D.current||!_.current)return;const $={placement:e,strategy:n,middleware:g};ee.current&&($.platform=ee.current),rB(D.current,_.current,$).then(ce=>{const Y={...ce,isPositioned:U.current!==!1};me.current&&!pf(P.current,Y)&&(P.current=Y,jd.flushSync(()=>{m(Y)}))})},[g,e,n,ee,U]);uh(()=>{h===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,m($=>({...$,isPositioned:!1})))},[h]);const me=b.useRef(!1);uh(()=>(me.current=!0,()=>{me.current=!1}),[]),uh(()=>{if(A&&(D.current=A),I&&(_.current=I),A&&I){if(z.current)return z.current(A,I,he);he()}},[A,I,he,z,L]);const R=b.useMemo(()=>({reference:D,floating:_,setReference:C,setFloating:E}),[C,E]),O=b.useMemo(()=>({reference:A,floating:I}),[A,I]),X=b.useMemo(()=>{const $={position:n,left:0,top:0};if(!O.floating)return $;const ce=yw(O.floating,f.x),Y=yw(O.floating,f.y);return c?{...$,transform:"translate("+ce+"px, "+Y+"px)",...QC(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ce,top:Y}},[n,c,O.floating,f.x,f.y]);return b.useMemo(()=>({...f,update:he,refs:R,elements:O,floatingStyles:X}),[f,he,R,O,X])}const oB=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:a}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?xw({element:r.current,padding:a}).fn(n):{}:r?xw({element:r,padding:a}).fn(n):{}}}},lB=(t,e)=>({...QF(t),options:[t,e]}),cB=(t,e)=>({...XF(t),options:[t,e]}),dB=(t,e)=>({...nB(t),options:[t,e]}),uB=(t,e)=>({...ZF(t),options:[t,e]}),hB=(t,e)=>({...eB(t),options:[t,e]}),fB=(t,e)=>({...tB(t),options:[t,e]}),pB=(t,e)=>({...oB(t),options:[t,e]});var mB="Arrow",XC=b.forwardRef((t,e)=>{const{children:n,width:r=10,height:a=5,...i}=t;return s.jsx(ut.svg,{...i,ref:e,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});XC.displayName=mB;var gB=XC,sy="Popper",[ZC,e4]=Li(sy),[xB,t4]=ZC(sy),n4=t=>{const{__scopePopper:e,children:n}=t,[r,a]=b.useState(null);return s.jsx(xB,{scope:e,anchor:r,onAnchorChange:a,children:n})};n4.displayName=sy;var r4="PopperAnchor",s4=b.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...a}=t,i=t4(r4,n),o=b.useRef(null),c=St(e,o),u=b.useRef(null);return b.useEffect(()=>{const h=u.current;u.current=(r==null?void 0:r.current)||o.current,h!==u.current&&i.onAnchorChange(u.current)}),r?null:s.jsx(ut.div,{...a,ref:c})});s4.displayName=r4;var ay="PopperContent",[yB,bB]=ZC(ay),a4=b.forwardRef((t,e)=>{var Q,se,ye,Me,Be,He;const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:i="center",alignOffset:o=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:h=[],collisionPadding:f=0,sticky:m="partial",hideWhenDetached:g=!1,updatePositionStrategy:y="optimized",onPlaced:v,...w}=t,N=t4(ay,n),[k,C]=b.useState(null),E=St(e,gt=>C(gt)),[A,I]=b.useState(null),D=a0(A),_=(D==null?void 0:D.width)??0,P=(D==null?void 0:D.height)??0,L=r+(i!=="center"?"-"+i:""),z=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},ee=Array.isArray(h)?h:[h],U=ee.length>0,he={padding:z,boundary:ee.filter(NB),altBoundary:U},{refs:me,floatingStyles:R,placement:O,isPositioned:X,middlewareData:$}=iB({strategy:"fixed",placement:L,whileElementsMounted:(...gt)=>YF(...gt,{animationFrame:y==="always"}),elements:{reference:N.anchor},middleware:[lB({mainAxis:a+P,alignmentAxis:o}),u&&cB({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?dB():void 0,...he}),u&&uB({...he}),hB({...he,apply:({elements:gt,rects:Dt,availableWidth:jn,availableHeight:it})=>{const{width:Mt,height:re}=Dt.reference,Pe=gt.floating.style;Pe.setProperty("--radix-popper-available-width",`${jn}px`),Pe.setProperty("--radix-popper-available-height",`${it}px`),Pe.setProperty("--radix-popper-anchor-width",`${Mt}px`),Pe.setProperty("--radix-popper-anchor-height",`${re}px`)}}),A&&pB({element:A,padding:c}),wB({arrowWidth:_,arrowHeight:P}),g&&fB({strategy:"referenceHidden",...he})]}),[ce,Y]=l4(O),F=Ti(v);rr(()=>{X&&(F==null||F())},[X,F]);const W=(Q=$.arrow)==null?void 0:Q.x,K=(se=$.arrow)==null?void 0:se.y,B=((ye=$.arrow)==null?void 0:ye.centerOffset)!==0,[oe,G]=b.useState();return rr(()=>{k&&G(window.getComputedStyle(k).zIndex)},[k]),s.jsx("div",{ref:me.setFloating,"data-radix-popper-content-wrapper":"",style:{...R,transform:X?R.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:oe,"--radix-popper-transform-origin":[(Me=$.transformOrigin)==null?void 0:Me.x,(Be=$.transformOrigin)==null?void 0:Be.y].join(" "),...((He=$.hide)==null?void 0:He.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:s.jsx(yB,{scope:n,placedSide:ce,onArrowChange:I,arrowX:W,arrowY:K,shouldHideArrow:B,children:s.jsx(ut.div,{"data-side":ce,"data-align":Y,...w,ref:E,style:{...w.style,animation:X?void 0:"none"}})})})});a4.displayName=ay;var i4="PopperArrow",vB={top:"bottom",right:"left",bottom:"top",left:"right"},o4=b.forwardRef(function(e,n){const{__scopePopper:r,...a}=e,i=bB(i4,r),o=vB[i.placedSide];return s.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:s.jsx(gB,{...a,ref:n,style:{...a.style,display:"block"}})})});o4.displayName=i4;function NB(t){return t!==null}var wB=t=>({name:"transformOrigin",options:t,fn(e){var N,k,C;const{placement:n,rects:r,middlewareData:a}=e,o=((N=a.arrow)==null?void 0:N.centerOffset)!==0,c=o?0:t.arrowWidth,u=o?0:t.arrowHeight,[h,f]=l4(n),m={start:"0%",center:"50%",end:"100%"}[f],g=(((k=a.arrow)==null?void 0:k.x)??0)+c/2,y=(((C=a.arrow)==null?void 0:C.y)??0)+u/2;let v="",w="";return h==="bottom"?(v=o?m:`${g}px`,w=`${-u}px`):h==="top"?(v=o?m:`${g}px`,w=`${r.floating.height+u}px`):h==="right"?(v=`${-u}px`,w=o?m:`${y}px`):h==="left"&&(v=`${r.floating.width+u}px`,w=o?m:`${y}px`),{data:{x:v,y:w}}}});function l4(t){const[e,n="center"]=t.split("-");return[e,n]}var jB=n4,kB=s4,SB=a4,CB=o4,c4=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"}),EB="VisuallyHidden",TB=b.forwardRef((t,e)=>s.jsx(ut.span,{...t,ref:e,style:{...c4,...t.style}}));TB.displayName=EB;var MB=[" ","Enter","ArrowUp","ArrowDown"],AB=[" ","Enter"],_o="Select",[Kf,qf,IB]=n0(_o),[tc]=Li(_o,[IB,e4]),Gf=e4(),[RB,Fi]=tc(_o),[PB,OB]=tc(_o),d4=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:a,onOpenChange:i,value:o,defaultValue:c,onValueChange:u,dir:h,name:f,autoComplete:m,disabled:g,required:y,form:v}=t,w=Gf(e),[N,k]=b.useState(null),[C,E]=b.useState(null),[A,I]=b.useState(!1),D=wf(h),[_,P]=Eo({prop:r,defaultProp:a??!1,onChange:i,caller:_o}),[L,z]=Eo({prop:o,defaultProp:c,onChange:u,caller:_o}),ee=b.useRef(null),U=N?v||!!N.closest("form"):!0,[he,me]=b.useState(new Set),R=Array.from(he).map(O=>O.props.value).join(";");return s.jsx(jB,{...w,children:s.jsxs(RB,{required:y,scope:e,trigger:N,onTriggerChange:k,valueNode:C,onValueNodeChange:E,valueNodeHasChildren:A,onValueNodeHasChildrenChange:I,contentId:ji(),value:L,onValueChange:z,open:_,onOpenChange:P,dir:D,triggerPointerDownPosRef:ee,disabled:g,children:[s.jsx(Kf.Provider,{scope:e,children:s.jsx(PB,{scope:t.__scopeSelect,onNativeOptionAdd:b.useCallback(O=>{me(X=>new Set(X).add(O))},[]),onNativeOptionRemove:b.useCallback(O=>{me(X=>{const $=new Set(X);return $.delete(O),$})},[]),children:n})}),U?s.jsxs(R4,{"aria-hidden":!0,required:y,tabIndex:-1,name:f,autoComplete:m,value:L,onChange:O=>z(O.target.value),disabled:g,form:v,children:[L===void 0?s.jsx("option",{value:""}):null,Array.from(he)]},R):null]})})};d4.displayName=_o;var u4="SelectTrigger",h4=b.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...a}=t,i=Gf(n),o=Fi(u4,n),c=o.disabled||r,u=St(e,o.onTriggerChange),h=qf(n),f=b.useRef("touch"),[m,g,y]=O4(w=>{const N=h().filter(E=>!E.disabled),k=N.find(E=>E.value===o.value),C=D4(N,w,k);C!==void 0&&o.onValueChange(C.value)}),v=w=>{c||(o.onOpenChange(!0),y()),w&&(o.triggerPointerDownPosRef.current={x:Math.round(w.pageX),y:Math.round(w.pageY)})};return s.jsx(kB,{asChild:!0,...i,children:s.jsx(ut.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":P4(o.value)?"":void 0,...a,ref:u,onClick:at(a.onClick,w=>{w.currentTarget.focus(),f.current!=="mouse"&&v(w)}),onPointerDown:at(a.onPointerDown,w=>{f.current=w.pointerType;const N=w.target;N.hasPointerCapture(w.pointerId)&&N.releasePointerCapture(w.pointerId),w.button===0&&w.ctrlKey===!1&&w.pointerType==="mouse"&&(v(w),w.preventDefault())}),onKeyDown:at(a.onKeyDown,w=>{const N=m.current!=="";!(w.ctrlKey||w.altKey||w.metaKey)&&w.key.length===1&&g(w.key),!(N&&w.key===" ")&&MB.includes(w.key)&&(v(),w.preventDefault())})})})});h4.displayName=u4;var f4="SelectValue",p4=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,children:i,placeholder:o="",...c}=t,u=Fi(f4,n),{onValueNodeHasChildrenChange:h}=u,f=i!==void 0,m=St(e,u.onValueNodeChange);return rr(()=>{h(f)},[h,f]),s.jsx(ut.span,{...c,ref:m,style:{pointerEvents:"none"},children:P4(u.value)?s.jsx(s.Fragment,{children:o}):i})});p4.displayName=f4;var DB="SelectIcon",m4=b.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...a}=t;return s.jsx(ut.span,{"aria-hidden":!0,...a,ref:e,children:r||"▼"})});m4.displayName=DB;var LB="SelectPortal",g4=t=>s.jsx(Qx,{asChild:!0,...t});g4.displayName=LB;var zo="SelectContent",x4=b.forwardRef((t,e)=>{const n=Fi(zo,t.__scopeSelect),[r,a]=b.useState();if(rr(()=>{a(new DocumentFragment)},[]),!n.open){const i=r;return i?jd.createPortal(s.jsx(y4,{scope:t.__scopeSelect,children:s.jsx(Kf.Slot,{scope:t.__scopeSelect,children:s.jsx("div",{children:t.children})})}),i):null}return s.jsx(b4,{...t,ref:e})});x4.displayName=zo;var ys=10,[y4,Bi]=tc(zo),_B="SelectContentImpl",zB=ld("SelectContent.RemoveScroll"),b4=b.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:o,side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:y,sticky:v,hideWhenDetached:w,avoidCollisions:N,...k}=t,C=Fi(zo,n),[E,A]=b.useState(null),[I,D]=b.useState(null),_=St(e,Q=>A(Q)),[P,L]=b.useState(null),[z,ee]=b.useState(null),U=qf(n),[he,me]=b.useState(!1),R=b.useRef(!1);b.useEffect(()=>{if(E)return Rj(E)},[E]),jj();const O=b.useCallback(Q=>{const[se,...ye]=U().map(He=>He.ref.current),[Me]=ye.slice(-1),Be=document.activeElement;for(const He of Q)if(He===Be||(He==null||He.scrollIntoView({block:"nearest"}),He===se&&I&&(I.scrollTop=0),He===Me&&I&&(I.scrollTop=I.scrollHeight),He==null||He.focus(),document.activeElement!==Be))return},[U,I]),X=b.useCallback(()=>O([P,E]),[O,P,E]);b.useEffect(()=>{he&&X()},[he,X]);const{onOpenChange:$,triggerPointerDownPosRef:ce}=C;b.useEffect(()=>{if(E){let Q={x:0,y:0};const se=Me=>{var Be,He;Q={x:Math.abs(Math.round(Me.pageX)-(((Be=ce.current)==null?void 0:Be.x)??0)),y:Math.abs(Math.round(Me.pageY)-(((He=ce.current)==null?void 0:He.y)??0))}},ye=Me=>{Q.x<=10&&Q.y<=10?Me.preventDefault():E.contains(Me.target)||$(!1),document.removeEventListener("pointermove",se),ce.current=null};return ce.current!==null&&(document.addEventListener("pointermove",se),document.addEventListener("pointerup",ye,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",se),document.removeEventListener("pointerup",ye,{capture:!0})}}},[E,$,ce]),b.useEffect(()=>{const Q=()=>$(!1);return window.addEventListener("blur",Q),window.addEventListener("resize",Q),()=>{window.removeEventListener("blur",Q),window.removeEventListener("resize",Q)}},[$]);const[Y,F]=O4(Q=>{const se=U().filter(Be=>!Be.disabled),ye=se.find(Be=>Be.ref.current===document.activeElement),Me=D4(se,Q,ye);Me&&setTimeout(()=>Me.ref.current.focus())}),W=b.useCallback((Q,se,ye)=>{const Me=!R.current&&!ye;(C.value!==void 0&&C.value===se||Me)&&(L(Q),Me&&(R.current=!0))},[C.value]),K=b.useCallback(()=>E==null?void 0:E.focus(),[E]),B=b.useCallback((Q,se,ye)=>{const Me=!R.current&&!ye;(C.value!==void 0&&C.value===se||Me)&&ee(Q)},[C.value]),oe=r==="popper"?Ox:v4,G=oe===Ox?{side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:y,sticky:v,hideWhenDetached:w,avoidCollisions:N}:{};return s.jsx(y4,{scope:n,content:E,viewport:I,onViewportChange:D,itemRefCallback:W,selectedItem:P,onItemLeave:K,itemTextRefCallback:B,focusSelectedItem:X,selectedItemText:z,position:r,isPositioned:he,searchRef:Y,children:s.jsx(Xx,{as:zB,allowPinchZoom:!0,children:s.jsx(Yx,{asChild:!0,trapped:C.open,onMountAutoFocus:Q=>{Q.preventDefault()},onUnmountAutoFocus:at(a,Q=>{var se;(se=C.trigger)==null||se.focus({preventScroll:!0}),Q.preventDefault()}),children:s.jsx(Jx,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:Q=>Q.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:s.jsx(oe,{role:"listbox",id:C.contentId,"data-state":C.open?"open":"closed",dir:C.dir,onContextMenu:Q=>Q.preventDefault(),...k,...G,onPlaced:()=>me(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:at(k.onKeyDown,Q=>{const se=Q.ctrlKey||Q.altKey||Q.metaKey;if(Q.key==="Tab"&&Q.preventDefault(),!se&&Q.key.length===1&&F(Q.key),["ArrowUp","ArrowDown","Home","End"].includes(Q.key)){let Me=U().filter(Be=>!Be.disabled).map(Be=>Be.ref.current);if(["ArrowUp","End"].includes(Q.key)&&(Me=Me.slice().reverse()),["ArrowUp","ArrowDown"].includes(Q.key)){const Be=Q.target,He=Me.indexOf(Be);Me=Me.slice(He+1)}setTimeout(()=>O(Me)),Q.preventDefault()}})})})})})})});b4.displayName=_B;var $B="SelectItemAlignedPosition",v4=b.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...a}=t,i=Fi(zo,n),o=Bi(zo,n),[c,u]=b.useState(null),[h,f]=b.useState(null),m=St(e,_=>f(_)),g=qf(n),y=b.useRef(!1),v=b.useRef(!0),{viewport:w,selectedItem:N,selectedItemText:k,focusSelectedItem:C}=o,E=b.useCallback(()=>{if(i.trigger&&i.valueNode&&c&&h&&w&&N&&k){const _=i.trigger.getBoundingClientRect(),P=h.getBoundingClientRect(),L=i.valueNode.getBoundingClientRect(),z=k.getBoundingClientRect();if(i.dir!=="rtl"){const Be=z.left-P.left,He=L.left-Be,gt=_.left-He,Dt=_.width+gt,jn=Math.max(Dt,P.width),it=window.innerWidth-ys,Mt=bh(He,[ys,Math.max(ys,it-jn)]);c.style.minWidth=Dt+"px",c.style.left=Mt+"px"}else{const Be=P.right-z.right,He=window.innerWidth-L.right-Be,gt=window.innerWidth-_.right-He,Dt=_.width+gt,jn=Math.max(Dt,P.width),it=window.innerWidth-ys,Mt=bh(He,[ys,Math.max(ys,it-jn)]);c.style.minWidth=Dt+"px",c.style.right=Mt+"px"}const ee=g(),U=window.innerHeight-ys*2,he=w.scrollHeight,me=window.getComputedStyle(h),R=parseInt(me.borderTopWidth,10),O=parseInt(me.paddingTop,10),X=parseInt(me.borderBottomWidth,10),$=parseInt(me.paddingBottom,10),ce=R+O+he+$+X,Y=Math.min(N.offsetHeight*5,ce),F=window.getComputedStyle(w),W=parseInt(F.paddingTop,10),K=parseInt(F.paddingBottom,10),B=_.top+_.height/2-ys,oe=U-B,G=N.offsetHeight/2,Q=N.offsetTop+G,se=R+O+Q,ye=ce-se;if(se<=B){const Be=ee.length>0&&N===ee[ee.length-1].ref.current;c.style.bottom="0px";const He=h.clientHeight-w.offsetTop-w.offsetHeight,gt=Math.max(oe,G+(Be?K:0)+He+X),Dt=se+gt;c.style.height=Dt+"px"}else{const Be=ee.length>0&&N===ee[0].ref.current;c.style.top="0px";const gt=Math.max(B,R+w.offsetTop+(Be?W:0)+G)+ye;c.style.height=gt+"px",w.scrollTop=se-B+w.offsetTop}c.style.margin=`${ys}px 0`,c.style.minHeight=Y+"px",c.style.maxHeight=U+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[g,i.trigger,i.valueNode,c,h,w,N,k,i.dir,r]);rr(()=>E(),[E]);const[A,I]=b.useState();rr(()=>{h&&I(window.getComputedStyle(h).zIndex)},[h]);const D=b.useCallback(_=>{_&&v.current===!0&&(E(),C==null||C(),v.current=!1)},[E,C]);return s.jsx(BB,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:y,onScrollButtonChange:D,children:s.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:A},children:s.jsx(ut.div,{...a,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});v4.displayName=$B;var FB="SelectPopperPosition",Ox=b.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=ys,...i}=t,o=Gf(n);return s.jsx(SB,{...o,...i,ref:e,align:r,collisionPadding:a,style:{boxSizing:"border-box",...i.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)"}})});Ox.displayName=FB;var[BB,iy]=tc(zo,{}),Dx="SelectViewport",N4=b.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...a}=t,i=Bi(Dx,n),o=iy(Dx,n),c=St(e,i.onViewportChange),u=b.useRef(0);return s.jsxs(s.Fragment,{children:[s.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),s.jsx(Kf.Slot,{scope:n,children:s.jsx(ut.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:at(a.onScroll,h=>{const f=h.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:g}=o;if(g!=null&&g.current&&m){const y=Math.abs(u.current-f.scrollTop);if(y>0){const v=window.innerHeight-ys*2,w=parseFloat(m.style.minHeight),N=parseFloat(m.style.height),k=Math.max(w,N);if(k0?A:0,m.style.justifyContent="flex-end")}}}u.current=f.scrollTop})})})]})});N4.displayName=Dx;var w4="SelectGroup",[VB,HB]=tc(w4),WB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=ji();return s.jsx(VB,{scope:n,id:a,children:s.jsx(ut.div,{role:"group","aria-labelledby":a,...r,ref:e})})});WB.displayName=w4;var j4="SelectLabel",UB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=HB(j4,n);return s.jsx(ut.div,{id:a.id,...r,ref:e})});UB.displayName=j4;var mf="SelectItem",[KB,k4]=tc(mf),S4=b.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:i,...o}=t,c=Fi(mf,n),u=Bi(mf,n),h=c.value===r,[f,m]=b.useState(i??""),[g,y]=b.useState(!1),v=St(e,C=>{var E;return(E=u.itemRefCallback)==null?void 0:E.call(u,C,r,a)}),w=ji(),N=b.useRef("touch"),k=()=>{a||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return s.jsx(KB,{scope:n,value:r,disabled:a,textId:w,isSelected:h,onItemTextChange:b.useCallback(C=>{m(E=>E||((C==null?void 0:C.textContent)??"").trim())},[]),children:s.jsx(Kf.ItemSlot,{scope:n,value:r,disabled:a,textValue:f,children:s.jsx(ut.div,{role:"option","aria-labelledby":w,"data-highlighted":g?"":void 0,"aria-selected":h&&g,"data-state":h?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...o,ref:v,onFocus:at(o.onFocus,()=>y(!0)),onBlur:at(o.onBlur,()=>y(!1)),onClick:at(o.onClick,()=>{N.current!=="mouse"&&k()}),onPointerUp:at(o.onPointerUp,()=>{N.current==="mouse"&&k()}),onPointerDown:at(o.onPointerDown,C=>{N.current=C.pointerType}),onPointerMove:at(o.onPointerMove,C=>{var E;N.current=C.pointerType,a?(E=u.onItemLeave)==null||E.call(u):N.current==="mouse"&&C.currentTarget.focus({preventScroll:!0})}),onPointerLeave:at(o.onPointerLeave,C=>{var E;C.currentTarget===document.activeElement&&((E=u.onItemLeave)==null||E.call(u))}),onKeyDown:at(o.onKeyDown,C=>{var A;((A=u.searchRef)==null?void 0:A.current)!==""&&C.key===" "||(AB.includes(C.key)&&k(),C.key===" "&&C.preventDefault())})})})})});S4.displayName=mf;var Uc="SelectItemText",C4=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,...i}=t,o=Fi(Uc,n),c=Bi(Uc,n),u=k4(Uc,n),h=OB(Uc,n),[f,m]=b.useState(null),g=St(e,k=>m(k),u.onItemTextChange,k=>{var C;return(C=c.itemTextRefCallback)==null?void 0:C.call(c,k,u.value,u.disabled)}),y=f==null?void 0:f.textContent,v=b.useMemo(()=>s.jsx("option",{value:u.value,disabled:u.disabled,children:y},u.value),[u.disabled,u.value,y]),{onNativeOptionAdd:w,onNativeOptionRemove:N}=h;return rr(()=>(w(v),()=>N(v)),[w,N,v]),s.jsxs(s.Fragment,{children:[s.jsx(ut.span,{id:u.textId,...i,ref:g}),u.isSelected&&o.valueNode&&!o.valueNodeHasChildren?jd.createPortal(i.children,o.valueNode):null]})});C4.displayName=Uc;var E4="SelectItemIndicator",T4=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return k4(E4,n).isSelected?s.jsx(ut.span,{"aria-hidden":!0,...r,ref:e}):null});T4.displayName=E4;var Lx="SelectScrollUpButton",M4=b.forwardRef((t,e)=>{const n=Bi(Lx,t.__scopeSelect),r=iy(Lx,t.__scopeSelect),[a,i]=b.useState(!1),o=St(e,r.onScrollButtonChange);return rr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=u.scrollTop>0;i(h)};const u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),a?s.jsx(I4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});M4.displayName=Lx;var _x="SelectScrollDownButton",A4=b.forwardRef((t,e)=>{const n=Bi(_x,t.__scopeSelect),r=iy(_x,t.__scopeSelect),[a,i]=b.useState(!1),o=St(e,r.onScrollButtonChange);return rr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=u.scrollHeight-u.clientHeight,f=Math.ceil(u.scrollTop)u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),a?s.jsx(I4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});A4.displayName=_x;var I4=b.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=t,i=Bi("SelectScrollButton",n),o=b.useRef(null),c=qf(n),u=b.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return b.useEffect(()=>()=>u(),[u]),rr(()=>{var f;const h=c().find(m=>m.ref.current===document.activeElement);(f=h==null?void 0:h.ref.current)==null||f.scrollIntoView({block:"nearest"})},[c]),s.jsx(ut.div,{"aria-hidden":!0,...a,ref:e,style:{flexShrink:0,...a.style},onPointerDown:at(a.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:at(a.onPointerMove,()=>{var h;(h=i.onItemLeave)==null||h.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:at(a.onPointerLeave,()=>{u()})})}),qB="SelectSeparator",GB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return s.jsx(ut.div,{"aria-hidden":!0,...r,ref:e})});GB.displayName=qB;var zx="SelectArrow",JB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=Gf(n),i=Fi(zx,n),o=Bi(zx,n);return i.open&&o.position==="popper"?s.jsx(CB,{...a,...r,ref:e}):null});JB.displayName=zx;var YB="SelectBubbleInput",R4=b.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const a=b.useRef(null),i=St(r,a),o=s0(e);return b.useEffect(()=>{const c=a.current;if(!c)return;const u=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(o!==e&&f){const m=new Event("change",{bubbles:!0});f.call(c,e),c.dispatchEvent(m)}},[o,e]),s.jsx(ut.select,{...n,style:{...c4,...n.style},ref:i,defaultValue:e})});R4.displayName=YB;function P4(t){return t===""||t===void 0}function O4(t){const e=Ti(t),n=b.useRef(""),r=b.useRef(0),a=b.useCallback(o=>{const c=n.current+o;e(c),(function u(h){n.current=h,window.clearTimeout(r.current),h!==""&&(r.current=window.setTimeout(()=>u(""),1e3))})(c)},[e]),i=b.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,i]}function D4(t,e,n){const a=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let o=QB(t,Math.max(i,0));a.length===1&&(o=o.filter(h=>h!==n));const u=o.find(h=>h.textValue.toLowerCase().startsWith(a.toLowerCase()));return u!==n?u:void 0}function QB(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var XB=d4,L4=h4,ZB=p4,eV=m4,tV=g4,_4=x4,nV=N4,z4=S4,rV=C4,sV=T4,aV=M4,iV=A4;const Sl=XB,Cl=ZB,fo=b.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(L4,{ref:r,className:Ct("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,s.jsx(eV,{asChild:!0,children:s.jsx(od,{className:"h-4 w-4 opacity-50"})})]}));fo.displayName=L4.displayName;const po=b.forwardRef(({className:t,children:e,position:n="popper",...r},a)=>s.jsx(tV,{children:s.jsxs(_4,{ref:a,className:Ct("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1",t),position:n,...r,children:[s.jsx(aV,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(qw,{className:"h-4 w-4"})}),s.jsx(nV,{className:"p-1",children:e}),s.jsx(iV,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(od,{className:"h-4 w-4"})})]})}));po.displayName=_4.displayName;const Dr=b.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(z4,{ref:r,className:Ct("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(sV,{children:s.jsx(yf,{className:"h-4 w-4"})})}),s.jsx(rV,{children:e})]}));Dr.displayName=z4.displayName;const oV=["一","二","三","四","五","六","七","八","九","十"];function kg(t){return t.startsWith("part:")?{type:"part",id:t.slice(5)}:t.startsWith("chapter:")?{type:"chapter",id:t.slice(8)}:t.startsWith("section:")?{type:"section",id:t.slice(8)}:null}function lV({parts:t,expandedParts:e,onTogglePart:n,onReorder:r,onReadSection:a,onDeleteSection:i,onAddSectionInPart:o,onAddChapterInPart:c,onDeleteChapter:u,onEditPart:h,onDeletePart:f,onEditChapter:m,selectedSectionIds:g=[],onToggleSectionSelect:y,onShowSectionOrders:v,pinnedSectionIds:w=[]}){const[N,k]=b.useState(null),[C,E]=b.useState(null),A=(z,ee)=>(N==null?void 0:N.type)===z&&(N==null?void 0:N.id)===ee,I=(z,ee)=>(C==null?void 0:C.type)===z&&(C==null?void 0:C.id)===ee,D=b.useCallback(()=>{const z=[];for(const ee of t)for(const U of ee.chapters)for(const he of U.sections)z.push({id:he.id,partId:ee.id,partTitle:ee.title,chapterId:U.id,chapterTitle:U.title});return z},[t]),_=b.useCallback(async(z,ee,U,he)=>{var $;z.preventDefault(),z.stopPropagation();const me=z.dataTransfer.getData("text/plain"),R=kg(me);if(!R||R.type===ee&&R.id===U)return;const O=D(),X=new Map(O.map(ce=>[ce.id,ce]));if(R.type==="part"&&ee==="part"){const ce=t.map(B=>B.id),Y=ce.indexOf(R.id),F=ce.indexOf(U);if(Y===-1||F===-1)return;const W=[...ce];W.splice(Y,1),W.splice(YG.id===B);if(oe)for(const G of oe.chapters)for(const Q of G.sections){const se=X.get(Q.id);se&&K.push(se)}}await r(K);return}if(R.type==="chapter"&&(ee==="chapter"||ee==="section"||ee==="part")){const ce=t.find(se=>se.chapters.some(ye=>ye.id===R.id)),Y=ce==null?void 0:ce.chapters.find(se=>se.id===R.id);if(!ce||!Y)return;let F,W,K=null;if(ee==="section"){const se=X.get(U);if(!se)return;F=se.partId,W=se.partTitle,K=U}else if(ee==="chapter"){const se=t.find(Be=>Be.chapters.some(He=>He.id===U)),ye=se==null?void 0:se.chapters.find(Be=>Be.id===U);if(!se||!ye)return;F=se.id,W=se.title;const Me=O.filter(Be=>Be.chapterId===U).pop();K=(Me==null?void 0:Me.id)??null}else{const se=t.find(Me=>Me.id===U);if(!se||!se.chapters[0])return;F=se.id,W=se.title;const ye=O.filter(Me=>Me.partId===se.id&&Me.chapterId===se.chapters[0].id);K=(($=ye[ye.length-1])==null?void 0:$.id)??null}const B=Y.sections.map(se=>se.id),oe=O.filter(se=>!B.includes(se.id));let G=oe.length;if(K){const se=oe.findIndex(ye=>ye.id===K);se>=0&&(G=se+1)}const Q=B.map(se=>({...X.get(se),partId:F,partTitle:W,chapterId:Y.id,chapterTitle:Y.title}));await r([...oe.slice(0,G),...Q,...oe.slice(G)]);return}if(R.type==="section"&&(ee==="section"||ee==="chapter"||ee==="part")){if(!he)return;const{partId:ce,partTitle:Y,chapterId:F,chapterTitle:W}=he;let K;if(ee==="section")K=O.findIndex(ye=>ye.id===U);else if(ee==="chapter"){const ye=O.filter(Me=>Me.chapterId===U).pop();K=ye?O.findIndex(Me=>Me.id===ye.id)+1:O.length}else{const ye=t.find(He=>He.id===U);if(!(ye!=null&&ye.chapters[0]))return;const Me=O.filter(He=>He.partId===ye.id&&He.chapterId===ye.chapters[0].id),Be=Me[Me.length-1];K=Be?O.findIndex(He=>He.id===Be.id)+1:0}const B=O.findIndex(ye=>ye.id===R.id);if(B===-1)return;const oe=O.filter(ye=>ye.id!==R.id),G=B({onDragEnter:he=>{he.preventDefault(),he.stopPropagation(),he.dataTransfer.dropEffect="move",E({type:z,id:ee})},onDragOver:he=>{he.preventDefault(),he.stopPropagation(),he.dataTransfer.dropEffect="move",E({type:z,id:ee})},onDragLeave:()=>E(null),onDrop:he=>{E(null);const me=kg(he.dataTransfer.getData("text/plain"));if(me&&!(z==="section"&&me.type==="section"&&me.id===ee))if(z==="part")if(me.type==="part")_(he,"part",ee);else{const R=t.find(X=>X.id===ee);(R==null?void 0:R.chapters[0])&&U&&_(he,"part",ee,U)}else z==="chapter"&&U?(me.type==="section"||me.type==="chapter")&&_(he,"chapter",ee,U):z==="section"&&U&&_(he,"section",ee,U)}}),L=z=>oV[z]??String(z+1);return s.jsx("div",{className:"space-y-3",children:t.map((z,ee)=>{var Y,F,W,K;const U=z.title==="序言"||z.title.includes("序言"),he=z.title==="尾声"||z.title.includes("尾声"),me=z.title==="附录"||z.title.includes("附录"),R=I("part",z.id),O=e.includes(z.id),X=z.chapters.length,$=z.chapters.reduce((B,oe)=>B+oe.sections.length,0);if(U&&z.chapters.length===1&&z.chapters[0].sections.length===1){const B=z.chapters[0].sections[0],oe=I("section",B.id),G={partId:z.id,partTitle:z.title,chapterId:z.chapters[0].id,chapterTitle:z.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:Q=>{Q.stopPropagation(),Q.dataTransfer.setData("text/plain","section:"+B.id),Q.dataTransfer.effectAllowed="move",k({type:"section",id:B.id})},onDragEnd:()=>{k(null),E(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${oe?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${A("section",B.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",B.id,G),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(fa,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:Q=>Q.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(B.id),onChange:()=>y(B.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:s.jsx($r,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[z.chapters[0].title," | ",B.title]}),w.includes(B.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(xi,{className:"w-3.5 h-3.5 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:Q=>Q.stopPropagation(),onClick:Q=>Q.stopPropagation(),children:[B.price===0||B.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",B.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",B.clickCount??0," · 付款 ",B.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(B.hotScore??0).toFixed(1)," · 第",B.hotRank&&B.hotRank>0?B.hotRank:"-","名"]}),v&&s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(B),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(B),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx($t,{className:"w-3.5 h-3.5"})}),s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(B),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(er,{className:"w-3.5 h-3.5"})})]})]})]},z.id)}if(z.title==="2026每日派对干货"||z.title.includes("2026每日派对干货")){const B=I("part",z.id);return s.jsxs("div",{className:`rounded-xl border overflow-hidden transition-all duration-200 ${B?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50 bg-[#1C1C1E]"}`,...P("part",z.id,{partId:z.id,partTitle:z.title,chapterId:((Y=z.chapters[0])==null?void 0:Y.id)??"",chapterTitle:((F=z.chapters[0])==null?void 0:F.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:oe=>{oe.stopPropagation(),oe.dataTransfer.setData("text/plain","part:"+z.id),oe.dataTransfer.effectAllowed="move",k({type:"part",id:z.id})},onDragEnd:()=>{k(null),E(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${A("part",z.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/50"}`,onClick:()=>n(z.id),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(fa,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),s.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac]/80 flex items-center justify-center text-white font-bold shrink-0",children:"派"}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:z.title}),s.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",$," 节"]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:oe=>oe.stopPropagation(),onClick:oe=>oe.stopPropagation(),children:[o&&s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(z),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx(pn,{className:"w-3.5 h-3.5"})}),h&&s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(z),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx($t,{className:"w-3.5 h-3.5"})}),f&&s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(z),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(er,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",children:[X,"章"]}),O?s.jsx(od,{className:"w-5 h-5 text-gray-500"}):s.jsx(El,{className:"w-5 h-5 text-gray-500"})]})]}),O&&z.chapters.length>0&&s.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:z.chapters.map(oe=>s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[s.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:oe.title}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:G=>G.stopPropagation(),children:[m&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>m(z,oe),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx($t,{className:"w-3.5 h-3.5"})}),c&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>c(z),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx(pn,{className:"w-3.5 h-3.5"})}),u&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>u(z,oe),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(er,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:oe.sections.map(G=>{const Q=I("section",G.id);return s.jsxs("div",{draggable:!0,onDragStart:se=>{se.stopPropagation(),se.dataTransfer.setData("text/plain","section:"+G.id),se.dataTransfer.effectAllowed="move",k({type:"section",id:G.id})},onDragEnd:()=>{k(null),E(null)},onClick:()=>a(G),className:`flex items-center justify-between py-2 px-3 rounded-lg min-h-[40px] cursor-pointer select-none transition-all duration-200 ${Q?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${A("section",G.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",G.id,{partId:z.id,partTitle:z.title,chapterId:oe.id,chapterTitle:oe.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(fa,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:se=>se.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(G.id),onChange:()=>y(G.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[G.id," ",G.title]}),w.includes(G.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(xi,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onClick:se=>se.stopPropagation(),children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",G.clickCount??0," · 付款 ",G.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(G.hotScore??0).toFixed(1)," · 第",G.hotRank&&G.hotRank>0?G.hotRank:"-","名"]}),v&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>v(G),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(G),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx($t,{className:"w-3.5 h-3.5"})}),s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(G),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(er,{className:"w-3.5 h-3.5"})})]})]},G.id)})})]},oe.id))})]},z.id)}if(me)return s.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"附录"}),s.jsx("div",{className:"space-y-3",children:z.chapters.map((B,oe)=>B.sections.length>0?B.sections.map(G=>{const Q=I("section",G.id);return s.jsxs("div",{draggable:!0,onDragStart:se=>{se.stopPropagation(),se.dataTransfer.setData("text/plain","section:"+G.id),se.dataTransfer.effectAllowed="move",k({type:"section",id:G.id})},onDragEnd:()=>{k(null),E(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 group cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${Q?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${A("section",G.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",G.id,{partId:z.id,partTitle:z.title,chapterId:B.id,chapterTitle:B.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(fa,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:se=>se.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(G.id),onChange:()=>y(G.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-300 truncate",children:["附录",oe+1," | ",B.title," | ",G.title]}),w.includes(G.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(xi,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",G.clickCount??0," · 付款 ",G.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(G.hotScore??0).toFixed(1)," · 第",G.hotRank&&G.hotRank>0?G.hotRank:"-","名"]}),v&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>v(G),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>a(G),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx($t,{className:"w-3.5 h-3.5"})}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>i(G),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(er,{className:"w-3.5 h-3.5"})})]})]}),s.jsx(El,{className:"w-4 h-4 text-gray-500 shrink-0"})]},G.id)}):s.jsxs("div",{className:"flex justify-between items-center py-2 select-none hover:bg-[#162840]/50 rounded px-2 -mx-2",children:[s.jsxs("span",{className:"text-sm text-gray-500",children:["附录",oe+1," | ",B.title,"(空)"]}),s.jsx(El,{className:"w-4 h-4 text-gray-500 shrink-0"})]},B.id))})]},z.id);if(he&&z.chapters.length===1&&z.chapters[0].sections.length===1){const B=z.chapters[0].sections[0],oe=I("section",B.id),G={partId:z.id,partTitle:z.title,chapterId:z.chapters[0].id,chapterTitle:z.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:Q=>{Q.stopPropagation(),Q.dataTransfer.setData("text/plain","section:"+B.id),Q.dataTransfer.effectAllowed="move",k({type:"section",id:B.id})},onDragEnd:()=>{k(null),E(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${oe?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${A("section",B.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",B.id,G),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(fa,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:Q=>Q.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(B.id),onChange:()=>y(B.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:s.jsx($r,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[z.chapters[0].title," | ",B.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:Q=>Q.stopPropagation(),onClick:Q=>Q.stopPropagation(),children:[B.price===0||B.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",B.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",B.clickCount??0," · 付款 ",B.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(B.hotScore??0).toFixed(1)," · 第",B.hotRank&&B.hotRank>0?B.hotRank:"-","名"]}),v&&s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(B),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(B),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx($t,{className:"w-3.5 h-3.5"})}),s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(B),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(er,{className:"w-3.5 h-3.5"})})]})]})]},z.id)}return he?s.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"尾声"}),s.jsx("div",{className:"space-y-3",children:z.chapters.map(B=>B.sections.map(oe=>{const G=I("section",oe.id);return s.jsxs("div",{draggable:!0,onDragStart:Q=>{Q.stopPropagation(),Q.dataTransfer.setData("text/plain","section:"+oe.id),Q.dataTransfer.effectAllowed="move",k({type:"section",id:oe.id})},onDragEnd:()=>{k(null),E(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${G?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${A("section",oe.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",oe.id,{partId:z.id,partTitle:z.title,chapterId:B.id,chapterTitle:B.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(fa,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:Q=>Q.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(oe.id),onChange:()=>y(oe.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-300",children:[B.title," | ",oe.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",oe.clickCount??0," · 付款 ",oe.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(oe.hotScore??0).toFixed(1)," · 第",oe.hotRank&&oe.hotRank>0?oe.hotRank:"-","名"]}),v&&s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(oe),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(oe),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx($t,{className:"w-3.5 h-3.5"})}),s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(oe),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(er,{className:"w-3.5 h-3.5"})})]})]})]},oe.id)}))})]},z.id):s.jsxs("div",{className:`rounded-xl border bg-[#1C1C1E] overflow-hidden transition-all duration-200 ${R?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50"}`,...P("part",z.id,{partId:z.id,partTitle:z.title,chapterId:((W=z.chapters[0])==null?void 0:W.id)??"",chapterTitle:((K=z.chapters[0])==null?void 0:K.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:B=>{B.stopPropagation(),B.dataTransfer.setData("text/plain","part:"+z.id),B.dataTransfer.effectAllowed="move",k({type:"part",id:z.id})},onDragEnd:()=>{k(null),E(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${A("part",z.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] rounded-xl shadow-xl shadow-[#38bdac]/20":"hover:bg-[#162840]/50"}`,onClick:()=>n(z.id),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(fa,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),s.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac] flex items-center justify-center text-white font-bold shadow-lg shadow-[#38bdac]/30 shrink-0",children:L(ee)}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:z.title}),s.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",$," 节"]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:B=>B.stopPropagation(),onClick:B=>B.stopPropagation(),children:[o&&s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(z),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx(pn,{className:"w-3.5 h-3.5"})}),h&&s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(z),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx($t,{className:"w-3.5 h-3.5"})}),f&&s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(z),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(er,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",children:[X,"章"]}),O?s.jsx(od,{className:"w-5 h-5 text-gray-500"}):s.jsx(El,{className:"w-5 h-5 text-gray-500"})]})]}),O&&s.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:z.chapters.map(B=>{const oe=I("chapter",B.id);return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[s.jsxs("div",{draggable:!0,onDragStart:G=>{G.stopPropagation(),G.dataTransfer.setData("text/plain","chapter:"+B.id),G.dataTransfer.effectAllowed="move",k({type:"chapter",id:B.id})},onDragEnd:()=>{k(null),E(null)},onDragEnter:G=>{G.preventDefault(),G.stopPropagation(),G.dataTransfer.dropEffect="move",E({type:"chapter",id:B.id})},onDragOver:G=>{G.preventDefault(),G.stopPropagation(),G.dataTransfer.dropEffect="move",E({type:"chapter",id:B.id})},onDragLeave:()=>E(null),onDrop:G=>{E(null);const Q=kg(G.dataTransfer.getData("text/plain"));if(!Q)return;const se={partId:z.id,partTitle:z.title,chapterId:B.id,chapterTitle:B.title};(Q.type==="section"||Q.type==="chapter")&&_(G,"chapter",B.id,se)},className:`flex-1 min-w-0 py-2 px-2 rounded cursor-grab active:cursor-grabbing select-none -mx-2 transition-all duration-200 flex items-center gap-2 ${oe?"bg-[#38bdac]/15 ring-1 ring-[#38bdac]/50":""} ${A("chapter",B.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/30"}`,children:[s.jsx(fa,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),s.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:B.title})]}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:G=>G.stopPropagation(),children:[m&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>m(z,B),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx($t,{className:"w-3.5 h-3.5"})}),c&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>c(z),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx(pn,{className:"w-3.5 h-3.5"})}),u&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>u(z,B),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(er,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:B.sections.map(G=>{const Q=I("section",G.id);return s.jsxs("div",{draggable:!0,onDragStart:se=>{se.stopPropagation(),se.dataTransfer.setData("text/plain","section:"+G.id),se.dataTransfer.effectAllowed="move",k({type:"section",id:G.id})},onDragEnd:()=>{k(null),E(null)},className:`flex items-center justify-between py-2 px-3 rounded-lg group cursor-grab active:cursor-grabbing select-none min-h-[40px] transition-all duration-200 ${Q?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${A("section",G.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] shadow-lg":"hover:bg-[#162840]/50"}`,...P("section",G.id,{partId:z.id,partTitle:z.title,chapterId:B.id,chapterTitle:B.title}),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:se=>se.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(G.id),onChange:()=>y(G.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx(fa,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),s.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${G.price===0||G.isFree?"border-2 border-[#38bdac] bg-transparent":"bg-gray-500"}`}),s.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[G.id," ",G.title]}),w.includes(G.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(xi,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:se=>se.stopPropagation(),onClick:se=>se.stopPropagation(),children:[G.isNew&&s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"NEW"}),G.price===0||G.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",G.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",title:"点击次数 · 付款笔数",children:["点击 ",G.clickCount??0," · 付款 ",G.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(G.hotScore??0).toFixed(1)," · 第",G.hotRank&&G.hotRank>0?G.hotRank:"-","名"]}),v&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>v(G),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5 shrink-0",children:"付款记录"}),s.jsxs("div",{className:"flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(G),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx($t,{className:"w-3.5 h-3.5"})}),s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(G),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(er,{className:"w-3.5 h-3.5"})})]})]})]},G.id)})})]},B.id)})})]},z.id)})})}function cV(t){var a;const e=new URLSearchParams;e.set("page",String(t.page)),e.set("limit",String(t.limit)),(a=t==null?void 0:t.keyword)!=null&&a.trim()&&e.set("keyword",t.keyword.trim());const n=e.toString(),r=n?`/api/admin/ckb/devices?${n}`:"/api/admin/ckb/devices";return De(r)}function dV(t){return De(`/api/db/person?personId=${encodeURIComponent(t)}`)}const $4=11,bw={personId:"",name:"",aliases:"",label:"",sceneId:$4,ckbApiKey:"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:"phone",remarkFormat:"",addFriendInterval:1,startTime:"09:00",endTime:"18:00",deviceGroups:""};function uV({open:t,onOpenChange:e,editingPerson:n,onSubmit:r}){const a=!!n,[i,o]=b.useState(bw),[c,u]=b.useState(!1),[h,f]=b.useState(!1),[m,g]=b.useState([]),[y,v]=b.useState(!1),[w,N]=b.useState(""),[k,C]=b.useState({});b.useEffect(()=>{t&&(N(""),o(n?{personId:n.personId??n.name??"",name:n.name??"",aliases:n.aliases??"",label:n.label??"",sceneId:$4,ckbApiKey:n.ckbApiKey??"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:n.remarkType??"phone",remarkFormat:n.remarkFormat??"",addFriendInterval:n.addFriendInterval??1,startTime:n.startTime??"09:00",endTime:n.endTime??"18:00",deviceGroups:n.deviceGroups??""}:{...bw}),C({}),m.length===0&&E(""))},[t,n]);const E=async I=>{v(!0);try{const D=await cV({page:1,limit:50,keyword:I});D!=null&&D.success&&Array.isArray(D.devices)?g(D.devices):D!=null&&D.error&&le.error(D.error)}catch(D){le.error(D instanceof Error?D.message:"加载设备列表失败")}finally{v(!1)}},A=async()=>{var P;const I={};(!i.name||!String(i.name).trim())&&(I.name="请填写名称");const D=i.addFriendInterval;if((typeof D!="number"||D<1)&&(I.addFriendInterval="添加间隔至少为 1 分钟"),(((P=i.deviceGroups)==null?void 0:P.split(",").map(L=>L.trim()).filter(Boolean))??[]).length===0&&(I.deviceGroups="请至少选择 1 台设备"),C(I),Object.keys(I).length>0){le.error(I.name||I.addFriendInterval||I.deviceGroups||"请完善必填项");return}u(!0);try{await r(i),e(!1)}catch(L){le.error(L instanceof Error?L.message:"保存失败")}finally{u(!1)}};return s.jsx(Ft,{open:t,onOpenChange:e,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-y-auto",children:[s.jsxs(Bt,{children:[s.jsx(Vt,{className:"text-[#38bdac]",children:a?"编辑人物":"添加人物 — 存客宝 API 获客"}),s.jsx(Jj,{className:"text-gray-400 text-sm",children:a?"修改后同步到存客宝计划":"添加时自动生成 token,并同步创建存客宝场景获客计划"})]}),s.jsxs("div",{className:"space-y-6 py-2",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium text-gray-400 uppercase tracking-wider mb-3",children:"基础信息"}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(te,{className:"text-gray-400 text-xs",children:["名称 ",s.jsx("span",{className:"text-red-400",children:"*"})]}),s.jsx(ie,{className:`bg-[#0a1628] text-white ${k.name?"border-red-500 focus-visible:ring-red-500":"border-gray-700"}`,placeholder:"如 卡若",value:i.name,onChange:I=>{o(D=>({...D,name:I.target.value})),k.name&&C(D=>({...D,name:void 0}))}}),k.name&&s.jsx("p",{className:"text-xs text-red-400",children:k.name})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"人物ID(可选)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"自动生成",value:i.personId,onChange:I=>o(D=>({...D,personId:I.target.value})),disabled:a})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"标签(身份/角色)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 超级个体",value:i.label,onChange:I=>o(D=>({...D,label:I.target.value}))})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"别名(逗号分隔,@ 可匹配)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 卡卡, 若若",value:i.aliases,onChange:I=>o(D=>({...D,aliases:I.target.value}))})]})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-5",children:[s.jsx("p",{className:"text-xs font-medium text-gray-400 uppercase tracking-wider mb-4",children:"存客宝 API 获客配置"}),s.jsxs("div",{className:"grid grid-cols-2 gap-x-8 gap-y-4",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"存客宝密钥(计划 apiKey)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"创建计划成功后自动回填,不可手动修改",value:i.ckbApiKey,readOnly:!0}),s.jsx("p",{className:"text-xs text-gray-500",children:"由存客宝计划详情接口返回的 apiKey,用于小程序 @人物 时推送到对应获客计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(te,{className:"text-gray-400 text-xs",children:["选择设备 ",s.jsx("span",{className:"text-red-400",children:"*"})]}),s.jsxs("div",{className:`flex gap-2 rounded-md border ${k.deviceGroups?"border-red-500":"border-gray-700"}`,children:[s.jsx(ie,{className:"bg-[#0a1628] border-0 text-white focus-visible:ring-0 focus-visible:ring-offset-0",placeholder:"未选择设备",readOnly:!0,value:i.deviceGroups?`已选择 ${i.deviceGroups.split(",").filter(Boolean).length} 个设备`:"",onClick:()=>f(!0)}),s.jsx(ne,{type:"button",variant:"outline",className:"border-0 border-l border-inherit rounded-r-md text-gray-200",onClick:()=>f(!0),children:"选择"})]}),k.deviceGroups?s.jsx("p",{className:"text-xs text-red-400",children:k.deviceGroups}):s.jsx("p",{className:"text-xs text-gray-500",children:"从存客宝设备列表中选择,至少选择 1 台设备参与获客计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"好友备注"}),s.jsxs(Sl,{value:i.remarkType,onValueChange:I=>o(D=>({...D,remarkType:I})),children:[s.jsx(fo,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(Cl,{placeholder:"选择备注类型"})}),s.jsxs(po,{children:[s.jsx(Dr,{value:"phone",children:"手机号"}),s.jsx(Dr,{value:"nickname",children:"昵称"}),s.jsx(Dr,{value:"source",children:"来源"})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"备注格式"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 手机号+SOUL链接人与事-{名称},留空用默认",value:i.remarkFormat,onChange:I=>o(D=>({...D,remarkFormat:I.target.value}))})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"打招呼语"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"你好,请通过",value:i.greeting,onChange:I=>o(D=>({...D,greeting:I.target.value}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"添加间隔(分钟)"}),s.jsx(ie,{type:"number",min:1,className:`bg-[#0a1628] text-white ${k.addFriendInterval?"border-red-500 focus-visible:ring-red-500":"border-gray-700"}`,value:i.addFriendInterval,onChange:I=>{o(D=>({...D,addFriendInterval:Number(I.target.value)||1})),k.addFriendInterval&&C(D=>({...D,addFriendInterval:void 0}))}}),k.addFriendInterval&&s.jsx("p",{className:"text-xs text-red-400",children:k.addFriendInterval})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"允许加人时间段"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ie,{type:"time",className:"bg-[#0a1628] border-gray-700 text-white w-24",value:i.startTime,onChange:I=>o(D=>({...D,startTime:I.target.value}))}),s.jsx("span",{className:"text-gray-500 text-sm shrink-0",children:"至"}),s.jsx(ie,{type:"time",className:"bg-[#0a1628] border-gray-700 text-white w-24",value:i.endTime,onChange:I=>o(D=>({...D,endTime:I.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"获客成功提示"}),s.jsx(Yl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[72px] resize-none",placeholder:"请注意消息,稍后加你微信",value:i.tips,onChange:I=>o(D=>({...D,tips:I.target.value}))})]})]})]})]})]}),s.jsxs(ln,{className:"gap-3 pt-2",children:[s.jsx(ne,{variant:"outline",onClick:()=>e(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(ne,{onClick:A,disabled:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:c?"保存中...":a?"保存":"添加"})]}),h&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",children:s.jsxs("div",{className:"w-full max-w-3xl max-h-[80vh] bg-[#0b1828] border border-gray-700 rounded-xl shadow-xl flex flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-gray-700/60",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-medium text-white",children:"选择设备"}),s.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"勾选需要参与本计划的设备,可多选"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ie,{className:"bg-[#050c18] border-gray-700 text-white h-8 w-52",placeholder:"搜索备注/微信号/IMEI",value:w,onChange:I=>N(I.target.value),onKeyDown:I=>{I.key==="Enter"&&E(w)}}),s.jsx(ne,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-200 h-8",onClick:()=>E(w),disabled:y,children:"刷新"}),s.jsx(ne,{type:"button",size:"icon",variant:"outline",className:"border-gray-600 text-gray-300 h-8 w-8",onClick:()=>f(!1),children:"✕"})]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:y?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-400 text-sm",children:"正在加载设备列表…"}):m.length===0?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-500 text-sm",children:"暂无设备数据,请检查存客宝账号与开放 API 配置"}):s.jsx("div",{className:"p-4 space-y-2",children:m.map(I=>{const D=String(I.id??""),_=i.deviceGroups?i.deviceGroups.split(",").map(z=>z.trim()).filter(Boolean):[],P=_.includes(D),L=()=>{let z;P?z=_.filter(ee=>ee!==D):z=[..._,D],o(ee=>({...ee,deviceGroups:z.join(",")})),z.length>0&&C(ee=>({...ee,deviceGroups:void 0}))};return s.jsxs("label",{className:"flex items-center gap-3 rounded-lg border border-gray-700/60 bg-[#050c18] px-3 py-2 cursor-pointer hover:border-[#38bdac]/70",children:[s.jsx("input",{type:"checkbox",className:"h-4 w-4 accent-[#38bdac]",checked:P,onChange:L}),s.jsxs("div",{className:"flex flex-col min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-white truncate max-w-xs",children:I.memo||I.wechatId||`设备 ${D}`}),I.status==="online"&&s.jsx("span",{className:"rounded-full bg-emerald-500/20 text-emerald-400 text-[11px] px-2 py-0.5",children:"在线"}),I.status==="offline"&&s.jsx("span",{className:"rounded-full bg-gray-600/20 text-gray-400 text-[11px] px-2 py-0.5",children:"离线"})]}),s.jsxs("div",{className:"text-[11px] text-gray-400 mt-0.5",children:[s.jsxs("span",{className:"mr-3",children:["ID: ",D]}),I.wechatId&&s.jsxs("span",{className:"mr-3",children:["微信号: ",I.wechatId]}),typeof I.totalFriend=="number"&&s.jsxs("span",{children:["好友数: ",I.totalFriend]})]})]})]},D)})})}),s.jsxs("div",{className:"flex justify-between items-center px-5 py-3 border-t border-gray-700/60",children:[s.jsxs("span",{className:"text-xs text-gray-400",children:["已选择"," ",i.deviceGroups?i.deviceGroups.split(",").filter(Boolean).length:0," ","台设备"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ne,{type:"button",variant:"outline",className:"border-gray-600 text-gray-200 h-8 px-4",onClick:()=>f(!1),children:"取消"}),s.jsx(ne,{type:"button",className:"bg-[#38bdac] hover:bg-[#2da396] text-white h-8 px-4",onClick:()=>f(!1),children:"确定"})]})]})]})})]})})}function vw(t,e,n){if(!t||!t.includes("@")&&!t.includes("@")&&!t.includes("#")||typeof document>"u")return t;const r=document.createElement("div");r.innerHTML=t;const a=h=>h.trim().toLowerCase(),i=new Map;for(const h of e){const f=[h.name,...h.aliases?h.aliases.split(","):[]].map(m=>a(m)).filter(Boolean);for(const m of f)i.has(m)||i.set(m,h)}const o=new Map;for(const h of n){const f=[h.label,...h.aliases?h.aliases.split(","):[]].map(m=>a(m)).filter(Boolean);for(const m of f)o.has(m)||o.set(m,h)}const c=h=>{const f=h.textContent||"";if(!f||!f.includes("@")&&!f.includes("@")&&!f.includes("#"))return;const m=h.parentNode;if(!m)return;const g=document.createDocumentFragment(),y=/([@@][^\s@#@#]+|#[^\s@#@#]+)/g;let v=0,w;for(;w=y.exec(f);){const[N]=w,k=w.index;if(k>v&&g.appendChild(document.createTextNode(f.slice(v,k))),N.startsWith("@")||N.startsWith("@")){const C=i.get(a(N.slice(1)));if(C){const E=document.createElement("span");E.setAttribute("data-type","mention"),E.setAttribute("data-id",C.id),E.setAttribute("data-label",C.name),E.className="mention-tag",E.textContent=`@${C.name}`,g.appendChild(E)}else g.appendChild(document.createTextNode(N))}else if(N.startsWith("#")){const C=o.get(a(N.slice(1)));if(C){const E=document.createElement("span");E.setAttribute("data-type","linkTag"),E.setAttribute("data-url",C.url||""),E.setAttribute("data-tag-type",C.type||"url"),E.setAttribute("data-tag-id",C.id||""),E.setAttribute("data-page-path",C.pagePath||""),E.setAttribute("data-app-id",C.appId||""),C.type==="miniprogram"&&C.appId&&E.setAttribute("data-mp-key",C.appId),E.className="link-tag-node",E.textContent=`#${C.label}`,g.appendChild(E)}else g.appendChild(document.createTextNode(N))}else g.appendChild(document.createTextNode(N));v=k+N.length}v{if(h.nodeType===Node.ELEMENT_NODE){const m=h.getAttribute("data-type");if(m==="mention"||m==="linkTag")return;h.childNodes.forEach(g=>u(g));return}h.nodeType===Node.TEXT_NODE&&c(h)};return r.childNodes.forEach(h=>u(h)),r.innerHTML}function hV(t){const e=new Map;for(const c of t){const u=c.partId||"part-1",h=c.partTitle||"未分类",f=c.chapterId||"chapter-1",m=c.chapterTitle||"未分类";e.has(u)||e.set(u,{id:u,title:h,chapters:new Map});const g=e.get(u);g.chapters.has(f)||g.chapters.set(f,{id:f,title:m,sections:[]}),g.chapters.get(f).sections.push({id:c.id,title:c.title,price:c.price??1,filePath:c.filePath,isFree:c.isFree,isNew:c.isNew,clickCount:c.clickCount??0,payCount:c.payCount??0,hotScore:c.hotScore??0,hotRank:c.hotRank??0})}const n="part-2026-daily",r="2026每日派对干货";Array.from(e.values()).some(c=>c.title===r||c.title.includes(r))||e.set(n,{id:n,title:r,chapters:new Map([["chapter-2026-daily",{id:"chapter-2026-daily",title:r,sections:[]}]])});const i=Array.from(e.values()).map(c=>({...c,chapters:Array.from(c.chapters.values())})),o=c=>c.includes("序言")?0:c.includes(r)?1.5:c.includes("附录")?2:c.includes("尾声")?3:1;return i.sort((c,u)=>{const h=o(c.title),f=o(u.title);return h!==f?h-f:0})}function fV(){var cs,ds,us;const[t,e]=b.useState([]),[n,r]=b.useState(!0),[a,i]=b.useState([]),[o,c]=b.useState(null),[u,h]=b.useState(!1),[f,m]=b.useState(!1),[g,y]=b.useState(!1),[v,w]=b.useState(""),[N,k]=b.useState([]),[C,E]=b.useState(!1),[A,I]=b.useState({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),[D,_]=b.useState(null),[P,L]=b.useState(!1),[z,ee]=b.useState(!1),[U,he]=b.useState(null),[me,R]=b.useState(!1),[O,X]=b.useState([]),[$,ce]=b.useState(!1),[Y,F]=b.useState(""),[W,K]=b.useState(""),[B,oe]=b.useState(!1),[G,Q]=b.useState(""),[se,ye]=b.useState(!1),[Me,Be]=b.useState(null),[He,gt]=b.useState(!1),[Dt,jn]=b.useState(!1),[it,Mt]=b.useState({readWeight:50,recencyWeight:30,payWeight:20}),[re,Pe]=b.useState(!1),[et,xt]=b.useState(!1),[ft,pt]=b.useState(1),[wt,Qt]=b.useState([]),[Lt,An]=b.useState(!1),[At,Kn]=b.useState([]),[ns,or]=b.useState(!1),[ge,Ne]=b.useState(20),[qn,Es]=b.useState(!1),[Ts,Pa]=b.useState(!1),[br,Vi]=b.useState([]),[vr,lr]=b.useState([]),[Ms,Oa]=b.useState(!1),[Hi,Xs]=b.useState(null),[vt,Gn]=b.useState({tagId:"",label:"",aliases:"",url:"",type:"url",appId:"",pagePath:""}),[Da,As]=b.useState(null),Nr=b.useRef(null),[Wi,Zs]=b.useState({}),[nc,Jn]=b.useState(!1),[ea,rs]=b.useState(""),[Ar,La]=b.useState(""),[ta,Ui]=b.useState([]),[cr,Ki]=b.useState(0),[ss,rc]=b.useState(1),[Vo,qi]=b.useState(!1),un=hV(t),as=t.length,Is=10,_a=Math.max(1,Math.ceil(wt.length/Is)),It=wt.slice((ft-1)*Is,ft*Is),zn=async()=>{r(!0);try{const T=await De("/api/db/book?action=list",{cache:"no-store"});e(Array.isArray(T==null?void 0:T.sections)?T.sections:[])}catch(T){console.error(T),e([])}finally{r(!1)}},Vr=async()=>{An(!0);try{const T=await De("/api/db/book?action=ranking",{cache:"no-store"}),q=Array.isArray(T==null?void 0:T.sections)?T.sections:[];Qt(q);const ue=q.filter(fe=>fe.isPinned).map(fe=>fe.id);Kn(ue)}catch(T){console.error(T),Qt([])}finally{An(!1)}};b.useEffect(()=>{zn(),Vr()},[]);const Ho=T=>{i(q=>q.includes(T)?q.filter(ue=>ue!==T):[...q,T])},za=b.useCallback(T=>{const q=t,ue=T.flatMap(fe=>{const nt=q.find(yt=>yt.id===fe.id);return nt?[{...nt,partId:fe.partId,partTitle:fe.partTitle,chapterId:fe.chapterId,chapterTitle:fe.chapterTitle}]:[]});return e(ue),Tt("/api/db/book",{action:"reorder",items:T}).then(fe=>{fe&&fe.success===!1&&(e(q),le.error("排序失败: "+(fe&&typeof fe=="object"&&"error"in fe?fe.error:"未知错误")))}).catch(fe=>{e(q),console.error("排序失败:",fe),le.error("排序失败: "+(fe instanceof Error?fe.message:"网络或服务异常"))}),Promise.resolve()},[t]),sc=async T=>{if(confirm(`确定要删除章节「${T.title}」吗?此操作不可恢复。`))try{const q=await wa(`/api/db/book?id=${encodeURIComponent(T.id)}`);q&&q.success!==!1?(le.success("已删除"),zn(),Vr()):le.error("删除失败: "+(q&&typeof q=="object"&&"error"in q?q.error:"未知错误"))}catch(q){console.error(q),le.error("删除失败")}},Gi=b.useCallback(async()=>{Pe(!0);try{const T=await De("/api/db/config/full?key=article_ranking_weights",{cache:"no-store"}),q=T&&T.data;q&&typeof q.readWeight=="number"&&typeof q.recencyWeight=="number"&&typeof q.payWeight=="number"&&Mt({readWeight:Math.round(q.readWeight*100),recencyWeight:Math.round(q.recencyWeight*100),payWeight:Math.round(q.payWeight*100)})}catch{}finally{Pe(!1)}},[]);b.useEffect(()=>{Dt&&Gi()},[Dt,Gi]);const $a=async()=>{const{readWeight:T,recencyWeight:q,payWeight:ue}=it,fe=T+q+ue;if(Math.abs(fe-100)>1){le.error("三个权重之和必须等于 100%");return}xt(!0);try{const nt=await Nt("/api/db/config",{key:"article_ranking_weights",value:{readWeight:T/100,recencyWeight:q/100,payWeight:ue/100},description:"文章排名算法权重"});nt&&nt.success!==!1?(le.success("排名权重已保存,排行榜已刷新"),zn(),Vr()):le.error("保存失败: "+(nt&&typeof nt=="object"&&"error"in nt?nt.error:""))}catch(nt){console.error(nt),le.error("保存失败")}finally{xt(!1)}},dr=b.useCallback(async()=>{or(!0);try{const T=await De("/api/db/config/full?key=pinned_section_ids",{cache:"no-store"}),q=T&&T.data;Array.isArray(q)&&Kn(q)}catch{}finally{or(!1)}},[]),is=b.useCallback(async()=>{try{const T=await De("/api/db/persons");T!=null&&T.success&&T.persons&&Vi(T.persons.map(q=>{const ue=q.deviceGroups,fe=Array.isArray(ue)?ue.join(","):ue??"";return{id:q.token??q.personId??"",personId:q.personId,name:q.name,aliases:q.aliases??"",label:q.label??"",ckbApiKey:q.ckbApiKey??"",ckbPlanId:q.ckbPlanId,remarkType:q.remarkType,remarkFormat:q.remarkFormat,addFriendInterval:q.addFriendInterval,startTime:q.startTime,endTime:q.endTime,deviceGroups:fe}}))}catch{}},[]),$n=b.useCallback(async T=>{const q=T==null?void 0:T.trim();if(!q)return null;try{const ue=await Nt("/api/db/persons",{name:q});if(!(ue!=null&&ue.success)||!ue.person)return null;const fe=ue.person;return is(),{id:fe.token??fe.personId??"",personId:fe.personId,name:fe.name??q,label:fe.label??""}}catch{return le.error("创建人物失败"),null}},[is]),Wo=b.useCallback(async()=>{try{const T=await De("/api/db/ckb-person-leads");if(T!=null&&T.success&&T.byPerson){const q={};for(const ue of T.byPerson)q[ue.token]=ue.total;Zs(q)}}catch{}},[]),Fa=b.useCallback(async(T,q,ue=1)=>{rs(T),La(q),Jn(!0),rc(ue),qi(!0);try{const fe=await De(`/api/db/ckb-person-leads?token=${encodeURIComponent(T)}&page=${ue}&pageSize=20`);fe!=null&&fe.success&&(Ui(fe.records||[]),Ki(fe.total||0),fe.personName&&La(fe.personName))}catch{}finally{qi(!1)}},[]),na=b.useCallback(async()=>{try{const T=await De("/api/db/link-tags");T!=null&&T.success&&T.linkTags&&lr(T.linkTags.map(q=>({id:q.tagId,label:q.label,aliases:q.aliases??"",url:q.url,type:q.type||"url",appId:q.appId||"",pagePath:q.pagePath||""})))}catch{}},[]),Rs=async T=>{const q=At.includes(T)?At.filter(ue=>ue!==T):[...At,T];Kn(q);try{await Nt("/api/db/config",{key:"pinned_section_ids",value:q,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"}),Vr()}catch{Kn(At)}},Ps=b.useCallback(async()=>{Es(!0);try{const T=await De("/api/db/config/full?key=unpaid_preview_percent",{cache:"no-store"}),q=T&&T.data;typeof q=="number"&&q>0&&q<=100&&Ne(q)}catch{}finally{Es(!1)}},[]),Os=async()=>{if(ge<1||ge>100){le.error("预览比例需在 1~100 之间");return}Pa(!0);try{const T=await Nt("/api/db/config",{key:"unpaid_preview_percent",value:ge,description:"小程序未付费内容默认预览比例(%)"});T&&T.success!==!1?le.success("预览比例已保存"):le.error("保存失败: "+(T.error||""))}catch{le.error("保存失败")}finally{Pa(!1)}};b.useEffect(()=>{dr(),Ps(),is(),na(),Wo()},[dr,Ps,is,na,Wo]);const Ds=async T=>{Be({section:T,orders:[]}),gt(!0);try{const q=await De(`/api/db/book?action=section-orders&id=${encodeURIComponent(T.id)}`),ue=q!=null&&q.success&&Array.isArray(q.orders)?q.orders:[];Be(fe=>fe?{...fe,orders:ue}:null)}catch(q){console.error(q),Be(ue=>ue?{...ue,orders:[]}:null)}finally{gt(!1)}},V=async T=>{m(!0);try{const q=await De(`/api/db/book?action=read&id=${encodeURIComponent(T.id)}`);if(q!=null&&q.success&&q.section){const ue=q.section,fe=ue.editionPremium===!0;c({id:T.id,originalId:T.id,title:q.section.title??T.title,price:q.section.price??T.price,content:q.section.content??"",filePath:T.filePath,isFree:T.isFree||T.price===0,isNew:ue.isNew??T.isNew,isPinned:At.includes(T.id),hotScore:T.hotScore??0,editionStandard:fe?!1:ue.editionStandard??!0,editionPremium:fe,previewPercent:ue.previewPercent??null})}else c({id:T.id,originalId:T.id,title:T.title,price:T.price,content:"",filePath:T.filePath,isFree:T.isFree,isNew:T.isNew,isPinned:At.includes(T.id),hotScore:T.hotScore??0,editionStandard:!0,editionPremium:!1,previewPercent:null}),q&&!q.success&&le.error("无法读取文件内容: "+(q.error||"未知错误"))}catch(q){console.error(q),c({id:T.id,title:T.title,price:T.price,content:"",filePath:T.filePath,isFree:T.isFree})}finally{m(!1)}},Ae=async()=>{var T;if(o){y(!0);try{let q=o.content||"";q=vw(q,br,vr);const ue=[new RegExp(`^#+\\s*${o.id.replace(".","\\.")}\\s+.*$`,"gm"),new RegExp(`^#+\\s*${o.id.replace(".","\\.")}[::].*$`,"gm"),new RegExp(`^#\\s+.*${(T=o.title)==null?void 0:T.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const Ls of ue)q=q.replace(Ls,"");q=q.replace(/^\s*\n+/,"").trim();const fe=o.originalId||o.id,nt=o.id!==fe,yt=o.previewPercent,In=yt!=null&&yt!==0&&Number(yt)>=1&&Number(yt)<=100,hn=await Tt("/api/db/book",{id:fe,...nt?{newId:o.id}:{},title:o.title,price:o.isFree?0:o.price,content:q,isFree:o.isFree||o.price===0,isNew:o.isNew,hotScore:o.hotScore,editionStandard:o.editionPremium?!1:o.editionStandard??!0,editionPremium:o.editionPremium??!1,...In?{previewPercent:Number(yt)}:{clearPreviewPercent:!0},saveToFile:!0}),sa=nt?o.id:fe;o.isPinned!==At.includes(sa)&&await Rs(sa),hn&&hn.success!==!1?(le.success(`已保存:${o.title}`),c(null),zn()):le.error("保存失败: "+(hn&&typeof hn=="object"&&"error"in hn?hn.error:"未知错误"))}catch(q){console.error(q),le.error("保存失败")}finally{y(!1)}}},Ye=async()=>{if(!A.id||!A.title){le.error("请填写章节ID和标题");return}y(!0);try{const T=un.find(fe=>fe.id===A.partId),q=T==null?void 0:T.chapters.find(fe=>fe.id===A.chapterId),ue=await Tt("/api/db/book",{id:A.id,title:A.title,price:A.isFree?0:A.price,content:vw(A.content||"",br,vr),partId:A.partId,partTitle:(T==null?void 0:T.title)??"",chapterId:A.chapterId,chapterTitle:(q==null?void 0:q.title)??"",isFree:A.isFree,isNew:A.isNew,editionStandard:A.editionPremium?!1:A.editionStandard??!0,editionPremium:A.editionPremium??!1,hotScore:A.hotScore??0,saveToFile:!1});if(ue&&ue.success!==!1){if(A.isPinned){const fe=[...At,A.id];Kn(fe);try{await Nt("/api/db/config",{key:"pinned_section_ids",value:fe,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"})}catch{}}le.success(`章节创建成功:${A.title}`),h(!1),I({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),zn()}else le.error("创建失败: "+(ue&&typeof ue=="object"&&"error"in ue?ue.error:"未知错误"))}catch(T){console.error(T),le.error("创建失败")}finally{y(!1)}},ct=T=>{I(q=>{var ue;return{...q,partId:T.id,chapterId:((ue=T.chapters[0])==null?void 0:ue.id)??"chapter-1"}}),h(!0)},xn=T=>{_({id:T.id,title:T.title})},kn=async()=>{var T;if((T=D==null?void 0:D.title)!=null&&T.trim()){L(!0);try{const q=t.map(fe=>({id:fe.id,partId:fe.partId||"part-1",partTitle:fe.partId===D.id?D.title.trim():fe.partTitle||"",chapterId:fe.chapterId||"chapter-1",chapterTitle:fe.chapterTitle||""})),ue=await Tt("/api/db/book",{action:"reorder",items:q});if(ue&&ue.success!==!1){const fe=D.title.trim();e(nt=>nt.map(yt=>yt.partId===D.id?{...yt,partTitle:fe}:yt)),_(null),zn()}else le.error("更新篇名失败: "+(ue&&typeof ue=="object"&&"error"in ue?ue.error:"未知错误"))}catch(q){console.error(q),le.error("更新篇名失败")}finally{L(!1)}}},Uo=T=>{const q=T.chapters.length+1,ue=`chapter-${T.id}-${q}-${Date.now()}`;I({id:`${q}.1`,title:"新章节",price:1,partId:T.id,chapterId:ue,content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),h(!0)},Xt=(T,q)=>{he({part:T,chapter:q,title:q.title})},st=async()=>{var T;if((T=U==null?void 0:U.title)!=null&&T.trim()){R(!0);try{const q=t.map(fe=>({id:fe.id,partId:fe.partId||U.part.id,partTitle:fe.partId===U.part.id?U.part.title:fe.partTitle||"",chapterId:fe.chapterId||U.chapter.id,chapterTitle:fe.partId===U.part.id&&fe.chapterId===U.chapter.id?U.title.trim():fe.chapterTitle||""})),ue=await Tt("/api/db/book",{action:"reorder",items:q});if(ue&&ue.success!==!1){const fe=U.title.trim(),nt=U.part.id,yt=U.chapter.id;e(In=>In.map(hn=>hn.partId===nt&&hn.chapterId===yt?{...hn,chapterTitle:fe}:hn)),he(null),zn()}else le.error("保存失败: "+(ue&&typeof ue=="object"&&"error"in ue?ue.error:"未知错误"))}catch(q){console.error(q),le.error("保存失败")}finally{R(!1)}}},Ba=async(T,q)=>{const ue=q.sections.map(fe=>fe.id);if(ue.length===0){le.info("该章下无小节,无需删除");return}if(confirm(`确定要删除「第${T.chapters.indexOf(q)+1}章 | ${q.title}」吗?将删除共 ${ue.length} 节,此操作不可恢复。`))try{for(const fe of ue)await wa(`/api/db/book?id=${encodeURIComponent(fe)}`);zn()}catch(fe){console.error(fe),le.error("删除失败")}},Va=async()=>{if(!G.trim()){le.error("请输入篇名");return}ye(!0);try{const T=`part-new-${Date.now()}`,q="chapter-1",ue=`part-placeholder-${Date.now()}`,fe=await Tt("/api/db/book",{id:ue,title:"占位节(可编辑)",price:0,content:"",partId:T,partTitle:G.trim(),chapterId:q,chapterTitle:"第1章 | 待编辑",saveToFile:!1});fe&&fe.success!==!1?(le.success(`篇「${G}」创建成功`),ee(!1),Q(""),zn()):le.error("创建失败: "+(fe&&typeof fe=="object"&&"error"in fe?fe.error:"未知错误"))}catch(T){console.error(T),le.error("创建失败")}finally{ye(!1)}},ls=async()=>{if(O.length===0){le.error("请先勾选要移动的章节");return}const T=un.find(ue=>ue.id===Y),q=T==null?void 0:T.chapters.find(ue=>ue.id===W);if(!T||!q||!Y||!W){le.error("请选择目标篇和章");return}oe(!0);try{const ue=()=>{const In=new Set(O),hn=t.map(rn=>({id:rn.id,partId:rn.partId||"",partTitle:rn.partTitle||"",chapterId:rn.chapterId||"",chapterTitle:rn.chapterTitle||""})),sa=hn.filter(rn=>In.has(rn.id)).map(rn=>({...rn,partId:Y,partTitle:T.title||Y,chapterId:W,chapterTitle:q.title||W})),Ls=hn.filter(rn=>!In.has(rn.id));let ac=Ls.length;for(let rn=Ls.length-1;rn>=0;rn-=1){const Ha=Ls[rn];if(Ha.partId===Y&&Ha.chapterId===W){ac=rn+1;break}}return[...Ls.slice(0,ac),...sa,...Ls.slice(ac)]},fe=async()=>{const In=ue(),hn=await Tt("/api/db/book",{action:"reorder",items:In});return hn&&hn.success!==!1?(le.success(`已移动 ${O.length} 节到「${T.title}」-「${q.title}」`),ce(!1),X([]),await zn(),!0):!1},nt={action:"move-sections",sectionIds:O,targetPartId:Y,targetChapterId:W,targetPartTitle:T.title||Y,targetChapterTitle:q.title||W},yt=await Tt("/api/db/book",nt);if(yt&&yt.success!==!1)le.success(`已移动 ${yt.count??O.length} 节到「${T.title}」-「${q.title}」`),ce(!1),X([]),await zn();else{const In=yt&&typeof yt=="object"&&"error"in yt?yt.error||"":"未知错误";if((In.includes("缺少 id")||In.includes("无效的 action"))&&await fe())return;le.error("移动失败: "+In)}}catch(ue){console.error(ue),le.error("移动失败: "+(ue instanceof Error?ue.message:"网络或服务异常"))}finally{oe(!1)}},Ko=T=>{X(q=>q.includes(T)?q.filter(ue=>ue!==T):[...q,T])},qo=async T=>{const q=t.filter(ue=>ue.partId===T.id).map(ue=>ue.id);if(q.length===0){le.info("该篇下暂无小节可删除");return}if(confirm(`确定要删除「${T.title}」整篇吗?将删除共 ${q.length} 节内容,此操作不可恢复。`))try{for(const ue of q)await wa(`/api/db/book?id=${encodeURIComponent(ue)}`);zn()}catch(ue){console.error(ue),le.error("删除失败")}},ra=async()=>{var T;if(v.trim()){E(!0);try{const q=await De(`/api/search?q=${encodeURIComponent(v)}`);q!=null&&q.success&&((T=q.data)!=null&&T.results)?k(q.data.results):(k([]),q&&!q.success&&le.error("搜索失败: "+q.error))}catch(q){console.error(q),k([]),le.error("搜索失败")}finally{E(!1)}}},Ji=un.find(T=>T.id===A.partId),Yi=(Ji==null?void 0:Ji.chapters)??[];return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"内容管理"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",un.length," 篇 · ",as," 节内容"]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(ne,{onClick:()=>jn(!0),variant:"outline",className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:[s.jsx(Iu,{className:"w-4 h-4 mr-2"}),"排名算法"]}),s.jsxs(ne,{onClick:()=>{const T=typeof window<"u"?`${window.location.origin}/api-doc`:"";T&&window.open(T,"_blank","noopener,noreferrer")},variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ns,{className:"w-4 h-4 mr-2"}),"API 接口"]})]})]}),s.jsx(Ft,{open:u,onOpenChange:h,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] flex flex-col p-0 gap-0",showCloseButton:!0,children:[s.jsx(Bt,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(pn,{className:"w-5 h-5 text-[#38bdac]"}),"新建章节"]})}),s.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"章节ID *"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 9.15",value:A.id,onChange:T=>I({...A,id:T.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"价格 (元)"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:A.isFree?0:A.price,onChange:T=>I({...A,price:Number(T.target.value),isFree:Number(T.target.value)===0}),disabled:A.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"免费"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:A.isFree,onChange:T=>I({...A,isFree:T.target.checked,price:T.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"最新新增"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:A.isNew,onChange:T=>I({...A,isNew:T.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"小程序直推"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:A.isPinned,onChange:T=>I({...A,isPinned:T.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"文章类型"}),s.jsxs("div",{className:"flex items-center gap-4 h-10",children:[s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"new-edition-type",checked:A.editionPremium!==!0,onChange:()=>I({...A,editionStandard:!0,editionPremium:!1}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"普通版"})]}),s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"new-edition-type",checked:A.editionPremium===!0,onChange:()=>I({...A,editionStandard:!1,editionPremium:!0}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"增值版"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"热度分"}),s.jsx(ie,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:A.hotScore??0,onChange:T=>I({...A,hotScore:Math.max(0,parseFloat(T.target.value)||0)})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"章节标题 *"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入章节标题",value:A.title,onChange:T=>I({...A,title:T.target.value})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"所属篇"}),s.jsxs(Sl,{value:A.partId,onValueChange:T=>{var ue;const q=un.find(fe=>fe.id===T);I({...A,partId:T,chapterId:((ue=q==null?void 0:q.chapters[0])==null?void 0:ue.id)??"chapter-1"})},children:[s.jsx(fo,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(Cl,{})}),s.jsxs(po,{className:"bg-[#0f2137] border-gray-700",children:[un.map(T=>s.jsx(Dr,{value:T.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:T.title},T.id)),un.length===0&&s.jsx(Dr,{value:"part-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认篇"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"所属章"}),s.jsxs(Sl,{value:A.chapterId,onValueChange:T=>I({...A,chapterId:T}),children:[s.jsx(fo,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(Cl,{})}),s.jsxs(po,{className:"bg-[#0f2137] border-gray-700",children:[Yi.map(T=>s.jsx(Dr,{value:T.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:T.title},T.id)),Yi.length===0&&s.jsx(Dr,{value:"chapter-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认章"})]})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),s.jsx(Ax,{content:A.content||"",onChange:T=>I({...A,content:T}),onImageUpload:async T=>{var nt;const q=new FormData;q.append("file",T),q.append("folder","book-images");const fe=await(await fetch(ja("/api/upload"),{method:"POST",body:q,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((nt=fe==null?void 0:fe.data)==null?void 0:nt.url)||(fe==null?void 0:fe.url)||""},onVideoUpload:async T=>{var nt;const q=new FormData;q.append("file",T),q.append("folder","book-videos");const fe=await(await fetch(ja("/api/upload/video"),{method:"POST",body:q,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((nt=fe==null?void 0:fe.data)==null?void 0:nt.url)||(fe==null?void 0:fe.url)||""},persons:br,linkTags:vr,onPersonCreate:$n,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(ln,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[s.jsx(ne,{variant:"outline",onClick:()=>h(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(ne,{onClick:Ye,disabled:g||!A.id||!A.title,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),s.jsx(Ft,{open:!!D,onOpenChange:T=>!T&&_(null),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx($t,{className:"w-5 h-5 text-[#38bdac]"}),"编辑篇名"]})}),D&&s.jsx("div",{className:"space-y-4 py-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"篇名"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:D.title,onChange:T=>_({...D,title:T.target.value}),placeholder:"输入篇名"})]})}),s.jsxs(ln,{children:[s.jsx(ne,{variant:"outline",onClick:()=>_(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(ne,{onClick:kn,disabled:P||!((cs=D==null?void 0:D.title)!=null&&cs.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:P?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Ft,{open:!!U,onOpenChange:T=>!T&&he(null),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx($t,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节名称"]})}),U&&s.jsx("div",{className:"space-y-4 py-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"章节名称(如:第8章|底层结构)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:U.title,onChange:T=>he({...U,title:T.target.value}),placeholder:"输入章节名称"})]})}),s.jsxs(ln,{children:[s.jsx(ne,{variant:"outline",onClick:()=>he(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(ne,{onClick:st,disabled:me||!((ds=U==null?void 0:U.title)!=null&&ds.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:me?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Ft,{open:$,onOpenChange:T=>{var q;if(ce(T),T&&un.length>0){const ue=un[0];F(ue.id),K(((q=ue.chapters[0])==null?void 0:q.id)??"")}},children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Bt,{children:s.jsx(Vt,{className:"text-white",children:"批量移动至指定目录"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["已选 ",s.jsx("span",{className:"text-[#38bdac] font-medium",children:O.length})," 节,请选择目标篇与章。"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"目标篇"}),s.jsxs(Sl,{value:Y,onValueChange:T=>{var ue;F(T);const q=un.find(fe=>fe.id===T);K(((ue=q==null?void 0:q.chapters[0])==null?void 0:ue.id)??"")},children:[s.jsx(fo,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(Cl,{placeholder:"选择篇"})}),s.jsx(po,{className:"bg-[#0f2137] border-gray-700",children:un.map(T=>s.jsx(Dr,{value:T.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:T.title},T.id))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"目标章"}),s.jsxs(Sl,{value:W,onValueChange:K,children:[s.jsx(fo,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(Cl,{placeholder:"选择章"})}),s.jsx(po,{className:"bg-[#0f2137] border-gray-700",children:(((us=un.find(T=>T.id===Y))==null?void 0:us.chapters)??[]).map(T=>s.jsx(Dr,{value:T.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:T.title},T.id))})]})]})]}),s.jsxs(ln,{children:[s.jsx(ne,{variant:"outline",onClick:()=>ce(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(ne,{onClick:ls,disabled:B||O.length===0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:B?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-2 animate-spin"}),"移动中..."]}):"确认移动"})]})]})}),s.jsx(Ft,{open:!!Me,onOpenChange:T=>!T&&Be(null),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",showCloseButton:!0,children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white",children:["付款记录 — ",(Me==null?void 0:Me.section.title)??""]})}),s.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:He?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):Me&&Me.orders.length===0?s.jsx("p",{className:"text-gray-500 text-center py-6",children:"暂无付款记录"}):Me?s.jsxs("table",{className:"w-full text-sm border-collapse",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-700 text-left text-gray-400",children:[s.jsx("th",{className:"py-2 pr-2",children:"订单号"}),s.jsx("th",{className:"py-2 pr-2",children:"用户ID"}),s.jsx("th",{className:"py-2 pr-2",children:"金额"}),s.jsx("th",{className:"py-2 pr-2",children:"状态"}),s.jsx("th",{className:"py-2 pr-2",children:"支付时间"})]})}),s.jsx("tbody",{children:Me.orders.map(T=>s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("td",{className:"py-2 pr-2",children:s.jsx("button",{className:"text-blue-400 hover:text-blue-300 hover:underline text-left truncate max-w-[180px] block",title:`查看订单 ${T.orderSn}`,onClick:()=>window.open(`/orders?search=${T.orderSn??T.id??""}`,"_blank"),children:T.orderSn?T.orderSn.length>16?T.orderSn.slice(0,8)+"..."+T.orderSn.slice(-6):T.orderSn:"-"})}),s.jsx("td",{className:"py-2 pr-2",children:s.jsx("button",{className:"text-[#38bdac] hover:text-[#2da396] hover:underline text-left truncate max-w-[140px] block",title:`查看用户 ${T.userId??T.openId??""}`,onClick:()=>window.open(`/users?search=${T.userId??T.openId??""}`,"_blank"),children:(()=>{const q=T.userId??T.openId??"-";return q.length>12?q.slice(0,6)+"..."+q.slice(-4):q})()})}),s.jsxs("td",{className:"py-2 pr-2 text-gray-300",children:["¥",T.amount??0]}),s.jsx("td",{className:"py-2 pr-2 text-gray-300",children:T.status??"-"}),s.jsx("td",{className:"py-2 pr-2 text-gray-500",children:T.payTime??T.createdAt??"-"})]},T.id??T.orderSn??""))})]}):null})]})}),s.jsx(Ft,{open:Dt,onOpenChange:jn,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(Iu,{className:"w-5 h-5 text-amber-400"}),"文章排名算法"]})}),s.jsxs("div",{className:"space-y-4 py-2",children:[s.jsx("p",{className:"text-sm text-gray-400",children:"排名积分制:三个维度各取前20名(第1名=20分,第20名=1分),乘以权重后求和(三权重之和须为 100%)"}),re?s.jsx("p",{className:"text-gray-500",children:"加载中..."}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"阅读权重 (%)"}),s.jsx(ie,{type:"number",step:"5",min:"0",max:"100",className:"bg-[#0a1628] border-gray-700 text-white",value:it.readWeight,onChange:T=>Mt(q=>({...q,readWeight:Math.max(0,Math.min(100,parseInt(T.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"新度权重 (%)"}),s.jsx(ie,{type:"number",step:"5",min:"0",max:"100",className:"bg-[#0a1628] border-gray-700 text-white",value:it.recencyWeight,onChange:T=>Mt(q=>({...q,recencyWeight:Math.max(0,Math.min(100,parseInt(T.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"付款权重 (%)"}),s.jsx(ie,{type:"number",step:"5",min:"0",max:"100",className:"bg-[#0a1628] border-gray-700 text-white",value:it.payWeight,onChange:T=>Mt(q=>({...q,payWeight:Math.max(0,Math.min(100,parseInt(T.target.value)||0))}))})]})]}),s.jsxs("p",{className:`text-xs ${Math.abs(it.readWeight+it.recencyWeight+it.payWeight-100)>1?"text-red-400":"text-green-400"}`,children:["当前之和: ",it.readWeight+it.recencyWeight+it.payWeight,"%",Math.abs(it.readWeight+it.recencyWeight+it.payWeight-100)>1?"(须为 100%)":" ✓"]}),s.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs text-gray-400",children:[s.jsx("li",{children:"阅读量排名前20:第1名=20分 → 第20名=1分,其余0分"}),s.jsx("li",{children:"新度排名前20(按最近更新):同理20→1分"}),s.jsx("li",{children:"付款量排名前20:同理20→1分"}),s.jsx("li",{children:"热度 = 阅读排名分 × 阅读权重% + 新度排名分 × 新度权重% + 付款排名分 × 付款权重%"})]}),s.jsx(ne,{onClick:$a,disabled:et||Math.abs(it.readWeight+it.recencyWeight+it.payWeight-100)>1,className:"w-full bg-amber-500 hover:bg-amber-600 text-white",children:et?"保存中...":"保存权重"})]})]})]})}),s.jsx(Ft,{open:z,onOpenChange:ee,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(pn,{className:"w-5 h-5 text-amber-400"}),"新建篇"]})}),s.jsx("div",{className:"space-y-4 py-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"篇名(如:第六篇|真实的社会)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:G,onChange:T=>Q(T.target.value),placeholder:"输入篇名"})]})}),s.jsxs(ln,{children:[s.jsx(ne,{variant:"outline",onClick:()=>{ee(!1),Q("")},className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(ne,{onClick:Va,disabled:se||!G.trim(),className:"bg-amber-500 hover:bg-amber-600 text-white",children:se?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"创建篇"]})})]})]})}),s.jsx(Ft,{open:!!o,onOpenChange:()=>c(null),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] flex flex-col p-0 gap-0",showCloseButton:!0,children:[s.jsx(Bt,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx($t,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节"]})}),o&&s.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"章节ID"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:o.id,onChange:T=>c({...o,id:T.target.value}),placeholder:"如: 9.15"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"价格 (元)"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.isFree?0:o.price,onChange:T=>c({...o,price:Number(T.target.value),isFree:Number(T.target.value)===0}),disabled:o.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"免费"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:o.isFree||o.price===0,onChange:T=>c({...o,isFree:T.target.checked,price:T.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"最新新增"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:o.isNew??!1,onChange:T=>c({...o,isNew:T.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"小程序直推"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:o.isPinned??!1,onChange:T=>c({...o,isPinned:T.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"文章类型"}),s.jsxs("div",{className:"flex items-center gap-4 h-10",children:[s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"edition-type",checked:o.editionPremium!==!0,onChange:()=>c({...o,editionStandard:!0,editionPremium:!1}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"普通版"})]}),s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"edition-type",checked:o.editionPremium===!0,onChange:()=>c({...o,editionStandard:!1,editionPremium:!0}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"增值版"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"热度分"}),s.jsx(ie,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:o.hotScore??0,onChange:T=>c({...o,hotScore:Math.max(0,parseFloat(T.target.value)||0)})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"预览比例 (%)"}),s.jsx(ie,{type:"number",min:"1",max:"100",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"默认使用全局设置",value:o.previewPercent!=null&&o.previewPercent>=1&&o.previewPercent<=100?String(o.previewPercent):"",onChange:T=>{const q=T.target.value.trim(),ue=q===""?null:parseInt(q,10);c({...o,previewPercent:q!==""&&ue!==null&&!isNaN(ue)&&ue>=1&&ue<=100?ue:null})}}),s.jsx("span",{className:"text-xs text-gray-500",children:"未付费用户可见前 N% 内容,留空使用全局设置"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"章节标题"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:o.title,onChange:T=>c({...o,title:T.target.value})})]}),o.filePath&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"文件路径"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-gray-400 text-sm",value:o.filePath,disabled:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),f?s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700 rounded-md min-h-[400px] flex items-center justify-center",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(Ax,{ref:Nr,content:o.content||"",onChange:T=>c({...o,content:T}),onImageUpload:async T=>{var nt;const q=new FormData;q.append("file",T),q.append("folder","book-images");const fe=await(await fetch(ja("/api/upload"),{method:"POST",body:q,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((nt=fe==null?void 0:fe.data)==null?void 0:nt.url)||(fe==null?void 0:fe.url)||""},onVideoUpload:async T=>{var nt;const q=new FormData;q.append("file",T),q.append("folder","book-videos");const fe=await(await fetch(ja("/api/upload/video"),{method:"POST",body:q,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((nt=fe==null?void 0:fe.data)==null?void 0:nt.url)||(fe==null?void 0:fe.url)||""},persons:br,linkTags:vr,onPersonCreate:$n,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(ln,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[o&&s.jsxs(ne,{variant:"outline",onClick:()=>Ds({id:o.id,title:o.title,price:o.price}),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent mr-auto",children:[s.jsx($r,{className:"w-4 h-4 mr-2"}),"付款记录"]}),s.jsxs(ne,{variant:"outline",onClick:()=>c(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(nr,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsx(ne,{onClick:Ae,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),s.jsxs(Cd,{defaultValue:"chapters",className:"space-y-6",children:[s.jsxs(Jl,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(tn,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx($r,{className:"w-4 h-4 mr-2"}),"章节管理"]}),s.jsxs(tn,{value:"ranking",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(zg,{className:"w-4 h-4 mr-2"}),"内容排行榜"]}),s.jsxs(tn,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(Sa,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),s.jsxs(tn,{value:"link-person",className:"data-[state=active]:bg-purple-500/20 data-[state=active]:text-purple-400 text-gray-400",children:[s.jsx(Ns,{className:"w-4 h-4 mr-2"}),"链接人与事"]}),s.jsxs(tn,{value:"link-tag",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(Hv,{className:"w-4 h-4 mr-2"}),"链接标签"]})]}),s.jsxs(nn,{value:"chapters",className:"space-y-4",children:[s.jsxs("div",{className:"rounded-2xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between shadow-sm",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac] flex items-center justify-center text-white shadow-lg shadow-[#38bdac]/20 shrink-0",children:s.jsx($r,{className:"w-6 h-6"})}),s.jsxs("div",{children:[s.jsx("h2",{className:"font-bold text-base text-white leading-tight mb-1",children:"一场SOUL的创业实验场"}),s.jsx("p",{className:"text-xs text-gray-500",children:"来自Soul派对房的真实商业故事"})]})]}),s.jsxs("div",{className:"text-center shrink-0",children:[s.jsx("span",{className:"block text-2xl font-bold text-[#38bdac]",children:as}),s.jsx("span",{className:"text-xs text-gray-500",children:"章节"})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(ne,{onClick:()=>h(!0),className:"flex-1 min-w-[120px] bg-[#38bdac]/10 hover:bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/30",children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"新建章节"]}),s.jsxs(ne,{onClick:()=>ee(!0),className:"flex-1 min-w-[120px] bg-amber-500/10 hover:bg-amber-500/20 text-amber-400 border border-amber-500/30",children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"新建篇"]}),s.jsxs(ne,{variant:"outline",onClick:()=>ce(!0),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:["批量移动(已选 ",O.length," 节)"]})]}),n?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(lV,{parts:un,expandedParts:a,onTogglePart:Ho,onReorder:za,onReadSection:V,onDeleteSection:sc,onAddSectionInPart:ct,onAddChapterInPart:Uo,onDeleteChapter:Ba,onEditPart:xn,onDeletePart:qo,onEditChapter:Xt,selectedSectionIds:O,onToggleSectionSelect:Ko,onShowSectionOrders:Ds,pinnedSectionIds:At})]}),s.jsx(nn,{value:"search",className:"space-y-4",children:s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(qe,{children:s.jsx(Ge,{className:"text-white",children:"内容搜索"})}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",placeholder:"搜索标题或内容...",value:v,onChange:T=>w(T.target.value),onKeyDown:T=>T.key==="Enter"&&ra()}),s.jsx(ne,{onClick:ra,disabled:C||!v.trim(),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:C?s.jsx(Ue,{className:"w-4 h-4 animate-spin"}):s.jsx(Sa,{className:"w-4 h-4"})})]}),N.length>0&&s.jsxs("div",{className:"space-y-2 mt-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["找到 ",N.length," 个结果"]}),N.filter(T=>T.matchType==="title").length>0&&s.jsxs("div",{children:[s.jsx("p",{className:"text-amber-400 text-sm font-medium mb-2",children:"标题匹配"}),N.filter(T=>T.matchType==="title").slice(0,3).map(T=>s.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors mb-2",onClick:()=>V({id:T.id,title:T.title,price:T.price??1,filePath:""}),children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[#38bdac] font-mono text-xs",children:T.id}),s.jsx("span",{className:"text-white",children:T.title}),At.includes(T.id)&&s.jsx(xi,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})]})}),(T.partTitle||T.chapterTitle)&&s.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[T.partTitle," · ",T.chapterTitle]})]},T.id))]}),N.filter(T=>T.matchType==="content").length>0&&s.jsxs("div",{className:"mt-4",children:[s.jsx("p",{className:"text-gray-400 text-sm font-medium mb-2",children:"内容匹配"}),N.filter(T=>T.matchType==="content").map(T=>s.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors mb-2",onClick:()=>V({id:T.id,title:T.title,price:T.price??1,filePath:""}),children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[#38bdac] font-mono text-xs",children:T.id}),s.jsx("span",{className:"text-white",children:T.title}),At.includes(T.id)&&s.jsx(xi,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})]})}),T.snippet&&s.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:T.snippet}),(T.partTitle||T.chapterTitle)&&s.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[T.partTitle," · ",T.chapterTitle]})]},T.id))]})]})]})]})}),s.jsxs(nn,{value:"ranking",className:"space-y-4",children:[s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(qe,{className:"pb-3",children:s.jsxs(Ge,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Iu,{className:"w-4 h-4 text-[#38bdac]"}),"内容显示规则"]})}),s.jsx(Ce,{children:s.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(te,{className:"text-gray-400 text-sm whitespace-nowrap",children:"未付费预览比例"}),s.jsx(ie,{type:"number",min:"1",max:"100",className:"bg-[#0a1628] border-gray-700 text-white w-20",value:ge,onChange:T=>Ne(Math.max(1,Math.min(100,Number(T.target.value)||20))),disabled:qn}),s.jsx("span",{className:"text-gray-500 text-sm",children:"%"})]}),s.jsx(ne,{size:"sm",onClick:Os,disabled:Ts,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:Ts?"保存中...":"保存"}),s.jsxs("span",{className:"text-xs text-gray-500",children:["小程序未付费用户默认显示文章前 ",ge,"% 内容"]})]})})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(qe,{className:"pb-3",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs(Ge,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(zg,{className:"w-4 h-4 text-amber-400"}),"内容排行榜",s.jsxs("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["按热度排行 · 共 ",wt.length," 节"]})]}),s.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>Vr(),disabled:Lt,className:"text-gray-400 hover:text-white h-7 w-7 p-0",title:"刷新排行榜",children:s.jsx(Ue,{className:`w-4 h-4 ${Lt?"animate-spin":""}`})}),s.jsx(ne,{variant:"ghost",size:"sm",disabled:ft<=1||Lt,onClick:()=>pt(T=>Math.max(1,T-1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(JT,{className:"w-4 h-4"})}),s.jsxs("span",{className:"text-gray-400 min-w-[60px] text-center",children:[ft," / ",_a]}),s.jsx(ne,{variant:"ghost",size:"sm",disabled:ft>=_a||Lt,onClick:()=>pt(T=>Math.min(_a,T+1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(El,{className:"w-4 h-4"})})]})]})}),s.jsx(Ce,{children:s.jsxs("div",{className:"space-y-0",children:[s.jsxs("div",{className:"grid grid-cols-[40px_40px_1fr_80px_80px_80px_60px] gap-2 px-3 py-2 text-xs text-gray-500 border-b border-gray-700/50",children:[s.jsx("span",{children:"排名"}),s.jsx("span",{children:"置顶"}),s.jsx("span",{children:"标题"}),s.jsx("span",{className:"text-right",children:"点击量"}),s.jsx("span",{className:"text-right",children:"付款数"}),s.jsx("span",{className:"text-right",children:"热度"}),s.jsx("span",{className:"text-right",children:"编辑"})]}),It.map((T,q)=>{const ue=(ft-1)*Is+q+1,fe=T.isPinned??At.includes(T.id);return s.jsxs("div",{className:`grid grid-cols-[40px_40px_1fr_80px_80px_80px_60px] gap-2 px-3 py-2.5 items-center border-b border-gray-700/30 hover:bg-[#162840] transition-colors ${fe?"bg-amber-500/5":""}`,children:[s.jsx("span",{className:`text-sm font-bold ${ue<=3?"text-amber-400":"text-gray-500"}`,children:ue<=3?["🥇","🥈","🥉"][ue-1]:`#${ue}`}),s.jsx(ne,{variant:"ghost",size:"sm",className:`h-6 w-6 p-0 ${fe?"text-amber-400":"text-gray-600 hover:text-amber-400"}`,onClick:()=>Rs(T.id),disabled:ns,title:fe?"取消置顶":"强制置顶(精选推荐/首页最新更新)",children:fe?s.jsx(xi,{className:"w-3.5 h-3.5 fill-current"}):s.jsx(NA,{className:"w-3.5 h-3.5"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"text-white text-sm truncate block",children:T.title}),s.jsxs("span",{className:"text-gray-600 text-xs",children:[T.partTitle," · ",T.chapterTitle]})]}),s.jsx("span",{className:"text-right text-sm text-blue-400 font-mono",children:T.clickCount??0}),s.jsx("span",{className:"text-right text-sm text-green-400 font-mono",children:T.payCount??0}),s.jsx("span",{className:"text-right text-sm text-amber-400 font-mono",children:(T.hotScore??0).toFixed(1)}),s.jsx("div",{className:"text-right",children:s.jsx(ne,{variant:"ghost",size:"sm",className:"text-gray-500 hover:text-[#38bdac] h-6 px-1",onClick:()=>V({id:T.id,title:T.title,price:T.price,filePath:""}),title:"编辑文章",children:s.jsx($t,{className:"w-3 h-3"})})})]},T.id)}),It.length===0&&s.jsx("div",{className:"py-8 text-center text-gray-500",children:"暂无数据"})]})})]})]}),s.jsxs(nn,{value:"link-person",className:"space-y-4",children:[s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{className:"pb-3",children:[s.jsxs(Ge,{className:"text-white text-base flex items-center gap-2",children:[s.jsx("span",{className:"text-[#38bdac] text-lg font-bold",children:"@"}),"AI列表 — 链接人与事(编辑器内输入 @ 可链接)"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"添加时自动生成 32 位 token,文章 @ 时存 token;小程序点击 @ 时用 token 兑换真实密钥后加好友"})]}),s.jsxs(Ce,{className:"space-y-3",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("p",{className:"text-xs text-gray-500",children:"添加人物时同步创建存客宝场景获客计划,配置与存客宝 API 获客一致"}),s.jsxs(ne,{size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",onClick:()=>{Xs(null),Oa(!0)},children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"添加"]})]}),s.jsxs("div",{className:"space-y-1 max-h-[400px] overflow-y-auto",children:[br.length>0&&s.jsxs("div",{className:"flex items-center gap-4 px-3 py-1.5 text-xs text-gray-500 border-b border-gray-700/50",children:[s.jsx("span",{className:"w-[200px] shrink-0",children:"token"}),s.jsx("span",{className:"w-24 shrink-0",children:"@的人"}),s.jsx("span",{className:"w-28 shrink-0",children:"别名"}),s.jsx("span",{className:"w-16 shrink-0 text-center",children:"获客数"}),s.jsx("span",{children:"获客计划活动名"})]}),br.map(T=>{const q=Wi[T.id]||0;return s.jsxs("div",{className:"bg-[#0a1628] rounded px-3 py-2 flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-4 text-sm min-w-0",children:[s.jsx("span",{className:"text-gray-400 text-xs font-mono shrink-0 w-[200px] truncate",title:T.id,children:T.id}),s.jsx("span",{className:"text-amber-400 shrink-0 w-24 truncate",title:"@的人",children:T.name}),s.jsx("span",{className:"text-gray-500 shrink-0 w-28 truncate text-xs",title:"别名",children:T.aliases||"-"}),s.jsx("span",{className:`shrink-0 w-16 text-center text-xs font-bold ${q>0?"text-green-400":"text-gray-600"}`,title:"获客数",children:q}),s.jsxs("span",{className:"text-white truncate",title:"获客计划活动名",children:["SOUL链接人与事-",T.name]})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(ne,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-[#38bdac] h-6 px-2",title:"编辑",onClick:async()=>{try{const ue=await dV(T.personId||"");if(ue!=null&&ue.success&&ue.person){const fe=ue.person;Xs({id:fe.token??fe.personId,personId:fe.personId,name:fe.name,aliases:fe.aliases??"",label:fe.label??"",ckbApiKey:fe.ckbApiKey??"",remarkType:fe.remarkType,remarkFormat:fe.remarkFormat,addFriendInterval:fe.addFriendInterval,startTime:fe.startTime,endTime:fe.endTime,deviceGroups:fe.deviceGroups})}else Xs(T),ue!=null&&ue.error&&le.error(ue.error)}catch(ue){console.error(ue),Xs(T),le.error(ue instanceof Error?ue.message:"加载人物详情失败")}Oa(!0)},children:s.jsx(mA,{className:"w-3 h-3"})}),s.jsx(ne,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-green-400 h-6 px-2",title:"查看获客详情",onClick:()=>Fa(T.id,T.name),children:s.jsx(Mn,{className:"w-3 h-3"})}),s.jsx(ne,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-amber-400 h-6 px-2",title:"编辑计划(跳转存客宝)",onClick:()=>{const ue=T.ckbPlanId;ue?window.open(`https://h5.ckb.quwanzhi.com/#/scenarios/edit/${ue}`,"_blank"):le.info("该人物尚未同步存客宝计划,请先保存后等待同步完成")},children:s.jsx(Ks,{className:"w-3 h-3"})}),s.jsx(ne,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",title:"删除(同时删除存客宝对应获客计划)",onClick:async()=>{confirm(`确定删除「SOUL链接人与事-${T.name}」?将同时删除存客宝对应获客计划。`)&&(await wa(`/api/db/persons?personId=${T.personId}`),is())},children:s.jsx(nr,{className:"w-3 h-3"})})]})]},T.id)}),br.length===0&&s.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无AI人物,添加后可在编辑器中 @链接"})]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{className:"pb-3",children:[s.jsxs(Ge,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Iu,{className:"w-4 h-4 text-green-400"}),"存客宝绑定"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"配置存客宝 API 后,文章中 @人物 或 #标签 点击可自动进入存客宝流量池"})]}),s.jsxs(Ce,{className:"space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"存客宝 API 地址"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8",placeholder:"https://ckbapi.quwanzhi.com",defaultValue:"https://ckbapi.quwanzhi.com",readOnly:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"绑定计划"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8",placeholder:"创业实验-内容引流",defaultValue:"创业实验-内容引流",readOnly:!0})]})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["具体存客宝场景配置与接口测试请前往"," ",s.jsx("button",{className:"text-[#38bdac] hover:underline",onClick:()=>window.open("/match","_blank"),children:"找伙伴 → 存客宝工作台"})]})]})]})]}),s.jsx(nn,{value:"link-tag",className:"space-y-4",children:s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{className:"pb-3",children:[s.jsxs(Ge,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Hv,{className:"w-4 h-4 text-amber-400"}),"链接标签 — 链接事与物(编辑器内 #标签 可跳转链接/小程序/存客宝)"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"小程序端点击 #标签 可直接跳转对应链接,进入流量池"})]}),s.jsxs(Ce,{className:"space-y-3",children:[s.jsxs("div",{className:"flex gap-2 items-end flex-wrap",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"标签ID"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-24",placeholder:"如 team01",value:vt.tagId,onChange:T=>Gn({...vt,tagId:T.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"显示文字"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-28",placeholder:"如 神仙团队",value:vt.label,onChange:T=>Gn({...vt,label:T.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"别名"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-28",placeholder:"逗号分隔",value:vt.aliases,onChange:T=>Gn({...vt,aliases:T.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"类型"}),s.jsxs(Sl,{value:vt.type,onValueChange:T=>Gn({...vt,type:T}),children:[s.jsx(fo,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-24",children:s.jsx(Cl,{})}),s.jsxs(po,{children:[s.jsx(Dr,{value:"url",children:"网页链接"}),s.jsx(Dr,{value:"miniprogram",children:"小程序"}),s.jsx(Dr,{value:"ckb",children:"存客宝"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:vt.type==="url"?"URL地址":vt.type==="ckb"?"存客宝计划URL":"AppID"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-44",placeholder:vt.type==="url"?"https://...":vt.type==="ckb"?"https://ckbapi.quwanzhi.com/...":"wx...",value:vt.type==="url"||vt.type==="ckb"?vt.url:vt.appId,onChange:T=>{vt.type==="url"||vt.type==="ckb"?Gn({...vt,url:T.target.value}):Gn({...vt,appId:T.target.value})}})]}),vt.type==="miniprogram"&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"页面路径"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-36",placeholder:"pages/index/index",value:vt.pagePath,onChange:T=>Gn({...vt,pagePath:T.target.value})})]}),s.jsxs(ne,{size:"sm",className:"bg-amber-500 hover:bg-amber-600 text-white h-8",onClick:async()=>{if(!vt.tagId||!vt.label){le.error("标签ID和显示文字必填");return}const T={...vt};T.type==="miniprogram"&&(T.url=""),await Nt("/api/db/link-tags",T),Gn({tagId:"",label:"",aliases:"",url:"",type:"url",appId:"",pagePath:""}),As(null),na()},children:[s.jsx(pn,{className:"w-3 h-3 mr-1"}),Da?"保存":"添加"]})]}),s.jsxs("div",{className:"space-y-1 max-h-[400px] overflow-y-auto",children:[vr.map(T=>s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded px-3 py-2",children:[s.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[s.jsxs("button",{type:"button",className:"text-amber-400 font-bold text-base hover:underline",onClick:()=>{Gn({tagId:T.id,label:T.label,aliases:T.aliases??"",url:T.url,type:T.type,appId:T.appId??"",pagePath:T.pagePath??""}),As(T.id)},children:["#",T.label]}),s.jsx(Ke,{variant:"secondary",className:`text-[10px] ${T.type==="ckb"?"bg-green-500/20 text-green-300 border-green-500/30":"bg-gray-700 text-gray-300"}`,children:T.type==="url"?"网页":T.type==="ckb"?"存客宝":"小程序"}),T.type==="miniprogram"?s.jsxs("span",{className:"text-gray-400 text-xs font-mono",children:[T.appId," ",T.pagePath?`· ${T.pagePath}`:""]}):T.url?s.jsxs("a",{href:T.url,target:"_blank",rel:"noreferrer",className:"text-blue-400 text-xs truncate max-w-[250px] hover:underline flex items-center gap-1",children:[T.url," ",s.jsx(Ks,{className:"w-3 h-3 shrink-0"})]}):null]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ne,{variant:"ghost",size:"sm",className:"text-gray-300 hover:text-white h-6 px-2",onClick:()=>{Gn({tagId:T.id,label:T.label,aliases:T.aliases??"",url:T.url,type:T.type,appId:T.appId??"",pagePath:T.pagePath??""}),As(T.id)},children:"编辑"}),s.jsx(ne,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",onClick:async()=>{await wa(`/api/db/link-tags?tagId=${T.id}`),Da===T.id&&(As(null),Gn({tagId:"",label:"",aliases:"",url:"",type:"url",appId:"",pagePath:""})),na()},children:s.jsx(nr,{className:"w-3 h-3"})})]})]},T.id)),vr.length===0&&s.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无链接标签,添加后可在编辑器中使用 #标签 跳转"})]})]})]})})]}),s.jsx(uV,{open:Ms,onOpenChange:Oa,editingPerson:Hi,onSubmit:async T=>{var fe;const q={personId:T.personId||T.name.toLowerCase().replace(/\s+/g,"_")+"_"+Date.now().toString(36),name:T.name,aliases:T.aliases||void 0,label:T.label,ckbApiKey:T.ckbApiKey||void 0,greeting:T.greeting||void 0,tips:T.tips||void 0,remarkType:T.remarkType||void 0,remarkFormat:T.remarkFormat||void 0,addFriendInterval:T.addFriendInterval,startTime:T.startTime||void 0,endTime:T.endTime||void 0,deviceGroups:(fe=T.deviceGroups)!=null&&fe.trim()?T.deviceGroups.split(",").map(nt=>parseInt(nt.trim(),10)).filter(nt=>!Number.isNaN(nt)):void 0},ue=await Nt("/api/db/persons",q);if(ue&&ue.success===!1){const nt=ue;nt.ckbResponse&&console.log("存客宝返回",nt.ckbResponse);const yt=nt.error||"操作失败";throw new Error(yt)}if(is(),le.success(Hi?"已保存":"已添加"),ue!=null&&ue.ckbCreateResult&&Object.keys(ue.ckbCreateResult).length>0){const nt=ue.ckbCreateResult;console.log("存客宝创建结果",nt);const yt=nt.planId??nt.id,In=yt!=null?[`planId: ${yt}`]:[];nt.apiKey!=null&&In.push("apiKey: ***"),le.info(In.length?`存客宝创建结果:${In.join(",")}`:"存客宝创建结果见控制台")}}}),s.jsx(Ft,{open:nc,onOpenChange:Jn,children:s.jsxs(Rt,{className:"max-w-2xl bg-[#0f2137] border-gray-700",children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(Mn,{className:"w-5 h-5 text-green-400"}),Ar," — 获客详情(共 ",cr," 条)"]})}),s.jsx("div",{className:"max-h-[450px] overflow-y-auto space-y-2",children:Vo?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(Ue,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):ta.length===0?s.jsx("div",{className:"text-gray-500 text-sm py-8 text-center",children:"暂无获客记录"}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-[60px_1fr_100px_100px_80px_120px] gap-2 px-3 py-1.5 text-xs text-gray-500 border-b border-gray-700/50",children:[s.jsx("span",{children:"#"}),s.jsx("span",{children:"昵称/姓名"}),s.jsx("span",{children:"手机"}),s.jsx("span",{children:"微信"}),s.jsx("span",{children:"来源"}),s.jsx("span",{children:"时间"})]}),ta.map((T,q)=>s.jsxs("div",{className:"grid grid-cols-[60px_1fr_100px_100px_80px_120px] gap-2 px-3 py-2 bg-[#0a1628] rounded text-sm",children:[s.jsx("span",{className:"text-gray-500 text-xs",children:(ss-1)*20+q+1}),s.jsx("span",{className:"text-white truncate",children:T.nickname||T.name||T.userId||"-"}),s.jsx("span",{className:"text-gray-300 text-xs",children:T.phone||"-"}),s.jsx("span",{className:"text-gray-300 text-xs truncate",children:T.wechatId||"-"}),s.jsx("span",{className:"text-gray-500 text-xs",children:T.source==="article_mention"?"文章@":T.source==="index_lead"?"首页":T.source||"-"}),s.jsx("span",{className:"text-gray-500 text-xs",children:T.createdAt?new Date(T.createdAt).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"-"})]},T.id))]})}),cr>20&&s.jsxs("div",{className:"flex items-center justify-center gap-2 pt-2",children:[s.jsx(ne,{size:"sm",variant:"outline",disabled:ss<=1,onClick:()=>Fa(ea,Ar,ss-1),className:"border-gray-600 text-gray-300 bg-transparent h-7 px-3",children:"上一页"}),s.jsxs("span",{className:"text-gray-400 text-xs",children:[ss," / ",Math.ceil(cr/20)]}),s.jsx(ne,{size:"sm",variant:"outline",disabled:ss>=Math.ceil(cr/20),onClick:()=>Fa(ea,Ar,ss+1),className:"border-gray-600 text-gray-300 bg-transparent h-7 px-3",children:"下一页"})]})]})})]})}const Na={name:"卡若",avatar:"K",avatarImg:"",title:"Soul派对房主理人 · 私域运营专家",bio:'每天早上6点到9点,在Soul派对房分享真实的创业故事。专注私域运营与项目变现,用"云阿米巴"模式帮助创业者构建可持续的商业体系。',stats:[{label:"商业案例",value:"62"},{label:"连续直播",value:"365天"},{label:"派对分享",value:"1000+"}],highlights:["5年私域运营经验","帮助100+品牌从0到1增长","连续创业者,擅长商业模式设计"]};function Nw(t){return Array.isArray(t)?t.map(e=>e&&typeof e=="object"&&"label"in e&&"value"in e?{label:String(e.label),value:String(e.value)}:{label:"",value:""}).filter(e=>e.label||e.value):Na.stats}function ww(t){return Array.isArray(t)?t.map(e=>typeof e=="string"?e:String(e??"")).filter(Boolean):Na.highlights}function pV(){const[t,e]=b.useState(Na),[n,r]=b.useState(!0),[a,i]=b.useState(!1),[o,c]=b.useState(!1),u=b.useRef(null);b.useEffect(()=>{De("/api/admin/author-settings").then(k=>{const C=k==null?void 0:k.data;C&&typeof C=="object"&&e({name:String(C.name??Na.name),avatar:String(C.avatar??Na.avatar),avatarImg:String(C.avatarImg??""),title:String(C.title??Na.title),bio:String(C.bio??Na.bio),stats:Nw(C.stats).length?Nw(C.stats):Na.stats,highlights:ww(C.highlights).length?ww(C.highlights):Na.highlights})}).catch(console.error).finally(()=>r(!1))},[]);const h=async()=>{i(!0);try{const k={name:t.name,avatar:t.avatar||"K",avatarImg:t.avatarImg,title:t.title,bio:t.bio,stats:t.stats.filter(A=>A.label||A.value),highlights:t.highlights.filter(Boolean)},C=await Nt("/api/admin/author-settings",k);if(!C||C.success===!1){le.error("保存失败: "+(C&&typeof C=="object"&&"error"in C?C.error:""));return}i(!1);const E=document.createElement("div");E.className="fixed top-4 right-4 z-50 px-4 py-2 rounded-lg bg-[#38bdac] text-white text-sm shadow-lg",E.textContent="作者设置已保存",document.body.appendChild(E),setTimeout(()=>E.remove(),2e3)}catch(k){console.error(k),le.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{i(!1)}},f=async k=>{var E;const C=(E=k.target.files)==null?void 0:E[0];if(C){c(!0);try{const A=new FormData;A.append("file",C),A.append("folder","avatars");const I=Kx(),D={};I&&(D.Authorization=`Bearer ${I}`);const P=await(await fetch(ja("/api/upload"),{method:"POST",body:A,credentials:"include",headers:D})).json();P!=null&&P.success&&(P!=null&&P.url)?e(L=>({...L,avatarImg:P.url})):le.error("上传失败: "+((P==null?void 0:P.error)||"未知错误"))}catch(A){console.error(A),le.error("上传失败")}finally{c(!1),u.current&&(u.current.value="")}}},m=()=>e(k=>({...k,stats:[...k.stats,{label:"",value:""}]})),g=k=>e(C=>({...C,stats:C.stats.filter((E,A)=>A!==k)})),y=(k,C,E)=>e(A=>({...A,stats:A.stats.map((I,D)=>D===k?{...I,[C]:E}:I)})),v=()=>e(k=>({...k,highlights:[...k.highlights,""]})),w=k=>e(C=>({...C,highlights:C.highlights.filter((E,A)=>A!==k)})),N=(k,C)=>e(E=>({...E,highlights:E.highlights.map((A,I)=>I===k?C:A)}));return n?s.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(No,{className:"w-5 h-5 text-[#38bdac]"}),"作者详情"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置小程序「关于作者」页展示的作者信息,包括头像、简介、统计数据与亮点标签。"})]}),s.jsxs(ne,{onClick:h,disabled:a||n,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"flex items-center gap-2 text-white",children:[s.jsx(No,{className:"w-4 h-4 text-[#38bdac]"}),"基本信息"]}),s.jsx(Ht,{className:"text-gray-400",children:"作者姓名、头像、头衔与个人简介,将展示在「关于作者」页顶部。"})]}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"姓名"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.name,onChange:k=>e(C=>({...C,name:k.target.value})),placeholder:"卡若"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"首字母占位(无头像时显示)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white w-20",value:t.avatar,onChange:k=>e(C=>({...C,avatar:k.target.value.slice(0,1)||"K"})),placeholder:"K"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Xw,{className:"w-3 h-3 text-[#38bdac]"}),"头像图片"]}),s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ie,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:t.avatarImg,onChange:k=>e(C=>({...C,avatarImg:k.target.value})),placeholder:"上传或粘贴 URL,如 /uploads/avatars/xxx.png"}),s.jsx("input",{ref:u,type:"file",accept:"image/*",className:"hidden",onChange:f}),s.jsxs(ne,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:o,onClick:()=>{var k;return(k=u.current)==null?void 0:k.click()},children:[s.jsx(mh,{className:"w-4 h-4 mr-2"}),o?"上传中...":"上传"]})]}),t.avatarImg&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:ts(t.avatarImg.startsWith("http")?t.avatarImg:ja(t.avatarImg)),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"头衔"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.title,onChange:k=>e(C=>({...C,title:k.target.value})),placeholder:"Soul派对房主理人 · 私域运营专家"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"个人简介"}),s.jsx(Yl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[120px]",value:t.bio,onChange:k=>e(C=>({...C,bio:k.target.value})),placeholder:"每天早上6点到9点..."})]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsx(Ge,{className:"text-white",children:"统计数据"}),s.jsx(Ht,{className:"text-gray-400",children:"展示在作者卡片中的数字指标,如「商业案例 62」「连续直播 365天」。第一个「商业案例」的值可由书籍统计自动更新。"})]}),s.jsxs(Ce,{className:"space-y-3",children:[t.stats.map((k,C)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ie,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.label,onChange:E=>y(C,"label",E.target.value),placeholder:"标签"}),s.jsx(ie,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.value,onChange:E=>y(C,"value",E.target.value),placeholder:"数值"}),s.jsx(ne,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>g(C),children:s.jsx(nr,{className:"w-4 h-4"})})]},C)),s.jsxs(ne,{variant:"outline",size:"sm",onClick:m,className:"border-gray-600 text-gray-400",children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"添加统计项"]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsx(Ge,{className:"text-white",children:"亮点标签"}),s.jsx(Ht,{className:"text-gray-400",children:"作者优势或成就的简短描述,以标签形式展示。"})]}),s.jsxs(Ce,{className:"space-y-3",children:[t.highlights.map((k,C)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ie,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k,onChange:E=>N(C,E.target.value),placeholder:"5年私域运营经验"}),s.jsx(ne,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>w(C),children:s.jsx(nr,{className:"w-4 h-4"})})]},C)),s.jsxs(ne,{variant:"outline",size:"sm",onClick:v,className:"border-gray-600 text-gray-400",children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"添加亮点"]})]})]})]})]})}function mV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o]=b.useState(10),[c,u]=b.useState(0),[h,f]=b.useState(""),m=o0(h,300),[g,y]=b.useState(!0),[v,w]=b.useState(null),[N,k]=b.useState(!1),[C,E]=b.useState(null),[A,I]=b.useState(""),[D,_]=b.useState(""),[P,L]=b.useState(""),[z,ee]=b.useState("admin"),[U,he]=b.useState("active"),[me,R]=b.useState(!1);async function O(){var W;y(!0),w(null);try{const K=new URLSearchParams({page:String(a),pageSize:String(o)});m.trim()&&K.set("search",m.trim());const B=await De(`/api/admin/users?${K}`);B!=null&&B.success?(e(B.records||[]),r(B.total??0),u(B.totalPages??0)):w(B.error||"加载失败")}catch(K){const B=K;w(B.status===403?"无权限访问":((W=B==null?void 0:B.data)==null?void 0:W.error)||"加载失败"),e([])}finally{y(!1)}}b.useEffect(()=>{O()},[a,o,m]);const X=()=>{E(null),I(""),_(""),L(""),ee("admin"),he("active"),k(!0)},$=W=>{E(W),I(W.username),_(""),L(W.name||""),ee(W.role==="super_admin"?"super_admin":"admin"),he(W.status==="disabled"?"disabled":"active"),k(!0)},ce=async()=>{var W;if(!A.trim()){w("用户名不能为空");return}if(!C&&!D){w("新建时密码必填,至少 6 位");return}if(D&&D.length<6){w("密码至少 6 位");return}w(null),R(!0);try{if(C){const K=await Tt("/api/admin/users",{id:C.id,password:D||void 0,name:P.trim(),role:z,status:U});K!=null&&K.success?(k(!1),O()):w((K==null?void 0:K.error)||"保存失败")}else{const K=await Nt("/api/admin/users",{username:A.trim(),password:D,name:P.trim(),role:z});K!=null&&K.success?(k(!1),O()):w((K==null?void 0:K.error)||"保存失败")}}catch(K){const B=K;w(((W=B==null?void 0:B.data)==null?void 0:W.error)||"保存失败")}finally{R(!1)}},Y=async W=>{var K;if(confirm("确定删除该管理员?"))try{const B=await wa(`/api/admin/users?id=${W}`);B!=null&&B.success?O():w((B==null?void 0:B.error)||"删除失败")}catch(B){const oe=B;w(((K=oe==null?void 0:oe.data)==null?void 0:K.error)||"删除失败")}},F=W=>{if(!W)return"-";try{const K=new Date(W);return isNaN(K.getTime())?W:K.toLocaleString("zh-CN")}catch{return W}};return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Wx,{className:"w-5 h-5 text-[#38bdac]"}),"管理员用户"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"后台登录账号管理,仅超级管理员可操作"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ie,{placeholder:"搜索用户名/昵称",value:h,onChange:W=>f(W.target.value),className:"w-48 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"}),s.jsx(ne,{variant:"outline",size:"sm",onClick:O,disabled:g,className:"border-gray-600 text-gray-300",children:s.jsx(Ue,{className:`w-4 h-4 ${g?"animate-spin":""}`})}),s.jsxs(ne,{onClick:X,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"新增管理员"]})]})]}),v&&s.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 text-sm flex justify-between items-center",children:[s.jsx("span",{children:v}),s.jsx("button",{type:"button",onClick:()=>w(null),className:"text-red-400 hover:text-red-300",children:"×"})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ce,{className:"p-0",children:g?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(s.Fragment,{children:[s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400",children:"ID"}),s.jsx(Ee,{className:"text-gray-400",children:"用户名"}),s.jsx(Ee,{className:"text-gray-400",children:"昵称"}),s.jsx(Ee,{className:"text-gray-400",children:"角色"}),s.jsx(Ee,{className:"text-gray-400",children:"状态"}),s.jsx(Ee,{className:"text-gray-400",children:"创建时间"}),s.jsx(Ee,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(gr,{children:[t.map(W=>s.jsxs(lt,{className:"border-gray-700/50",children:[s.jsx(be,{className:"text-gray-300",children:W.id}),s.jsx(be,{className:"text-white font-medium",children:W.username}),s.jsx(be,{className:"text-gray-400",children:W.name||"-"}),s.jsx(be,{children:s.jsx(Ke,{variant:"outline",className:W.role==="super_admin"?"border-amber-500/50 text-amber-400":"border-gray-600 text-gray-400",children:W.role==="super_admin"?"超级管理员":"管理员"})}),s.jsx(be,{children:s.jsx(Ke,{variant:"outline",className:W.status==="active"?"border-[#38bdac]/50 text-[#38bdac]":"border-gray-500 text-gray-500",children:W.status==="active"?"正常":"已禁用"})}),s.jsx(be,{className:"text-gray-500 text-sm",children:F(W.createdAt)}),s.jsxs(be,{className:"text-right",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>$(W),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx($t,{className:"w-4 h-4"})}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>Y(W.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(er,{className:"w-4 h-4"})})]})]},W.id)),t.length===0&&!g&&s.jsx(lt,{children:s.jsx(be,{colSpan:7,className:"text-center py-12 text-gray-500",children:v==="无权限访问"?"仅超级管理员可查看":"暂无管理员"})})]})]}),c>1&&s.jsx("div",{className:"p-4 border-t border-gray-700/50",children:s.jsx(ws,{page:a,pageSize:o,total:n,totalPages:c,onPageChange:i})})]})})}),s.jsx(Ft,{open:N,onOpenChange:k,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(Bt,{children:s.jsx(Vt,{className:"text-white",children:C?"编辑管理员":"新增管理员"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"用户名"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"登录用户名",value:A,onChange:W=>I(W.target.value),disabled:!!C}),C&&s.jsx("p",{className:"text-xs text-gray-500",children:"用户名不可修改"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:C?"新密码(留空不改)":"密码"}),s.jsx(ie,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:C?"留空表示不修改":"至少 6 位",value:D,onChange:W=>_(W.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"昵称"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"显示名称",value:P,onChange:W=>L(W.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"角色"}),s.jsxs("select",{value:z,onChange:W=>ee(W.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[s.jsx("option",{value:"admin",children:"管理员"}),s.jsx("option",{value:"super_admin",children:"超级管理员"})]})]}),C&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"状态"}),s.jsxs("select",{value:U,onChange:W=>he(W.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[s.jsx("option",{value:"active",children:"正常"}),s.jsx("option",{value:"disabled",children:"禁用"})]})]})]}),s.jsxs(ln,{children:[s.jsxs(ne,{variant:"outline",onClick:()=>k(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(nr,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(ne,{onClick:ce,disabled:me,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),me?"保存中...":"保存"]})]})]})})]})}function bn({method:t,url:e,desc:n,headers:r,body:a,response:i}){const o=t==="GET"?"text-emerald-400":t==="POST"?"text-amber-400":t==="PUT"?"text-blue-400":t==="DELETE"?"text-rose-400":"text-gray-400";return s.jsxs("div",{className:"rounded-lg bg-[#0a1628]/60 border border-gray-700/50 p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:`font-mono font-semibold ${o}`,children:t}),s.jsx("code",{className:"text-sm text-[#38bdac] break-all",children:e})]}),n&&s.jsx("p",{className:"text-gray-400 text-sm",children:n}),r&&r.length>0&&s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"Headers"}),s.jsx("pre",{className:"text-xs text-gray-300 font-mono overflow-x-auto p-2 rounded bg-black/30",children:r.join(` + `).join(""),n.querySelectorAll(".mention-item").forEach(u=>{u.addEventListener("click",()=>{const h=parseInt(u.getAttribute("data-index")||"0");o(h)})}))};return{onStart:u=>{if(n=document.createElement("div"),n.className="mention-popup",document.body.appendChild(n),a=u.items,i=u.command,r=0,c(),u.clientRect){const h=u.clientRect();h&&(n.style.top=`${h.bottom+4}px`,n.style.left=`${h.left}px`)}},onUpdate:u=>{if(a=u.items,i=u.command,r=0,c(),u.clientRect&&n){const h=u.clientRect();h&&(n.style.top=`${h.bottom+4}px`,n.style.left=`${h.left}px`)}},onKeyDown:u=>u.event.key==="ArrowUp"?(r=Math.max(0,r-1),c(),!0):u.event.key==="ArrowDown"?(r=Math.min(a.length-1,r+1),c(),!0):u.event.key==="Enter"?(o(r),!0):u.event.key==="Escape"?(n==null||n.remove(),n=null,!0):!1,onExit:()=>{n==null||n.remove(),n=null}}}}),Ax=b.forwardRef(({content:t,onChange:e,onImageUpload:n,onVideoUpload:r,persons:a=[],linkTags:i=[],onPersonCreate:o,placeholder:c="开始编辑内容...",className:u},h)=>{const f=b.useRef(null),m=b.useRef(null),[g,y]=b.useState(!1),[v,w]=b.useState(""),[N,k]=b.useState(!1),[C,E]=b.useState(!1),[A,I]=b.useState(0),D=b.useRef(Ng(ow(t),a,i)),_=b.useRef(e);_.current=e;const P=b.useRef(a);P.current=a;const L=b.useRef(i);L.current=i;const z=b.useRef(o);z.current=o;const ee=b.useRef(),U=J_({extensions:[Lz,$z.configure({inline:!0,allowBase64:!0}),U7.configure({openOnClick:!1,HTMLAttributes:{class:"rich-link"}}),Uz.configure({HTMLAttributes:{class:"mention-tag"},suggestion:{...rF(P,z),allowedPrefixes:null}}),nF,Kz.configure({placeholder:c}),FC.configure({resizable:!0}),$C,_C,zC],content:D.current,onUpdate:({editor:$})=>{ee.current&&clearTimeout(ee.current),ee.current=setTimeout(()=>{const ce=$.getHTML(),Y=Ng(ce,P.current||[],L.current||[]);if(Y!==ce){$.commands.setContent(Y,{emitUpdate:!1}),_.current(Y);return}_.current(ce)},300)},editorProps:{attributes:{class:"rich-editor-content"}}});b.useImperativeHandle(h,()=>({getHTML:()=>(U==null?void 0:U.getHTML())||"",getMarkdown:()=>tF((U==null?void 0:U.getHTML())||"")})),b.useEffect(()=>{if(!U)return;const $=Ng(ow(t),P.current||[],L.current||[]);$!==U.getHTML()&&U.commands.setContent($,{emitUpdate:!1})},[t,U,a,i]);const he=b.useCallback(async $=>{var Y;const ce=(Y=$.target.files)==null?void 0:Y[0];if(!(!ce||!U)){if(n){E(!0),I(10);const F=setInterval(()=>{I(W=>Math.min(W+15,90))},300);try{const W=await n(ce);clearInterval(F),I(100),W&&U.chain().focus().setImage({src:W}).run()}finally{clearInterval(F),setTimeout(()=>{E(!1),I(0)},500)}}else{const F=new FileReader;F.onload=()=>{typeof F.result=="string"&&U.chain().focus().setImage({src:F.result}).run()},F.readAsDataURL(ce)}$.target.value=""}},[U,n]),me=b.useCallback(async $=>{var Y;const ce=(Y=$.target.files)==null?void 0:Y[0];if(!(!ce||!U)){if(r){y(!0),I(5);const F=setInterval(()=>{I(W=>Math.min(W+8,90))},500);try{const W=await r(ce);clearInterval(F),I(100),W&&U.chain().focus().insertContent(`

`).run()}finally{clearInterval(F),setTimeout(()=>{y(!1),I(0)},500)}}$.target.value=""}},[U,r]),R=b.useCallback(()=>{U&&U.chain().focus().insertContent("@").run()},[U]),O=b.useCallback($=>{U&&U.chain().focus().insertContent({type:"linkTag",attrs:{label:$.label,url:$.url||"",tagType:$.type||"url",tagId:$.id||"",pagePath:$.pagePath||"",appId:$.appId||"",mpKey:$.type==="miniprogram"&&$.appId||""}}).run()},[U]),X=b.useCallback(()=>{!U||!v||(U.chain().focus().setLink({href:v}).run(),w(""),k(!1))},[U,v]);return U?s.jsxs("div",{className:`rich-editor-wrapper ${u||""}`,children:[s.jsxs("div",{className:"rich-editor-toolbar",children:[s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>U.chain().focus().toggleBold().run(),className:U.isActive("bold")?"is-active":"",type:"button",children:s.jsx(VT,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>U.chain().focus().toggleItalic().run(),className:U.isActive("italic")?"is-active":"",type:"button",children:s.jsx(HM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>U.chain().focus().toggleStrike().run(),className:U.isActive("strike")?"is-active":"",type:"button",children:s.jsx(FA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>U.chain().focus().toggleCode().run(),className:U.isActive("code")?"is-active":"",type:"button",children:s.jsx(cM,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>U.chain().focus().toggleHeading({level:1}).run(),className:U.isActive("heading",{level:1})?"is-active":"",type:"button",children:s.jsx(PM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>U.chain().focus().toggleHeading({level:2}).run(),className:U.isActive("heading",{level:2})?"is-active":"",type:"button",children:s.jsx(DM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>U.chain().focus().toggleHeading({level:3}).run(),className:U.isActive("heading",{level:3})?"is-active":"",type:"button",children:s.jsx(_M,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>U.chain().focus().toggleBulletList().run(),className:U.isActive("bulletList")?"is-active":"",type:"button",children:s.jsx(XM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>U.chain().focus().toggleOrderedList().run(),className:U.isActive("orderedList")?"is-active":"",type:"button",children:s.jsx(YM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>U.chain().focus().toggleBlockquote().run(),className:U.isActive("blockquote")?"is-active":"",type:"button",children:s.jsx(SA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>U.chain().focus().setHorizontalRule().run(),type:"button",children:s.jsx(cA,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("input",{ref:f,type:"file",accept:"image/*",onChange:he,className:"hidden"}),s.jsx("button",{onClick:()=>{var $;return($=f.current)==null?void 0:$.click()},type:"button",title:"插入图片",children:s.jsx(Xw,{className:"w-4 h-4"})}),s.jsx("input",{ref:m,type:"file",accept:"video/mp4,video/quicktime,video/webm,.mp4,.mov,.webm",onChange:me,className:"hidden"}),s.jsx("button",{onClick:()=>{var $;return($=m.current)==null?void 0:$.click()},disabled:g||!r,type:"button",title:"插入视频",className:g?"opacity-50":"",children:s.jsx(t5,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>k(!N),className:U.isActive("link")?"is-active":"",type:"button",title:"插入链接",children:s.jsx(Lg,{className:"w-4 h-4"})}),s.jsx("button",{onClick:R,type:"button",title:"@ 指定人物",className:"mention-trigger-btn",children:s.jsx($T,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>U.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),type:"button",children:s.jsx(VA,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>U.chain().focus().undo().run(),disabled:!U.can().undo(),type:"button",children:s.jsx(JA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>U.chain().focus().redo().run(),disabled:!U.can().redo(),type:"button",children:s.jsx(EA,{className:"w-4 h-4"})})]}),i.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"toolbar-divider"}),s.jsx("div",{className:"toolbar-group",children:s.jsxs("select",{className:"link-tag-select",onChange:$=>{const ce=i.find(Y=>Y.id===$.target.value);ce&&O(ce),$.target.value=""},defaultValue:"",children:[s.jsx("option",{value:"",disabled:!0,children:"# 插入链接标签"}),i.map($=>s.jsx("option",{value:$.id,children:$.label},$.id))]})})]})]}),N&&s.jsxs("div",{className:"link-input-bar",children:[s.jsx("input",{type:"url",placeholder:"输入链接地址...",value:v,onChange:$=>w($.target.value),onKeyDown:$=>$.key==="Enter"&&X(),className:"link-input"}),s.jsx("button",{onClick:X,className:"link-confirm",type:"button",children:"确定"}),s.jsx("button",{onClick:()=>{U.chain().focus().unsetLink().run(),k(!1)},className:"link-remove",type:"button",children:"移除"})]}),(C||g)&&s.jsxs("div",{className:"upload-progress-bar",children:[s.jsx("div",{className:"upload-progress-track",children:s.jsx("div",{className:"upload-progress-fill",style:{width:`${A}%`}})}),s.jsxs("span",{className:"upload-progress-text",children:[g?"视频":"图片","上传中 ",A,"%"]})]}),s.jsx(Y2,{editor:U})]}):null});Ax.displayName="RichEditor";const sF=["top","right","bottom","left"],Ii=Math.min,Lr=Math.max,uf=Math.round,th=Math.floor,Us=t=>({x:t,y:t}),aF={left:"right",right:"left",bottom:"top",top:"bottom"},iF={start:"end",end:"start"};function Ix(t,e,n){return Lr(t,Ii(e,n))}function Ma(t,e){return typeof t=="function"?t(e):t}function Aa(t){return t.split("-")[0]}function Zl(t){return t.split("-")[1]}function X0(t){return t==="x"?"y":"x"}function Z0(t){return t==="y"?"height":"width"}const oF=new Set(["top","bottom"]);function Ws(t){return oF.has(Aa(t))?"y":"x"}function ey(t){return X0(Ws(t))}function lF(t,e,n){n===void 0&&(n=!1);const r=Zl(t),a=ey(t),i=Z0(a);let o=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=hf(o)),[o,hf(o)]}function cF(t){const e=hf(t);return[Rx(t),e,Rx(e)]}function Rx(t){return t.replace(/start|end/g,e=>iF[e])}const lw=["left","right"],cw=["right","left"],dF=["top","bottom"],uF=["bottom","top"];function hF(t,e,n){switch(t){case"top":case"bottom":return n?e?cw:lw:e?lw:cw;case"left":case"right":return e?dF:uF;default:return[]}}function fF(t,e,n,r){const a=Zl(t);let i=hF(Aa(t),n==="start",r);return a&&(i=i.map(o=>o+"-"+a),e&&(i=i.concat(i.map(Rx)))),i}function hf(t){return t.replace(/left|right|bottom|top/g,e=>aF[e])}function pF(t){return{top:0,right:0,bottom:0,left:0,...t}}function BC(t){return typeof t!="number"?pF(t):{top:t,right:t,bottom:t,left:t}}function ff(t){const{x:e,y:n,width:r,height:a}=t;return{width:r,height:a,top:n,left:e,right:e+r,bottom:n+a,x:e,y:n}}function dw(t,e,n){let{reference:r,floating:a}=t;const i=Ws(e),o=ey(e),c=Z0(o),u=Aa(e),h=i==="y",f=r.x+r.width/2-a.width/2,m=r.y+r.height/2-a.height/2,g=r[c]/2-a[c]/2;let y;switch(u){case"top":y={x:f,y:r.y-a.height};break;case"bottom":y={x:f,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:m};break;case"left":y={x:r.x-a.width,y:m};break;default:y={x:r.x,y:r.y}}switch(Zl(e)){case"start":y[o]-=g*(n&&h?-1:1);break;case"end":y[o]+=g*(n&&h?-1:1);break}return y}async function mF(t,e){var n;e===void 0&&(e={});const{x:r,y:a,platform:i,rects:o,elements:c,strategy:u}=t,{boundary:h="clippingAncestors",rootBoundary:f="viewport",elementContext:m="floating",altBoundary:g=!1,padding:y=0}=Ma(e,t),v=BC(y),N=c[g?m==="floating"?"reference":"floating":m],k=ff(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(N)))==null||n?N:N.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:h,rootBoundary:f,strategy:u})),C=m==="floating"?{x:r,y:a,width:o.floating.width,height:o.floating.height}:o.reference,E=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),A=await(i.isElement==null?void 0:i.isElement(E))?await(i.getScale==null?void 0:i.getScale(E))||{x:1,y:1}:{x:1,y:1},I=ff(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:C,offsetParent:E,strategy:u}):C);return{top:(k.top-I.top+v.top)/A.y,bottom:(I.bottom-k.bottom+v.bottom)/A.y,left:(k.left-I.left+v.left)/A.x,right:(I.right-k.right+v.right)/A.x}}const gF=async(t,e,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:i=[],platform:o}=n,c=i.filter(Boolean),u=await(o.isRTL==null?void 0:o.isRTL(e));let h=await o.getElementRects({reference:t,floating:e,strategy:a}),{x:f,y:m}=dw(h,r,u),g=r,y={},v=0;for(let N=0;N({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:a,rects:i,platform:o,elements:c,middlewareData:u}=e,{element:h,padding:f=0}=Ma(t,e)||{};if(h==null)return{};const m=BC(f),g={x:n,y:r},y=ey(a),v=Z0(y),w=await o.getDimensions(h),N=y==="y",k=N?"top":"left",C=N?"bottom":"right",E=N?"clientHeight":"clientWidth",A=i.reference[v]+i.reference[y]-g[y]-i.floating[v],I=g[y]-i.reference[y],D=await(o.getOffsetParent==null?void 0:o.getOffsetParent(h));let _=D?D[E]:0;(!_||!await(o.isElement==null?void 0:o.isElement(D)))&&(_=c.floating[E]||i.floating[v]);const P=A/2-I/2,L=_/2-w[v]/2-1,z=Ii(m[k],L),ee=Ii(m[C],L),U=z,he=_-w[v]-ee,me=_/2-w[v]/2+P,R=Ix(U,me,he),O=!u.arrow&&Zl(a)!=null&&me!==R&&i.reference[v]/2-(meme<=0)){var ee,U;const me=(((ee=i.flip)==null?void 0:ee.index)||0)+1,R=_[me];if(R&&(!(m==="alignment"?C!==Ws(R):!1)||z.every($=>Ws($.placement)===C?$.overflows[0]>0:!0)))return{data:{index:me,overflows:z},reset:{placement:R}};let O=(U=z.filter(X=>X.overflows[0]<=0).sort((X,$)=>X.overflows[1]-$.overflows[1])[0])==null?void 0:U.placement;if(!O)switch(y){case"bestFit":{var he;const X=(he=z.filter($=>{if(D){const ce=Ws($.placement);return ce===C||ce==="y"}return!0}).map($=>[$.placement,$.overflows.filter(ce=>ce>0).reduce((ce,Y)=>ce+Y,0)]).sort(($,ce)=>$[1]-ce[1])[0])==null?void 0:he[0];X&&(O=X);break}case"initialPlacement":O=c;break}if(a!==O)return{reset:{placement:O}}}return{}}}};function uw(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function hw(t){return sF.some(e=>t[e]>=0)}const bF=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:a="referenceHidden",...i}=Ma(t,e);switch(a){case"referenceHidden":{const o=await r.detectOverflow(e,{...i,elementContext:"reference"}),c=uw(o,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:hw(c)}}}case"escaped":{const o=await r.detectOverflow(e,{...i,altBoundary:!0}),c=uw(o,n.floating);return{data:{escapedOffsets:c,escaped:hw(c)}}}default:return{}}}}},VC=new Set(["left","top"]);async function vF(t,e){const{placement:n,platform:r,elements:a}=t,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),o=Aa(n),c=Zl(n),u=Ws(n)==="y",h=VC.has(o)?-1:1,f=i&&u?-1:1,m=Ma(e,t);let{mainAxis:g,crossAxis:y,alignmentAxis:v}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof v=="number"&&(y=c==="end"?v*-1:v),u?{x:y*f,y:g*h}:{x:g*h,y:y*f}}const NF=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:a,y:i,placement:o,middlewareData:c}=e,u=await vF(e,t);return o===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:a+u.x,y:i+u.y,data:{...u,placement:o}}}}},wF=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:a,platform:i}=e,{mainAxis:o=!0,crossAxis:c=!1,limiter:u={fn:k=>{let{x:C,y:E}=k;return{x:C,y:E}}},...h}=Ma(t,e),f={x:n,y:r},m=await i.detectOverflow(e,h),g=Ws(Aa(a)),y=X0(g);let v=f[y],w=f[g];if(o){const k=y==="y"?"top":"left",C=y==="y"?"bottom":"right",E=v+m[k],A=v-m[C];v=Ix(E,v,A)}if(c){const k=g==="y"?"top":"left",C=g==="y"?"bottom":"right",E=w+m[k],A=w-m[C];w=Ix(E,w,A)}const N=u.fn({...e,[y]:v,[g]:w});return{...N,data:{x:N.x-n,y:N.y-r,enabled:{[y]:o,[g]:c}}}}}},jF=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:a,rects:i,middlewareData:o}=e,{offset:c=0,mainAxis:u=!0,crossAxis:h=!0}=Ma(t,e),f={x:n,y:r},m=Ws(a),g=X0(m);let y=f[g],v=f[m];const w=Ma(c,e),N=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(u){const E=g==="y"?"height":"width",A=i.reference[g]-i.floating[E]+N.mainAxis,I=i.reference[g]+i.reference[E]-N.mainAxis;yI&&(y=I)}if(h){var k,C;const E=g==="y"?"width":"height",A=VC.has(Aa(a)),I=i.reference[m]-i.floating[E]+(A&&((k=o.offset)==null?void 0:k[m])||0)+(A?0:N.crossAxis),D=i.reference[m]+i.reference[E]+(A?0:((C=o.offset)==null?void 0:C[m])||0)-(A?N.crossAxis:0);vD&&(v=D)}return{[g]:y,[m]:v}}}},kF=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:a,rects:i,platform:o,elements:c}=e,{apply:u=()=>{},...h}=Ma(t,e),f=await o.detectOverflow(e,h),m=Aa(a),g=Zl(a),y=Ws(a)==="y",{width:v,height:w}=i.floating;let N,k;m==="top"||m==="bottom"?(N=m,k=g===(await(o.isRTL==null?void 0:o.isRTL(c.floating))?"start":"end")?"left":"right"):(k=m,N=g==="end"?"top":"bottom");const C=w-f.top-f.bottom,E=v-f.left-f.right,A=Ii(w-f[N],C),I=Ii(v-f[k],E),D=!e.middlewareData.shift;let _=A,P=I;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(P=E),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(_=C),D&&!g){const z=Lr(f.left,0),ee=Lr(f.right,0),U=Lr(f.top,0),he=Lr(f.bottom,0);y?P=v-2*(z!==0||ee!==0?z+ee:Lr(f.left,f.right)):_=w-2*(U!==0||he!==0?U+he:Lr(f.top,f.bottom))}await u({...e,availableWidth:P,availableHeight:_});const L=await o.getDimensions(c.floating);return v!==L.width||w!==L.height?{reset:{rects:!0}}:{}}}};function Vf(){return typeof window<"u"}function ec(t){return HC(t)?(t.nodeName||"").toLowerCase():"#document"}function Br(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Qs(t){var e;return(e=(HC(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function HC(t){return Vf()?t instanceof Node||t instanceof Br(t).Node:!1}function js(t){return Vf()?t instanceof Element||t instanceof Br(t).Element:!1}function Js(t){return Vf()?t instanceof HTMLElement||t instanceof Br(t).HTMLElement:!1}function fw(t){return!Vf()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Br(t).ShadowRoot}const SF=new Set(["inline","contents"]);function Id(t){const{overflow:e,overflowX:n,overflowY:r,display:a}=ks(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!SF.has(a)}const CF=new Set(["table","td","th"]);function EF(t){return CF.has(ec(t))}const TF=[":popover-open",":modal"];function Hf(t){return TF.some(e=>{try{return t.matches(e)}catch{return!1}})}const MF=["transform","translate","scale","rotate","perspective"],AF=["transform","translate","scale","rotate","perspective","filter"],IF=["paint","layout","strict","content"];function ty(t){const e=ny(),n=js(t)?ks(t):t;return MF.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||AF.some(r=>(n.willChange||"").includes(r))||IF.some(r=>(n.contain||"").includes(r))}function RF(t){let e=Ri(t);for(;Js(e)&&!Wl(e);){if(ty(e))return e;if(Hf(e))return null;e=Ri(e)}return null}function ny(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const PF=new Set(["html","body","#document"]);function Wl(t){return PF.has(ec(t))}function ks(t){return Br(t).getComputedStyle(t)}function Wf(t){return js(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ri(t){if(ec(t)==="html")return t;const e=t.assignedSlot||t.parentNode||fw(t)&&t.host||Qs(t);return fw(e)?e.host:e}function WC(t){const e=Ri(t);return Wl(e)?t.ownerDocument?t.ownerDocument.body:t.body:Js(e)&&Id(e)?e:WC(e)}function Nd(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const a=WC(t),i=a===((r=t.ownerDocument)==null?void 0:r.body),o=Br(a);if(i){const c=Px(o);return e.concat(o,o.visualViewport||[],Id(a)?a:[],c&&n?Nd(c):[])}return e.concat(a,Nd(a,[],n))}function Px(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function UC(t){const e=ks(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const a=Js(t),i=a?t.offsetWidth:n,o=a?t.offsetHeight:r,c=uf(n)!==i||uf(r)!==o;return c&&(n=i,r=o),{width:n,height:r,$:c}}function ry(t){return js(t)?t:t.contextElement}function Ol(t){const e=ry(t);if(!Js(e))return Us(1);const n=e.getBoundingClientRect(),{width:r,height:a,$:i}=UC(e);let o=(i?uf(n.width):n.width)/r,c=(i?uf(n.height):n.height)/a;return(!o||!Number.isFinite(o))&&(o=1),(!c||!Number.isFinite(c))&&(c=1),{x:o,y:c}}const OF=Us(0);function KC(t){const e=Br(t);return!ny()||!e.visualViewport?OF:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function DF(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Br(t)?!1:e}function Lo(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const a=t.getBoundingClientRect(),i=ry(t);let o=Us(1);e&&(r?js(r)&&(o=Ol(r)):o=Ol(t));const c=DF(i,n,r)?KC(i):Us(0);let u=(a.left+c.x)/o.x,h=(a.top+c.y)/o.y,f=a.width/o.x,m=a.height/o.y;if(i){const g=Br(i),y=r&&js(r)?Br(r):r;let v=g,w=Px(v);for(;w&&r&&y!==v;){const N=Ol(w),k=w.getBoundingClientRect(),C=ks(w),E=k.left+(w.clientLeft+parseFloat(C.paddingLeft))*N.x,A=k.top+(w.clientTop+parseFloat(C.paddingTop))*N.y;u*=N.x,h*=N.y,f*=N.x,m*=N.y,u+=E,h+=A,v=Br(w),w=Px(v)}}return ff({width:f,height:m,x:u,y:h})}function Uf(t,e){const n=Wf(t).scrollLeft;return e?e.left+n:Lo(Qs(t)).left+n}function qC(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-Uf(t,n),a=n.top+e.scrollTop;return{x:r,y:a}}function LF(t){let{elements:e,rect:n,offsetParent:r,strategy:a}=t;const i=a==="fixed",o=Qs(r),c=e?Hf(e.floating):!1;if(r===o||c&&i)return n;let u={scrollLeft:0,scrollTop:0},h=Us(1);const f=Us(0),m=Js(r);if((m||!m&&!i)&&((ec(r)!=="body"||Id(o))&&(u=Wf(r)),Js(r))){const y=Lo(r);h=Ol(r),f.x=y.x+r.clientLeft,f.y=y.y+r.clientTop}const g=o&&!m&&!i?qC(o,u):Us(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-u.scrollLeft*h.x+f.x+g.x,y:n.y*h.y-u.scrollTop*h.y+f.y+g.y}}function _F(t){return Array.from(t.getClientRects())}function zF(t){const e=Qs(t),n=Wf(t),r=t.ownerDocument.body,a=Lr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=Lr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Uf(t);const c=-n.scrollTop;return ks(r).direction==="rtl"&&(o+=Lr(e.clientWidth,r.clientWidth)-a),{width:a,height:i,x:o,y:c}}const pw=25;function $F(t,e){const n=Br(t),r=Qs(t),a=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,c=0,u=0;if(a){i=a.width,o=a.height;const f=ny();(!f||f&&e==="fixed")&&(c=a.offsetLeft,u=a.offsetTop)}const h=Uf(r);if(h<=0){const f=r.ownerDocument,m=f.body,g=getComputedStyle(m),y=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,v=Math.abs(r.clientWidth-m.clientWidth-y);v<=pw&&(i-=v)}else h<=pw&&(i+=h);return{width:i,height:o,x:c,y:u}}const FF=new Set(["absolute","fixed"]);function BF(t,e){const n=Lo(t,!0,e==="fixed"),r=n.top+t.clientTop,a=n.left+t.clientLeft,i=Js(t)?Ol(t):Us(1),o=t.clientWidth*i.x,c=t.clientHeight*i.y,u=a*i.x,h=r*i.y;return{width:o,height:c,x:u,y:h}}function mw(t,e,n){let r;if(e==="viewport")r=$F(t,n);else if(e==="document")r=zF(Qs(t));else if(js(e))r=BF(e,n);else{const a=KC(t);r={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return ff(r)}function GC(t,e){const n=Ri(t);return n===e||!js(n)||Wl(n)?!1:ks(n).position==="fixed"||GC(n,e)}function VF(t,e){const n=e.get(t);if(n)return n;let r=Nd(t,[],!1).filter(c=>js(c)&&ec(c)!=="body"),a=null;const i=ks(t).position==="fixed";let o=i?Ri(t):t;for(;js(o)&&!Wl(o);){const c=ks(o),u=ty(o);!u&&c.position==="fixed"&&(a=null),(i?!u&&!a:!u&&c.position==="static"&&!!a&&FF.has(a.position)||Id(o)&&!u&&GC(t,o))?r=r.filter(f=>f!==o):a=c,o=Ri(o)}return e.set(t,r),r}function HF(t){let{element:e,boundary:n,rootBoundary:r,strategy:a}=t;const o=[...n==="clippingAncestors"?Hf(e)?[]:VF(e,this._c):[].concat(n),r],c=o[0],u=o.reduce((h,f)=>{const m=mw(e,f,a);return h.top=Lr(m.top,h.top),h.right=Ii(m.right,h.right),h.bottom=Ii(m.bottom,h.bottom),h.left=Lr(m.left,h.left),h},mw(e,c,a));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function WF(t){const{width:e,height:n}=UC(t);return{width:e,height:n}}function UF(t,e,n){const r=Js(e),a=Qs(e),i=n==="fixed",o=Lo(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const u=Us(0);function h(){u.x=Uf(a)}if(r||!r&&!i)if((ec(e)!=="body"||Id(a))&&(c=Wf(e)),r){const y=Lo(e,!0,i,e);u.x=y.x+e.clientLeft,u.y=y.y+e.clientTop}else a&&h();i&&!r&&a&&h();const f=a&&!r&&!i?qC(a,c):Us(0),m=o.left+c.scrollLeft-u.x-f.x,g=o.top+c.scrollTop-u.y-f.y;return{x:m,y:g,width:o.width,height:o.height}}function wg(t){return ks(t).position==="static"}function gw(t,e){if(!Js(t)||ks(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Qs(t)===n&&(n=n.ownerDocument.body),n}function JC(t,e){const n=Br(t);if(Hf(t))return n;if(!Js(t)){let a=Ri(t);for(;a&&!Wl(a);){if(js(a)&&!wg(a))return a;a=Ri(a)}return n}let r=gw(t,e);for(;r&&EF(r)&&wg(r);)r=gw(r,e);return r&&Wl(r)&&wg(r)&&!ty(r)?n:r||RF(t)||n}const KF=async function(t){const e=this.getOffsetParent||JC,n=this.getDimensions,r=await n(t.floating);return{reference:UF(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function qF(t){return ks(t).direction==="rtl"}const GF={convertOffsetParentRelativeRectToViewportRelativeRect:LF,getDocumentElement:Qs,getClippingRect:HF,getOffsetParent:JC,getElementRects:KF,getClientRects:_F,getDimensions:WF,getScale:Ol,isElement:js,isRTL:qF};function YC(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function JF(t,e){let n=null,r;const a=Qs(t);function i(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function o(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),i();const h=t.getBoundingClientRect(),{left:f,top:m,width:g,height:y}=h;if(c||e(),!g||!y)return;const v=th(m),w=th(a.clientWidth-(f+g)),N=th(a.clientHeight-(m+y)),k=th(f),E={rootMargin:-v+"px "+-w+"px "+-N+"px "+-k+"px",threshold:Lr(0,Ii(1,u))||1};let A=!0;function I(D){const _=D[0].intersectionRatio;if(_!==u){if(!A)return o();_?o(!1,_):r=setTimeout(()=>{o(!1,1e-7)},1e3)}_===1&&!YC(h,t.getBoundingClientRect())&&o(),A=!1}try{n=new IntersectionObserver(I,{...E,root:a.ownerDocument})}catch{n=new IntersectionObserver(I,E)}n.observe(t)}return o(!0),i}function YF(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,h=ry(t),f=a||i?[...h?Nd(h):[],...Nd(e)]:[];f.forEach(k=>{a&&k.addEventListener("scroll",n,{passive:!0}),i&&k.addEventListener("resize",n)});const m=h&&c?JF(h,n):null;let g=-1,y=null;o&&(y=new ResizeObserver(k=>{let[C]=k;C&&C.target===h&&y&&(y.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var E;(E=y)==null||E.observe(e)})),n()}),h&&!u&&y.observe(h),y.observe(e));let v,w=u?Lo(t):null;u&&N();function N(){const k=Lo(t);w&&!YC(w,k)&&n(),w=k,v=requestAnimationFrame(N)}return n(),()=>{var k;f.forEach(C=>{a&&C.removeEventListener("scroll",n),i&&C.removeEventListener("resize",n)}),m==null||m(),(k=y)==null||k.disconnect(),y=null,u&&cancelAnimationFrame(v)}}const QF=NF,XF=wF,ZF=yF,eB=kF,tB=bF,xw=xF,nB=jF,rB=(t,e,n)=>{const r=new Map,a={platform:GF,...n},i={...a.platform,_c:r};return gF(t,e,{...a,platform:i})};var sB=typeof document<"u",aB=function(){},uh=sB?b.useLayoutEffect:aB;function pf(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,a;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!pf(t[r],e[r]))return!1;return!0}if(a=Object.keys(t),n=a.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,a[r]))return!1;for(r=n;r--!==0;){const i=a[r];if(!(i==="_owner"&&t.$$typeof)&&!pf(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function QC(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function yw(t,e){const n=QC(t);return Math.round(e*n)/n}function jg(t){const e=b.useRef(t);return uh(()=>{e.current=t}),e}function iB(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:i,floating:o}={},transform:c=!0,whileElementsMounted:u,open:h}=t,[f,m]=b.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[g,y]=b.useState(r);pf(g,r)||y(r);const[v,w]=b.useState(null),[N,k]=b.useState(null),C=b.useCallback($=>{$!==D.current&&(D.current=$,w($))},[]),E=b.useCallback($=>{$!==_.current&&(_.current=$,k($))},[]),A=i||v,I=o||N,D=b.useRef(null),_=b.useRef(null),P=b.useRef(f),L=u!=null,z=jg(u),ee=jg(a),U=jg(h),he=b.useCallback(()=>{if(!D.current||!_.current)return;const $={placement:e,strategy:n,middleware:g};ee.current&&($.platform=ee.current),rB(D.current,_.current,$).then(ce=>{const Y={...ce,isPositioned:U.current!==!1};me.current&&!pf(P.current,Y)&&(P.current=Y,jd.flushSync(()=>{m(Y)}))})},[g,e,n,ee,U]);uh(()=>{h===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,m($=>({...$,isPositioned:!1})))},[h]);const me=b.useRef(!1);uh(()=>(me.current=!0,()=>{me.current=!1}),[]),uh(()=>{if(A&&(D.current=A),I&&(_.current=I),A&&I){if(z.current)return z.current(A,I,he);he()}},[A,I,he,z,L]);const R=b.useMemo(()=>({reference:D,floating:_,setReference:C,setFloating:E}),[C,E]),O=b.useMemo(()=>({reference:A,floating:I}),[A,I]),X=b.useMemo(()=>{const $={position:n,left:0,top:0};if(!O.floating)return $;const ce=yw(O.floating,f.x),Y=yw(O.floating,f.y);return c?{...$,transform:"translate("+ce+"px, "+Y+"px)",...QC(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ce,top:Y}},[n,c,O.floating,f.x,f.y]);return b.useMemo(()=>({...f,update:he,refs:R,elements:O,floatingStyles:X}),[f,he,R,O,X])}const oB=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:a}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?xw({element:r.current,padding:a}).fn(n):{}:r?xw({element:r,padding:a}).fn(n):{}}}},lB=(t,e)=>({...QF(t),options:[t,e]}),cB=(t,e)=>({...XF(t),options:[t,e]}),dB=(t,e)=>({...nB(t),options:[t,e]}),uB=(t,e)=>({...ZF(t),options:[t,e]}),hB=(t,e)=>({...eB(t),options:[t,e]}),fB=(t,e)=>({...tB(t),options:[t,e]}),pB=(t,e)=>({...oB(t),options:[t,e]});var mB="Arrow",XC=b.forwardRef((t,e)=>{const{children:n,width:r=10,height:a=5,...i}=t;return s.jsx(ut.svg,{...i,ref:e,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});XC.displayName=mB;var gB=XC,sy="Popper",[ZC,e4]=Li(sy),[xB,t4]=ZC(sy),n4=t=>{const{__scopePopper:e,children:n}=t,[r,a]=b.useState(null);return s.jsx(xB,{scope:e,anchor:r,onAnchorChange:a,children:n})};n4.displayName=sy;var r4="PopperAnchor",s4=b.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...a}=t,i=t4(r4,n),o=b.useRef(null),c=St(e,o),u=b.useRef(null);return b.useEffect(()=>{const h=u.current;u.current=(r==null?void 0:r.current)||o.current,h!==u.current&&i.onAnchorChange(u.current)}),r?null:s.jsx(ut.div,{...a,ref:c})});s4.displayName=r4;var ay="PopperContent",[yB,bB]=ZC(ay),a4=b.forwardRef((t,e)=>{var Q,se,ye,Me,Be,He;const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:i="center",alignOffset:o=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:h=[],collisionPadding:f=0,sticky:m="partial",hideWhenDetached:g=!1,updatePositionStrategy:y="optimized",onPlaced:v,...w}=t,N=t4(ay,n),[k,C]=b.useState(null),E=St(e,gt=>C(gt)),[A,I]=b.useState(null),D=a0(A),_=(D==null?void 0:D.width)??0,P=(D==null?void 0:D.height)??0,L=r+(i!=="center"?"-"+i:""),z=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},ee=Array.isArray(h)?h:[h],U=ee.length>0,he={padding:z,boundary:ee.filter(NB),altBoundary:U},{refs:me,floatingStyles:R,placement:O,isPositioned:X,middlewareData:$}=iB({strategy:"fixed",placement:L,whileElementsMounted:(...gt)=>YF(...gt,{animationFrame:y==="always"}),elements:{reference:N.anchor},middleware:[lB({mainAxis:a+P,alignmentAxis:o}),u&&cB({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?dB():void 0,...he}),u&&uB({...he}),hB({...he,apply:({elements:gt,rects:Dt,availableWidth:jn,availableHeight:it})=>{const{width:Mt,height:re}=Dt.reference,Pe=gt.floating.style;Pe.setProperty("--radix-popper-available-width",`${jn}px`),Pe.setProperty("--radix-popper-available-height",`${it}px`),Pe.setProperty("--radix-popper-anchor-width",`${Mt}px`),Pe.setProperty("--radix-popper-anchor-height",`${re}px`)}}),A&&pB({element:A,padding:c}),wB({arrowWidth:_,arrowHeight:P}),g&&fB({strategy:"referenceHidden",...he})]}),[ce,Y]=l4(O),F=Ti(v);rr(()=>{X&&(F==null||F())},[X,F]);const W=(Q=$.arrow)==null?void 0:Q.x,K=(se=$.arrow)==null?void 0:se.y,B=((ye=$.arrow)==null?void 0:ye.centerOffset)!==0,[oe,G]=b.useState();return rr(()=>{k&&G(window.getComputedStyle(k).zIndex)},[k]),s.jsx("div",{ref:me.setFloating,"data-radix-popper-content-wrapper":"",style:{...R,transform:X?R.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:oe,"--radix-popper-transform-origin":[(Me=$.transformOrigin)==null?void 0:Me.x,(Be=$.transformOrigin)==null?void 0:Be.y].join(" "),...((He=$.hide)==null?void 0:He.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:s.jsx(yB,{scope:n,placedSide:ce,onArrowChange:I,arrowX:W,arrowY:K,shouldHideArrow:B,children:s.jsx(ut.div,{"data-side":ce,"data-align":Y,...w,ref:E,style:{...w.style,animation:X?void 0:"none"}})})})});a4.displayName=ay;var i4="PopperArrow",vB={top:"bottom",right:"left",bottom:"top",left:"right"},o4=b.forwardRef(function(e,n){const{__scopePopper:r,...a}=e,i=bB(i4,r),o=vB[i.placedSide];return s.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:s.jsx(gB,{...a,ref:n,style:{...a.style,display:"block"}})})});o4.displayName=i4;function NB(t){return t!==null}var wB=t=>({name:"transformOrigin",options:t,fn(e){var N,k,C;const{placement:n,rects:r,middlewareData:a}=e,o=((N=a.arrow)==null?void 0:N.centerOffset)!==0,c=o?0:t.arrowWidth,u=o?0:t.arrowHeight,[h,f]=l4(n),m={start:"0%",center:"50%",end:"100%"}[f],g=(((k=a.arrow)==null?void 0:k.x)??0)+c/2,y=(((C=a.arrow)==null?void 0:C.y)??0)+u/2;let v="",w="";return h==="bottom"?(v=o?m:`${g}px`,w=`${-u}px`):h==="top"?(v=o?m:`${g}px`,w=`${r.floating.height+u}px`):h==="right"?(v=`${-u}px`,w=o?m:`${y}px`):h==="left"&&(v=`${r.floating.width+u}px`,w=o?m:`${y}px`),{data:{x:v,y:w}}}});function l4(t){const[e,n="center"]=t.split("-");return[e,n]}var jB=n4,kB=s4,SB=a4,CB=o4,c4=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"}),EB="VisuallyHidden",TB=b.forwardRef((t,e)=>s.jsx(ut.span,{...t,ref:e,style:{...c4,...t.style}}));TB.displayName=EB;var MB=[" ","Enter","ArrowUp","ArrowDown"],AB=[" ","Enter"],_o="Select",[Kf,qf,IB]=n0(_o),[tc]=Li(_o,[IB,e4]),Gf=e4(),[RB,Fi]=tc(_o),[PB,OB]=tc(_o),d4=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:a,onOpenChange:i,value:o,defaultValue:c,onValueChange:u,dir:h,name:f,autoComplete:m,disabled:g,required:y,form:v}=t,w=Gf(e),[N,k]=b.useState(null),[C,E]=b.useState(null),[A,I]=b.useState(!1),D=wf(h),[_,P]=Eo({prop:r,defaultProp:a??!1,onChange:i,caller:_o}),[L,z]=Eo({prop:o,defaultProp:c,onChange:u,caller:_o}),ee=b.useRef(null),U=N?v||!!N.closest("form"):!0,[he,me]=b.useState(new Set),R=Array.from(he).map(O=>O.props.value).join(";");return s.jsx(jB,{...w,children:s.jsxs(RB,{required:y,scope:e,trigger:N,onTriggerChange:k,valueNode:C,onValueNodeChange:E,valueNodeHasChildren:A,onValueNodeHasChildrenChange:I,contentId:ji(),value:L,onValueChange:z,open:_,onOpenChange:P,dir:D,triggerPointerDownPosRef:ee,disabled:g,children:[s.jsx(Kf.Provider,{scope:e,children:s.jsx(PB,{scope:t.__scopeSelect,onNativeOptionAdd:b.useCallback(O=>{me(X=>new Set(X).add(O))},[]),onNativeOptionRemove:b.useCallback(O=>{me(X=>{const $=new Set(X);return $.delete(O),$})},[]),children:n})}),U?s.jsxs(R4,{"aria-hidden":!0,required:y,tabIndex:-1,name:f,autoComplete:m,value:L,onChange:O=>z(O.target.value),disabled:g,form:v,children:[L===void 0?s.jsx("option",{value:""}):null,Array.from(he)]},R):null]})})};d4.displayName=_o;var u4="SelectTrigger",h4=b.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...a}=t,i=Gf(n),o=Fi(u4,n),c=o.disabled||r,u=St(e,o.onTriggerChange),h=qf(n),f=b.useRef("touch"),[m,g,y]=O4(w=>{const N=h().filter(E=>!E.disabled),k=N.find(E=>E.value===o.value),C=D4(N,w,k);C!==void 0&&o.onValueChange(C.value)}),v=w=>{c||(o.onOpenChange(!0),y()),w&&(o.triggerPointerDownPosRef.current={x:Math.round(w.pageX),y:Math.round(w.pageY)})};return s.jsx(kB,{asChild:!0,...i,children:s.jsx(ut.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":P4(o.value)?"":void 0,...a,ref:u,onClick:at(a.onClick,w=>{w.currentTarget.focus(),f.current!=="mouse"&&v(w)}),onPointerDown:at(a.onPointerDown,w=>{f.current=w.pointerType;const N=w.target;N.hasPointerCapture(w.pointerId)&&N.releasePointerCapture(w.pointerId),w.button===0&&w.ctrlKey===!1&&w.pointerType==="mouse"&&(v(w),w.preventDefault())}),onKeyDown:at(a.onKeyDown,w=>{const N=m.current!=="";!(w.ctrlKey||w.altKey||w.metaKey)&&w.key.length===1&&g(w.key),!(N&&w.key===" ")&&MB.includes(w.key)&&(v(),w.preventDefault())})})})});h4.displayName=u4;var f4="SelectValue",p4=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,children:i,placeholder:o="",...c}=t,u=Fi(f4,n),{onValueNodeHasChildrenChange:h}=u,f=i!==void 0,m=St(e,u.onValueNodeChange);return rr(()=>{h(f)},[h,f]),s.jsx(ut.span,{...c,ref:m,style:{pointerEvents:"none"},children:P4(u.value)?s.jsx(s.Fragment,{children:o}):i})});p4.displayName=f4;var DB="SelectIcon",m4=b.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...a}=t;return s.jsx(ut.span,{"aria-hidden":!0,...a,ref:e,children:r||"▼"})});m4.displayName=DB;var LB="SelectPortal",g4=t=>s.jsx(Qx,{asChild:!0,...t});g4.displayName=LB;var zo="SelectContent",x4=b.forwardRef((t,e)=>{const n=Fi(zo,t.__scopeSelect),[r,a]=b.useState();if(rr(()=>{a(new DocumentFragment)},[]),!n.open){const i=r;return i?jd.createPortal(s.jsx(y4,{scope:t.__scopeSelect,children:s.jsx(Kf.Slot,{scope:t.__scopeSelect,children:s.jsx("div",{children:t.children})})}),i):null}return s.jsx(b4,{...t,ref:e})});x4.displayName=zo;var ys=10,[y4,Bi]=tc(zo),_B="SelectContentImpl",zB=ld("SelectContent.RemoveScroll"),b4=b.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:o,side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:y,sticky:v,hideWhenDetached:w,avoidCollisions:N,...k}=t,C=Fi(zo,n),[E,A]=b.useState(null),[I,D]=b.useState(null),_=St(e,Q=>A(Q)),[P,L]=b.useState(null),[z,ee]=b.useState(null),U=qf(n),[he,me]=b.useState(!1),R=b.useRef(!1);b.useEffect(()=>{if(E)return Rj(E)},[E]),jj();const O=b.useCallback(Q=>{const[se,...ye]=U().map(He=>He.ref.current),[Me]=ye.slice(-1),Be=document.activeElement;for(const He of Q)if(He===Be||(He==null||He.scrollIntoView({block:"nearest"}),He===se&&I&&(I.scrollTop=0),He===Me&&I&&(I.scrollTop=I.scrollHeight),He==null||He.focus(),document.activeElement!==Be))return},[U,I]),X=b.useCallback(()=>O([P,E]),[O,P,E]);b.useEffect(()=>{he&&X()},[he,X]);const{onOpenChange:$,triggerPointerDownPosRef:ce}=C;b.useEffect(()=>{if(E){let Q={x:0,y:0};const se=Me=>{var Be,He;Q={x:Math.abs(Math.round(Me.pageX)-(((Be=ce.current)==null?void 0:Be.x)??0)),y:Math.abs(Math.round(Me.pageY)-(((He=ce.current)==null?void 0:He.y)??0))}},ye=Me=>{Q.x<=10&&Q.y<=10?Me.preventDefault():E.contains(Me.target)||$(!1),document.removeEventListener("pointermove",se),ce.current=null};return ce.current!==null&&(document.addEventListener("pointermove",se),document.addEventListener("pointerup",ye,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",se),document.removeEventListener("pointerup",ye,{capture:!0})}}},[E,$,ce]),b.useEffect(()=>{const Q=()=>$(!1);return window.addEventListener("blur",Q),window.addEventListener("resize",Q),()=>{window.removeEventListener("blur",Q),window.removeEventListener("resize",Q)}},[$]);const[Y,F]=O4(Q=>{const se=U().filter(Be=>!Be.disabled),ye=se.find(Be=>Be.ref.current===document.activeElement),Me=D4(se,Q,ye);Me&&setTimeout(()=>Me.ref.current.focus())}),W=b.useCallback((Q,se,ye)=>{const Me=!R.current&&!ye;(C.value!==void 0&&C.value===se||Me)&&(L(Q),Me&&(R.current=!0))},[C.value]),K=b.useCallback(()=>E==null?void 0:E.focus(),[E]),B=b.useCallback((Q,se,ye)=>{const Me=!R.current&&!ye;(C.value!==void 0&&C.value===se||Me)&&ee(Q)},[C.value]),oe=r==="popper"?Ox:v4,G=oe===Ox?{side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:y,sticky:v,hideWhenDetached:w,avoidCollisions:N}:{};return s.jsx(y4,{scope:n,content:E,viewport:I,onViewportChange:D,itemRefCallback:W,selectedItem:P,onItemLeave:K,itemTextRefCallback:B,focusSelectedItem:X,selectedItemText:z,position:r,isPositioned:he,searchRef:Y,children:s.jsx(Xx,{as:zB,allowPinchZoom:!0,children:s.jsx(Yx,{asChild:!0,trapped:C.open,onMountAutoFocus:Q=>{Q.preventDefault()},onUnmountAutoFocus:at(a,Q=>{var se;(se=C.trigger)==null||se.focus({preventScroll:!0}),Q.preventDefault()}),children:s.jsx(Jx,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:Q=>Q.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:s.jsx(oe,{role:"listbox",id:C.contentId,"data-state":C.open?"open":"closed",dir:C.dir,onContextMenu:Q=>Q.preventDefault(),...k,...G,onPlaced:()=>me(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:at(k.onKeyDown,Q=>{const se=Q.ctrlKey||Q.altKey||Q.metaKey;if(Q.key==="Tab"&&Q.preventDefault(),!se&&Q.key.length===1&&F(Q.key),["ArrowUp","ArrowDown","Home","End"].includes(Q.key)){let Me=U().filter(Be=>!Be.disabled).map(Be=>Be.ref.current);if(["ArrowUp","End"].includes(Q.key)&&(Me=Me.slice().reverse()),["ArrowUp","ArrowDown"].includes(Q.key)){const Be=Q.target,He=Me.indexOf(Be);Me=Me.slice(He+1)}setTimeout(()=>O(Me)),Q.preventDefault()}})})})})})})});b4.displayName=_B;var $B="SelectItemAlignedPosition",v4=b.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...a}=t,i=Fi(zo,n),o=Bi(zo,n),[c,u]=b.useState(null),[h,f]=b.useState(null),m=St(e,_=>f(_)),g=qf(n),y=b.useRef(!1),v=b.useRef(!0),{viewport:w,selectedItem:N,selectedItemText:k,focusSelectedItem:C}=o,E=b.useCallback(()=>{if(i.trigger&&i.valueNode&&c&&h&&w&&N&&k){const _=i.trigger.getBoundingClientRect(),P=h.getBoundingClientRect(),L=i.valueNode.getBoundingClientRect(),z=k.getBoundingClientRect();if(i.dir!=="rtl"){const Be=z.left-P.left,He=L.left-Be,gt=_.left-He,Dt=_.width+gt,jn=Math.max(Dt,P.width),it=window.innerWidth-ys,Mt=bh(He,[ys,Math.max(ys,it-jn)]);c.style.minWidth=Dt+"px",c.style.left=Mt+"px"}else{const Be=P.right-z.right,He=window.innerWidth-L.right-Be,gt=window.innerWidth-_.right-He,Dt=_.width+gt,jn=Math.max(Dt,P.width),it=window.innerWidth-ys,Mt=bh(He,[ys,Math.max(ys,it-jn)]);c.style.minWidth=Dt+"px",c.style.right=Mt+"px"}const ee=g(),U=window.innerHeight-ys*2,he=w.scrollHeight,me=window.getComputedStyle(h),R=parseInt(me.borderTopWidth,10),O=parseInt(me.paddingTop,10),X=parseInt(me.borderBottomWidth,10),$=parseInt(me.paddingBottom,10),ce=R+O+he+$+X,Y=Math.min(N.offsetHeight*5,ce),F=window.getComputedStyle(w),W=parseInt(F.paddingTop,10),K=parseInt(F.paddingBottom,10),B=_.top+_.height/2-ys,oe=U-B,G=N.offsetHeight/2,Q=N.offsetTop+G,se=R+O+Q,ye=ce-se;if(se<=B){const Be=ee.length>0&&N===ee[ee.length-1].ref.current;c.style.bottom="0px";const He=h.clientHeight-w.offsetTop-w.offsetHeight,gt=Math.max(oe,G+(Be?K:0)+He+X),Dt=se+gt;c.style.height=Dt+"px"}else{const Be=ee.length>0&&N===ee[0].ref.current;c.style.top="0px";const gt=Math.max(B,R+w.offsetTop+(Be?W:0)+G)+ye;c.style.height=gt+"px",w.scrollTop=se-B+w.offsetTop}c.style.margin=`${ys}px 0`,c.style.minHeight=Y+"px",c.style.maxHeight=U+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[g,i.trigger,i.valueNode,c,h,w,N,k,i.dir,r]);rr(()=>E(),[E]);const[A,I]=b.useState();rr(()=>{h&&I(window.getComputedStyle(h).zIndex)},[h]);const D=b.useCallback(_=>{_&&v.current===!0&&(E(),C==null||C(),v.current=!1)},[E,C]);return s.jsx(BB,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:y,onScrollButtonChange:D,children:s.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:A},children:s.jsx(ut.div,{...a,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});v4.displayName=$B;var FB="SelectPopperPosition",Ox=b.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=ys,...i}=t,o=Gf(n);return s.jsx(SB,{...o,...i,ref:e,align:r,collisionPadding:a,style:{boxSizing:"border-box",...i.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)"}})});Ox.displayName=FB;var[BB,iy]=tc(zo,{}),Dx="SelectViewport",N4=b.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...a}=t,i=Bi(Dx,n),o=iy(Dx,n),c=St(e,i.onViewportChange),u=b.useRef(0);return s.jsxs(s.Fragment,{children:[s.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),s.jsx(Kf.Slot,{scope:n,children:s.jsx(ut.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:at(a.onScroll,h=>{const f=h.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:g}=o;if(g!=null&&g.current&&m){const y=Math.abs(u.current-f.scrollTop);if(y>0){const v=window.innerHeight-ys*2,w=parseFloat(m.style.minHeight),N=parseFloat(m.style.height),k=Math.max(w,N);if(k0?A:0,m.style.justifyContent="flex-end")}}}u.current=f.scrollTop})})})]})});N4.displayName=Dx;var w4="SelectGroup",[VB,HB]=tc(w4),WB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=ji();return s.jsx(VB,{scope:n,id:a,children:s.jsx(ut.div,{role:"group","aria-labelledby":a,...r,ref:e})})});WB.displayName=w4;var j4="SelectLabel",UB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=HB(j4,n);return s.jsx(ut.div,{id:a.id,...r,ref:e})});UB.displayName=j4;var mf="SelectItem",[KB,k4]=tc(mf),S4=b.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:i,...o}=t,c=Fi(mf,n),u=Bi(mf,n),h=c.value===r,[f,m]=b.useState(i??""),[g,y]=b.useState(!1),v=St(e,C=>{var E;return(E=u.itemRefCallback)==null?void 0:E.call(u,C,r,a)}),w=ji(),N=b.useRef("touch"),k=()=>{a||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return s.jsx(KB,{scope:n,value:r,disabled:a,textId:w,isSelected:h,onItemTextChange:b.useCallback(C=>{m(E=>E||((C==null?void 0:C.textContent)??"").trim())},[]),children:s.jsx(Kf.ItemSlot,{scope:n,value:r,disabled:a,textValue:f,children:s.jsx(ut.div,{role:"option","aria-labelledby":w,"data-highlighted":g?"":void 0,"aria-selected":h&&g,"data-state":h?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...o,ref:v,onFocus:at(o.onFocus,()=>y(!0)),onBlur:at(o.onBlur,()=>y(!1)),onClick:at(o.onClick,()=>{N.current!=="mouse"&&k()}),onPointerUp:at(o.onPointerUp,()=>{N.current==="mouse"&&k()}),onPointerDown:at(o.onPointerDown,C=>{N.current=C.pointerType}),onPointerMove:at(o.onPointerMove,C=>{var E;N.current=C.pointerType,a?(E=u.onItemLeave)==null||E.call(u):N.current==="mouse"&&C.currentTarget.focus({preventScroll:!0})}),onPointerLeave:at(o.onPointerLeave,C=>{var E;C.currentTarget===document.activeElement&&((E=u.onItemLeave)==null||E.call(u))}),onKeyDown:at(o.onKeyDown,C=>{var A;((A=u.searchRef)==null?void 0:A.current)!==""&&C.key===" "||(AB.includes(C.key)&&k(),C.key===" "&&C.preventDefault())})})})})});S4.displayName=mf;var Uc="SelectItemText",C4=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,...i}=t,o=Fi(Uc,n),c=Bi(Uc,n),u=k4(Uc,n),h=OB(Uc,n),[f,m]=b.useState(null),g=St(e,k=>m(k),u.onItemTextChange,k=>{var C;return(C=c.itemTextRefCallback)==null?void 0:C.call(c,k,u.value,u.disabled)}),y=f==null?void 0:f.textContent,v=b.useMemo(()=>s.jsx("option",{value:u.value,disabled:u.disabled,children:y},u.value),[u.disabled,u.value,y]),{onNativeOptionAdd:w,onNativeOptionRemove:N}=h;return rr(()=>(w(v),()=>N(v)),[w,N,v]),s.jsxs(s.Fragment,{children:[s.jsx(ut.span,{id:u.textId,...i,ref:g}),u.isSelected&&o.valueNode&&!o.valueNodeHasChildren?jd.createPortal(i.children,o.valueNode):null]})});C4.displayName=Uc;var E4="SelectItemIndicator",T4=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return k4(E4,n).isSelected?s.jsx(ut.span,{"aria-hidden":!0,...r,ref:e}):null});T4.displayName=E4;var Lx="SelectScrollUpButton",M4=b.forwardRef((t,e)=>{const n=Bi(Lx,t.__scopeSelect),r=iy(Lx,t.__scopeSelect),[a,i]=b.useState(!1),o=St(e,r.onScrollButtonChange);return rr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=u.scrollTop>0;i(h)};const u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),a?s.jsx(I4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});M4.displayName=Lx;var _x="SelectScrollDownButton",A4=b.forwardRef((t,e)=>{const n=Bi(_x,t.__scopeSelect),r=iy(_x,t.__scopeSelect),[a,i]=b.useState(!1),o=St(e,r.onScrollButtonChange);return rr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=u.scrollHeight-u.clientHeight,f=Math.ceil(u.scrollTop)u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),a?s.jsx(I4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});A4.displayName=_x;var I4=b.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=t,i=Bi("SelectScrollButton",n),o=b.useRef(null),c=qf(n),u=b.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return b.useEffect(()=>()=>u(),[u]),rr(()=>{var f;const h=c().find(m=>m.ref.current===document.activeElement);(f=h==null?void 0:h.ref.current)==null||f.scrollIntoView({block:"nearest"})},[c]),s.jsx(ut.div,{"aria-hidden":!0,...a,ref:e,style:{flexShrink:0,...a.style},onPointerDown:at(a.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:at(a.onPointerMove,()=>{var h;(h=i.onItemLeave)==null||h.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:at(a.onPointerLeave,()=>{u()})})}),qB="SelectSeparator",GB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return s.jsx(ut.div,{"aria-hidden":!0,...r,ref:e})});GB.displayName=qB;var zx="SelectArrow",JB=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=Gf(n),i=Fi(zx,n),o=Bi(zx,n);return i.open&&o.position==="popper"?s.jsx(CB,{...a,...r,ref:e}):null});JB.displayName=zx;var YB="SelectBubbleInput",R4=b.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const a=b.useRef(null),i=St(r,a),o=s0(e);return b.useEffect(()=>{const c=a.current;if(!c)return;const u=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(o!==e&&f){const m=new Event("change",{bubbles:!0});f.call(c,e),c.dispatchEvent(m)}},[o,e]),s.jsx(ut.select,{...n,style:{...c4,...n.style},ref:i,defaultValue:e})});R4.displayName=YB;function P4(t){return t===""||t===void 0}function O4(t){const e=Ti(t),n=b.useRef(""),r=b.useRef(0),a=b.useCallback(o=>{const c=n.current+o;e(c),(function u(h){n.current=h,window.clearTimeout(r.current),h!==""&&(r.current=window.setTimeout(()=>u(""),1e3))})(c)},[e]),i=b.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,i]}function D4(t,e,n){const a=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let o=QB(t,Math.max(i,0));a.length===1&&(o=o.filter(h=>h!==n));const u=o.find(h=>h.textValue.toLowerCase().startsWith(a.toLowerCase()));return u!==n?u:void 0}function QB(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var XB=d4,L4=h4,ZB=p4,eV=m4,tV=g4,_4=x4,nV=N4,z4=S4,rV=C4,sV=T4,aV=M4,iV=A4;const Sl=XB,Cl=ZB,fo=b.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(L4,{ref:r,className:Ct("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,s.jsx(eV,{asChild:!0,children:s.jsx(od,{className:"h-4 w-4 opacity-50"})})]}));fo.displayName=L4.displayName;const po=b.forwardRef(({className:t,children:e,position:n="popper",...r},a)=>s.jsx(tV,{children:s.jsxs(_4,{ref:a,className:Ct("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1",t),position:n,...r,children:[s.jsx(aV,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(qw,{className:"h-4 w-4"})}),s.jsx(nV,{className:"p-1",children:e}),s.jsx(iV,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(od,{className:"h-4 w-4"})})]})}));po.displayName=_4.displayName;const Dr=b.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(z4,{ref:r,className:Ct("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(sV,{children:s.jsx(yf,{className:"h-4 w-4"})})}),s.jsx(rV,{children:e})]}));Dr.displayName=z4.displayName;const oV=["一","二","三","四","五","六","七","八","九","十"];function kg(t){return t.startsWith("part:")?{type:"part",id:t.slice(5)}:t.startsWith("chapter:")?{type:"chapter",id:t.slice(8)}:t.startsWith("section:")?{type:"section",id:t.slice(8)}:null}function lV({parts:t,expandedParts:e,onTogglePart:n,onReorder:r,onReadSection:a,onDeleteSection:i,onAddSectionInPart:o,onAddChapterInPart:c,onDeleteChapter:u,onEditPart:h,onDeletePart:f,onEditChapter:m,selectedSectionIds:g=[],onToggleSectionSelect:y,onShowSectionOrders:v,pinnedSectionIds:w=[]}){const[N,k]=b.useState(null),[C,E]=b.useState(null),A=(z,ee)=>(N==null?void 0:N.type)===z&&(N==null?void 0:N.id)===ee,I=(z,ee)=>(C==null?void 0:C.type)===z&&(C==null?void 0:C.id)===ee,D=b.useCallback(()=>{const z=[];for(const ee of t)for(const U of ee.chapters)for(const he of U.sections)z.push({id:he.id,partId:ee.id,partTitle:ee.title,chapterId:U.id,chapterTitle:U.title});return z},[t]),_=b.useCallback(async(z,ee,U,he)=>{var $;z.preventDefault(),z.stopPropagation();const me=z.dataTransfer.getData("text/plain"),R=kg(me);if(!R||R.type===ee&&R.id===U)return;const O=D(),X=new Map(O.map(ce=>[ce.id,ce]));if(R.type==="part"&&ee==="part"){const ce=t.map(B=>B.id),Y=ce.indexOf(R.id),F=ce.indexOf(U);if(Y===-1||F===-1)return;const W=[...ce];W.splice(Y,1),W.splice(YG.id===B);if(oe)for(const G of oe.chapters)for(const Q of G.sections){const se=X.get(Q.id);se&&K.push(se)}}await r(K);return}if(R.type==="chapter"&&(ee==="chapter"||ee==="section"||ee==="part")){const ce=t.find(se=>se.chapters.some(ye=>ye.id===R.id)),Y=ce==null?void 0:ce.chapters.find(se=>se.id===R.id);if(!ce||!Y)return;let F,W,K=null;if(ee==="section"){const se=X.get(U);if(!se)return;F=se.partId,W=se.partTitle,K=U}else if(ee==="chapter"){const se=t.find(Be=>Be.chapters.some(He=>He.id===U)),ye=se==null?void 0:se.chapters.find(Be=>Be.id===U);if(!se||!ye)return;F=se.id,W=se.title;const Me=O.filter(Be=>Be.chapterId===U).pop();K=(Me==null?void 0:Me.id)??null}else{const se=t.find(Me=>Me.id===U);if(!se||!se.chapters[0])return;F=se.id,W=se.title;const ye=O.filter(Me=>Me.partId===se.id&&Me.chapterId===se.chapters[0].id);K=(($=ye[ye.length-1])==null?void 0:$.id)??null}const B=Y.sections.map(se=>se.id),oe=O.filter(se=>!B.includes(se.id));let G=oe.length;if(K){const se=oe.findIndex(ye=>ye.id===K);se>=0&&(G=se+1)}const Q=B.map(se=>({...X.get(se),partId:F,partTitle:W,chapterId:Y.id,chapterTitle:Y.title}));await r([...oe.slice(0,G),...Q,...oe.slice(G)]);return}if(R.type==="section"&&(ee==="section"||ee==="chapter"||ee==="part")){if(!he)return;const{partId:ce,partTitle:Y,chapterId:F,chapterTitle:W}=he;let K;if(ee==="section")K=O.findIndex(ye=>ye.id===U);else if(ee==="chapter"){const ye=O.filter(Me=>Me.chapterId===U).pop();K=ye?O.findIndex(Me=>Me.id===ye.id)+1:O.length}else{const ye=t.find(He=>He.id===U);if(!(ye!=null&&ye.chapters[0]))return;const Me=O.filter(He=>He.partId===ye.id&&He.chapterId===ye.chapters[0].id),Be=Me[Me.length-1];K=Be?O.findIndex(He=>He.id===Be.id)+1:0}const B=O.findIndex(ye=>ye.id===R.id);if(B===-1)return;const oe=O.filter(ye=>ye.id!==R.id),G=B({onDragEnter:he=>{he.preventDefault(),he.stopPropagation(),he.dataTransfer.dropEffect="move",E({type:z,id:ee})},onDragOver:he=>{he.preventDefault(),he.stopPropagation(),he.dataTransfer.dropEffect="move",E({type:z,id:ee})},onDragLeave:()=>E(null),onDrop:he=>{E(null);const me=kg(he.dataTransfer.getData("text/plain"));if(me&&!(z==="section"&&me.type==="section"&&me.id===ee))if(z==="part")if(me.type==="part")_(he,"part",ee);else{const R=t.find(X=>X.id===ee);(R==null?void 0:R.chapters[0])&&U&&_(he,"part",ee,U)}else z==="chapter"&&U?(me.type==="section"||me.type==="chapter")&&_(he,"chapter",ee,U):z==="section"&&U&&_(he,"section",ee,U)}}),L=z=>oV[z]??String(z+1);return s.jsx("div",{className:"space-y-3",children:t.map((z,ee)=>{var Y,F,W,K;const U=z.title==="序言"||z.title.includes("序言"),he=z.title==="尾声"||z.title.includes("尾声"),me=z.title==="附录"||z.title.includes("附录"),R=I("part",z.id),O=e.includes(z.id),X=z.chapters.length,$=z.chapters.reduce((B,oe)=>B+oe.sections.length,0);if(U&&z.chapters.length===1&&z.chapters[0].sections.length===1){const B=z.chapters[0].sections[0],oe=I("section",B.id),G={partId:z.id,partTitle:z.title,chapterId:z.chapters[0].id,chapterTitle:z.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:Q=>{Q.stopPropagation(),Q.dataTransfer.setData("text/plain","section:"+B.id),Q.dataTransfer.effectAllowed="move",k({type:"section",id:B.id})},onDragEnd:()=>{k(null),E(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${oe?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${A("section",B.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",B.id,G),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(fa,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:Q=>Q.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(B.id),onChange:()=>y(B.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:s.jsx($r,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[z.chapters[0].title," | ",B.title]}),w.includes(B.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(xi,{className:"w-3.5 h-3.5 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:Q=>Q.stopPropagation(),onClick:Q=>Q.stopPropagation(),children:[B.price===0||B.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",B.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",B.clickCount??0," · 付款 ",B.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(B.hotScore??0).toFixed(1)," · 第",B.hotRank&&B.hotRank>0?B.hotRank:"-","名"]}),v&&s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(B),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(B),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx($t,{className:"w-3.5 h-3.5"})}),s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(B),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(er,{className:"w-3.5 h-3.5"})})]})]})]},z.id)}if(z.title==="2026每日派对干货"||z.title.includes("2026每日派对干货")){const B=I("part",z.id);return s.jsxs("div",{className:`rounded-xl border overflow-hidden transition-all duration-200 ${B?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50 bg-[#1C1C1E]"}`,...P("part",z.id,{partId:z.id,partTitle:z.title,chapterId:((Y=z.chapters[0])==null?void 0:Y.id)??"",chapterTitle:((F=z.chapters[0])==null?void 0:F.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:oe=>{oe.stopPropagation(),oe.dataTransfer.setData("text/plain","part:"+z.id),oe.dataTransfer.effectAllowed="move",k({type:"part",id:z.id})},onDragEnd:()=>{k(null),E(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${A("part",z.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/50"}`,onClick:()=>n(z.id),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(fa,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),s.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac]/80 flex items-center justify-center text-white font-bold shrink-0",children:"派"}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:z.title}),s.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",$," 节"]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:oe=>oe.stopPropagation(),onClick:oe=>oe.stopPropagation(),children:[o&&s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(z),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx(pn,{className:"w-3.5 h-3.5"})}),h&&s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(z),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx($t,{className:"w-3.5 h-3.5"})}),f&&s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(z),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(er,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",children:[X,"章"]}),O?s.jsx(od,{className:"w-5 h-5 text-gray-500"}):s.jsx(El,{className:"w-5 h-5 text-gray-500"})]})]}),O&&z.chapters.length>0&&s.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:z.chapters.map(oe=>s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[s.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:oe.title}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:G=>G.stopPropagation(),children:[m&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>m(z,oe),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx($t,{className:"w-3.5 h-3.5"})}),c&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>c(z),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx(pn,{className:"w-3.5 h-3.5"})}),u&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>u(z,oe),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(er,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:oe.sections.map(G=>{const Q=I("section",G.id);return s.jsxs("div",{draggable:!0,onDragStart:se=>{se.stopPropagation(),se.dataTransfer.setData("text/plain","section:"+G.id),se.dataTransfer.effectAllowed="move",k({type:"section",id:G.id})},onDragEnd:()=>{k(null),E(null)},onClick:()=>a(G),className:`flex items-center justify-between py-2 px-3 rounded-lg min-h-[40px] cursor-pointer select-none transition-all duration-200 ${Q?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${A("section",G.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",G.id,{partId:z.id,partTitle:z.title,chapterId:oe.id,chapterTitle:oe.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(fa,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:se=>se.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(G.id),onChange:()=>y(G.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[G.id," ",G.title]}),w.includes(G.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(xi,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onClick:se=>se.stopPropagation(),children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",G.clickCount??0," · 付款 ",G.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(G.hotScore??0).toFixed(1)," · 第",G.hotRank&&G.hotRank>0?G.hotRank:"-","名"]}),v&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>v(G),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(G),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx($t,{className:"w-3.5 h-3.5"})}),s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(G),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(er,{className:"w-3.5 h-3.5"})})]})]},G.id)})})]},oe.id))})]},z.id)}if(me)return s.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"附录"}),s.jsx("div",{className:"space-y-3",children:z.chapters.map((B,oe)=>B.sections.length>0?B.sections.map(G=>{const Q=I("section",G.id);return s.jsxs("div",{draggable:!0,onDragStart:se=>{se.stopPropagation(),se.dataTransfer.setData("text/plain","section:"+G.id),se.dataTransfer.effectAllowed="move",k({type:"section",id:G.id})},onDragEnd:()=>{k(null),E(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 group cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${Q?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${A("section",G.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",G.id,{partId:z.id,partTitle:z.title,chapterId:B.id,chapterTitle:B.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(fa,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:se=>se.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(G.id),onChange:()=>y(G.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-300 truncate",children:["附录",oe+1," | ",B.title," | ",G.title]}),w.includes(G.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(xi,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",G.clickCount??0," · 付款 ",G.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(G.hotScore??0).toFixed(1)," · 第",G.hotRank&&G.hotRank>0?G.hotRank:"-","名"]}),v&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>v(G),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>a(G),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx($t,{className:"w-3.5 h-3.5"})}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>i(G),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(er,{className:"w-3.5 h-3.5"})})]})]}),s.jsx(El,{className:"w-4 h-4 text-gray-500 shrink-0"})]},G.id)}):s.jsxs("div",{className:"flex justify-between items-center py-2 select-none hover:bg-[#162840]/50 rounded px-2 -mx-2",children:[s.jsxs("span",{className:"text-sm text-gray-500",children:["附录",oe+1," | ",B.title,"(空)"]}),s.jsx(El,{className:"w-4 h-4 text-gray-500 shrink-0"})]},B.id))})]},z.id);if(he&&z.chapters.length===1&&z.chapters[0].sections.length===1){const B=z.chapters[0].sections[0],oe=I("section",B.id),G={partId:z.id,partTitle:z.title,chapterId:z.chapters[0].id,chapterTitle:z.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:Q=>{Q.stopPropagation(),Q.dataTransfer.setData("text/plain","section:"+B.id),Q.dataTransfer.effectAllowed="move",k({type:"section",id:B.id})},onDragEnd:()=>{k(null),E(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${oe?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${A("section",B.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",B.id,G),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(fa,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:Q=>Q.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(B.id),onChange:()=>y(B.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:s.jsx($r,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[z.chapters[0].title," | ",B.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:Q=>Q.stopPropagation(),onClick:Q=>Q.stopPropagation(),children:[B.price===0||B.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",B.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",B.clickCount??0," · 付款 ",B.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(B.hotScore??0).toFixed(1)," · 第",B.hotRank&&B.hotRank>0?B.hotRank:"-","名"]}),v&&s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(B),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(B),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx($t,{className:"w-3.5 h-3.5"})}),s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(B),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(er,{className:"w-3.5 h-3.5"})})]})]})]},z.id)}return he?s.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"尾声"}),s.jsx("div",{className:"space-y-3",children:z.chapters.map(B=>B.sections.map(oe=>{const G=I("section",oe.id);return s.jsxs("div",{draggable:!0,onDragStart:Q=>{Q.stopPropagation(),Q.dataTransfer.setData("text/plain","section:"+oe.id),Q.dataTransfer.effectAllowed="move",k({type:"section",id:oe.id})},onDragEnd:()=>{k(null),E(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${G?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${A("section",oe.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...P("section",oe.id,{partId:z.id,partTitle:z.title,chapterId:B.id,chapterTitle:B.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(fa,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:Q=>Q.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(oe.id),onChange:()=>y(oe.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-300",children:[B.title," | ",oe.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",oe.clickCount??0," · 付款 ",oe.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(oe.hotScore??0).toFixed(1)," · 第",oe.hotRank&&oe.hotRank>0?oe.hotRank:"-","名"]}),v&&s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(oe),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(oe),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx($t,{className:"w-3.5 h-3.5"})}),s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(oe),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(er,{className:"w-3.5 h-3.5"})})]})]})]},oe.id)}))})]},z.id):s.jsxs("div",{className:`rounded-xl border bg-[#1C1C1E] overflow-hidden transition-all duration-200 ${R?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50"}`,...P("part",z.id,{partId:z.id,partTitle:z.title,chapterId:((W=z.chapters[0])==null?void 0:W.id)??"",chapterTitle:((K=z.chapters[0])==null?void 0:K.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:B=>{B.stopPropagation(),B.dataTransfer.setData("text/plain","part:"+z.id),B.dataTransfer.effectAllowed="move",k({type:"part",id:z.id})},onDragEnd:()=>{k(null),E(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${A("part",z.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] rounded-xl shadow-xl shadow-[#38bdac]/20":"hover:bg-[#162840]/50"}`,onClick:()=>n(z.id),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(fa,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),s.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac] flex items-center justify-center text-white font-bold shadow-lg shadow-[#38bdac]/30 shrink-0",children:L(ee)}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:z.title}),s.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["共 ",$," 节"]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:B=>B.stopPropagation(),onClick:B=>B.stopPropagation(),children:[o&&s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(z),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx(pn,{className:"w-3.5 h-3.5"})}),h&&s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(z),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx($t,{className:"w-3.5 h-3.5"})}),f&&s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(z),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(er,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",children:[X,"章"]}),O?s.jsx(od,{className:"w-5 h-5 text-gray-500"}):s.jsx(El,{className:"w-5 h-5 text-gray-500"})]})]}),O&&s.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:z.chapters.map(B=>{const oe=I("chapter",B.id);return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[s.jsxs("div",{draggable:!0,onDragStart:G=>{G.stopPropagation(),G.dataTransfer.setData("text/plain","chapter:"+B.id),G.dataTransfer.effectAllowed="move",k({type:"chapter",id:B.id})},onDragEnd:()=>{k(null),E(null)},onDragEnter:G=>{G.preventDefault(),G.stopPropagation(),G.dataTransfer.dropEffect="move",E({type:"chapter",id:B.id})},onDragOver:G=>{G.preventDefault(),G.stopPropagation(),G.dataTransfer.dropEffect="move",E({type:"chapter",id:B.id})},onDragLeave:()=>E(null),onDrop:G=>{E(null);const Q=kg(G.dataTransfer.getData("text/plain"));if(!Q)return;const se={partId:z.id,partTitle:z.title,chapterId:B.id,chapterTitle:B.title};(Q.type==="section"||Q.type==="chapter")&&_(G,"chapter",B.id,se)},className:`flex-1 min-w-0 py-2 px-2 rounded cursor-grab active:cursor-grabbing select-none -mx-2 transition-all duration-200 flex items-center gap-2 ${oe?"bg-[#38bdac]/15 ring-1 ring-[#38bdac]/50":""} ${A("chapter",B.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/30"}`,children:[s.jsx(fa,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),s.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:B.title})]}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:G=>G.stopPropagation(),children:[m&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>m(z,B),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx($t,{className:"w-3.5 h-3.5"})}),c&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>c(z),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx(pn,{className:"w-3.5 h-3.5"})}),u&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>u(z,B),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(er,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:B.sections.map(G=>{const Q=I("section",G.id);return s.jsxs("div",{draggable:!0,onDragStart:se=>{se.stopPropagation(),se.dataTransfer.setData("text/plain","section:"+G.id),se.dataTransfer.effectAllowed="move",k({type:"section",id:G.id})},onDragEnd:()=>{k(null),E(null)},className:`flex items-center justify-between py-2 px-3 rounded-lg group cursor-grab active:cursor-grabbing select-none min-h-[40px] transition-all duration-200 ${Q?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${A("section",G.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] shadow-lg":"hover:bg-[#162840]/50"}`,...P("section",G.id,{partId:z.id,partTitle:z.title,chapterId:B.id,chapterTitle:B.title}),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:se=>se.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(G.id),onChange:()=>y(G.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx(fa,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),s.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${G.price===0||G.isFree?"border-2 border-[#38bdac] bg-transparent":"bg-gray-500"}`}),s.jsxs("span",{className:"text-sm text-gray-200 truncate",children:[G.id," ",G.title]}),w.includes(G.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(xi,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:se=>se.stopPropagation(),onClick:se=>se.stopPropagation(),children:[G.isNew&&s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"NEW"}),G.price===0||G.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",G.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",title:"点击次数 · 付款笔数",children:["点击 ",G.clickCount??0," · 付款 ",G.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(G.hotScore??0).toFixed(1)," · 第",G.hotRank&&G.hotRank>0?G.hotRank:"-","名"]}),v&&s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>v(G),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5 shrink-0",children:"付款记录"}),s.jsxs("div",{className:"flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(G),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx($t,{className:"w-3.5 h-3.5"})}),s.jsx(ne,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(G),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(er,{className:"w-3.5 h-3.5"})})]})]})]},G.id)})})]},B.id)})})]},z.id)})})}function cV(t){var a;const e=new URLSearchParams;e.set("page",String(t.page)),e.set("limit",String(t.limit)),(a=t==null?void 0:t.keyword)!=null&&a.trim()&&e.set("keyword",t.keyword.trim());const n=e.toString(),r=n?`/api/admin/ckb/devices?${n}`:"/api/admin/ckb/devices";return De(r)}function dV(t){return De(`/api/db/person?personId=${encodeURIComponent(t)}`)}const $4=11,bw={personId:"",name:"",aliases:"",label:"",sceneId:$4,ckbApiKey:"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:"phone",remarkFormat:"",addFriendInterval:1,startTime:"09:00",endTime:"18:00",deviceGroups:""};function uV({open:t,onOpenChange:e,editingPerson:n,onSubmit:r}){const a=!!n,[i,o]=b.useState(bw),[c,u]=b.useState(!1),[h,f]=b.useState(!1),[m,g]=b.useState([]),[y,v]=b.useState(!1),[w,N]=b.useState(""),[k,C]=b.useState({});b.useEffect(()=>{t&&(N(""),o(n?{personId:n.personId??n.name??"",name:n.name??"",aliases:n.aliases??"",label:n.label??"",sceneId:$4,ckbApiKey:n.ckbApiKey??"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:n.remarkType??"phone",remarkFormat:n.remarkFormat??"",addFriendInterval:n.addFriendInterval??1,startTime:n.startTime??"09:00",endTime:n.endTime??"18:00",deviceGroups:n.deviceGroups??""}:{...bw}),C({}),m.length===0&&E(""))},[t,n]);const E=async I=>{v(!0);try{const D=await cV({page:1,limit:50,keyword:I});D!=null&&D.success&&Array.isArray(D.devices)?g(D.devices):D!=null&&D.error&&le.error(D.error)}catch(D){le.error(D instanceof Error?D.message:"加载设备列表失败")}finally{v(!1)}},A=async()=>{var P;const I={};(!i.name||!String(i.name).trim())&&(I.name="请填写名称");const D=i.addFriendInterval;if((typeof D!="number"||D<1)&&(I.addFriendInterval="添加间隔至少为 1 分钟"),(((P=i.deviceGroups)==null?void 0:P.split(",").map(L=>L.trim()).filter(Boolean))??[]).length===0&&(I.deviceGroups="请至少选择 1 台设备"),C(I),Object.keys(I).length>0){le.error(I.name||I.addFriendInterval||I.deviceGroups||"请完善必填项");return}u(!0);try{await r(i),e(!1)}catch(L){le.error(L instanceof Error?L.message:"保存失败")}finally{u(!1)}};return s.jsx(Ft,{open:t,onOpenChange:e,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-y-auto",children:[s.jsxs(Bt,{children:[s.jsx(Vt,{className:"text-[#38bdac]",children:a?"编辑人物":"添加人物 — 存客宝 API 获客"}),s.jsx(Jj,{className:"text-gray-400 text-sm",children:a?"修改后同步到存客宝计划":"添加时自动生成 token,并同步创建存客宝场景获客计划"})]}),s.jsxs("div",{className:"space-y-6 py-2",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium text-gray-400 uppercase tracking-wider mb-3",children:"基础信息"}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(te,{className:"text-gray-400 text-xs",children:["名称 ",s.jsx("span",{className:"text-red-400",children:"*"})]}),s.jsx(ie,{className:`bg-[#0a1628] text-white ${k.name?"border-red-500 focus-visible:ring-red-500":"border-gray-700"}`,placeholder:"如 卡若",value:i.name,onChange:I=>{o(D=>({...D,name:I.target.value})),k.name&&C(D=>({...D,name:void 0}))}}),k.name&&s.jsx("p",{className:"text-xs text-red-400",children:k.name})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"人物ID(可选)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"自动生成",value:i.personId,onChange:I=>o(D=>({...D,personId:I.target.value})),disabled:a})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"标签(身份/角色)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 超级个体",value:i.label,onChange:I=>o(D=>({...D,label:I.target.value}))})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"别名(逗号分隔,@ 可匹配)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 卡卡, 若若",value:i.aliases,onChange:I=>o(D=>({...D,aliases:I.target.value}))})]})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-5",children:[s.jsx("p",{className:"text-xs font-medium text-gray-400 uppercase tracking-wider mb-4",children:"存客宝 API 获客配置"}),s.jsxs("div",{className:"grid grid-cols-2 gap-x-8 gap-y-4",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"存客宝密钥(计划 apiKey)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"创建计划成功后自动回填,不可手动修改",value:i.ckbApiKey,readOnly:!0}),s.jsx("p",{className:"text-xs text-gray-500",children:"由存客宝计划详情接口返回的 apiKey,用于小程序 @人物 时推送到对应获客计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(te,{className:"text-gray-400 text-xs",children:["选择设备 ",s.jsx("span",{className:"text-red-400",children:"*"})]}),s.jsxs("div",{className:`flex gap-2 rounded-md border ${k.deviceGroups?"border-red-500":"border-gray-700"}`,children:[s.jsx(ie,{className:"bg-[#0a1628] border-0 text-white focus-visible:ring-0 focus-visible:ring-offset-0",placeholder:"未选择设备",readOnly:!0,value:i.deviceGroups?`已选择 ${i.deviceGroups.split(",").filter(Boolean).length} 个设备`:"",onClick:()=>f(!0)}),s.jsx(ne,{type:"button",variant:"outline",className:"border-0 border-l border-inherit rounded-r-md text-gray-200",onClick:()=>f(!0),children:"选择"})]}),k.deviceGroups?s.jsx("p",{className:"text-xs text-red-400",children:k.deviceGroups}):s.jsx("p",{className:"text-xs text-gray-500",children:"从存客宝设备列表中选择,至少选择 1 台设备参与获客计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"好友备注"}),s.jsxs(Sl,{value:i.remarkType,onValueChange:I=>o(D=>({...D,remarkType:I})),children:[s.jsx(fo,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(Cl,{placeholder:"选择备注类型"})}),s.jsxs(po,{children:[s.jsx(Dr,{value:"phone",children:"手机号"}),s.jsx(Dr,{value:"nickname",children:"昵称"}),s.jsx(Dr,{value:"source",children:"来源"})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"备注格式"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 手机号+SOUL链接人与事-{名称},留空用默认",value:i.remarkFormat,onChange:I=>o(D=>({...D,remarkFormat:I.target.value}))})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"打招呼语"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"你好,请通过",value:i.greeting,onChange:I=>o(D=>({...D,greeting:I.target.value}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"添加间隔(分钟)"}),s.jsx(ie,{type:"number",min:1,className:`bg-[#0a1628] text-white ${k.addFriendInterval?"border-red-500 focus-visible:ring-red-500":"border-gray-700"}`,value:i.addFriendInterval,onChange:I=>{o(D=>({...D,addFriendInterval:Number(I.target.value)||1})),k.addFriendInterval&&C(D=>({...D,addFriendInterval:void 0}))}}),k.addFriendInterval&&s.jsx("p",{className:"text-xs text-red-400",children:k.addFriendInterval})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"允许加人时间段"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ie,{type:"time",className:"bg-[#0a1628] border-gray-700 text-white w-24",value:i.startTime,onChange:I=>o(D=>({...D,startTime:I.target.value}))}),s.jsx("span",{className:"text-gray-500 text-sm shrink-0",children:"至"}),s.jsx(ie,{type:"time",className:"bg-[#0a1628] border-gray-700 text-white w-24",value:i.endTime,onChange:I=>o(D=>({...D,endTime:I.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"获客成功提示"}),s.jsx(Yl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[72px] resize-none",placeholder:"请注意消息,稍后加你微信",value:i.tips,onChange:I=>o(D=>({...D,tips:I.target.value}))})]})]})]})]})]}),s.jsxs(ln,{className:"gap-3 pt-2",children:[s.jsx(ne,{variant:"outline",onClick:()=>e(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(ne,{onClick:A,disabled:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:c?"保存中...":a?"保存":"添加"})]}),h&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",children:s.jsxs("div",{className:"w-full max-w-3xl max-h-[80vh] bg-[#0b1828] border border-gray-700 rounded-xl shadow-xl flex flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-gray-700/60",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-medium text-white",children:"选择设备"}),s.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"勾选需要参与本计划的设备,可多选"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ie,{className:"bg-[#050c18] border-gray-700 text-white h-8 w-52",placeholder:"搜索备注/微信号/IMEI",value:w,onChange:I=>N(I.target.value),onKeyDown:I=>{I.key==="Enter"&&E(w)}}),s.jsx(ne,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-200 h-8",onClick:()=>E(w),disabled:y,children:"刷新"}),s.jsx(ne,{type:"button",size:"icon",variant:"outline",className:"border-gray-600 text-gray-300 h-8 w-8",onClick:()=>f(!1),children:"✕"})]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:y?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-400 text-sm",children:"正在加载设备列表…"}):m.length===0?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-500 text-sm",children:"暂无设备数据,请检查存客宝账号与开放 API 配置"}):s.jsx("div",{className:"p-4 space-y-2",children:m.map(I=>{const D=String(I.id??""),_=i.deviceGroups?i.deviceGroups.split(",").map(z=>z.trim()).filter(Boolean):[],P=_.includes(D),L=()=>{let z;P?z=_.filter(ee=>ee!==D):z=[..._,D],o(ee=>({...ee,deviceGroups:z.join(",")})),z.length>0&&C(ee=>({...ee,deviceGroups:void 0}))};return s.jsxs("label",{className:"flex items-center gap-3 rounded-lg border border-gray-700/60 bg-[#050c18] px-3 py-2 cursor-pointer hover:border-[#38bdac]/70",children:[s.jsx("input",{type:"checkbox",className:"h-4 w-4 accent-[#38bdac]",checked:P,onChange:L}),s.jsxs("div",{className:"flex flex-col min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-white truncate max-w-xs",children:I.memo||I.wechatId||`设备 ${D}`}),I.status==="online"&&s.jsx("span",{className:"rounded-full bg-emerald-500/20 text-emerald-400 text-[11px] px-2 py-0.5",children:"在线"}),I.status==="offline"&&s.jsx("span",{className:"rounded-full bg-gray-600/20 text-gray-400 text-[11px] px-2 py-0.5",children:"离线"})]}),s.jsxs("div",{className:"text-[11px] text-gray-400 mt-0.5",children:[s.jsxs("span",{className:"mr-3",children:["ID: ",D]}),I.wechatId&&s.jsxs("span",{className:"mr-3",children:["微信号: ",I.wechatId]}),typeof I.totalFriend=="number"&&s.jsxs("span",{children:["好友数: ",I.totalFriend]})]})]})]},D)})})}),s.jsxs("div",{className:"flex justify-between items-center px-5 py-3 border-t border-gray-700/60",children:[s.jsxs("span",{className:"text-xs text-gray-400",children:["已选择"," ",i.deviceGroups?i.deviceGroups.split(",").filter(Boolean).length:0," ","台设备"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ne,{type:"button",variant:"outline",className:"border-gray-600 text-gray-200 h-8 px-4",onClick:()=>f(!1),children:"取消"}),s.jsx(ne,{type:"button",className:"bg-[#38bdac] hover:bg-[#2da396] text-white h-8 px-4",onClick:()=>f(!1),children:"确定"})]})]})]})})]})})}function vw(t,e,n){if(!t||!t.includes("@")&&!t.includes("@")&&!t.includes("#")||typeof document>"u")return t;const r=document.createElement("div");r.innerHTML=t;const a=h=>h.trim().toLowerCase(),i=new Map;for(const h of e){const f=[h.name,...h.aliases?h.aliases.split(","):[]].map(m=>a(m)).filter(Boolean);for(const m of f)i.has(m)||i.set(m,h)}const o=new Map;for(const h of n){const f=[h.label,...h.aliases?h.aliases.split(","):[]].map(m=>a(m)).filter(Boolean);for(const m of f)o.has(m)||o.set(m,h)}const c=h=>{const f=h.textContent||"";if(!f||!f.includes("@")&&!f.includes("@")&&!f.includes("#"))return;const m=h.parentNode;if(!m)return;const g=document.createDocumentFragment(),y=/([@@][^\s@#@#]+|#[^\s@#@#]+)/g;let v=0,w;for(;w=y.exec(f);){const[N]=w,k=w.index;if(k>v&&g.appendChild(document.createTextNode(f.slice(v,k))),N.startsWith("@")||N.startsWith("@")){const C=i.get(a(N.slice(1)));if(C){const E=document.createElement("span");E.setAttribute("data-type","mention"),E.setAttribute("data-id",C.id),E.setAttribute("data-label",C.name),E.className="mention-tag",E.textContent=`@${C.name}`,g.appendChild(E)}else g.appendChild(document.createTextNode(N))}else if(N.startsWith("#")){const C=o.get(a(N.slice(1)));if(C){const E=document.createElement("span");E.setAttribute("data-type","linkTag"),E.setAttribute("data-url",C.url||""),E.setAttribute("data-tag-type",C.type||"url"),E.setAttribute("data-tag-id",C.id||""),E.setAttribute("data-page-path",C.pagePath||""),E.setAttribute("data-app-id",C.appId||""),C.type==="miniprogram"&&C.appId&&E.setAttribute("data-mp-key",C.appId),E.className="link-tag-node",E.textContent=`#${C.label}`,g.appendChild(E)}else g.appendChild(document.createTextNode(N))}else g.appendChild(document.createTextNode(N));v=k+N.length}v{if(h.nodeType===Node.ELEMENT_NODE){const m=h.getAttribute("data-type");if(m==="mention"||m==="linkTag")return;h.childNodes.forEach(g=>u(g));return}h.nodeType===Node.TEXT_NODE&&c(h)};return r.childNodes.forEach(h=>u(h)),r.innerHTML}function hV(t){const e=new Map;for(const c of t){const u=c.partId||"part-1",h=c.partTitle||"未分类",f=c.chapterId||"chapter-1",m=c.chapterTitle||"未分类";e.has(u)||e.set(u,{id:u,title:h,chapters:new Map});const g=e.get(u);g.chapters.has(f)||g.chapters.set(f,{id:f,title:m,sections:[]}),g.chapters.get(f).sections.push({id:c.id,title:c.title,price:c.price??1,filePath:c.filePath,isFree:c.isFree,isNew:c.isNew,clickCount:c.clickCount??0,payCount:c.payCount??0,hotScore:c.hotScore??0,hotRank:c.hotRank??0})}const n="part-2026-daily",r="2026每日派对干货";Array.from(e.values()).some(c=>c.title===r||c.title.includes(r))||e.set(n,{id:n,title:r,chapters:new Map([["chapter-2026-daily",{id:"chapter-2026-daily",title:r,sections:[]}]])});const i=Array.from(e.values()).map(c=>({...c,chapters:Array.from(c.chapters.values())})),o=c=>c.includes("序言")?0:c.includes(r)?1.5:c.includes("附录")?2:c.includes("尾声")?3:1;return i.sort((c,u)=>{const h=o(c.title),f=o(u.title);return h!==f?h-f:0})}function fV(){var cs,ds,us;const[t,e]=b.useState([]),[n,r]=b.useState(!0),[a,i]=b.useState([]),[o,c]=b.useState(null),[u,h]=b.useState(!1),[f,m]=b.useState(!1),[g,y]=b.useState(!1),[v,w]=b.useState(""),[N,k]=b.useState([]),[C,E]=b.useState(!1),[A,I]=b.useState({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),[D,_]=b.useState(null),[P,L]=b.useState(!1),[z,ee]=b.useState(!1),[U,he]=b.useState(null),[me,R]=b.useState(!1),[O,X]=b.useState([]),[$,ce]=b.useState(!1),[Y,F]=b.useState(""),[W,K]=b.useState(""),[B,oe]=b.useState(!1),[G,Q]=b.useState(""),[se,ye]=b.useState(!1),[Me,Be]=b.useState(null),[He,gt]=b.useState(!1),[Dt,jn]=b.useState(!1),[it,Mt]=b.useState({readWeight:50,recencyWeight:30,payWeight:20}),[re,Pe]=b.useState(!1),[et,xt]=b.useState(!1),[ft,pt]=b.useState(1),[wt,Qt]=b.useState([]),[Lt,An]=b.useState(!1),[At,Kn]=b.useState([]),[rs,or]=b.useState(!1),[ge,Ne]=b.useState(20),[qn,Es]=b.useState(!1),[Ts,Pa]=b.useState(!1),[br,Vi]=b.useState([]),[vr,lr]=b.useState([]),[Ms,Oa]=b.useState(!1),[Hi,Xs]=b.useState(null),[Nt,Gn]=b.useState({tagId:"",label:"",aliases:"",url:"",type:"url",appId:"",pagePath:""}),[Da,As]=b.useState(null),Nr=b.useRef(null),[Wi,Zs]=b.useState({}),[nc,Jn]=b.useState(!1),[ea,ss]=b.useState(""),[Ar,La]=b.useState(""),[ta,Ui]=b.useState([]),[cr,Ki]=b.useState(0),[as,rc]=b.useState(1),[Vo,qi]=b.useState(!1),un=hV(t),is=t.length,Is=10,_a=Math.max(1,Math.ceil(wt.length/Is)),It=wt.slice((ft-1)*Is,ft*Is),zn=async()=>{r(!0);try{const T=await De("/api/db/book?action=list",{cache:"no-store"});e(Array.isArray(T==null?void 0:T.sections)?T.sections:[])}catch(T){console.error(T),e([])}finally{r(!1)}},Vr=async()=>{An(!0);try{const T=await De("/api/db/book?action=ranking",{cache:"no-store"}),q=Array.isArray(T==null?void 0:T.sections)?T.sections:[];Qt(q);const ue=q.filter(fe=>fe.isPinned).map(fe=>fe.id);Kn(ue)}catch(T){console.error(T),Qt([])}finally{An(!1)}};b.useEffect(()=>{zn(),Vr()},[]);const Ho=T=>{i(q=>q.includes(T)?q.filter(ue=>ue!==T):[...q,T])},za=b.useCallback(T=>{const q=t,ue=T.flatMap(fe=>{const nt=q.find(yt=>yt.id===fe.id);return nt?[{...nt,partId:fe.partId,partTitle:fe.partTitle,chapterId:fe.chapterId,chapterTitle:fe.chapterTitle}]:[]});return e(ue),Tt("/api/db/book",{action:"reorder",items:T}).then(fe=>{fe&&fe.success===!1&&(e(q),le.error("排序失败: "+(fe&&typeof fe=="object"&&"error"in fe?fe.error:"未知错误")))}).catch(fe=>{e(q),console.error("排序失败:",fe),le.error("排序失败: "+(fe instanceof Error?fe.message:"网络或服务异常"))}),Promise.resolve()},[t]),sc=async T=>{if(confirm(`确定要删除章节「${T.title}」吗?此操作不可恢复。`))try{const q=await wa(`/api/db/book?id=${encodeURIComponent(T.id)}`);q&&q.success!==!1?(le.success("已删除"),zn(),Vr()):le.error("删除失败: "+(q&&typeof q=="object"&&"error"in q?q.error:"未知错误"))}catch(q){console.error(q),le.error("删除失败")}},Gi=b.useCallback(async()=>{Pe(!0);try{const T=await De("/api/db/config/full?key=article_ranking_weights",{cache:"no-store"}),q=T&&T.data;q&&typeof q.readWeight=="number"&&typeof q.recencyWeight=="number"&&typeof q.payWeight=="number"&&Mt({readWeight:Math.round(q.readWeight*100),recencyWeight:Math.round(q.recencyWeight*100),payWeight:Math.round(q.payWeight*100)})}catch{}finally{Pe(!1)}},[]);b.useEffect(()=>{Dt&&Gi()},[Dt,Gi]);const $a=async()=>{const{readWeight:T,recencyWeight:q,payWeight:ue}=it,fe=T+q+ue;if(Math.abs(fe-100)>1){le.error("三个权重之和必须等于 100%");return}xt(!0);try{const nt=await vt("/api/db/config",{key:"article_ranking_weights",value:{readWeight:T/100,recencyWeight:q/100,payWeight:ue/100},description:"文章排名算法权重"});nt&&nt.success!==!1?(le.success("排名权重已保存,排行榜已刷新"),zn(),Vr()):le.error("保存失败: "+(nt&&typeof nt=="object"&&"error"in nt?nt.error:""))}catch(nt){console.error(nt),le.error("保存失败")}finally{xt(!1)}},dr=b.useCallback(async()=>{or(!0);try{const T=await De("/api/db/config/full?key=pinned_section_ids",{cache:"no-store"}),q=T&&T.data;Array.isArray(q)&&Kn(q)}catch{}finally{or(!1)}},[]),Hr=b.useCallback(async()=>{try{const T=await De("/api/db/persons");T!=null&&T.success&&T.persons&&Vi(T.persons.map(q=>{const ue=q.deviceGroups,fe=Array.isArray(ue)?ue.join(","):ue??"";return{id:q.token??q.personId??"",personId:q.personId,name:q.name,aliases:q.aliases??"",label:q.label??"",ckbApiKey:q.ckbApiKey??"",ckbPlanId:q.ckbPlanId,remarkType:q.remarkType,remarkFormat:q.remarkFormat,addFriendInterval:q.addFriendInterval,startTime:q.startTime,endTime:q.endTime,deviceGroups:fe}}))}catch{}},[]),$n=b.useCallback(async T=>{const q=T==null?void 0:T.trim();if(!q)return null;try{const ue=await vt("/api/db/persons",{name:q});if(!(ue!=null&&ue.success)||!ue.person)return null;const fe=ue.person;return Hr(),{id:fe.token??fe.personId??"",personId:fe.personId,name:fe.name??q,label:fe.label??""}}catch{return le.error("创建人物失败"),null}},[Hr]),Wo=b.useCallback(async()=>{try{const T=await De("/api/db/ckb-person-leads");if(T!=null&&T.success&&T.byPerson){const q={};for(const ue of T.byPerson)q[ue.token]=ue.total;Zs(q)}}catch{}},[]),Fa=b.useCallback(async(T,q,ue=1)=>{ss(T),La(q),Jn(!0),rc(ue),qi(!0);try{const fe=await De(`/api/db/ckb-person-leads?token=${encodeURIComponent(T)}&page=${ue}&pageSize=20`);fe!=null&&fe.success&&(Ui(fe.records||[]),Ki(fe.total||0),fe.personName&&La(fe.personName))}catch{}finally{qi(!1)}},[]),na=b.useCallback(async()=>{try{const T=await De("/api/db/link-tags");T!=null&&T.success&&T.linkTags&&lr(T.linkTags.map(q=>({id:q.tagId,label:q.label,aliases:q.aliases??"",url:q.url,type:q.type||"url",appId:q.appId||"",pagePath:q.pagePath||""})))}catch{}},[]),Rs=async T=>{const q=At.includes(T)?At.filter(ue=>ue!==T):[...At,T];Kn(q);try{await vt("/api/db/config",{key:"pinned_section_ids",value:q,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"}),Vr()}catch{Kn(At)}},Ps=b.useCallback(async()=>{Es(!0);try{const T=await De("/api/db/config/full?key=unpaid_preview_percent",{cache:"no-store"}),q=T&&T.data;typeof q=="number"&&q>0&&q<=100&&Ne(q)}catch{}finally{Es(!1)}},[]),Os=async()=>{if(ge<1||ge>100){le.error("预览比例需在 1~100 之间");return}Pa(!0);try{const T=await vt("/api/db/config",{key:"unpaid_preview_percent",value:ge,description:"小程序未付费内容默认预览比例(%)"});T&&T.success!==!1?le.success("预览比例已保存"):le.error("保存失败: "+(T.error||""))}catch{le.error("保存失败")}finally{Pa(!1)}};b.useEffect(()=>{dr(),Ps(),Hr(),na(),Wo()},[dr,Ps,Hr,na,Wo]);const Ds=async T=>{Be({section:T,orders:[]}),gt(!0);try{const q=await De(`/api/db/book?action=section-orders&id=${encodeURIComponent(T.id)}`),ue=q!=null&&q.success&&Array.isArray(q.orders)?q.orders:[];Be(fe=>fe?{...fe,orders:ue}:null)}catch(q){console.error(q),Be(ue=>ue?{...ue,orders:[]}:null)}finally{gt(!1)}},V=async T=>{m(!0);try{const q=await De(`/api/db/book?action=read&id=${encodeURIComponent(T.id)}`);if(q!=null&&q.success&&q.section){const ue=q.section,fe=ue.editionPremium===!0;c({id:T.id,originalId:T.id,title:q.section.title??T.title,price:q.section.price??T.price,content:q.section.content??"",filePath:T.filePath,isFree:T.isFree||T.price===0,isNew:ue.isNew??T.isNew,isPinned:At.includes(T.id),hotScore:T.hotScore??0,editionStandard:fe?!1:ue.editionStandard??!0,editionPremium:fe,previewPercent:ue.previewPercent??null})}else c({id:T.id,originalId:T.id,title:T.title,price:T.price,content:"",filePath:T.filePath,isFree:T.isFree,isNew:T.isNew,isPinned:At.includes(T.id),hotScore:T.hotScore??0,editionStandard:!0,editionPremium:!1,previewPercent:null}),q&&!q.success&&le.error("无法读取文件内容: "+(q.error||"未知错误"))}catch(q){console.error(q),c({id:T.id,title:T.title,price:T.price,content:"",filePath:T.filePath,isFree:T.isFree})}finally{m(!1)}},Ae=async()=>{var T;if(o){y(!0);try{let q=o.content||"";q=vw(q,br,vr);const ue=[new RegExp(`^#+\\s*${o.id.replace(".","\\.")}\\s+.*$`,"gm"),new RegExp(`^#+\\s*${o.id.replace(".","\\.")}[::].*$`,"gm"),new RegExp(`^#\\s+.*${(T=o.title)==null?void 0:T.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const Ls of ue)q=q.replace(Ls,"");q=q.replace(/^\s*\n+/,"").trim();const fe=o.originalId||o.id,nt=o.id!==fe,yt=o.previewPercent,In=yt!=null&&yt!==0&&Number(yt)>=1&&Number(yt)<=100,hn=await Tt("/api/db/book",{id:fe,...nt?{newId:o.id}:{},title:o.title,price:o.isFree?0:o.price,content:q,isFree:o.isFree||o.price===0,isNew:o.isNew,hotScore:o.hotScore,editionStandard:o.editionPremium?!1:o.editionStandard??!0,editionPremium:o.editionPremium??!1,...In?{previewPercent:Number(yt)}:{clearPreviewPercent:!0},saveToFile:!0}),sa=nt?o.id:fe;o.isPinned!==At.includes(sa)&&await Rs(sa),hn&&hn.success!==!1?(le.success(`已保存:${o.title}`),c(null),zn()):le.error("保存失败: "+(hn&&typeof hn=="object"&&"error"in hn?hn.error:"未知错误"))}catch(q){console.error(q),le.error("保存失败")}finally{y(!1)}}},Ye=async()=>{if(!A.id||!A.title){le.error("请填写章节ID和标题");return}y(!0);try{const T=un.find(fe=>fe.id===A.partId),q=T==null?void 0:T.chapters.find(fe=>fe.id===A.chapterId),ue=await Tt("/api/db/book",{id:A.id,title:A.title,price:A.isFree?0:A.price,content:vw(A.content||"",br,vr),partId:A.partId,partTitle:(T==null?void 0:T.title)??"",chapterId:A.chapterId,chapterTitle:(q==null?void 0:q.title)??"",isFree:A.isFree,isNew:A.isNew,editionStandard:A.editionPremium?!1:A.editionStandard??!0,editionPremium:A.editionPremium??!1,hotScore:A.hotScore??0,saveToFile:!1});if(ue&&ue.success!==!1){if(A.isPinned){const fe=[...At,A.id];Kn(fe);try{await vt("/api/db/config",{key:"pinned_section_ids",value:fe,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"})}catch{}}le.success(`章节创建成功:${A.title}`),h(!1),I({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),zn()}else le.error("创建失败: "+(ue&&typeof ue=="object"&&"error"in ue?ue.error:"未知错误"))}catch(T){console.error(T),le.error("创建失败")}finally{y(!1)}},ct=T=>{I(q=>{var ue;return{...q,partId:T.id,chapterId:((ue=T.chapters[0])==null?void 0:ue.id)??"chapter-1"}}),h(!0)},xn=T=>{_({id:T.id,title:T.title})},kn=async()=>{var T;if((T=D==null?void 0:D.title)!=null&&T.trim()){L(!0);try{const q=t.map(fe=>({id:fe.id,partId:fe.partId||"part-1",partTitle:fe.partId===D.id?D.title.trim():fe.partTitle||"",chapterId:fe.chapterId||"chapter-1",chapterTitle:fe.chapterTitle||""})),ue=await Tt("/api/db/book",{action:"reorder",items:q});if(ue&&ue.success!==!1){const fe=D.title.trim();e(nt=>nt.map(yt=>yt.partId===D.id?{...yt,partTitle:fe}:yt)),_(null),zn()}else le.error("更新篇名失败: "+(ue&&typeof ue=="object"&&"error"in ue?ue.error:"未知错误"))}catch(q){console.error(q),le.error("更新篇名失败")}finally{L(!1)}}},Uo=T=>{const q=T.chapters.length+1,ue=`chapter-${T.id}-${q}-${Date.now()}`;I({id:`${q}.1`,title:"新章节",price:1,partId:T.id,chapterId:ue,content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),h(!0)},Xt=(T,q)=>{he({part:T,chapter:q,title:q.title})},st=async()=>{var T;if((T=U==null?void 0:U.title)!=null&&T.trim()){R(!0);try{const q=t.map(fe=>({id:fe.id,partId:fe.partId||U.part.id,partTitle:fe.partId===U.part.id?U.part.title:fe.partTitle||"",chapterId:fe.chapterId||U.chapter.id,chapterTitle:fe.partId===U.part.id&&fe.chapterId===U.chapter.id?U.title.trim():fe.chapterTitle||""})),ue=await Tt("/api/db/book",{action:"reorder",items:q});if(ue&&ue.success!==!1){const fe=U.title.trim(),nt=U.part.id,yt=U.chapter.id;e(In=>In.map(hn=>hn.partId===nt&&hn.chapterId===yt?{...hn,chapterTitle:fe}:hn)),he(null),zn()}else le.error("保存失败: "+(ue&&typeof ue=="object"&&"error"in ue?ue.error:"未知错误"))}catch(q){console.error(q),le.error("保存失败")}finally{R(!1)}}},Ba=async(T,q)=>{const ue=q.sections.map(fe=>fe.id);if(ue.length===0){le.info("该章下无小节,无需删除");return}if(confirm(`确定要删除「第${T.chapters.indexOf(q)+1}章 | ${q.title}」吗?将删除共 ${ue.length} 节,此操作不可恢复。`))try{for(const fe of ue)await wa(`/api/db/book?id=${encodeURIComponent(fe)}`);zn()}catch(fe){console.error(fe),le.error("删除失败")}},Va=async()=>{if(!G.trim()){le.error("请输入篇名");return}ye(!0);try{const T=`part-new-${Date.now()}`,q="chapter-1",ue=`part-placeholder-${Date.now()}`,fe=await Tt("/api/db/book",{id:ue,title:"占位节(可编辑)",price:0,content:"",partId:T,partTitle:G.trim(),chapterId:q,chapterTitle:"第1章 | 待编辑",saveToFile:!1});fe&&fe.success!==!1?(le.success(`篇「${G}」创建成功`),ee(!1),Q(""),zn()):le.error("创建失败: "+(fe&&typeof fe=="object"&&"error"in fe?fe.error:"未知错误"))}catch(T){console.error(T),le.error("创建失败")}finally{ye(!1)}},ls=async()=>{if(O.length===0){le.error("请先勾选要移动的章节");return}const T=un.find(ue=>ue.id===Y),q=T==null?void 0:T.chapters.find(ue=>ue.id===W);if(!T||!q||!Y||!W){le.error("请选择目标篇和章");return}oe(!0);try{const ue=()=>{const In=new Set(O),hn=t.map(rn=>({id:rn.id,partId:rn.partId||"",partTitle:rn.partTitle||"",chapterId:rn.chapterId||"",chapterTitle:rn.chapterTitle||""})),sa=hn.filter(rn=>In.has(rn.id)).map(rn=>({...rn,partId:Y,partTitle:T.title||Y,chapterId:W,chapterTitle:q.title||W})),Ls=hn.filter(rn=>!In.has(rn.id));let ac=Ls.length;for(let rn=Ls.length-1;rn>=0;rn-=1){const Ha=Ls[rn];if(Ha.partId===Y&&Ha.chapterId===W){ac=rn+1;break}}return[...Ls.slice(0,ac),...sa,...Ls.slice(ac)]},fe=async()=>{const In=ue(),hn=await Tt("/api/db/book",{action:"reorder",items:In});return hn&&hn.success!==!1?(le.success(`已移动 ${O.length} 节到「${T.title}」-「${q.title}」`),ce(!1),X([]),await zn(),!0):!1},nt={action:"move-sections",sectionIds:O,targetPartId:Y,targetChapterId:W,targetPartTitle:T.title||Y,targetChapterTitle:q.title||W},yt=await Tt("/api/db/book",nt);if(yt&&yt.success!==!1)le.success(`已移动 ${yt.count??O.length} 节到「${T.title}」-「${q.title}」`),ce(!1),X([]),await zn();else{const In=yt&&typeof yt=="object"&&"error"in yt?yt.error||"":"未知错误";if((In.includes("缺少 id")||In.includes("无效的 action"))&&await fe())return;le.error("移动失败: "+In)}}catch(ue){console.error(ue),le.error("移动失败: "+(ue instanceof Error?ue.message:"网络或服务异常"))}finally{oe(!1)}},Ko=T=>{X(q=>q.includes(T)?q.filter(ue=>ue!==T):[...q,T])},qo=async T=>{const q=t.filter(ue=>ue.partId===T.id).map(ue=>ue.id);if(q.length===0){le.info("该篇下暂无小节可删除");return}if(confirm(`确定要删除「${T.title}」整篇吗?将删除共 ${q.length} 节内容,此操作不可恢复。`))try{for(const ue of q)await wa(`/api/db/book?id=${encodeURIComponent(ue)}`);zn()}catch(ue){console.error(ue),le.error("删除失败")}},ra=async()=>{var T;if(v.trim()){E(!0);try{const q=await De(`/api/search?q=${encodeURIComponent(v)}`);q!=null&&q.success&&((T=q.data)!=null&&T.results)?k(q.data.results):(k([]),q&&!q.success&&le.error("搜索失败: "+q.error))}catch(q){console.error(q),k([]),le.error("搜索失败")}finally{E(!1)}}},Ji=un.find(T=>T.id===A.partId),Yi=(Ji==null?void 0:Ji.chapters)??[];return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"内容管理"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",un.length," 篇 · ",is," 节内容"]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(ne,{onClick:()=>jn(!0),variant:"outline",className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:[s.jsx(Iu,{className:"w-4 h-4 mr-2"}),"排名算法"]}),s.jsxs(ne,{onClick:()=>{const T=typeof window<"u"?`${window.location.origin}/api-doc`:"";T&&window.open(T,"_blank","noopener,noreferrer")},variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ns,{className:"w-4 h-4 mr-2"}),"API 接口"]})]})]}),s.jsx(Ft,{open:u,onOpenChange:h,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] flex flex-col p-0 gap-0",showCloseButton:!0,children:[s.jsx(Bt,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(pn,{className:"w-5 h-5 text-[#38bdac]"}),"新建章节"]})}),s.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"章节ID *"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 9.15",value:A.id,onChange:T=>I({...A,id:T.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"价格 (元)"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:A.isFree?0:A.price,onChange:T=>I({...A,price:Number(T.target.value),isFree:Number(T.target.value)===0}),disabled:A.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"免费"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:A.isFree,onChange:T=>I({...A,isFree:T.target.checked,price:T.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"最新新增"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:A.isNew,onChange:T=>I({...A,isNew:T.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"小程序直推"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:A.isPinned,onChange:T=>I({...A,isPinned:T.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"文章类型"}),s.jsxs("div",{className:"flex items-center gap-4 h-10",children:[s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"new-edition-type",checked:A.editionPremium!==!0,onChange:()=>I({...A,editionStandard:!0,editionPremium:!1}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"普通版"})]}),s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"new-edition-type",checked:A.editionPremium===!0,onChange:()=>I({...A,editionStandard:!1,editionPremium:!0}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"增值版"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"热度分"}),s.jsx(ie,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:A.hotScore??0,onChange:T=>I({...A,hotScore:Math.max(0,parseFloat(T.target.value)||0)})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"章节标题 *"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入章节标题",value:A.title,onChange:T=>I({...A,title:T.target.value})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"所属篇"}),s.jsxs(Sl,{value:A.partId,onValueChange:T=>{var ue;const q=un.find(fe=>fe.id===T);I({...A,partId:T,chapterId:((ue=q==null?void 0:q.chapters[0])==null?void 0:ue.id)??"chapter-1"})},children:[s.jsx(fo,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(Cl,{})}),s.jsxs(po,{className:"bg-[#0f2137] border-gray-700",children:[un.map(T=>s.jsx(Dr,{value:T.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:T.title},T.id)),un.length===0&&s.jsx(Dr,{value:"part-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认篇"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"所属章"}),s.jsxs(Sl,{value:A.chapterId,onValueChange:T=>I({...A,chapterId:T}),children:[s.jsx(fo,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(Cl,{})}),s.jsxs(po,{className:"bg-[#0f2137] border-gray-700",children:[Yi.map(T=>s.jsx(Dr,{value:T.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:T.title},T.id)),Yi.length===0&&s.jsx(Dr,{value:"chapter-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认章"})]})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),s.jsx(Ax,{content:A.content||"",onChange:T=>I({...A,content:T}),onImageUpload:async T=>{var nt;const q=new FormData;q.append("file",T),q.append("folder","book-images");const fe=await(await fetch(ja("/api/upload"),{method:"POST",body:q,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((nt=fe==null?void 0:fe.data)==null?void 0:nt.url)||(fe==null?void 0:fe.url)||""},onVideoUpload:async T=>{var nt;const q=new FormData;q.append("file",T),q.append("folder","book-videos");const fe=await(await fetch(ja("/api/upload/video"),{method:"POST",body:q,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((nt=fe==null?void 0:fe.data)==null?void 0:nt.url)||(fe==null?void 0:fe.url)||""},persons:br,linkTags:vr,onPersonCreate:$n,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(ln,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[s.jsx(ne,{variant:"outline",onClick:()=>h(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(ne,{onClick:Ye,disabled:g||!A.id||!A.title,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),s.jsx(Ft,{open:!!D,onOpenChange:T=>!T&&_(null),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx($t,{className:"w-5 h-5 text-[#38bdac]"}),"编辑篇名"]})}),D&&s.jsx("div",{className:"space-y-4 py-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"篇名"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:D.title,onChange:T=>_({...D,title:T.target.value}),placeholder:"输入篇名"})]})}),s.jsxs(ln,{children:[s.jsx(ne,{variant:"outline",onClick:()=>_(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(ne,{onClick:kn,disabled:P||!((cs=D==null?void 0:D.title)!=null&&cs.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:P?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Ft,{open:!!U,onOpenChange:T=>!T&&he(null),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx($t,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节名称"]})}),U&&s.jsx("div",{className:"space-y-4 py-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"章节名称(如:第8章|底层结构)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:U.title,onChange:T=>he({...U,title:T.target.value}),placeholder:"输入章节名称"})]})}),s.jsxs(ln,{children:[s.jsx(ne,{variant:"outline",onClick:()=>he(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(ne,{onClick:st,disabled:me||!((ds=U==null?void 0:U.title)!=null&&ds.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:me?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Ft,{open:$,onOpenChange:T=>{var q;if(ce(T),T&&un.length>0){const ue=un[0];F(ue.id),K(((q=ue.chapters[0])==null?void 0:q.id)??"")}},children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Bt,{children:s.jsx(Vt,{className:"text-white",children:"批量移动至指定目录"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["已选 ",s.jsx("span",{className:"text-[#38bdac] font-medium",children:O.length})," 节,请选择目标篇与章。"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"目标篇"}),s.jsxs(Sl,{value:Y,onValueChange:T=>{var ue;F(T);const q=un.find(fe=>fe.id===T);K(((ue=q==null?void 0:q.chapters[0])==null?void 0:ue.id)??"")},children:[s.jsx(fo,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(Cl,{placeholder:"选择篇"})}),s.jsx(po,{className:"bg-[#0f2137] border-gray-700",children:un.map(T=>s.jsx(Dr,{value:T.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:T.title},T.id))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"目标章"}),s.jsxs(Sl,{value:W,onValueChange:K,children:[s.jsx(fo,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(Cl,{placeholder:"选择章"})}),s.jsx(po,{className:"bg-[#0f2137] border-gray-700",children:(((us=un.find(T=>T.id===Y))==null?void 0:us.chapters)??[]).map(T=>s.jsx(Dr,{value:T.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:T.title},T.id))})]})]})]}),s.jsxs(ln,{children:[s.jsx(ne,{variant:"outline",onClick:()=>ce(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(ne,{onClick:ls,disabled:B||O.length===0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:B?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-2 animate-spin"}),"移动中..."]}):"确认移动"})]})]})}),s.jsx(Ft,{open:!!Me,onOpenChange:T=>!T&&Be(null),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",showCloseButton:!0,children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white",children:["付款记录 — ",(Me==null?void 0:Me.section.title)??""]})}),s.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:He?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):Me&&Me.orders.length===0?s.jsx("p",{className:"text-gray-500 text-center py-6",children:"暂无付款记录"}):Me?s.jsxs("table",{className:"w-full text-sm border-collapse",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-700 text-left text-gray-400",children:[s.jsx("th",{className:"py-2 pr-2",children:"订单号"}),s.jsx("th",{className:"py-2 pr-2",children:"用户ID"}),s.jsx("th",{className:"py-2 pr-2",children:"金额"}),s.jsx("th",{className:"py-2 pr-2",children:"状态"}),s.jsx("th",{className:"py-2 pr-2",children:"支付时间"})]})}),s.jsx("tbody",{children:Me.orders.map(T=>s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("td",{className:"py-2 pr-2",children:s.jsx("button",{className:"text-blue-400 hover:text-blue-300 hover:underline text-left truncate max-w-[180px] block",title:`查看订单 ${T.orderSn}`,onClick:()=>window.open(`/orders?search=${T.orderSn??T.id??""}`,"_blank"),children:T.orderSn?T.orderSn.length>16?T.orderSn.slice(0,8)+"..."+T.orderSn.slice(-6):T.orderSn:"-"})}),s.jsx("td",{className:"py-2 pr-2",children:s.jsx("button",{className:"text-[#38bdac] hover:text-[#2da396] hover:underline text-left truncate max-w-[140px] block",title:`查看用户 ${T.userId??T.openId??""}`,onClick:()=>window.open(`/users?search=${T.userId??T.openId??""}`,"_blank"),children:(()=>{const q=T.userId??T.openId??"-";return q.length>12?q.slice(0,6)+"..."+q.slice(-4):q})()})}),s.jsxs("td",{className:"py-2 pr-2 text-gray-300",children:["¥",T.amount??0]}),s.jsx("td",{className:"py-2 pr-2 text-gray-300",children:T.status??"-"}),s.jsx("td",{className:"py-2 pr-2 text-gray-500",children:T.payTime??T.createdAt??"-"})]},T.id??T.orderSn??""))})]}):null})]})}),s.jsx(Ft,{open:Dt,onOpenChange:jn,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(Iu,{className:"w-5 h-5 text-amber-400"}),"文章排名算法"]})}),s.jsxs("div",{className:"space-y-4 py-2",children:[s.jsx("p",{className:"text-sm text-gray-400",children:"排名积分制:三个维度各取前20名(第1名=20分,第20名=1分),乘以权重后求和(三权重之和须为 100%)"}),re?s.jsx("p",{className:"text-gray-500",children:"加载中..."}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"阅读权重 (%)"}),s.jsx(ie,{type:"number",step:"5",min:"0",max:"100",className:"bg-[#0a1628] border-gray-700 text-white",value:it.readWeight,onChange:T=>Mt(q=>({...q,readWeight:Math.max(0,Math.min(100,parseInt(T.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"新度权重 (%)"}),s.jsx(ie,{type:"number",step:"5",min:"0",max:"100",className:"bg-[#0a1628] border-gray-700 text-white",value:it.recencyWeight,onChange:T=>Mt(q=>({...q,recencyWeight:Math.max(0,Math.min(100,parseInt(T.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"付款权重 (%)"}),s.jsx(ie,{type:"number",step:"5",min:"0",max:"100",className:"bg-[#0a1628] border-gray-700 text-white",value:it.payWeight,onChange:T=>Mt(q=>({...q,payWeight:Math.max(0,Math.min(100,parseInt(T.target.value)||0))}))})]})]}),s.jsxs("p",{className:`text-xs ${Math.abs(it.readWeight+it.recencyWeight+it.payWeight-100)>1?"text-red-400":"text-green-400"}`,children:["当前之和: ",it.readWeight+it.recencyWeight+it.payWeight,"%",Math.abs(it.readWeight+it.recencyWeight+it.payWeight-100)>1?"(须为 100%)":" ✓"]}),s.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs text-gray-400",children:[s.jsx("li",{children:"阅读量排名前20:第1名=20分 → 第20名=1分,其余0分"}),s.jsx("li",{children:"新度排名前20(按最近更新):同理20→1分"}),s.jsx("li",{children:"付款量排名前20:同理20→1分"}),s.jsx("li",{children:"热度 = 阅读排名分 × 阅读权重% + 新度排名分 × 新度权重% + 付款排名分 × 付款权重%"})]}),s.jsx(ne,{onClick:$a,disabled:et||Math.abs(it.readWeight+it.recencyWeight+it.payWeight-100)>1,className:"w-full bg-amber-500 hover:bg-amber-600 text-white",children:et?"保存中...":"保存权重"})]})]})]})}),s.jsx(Ft,{open:z,onOpenChange:ee,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(pn,{className:"w-5 h-5 text-amber-400"}),"新建篇"]})}),s.jsx("div",{className:"space-y-4 py-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"篇名(如:第六篇|真实的社会)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:G,onChange:T=>Q(T.target.value),placeholder:"输入篇名"})]})}),s.jsxs(ln,{children:[s.jsx(ne,{variant:"outline",onClick:()=>{ee(!1),Q("")},className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(ne,{onClick:Va,disabled:se||!G.trim(),className:"bg-amber-500 hover:bg-amber-600 text-white",children:se?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"创建篇"]})})]})]})}),s.jsx(Ft,{open:!!o,onOpenChange:()=>c(null),children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] flex flex-col p-0 gap-0",showCloseButton:!0,children:[s.jsx(Bt,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx($t,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节"]})}),o&&s.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"章节ID"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:o.id,onChange:T=>c({...o,id:T.target.value}),placeholder:"如: 9.15"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"价格 (元)"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.isFree?0:o.price,onChange:T=>c({...o,price:Number(T.target.value),isFree:Number(T.target.value)===0}),disabled:o.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"免费"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:o.isFree||o.price===0,onChange:T=>c({...o,isFree:T.target.checked,price:T.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"最新新增"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:o.isNew??!1,onChange:T=>c({...o,isNew:T.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"小程序直推"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:o.isPinned??!1,onChange:T=>c({...o,isPinned:T.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"文章类型"}),s.jsxs("div",{className:"flex items-center gap-4 h-10",children:[s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"edition-type",checked:o.editionPremium!==!0,onChange:()=>c({...o,editionStandard:!0,editionPremium:!1}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"普通版"})]}),s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"edition-type",checked:o.editionPremium===!0,onChange:()=>c({...o,editionStandard:!1,editionPremium:!0}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"增值版"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"热度分"}),s.jsx(ie,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:o.hotScore??0,onChange:T=>c({...o,hotScore:Math.max(0,parseFloat(T.target.value)||0)})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"预览比例 (%)"}),s.jsx(ie,{type:"number",min:"1",max:"100",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"默认使用全局设置",value:o.previewPercent!=null&&o.previewPercent>=1&&o.previewPercent<=100?String(o.previewPercent):"",onChange:T=>{const q=T.target.value.trim(),ue=q===""?null:parseInt(q,10);c({...o,previewPercent:q!==""&&ue!==null&&!isNaN(ue)&&ue>=1&&ue<=100?ue:null})}}),s.jsx("span",{className:"text-xs text-gray-500",children:"未付费用户可见前 N% 内容,留空使用全局设置"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"章节标题"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:o.title,onChange:T=>c({...o,title:T.target.value})})]}),o.filePath&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"文件路径"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-gray-400 text-sm",value:o.filePath,disabled:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),f?s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700 rounded-md min-h-[400px] flex items-center justify-center",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(Ax,{ref:Nr,content:o.content||"",onChange:T=>c({...o,content:T}),onImageUpload:async T=>{var nt;const q=new FormData;q.append("file",T),q.append("folder","book-images");const fe=await(await fetch(ja("/api/upload"),{method:"POST",body:q,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((nt=fe==null?void 0:fe.data)==null?void 0:nt.url)||(fe==null?void 0:fe.url)||""},onVideoUpload:async T=>{var nt;const q=new FormData;q.append("file",T),q.append("folder","book-videos");const fe=await(await fetch(ja("/api/upload/video"),{method:"POST",body:q,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((nt=fe==null?void 0:fe.data)==null?void 0:nt.url)||(fe==null?void 0:fe.url)||""},persons:br,linkTags:vr,onPersonCreate:$n,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(ln,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[o&&s.jsxs(ne,{variant:"outline",onClick:()=>Ds({id:o.id,title:o.title,price:o.price}),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent mr-auto",children:[s.jsx($r,{className:"w-4 h-4 mr-2"}),"付款记录"]}),s.jsxs(ne,{variant:"outline",onClick:()=>c(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(nr,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsx(ne,{onClick:Ae,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:g?s.jsxs(s.Fragment,{children:[s.jsx(Ue,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),s.jsxs(Cd,{defaultValue:"chapters",className:"space-y-6",children:[s.jsxs(Jl,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(tn,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx($r,{className:"w-4 h-4 mr-2"}),"章节管理"]}),s.jsxs(tn,{value:"ranking",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(zg,{className:"w-4 h-4 mr-2"}),"内容排行榜"]}),s.jsxs(tn,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(Sa,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),s.jsxs(tn,{value:"link-person",className:"data-[state=active]:bg-purple-500/20 data-[state=active]:text-purple-400 text-gray-400",children:[s.jsx(Ns,{className:"w-4 h-4 mr-2"}),"链接人与事"]}),s.jsxs(tn,{value:"link-tag",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(Hv,{className:"w-4 h-4 mr-2"}),"链接标签"]})]}),s.jsxs(nn,{value:"chapters",className:"space-y-4",children:[s.jsxs("div",{className:"rounded-2xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between shadow-sm",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac] flex items-center justify-center text-white shadow-lg shadow-[#38bdac]/20 shrink-0",children:s.jsx($r,{className:"w-6 h-6"})}),s.jsxs("div",{children:[s.jsx("h2",{className:"font-bold text-base text-white leading-tight mb-1",children:"一场SOUL的创业实验场"}),s.jsx("p",{className:"text-xs text-gray-500",children:"来自Soul派对房的真实商业故事"})]})]}),s.jsxs("div",{className:"text-center shrink-0",children:[s.jsx("span",{className:"block text-2xl font-bold text-[#38bdac]",children:is}),s.jsx("span",{className:"text-xs text-gray-500",children:"章节"})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(ne,{onClick:()=>h(!0),className:"flex-1 min-w-[120px] bg-[#38bdac]/10 hover:bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/30",children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"新建章节"]}),s.jsxs(ne,{onClick:()=>ee(!0),className:"flex-1 min-w-[120px] bg-amber-500/10 hover:bg-amber-500/20 text-amber-400 border border-amber-500/30",children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"新建篇"]}),s.jsxs(ne,{variant:"outline",onClick:()=>ce(!0),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:["批量移动(已选 ",O.length," 节)"]})]}),n?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(lV,{parts:un,expandedParts:a,onTogglePart:Ho,onReorder:za,onReadSection:V,onDeleteSection:sc,onAddSectionInPart:ct,onAddChapterInPart:Uo,onDeleteChapter:Ba,onEditPart:xn,onDeletePart:qo,onEditChapter:Xt,selectedSectionIds:O,onToggleSectionSelect:Ko,onShowSectionOrders:Ds,pinnedSectionIds:At})]}),s.jsx(nn,{value:"search",className:"space-y-4",children:s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(qe,{children:s.jsx(Ge,{className:"text-white",children:"内容搜索"})}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",placeholder:"搜索标题或内容...",value:v,onChange:T=>w(T.target.value),onKeyDown:T=>T.key==="Enter"&&ra()}),s.jsx(ne,{onClick:ra,disabled:C||!v.trim(),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:C?s.jsx(Ue,{className:"w-4 h-4 animate-spin"}):s.jsx(Sa,{className:"w-4 h-4"})})]}),N.length>0&&s.jsxs("div",{className:"space-y-2 mt-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["找到 ",N.length," 个结果"]}),N.filter(T=>T.matchType==="title").length>0&&s.jsxs("div",{children:[s.jsx("p",{className:"text-amber-400 text-sm font-medium mb-2",children:"标题匹配"}),N.filter(T=>T.matchType==="title").slice(0,3).map(T=>s.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors mb-2",onClick:()=>V({id:T.id,title:T.title,price:T.price??1,filePath:""}),children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[#38bdac] font-mono text-xs",children:T.id}),s.jsx("span",{className:"text-white",children:T.title}),At.includes(T.id)&&s.jsx(xi,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})]})}),(T.partTitle||T.chapterTitle)&&s.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[T.partTitle," · ",T.chapterTitle]})]},T.id))]}),N.filter(T=>T.matchType==="content").length>0&&s.jsxs("div",{className:"mt-4",children:[s.jsx("p",{className:"text-gray-400 text-sm font-medium mb-2",children:"内容匹配"}),N.filter(T=>T.matchType==="content").map(T=>s.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors mb-2",onClick:()=>V({id:T.id,title:T.title,price:T.price??1,filePath:""}),children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[#38bdac] font-mono text-xs",children:T.id}),s.jsx("span",{className:"text-white",children:T.title}),At.includes(T.id)&&s.jsx(xi,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})]})}),T.snippet&&s.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:T.snippet}),(T.partTitle||T.chapterTitle)&&s.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[T.partTitle," · ",T.chapterTitle]})]},T.id))]})]})]})]})}),s.jsxs(nn,{value:"ranking",className:"space-y-4",children:[s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(qe,{className:"pb-3",children:s.jsxs(Ge,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Iu,{className:"w-4 h-4 text-[#38bdac]"}),"内容显示规则"]})}),s.jsx(Ce,{children:s.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(te,{className:"text-gray-400 text-sm whitespace-nowrap",children:"未付费预览比例"}),s.jsx(ie,{type:"number",min:"1",max:"100",className:"bg-[#0a1628] border-gray-700 text-white w-20",value:ge,onChange:T=>Ne(Math.max(1,Math.min(100,Number(T.target.value)||20))),disabled:qn}),s.jsx("span",{className:"text-gray-500 text-sm",children:"%"})]}),s.jsx(ne,{size:"sm",onClick:Os,disabled:Ts,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:Ts?"保存中...":"保存"}),s.jsxs("span",{className:"text-xs text-gray-500",children:["小程序未付费用户默认显示文章前 ",ge,"% 内容"]})]})})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(qe,{className:"pb-3",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs(Ge,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(zg,{className:"w-4 h-4 text-amber-400"}),"内容排行榜",s.jsxs("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["按热度排行 · 共 ",wt.length," 节"]})]}),s.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>Vr(),disabled:Lt,className:"text-gray-400 hover:text-white h-7 w-7 p-0",title:"刷新排行榜",children:s.jsx(Ue,{className:`w-4 h-4 ${Lt?"animate-spin":""}`})}),s.jsx(ne,{variant:"ghost",size:"sm",disabled:ft<=1||Lt,onClick:()=>pt(T=>Math.max(1,T-1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(JT,{className:"w-4 h-4"})}),s.jsxs("span",{className:"text-gray-400 min-w-[60px] text-center",children:[ft," / ",_a]}),s.jsx(ne,{variant:"ghost",size:"sm",disabled:ft>=_a||Lt,onClick:()=>pt(T=>Math.min(_a,T+1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(El,{className:"w-4 h-4"})})]})]})}),s.jsx(Ce,{children:s.jsxs("div",{className:"space-y-0",children:[s.jsxs("div",{className:"grid grid-cols-[40px_40px_1fr_80px_80px_80px_60px] gap-2 px-3 py-2 text-xs text-gray-500 border-b border-gray-700/50",children:[s.jsx("span",{children:"排名"}),s.jsx("span",{children:"置顶"}),s.jsx("span",{children:"标题"}),s.jsx("span",{className:"text-right",children:"点击量"}),s.jsx("span",{className:"text-right",children:"付款数"}),s.jsx("span",{className:"text-right",children:"热度"}),s.jsx("span",{className:"text-right",children:"编辑"})]}),It.map((T,q)=>{const ue=(ft-1)*Is+q+1,fe=T.isPinned??At.includes(T.id);return s.jsxs("div",{className:`grid grid-cols-[40px_40px_1fr_80px_80px_80px_60px] gap-2 px-3 py-2.5 items-center border-b border-gray-700/30 hover:bg-[#162840] transition-colors ${fe?"bg-amber-500/5":""}`,children:[s.jsx("span",{className:`text-sm font-bold ${ue<=3?"text-amber-400":"text-gray-500"}`,children:ue<=3?["🥇","🥈","🥉"][ue-1]:`#${ue}`}),s.jsx(ne,{variant:"ghost",size:"sm",className:`h-6 w-6 p-0 ${fe?"text-amber-400":"text-gray-600 hover:text-amber-400"}`,onClick:()=>Rs(T.id),disabled:rs,title:fe?"取消置顶":"强制置顶(精选推荐/首页最新更新)",children:fe?s.jsx(xi,{className:"w-3.5 h-3.5 fill-current"}):s.jsx(NA,{className:"w-3.5 h-3.5"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"text-white text-sm truncate block",children:T.title}),s.jsxs("span",{className:"text-gray-600 text-xs",children:[T.partTitle," · ",T.chapterTitle]})]}),s.jsx("span",{className:"text-right text-sm text-blue-400 font-mono",children:T.clickCount??0}),s.jsx("span",{className:"text-right text-sm text-green-400 font-mono",children:T.payCount??0}),s.jsx("span",{className:"text-right text-sm text-amber-400 font-mono",children:(T.hotScore??0).toFixed(1)}),s.jsx("div",{className:"text-right",children:s.jsx(ne,{variant:"ghost",size:"sm",className:"text-gray-500 hover:text-[#38bdac] h-6 px-1",onClick:()=>V({id:T.id,title:T.title,price:T.price,filePath:""}),title:"编辑文章",children:s.jsx($t,{className:"w-3 h-3"})})})]},T.id)}),It.length===0&&s.jsx("div",{className:"py-8 text-center text-gray-500",children:"暂无数据"})]})})]})]}),s.jsxs(nn,{value:"link-person",className:"space-y-4",children:[s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{className:"pb-3",children:[s.jsxs(Ge,{className:"text-white text-base flex items-center gap-2",children:[s.jsx("span",{className:"text-[#38bdac] text-lg font-bold",children:"@"}),"AI列表 — 链接人与事(编辑器内输入 @ 可链接)"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"添加时自动生成 32 位 token,文章 @ 时存 token;小程序点击 @ 时用 token 兑换真实密钥后加好友"})]}),s.jsxs(Ce,{className:"space-y-3",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("p",{className:"text-xs text-gray-500",children:"添加人物时同步创建存客宝场景获客计划,配置与存客宝 API 获客一致"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ne,{size:"sm",variant:"outline",className:"border-amber-600 text-amber-400 hover:bg-amber-900/30 bg-transparent",onClick:async()=>{try{const T=await vt("/api/db/persons/fix-ckb",{});T!=null&&T.success?(alert(`修复完成:${T.fixed}/${T.total} 个人物已补充 CKB 密钥`),Hr()):alert("修复失败")}catch{alert("修复请求失败")}},children:"修复 CKB 密钥"}),s.jsxs(ne,{size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",onClick:()=>{Xs(null),Oa(!0)},children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"添加"]})]})]}),s.jsxs("div",{className:"space-y-1 max-h-[400px] overflow-y-auto",children:[br.length>0&&s.jsxs("div",{className:"flex items-center gap-4 px-3 py-1.5 text-xs text-gray-500 border-b border-gray-700/50",children:[s.jsx("span",{className:"w-[200px] shrink-0",children:"token"}),s.jsx("span",{className:"w-24 shrink-0",children:"@的人"}),s.jsx("span",{className:"w-28 shrink-0",children:"别名"}),s.jsx("span",{className:"w-16 shrink-0 text-center",children:"获客数"}),s.jsx("span",{children:"获客计划活动名"})]}),br.map(T=>{const q=Wi[T.id]||0;return s.jsxs("div",{className:"bg-[#0a1628] rounded px-3 py-2 flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-4 text-sm min-w-0",children:[s.jsx("span",{className:"text-gray-400 text-xs font-mono shrink-0 w-[200px] truncate",title:T.id,children:T.id}),s.jsx("span",{className:"text-amber-400 shrink-0 w-24 truncate",title:"@的人",children:T.name}),s.jsx("span",{className:"text-gray-500 shrink-0 w-28 truncate text-xs",title:"别名",children:T.aliases||"-"}),s.jsx("span",{className:`shrink-0 w-16 text-center text-xs font-bold ${q>0?"text-green-400":"text-gray-600"}`,title:"获客数",children:q}),s.jsxs("span",{className:"text-white truncate",title:"获客计划活动名",children:["SOUL链接人与事-",T.name]})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(ne,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-[#38bdac] h-6 px-2",title:"编辑",onClick:async()=>{try{const ue=await dV(T.personId||"");if(ue!=null&&ue.success&&ue.person){const fe=ue.person;Xs({id:fe.token??fe.personId,personId:fe.personId,name:fe.name,aliases:fe.aliases??"",label:fe.label??"",ckbApiKey:fe.ckbApiKey??"",remarkType:fe.remarkType,remarkFormat:fe.remarkFormat,addFriendInterval:fe.addFriendInterval,startTime:fe.startTime,endTime:fe.endTime,deviceGroups:fe.deviceGroups})}else Xs(T),ue!=null&&ue.error&&le.error(ue.error)}catch(ue){console.error(ue),Xs(T),le.error(ue instanceof Error?ue.message:"加载人物详情失败")}Oa(!0)},children:s.jsx(mA,{className:"w-3 h-3"})}),s.jsx(ne,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-green-400 h-6 px-2",title:"查看获客详情",onClick:()=>Fa(T.id,T.name),children:s.jsx(Mn,{className:"w-3 h-3"})}),s.jsx(ne,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-amber-400 h-6 px-2",title:"编辑计划(跳转存客宝)",onClick:()=>{const ue=T.ckbPlanId;ue?window.open(`https://h5.ckb.quwanzhi.com/#/scenarios/edit/${ue}`,"_blank"):le.info("该人物尚未同步存客宝计划,请先保存后等待同步完成")},children:s.jsx(Ks,{className:"w-3 h-3"})}),s.jsx(ne,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",title:"删除(同时删除存客宝对应获客计划)",onClick:async()=>{confirm(`确定删除「SOUL链接人与事-${T.name}」?将同时删除存客宝对应获客计划。`)&&(await wa(`/api/db/persons?personId=${T.personId}`),Hr())},children:s.jsx(nr,{className:"w-3 h-3"})})]})]},T.id)}),br.length===0&&s.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无AI人物,添加后可在编辑器中 @链接"})]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{className:"pb-3",children:[s.jsxs(Ge,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Iu,{className:"w-4 h-4 text-green-400"}),"存客宝绑定"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"配置存客宝 API 后,文章中 @人物 或 #标签 点击可自动进入存客宝流量池"})]}),s.jsxs(Ce,{className:"space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"存客宝 API 地址"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8",placeholder:"https://ckbapi.quwanzhi.com",defaultValue:"https://ckbapi.quwanzhi.com",readOnly:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"绑定计划"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8",placeholder:"创业实验-内容引流",defaultValue:"创业实验-内容引流",readOnly:!0})]})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["具体存客宝场景配置与接口测试请前往"," ",s.jsx("button",{className:"text-[#38bdac] hover:underline",onClick:()=>window.open("/match","_blank"),children:"找伙伴 → 存客宝工作台"})]})]})]})]}),s.jsx(nn,{value:"link-tag",className:"space-y-4",children:s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{className:"pb-3",children:[s.jsxs(Ge,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Hv,{className:"w-4 h-4 text-amber-400"}),"链接标签 — 链接事与物(编辑器内 #标签 可跳转链接/小程序/存客宝)"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"小程序端点击 #标签 可直接跳转对应链接,进入流量池"})]}),s.jsxs(Ce,{className:"space-y-3",children:[s.jsxs("div",{className:"flex gap-2 items-end flex-wrap",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"标签ID"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-24",placeholder:"如 team01",value:Nt.tagId,onChange:T=>Gn({...Nt,tagId:T.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"显示文字"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-28",placeholder:"如 神仙团队",value:Nt.label,onChange:T=>Gn({...Nt,label:T.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"别名"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-28",placeholder:"逗号分隔",value:Nt.aliases,onChange:T=>Gn({...Nt,aliases:T.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"类型"}),s.jsxs(Sl,{value:Nt.type,onValueChange:T=>Gn({...Nt,type:T}),children:[s.jsx(fo,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-24",children:s.jsx(Cl,{})}),s.jsxs(po,{children:[s.jsx(Dr,{value:"url",children:"网页链接"}),s.jsx(Dr,{value:"miniprogram",children:"小程序"}),s.jsx(Dr,{value:"ckb",children:"存客宝"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:Nt.type==="url"?"URL地址":Nt.type==="ckb"?"存客宝计划URL":"AppID"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-44",placeholder:Nt.type==="url"?"https://...":Nt.type==="ckb"?"https://ckbapi.quwanzhi.com/...":"wx...",value:Nt.type==="url"||Nt.type==="ckb"?Nt.url:Nt.appId,onChange:T=>{Nt.type==="url"||Nt.type==="ckb"?Gn({...Nt,url:T.target.value}):Gn({...Nt,appId:T.target.value})}})]}),Nt.type==="miniprogram"&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"页面路径"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-36",placeholder:"pages/index/index",value:Nt.pagePath,onChange:T=>Gn({...Nt,pagePath:T.target.value})})]}),s.jsxs(ne,{size:"sm",className:"bg-amber-500 hover:bg-amber-600 text-white h-8",onClick:async()=>{if(!Nt.tagId||!Nt.label){le.error("标签ID和显示文字必填");return}const T={...Nt};T.type==="miniprogram"&&(T.url=""),await vt("/api/db/link-tags",T),Gn({tagId:"",label:"",aliases:"",url:"",type:"url",appId:"",pagePath:""}),As(null),na()},children:[s.jsx(pn,{className:"w-3 h-3 mr-1"}),Da?"保存":"添加"]})]}),s.jsxs("div",{className:"space-y-1 max-h-[400px] overflow-y-auto",children:[vr.map(T=>s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded px-3 py-2",children:[s.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[s.jsxs("button",{type:"button",className:"text-amber-400 font-bold text-base hover:underline",onClick:()=>{Gn({tagId:T.id,label:T.label,aliases:T.aliases??"",url:T.url,type:T.type,appId:T.appId??"",pagePath:T.pagePath??""}),As(T.id)},children:["#",T.label]}),s.jsx(Ke,{variant:"secondary",className:`text-[10px] ${T.type==="ckb"?"bg-green-500/20 text-green-300 border-green-500/30":"bg-gray-700 text-gray-300"}`,children:T.type==="url"?"网页":T.type==="ckb"?"存客宝":"小程序"}),T.type==="miniprogram"?s.jsxs("span",{className:"text-gray-400 text-xs font-mono",children:[T.appId," ",T.pagePath?`· ${T.pagePath}`:""]}):T.url?s.jsxs("a",{href:T.url,target:"_blank",rel:"noreferrer",className:"text-blue-400 text-xs truncate max-w-[250px] hover:underline flex items-center gap-1",children:[T.url," ",s.jsx(Ks,{className:"w-3 h-3 shrink-0"})]}):null]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ne,{variant:"ghost",size:"sm",className:"text-gray-300 hover:text-white h-6 px-2",onClick:()=>{Gn({tagId:T.id,label:T.label,aliases:T.aliases??"",url:T.url,type:T.type,appId:T.appId??"",pagePath:T.pagePath??""}),As(T.id)},children:"编辑"}),s.jsx(ne,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",onClick:async()=>{await wa(`/api/db/link-tags?tagId=${T.id}`),Da===T.id&&(As(null),Gn({tagId:"",label:"",aliases:"",url:"",type:"url",appId:"",pagePath:""})),na()},children:s.jsx(nr,{className:"w-3 h-3"})})]})]},T.id)),vr.length===0&&s.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无链接标签,添加后可在编辑器中使用 #标签 跳转"})]})]})]})})]}),s.jsx(uV,{open:Ms,onOpenChange:Oa,editingPerson:Hi,onSubmit:async T=>{var fe;const q={personId:T.personId||T.name.toLowerCase().replace(/\s+/g,"_")+"_"+Date.now().toString(36),name:T.name,aliases:T.aliases||void 0,label:T.label,ckbApiKey:T.ckbApiKey||void 0,greeting:T.greeting||void 0,tips:T.tips||void 0,remarkType:T.remarkType||void 0,remarkFormat:T.remarkFormat||void 0,addFriendInterval:T.addFriendInterval,startTime:T.startTime||void 0,endTime:T.endTime||void 0,deviceGroups:(fe=T.deviceGroups)!=null&&fe.trim()?T.deviceGroups.split(",").map(nt=>parseInt(nt.trim(),10)).filter(nt=>!Number.isNaN(nt)):void 0},ue=await vt("/api/db/persons",q);if(ue&&ue.success===!1){const nt=ue;nt.ckbResponse&&console.log("存客宝返回",nt.ckbResponse);const yt=nt.error||"操作失败";throw new Error(yt)}if(Hr(),le.success(Hi?"已保存":"已添加"),ue!=null&&ue.ckbCreateResult&&Object.keys(ue.ckbCreateResult).length>0){const nt=ue.ckbCreateResult;console.log("存客宝创建结果",nt);const yt=nt.planId??nt.id,In=yt!=null?[`planId: ${yt}`]:[];nt.apiKey!=null&&In.push("apiKey: ***"),le.info(In.length?`存客宝创建结果:${In.join(",")}`:"存客宝创建结果见控制台")}}}),s.jsx(Ft,{open:nc,onOpenChange:Jn,children:s.jsxs(Rt,{className:"max-w-2xl bg-[#0f2137] border-gray-700",children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(Mn,{className:"w-5 h-5 text-green-400"}),Ar," — 获客详情(共 ",cr," 条)"]})}),s.jsx("div",{className:"max-h-[450px] overflow-y-auto space-y-2",children:Vo?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(Ue,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):ta.length===0?s.jsx("div",{className:"text-gray-500 text-sm py-8 text-center",children:"暂无获客记录"}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-[60px_1fr_100px_100px_80px_120px] gap-2 px-3 py-1.5 text-xs text-gray-500 border-b border-gray-700/50",children:[s.jsx("span",{children:"#"}),s.jsx("span",{children:"昵称/姓名"}),s.jsx("span",{children:"手机"}),s.jsx("span",{children:"微信"}),s.jsx("span",{children:"来源"}),s.jsx("span",{children:"时间"})]}),ta.map((T,q)=>s.jsxs("div",{className:"grid grid-cols-[60px_1fr_100px_100px_80px_120px] gap-2 px-3 py-2 bg-[#0a1628] rounded text-sm",children:[s.jsx("span",{className:"text-gray-500 text-xs",children:(as-1)*20+q+1}),s.jsx("span",{className:"text-white truncate",children:T.nickname||T.name||T.userId||"-"}),s.jsx("span",{className:"text-gray-300 text-xs",children:T.phone||"-"}),s.jsx("span",{className:"text-gray-300 text-xs truncate",children:T.wechatId||"-"}),s.jsx("span",{className:"text-gray-500 text-xs",children:T.source==="article_mention"?"文章@":T.source==="index_lead"?"首页":T.source||"-"}),s.jsx("span",{className:"text-gray-500 text-xs",children:T.createdAt?new Date(T.createdAt).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"-"})]},T.id))]})}),cr>20&&s.jsxs("div",{className:"flex items-center justify-center gap-2 pt-2",children:[s.jsx(ne,{size:"sm",variant:"outline",disabled:as<=1,onClick:()=>Fa(ea,Ar,as-1),className:"border-gray-600 text-gray-300 bg-transparent h-7 px-3",children:"上一页"}),s.jsxs("span",{className:"text-gray-400 text-xs",children:[as," / ",Math.ceil(cr/20)]}),s.jsx(ne,{size:"sm",variant:"outline",disabled:as>=Math.ceil(cr/20),onClick:()=>Fa(ea,Ar,as+1),className:"border-gray-600 text-gray-300 bg-transparent h-7 px-3",children:"下一页"})]})]})})]})}const Na={name:"卡若",avatar:"K",avatarImg:"",title:"Soul派对房主理人 · 私域运营专家",bio:'每天早上6点到9点,在Soul派对房分享真实的创业故事。专注私域运营与项目变现,用"云阿米巴"模式帮助创业者构建可持续的商业体系。',stats:[{label:"商业案例",value:"62"},{label:"连续直播",value:"365天"},{label:"派对分享",value:"1000+"}],highlights:["5年私域运营经验","帮助100+品牌从0到1增长","连续创业者,擅长商业模式设计"]};function Nw(t){return Array.isArray(t)?t.map(e=>e&&typeof e=="object"&&"label"in e&&"value"in e?{label:String(e.label),value:String(e.value)}:{label:"",value:""}).filter(e=>e.label||e.value):Na.stats}function ww(t){return Array.isArray(t)?t.map(e=>typeof e=="string"?e:String(e??"")).filter(Boolean):Na.highlights}function pV(){const[t,e]=b.useState(Na),[n,r]=b.useState(!0),[a,i]=b.useState(!1),[o,c]=b.useState(!1),u=b.useRef(null);b.useEffect(()=>{De("/api/admin/author-settings").then(k=>{const C=k==null?void 0:k.data;C&&typeof C=="object"&&e({name:String(C.name??Na.name),avatar:String(C.avatar??Na.avatar),avatarImg:String(C.avatarImg??""),title:String(C.title??Na.title),bio:String(C.bio??Na.bio),stats:Nw(C.stats).length?Nw(C.stats):Na.stats,highlights:ww(C.highlights).length?ww(C.highlights):Na.highlights})}).catch(console.error).finally(()=>r(!1))},[]);const h=async()=>{i(!0);try{const k={name:t.name,avatar:t.avatar||"K",avatarImg:t.avatarImg,title:t.title,bio:t.bio,stats:t.stats.filter(A=>A.label||A.value),highlights:t.highlights.filter(Boolean)},C=await vt("/api/admin/author-settings",k);if(!C||C.success===!1){le.error("保存失败: "+(C&&typeof C=="object"&&"error"in C?C.error:""));return}i(!1);const E=document.createElement("div");E.className="fixed top-4 right-4 z-50 px-4 py-2 rounded-lg bg-[#38bdac] text-white text-sm shadow-lg",E.textContent="作者设置已保存",document.body.appendChild(E),setTimeout(()=>E.remove(),2e3)}catch(k){console.error(k),le.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{i(!1)}},f=async k=>{var E;const C=(E=k.target.files)==null?void 0:E[0];if(C){c(!0);try{const A=new FormData;A.append("file",C),A.append("folder","avatars");const I=Kx(),D={};I&&(D.Authorization=`Bearer ${I}`);const P=await(await fetch(ja("/api/upload"),{method:"POST",body:A,credentials:"include",headers:D})).json();P!=null&&P.success&&(P!=null&&P.url)?e(L=>({...L,avatarImg:P.url})):le.error("上传失败: "+((P==null?void 0:P.error)||"未知错误"))}catch(A){console.error(A),le.error("上传失败")}finally{c(!1),u.current&&(u.current.value="")}}},m=()=>e(k=>({...k,stats:[...k.stats,{label:"",value:""}]})),g=k=>e(C=>({...C,stats:C.stats.filter((E,A)=>A!==k)})),y=(k,C,E)=>e(A=>({...A,stats:A.stats.map((I,D)=>D===k?{...I,[C]:E}:I)})),v=()=>e(k=>({...k,highlights:[...k.highlights,""]})),w=k=>e(C=>({...C,highlights:C.highlights.filter((E,A)=>A!==k)})),N=(k,C)=>e(E=>({...E,highlights:E.highlights.map((A,I)=>I===k?C:A)}));return n?s.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(No,{className:"w-5 h-5 text-[#38bdac]"}),"作者详情"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置小程序「关于作者」页展示的作者信息,包括头像、简介、统计数据与亮点标签。"})]}),s.jsxs(ne,{onClick:h,disabled:a||n,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"flex items-center gap-2 text-white",children:[s.jsx(No,{className:"w-4 h-4 text-[#38bdac]"}),"基本信息"]}),s.jsx(Ht,{className:"text-gray-400",children:"作者姓名、头像、头衔与个人简介,将展示在「关于作者」页顶部。"})]}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"姓名"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.name,onChange:k=>e(C=>({...C,name:k.target.value})),placeholder:"卡若"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"首字母占位(无头像时显示)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white w-20",value:t.avatar,onChange:k=>e(C=>({...C,avatar:k.target.value.slice(0,1)||"K"})),placeholder:"K"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Xw,{className:"w-3 h-3 text-[#38bdac]"}),"头像图片"]}),s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ie,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:t.avatarImg,onChange:k=>e(C=>({...C,avatarImg:k.target.value})),placeholder:"上传或粘贴 URL,如 /uploads/avatars/xxx.png"}),s.jsx("input",{ref:u,type:"file",accept:"image/*",className:"hidden",onChange:f}),s.jsxs(ne,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:o,onClick:()=>{var k;return(k=u.current)==null?void 0:k.click()},children:[s.jsx(mh,{className:"w-4 h-4 mr-2"}),o?"上传中...":"上传"]})]}),t.avatarImg&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:ns(t.avatarImg.startsWith("http")?t.avatarImg:ja(t.avatarImg)),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"头衔"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.title,onChange:k=>e(C=>({...C,title:k.target.value})),placeholder:"Soul派对房主理人 · 私域运营专家"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"个人简介"}),s.jsx(Yl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[120px]",value:t.bio,onChange:k=>e(C=>({...C,bio:k.target.value})),placeholder:"每天早上6点到9点..."})]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsx(Ge,{className:"text-white",children:"统计数据"}),s.jsx(Ht,{className:"text-gray-400",children:"展示在作者卡片中的数字指标,如「商业案例 62」「连续直播 365天」。第一个「商业案例」的值可由书籍统计自动更新。"})]}),s.jsxs(Ce,{className:"space-y-3",children:[t.stats.map((k,C)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ie,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.label,onChange:E=>y(C,"label",E.target.value),placeholder:"标签"}),s.jsx(ie,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.value,onChange:E=>y(C,"value",E.target.value),placeholder:"数值"}),s.jsx(ne,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>g(C),children:s.jsx(nr,{className:"w-4 h-4"})})]},C)),s.jsxs(ne,{variant:"outline",size:"sm",onClick:m,className:"border-gray-600 text-gray-400",children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"添加统计项"]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsx(Ge,{className:"text-white",children:"亮点标签"}),s.jsx(Ht,{className:"text-gray-400",children:"作者优势或成就的简短描述,以标签形式展示。"})]}),s.jsxs(Ce,{className:"space-y-3",children:[t.highlights.map((k,C)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ie,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k,onChange:E=>N(C,E.target.value),placeholder:"5年私域运营经验"}),s.jsx(ne,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>w(C),children:s.jsx(nr,{className:"w-4 h-4"})})]},C)),s.jsxs(ne,{variant:"outline",size:"sm",onClick:v,className:"border-gray-600 text-gray-400",children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"添加亮点"]})]})]})]})]})}function mV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o]=b.useState(10),[c,u]=b.useState(0),[h,f]=b.useState(""),m=o0(h,300),[g,y]=b.useState(!0),[v,w]=b.useState(null),[N,k]=b.useState(!1),[C,E]=b.useState(null),[A,I]=b.useState(""),[D,_]=b.useState(""),[P,L]=b.useState(""),[z,ee]=b.useState("admin"),[U,he]=b.useState("active"),[me,R]=b.useState(!1);async function O(){var W;y(!0),w(null);try{const K=new URLSearchParams({page:String(a),pageSize:String(o)});m.trim()&&K.set("search",m.trim());const B=await De(`/api/admin/users?${K}`);B!=null&&B.success?(e(B.records||[]),r(B.total??0),u(B.totalPages??0)):w(B.error||"加载失败")}catch(K){const B=K;w(B.status===403?"无权限访问":((W=B==null?void 0:B.data)==null?void 0:W.error)||"加载失败"),e([])}finally{y(!1)}}b.useEffect(()=>{O()},[a,o,m]);const X=()=>{E(null),I(""),_(""),L(""),ee("admin"),he("active"),k(!0)},$=W=>{E(W),I(W.username),_(""),L(W.name||""),ee(W.role==="super_admin"?"super_admin":"admin"),he(W.status==="disabled"?"disabled":"active"),k(!0)},ce=async()=>{var W;if(!A.trim()){w("用户名不能为空");return}if(!C&&!D){w("新建时密码必填,至少 6 位");return}if(D&&D.length<6){w("密码至少 6 位");return}w(null),R(!0);try{if(C){const K=await Tt("/api/admin/users",{id:C.id,password:D||void 0,name:P.trim(),role:z,status:U});K!=null&&K.success?(k(!1),O()):w((K==null?void 0:K.error)||"保存失败")}else{const K=await vt("/api/admin/users",{username:A.trim(),password:D,name:P.trim(),role:z});K!=null&&K.success?(k(!1),O()):w((K==null?void 0:K.error)||"保存失败")}}catch(K){const B=K;w(((W=B==null?void 0:B.data)==null?void 0:W.error)||"保存失败")}finally{R(!1)}},Y=async W=>{var K;if(confirm("确定删除该管理员?"))try{const B=await wa(`/api/admin/users?id=${W}`);B!=null&&B.success?O():w((B==null?void 0:B.error)||"删除失败")}catch(B){const oe=B;w(((K=oe==null?void 0:oe.data)==null?void 0:K.error)||"删除失败")}},F=W=>{if(!W)return"-";try{const K=new Date(W);return isNaN(K.getTime())?W:K.toLocaleString("zh-CN")}catch{return W}};return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Wx,{className:"w-5 h-5 text-[#38bdac]"}),"管理员用户"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"后台登录账号管理,仅超级管理员可操作"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ie,{placeholder:"搜索用户名/昵称",value:h,onChange:W=>f(W.target.value),className:"w-48 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"}),s.jsx(ne,{variant:"outline",size:"sm",onClick:O,disabled:g,className:"border-gray-600 text-gray-300",children:s.jsx(Ue,{className:`w-4 h-4 ${g?"animate-spin":""}`})}),s.jsxs(ne,{onClick:X,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"新增管理员"]})]})]}),v&&s.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 text-sm flex justify-between items-center",children:[s.jsx("span",{children:v}),s.jsx("button",{type:"button",onClick:()=>w(null),className:"text-red-400 hover:text-red-300",children:"×"})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ce,{className:"p-0",children:g?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(s.Fragment,{children:[s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400",children:"ID"}),s.jsx(Ee,{className:"text-gray-400",children:"用户名"}),s.jsx(Ee,{className:"text-gray-400",children:"昵称"}),s.jsx(Ee,{className:"text-gray-400",children:"角色"}),s.jsx(Ee,{className:"text-gray-400",children:"状态"}),s.jsx(Ee,{className:"text-gray-400",children:"创建时间"}),s.jsx(Ee,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(gr,{children:[t.map(W=>s.jsxs(lt,{className:"border-gray-700/50",children:[s.jsx(be,{className:"text-gray-300",children:W.id}),s.jsx(be,{className:"text-white font-medium",children:W.username}),s.jsx(be,{className:"text-gray-400",children:W.name||"-"}),s.jsx(be,{children:s.jsx(Ke,{variant:"outline",className:W.role==="super_admin"?"border-amber-500/50 text-amber-400":"border-gray-600 text-gray-400",children:W.role==="super_admin"?"超级管理员":"管理员"})}),s.jsx(be,{children:s.jsx(Ke,{variant:"outline",className:W.status==="active"?"border-[#38bdac]/50 text-[#38bdac]":"border-gray-500 text-gray-500",children:W.status==="active"?"正常":"已禁用"})}),s.jsx(be,{className:"text-gray-500 text-sm",children:F(W.createdAt)}),s.jsxs(be,{className:"text-right",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>$(W),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx($t,{className:"w-4 h-4"})}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>Y(W.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(er,{className:"w-4 h-4"})})]})]},W.id)),t.length===0&&!g&&s.jsx(lt,{children:s.jsx(be,{colSpan:7,className:"text-center py-12 text-gray-500",children:v==="无权限访问"?"仅超级管理员可查看":"暂无管理员"})})]})]}),c>1&&s.jsx("div",{className:"p-4 border-t border-gray-700/50",children:s.jsx(ws,{page:a,pageSize:o,total:n,totalPages:c,onPageChange:i})})]})})}),s.jsx(Ft,{open:N,onOpenChange:k,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(Bt,{children:s.jsx(Vt,{className:"text-white",children:C?"编辑管理员":"新增管理员"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"用户名"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"登录用户名",value:A,onChange:W=>I(W.target.value),disabled:!!C}),C&&s.jsx("p",{className:"text-xs text-gray-500",children:"用户名不可修改"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:C?"新密码(留空不改)":"密码"}),s.jsx(ie,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:C?"留空表示不修改":"至少 6 位",value:D,onChange:W=>_(W.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"昵称"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"显示名称",value:P,onChange:W=>L(W.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"角色"}),s.jsxs("select",{value:z,onChange:W=>ee(W.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[s.jsx("option",{value:"admin",children:"管理员"}),s.jsx("option",{value:"super_admin",children:"超级管理员"})]})]}),C&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"状态"}),s.jsxs("select",{value:U,onChange:W=>he(W.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[s.jsx("option",{value:"active",children:"正常"}),s.jsx("option",{value:"disabled",children:"禁用"})]})]})]}),s.jsxs(ln,{children:[s.jsxs(ne,{variant:"outline",onClick:()=>k(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(nr,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(ne,{onClick:ce,disabled:me,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),me?"保存中...":"保存"]})]})]})})]})}function bn({method:t,url:e,desc:n,headers:r,body:a,response:i}){const o=t==="GET"?"text-emerald-400":t==="POST"?"text-amber-400":t==="PUT"?"text-blue-400":t==="DELETE"?"text-rose-400":"text-gray-400";return s.jsxs("div",{className:"rounded-lg bg-[#0a1628]/60 border border-gray-700/50 p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:`font-mono font-semibold ${o}`,children:t}),s.jsx("code",{className:"text-sm text-[#38bdac] break-all",children:e})]}),n&&s.jsx("p",{className:"text-gray-400 text-sm",children:n}),r&&r.length>0&&s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"Headers"}),s.jsx("pre",{className:"text-xs text-gray-300 font-mono overflow-x-auto p-2 rounded bg-black/30",children:r.join(` `)})]}),a&&s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"Request Body (JSON)"}),s.jsx("pre",{className:"text-xs text-green-400/90 font-mono overflow-x-auto p-2 rounded bg-black/30 whitespace-pre-wrap",children:a})]}),i&&s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"Response Example"}),s.jsx("pre",{className:"text-xs text-amber-200/80 font-mono overflow-x-auto p-2 rounded bg-black/30 whitespace-pre-wrap",children:i})]})]})}function F4(){const t=["Authorization: Bearer {token}","Content-Type: application/json"];return s.jsxs("div",{className:"p-8 w-full bg-[#0a1628] text-white",children:[s.jsxs("div",{className:"mb-8",children:[s.jsx("h1",{className:"text-2xl font-bold text-white",children:"API 接口文档"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"内容管理相关接口 · RESTful · 基础路径 /api · 管理端需 Bearer Token"})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(qe,{className:"pb-3",children:s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(Zw,{className:"w-5 h-5 text-[#38bdac]"}),"1. Authentication"]})}),s.jsx(Ce,{className:"space-y-4",children:s.jsx(bn,{method:"POST",url:"/api/admin",desc:"登录,返回 JWT token",headers:["Content-Type: application/json"],body:`{ "username": "admin", "password": "your_password" @@ -912,16 +912,16 @@ ${y.slice(h+2)}`,m+=1;else break}e.push({indent:h,number:parseInt(c,10),content: }`,response:`{ "success": true, "data": { "amount": 10.00, "balance": 120.50 } -}`})]})]}),s.jsx("p",{className:"text-gray-500 text-xs mt-6",children:"管理端仅使用 /api/admin/*、/api/db/*;小程序使用 /api/miniprogram/*。完整实现见 soul-api 源码。"})]})}const gV={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},xV={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},yV={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...xV},ckbLeadApiKey:""},bV={endpoint:"",accessKeyId:"",accessKeySecret:"",bucket:"",region:""},vV={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0},NV=["system","author","admin","api-docs"];function wV(){const[t,e]=Uw(),n=t.get("tab")??"system",r=NV.includes(n)?n:"system",[a,i]=b.useState(yV),[o,c]=b.useState(vV),[u,h]=b.useState(gV),[f,m]=b.useState(bV),[g,y]=b.useState(!1),[v,w]=b.useState(!0),[N,k]=b.useState(!1),[C,E]=b.useState(""),[A,I]=b.useState(""),[D,_]=b.useState(!1),[P,L]=b.useState(!1),z=(R,O,X=!1)=>{E(R),I(O),_(X),k(!0)};b.useEffect(()=>{(async()=>{try{const O=await De("/api/admin/settings");if(!O||O.success===!1)return;if(O.featureConfig&&Object.keys(O.featureConfig).length&&c(X=>({...X,...O.featureConfig})),O.mpConfig&&typeof O.mpConfig=="object"&&h(X=>({...X,...O.mpConfig})),O.ossConfig&&typeof O.ossConfig=="object"&&m(X=>({...X,...O.ossConfig})),O.siteSettings&&typeof O.siteSettings=="object"){const X=O.siteSettings;i($=>({...$,...typeof X.sectionPrice=="number"&&{sectionPrice:X.sectionPrice},...typeof X.baseBookPrice=="number"&&{baseBookPrice:X.baseBookPrice},...typeof X.distributorShare=="number"&&{distributorShare:X.distributorShare},...X.authorInfo&&typeof X.authorInfo=="object"&&{authorInfo:{...$.authorInfo,...X.authorInfo}},...typeof X.ckbLeadApiKey=="string"&&{ckbLeadApiKey:X.ckbLeadApiKey}}))}}catch(O){console.error("Load settings error:",O)}finally{w(!1)}})()},[]);const ee=async(R,O)=>{L(!0);try{const X=await Nt("/api/admin/settings",{featureConfig:R});if(!X||X.success===!1){O(),z("保存失败",(X==null?void 0:X.error)??"未知错误",!0);return}z("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(X){console.error("Save feature config error:",X),O(),z("保存失败",X instanceof Error?X.message:String(X),!0)}finally{L(!1)}},U=(R,O)=>{const X=o,$={...X,[R]:O};c($),ee($,()=>c(X))},he=async()=>{y(!0);try{const R=await Nt("/api/admin/settings",{featureConfig:o,siteSettings:{sectionPrice:a.sectionPrice,baseBookPrice:a.baseBookPrice,distributorShare:a.distributorShare,authorInfo:a.authorInfo,ckbLeadApiKey:a.ckbLeadApiKey||void 0},mpConfig:{...u,appId:u.appId||"",withdrawSubscribeTmplId:u.withdrawSubscribeTmplId||"",mchId:u.mchId||"",minWithdraw:typeof u.minWithdraw=="number"?u.minWithdraw:10},ossConfig:{endpoint:f.endpoint||"",accessKeyId:f.accessKeyId||"",accessKeySecret:f.accessKeySecret||"",bucket:f.bucket||"",region:f.region||""}});if(!R||R.success===!1){z("保存失败",(R==null?void 0:R.error)??"未知错误",!0);return}z("已保存","设置已保存成功。")}catch(R){console.error("Save settings error:",R),z("保存失败",R instanceof Error?R.message:String(R),!0)}finally{y(!1)}},me=R=>{e(R==="system"?{}:{tab:R})};return v?s.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"系统设置"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置全站基础参数与开关"})]}),r==="system"&&s.jsxs(ne,{onClick:he,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),g?"保存中...":"保存设置"]})]}),s.jsxs(Cd,{value:r,onValueChange:me,className:"w-full",children:[s.jsxs(Jl,{className:"mb-6 bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(tn,{value:"system",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(bo,{className:"w-4 h-4 mr-2"}),"系统设置"]}),s.jsxs(tn,{value:"author",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(Im,{className:"w-4 h-4 mr-2"}),"作者详情"]}),s.jsxs(tn,{value:"admin",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(Wx,{className:"w-4 h-4 mr-2"}),"管理员"]}),s.jsxs(tn,{value:"api-docs",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx($r,{className:"w-4 h-4 mr-2"}),"API 文档"]})]}),s.jsx(nn,{value:"system",className:"mt-0",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(Im,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),s.jsx(Ht,{className:"text-gray-400",children:'配置作者信息,将在"关于作者"页面显示'})]}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"author-name",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Im,{className:"w-3 h-3"}),"主理人名称"]}),s.jsx(ie,{id:"author-name",className:"bg-[#0a1628] border-gray-700 text-white",value:a.authorInfo.name??"",onChange:R=>i(O=>({...O,authorInfo:{...O.authorInfo,name:R.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"start-date",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(fh,{className:"w-3 h-3"}),"开播日期"]}),s.jsx(ie,{id:"start-date",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 2025年10月15日",value:a.authorInfo.startDate??"",onChange:R=>i(O=>({...O,authorInfo:{...O.authorInfo,startDate:R.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"live-time",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(fh,{className:"w-3 h-3"}),"直播时间"]}),s.jsx(ie,{id:"live-time",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 06:00-09:00",value:a.authorInfo.liveTime??"",onChange:R=>i(O=>({...O,authorInfo:{...O.authorInfo,liveTime:R.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"platform",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(ej,{className:"w-3 h-3"}),"直播平台"]}),s.jsx(ie,{id:"platform",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: Soul派对房",value:a.authorInfo.platform??"",onChange:R=>i(O=>({...O,authorInfo:{...O.authorInfo,platform:R.target.value}}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"description",className:"text-gray-300 flex items-center gap-1",children:[s.jsx($r,{className:"w-3 h-3"}),"简介描述"]}),s.jsx(ie,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:a.authorInfo.description??"",onChange:R=>i(O=>({...O,authorInfo:{...O.authorInfo,description:R.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),s.jsx(Yl,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:a.authorInfo.bio??"",onChange:R=>i(O=>({...O,authorInfo:{...O.authorInfo,bio:R.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"ckb-lead-api-key",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Ns,{className:"w-3 h-3"}),"链接卡若存客宝密钥"]}),s.jsx(ie,{id:"ckb-lead-api-key",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 xxxxx-xxxxx-xxxxx-xxxxx(留空则用 .env 默认)",value:a.ckbLeadApiKey??"",onChange:R=>i(O=>({...O,ckbLeadApiKey:R.target.value}))}),s.jsx("p",{className:"text-xs text-gray-500",children:"小程序首页「链接卡若」留资接口使用的存客宝 API Key,优先于 .env 配置"})]}),s.jsxs("div",{className:"mt-4 p-4 rounded-xl bg-[#0a1628] border border-[#38bdac]/30",children:[s.jsx("p",{className:"text-xs text-gray-500 mb-2",children:"预览效果"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.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:(a.authorInfo.name??"K").charAt(0)}),s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-semibold",children:a.authorInfo.name}),s.jsx("p",{className:"text-gray-400 text-xs",children:a.authorInfo.description}),s.jsxs("p",{className:"text-[#38bdac] text-xs mt-1",children:["每日 ",a.authorInfo.liveTime," · ",a.authorInfo.platform]})]})]})]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(ph,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置书籍和章节的定价"})]}),s.jsx(Ce,{className:"space-y-4",children:s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"单节价格 (元)"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:a.sectionPrice,onChange:R=>i(O=>({...O,sectionPrice:Number.parseFloat(R.target.value)||1}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"整本价格 (元)"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:a.baseBookPrice,onChange:R=>i(O=>({...O,baseBookPrice:Number.parseFloat(R.target.value)||9.9}))})]})]})})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(Dl,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),s.jsx(Ht,{className:"text-gray-400",children:"订阅消息模板、支付商户号等,小程序从 /api/miniprogram/config 读取(API 地址由 app.js baseUrl 控制)"})]}),s.jsx(Ce,{className:"space-y-4",children:s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"小程序 AppID"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:u.appId??"",onChange:R=>h(O=>({...O,appId:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"提现订阅模板 ID"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"用户申请提现时需授权",value:u.withdrawSubscribeTmplId??"",onChange:R=>h(O=>({...O,withdrawSubscribeTmplId:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"微信支付商户号"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"1318592501",value:u.mchId??"",onChange:R=>h(O=>({...O,mchId:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"最低提现金额 (元)"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:u.minWithdraw??10,onChange:R=>h(O=>({...O,minWithdraw:Number.parseFloat(R.target.value)||10}))})]})]})})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(oM,{className:"w-5 h-5 text-[#38bdac]"}),"阿里云 OSS 配置"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置阿里云对象存储,用于图片和视频的云端存储(配置后将替代本地存储)"})]}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"Endpoint"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"oss-cn-hangzhou.aliyuncs.com",value:f.endpoint??"",onChange:R=>m(O=>({...O,endpoint:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"Region"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"oss-cn-hangzhou",value:f.region??"",onChange:R=>m(O=>({...O,region:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"AccessKey ID"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"LTAI5t...",value:f.accessKeyId??"",onChange:R=>m(O=>({...O,accessKeyId:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"AccessKey Secret"}),s.jsx(ie,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"********",value:f.accessKeySecret??"",onChange:R=>m(O=>({...O,accessKeySecret:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2 col-span-2",children:[s.jsx(te,{className:"text-gray-300",children:"Bucket 名称"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"my-soul-bucket",value:f.bucket??"",onChange:R=>m(O=>({...O,bucket:R.target.value}))})]})]}),s.jsx("div",{className:`p-3 rounded-lg ${f.endpoint&&f.bucket&&f.accessKeyId?"bg-green-500/10 border border-green-500/30":"bg-amber-500/10 border border-amber-500/30"}`,children:s.jsx("p",{className:`text-xs ${f.endpoint&&f.bucket&&f.accessKeyId?"text-green-300":"text-amber-300"}`,children:f.endpoint&&f.bucket&&f.accessKeyId?`✅ OSS 已配置(${f.bucket}.${f.endpoint}),上传将自动使用云端存储`:"⚠ 未配置 OSS,当前上传存储在本地服务器。填写以上信息并保存后自动启用云端存储"})})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(bo,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),s.jsx(Ht,{className:"text-gray-400",children:"控制各个功能模块的显示/隐藏"})]}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Mn,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(te,{htmlFor:"match-enabled",className:"text-white font-medium cursor-pointer",children:"找伙伴功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制小程序和Web端的找伙伴功能显示"})]}),s.jsx(Et,{id:"match-enabled",checked:o.matchEnabled,disabled:P,onCheckedChange:R=>U("matchEnabled",R)})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(wM,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(te,{htmlFor:"referral-enabled",className:"text-white font-medium cursor-pointer",children:"推广功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制推广中心的显示(我的页面入口)"})]}),s.jsx(Et,{id:"referral-enabled",checked:o.referralEnabled,disabled:P,onCheckedChange:R=>U("referralEnabled",R)})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx($r,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(te,{htmlFor:"search-enabled",className:"text-white font-medium cursor-pointer",children:"搜索功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制首页搜索栏的显示"})]}),s.jsx(Et,{id:"search-enabled",checked:o.searchEnabled,disabled:P,onCheckedChange:R=>U("searchEnabled",R)})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(bo,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(te,{htmlFor:"about-enabled",className:"text-white font-medium cursor-pointer",children:"关于页面"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制关于页面的访问"})]}),s.jsx(Et,{id:"about-enabled",checked:o.aboutEnabled,disabled:P,onCheckedChange:R=>U("aboutEnabled",R)})]})]}),s.jsx("div",{className:"p-3 rounded-lg bg-blue-500/10 border border-blue-500/30",children:s.jsx("p",{className:"text-xs text-blue-300",children:"💡 关闭功能后,相关入口会自动隐藏。建议在功能开发完成后再开启。"})})]})]})]})}),s.jsx(nn,{value:"author",className:"mt-0",children:s.jsx(pV,{})}),s.jsx(nn,{value:"admin",className:"mt-0",children:s.jsx(mV,{})}),s.jsx(nn,{value:"api-docs",className:"mt-0",children:s.jsx(F4,{})})]}),s.jsx(Ft,{open:N,onOpenChange:k,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsxs(Bt,{children:[s.jsx(Vt,{className:D?"text-red-400":"text-[#38bdac]",children:C}),s.jsx(Jj,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:A})]}),s.jsx(ln,{className:"mt-4",children:s.jsx(ne,{onClick:()=>k(!1),className:D?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const jw={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 jV(){const[t,e]=b.useState(!1),[n,r]=b.useState(jw),[a,i]=b.useState(""),o=async()=>{e(!0);try{const k=await De("/api/config");k!=null&&k.paymentMethods&&r({...jw,...k.paymentMethods})}catch(k){console.error(k)}finally{e(!1)}};b.useEffect(()=>{o()},[]);const c=async()=>{e(!0);try{await Nt("/api/db/config",{key:"payment_methods",value:n,description:"支付方式配置"}),le.success("配置已保存!")}catch(k){console.error("保存失败:",k),le.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{e(!1)}},u=(k,C)=>{navigator.clipboard.writeText(k),i(C),setTimeout(()=>i(""),2e3)},h=(k,C)=>{r(E=>({...E,wechat:{...E.wechat,[k]:C}}))},f=(k,C)=>{r(E=>({...E,alipay:{...E.alipay,[k]:C}}))},m=(k,C)=>{r(E=>({...E,usdt:{...E.usdt,[k]:C}}))},g=(k,C)=>{r(E=>({...E,paypal:{...E.paypal,[k]:C}}))},y=n.wechat,v=n.alipay,w=n.usdt,N=n.paypal;return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold mb-2 text-white",children:"支付配置"}),s.jsx("p",{className:"text-gray-400",children:"配置微信、支付宝、USDT、PayPal等支付参数"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(ne,{variant:"outline",onClick:o,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${t?"animate-spin":""}`}),"同步配置"]}),s.jsxs(ne,{onClick:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),"保存配置"]})]})]}),s.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Gw,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm",children:[s.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"如何获取微信群跳转链接?"}),s.jsxs("ol",{className:"text-[#07C160]/80 space-y-1 list-decimal list-inside",children:[s.jsx("li",{children:"打开微信,进入目标微信群"}),s.jsx("li",{children:'点击右上角"..." → "群二维码"'}),s.jsx("li",{children:'点击右上角"..." → "发送到电脑"'}),s.jsx("li",{children:"在电脑上保存二维码图片,上传到图床获取URL"}),s.jsx("li",{children:"或使用草料二维码等工具解析二维码获取链接"})]}),s.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"提示:微信群二维码7天后失效,建议使用活码工具"})]})]})}),s.jsxs(Cd,{defaultValue:"wechat",className:"space-y-6",children:[s.jsxs(Jl,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[s.jsxs(tn,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[s.jsx(Dl,{className:"w-4 h-4 mr-2"}),"微信"]}),s.jsxs(tn,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[s.jsx(Vv,{className:"w-4 h-4 mr-2"}),"支付宝"]}),s.jsxs(tn,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[s.jsx(Fv,{className:"w-4 h-4 mr-2"}),"USDT"]}),s.jsxs(tn,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[s.jsx(Dg,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),s.jsx(nn,{value:"wechat",className:"space-y-4",children:s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(Ge,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(Dl,{className:"w-5 h-5"}),"微信支付配置"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),s.jsx(Et,{checked:!!y.enabled,onCheckedChange:k=>h("enabled",k)})]}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"网站AppID"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.websiteAppId??""),onChange:k=>h("websiteAppId",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"商户号"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.merchantId??""),onChange:k=>h("merchantId",k.target.value)})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[s.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[s.jsx(Ks,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置(核心功能)"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"微信收款码/支付链接"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://收款码图片URL 或 weixin://支付链接",value:String(y.qrCode??""),onChange:k=>h("qrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户点击微信支付后显示的二维码图片URL"})]}),s.jsxs("div",{className:"space-y-2 bg-[#07C160]/5 p-4 rounded-xl border border-[#07C160]/20",children:[s.jsx(te,{className:"text-[#07C160] font-medium",children:"微信群跳转链接(支付成功后跳转)"}),s.jsx(ie,{className:"bg-[#0a1628] border-[#07C160]/30 text-white placeholder:text-gray-500",placeholder:"https://weixin.qq.com/g/... 或微信群二维码图片URL",value:String(y.groupQrCode??""),onChange:k=>h("groupQrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-[#07C160]/70",children:"用户支付成功后将自动跳转到此链接,进入指定微信群"})]})]})]})]})}),s.jsx(nn,{value:"alipay",className:"space-y-4",children:s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(Ge,{className:"text-[#1677FF] flex items-center gap-2",children:[s.jsx(Vv,{className:"w-5 h-5"}),"支付宝配置"]}),s.jsx(Ht,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),s.jsx(Et,{checked:!!v.enabled,onCheckedChange:k=>f("enabled",k)})]}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"合作者身份 (PID)"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(v.partnerId??""),onChange:k=>f("partnerId",k.target.value)}),s.jsx(ne,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>u(String(v.partnerId??""),"pid"),children:a==="pid"?s.jsx(yf,{className:"w-4 h-4 text-green-500"}):s.jsx(Yw,{className:"w-4 h-4 text-gray-400"})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"安全校验码 (Key)"}),s.jsx(ie,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(v.securityKey??""),onChange:k=>f("securityKey",k.target.value)})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[s.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[s.jsx(Ks,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"支付宝收款码/跳转链接"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://qr.alipay.com/... 或收款码图片URL",value:String(v.qrCode??""),onChange:k=>f("qrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户点击支付宝支付后显示的二维码"})]})]})]})]})}),s.jsx(nn,{value:"usdt",className:"space-y-4",children:s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(Ge,{className:"text-[#26A17B] flex items-center gap-2",children:[s.jsx(Fv,{className:"w-5 h-5"}),"USDT配置"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),s.jsx(Et,{checked:!!w.enabled,onCheckedChange:k=>m("enabled",k)})]}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"网络类型"}),s.jsxs("select",{className:"w-full bg-[#0a1628] border border-gray-700 text-white rounded-md p-2",value:String(w.network??"TRC20"),onChange:k=>m("network",k.target.value),children:[s.jsx("option",{value:"TRC20",children:"TRC20 (波场)"}),s.jsx("option",{value:"ERC20",children:"ERC20 (以太坊)"}),s.jsx("option",{value:"BEP20",children:"BEP20 (币安链)"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"收款地址"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",placeholder:"T... (TRC20地址)",value:String(w.address??""),onChange:k=>m("address",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(w.exchangeRate)??7.2,onChange:k=>m("exchangeRate",Number.parseFloat(k.target.value)||7.2)})]})]})]})}),s.jsx(nn,{value:"paypal",className:"space-y-4",children:s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(Ge,{className:"text-[#169BD7] flex items-center gap-2",children:[s.jsx(Dg,{className:"w-5 h-5"}),"PayPal配置"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),s.jsx(Et,{checked:!!N.enabled,onCheckedChange:k=>g("enabled",k)})]}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"PayPal邮箱"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"your@email.com",value:String(N.email??""),onChange:k=>g("email",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(N.exchangeRate)??7.2,onChange:k=>g("exchangeRate",Number(k.target.value)||7.2)})]})]})]})})]})]})}const kV={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},SV={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},CV={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function EV(){const[t,e]=b.useState({siteConfig:{...kV},menuConfig:{...SV},pageConfig:{...CV}}),[n,r]=b.useState(!1),[a,i]=b.useState(!1);b.useEffect(()=>{De("/api/config").then(f=>{f!=null&&f.siteConfig&&e(m=>({...m,siteConfig:{...m.siteConfig,...f.siteConfig}})),f!=null&&f.menuConfig&&e(m=>({...m,menuConfig:{...m.menuConfig,...f.menuConfig}})),f!=null&&f.pageConfig&&e(m=>({...m,pageConfig:{...m.pageConfig,...f.pageConfig}}))}).catch(console.error)},[]);const o=async()=>{i(!0);try{await Nt("/api/db/config",{key:"site_config",value:t.siteConfig,description:"网站基础配置"}),await Nt("/api/db/config",{key:"menu_config",value:t.menuConfig,description:"底部菜单配置"}),await Nt("/api/db/config",{key:"page_config",value:t.pageConfig,description:"页面标题配置"}),r(!0),setTimeout(()=>r(!1),2e3),le.success("配置已保存")}catch(f){console.error(f),le.error("保存失败: "+(f instanceof Error?f.message:String(f)))}finally{i(!1)}},c=t.siteConfig,u=t.menuConfig,h=t.pageConfig;return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"网站配置"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置网站名称、图标、菜单和页面标题"})]}),s.jsxs(ne,{onClick:o,disabled:a,className:`${n?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),a?"保存中...":n?"已保存":"保存设置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(Dg,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置网站名称、标题和描述"})]}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{htmlFor:"site-name",className:"text-gray-300",children:"网站名称"}),s.jsx(ie,{id:"site-name",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteName??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteName:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{htmlFor:"site-title",className:"text-gray-300",children:"网站标题"}),s.jsx(ie,{id:"site-title",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteTitle??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteTitle:f.target.value}}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{htmlFor:"site-desc",className:"text-gray-300",children:"网站描述"}),s.jsx(ie,{id:"site-desc",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteDescription??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteDescription:f.target.value}}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{htmlFor:"logo",className:"text-gray-300",children:"Logo地址"}),s.jsx(ie,{id:"logo",className:"bg-[#0a1628] border-gray-700 text-white",value:c.logo??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,logo:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{htmlFor:"favicon",className:"text-gray-300",children:"Favicon地址"}),s.jsx(ie,{id:"favicon",className:"bg-[#0a1628] border-gray-700 text-white",value:c.favicon??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,favicon:f.target.value}}))})]})]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(hA,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置网站主题色"})]}),s.jsx(Ce,{children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("div",{className:"space-y-2 flex-1",children:[s.jsx(te,{htmlFor:"primary-color",className:"text-gray-300",children:"主色调"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(ie,{id:"primary-color",type:"color",className:"w-16 h-10 bg-[#0a1628] border-gray-700 cursor-pointer p-1",value:c.primaryColor??"#00CED1",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,primaryColor:f.target.value}}))}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white flex-1",value:c.primaryColor??"#00CED1",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,primaryColor:f.target.value}}))})]})]}),s.jsx("div",{className:"w-24 h-24 rounded-xl flex items-center justify-center text-white font-bold",style:{backgroundColor:c.primaryColor??"#00CED1"},children:"预览"})]})})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(aA,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),s.jsx(Ht,{className:"text-gray-400",children:"控制底部导航栏菜单的显示和名称"})]}),s.jsx(Ce,{className:"space-y-4",children:Object.entries(u).map(([f,m])=>s.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[s.jsx(Et,{checked:(m==null?void 0:m.enabled)??!0,onCheckedChange:g=>e(y=>({...y,menuConfig:{...y.menuConfig,[f]:{...m,enabled:g}}}))}),s.jsx("span",{className:"text-gray-300 w-16 capitalize",children:f}),s.jsx(ie,{className:"bg-[#0f2137] border-gray-700 text-white max-w-[200px]",value:(m==null?void 0:m.label)??"",onChange:g=>e(y=>({...y,menuConfig:{...y.menuConfig,[f]:{...m,label:g.target.value}}}))})]}),s.jsx("span",{className:`text-sm ${m!=null&&m.enabled?"text-green-400":"text-gray-500"}`,children:m!=null&&m.enabled?"显示":"隐藏"})]},f))})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(bM,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置各个页面的标题和副标题"})]}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"首页标题"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.homeTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,homeTitle:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"首页副标题"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.homeSubtitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,homeSubtitle:f.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"目录页标题"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.chaptersTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,chaptersTitle:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"匹配页标题"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.matchTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,matchTitle:f.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"我的页标题"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.myTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,myTitle:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"关于作者标题"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.aboutTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,aboutTitle:f.target.value}}))})]})]})]})]})]})]})}function TV(){const[t,e]=b.useState(""),[n,r]=b.useState(""),[a,i]=b.useState(""),[o,c]=b.useState({}),u=async()=>{var y,v,w,N;try{const k=await De("/api/config"),C=(v=(y=k==null?void 0:k.liveQRCodes)==null?void 0:y[0])==null?void 0:v.urls;Array.isArray(C)&&e(C.join(` +}`})]})]}),s.jsx("p",{className:"text-gray-500 text-xs mt-6",children:"管理端仅使用 /api/admin/*、/api/db/*;小程序使用 /api/miniprogram/*。完整实现见 soul-api 源码。"})]})}const gV={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},xV={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},yV={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...xV},ckbLeadApiKey:""},bV={endpoint:"",accessKeyId:"",accessKeySecret:"",bucket:"",region:""},vV={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0},NV=["system","author","admin","api-docs"];function wV(){const[t,e]=Uw(),n=t.get("tab")??"system",r=NV.includes(n)?n:"system",[a,i]=b.useState(yV),[o,c]=b.useState(vV),[u,h]=b.useState(gV),[f,m]=b.useState(bV),[g,y]=b.useState(!1),[v,w]=b.useState(!0),[N,k]=b.useState(!1),[C,E]=b.useState(""),[A,I]=b.useState(""),[D,_]=b.useState(!1),[P,L]=b.useState(!1),z=(R,O,X=!1)=>{E(R),I(O),_(X),k(!0)};b.useEffect(()=>{(async()=>{try{const O=await De("/api/admin/settings");if(!O||O.success===!1)return;if(O.featureConfig&&Object.keys(O.featureConfig).length&&c(X=>({...X,...O.featureConfig})),O.mpConfig&&typeof O.mpConfig=="object"&&h(X=>({...X,...O.mpConfig})),O.ossConfig&&typeof O.ossConfig=="object"&&m(X=>({...X,...O.ossConfig})),O.siteSettings&&typeof O.siteSettings=="object"){const X=O.siteSettings;i($=>({...$,...typeof X.sectionPrice=="number"&&{sectionPrice:X.sectionPrice},...typeof X.baseBookPrice=="number"&&{baseBookPrice:X.baseBookPrice},...typeof X.distributorShare=="number"&&{distributorShare:X.distributorShare},...X.authorInfo&&typeof X.authorInfo=="object"&&{authorInfo:{...$.authorInfo,...X.authorInfo}},...typeof X.ckbLeadApiKey=="string"&&{ckbLeadApiKey:X.ckbLeadApiKey}}))}}catch(O){console.error("Load settings error:",O)}finally{w(!1)}})()},[]);const ee=async(R,O)=>{L(!0);try{const X=await vt("/api/admin/settings",{featureConfig:R});if(!X||X.success===!1){O(),z("保存失败",(X==null?void 0:X.error)??"未知错误",!0);return}z("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(X){console.error("Save feature config error:",X),O(),z("保存失败",X instanceof Error?X.message:String(X),!0)}finally{L(!1)}},U=(R,O)=>{const X=o,$={...X,[R]:O};c($),ee($,()=>c(X))},he=async()=>{y(!0);try{const R=await vt("/api/admin/settings",{featureConfig:o,siteSettings:{sectionPrice:a.sectionPrice,baseBookPrice:a.baseBookPrice,distributorShare:a.distributorShare,authorInfo:a.authorInfo,ckbLeadApiKey:a.ckbLeadApiKey||void 0},mpConfig:{...u,appId:u.appId||"",withdrawSubscribeTmplId:u.withdrawSubscribeTmplId||"",mchId:u.mchId||"",minWithdraw:typeof u.minWithdraw=="number"?u.minWithdraw:10},ossConfig:{endpoint:f.endpoint||"",accessKeyId:f.accessKeyId||"",accessKeySecret:f.accessKeySecret||"",bucket:f.bucket||"",region:f.region||""}});if(!R||R.success===!1){z("保存失败",(R==null?void 0:R.error)??"未知错误",!0);return}z("已保存","设置已保存成功。")}catch(R){console.error("Save settings error:",R),z("保存失败",R instanceof Error?R.message:String(R),!0)}finally{y(!1)}},me=R=>{e(R==="system"?{}:{tab:R})};return v?s.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"系统设置"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置全站基础参数与开关"})]}),r==="system"&&s.jsxs(ne,{onClick:he,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),g?"保存中...":"保存设置"]})]}),s.jsxs(Cd,{value:r,onValueChange:me,className:"w-full",children:[s.jsxs(Jl,{className:"mb-6 bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(tn,{value:"system",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(bo,{className:"w-4 h-4 mr-2"}),"系统设置"]}),s.jsxs(tn,{value:"author",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(Im,{className:"w-4 h-4 mr-2"}),"作者详情"]}),s.jsxs(tn,{value:"admin",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(Wx,{className:"w-4 h-4 mr-2"}),"管理员"]}),s.jsxs(tn,{value:"api-docs",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx($r,{className:"w-4 h-4 mr-2"}),"API 文档"]})]}),s.jsx(nn,{value:"system",className:"mt-0",children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(Im,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),s.jsx(Ht,{className:"text-gray-400",children:'配置作者信息,将在"关于作者"页面显示'})]}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"author-name",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Im,{className:"w-3 h-3"}),"主理人名称"]}),s.jsx(ie,{id:"author-name",className:"bg-[#0a1628] border-gray-700 text-white",value:a.authorInfo.name??"",onChange:R=>i(O=>({...O,authorInfo:{...O.authorInfo,name:R.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"start-date",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(fh,{className:"w-3 h-3"}),"开播日期"]}),s.jsx(ie,{id:"start-date",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 2025年10月15日",value:a.authorInfo.startDate??"",onChange:R=>i(O=>({...O,authorInfo:{...O.authorInfo,startDate:R.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"live-time",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(fh,{className:"w-3 h-3"}),"直播时间"]}),s.jsx(ie,{id:"live-time",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 06:00-09:00",value:a.authorInfo.liveTime??"",onChange:R=>i(O=>({...O,authorInfo:{...O.authorInfo,liveTime:R.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"platform",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(ej,{className:"w-3 h-3"}),"直播平台"]}),s.jsx(ie,{id:"platform",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: Soul派对房",value:a.authorInfo.platform??"",onChange:R=>i(O=>({...O,authorInfo:{...O.authorInfo,platform:R.target.value}}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"description",className:"text-gray-300 flex items-center gap-1",children:[s.jsx($r,{className:"w-3 h-3"}),"简介描述"]}),s.jsx(ie,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:a.authorInfo.description??"",onChange:R=>i(O=>({...O,authorInfo:{...O.authorInfo,description:R.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),s.jsx(Yl,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:a.authorInfo.bio??"",onChange:R=>i(O=>({...O,authorInfo:{...O.authorInfo,bio:R.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"ckb-lead-api-key",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Ns,{className:"w-3 h-3"}),"链接卡若存客宝密钥"]}),s.jsx(ie,{id:"ckb-lead-api-key",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 xxxxx-xxxxx-xxxxx-xxxxx(留空则用 .env 默认)",value:a.ckbLeadApiKey??"",onChange:R=>i(O=>({...O,ckbLeadApiKey:R.target.value}))}),s.jsx("p",{className:"text-xs text-gray-500",children:"小程序首页「链接卡若」留资接口使用的存客宝 API Key,优先于 .env 配置"})]}),s.jsxs("div",{className:"mt-4 p-4 rounded-xl bg-[#0a1628] border border-[#38bdac]/30",children:[s.jsx("p",{className:"text-xs text-gray-500 mb-2",children:"预览效果"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.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:(a.authorInfo.name??"K").charAt(0)}),s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-semibold",children:a.authorInfo.name}),s.jsx("p",{className:"text-gray-400 text-xs",children:a.authorInfo.description}),s.jsxs("p",{className:"text-[#38bdac] text-xs mt-1",children:["每日 ",a.authorInfo.liveTime," · ",a.authorInfo.platform]})]})]})]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(ph,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置书籍和章节的定价"})]}),s.jsx(Ce,{className:"space-y-4",children:s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"单节价格 (元)"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:a.sectionPrice,onChange:R=>i(O=>({...O,sectionPrice:Number.parseFloat(R.target.value)||1}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"整本价格 (元)"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:a.baseBookPrice,onChange:R=>i(O=>({...O,baseBookPrice:Number.parseFloat(R.target.value)||9.9}))})]})]})})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(Dl,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),s.jsx(Ht,{className:"text-gray-400",children:"订阅消息模板、支付商户号等,小程序从 /api/miniprogram/config 读取(API 地址由 app.js baseUrl 控制)"})]}),s.jsx(Ce,{className:"space-y-4",children:s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"小程序 AppID"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:u.appId??"",onChange:R=>h(O=>({...O,appId:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"提现订阅模板 ID"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"用户申请提现时需授权",value:u.withdrawSubscribeTmplId??"",onChange:R=>h(O=>({...O,withdrawSubscribeTmplId:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"微信支付商户号"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"1318592501",value:u.mchId??"",onChange:R=>h(O=>({...O,mchId:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"最低提现金额 (元)"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:u.minWithdraw??10,onChange:R=>h(O=>({...O,minWithdraw:Number.parseFloat(R.target.value)||10}))})]})]})})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(oM,{className:"w-5 h-5 text-[#38bdac]"}),"阿里云 OSS 配置"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置阿里云对象存储,用于图片和视频的云端存储(配置后将替代本地存储)"})]}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"Endpoint"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"oss-cn-hangzhou.aliyuncs.com",value:f.endpoint??"",onChange:R=>m(O=>({...O,endpoint:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"Region"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"oss-cn-hangzhou",value:f.region??"",onChange:R=>m(O=>({...O,region:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"AccessKey ID"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"LTAI5t...",value:f.accessKeyId??"",onChange:R=>m(O=>({...O,accessKeyId:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"AccessKey Secret"}),s.jsx(ie,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"********",value:f.accessKeySecret??"",onChange:R=>m(O=>({...O,accessKeySecret:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2 col-span-2",children:[s.jsx(te,{className:"text-gray-300",children:"Bucket 名称"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"my-soul-bucket",value:f.bucket??"",onChange:R=>m(O=>({...O,bucket:R.target.value}))})]})]}),s.jsx("div",{className:`p-3 rounded-lg ${f.endpoint&&f.bucket&&f.accessKeyId?"bg-green-500/10 border border-green-500/30":"bg-amber-500/10 border border-amber-500/30"}`,children:s.jsx("p",{className:`text-xs ${f.endpoint&&f.bucket&&f.accessKeyId?"text-green-300":"text-amber-300"}`,children:f.endpoint&&f.bucket&&f.accessKeyId?`✅ OSS 已配置(${f.bucket}.${f.endpoint}),上传将自动使用云端存储`:"⚠ 未配置 OSS,当前上传存储在本地服务器。填写以上信息并保存后自动启用云端存储"})})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(bo,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),s.jsx(Ht,{className:"text-gray-400",children:"控制各个功能模块的显示/隐藏"})]}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Mn,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(te,{htmlFor:"match-enabled",className:"text-white font-medium cursor-pointer",children:"找伙伴功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制小程序和Web端的找伙伴功能显示"})]}),s.jsx(Et,{id:"match-enabled",checked:o.matchEnabled,disabled:P,onCheckedChange:R=>U("matchEnabled",R)})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(wM,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(te,{htmlFor:"referral-enabled",className:"text-white font-medium cursor-pointer",children:"推广功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制推广中心的显示(我的页面入口)"})]}),s.jsx(Et,{id:"referral-enabled",checked:o.referralEnabled,disabled:P,onCheckedChange:R=>U("referralEnabled",R)})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx($r,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(te,{htmlFor:"search-enabled",className:"text-white font-medium cursor-pointer",children:"搜索功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制首页搜索栏的显示"})]}),s.jsx(Et,{id:"search-enabled",checked:o.searchEnabled,disabled:P,onCheckedChange:R=>U("searchEnabled",R)})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(bo,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(te,{htmlFor:"about-enabled",className:"text-white font-medium cursor-pointer",children:"关于页面"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制关于页面的访问"})]}),s.jsx(Et,{id:"about-enabled",checked:o.aboutEnabled,disabled:P,onCheckedChange:R=>U("aboutEnabled",R)})]})]}),s.jsx("div",{className:"p-3 rounded-lg bg-blue-500/10 border border-blue-500/30",children:s.jsx("p",{className:"text-xs text-blue-300",children:"💡 关闭功能后,相关入口会自动隐藏。建议在功能开发完成后再开启。"})})]})]})]})}),s.jsx(nn,{value:"author",className:"mt-0",children:s.jsx(pV,{})}),s.jsx(nn,{value:"admin",className:"mt-0",children:s.jsx(mV,{})}),s.jsx(nn,{value:"api-docs",className:"mt-0",children:s.jsx(F4,{})})]}),s.jsx(Ft,{open:N,onOpenChange:k,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsxs(Bt,{children:[s.jsx(Vt,{className:D?"text-red-400":"text-[#38bdac]",children:C}),s.jsx(Jj,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:A})]}),s.jsx(ln,{className:"mt-4",children:s.jsx(ne,{onClick:()=>k(!1),className:D?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const jw={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 jV(){const[t,e]=b.useState(!1),[n,r]=b.useState(jw),[a,i]=b.useState(""),o=async()=>{e(!0);try{const k=await De("/api/config");k!=null&&k.paymentMethods&&r({...jw,...k.paymentMethods})}catch(k){console.error(k)}finally{e(!1)}};b.useEffect(()=>{o()},[]);const c=async()=>{e(!0);try{await vt("/api/db/config",{key:"payment_methods",value:n,description:"支付方式配置"}),le.success("配置已保存!")}catch(k){console.error("保存失败:",k),le.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{e(!1)}},u=(k,C)=>{navigator.clipboard.writeText(k),i(C),setTimeout(()=>i(""),2e3)},h=(k,C)=>{r(E=>({...E,wechat:{...E.wechat,[k]:C}}))},f=(k,C)=>{r(E=>({...E,alipay:{...E.alipay,[k]:C}}))},m=(k,C)=>{r(E=>({...E,usdt:{...E.usdt,[k]:C}}))},g=(k,C)=>{r(E=>({...E,paypal:{...E.paypal,[k]:C}}))},y=n.wechat,v=n.alipay,w=n.usdt,N=n.paypal;return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold mb-2 text-white",children:"支付配置"}),s.jsx("p",{className:"text-gray-400",children:"配置微信、支付宝、USDT、PayPal等支付参数"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(ne,{variant:"outline",onClick:o,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${t?"animate-spin":""}`}),"同步配置"]}),s.jsxs(ne,{onClick:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),"保存配置"]})]})]}),s.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Gw,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm",children:[s.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"如何获取微信群跳转链接?"}),s.jsxs("ol",{className:"text-[#07C160]/80 space-y-1 list-decimal list-inside",children:[s.jsx("li",{children:"打开微信,进入目标微信群"}),s.jsx("li",{children:'点击右上角"..." → "群二维码"'}),s.jsx("li",{children:'点击右上角"..." → "发送到电脑"'}),s.jsx("li",{children:"在电脑上保存二维码图片,上传到图床获取URL"}),s.jsx("li",{children:"或使用草料二维码等工具解析二维码获取链接"})]}),s.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"提示:微信群二维码7天后失效,建议使用活码工具"})]})]})}),s.jsxs(Cd,{defaultValue:"wechat",className:"space-y-6",children:[s.jsxs(Jl,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[s.jsxs(tn,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[s.jsx(Dl,{className:"w-4 h-4 mr-2"}),"微信"]}),s.jsxs(tn,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[s.jsx(Vv,{className:"w-4 h-4 mr-2"}),"支付宝"]}),s.jsxs(tn,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[s.jsx(Fv,{className:"w-4 h-4 mr-2"}),"USDT"]}),s.jsxs(tn,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[s.jsx(Dg,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),s.jsx(nn,{value:"wechat",className:"space-y-4",children:s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(Ge,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(Dl,{className:"w-5 h-5"}),"微信支付配置"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),s.jsx(Et,{checked:!!y.enabled,onCheckedChange:k=>h("enabled",k)})]}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"网站AppID"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.websiteAppId??""),onChange:k=>h("websiteAppId",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"商户号"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.merchantId??""),onChange:k=>h("merchantId",k.target.value)})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[s.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[s.jsx(Ks,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置(核心功能)"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"微信收款码/支付链接"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://收款码图片URL 或 weixin://支付链接",value:String(y.qrCode??""),onChange:k=>h("qrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户点击微信支付后显示的二维码图片URL"})]}),s.jsxs("div",{className:"space-y-2 bg-[#07C160]/5 p-4 rounded-xl border border-[#07C160]/20",children:[s.jsx(te,{className:"text-[#07C160] font-medium",children:"微信群跳转链接(支付成功后跳转)"}),s.jsx(ie,{className:"bg-[#0a1628] border-[#07C160]/30 text-white placeholder:text-gray-500",placeholder:"https://weixin.qq.com/g/... 或微信群二维码图片URL",value:String(y.groupQrCode??""),onChange:k=>h("groupQrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-[#07C160]/70",children:"用户支付成功后将自动跳转到此链接,进入指定微信群"})]})]})]})]})}),s.jsx(nn,{value:"alipay",className:"space-y-4",children:s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(Ge,{className:"text-[#1677FF] flex items-center gap-2",children:[s.jsx(Vv,{className:"w-5 h-5"}),"支付宝配置"]}),s.jsx(Ht,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),s.jsx(Et,{checked:!!v.enabled,onCheckedChange:k=>f("enabled",k)})]}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"合作者身份 (PID)"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(v.partnerId??""),onChange:k=>f("partnerId",k.target.value)}),s.jsx(ne,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>u(String(v.partnerId??""),"pid"),children:a==="pid"?s.jsx(yf,{className:"w-4 h-4 text-green-500"}):s.jsx(Yw,{className:"w-4 h-4 text-gray-400"})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"安全校验码 (Key)"}),s.jsx(ie,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(v.securityKey??""),onChange:k=>f("securityKey",k.target.value)})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[s.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[s.jsx(Ks,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"支付宝收款码/跳转链接"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://qr.alipay.com/... 或收款码图片URL",value:String(v.qrCode??""),onChange:k=>f("qrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户点击支付宝支付后显示的二维码"})]})]})]})]})}),s.jsx(nn,{value:"usdt",className:"space-y-4",children:s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(Ge,{className:"text-[#26A17B] flex items-center gap-2",children:[s.jsx(Fv,{className:"w-5 h-5"}),"USDT配置"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),s.jsx(Et,{checked:!!w.enabled,onCheckedChange:k=>m("enabled",k)})]}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"网络类型"}),s.jsxs("select",{className:"w-full bg-[#0a1628] border border-gray-700 text-white rounded-md p-2",value:String(w.network??"TRC20"),onChange:k=>m("network",k.target.value),children:[s.jsx("option",{value:"TRC20",children:"TRC20 (波场)"}),s.jsx("option",{value:"ERC20",children:"ERC20 (以太坊)"}),s.jsx("option",{value:"BEP20",children:"BEP20 (币安链)"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"收款地址"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",placeholder:"T... (TRC20地址)",value:String(w.address??""),onChange:k=>m("address",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(w.exchangeRate)??7.2,onChange:k=>m("exchangeRate",Number.parseFloat(k.target.value)||7.2)})]})]})]})}),s.jsx(nn,{value:"paypal",className:"space-y-4",children:s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(Ge,{className:"text-[#169BD7] flex items-center gap-2",children:[s.jsx(Dg,{className:"w-5 h-5"}),"PayPal配置"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),s.jsx(Et,{checked:!!N.enabled,onCheckedChange:k=>g("enabled",k)})]}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"PayPal邮箱"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"your@email.com",value:String(N.email??""),onChange:k=>g("email",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(N.exchangeRate)??7.2,onChange:k=>g("exchangeRate",Number(k.target.value)||7.2)})]})]})]})})]})]})}const kV={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},SV={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},CV={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function EV(){const[t,e]=b.useState({siteConfig:{...kV},menuConfig:{...SV},pageConfig:{...CV}}),[n,r]=b.useState(!1),[a,i]=b.useState(!1);b.useEffect(()=>{De("/api/config").then(f=>{f!=null&&f.siteConfig&&e(m=>({...m,siteConfig:{...m.siteConfig,...f.siteConfig}})),f!=null&&f.menuConfig&&e(m=>({...m,menuConfig:{...m.menuConfig,...f.menuConfig}})),f!=null&&f.pageConfig&&e(m=>({...m,pageConfig:{...m.pageConfig,...f.pageConfig}}))}).catch(console.error)},[]);const o=async()=>{i(!0);try{await vt("/api/db/config",{key:"site_config",value:t.siteConfig,description:"网站基础配置"}),await vt("/api/db/config",{key:"menu_config",value:t.menuConfig,description:"底部菜单配置"}),await vt("/api/db/config",{key:"page_config",value:t.pageConfig,description:"页面标题配置"}),r(!0),setTimeout(()=>r(!1),2e3),le.success("配置已保存")}catch(f){console.error(f),le.error("保存失败: "+(f instanceof Error?f.message:String(f)))}finally{i(!1)}},c=t.siteConfig,u=t.menuConfig,h=t.pageConfig;return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"网站配置"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置网站名称、图标、菜单和页面标题"})]}),s.jsxs(ne,{onClick:o,disabled:a,className:`${n?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),a?"保存中...":n?"已保存":"保存设置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(Dg,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置网站名称、标题和描述"})]}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{htmlFor:"site-name",className:"text-gray-300",children:"网站名称"}),s.jsx(ie,{id:"site-name",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteName??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteName:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{htmlFor:"site-title",className:"text-gray-300",children:"网站标题"}),s.jsx(ie,{id:"site-title",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteTitle??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteTitle:f.target.value}}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{htmlFor:"site-desc",className:"text-gray-300",children:"网站描述"}),s.jsx(ie,{id:"site-desc",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteDescription??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteDescription:f.target.value}}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{htmlFor:"logo",className:"text-gray-300",children:"Logo地址"}),s.jsx(ie,{id:"logo",className:"bg-[#0a1628] border-gray-700 text-white",value:c.logo??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,logo:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{htmlFor:"favicon",className:"text-gray-300",children:"Favicon地址"}),s.jsx(ie,{id:"favicon",className:"bg-[#0a1628] border-gray-700 text-white",value:c.favicon??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,favicon:f.target.value}}))})]})]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(hA,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置网站主题色"})]}),s.jsx(Ce,{children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("div",{className:"space-y-2 flex-1",children:[s.jsx(te,{htmlFor:"primary-color",className:"text-gray-300",children:"主色调"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(ie,{id:"primary-color",type:"color",className:"w-16 h-10 bg-[#0a1628] border-gray-700 cursor-pointer p-1",value:c.primaryColor??"#00CED1",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,primaryColor:f.target.value}}))}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white flex-1",value:c.primaryColor??"#00CED1",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,primaryColor:f.target.value}}))})]})]}),s.jsx("div",{className:"w-24 h-24 rounded-xl flex items-center justify-center text-white font-bold",style:{backgroundColor:c.primaryColor??"#00CED1"},children:"预览"})]})})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(aA,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),s.jsx(Ht,{className:"text-gray-400",children:"控制底部导航栏菜单的显示和名称"})]}),s.jsx(Ce,{className:"space-y-4",children:Object.entries(u).map(([f,m])=>s.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[s.jsx(Et,{checked:(m==null?void 0:m.enabled)??!0,onCheckedChange:g=>e(y=>({...y,menuConfig:{...y.menuConfig,[f]:{...m,enabled:g}}}))}),s.jsx("span",{className:"text-gray-300 w-16 capitalize",children:f}),s.jsx(ie,{className:"bg-[#0f2137] border-gray-700 text-white max-w-[200px]",value:(m==null?void 0:m.label)??"",onChange:g=>e(y=>({...y,menuConfig:{...y.menuConfig,[f]:{...m,label:g.target.value}}}))})]}),s.jsx("span",{className:`text-sm ${m!=null&&m.enabled?"text-green-400":"text-gray-500"}`,children:m!=null&&m.enabled?"显示":"隐藏"})]},f))})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(bM,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置各个页面的标题和副标题"})]}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"首页标题"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.homeTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,homeTitle:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"首页副标题"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.homeSubtitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,homeSubtitle:f.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"目录页标题"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.chaptersTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,chaptersTitle:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"匹配页标题"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.matchTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,matchTitle:f.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"我的页标题"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.myTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,myTitle:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"关于作者标题"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.aboutTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,aboutTitle:f.target.value}}))})]})]})]})]})]})]})}function TV(){const[t,e]=b.useState(""),[n,r]=b.useState(""),[a,i]=b.useState(""),[o,c]=b.useState({}),u=async()=>{var y,v,w,N;try{const k=await De("/api/config"),C=(v=(y=k==null?void 0:k.liveQRCodes)==null?void 0:y[0])==null?void 0:v.urls;Array.isArray(C)&&e(C.join(` `));const E=(N=(w=k==null?void 0:k.paymentMethods)==null?void 0:w.wechat)==null?void 0:N.groupQrCode;E&&r(E),c({paymentMethods:k==null?void 0:k.paymentMethods,liveQRCodes:k==null?void 0:k.liveQRCodes})}catch(k){console.error(k)}};b.useEffect(()=>{u()},[]);const h=(y,v)=>{navigator.clipboard.writeText(y),i(v),setTimeout(()=>i(""),2e3)},f=async()=>{try{const y=t.split(` -`).map(w=>w.trim()).filter(Boolean),v=[...o.liveQRCodes||[]];v[0]?v[0].urls=y:v.push({id:"live-1",name:"微信群活码",urls:y,clickCount:0}),await Nt("/api/db/config",{key:"live_qr_codes",value:v,description:"群活码配置"}),le.success("群活码配置已保存!"),await u()}catch(y){console.error(y),le.error("保存失败: "+(y instanceof Error?y.message:String(y)))}},m=async()=>{var y;try{await Nt("/api/db/config",{key:"payment_methods",value:{...o.paymentMethods||{},wechat:{...((y=o.paymentMethods)==null?void 0:y.wechat)||{},groupQrCode:n}},description:"支付方式配置"}),le.success("微信群链接已保存!用户支付成功后将自动跳转"),await u()}catch(v){console.error(v),le.error("保存失败: "+(v instanceof Error?v.message:String(v)))}},g=()=>{n?window.open(n,"_blank"):le.error("请先配置微信群链接")};return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"mb-8",children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"微信群活码管理"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置微信群跳转链接,用户支付后自动跳转加群"})]}),s.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Gw,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm",children:[s.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"微信群活码配置指南"}),s.jsxs("div",{className:"text-[#07C160]/80 space-y-2",children:[s.jsx("p",{className:"font-medium",children:"方法一:使用草料活码(推荐)"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[s.jsx("li",{children:"访问草料二维码创建活码"}),s.jsx("li",{children:"上传微信群二维码图片,生成永久链接"}),s.jsx("li",{children:"复制生成的短链接填入下方配置"}),s.jsx("li",{children:"群满后可直接在草料后台更换新群码,链接不变"})]}),s.jsx("p",{className:"font-medium mt-3",children:"方法二:直接使用微信群链接"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[s.jsx("li",{children:'微信打开目标群 → 右上角"..." → 群二维码'}),s.jsx("li",{children:"长按二维码 → 识别二维码 → 复制链接"})]}),s.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"注意:微信原生群二维码7天后失效,建议使用草料活码"})]})]})]})}),s.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(Wv,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),s.jsx(Ht,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Lg,{className:"w-4 h-4"}),"微信群链接 / 活码链接"]}),s.jsxs("div",{className:"flex gap-2",children:[s.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:n,onChange:y=>r(y.target.value)}),s.jsx(ne,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>h(n,"group"),children:a==="group"?s.jsx(yf,{className:"w-4 h-4 text-green-500"}):s.jsx(Yw,{className:"w-4 h-4 text-gray-400"})})]}),s.jsxs("p",{className:"text-xs text-gray-500 flex items-center gap-1",children:[s.jsx(Ks,{className:"w-3 h-3"}),"支持格式:草料短链、微信群链接(https://weixin.qq.com/g/...)、企业微信链接等"]})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(ne,{onClick:m,className:"flex-1 bg-[#07C160] hover:bg-[#06AD51] text-white",children:[s.jsx(mh,{className:"w-4 h-4 mr-2"}),"保存配置"]}),s.jsxs(ne,{onClick:g,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[s.jsx(Ks,{className:"w-4 h-4 mr-2"}),"测试跳转"]})]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(Wv,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Lg,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),s.jsx(Yl,{placeholder:"https://cli.im/group1\\nhttps://cli.im/group2",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 min-h-[120px] font-mono text-sm",value:t,onChange:y=>e(y.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"每行填写一个群链接,系统将按顺序或随机分配"})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[s.jsx("span",{className:"text-sm text-gray-400",children:"已配置群数量"}),s.jsxs("span",{className:"font-bold text-[#38bdac]",children:[t.split(` -`).filter(Boolean).length," 个"]})]}),s.jsxs(ne,{onClick:f,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mh,{className:"w-4 h-4 mr-2"}),"保存多群配置"]})]})]})]}),s.jsxs("div",{className:"mt-6 bg-[#0f2137] rounded-xl p-4 border border-gray-700/50",children:[s.jsx("h4",{className:"text-white font-medium mb-3",children:"常见问题"}),s.jsxs("div",{className:"space-y-3 text-sm",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-[#38bdac]",children:"Q: 为什么推荐使用草料活码?"}),s.jsx("p",{className:"text-gray-400",children:"A: 草料活码是永久链接,群满后可直接在后台更换新群码,无需修改网站配置。微信原生群码7天失效。"})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[#38bdac]",children:"Q: 支付后没有跳转怎么办?"}),s.jsx("p",{className:"text-gray-400",children:"A: 1) 检查链接是否正确填写 2) 部分浏览器可能拦截弹窗,用户需手动允许 3) 建议使用https开头的链接"})]})]})]})]})}const kw={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}},MV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function AV(){const[t,e]=b.useState(kw),[n,r]=b.useState(!0),[a,i]=b.useState(!1),[o,c]=b.useState(!1),[u,h]=b.useState(null),[f,m]=b.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),g=async()=>{r(!0);try{const E=await De("/api/db/config/full?key=match_config"),A=(E==null?void 0:E.data)??(E==null?void 0:E.config);A&&e({...kw,...A})}catch(E){console.error("加载匹配配置失败:",E)}finally{r(!1)}};b.useEffect(()=>{g()},[]);const y=async()=>{i(!0);try{const E=await Nt("/api/db/config",{key:"match_config",value:t,description:"匹配功能配置"});E&&E.success!==!1?le.success("配置保存成功!"):le.error("保存失败: "+(E&&typeof E=="object"&&"error"in E?E.error:"未知错误"))}catch(E){console.error("保存配置失败:",E),le.error("保存失败")}finally{i(!1)}},v=E=>{h(E),m({id:E.id,label:E.label,matchLabel:E.matchLabel,icon:E.icon,matchFromDB:E.matchFromDB,showJoinAfterMatch:E.showJoinAfterMatch,price:E.price,enabled:E.enabled}),c(!0)},w=()=>{h(null),m({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),c(!0)},N=()=>{if(!f.id||!f.label){le.error("请填写类型ID和名称");return}const E=[...t.matchTypes];if(u){const A=E.findIndex(I=>I.id===u.id);A!==-1&&(E[A]={...f})}else{if(E.some(A=>A.id===f.id)){le.error("类型ID已存在");return}E.push({...f})}e({...t,matchTypes:E}),c(!1)},k=E=>{confirm("确定要删除这个匹配类型吗?")&&e({...t,matchTypes:t.matchTypes.filter(A=>A.id!==E)})},C=E=>{e({...t,matchTypes:t.matchTypes.map(A=>A.id===E?{...A,enabled:!A.enabled}:A)})};return s.jsxs("div",{className:"p-8 w-full space-y-6",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(bo,{className:"w-6 h-6 text-[#38bdac]"}),"匹配功能配置"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"管理找伙伴功能的匹配类型和价格"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(ne,{variant:"outline",onClick:g,disabled:n,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]}),s.jsxs(ne,{onClick:y,disabled:a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存配置"]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(yi,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),s.jsxs(Ce,{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"每日免费匹配次数"}),s.jsx(ie,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.freeMatchLimit,onChange:E=>e({...t,freeMatchLimit:parseInt(E.target.value,10)||0})}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户每天可免费匹配的次数"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"付费匹配价格(元)"}),s.jsx(ie,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:t.matchPrice,onChange:E=>e({...t,matchPrice:parseFloat(E.target.value)||1})}),s.jsx("p",{className:"text-xs text-gray-500",children:"免费次数用完后的单次匹配价格"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"每日最大匹配次数"}),s.jsx(ie,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.settings.maxMatchesPerDay,onChange:E=>e({...t,settings:{...t.settings,maxMatchesPerDay:parseInt(E.target.value,10)||10}})}),s.jsx("p",{className:"text-xs text-gray-500",children:"包含免费和付费的总次数"})]})]}),s.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:t.settings.enableFreeMatches,onCheckedChange:E=>e({...t,settings:{...t.settings,enableFreeMatches:E}})}),s.jsx(te,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:t.settings.enablePaidMatches,onCheckedChange:E=>e({...t,settings:{...t.settings,enablePaidMatches:E}})}),s.jsx(te,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(qe,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(Mn,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(ne,{onClick:w,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(pn,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),s.jsx(Ce,{children:s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400",children:"图标"}),s.jsx(Ee,{className:"text-gray-400",children:"类型ID"}),s.jsx(Ee,{className:"text-gray-400",children:"显示名称"}),s.jsx(Ee,{className:"text-gray-400",children:"匹配标签"}),s.jsx(Ee,{className:"text-gray-400",children:"价格"}),s.jsx(Ee,{className:"text-gray-400",children:"数据库匹配"}),s.jsx(Ee,{className:"text-gray-400",children:"状态"}),s.jsx(Ee,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsx(gr,{children:t.matchTypes.map(E=>s.jsxs(lt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{children:s.jsx("span",{className:"text-2xl",children:E.icon})}),s.jsx(be,{className:"font-mono text-gray-300",children:E.id}),s.jsx(be,{className:"text-white font-medium",children:E.label}),s.jsx(be,{className:"text-gray-300",children:E.matchLabel}),s.jsx(be,{children:s.jsxs(Ke,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",E.price]})}),s.jsx(be,{children:E.matchFromDB?s.jsx(Ke,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):s.jsx(Ke,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),s.jsx(be,{children:s.jsx(Et,{checked:E.enabled,onCheckedChange:()=>C(E.id)})}),s.jsx(be,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>v(E),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx($t,{className:"w-4 h-4"})}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>k(E.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(er,{className:"w-4 h-4"})})]})})]},E.id))})]})})]}),s.jsx(Ft,{open:o,onOpenChange:c,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[u?s.jsx($t,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(pn,{className:"w-5 h-5 text-[#38bdac]"}),u?"编辑匹配类型":"添加匹配类型"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"类型ID(英文)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:f.id,onChange:E=>m({...f,id:E.target.value}),disabled:!!u})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:MV.map(E=>s.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${f.icon===E?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>m({...f,icon:E}),children:E},E))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"显示名称"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业合伙",value:f.label,onChange:E=>m({...f,label:E.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"匹配标签"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业伙伴",value:f.matchLabel,onChange:E=>m({...f,matchLabel:E.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"单次匹配价格(元)"}),s.jsx(ie,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:f.price,onChange:E=>m({...f,price:parseFloat(E.target.value)||1})})]}),s.jsxs("div",{className:"flex gap-6 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:f.matchFromDB,onCheckedChange:E=>m({...f,matchFromDB:E})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:f.showJoinAfterMatch,onCheckedChange:E=>m({...f,showJoinAfterMatch:E})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:f.enabled,onCheckedChange:E=>m({...f,enabled:E})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(ln,{children:[s.jsx(ne,{variant:"outline",onClick:()=>c(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsxs(ne,{onClick:N,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const Sw={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function IV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(""),[f,m]=b.useState(!0),[g,y]=b.useState(null);async function v(){m(!0),y(null);try{const N=new URLSearchParams({page:String(a),pageSize:String(o)});u&&N.set("matchType",u);const k=await De(`/api/db/match-records?${N}`);k!=null&&k.success?(e(k.records||[]),r(k.total??0)):y("加载匹配记录失败")}catch(N){console.error("加载匹配记录失败",N),y("加载失败,请检查网络后重试")}finally{m(!1)}}b.useEffect(()=>{v()},[a,u]);const w=Math.ceil(n/o)||1;return s.jsxs("div",{className:"p-8 w-full",children:[g&&s.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:[s.jsx("span",{children:g}),s.jsx("button",{type:"button",onClick:()=>y(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"匹配记录"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["找伙伴匹配统计,共 ",n," 条记录"]})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("select",{value:u,onChange:N=>{h(N.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部类型"}),Object.entries(Sw).map(([N,k])=>s.jsx("option",{value:N,children:k},N))]}),s.jsxs("button",{type:"button",onClick:v,disabled:f,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(Ue,{className:`w-4 h-4 ${f?"animate-spin":""}`}),"刷新"]})]})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ce,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400",children:"发起人"}),s.jsx(Ee,{className:"text-gray-400",children:"匹配到"}),s.jsx(Ee,{className:"text-gray-400",children:"类型"}),s.jsx(Ee,{className:"text-gray-400",children:"联系方式"}),s.jsx(Ee,{className:"text-gray-400",children:"匹配时间"})]})}),s.jsxs(gr,{children:[t.map(N=>s.jsxs(lt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.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?s.jsx("img",{src:ts(N.userAvatar),alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const C=k.currentTarget.nextElementSibling;C&&C.classList.remove("hidden")}}):null,s.jsx("span",{className:N.userAvatar?"hidden":"",children:(N.userNickname||N.userId||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white",children:N.userNickname||N.userId}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[N.userId.slice(0,16),"..."]})]})]})}),s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.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?s.jsx("img",{src:ts(N.matchedUserAvatar),alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const C=k.currentTarget.nextElementSibling;C&&C.classList.remove("hidden")}}):null,s.jsx("span",{className:N.matchedUserAvatar?"hidden":"",children:(N.matchedNickname||N.matchedUserId||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white",children:N.matchedNickname||N.matchedUserId}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[N.matchedUserId.slice(0,16),"..."]})]})]})}),s.jsx(be,{children:s.jsx(Ke,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Sw[N.matchType]||N.matchType})}),s.jsxs(be,{className:"text-gray-400 text-sm",children:[N.phone&&s.jsxs("div",{children:["📱 ",N.phone]}),N.wechatId&&s.jsxs("div",{children:["💬 ",N.wechatId]}),!N.phone&&!N.wechatId&&"-"]}),s.jsx(be,{className:"text-gray-400",children:N.createdAt?new Date(N.createdAt).toLocaleString():"-"})]},N.id)),t.length===0&&s.jsx(lt,{children:s.jsx(be,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(ws,{page:a,totalPages:w,total:n,pageSize:o,onPageChange:i,onPageSizeChange:N=>{c(N),i(1)}})]})})})]})}function RV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0);async function a(){r(!0);try{const i=await De("/api/db/vip-members?limit=100");if(i!=null&&i.success&&i.data){const o=[...i.data].map((c,u)=>({...c,vipSort:typeof c.vipSort=="number"?c.vipSort:u+1}));o.sort((c,u)=>(c.vipSort??999999)-(u.vipSort??999999)),e(o)}}catch(i){console.error("Load VIP members error:",i),le.error("加载 VIP 成员失败")}finally{r(!1)}}return b.useEffect(()=>{a()},[]),s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("div",{className:"flex justify-between items-center mb-8",children:s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Al,{className:"w-5 h-5 text-amber-400"}),"用户管理 / 超级个体列表"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"这里展示所有有效超级个体用户,仅用于查看其基本信息与排序值。"})]})}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ce,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400 w-20",children:"序号"}),s.jsx(Ee,{className:"text-gray-400",children:"成员"}),s.jsx(Ee,{className:"text-gray-400 w-40",children:"超级个体"}),s.jsx(Ee,{className:"text-gray-400 w-28",children:"排序值"})]})}),s.jsxs(gr,{children:[t.map((i,o)=>{var c;return s.jsxs(lt,{className:"border-gray-700/50",children:[s.jsx(be,{className:"text-gray-300",children:o+1}),s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[i.avatar?s.jsx("img",{src:ts(i.avatar),className:"w-8 h-8 rounded-full object-cover border border-amber-400/60"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/20 border border-amber-400/60 flex items-center justify-center text-amber-300 text-sm",children:((c=i.name)==null?void 0:c[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:i.name})})]})}),s.jsx(be,{className:"text-gray-300",children:i.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置超级个体)"})}),s.jsx(be,{className:"text-gray-300",children:i.vipSort??o+1})]},i.id)}),t.length===0&&s.jsx(lt,{children:s.jsx(be,{colSpan:5,className:"text-center py-12 text-gray-500",children:"当前没有有效的超级个体用户。"})})]})]})})})]})}function B4(t){const[e,n]=b.useState([]),[r,a]=b.useState(!0),[i,o]=b.useState(!1),[c,u]=b.useState(null),[h,f]=b.useState({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:0,enabled:!0}),[m,g]=b.useState(!1),[y,v]=b.useState(!1),w=b.useRef(null),N=async P=>{var z;const L=(z=P.target.files)==null?void 0:z[0];if(L){v(!0);try{const ee=new FormData;ee.append("file",L),ee.append("folder","mentors");const U=Kx(),he={};U&&(he.Authorization=`Bearer ${U}`);const R=await(await fetch(ja("/api/upload"),{method:"POST",body:ee,credentials:"include",headers:he})).json();R!=null&&R.success&&(R!=null&&R.url)?f(O=>({...O,avatar:R.url})):le.error("上传失败: "+((R==null?void 0:R.error)||"未知错误"))}catch(ee){console.error(ee),le.error("上传失败")}finally{v(!1),w.current&&(w.current.value="")}}};async function k(){a(!0);try{const P=await De("/api/db/mentors");P!=null&&P.success&&P.data&&n(P.data)}catch(P){console.error("Load mentors error:",P)}finally{a(!1)}}b.useEffect(()=>{k()},[]);const C=()=>{f({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:e.length>0?Math.max(...e.map(P=>P.sort))+1:0,enabled:!0})},E=()=>{u(null),C(),o(!0)},A=P=>{u(P),f({name:P.name,avatar:P.avatar||"",intro:P.intro||"",tags:P.tags||"",priceSingle:P.priceSingle!=null?String(P.priceSingle):"",priceHalfYear:P.priceHalfYear!=null?String(P.priceHalfYear):"",priceYear:P.priceYear!=null?String(P.priceYear):"",quote:P.quote||"",whyFind:P.whyFind||"",offering:P.offering||"",judgmentStyle:P.judgmentStyle||"",sort:P.sort,enabled:P.enabled??!0}),o(!0)},I=async()=>{if(!h.name.trim()){le.error("导师姓名不能为空");return}g(!0);try{const P=z=>z===""?void 0:parseFloat(z),L={name:h.name.trim(),avatar:h.avatar.trim()||void 0,intro:h.intro.trim()||void 0,tags:h.tags.trim()||void 0,priceSingle:P(h.priceSingle),priceHalfYear:P(h.priceHalfYear),priceYear:P(h.priceYear),quote:h.quote.trim()||void 0,whyFind:h.whyFind.trim()||void 0,offering:h.offering.trim()||void 0,judgmentStyle:h.judgmentStyle.trim()||void 0,sort:h.sort,enabled:h.enabled};if(c){const z=await Tt("/api/db/mentors",{id:c.id,...L});z!=null&&z.success?(o(!1),k()):le.error("更新失败: "+(z==null?void 0:z.error))}else{const z=await Nt("/api/db/mentors",L);z!=null&&z.success?(o(!1),k()):le.error("新增失败: "+(z==null?void 0:z.error))}}catch(P){console.error("Save error:",P),le.error("保存失败")}finally{g(!1)}},D=async P=>{if(confirm("确定删除该导师?"))try{const L=await wa(`/api/db/mentors?id=${P}`);L!=null&&L.success?k():le.error("删除失败: "+(L==null?void 0:L.error))}catch(L){console.error("Delete error:",L),le.error("删除失败")}},_=P=>P!=null?`¥${P}`:"-";return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Mn,{className:"w-5 h-5 text-[#38bdac]"}),"导师管理"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师列表,支持每个导师独立配置单次/半年/年度价格"})]}),s.jsxs(ne,{onClick:E,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"新增导师"]})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ce,{className:"p-0",children:r?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400",children:"ID"}),s.jsx(Ee,{className:"text-gray-400",children:"姓名"}),s.jsx(Ee,{className:"text-gray-400",children:"简介"}),s.jsx(Ee,{className:"text-gray-400",children:"单次"}),s.jsx(Ee,{className:"text-gray-400",children:"半年"}),s.jsx(Ee,{className:"text-gray-400",children:"年度"}),s.jsx(Ee,{className:"text-gray-400",children:"排序"}),s.jsx(Ee,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(gr,{children:[e.map(P=>s.jsxs(lt,{className:"border-gray-700/50",children:[s.jsx(be,{className:"text-gray-300",children:P.id}),s.jsx(be,{className:"text-white",children:P.name}),s.jsx(be,{className:"text-gray-400 max-w-[200px] truncate",children:P.intro||"-"}),s.jsx(be,{className:"text-gray-400",children:_(P.priceSingle)}),s.jsx(be,{className:"text-gray-400",children:_(P.priceHalfYear)}),s.jsx(be,{className:"text-gray-400",children:_(P.priceYear)}),s.jsx(be,{className:"text-gray-400",children:P.sort}),s.jsxs(be,{className:"text-right",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>A(P),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx($t,{className:"w-4 h-4"})}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>D(P.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(er,{className:"w-4 h-4"})})]})]},P.id)),e.length===0&&s.jsx(lt,{children:s.jsx(be,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无导师,点击「新增导师」添加"})})]})]})})}),s.jsx(Ft,{open:i,onOpenChange:o,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg max-h-[90vh] overflow-y-auto",children:[s.jsx(Bt,{children:s.jsx(Vt,{className:"text-white",children:c?"编辑导师":"新增导师"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"姓名 *"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:卡若",value:h.name,onChange:P=>f(L=>({...L,name:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"排序"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:h.sort,onChange:P=>f(L=>({...L,sort:parseInt(P.target.value,10)||0}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"头像"}),s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ie,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:h.avatar,onChange:P=>f(L=>({...L,avatar:P.target.value})),placeholder:"点击上传或粘贴图片地址"}),s.jsx("input",{ref:w,type:"file",accept:"image/*",className:"hidden",onChange:N}),s.jsxs(ne,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:y,onClick:()=>{var P;return(P=w.current)==null?void 0:P.click()},children:[s.jsx(mh,{className:"w-4 h-4 mr-2"}),y?"上传中...":"上传"]})]}),h.avatar&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:ts(h.avatar.startsWith("http")?h.avatar:ja(h.avatar)),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"简介"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:结构判断型咨询 · Decision > Execution",value:h.intro,onChange:P=>f(L=>({...L,intro:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"技能标签(逗号分隔)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:项目结构判断、风险止损、人×项目匹配",value:h.tags,onChange:P=>f(L=>({...L,tags:P.target.value}))})]}),s.jsxs("div",{className:"border-t border-gray-700 pt-4",children:[s.jsx(te,{className:"text-gray-300 block mb-2",children:"价格配置(每个导师独立)"}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"单次咨询 ¥"}),s.jsx(ie,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"980",value:h.priceSingle,onChange:P=>f(L=>({...L,priceSingle:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"半年咨询 ¥"}),s.jsx(ie,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"19800",value:h.priceHalfYear,onChange:P=>f(L=>({...L,priceHalfYear:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"年度咨询 ¥"}),s.jsx(ie,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"29800",value:h.priceYear,onChange:P=>f(L=>({...L,priceYear:P.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"引言"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:大多数人失败,不是因为不努力...",value:h.quote,onChange:P=>f(L=>({...L,quote:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"为什么找(文本)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:h.whyFind,onChange:P=>f(L=>({...L,whyFind:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"提供什么(文本)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:h.offering,onChange:P=>f(L=>({...L,offering:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"判断风格(逗号分隔)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:冷静、克制、偏风险视角",value:h.judgmentStyle,onChange:P=>f(L=>({...L,judgmentStyle:P.target.value}))})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",id:"enabled",checked:h.enabled,onChange:P=>f(L=>({...L,enabled:P.target.checked})),className:"rounded border-gray-600 bg-[#0a1628]"}),s.jsx(te,{htmlFor:"enabled",className:"text-gray-300 cursor-pointer",children:"上架(小程序可见)"})]})]}),s.jsxs(ln,{children:[s.jsxs(ne,{variant:"outline",onClick:()=>o(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(nr,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(ne,{onClick:I,disabled:m,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),m?"保存中...":"保存"]})]})]})})]})}function PV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[a,i]=b.useState("");async function o(){r(!0);try{const h=a?`/api/db/mentor-consultations?status=${a}`:"/api/db/mentor-consultations",f=await De(h);f!=null&&f.success&&f.data&&e(f.data)}catch(h){console.error("Load consultations error:",h)}finally{r(!1)}}b.useEffect(()=>{o()},[a]);const c={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},u={single:"单次",half_year:"半年",year:"年度"};return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(fh,{className:"w-5 h-5 text-[#38bdac]"}),"导师预约列表"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师咨询预约记录"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("select",{value:a,onChange:h=>i(h.target.value),className:"bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2 text-gray-300 text-sm",children:[s.jsx("option",{value:"",children:"全部状态"}),Object.entries(c).map(([h,f])=>s.jsx("option",{value:h,children:f},h))]}),s.jsxs(ne,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]})]})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ce,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400",children:"ID"}),s.jsx(Ee,{className:"text-gray-400",children:"用户ID"}),s.jsx(Ee,{className:"text-gray-400",children:"导师ID"}),s.jsx(Ee,{className:"text-gray-400",children:"类型"}),s.jsx(Ee,{className:"text-gray-400",children:"金额"}),s.jsx(Ee,{className:"text-gray-400",children:"状态"}),s.jsx(Ee,{className:"text-gray-400",children:"创建时间"})]})}),s.jsxs(gr,{children:[t.map(h=>s.jsxs(lt,{className:"border-gray-700/50",children:[s.jsx(be,{className:"text-gray-300",children:h.id}),s.jsx(be,{className:"text-gray-400",children:h.userId}),s.jsx(be,{className:"text-gray-400",children:h.mentorId}),s.jsx(be,{className:"text-gray-400",children:u[h.consultationType]||h.consultationType}),s.jsxs(be,{className:"text-white",children:["¥",h.amount]}),s.jsx(be,{className:"text-gray-400",children:c[h.status]||h.status}),s.jsx(be,{className:"text-gray-500 text-sm",children:h.createdAt})]},h.id)),t.length===0&&s.jsx(lt,{children:s.jsx(be,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}const Kc={poolSource:["vip"],requirePhone:!0,requireNickname:!0,requireAvatar:!1,requireBusiness:!1},Cw={matchTypes:[{id:"partner",label:"找伙伴",matchLabel:"找伙伴",icon:"⭐",matchFromDB:!0,showJoinAfterMatch:!1,price:1,enabled:!0},{id:"investor",label:"资源对接",matchLabel:"资源对接",icon:"👥",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"mentor",label:"导师顾问",matchLabel:"导师顾问",icon:"❤️",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"team",label:"团队招募",matchLabel:"加入项目",icon:"🎮",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}],freeMatchLimit:3,matchPrice:1,settings:{enableFreeMatches:!0,enablePaidMatches:!0,maxMatchesPerDay:10},poolSettings:Kc},OV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function DV(){const t=Di(),[e,n]=b.useState(Cw),[r,a]=b.useState(!0),[i,o]=b.useState(!1),[c,u]=b.useState(!1),[h,f]=b.useState(null),[m,g]=b.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),[y,v]=b.useState(null),[w,N]=b.useState(!1),k=async()=>{N(!0);try{const L=await De("/api/db/match-pool-counts");L!=null&&L.success&&L.data&&v(L.data)}catch(L){console.error("加载池子人数失败:",L)}finally{N(!1)}},C=async()=>{a(!0);try{const L=await De("/api/db/config/full?key=match_config"),z=(L==null?void 0:L.data)??(L==null?void 0:L.config);if(z){let ee=z.poolSettings??Kc;ee.poolSource&&!Array.isArray(ee.poolSource)&&(ee={...ee,poolSource:[ee.poolSource]}),n({...Cw,...z,poolSettings:ee})}}catch(L){console.error("加载匹配配置失败:",L)}finally{a(!1)}};b.useEffect(()=>{C(),k()},[]);const E=async()=>{o(!0);try{const L=await Nt("/api/db/config",{key:"match_config",value:e,description:"匹配功能配置"});le.error((L==null?void 0:L.success)!==!1?"配置保存成功!":"保存失败: "+((L==null?void 0:L.error)||"未知错误"))}catch(L){console.error(L),le.error("保存失败")}finally{o(!1)}},A=L=>{f(L),g({...L}),u(!0)},I=()=>{f(null),g({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),u(!0)},D=()=>{if(!m.id||!m.label){le.error("请填写类型ID和名称");return}const L=[...e.matchTypes];if(h){const z=L.findIndex(ee=>ee.id===h.id);z!==-1&&(L[z]={...m})}else{if(L.some(z=>z.id===m.id)){le.error("类型ID已存在");return}L.push({...m})}n({...e,matchTypes:L}),u(!1)},_=L=>{confirm("确定要删除这个匹配类型吗?")&&n({...e,matchTypes:e.matchTypes.filter(z=>z.id!==L)})},P=L=>{n({...e,matchTypes:e.matchTypes.map(z=>z.id===L?{...z,enabled:!z.enabled}:z)})};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsxs(ne,{variant:"outline",onClick:C,disabled:r,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${r?"animate-spin":""}`})," 刷新"]}),s.jsxs(ne,{onClick:E,disabled:i,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"})," ",i?"保存中...":"保存配置"]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(Qw,{className:"w-5 h-5 text-blue-400"})," 匹配池选择"]}),s.jsx(Ht,{className:"text-gray-400",children:"选择匹配的用户池和完善程度要求,只有满足条件的用户才可被匹配到"})]}),s.jsxs(Ce,{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx(te,{className:"text-gray-300",children:"匹配来源池"}),s.jsx("p",{className:"text-gray-500 text-xs",children:"可同时勾选多个池子(取并集匹配)"}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[{value:"vip",label:"超级个体(VIP会员)",desc:"付费 ¥1980 的VIP会员",icon:"👑",countKey:"vip"},{value:"complete",label:"完善资料用户",desc:"符合下方完善度要求的用户",icon:"✅",countKey:"complete"},{value:"all",label:"全部用户",desc:"所有已注册用户",icon:"👥",countKey:"all"}].map(L=>{const z=e.poolSettings??Kc,U=(Array.isArray(z.poolSource)?z.poolSource:[z.poolSource]).includes(L.value),he=y==null?void 0:y[L.countKey],me=()=>{const R=Array.isArray(z.poolSource)?[...z.poolSource]:[z.poolSource],O=U?R.filter(X=>X!==L.value):[...R,L.value];O.length===0&&O.push(L.value),n({...e,poolSettings:{...z,poolSource:O}})};return s.jsxs("button",{type:"button",onClick:me,className:`p-4 rounded-lg border text-left transition-all ${U?"border-[#38bdac] bg-[#38bdac]/10":"border-gray-700 bg-[#0a1628] hover:border-gray-600"}`,children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:`w-5 h-5 rounded border-2 flex items-center justify-center text-xs ${U?"border-[#38bdac] bg-[#38bdac] text-white":"border-gray-600"}`,children:U&&"✓"}),s.jsx("span",{className:"text-xl",children:L.icon}),s.jsx("span",{className:`text-sm font-medium ${U?"text-[#38bdac]":"text-gray-300"}`,children:L.label})]}),s.jsxs("span",{className:"text-lg font-bold text-white",children:[w?"...":he??"-",s.jsx("span",{className:"text-xs text-gray-500 font-normal ml-1",children:"人"})]})]}),s.jsx("p",{className:"text-gray-500 text-xs mt-2",children:L.desc}),s.jsx("span",{role:"link",tabIndex:0,onClick:R=>{R.stopPropagation(),t(`/users?pool=${L.value}`)},onKeyDown:R=>{R.key==="Enter"&&(R.stopPropagation(),t(`/users?pool=${L.value}`))},className:"text-[#38bdac] text-xs mt-2 inline-block hover:underline cursor-pointer",children:"查看用户列表 →"})]},L.value)})})]}),s.jsxs("div",{className:"space-y-3 pt-4 border-t border-gray-700/50",children:[s.jsx(te,{className:"text-gray-300",children:"用户资料完善要求(被匹配用户必须满足以下条件)"}),s.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[{key:"requirePhone",label:"有手机号",icon:"📱"},{key:"requireNickname",label:"有昵称",icon:"👤"},{key:"requireAvatar",label:"有头像",icon:"🖼️"},{key:"requireBusiness",label:"有业务需求",icon:"💼"}].map(L=>{const ee=(e.poolSettings??Kc)[L.key];return s.jsxs("div",{className:"flex items-center gap-3 bg-[#0a1628] rounded-lg p-3",children:[s.jsx(Et,{checked:ee,onCheckedChange:U=>n({...e,poolSettings:{...e.poolSettings??Kc,[L.key]:U}})}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{children:L.icon}),s.jsx(te,{className:"text-gray-300 text-sm",children:L.label})]})]},L.key)})})]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(yi,{className:"w-5 h-5 text-yellow-400"})," 基础设置"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),s.jsxs(Ce,{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"每日免费匹配次数"}),s.jsx(ie,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.freeMatchLimit,onChange:L=>n({...e,freeMatchLimit:parseInt(L.target.value,10)||0})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"付费匹配价格(元)"}),s.jsx(ie,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:e.matchPrice,onChange:L=>n({...e,matchPrice:parseFloat(L.target.value)||1})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"每日最大匹配次数"}),s.jsx(ie,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.settings.maxMatchesPerDay,onChange:L=>n({...e,settings:{...e.settings,maxMatchesPerDay:parseInt(L.target.value,10)||10}})})]})]}),s.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:e.settings.enableFreeMatches,onCheckedChange:L=>n({...e,settings:{...e.settings,enableFreeMatches:L}})}),s.jsx(te,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:e.settings.enablePaidMatches,onCheckedChange:L=>n({...e,settings:{...e.settings,enablePaidMatches:L}})}),s.jsx(te,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(qe,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(Mn,{className:"w-5 h-5 text-[#38bdac]"})," 匹配类型管理"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(ne,{onClick:I,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(pn,{className:"w-4 h-4 mr-1"})," 添加类型"]})]}),s.jsx(Ce,{children:s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400",children:"图标"}),s.jsx(Ee,{className:"text-gray-400",children:"类型ID"}),s.jsx(Ee,{className:"text-gray-400",children:"显示名称"}),s.jsx(Ee,{className:"text-gray-400",children:"匹配标签"}),s.jsx(Ee,{className:"text-gray-400",children:"价格"}),s.jsx(Ee,{className:"text-gray-400",children:"数据库匹配"}),s.jsx(Ee,{className:"text-gray-400",children:"状态"}),s.jsx(Ee,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsx(gr,{children:e.matchTypes.map(L=>s.jsxs(lt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{children:s.jsx("span",{className:"text-2xl",children:L.icon})}),s.jsx(be,{className:"font-mono text-gray-300",children:L.id}),s.jsx(be,{className:"text-white font-medium",children:L.label}),s.jsx(be,{className:"text-gray-300",children:L.matchLabel}),s.jsx(be,{children:s.jsxs(Ke,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",L.price]})}),s.jsx(be,{children:L.matchFromDB?s.jsx(Ke,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):s.jsx(Ke,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),s.jsx(be,{children:s.jsx(Et,{checked:L.enabled,onCheckedChange:()=>P(L.id)})}),s.jsx(be,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>A(L),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx($t,{className:"w-4 h-4"})}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>_(L.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(er,{className:"w-4 h-4"})})]})})]},L.id))})]})})]}),s.jsx(Ft,{open:c,onOpenChange:u,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[h?s.jsx($t,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(pn,{className:"w-5 h-5 text-[#38bdac]"}),h?"编辑匹配类型":"添加匹配类型"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"类型ID(英文)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:m.id,onChange:L=>g({...m,id:L.target.value}),disabled:!!h})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:OV.map(L=>s.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${m.icon===L?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>g({...m,icon:L}),children:L},L))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"显示名称"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.label,onChange:L=>g({...m,label:L.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"匹配标签"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.matchLabel,onChange:L=>g({...m,matchLabel:L.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"单次匹配价格(元)"}),s.jsx(ie,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:m.price,onChange:L=>g({...m,price:parseFloat(L.target.value)||1})})]}),s.jsxs("div",{className:"flex gap-6 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:m.matchFromDB,onCheckedChange:L=>g({...m,matchFromDB:L})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:m.showJoinAfterMatch,onCheckedChange:L=>g({...m,showJoinAfterMatch:L})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:m.enabled,onCheckedChange:L=>g({...m,enabled:L})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(ln,{children:[s.jsx(ne,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsxs(ne,{onClick:D,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"})," 保存"]})]})]})})]})}const Ew={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function LV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(""),[f,m]=b.useState(!0),[g,y]=b.useState(null),[v,w]=b.useState(null);async function N(){m(!0),y(null);try{const E=new URLSearchParams({page:String(a),pageSize:String(o)});u&&E.set("matchType",u);const A=await De(`/api/db/match-records?${E}`);A!=null&&A.success?(e(A.records||[]),r(A.total??0)):y("加载匹配记录失败")}catch{y("加载失败,请检查网络后重试")}finally{m(!1)}}b.useEffect(()=>{N()},[a,u]);const k=Math.ceil(n/o)||1,C=({userId:E,nickname:A,avatar:I})=>s.jsxs("div",{className:"flex items-center gap-3 cursor-pointer group",onClick:()=>w(E),children:[s.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:[I?s.jsx("img",{src:ts(I),alt:"",className:"w-full h-full object-cover",onError:D=>{D.currentTarget.style.display="none"}}):null,s.jsx("span",{className:I?"hidden":"",children:(A||E||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white group-hover:text-[#38bdac] transition-colors",children:A||E}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[E==null?void 0:E.slice(0,16),(E==null?void 0:E.length)>16?"...":""]})]})]});return s.jsxs("div",{children:[g&&s.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:[s.jsx("span",{children:g}),s.jsx("button",{type:"button",onClick:()=>y(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("p",{className:"text-gray-400",children:["共 ",n," 条匹配记录 · 点击用户名查看详情"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("select",{value:u,onChange:E=>{h(E.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部类型"}),Object.entries(Ew).map(([E,A])=>s.jsx("option",{value:E,children:A},E))]}),s.jsxs("button",{type:"button",onClick:N,disabled:f,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(Ue,{className:`w-4 h-4 ${f?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ce,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400",children:"发起人"}),s.jsx(Ee,{className:"text-gray-400",children:"匹配到"}),s.jsx(Ee,{className:"text-gray-400",children:"类型"}),s.jsx(Ee,{className:"text-gray-400",children:"联系方式"}),s.jsx(Ee,{className:"text-gray-400",children:"匹配时间"})]})}),s.jsxs(gr,{children:[t.map(E=>s.jsxs(lt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{children:s.jsx(C,{userId:E.userId,nickname:E.userNickname,avatar:E.userAvatar})}),s.jsx(be,{children:E.matchedUserId?s.jsx(C,{userId:E.matchedUserId,nickname:E.matchedNickname,avatar:E.matchedUserAvatar}):s.jsx("span",{className:"text-gray-500",children:"—"})}),s.jsx(be,{children:s.jsx(Ke,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Ew[E.matchType]||E.matchType})}),s.jsxs(be,{className:"text-sm",children:[E.phone&&s.jsxs("div",{className:"text-green-400",children:["📱 ",E.phone]}),E.wechatId&&s.jsxs("div",{className:"text-blue-400",children:["💬 ",E.wechatId]}),!E.phone&&!E.wechatId&&s.jsx("span",{className:"text-gray-600",children:"-"})]}),s.jsx(be,{className:"text-gray-400",children:E.createdAt?new Date(E.createdAt).toLocaleString():"-"})]},E.id)),t.length===0&&s.jsx(lt,{children:s.jsx(be,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(ws,{page:a,totalPages:k,total:n,pageSize:o,onPageChange:i,onPageSizeChange:E=>{c(E),i(1)}})]})})}),s.jsx(i0,{open:!!v,onClose:()=>w(null),userId:v,onUserUpdated:N})]})}function _V(){const[t,e]=b.useState("records");return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>e("records"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="records"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"匹配记录"}),s.jsx("button",{type:"button",onClick:()=>e("pool"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="pool"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"匹配池设置"})]}),t==="records"&&s.jsx(LV,{}),t==="pool"&&s.jsx(DV,{})]})}const Tw={investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function zV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(!0),[f,m]=b.useState("investor"),[g,y]=b.useState(null);async function v(){h(!0);try{const C=new URLSearchParams({page:String(a),pageSize:String(o),matchType:f}),E=await De(`/api/db/match-records?${C}`);E!=null&&E.success&&(e(E.records||[]),r(E.total??0))}catch(C){console.error(C)}finally{h(!1)}}b.useEffect(()=>{v()},[a,f]);const w=async C=>{if(!C.phone&&!C.wechatId){le.info("该记录无联系方式,无法推送到存客宝");return}y(C.id);try{const E=await Nt("/api/ckb/join",{type:C.matchType||"investor",phone:C.phone||"",wechat:C.wechatId||"",userId:C.userId,name:C.userNickname||""});le.error((E==null?void 0:E.message)||(E!=null&&E.success?"推送成功":"推送失败"))}catch(E){le.error("推送失败: "+(E instanceof Error?E.message:"网络错误"))}finally{y(null)}},N=Math.ceil(n/o)||1,k=C=>!!(C.phone||C.wechatId);return s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400",children:"点击获客:有人填写手机号/微信号的直接显示,可一键推送到存客宝"}),s.jsxs("p",{className:"text-gray-500 text-xs mt-1",children:["共 ",n," 条记录 — 有联系方式的可触发存客宝添加好友"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("select",{value:f,onChange:C=>{m(C.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:Object.entries(Tw).map(([C,E])=>s.jsx("option",{value:C,children:E},C))}),s.jsxs(ne,{onClick:v,disabled:u,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${u?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ce,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400",children:"发起人"}),s.jsx(Ee,{className:"text-gray-400",children:"匹配到"}),s.jsx(Ee,{className:"text-gray-400",children:"类型"}),s.jsx(Ee,{className:"text-gray-400",children:"联系方式"}),s.jsx(Ee,{className:"text-gray-400",children:"时间"}),s.jsx(Ee,{className:"text-gray-400 text-right",children:"操作"})]})}),s.jsxs(gr,{children:[t.map(C=>{var E,A;return s.jsxs(lt,{className:`border-gray-700/50 ${k(C)?"hover:bg-[#0a1628]":"opacity-60"}`,children:[s.jsx(be,{className:"text-white",children:C.userNickname||((E=C.userId)==null?void 0:E.slice(0,12))}),s.jsx(be,{className:"text-white",children:C.matchedNickname||((A=C.matchedUserId)==null?void 0:A.slice(0,12))}),s.jsx(be,{children:s.jsx(Ke,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Tw[C.matchType]||C.matchType})}),s.jsxs(be,{className:"text-sm",children:[C.phone&&s.jsxs("div",{className:"text-green-400",children:["📱 ",C.phone]}),C.wechatId&&s.jsxs("div",{className:"text-blue-400",children:["💬 ",C.wechatId]}),!C.phone&&!C.wechatId&&s.jsx("span",{className:"text-gray-600",children:"无联系方式"})]}),s.jsx(be,{className:"text-gray-400 text-sm",children:C.createdAt?new Date(C.createdAt).toLocaleString():"-"}),s.jsx(be,{className:"text-right",children:k(C)?s.jsxs(ne,{size:"sm",onClick:()=>w(C),disabled:g===C.id,className:"bg-[#38bdac] hover:bg-[#2da396] text-white text-xs h-7 px-3",children:[s.jsx(RA,{className:"w-3 h-3 mr-1"}),g===C.id?"推送中...":"推送CKB"]}):s.jsx("span",{className:"text-gray-600 text-xs",children:"—"})})]},C.id)}),t.length===0&&s.jsx(lt,{children:s.jsx(be,{colSpan:6,className:"text-center py-12 text-gray-500",children:"暂无记录"})})]})]}),s.jsx(ws,{page:a,totalPages:N,total:n,pageSize:o,onPageChange:i,onPageSizeChange:C=>{c(C),i(1)}})]})})})]})}const Mw={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},$V={single:"单次",half_year:"半年",year:"年度"};function FV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[a,i]=b.useState("");async function o(){r(!0);try{const c=a?`/api/db/mentor-consultations?status=${a}`:"/api/db/mentor-consultations",u=await De(c);u!=null&&u.success&&u.data&&e(u.data)}catch(c){console.error(c)}finally{r(!1)}}return b.useEffect(()=>{o()},[a]),s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsx("p",{className:"text-gray-400",children:"导师咨询预约记录"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("select",{value:a,onChange:c=>i(c.target.value),className:"bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2 text-gray-300 text-sm",children:[s.jsx("option",{value:"",children:"全部状态"}),Object.entries(Mw).map(([c,u])=>s.jsx("option",{value:c,children:u},c))]}),s.jsxs(ne,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ce,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400",children:"ID"}),s.jsx(Ee,{className:"text-gray-400",children:"用户ID"}),s.jsx(Ee,{className:"text-gray-400",children:"导师ID"}),s.jsx(Ee,{className:"text-gray-400",children:"类型"}),s.jsx(Ee,{className:"text-gray-400",children:"金额"}),s.jsx(Ee,{className:"text-gray-400",children:"状态"}),s.jsx(Ee,{className:"text-gray-400",children:"创建时间"})]})}),s.jsxs(gr,{children:[t.map(c=>s.jsxs(lt,{className:"border-gray-700/50",children:[s.jsx(be,{className:"text-gray-300",children:c.id}),s.jsx(be,{className:"text-gray-400",children:c.userId}),s.jsx(be,{className:"text-gray-400",children:c.mentorId}),s.jsx(be,{className:"text-gray-400",children:$V[c.consultationType]||c.consultationType}),s.jsxs(be,{className:"text-white",children:["¥",c.amount]}),s.jsx(be,{className:"text-gray-400",children:Mw[c.status]||c.status}),s.jsx(be,{className:"text-gray-500 text-sm",children:c.createdAt?new Date(c.createdAt).toLocaleString():"-"})]},c.id)),t.length===0&&s.jsx(lt,{children:s.jsx(be,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}function BV(){const[t,e]=b.useState("booking");return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>e("booking"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="booking"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"预约记录"}),s.jsx("button",{type:"button",onClick:()=>e("manage"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="manage"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"导师管理"})]}),t==="booking"&&s.jsx(FV,{}),t==="manage"&&s.jsx("div",{className:"-mx-8",children:s.jsx(B4,{embedded:!0})})]})}function VV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(!0);async function f(){h(!0);try{const g=new URLSearchParams({page:String(a),pageSize:String(o),matchType:"team"}),y=await De(`/api/db/match-records?${g}`);y!=null&&y.success&&(e(y.records||[]),r(y.total??0))}catch(g){console.error(g)}finally{h(!1)}}b.useEffect(()=>{f()},[a]);const m=Math.ceil(n/o)||1;return s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("div",{children:[s.jsxs("p",{className:"text-gray-400",children:["团队招募匹配记录,共 ",n," 条"]}),s.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"用户通过「团队招募」提交联系方式到存客宝"})]}),s.jsxs("button",{type:"button",onClick:f,disabled:u,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(Ue,{className:`w-4 h-4 ${u?"animate-spin":""}`})," 刷新"]})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ce,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400",children:"发起人"}),s.jsx(Ee,{className:"text-gray-400",children:"匹配到"}),s.jsx(Ee,{className:"text-gray-400",children:"联系方式"}),s.jsx(Ee,{className:"text-gray-400",children:"时间"})]})}),s.jsxs(gr,{children:[t.map(g=>s.jsxs(lt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{className:"text-white",children:g.userNickname||g.userId}),s.jsx(be,{className:"text-white",children:g.matchedNickname||g.matchedUserId}),s.jsxs(be,{className:"text-gray-400 text-sm",children:[g.phone&&s.jsxs("div",{children:["📱 ",g.phone]}),g.wechatId&&s.jsxs("div",{children:["💬 ",g.wechatId]}),!g.phone&&!g.wechatId&&"-"]}),s.jsx(be,{className:"text-gray-400",children:g.createdAt?new Date(g.createdAt).toLocaleString():"-"})]},g.id)),t.length===0&&s.jsx(lt,{children:s.jsx(be,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无团队招募记录"})})]})]}),s.jsx(ws,{page:a,totalPages:m,total:n,pageSize:o,onPageChange:i,onPageSizeChange:g=>{c(g),i(1)}})]})})})]})}const Aw={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"},Iw={partner:"⭐",investor:"👥",mentor:"❤️",team:"🎮"};function HV({onSwitchTab:t,onOpenCKB:e}={}){const n=Di(),[r,a]=b.useState(null),[i,o]=b.useState(null),[c,u]=b.useState(!0),h=b.useCallback(async()=>{var m,g;u(!0);try{const[y,v]=await Promise.allSettled([De("/api/db/match-records?stats=true"),De("/api/db/ckb-plan-stats")]);if(y.status==="fulfilled"&&((m=y.value)!=null&&m.success)&&y.value.data){let w=y.value.data;if(w.totalMatches>0&&(!w.uniqueUsers||w.uniqueUsers===0))try{const N=await De("/api/db/match-records?page=1&pageSize=200");if(N!=null&&N.success&&N.records){const k=new Set(N.records.map(C=>C.userId).filter(Boolean));w={...w,uniqueUsers:k.size}}}catch{}a(w)}v.status==="fulfilled"&&((g=v.value)!=null&&g.success)&&v.value.data&&o(v.value.data)}catch(y){console.error("加载统计失败:",y)}finally{u(!1)}},[]);b.useEffect(()=>{h()},[h]);const f=m=>c?"—":String(m??0);return s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{children:[s.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[s.jsx(Mn,{className:"w-5 h-5 text-[#38bdac]"})," 找伙伴数据"]}),s.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-5",children:[s.jsx(Se,{className:"bg-gradient-to-br from-[#0f2137] to-[#162d4a] border-gray-700/40 cursor-pointer hover:border-[#38bdac]/60 transition-all",onClick:()=>t==null?void 0:t("partner"),children:s.jsxs(Ce,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"总匹配次数"}),s.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.totalMatches)}),s.jsxs("p",{className:"text-[#38bdac] text-xs mt-3 flex items-center gap-1",children:[s.jsx(Ks,{className:"w-3 h-3"})," 查看匹配记录"]})]})}),s.jsx(Se,{className:"bg-gradient-to-br from-[#0f2137] to-[#162d4a] border-gray-700/40 cursor-pointer hover:border-yellow-500/60 transition-all",onClick:()=>t==null?void 0:t("partner"),children:s.jsxs(Ce,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"今日匹配"}),s.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.todayMatches)}),s.jsxs("p",{className:"text-yellow-400/60 text-xs mt-3 flex items-center gap-1",children:[s.jsx(yi,{className:"w-3 h-3"})," 今日实时"]})]})}),s.jsx(Se,{className:"bg-gradient-to-br from-[#0f2137] to-[#162d4a] border-gray-700/40 cursor-pointer hover:border-blue-500/60 transition-all",onClick:()=>n("/users"),children:s.jsxs(Ce,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"匹配用户数"}),s.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.uniqueUsers)}),s.jsxs("p",{className:"text-blue-400/60 text-xs mt-3 flex items-center gap-1",children:[s.jsx(Ks,{className:"w-3 h-3"})," 查看用户管理"]})]})}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/40",children:s.jsxs(Ce,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"人均匹配"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":r!=null&&r.uniqueUsers?(r.totalMatches/r.uniqueUsers).toFixed(1):"0"})]})}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/40",children:s.jsxs(Ce,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"付费匹配次数"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:f(r==null?void 0:r.paidMatchCount)})]})})]})]}),(r==null?void 0:r.byType)&&r.byType.length>0&&s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold text-white mb-4",children:"各类型匹配分布"}),s.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:r.byType.map(m=>{const g=r.totalMatches>0?m.count/r.totalMatches*100:0;return s.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/40 rounded-xl p-5",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx("span",{className:"text-2xl",children:Iw[m.matchType]||"📊"}),s.jsx("span",{className:"text-gray-300 font-medium",children:Aw[m.matchType]||m.matchType})]}),s.jsx("p",{className:"text-3xl font-bold text-white mb-2",children:m.count}),s.jsx("div",{className:"w-full h-2 bg-gray-700/50 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-[#38bdac] rounded-full transition-all",style:{width:`${Math.min(g,100)}%`}})}),s.jsxs("p",{className:"text-gray-500 text-xs mt-1.5",children:[g.toFixed(1),"%"]})]},m.matchType)})})]}),s.jsxs("div",{children:[s.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[s.jsx(Ns,{className:"w-5 h-5 text-orange-400"})," AI 获客数据"]}),s.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-5 mb-6",children:[s.jsx(Se,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("submitted"),children:s.jsxs(Ce,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"已提交线索"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":(i==null?void 0:i.ckbTotal)??0}),s.jsx("p",{className:"text-orange-400/60 text-xs mt-2",children:"点击查看明细 →"})]})}),s.jsx(Se,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("contact"),children:s.jsxs(Ce,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"有联系方式"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":(i==null?void 0:i.withContact)??0}),s.jsx("p",{className:"text-orange-400/60 text-xs mt-2",children:"点击查看明细 →"})]})}),s.jsx(Se,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("test"),children:s.jsxs(Ce,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"AI 添加进度"}),s.jsx("p",{className:"text-xl font-bold text-orange-400",children:"查看详情 →"}),s.jsx("p",{className:"text-gray-500 text-xs mt-2",children:"添加成功率 · 回复率 · API 文档"})]})})]}),(i==null?void 0:i.byType)&&i.byType.length>0&&s.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 mb-6",children:i.byType.map(m=>s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-lg p-4 flex items-center gap-3",children:[s.jsx("span",{className:"text-xl",children:Iw[m.matchType]||"📋"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-xs",children:Aw[m.matchType]||m.matchType}),s.jsx("p",{className:"text-xl font-bold text-white",children:m.total})]})]},m.matchType))})]})]})}const WV=["partner","investor","mentor","team"],Sg=[{key:"join_partner",label:"找伙伴场景"},{key:"join_investor",label:"资源对接场景"},{key:"join_mentor",label:"导师顾问场景"},{key:"join_team",label:"团队招募场景"},{key:"match",label:"匹配上报"},{key:"lead",label:"链接卡若"}],Rw=`# 场景获客接口摘要 +`).map(w=>w.trim()).filter(Boolean),v=[...o.liveQRCodes||[]];v[0]?v[0].urls=y:v.push({id:"live-1",name:"微信群活码",urls:y,clickCount:0}),await vt("/api/db/config",{key:"live_qr_codes",value:v,description:"群活码配置"}),le.success("群活码配置已保存!"),await u()}catch(y){console.error(y),le.error("保存失败: "+(y instanceof Error?y.message:String(y)))}},m=async()=>{var y;try{await vt("/api/db/config",{key:"payment_methods",value:{...o.paymentMethods||{},wechat:{...((y=o.paymentMethods)==null?void 0:y.wechat)||{},groupQrCode:n}},description:"支付方式配置"}),le.success("微信群链接已保存!用户支付成功后将自动跳转"),await u()}catch(v){console.error(v),le.error("保存失败: "+(v instanceof Error?v.message:String(v)))}},g=()=>{n?window.open(n,"_blank"):le.error("请先配置微信群链接")};return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"mb-8",children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"微信群活码管理"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置微信群跳转链接,用户支付后自动跳转加群"})]}),s.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Gw,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm",children:[s.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"微信群活码配置指南"}),s.jsxs("div",{className:"text-[#07C160]/80 space-y-2",children:[s.jsx("p",{className:"font-medium",children:"方法一:使用草料活码(推荐)"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[s.jsx("li",{children:"访问草料二维码创建活码"}),s.jsx("li",{children:"上传微信群二维码图片,生成永久链接"}),s.jsx("li",{children:"复制生成的短链接填入下方配置"}),s.jsx("li",{children:"群满后可直接在草料后台更换新群码,链接不变"})]}),s.jsx("p",{className:"font-medium mt-3",children:"方法二:直接使用微信群链接"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[s.jsx("li",{children:'微信打开目标群 → 右上角"..." → 群二维码'}),s.jsx("li",{children:"长按二维码 → 识别二维码 → 复制链接"})]}),s.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"注意:微信原生群二维码7天后失效,建议使用草料活码"})]})]})]})}),s.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(Wv,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),s.jsx(Ht,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Lg,{className:"w-4 h-4"}),"微信群链接 / 活码链接"]}),s.jsxs("div",{className:"flex gap-2",children:[s.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:n,onChange:y=>r(y.target.value)}),s.jsx(ne,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>h(n,"group"),children:a==="group"?s.jsx(yf,{className:"w-4 h-4 text-green-500"}):s.jsx(Yw,{className:"w-4 h-4 text-gray-400"})})]}),s.jsxs("p",{className:"text-xs text-gray-500 flex items-center gap-1",children:[s.jsx(Ks,{className:"w-3 h-3"}),"支持格式:草料短链、微信群链接(https://weixin.qq.com/g/...)、企业微信链接等"]})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(ne,{onClick:m,className:"flex-1 bg-[#07C160] hover:bg-[#06AD51] text-white",children:[s.jsx(mh,{className:"w-4 h-4 mr-2"}),"保存配置"]}),s.jsxs(ne,{onClick:g,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[s.jsx(Ks,{className:"w-4 h-4 mr-2"}),"测试跳转"]})]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(Wv,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),s.jsxs(Ce,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Lg,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),s.jsx(Yl,{placeholder:"https://cli.im/group1\\nhttps://cli.im/group2",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 min-h-[120px] font-mono text-sm",value:t,onChange:y=>e(y.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"每行填写一个群链接,系统将按顺序或随机分配"})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[s.jsx("span",{className:"text-sm text-gray-400",children:"已配置群数量"}),s.jsxs("span",{className:"font-bold text-[#38bdac]",children:[t.split(` +`).filter(Boolean).length," 个"]})]}),s.jsxs(ne,{onClick:f,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mh,{className:"w-4 h-4 mr-2"}),"保存多群配置"]})]})]})]}),s.jsxs("div",{className:"mt-6 bg-[#0f2137] rounded-xl p-4 border border-gray-700/50",children:[s.jsx("h4",{className:"text-white font-medium mb-3",children:"常见问题"}),s.jsxs("div",{className:"space-y-3 text-sm",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-[#38bdac]",children:"Q: 为什么推荐使用草料活码?"}),s.jsx("p",{className:"text-gray-400",children:"A: 草料活码是永久链接,群满后可直接在后台更换新群码,无需修改网站配置。微信原生群码7天失效。"})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[#38bdac]",children:"Q: 支付后没有跳转怎么办?"}),s.jsx("p",{className:"text-gray-400",children:"A: 1) 检查链接是否正确填写 2) 部分浏览器可能拦截弹窗,用户需手动允许 3) 建议使用https开头的链接"})]})]})]})]})}const kw={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}},MV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function AV(){const[t,e]=b.useState(kw),[n,r]=b.useState(!0),[a,i]=b.useState(!1),[o,c]=b.useState(!1),[u,h]=b.useState(null),[f,m]=b.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),g=async()=>{r(!0);try{const E=await De("/api/db/config/full?key=match_config"),A=(E==null?void 0:E.data)??(E==null?void 0:E.config);A&&e({...kw,...A})}catch(E){console.error("加载匹配配置失败:",E)}finally{r(!1)}};b.useEffect(()=>{g()},[]);const y=async()=>{i(!0);try{const E=await vt("/api/db/config",{key:"match_config",value:t,description:"匹配功能配置"});E&&E.success!==!1?le.success("配置保存成功!"):le.error("保存失败: "+(E&&typeof E=="object"&&"error"in E?E.error:"未知错误"))}catch(E){console.error("保存配置失败:",E),le.error("保存失败")}finally{i(!1)}},v=E=>{h(E),m({id:E.id,label:E.label,matchLabel:E.matchLabel,icon:E.icon,matchFromDB:E.matchFromDB,showJoinAfterMatch:E.showJoinAfterMatch,price:E.price,enabled:E.enabled}),c(!0)},w=()=>{h(null),m({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),c(!0)},N=()=>{if(!f.id||!f.label){le.error("请填写类型ID和名称");return}const E=[...t.matchTypes];if(u){const A=E.findIndex(I=>I.id===u.id);A!==-1&&(E[A]={...f})}else{if(E.some(A=>A.id===f.id)){le.error("类型ID已存在");return}E.push({...f})}e({...t,matchTypes:E}),c(!1)},k=E=>{confirm("确定要删除这个匹配类型吗?")&&e({...t,matchTypes:t.matchTypes.filter(A=>A.id!==E)})},C=E=>{e({...t,matchTypes:t.matchTypes.map(A=>A.id===E?{...A,enabled:!A.enabled}:A)})};return s.jsxs("div",{className:"p-8 w-full space-y-6",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(bo,{className:"w-6 h-6 text-[#38bdac]"}),"匹配功能配置"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"管理找伙伴功能的匹配类型和价格"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(ne,{variant:"outline",onClick:g,disabled:n,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]}),s.jsxs(ne,{onClick:y,disabled:a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存配置"]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(yi,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),s.jsxs(Ce,{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"每日免费匹配次数"}),s.jsx(ie,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.freeMatchLimit,onChange:E=>e({...t,freeMatchLimit:parseInt(E.target.value,10)||0})}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户每天可免费匹配的次数"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"付费匹配价格(元)"}),s.jsx(ie,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:t.matchPrice,onChange:E=>e({...t,matchPrice:parseFloat(E.target.value)||1})}),s.jsx("p",{className:"text-xs text-gray-500",children:"免费次数用完后的单次匹配价格"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"每日最大匹配次数"}),s.jsx(ie,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.settings.maxMatchesPerDay,onChange:E=>e({...t,settings:{...t.settings,maxMatchesPerDay:parseInt(E.target.value,10)||10}})}),s.jsx("p",{className:"text-xs text-gray-500",children:"包含免费和付费的总次数"})]})]}),s.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:t.settings.enableFreeMatches,onCheckedChange:E=>e({...t,settings:{...t.settings,enableFreeMatches:E}})}),s.jsx(te,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:t.settings.enablePaidMatches,onCheckedChange:E=>e({...t,settings:{...t.settings,enablePaidMatches:E}})}),s.jsx(te,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(qe,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(Mn,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(ne,{onClick:w,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(pn,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),s.jsx(Ce,{children:s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400",children:"图标"}),s.jsx(Ee,{className:"text-gray-400",children:"类型ID"}),s.jsx(Ee,{className:"text-gray-400",children:"显示名称"}),s.jsx(Ee,{className:"text-gray-400",children:"匹配标签"}),s.jsx(Ee,{className:"text-gray-400",children:"价格"}),s.jsx(Ee,{className:"text-gray-400",children:"数据库匹配"}),s.jsx(Ee,{className:"text-gray-400",children:"状态"}),s.jsx(Ee,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsx(gr,{children:t.matchTypes.map(E=>s.jsxs(lt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{children:s.jsx("span",{className:"text-2xl",children:E.icon})}),s.jsx(be,{className:"font-mono text-gray-300",children:E.id}),s.jsx(be,{className:"text-white font-medium",children:E.label}),s.jsx(be,{className:"text-gray-300",children:E.matchLabel}),s.jsx(be,{children:s.jsxs(Ke,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",E.price]})}),s.jsx(be,{children:E.matchFromDB?s.jsx(Ke,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):s.jsx(Ke,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),s.jsx(be,{children:s.jsx(Et,{checked:E.enabled,onCheckedChange:()=>C(E.id)})}),s.jsx(be,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>v(E),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx($t,{className:"w-4 h-4"})}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>k(E.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(er,{className:"w-4 h-4"})})]})})]},E.id))})]})})]}),s.jsx(Ft,{open:o,onOpenChange:c,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[u?s.jsx($t,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(pn,{className:"w-5 h-5 text-[#38bdac]"}),u?"编辑匹配类型":"添加匹配类型"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"类型ID(英文)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:f.id,onChange:E=>m({...f,id:E.target.value}),disabled:!!u})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:MV.map(E=>s.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${f.icon===E?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>m({...f,icon:E}),children:E},E))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"显示名称"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业合伙",value:f.label,onChange:E=>m({...f,label:E.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"匹配标签"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业伙伴",value:f.matchLabel,onChange:E=>m({...f,matchLabel:E.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"单次匹配价格(元)"}),s.jsx(ie,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:f.price,onChange:E=>m({...f,price:parseFloat(E.target.value)||1})})]}),s.jsxs("div",{className:"flex gap-6 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:f.matchFromDB,onCheckedChange:E=>m({...f,matchFromDB:E})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:f.showJoinAfterMatch,onCheckedChange:E=>m({...f,showJoinAfterMatch:E})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:f.enabled,onCheckedChange:E=>m({...f,enabled:E})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(ln,{children:[s.jsx(ne,{variant:"outline",onClick:()=>c(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsxs(ne,{onClick:N,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const Sw={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function IV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(""),[f,m]=b.useState(!0),[g,y]=b.useState(null);async function v(){m(!0),y(null);try{const N=new URLSearchParams({page:String(a),pageSize:String(o)});u&&N.set("matchType",u);const k=await De(`/api/db/match-records?${N}`);k!=null&&k.success?(e(k.records||[]),r(k.total??0)):y("加载匹配记录失败")}catch(N){console.error("加载匹配记录失败",N),y("加载失败,请检查网络后重试")}finally{m(!1)}}b.useEffect(()=>{v()},[a,u]);const w=Math.ceil(n/o)||1;return s.jsxs("div",{className:"p-8 w-full",children:[g&&s.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:[s.jsx("span",{children:g}),s.jsx("button",{type:"button",onClick:()=>y(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"匹配记录"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["找伙伴匹配统计,共 ",n," 条记录"]})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("select",{value:u,onChange:N=>{h(N.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部类型"}),Object.entries(Sw).map(([N,k])=>s.jsx("option",{value:N,children:k},N))]}),s.jsxs("button",{type:"button",onClick:v,disabled:f,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(Ue,{className:`w-4 h-4 ${f?"animate-spin":""}`}),"刷新"]})]})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ce,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400",children:"发起人"}),s.jsx(Ee,{className:"text-gray-400",children:"匹配到"}),s.jsx(Ee,{className:"text-gray-400",children:"类型"}),s.jsx(Ee,{className:"text-gray-400",children:"联系方式"}),s.jsx(Ee,{className:"text-gray-400",children:"匹配时间"})]})}),s.jsxs(gr,{children:[t.map(N=>s.jsxs(lt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.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?s.jsx("img",{src:ns(N.userAvatar),alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const C=k.currentTarget.nextElementSibling;C&&C.classList.remove("hidden")}}):null,s.jsx("span",{className:N.userAvatar?"hidden":"",children:(N.userNickname||N.userId||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white",children:N.userNickname||N.userId}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[N.userId.slice(0,16),"..."]})]})]})}),s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.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?s.jsx("img",{src:ns(N.matchedUserAvatar),alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const C=k.currentTarget.nextElementSibling;C&&C.classList.remove("hidden")}}):null,s.jsx("span",{className:N.matchedUserAvatar?"hidden":"",children:(N.matchedNickname||N.matchedUserId||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white",children:N.matchedNickname||N.matchedUserId}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[N.matchedUserId.slice(0,16),"..."]})]})]})}),s.jsx(be,{children:s.jsx(Ke,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Sw[N.matchType]||N.matchType})}),s.jsxs(be,{className:"text-gray-400 text-sm",children:[N.phone&&s.jsxs("div",{children:["📱 ",N.phone]}),N.wechatId&&s.jsxs("div",{children:["💬 ",N.wechatId]}),!N.phone&&!N.wechatId&&"-"]}),s.jsx(be,{className:"text-gray-400",children:N.createdAt?new Date(N.createdAt).toLocaleString():"-"})]},N.id)),t.length===0&&s.jsx(lt,{children:s.jsx(be,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(ws,{page:a,totalPages:w,total:n,pageSize:o,onPageChange:i,onPageSizeChange:N=>{c(N),i(1)}})]})})})]})}function RV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0);async function a(){r(!0);try{const i=await De("/api/db/vip-members?limit=100");if(i!=null&&i.success&&i.data){const o=[...i.data].map((c,u)=>({...c,vipSort:typeof c.vipSort=="number"?c.vipSort:u+1}));o.sort((c,u)=>(c.vipSort??999999)-(u.vipSort??999999)),e(o)}}catch(i){console.error("Load VIP members error:",i),le.error("加载 VIP 成员失败")}finally{r(!1)}}return b.useEffect(()=>{a()},[]),s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("div",{className:"flex justify-between items-center mb-8",children:s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Al,{className:"w-5 h-5 text-amber-400"}),"用户管理 / 超级个体列表"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"这里展示所有有效超级个体用户,仅用于查看其基本信息与排序值。"})]})}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ce,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400 w-20",children:"序号"}),s.jsx(Ee,{className:"text-gray-400",children:"成员"}),s.jsx(Ee,{className:"text-gray-400 w-40",children:"超级个体"}),s.jsx(Ee,{className:"text-gray-400 w-28",children:"排序值"})]})}),s.jsxs(gr,{children:[t.map((i,o)=>{var c;return s.jsxs(lt,{className:"border-gray-700/50",children:[s.jsx(be,{className:"text-gray-300",children:o+1}),s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[i.avatar?s.jsx("img",{src:ns(i.avatar),className:"w-8 h-8 rounded-full object-cover border border-amber-400/60"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/20 border border-amber-400/60 flex items-center justify-center text-amber-300 text-sm",children:((c=i.name)==null?void 0:c[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:i.name})})]})}),s.jsx(be,{className:"text-gray-300",children:i.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置超级个体)"})}),s.jsx(be,{className:"text-gray-300",children:i.vipSort??o+1})]},i.id)}),t.length===0&&s.jsx(lt,{children:s.jsx(be,{colSpan:5,className:"text-center py-12 text-gray-500",children:"当前没有有效的超级个体用户。"})})]})]})})})]})}function B4(t){const[e,n]=b.useState([]),[r,a]=b.useState(!0),[i,o]=b.useState(!1),[c,u]=b.useState(null),[h,f]=b.useState({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:0,enabled:!0}),[m,g]=b.useState(!1),[y,v]=b.useState(!1),w=b.useRef(null),N=async P=>{var z;const L=(z=P.target.files)==null?void 0:z[0];if(L){v(!0);try{const ee=new FormData;ee.append("file",L),ee.append("folder","mentors");const U=Kx(),he={};U&&(he.Authorization=`Bearer ${U}`);const R=await(await fetch(ja("/api/upload"),{method:"POST",body:ee,credentials:"include",headers:he})).json();R!=null&&R.success&&(R!=null&&R.url)?f(O=>({...O,avatar:R.url})):le.error("上传失败: "+((R==null?void 0:R.error)||"未知错误"))}catch(ee){console.error(ee),le.error("上传失败")}finally{v(!1),w.current&&(w.current.value="")}}};async function k(){a(!0);try{const P=await De("/api/db/mentors");P!=null&&P.success&&P.data&&n(P.data)}catch(P){console.error("Load mentors error:",P)}finally{a(!1)}}b.useEffect(()=>{k()},[]);const C=()=>{f({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:e.length>0?Math.max(...e.map(P=>P.sort))+1:0,enabled:!0})},E=()=>{u(null),C(),o(!0)},A=P=>{u(P),f({name:P.name,avatar:P.avatar||"",intro:P.intro||"",tags:P.tags||"",priceSingle:P.priceSingle!=null?String(P.priceSingle):"",priceHalfYear:P.priceHalfYear!=null?String(P.priceHalfYear):"",priceYear:P.priceYear!=null?String(P.priceYear):"",quote:P.quote||"",whyFind:P.whyFind||"",offering:P.offering||"",judgmentStyle:P.judgmentStyle||"",sort:P.sort,enabled:P.enabled??!0}),o(!0)},I=async()=>{if(!h.name.trim()){le.error("导师姓名不能为空");return}g(!0);try{const P=z=>z===""?void 0:parseFloat(z),L={name:h.name.trim(),avatar:h.avatar.trim()||void 0,intro:h.intro.trim()||void 0,tags:h.tags.trim()||void 0,priceSingle:P(h.priceSingle),priceHalfYear:P(h.priceHalfYear),priceYear:P(h.priceYear),quote:h.quote.trim()||void 0,whyFind:h.whyFind.trim()||void 0,offering:h.offering.trim()||void 0,judgmentStyle:h.judgmentStyle.trim()||void 0,sort:h.sort,enabled:h.enabled};if(c){const z=await Tt("/api/db/mentors",{id:c.id,...L});z!=null&&z.success?(o(!1),k()):le.error("更新失败: "+(z==null?void 0:z.error))}else{const z=await vt("/api/db/mentors",L);z!=null&&z.success?(o(!1),k()):le.error("新增失败: "+(z==null?void 0:z.error))}}catch(P){console.error("Save error:",P),le.error("保存失败")}finally{g(!1)}},D=async P=>{if(confirm("确定删除该导师?"))try{const L=await wa(`/api/db/mentors?id=${P}`);L!=null&&L.success?k():le.error("删除失败: "+(L==null?void 0:L.error))}catch(L){console.error("Delete error:",L),le.error("删除失败")}},_=P=>P!=null?`¥${P}`:"-";return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Mn,{className:"w-5 h-5 text-[#38bdac]"}),"导师管理"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师列表,支持每个导师独立配置单次/半年/年度价格"})]}),s.jsxs(ne,{onClick:E,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(pn,{className:"w-4 h-4 mr-2"}),"新增导师"]})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ce,{className:"p-0",children:r?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400",children:"ID"}),s.jsx(Ee,{className:"text-gray-400",children:"姓名"}),s.jsx(Ee,{className:"text-gray-400",children:"简介"}),s.jsx(Ee,{className:"text-gray-400",children:"单次"}),s.jsx(Ee,{className:"text-gray-400",children:"半年"}),s.jsx(Ee,{className:"text-gray-400",children:"年度"}),s.jsx(Ee,{className:"text-gray-400",children:"排序"}),s.jsx(Ee,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(gr,{children:[e.map(P=>s.jsxs(lt,{className:"border-gray-700/50",children:[s.jsx(be,{className:"text-gray-300",children:P.id}),s.jsx(be,{className:"text-white",children:P.name}),s.jsx(be,{className:"text-gray-400 max-w-[200px] truncate",children:P.intro||"-"}),s.jsx(be,{className:"text-gray-400",children:_(P.priceSingle)}),s.jsx(be,{className:"text-gray-400",children:_(P.priceHalfYear)}),s.jsx(be,{className:"text-gray-400",children:_(P.priceYear)}),s.jsx(be,{className:"text-gray-400",children:P.sort}),s.jsxs(be,{className:"text-right",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>A(P),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx($t,{className:"w-4 h-4"})}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>D(P.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(er,{className:"w-4 h-4"})})]})]},P.id)),e.length===0&&s.jsx(lt,{children:s.jsx(be,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无导师,点击「新增导师」添加"})})]})]})})}),s.jsx(Ft,{open:i,onOpenChange:o,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg max-h-[90vh] overflow-y-auto",children:[s.jsx(Bt,{children:s.jsx(Vt,{className:"text-white",children:c?"编辑导师":"新增导师"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"姓名 *"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:卡若",value:h.name,onChange:P=>f(L=>({...L,name:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"排序"}),s.jsx(ie,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:h.sort,onChange:P=>f(L=>({...L,sort:parseInt(P.target.value,10)||0}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"头像"}),s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ie,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:h.avatar,onChange:P=>f(L=>({...L,avatar:P.target.value})),placeholder:"点击上传或粘贴图片地址"}),s.jsx("input",{ref:w,type:"file",accept:"image/*",className:"hidden",onChange:N}),s.jsxs(ne,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:y,onClick:()=>{var P;return(P=w.current)==null?void 0:P.click()},children:[s.jsx(mh,{className:"w-4 h-4 mr-2"}),y?"上传中...":"上传"]})]}),h.avatar&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:ns(h.avatar.startsWith("http")?h.avatar:ja(h.avatar)),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"简介"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:结构判断型咨询 · Decision > Execution",value:h.intro,onChange:P=>f(L=>({...L,intro:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"技能标签(逗号分隔)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:项目结构判断、风险止损、人×项目匹配",value:h.tags,onChange:P=>f(L=>({...L,tags:P.target.value}))})]}),s.jsxs("div",{className:"border-t border-gray-700 pt-4",children:[s.jsx(te,{className:"text-gray-300 block mb-2",children:"价格配置(每个导师独立)"}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"单次咨询 ¥"}),s.jsx(ie,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"980",value:h.priceSingle,onChange:P=>f(L=>({...L,priceSingle:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"半年咨询 ¥"}),s.jsx(ie,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"19800",value:h.priceHalfYear,onChange:P=>f(L=>({...L,priceHalfYear:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"年度咨询 ¥"}),s.jsx(ie,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"29800",value:h.priceYear,onChange:P=>f(L=>({...L,priceYear:P.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"引言"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:大多数人失败,不是因为不努力...",value:h.quote,onChange:P=>f(L=>({...L,quote:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"为什么找(文本)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:h.whyFind,onChange:P=>f(L=>({...L,whyFind:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"提供什么(文本)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:h.offering,onChange:P=>f(L=>({...L,offering:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"判断风格(逗号分隔)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:冷静、克制、偏风险视角",value:h.judgmentStyle,onChange:P=>f(L=>({...L,judgmentStyle:P.target.value}))})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",id:"enabled",checked:h.enabled,onChange:P=>f(L=>({...L,enabled:P.target.checked})),className:"rounded border-gray-600 bg-[#0a1628]"}),s.jsx(te,{htmlFor:"enabled",className:"text-gray-300 cursor-pointer",children:"上架(小程序可见)"})]})]}),s.jsxs(ln,{children:[s.jsxs(ne,{variant:"outline",onClick:()=>o(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(nr,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(ne,{onClick:I,disabled:m,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"}),m?"保存中...":"保存"]})]})]})})]})}function PV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[a,i]=b.useState("");async function o(){r(!0);try{const h=a?`/api/db/mentor-consultations?status=${a}`:"/api/db/mentor-consultations",f=await De(h);f!=null&&f.success&&f.data&&e(f.data)}catch(h){console.error("Load consultations error:",h)}finally{r(!1)}}b.useEffect(()=>{o()},[a]);const c={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},u={single:"单次",half_year:"半年",year:"年度"};return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(fh,{className:"w-5 h-5 text-[#38bdac]"}),"导师预约列表"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师咨询预约记录"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("select",{value:a,onChange:h=>i(h.target.value),className:"bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2 text-gray-300 text-sm",children:[s.jsx("option",{value:"",children:"全部状态"}),Object.entries(c).map(([h,f])=>s.jsx("option",{value:h,children:f},h))]}),s.jsxs(ne,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]})]})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ce,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400",children:"ID"}),s.jsx(Ee,{className:"text-gray-400",children:"用户ID"}),s.jsx(Ee,{className:"text-gray-400",children:"导师ID"}),s.jsx(Ee,{className:"text-gray-400",children:"类型"}),s.jsx(Ee,{className:"text-gray-400",children:"金额"}),s.jsx(Ee,{className:"text-gray-400",children:"状态"}),s.jsx(Ee,{className:"text-gray-400",children:"创建时间"})]})}),s.jsxs(gr,{children:[t.map(h=>s.jsxs(lt,{className:"border-gray-700/50",children:[s.jsx(be,{className:"text-gray-300",children:h.id}),s.jsx(be,{className:"text-gray-400",children:h.userId}),s.jsx(be,{className:"text-gray-400",children:h.mentorId}),s.jsx(be,{className:"text-gray-400",children:u[h.consultationType]||h.consultationType}),s.jsxs(be,{className:"text-white",children:["¥",h.amount]}),s.jsx(be,{className:"text-gray-400",children:c[h.status]||h.status}),s.jsx(be,{className:"text-gray-500 text-sm",children:h.createdAt})]},h.id)),t.length===0&&s.jsx(lt,{children:s.jsx(be,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}const Kc={poolSource:["vip"],requirePhone:!0,requireNickname:!0,requireAvatar:!1,requireBusiness:!1},Cw={matchTypes:[{id:"partner",label:"找伙伴",matchLabel:"找伙伴",icon:"⭐",matchFromDB:!0,showJoinAfterMatch:!1,price:1,enabled:!0},{id:"investor",label:"资源对接",matchLabel:"资源对接",icon:"👥",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"mentor",label:"导师顾问",matchLabel:"导师顾问",icon:"❤️",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"team",label:"团队招募",matchLabel:"加入项目",icon:"🎮",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}],freeMatchLimit:3,matchPrice:1,settings:{enableFreeMatches:!0,enablePaidMatches:!0,maxMatchesPerDay:10},poolSettings:Kc},OV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function DV(){const t=Di(),[e,n]=b.useState(Cw),[r,a]=b.useState(!0),[i,o]=b.useState(!1),[c,u]=b.useState(!1),[h,f]=b.useState(null),[m,g]=b.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),[y,v]=b.useState(null),[w,N]=b.useState(!1),k=async()=>{N(!0);try{const L=await De("/api/db/match-pool-counts");L!=null&&L.success&&L.data&&v(L.data)}catch(L){console.error("加载池子人数失败:",L)}finally{N(!1)}},C=async()=>{a(!0);try{const L=await De("/api/db/config/full?key=match_config"),z=(L==null?void 0:L.data)??(L==null?void 0:L.config);if(z){let ee=z.poolSettings??Kc;ee.poolSource&&!Array.isArray(ee.poolSource)&&(ee={...ee,poolSource:[ee.poolSource]}),n({...Cw,...z,poolSettings:ee})}}catch(L){console.error("加载匹配配置失败:",L)}finally{a(!1)}};b.useEffect(()=>{C(),k()},[]);const E=async()=>{o(!0);try{const L=await vt("/api/db/config",{key:"match_config",value:e,description:"匹配功能配置"});le.error((L==null?void 0:L.success)!==!1?"配置保存成功!":"保存失败: "+((L==null?void 0:L.error)||"未知错误"))}catch(L){console.error(L),le.error("保存失败")}finally{o(!1)}},A=L=>{f(L),g({...L}),u(!0)},I=()=>{f(null),g({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),u(!0)},D=()=>{if(!m.id||!m.label){le.error("请填写类型ID和名称");return}const L=[...e.matchTypes];if(h){const z=L.findIndex(ee=>ee.id===h.id);z!==-1&&(L[z]={...m})}else{if(L.some(z=>z.id===m.id)){le.error("类型ID已存在");return}L.push({...m})}n({...e,matchTypes:L}),u(!1)},_=L=>{confirm("确定要删除这个匹配类型吗?")&&n({...e,matchTypes:e.matchTypes.filter(z=>z.id!==L)})},P=L=>{n({...e,matchTypes:e.matchTypes.map(z=>z.id===L?{...z,enabled:!z.enabled}:z)})};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsxs(ne,{variant:"outline",onClick:C,disabled:r,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${r?"animate-spin":""}`})," 刷新"]}),s.jsxs(ne,{onClick:E,disabled:i,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"})," ",i?"保存中...":"保存配置"]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(Qw,{className:"w-5 h-5 text-blue-400"})," 匹配池选择"]}),s.jsx(Ht,{className:"text-gray-400",children:"选择匹配的用户池和完善程度要求,只有满足条件的用户才可被匹配到"})]}),s.jsxs(Ce,{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx(te,{className:"text-gray-300",children:"匹配来源池"}),s.jsx("p",{className:"text-gray-500 text-xs",children:"可同时勾选多个池子(取并集匹配)"}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[{value:"vip",label:"超级个体(VIP会员)",desc:"付费 ¥1980 的VIP会员",icon:"👑",countKey:"vip"},{value:"complete",label:"完善资料用户",desc:"符合下方完善度要求的用户",icon:"✅",countKey:"complete"},{value:"all",label:"全部用户",desc:"所有已注册用户",icon:"👥",countKey:"all"}].map(L=>{const z=e.poolSettings??Kc,U=(Array.isArray(z.poolSource)?z.poolSource:[z.poolSource]).includes(L.value),he=y==null?void 0:y[L.countKey],me=()=>{const R=Array.isArray(z.poolSource)?[...z.poolSource]:[z.poolSource],O=U?R.filter(X=>X!==L.value):[...R,L.value];O.length===0&&O.push(L.value),n({...e,poolSettings:{...z,poolSource:O}})};return s.jsxs("button",{type:"button",onClick:me,className:`p-4 rounded-lg border text-left transition-all ${U?"border-[#38bdac] bg-[#38bdac]/10":"border-gray-700 bg-[#0a1628] hover:border-gray-600"}`,children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:`w-5 h-5 rounded border-2 flex items-center justify-center text-xs ${U?"border-[#38bdac] bg-[#38bdac] text-white":"border-gray-600"}`,children:U&&"✓"}),s.jsx("span",{className:"text-xl",children:L.icon}),s.jsx("span",{className:`text-sm font-medium ${U?"text-[#38bdac]":"text-gray-300"}`,children:L.label})]}),s.jsxs("span",{className:"text-lg font-bold text-white",children:[w?"...":he??"-",s.jsx("span",{className:"text-xs text-gray-500 font-normal ml-1",children:"人"})]})]}),s.jsx("p",{className:"text-gray-500 text-xs mt-2",children:L.desc}),s.jsx("span",{role:"link",tabIndex:0,onClick:R=>{R.stopPropagation(),t(`/users?pool=${L.value}`)},onKeyDown:R=>{R.key==="Enter"&&(R.stopPropagation(),t(`/users?pool=${L.value}`))},className:"text-[#38bdac] text-xs mt-2 inline-block hover:underline cursor-pointer",children:"查看用户列表 →"})]},L.value)})})]}),s.jsxs("div",{className:"space-y-3 pt-4 border-t border-gray-700/50",children:[s.jsx(te,{className:"text-gray-300",children:"用户资料完善要求(被匹配用户必须满足以下条件)"}),s.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[{key:"requirePhone",label:"有手机号",icon:"📱"},{key:"requireNickname",label:"有昵称",icon:"👤"},{key:"requireAvatar",label:"有头像",icon:"🖼️"},{key:"requireBusiness",label:"有业务需求",icon:"💼"}].map(L=>{const ee=(e.poolSettings??Kc)[L.key];return s.jsxs("div",{className:"flex items-center gap-3 bg-[#0a1628] rounded-lg p-3",children:[s.jsx(Et,{checked:ee,onCheckedChange:U=>n({...e,poolSettings:{...e.poolSettings??Kc,[L.key]:U}})}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{children:L.icon}),s.jsx(te,{className:"text-gray-300 text-sm",children:L.label})]})]},L.key)})})]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(qe,{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(yi,{className:"w-5 h-5 text-yellow-400"})," 基础设置"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),s.jsxs(Ce,{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"每日免费匹配次数"}),s.jsx(ie,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.freeMatchLimit,onChange:L=>n({...e,freeMatchLimit:parseInt(L.target.value,10)||0})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"付费匹配价格(元)"}),s.jsx(ie,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:e.matchPrice,onChange:L=>n({...e,matchPrice:parseFloat(L.target.value)||1})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"每日最大匹配次数"}),s.jsx(ie,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.settings.maxMatchesPerDay,onChange:L=>n({...e,settings:{...e.settings,maxMatchesPerDay:parseInt(L.target.value,10)||10}})})]})]}),s.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:e.settings.enableFreeMatches,onCheckedChange:L=>n({...e,settings:{...e.settings,enableFreeMatches:L}})}),s.jsx(te,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:e.settings.enablePaidMatches,onCheckedChange:L=>n({...e,settings:{...e.settings,enablePaidMatches:L}})}),s.jsx(te,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(qe,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(Ge,{className:"text-white flex items-center gap-2",children:[s.jsx(Mn,{className:"w-5 h-5 text-[#38bdac]"})," 匹配类型管理"]}),s.jsx(Ht,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(ne,{onClick:I,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(pn,{className:"w-4 h-4 mr-1"})," 添加类型"]})]}),s.jsx(Ce,{children:s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400",children:"图标"}),s.jsx(Ee,{className:"text-gray-400",children:"类型ID"}),s.jsx(Ee,{className:"text-gray-400",children:"显示名称"}),s.jsx(Ee,{className:"text-gray-400",children:"匹配标签"}),s.jsx(Ee,{className:"text-gray-400",children:"价格"}),s.jsx(Ee,{className:"text-gray-400",children:"数据库匹配"}),s.jsx(Ee,{className:"text-gray-400",children:"状态"}),s.jsx(Ee,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsx(gr,{children:e.matchTypes.map(L=>s.jsxs(lt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{children:s.jsx("span",{className:"text-2xl",children:L.icon})}),s.jsx(be,{className:"font-mono text-gray-300",children:L.id}),s.jsx(be,{className:"text-white font-medium",children:L.label}),s.jsx(be,{className:"text-gray-300",children:L.matchLabel}),s.jsx(be,{children:s.jsxs(Ke,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",L.price]})}),s.jsx(be,{children:L.matchFromDB?s.jsx(Ke,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):s.jsx(Ke,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),s.jsx(be,{children:s.jsx(Et,{checked:L.enabled,onCheckedChange:()=>P(L.id)})}),s.jsx(be,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>A(L),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx($t,{className:"w-4 h-4"})}),s.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>_(L.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(er,{className:"w-4 h-4"})})]})})]},L.id))})]})})]}),s.jsx(Ft,{open:c,onOpenChange:u,children:s.jsxs(Rt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[h?s.jsx($t,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(pn,{className:"w-5 h-5 text-[#38bdac]"}),h?"编辑匹配类型":"添加匹配类型"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"类型ID(英文)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:m.id,onChange:L=>g({...m,id:L.target.value}),disabled:!!h})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:OV.map(L=>s.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${m.icon===L?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>g({...m,icon:L}),children:L},L))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"显示名称"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.label,onChange:L=>g({...m,label:L.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"匹配标签"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.matchLabel,onChange:L=>g({...m,matchLabel:L.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"单次匹配价格(元)"}),s.jsx(ie,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:m.price,onChange:L=>g({...m,price:parseFloat(L.target.value)||1})})]}),s.jsxs("div",{className:"flex gap-6 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:m.matchFromDB,onCheckedChange:L=>g({...m,matchFromDB:L})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:m.showJoinAfterMatch,onCheckedChange:L=>g({...m,showJoinAfterMatch:L})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Et,{checked:m.enabled,onCheckedChange:L=>g({...m,enabled:L})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(ln,{children:[s.jsx(ne,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsxs(ne,{onClick:D,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-4 h-4 mr-2"})," 保存"]})]})]})})]})}const Ew={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function LV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(""),[f,m]=b.useState(!0),[g,y]=b.useState(null),[v,w]=b.useState(null);async function N(){m(!0),y(null);try{const E=new URLSearchParams({page:String(a),pageSize:String(o)});u&&E.set("matchType",u);const A=await De(`/api/db/match-records?${E}`);A!=null&&A.success?(e(A.records||[]),r(A.total??0)):y("加载匹配记录失败")}catch{y("加载失败,请检查网络后重试")}finally{m(!1)}}b.useEffect(()=>{N()},[a,u]);const k=Math.ceil(n/o)||1,C=({userId:E,nickname:A,avatar:I})=>s.jsxs("div",{className:"flex items-center gap-3 cursor-pointer group",onClick:()=>w(E),children:[s.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:[I?s.jsx("img",{src:ns(I),alt:"",className:"w-full h-full object-cover",onError:D=>{D.currentTarget.style.display="none"}}):null,s.jsx("span",{className:I?"hidden":"",children:(A||E||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white group-hover:text-[#38bdac] transition-colors",children:A||E}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[E==null?void 0:E.slice(0,16),(E==null?void 0:E.length)>16?"...":""]})]})]});return s.jsxs("div",{children:[g&&s.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:[s.jsx("span",{children:g}),s.jsx("button",{type:"button",onClick:()=>y(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("p",{className:"text-gray-400",children:["共 ",n," 条匹配记录 · 点击用户名查看详情"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("select",{value:u,onChange:E=>{h(E.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部类型"}),Object.entries(Ew).map(([E,A])=>s.jsx("option",{value:E,children:A},E))]}),s.jsxs("button",{type:"button",onClick:N,disabled:f,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(Ue,{className:`w-4 h-4 ${f?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ce,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400",children:"发起人"}),s.jsx(Ee,{className:"text-gray-400",children:"匹配到"}),s.jsx(Ee,{className:"text-gray-400",children:"类型"}),s.jsx(Ee,{className:"text-gray-400",children:"联系方式"}),s.jsx(Ee,{className:"text-gray-400",children:"匹配时间"})]})}),s.jsxs(gr,{children:[t.map(E=>s.jsxs(lt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{children:s.jsx(C,{userId:E.userId,nickname:E.userNickname,avatar:E.userAvatar})}),s.jsx(be,{children:E.matchedUserId?s.jsx(C,{userId:E.matchedUserId,nickname:E.matchedNickname,avatar:E.matchedUserAvatar}):s.jsx("span",{className:"text-gray-500",children:"—"})}),s.jsx(be,{children:s.jsx(Ke,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Ew[E.matchType]||E.matchType})}),s.jsxs(be,{className:"text-sm",children:[E.phone&&s.jsxs("div",{className:"text-green-400",children:["📱 ",E.phone]}),E.wechatId&&s.jsxs("div",{className:"text-blue-400",children:["💬 ",E.wechatId]}),!E.phone&&!E.wechatId&&s.jsx("span",{className:"text-gray-600",children:"-"})]}),s.jsx(be,{className:"text-gray-400",children:E.createdAt?new Date(E.createdAt).toLocaleString():"-"})]},E.id)),t.length===0&&s.jsx(lt,{children:s.jsx(be,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(ws,{page:a,totalPages:k,total:n,pageSize:o,onPageChange:i,onPageSizeChange:E=>{c(E),i(1)}})]})})}),s.jsx(i0,{open:!!v,onClose:()=>w(null),userId:v,onUserUpdated:N})]})}function _V(){const[t,e]=b.useState("records");return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>e("records"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="records"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"匹配记录"}),s.jsx("button",{type:"button",onClick:()=>e("pool"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="pool"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"匹配池设置"})]}),t==="records"&&s.jsx(LV,{}),t==="pool"&&s.jsx(DV,{})]})}const Tw={investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function zV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(!0),[f,m]=b.useState("investor"),[g,y]=b.useState(null);async function v(){h(!0);try{const C=new URLSearchParams({page:String(a),pageSize:String(o),matchType:f}),E=await De(`/api/db/match-records?${C}`);E!=null&&E.success&&(e(E.records||[]),r(E.total??0))}catch(C){console.error(C)}finally{h(!1)}}b.useEffect(()=>{v()},[a,f]);const w=async C=>{if(!C.phone&&!C.wechatId){le.info("该记录无联系方式,无法推送到存客宝");return}y(C.id);try{const E=await vt("/api/ckb/join",{type:C.matchType||"investor",phone:C.phone||"",wechat:C.wechatId||"",userId:C.userId,name:C.userNickname||""});le.error((E==null?void 0:E.message)||(E!=null&&E.success?"推送成功":"推送失败"))}catch(E){le.error("推送失败: "+(E instanceof Error?E.message:"网络错误"))}finally{y(null)}},N=Math.ceil(n/o)||1,k=C=>!!(C.phone||C.wechatId);return s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400",children:"点击获客:有人填写手机号/微信号的直接显示,可一键推送到存客宝"}),s.jsxs("p",{className:"text-gray-500 text-xs mt-1",children:["共 ",n," 条记录 — 有联系方式的可触发存客宝添加好友"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("select",{value:f,onChange:C=>{m(C.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:Object.entries(Tw).map(([C,E])=>s.jsx("option",{value:C,children:E},C))}),s.jsxs(ne,{onClick:v,disabled:u,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${u?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ce,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400",children:"发起人"}),s.jsx(Ee,{className:"text-gray-400",children:"匹配到"}),s.jsx(Ee,{className:"text-gray-400",children:"类型"}),s.jsx(Ee,{className:"text-gray-400",children:"联系方式"}),s.jsx(Ee,{className:"text-gray-400",children:"时间"}),s.jsx(Ee,{className:"text-gray-400 text-right",children:"操作"})]})}),s.jsxs(gr,{children:[t.map(C=>{var E,A;return s.jsxs(lt,{className:`border-gray-700/50 ${k(C)?"hover:bg-[#0a1628]":"opacity-60"}`,children:[s.jsx(be,{className:"text-white",children:C.userNickname||((E=C.userId)==null?void 0:E.slice(0,12))}),s.jsx(be,{className:"text-white",children:C.matchedNickname||((A=C.matchedUserId)==null?void 0:A.slice(0,12))}),s.jsx(be,{children:s.jsx(Ke,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Tw[C.matchType]||C.matchType})}),s.jsxs(be,{className:"text-sm",children:[C.phone&&s.jsxs("div",{className:"text-green-400",children:["📱 ",C.phone]}),C.wechatId&&s.jsxs("div",{className:"text-blue-400",children:["💬 ",C.wechatId]}),!C.phone&&!C.wechatId&&s.jsx("span",{className:"text-gray-600",children:"无联系方式"})]}),s.jsx(be,{className:"text-gray-400 text-sm",children:C.createdAt?new Date(C.createdAt).toLocaleString():"-"}),s.jsx(be,{className:"text-right",children:k(C)?s.jsxs(ne,{size:"sm",onClick:()=>w(C),disabled:g===C.id,className:"bg-[#38bdac] hover:bg-[#2da396] text-white text-xs h-7 px-3",children:[s.jsx(RA,{className:"w-3 h-3 mr-1"}),g===C.id?"推送中...":"推送CKB"]}):s.jsx("span",{className:"text-gray-600 text-xs",children:"—"})})]},C.id)}),t.length===0&&s.jsx(lt,{children:s.jsx(be,{colSpan:6,className:"text-center py-12 text-gray-500",children:"暂无记录"})})]})]}),s.jsx(ws,{page:a,totalPages:N,total:n,pageSize:o,onPageChange:i,onPageSizeChange:C=>{c(C),i(1)}})]})})})]})}const Mw={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},$V={single:"单次",half_year:"半年",year:"年度"};function FV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[a,i]=b.useState("");async function o(){r(!0);try{const c=a?`/api/db/mentor-consultations?status=${a}`:"/api/db/mentor-consultations",u=await De(c);u!=null&&u.success&&u.data&&e(u.data)}catch(c){console.error(c)}finally{r(!1)}}return b.useEffect(()=>{o()},[a]),s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsx("p",{className:"text-gray-400",children:"导师咨询预约记录"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("select",{value:a,onChange:c=>i(c.target.value),className:"bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2 text-gray-300 text-sm",children:[s.jsx("option",{value:"",children:"全部状态"}),Object.entries(Mw).map(([c,u])=>s.jsx("option",{value:c,children:u},c))]}),s.jsxs(ne,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(Ce,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400",children:"ID"}),s.jsx(Ee,{className:"text-gray-400",children:"用户ID"}),s.jsx(Ee,{className:"text-gray-400",children:"导师ID"}),s.jsx(Ee,{className:"text-gray-400",children:"类型"}),s.jsx(Ee,{className:"text-gray-400",children:"金额"}),s.jsx(Ee,{className:"text-gray-400",children:"状态"}),s.jsx(Ee,{className:"text-gray-400",children:"创建时间"})]})}),s.jsxs(gr,{children:[t.map(c=>s.jsxs(lt,{className:"border-gray-700/50",children:[s.jsx(be,{className:"text-gray-300",children:c.id}),s.jsx(be,{className:"text-gray-400",children:c.userId}),s.jsx(be,{className:"text-gray-400",children:c.mentorId}),s.jsx(be,{className:"text-gray-400",children:$V[c.consultationType]||c.consultationType}),s.jsxs(be,{className:"text-white",children:["¥",c.amount]}),s.jsx(be,{className:"text-gray-400",children:Mw[c.status]||c.status}),s.jsx(be,{className:"text-gray-500 text-sm",children:c.createdAt?new Date(c.createdAt).toLocaleString():"-"})]},c.id)),t.length===0&&s.jsx(lt,{children:s.jsx(be,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}function BV(){const[t,e]=b.useState("booking");return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>e("booking"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="booking"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"预约记录"}),s.jsx("button",{type:"button",onClick:()=>e("manage"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="manage"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"导师管理"})]}),t==="booking"&&s.jsx(FV,{}),t==="manage"&&s.jsx("div",{className:"-mx-8",children:s.jsx(B4,{embedded:!0})})]})}function VV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(!0);async function f(){h(!0);try{const g=new URLSearchParams({page:String(a),pageSize:String(o),matchType:"team"}),y=await De(`/api/db/match-records?${g}`);y!=null&&y.success&&(e(y.records||[]),r(y.total??0))}catch(g){console.error(g)}finally{h(!1)}}b.useEffect(()=>{f()},[a]);const m=Math.ceil(n/o)||1;return s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("div",{children:[s.jsxs("p",{className:"text-gray-400",children:["团队招募匹配记录,共 ",n," 条"]}),s.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"用户通过「团队招募」提交联系方式到存客宝"})]}),s.jsxs("button",{type:"button",onClick:f,disabled:u,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(Ue,{className:`w-4 h-4 ${u?"animate-spin":""}`})," 刷新"]})]}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(Ce,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Ue,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(pr,{children:[s.jsx(mr,{children:s.jsxs(lt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ee,{className:"text-gray-400",children:"发起人"}),s.jsx(Ee,{className:"text-gray-400",children:"匹配到"}),s.jsx(Ee,{className:"text-gray-400",children:"联系方式"}),s.jsx(Ee,{className:"text-gray-400",children:"时间"})]})}),s.jsxs(gr,{children:[t.map(g=>s.jsxs(lt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{className:"text-white",children:g.userNickname||g.userId}),s.jsx(be,{className:"text-white",children:g.matchedNickname||g.matchedUserId}),s.jsxs(be,{className:"text-gray-400 text-sm",children:[g.phone&&s.jsxs("div",{children:["📱 ",g.phone]}),g.wechatId&&s.jsxs("div",{children:["💬 ",g.wechatId]}),!g.phone&&!g.wechatId&&"-"]}),s.jsx(be,{className:"text-gray-400",children:g.createdAt?new Date(g.createdAt).toLocaleString():"-"})]},g.id)),t.length===0&&s.jsx(lt,{children:s.jsx(be,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无团队招募记录"})})]})]}),s.jsx(ws,{page:a,totalPages:m,total:n,pageSize:o,onPageChange:i,onPageSizeChange:g=>{c(g),i(1)}})]})})})]})}const Aw={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"},Iw={partner:"⭐",investor:"👥",mentor:"❤️",team:"🎮"};function HV({onSwitchTab:t,onOpenCKB:e}={}){const n=Di(),[r,a]=b.useState(null),[i,o]=b.useState(null),[c,u]=b.useState(!0),h=b.useCallback(async()=>{var m,g;u(!0);try{const[y,v]=await Promise.allSettled([De("/api/db/match-records?stats=true"),De("/api/db/ckb-plan-stats")]);if(y.status==="fulfilled"&&((m=y.value)!=null&&m.success)&&y.value.data){let w=y.value.data;if(w.totalMatches>0&&(!w.uniqueUsers||w.uniqueUsers===0))try{const N=await De("/api/db/match-records?page=1&pageSize=200");if(N!=null&&N.success&&N.records){const k=new Set(N.records.map(C=>C.userId).filter(Boolean));w={...w,uniqueUsers:k.size}}}catch{}a(w)}v.status==="fulfilled"&&((g=v.value)!=null&&g.success)&&v.value.data&&o(v.value.data)}catch(y){console.error("加载统计失败:",y)}finally{u(!1)}},[]);b.useEffect(()=>{h()},[h]);const f=m=>c?"—":String(m??0);return s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{children:[s.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[s.jsx(Mn,{className:"w-5 h-5 text-[#38bdac]"})," 找伙伴数据"]}),s.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-5",children:[s.jsx(Se,{className:"bg-gradient-to-br from-[#0f2137] to-[#162d4a] border-gray-700/40 cursor-pointer hover:border-[#38bdac]/60 transition-all",onClick:()=>t==null?void 0:t("partner"),children:s.jsxs(Ce,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"总匹配次数"}),s.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.totalMatches)}),s.jsxs("p",{className:"text-[#38bdac] text-xs mt-3 flex items-center gap-1",children:[s.jsx(Ks,{className:"w-3 h-3"})," 查看匹配记录"]})]})}),s.jsx(Se,{className:"bg-gradient-to-br from-[#0f2137] to-[#162d4a] border-gray-700/40 cursor-pointer hover:border-yellow-500/60 transition-all",onClick:()=>t==null?void 0:t("partner"),children:s.jsxs(Ce,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"今日匹配"}),s.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.todayMatches)}),s.jsxs("p",{className:"text-yellow-400/60 text-xs mt-3 flex items-center gap-1",children:[s.jsx(yi,{className:"w-3 h-3"})," 今日实时"]})]})}),s.jsx(Se,{className:"bg-gradient-to-br from-[#0f2137] to-[#162d4a] border-gray-700/40 cursor-pointer hover:border-blue-500/60 transition-all",onClick:()=>n("/users"),children:s.jsxs(Ce,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"匹配用户数"}),s.jsx("p",{className:"text-4xl font-bold text-white",children:f(r==null?void 0:r.uniqueUsers)}),s.jsxs("p",{className:"text-blue-400/60 text-xs mt-3 flex items-center gap-1",children:[s.jsx(Ks,{className:"w-3 h-3"})," 查看用户管理"]})]})}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/40",children:s.jsxs(Ce,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"人均匹配"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":r!=null&&r.uniqueUsers?(r.totalMatches/r.uniqueUsers).toFixed(1):"0"})]})}),s.jsx(Se,{className:"bg-[#0f2137] border-gray-700/40",children:s.jsxs(Ce,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"付费匹配次数"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:f(r==null?void 0:r.paidMatchCount)})]})})]})]}),(r==null?void 0:r.byType)&&r.byType.length>0&&s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold text-white mb-4",children:"各类型匹配分布"}),s.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:r.byType.map(m=>{const g=r.totalMatches>0?m.count/r.totalMatches*100:0;return s.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/40 rounded-xl p-5",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx("span",{className:"text-2xl",children:Iw[m.matchType]||"📊"}),s.jsx("span",{className:"text-gray-300 font-medium",children:Aw[m.matchType]||m.matchType})]}),s.jsx("p",{className:"text-3xl font-bold text-white mb-2",children:m.count}),s.jsx("div",{className:"w-full h-2 bg-gray-700/50 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-[#38bdac] rounded-full transition-all",style:{width:`${Math.min(g,100)}%`}})}),s.jsxs("p",{className:"text-gray-500 text-xs mt-1.5",children:[g.toFixed(1),"%"]})]},m.matchType)})})]}),s.jsxs("div",{children:[s.jsxs("h3",{className:"text-lg font-semibold text-white mb-4 flex items-center gap-2",children:[s.jsx(Ns,{className:"w-5 h-5 text-orange-400"})," AI 获客数据"]}),s.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-5 mb-6",children:[s.jsx(Se,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("submitted"),children:s.jsxs(Ce,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"已提交线索"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":(i==null?void 0:i.ckbTotal)??0}),s.jsx("p",{className:"text-orange-400/60 text-xs mt-2",children:"点击查看明细 →"})]})}),s.jsx(Se,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("contact"),children:s.jsxs(Ce,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"有联系方式"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:c?"—":(i==null?void 0:i.withContact)??0}),s.jsx("p",{className:"text-orange-400/60 text-xs mt-2",children:"点击查看明细 →"})]})}),s.jsx(Se,{className:"bg-[#0f2137] border-orange-500/20 cursor-pointer hover:border-orange-500/50 transition-colors",onClick:()=>e==null?void 0:e("test"),children:s.jsxs(Ce,{className:"p-6",children:[s.jsx("p",{className:"text-gray-400 text-sm mb-2",children:"AI 添加进度"}),s.jsx("p",{className:"text-xl font-bold text-orange-400",children:"查看详情 →"}),s.jsx("p",{className:"text-gray-500 text-xs mt-2",children:"添加成功率 · 回复率 · API 文档"})]})})]}),(i==null?void 0:i.byType)&&i.byType.length>0&&s.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 mb-6",children:i.byType.map(m=>s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-lg p-4 flex items-center gap-3",children:[s.jsx("span",{className:"text-xl",children:Iw[m.matchType]||"📋"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 text-xs",children:Aw[m.matchType]||m.matchType}),s.jsx("p",{className:"text-xl font-bold text-white",children:m.total})]})]},m.matchType))})]})]})}const WV=["partner","investor","mentor","team"],Sg=[{key:"join_partner",label:"找伙伴场景"},{key:"join_investor",label:"资源对接场景"},{key:"join_mentor",label:"导师顾问场景"},{key:"join_team",label:"团队招募场景"},{key:"match",label:"匹配上报"},{key:"lead",label:"链接卡若"}],Rw=`# 场景获客接口摘要 - 地址:POST /v1/api/scenarios - 必填:apiKey、sign、timestamp - 主标识:phone 或 wechatId 至少一项 - 可选:name、source、remark、tags、siteTags、portrait - 签名:排除 sign/apiKey/portrait,键名升序拼接值后双重 MD5 -- 成功:code=200,message=新增成功 或 已存在`;function UV({initialTab:t="overview"}){const[e,n]=b.useState(t),[r,a]=b.useState("13800000000"),[i,o]=b.useState(""),[c,u]=b.useState(""),[h,f]=b.useState(Rw),[m,g]=b.useState(!1),[y,v]=b.useState(!1),[w,N]=b.useState([]),[k,C]=b.useState([]),[E,A]=b.useState({}),[I,D]=b.useState([{endpoint:"/api/ckb/join",label:"找伙伴",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"资源对接",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"导师顾问",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"团队招募",method:"POST",status:"idle"},{endpoint:"/api/ckb/match",label:"匹配上报",method:"POST",status:"idle"},{endpoint:"/api/miniprogram/ckb/lead",label:"链接卡若",method:"POST",status:"idle"},{endpoint:"/api/match/config",label:"匹配配置",method:"GET",status:"idle"}]),_=b.useMemo(()=>{const R={};return Sg.forEach(O=>{R[O.key]=E[O.key]||{apiUrl:"https://ckbapi.quwanzhi.com/v1/api/scenarios",apiKey:"fyngh-ecy9h-qkdae-epwd5-rz6kd",source:"",tags:"",siteTags:"创业实验APP",notes:""}}),R},[E]),P=R=>{const O=r.trim(),X=i.trim();return R<=3?{type:WV[R],phone:O||void 0,wechat:X||void 0,userId:"admin_test",name:"后台测试"}:R===4?{matchType:"partner",phone:O||void 0,wechat:X||void 0,userId:"admin_test",nickname:"后台测试",matchedUser:{id:"test",nickname:"测试",matchScore:88}}:R===5?{phone:O||void 0,wechatId:X||void 0,userId:"admin_test",name:"后台测试"}:{}};async function L(){v(!0);try{const[R,O,X]=await Promise.all([De("/api/db/config/full?key=ckb_config"),De("/api/db/ckb-leads?mode=submitted&page=1&pageSize=50"),De("/api/db/ckb-leads?mode=contact&page=1&pageSize=50")]),$=R==null?void 0:R.data;$!=null&&$.routes&&A($.routes),$!=null&&$.docNotes&&u($.docNotes),$!=null&&$.docContent&&f($.docContent),O!=null&&O.success&&N(O.records||[]),X!=null&&X.success&&C(X.records||[])}finally{v(!1)}}b.useEffect(()=>{n(t)},[t]),b.useEffect(()=>{L()},[]);async function z(){g(!0);try{const R=await Nt("/api/db/config",{key:"ckb_config",value:{routes:_,docNotes:c,docContent:h},description:"存客宝接口配置"});le.error((R==null?void 0:R.success)!==!1?"存客宝配置已保存":`保存失败: ${(R==null?void 0:R.error)||"未知错误"}`)}catch(R){le.error(`保存失败: ${R instanceof Error?R.message:"网络错误"}`)}finally{g(!1)}}const ee=(R,O)=>{A(X=>({...X,[R]:{..._[R],...O}}))},U=async R=>{const O=I[R];if(O.method==="POST"&&!r.trim()&&!i.trim()){le.error("请填写测试手机号");return}const X=[...I];X[R]={...O,status:"testing",message:void 0,responseTime:void 0},D(X);const $=performance.now();try{const ce=O.method==="GET"?await De(O.endpoint):await Nt(O.endpoint,P(R)),Y=Math.round(performance.now()-$),F=(ce==null?void 0:ce.message)||"",W=(ce==null?void 0:ce.success)===!0||F.includes("已存在")||F.includes("已加入")||F.includes("已提交"),K=[...I];K[R]={...O,status:W?"success":"error",message:F||(W?"正常":"异常"),responseTime:Y},D(K),await L()}catch(ce){const Y=Math.round(performance.now()-$),F=[...I];F[R]={...O,status:"error",message:ce instanceof Error?ce.message:"失败",responseTime:Y},D(F)}},he=async()=>{if(!r.trim()&&!i.trim()){le.error("请填写测试手机号");return}for(let R=0;Rs.jsx("div",{className:"overflow-auto rounded-lg border border-gray-700/30",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{className:"bg-[#0a1628] text-gray-400",children:s.jsxs("tr",{children:[s.jsx("th",{className:"text-left px-4 py-3",children:"发起人"}),s.jsx("th",{className:"text-left px-4 py-3",children:"类型"}),s.jsx("th",{className:"text-left px-4 py-3",children:"手机号"}),s.jsx("th",{className:"text-left px-4 py-3",children:"微信号"}),s.jsx("th",{className:"text-left px-4 py-3",children:"时间"})]})}),s.jsx("tbody",{children:R.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:O})}):R.map(X=>s.jsxs("tr",{className:"border-t border-gray-700/30",children:[s.jsx("td",{className:"px-4 py-3 text-white",children:X.userNickname||X.userId}),s.jsx("td",{className:"px-4 py-3 text-gray-300",children:X.matchType}),s.jsx("td",{className:"px-4 py-3 text-green-400",children:X.phone||"—"}),s.jsx("td",{className:"px-4 py-3 text-blue-400",children:X.wechatId||"—"}),s.jsx("td",{className:"px-4 py-3 text-gray-400",children:X.createdAt?new Date(X.createdAt).toLocaleString():"—"})]},X.id))})]})});return s.jsx(Se,{className:"bg-[#0f2137] border-orange-500/30 mb-6",children:s.jsxs(Ce,{className:"p-5",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("h3",{className:"text-white font-semibold",children:"存客宝工作台"}),s.jsx(Ke,{className:"bg-orange-500/20 text-orange-400 border-0 text-xs",children:"CKB"}),s.jsxs("button",{type:"button",onClick:()=>n("doc"),className:"text-orange-400/60 text-xs hover:text-orange-400 flex items-center gap-1",children:[s.jsx(Ks,{className:"w-3 h-3"})," API 文档"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(ne,{onClick:()=>L(),variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-3.5 h-3.5 mr-1 ${y?"animate-spin":""}`})," 刷新"]}),s.jsxs(ne,{onClick:z,disabled:m,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-3.5 h-3.5 mr-1"})," ",m?"保存中...":"保存配置"]})]})]}),s.jsx("div",{className:"flex flex-wrap gap-2 mb-5",children:[["overview","概览"],["submitted","已提交线索"],["contact","有联系方式"],["config","场景配置"],["test","接口测试"],["doc","API 文档"]].map(([R,O])=>s.jsx("button",{type:"button",onClick:()=>n(R),className:`px-4 py-2 rounded-lg text-sm transition-colors ${e===R?"bg-orange-500 text-white":"bg-[#0a1628] text-gray-400 hover:text-white"}`,children:O},R))}),e==="overview"&&s.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"已提交线索"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:w.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"有联系方式"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:k.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"场景配置数"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:Sg.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"文档备注"}),s.jsx("p",{className:"text-sm text-gray-300 line-clamp-3",children:c||"未填写"})]})]}),e==="submitted"&&me(w,"暂无已提交线索"),e==="contact"&&me(k,"暂无有联系方式线索"),e==="config"&&s.jsx("div",{className:"space-y-4",children:Sg.map(R=>s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h4",{className:"text-white font-medium",children:R.label}),s.jsx(Ke,{className:"bg-orange-500/20 text-orange-300 border-0 text-xs",children:R.key})]}),s.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"API 地址"}),s.jsx(ie,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[R.key].apiUrl,onChange:O=>ee(R.key,{apiUrl:O.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"API Key"}),s.jsx(ie,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[R.key].apiKey,onChange:O=>ee(R.key,{apiKey:O.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"Source"}),s.jsx(ie,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[R.key].source,onChange:O=>ee(R.key,{source:O.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"Tags"}),s.jsx(ie,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[R.key].tags,onChange:O=>ee(R.key,{tags:O.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"SiteTags"}),s.jsx(ie,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[R.key].siteTags,onChange:O=>ee(R.key,{siteTags:O.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"说明备注"}),s.jsx(ie,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[R.key].notes,onChange:O=>ee(R.key,{notes:O.target.value})})]})]})]},R.key))}),e==="test"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex gap-3 mb-4",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[s.jsx(Dl,{className:"w-4 h-4 text-gray-500 shrink-0"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"测试手机号"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:r,onChange:R=>a(R.target.value)})]})]}),s.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[s.jsx("span",{className:"text-gray-500 text-sm shrink-0",children:"💬"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"微信号(可选)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:i,onChange:R=>o(R.target.value)})]})]}),s.jsx("div",{className:"flex items-end",children:s.jsxs(ne,{onClick:he,className:"bg-orange-500 hover:bg-orange-600 text-white",children:[s.jsx(yi,{className:"w-3.5 h-3.5 mr-1"})," 全部测试"]})})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-2",children:I.map((R,O)=>s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg px-3 py-2 border border-gray-700/30",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[R.status==="idle"&&s.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-600 shrink-0"}),R.status==="testing"&&s.jsx(Ue,{className:"w-3 h-3 text-yellow-400 animate-spin shrink-0"}),R.status==="success"&&s.jsx(Rg,{className:"w-3 h-3 text-green-400 shrink-0"}),R.status==="error"&&s.jsx(Jw,{className:"w-3 h-3 text-red-400 shrink-0"}),s.jsx("span",{className:"text-white text-xs truncate",children:R.label})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[R.responseTime!==void 0&&s.jsxs("span",{className:"text-gray-600 text-[10px]",children:[R.responseTime,"ms"]}),s.jsx("button",{type:"button",onClick:()=>U(O),disabled:R.status==="testing",className:"text-orange-400/60 hover:text-orange-400 text-[10px] disabled:opacity-50",children:"测试"})]})]},`${R.endpoint}-${O}`))})]}),e==="doc"&&s.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h4",{className:"text-white text-sm font-medium",children:"场景获客 API 摘要"}),s.jsxs("a",{href:"https://ckbapi.quwanzhi.com/v1/api/scenarios",target:"_blank",rel:"noreferrer",className:"text-orange-400/70 hover:text-orange-400 text-xs flex items-center gap-1",children:[s.jsx(Ks,{className:"w-3 h-3"})," 打开外链"]})]}),s.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-400 leading-6",children:h||Rw})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[s.jsx("h4",{className:"text-white text-sm font-medium mb-3",children:"说明备注(可编辑)"}),s.jsx("textarea",{className:"w-full min-h-[260px] bg-[#0f2137] border border-gray-700 rounded-md text-sm text-gray-300 p-3 outline-none focus:border-orange-500/50 resize-y",value:c,onChange:R=>u(R.target.value),placeholder:"记录 Token、入口差异、回复率统计规则、对接约定等。"})]})]})]})})}const KV=[{id:"stats",label:"数据统计",icon:Ig},{id:"partner",label:"找伙伴",icon:Mn},{id:"resource",label:"资源对接",icon:AM},{id:"mentor",label:"导师预约",icon:EM},{id:"team",label:"团队招募",icon:$g}];function qV(){const[t,e]=b.useState("stats"),[n,r]=b.useState(!1),[a,i]=b.useState("overview");return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"mb-6 flex items-start justify-between gap-4",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Mn,{className:"w-6 h-6 text-[#38bdac]"}),"找伙伴"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"数据统计、匹配池与记录、资源对接、导师预约、团队招募"})]}),s.jsxs(ne,{type:"button",variant:"outline",onClick:()=>r(o=>!o),className:"border-orange-500/40 text-orange-300 hover:bg-orange-500/10 bg-transparent",children:[s.jsx(Ns,{className:"w-4 h-4 mr-2"}),"存客宝"]})]}),n&&s.jsx(UV,{initialTab:a}),s.jsx("div",{className:"flex flex-wrap gap-1 mb-6 bg-[#0f2137] rounded-lg p-1 border border-gray-700/50",children:KV.map(o=>{const c=t===o.id;return s.jsxs("button",{type:"button",onClick:()=>e(o.id),className:`flex items-center gap-2 px-5 py-2.5 rounded-md text-sm font-medium transition-all ${c?"bg-[#38bdac] text-white shadow-lg":"text-gray-400 hover:text-white hover:bg-gray-700/50"}`,children:[s.jsx(o.icon,{className:"w-4 h-4"}),o.label]},o.id)})}),t==="stats"&&s.jsx(HV,{onSwitchTab:o=>e(o),onOpenCKB:o=>{i(o||"overview"),r(!0)}}),t==="partner"&&s.jsx(_V,{}),t==="resource"&&s.jsx(zV,{}),t==="mentor"&&s.jsx(BV,{}),t==="team"&&s.jsx(VV,{})]})}function GV(){return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-8",children:[s.jsx(Ns,{className:"w-8 h-8 text-[#38bdac]"}),s.jsx("h1",{className:"text-2xl font-bold text-white",children:"API 接口文档"})]}),s.jsx("p",{className:"text-gray-400 mb-6",children:"API 风格:RESTful · 版本 v1.0 · 基础路径 /api · 简单、清晰、易用。"}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(qe,{children:s.jsx(Ge,{className:"text-white",children:"1. 接口总览"})}),s.jsxs(Ce,{className:"space-y-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 mb-2",children:"接口分类"}),s.jsxs("ul",{className:"space-y-1 text-gray-300 font-mono",children:[s.jsx("li",{children:"/api/book — 书籍内容(章节列表、内容获取、同步)"}),s.jsx("li",{children:"/api/miniprogram/upload — 小程序上传(图片/视频、图片压缩)"}),s.jsx("li",{children:"/api/admin/content/upload — 管理端内容导入"}),s.jsx("li",{children:"/api/payment — 支付系统(订单创建、回调、状态查询)"}),s.jsx("li",{children:"/api/referral — 分销系统(邀请码、收益、提现)"}),s.jsx("li",{children:"/api/user — 用户系统(登录、注册、信息更新)"}),s.jsx("li",{children:"/api/match — 匹配系统(寻找匹配、匹配历史)"}),s.jsx("li",{children:"/api/admin — 管理后台(内容/订单/用户/分销管理)"}),s.jsx("li",{children:"/api/config — 配置系统"})]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 mb-2",children:"认证方式"}),s.jsx("p",{className:"text-gray-300",children:"用户:Cookie session_id(可选)"}),s.jsx("p",{className:"text-gray-300",children:"管理端:Authorization: Bearer admin-token-secret"})]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(qe,{children:s.jsx(Ge,{className:"text-white",children:"2. 书籍内容"})}),s.jsxs(Ce,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[s.jsx("p",{children:"GET /api/book/all-chapters — 获取所有章节"}),s.jsx("p",{children:"GET /api/book/chapter/:id — 获取单章内容"}),s.jsx("p",{children:"POST /api/book/sync — 同步章节(需管理员认证)"})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(qe,{children:s.jsx(Ge,{className:"text-white",children:"2.1 小程序上传接口"})}),s.jsxs(Ce,{className:"space-y-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 mb-1",children:"POST /api/miniprogram/upload/image — 图片上传(支持压缩)"}),s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"表单:file(必填)、folder(可选,默认 images)、quality(可选 1-100,默认 85)"}),s.jsx("p",{className:"text-gray-500 text-xs",children:"支持 jpeg/png/gif,单张最大 5MB。JPEG 按 quality 压缩。"}),s.jsx("pre",{className:"mt-2 p-2 rounded bg-black/40 text-green-400 text-xs overflow-x-auto",children:'响应示例: { "success": true, "url": "/uploads/images/xxx.jpg", "data": { "url", "fileName", "size", "type", "quality" } }'})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 mb-1",children:"POST /api/miniprogram/upload/video — 视频上传"}),s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"表单:file(必填)、folder(可选,默认 videos)"}),s.jsx("p",{className:"text-gray-500 text-xs",children:"支持 mp4/mov/avi,单个最大 100MB。"}),s.jsx("pre",{className:"mt-2 p-2 rounded bg-black/40 text-green-400 text-xs overflow-x-auto",children:'响应示例: { "success": true, "url": "/uploads/videos/xxx.mp4", "data": { "url", "fileName", "size", "type", "folder" } }'})]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(qe,{children:s.jsx(Ge,{className:"text-white",children:"2.2 管理端内容上传"})}),s.jsxs(Ce,{className:"space-y-3 text-sm",children:[s.jsx("p",{className:"text-gray-400",children:"POST /api/admin/content/upload — 内容导入(需 AdminAuth)"}),s.jsx("p",{className:"text-gray-500 text-xs",children:"通过 API 批量导入章节到内容管理,不直接操作数据库。"}),s.jsx("pre",{className:"p-2 rounded bg-black/40 text-green-400 text-xs overflow-x-auto",children:`请求体: { +- 成功:code=200,message=新增成功 或 已存在`;function UV({initialTab:t="overview"}){const[e,n]=b.useState(t),[r,a]=b.useState("13800000000"),[i,o]=b.useState(""),[c,u]=b.useState(""),[h,f]=b.useState(Rw),[m,g]=b.useState(!1),[y,v]=b.useState(!1),[w,N]=b.useState([]),[k,C]=b.useState([]),[E,A]=b.useState({}),[I,D]=b.useState([{endpoint:"/api/ckb/join",label:"找伙伴",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"资源对接",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"导师顾问",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"团队招募",method:"POST",status:"idle"},{endpoint:"/api/ckb/match",label:"匹配上报",method:"POST",status:"idle"},{endpoint:"/api/miniprogram/ckb/lead",label:"链接卡若",method:"POST",status:"idle"},{endpoint:"/api/match/config",label:"匹配配置",method:"GET",status:"idle"}]),_=b.useMemo(()=>{const R={};return Sg.forEach(O=>{R[O.key]=E[O.key]||{apiUrl:"https://ckbapi.quwanzhi.com/v1/api/scenarios",apiKey:"fyngh-ecy9h-qkdae-epwd5-rz6kd",source:"",tags:"",siteTags:"创业实验APP",notes:""}}),R},[E]),P=R=>{const O=r.trim(),X=i.trim();return R<=3?{type:WV[R],phone:O||void 0,wechat:X||void 0,userId:"admin_test",name:"后台测试"}:R===4?{matchType:"partner",phone:O||void 0,wechat:X||void 0,userId:"admin_test",nickname:"后台测试",matchedUser:{id:"test",nickname:"测试",matchScore:88}}:R===5?{phone:O||void 0,wechatId:X||void 0,userId:"admin_test",name:"后台测试"}:{}};async function L(){v(!0);try{const[R,O,X]=await Promise.all([De("/api/db/config/full?key=ckb_config"),De("/api/db/ckb-leads?mode=submitted&page=1&pageSize=50"),De("/api/db/ckb-leads?mode=contact&page=1&pageSize=50")]),$=R==null?void 0:R.data;$!=null&&$.routes&&A($.routes),$!=null&&$.docNotes&&u($.docNotes),$!=null&&$.docContent&&f($.docContent),O!=null&&O.success&&N(O.records||[]),X!=null&&X.success&&C(X.records||[])}finally{v(!1)}}b.useEffect(()=>{n(t)},[t]),b.useEffect(()=>{L()},[]);async function z(){g(!0);try{const R=await vt("/api/db/config",{key:"ckb_config",value:{routes:_,docNotes:c,docContent:h},description:"存客宝接口配置"});le.error((R==null?void 0:R.success)!==!1?"存客宝配置已保存":`保存失败: ${(R==null?void 0:R.error)||"未知错误"}`)}catch(R){le.error(`保存失败: ${R instanceof Error?R.message:"网络错误"}`)}finally{g(!1)}}const ee=(R,O)=>{A(X=>({...X,[R]:{..._[R],...O}}))},U=async R=>{const O=I[R];if(O.method==="POST"&&!r.trim()&&!i.trim()){le.error("请填写测试手机号");return}const X=[...I];X[R]={...O,status:"testing",message:void 0,responseTime:void 0},D(X);const $=performance.now();try{const ce=O.method==="GET"?await De(O.endpoint):await vt(O.endpoint,P(R)),Y=Math.round(performance.now()-$),F=(ce==null?void 0:ce.message)||"",W=(ce==null?void 0:ce.success)===!0||F.includes("已存在")||F.includes("已加入")||F.includes("已提交"),K=[...I];K[R]={...O,status:W?"success":"error",message:F||(W?"正常":"异常"),responseTime:Y},D(K),await L()}catch(ce){const Y=Math.round(performance.now()-$),F=[...I];F[R]={...O,status:"error",message:ce instanceof Error?ce.message:"失败",responseTime:Y},D(F)}},he=async()=>{if(!r.trim()&&!i.trim()){le.error("请填写测试手机号");return}for(let R=0;Rs.jsx("div",{className:"overflow-auto rounded-lg border border-gray-700/30",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{className:"bg-[#0a1628] text-gray-400",children:s.jsxs("tr",{children:[s.jsx("th",{className:"text-left px-4 py-3",children:"发起人"}),s.jsx("th",{className:"text-left px-4 py-3",children:"类型"}),s.jsx("th",{className:"text-left px-4 py-3",children:"手机号"}),s.jsx("th",{className:"text-left px-4 py-3",children:"微信号"}),s.jsx("th",{className:"text-left px-4 py-3",children:"时间"})]})}),s.jsx("tbody",{children:R.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:O})}):R.map(X=>s.jsxs("tr",{className:"border-t border-gray-700/30",children:[s.jsx("td",{className:"px-4 py-3 text-white",children:X.userNickname||X.userId}),s.jsx("td",{className:"px-4 py-3 text-gray-300",children:X.matchType}),s.jsx("td",{className:"px-4 py-3 text-green-400",children:X.phone||"—"}),s.jsx("td",{className:"px-4 py-3 text-blue-400",children:X.wechatId||"—"}),s.jsx("td",{className:"px-4 py-3 text-gray-400",children:X.createdAt?new Date(X.createdAt).toLocaleString():"—"})]},X.id))})]})});return s.jsx(Se,{className:"bg-[#0f2137] border-orange-500/30 mb-6",children:s.jsxs(Ce,{className:"p-5",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("h3",{className:"text-white font-semibold",children:"存客宝工作台"}),s.jsx(Ke,{className:"bg-orange-500/20 text-orange-400 border-0 text-xs",children:"CKB"}),s.jsxs("button",{type:"button",onClick:()=>n("doc"),className:"text-orange-400/60 text-xs hover:text-orange-400 flex items-center gap-1",children:[s.jsx(Ks,{className:"w-3 h-3"})," API 文档"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(ne,{onClick:()=>L(),variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ue,{className:`w-3.5 h-3.5 mr-1 ${y?"animate-spin":""}`})," 刷新"]}),s.jsxs(ne,{onClick:z,disabled:m,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(mn,{className:"w-3.5 h-3.5 mr-1"})," ",m?"保存中...":"保存配置"]})]})]}),s.jsx("div",{className:"flex flex-wrap gap-2 mb-5",children:[["overview","概览"],["submitted","已提交线索"],["contact","有联系方式"],["config","场景配置"],["test","接口测试"],["doc","API 文档"]].map(([R,O])=>s.jsx("button",{type:"button",onClick:()=>n(R),className:`px-4 py-2 rounded-lg text-sm transition-colors ${e===R?"bg-orange-500 text-white":"bg-[#0a1628] text-gray-400 hover:text-white"}`,children:O},R))}),e==="overview"&&s.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"已提交线索"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:w.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"有联系方式"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:k.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"场景配置数"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:Sg.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"文档备注"}),s.jsx("p",{className:"text-sm text-gray-300 line-clamp-3",children:c||"未填写"})]})]}),e==="submitted"&&me(w,"暂无已提交线索"),e==="contact"&&me(k,"暂无有联系方式线索"),e==="config"&&s.jsx("div",{className:"space-y-4",children:Sg.map(R=>s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h4",{className:"text-white font-medium",children:R.label}),s.jsx(Ke,{className:"bg-orange-500/20 text-orange-300 border-0 text-xs",children:R.key})]}),s.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"API 地址"}),s.jsx(ie,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[R.key].apiUrl,onChange:O=>ee(R.key,{apiUrl:O.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"API Key"}),s.jsx(ie,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[R.key].apiKey,onChange:O=>ee(R.key,{apiKey:O.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"Source"}),s.jsx(ie,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[R.key].source,onChange:O=>ee(R.key,{source:O.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"Tags"}),s.jsx(ie,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[R.key].tags,onChange:O=>ee(R.key,{tags:O.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"SiteTags"}),s.jsx(ie,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[R.key].siteTags,onChange:O=>ee(R.key,{siteTags:O.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"说明备注"}),s.jsx(ie,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[R.key].notes,onChange:O=>ee(R.key,{notes:O.target.value})})]})]})]},R.key))}),e==="test"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex gap-3 mb-4",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[s.jsx(Dl,{className:"w-4 h-4 text-gray-500 shrink-0"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"测试手机号"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:r,onChange:R=>a(R.target.value)})]})]}),s.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[s.jsx("span",{className:"text-gray-500 text-sm shrink-0",children:"💬"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"微信号(可选)"}),s.jsx(ie,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:i,onChange:R=>o(R.target.value)})]})]}),s.jsx("div",{className:"flex items-end",children:s.jsxs(ne,{onClick:he,className:"bg-orange-500 hover:bg-orange-600 text-white",children:[s.jsx(yi,{className:"w-3.5 h-3.5 mr-1"})," 全部测试"]})})]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-2",children:I.map((R,O)=>s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg px-3 py-2 border border-gray-700/30",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[R.status==="idle"&&s.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-600 shrink-0"}),R.status==="testing"&&s.jsx(Ue,{className:"w-3 h-3 text-yellow-400 animate-spin shrink-0"}),R.status==="success"&&s.jsx(Rg,{className:"w-3 h-3 text-green-400 shrink-0"}),R.status==="error"&&s.jsx(Jw,{className:"w-3 h-3 text-red-400 shrink-0"}),s.jsx("span",{className:"text-white text-xs truncate",children:R.label})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[R.responseTime!==void 0&&s.jsxs("span",{className:"text-gray-600 text-[10px]",children:[R.responseTime,"ms"]}),s.jsx("button",{type:"button",onClick:()=>U(O),disabled:R.status==="testing",className:"text-orange-400/60 hover:text-orange-400 text-[10px] disabled:opacity-50",children:"测试"})]})]},`${R.endpoint}-${O}`))})]}),e==="doc"&&s.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("h4",{className:"text-white text-sm font-medium",children:"场景获客 API 摘要"}),s.jsxs("a",{href:"https://ckbapi.quwanzhi.com/v1/api/scenarios",target:"_blank",rel:"noreferrer",className:"text-orange-400/70 hover:text-orange-400 text-xs flex items-center gap-1",children:[s.jsx(Ks,{className:"w-3 h-3"})," 打开外链"]})]}),s.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-400 leading-6",children:h||Rw})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[s.jsx("h4",{className:"text-white text-sm font-medium mb-3",children:"说明备注(可编辑)"}),s.jsx("textarea",{className:"w-full min-h-[260px] bg-[#0f2137] border border-gray-700 rounded-md text-sm text-gray-300 p-3 outline-none focus:border-orange-500/50 resize-y",value:c,onChange:R=>u(R.target.value),placeholder:"记录 Token、入口差异、回复率统计规则、对接约定等。"})]})]})]})})}const KV=[{id:"stats",label:"数据统计",icon:Ig},{id:"partner",label:"找伙伴",icon:Mn},{id:"resource",label:"资源对接",icon:AM},{id:"mentor",label:"导师预约",icon:EM},{id:"team",label:"团队招募",icon:$g}];function qV(){const[t,e]=b.useState("stats"),[n,r]=b.useState(!1),[a,i]=b.useState("overview");return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"mb-6 flex items-start justify-between gap-4",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Mn,{className:"w-6 h-6 text-[#38bdac]"}),"找伙伴"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"数据统计、匹配池与记录、资源对接、导师预约、团队招募"})]}),s.jsxs(ne,{type:"button",variant:"outline",onClick:()=>r(o=>!o),className:"border-orange-500/40 text-orange-300 hover:bg-orange-500/10 bg-transparent",children:[s.jsx(Ns,{className:"w-4 h-4 mr-2"}),"存客宝"]})]}),n&&s.jsx(UV,{initialTab:a}),s.jsx("div",{className:"flex flex-wrap gap-1 mb-6 bg-[#0f2137] rounded-lg p-1 border border-gray-700/50",children:KV.map(o=>{const c=t===o.id;return s.jsxs("button",{type:"button",onClick:()=>e(o.id),className:`flex items-center gap-2 px-5 py-2.5 rounded-md text-sm font-medium transition-all ${c?"bg-[#38bdac] text-white shadow-lg":"text-gray-400 hover:text-white hover:bg-gray-700/50"}`,children:[s.jsx(o.icon,{className:"w-4 h-4"}),o.label]},o.id)})}),t==="stats"&&s.jsx(HV,{onSwitchTab:o=>e(o),onOpenCKB:o=>{i(o||"overview"),r(!0)}}),t==="partner"&&s.jsx(_V,{}),t==="resource"&&s.jsx(zV,{}),t==="mentor"&&s.jsx(BV,{}),t==="team"&&s.jsx(VV,{})]})}function GV(){return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-8",children:[s.jsx(Ns,{className:"w-8 h-8 text-[#38bdac]"}),s.jsx("h1",{className:"text-2xl font-bold text-white",children:"API 接口文档"})]}),s.jsx("p",{className:"text-gray-400 mb-6",children:"API 风格:RESTful · 版本 v1.0 · 基础路径 /api · 简单、清晰、易用。"}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(qe,{children:s.jsx(Ge,{className:"text-white",children:"1. 接口总览"})}),s.jsxs(Ce,{className:"space-y-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 mb-2",children:"接口分类"}),s.jsxs("ul",{className:"space-y-1 text-gray-300 font-mono",children:[s.jsx("li",{children:"/api/book — 书籍内容(章节列表、内容获取、同步)"}),s.jsx("li",{children:"/api/miniprogram/upload — 小程序上传(图片/视频、图片压缩)"}),s.jsx("li",{children:"/api/admin/content/upload — 管理端内容导入"}),s.jsx("li",{children:"/api/payment — 支付系统(订单创建、回调、状态查询)"}),s.jsx("li",{children:"/api/referral — 分销系统(邀请码、收益、提现)"}),s.jsx("li",{children:"/api/user — 用户系统(登录、注册、信息更新)"}),s.jsx("li",{children:"/api/match — 匹配系统(寻找匹配、匹配历史)"}),s.jsx("li",{children:"/api/admin — 管理后台(内容/订单/用户/分销管理)"}),s.jsx("li",{children:"/api/config — 配置系统"})]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 mb-2",children:"认证方式"}),s.jsx("p",{className:"text-gray-300",children:"用户:Cookie session_id(可选)"}),s.jsx("p",{className:"text-gray-300",children:"管理端:Authorization: Bearer admin-token-secret"})]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(qe,{children:s.jsx(Ge,{className:"text-white",children:"2. 书籍内容"})}),s.jsxs(Ce,{className:"space-y-2 text-sm text-gray-300 font-mono",children:[s.jsx("p",{children:"GET /api/book/all-chapters — 获取所有章节"}),s.jsx("p",{children:"GET /api/book/chapter/:id — 获取单章内容"}),s.jsx("p",{children:"POST /api/book/sync — 同步章节(需管理员认证)"})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(qe,{children:s.jsx(Ge,{className:"text-white",children:"2.1 小程序上传接口"})}),s.jsxs(Ce,{className:"space-y-4 text-sm",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 mb-1",children:"POST /api/miniprogram/upload/image — 图片上传(支持压缩)"}),s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"表单:file(必填)、folder(可选,默认 images)、quality(可选 1-100,默认 85)"}),s.jsx("p",{className:"text-gray-500 text-xs",children:"支持 jpeg/png/gif,单张最大 5MB。JPEG 按 quality 压缩。"}),s.jsx("pre",{className:"mt-2 p-2 rounded bg-black/40 text-green-400 text-xs overflow-x-auto",children:'响应示例: { "success": true, "url": "/uploads/images/xxx.jpg", "data": { "url", "fileName", "size", "type", "quality" } }'})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400 mb-1",children:"POST /api/miniprogram/upload/video — 视频上传"}),s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"表单:file(必填)、folder(可选,默认 videos)"}),s.jsx("p",{className:"text-gray-500 text-xs",children:"支持 mp4/mov/avi,单个最大 100MB。"}),s.jsx("pre",{className:"mt-2 p-2 rounded bg-black/40 text-green-400 text-xs overflow-x-auto",children:'响应示例: { "success": true, "url": "/uploads/videos/xxx.mp4", "data": { "url", "fileName", "size", "type", "folder" } }'})]})]})]}),s.jsxs(Se,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(qe,{children:s.jsx(Ge,{className:"text-white",children:"2.2 管理端内容上传"})}),s.jsxs(Ce,{className:"space-y-3 text-sm",children:[s.jsx("p",{className:"text-gray-400",children:"POST /api/admin/content/upload — 内容导入(需 AdminAuth)"}),s.jsx("p",{className:"text-gray-500 text-xs",children:"通过 API 批量导入章节到内容管理,不直接操作数据库。"}),s.jsx("pre",{className:"p-2 rounded bg-black/40 text-green-400 text-xs overflow-x-auto",children:`请求体: { "action": "import", "data": [{ "id": "ch-001", diff --git a/soul-admin/dist/assets/index-Q6CWPvkN.css b/soul-admin/dist/assets/index-Q6CWPvkN.css deleted file mode 100644 index 6239f27a..00000000 --- a/soul-admin/dist/assets/index-Q6CWPvkN.css +++ /dev/null @@ -1 +0,0 @@ -.rich-editor-wrapper{border:1px solid #374151;border-radius:.5rem;background:#0a1628;overflow:hidden}.rich-editor-toolbar{display:flex;align-items:center;gap:2px;padding:6px 8px;border-bottom:1px solid #374151;background:#0f1d32;flex-wrap:wrap}.toolbar-group{display:flex;align-items:center;gap:1px}.toolbar-divider{width:1px;height:20px;background:#374151;margin:0 4px}.rich-editor-toolbar button{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:4px;border:none;background:transparent;color:#9ca3af;cursor:pointer;transition:all .15s}.rich-editor-toolbar button:hover{background:#1f2937;color:#d1d5db}.rich-editor-toolbar button.is-active{background:#38bdac33;color:#38bdac}.rich-editor-toolbar button:disabled{opacity:.3;cursor:not-allowed}.link-tag-select{background:#0a1628;border:1px solid #374151;color:#d1d5db;font-size:12px;padding:2px 6px;border-radius:4px;cursor:pointer;max-width:160px}.link-input-bar{display:flex;align-items:center;gap:4px;padding:4px 8px;border-bottom:1px solid #374151;background:#0f1d32}.link-input{flex:1;background:#0a1628;border:1px solid #374151;color:#fff;padding:4px 8px;border-radius:4px;font-size:13px}.link-confirm,.link-remove{padding:4px 10px;border-radius:4px;border:none;font-size:12px;cursor:pointer}.link-confirm{background:#38bdac;color:#fff}.link-remove{background:#374151;color:#9ca3af}.rich-editor-content{min-height:300px;max-height:500px;overflow-y:auto;padding:12px 16px;color:#e5e7eb;font-size:14px;line-height:1.7}.rich-editor-content:focus{outline:none}.rich-editor-content h1{font-size:1.5em;font-weight:700;margin:.8em 0 .4em;color:#fff}.rich-editor-content h2{font-size:1.3em;font-weight:600;margin:.7em 0 .3em;color:#fff}.rich-editor-content h3{font-size:1.15em;font-weight:600;margin:.6em 0 .3em;color:#fff}.rich-editor-content p{margin:.4em 0}.rich-editor-content strong{color:#fff}.rich-editor-content code{background:#1f2937;padding:2px 6px;border-radius:3px;font-size:.9em;color:#38bdac}.rich-editor-content pre{background:#1f2937;padding:12px;border-radius:6px;overflow-x:auto;margin:.6em 0}.rich-editor-content blockquote{border-left:3px solid #38bdac;padding-left:12px;margin:.6em 0;color:#9ca3af}.rich-editor-content ul,.rich-editor-content ol{padding-left:1.5em;margin:.4em 0}.rich-editor-content li{margin:.2em 0}.rich-editor-content hr{border:none;border-top:1px solid #374151;margin:1em 0}.rich-editor-content img{max-width:100%;border-radius:6px;margin:.5em 0}.rich-editor-content a,.rich-link{color:#38bdac;text-decoration:underline;cursor:pointer}.rich-editor-content table{border-collapse:collapse;width:100%;margin:.5em 0}.rich-editor-content th,.rich-editor-content td{border:1px solid #374151;padding:6px 10px;text-align:left}.rich-editor-content th{background:#1f2937;font-weight:600}.rich-editor-content .ProseMirror-placeholder:before{content:attr(data-placeholder);color:#6b7280;float:left;height:0;pointer-events:none}.mention-tag{background:#38bdac26;color:#38bdac;border-radius:4px;padding:1px 4px;font-weight:500}.link-tag-node{background:#ffd7001f;color:gold;border-radius:4px;padding:1px 4px;font-weight:500;cursor:default;-webkit-user-select:all;user-select:all}.mention-popup{position:fixed;z-index:9999;background:#1a2638;border:1px solid #374151;border-radius:8px;padding:4px;min-width:180px;max-height:240px;overflow-y:auto;box-shadow:0 4px 20px #0006}.mention-item{display:flex;align-items:center;justify-content:space-between;padding:6px 10px;border-radius:4px;cursor:pointer;color:#d1d5db;font-size:13px}.mention-item:hover,.mention-item.is-selected{background:#38bdac26;color:#38bdac}.mention-name{font-weight:500}.mention-id{font-size:11px;color:#6b7280}.bubble-menu{display:flex;gap:2px;background:#1a2638;border:1px solid #374151;border-radius:6px;padding:4px;box-shadow:0 4px 12px #0000004d}.bubble-menu button{display:flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:4px;border:none;background:transparent;color:#9ca3af;cursor:pointer}.bubble-menu button:hover{background:#1f2937;color:#d1d5db}.bubble-menu button.is-active{color:#38bdac}.mention-trigger-btn{color:#38bdac!important}.mention-trigger-btn:hover{background:#38bdac33!important}.upload-progress-bar{display:flex;align-items:center;gap:8px;padding:4px 10px;background:#0f1d32;border-bottom:1px solid #374151}.upload-progress-track{flex:1;height:4px;background:#1f2937;border-radius:2px;overflow:hidden}.upload-progress-fill{height:100%;background:linear-gradient(90deg,#38bdac,#4ae3ce);border-radius:2px;transition:width .3s ease}.upload-progress-text{font-size:11px;color:#38bdac;white-space:nowrap}/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-pan-x:initial;--tw-pan-y:initial;--tw-pinch-zoom:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial}}}@layer theme{:root,:host{--font-sans:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-sky-200:oklch(90.1% .058 230.902);--color-sky-300:oklch(82.8% .111 230.318);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-rose-400:oklch(71.2% .194 13.428);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5/2.25);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--blur-xl:24px;--blur-3xl:64px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.not-sr-only{clip-path:none;white-space:normal;width:auto;height:auto;margin:0;padding:0;position:static;overflow:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.-top-2\.5{top:calc(var(--spacing)*-2.5)}.top-0{top:calc(var(--spacing)*0)}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-4{top:calc(var(--spacing)*4)}.top-16{top:calc(var(--spacing)*16)}.top-\[50\%\]{top:50%}.right-0{right:calc(var(--spacing)*0)}.right-1{right:calc(var(--spacing)*1)}.right-1\/4{right:25%}.right-4{right:calc(var(--spacing)*4)}.bottom-1\/4{bottom:25%}.-left-2\.5{left:calc(var(--spacing)*-2.5)}.left-0{left:calc(var(--spacing)*0)}.left-1\/4{left:25%}.left-2{left:calc(var(--spacing)*2)}.left-3{left:calc(var(--spacing)*3)}.left-\[50\%\]{left:50%}.isolate{isolation:isolate}.isolation-auto{isolation:auto}.z-10{z-index:10}.z-50{z-index:50}.col-span-2{grid-column:span 2/span 2}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.-mx-2{margin-inline:calc(var(--spacing)*-2)}.-mx-8{margin-inline:calc(var(--spacing)*-8)}.mx-20{margin-inline:calc(var(--spacing)*20)}.mx-auto{margin-inline:auto}.-mt-6{margin-top:calc(var(--spacing)*-6)}.mt-0{margin-top:calc(var(--spacing)*0)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-1\.5{margin-top:calc(var(--spacing)*1.5)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mt-8{margin-top:calc(var(--spacing)*8)}.mr-1{margin-right:calc(var(--spacing)*1)}.mr-2{margin-right:calc(var(--spacing)*2)}.mr-3{margin-right:calc(var(--spacing)*3)}.mr-auto{margin-right:auto}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-1\.5{margin-bottom:calc(var(--spacing)*1.5)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-4{margin-left:calc(var(--spacing)*4)}.ml-6{margin-left:calc(var(--spacing)*6)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.flow-root{display:flow-root}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline\!{display:inline!important}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.inline-grid{display:inline-grid}.inline-table{display:inline-table}.list-item{display:list-item}.table{display:table}.table\!{display:table!important}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-column{display:table-column}.table-column-group{display:table-column-group}.table-footer-group{display:table-footer-group}.table-header-group{display:table-header-group}.table-row{display:table-row}.table-row-group{display:table-row-group}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.size-9{width:calc(var(--spacing)*9);height:calc(var(--spacing)*9)}.size-10{width:calc(var(--spacing)*10);height:calc(var(--spacing)*10)}.h-0\.5{height:calc(var(--spacing)*.5)}.h-1\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-3{height:calc(var(--spacing)*3)}.h-3\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-16{height:calc(var(--spacing)*16)}.h-20{height:calc(var(--spacing)*20)}.h-24{height:calc(var(--spacing)*24)}.h-96{height:calc(var(--spacing)*96)}.h-auto{height:auto}.h-full{height:100%}.max-h-60{max-height:calc(var(--spacing)*60)}.max-h-96{max-height:calc(var(--spacing)*96)}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[250px\]{max-height:250px}.max-h-\[300px\]{max-height:300px}.max-h-\[400px\]{max-height:400px}.max-h-\[450px\]{max-height:450px}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-8{min-height:calc(var(--spacing)*8)}.min-h-\[32px\]{min-height:32px}.min-h-\[40px\]{min-height:40px}.min-h-\[60vh\]{min-height:60vh}.min-h-\[72px\]{min-height:72px}.min-h-\[80px\]{min-height:80px}.min-h-\[100px\]{min-height:100px}.min-h-\[120px\]{min-height:120px}.min-h-\[260px\]{min-height:260px}.min-h-\[400px\]{min-height:400px}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-0\.5{width:calc(var(--spacing)*.5)}.w-2{width:calc(var(--spacing)*2)}.w-3{width:calc(var(--spacing)*3)}.w-3\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-7{width:calc(var(--spacing)*7)}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-10{width:calc(var(--spacing)*10)}.w-12{width:calc(var(--spacing)*12)}.w-16{width:calc(var(--spacing)*16)}.w-20{width:calc(var(--spacing)*20)}.w-24{width:calc(var(--spacing)*24)}.w-28{width:calc(var(--spacing)*28)}.w-32{width:calc(var(--spacing)*32)}.w-36{width:calc(var(--spacing)*36)}.w-40{width:calc(var(--spacing)*40)}.w-44{width:calc(var(--spacing)*44)}.w-48{width:calc(var(--spacing)*48)}.w-52{width:calc(var(--spacing)*52)}.w-56{width:calc(var(--spacing)*56)}.w-64{width:calc(var(--spacing)*64)}.w-96{width:calc(var(--spacing)*96)}.w-\[200px\]{width:200px}.w-fit{width:fit-content}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[140px\]{max-width:140px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[250px\]{max-width:250px}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-48{min-width:calc(var(--spacing)*48)}.min-w-\[8rem\]{min-width:8rem}.min-w-\[60px\]{min-width:60px}.min-w-\[120px\]{min-width:120px}.min-w-\[1024px\]{min-width:1024px}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-1\/2{--tw-translate-x: 50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-none{translate:none}.scale-3d{scale:var(--tw-scale-x)var(--tw-scale-y)var(--tw-scale-z)}.scale-\[0\.98\]{scale:.98}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-pointer{cursor:pointer}.touch-pinch-zoom{--tw-pinch-zoom:pinch-zoom;touch-action:var(--tw-pan-x,)var(--tw-pan-y,)var(--tw-pinch-zoom,)}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-\[40px_40px_1fr_80px_80px_80px_60px\]{grid-template-columns:40px 40px 1fr 80px 80px 80px 60px}.grid-cols-\[60px_1fr_100px_100px_80px_120px\]{grid-template-columns:60px 1fr 100px 100px 80px 120px}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:calc(var(--spacing)*0)}.gap-0\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-5{gap:calc(var(--spacing)*5)}.gap-6{gap:calc(var(--spacing)*6)}.gap-8{gap:calc(var(--spacing)*8)}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*0)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*0)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*8)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-reverse>:not(:last-child)){--tw-space-y-reverse:1}.gap-x-8{column-gap:calc(var(--spacing)*8)}:where(.space-x-reverse>:not(:last-child)){--tw-space-x-reverse:1}.gap-y-4{row-gap:calc(var(--spacing)*4)}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px*var(--tw-divide-x-reverse));border-inline-end-width:calc(1px*calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-y-reverse>:not(:last-child)){--tw-divide-y-reverse:1}:where(.divide-gray-700\/50>:not(:last-child)){border-color:#36415380}@supports (color:color-mix(in lab,red,red)){:where(.divide-gray-700\/50>:not(:last-child)){border-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}:where(.divide-white\/5>:not(:last-child)){border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){:where(.divide-white\/5>:not(:last-child)){border-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-s{border-start-start-radius:.25rem;border-end-start-radius:.25rem}.rounded-ss{border-start-start-radius:.25rem}.rounded-e{border-start-end-radius:.25rem;border-end-end-radius:.25rem}.rounded-se{border-start-end-radius:.25rem}.rounded-ee{border-end-end-radius:.25rem}.rounded-es{border-end-start-radius:.25rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-tl{border-top-left-radius:.25rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-r-md{border-top-right-radius:var(--radius-md);border-bottom-right-radius:var(--radius-md)}.rounded-tr{border-top-right-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-br{border-bottom-right-radius:.25rem}.rounded-bl{border-bottom-left-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-\[\#07C160\]{border-color:#07c160}.border-\[\#07C160\]\/20{border-color:#07c16033}.border-\[\#07C160\]\/30{border-color:#07c1604d}.border-\[\#38bdac\]{border-color:#38bdac}.border-\[\#38bdac\]\/20{border-color:#38bdac33}.border-\[\#38bdac\]\/30{border-color:#38bdac4d}.border-\[\#38bdac\]\/40{border-color:#38bdac66}.border-\[\#38bdac\]\/50{border-color:#38bdac80}.border-amber-400\/60{border-color:#fcbb0099}@supports (color:color-mix(in lab,red,red)){.border-amber-400\/60{border-color:color-mix(in oklab,var(--color-amber-400)60%,transparent)}}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.border-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/40{border-color:color-mix(in oklab,var(--color-amber-500)40%,transparent)}}.border-amber-500\/50{border-color:#f99c0080}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/50{border-color:color-mix(in oklab,var(--color-amber-500)50%,transparent)}}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/30{border-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.border-blue-500\/40{border-color:#3080ff66}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/40{border-color:color-mix(in oklab,var(--color-blue-500)40%,transparent)}}.border-blue-500\/50{border-color:#3080ff80}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/50{border-color:color-mix(in oklab,var(--color-blue-500)50%,transparent)}}.border-cyan-500\/30{border-color:#00b7d74d}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/30{border-color:color-mix(in oklab,var(--color-cyan-500)30%,transparent)}}.border-cyan-500\/40{border-color:#00b7d766}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/40{border-color:color-mix(in oklab,var(--color-cyan-500)40%,transparent)}}.border-gray-500{border-color:var(--color-gray-500)}.border-gray-600{border-color:var(--color-gray-600)}.border-gray-700{border-color:var(--color-gray-700)}.border-gray-700\/30{border-color:#3641534d}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/30{border-color:color-mix(in oklab,var(--color-gray-700)30%,transparent)}}.border-gray-700\/40{border-color:#36415366}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/40{border-color:color-mix(in oklab,var(--color-gray-700)40%,transparent)}}.border-gray-700\/50{border-color:#36415380}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/50{border-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.border-gray-700\/60{border-color:#36415399}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/60{border-color:color-mix(in oklab,var(--color-gray-700)60%,transparent)}}.border-green-500\/30{border-color:#00c7584d}@supports (color:color-mix(in lab,red,red)){.border-green-500\/30{border-color:color-mix(in oklab,var(--color-green-500)30%,transparent)}}.border-green-500\/40{border-color:#00c75866}@supports (color:color-mix(in lab,red,red)){.border-green-500\/40{border-color:color-mix(in oklab,var(--color-green-500)40%,transparent)}}.border-inherit{border-color:inherit}.border-orange-500\/20{border-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/20{border-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.border-orange-500\/30{border-color:#fe6e004d}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/30{border-color:color-mix(in oklab,var(--color-orange-500)30%,transparent)}}.border-orange-500\/40{border-color:#fe6e0066}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/40{border-color:color-mix(in oklab,var(--color-orange-500)40%,transparent)}}.border-orange-500\/50{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/50{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.border-purple-500\/20{border-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/20{border-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.border-purple-500\/30{border-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/30{border-color:color-mix(in oklab,var(--color-purple-500)30%,transparent)}}.border-purple-500\/40{border-color:#ac4bff66}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/40{border-color:color-mix(in oklab,var(--color-purple-500)40%,transparent)}}.border-red-500{border-color:var(--color-red-500)}.border-red-500\/20{border-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.border-red-500\/20{border-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.border-red-500\/50{border-color:#fb2c3680}@supports (color:color-mix(in lab,red,red)){.border-red-500\/50{border-color:color-mix(in oklab,var(--color-red-500)50%,transparent)}}.border-transparent{border-color:#0000}.border-white\/5{border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.border-white\/5{border-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.border-white\/20{border-color:#fff3}@supports (color:color-mix(in lab,red,red)){.border-white\/20{border-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.border-yellow-500\/30{border-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/30{border-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.border-yellow-500\/40{border-color:#edb20066}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/40{border-color:color-mix(in oklab,var(--color-yellow-500)40%,transparent)}}.bg-\[\#0a1628\]{background-color:#0a1628}.bg-\[\#0a1628\]\/50{background-color:#0a162880}.bg-\[\#0a1628\]\/60{background-color:#0a162899}.bg-\[\#0b1828\]{background-color:#0b1828}.bg-\[\#0f2137\]{background-color:#0f2137}.bg-\[\#00CED1\]{background-color:#00ced1}.bg-\[\#1C1C1E\]{background-color:#1c1c1e}.bg-\[\#07C160\]{background-color:#07c160}.bg-\[\#07C160\]\/5{background-color:#07c1600d}.bg-\[\#07C160\]\/10{background-color:#07c1601a}.bg-\[\#38bdac\]{background-color:#38bdac}.bg-\[\#38bdac\]\/5{background-color:#38bdac0d}.bg-\[\#38bdac\]\/10{background-color:#38bdac1a}.bg-\[\#38bdac\]\/15{background-color:#38bdac26}.bg-\[\#38bdac\]\/20{background-color:#38bdac33}.bg-\[\#38bdac\]\/30{background-color:#38bdac4d}.bg-\[\#38bdac\]\/60{background-color:#38bdac99}.bg-\[\#38bdac\]\/80{background-color:#38bdaccc}.bg-\[\#050c18\]{background-color:#050c18}.bg-\[\#162840\]{background-color:#162840}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/5{background-color:color-mix(in oklab,var(--color-amber-500)5%,transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\/30{background-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.bg-black\/30{background-color:color-mix(in oklab,var(--color-black)30%,transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black)40%,transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black)60%,transparent)}}.bg-black\/90{background-color:#000000e6}@supports (color:color-mix(in lab,red,red)){.bg-black\/90{background-color:color-mix(in oklab,var(--color-black)90%,transparent)}}.bg-blue-500\/5{background-color:#3080ff0d}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/5{background-color:color-mix(in oklab,var(--color-blue-500)5%,transparent)}}.bg-blue-500\/10{background-color:#3080ff1a}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/10{background-color:color-mix(in oklab,var(--color-blue-500)10%,transparent)}}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.bg-cyan-500{background-color:var(--color-cyan-500)}.bg-cyan-500\/20{background-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/20{background-color:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.bg-emerald-500\/20{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/20{background-color:color-mix(in oklab,var(--color-emerald-500)20%,transparent)}}.bg-gray-500{background-color:var(--color-gray-500)}.bg-gray-500\/20{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\/20{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.bg-gray-600{background-color:var(--color-gray-600)}.bg-gray-600\/20{background-color:#4a556533}@supports (color:color-mix(in lab,red,red)){.bg-gray-600\/20{background-color:color-mix(in oklab,var(--color-gray-600)20%,transparent)}}.bg-gray-600\/50{background-color:#4a556580}@supports (color:color-mix(in lab,red,red)){.bg-gray-600\/50{background-color:color-mix(in oklab,var(--color-gray-600)50%,transparent)}}.bg-gray-700{background-color:var(--color-gray-700)}.bg-gray-700\/50{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.bg-gray-700\/50{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\/10{background-color:#00c7581a}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/10{background-color:color-mix(in oklab,var(--color-green-500)10%,transparent)}}.bg-green-500\/20{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/20{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.bg-green-600{background-color:var(--color-green-600)}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-500\/10{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/10{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.bg-purple-500\/20{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/20{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.bg-red-600{background-color:var(--color-red-600)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.bg-white\/5{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.bg-white\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.bg-white\/20{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.bg-yellow-500\/20{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.bg-yellow-500\/20{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-\[\#0f2137\]{--tw-gradient-from:#0f2137;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#00CED1\]{--tw-gradient-from:#00ced1;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#38bdac\]\/10{--tw-gradient-from:oklab(72.378% -.11483 -.0053193/.1);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-blue-500\/20{--tw-gradient-from:#3080ff33}@supports (color:color-mix(in lab,red,red)){.from-blue-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.from-blue-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-cyan-500\/20{--tw-gradient-from:#00b7d733}@supports (color:color-mix(in lab,red,red)){.from-cyan-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.from-cyan-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-green-500\/20{--tw-gradient-from:#00c75833}@supports (color:color-mix(in lab,red,red)){.from-green-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.from-green-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-purple-500\/20{--tw-gradient-from:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.from-purple-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.from-purple-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-yellow-500\/20{--tw-gradient-from:#edb20033}@supports (color:color-mix(in lab,red,red)){.from-yellow-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.from-yellow-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.via-\[\#38bdac\]\/30{--tw-gradient-via:oklab(72.378% -.11483 -.0053193/.3);--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-\[\#0f2137\]{--tw-gradient-to:#0f2137;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-\[\#20B2AA\]{--tw-gradient-to:#20b2aa;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-\[\#162d4a\]{--tw-gradient-to:#162d4a;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-amber-500\/20{--tw-gradient-to:#f99c0033}@supports (color:color-mix(in lab,red,red)){.to-amber-500\/20{--tw-gradient-to:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.to-amber-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-cyan-500\/5{--tw-gradient-to:#00b7d70d}@supports (color:color-mix(in lab,red,red)){.to-cyan-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-cyan-500)5%,transparent)}}.to-cyan-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-green-500\/5{--tw-gradient-to:#00c7580d}@supports (color:color-mix(in lab,red,red)){.to-green-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-green-500)5%,transparent)}}.to-green-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-purple-500\/5{--tw-gradient-to:#ac4bff0d}@supports (color:color-mix(in lab,red,red)){.to-purple-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-purple-500)5%,transparent)}}.to-purple-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-yellow-500\/5{--tw-gradient-to:#edb2000d}@supports (color:color-mix(in lab,red,red)){.to-yellow-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-yellow-500)5%,transparent)}}.to-yellow-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.bg-repeat{background-repeat:repeat}.mask-no-clip{-webkit-mask-clip:no-clip;mask-clip:no-clip}.mask-repeat{-webkit-mask-repeat:repeat;mask-repeat:repeat}.fill-amber-400{fill:var(--color-amber-400)}.fill-current{fill:currentColor}.object-cover{object-fit:cover}.p-0{padding:calc(var(--spacing)*0)}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.p-2\.5{padding:calc(var(--spacing)*2.5)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.px-0{padding-inline:calc(var(--spacing)*0)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-5{padding-block:calc(var(--spacing)*5)}.py-6{padding-block:calc(var(--spacing)*6)}.py-8{padding-block:calc(var(--spacing)*8)}.py-10{padding-block:calc(var(--spacing)*10)}.py-12{padding-block:calc(var(--spacing)*12)}.py-16{padding-block:calc(var(--spacing)*16)}.py-20{padding-block:calc(var(--spacing)*20)}.pt-0{padding-top:calc(var(--spacing)*0)}.pt-1{padding-top:calc(var(--spacing)*1)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-4{padding-top:calc(var(--spacing)*4)}.pt-5{padding-top:calc(var(--spacing)*5)}.pt-6{padding-top:calc(var(--spacing)*6)}.pr-1{padding-right:calc(var(--spacing)*1)}.pr-2{padding-right:calc(var(--spacing)*2)}.pr-4{padding-right:calc(var(--spacing)*4)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-3{padding-bottom:calc(var(--spacing)*3)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-4{padding-left:calc(var(--spacing)*4)}.pl-8{padding-left:calc(var(--spacing)*8)}.pl-10{padding-left:calc(var(--spacing)*10)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-6{--tw-leading:calc(var(--spacing)*6);line-height:calc(var(--spacing)*6)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.text-wrap{text-wrap:wrap}.break-all{word-break:break-all}.text-clip{text-overflow:clip}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#00CED1\]{color:#00ced1}.text-\[\#07C160\]{color:#07c160}.text-\[\#07C160\]\/60{color:#07c16099}.text-\[\#07C160\]\/70{color:#07c160b3}.text-\[\#07C160\]\/80{color:#07c160cc}.text-\[\#26A17B\]{color:#26a17b}.text-\[\#38bdac\]{color:#38bdac}.text-\[\#38bdac\]\/30{color:#38bdac4d}.text-\[\#38bdac\]\/40{color:#38bdac66}.text-\[\#169BD7\]{color:#169bd7}.text-\[\#1677FF\]{color:#1677ff}.text-\[\#FFD700\]{color:gold}.text-amber-200{color:var(--color-amber-200)}.text-amber-200\/80{color:#fee685cc}@supports (color:color-mix(in lab,red,red)){.text-amber-200\/80{color:color-mix(in oklab,var(--color-amber-200)80%,transparent)}}.text-amber-300{color:var(--color-amber-300)}.text-amber-400{color:var(--color-amber-400)}.text-amber-400\/30{color:#fcbb004d}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/30{color:color-mix(in oklab,var(--color-amber-400)30%,transparent)}}.text-amber-400\/90{color:#fcbb00e6}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/90{color:color-mix(in oklab,var(--color-amber-400)90%,transparent)}}.text-black{color:var(--color-black)}.text-blue-300{color:var(--color-blue-300)}.text-blue-300\/60{color:#90c5ff99}@supports (color:color-mix(in lab,red,red)){.text-blue-300\/60{color:color-mix(in oklab,var(--color-blue-300)60%,transparent)}}.text-blue-400{color:var(--color-blue-400)}.text-blue-400\/60{color:#54a2ff99}@supports (color:color-mix(in lab,red,red)){.text-blue-400\/60{color:color-mix(in oklab,var(--color-blue-400)60%,transparent)}}.text-cyan-400{color:var(--color-cyan-400)}.text-emerald-400{color:var(--color-emerald-400)}.text-gray-200{color:var(--color-gray-200)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-green-300{color:var(--color-green-300)}.text-green-400{color:var(--color-green-400)}.text-green-400\/90{color:#05df72e6}@supports (color:color-mix(in lab,red,red)){.text-green-400\/90{color:color-mix(in oklab,var(--color-green-400)90%,transparent)}}.text-green-500{color:var(--color-green-500)}.text-orange-300{color:var(--color-orange-300)}.text-orange-300\/60{color:#ffb96d99}@supports (color:color-mix(in lab,red,red)){.text-orange-300\/60{color:color-mix(in oklab,var(--color-orange-300)60%,transparent)}}.text-orange-400{color:var(--color-orange-400)}.text-orange-400\/60{color:#ff8b1a99}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/60{color:color-mix(in oklab,var(--color-orange-400)60%,transparent)}}.text-orange-400\/70{color:#ff8b1ab3}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/70{color:color-mix(in oklab,var(--color-orange-400)70%,transparent)}}.text-orange-400\/80{color:#ff8b1acc}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/80{color:color-mix(in oklab,var(--color-orange-400)80%,transparent)}}.text-purple-400{color:var(--color-purple-400)}.text-red-400{color:var(--color-red-400)}.text-rose-400{color:var(--color-rose-400)}.text-sky-300{color:var(--color-sky-300)}.text-white{color:var(--color-white)}.text-white\/40{color:#fff6}@supports (color:color-mix(in lab,red,red)){.text-white\/40{color:color-mix(in oklab,var(--color-white)40%,transparent)}}.text-white\/60{color:#fff9}@supports (color:color-mix(in lab,red,red)){.text-white\/60{color:color-mix(in oklab,var(--color-white)60%,transparent)}}.text-white\/70{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.text-white\/70{color:color-mix(in oklab,var(--color-white)70%,transparent)}}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.text-white\/80{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.text-yellow-400{color:var(--color-yellow-400)}.text-yellow-400\/60{color:#fac80099}@supports (color:color-mix(in lab,red,red)){.text-yellow-400\/60{color:color-mix(in oklab,var(--color-yellow-400)60%,transparent)}}.text-yellow-500\/70{color:#edb200b3}@supports (color:color-mix(in lab,red,red)){.text-yellow-500\/70{color:color-mix(in oklab,var(--color-yellow-500)70%,transparent)}}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.italic\!{font-style:italic!important}.not-italic{font-style:normal}.diagonal-fractions{--tw-numeric-fraction:diagonal-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.stacked-fractions{--tw-numeric-fraction:stacked-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.normal-nums{font-variant-numeric:normal}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.overline{text-decoration-line:overline}.underline{text-decoration-line:underline}.underline\!{text-decoration-line:underline!important}.underline-offset-4{text-underline-offset:4px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.subpixel-antialiased{-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto}.accent-\[\#38bdac\]{accent-color:#38bdac}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-55{opacity:.55}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-0{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.inset-ring{--tw-inset-ring-shadow:inset 0 0 0 1px var(--tw-inset-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[\#38bdac\]\/20{--tw-shadow-color:#38bdac33}@supports (color:color-mix(in lab,red,red)){.shadow-\[\#38bdac\]\/20{--tw-shadow-color:color-mix(in oklab,oklab(72.378% -.11483 -.0053193/.2) var(--tw-shadow-alpha),transparent)}}.shadow-\[\#38bdac\]\/30{--tw-shadow-color:#38bdac4d}@supports (color:color-mix(in lab,red,red)){.shadow-\[\#38bdac\]\/30{--tw-shadow-color:color-mix(in oklab,oklab(72.378% -.11483 -.0053193/.3) var(--tw-shadow-alpha),transparent)}}.ring-\[\#38bdac\]{--tw-ring-color:#38bdac}.ring-\[\#38bdac\]\/40{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.4)}.ring-\[\#38bdac\]\/50{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.5)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.blur-3xl{--tw-blur:blur(var(--blur-3xl));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.drop-shadow{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#0000001a))drop-shadow(0 1px 1px var(--tw-drop-shadow-color,#0000000f));--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a)drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter\!{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)!important}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-grayscale{--tw-backdrop-grayscale:grayscale(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-invert{--tw-backdrop-invert:invert(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-sepia{--tw-backdrop-sepia:sepia(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition\!{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events!important;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))!important;transition-duration:var(--tw-duration,var(--default-transition-duration))!important}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}:where(.divide-x-reverse>:not(:last-child)){--tw-divide-x-reverse:1}.ring-inset{--tw-ring-inset:inset}@media(hover:hover){.group-hover\:text-\[\#38bdac\]:is(:where(.group):hover *){color:#38bdac}.group-hover\:text-gray-400:is(:where(.group):hover *){color:var(--color-gray-400)}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.peer-disabled\:cursor-not-allowed:is(:where(.peer):disabled~*){cursor:not-allowed}.peer-disabled\:opacity-70:is(:where(.peer):disabled~*){opacity:.7}.placeholder\:text-gray-500::placeholder{color:var(--color-gray-500)}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}@media(hover:hover){.hover\:border-\[\#38bdac\]\/30:hover{border-color:#38bdac4d}.hover\:border-\[\#38bdac\]\/50:hover{border-color:#38bdac80}.hover\:border-\[\#38bdac\]\/60:hover{border-color:#38bdac99}.hover\:border-\[\#38bdac\]\/70:hover{border-color:#38bdacb3}.hover\:border-blue-500\/60:hover{border-color:#3080ff99}@supports (color:color-mix(in lab,red,red)){.hover\:border-blue-500\/60:hover{border-color:color-mix(in oklab,var(--color-blue-500)60%,transparent)}}.hover\:border-gray-500:hover{border-color:var(--color-gray-500)}.hover\:border-gray-600:hover{border-color:var(--color-gray-600)}.hover\:border-orange-500\/50:hover{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.hover\:border-orange-500\/50:hover{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.hover\:border-yellow-500\/60:hover{border-color:#edb20099}@supports (color:color-mix(in lab,red,red)){.hover\:border-yellow-500\/60:hover{border-color:color-mix(in oklab,var(--color-yellow-500)60%,transparent)}}.hover\:bg-\[\#0a1628\]:hover{background-color:#0a1628}.hover\:bg-\[\#0a1628\]\/80:hover{background-color:#0a1628cc}.hover\:bg-\[\#1a3050\]:hover{background-color:#1a3050}.hover\:bg-\[\#2da396\]:hover{background-color:#2da396}.hover\:bg-\[\#06AD51\]:hover{background-color:#06ad51}.hover\:bg-\[\#07C160\]\/10:hover{background-color:#07c1601a}.hover\:bg-\[\#20B2AA\]:hover{background-color:#20b2aa}.hover\:bg-\[\#38bdac\]\/10:hover{background-color:#38bdac1a}.hover\:bg-\[\#38bdac\]\/20:hover{background-color:#38bdac33}.hover\:bg-\[\#162840\]:hover{background-color:#162840}.hover\:bg-\[\#162840\]\/30:hover{background-color:#1628404d}.hover\:bg-\[\#162840\]\/50:hover{background-color:#16284080}.hover\:bg-amber-500\/10:hover{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/10:hover{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.hover\:bg-amber-500\/20:hover{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/20:hover{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.hover\:bg-amber-500\/30:hover{background-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/30:hover{background-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.hover\:bg-amber-600:hover{background-color:var(--color-amber-600)}.hover\:bg-blue-400\/10:hover{background-color:#54a2ff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-400\/10:hover{background-color:color-mix(in oklab,var(--color-blue-400)10%,transparent)}}.hover\:bg-blue-500\/20:hover{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-500\/20:hover{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.hover\:bg-gray-500:hover{background-color:var(--color-gray-500)}.hover\:bg-gray-500\/20:hover{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-500\/20:hover{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.hover\:bg-gray-700:hover{background-color:var(--color-gray-700)}.hover\:bg-gray-700\/50:hover{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-700\/50:hover{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.hover\:bg-gray-800:hover{background-color:var(--color-gray-800)}.hover\:bg-green-500\/20:hover{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.hover\:bg-green-500\/20:hover{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.hover\:bg-green-700:hover{background-color:var(--color-green-700)}.hover\:bg-orange-400\/10:hover{background-color:#ff8b1a1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-400\/10:hover{background-color:color-mix(in oklab,var(--color-orange-400)10%,transparent)}}.hover\:bg-orange-500\/10:hover{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/10:hover{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.hover\:bg-orange-500\/20:hover{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/20:hover{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.hover\:bg-orange-600:hover{background-color:var(--color-orange-600)}.hover\:bg-purple-500\/10:hover{background-color:#ac4bff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/10:hover{background-color:color-mix(in oklab,var(--color-purple-500)10%,transparent)}}.hover\:bg-purple-500\/20:hover{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/20:hover{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.hover\:bg-purple-500\/30:hover{background-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/30:hover{background-color:color-mix(in oklab,var(--color-purple-500)30%,transparent)}}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.hover\:bg-red-500\/20:hover{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/20:hover{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.hover\:bg-red-700:hover{background-color:var(--color-red-700)}.hover\:bg-white\/5:hover{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/5:hover{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.hover\:bg-white\/20:hover{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/20:hover{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.hover\:bg-yellow-500\/20:hover{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-500\/20:hover{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.hover\:bg-yellow-500\/30:hover{background-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-500\/30:hover{background-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.hover\:text-\[\#2da396\]:hover{color:#2da396}.hover\:text-\[\#5fe0cd\]:hover{color:#5fe0cd}.hover\:text-\[\#38bdac\]:hover{color:#38bdac}.hover\:text-amber-200:hover{color:var(--color-amber-200)}.hover\:text-amber-300:hover{color:var(--color-amber-300)}.hover\:text-amber-400:hover{color:var(--color-amber-400)}.hover\:text-blue-300:hover{color:var(--color-blue-300)}.hover\:text-blue-400:hover{color:var(--color-blue-400)}.hover\:text-gray-300:hover{color:var(--color-gray-300)}.hover\:text-green-400:hover{color:var(--color-green-400)}.hover\:text-orange-400:hover{color:var(--color-orange-400)}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:text-sky-200:hover{color:var(--color-sky-200)}.hover\:text-white:hover{color:var(--color-white)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}}.focus\:border-\[\#38bdac\]:focus{border-color:#38bdac}.focus\:border-orange-500\/50:focus{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.focus\:border-orange-500\/50:focus{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.focus\:bg-\[\#38bdac\]\/20:focus{background-color:#38bdac33}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-\[\#38bdac\]:focus{--tw-ring-color:#38bdac}.focus\:ring-amber-400:focus{--tw-ring-color:var(--color-amber-400)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:ring-0:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[3px\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[\#38bdac\]:focus-visible{--tw-ring-color:#38bdac}.focus-visible\:ring-red-500:focus-visible{--tw-ring-color:var(--color-red-500)}.focus-visible\:ring-offset-0:focus-visible{--tw-ring-offset-width:0px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus-visible\:ring-offset-\[\#0a1628\]:focus-visible{--tw-ring-offset-color:#0a1628}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.has-\[\>svg\]\:px-2\.5:has(>svg){padding-inline:calc(var(--spacing)*2.5)}.has-\[\>svg\]\:px-3:has(>svg){padding-inline:calc(var(--spacing)*3)}.has-\[\>svg\]\:px-4:has(>svg){padding-inline:calc(var(--spacing)*4)}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:calc(var(--spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=active\]\:bg-\[\#07C160\]\/20[data-state=active]{background-color:#07c16033}.data-\[state\=active\]\:bg-\[\#26A17B\]\/20[data-state=active]{background-color:#26a17b33}.data-\[state\=active\]\:bg-\[\#38bdac\]\/20[data-state=active]{background-color:#38bdac33}.data-\[state\=active\]\:bg-\[\#1677FF\]\/20[data-state=active]{background-color:#1677ff33}.data-\[state\=active\]\:bg-\[\#003087\]\/20[data-state=active]{background-color:#00308733}.data-\[state\=active\]\:bg-amber-500\/20[data-state=active]{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.data-\[state\=active\]\:bg-amber-500\/20[data-state=active]{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.data-\[state\=active\]\:bg-purple-500\/20[data-state=active]{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.data-\[state\=active\]\:bg-purple-500\/20[data-state=active]{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.data-\[state\=active\]\:font-medium[data-state=active]{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.data-\[state\=active\]\:text-\[\#07C160\][data-state=active]{color:#07c160}.data-\[state\=active\]\:text-\[\#26A17B\][data-state=active]{color:#26a17b}.data-\[state\=active\]\:text-\[\#38bdac\][data-state=active]{color:#38bdac}.data-\[state\=active\]\:text-\[\#169BD7\][data-state=active]{color:#169bd7}.data-\[state\=active\]\:text-\[\#1677FF\][data-state=active]{color:#1677ff}.data-\[state\=active\]\:text-amber-400[data-state=active]{color:var(--color-amber-400)}.data-\[state\=active\]\:text-purple-400[data-state=active]{color:var(--color-purple-400)}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x:calc(var(--spacing)*4);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=checked\]\:bg-\[\#38bdac\][data-state=checked]{background-color:#38bdac}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=unchecked\]\:bg-gray-600[data-state=unchecked]{background-color:var(--color-gray-600)}@media(min-width:40rem){.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.sm\:text-left{text-align:left}}@media(min-width:48rem){.md\:col-span-2{grid-column:span 2/span 2}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@media(min-width:64rem){.lg\:block{display:block}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}@media(min-width:80rem){.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.\[\&_tr\]\:border-b tr{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-style:var(--tw-border-style);border-width:0}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:calc(var(--spacing)*0)}.\[\&\>span\]\:line-clamp-1>span{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}}:root{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20% .02 240);--card-foreground:oklch(98.5% 0 0);--popover:oklch(20% .02 240);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(65% .15 180);--primary-foreground:oklch(20% 0 0);--secondary:oklch(27% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(27% 0 0);--muted-foreground:oklch(65% 0 0);--accent:oklch(27% 0 0);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(55% .2 25);--destructive-foreground:oklch(98.5% 0 0);--border:oklch(35% 0 0);--input:oklch(35% 0 0);--ring:oklch(65% .15 180);--radius:.625rem}body{font-family:var(--font-sans);color:var(--foreground);background:#0a1628}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-pan-x{syntax:"*";inherits:false}@property --tw-pan-y{syntax:"*";inherits:false}@property --tw-pinch-zoom{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}} diff --git a/soul-admin/dist/index.html b/soul-admin/dist/index.html index 14567d56..60a03d02 100644 --- a/soul-admin/dist/index.html +++ b/soul-admin/dist/index.html @@ -4,8 +4,8 @@ 管理后台 - Soul创业派对 - - + +
diff --git a/soul-admin/src/pages/content/ContentPage.tsx b/soul-admin/src/pages/content/ContentPage.tsx index debb4883..136dd324 100644 --- a/soul-admin/src/pages/content/ContentPage.tsx +++ b/soul-admin/src/pages/content/ContentPage.tsx @@ -2454,17 +2454,37 @@ export function ContentPage() {

添加人物时同步创建存客宝场景获客计划,配置与存客宝 API 获客一致

- +
+ + +
{persons.length > 0 && ( diff --git a/soul-api/.env.production b/soul-api/.env.production index f378e8a4..55f06a16 100644 --- a/soul-api/.env.production +++ b/soul-api/.env.production @@ -14,8 +14,10 @@ DB_DSN=cdb_outerroot:Zhiqun1984@tcp(56b4c23f6853c.gz.cdb.myqcloud.com:14413)/sou # 统一 API 域名(支付回调、转账回调、apiDomain 等由此派生;无需尾部斜杠) API_BASE_URL=https://soulapi.quwanzhi.com -#添加卡若 +# 存客宝配置 CKB_LEAD_API_KEY=2y4v5-rjhfc-sg5wy-zklkv-bg0tl +CKB_OPEN_API_KEY=mI9Ol-NO6cS-ho3Py-7Pj22-WyK3A +CKB_OPEN_ACCOUNT=karuo1 # 微信小程序配置 WECHAT_APPID=wxb8bbb2b10dec74aa diff --git a/soul-api/internal/handler/admin_user_rules.go b/soul-api/internal/handler/admin_user_rules.go index a99604a4..9d3da2fa 100644 --- a/soul-api/internal/handler/admin_user_rules.go +++ b/soul-api/internal/handler/admin_user_rules.go @@ -11,6 +11,21 @@ import ( "gorm.io/gorm" ) +// MiniprogramUserRules GET /api/miniprogram/user-rules(小程序端,只返回启用的规则) +func MiniprogramUserRules(c *gin.Context) { + db := database.DB() + var rules []model.UserRule + if err := db.Where("enabled = ?", true).Order("sort ASC, id ASC").Find(&rules).Error; err != nil { + c.JSON(http.StatusOK, gin.H{"success": false, "error": err.Error()}) + return + } + out := make([]gin.H, 0, len(rules)) + for _, r := range rules { + out = append(out, gin.H{"id": r.ID, "title": r.Title, "description": r.Description, "trigger": r.Trigger, "sort": r.Sort}) + } + c.JSON(http.StatusOK, gin.H{"success": true, "rules": out}) +} + // DBUserRulesList GET /api/db/user-rules func DBUserRulesList(c *gin.Context) { db := database.DB() diff --git a/soul-api/internal/handler/balance.go b/soul-api/internal/handler/balance.go index 44033d87..3cd91348 100644 --- a/soul-api/internal/handler/balance.go +++ b/soul-api/internal/handler/balance.go @@ -258,7 +258,7 @@ func BalanceGiftRedeem(c *gin.Context) { }}) } -// POST /api/miniprogram/balance/refund 申请余额退款(9折) +// POST /api/miniprogram/balance/refund 申请余额退款(全额原路返回) func BalanceRefund(c *gin.Context) { var body struct { UserID string `json:"userId" binding:"required"` @@ -270,7 +270,6 @@ func BalanceRefund(c *gin.Context) { } db := database.DB() - refundAmount := body.Amount * 0.9 err := db.Transaction(func(tx *gorm.DB) error { var bal model.UserBalance @@ -290,7 +289,7 @@ func BalanceRefund(c *gin.Context) { Type: "refund", Amount: -body.Amount, BalanceAfter: bal.Balance - body.Amount, - Description: fmt.Sprintf("退款 ¥%.2f(原额 ¥%.2f,9折退回 ¥%.2f)", body.Amount, body.Amount, refundAmount), + Description: fmt.Sprintf("全额退款 ¥%.2f", body.Amount), }) return nil @@ -303,8 +302,8 @@ func BalanceRefund(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"success": true, "data": gin.H{ "deducted": body.Amount, - "refundAmount": refundAmount, - "message": fmt.Sprintf("退款成功,实际退回 ¥%.2f", refundAmount), + "refundAmount": body.Amount, + "message": fmt.Sprintf("退款成功,¥%.2f 将原路返回", body.Amount), }}) } diff --git a/soul-api/internal/handler/db.go b/soul-api/internal/handler/db.go index 9731b5f9..9d0c8666 100644 --- a/soul-api/internal/handler/db.go +++ b/soul-api/internal/handler/db.go @@ -127,6 +127,23 @@ func GetPublicDBConfig(c *gin.Context) { if _, has := out["linkedMiniprograms"]; !has { out["linkedMiniprograms"] = []gin.H{} } + // persons 列表(仅暴露安全字段:personId / name / aliases / label,不暴露 ckbApiKey 等密钥) + var personRows []model.Person + if err := db.Order("name ASC").Find(&personRows).Error; err == nil && len(personRows) > 0 { + pList := make([]gin.H, 0, len(personRows)) + for _, p := range personRows { + pList = append(pList, gin.H{ + "personId": p.PersonID, + "name": p.Name, + "aliases": p.Aliases, + "label": p.Label, + }) + } + out["persons"] = pList + } + if _, has := out["persons"]; !has { + out["persons"] = []gin.H{} + } c.JSON(http.StatusOK, out) } diff --git a/soul-api/internal/handler/db_ckb_leads.go b/soul-api/internal/handler/db_ckb_leads.go index 7738a112..5bc6f5ee 100644 --- a/soul-api/internal/handler/db_ckb_leads.go +++ b/soul-api/internal/handler/db_ckb_leads.go @@ -114,7 +114,7 @@ func CKBPersonLeadStats(c *gin.Context) { personToken := c.Query("token") if personToken != "" { - // 返回某人物的线索明细(通过 token → Person.PersonID → CkbLeadRecord.TargetPersonID) + // 返回某人物的线索明细(通过 token → Person → 用 PersonID 和 Token 匹配 CkbLeadRecord.TargetPersonID) var person model.Person if err := db.Where("token = ?", personToken).First(&person).Error; err != nil { c.JSON(http.StatusOK, gin.H{"success": false, "error": "人物不存在"}) @@ -128,7 +128,7 @@ func CKBPersonLeadStats(c *gin.Context) { if pageSize < 1 || pageSize > 100 { pageSize = 20 } - q := db.Model(&model.CkbLeadRecord{}).Where("target_person_id = ?", person.Token) + q := db.Model(&model.CkbLeadRecord{}).Where("target_person_id IN ?", []string{person.PersonID, person.Token}) var total int64 q.Count(&total) var records []model.CkbLeadRecord @@ -159,19 +159,40 @@ func CKBPersonLeadStats(c *gin.Context) { // 无 token 参数:返回所有人物的获客数量汇总 type PersonLeadStat struct { - Token string `gorm:"column:target_person_id" json:"token"` - Total int64 `gorm:"column:total" json:"total"` + TargetPersonID string `gorm:"column:target_person_id"` + Total int64 `gorm:"column:total"` } var stats []PersonLeadStat db.Raw("SELECT target_person_id, COUNT(*) as total FROM ckb_lead_records WHERE target_person_id != '' GROUP BY target_person_id").Scan(&stats) + // 构建 personId/token → Person.Token 的映射,使前端能用 token 匹配 + var persons []model.Person + db.Select("person_id, token").Find(&persons) + pidToToken := make(map[string]string, len(persons)) + for _, p := range persons { + pidToToken[p.PersonID] = p.Token + pidToToken[p.Token] = p.Token + } + merged := make(map[string]int64) + for _, s := range stats { + key := pidToToken[s.TargetPersonID] + if key == "" { + key = s.TargetPersonID + } + merged[key] += s.Total + } + byPerson := make([]gin.H, 0, len(merged)) + for token, total := range merged { + byPerson = append(byPerson, gin.H{"token": token, "total": total}) + } + // 同时统计全局(无特定人物的)线索 var globalTotal int64 db.Model(&model.CkbLeadRecord{}).Where("target_person_id = '' OR target_person_id IS NULL").Count(&globalTotal) c.JSON(http.StatusOK, gin.H{ "success": true, - "byPerson": stats, + "byPerson": byPerson, "globalLeads": globalTotal, }) } diff --git a/soul-api/internal/handler/db_person.go b/soul-api/internal/handler/db_person.go index bbe02ffa..fdc66ffd 100644 --- a/soul-api/internal/handler/db_person.go +++ b/soul-api/internal/handler/db_person.go @@ -223,6 +223,59 @@ func genPersonToken() (string, error) { return s + "0123456789abcdefghijklmnopqrstuv"[:(32-len(s))], nil } +// DBPersonFixCKB POST /api/db/persons/fix-ckb 为缺少 ckb_api_key 的人物批量创建存客宝获客计划 +func DBPersonFixCKB(c *gin.Context) { + db := database.DB() + var persons []model.Person + if err := db.Where("ckb_api_key = '' OR ckb_api_key IS NULL").Find(&persons).Error; err != nil { + c.JSON(http.StatusOK, gin.H{"success": false, "error": err.Error()}) + return + } + if len(persons) == 0 { + c.JSON(http.StatusOK, gin.H{"success": true, "message": "所有人物已有 ckb_api_key", "fixed": 0}) + return + } + openToken, err := ckbOpenGetToken() + if err != nil { + c.JSON(http.StatusOK, gin.H{"success": false, "error": err.Error()}) + return + } + results := make([]gin.H, 0, len(persons)) + fixed := 0 + for _, p := range persons { + planPayload := map[string]interface{}{ + "name": fmt.Sprintf("SOUL链接人与事-%s", p.Name), + "sceneId": 11, + "scenario": 11, + "remarkType": p.RemarkType, + "greeting": p.Greeting, + "addInterval": 1, + "startTime": "09:00", + "endTime": "18:00", + "enabled": true, + "tips": p.Tips, + "distributionEnabled": false, + } + planID, _, _, planErr := ckbOpenCreatePlan(openToken, planPayload) + if planErr != nil { + results = append(results, gin.H{"personId": p.PersonID, "name": p.Name, "error": planErr.Error()}) + continue + } + apiKey, keyErr := ckbOpenGetPlanDetail(openToken, planID) + if keyErr != nil { + results = append(results, gin.H{"personId": p.PersonID, "name": p.Name, "error": keyErr.Error()}) + continue + } + db.Model(&model.Person{}).Where("person_id = ?", p.PersonID).Updates(map[string]interface{}{ + "ckb_api_key": apiKey, + "ckb_plan_id": planID, + }) + results = append(results, gin.H{"personId": p.PersonID, "name": p.Name, "apiKey": apiKey, "planId": planID}) + fixed++ + } + c.JSON(http.StatusOK, gin.H{"success": true, "fixed": fixed, "total": len(persons), "results": results}) +} + // DBPersonDelete DELETE /api/db/persons?personId=xxx 管理端-删除人物 func DBPersonDelete(c *gin.Context) { pid := c.Query("personId") diff --git a/soul-api/internal/handler/miniprogram.go b/soul-api/internal/handler/miniprogram.go index cbf5b3ef..0bc2b46b 100644 --- a/soul-api/internal/handler/miniprogram.go +++ b/soul-api/internal/handler/miniprogram.go @@ -1016,7 +1016,7 @@ func getStandardPrice(db *gorm.DB, productType, productID string) (float64, erro } return 0, fmt.Errorf("未知商品类型: %s", productType) - case "section": + case "section", "gift": if productID == "" { return 0, fmt.Errorf("单章购买缺少 productId") } @@ -1032,6 +1032,19 @@ func getStandardPrice(db *gorm.DB, productType, productID string) (float64, erro } return *ch.Price, nil + case "balance_recharge": + if productID == "" { + return 0, fmt.Errorf("充值订单号缺失") + } + var order model.Order + if err := db.Where("order_sn = ? AND product_type = ?", productID, "balance_recharge").First(&order).Error; err != nil { + return 0, fmt.Errorf("充值订单不存在: %s", productID) + } + if order.Amount <= 0 { + return 0, fmt.Errorf("充值金额无效") + } + return order.Amount, nil + default: return 0, fmt.Errorf("未知商品类型: %s", productType) } diff --git a/soul-api/internal/router/router.go b/soul-api/internal/router/router.go index a7b55b02..94f77bdd 100644 --- a/soul-api/internal/router/router.go +++ b/soul-api/internal/router/router.go @@ -178,6 +178,7 @@ func Setup(cfg *config.Config) *gin.Engine { db.GET("/person", handler.DBPersonDetail) db.POST("/persons", handler.DBPersonSave) db.DELETE("/persons", handler.DBPersonDelete) + db.POST("/persons/fix-ckb", handler.DBPersonFixCKB) db.GET("/link-tags", handler.DBLinkTagList) db.POST("/link-tags", handler.DBLinkTagSave) db.DELETE("/link-tags", handler.DBLinkTagDelete) @@ -330,6 +331,7 @@ func Setup(cfg *config.Config) *gin.Engine { miniprogram.GET("/mentors/:id", handler.MiniprogramMentorsDetail) miniprogram.POST("/mentors/:id/book", handler.MiniprogramMentorsBook) miniprogram.GET("/about/author", handler.MiniprogramAboutAuthor) + miniprogram.GET("/user-rules", handler.MiniprogramUserRules) // 余额与代付 miniprogram.GET("/balance", handler.BalanceGet) miniprogram.POST("/balance/recharge", handler.BalanceRecharge) diff --git a/soul-api/soul-api-linux b/soul-api/soul-api-linux new file mode 100755 index 00000000..2de6fbcb Binary files /dev/null and b/soul-api/soul-api-linux differ diff --git a/soul-api/wechat/info.log b/soul-api/wechat/info.log index b1fa724a..0fa7a0d1 100644 --- a/soul-api/wechat/info.log +++ b/soul-api/wechat/info.log @@ -37058,3 +37058,59 @@ {"level":"debug","timestamp":"2026-03-15T19:20:24+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 11:20:24 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08F8ABDACD0610E30118E4BAC0552094A31228CEC602-0\r\nServer: nginx\r\nWechatpay-Nonce: b8040b9d45d038f2b5102c93eb9dee3f\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: j6Yvct7Leqk+Ou+zcDjz6P3LBecIKxnVbscTrG5qo4pLw0g+HM8HPbXMny88ws48FjNk6KTcX+a4nq1Ucf6yz/fDvwoZ5QrkQMRMZfSoK2jLqepBtpDOqRaVHQFy//OTPNCUOxIZr3y3BuvPslW4vyraBbI5Ty2nAoBRWuzSqasG8tW8nccPG9c/sqzJTzvo8QShrP9rUoj+s4pS8NiN9UJynYTAYxZmfo7tp8bjNjO8U8A5FKZrzMalUkOWi23w7FqG0aI6ByfrlqhC/wYL1obPk1Z4fR+SKQ+jsNjJHGFiD9+cX9zyo5ghhDAXE6HA4CT/opCcC+avw4y9L5t5qw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773573624\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315185745222552\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} {"level":"debug","timestamp":"2026-03-15T19:30:24+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315185745222552?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"MTqVkziwhssIyW1M8iCrF16pkrtygMLn\",timestamp=\"1773574224\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"2VzE4uvRxrlkaV/WPapgk/zITa5Lk+ybPg6W9WK9faktT0411dQ2+JMvvDQTUnF/LmMAzvN6OKhojwhJ70u/AHRdbUjaX7pgleHCfBaSAtW7IbfLsx6PGPuevPoJVI2jtAIZztpYcLoaRhqclE4amdhsHDfjIzNPBZAC93JWwZDJVSeDsBrRrX1ndCqc4DcuX8O3UigUnKcpZwH454L4lJZCYCmB1TePBplyT6cYWjUv7x6v9dUxKBrzQEiZs8dJIfSsNSb+mMtyBcK3dWZRtjwQwRTHYGFlAuJt8z9GFrfwJDTA9wxyprbsTy1fP6AR1qpvTx3pAAcgYc7wFf56Xw==\"Accept:*/*} request body:"} {"level":"debug","timestamp":"2026-03-15T19:30:24+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 11:30:24 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08D0B0DACD0610C40418BEE7F8AF012094991B28D3E801-0\r\nServer: nginx\r\nWechatpay-Nonce: e4708ff592ab6ae526a0db8185683a9b\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: dA7O8RH0g0BSHPG5VAvVRoUU0TTBkeEiWVLx3hSALD55aDJdbrFXvy+5qQBrI0XpQmzfJ1wOVlynanlme2IMjWjtk+zy5cy7GNiYDywpdVxEx+V03iDmZPuyplho8l1B4O2exKpkVNrd5YM1nX9v/hkfjeRCqMvrBPV/fhKszJnXtvURXA6obnaiiQ0Q9P5VF7MwMKLa2CwPo3tDuj9eqqbR0vZfKglyvTZprF1pOkT88G8FsEMFgc9pBq+PpmfRy0ec8rJtSDK6ou5Idbc6wOWdQHSwvG2MQ4g27g5aIqMuFx/tuu7lhl5fAShU1HEJVzmqZ+pMnhYvHbNP/gGCWg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773574224\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315185745222552\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T20:26:52+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315202447272285?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"UMRUBgGfQF15OAkzzKkbhdrQxDD5qKaJ\",timestamp=\"1773577612\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"ew7t3P/fH+ryrwxH4MuwZG8ycku2wkUWZQWR7pkqrZdK/zbcCX7zWOm21MIV8DeVgJ1Ba28FJibCHWKKCFING9YiAOPF+obLq7qYeEa+Dl887cvTDtm14XuL3iMk1HPshiPT159pD+kN2/NThvObvuegoMtjRqVkJbfpBoeiTDqxXVVZxl7vfSi9mDuTacUdja6wlO8BGwIn+SkS80Wnk/zJw8Bjjh57qBsZyFxwb9uErDMBVE0bNgmpzwy7rdkmXhCc0XkIDnzEvsWzEwDfu7+1i/xC9NEqLigIBsaoyH8ZPfBhqzGaQwR6Q1tFbQ9I/kqUD9Wze6Oh8X4WbzPcww==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-15T20:26:52+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 12:26:52 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 088CCBDACD0610C90518BC9885AB0120C28F0B28DDC001-0\r\nServer: nginx\r\nWechatpay-Nonce: 59193ae69425422f2e22738bb5c47e95\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: L3Qx1A8D3q48BVV9Yr6Z1ZiFGy55RWWIqLLJNCMHTW6obcotYAW4ikf4YF41wWi5YwHEsEWIHJaLblxHrZfoG7gOWjvnFO7GIRoD474PIX/SRE8Ui6sedlubNhDG4oMtS7UccbnG97Y7PqJ0Chr/O8cH1z6h31peD1RQjw4tf1DStnS+mbo6QkvG9mePx+ThVVki8sQtG63bbUdieEJp+UWfXPqzR43siR3Bo5gLf31Vs7QyA2ePsDPLuTiUeiJJQCIDwoj1tmA7FDprHxIyBvtmdlVCj+tUm1vLpzxlJyGKNSMahPEhVXvjwiAEPtUG40/jpNrsyDSjva7lv6k/1Q==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773577612\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315202447272285\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T20:26:53+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315202503426849?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"uR0zRYIz3VEEfnSCaHLIatlx3AGn3gJE\",timestamp=\"1773577612\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"kaqz6qxt+bouYdZMvVt28KM1EedAVVOWY5+dtF3uT908mOTa5ddR2/YW5iZEIGXjX0iv4dq/Rc41PO8y9IcFcJfeP4c4MsxfRlci7WGvV2Nw3K09HnmV4mMQ21nt+j4d1aE0Z2GRCsQAdJ1iJgCbW5RNHvy5Hcbr/jBHBvA2xDerAjSwRozSDmnF4EwJzN0rE9P3slC1RaagQahWCC7UiNWzsORtRlNKFrUMi1XSUnhKAjhimkV3zt4HFO8YQWCjbZngy2cOG+N+wdLRhu8rwBwg2fgp/0XCW+3SuW7/Vv+g/3fLVbMnHnCY8XWIURmuwLAfsJNWwkOdonA+R6Y02A==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-15T20:26:53+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 12:26:53 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 088CCBDACD0610A50718F1D48C5820D6F31628FEF801-0\r\nServer: nginx\r\nWechatpay-Nonce: 1e7cbb77ca8e637aaf19bdf9873a7a00\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: DX1voJFUIpSM8PCBRD9i2CvSuIto0edhldnx0JWUIrSQTAcdF/DNmCLBk2/DUnmYVxc8nCBxPUOwl+JnZnJLALefmR8VQslQGbfysVfp24/dzvWL4YH9s8U8GEErIbyIPVCh3whSLo0ApUnIEbxF05YqA2C0IuFwxanda46NJ3CypyblUkV4DwoT0IcD30BdkvOgGTbQACkpJAQjZ4bMJShKk76ftYE6A1Wj+Id3PeYLO4wlUJwhROQqaVxBQrmaHI6zzSf0fSed412GGEonitiHvWXKoEmpMtgkGg0Sj/ZpfU6Z4zjHvukgeua3iWQ1MdWNP6EOybjoEGcZj/CW1g==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773577612\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315202503426849\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T20:26:53+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315202530561613?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"46iEd2Gw6kTO8KGjAfcY3YgshRrw5Hsu\",timestamp=\"1773577613\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"FL/z/aCbesc/CX8bwNYwvX26sw6+V+3vG1148AZ0tPbm0wtE7yPH3KJT3uoGkyjRw7qyS6PoM4bf8olOEbHAQOmQU7yt5z+ilAzIghALI7PD3ocvoEda9D4Xqojk++8ALxrEHUGZ690GrGDPBdS1ocNdsSBXqnuCjx8MLjeK56MI5uE4YmAXc1QsLTrKaqqbAmV5QzTh5vTMMw8axNTwXfhcqiaTWEX5MaPz4mJb9Z3oeyS85GmRMHukjLpT9pYg2lNrm+Du4suqG6UjBbg/gfIBlMKYkGa/x9bM/TU3auCChq37QwKokyVZ1iFy9XM8fZYcDfRf/R6lr1ZakoddFA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-15T20:26:53+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 12:26:53 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 088DCBDACD06106A18B1E5F8AF0120F48A1828E7FF01-0\r\nServer: nginx\r\nWechatpay-Nonce: 4143932217e980ef6e1ce05744281a5f\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: Jb15q06dJzPS69i327y+49ujQJlVdQa5aDHPDYLv5MhVU03phnXS6m1VkOiABaBUgPiXScS+urZw7cEN7JtBkJPIT5Xf6kyRy+kOoqNzosDkUkDL50Y7LYigfrkrrBvMl1D5vQG1zSlqCGz1IHVjiMAAnTbaCE9a+9NAR3ijY+tv6bvFGSJUJc0b/sK8OYjziHeLowUi82tOxAdnu8aT8trOmcJdtC0NvwNZiPQOmVISb1vI4wUAbLA06ceH62IODrQAbRV89gPWZZLc0ZwQH4W0ZJOVfIqgpP0Mf78HzTOxhtcpqM3UtNx3keMIihgU+nb+zzkBbJ51KjjMWpblnw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773577613\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315202530561613\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T20:31:52+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315202447272285?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"LntIaNw4tzWymosxrPFE7djqhkND6Fle\",timestamp=\"1773577912\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"laufOP/mnv5aUSXV+w7i7jUG2az1p04pSo4VpeAibB6NpSM1iPleuFM1av3Q33WlSn95XuKgW+pAZeM+JZ1MhsPKtCFM4zH90NpWzVqg7QGbycAQiXpvma5juTDmOv/6QSzgKEm2WDX/wZdlV0c9CLsd2BM8fFtN1DatPjhi9BjX93GMG9T8psn9Tun2pOF7FQtS763eDIODnjjRgPjovAMxQINO6CrrIbDrBRmvfyNaLuXiSdh/tl9f0LbUUTzD21bBGfCOAvdXQkgc7gdOIyk0QqBVTMXSsi+I+tB1/m92OsUnd7P3LAgMPmhFADp8+bvKLAor4HCFoV3VD3nW/g==\"} request body:"} +{"level":"debug","timestamp":"2026-03-15T20:31:52+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 12:31:52 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B8CDDACD0610B70518F3B5F8AF012088D219288306-0\r\nServer: nginx\r\nWechatpay-Nonce: 7d254360e0fb094442e9f3afd9f03c30\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: OvS8iddSeSTDXKQ+clmSwzipLglN/dEWEBSLcjmVdyzk/2SEX+4U84LqEXZdcDzUW5dWVmsycCuq5aIWo2ILNilnA+LLFJlDJpbY7NNGJlgEOpp9XwaqiD5guN1jAll8unQMzSU9DN2fsYbPXxpagIPJL9VErx+NcqkZ7l8MC+9sYVmg1yvpOAWNQAciF4LY+vvR5f9qMhALLdYqaeUhnm2Ozc7mtH9fG7rUxJ9Ua0Zzfknmh5Ne2mipDTL812VntIppohEYLPM7roYiOB+4Offd2moYIod2BK/XOFxzlU5HTDKuWu+IWDT4RWT9Z0rNft+JpipJNSysN+agldDL3w==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773577912\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315202447272285\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T20:31:53+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315202503426849?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"9n4Oomg72ZkKDZXsr849SWAA3OucI0gA\",timestamp=\"1773577912\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"1SHM5obysal9dRwWS/RB41nEeKJBa5Jdo7NvdPq+ZR0TNAWnlWBb4yzhh3L9fQauJxYZDq8hYxlfkeQkeelsQ8zyc7sIQfOiRobRVVkgCXns9JCFy6+gnOIdIGO4IwP17xem9tnRk3CVXfxv4K2Vj4APW/mJtuZmZl7oTJ7fXP9gE+S0vppr7UrishA6ToQYdwmNIZMPONBin8RQ2S4IsHHjNKjrOvDXABja3l2D5C0Sh9pGtSna2eBtrDu8g0sZEk8Qe8k4fOgnB07PKkDMSNa/d+W8i5BQPf59Zpbw4MK+/bWoYN8YbQI9yvQsUZAoUvavKOsF+T4S5rRig8sIug==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-15T20:31:53+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 12:31:53 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B9CDDACD06100318A2DB8C582096F90728EFDC05-0\r\nServer: nginx\r\nWechatpay-Nonce: 0a1b6f651876833d090aba5f0a1f9e55\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: MZrhfj03qSuun/fDz7iGrRp+lrBNwCH+x+es2vMIKUK4I6ZNbBj0cIGoxVpTACZZyRUC6qkIg2oVk2lEIECh8F2eF8gZd1k9Z4hUC/F0NuxDDx/cKe/ohwEwGq4zDtAHCg8XS3LA1j9c4MuHP1dsuD0gdRo7Qp19kgYXPgZn8goXkbJovGnyy475buDreCG7TV1yZxMk9DvkXdJtQB15c2zTVr5RKbBvfqP8Y7MiMSEy3GEuKUFaLPXKNUjYAOJ0WoTTOrW5Zti4Pfrrv2/61tDoeDJFepZ3antWavRacTYvvbIxUk1qcLhF43Tnn6qfXQM/ijFcUTPE/PZnqz+bbg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773577913\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315202503426849\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T20:31:53+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315202530561613?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"5VV2sIhDhNelTvsLUreETQfDGRkobJKN\",timestamp=\"1773577913\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"m2JBIeg8jnVx+L+oN5fvZ75aTkRx8FiRkbYuYjAMm3A7cfJS+zBml+08KOu7aooPQiSFW1A3USi3CayDfyfmR1QYPGJnDEEjOs3vDPQPuICvpPgSqxytcMOALXtRpcCNTa++aA771UVgYMvXplmfCzumSR5/P9acJf42ozAwTpW7b5OWKqPjg3t7Wez0NCvy+a2q7gSYYwEX/qY84rWOXnUEfZfgVh+7F10cubr/c/e49y83IdF5FZkPtdgIEEYEM85Hk5HQlNU6ZdY/cAeFYXS2aaTft3gwOtP89MtRlJjx7pmD4E9ucDd11hXyLqV2nYgwLSMgC+S4YdC9ff5pFw==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-15T20:31:53+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 12:31:53 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08B9CDDACD0610F201189982F8AF0120B6E71828E8F602-0\r\nServer: nginx\r\nWechatpay-Nonce: ee5007a44b6fa031de245c3ecc82519d\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: LRWhBnU00/GL0UWrgRr3SNTzSChbcSm8j5bWAj2WUmsZkf3DSJNdRGBJcemu0kdYVRQfavJ/EIrozYQeyF2m4CCgYwCChUsXM0aAGBDZPvy23iPup+hTMCMR9MgCEKXTnU0wLoh55FcH0T/EiXI062QEM3UQYP5oGOD4nMgxTj3bOzF57bkf7YXwx0AwCHc1qx7SFT60dckov+/JTB5ayEAXif0mZmxkwmpnrYcF+7DPy8Jpz2Rzs3N3kGRi6U0UgEi1Z6Nip2z9zliflfEbeu9jolrnBJCJ23C25vFmp2WOG/kylR/xMDE58kQeY90sbwvg4yjimLaeNO7KWCALqg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773577913\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315202530561613\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T20:36:52+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315202447272285?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"tFUaGlYrGyuNgp85pAcFBaRPrHoLJPxq\",timestamp=\"1773578212\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"jnUB1SRI+5pV78Wd5MjiOgfeh7oFwr0C0KD2urG6A54kHTD97tFi07eN0CLfSqmr4tDwto6w14U+oz3cCszD/AtKyaCVoTuIOQD0G4gjixUwJy/1cErTIARz1zU13gCdiD0ZkXYxgNIcV5K+oFxdyQH7dy21PGCiQ7/5MZKIejDKfraJrVCugGqdaMAUSpQIOSsh4FIqc1QWrwe+b8iyTjy37hUOJW7wivR1ZDQEjFK+LBPUcQSMU1sdEvi+XiaNFesHfbo0Cl2WkXTjeo7oP9+uDyTvmltapGDH1DwPP43n0QKnnHRxb1v6zY5323nz6cDbZET/Ba8/ABUDPcTAkg==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-15T20:36:52+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 12:36:52 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08E4CFDACD0610E10418F5B2F8AF0120F4DC23288EE104-0\r\nServer: nginx\r\nWechatpay-Nonce: f2feeaffbb285b019e365cbcf30cfa3c\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: T3IUggvr18iuQCW97DzxYb3wxtlaVDCU/Tedbc4nglmS6nzRP7nN41HG+8ZIKLwYPlT3z6Wl+etL4xhSEiQOItykXp++r98tu0+8BYX2njvmvm58bjUXyTi8qyYfkbHvTcfVgQDvjyGWzvek5UdYtgtCkqujPVc4/68OYsfLsJ/v2M1jbu4wbTmkYeabd52YtvFko6AkJtzXuLtXE6BvC7bQQBM+7rFMVVBZc/fafNUK5ABeW5QZuDIHQQiNG7PY8iG3MOzFSFavZ9E/pQhZxkweb2b28QGMBXHRazPF4+IhJWRpg+VhrB5o1odX3ry2x0VqGU0IUi40YTxx1+oPDQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773578212\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315202447272285\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T20:36:53+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315202503426849?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"9BfFrKKcR98uMfIqJl48IkNWUMH5Lt1y\",timestamp=\"1773578212\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"Q9hYnw34cJIZk7+4wehu1PX+ZL6NH6em5o+8GcUji4tlIhRuDLchAI0NBmf/9Q9TMrVB8yhDcGEnQFb4rbOCbdoNpQuu2yTbajfGSz9RlZm21o6AshRV7X00tzkpPVa3lWuIc4yUBUcLCFQ+eN1f/K7E60+RHQcmkHj+coEiftqmWi1UNtUg6jPQ2ZxmSJUO5v96SDHuEZ8T1cxJyHa91fubJvQzzRTOWdC9WERcAxmBbC8cn4L5xWA52pxlSh+GYS8J49gOtlEq5ppeilncW5mKUjseUjjQPyZkkC3ekAh3odGzLJ1qBRAXJDrHE2SqL1lcRpnSLTyl0bdDWkb8qw==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-15T20:36:53+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 12:36:53 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08E4CFDACD06108807188AABC05520BCAD31289CE402-0\r\nServer: nginx\r\nWechatpay-Nonce: b7b2b1036868fed7fe225c3b7f0fefc7\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: brtoCGg63jwVvRyUexrIQe6y8k7P7pmfEDLpK3Z71IidOgKasWMyYjrmE5Q79zUoO4ak8tQxLg2Zi9IT9qmj0HJUljZCh/NMM4lw3r+TFEzPIpjfFqX0FoITWV86jSCao418Sj77DeQQdHPL1oWFwNo5KYPvWkWCyrqno/IHwg9yR1o6j28zmV37Q67+n608ATkgaMal6Be/WmCgWFRz0BTmjOhjkEdeNy9+LFagVg9C0+krXSx7wh4GcPstiplDLBXHuenVxWg0XrO0tfhMc+08abV4oa11XZ8IDQNusMZovVWV0Ud6tc1IEMlN4cufpv/p68lobUmTZsVzvYOl7g==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773578212\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315202503426849\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T20:36:53+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315202530561613?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"CpFAX0cEQcOALFoO9ePZ4IMb312dF9sD\",timestamp=\"1773578213\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"NuwOR6DxSB9ilbI9zFWYibOwhamTcehJZsTz9EhD9v8KS/UTuqQx79odvfhp58B8wwn/FJfpaFC5CHzyFsgxydlXrgdmwkp0fDu2BXjj/C2qs4hh4Zq5yoj8MUAf5XbyvEeeXTov3LlXPZC2CQZGMOzE7NGpdUtCbFvvagM5oehMKob2C2gQY4q4ylSOll0zsPfib7brRvp7aEyUe33f+AwDBrDfkLVTWjvaBXxvaCZMVxbj+3K9dGeMM2zmn4PC4jTSNYdFDv043Ou9xojBoDn/AUMPISXyVWhfvxOS2onYhjwY7YQWPiuxQkDyrVwzS84GN15XPREnFCeKpa/K4Q==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-15T20:36:53+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 12:36:53 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08E5CFDACD06109701189FBBC05520D2A40E28C04D-0\r\nServer: nginx\r\nWechatpay-Nonce: 28a1278d4c4302f33d7277b387538ba4\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: rg6zed3GvzplbP3oIS8iM2rVssyzAbzecBNNMFEg00ja+Z8Hz+6NuOsyob2Kz/vLjk6aVj4KofumcoKh3Bdeu1fcx70hbOl8bGAVb3qtFZ9dvKowXB5YFrxhG6by//1YzwjkWyjn3XQOnq6ExUePRtAlzwLFvOdwWdYzAK5QjvHsKt1FnlAbwTxgxTY8rcbzadOzvbckc1ZZAXcZxuz2FQm10kM+JPSvgk3KUYZky9s0TFJCXrml0Y1lIYbg+CHVyD2Qvdy+LUZmoa00AdR2rw04OPF7nKMkEEqoRQh4e2jz2swX47DUNuGuyF2fLlYy3dBEJBOEViGaxCK63u8Buw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773578213\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315202530561613\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T20:41:52+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315202447272285?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"nLKnGECOmxtMs4mJRGkpeIE9LWsB0Ijt\",timestamp=\"1773578512\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"dQXcnAhcJTwcTkFiAPFq6FtwvHZyODhbA5sXO5dMiYQLhbmBwLlD4/uQ56w8YmeSHmn8bheXYD26mSYDsLpFN1t7hfkqzeyW8ieRBtAi6c7Kg099P92FGtvePRQPGs9F8UGXiNfU32yFNX1bRILd+9fdaZFBWvR99uruFmjcY9EJeol3vcYgMduq2A+UvKes5ITIxqgzXncolG+8noYA/YMXpsObtYDB/sKQkw9PAMZbZxw84jG02LUhFeoiRBIv29XtADceD/GniNx0YW7yRmk/bwDHDMAg3rPMHvpPVyM4Ur+QrEvhP9L5poGJbksg+VDAIuxbY8yl58r9dFZ1Xw==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-15T20:41:52+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 12:41:52 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 0890D2DACD0610E00418A299F5AF01209C8E1228EEA302-0\r\nServer: nginx\r\nWechatpay-Nonce: a6c4007c0f7808dbb9f687bf150bfb44\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: S2/3XSiZ81HSpDJFk8HTv6gJODTtpplmkcNShdghxCq4FiMBgFH9EAvKoZrD21FEH/FDoP+wT69zI16Ui5fcXB7gaNqU+ywebIb3e1FYjoZNU6ebZ57A/aP6KEHtaiaDEIW9SlbLkzuIQLpLcVuBYu7iJtpk6FKOeFwdmkVkStefws+G2rIFH1dLNO+XUlEV13SKSpV5InctbFn0wJnIBS3BtpbQr6Dnx6LUcSAsYEzhgWlIs2jHpvY78O6M2ULYNm8GJ5CueGU/eLlkleoUBFjFtgtGWUSnSPI45Afr4MQdeJ9pBRLYHCrFhLBLmTSACO6ZEPTFkBLAiJEAIjGhEQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773578512\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315202447272285\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T20:41:52+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315202503426849?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"mHB9uIkLicebNjiTRX5RqT0tWIfkVaBQ\",timestamp=\"1773578512\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"BuH9bcLkt42ZEEufPD3+VoCTqaq75iJrEHTZ26iNte61ldq9Vpfzdq8v0y7B4M/gMOILijEvdwuEwzrBoPyyOniJGzphqlpHRA706fd9Ag9N3PyD4ik/Oizfe6x6oz699Pus8dDb7k1vnWoEMBbgwx0mG6YyEmEdO2Y7FYLP2oBU3P/A01owOp0hU8LSqfY11j2mxaAsEHtgmWzdnytGALkSmY5V2+tb4QgM/+ULUfYlP/k8xm3lFkBk7a9OqdsrvxZuYm4onbxMARLznrArxep8ski/W5TbbjG/eUXHBt6OthkhbYk45qPLW8HePmO4iyWOUdCvpO8wmqjkNdqOog==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-15T20:41:52+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 12:41:52 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 0890D2DACD0610B7061891B4F8AF0120F0A4182897F203-0\r\nServer: nginx\r\nWechatpay-Nonce: 4233b5663433ed6ad4ccc0d0471c3a4d\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: pvP/ZmHwViAnUaQjts1ZQnum8Dm2xkSyIlSC7TXy9yaCzH2TrYHmTWxlpOSqVv8NmJCIC1RQalwyw6dJjzIn0Xz9E1Q/VBudigraEBypHUD16/d5RdY1TOEDC9JqHXRYxZuED+eKFtSnGUHO78rENoRbLfdwm5/mpK7DaUrPtfticmudCzxLzdDtQeEvCMHCKvHyTl6ONg3sOgz1vlS6S7/GCbsBYanx5EHOZpYABljBdYsbn5WngE9q/So+fQ9iDS43BVLhAxrY9GDK/wSlDGybBhFo2v3vgJOjtOJ3qzijlPeoIJYqvmQvwd5Lab1XvRjsdmmjmrrA837784Ly7w==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773578512\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315202503426849\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T20:41:53+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315202530561613?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"g2raLDr8eQA5LQEUVPJrIfektoAkuV5n\",timestamp=\"1773578512\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"fBW2tiPDceuRCHzE/K9Xg9rxdRmJqdEdcJeoQnKzp+COwXiBcbSjtkHp0WUo3tS0iqgMHvnNAG7DNTmguZK5IjNowQ9Cladjk4zkZAcCC1Grnbgp5MCpHLgpfbTdz1LnhErqQc45mIWeMXQJrowlKZ3q7qnW0cCOqI75dS8vyYZ8XPTJRgBQ1bOLYAn7n256N9zzarntYIg4Mb0nw6NbgYkJASpMfuFRd3nnuQqrS53VkOPj9myoXFsMmApkKwZUvBnSQDplGElLrqiNTpzTq3eMkI0KZ9UnEQKvPSdKr1nJVozEM0k+JEp/0mfPjR64GCxMZ5bH/hFh4aC0kmWfdA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-15T20:41:53+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 12:41:53 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 0891D2DACD06100018A8CCC05520F6F22628F48301-0\r\nServer: nginx\r\nWechatpay-Nonce: f6bfa936a30f2176f72eed3c093fec67\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: IZQwIhiTO0xZxET+YnC9QSmsBw5QISYsmiTCDfdWCkRP01BW7U5k6z49kFSuFWyYU0kaslA8Pcl4Q5UDYgkSO4rgRqmehc65ISnsWCMp/EgvKq57VtwlRVqK/2Js8PARgsG7EcXa3Z2pikcL9ij7SCqmAlBs+JV2dEBWfl9+VNYbqoVzpFA9eFxbW9V+CRYdn3CMOxxJ5eMyok4T0j2Ald9B55AF6a9bN1HyylTCvKUHW2DRq2ftG/+7X2m5eX4eoMvqHb2wvRvnJ2HUYCafKC663sxhoBMY7pjpGrjpkNKDASqfSvPXrMzqtFdQqQCYOzQwxW+5vZieWj+URY7LTg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773578513\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315202530561613\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T20:46:52+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315202447272285?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"jhm10jmmSlpTa1ZU3JzS5BLgV8nVJI84\",timestamp=\"1773578812\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"PJDEi46NLKCqbadz9vXUBTJGdnxuQrsL5ozomIANU09wAiaicsPJ+k8Y1OxM7NliFemzMh7dUJZcwOT56TdmpoEWKvzEZ8qTb0QhqalOehN5JNIiJyE+M8l61YGukWqIcAJHBUijmEZj2znwTUmnVbusLz7O38HrJnM91ScYeYSPK99/RwQsc8BU04KbbuClatLQUDyD1ByhXufqE88RQR4adpHE6HmDZb8renkMaZndvHFiZtnNYC3+Ap1RIAFAd5cZf4gFoRNylQObXZNXwfQ8EhXStVlzzl7i3Ygwu8bYTMp2OLwLViDWyvnoL9CGCvfsciLDI075qlxXfppXKw==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-15T20:46:52+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 12:46:52 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08BCD4DACD0610AE0518D58CEEAB0120F4890228B88603-0\r\nServer: nginx\r\nWechatpay-Nonce: 585ba5989977095a86971de41edeef76\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: qk+Gdq+o9KZxVGVC8zObX9thBTsIo0GXliCgsYj2NlJeS3se/9e6YwKMw7N6MNWQO/B1JSOxyneIzEF4WhfuzFKIMX0+gWZ+Xl66U2luzfIKjtAA86/0WL9MyD7G8msS+ieJLSWpJn2cGBFAHY5KnVsq8bsgJP1MOwjjUjMSTN1YCBVrZt15fP/+sZ/mwCtg3Fj4uoy2tlZbC/55nL39P73H8q4Il4S9uLD/VMvE44lWEeTtLhpTXVkGFXZUVsVlxWYVxxmxKZCKTLJzXD92XHqNJnHqKc5QZHBPDx7I1m1SfcSvZECGreBNQei0CMGqEoQc/hCNx9usYmw6RvF0zg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773578812\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315202447272285\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T20:46:53+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315202503426849?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"e1yGCNoSPla2EbTyJj6UZ7pziOzWo6Bt\",timestamp=\"1773578812\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"oda1pBmJfIeysTneOBziiyARQ5SpzedfJcVtVH4FIntMnaFtY4teB+B+pIOO+G9SE4m26nFGgpNbNrnnIv0iTi3qqfvcZc30dtwAQ4kP4yd+Vfwv//7YMz2Z8R0oQ8p5tDbes2AttDcTWdXTz2KH5LUQEFi/LYncnTOx6yybfsSd2aviG9rBYdCngidQug60fHVFmLGsWyZdrnjYiosHZyJlTQhwkJJZjRNRJxY9TH1jdNcLWUOlM6IhvzA+IFfHoFd9NrdeQM5JYcoiiaXdLcDdCEJo11oQa/ovxJ4qRUGQyjEqN4Qcam6EWtBhgPtwu1F/trBOMIzPUfVq8k5/kA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-15T20:46:53+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 12:46:53 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08BCD4DACD06109A0718FCC38C5820FAC60A28F2D703-0\r\nServer: nginx\r\nWechatpay-Nonce: 893b1f047d857ec4b094f4d6ecb35d66\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: TN6rKXg3C/hviPFQvvP7fxmmpoeQPZoqvH53rC+3SX4qROAC29ucwwJ1ByPsTp1hQJrIEi8ds627ced6J0DUxZeFuqhXyDzVEdAEV+eKi3wpfoIUUcD1EkA/y9VOQvDkrmDGL2utowBjK5Tnq2RFf8DereY7DOl+btntpCdGKcKb05/7VAqzjF7+rPr0uhBoQq+GiDv9Ru7laooFzmsfGAfgcQH2dU/8tNQMXemIWWLq4EFFAKqg6sF+4zhYl/xDgbn9TrOUOA+H3j7k2D3u2/TC/U0Q8NNpK1ZrMfaC+hTRZeMAUEBak3gdOH2bIY9jFRqTLENgoLm7GknqDurcUg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773578813\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315202503426849\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T20:46:53+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315202530561613?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"FJc71XFldgLwEnwyR99g0cH8vLIgjDYZ\",timestamp=\"1773578813\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"N0DF3L2oyAh6PHDfB8tMUaXy29da1zfXFm0pHAAb8ll78ATffy13Xi/VK7/wAeLMKvtisMkr0cJn/WzwjT6RXh7xs1mdbG79hDOx/oRAwBA80e5w8qrZ31FI8L4DX8BIBorC50NfemUR5MohFpkwcogLdqBPvh6zhEcFJglXE4hIBo8tAaiVZt/4M+p0Ks5jjmTHNNKAjQp2BQTLjnvEySZE0BDLmbfM44GTrAfII5wa7h4YIvLuFTq6ocFyZGa/qSAuqW4YAZf29ZN16ZY5DQwzNtuXaZZvNONM+lzv0LQ2nQyrnxd1TnTA1wm4Qwn68FXwElkQqSMbUw/l2QPQVA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-15T20:46:53+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 12:46:53 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08BDD4DACD0610E50118D0BB8C582096DF1B28F1B701-0\r\nServer: nginx\r\nWechatpay-Nonce: a3df38eb67d066044c0b08fce44ff315\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: CTgE8BRn1cENbnSyr1Ouy5KzGdIJFyEVcoeNVGiwM9jjED7xlCGFC+fB0DbHG9SUzYk5YdXw35DCmXYIMUe6c7hQaB06E7VXNiHOoENcjxP2z77N/esVKLox13DW6ndmm2mq391fiNvcP1K5AexSeZ+KInN1f1I4WFRCe7V5VQkX/CFPdcAhHveXyfb/7LqTdRlyzTBzTJ0bCh2EFFKzxcnWZjl8Q2uwqM2WcQO2/Cw5ZDrwcYhi8clahlXCK2u9iFYDyxOi3NY79r4aWEnFq2BtXoqfHzgwwWfVj9u9+oDTnn8Y3pZYNXDz38BHJ2U0W/fZ/e+/unObLj/91bjfmw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773578813\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315202530561613\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T20:46:53+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315204530619247?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"3qzEalAnzaD1oG9YtFnzLWwH9dUZeFdY\",timestamp=\"1773578813\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"rijwJZiE7tg30crHK6Ac0Z2hrkIwjXuf6XivzLoAFV0zhBGQa2l54WMZnzWksTFFuPnXGN3TES8IDklW+yeQdV9EpPcVtvFPWKjt2DdUkLDxSZBKXl/SlhRI2uQEiBSwmJAWzbeI357BNVkhW3EPKN7abqpBKMYM5pQ28I/Kmn+Wi4u6WvQhpnWcBLPQ1ibtTbuzZfS9XFU4/eUiuijBT8TwTjZe+6JEza+lGac/wlG3tPUFDSTnrVgF1pOCPnUSXV7ynTjBIjKJ5Zy1MS3PNhdWxi5ISZKe2b9Z+ASSZx3M9uiQ+FxkXh9hGQO3MKMNb1BY0oOSQo4B/OK3Jab6HQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-15T20:46:53+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 12:46:53 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08BDD4DACD0610C10318A2D78C5820BEF00B28E714-0\r\nServer: nginx\r\nWechatpay-Nonce: 5157f5b7aaeb04969d6c69d0d689d279\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: xSVdpuyFy13WAWopcnKvXoIW3/tyglhLZWdxE40w9Wq3Z0N5wbL5+zPjr78DyHHEqFxQdrj9HGzvpHDq33Hm0EW4tqIDZzcTYtfGlFR/PMZbHHnIvyTl+245sw0nTJ9jcl6XB1v44gTbgbp1AlRZ6G+9z+GgMq6mCubTzXsw4m2AGz8bCRZFi/B4q86JZdfUXLG2W02UZRbpwVPcTtXCSUbkDREbvUxrJFMBbqLhway/RTGz0mgpDjqVSAIAbSriziZvlgNi91dbOC5Mavrvlj6GWXTSXNnl1M5m0iz6aN66Khe7Isek+sLS5RIDMhVCcCSy1mxYPzUtVmXToQ6Hfg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773578813\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315204530619247\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T20:51:52+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315202447272285?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"yoifdB2t0bDezlv00qf2Zw47nrMOL7H2\",timestamp=\"1773579112\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"ovAaSxdoE5a+tU1WJYDvU+eOJrMxV5/u0AjasVL5b7aCXSwZHrq5pZNbeZZ8Ig/lDoCr3W0Zi+47XpfjkeIZCPA2ocopP7FM5la1xOAvM1c+w9uIXjBYLkQB1PiTWAojEHc1ZJwLzX/GEZsvRu8SJD9C+P90geDzZIG9/qdioumYGWOxxVHP69cPZnZWED3bmoBTPDPuug91yYQkUE/+iBHi3vxAbl10U7n7doLuk/ReR259bqPLtn2uIDSjK8c4JSBqCyh0L7l7fDxGxL2Y0zJWUbWkVqTnBvNMmK7G/PkSWLE1gnYLvpE0PSt8NRLOyioebXCZzMe729V++0SBmA==\"} request body:"} +{"level":"debug","timestamp":"2026-03-15T20:51:52+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 12:51:52 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08E8D6DACD0610A50518C4C6C0552088FA1728D56-0\r\nServer: nginx\r\nWechatpay-Nonce: 119a7fc0053a6d48de52e48ca319fb9b\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: wDek3yg+R37WyVKZYxXr0OuV7bXbk8PT8R6Elmv0fp8IjkP1is3MqJaU1QmCAvX5HC/D0eNve4W3SFEug9G/2CiIPoZH2iT2jB2NyhzeoJA0sVV2dDXjPN9JaGOlz2IR+oGsJotsUeVbgDMRBv4Y2jQqq6eRYxaJVj2ey8JnFMGtxlWCE0uM2P8uQlbSStObUCdyYZLlV+E/DO1RN7XhZy8GZWW3/psXMY5WHaP3n5C/gOq48O41/M1ZS8osJNgNlvTXqKuBcR8rCwSq2niHHmLAbywDxl4sB64VVG3sSvSpimMs3bSIPCsqNtJ21VW7Bd6VwULeYf6KtY0VdYtCKw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773579112\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315202447272285\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T20:51:53+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315202503426849?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"w4dsYtP8F1kwaPaaY9ZCuYt9VjgNGiX2\",timestamp=\"1773579112\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"GftOBrHPtBYaNFzwITDS0hZj0CqB+5TX1+cI+o98ioeRda2cWwRKWqKVYxnZEC7Geqq/fBqMccm6oDW7HExKnHkL9qPJtOtAQQOUWQL9ZB0JION59uButuCI7FBhUa87YeRvuqlRIFtkY7vaJdqMQMLKp5xL0YS53eszoms5b007Ps02ft0QUCDQcHgUM+jugIBDdskGXktCmql5A1PriVh2NcqkcJyTiULjFY7Jg4HN3DD0yTpIUPzSi8YfnGxY/w1NedojdAFftsIAGLtUXRttLlZ2qfKYcvGOkbAROBwwgQOaJYbC1MIzm+oEoBpoSTR4R1sgqktdqxTSFa6dlw==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-15T20:51:53+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 12:51:53 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08E8D6DACD0610F306188BDA8C5820B6FE1A2888AA01-0\r\nServer: nginx\r\nWechatpay-Nonce: 8c9bf824090d8a36cefd6fe037870f12\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: f2lPxPjme9g6TI1wZinGk9g0RpiwLcKq0ORBAOz4MGD+2V2wSixRotbB02AIQy9kq2AYZWD0XQUDCwzIWEUCBNdiHaPQSYKX76urTZAU8pbdTObXhB8kGW5/fLqK5n4t9x6YhDfC9SQ7rQxWuScPBXIHq2KnMk/kcR2mAU+PasnuzuXSfmod/dt3YtoognVdxkC2r0fWvEklI4a8JL/HCI19EqakdsiTuPtWpSLCDRc4oPhcxZwe/deWScKxvSU7c54jwS3xe0RK83nRdFHvwnCbucdSg3yqjtTmkXwB9jzNT5Nql1r2XmcS3kcgbgFZwnpFQWfJEhsG0g5Gkhh84A==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773579112\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315202503426849\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T20:51:53+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315202530561613?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"IvWMuWuGsn1QuDr9jn9KFuQ6SODTpDVT\",timestamp=\"1773579113\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"Pdw0vM0GmLxW88rc3iizjlN6aBz0RJ5j4ENWT7/35lvJCUnLdOWwDpJEaz6eaZ4gSfPg8Wbp7kuhcRVsNKZPiCY2+PP9Q4yWPz0DZMJ2IZ6lZ1F3FPQ3XVwU7j4EVLh9fpDe85u9Uhqy0W7qFv+iDY4SfbEwUifbaUum/M2CK2T3Pl+QSoZYOFuJhIOaQE8LIsqN2J0bDODmCH0NCVKCH3ekWA7VkbZLlHtVNjfckWXCnO6wWw0xkIdMAFVAXdnGlDENy5ip6jVAKuI8Aesz7x7MYcW5mnp6pW79mLHI3tB9oHKG99Woee5HdY6r1EEDRh6EMjLJekqg6bHoU/CHCQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-15T20:51:53+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 12:51:53 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08E9D6DACD06105918E9C6C05520C6FA2D28B8F103-0\r\nServer: nginx\r\nWechatpay-Nonce: a4ec921877fbad11a9cf2b0a2da6badf\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: um/6wjXobYDInp1mG04vyZs0d4mcVLoNw8lOujQ3TQRnLaWZXP0URpnoVxodBk4rF2WIjfIE5OkzI26W7DW01Mvg/ZVmMk58DkjGLujSmzPs8LowpWQMc27kczjoYVcIlRPr5RiqsXPqaEomKnEzkwUtHUQzp9shO/XFYWBoKsnmuHv/StcawtTjslzqLlbR0xeR5pidu/go1cwV7R7Cp8U932prZUKCq2VAkInLQHZjOLGpuIIIAMwZSojOtbcY5oRRQgnelLBN2wUDbwjS+MDLdSha8tl4NoJUWtynNh5y0A/fDbZAJiNlu/kKIXlcr47UaWNmFng0egsPf2qQig==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773579113\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315202530561613\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T20:51:53+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315204530619247?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"vE5KMpsES9RRuDsSMnD0xSHZ7zdNUjWc\",timestamp=\"1773579113\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"36Fia5gkG4WMHQl0J/31SBdwQJNwcWiijWrCrpQdOXBsOhYRKVi9HgUq7PEbLhvdGj+ZZblBEZVr3yGn6aAnVqM/zNl3ivUouEMKoGawFzFyxFzNH+2k9ypDBmMNZhXmN0mwlMw3eRlTJflBI24jyYFZOzUAISb+vK/xmbzrX4koSiczBHbTY1CpIteVYM6I1SzNlFrg42/5r372XxCfmB4Al/qN2Dq7blA1KUq2faASm1PQnI8CTujsZ7GGSuBmT2QTXig3M5978lrpDiF/TAr0uaZrxBshRvpg3rJyYb1+y7hfQXqDZE9RasAs4roG7BmmCX64fPxkRCK0Zk2I0A==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-15T20:51:53+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 12:51:53 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08E9D6DACD0610930218EFDB8C5820E0D90D28BA8A04-0\r\nServer: nginx\r\nWechatpay-Nonce: 3753187d1891444c547239bc25659c6c\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: yCYJC7cIupozhjNmLYOEbRifeu18hDKI7uoD2JWQhZm5wjCXZokGxMnIdU29y/Eb6MV2EPL/Bz8lGABLdruN5dllA0xo6tW3dDKTbk/cQ0rlTlf9RgXMMCKibpYx8CqJ6j9Bh0UuUYV4Vyd8Tn2QOipWxC4+l2lFTymRgPoQRn4cHQzCpLIEl6+RiLCpRaoPeNmUT+j5PoE82Q35zSFr47oWm/EgjZ68JcOfbUbyJXxTrlK0Z2FIR1tnEVgxjAmyDyxOfglnVACDERqJwamO87K7I+oM6nD4qcjojR54Qbkvav0b14izveIDwcTGMdxLteT/bj7Gc04UjJlgZ3RqDA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773579113\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315204530619247\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T20:56:52+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315202447272285?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"e719zBk0AfppdPSoOqKTlMUyTGkzfQKw\",timestamp=\"1773579412\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"Wyk3Qco5eLQWlIqEJtm2VJYj+QFDqC1+MmRTBeaz0UjuRRgmD+jQexkcmCGoAn/2UyYHoZtPE7MQN2L3WFs0WiZeq5oTAdxwysmX3uZPmOiB+xRO7RYFe4QxU+KWUxaZ5nx5hFRc/syICRtQNNV6dHJW76QDmm4cTq+Ylzq8HrGWF0Wk1LoEDld5ZDXZxJziieXs8fWHkykmyAImFx5Nr9M1dm94UQpSyNLtAAR6hdERFueCajuWNgr/6xg/vGlDxMjpk3Mniot9PfYBnFfOyglARfPSBR7iLCzEycLaB+2nCo2ZhK6B0y71aaRRqMJveln7bgipSYYgAX6SuMEcWw==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-15T20:56:52+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 12:56:52 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 0894D9DACD0610BC05189890F5AF012098DD3C28E3B002-0\r\nServer: nginx\r\nWechatpay-Nonce: d67646207e3b7e1deed04a7fec3ddcb1\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: ZHEB2VoinNpTKGCkFN54bwYaDRAcV0iqT4zjphvHNX0vOEWHHPf7yG4UE7sWX3MIul5a1E5o8V6XfKEsCVuNKqJVkhFSBSbTgbtIw2mJBzdoU2AWvlqUeVS25f47EeNKVoY/q219lHG2tm5LlfXCHr9R1PKoakJSgXHXuLX0dPjfMZPS+bSkZAGxwA5d3XxpAn9kJBJaHABCzV1tLgCDnMVtpd0EF6soJZ0ncJSuXAlhz5iCx6F/pBCUcoc8js6v5qb0xYEhozveqjvXjd2iK7GMIsfWcmyEJ0pneJmC2gz/okxvrncck34oYa9fcXhSSgxXMwDVYruD8gSbMriODw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773579412\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315202447272285\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T20:56:53+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315202503426849?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"1vwWgXjrzOUIeoGNgPtUo0CBk495dJen\",timestamp=\"1773579413\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"1yg4hVlmZX0XM/gZiBrc+A3jWbt2xEdtS8k6ZBUIeV8AUWI3ad18ImNftkYOld1sMd1NNj2yJWMDg88OhRnAtS7tKEz3u9Q2xjQnFL0McVriIWrIXG3kuFnG5bpJO/meQ2YwwF2Djbsjz8kRMtw6WSELPG0aBRUCwy/w8tuTTxdOFV6knAHhg9bZxmXxwA0qApyZwDJVx8yP0lTf/7h9dlqBi7Er31F4FEZOJz0bs4/SdVE85stL02QZcoo5fhXR1ilNCy0T+bjfdsA9/IVXyUaOmM2WerBYIkzi7wHLCUUsZtcgMzd54q83vJ5SCGQWh+2BvxIvXyhzxCt/y7+4gg==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-15T20:56:53+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 12:56:53 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 0895D9DACD0610A00118BCC8C05520B2A13928F1E205-0\r\nServer: nginx\r\nWechatpay-Nonce: 4a5b45b51e9ccf4cd8185a6f51b91daf\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: SiFSiUMBEJEXkpjLclCKIhrEux37hOWz94Cr+T/cDNPRqHMtZ17M0WgC4RaM9Ktxjjn0OL24sOp3ecjsx9Pg+CgqdN77ZWDQs/K4DpRNbvo6DwTGSMRLRYH9TxdQDnqKaRS5ocg/NnmQStqb39Cs5v0klrbYVhtX8aawACUEgnslXfSd456OMYAKMDQPhYF7PxLS+Vq/zSaxrpBrqzXXYIUGra7ubObO/kYa7g0HcsM5vgQp5p7ZpKbRwYLwBq6QBr5FgkPABnTJyptkI+ExqvU68ytHIMvWq6zmyXO+Xu+3GB+/13b35p33msMk6tjCHVhWxL6OiLPtbrB/2V32Yg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773579413\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315202503426849\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T20:56:53+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315202530561613?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"8dFXifpqYpu1rEUL9fKkw7FPoUJQ0FyT\",timestamp=\"1773579413\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"ccYakYgLwEFbf7uN8Z5YjlRBtHfzZ9Ta8mKHHVxTOmrPkGre69Qq8DYexSFLg7y+8mkFjuk7enTz0c05C7wKgG6h/anNVhjRVfcsqv5lCG1hBAE+srqW9Tp+BjCpU1cXW2RjlzTpGy9EKWh89KP8Cm1MDM9ZbHgeMS5Nw0UUz1Kowi+OclGyB/9H/MF0Vdeg6YzWobhbiOy+V3XJ6MOxG+3no/C8rZIyFrtMrgg/V4aPtK/jg6V6ljbOuFDUxtLBoCJzGhvCbvz/izhHfvJrfHh2BmxV1wRRB75mq68Ztd49B//OrJQK3VMkzWu3s1t08MQlG0eIHoFp3l08wY5kgw==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-15T20:56:53+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 12:56:53 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 0895D9DACD0610B005189082F8AF0120F68E0928AD9301-0\r\nServer: nginx\r\nWechatpay-Nonce: 8d498824b75b8fc5f6943f97a15b3459\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: XhJmlVMvFUT+YozjWk2YMCnEOxS2JuF1sHGd2MUjI+UZ6gnZ2M6tVa67/ttmX5GB8OYSH9kJbs69koIM11nR2fyNnXLAl1mv5VmiHn/pidx4XhiiDmNe/Ofwsc4i6vghrwsTX2f/cE7fX6ZvgXwywFu5hmqarsHLsMI9mowpae+ts4+nUj+wVuiP6sr7PpWkf5mO+jdt4Ek33D26nPHL+ZNTmLwKvXEOh/5db0Qdkaezh2wWKVmoGqxVPPD1VWFlgpahib9xYe0cm9vq10TO+zjqPt+ZuT/XJWyezqaVNBSY4bFozjWE7LzHm+LANhHQsQJ+QKzyp9itKyop8vgZ9w==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773579413\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315202530561613\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T20:56:54+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315204530619247?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"9caJo36tfBisLQgw09HXrWyFCoz1FSaE\",timestamp=\"1773579414\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"DEsG9K/XhCdYc0j4y4pKhPYw6RfIHyZcSQtYk3n2taN8JUmOY/fYAS+uL3eEcJ4b/3OL+MfNeChLX8kr5DWlDs7jK74Ys4NOAxcxNfdHkKKW4XAMluQYF6gnS5MuVb+DKAhDIRAyvLkjbecFE2ug2m4bFQiidF83001A8W1CfTb8rXiUXJmMyyUu1aZq9bbKgORlWhUITXElbldVixezeBHNokFPtsYr89qGE9vAf3YYCR7A93qN0f4r5EusvpWfXB88DLGOJ6wvlnnqF4G18j2kHKvy4voRJ6NsyT7MVWz/KqjGYh3PimQ5GdbVQuW+CcGateHhueD+voEscluXXA==\"} request body:"} +{"level":"debug","timestamp":"2026-03-15T20:56:54+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 12:56:54 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 0896D9DACD0610D50118B19885AB0120EE6628EBAB04-0\r\nServer: nginx\r\nWechatpay-Nonce: a7489dac63fe82438c34d8116c623654\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: cm+36OYJFu/3S2jX4vTb925LdJCpqEM4TqjzJIXCePVAfdMiSJboH/7TdnyfVOzQliONKmMZ8v8aTOsWGAF7avK6wfrAc1gzSjnkFMveGIWnKw49QCkBKfenTFsFj0zEMimy2742iRzADtf411LJArDz2xXJ73JCuLtMv+QrLXdUs8nqM9xmR7qKix7cPmWSF7qzovFxpsVzcKAPUkwb3EzqCMG21O2CosCzShpHoiw1iwhl+fD+3zHm9pY+lsmp1K7tCqtvxBjFniLHlnLqAAs4DrRGd8h1ABlrz2TwfSUSjsUAv1Fi/uTJh9eC4xvIevjWPTPUWPX0B7m/uDB90Q==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773579414\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315204530619247\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T21:01:52+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315204530619247?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"FeUcvbx3mazx4ACsACFkwp2kwrcic2jt\",timestamp=\"1773579712\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"cToyuAjhH9JU8xMO6Owrz2itZItsYHxNmCcKpwRWrFity8m/JZY3ezssRQF/mXbL27daNI+0aIZidvAB3PygOAPGqNSypHfoN59/OPq623dSVIy7uWbGSDi7ks+HlPgCQTeK++Bwk3EYm8bf2AmWZnVclSLNVWlBJm0EDaPAX9+qusSCy5qZyKgGINjrpw+/cxpLfZbaqOMd6Ug4HadD3sum8fIQfV2siM7MgOKHjyGfBJW+Ezs0rA0YJ6kEYDy3ABctfJldHjygHfGQENZ8JLSZ6rS+bWmLLhdEoJaJQ4YanQaPhLJ3VzRvqTyaZXoqtn1nrfiEupigot6tUDThnw==\"} request body:"} +{"level":"debug","timestamp":"2026-03-15T21:01:52+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 13:01:52 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C0DBDACD0610890518A6DB8C5820FCAD1628E4D402-0\r\nServer: nginx\r\nWechatpay-Nonce: 4ca2ab5a0d13bc47f2a7ee5abf74b390\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: Qs17Fg2OCfBhAb3Y7yfvWLcNy5DriJAuS8yqWwe1y29EXDBjiYbukb3nTKhSafDK40EujDmswapJ4wcEg5v79BSfPu+ss1bFrT4gnEb48srW0qgr1cxPuQ2stWxU7SxlyV7KojjKX14KKuXn9fKK0Qu0hkDaNYMFVPR6pKfrJaC4i7vKvnveQeCB1bjjX2c+UpnDyNTkO8mXbXG42NJFQyh9uS1sOUfAUA5cAahDS7gW9MTMAnkWrno3ueH/3JQsWAs+lGJKeDuTH+1yqtmWSNrY1W4XiY5BNxrtfkcfvNOlldFzbOm5zEb8EhThWV+zACFv5F3IghLaPaZWFQ2HUQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773579712\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315204530619247\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T21:06:52+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315204530619247?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"czEsnSBfeC1GuqUiqppTD26WGsFt1RVO\",timestamp=\"1773580012\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"q9LEY6VBiwuVnTBbyGnrHO0XpeRONLVGgdofe2EtXw0z/FjogDnQeoAzoWtZw/hctLme1tQGOWVL6p8YX9c9jnL9ZaBKNe8HGBFhzF1ndGftEUkvxi+xNmLbMseIH1cvkZwATVsAxnW+OxtBJVcCEEUULlc2j4JRJBCbiThghgDIH5uE8ujWdxJ0liibKGNxamLfcYx+t55MYhgtgerd2PMXDzGo9qcC9jGNNaW8KWKi+R/U2G6TBr7hchHeFvuMWOBoe/eP594KQJV6/SB4XxFGtaBCL8sEQ5GP3aerMDJlRReCeopmMDftKcdAUyVrEz8hsiBTKqR2WFGPYrA0Ww==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-15T21:06:52+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 13:06:52 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08ECDDDACD0610820518F3C78C5820D6F30A28B0D402-0\r\nServer: nginx\r\nWechatpay-Nonce: 7e5fae6fbc128d9efd7901736eed34cc\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: IK9Zb2VC3vpCIWMny+D1FdjrYRSxOVy8vnjAMoCEC+9SY6WR9BBwnlNk6QAAqVTnjxkCQh2IlOWf1+gHJDMqDIXIYgEtsVtFmabpb2l94jdm5GnX5A0TFel7B9h65xESSvrigB4YfqZTeV1ZzMpyoaNEQVjQ2+hmdhCeoJeLy2im5zGXBfSqYlCGtm7p9O4ccUR0rSXvlAI5dQ7hFzlCjPUUssm4fzjxLnADdewQWmfGS6If2IlQRZHVMC+nGd+MKmw8EhT6AsAn6gC6s1+09TFiuOoXKwMJWoE+dRKKZs67mKV/64fD6s7BwTvjSGJeUM8WvODDic6E4vxS/29zOQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773580012\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315204530619247\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T21:11:52+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315204530619247?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"6WAIqixT7kUc79pZIYIpBjZp1V8t7rHy\",timestamp=\"1773580312\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"QaumaeaIcLluXlSWIfTlMJLCD82NGlWi2PH3VFf9hK+3TJf3wpoHAAskhq6ae8wCsuP++4fqIIWR/ClkZnUmYgff9t2iKJyY346jynAB1UnXkj8sagsWdx9Xcf07zc/4OCIHu75RNmBBql3Mf73pGa9uzh24XwEmBPGrDZOKHpqjM09qxT3IVaGYFAIs9vt33WbM4xmbshylRdq+pxO22geNeeAkQ+X8MS9mi4RmHAZ7ybLR/U50/VKQ70f1A7m4fjNuu4iioHhMxBj+KmG9W2q0uY/gOyVOaLGROEBpS33U3UXpMDqMiLPEyXSS+6aEAhUvWVLcsj6SucFMj3hoDw==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-15T21:11:52+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 13:11:52 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 0898E0DACD0610CD0518DCE6F8AF012098A214288AD502-0\r\nServer: nginx\r\nWechatpay-Nonce: 2f19d7cc6e0dfaa06bdce7c85e36098e\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: dwddR821riC0Q6iF2VDj3BwA1JnxTMA85kHT4NnddIQYfQcRyFnIgQ9BiHqKQ8aY8CKSBhNh459TWpm9GfmWfRK//H2n4GYCzHl0JuggfMYYH50Z/Zdtyn1+SomzcXzXWdNjw3jL4ccoQKABlAjguOYMxTv1XOFnP/Ahe9Tlv8qckoWvEf4lua0nSgr2KOkwXp8aWbtNgJXDblijPpXp0mhC3nxthJwoCCFqET2ATWgtiLMoWcVNEQ7ZmysDwtp5ajknUy54sG35fNpr4XNhNlY+GELT6Ffjfvy5i60Gx/BMc12J9ansaE2cW84B608SXO9IoRX9JkgDGJrU8wsgrg==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773580312\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315204530619247\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-15T21:16:52+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260315204530619247?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"ex21je8nwvshcAqYftcs9Ha5iUO2C5Oz\",timestamp=\"1773580612\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"KRRQdK55IJ7NWD0SCh2DRkKxT2CksPD+sfWWFZaYV1wwTchjz6R8BywXzb07vQcbdjBgehzjOY6by9HfTd0yQmYVidaU2DyWsxN3pCxwWsObInZLdXtLDvwW37lcghnL77wb+XwAqwrGBOZtB+WLwlIhH9Ag9svzVGN7cW8DTBu7o9+3m/jtSk7Qgysa7HOxkuJNfbLDV0hhNlVpaFSvHtriDSxFHWQ6+ws7ZfVwXPTaUV0Tr8Pu5894ZDlQKkrwiBExQh63edprK9l0V5m+va6FiAO+n3zvv59P7eo7+O08FR7jCWONE+BQjnljRSjxTbgxb/aVj3xzZcAhg4eSQA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-15T21:16:52+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 252\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Sun, 15 Mar 2026 13:16:52 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C4E2DACD0610AF05189A8985AB0120C8CE28289755-0\r\nServer: nginx\r\nWechatpay-Nonce: efbe563af7ccb856638213f28b464152\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: SHeVt9DiS95Q0EiwnpviZ7vu6+sFsgI51meKG0QdnTk9C70QT3HjqAqYfYto6yAPph82QFm3YLGM30aAWeqJj/czJA/FhhDZRu7awRZicWhr6Ws+vTUP39eM2LJATXJ+0dyEim7qoXJz3OgjXlxkQ8glhlJeoFPAZxcLnanmXLxRj2qTTOlQi1lRrifjqlUF7o2pMFq20jLLiesSqZBE9DigMISVpRRY6MGmtx3YyvV7rqxVPn52mg6aJ82N/8xS7oJC3wm5QIi4/1KdocPF5NB7J7QSo2OTqxVf7klTtd8GC+xjI1rveeysbKqG386uZknTpcBq3WKmPiVEau23GQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1773580612\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":198000},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260315204530619247\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} diff --git a/开发文档/1、需求/修改/20260315用户管理3.md b/开发文档/1、需求/修改/20260315用户管理3.md index 30b982fb..0a3ec48c 100644 --- a/开发文档/1、需求/修改/20260315用户管理3.md +++ b/开发文档/1、需求/修改/20260315用户管理3.md @@ -1,5 +1,22 @@ -功能一: -![](images/2026-03-15-19-13-23.png)添加规则,这里保存,是添加规则,这里保存失败了。保存失败,然后这个。保存失败,帮我修复一下,看看具体什么问题,直接帮我操作,并且修复完这里没有添加规则和读取之前的那个规则,以及这个规则添加完之后必须得生效的规则,可用的规则都给帮我添加那个添加进去,嗯。 \ No newline at end of file +功能一:链接人和事 +![](images/2026-03-15-22-33-29.png)然后到存客宝这个场景获客里面的生成相应的那个计划,以及到这个链接人和事的这个页面,把能艾特蓝风的相应的都生成这个计划,并且这个计划可编辑到咱们的这个链接人和事。然后务必保证这个 TOKEN 跟这个能转到这个相应的链接,你从腾讯云的服务器上面去找到那个和乘客跑的那个操作形式上面来找到,但来找到这个的几个那个 TOKEN 帮我填写上去。来完善整个的那个项目。把这个链接的那个事的帮我操作好,但是不能修改存课保方面的任何文件跟数据库。 + + +功能二:规则配置 +![](images/2026-03-15-22-34-51.png)那个查看这里的所有的这些规则配置,这里的规则配置和是否开启这些功能是实际的这些功能,而不是纯粹规则列表配置完之后是能使直接实现的,包括具体的一个时间做什么事情,然后看下现有的一些代码,把这些规则补齐,有的就直接打开,然后需要埋点跟判断的就帮我完善这个埋点跟判断的这一些这些内容和提醒这些。都是一些出发的一些条件,帮我全力的完善一下,并且检查可用性。 + +功能三:获客计划 +![](images/2026-03-15-22-37-27.png) +![](images/2026-03-15-22-37-52.png)小程序文章点击爱的蓝风的时候,这个前台前面点击那个 ad 指令人的时候,获客数这里要匹配,并且能点击进去看到这一个表,获客的这一个表单一方面在每一方这个表单跟纯客宝的这边的那个获客数是要相匹配的。获计划是要相匹配的,然后在这里的话是可以直接选择纯克宝的获客计划绑定,能看到当前的这个 API 的那个获客计划,并且能点击绑定。 + + +功能四:支付还是有问题处理一下 +![](images/2026-03-15-22-39-38.png) + + +功能五:右下角朋友圈分享 +![](images/2026-03-15-22-41-02.png) +点击这个按钮,要跳出分享到朋友圈,然后并且能直接那个复制文字。然后这个复制出来的朋友圈文案的话,就是前面,嗯,那个总获得的话就是前面的。前200,前100个字到那个200个字之间,那最后的话就是一个省略号,然后再加一个手指的一个箭头。好,获得的是文章的是这一个文案。 \ No newline at end of file diff --git a/开发文档/1、需求/修改/images/2026-03-15-19-53-08.png b/开发文档/1、需求/修改/images/2026-03-15-19-53-08.png new file mode 100644 index 00000000..0e133bd7 Binary files /dev/null and b/开发文档/1、需求/修改/images/2026-03-15-19-53-08.png differ diff --git a/开发文档/1、需求/修改/images/2026-03-15-19-53-58.png b/开发文档/1、需求/修改/images/2026-03-15-19-53-58.png new file mode 100644 index 00000000..faba27a5 Binary files /dev/null and b/开发文档/1、需求/修改/images/2026-03-15-19-53-58.png differ diff --git a/开发文档/1、需求/修改/images/2026-03-15-19-56-29.png b/开发文档/1、需求/修改/images/2026-03-15-19-56-29.png new file mode 100644 index 00000000..f86d8e56 Binary files /dev/null and b/开发文档/1、需求/修改/images/2026-03-15-19-56-29.png differ diff --git a/开发文档/1、需求/修改/images/2026-03-15-20-00-02.png b/开发文档/1、需求/修改/images/2026-03-15-20-00-02.png new file mode 100644 index 00000000..b4463bf2 Binary files /dev/null and b/开发文档/1、需求/修改/images/2026-03-15-20-00-02.png differ diff --git a/开发文档/1、需求/修改/images/2026-03-15-20-01-17.png b/开发文档/1、需求/修改/images/2026-03-15-20-01-17.png new file mode 100644 index 00000000..194f5d12 Binary files /dev/null and b/开发文档/1、需求/修改/images/2026-03-15-20-01-17.png differ diff --git a/开发文档/1、需求/修改/images/2026-03-15-20-01-58.png b/开发文档/1、需求/修改/images/2026-03-15-20-01-58.png new file mode 100644 index 00000000..cf885186 Binary files /dev/null and b/开发文档/1、需求/修改/images/2026-03-15-20-01-58.png differ diff --git a/开发文档/1、需求/修改/images/2026-03-15-20-04-09.png b/开发文档/1、需求/修改/images/2026-03-15-20-04-09.png new file mode 100644 index 00000000..8b31997b Binary files /dev/null and b/开发文档/1、需求/修改/images/2026-03-15-20-04-09.png differ diff --git a/开发文档/1、需求/修改/images/2026-03-15-22-22-57.png b/开发文档/1、需求/修改/images/2026-03-15-22-22-57.png new file mode 100644 index 00000000..1de46951 Binary files /dev/null and b/开发文档/1、需求/修改/images/2026-03-15-22-22-57.png differ diff --git a/开发文档/1、需求/修改/images/2026-03-15-22-23-49.png b/开发文档/1、需求/修改/images/2026-03-15-22-23-49.png new file mode 100644 index 00000000..da2f5d88 Binary files /dev/null and b/开发文档/1、需求/修改/images/2026-03-15-22-23-49.png differ diff --git a/开发文档/1、需求/修改/images/2026-03-15-22-24-45.png b/开发文档/1、需求/修改/images/2026-03-15-22-24-45.png new file mode 100644 index 00000000..18b7a638 Binary files /dev/null and b/开发文档/1、需求/修改/images/2026-03-15-22-24-45.png differ diff --git a/开发文档/1、需求/修改/images/2026-03-15-22-27-57.png b/开发文档/1、需求/修改/images/2026-03-15-22-27-57.png new file mode 100644 index 00000000..0c607e4e Binary files /dev/null and b/开发文档/1、需求/修改/images/2026-03-15-22-27-57.png differ diff --git a/开发文档/1、需求/修改/images/2026-03-15-22-28-36.png b/开发文档/1、需求/修改/images/2026-03-15-22-28-36.png new file mode 100644 index 00000000..696e293b Binary files /dev/null and b/开发文档/1、需求/修改/images/2026-03-15-22-28-36.png differ diff --git a/开发文档/1、需求/修改/images/2026-03-15-22-33-29.png b/开发文档/1、需求/修改/images/2026-03-15-22-33-29.png new file mode 100644 index 00000000..4ccf52a1 Binary files /dev/null and b/开发文档/1、需求/修改/images/2026-03-15-22-33-29.png differ diff --git a/开发文档/1、需求/修改/images/2026-03-15-22-34-51.png b/开发文档/1、需求/修改/images/2026-03-15-22-34-51.png new file mode 100644 index 00000000..22f6d964 Binary files /dev/null and b/开发文档/1、需求/修改/images/2026-03-15-22-34-51.png differ diff --git a/开发文档/1、需求/修改/images/2026-03-15-22-37-27.png b/开发文档/1、需求/修改/images/2026-03-15-22-37-27.png new file mode 100644 index 00000000..dd9456bc Binary files /dev/null and b/开发文档/1、需求/修改/images/2026-03-15-22-37-27.png differ diff --git a/开发文档/1、需求/修改/images/2026-03-15-22-37-52.png b/开发文档/1、需求/修改/images/2026-03-15-22-37-52.png new file mode 100644 index 00000000..ca1e6b12 Binary files /dev/null and b/开发文档/1、需求/修改/images/2026-03-15-22-37-52.png differ diff --git a/开发文档/1、需求/修改/images/2026-03-15-22-39-38.png b/开发文档/1、需求/修改/images/2026-03-15-22-39-38.png new file mode 100644 index 00000000..c53869a2 Binary files /dev/null and b/开发文档/1、需求/修改/images/2026-03-15-22-39-38.png differ diff --git a/开发文档/1、需求/修改/images/2026-03-15-22-41-02.png b/开发文档/1、需求/修改/images/2026-03-15-22-41-02.png new file mode 100644 index 00000000..716f7dac Binary files /dev/null and b/开发文档/1、需求/修改/images/2026-03-15-22-41-02.png differ diff --git a/开发文档/1、需求/修改/20260314内容管理10.md b/开发文档/1、需求/已完成/20260314内容管理10.md similarity index 100% rename from 开发文档/1、需求/修改/20260314内容管理10.md rename to 开发文档/1、需求/已完成/20260314内容管理10.md diff --git a/开发文档/1、需求/修改/20260314内容管理11.md b/开发文档/1、需求/已完成/20260314内容管理11.md similarity index 100% rename from 开发文档/1、需求/修改/20260314内容管理11.md rename to 开发文档/1、需求/已完成/20260314内容管理11.md diff --git a/开发文档/1、需求/已完成/20260314内容管理12.md b/开发文档/1、需求/已完成/20260314内容管理12.md new file mode 100644 index 00000000..212f8899 --- /dev/null +++ b/开发文档/1、需求/已完成/20260314内容管理12.md @@ -0,0 +1,16 @@ + + +bug修复: +image.png![](images/2026-03-15-19-53-08.png)这一句话不要显示在这边,在文章里面的。 +![](images/2026-03-15-19-53-58.png)头图像还是裂开的,帮我检查一下这个问题修复。并且这个后台的数据好像没有同步过来,嗯,小程序上没显示,帮我分析一下。 + + +![](images/2026-03-15-20-00-02.png)那个点击允许跳转到自己的这个指定那个小程序页面的时候,那个如果他就直接关闭的,帮我看一下问题是什么?什么问题直接帮我处理一下,有自动关闭的 + +![](images/2026-03-15-20-01-17.png)的前端 点击小程序这个@,没有功能,没有实现功能,帮我看一下这个 ad 的功能没有实现。帮我处理一下。 + +![](images/2026-03-15-20-01-58.png) +这个头像获取微信头像之后,这个链接还是有问题,帮我检查并处理OSs 链接的一些情况以及 OSs 相关的功能,你帮我检查一下 + + +![](images/2026-03-15-20-04-09.png)这个点击小程序右上角的链接卡落,对,需要触发那个需要有字填写完善自己的微信号跟头像,微信号,手机号跟头像微信号跟手机号的其中一个和头像。点击完之后需要有这个。这个才能添加他吗?这种点击链接的都要完善自己的资料。 \ No newline at end of file diff --git a/开发文档/1、需求/已完成/20260314内容管理13.md b/开发文档/1、需求/已完成/20260314内容管理13.md new file mode 100644 index 00000000..dfbca308 --- /dev/null +++ b/开发文档/1、需求/已完成/20260314内容管理13.md @@ -0,0 +1,21 @@ + + + + +功能四:派对ai +这个咱们把这个派对 AI 以后都是用派对 AI 来开发这个一场秀的创意实验,然后让派对 AI 来发布那个复盘的一个那个内容,并且样式要符合飞书的样式,那这个派对 AI 的那个开发一场商业实验的时候,都用派对 AI 来做那个核心的一些工作。并且做实时的汇报,把复盘的东西发到这个创那个指定的这个群里面,所有的创业派对的这个项目,AI 的这个群里面,并且捆绑清楚。后要告诉派对,还当前发布小小程序,咱们对话过程当中发布小程序都是那个1.2.6的这一个版本,当前都是1.2.6的这个版本,并且是预览版,然后要申请到那个审核上面1.2.6的这个版本 + + +功能三:样式 +![](images/2026-03-15-22-27-57.png) +![](images/2026-03-15-22-28-36.png)然后这个界面的上一篇,下一篇的这个宽度已经超出界面了,所有的那个按钮宽度不要超出这个界面。这个央视帮我修整一下。特别是那右下角这个地球的话,它是能直接实现点击分享到朋友圈的功能,并且复制文案就直接实现,那如果你不能实现,你就告诉我,不要让我再点击两次。 + +功能二:支付问题修复 +![](images/2026-03-15-22-23-49.png) +![](images/2026-03-15-22-24-45.png) +分享里面的微信支付跟余额支付这个充值都有问题,都是显示充值失败,帮我检查一下到底是什么问题,直接帮我处理掉。这个充值接口检测清楚,然后把这个我的余额里面这个退款的按钮去掉,推广的按钮去掉。删除掉这个,不要有这个功能。 + +功能一:分享 +![](images/2026-03-15-22-22-57.png) +好友跟这个生成海报,这边的话和这个大夫分享这里的那个样式是一样的,图片在上面,然后下面是四个,下面是文字。然后第二个的话,右下角这个地球式的浮动的标签是分享到朋友圈的。那分享到朋友圈这里的话,自动就是生成文字,就可以直接粘贴,它要生成文字是生成那个营销的文字,关于这一篇文章的营销文字,每一篇文章都是一样,直接在可以粘贴到朋友圈里面。 + diff --git a/开发文档/1、需求/修改/20260314内容管理9.md b/开发文档/1、需求/已完成/20260314内容管理9.md similarity index 100% rename from 开发文档/1、需求/修改/20260314内容管理9.md rename to 开发文档/1、需求/已完成/20260314内容管理9.md diff --git a/开发文档/1、需求/修改/20260315 用户管理2.md b/开发文档/1、需求/已完成/20260315 用户管理2.md similarity index 100% rename from 开发文档/1、需求/修改/20260315 用户管理2.md rename to 开发文档/1、需求/已完成/20260315 用户管理2.md diff --git a/开发文档/1、需求/修改/20260315数据统计1.md b/开发文档/1、需求/已完成/20260315数据统计1.md similarity index 100% rename from 开发文档/1、需求/修改/20260315数据统计1.md rename to 开发文档/1、需求/已完成/20260315数据统计1.md diff --git a/开发文档/小程序管理/scripts/__pycache__/mp_api.cpython-314.pyc b/开发文档/小程序管理/scripts/__pycache__/mp_api.cpython-314.pyc index 9dcc6784..8dc9476e 100644 Binary files a/开发文档/小程序管理/scripts/__pycache__/mp_api.cpython-314.pyc and b/开发文档/小程序管理/scripts/__pycache__/mp_api.cpython-314.pyc differ diff --git a/开发文档/小程序管理/scripts/mp_deploy.py b/开发文档/小程序管理/scripts/mp_deploy.py index ad26a808..bd3053ce 100644 --- a/开发文档/小程序管理/scripts/mp_deploy.py +++ b/开发文档/小程序管理/scripts/mp_deploy.py @@ -13,10 +13,12 @@ 使用方法: python mp_deploy.py list # 列出所有小程序 python mp_deploy.py add # 添加新小程序 - python mp_deploy.py deploy # 一键部署 + python mp_deploy.py deploy # 上传 + 设为体验版(不提审) + python mp_deploy.py deploy --submit # 上传 + 体验版 + 提交审核 + python mp_deploy.py upload # 快速上传代码 + python mp_deploy.py submit # 单独提交审核 python mp_deploy.py cert # 提交认证 python mp_deploy.py cert-status # 查询认证状态 - python mp_deploy.py upload # 上传代码 python mp_deploy.py release # 发布上线 """ @@ -247,8 +249,8 @@ class MiniProgramDeployer: self.config.add_app(app) print(f"\n✅ 小程序 [{name}] 添加成功!") - def deploy(self, app_id: str, skip_cert_check: bool = False): - """一键部署流程""" + def deploy(self, app_id: str, skip_cert_check: bool = False, submit_audit: bool = False): + """一键部署流程(默认只上传 + 设为体验版,不提交审核)""" app = self.config.get_app(app_id) if not app: print(f"❌ 未找到小程序: {app_id}") @@ -264,8 +266,9 @@ class MiniProgramDeployer: ("检查认证状态", lambda a: self._step_check_cert(a, skip_cert_check)), ("编译项目", self._step_build), ("上传代码", self._step_upload), - ("提交审核", self._step_submit_audit), ] + if submit_audit: + steps.append(("提交审核", self._step_submit_audit)) for step_name, step_func in steps: print(f"\n📍 步骤: {step_name}") @@ -277,12 +280,18 @@ class MiniProgramDeployer: return False print("\n" + "=" * 60) - print(" 🎉 部署完成!") + print(" 🎉 部署完成!已上传并设为体验版") print("=" * 60) - print(f"\n 下一步操作:") - print(f" 1. 等待审核(通常1-3个工作日)") - print(f" 2. 审核通过后运行: python mp_deploy.py release {app_id}") - print(f" 3. 查看状态: python mp_deploy.py status {app_id}") + if not submit_audit: + print(f"\n 当前状态: 体验版(未提交审核)") + print(f" 下一步操作:") + print(f" 1. 扫码体验确认无问题") + print(f" 2. 需要提审时运行: python mp_deploy.py submit {app_id}") + print(f" 3. 或一键部署+提审: python mp_deploy.py deploy {app_id} --submit") + else: + print(f"\n 下一步操作:") + print(f" 1. 等待审核(通常1-3个工作日)") + print(f" 2. 审核通过后运行: python mp_deploy.py release {app_id}") return True @@ -689,6 +698,19 @@ class MiniProgramDeployer: else: print(f"❌ 上传失败: {output}") + def submit_review(self, app_id: str): + """单独提交审核(需先上传代码)""" + app = self.config.get_app(app_id) + if not app: + print(f"❌ 未找到小程序: {app_id}") + return False + + print("\n" + "=" * 60) + print(f" 📝 提交审核: {app.name}") + print("=" * 60) + + return self._step_submit_audit(app) + def print_header(title: str): print("\n" + "=" * 50) @@ -702,21 +724,18 @@ def main(): formatter_class=argparse.RawDescriptionHelpFormatter, epilog=""" 示例: - python mp_deploy.py list 列出所有小程序 - python mp_deploy.py add 添加新小程序 - python mp_deploy.py deploy soul-party 一键部署 - python mp_deploy.py cert soul-party 提交认证 - python mp_deploy.py cert-status soul-party 查询认证状态 - python mp_deploy.py cert-done soul-party 标记认证完成 - python mp_deploy.py upload soul-party 仅上传代码 - python mp_deploy.py release soul-party 发布上线 + python mp_deploy.py list 列出所有小程序 + python mp_deploy.py deploy soul-party 上传+体验版(不提审) + python mp_deploy.py deploy soul-party --submit 上传+体验版+提交审核 + python mp_deploy.py upload soul-party 快速上传代码 + python mp_deploy.py submit soul-party 单独提交审核 + python mp_deploy.py cert soul-party 提交认证 + python mp_deploy.py release soul-party 发布上线 部署流程: - 1. add 添加小程序配置 - 2. cert 提交企业认证(首次) - 3. cert-done 认证通过后标记 - 4. deploy 一键部署(编译+上传+提审) - 5. release 审核通过后发布 + 1. deploy 上传代码 + 设为体验版(默认不提审) + 2. submit 确认体验无问题后,单独提交审核 + 3. release 审核通过后发布上线 """ ) @@ -729,9 +748,10 @@ def main(): subparsers.add_parser("add", help="添加新小程序") # deploy - deploy_parser = subparsers.add_parser("deploy", help="一键部署") + deploy_parser = subparsers.add_parser("deploy", help="一键部署(上传+体验版,默认不提审)") deploy_parser.add_argument("app_id", help="小程序ID") deploy_parser.add_argument("--skip-cert", action="store_true", help="跳过认证检查") + deploy_parser.add_argument("--submit", action="store_true", help="上传后自动提交审核") # cert cert_parser = subparsers.add_parser("cert", help="提交认证") @@ -751,6 +771,10 @@ def main(): upload_parser.add_argument("-v", "--version", help="版本号") upload_parser.add_argument("-d", "--desc", help="版本描述") + # submit (单独提交审核) + submit_parser = subparsers.add_parser("submit", help="提交审核(需先上传代码)") + submit_parser.add_argument("app_id", help="小程序ID") + # release release_parser = subparsers.add_parser("release", help="发布上线") release_parser.add_argument("app_id", help="小程序ID") @@ -766,11 +790,16 @@ def main(): commands = { "list": lambda: deployer.list_apps(), "add": lambda: deployer.add_app(), - "deploy": lambda: deployer.deploy(args.app_id, args.skip_cert if hasattr(args, 'skip_cert') else False), + "deploy": lambda: deployer.deploy( + args.app_id, + args.skip_cert if hasattr(args, 'skip_cert') else False, + submit_audit=args.submit if hasattr(args, 'submit') else False, + ), "cert": lambda: deployer.submit_certification(args.app_id), "cert-status": lambda: deployer.check_cert_status(args.app_id), "cert-done": lambda: deployer.mark_cert_done(args.app_id), "upload": lambda: deployer.quick_upload(args.app_id, getattr(args, 'version', None), getattr(args, 'desc', None)), + "submit": lambda: deployer.submit_review(args.app_id), "release": lambda: deployer.release(args.app_id), } diff --git a/开发文档/小程序管理/scripts/reports/体验版二维码_soul-party_20260315_2022.png b/开发文档/小程序管理/scripts/reports/体验版二维码_soul-party_20260315_2022.png new file mode 100644 index 00000000..449703d8 Binary files /dev/null and b/开发文档/小程序管理/scripts/reports/体验版二维码_soul-party_20260315_2022.png differ diff --git a/开发文档/小程序管理/scripts/reports/体验版二维码_soul-party_20260315_2300.png b/开发文档/小程序管理/scripts/reports/体验版二维码_soul-party_20260315_2300.png new file mode 100644 index 00000000..460c4255 Binary files /dev/null and b/开发文档/小程序管理/scripts/reports/体验版二维码_soul-party_20260315_2300.png differ diff --git a/派对AI/04_魂码(火)/小程序站管理/SKILL.md b/派对AI/04_魂码(火)/小程序站管理/SKILL.md index de74d752..3329fb8e 100644 --- a/派对AI/04_魂码(火)/小程序站管理/SKILL.md +++ b/派对AI/04_魂码(火)/小程序站管理/SKILL.md @@ -1,46 +1,48 @@ --- name: 小程序站管理 description: Soul创业派对三端管理——小程序(C端)+管理端(React)+API后端(Go/Gin) -triggers: 小程序、管理端、网站管理、soul-admin、miniprogram、soul-api、三端、发布小程序 +triggers: 小程序、管理端、网站管理、soul-admin、miniprogram、soul-api、三端、发布小程序、部署、上传小程序 owner: 魂码(火) group: 火 -version: "1.0" -updated: "2026-03-13" +version: "2.0" +updated: "2026-03-15" --- -# 小程序站管理 +# 小程序站管理(魂码·火) > Soul 创业派对三端管理:微信小程序(C端)、React管理后台、Go API后端。 -> 代码开发已有完整 `.cursor/skills/` 覆盖,本 Skill 聚焦运维与发布管理。 +> **本技能覆盖开发、部署、版本管理全链路。** --- -## 能做什么 +## 当前版本状态 -- **小程序发布**:代码上传、审核、发布微信小程序 -- **管理端运维**:React 管理后台部署与维护 -- **API 后端运维**:Go + Gin + GORM 后端服务管理 -- **数据库管理**:`soul_miniprogram` 数据库维护 -- **域名与证书**:SSL 证书管理 +| 端 | 当前版本 | 状态 | 最后更新 | +|:---|:---|:---|:---| +| 小程序(C端) | **v1.3.3** | 已上传微信平台,待设体验版/提审 | 2026-03-15 | +| API 后端 | soul-api | 运行中 | 2026-03-15 | +| 管理端 | soul-admin | 运行中 | 2026-03-14 | + +**AppID**:`wxb8bbb2b10dec74aa` --- ## 三端架构 ``` -┌─────────────────────────────────────────────────┐ -│ 用户访问 │ -├──────────────┬──────────────┬───────────────────┤ -│ 微信小程序 │ 管理后台 │ API 后端 │ -│ miniprogram │ soul-admin │ soul-api │ -│ WXML/WXSS │ React/Vite │ Go/Gin/GORM │ -│ /api/mini* │ /api/admin* │ 路由分组 │ -│ │ /api/db/* │ │ -└──────────┬───┴──────┬───────┴────────┬──────────┘ - │ │ │ - └──────────┴────────────────┘ - │ - soul.quwanzhi.com +┌─────────────────────────────────────────────────────┐ +│ 用户访问 │ +├───────────────┬───────────────┬─────────────────────┤ +│ 微信小程序 │ 管理后台 │ API 后端 │ +│ miniprogram │ soul-admin │ soul-api │ +│ WXML/WXSS/JS │ React/Vite │ Go/Gin/GORM │ +│ │ │ │ +│ → /api/miniprogram/* │ ← Nginx 反代 │ +│ │ → /api/admin/*、/api/db/* │ +└───────────────┴───────────────┴─────────────────────┘ + │ + soulapi.quwanzhi.com → localhost:8080 + soul.quwanzhi.com(管理端静态) ``` **路由隔离(强制)**: @@ -50,58 +52,115 @@ updated: "2026-03-13" --- +## 服务器信息 + +| 项 | 值 | +|:---|:---| +| IP | `43.139.27.93` | +| SSH 端口 | `22022` | +| SSH 用户 | `root` | +| SSH 密码 | 读取 `DEPLOY_PASSWORD` 环境变量(默认见 `devlop.py`) | +| 部署路径 | `/www/wwwroot/self/soul-api` | +| API 域名 | `https://soulapi.quwanzhi.com` | +| 管理端域名 | `https://soul.quwanzhi.com` | +| 数据库 | MySQL `soul_miniprogram`(腾讯云) | + +--- + ## 执行步骤 -### 1. 小程序发布 +### 1. 小程序上传(C端) + +使用微信开发者工具 CLI 上传: ```bash -cd /Users/karuo/Documents/开发/3、自营项目/一场soul的创业实验-永平 - -# 使用小程序管理脚本 -python3 开发文档/小程序管理/scripts/mp_deploy.py --action upload -python3 开发文档/小程序管理/scripts/mp_deploy.py --action submit_audit -python3 开发文档/小程序管理/scripts/mp_deploy.py --action release +/Applications/wechatwebdevtools.app/Contents/MacOS/cli upload \ + --project "/Users/karuo/Documents/开发/3、自营项目/一场soul的创业实验-永平/miniprogram" \ + -v "版本号" \ + -d "版本描述" ``` -### 2. 管理端部署 +上传后需在 [微信公众平台](https://mp.weixin.qq.com) 手动操作: +1. 设为体验版 → 验证功能 +2. 提交审核 → 等待通过 +3. 发布上线 + +### 2. API 后端部署 + +使用 `devlop.py` 一键部署(本地交叉编译 → SSH 上传 → 远程重启): ```bash -# 构建 -cd soul-admin && npm run build - -# 部署到服务器(宝塔面板) -bash 部署到Kr宝塔.sh +cd /Users/karuo/Documents/开发/3、自营项目/一场soul的创业实验-永平/soul-api +python3 devlop.py ``` -### 3. API 后端部署 +手动部署(需 sshpass): ```bash -# 构建 -cd soul-api && go build -o soul-api +cd soul-api +GOOS=linux GOARCH=amd64 go build -o soul-api-linux +sshpass -p 'Zhiqun1984' scp -P 22022 soul-api-linux root@43.139.27.93:/www/wwwroot/self/soul-api/soul-api +sshpass -p 'Zhiqun1984' ssh -p 22022 root@43.139.27.93 "cd /www/wwwroot/self/soul-api && pkill -f './soul-api' ; nohup ./soul-api > /dev/null 2>&1 &" +``` -# 部署 -bash 部署永平到Kr宝塔.sh +部署后验证: + +```bash +curl -s https://soulapi.quwanzhi.com/api/miniprogram/config | python3 -c "import sys,json; d=json.load(sys.stdin); print('OK -', 'persons:', len(d.get('persons',[])), 'linkTags:', len(d.get('linkTags',[])))" +``` + +### 3. 管理端部署 + +```bash +cd /Users/karuo/Documents/开发/3、自营项目/一场soul的创业实验-永平/soul-admin +npm run build +# 将 dist/ 上传到服务器 /www/wwwroot/soul-admin/ +sshpass -p 'Zhiqun1984' scp -P 22022 -r dist/* root@43.139.27.93:/www/wwwroot/soul-admin/ ``` ### 4. 数据库操作 +直接 SSH 连接 MySQL: + +```bash +sshpass -p 'Zhiqun1984' ssh -p 22022 root@43.139.27.93 \ + "mysql -h 56b4c23f6853c.gz.cdb.myqcloud.com -P 14413 -u root -p数据库密码 soul_miniprogram -e 'SQL语句'" +``` + +或通过本地脚本: + ```bash -# 通过 db-exec 脚本执行 SQL(MCP 不可用时) cd .cursor/scripts/db-exec node exec.js "SELECT COUNT(*) FROM chapters" - -# 查看文章列表 -python3 content_upload.py --list-chapters ``` ### 5. 从 GitHub 拉取最新代码 ```bash +cd /Users/karuo/Documents/开发/3、自营项目/一场soul的创业实验-永平 bash 从GitHub下载最新_devlop.sh ``` --- +## 版本号规范 + +| 格式 | 含义 | +|:---|:---| +| `x.y.z` | 主版本.功能版本.修复版本 | + +每次上传小程序时版本号递增,描述中写明本次变更摘要。 + +**版本历史**(近期): + +| 版本 | 日期 | 变更 | +|:---|:---|:---| +| v1.3.3 | 2026-03-15 | 修复上下篇溢出、删除退款按钮、地球一键复制文案、分享按钮纵向布局 | +| v1.3.2 | 2026-03-15 | 修复@提及点击、@纯文本解析、上下篇排序 | +| v1.3.1 | 2026-03-15 | 支付修复(代付分享/充值)、退款原路返回 | + +--- + ## 开发规范引用 代码开发遵循已有 `.cursor/skills/` 中的规范: @@ -116,24 +175,13 @@ bash 从GitHub下载最新_devlop.sh --- -## 线上环境 - -| 项目 | 地址 | -|:---|:---| -| 小程序后端 | `https://soul.quwanzhi.com/api/` | -| 二维码接口 | `https://soul.quwanzhi.com/api/miniprogram/qrcode` | -| 管理端 | 宝塔面板部署 | -| GitHub 仓库 | `https://github.com/fnvtk/Mycontent/tree/yongpxu-soul` | - ---- - ## 凭证依赖 -| 配置键 | 用途 | -|:---|:---| -| `DB_*` | 数据库连接 | -| `WX_COMPONENT_*` | 微信第三方平台(小程序发布) | -| `WX_AUTHORIZER_*` | 授权小程序凭证 | +| 配置键 | 用途 | 来源 | +|:---|:---|:---| +| `DB_*` | 数据库连接 | `config/credentials.md` | +| `DEPLOY_HOST` / `DEPLOY_PASSWORD` | 服务器 SSH | `devlop.py` 默认值 | +| 微信开发者工具 | 小程序上传 | 本地安装 | --- @@ -141,13 +189,16 @@ bash 从GitHub下载最新_devlop.sh | 文件 | 说明 | |:---|:---| -| `开发文档/小程序管理/scripts/` | 小程序管理脚本集 | -| `开发文档/服务器管理/scripts/` | 服务器管理脚本集 | +| `soul-api/devlop.py` | API 后端一键部署脚本 | | `开发文档/8、部署/部署总览.md` | 部署完整文档 | | `.cursor/skills/` | 全套开发规范 Skill | +| `miniprogram/project.config.json` | 小程序项目配置(含 AppID) | + +--- ## 依赖 -- Node.js(管理端构建)、Go 1.25+(API构建) -- 微信开发者工具(小程序预览) -- 宝塔面板(服务器管理) +- **小程序**:微信开发者工具(CLI 上传) +- **API 后端**:Go 1.25+、paramiko(Python,devlop.py 用) +- **管理端**:Node.js、npm +- **服务器**:宝塔面板、Nginx、sshpass diff --git a/派对AI/BOOTSTRAP.md b/派对AI/BOOTSTRAP.md index 6595fecc..75952680 100644 --- a/派对AI/BOOTSTRAP.md +++ b/派对AI/BOOTSTRAP.md @@ -1,7 +1,7 @@ # Soul创业实验AI · 启动指令 > **本文件是 Soul创业实验AI 的唯一启动入口。** 读完即可接活、干活、交付。 -> 版本:1.0 | 更新:2026-03-13 +> 版本:2.0 | 更新:2026-03-15 > 项目:《一场soul的创业实验》内容运营与分发体系 --- @@ -11,7 +11,7 @@ - **名字**:Soul创业实验AI(简称「魂AI」) - **身份**:《一场soul的创业实验》项目的内容运营智能助手 - **职责**:视频剪辑、文章写作、运营报表、飞书管理、多平台分发、小程序站管理、素材库上传、Soul账号注册 -- **工作台**:`/Users/karuo/Documents/开发/3、自营项目/一场soul的创业实验-永平/项目AI/` +- **工作台**:`/Users/karuo/Documents/开发/3、自营项目/一场soul的创业实验-永平/派对AI/` ### 关联路径 @@ -66,9 +66,9 @@ Soul创业实验AI(魂AI) 所有需要 Token/Cookie/API 的操作,**统一从 `config/` 读取**,不在各脚本中硬编码: -1. 先检查 `项目AI/config/.env`(本地实际配置,不入 Git) -2. 若缺失,提示参照 `项目AI/config/.env.example` 配置 -3. 凭证过期时,参照 `项目AI/config/credentials.md` 刷新指南 +1. 先检查 `派对AI/config/.env`(本地实际配置,不入 Git) +2. 若缺失,提示参照 `派对AI/config/.env.example` 配置 +3. 凭证过期时,参照 `派对AI/config/credentials.md` 刷新指南 --- @@ -100,7 +100,43 @@ Soul创业实验AI(魂AI) --- -## 七、核心文件导航 +## 七、版本管理与开发分派(强制) + +### 7.1 版本管理 + +- **小程序版本号**由魂码(火)SKILL.md 统一维护,每次上传递增 +- 版本历史表在 `04_魂码(火)/小程序站管理/SKILL.md` → 版本历史 中记录 +- 格式:`x.y.z`(主版本.功能版本.修复版本) + +### 7.2 开发迭代分派 + +所有开发需求按以下流程分派: + +``` +用户提需求 → 魂AI 判断属于哪个端 + ├── 小程序前端(miniprogram/) → 魂码·火 执行 + ├── API 后端(soul-api/) → 魂码·火 执行 + ├── 管理端(soul-admin/) → 魂码·火 执行 + ├── 内容写作 → 魂产·木 执行 + ├── 运营数据 → 魂流·水 执行 + └── 多平台分发 → 魂质·土 执行 +``` + +### 7.3 需求文档管理 + +- 待处理需求:`开发文档/1、需求/修改/` +- 已完成需求:`开发文档/1、需求/已完成/` +- 完成后由魂AI 负责将文档移到 `已完成/` + +### 7.4 与卡若AI 的协同 + +- 派对AI 跑通的确定性能力,沉淀到卡若AI 经验库:`卡若AI/02_卡人(水)/水溪_整理归档/经验库/待沉淀/` +- 可复制的模式(CLI上传小程序、Go后端部署、支付链路等)供卡若AI 其他项目复用 +- 重大里程碑写入卡若AI 记忆(`1、卡若:本人/记忆.md`) + +--- + +## 八、核心文件导航 | 文件 | 路径 | 用途 | |:---|:---|:---| @@ -109,3 +145,5 @@ Soul创业实验AI(魂AI) | **凭证配置模板** | `config/.env.example` | 所有平台凭证模板 | | **凭证刷新指南** | `config/credentials.md` | 各平台 Token 获取与刷新方法 | | **使用手册** | `README.md` | 完整使用说明 | +| **魂码 SKILL** | `04_魂码(火)/小程序站管理/SKILL.md` | 三端管理、版本、部署 | +| **经验沉淀** | 卡若AI 经验库 `待沉淀/` | 已跑通能力存档 | diff --git a/派对AI/SKILL_REGISTRY.md b/派对AI/SKILL_REGISTRY.md index 123c3cf1..3d8b29c7 100644 --- a/派对AI/SKILL_REGISTRY.md +++ b/派对AI/SKILL_REGISTRY.md @@ -39,7 +39,7 @@ | # | 技能 | 触发词 | SKILL 路径 | 一句话 | |:--|:---|:---|:---|:---| -| S08 | **小程序站管理** | 小程序、管理端、网站管理、soul-admin、miniprogram、soul-api、三端 | `04_魂码(火)/小程序站管理/SKILL.md` | 小程序+管理端+API后端三端管理、发布、运维 | +| S08 | **小程序站管理** | 小程序、管理端、网站管理、soul-admin、miniprogram、soul-api、三端、发布小程序、部署、上传小程序 | `04_魂码(火)/小程序站管理/SKILL.md` | 小程序+管理端+API后端三端管理、开发、部署、发布、版本管理 | ## 土组 · 魂质(分发与变现)