From 7bf301a9c8c28e220af1e2994c13bd89804f4ebf Mon Sep 17 00:00:00 2001 From: Alex-larget <33240357+Alex-larget@users.noreply.github.com> Date: Thu, 26 Mar 2026 20:26:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=A6=96=E9=A1=B5=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BB=A5=E6=94=AF=E6=8C=81=E5=8A=A8=E6=80=81=E6=A0=87?= =?UTF-8?q?=E9=A2=98=E7=94=9F=E6=88=90=EF=BC=8C=E4=BC=98=E5=8C=96=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BD=93=E9=AA=8C=E3=80=82=E8=B0=83=E6=95=B4=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=90=8E=E5=8F=B0=E8=B5=84=E6=BA=90=E6=96=87=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E6=9B=BF=E6=8D=A2=E6=97=A7=E7=9A=84=20JavaScript=20?= =?UTF-8?q?=E5=92=8C=20CSS=20=E6=96=87=E4=BB=B6=EF=BC=8C=E6=8F=90=E5=8D=87?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=80=A7=E8=83=BD=E5=92=8C=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E4=B8=80=E8=87=B4=E6=80=A7=E3=80=82=E5=90=8C=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=95=B0=E6=8D=AE=E5=BA=93=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E4=BB=A5=E6=94=AF=E6=8C=81=E6=9B=B4=E7=BB=86=E7=B2=92=E5=BA=A6?= =?UTF-8?q?=E7=9A=84=E6=8E=A8=E9=80=81=E7=8A=B6=E6=80=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miniprogram/pages/index/index.js | 23 +- .../pages/member-detail/member-detail.js | 54 +- .../pages/mentor-detail/mentor-detail.js | 7 + .../pages/mentor-detail/mentor-detail.wxml | 4 + .../pages/mentor-detail/mentor-detail.wxss | 16 + miniprogram/pages/my/my.js | 10 + miniprogram/pages/my/my.wxml | 17 +- miniprogram/pages/my/my.wxss | 18 + .../pages/profile-edit/profile-edit.js | 15 + .../pages/profile-edit/profile-edit.wxml | 7 +- .../pages/profile-edit/profile-edit.wxss | 16 +- miniprogram/pages/read/read.js | 70 +- miniprogram/pages/read/read.wxml | 11 +- soul-admin/dist/assets/index-BHhAT-JW.css | 1 + soul-admin/dist/assets/index-CjWhuGfZ.css | 1 - soul-admin/dist/assets/index-DJrZIu_L.js | 1010 ----------------- soul-admin/dist/assets/index-i0PBc3Gp.js | 1010 +++++++++++++++++ soul-admin/dist/index.html | 4 +- soul-admin/src/layouts/AdminLayout.tsx | 15 +- .../src/pages/dashboard/DashboardPage.tsx | 4 +- .../pages/distribution/DistributionPage.tsx | 592 +--------- .../pages/find-partner/FindPartnerPage.tsx | 22 +- .../find-partner/tabs/CKBConfigPanel.tsx | 10 +- soul-admin/src/pages/mentors/MentorsPage.tsx | 40 +- .../src/pages/settings/SettingsPage.tsx | 13 + soul-admin/src/pages/users/UsersPage.tsx | 371 +++++- soul-api/internal/database/database.go | 37 +- soul-api/internal/handler/admin_dashboard.go | 5 +- soul-api/internal/handler/ckb.go | 239 +++- soul-api/internal/handler/db.go | 11 + soul-api/internal/handler/db_ckb_leads.go | 53 +- soul-api/internal/handler/mentor.go | 50 +- soul-api/internal/model/ckb_lead.go | 10 +- soul-api/internal/model/mentor.go | 2 + 34 files changed, 1994 insertions(+), 1774 deletions(-) create mode 100644 soul-admin/dist/assets/index-BHhAT-JW.css delete mode 100644 soul-admin/dist/assets/index-CjWhuGfZ.css delete mode 100644 soul-admin/dist/assets/index-DJrZIu_L.js create mode 100644 soul-admin/dist/assets/index-i0PBc3Gp.js diff --git a/miniprogram/pages/index/index.js b/miniprogram/pages/index/index.js index 02d8d3dd..ce0a1f45 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -321,8 +321,11 @@ Page({ _applyHomeMpUi() { const h = app.globalData.configCache?.mpConfig?.mpUi?.homePage || {} + const baseTitle = String(h.logoTitle || '卡若创业派对').trim() || '卡若创业派对' + const prefix = String(h.pinnedTitlePrefix != null ? h.pinnedTitlePrefix : '派对会员').trim() + const tpl = String(h.pinnedMainTitleTemplate || '').trim() const patch = { - mpUiLogoTitle: String(h.logoTitle || '卡若创业派对').trim() || '卡若创业派对', + mpUiLogoTitle: baseTitle, mpUiLogoSubtitle: String(h.logoSubtitle || '来自派对房的真实故事').trim() || '来自派对房的真实故事', mpUiSearchPlaceholder: String(h.searchPlaceholder || '搜索章节标题或内容...').trim() || '搜索章节标题或内容...', mpUiBannerTag: String(h.bannerTag || '推荐').trim() || '推荐', @@ -335,13 +338,29 @@ Page({ if (pinned && pinned.token) { const displayAv = pinned.avatar && isSafeImageSrc(pinned.avatar) ? pinned.avatar : DEFAULT_KARUO_LINK_AVATAR - patch.mpUiLinkKaruoText = `点击链接${pinned.name || '好友'}` + const nm = pinned.name || '好友' + patch.mpUiLinkKaruoText = `点击链接${nm}` patch.mpUiLinkKaruoDisplay = displayAv + let mainTitle = baseTitle + if (tpl) { + mainTitle = tpl + .replace(/\{\{name\}\}/g, nm) + .replace(/\{\{prefix\}\}/g, prefix) + .trim() || baseTitle + } else if (prefix) { + mainTitle = `${prefix} · ${nm}` + } else { + mainTitle = `@${nm}` + } + patch.mpUiLogoTitle = mainTitle } else { patch.mpUiLinkKaruoText = '' patch.mpUiLinkKaruoDisplay = DEFAULT_KARUO_LINK_AVATAR } this.setData(patch) + try { + wx.setNavigationBarTitle({ title: patch.mpUiLogoTitle || '首页' }) + } catch (_) {} }, /** 拉取后台置顶 @人物,合并到首页右上角「链接」区 */ diff --git a/miniprogram/pages/member-detail/member-detail.js b/miniprogram/pages/member-detail/member-detail.js index c0a61e63..3a36d40f 100644 --- a/miniprogram/pages/member-detail/member-detail.js +++ b/miniprogram/pages/member-detail/member-detail.js @@ -30,6 +30,28 @@ Page({ wx.navigateTo({ url: '/pages/profile-edit/profile-edit?full=1' }) }, + /** + * 未登录解锁前:先展示后台可配的「链接 vs 解锁」说明,用户确认后再弹出登录引导(mpUi.memberDetailPage) + */ + _showUnlockIntroThenLogin(afterConfirm) { + const mp = app.globalData.configCache?.mpConfig?.mpUi?.memberDetailPage || {} + const title = String(mp.unlockIntroTitle || '解锁与链接说明').trim() || '解锁与链接说明' + const body = String( + mp.unlockIntroBody || + '「链接」用于提交留资,由对方通过获客计划跟进;「解锁」用于复制手机/微信号后自行添加好友。\n\n请确认已了解后再登录。', + ).trim() + wx.showModal({ + title, + content: body, + confirmText: '我知道了', + cancelText: '取消', + success: (r) => { + if (!r.confirm) return + if (typeof afterConfirm === 'function') afterConfirm() + }, + }) + }, + async loadMember(id) { try { if (app.loadMbtiAvatarsMap) await app.loadMbtiAvatarsMap() @@ -377,14 +399,16 @@ Page({ if (field === 'wechat' && member.wechatUnlocked) return true if (field === 'contact' && member.contactUnlocked) return true if (!app.globalData.isLoggedIn) { - wx.showModal({ - title: '需要登录', - content: field === 'wechat' - ? '登录后可解锁并复制对方微信号,再按步骤去微信添加好友。' - : '登录后可解锁并复制对方手机号,便于添加好友或回拨。', - confirmText: '去登录', - cancelText: '取消', - success: (res) => { if (res.confirm) wx.switchTab({ url: '/pages/my/my' }) } + this._showUnlockIntroThenLogin(() => { + wx.showModal({ + title: '需要登录', + content: field === 'wechat' + ? '登录后可解锁并复制对方微信号,再按步骤去微信添加好友。' + : '登录后可解锁并复制对方手机号,便于添加好友或回拨。', + confirmText: '去登录', + cancelText: '取消', + success: (res) => { if (res.confirm) wx.switchTab({ url: '/pages/my/my' }) }, + }) }) return false } @@ -445,12 +469,14 @@ Page({ if (!member?.id || (field !== 'contact' && field !== 'wechat')) return const isLoggedIn = app.globalData.isLoggedIn if (!isLoggedIn) { - wx.showModal({ - title: '需要登录', - content: '请先登录后再解锁超级个体联系方式', - confirmText: '去登录', - cancelText: '取消', - success: (res) => { if (res.confirm) wx.switchTab({ url: '/pages/my/my' }) } + this._showUnlockIntroThenLogin(() => { + wx.showModal({ + title: '需要登录', + content: '请先登录后再解锁超级个体联系方式', + confirmText: '去登录', + cancelText: '取消', + success: (res) => { if (res.confirm) wx.switchTab({ url: '/pages/my/my' }) }, + }) }) return } diff --git a/miniprogram/pages/mentor-detail/mentor-detail.js b/miniprogram/pages/mentor-detail/mentor-detail.js index b0857f44..60f4924a 100644 --- a/miniprogram/pages/mentor-detail/mentor-detail.js +++ b/miniprogram/pages/mentor-detail/mentor-detail.js @@ -115,4 +115,11 @@ Page({ goBack() { getApp().goBackOrToHome() }, + + /** 与超级个体同款名片:后台为导师绑定 userId 后展示 */ + goMemberCard() { + const id = this.data.mentor && this.data.mentor.userId + if (!id) return + wx.navigateTo({ url: `/pages/member-detail/member-detail?id=${encodeURIComponent(String(id))}` }) + }, }) diff --git a/miniprogram/pages/mentor-detail/mentor-detail.wxml b/miniprogram/pages/mentor-detail/mentor-detail.wxml index fc635184..d7c67051 100644 --- a/miniprogram/pages/mentor-detail/mentor-detail.wxml +++ b/miniprogram/pages/mentor-detail/mentor-detail.wxml @@ -17,6 +17,10 @@ {{mentor.name}} {{mentor.intro}} {{mentor.quote}} + + 查看派对会员名片(与超级个体同页) + + diff --git a/miniprogram/pages/mentor-detail/mentor-detail.wxss b/miniprogram/pages/mentor-detail/mentor-detail.wxss index 9d373d22..8ea6da47 100644 --- a/miniprogram/pages/mentor-detail/mentor-detail.wxss +++ b/miniprogram/pages/mentor-detail/mentor-detail.wxss @@ -15,6 +15,22 @@ .mentor-intro { font-size: 28rpx; color: #4FD1C5; font-weight: 500; margin-bottom: 24rpx; } .mentor-quote { padding: 32rpx; background: #1E1E1E; border-left: 8rpx solid #4FD1C5; border-radius: 24rpx; font-size: 28rpx; color: #d4d4d8; text-align: left; width: 100%; max-width: 600rpx; box-sizing: border-box; } +.mentor-card-link { + margin-top: 24rpx; + padding: 20rpx 28rpx; + background: rgba(79, 209, 197, 0.08); + border: 1rpx solid rgba(79, 209, 197, 0.35); + border-radius: 16rpx; + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; + max-width: 600rpx; + box-sizing: border-box; +} +.mentor-card-link-text { font-size: 26rpx; color: #4FD1C5; flex: 1; padding-right: 16rpx; text-align: left; } +.mentor-card-link-arrow { flex-shrink: 0; } + .block { padding: 0 24rpx 64rpx; } .block-header { display: flex; align-items: center; margin-bottom: 24rpx; } .block-num { background: #4FD1C5; color: #000; font-size: 24rpx; font-weight: bold; padding: 8rpx 20rpx; border-radius: 999rpx; margin-right: 16rpx; } diff --git a/miniprogram/pages/my/my.js b/miniprogram/pages/my/my.js index 8c7f91b8..71f77ecb 100644 --- a/miniprogram/pages/my/my.js +++ b/miniprogram/pages/my/my.js @@ -614,6 +614,16 @@ Page({ wx.navigateTo({ url: '/pages/profile-edit/profile-edit' }) }, + /** 资料卡右侧齿轮:进入资料编辑(完整一页编辑,与分步向导区分) */ + goToProfileEdit() { + if (!this.data.isLoggedIn) { + this.showLogin() + return + } + trackClick('my', 'btn_click', '资料编辑') + wx.navigateTo({ url: '/pages/profile-edit/profile-edit?full=1&wizard=0' }) + }, + async onChooseAvatar(e) { const tempAvatarUrl = e.detail?.avatarUrl if (!tempAvatarUrl) return diff --git a/miniprogram/pages/my/my.wxml b/miniprogram/pages/my/my.wxml index 0004fba4..20eeefe6 100644 --- a/miniprogram/pages/my/my.wxml +++ b/miniprogram/pages/my/my.wxml @@ -28,13 +28,18 @@ VIP VIP - - - {{userInfo.nickname || '点击设置昵称'}} + + + + {{userInfo.nickname || '点击设置昵称'}} + + + {{mpUiCardLabel}} + {{isVip ? mpUiVipLabelVip : mpUiVipLabelGuest}} + - - {{mpUiCardLabel}} - {{isVip ? mpUiVipLabelVip : mpUiVipLabelGuest}} + + diff --git a/miniprogram/pages/my/my.wxss b/miniprogram/pages/my/my.wxss index b8dbdede..51f7dac1 100644 --- a/miniprogram/pages/my/my.wxss +++ b/miniprogram/pages/my/my.wxss @@ -72,7 +72,25 @@ padding: 4rpx 12rpx; border-radius: 8rpx; } .vip-badge-gray { background: rgba(255,255,255,0.2); color: rgba(255,255,255,0.5); } +/* 昵称区 + 右侧设置:齿轮与名片/会员按钮整体垂直居中 */ +.profile-meta-row { + flex: 1; + min-width: 0; + display: flex; + flex-direction: row; + align-items: center; + gap: 8rpx; +} .profile-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12rpx; } +.profile-settings-hit { + flex-shrink: 0; + padding: 12rpx 8rpx 12rpx 12rpx; + display: flex; + align-items: center; + justify-content: center; +} +.profile-settings-hit-active { opacity: 0.72; } +.profile-settings-icon { display: block; opacity: 0.92; } .profile-name-row { display: flex; align-items: center; justify-content: flex-start; gap: 16rpx; flex-wrap: wrap; } .user-name { font-size: 44rpx; font-weight: bold; color: #fff; diff --git a/miniprogram/pages/profile-edit/profile-edit.js b/miniprogram/pages/profile-edit/profile-edit.js index f9a0cccc..afedf1fb 100644 --- a/miniprogram/pages/profile-edit/profile-edit.js +++ b/miniprogram/pages/profile-edit/profile-edit.js @@ -127,6 +127,21 @@ Page({ goBack() { getApp().goBackOrToHome() }, + /** 分步向导时:齿轮 → 一页完整编辑(与「派对会员」资料同路径) */ + onOpenFullEdit() { + if (!this.data.wizardMode) return + wx.showModal({ + title: '切换到完整编辑', + content: '将在一页中展示全部资料项,便于一次性填写。当前分步进度不会丢失,可随时返回。', + confirmText: '进入完整编辑', + cancelText: '取消', + success: (r) => { + if (!r.confirm) return + wx.redirectTo({ url: '/pages/profile-edit/profile-edit?full=1&wizard=0' }) + }, + }) + }, + /** * 是否走三步向导:资料未「手机号+昵称」齐全且未标记完成,且非 full=1、非 VIP 开通页强制单页。 * 老用户已齐全则自动写 DONE,避免重复向导。 diff --git a/miniprogram/pages/profile-edit/profile-edit.wxml b/miniprogram/pages/profile-edit/profile-edit.wxml index 851cef9e..ee096c5b 100644 --- a/miniprogram/pages/profile-edit/profile-edit.wxml +++ b/miniprogram/pages/profile-edit/profile-edit.wxml @@ -3,7 +3,12 @@ {{wizardMode ? '分步档案(' + wizardStep + '/3)' : '编辑资料'}} - + + + + + + diff --git a/miniprogram/pages/profile-edit/profile-edit.wxss b/miniprogram/pages/profile-edit/profile-edit.wxss index 3813a4cf..fc8074a6 100644 --- a/miniprogram/pages/profile-edit/profile-edit.wxss +++ b/miniprogram/pages/profile-edit/profile-edit.wxss @@ -7,14 +7,22 @@ .nav-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 100; display: flex; align-items: center; justify-content: space-between; - height: 44px; padding: 0 24rpx; + height: 44px; padding: 0 16rpx 0 8rpx; background: rgba(5,11,20,0.9); backdrop-filter: blur(8rpx); border-bottom: 1rpx solid rgba(255,255,255,0.08); } -.nav-back { width: 60rpx; padding: 16rpx 0; } +.nav-back { width: 56rpx; padding: 16rpx 8rpx; flex-shrink: 0; } .back-icon { font-size: 44rpx; color: #5EEAD4; } -.nav-title { font-size: 36rpx; font-weight: 600; } -.nav-placeholder { width: 60rpx; } +.nav-title { + flex: 1; min-width: 0; font-size: 32rpx; font-weight: 600; + text-align: center; padding: 0 8rpx; + overflow: hidden; white-space: nowrap; text-overflow: ellipsis; +} +.nav-right { width: 56rpx; flex-shrink: 0; display: flex; align-items: center; justify-content: flex-end; } +.nav-right-spacer { width: 100%; height: 1px; } +.nav-gear { padding: 12rpx 8rpx; } +.nav-gear-hover { opacity: 0.75; } +.gear-icon { display: block; } .loading { padding: 96rpx; text-align: center; color: #94A3B8; } diff --git a/miniprogram/pages/read/read.js b/miniprogram/pages/read/read.js index c83f0527..4f9409b4 100644 --- a/miniprogram/pages/read/read.js +++ b/miniprogram/pages/read/read.js @@ -66,6 +66,42 @@ function normalizeMentionSegments(segments) { }) } +function normalizeLinkTagLabel(raw) { + return String(raw || '') + .replace(/^[##\s\u00a0\u200b\u3000]+/u, '') + .replace(/[\s\u00a0\u200b\u3000]+$/u, '') + .trim() + .toLowerCase() +} + +function resolveLinkTagByLabel(label) { + const normalized = normalizeLinkTagLabel(label) + if (!normalized) return null + const tags = Array.isArray(app.globalData.linkTagsConfig) ? app.globalData.linkTagsConfig : [] + for (const t of tags) { + if (!t) continue + const candidates = [t.label] + if (typeof t.aliases === 'string' && t.aliases.trim()) { + candidates.push(...t.aliases.split(',')) + } + for (const c of candidates) { + if (normalizeLinkTagLabel(c) === normalized) return t + } + } + return null +} + +function pickLinkTagField(tag, keys, defaultValue = '') { + if (!tag || typeof tag !== 'object') return defaultValue + for (const key of keys) { + const v = tag[key] + if (v == null) continue + const s = String(v).trim() + if (s) return s + } + return defaultValue +} + Page({ data: { // 系统信息 @@ -100,6 +136,11 @@ Page({ readingProgress: 0, /** 未解锁付费墙:合并 data.previewPercent(章节)与顶层 previewPercent(全局) */ previewPercent: 20, + /** mpUi.readPage.beforeLoginHint:未登录付费墙上方说明文案 */ + readBeforeLoginHint: '', + /** 朋友圈单页:标题与说明(mpUi.readPage.singlePageTitle / singlePagePaywallHint) */ + readSinglePageTitle: '解锁全文', + readSinglePageHint: '', showPaywall: false, // 上一篇/下一篇 @@ -209,7 +250,18 @@ Page({ const mp = (cfg && cfg.mpConfig) || {} const auditMode = !!mp.auditMode app.globalData.auditMode = auditMode - if (typeof this.setData === 'function') this.setData({ auditMode }) + const rp = (mp.mpUi && mp.mpUi.readPage) || {} + const readBeforeLoginHint = String(rp.beforeLoginHint || '').trim() + const readSinglePageTitle = String(rp.singlePageTitle || '解锁全文').trim() || '解锁全文' + const readSinglePageHint = String(rp.singlePagePaywallHint || '').trim() + if (typeof this.setData === 'function') { + this.setData({ + auditMode, + readBeforeLoginHint, + readSinglePageTitle, + readSinglePageHint, + }) + } } if (extras && Array.isArray(extras.linkTags)) { app.globalData.linkTagsConfig = extras.linkTags @@ -660,18 +712,18 @@ Page({ onLinkTagTap(e) { let url = (e.currentTarget.dataset.url || '').trim() const label = (e.currentTarget.dataset.label || '').trim() - let tagType = (e.currentTarget.dataset.tagType || '').trim() + let tagType = (e.currentTarget.dataset.tagType || '').trim().toLowerCase() let pagePath = (e.currentTarget.dataset.pagePath || '').trim() let mpKey = (e.currentTarget.dataset.mpKey || '').trim() // 旧格式()tagType 为空 → 按 label 从缓存 linkTags 补充类型信息 if (!tagType && label) { - const cached = (app.globalData.linkTagsConfig || []).find(t => t.label === label) + const cached = resolveLinkTagByLabel(label) if (cached) { - tagType = cached.type || 'url' - pagePath = cached.pagePath || '' - if (!url) url = cached.url || '' - if (cached.mpKey) mpKey = cached.mpKey + tagType = pickLinkTagField(cached, ['type', 'tagType'], 'url').toLowerCase() + pagePath = pickLinkTagField(cached, ['pagePath', 'page_path'], '') + if (!url) url = pickLinkTagField(cached, ['url', 'linkUrl', 'link_url'], '') + if (!mpKey) mpKey = pickLinkTagField(cached, ['mpKey', 'mp_key', 'appId', 'app_id'], '') } } @@ -685,8 +737,8 @@ Page({ // 小程序类型:用密钥查 linkedMiniprograms 得 appId,再唤醒(需在 app.json 的 navigateToMiniProgramAppIdList 中配置) if (tagType === 'miniprogram') { if (!mpKey && label) { - const cached = (app.globalData.linkTagsConfig || []).find(t => t.label === label) - if (cached) mpKey = cached.mpKey || '' + const cached = resolveLinkTagByLabel(label) + if (cached) mpKey = pickLinkTagField(cached, ['mpKey', 'mp_key', 'appId', 'app_id'], '') } const linked = (app.globalData.linkedMiniprograms || []).find(m => m.key === mpKey) if (linked && linked.appId) { diff --git a/miniprogram/pages/read/read.wxml b/miniprogram/pages/read/read.wxml index 2fcb929c..beff9bb8 100644 --- a/miniprogram/pages/read/read.wxml +++ b/miniprogram/pages/read/read.wxml @@ -127,7 +127,8 @@ - 解锁全文 + {{readSinglePageTitle}} + 试读 {{previewPercent}}%(与后台试读比例一致) 购买本章 @@ -135,11 +136,12 @@ 审核中,暂不支持购买 - 预览不可付款,请点底部「前往小程序」。 + {{readSinglePageHint || '预览不可付款,请点底部「前往小程序」。'}} 解锁完整内容 + {{readBeforeLoginHint}} 已阅读{{previewPercent}}%,登录并支付 ¥{{section && section.price != null ? section.price : sectionPrice}} 后阅读全文 @@ -199,7 +201,8 @@ - 解锁全文 + {{readSinglePageTitle}} + 试读 {{previewPercent}}%(与后台试读比例一致) 购买本章 @@ -207,7 +210,7 @@ 审核中,暂不支持购买 - 预览不可付款,请点底部「前往小程序」。 + {{readSinglePageHint || '预览不可付款,请点底部「前往小程序」。'}} diff --git a/soul-admin/dist/assets/index-BHhAT-JW.css b/soul-admin/dist/assets/index-BHhAT-JW.css new file mode 100644 index 00000000..967cd971 --- /dev/null +++ b/soul-admin/dist/assets/index-BHhAT-JW.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:450px;max-height:720px;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,.rich-editor-content .ProseMirror img,.rich-editor-content img.rich-editor-img-thumb{max-width:240px!important;max-height:140px!important;width:auto!important;height:auto!important;object-fit:contain;display:inline-block;vertical-align:middle;border-radius:6px;margin:.35em .25em .35em 0;border:1px dashed rgba(56,189,172,.45);background:#0f172a99;box-sizing:border-box}.rich-editor-content .rich-attachment-line{margin:.5em 0;padding:8px 12px;border-radius:8px;border:1px dashed rgba(125,211,252,.35);background:#0f172a8c;font-size:13px;line-height:1.5}.rich-editor-content .rich-attachment-badge{display:inline-block;font-size:10px;font-weight:600;letter-spacing:.02em;padding:2px 8px;border-radius:4px;background:#38bdac38;color:#38bdac;margin-right:8px;vertical-align:middle}.rich-editor-content .rich-attachment-link{color:#7dd3fc!important;font-weight:500;text-decoration:underline;word-break:break-all}.rich-editor-content .rich-video-wrap{display:block;margin:.5em 0;max-width:280px;border:1px dashed rgba(56,189,172,.45);border-radius:8px;overflow:hidden;background:#0f172acc}.rich-editor-content .rich-video-wrap video{display:block;width:100%;max-height:160px;object-fit:contain;vertical-align:middle}.rich-editor-content .rich-video-caption{font-size:11px;color:#6b7280;padding:4px 8px;border-top:1px solid #374151}.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{display:inline;background:#ffd7001f;color:gold;border-radius:4px;padding:1px 4px;font-weight:500;cursor:default;-webkit-user-select:all;user-select:all;white-space:nowrap}.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-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--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-red-800:oklch(44.4% .177 26.899);--color-red-900:oklch(39.6% .141 25.723);--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-950:oklch(27.9% .077 45.635);--color-yellow-300:oklch(90.5% .182 98.111);--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-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-cyan-200:oklch(91.7% .08 205.041);--color-cyan-300:oklch(86.5% .127 207.078);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-cyan-600:oklch(60.9% .126 221.723);--color-sky-200:oklch(90.1% .058 230.902);--color-sky-300:oklch(82.8% .111 230.318);--color-sky-500:oklch(68.5% .169 237.323);--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-blue-600:oklch(54.6% .245 262.881);--color-violet-300:oklch(81.1% .111 293.571);--color-violet-500:oklch(60.6% .25 292.717);--color-purple-300:oklch(82.7% .119 306.383);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-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-xl:36rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--container-6xl:72rem;--container-7xl:80rem;--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-wide:.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-snug:1.375;--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;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)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-2{top:calc(var(--spacing)*2)}.top-3{top:calc(var(--spacing)*3)}.top-4{top:calc(var(--spacing)*4)}.top-16{top:calc(var(--spacing)*16)}.top-\[50\%\]{top:50%}.top-full{top:100%}.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%}.bottom-2{bottom:calc(var(--spacing)*2)}.-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-\[-13px\]{left:-13px}.left-\[11px\]{left:11px}.left-\[50\%\]{left:50%}.isolate{isolation:isolate}.isolation-auto{isolation:auto}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.col-span-3{grid-column:span 3/span 3}.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-1{margin-inline:calc(var(--spacing)*1)}.mx-20{margin-inline:calc(var(--spacing)*20)}.mx-auto{margin-inline:auto}.-mt-6{margin-top:calc(var(--spacing)*-6)}.mt-0{margin-top:calc(var(--spacing)*0)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-1\.5{margin-top:calc(var(--spacing)*1.5)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mr-0\.5{margin-right:calc(var(--spacing)*.5)}.mr-1{margin-right:calc(var(--spacing)*1)}.mr-1\.5{margin-right:calc(var(--spacing)*1.5)}.mr-2{margin-right:calc(var(--spacing)*2)}.mr-3{margin-right:calc(var(--spacing)*3)}.mr-auto{margin-right:auto}.mb-0\.5{margin-bottom:calc(var(--spacing)*.5)}.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-3{margin-left:calc(var(--spacing)*3)}.ml-4{margin-left:calc(var(--spacing)*4)}.ml-6{margin-left:calc(var(--spacing)*6)}.ml-\[52px\]{margin-left:52px}.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-2\.5{height:calc(var(--spacing)*2.5)}.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-11{height:calc(var(--spacing)*11)}.h-12{height:calc(var(--spacing)*12)}.h-14{height:calc(var(--spacing)*14)}.h-16{height:calc(var(--spacing)*16)}.h-20{height:calc(var(--spacing)*20)}.h-24{height:calc(var(--spacing)*24)}.h-40{height:calc(var(--spacing)*40)}.h-96{height:calc(var(--spacing)*96)}.h-auto{height:auto}.h-full{height:100%}.h-screen{height:100vh}.max-h-48{max-height:calc(var(--spacing)*48)}.max-h-64{max-height:calc(var(--spacing)*64)}.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-\[92vh\]{max-height:92vh}.max-h-\[120px\]{max-height:120px}.max-h-\[160px\]{max-height:160px}.max-h-\[300px\]{max-height:300px}.max-h-\[400px\]{max-height:400px}.max-h-\[420px\]{max-height:420px}.max-h-\[450px\]{max-height:450px}.max-h-\[520px\]{max-height:520px}.max-h-\[min\(280px\,40vh\)\]{max-height:min(280px,40vh)}.max-h-none{max-height:none}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-8{min-height:calc(var(--spacing)*8)}.min-h-\[28px\]{min-height:28px}.min-h-\[40px\]{min-height:40px}.min-h-\[60px\]{min-height:60px}.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-\[280px\]{min-height:280px}.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-2\.5{width:calc(var(--spacing)*2.5)}.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-11{width:calc(var(--spacing)*11)}.w-12{width:calc(var(--spacing)*12)}.w-14{width:calc(var(--spacing)*14)}.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-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-\[5\.5rem\]{width:5.5rem}.w-\[72px\]{width:72px}.w-\[100px\]{width:100px}.w-\[280px\]{width:280px}.w-fit{width:fit-content}.w-full{width:100%}.w-screen{width:100vw}.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-6xl{max-width:var(--container-6xl)}.max-w-7xl{max-width:var(--container-7xl)}.max-w-\[72px\]{max-width:72px}.max-w-\[96px\]{max-width:96px}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[140px\]{max-width:140px}.max-w-\[160px\]{max-width:160px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[220px\]{max-width:220px}.max-w-\[260px\]{max-width:260px}.max-w-\[420px\]{max-width:420px}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.max-w-\[min\(100\%\,20rem\)\]{max-width:min(100%,20rem)}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-none{max-width:none}.max-w-sm{max-width:var(--container-sm)}.max-w-xl{max-width:var(--container-xl)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-40{min-width:calc(var(--spacing)*40)}.min-w-\[8rem\]{min-width:8rem}.min-w-\[60px\]{min-width:60px}.min-w-\[120px\]{min-width:120px}.min-w-\[148px\]{min-width:148px}.min-w-\[200px\]{min-width:200px}.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-0{--tw-translate-x:calc(var(--spacing)*0);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-y-0{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-none{translate:none}.scale-90{--tw-scale-x:90%;--tw-scale-y:90%;--tw-scale-z:90%;scale:var(--tw-scale-x)var(--tw-scale-y)}.scale-110{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x)var(--tw-scale-y)}.scale-3d{scale:var(--tw-scale-x)var(--tw-scale-y)var(--tw-scale-z)}.scale-\[0\.98\]{scale:.98}.rotate-90{rotate:90deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-pan-y{--tw-pan-y:pan-y;touch-action:var(--tw-pan-x,)var(--tw-pan-y,)var(--tw-pinch-zoom,)}.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}.list-none{list-style-type:none}.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-5{grid-template-columns:repeat(5,minmax(0,1fr))}.grid-cols-\[40px_1fr_90px_90px_70px_60px_110px\]{grid-template-columns:40px 1fr 90px 90px 70px 60px 110px}.grid-cols-\[40px_40px_1fr_80px_80px_80px_60px\]{grid-template-columns:40px 40px 1fr 80px 80px 80px 60px}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.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-2\.5{gap:calc(var(--spacing)*2.5)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-6{gap:calc(var(--spacing)*6)}.gap-8{gap:calc(var(--spacing)*8)}:where(.space-y-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-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*.5)*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-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overscroll-y-contain{overscroll-behavior-y:contain}.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-none{border-radius:0}.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-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-\[\#0f2137\]{border-color:#0f2137}.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\]\/25{border-color:#38bdac40}.border-\[\#38bdac\]\/30{border-color:#38bdac4d}.border-\[\#38bdac\]\/35{border-color:#38bdac59}.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\/25{border-color:#f99c0040}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/25{border-color:color-mix(in oklab,var(--color-amber-500)25%,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-amber-600\/60{border-color:#dd740099}@supports (color:color-mix(in lab,red,red)){.border-amber-600\/60{border-color:color-mix(in oklab,var(--color-amber-600)60%,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\/20{border-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/20{border-color:color-mix(in oklab,var(--color-cyan-500)20%,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-cyan-600\/60{border-color:#0092b599}@supports (color:color-mix(in lab,red,red)){.border-cyan-600\/60{border-color:color-mix(in oklab,var(--color-cyan-600)60%,transparent)}}.border-emerald-500\/30{border-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/30{border-color:color-mix(in oklab,var(--color-emerald-500)30%,transparent)}}.border-emerald-500\/50{border-color:#00bb7f80}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/50{border-color:color-mix(in oklab,var(--color-emerald-500)50%,transparent)}}.border-gray-500{border-color:var(--color-gray-500)}.border-gray-600{border-color:var(--color-gray-600)}.border-gray-600\/50{border-color:#4a556580}@supports (color:color-mix(in lab,red,red)){.border-gray-600\/50{border-color:color-mix(in oklab,var(--color-gray-600)50%,transparent)}}.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\/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-purple-500\/50{border-color:#ac4bff80}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/50{border-color:color-mix(in oklab,var(--color-purple-500)50%,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\/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-red-600\/40{border-color:#e4001466}@supports (color:color-mix(in lab,red,red)){.border-red-600\/40{border-color:color-mix(in oklab,var(--color-red-600)40%,transparent)}}.border-red-600\/50{border-color:#e4001480}@supports (color:color-mix(in lab,red,red)){.border-red-600\/50{border-color:color-mix(in oklab,var(--color-red-600)50%,transparent)}}.border-red-600\/60{border-color:#e4001499}@supports (color:color-mix(in lab,red,red)){.border-red-600\/60{border-color:color-mix(in oklab,var(--color-red-600)60%,transparent)}}.border-red-600\/70{border-color:#e40014b3}@supports (color:color-mix(in lab,red,red)){.border-red-600\/70{border-color:color-mix(in oklab,var(--color-red-600)70%,transparent)}}.border-red-900\/60{border-color:#82181a99}@supports (color:color-mix(in lab,red,red)){.border-red-900\/60{border-color:color-mix(in oklab,var(--color-red-900)60%,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\/35{border-color:#edb20059}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/35{border-color:color-mix(in oklab,var(--color-yellow-500)35%,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\]\/30{background-color:#0a16284d}.bg-\[\#0a1628\]\/40{background-color:#0a162866}.bg-\[\#0a1628\]\/50{background-color:#0a162880}.bg-\[\#0a1628\]\/60{background-color:#0a162899}.bg-\[\#0b1828\]{background-color:#0b1828}.bg-\[\#0f2137\]{background-color:#0f2137}.bg-\[\#0f2137\]\/90{background-color:#0f2137e6}.bg-\[\#00CED1\]{background-color:#00ced1}.bg-\[\#1C1C1E\]{background-color:#1c1c1e}.bg-\[\#3a1010\]\/35{background-color:#3a101059}.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\]\/80{background-color:#38bdaccc}.bg-\[\#050c18\]{background-color:#050c18}.bg-\[\#081322\]{background-color:#081322}.bg-\[\#162840\]{background-color:#162840}.bg-\[\#162840\]\/80{background-color:#162840cc}.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-amber-950\/25{background-color:#46190140}@supports (color:color-mix(in lab,red,red)){.bg-amber-950\/25{background-color:color-mix(in oklab,var(--color-amber-950)25%,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{background-color:var(--color-blue-500)}.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\/15{background-color:#00b7d726}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/15{background-color:color-mix(in oklab,var(--color-cyan-500)15%,transparent)}}.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\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/10{background-color:color-mix(in oklab,var(--color-emerald-500)10%,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-emerald-600{background-color:var(--color-emerald-600)}.bg-gray-500{background-color:var(--color-gray-500)}.bg-gray-500\/10{background-color:#6a72821a}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\/10{background-color:color-mix(in oklab,var(--color-gray-500)10%,transparent)}}.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-gray-800{background-color:var(--color-gray-800)}.bg-green-400\/10{background-color:#05df721a}@supports (color:color-mix(in lab,red,red)){.bg-green-400\/10{background-color:color-mix(in oklab,var(--color-green-400)10%,transparent)}}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\/20{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/20{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.bg-green-600{background-color:var(--color-green-600)}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-500\/10{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/10{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.bg-purple-500\/10{background-color:#ac4bff1a}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/10{background-color:color-mix(in oklab,var(--color-purple-500)10%,transparent)}}.bg-purple-500\/15{background-color:#ac4bff26}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/15{background-color:color-mix(in oklab,var(--color-purple-500)15%,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\/15{background-color:#fb2c3626}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/15{background-color:color-mix(in oklab,var(--color-red-500)15%,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-red-900\/80{background-color:#82181acc}@supports (color:color-mix(in lab,red,red)){.bg-red-900\/80{background-color:color-mix(in oklab,var(--color-red-900)80%,transparent)}}.bg-sky-500\/20{background-color:#00a5ef33}@supports (color:color-mix(in lab,red,red)){.bg-sky-500\/20{background-color:color-mix(in oklab,var(--color-sky-500)20%,transparent)}}.bg-transparent{background-color:#0000}.bg-violet-500\/20{background-color:#8d54ff33}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/20{background-color:color-mix(in oklab,var(--color-violet-500)20%,transparent)}}.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{background-color:var(--color-yellow-500)}.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-linear-to-br{--tw-gradient-position:to bottom right}@supports (background-image:linear-gradient(in lab,red,red)){.bg-linear-to-br{--tw-gradient-position:to bottom right in oklab}}.bg-linear-to-br{background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-\[\#00CED1\]{--tw-gradient-from:#00ced1;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#38bdac\]\/10{--tw-gradient-from:oklab(72.378% -.11483 -.0053193/.1);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#38bdac\]\/50{--tw-gradient-from:oklab(72.378% -.11483 -.0053193/.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))}.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-\[\#38bdac\]{--tw-gradient-to:#38bdac;--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-0\.5{padding:calc(var(--spacing)*.5)}.p-1{padding:calc(var(--spacing)*1)}.p-1\.5{padding:calc(var(--spacing)*1.5)}.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-0\.5{padding-inline:calc(var(--spacing)*.5)}.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-2\.5{padding-inline:calc(var(--spacing)*2.5)}.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{padding-block:calc(var(--spacing)*0)}.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-14{padding-block:calc(var(--spacing)*14)}.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-1\.5{padding-top:calc(var(--spacing)*1.5)}.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-0\.5{padding-right:calc(var(--spacing)*.5)}.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-0\.5{padding-bottom:calc(var(--spacing)*.5)}.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-1{padding-left:calc(var(--spacing)*1)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-4{padding-left:calc(var(--spacing)*4)}.pl-6{padding-left:calc(var(--spacing)*6)}.pl-8{padding-left:calc(var(--spacing)*8)}.pl-9{padding-left:calc(var(--spacing)*9)}.pl-10{padding-left:calc(var(--spacing)*10)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-bottom{vertical-align:bottom}.align-middle{vertical-align:middle}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Microsoft YaHei,sans-serif}.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-\[9px\]{font-size:9px}.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-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.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-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.text-wrap{text-wrap:wrap}.break-words,.wrap-break-word{overflow-wrap:break-word}.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\]\/20{color:#38bdac33}.text-\[\#38bdac\]\/30{color:#38bdac4d}.text-\[\#38bdac\]\/40{color:#38bdac66}.text-\[\#38bdac\]\/90{color:#38bdace6}.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-200\/90{color:#fee685e6}@supports (color:color-mix(in lab,red,red)){.text-amber-200\/90{color:color-mix(in oklab,var(--color-amber-200)90%,transparent)}}.text-amber-300{color:var(--color-amber-300)}.text-amber-300\/80{color:#ffd236cc}@supports (color:color-mix(in lab,red,red)){.text-amber-300\/80{color:color-mix(in oklab,var(--color-amber-300)80%,transparent)}}.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\/80{color:#fcbb00cc}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/80{color:color-mix(in oklab,var(--color-amber-400)80%,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-amber-500\/80{color:#f99c00cc}@supports (color:color-mix(in lab,red,red)){.text-amber-500\/80{color:color-mix(in oklab,var(--color-amber-500)80%,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-300\/80{color:#90c5ffcc}@supports (color:color-mix(in lab,red,red)){.text-blue-300\/80{color:color-mix(in oklab,var(--color-blue-300)80%,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-200{color:var(--color-cyan-200)}.text-cyan-300{color:var(--color-cyan-300)}.text-cyan-300\/90{color:#53eafde6}@supports (color:color-mix(in lab,red,red)){.text-cyan-300\/90{color:color-mix(in oklab,var(--color-cyan-300)90%,transparent)}}.text-cyan-400{color:var(--color-cyan-400)}.text-emerald-300{color:var(--color-emerald-300)}.text-emerald-400{color:var(--color-emerald-400)}.text-emerald-400\/90{color:#00d294e6}@supports (color:color-mix(in lab,red,red)){.text-emerald-400\/90{color:color-mix(in oklab,var(--color-emerald-400)90%,transparent)}}.text-gray-200{color:var(--color-gray-200)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-green-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\/25{color:#ff8b1a40}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/25{color:color-mix(in oklab,var(--color-orange-400)25%,transparent)}}.text-orange-400\/60{color:#ff8b1a99}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/60{color:color-mix(in oklab,var(--color-orange-400)60%,transparent)}}.text-orange-400\/70{color:#ff8b1ab3}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/70{color:color-mix(in oklab,var(--color-orange-400)70%,transparent)}}.text-orange-400\/80{color:#ff8b1acc}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/80{color:color-mix(in oklab,var(--color-orange-400)80%,transparent)}}.text-purple-300{color:var(--color-purple-300)}.text-purple-300\/90{color:#d9b3ffe6}@supports (color:color-mix(in lab,red,red)){.text-purple-300\/90{color:color-mix(in oklab,var(--color-purple-300)90%,transparent)}}.text-purple-400{color:var(--color-purple-400)}.text-red-100{color:var(--color-red-100)}.text-red-200{color:var(--color-red-200)}.text-red-300{color:var(--color-red-300)}.text-red-300\/70{color:#ffa3a3b3}@supports (color:color-mix(in lab,red,red)){.text-red-300\/70{color:color-mix(in oklab,var(--color-red-300)70%,transparent)}}.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-sky-300\/90{color:#77d4ffe6}@supports (color:color-mix(in lab,red,red)){.text-sky-300\/90{color:color-mix(in oklab,var(--color-sky-300)90%,transparent)}}.text-violet-300{color:var(--color-violet-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-300{color:var(--color-yellow-300)}.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)}}.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}.decoration-dotted{text-decoration-style:dotted}.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\]\/35{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.35)}.ring-\[\#38bdac\]\/40{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.4)}.ring-\[\#38bdac\]\/50{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.5)}.ring-transparent{--tw-ring-color:transparent}.ring-offset-2{--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)}.ring-offset-\[\#0a1628\]{--tw-ring-offset-color:#0a1628}.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}.\[overflow-anchor\:none\]{overflow-anchor:none}:where(.divide-x-reverse>:not(:last-child)){--tw-divide-x-reverse:1}.ring-inset{--tw-ring-inset:inset}.group-open\:text-\[\#38bdac\]:is(:where(.group):is([open],:popover-open,:open) *){color:#38bdac}@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\]\/35:hover{border-color:#38bdac59}.hover\:border-\[\#38bdac\]\/40:hover{border-color:#38bdac66}.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\:bg-\[\#0a1628\]:hover{background-color:#0a1628}.hover\:bg-\[\#0a1628\]\/80:hover{background-color:#0a1628cc}.hover\:bg-\[\#1a3050\]:hover{background-color:#1a3050}.hover\:bg-\[\#2aa896\]:hover{background-color:#2aa896}.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-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-blue-600:hover{background-color:var(--color-blue-600)}.hover\:bg-cyan-500\/10:hover{background-color:#00b7d71a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-cyan-500\/10:hover{background-color:color-mix(in oklab,var(--color-cyan-500)10%,transparent)}}.hover\:bg-emerald-500:hover{background-color:var(--color-emerald-500)}.hover\:bg-emerald-500\/15:hover{background-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.hover\:bg-emerald-500\/15:hover{background-color:color-mix(in oklab,var(--color-emerald-500)15%,transparent)}}.hover\:bg-emerald-500\/20:hover{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-emerald-500\/20:hover{background-color:color-mix(in oklab,var(--color-emerald-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\/40:hover{background-color:#36415366}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-700\/40:hover{background-color:color-mix(in oklab,var(--color-gray-700)40%,transparent)}}.hover\:bg-gray-700\/50:hover{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-700\/50:hover{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.hover\:bg-gray-800:hover{background-color:var(--color-gray-800)}.hover\:bg-green-500\/20:hover{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.hover\:bg-green-500\/20:hover{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.hover\:bg-green-700:hover{background-color:var(--color-green-700)}.hover\:bg-orange-500\/10:hover{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/10:hover{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.hover\:bg-orange-500\/20:hover{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/20:hover{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.hover\:bg-orange-600:hover{background-color:var(--color-orange-600)}.hover\:bg-purple-500\/10:hover{background-color:#ac4bff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/10:hover{background-color:color-mix(in oklab,var(--color-purple-500)10%,transparent)}}.hover\:bg-purple-500\/20:hover{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/20:hover{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.hover\:bg-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-red-800\/50:hover{background-color:#9f071280}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-800\/50:hover{background-color:color-mix(in oklab,var(--color-red-800)50%,transparent)}}.hover\:bg-white\/5:hover{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/5:hover{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.hover\:bg-white\/10:hover{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/10:hover{background-color:color-mix(in oklab,var(--color-white)10%,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-\[\#5ee0d1\]:hover{color:#5ee0d1}.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-amber-400\/90:hover{color:#fcbb00e6}@supports (color:color-mix(in lab,red,red)){.hover\:text-amber-400\/90:hover{color:color-mix(in oklab,var(--color-amber-400)90%,transparent)}}.hover\:text-blue-300:hover{color:var(--color-blue-300)}.hover\:text-blue-400:hover{color:var(--color-blue-400)}.hover\:text-gray-200:hover{color:var(--color-gray-200)}.hover\:text-gray-300:hover{color:var(--color-gray-300)}.hover\:text-gray-400:hover{color:var(--color-gray-400)}.hover\:text-green-300:hover{color:var(--color-green-300)}.hover\:text-green-400:hover{color:var(--color-green-400)}.hover\:text-orange-300:hover{color:var(--color-orange-300)}.hover\:text-orange-400:hover{color:var(--color-orange-400)}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:text-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-80:hover{opacity:.8}.hover\:opacity-100:hover{opacity:1}.hover\:ring-\[\#38bdac\]\/60:hover{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.6)}}.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-\[\#38bdac\]\/50:focus-visible{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.5)}.focus-visible\:ring-amber-600\/50:focus-visible{--tw-ring-color:#dd740080}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-amber-600\/50:focus-visible{--tw-ring-color:color-mix(in oklab,var(--color-amber-600)50%,transparent)}}.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\:col-span-2{grid-column:span 2/span 2}.sm\:w-\[220px\]{width:220px}.sm\:max-w-\[600px\]{max-width:600px}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:gap-2{gap:calc(var(--spacing)*2)}.sm\:p-4{padding:calc(var(--spacing)*4)}.sm\:p-5{padding:calc(var(--spacing)*5)}.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-6{grid-template-columns:repeat(6,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))}.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-6{grid-template-columns:repeat(6,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)}}@keyframes pulse{50%{opacity:.5}} diff --git a/soul-admin/dist/assets/index-CjWhuGfZ.css b/soul-admin/dist/assets/index-CjWhuGfZ.css deleted file mode 100644 index 42ed59cc..00000000 --- a/soul-admin/dist/assets/index-CjWhuGfZ.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:450px;max-height:720px;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,.rich-editor-content .ProseMirror img,.rich-editor-content img.rich-editor-img-thumb{max-width:240px!important;max-height:140px!important;width:auto!important;height:auto!important;object-fit:contain;display:inline-block;vertical-align:middle;border-radius:6px;margin:.35em .25em .35em 0;border:1px dashed rgba(56,189,172,.45);background:#0f172a99;box-sizing:border-box}.rich-editor-content .rich-attachment-line{margin:.5em 0;padding:8px 12px;border-radius:8px;border:1px dashed rgba(125,211,252,.35);background:#0f172a8c;font-size:13px;line-height:1.5}.rich-editor-content .rich-attachment-badge{display:inline-block;font-size:10px;font-weight:600;letter-spacing:.02em;padding:2px 8px;border-radius:4px;background:#38bdac38;color:#38bdac;margin-right:8px;vertical-align:middle}.rich-editor-content .rich-attachment-link{color:#7dd3fc!important;font-weight:500;text-decoration:underline;word-break:break-all}.rich-editor-content .rich-video-wrap{display:block;margin:.5em 0;max-width:280px;border:1px dashed rgba(56,189,172,.45);border-radius:8px;overflow:hidden;background:#0f172acc}.rich-editor-content .rich-video-wrap video{display:block;width:100%;max-height:160px;object-fit:contain;vertical-align:middle}.rich-editor-content .rich-video-caption{font-size:11px;color:#6b7280;padding:4px 8px;border-top:1px solid #374151}.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{display:inline;background:#ffd7001f;color:gold;border-radius:4px;padding:1px 4px;font-weight:500;cursor:default;-webkit-user-select:all;user-select:all;white-space:nowrap}.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-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--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-red-800:oklch(44.4% .177 26.899);--color-red-900:oklch(39.6% .141 25.723);--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-950:oklch(27.9% .077 45.635);--color-yellow-300:oklch(90.5% .182 98.111);--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-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-cyan-200:oklch(91.7% .08 205.041);--color-cyan-300:oklch(86.5% .127 207.078);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-cyan-600:oklch(60.9% .126 221.723);--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-blue-600:oklch(54.6% .245 262.881);--color-purple-300:oklch(82.7% .119 306.383);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-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-xl:36rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--container-6xl:72rem;--container-7xl:80rem;--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-wide:.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-snug:1.375;--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;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)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-2{top:calc(var(--spacing)*2)}.top-3{top:calc(var(--spacing)*3)}.top-4{top:calc(var(--spacing)*4)}.top-16{top:calc(var(--spacing)*16)}.top-\[50\%\]{top:50%}.top-full{top:100%}.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%}.bottom-2{bottom:calc(var(--spacing)*2)}.-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-\[-13px\]{left:-13px}.left-\[11px\]{left:11px}.left-\[50\%\]{left:50%}.isolate{isolation:isolate}.isolation-auto{isolation:auto}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.col-span-3{grid-column:span 3/span 3}.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-1{margin-inline:calc(var(--spacing)*1)}.mx-20{margin-inline:calc(var(--spacing)*20)}.mx-auto{margin-inline:auto}.-mt-6{margin-top:calc(var(--spacing)*-6)}.mt-0{margin-top:calc(var(--spacing)*0)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-1\.5{margin-top:calc(var(--spacing)*1.5)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mr-0\.5{margin-right:calc(var(--spacing)*.5)}.mr-1{margin-right:calc(var(--spacing)*1)}.mr-1\.5{margin-right:calc(var(--spacing)*1.5)}.mr-2{margin-right:calc(var(--spacing)*2)}.mr-3{margin-right:calc(var(--spacing)*3)}.mr-auto{margin-right:auto}.mb-0\.5{margin-bottom:calc(var(--spacing)*.5)}.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-3{margin-left:calc(var(--spacing)*3)}.ml-4{margin-left:calc(var(--spacing)*4)}.ml-6{margin-left:calc(var(--spacing)*6)}.ml-\[52px\]{margin-left:52px}.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-2\.5{height:calc(var(--spacing)*2.5)}.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-11{height:calc(var(--spacing)*11)}.h-12{height:calc(var(--spacing)*12)}.h-14{height:calc(var(--spacing)*14)}.h-16{height:calc(var(--spacing)*16)}.h-20{height:calc(var(--spacing)*20)}.h-24{height:calc(var(--spacing)*24)}.h-40{height:calc(var(--spacing)*40)}.h-96{height:calc(var(--spacing)*96)}.h-auto{height:auto}.h-full{height:100%}.h-screen{height:100vh}.max-h-48{max-height:calc(var(--spacing)*48)}.max-h-64{max-height:calc(var(--spacing)*64)}.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-\[92vh\]{max-height:92vh}.max-h-\[120px\]{max-height:120px}.max-h-\[160px\]{max-height:160px}.max-h-\[300px\]{max-height:300px}.max-h-\[400px\]{max-height:400px}.max-h-\[420px\]{max-height:420px}.max-h-\[450px\]{max-height:450px}.max-h-\[min\(280px\,40vh\)\]{max-height:min(280px,40vh)}.max-h-none{max-height:none}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-8{min-height:calc(var(--spacing)*8)}.min-h-\[28px\]{min-height:28px}.min-h-\[40px\]{min-height:40px}.min-h-\[60px\]{min-height:60px}.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-\[200px\]{min-height:200px}.min-h-\[260px\]{min-height:260px}.min-h-\[280px\]{min-height:280px}.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-2\.5{width:calc(var(--spacing)*2.5)}.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-11{width:calc(var(--spacing)*11)}.w-12{width:calc(var(--spacing)*12)}.w-14{width:calc(var(--spacing)*14)}.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-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-\[72px\]{width:72px}.w-\[100px\]{width:100px}.w-\[280px\]{width:280px}.w-fit{width:fit-content}.w-full{width:100%}.w-screen{width:100vw}.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-6xl{max-width:var(--container-6xl)}.max-w-7xl{max-width:var(--container-7xl)}.max-w-\[8rem\]{max-width:8rem}.max-w-\[14rem\]{max-width:14rem}.max-w-\[72px\]{max-width:72px}.max-w-\[96px\]{max-width:96px}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[140px\]{max-width:140px}.max-w-\[160px\]{max-width:160px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[220px\]{max-width:220px}.max-w-\[420px\]{max-width:420px}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.max-w-\[min\(100\%\,20rem\)\]{max-width:min(100%,20rem)}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-none{max-width:none}.max-w-sm{max-width:var(--container-sm)}.max-w-xl{max-width:var(--container-xl)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-40{min-width:calc(var(--spacing)*40)}.min-w-\[8rem\]{min-width:8rem}.min-w-\[10rem\]{min-width:10rem}.min-w-\[60px\]{min-width:60px}.min-w-\[120px\]{min-width:120px}.min-w-\[200px\]{min-width:200px}.min-w-\[220px\]{min-width:220px}.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-0{--tw-translate-x:calc(var(--spacing)*0);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-y-0{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-none{translate:none}.scale-90{--tw-scale-x:90%;--tw-scale-y:90%;--tw-scale-z:90%;scale:var(--tw-scale-x)var(--tw-scale-y)}.scale-110{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x)var(--tw-scale-y)}.scale-3d{scale:var(--tw-scale-x)var(--tw-scale-y)var(--tw-scale-z)}.scale-\[0\.98\]{scale:.98}.rotate-90{rotate:90deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-pan-y{--tw-pan-y:pan-y;touch-action:var(--tw-pan-x,)var(--tw-pan-y,)var(--tw-pinch-zoom,)}.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}.list-none{list-style-type:none}.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-5{grid-template-columns:repeat(5,minmax(0,1fr))}.grid-cols-\[40px_1fr_90px_90px_70px_60px_110px\]{grid-template-columns:40px 1fr 90px 90px 70px 60px 110px}.grid-cols-\[40px_40px_1fr_80px_80px_80px_60px\]{grid-template-columns:40px 40px 1fr 80px 80px 80px 60px}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-nowrap{flex-wrap:nowrap}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.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-2\.5{gap:calc(var(--spacing)*2.5)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-6{gap:calc(var(--spacing)*6)}.gap-8{gap:calc(var(--spacing)*8)}:where(.space-y-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-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*.5)*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-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overscroll-y-contain{overscroll-behavior-y:contain}.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-none{border-radius:0}.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-b-lg{border-bottom-right-radius:var(--radius-lg);border-bottom-left-radius:var(--radius-lg)}.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-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-\[\#0f2137\]{border-color:#0f2137}.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\]\/25{border-color:#38bdac40}.border-\[\#38bdac\]\/30{border-color:#38bdac4d}.border-\[\#38bdac\]\/35{border-color:#38bdac59}.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\/25{border-color:#f99c0040}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/25{border-color:color-mix(in oklab,var(--color-amber-500)25%,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-amber-600\/60{border-color:#dd740099}@supports (color:color-mix(in lab,red,red)){.border-amber-600\/60{border-color:color-mix(in oklab,var(--color-amber-600)60%,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\/20{border-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/20{border-color:color-mix(in oklab,var(--color-cyan-500)20%,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-cyan-600\/60{border-color:#0092b599}@supports (color:color-mix(in lab,red,red)){.border-cyan-600\/60{border-color:color-mix(in oklab,var(--color-cyan-600)60%,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\/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-purple-500\/50{border-color:#ac4bff80}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/50{border-color:color-mix(in oklab,var(--color-purple-500)50%,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\/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-red-600\/40{border-color:#e4001466}@supports (color:color-mix(in lab,red,red)){.border-red-600\/40{border-color:color-mix(in oklab,var(--color-red-600)40%,transparent)}}.border-red-600\/50{border-color:#e4001480}@supports (color:color-mix(in lab,red,red)){.border-red-600\/50{border-color:color-mix(in oklab,var(--color-red-600)50%,transparent)}}.border-red-600\/60{border-color:#e4001499}@supports (color:color-mix(in lab,red,red)){.border-red-600\/60{border-color:color-mix(in oklab,var(--color-red-600)60%,transparent)}}.border-red-600\/70{border-color:#e40014b3}@supports (color:color-mix(in lab,red,red)){.border-red-600\/70{border-color:color-mix(in oklab,var(--color-red-600)70%,transparent)}}.border-red-900\/60{border-color:#82181a99}@supports (color:color-mix(in lab,red,red)){.border-red-900\/60{border-color:color-mix(in oklab,var(--color-red-900)60%,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\/35{border-color:#edb20059}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/35{border-color:color-mix(in oklab,var(--color-yellow-500)35%,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\]\/30{background-color:#0a16284d}.bg-\[\#0a1628\]\/40{background-color:#0a162866}.bg-\[\#0a1628\]\/50{background-color:#0a162880}.bg-\[\#0a1628\]\/60{background-color:#0a162899}.bg-\[\#0a1628\]\/80{background-color:#0a1628cc}.bg-\[\#0b1828\]{background-color:#0b1828}.bg-\[\#0f2137\]{background-color:#0f2137}.bg-\[\#0f2137\]\/85{background-color:#0f2137d9}.bg-\[\#0f2137\]\/90{background-color:#0f2137e6}.bg-\[\#00CED1\]{background-color:#00ced1}.bg-\[\#1C1C1E\]{background-color:#1c1c1e}.bg-\[\#3a1010\]\/35{background-color:#3a101059}.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-\[\#081322\]{background-color:#081322}.bg-\[\#162840\]{background-color:#162840}.bg-\[\#162840\]\/80{background-color:#162840cc}.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-amber-950\/25{background-color:#46190140}@supports (color:color-mix(in lab,red,red)){.bg-amber-950\/25{background-color:color-mix(in oklab,var(--color-amber-950)25%,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{background-color:var(--color-blue-500)}.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\/15{background-color:#00b7d726}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/15{background-color:color-mix(in oklab,var(--color-cyan-500)15%,transparent)}}.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-emerald-600{background-color:var(--color-emerald-600)}.bg-gray-500{background-color:var(--color-gray-500)}.bg-gray-500\/10{background-color:#6a72821a}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\/10{background-color:color-mix(in oklab,var(--color-gray-500)10%,transparent)}}.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-gray-800{background-color:var(--color-gray-800)}.bg-green-400\/10{background-color:#05df721a}@supports (color:color-mix(in lab,red,red)){.bg-green-400\/10{background-color:color-mix(in oklab,var(--color-green-400)10%,transparent)}}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\/20{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/20{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.bg-green-600{background-color:var(--color-green-600)}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-500\/10{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/10{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.bg-purple-500\/10{background-color:#ac4bff1a}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/10{background-color:color-mix(in oklab,var(--color-purple-500)10%,transparent)}}.bg-purple-500\/15{background-color:#ac4bff26}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/15{background-color:color-mix(in oklab,var(--color-purple-500)15%,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\/15{background-color:#fb2c3626}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/15{background-color:color-mix(in oklab,var(--color-red-500)15%,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-red-900\/80{background-color:#82181acc}@supports (color:color-mix(in lab,red,red)){.bg-red-900\/80{background-color:color-mix(in oklab,var(--color-red-900)80%,transparent)}}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.bg-white\/5{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.bg-white\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.bg-white\/20{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.bg-yellow-500{background-color:var(--color-yellow-500)}.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-linear-to-br{--tw-gradient-position:to bottom right}@supports (background-image:linear-gradient(in lab,red,red)){.bg-linear-to-br{--tw-gradient-position:to bottom right in oklab}}.bg-linear-to-br{background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-\[\#00CED1\]{--tw-gradient-from:#00ced1;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#38bdac\]\/10{--tw-gradient-from:oklab(72.378% -.11483 -.0053193/.1);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.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-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-0\.5{padding:calc(var(--spacing)*.5)}.p-1{padding:calc(var(--spacing)*1)}.p-1\.5{padding:calc(var(--spacing)*1.5)}.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-0\.5{padding-inline:calc(var(--spacing)*.5)}.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-2\.5{padding-inline:calc(var(--spacing)*2.5)}.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{padding-block:calc(var(--spacing)*0)}.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-14{padding-block:calc(var(--spacing)*14)}.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-1\.5{padding-top:calc(var(--spacing)*1.5)}.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-0\.5{padding-right:calc(var(--spacing)*.5)}.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-0\.5{padding-bottom:calc(var(--spacing)*.5)}.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-1{padding-left:calc(var(--spacing)*1)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-4{padding-left:calc(var(--spacing)*4)}.pl-6{padding-left:calc(var(--spacing)*6)}.pl-8{padding-left:calc(var(--spacing)*8)}.pl-9{padding-left:calc(var(--spacing)*9)}.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}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Microsoft YaHei,sans-serif}.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-\[9px\]{font-size:9px}.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-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.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-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.text-wrap{text-wrap:wrap}.break-words,.wrap-break-word{overflow-wrap:break-word}.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\]\/20{color:#38bdac33}.text-\[\#38bdac\]\/30{color:#38bdac4d}.text-\[\#38bdac\]\/40{color:#38bdac66}.text-\[\#38bdac\]\/90{color:#38bdace6}.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-200\/90{color:#fee685e6}@supports (color:color-mix(in lab,red,red)){.text-amber-200\/90{color:color-mix(in oklab,var(--color-amber-200)90%,transparent)}}.text-amber-300{color:var(--color-amber-300)}.text-amber-300\/80{color:#ffd236cc}@supports (color:color-mix(in lab,red,red)){.text-amber-300\/80{color:color-mix(in oklab,var(--color-amber-300)80%,transparent)}}.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\/80{color:#fcbb00cc}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/80{color:color-mix(in oklab,var(--color-amber-400)80%,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-amber-500\/80{color:#f99c00cc}@supports (color:color-mix(in lab,red,red)){.text-amber-500\/80{color:color-mix(in oklab,var(--color-amber-500)80%,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-300\/80{color:#90c5ffcc}@supports (color:color-mix(in lab,red,red)){.text-blue-300\/80{color:color-mix(in oklab,var(--color-blue-300)80%,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-200{color:var(--color-cyan-200)}.text-cyan-300{color:var(--color-cyan-300)}.text-cyan-300\/90{color:#53eafde6}@supports (color:color-mix(in lab,red,red)){.text-cyan-300\/90{color:color-mix(in oklab,var(--color-cyan-300)90%,transparent)}}.text-cyan-400{color:var(--color-cyan-400)}.text-emerald-300{color:var(--color-emerald-300)}.text-emerald-400{color:var(--color-emerald-400)}.text-emerald-400\/90{color:#00d294e6}@supports (color:color-mix(in lab,red,red)){.text-emerald-400\/90{color:color-mix(in oklab,var(--color-emerald-400)90%,transparent)}}.text-gray-200{color:var(--color-gray-200)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-green-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\/25{color:#ff8b1a40}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/25{color:color-mix(in oklab,var(--color-orange-400)25%,transparent)}}.text-orange-400\/60{color:#ff8b1a99}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/60{color:color-mix(in oklab,var(--color-orange-400)60%,transparent)}}.text-orange-400\/70{color:#ff8b1ab3}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/70{color:color-mix(in oklab,var(--color-orange-400)70%,transparent)}}.text-orange-400\/80{color:#ff8b1acc}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/80{color:color-mix(in oklab,var(--color-orange-400)80%,transparent)}}.text-purple-300{color:var(--color-purple-300)}.text-purple-300\/90{color:#d9b3ffe6}@supports (color:color-mix(in lab,red,red)){.text-purple-300\/90{color:color-mix(in oklab,var(--color-purple-300)90%,transparent)}}.text-purple-400{color:var(--color-purple-400)}.text-red-100{color:var(--color-red-100)}.text-red-200{color:var(--color-red-200)}.text-red-300{color:var(--color-red-300)}.text-red-300\/70{color:#ffa3a3b3}@supports (color:color-mix(in lab,red,red)){.text-red-300\/70{color:color-mix(in oklab,var(--color-red-300)70%,transparent)}}.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-300{color:var(--color-yellow-300)}.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)}}.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\]\/35{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.35)}.ring-\[\#38bdac\]\/40{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.4)}.ring-\[\#38bdac\]\/50{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.5)}.ring-transparent{--tw-ring-color:transparent}.ring-offset-2{--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)}.ring-offset-\[\#0a1628\]{--tw-ring-offset-color:#0a1628}.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-\[2px\]{--tw-backdrop-blur:blur(2px);-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}.\[overflow-anchor\:none\]{overflow-anchor:none}:where(.divide-x-reverse>:not(:last-child)){--tw-divide-x-reverse:1}.ring-inset{--tw-ring-inset:inset}.group-open\:text-\[\#38bdac\]:is(:where(.group):is([open],:popover-open,:open) *){color:#38bdac}@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\]\/35:hover{border-color:#38bdac59}.hover\:border-\[\#38bdac\]\/40:hover{border-color:#38bdac66}.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\: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-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-blue-600:hover{background-color:var(--color-blue-600)}.hover\:bg-cyan-500\/10:hover{background-color:#00b7d71a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-cyan-500\/10:hover{background-color:color-mix(in oklab,var(--color-cyan-500)10%,transparent)}}.hover\:bg-emerald-500:hover{background-color:var(--color-emerald-500)}.hover\:bg-emerald-500\/20:hover{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-emerald-500\/20:hover{background-color:color-mix(in oklab,var(--color-emerald-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\/40:hover{background-color:#36415366}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-700\/40:hover{background-color:color-mix(in oklab,var(--color-gray-700)40%,transparent)}}.hover\:bg-gray-700\/50:hover{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-700\/50:hover{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.hover\:bg-gray-800:hover{background-color:var(--color-gray-800)}.hover\:bg-green-500\/20:hover{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.hover\:bg-green-500\/20:hover{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.hover\:bg-green-700:hover{background-color:var(--color-green-700)}.hover\:bg-orange-500\/10:hover{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/10:hover{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.hover\:bg-orange-500\/20:hover{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/20:hover{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.hover\:bg-orange-600:hover{background-color:var(--color-orange-600)}.hover\:bg-purple-500\/10:hover{background-color:#ac4bff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/10:hover{background-color:color-mix(in oklab,var(--color-purple-500)10%,transparent)}}.hover\:bg-purple-500\/20:hover{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/20:hover{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.hover\:bg-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\/15:hover{background-color:#fb2c3626}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/15:hover{background-color:color-mix(in oklab,var(--color-red-500)15%,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-red-800\/50:hover{background-color:#9f071280}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-800\/50:hover{background-color:color-mix(in oklab,var(--color-red-800)50%,transparent)}}.hover\:bg-white\/5:hover{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/5:hover{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.hover\:bg-white\/10:hover{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/10:hover{background-color:color-mix(in oklab,var(--color-white)10%,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-\[\#5ee0d1\]:hover{color:#5ee0d1}.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-amber-400\/90:hover{color:#fcbb00e6}@supports (color:color-mix(in lab,red,red)){.hover\:text-amber-400\/90:hover{color:color-mix(in oklab,var(--color-amber-400)90%,transparent)}}.hover\:text-blue-300:hover{color:var(--color-blue-300)}.hover\:text-blue-400:hover{color:var(--color-blue-400)}.hover\:text-gray-200:hover{color:var(--color-gray-200)}.hover\:text-gray-300:hover{color:var(--color-gray-300)}.hover\:text-gray-400:hover{color:var(--color-gray-400)}.hover\:text-green-300:hover{color:var(--color-green-300)}.hover\:text-green-400:hover{color:var(--color-green-400)}.hover\:text-orange-300:hover{color:var(--color-orange-300)}.hover\:text-orange-400:hover{color:var(--color-orange-400)}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:text-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-80:hover{opacity:.8}.hover\:opacity-100:hover{opacity:1}.hover\:ring-\[\#38bdac\]\/60:hover{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.6)}}.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-\[\#38bdac\]\/50:focus-visible{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.5)}.focus-visible\:ring-amber-600\/50:focus-visible{--tw-ring-color:#dd740080}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-amber-600\/50:focus-visible{--tw-ring-color:color-mix(in oklab,var(--color-amber-600)50%,transparent)}}.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\:col-span-2{grid-column:span 2/span 2}.sm\:w-\[220px\]{width:220px}.sm\:max-w-\[600px\]{max-width:600px}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:gap-2{gap:calc(var(--spacing)*2)}.sm\:p-4{padding:calc(var(--spacing)*4)}.sm\:p-5{padding:calc(var(--spacing)*5)}.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-6{grid-template-columns:repeat(6,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))}.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.\[\&_tr\]\:border-b tr{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-style:var(--tw-border-style);border-width:0}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:calc(var(--spacing)*0)}.\[\&\>span\]\:line-clamp-1>span{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}}:root{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20% .02 240);--card-foreground:oklch(98.5% 0 0);--popover:oklch(20% .02 240);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(65% .15 180);--primary-foreground:oklch(20% 0 0);--secondary:oklch(27% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(27% 0 0);--muted-foreground:oklch(65% 0 0);--accent:oklch(27% 0 0);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(55% .2 25);--destructive-foreground:oklch(98.5% 0 0);--border:oklch(35% 0 0);--input:oklch(35% 0 0);--ring:oklch(65% .15 180);--radius:.625rem}body{font-family:var(--font-sans);color:var(--foreground);background:#0a1628}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-pan-x{syntax:"*";inherits:false}@property --tw-pan-y{syntax:"*";inherits:false}@property --tw-pinch-zoom{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}} diff --git a/soul-admin/dist/assets/index-DJrZIu_L.js b/soul-admin/dist/assets/index-DJrZIu_L.js deleted file mode 100644 index 0590f133..00000000 --- a/soul-admin/dist/assets/index-DJrZIu_L.js +++ /dev/null @@ -1,1010 +0,0 @@ -function OE(t,e){for(var n=0;nr[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();function Sj(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var bx={exports:{}},Od={},vx={exports:{}},Lt={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var t1;function DE(){if(t1)return Lt;t1=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),o=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),m=Symbol.iterator;function x(F){return F===null||typeof F!="object"?null:(F=m&&F[m]||F["@@iterator"],typeof F=="function"?F:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,w={};function N(F,U,pe){this.props=F,this.context=U,this.refs=w,this.updater=pe||b}N.prototype.isReactComponent={},N.prototype.setState=function(F,U){if(typeof F!="object"&&typeof F!="function"&&F!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,F,U,"setState")},N.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function k(){}k.prototype=N.prototype;function T(F,U,pe){this.props=F,this.context=U,this.refs=w,this.updater=pe||b}var C=T.prototype=new k;C.constructor=T,v(C,N.prototype),C.isPureReactComponent=!0;var P=Array.isArray,L=Object.prototype.hasOwnProperty,q={current:null},z={key:!0,ref:!0,__self:!0,__source:!0};function H(F,U,pe){var fe,oe={},D=null,K=null;if(U!=null)for(fe in U.ref!==void 0&&(K=U.ref),U.key!==void 0&&(D=""+U.key),U)L.call(U,fe)&&!z.hasOwnProperty(fe)&&(oe[fe]=U[fe]);var _=arguments.length-2;if(_===1)oe.children=pe;else if(1<_){for(var Y=Array(_),te=0;te<_;te++)Y[te]=arguments[te+2];oe.children=Y}if(F&&F.defaultProps)for(fe in _=F.defaultProps,_)oe[fe]===void 0&&(oe[fe]=_[fe]);return{$$typeof:t,type:F,key:D,ref:K,props:oe,_owner:q.current}}function R(F,U){return{$$typeof:t,type:F.type,key:U,ref:F.ref,props:F.props,_owner:F._owner}}function se(F){return typeof F=="object"&&F!==null&&F.$$typeof===t}function X(F){var U={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(pe){return U[pe]})}var V=/\/+/g;function ie(F,U){return typeof F=="object"&&F!==null&&F.key!=null?X(""+F.key):U.toString(36)}function le(F,U,pe,fe,oe){var D=typeof F;(D==="undefined"||D==="boolean")&&(F=null);var K=!1;if(F===null)K=!0;else switch(D){case"string":case"number":K=!0;break;case"object":switch(F.$$typeof){case t:case e:K=!0}}if(K)return K=F,oe=oe(K),F=fe===""?"."+ie(K,0):fe,P(oe)?(pe="",F!=null&&(pe=F.replace(V,"$&/")+"/"),le(oe,U,pe,"",function(te){return te})):oe!=null&&(se(oe)&&(oe=R(oe,pe+(!oe.key||K&&K.key===oe.key?"":(""+oe.key).replace(V,"$&/")+"/")+F)),U.push(oe)),1;if(K=0,fe=fe===""?".":fe+":",P(F))for(var _=0;_>>1,U=$[F];if(0>>1;Fa(oe,Z))Da(K,oe)?($[F]=K,$[D]=Z,F=D):($[F]=oe,$[fe]=Z,F=fe);else if(Da(K,Z))$[F]=K,$[D]=Z,F=D;else break e}}return xe}function a($,xe){var Z=$.sortIndex-xe.sortIndex;return Z!==0?Z:$.id-xe.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,c=o.now();t.unstable_now=function(){return o.now()-c}}var u=[],h=[],f=1,m=null,x=3,b=!1,v=!1,w=!1,N=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C($){for(var xe=n(h);xe!==null;){if(xe.callback===null)r(h);else if(xe.startTime<=$)r(h),xe.sortIndex=xe.expirationTime,e(u,xe);else break;xe=n(h)}}function P($){if(w=!1,C($),!v)if(n(u)!==null)v=!0,I(L);else{var xe=n(h);xe!==null&&Q(P,xe.startTime-$)}}function L($,xe){v=!1,w&&(w=!1,k(H),H=-1),b=!0;var Z=x;try{for(C(xe),m=n(u);m!==null&&(!(m.expirationTime>xe)||$&&!X());){var F=m.callback;if(typeof F=="function"){m.callback=null,x=m.priorityLevel;var U=F(m.expirationTime<=xe);xe=t.unstable_now(),typeof U=="function"?m.callback=U:m===n(u)&&r(u),C(xe)}else r(u);m=n(u)}if(m!==null)var pe=!0;else{var fe=n(h);fe!==null&&Q(P,fe.startTime-xe),pe=!1}return pe}finally{m=null,x=Z,b=!1}}var q=!1,z=null,H=-1,R=5,se=-1;function X(){return!(t.unstable_now()-se$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<$?Math.floor(1e3/$):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_getFirstCallbackNode=function(){return n(u)},t.unstable_next=function($){switch(x){case 1:case 2:case 3:var xe=3;break;default:xe=x}var Z=x;x=xe;try{return $()}finally{x=Z}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function($,xe){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var Z=x;x=$;try{return xe()}finally{x=Z}},t.unstable_scheduleCallback=function($,xe,Z){var F=t.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0F?($.sortIndex=Z,e(h,$),n(u)===null&&$===n(h)&&(w?(k(H),H=-1):w=!0,Q(P,Z-F))):($.sortIndex=U,e(u,$),v||b||(v=!0,I(L))),$},t.unstable_shouldYield=X,t.unstable_wrapCallback=function($){var xe=x;return function(){var Z=x;x=xe;try{return $.apply(this,arguments)}finally{x=Z}}}})(jx)),jx}var i1;function FE(){return i1||(i1=1,wx.exports=$E()),wx.exports}/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var o1;function BE(){if(o1)return br;o1=1;var t=ju(),e=FE();function n(l){for(var d="https://reactjs.org/docs/error-decoder.html?invariant="+l,p=1;p"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,h=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},m={};function x(l){return u.call(m,l)?!0:u.call(f,l)?!1:h.test(l)?m[l]=!0:(f[l]=!0,!1)}function b(l,d,p,g){if(p!==null&&p.type===0)return!1;switch(typeof d){case"function":case"symbol":return!0;case"boolean":return g?!1:p!==null?!p.acceptsBooleans:(l=l.toLowerCase().slice(0,5),l!=="data-"&&l!=="aria-");default:return!1}}function v(l,d,p,g){if(d===null||typeof d>"u"||b(l,d,p,g))return!0;if(g)return!1;if(p!==null)switch(p.type){case 3:return!d;case 4:return d===!1;case 5:return isNaN(d);case 6:return isNaN(d)||1>d}return!1}function w(l,d,p,g,j,S,A){this.acceptsBooleans=d===2||d===3||d===4,this.attributeName=g,this.attributeNamespace=j,this.mustUseProperty=p,this.propertyName=l,this.type=d,this.sanitizeURL=S,this.removeEmptyString=A}var N={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){N[l]=new w(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var d=l[0];N[d]=new w(d,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){N[l]=new w(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){N[l]=new w(l,2,!1,l,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(l){N[l]=new w(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){N[l]=new w(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){N[l]=new w(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){N[l]=new w(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){N[l]=new w(l,5,!1,l.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function T(l){return l[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(l){var d=l.replace(k,T);N[d]=new w(d,1,!1,l,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(l){var d=l.replace(k,T);N[d]=new w(d,1,!1,l,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(l){var d=l.replace(k,T);N[d]=new w(d,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){N[l]=new w(l,1,!1,l.toLowerCase(),null,!1,!1)}),N.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){N[l]=new w(l,1,!1,l.toLowerCase(),null,!0,!0)});function C(l,d,p,g){var j=N.hasOwnProperty(d)?N[d]:null;(j!==null?j.type!==0:g||!(2W||j[A]!==S[W]){var ee=` -`+j[A].replace(" at new "," at ");return l.displayName&&ee.includes("")&&(ee=ee.replace("",l.displayName)),ee}while(1<=A&&0<=W);break}}}finally{pe=!1,Error.prepareStackTrace=p}return(l=l?l.displayName||l.name:"")?U(l):""}function oe(l){switch(l.tag){case 5:return U(l.type);case 16:return U("Lazy");case 13:return U("Suspense");case 19:return U("SuspenseList");case 0:case 2:case 15:return l=fe(l.type,!1),l;case 11:return l=fe(l.type.render,!1),l;case 1:return l=fe(l.type,!0),l;default:return""}}function D(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 z:return"Fragment";case q:return"Portal";case R:return"Profiler";case H:return"StrictMode";case ie:return"Suspense";case le:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case X:return(l.displayName||"Context")+".Consumer";case se:return(l._context.displayName||"Context")+".Provider";case V:var d=l.render;return l=l.displayName,l||(l=d.displayName||d.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case he:return d=l.displayName||null,d!==null?d:D(l.type)||"Memo";case I:d=l._payload,l=l._init;try{return D(l(d))}catch{}}return null}function K(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 D(d);case 8:return d===H?"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 _(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function Y(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function te(l){var d=Y(l)?"checked":"value",p=Object.getOwnPropertyDescriptor(l.constructor.prototype,d),g=""+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(A){g=""+A,S.call(this,A)}}),Object.defineProperty(l,d,{enumerable:p.enumerable}),{getValue:function(){return g},setValue:function(A){g=""+A},stopTracking:function(){l._valueTracker=null,delete l[d]}}}}function Ne(l){l._valueTracker||(l._valueTracker=te(l))}function Fe(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var p=d.getValue(),g="";return l&&(g=Y(l)?l.checked?"true":"false":l.value),l=g,l!==p?(d.setValue(l),!0):!1}function We(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 St(l,d){var p=d.checked;return Z({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??l._wrapperState.initialChecked})}function wt(l,d){var p=d.defaultValue==null?"":d.defaultValue,g=d.checked!=null?d.checked:d.defaultChecked;p=_(d.value!=null?d.value:p),l._wrapperState={initialChecked:g,initialValue:p,controlled:d.type==="checkbox"||d.type==="radio"?d.checked!=null:d.value!=null}}function Vt(l,d){d=d.checked,d!=null&&C(l,"checked",d,!1)}function _t(l,d){Vt(l,d);var p=_(d.value),g=d.type;if(p!=null)g==="number"?(p===0&&l.value===""||l.value!=p)&&(l.value=""+p):l.value!==""+p&&(l.value=""+p);else if(g==="submit"||g==="reset"){l.removeAttribute("value");return}d.hasOwnProperty("value")?Jt(l,d.type,p):d.hasOwnProperty("defaultValue")&&Jt(l,d.type,_(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(l.defaultChecked=!!d.defaultChecked)}function $n(l,d,p){if(d.hasOwnProperty("value")||d.hasOwnProperty("defaultValue")){var g=d.type;if(!(g!=="submit"&&g!=="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 Jt(l,d,p){(d!=="number"||We(l.ownerDocument)!==l)&&(p==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+p&&(l.defaultValue=""+p))}var dn=Array.isArray;function yn(l,d,p,g){if(l=l.options,d){d={};for(var j=0;j"+d.valueOf().toString()+"",d=je.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;d.firstChild;)l.appendChild(d.firstChild)}});function Ue(l,d){if(d){var p=l.firstChild;if(p&&p===l.lastChild&&p.nodeType===3){p.nodeValue=d;return}}l.textContent=d}var it={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},Dt=["Webkit","ms","Moz","O"];Object.keys(it).forEach(function(l){Dt.forEach(function(d){d=d+l.charAt(0).toUpperCase()+l.substring(1),it[d]=it[l]})});function Ct(l,d,p){return d==null||typeof d=="boolean"||d===""?"":p||typeof d!="number"||d===0||it.hasOwnProperty(l)&&it[l]?(""+d).trim():d+"px"}function $e(l,d){l=l.style;for(var p in d)if(d.hasOwnProperty(p)){var g=p.indexOf("--")===0,j=Ct(p,d[p],g);p==="float"&&(p="cssFloat"),g?l.setProperty(p,j):l[p]=j}}var mt=Z({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 es(l,d){if(d){if(mt[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 is(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 Gn=null;function Fn(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var or=null,ls=null,ws=null;function kr(l){if(l=vd(l)){if(typeof or!="function")throw Error(n(280));var d=l.stateNode;d&&(d=Uu(d),or(l.stateNode,l.type,d))}}function Pn(l){ls?ws?ws.push(l):ws=[l]:ls=l}function Js(){if(ls){var l=ls,d=ws;if(ws=ls=null,kr(l),d)for(l=0;l>>=0,l===0?32:31-(Er(l)/Xs|0)|0}var Xa=64,Cs=4194304;function ia(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 Za(l,d){var p=l.pendingLanes;if(p===0)return 0;var g=0,j=l.suspendedLanes,S=l.pingedLanes,A=p&268435455;if(A!==0){var W=A&~j;W!==0?g=ia(W):(S&=A,S!==0&&(g=ia(S)))}else A=p&~j,A!==0?g=ia(A):S!==0&&(g=ia(S));if(g===0)return 0;if(d!==0&&d!==g&&(d&j)===0&&(j=g&-g,S=d&-d,j>=S||j===16&&(S&4194240)!==0))return d;if((g&4)!==0&&(g|=p&16),d=l.entangledLanes,d!==0)for(l=l.entanglements,d&=g;0p;p++)d.push(l);return d}function oa(l,d,p){l.pendingLanes|=d,d!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,d=31-Ot(d),l[d]=p}function ei(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 g=l.eventTimes;for(l=l.expirationTimes;0=qe),Ge=" ",Qt=!1;function fr(l,d){switch(l){case"keyup":return we.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Rr(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var Wr=!1;function Xp(l,d){switch(l){case"compositionend":return Rr(d);case"keypress":return d.which!==32?null:(Qt=!0,Ge);case"textInput":return l=d.data,l===Ge&&Qt?null:l;default:return null}}function Zp(l,d){if(Wr)return l==="compositionend"||!Pe&&fr(l,d)?(l=Ql(),Wi=ai=Pr=null,Wr=!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=g}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=rb(p)}}function ib(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?ib(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function ob(){for(var l=window,d=We();d instanceof l.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)l=d.contentWindow;else break;d=We(l.document)}return d}function nm(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 V4(l){var d=ob(),p=l.focusedElem,g=l.selectionRange;if(d!==p&&p&&p.ownerDocument&&ib(p.ownerDocument.documentElement,p)){if(g!==null&&nm(p)){if(d=g.start,l=g.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(g.start,j);g=g.end===void 0?S:Math.min(g.end,j),!l.extend&&S>g&&(j=g,g=S,S=j),j=ab(p,S);var A=ab(p,g);j&&A&&(l.rangeCount!==1||l.anchorNode!==j.node||l.anchorOffset!==j.offset||l.focusNode!==A.node||l.focusOffset!==A.offset)&&(d=d.createRange(),d.setStart(j.node,j.offset),l.removeAllRanges(),S>g?(l.addRange(d),l.extend(A.node,A.offset)):(d.setEnd(A.node,A.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,Zl=null,sm=null,md=null,rm=!1;function lb(l,d,p){var g=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;rm||Zl==null||Zl!==We(g)||(g=Zl,"selectionStart"in g&&nm(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),md&&pd(md,g)||(md=g,g=Bu(sm,"onSelect"),0rc||(l.current=xm[rc],xm[rc]=null,rc--)}function un(l,d){rc++,xm[rc]=l.current,l.current=d}var Xi={},Fs=Yi(Xi),pr=Yi(!1),Zo=Xi;function ac(l,d){var p=l.type.contextTypes;if(!p)return Xi;var g=l.stateNode;if(g&&g.__reactInternalMemoizedUnmaskedChildContext===d)return g.__reactInternalMemoizedMaskedChildContext;var j={},S;for(S in p)j[S]=d[S];return g&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=d,l.__reactInternalMemoizedMaskedChildContext=j),j}function mr(l){return l=l.childContextTypes,l!=null}function Wu(){xn(pr),xn(Fs)}function jb(l,d,p){if(Fs.current!==Xi)throw Error(n(168));un(Fs,d),un(pr,p)}function kb(l,d,p){var g=l.stateNode;if(d=d.childContextTypes,typeof g.getChildContext!="function")return p;g=g.getChildContext();for(var j in g)if(!(j in d))throw Error(n(108,K(l)||"Unknown",j));return Z({},p,g)}function Ku(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||Xi,Zo=Fs.current,un(Fs,l),un(pr,pr.current),!0}function Sb(l,d,p){var g=l.stateNode;if(!g)throw Error(n(169));p?(l=kb(l,d,Zo),g.__reactInternalMemoizedMergedChildContext=l,xn(pr),xn(Fs),un(Fs,l)):xn(pr),un(pr,p)}var di=null,qu=!1,gm=!1;function Cb(l){di===null?di=[l]:di.push(l)}function eE(l){qu=!0,Cb(l)}function Zi(){if(!gm&&di!==null){gm=!0;var l=0,d=bt;try{var p=di;for(bt=1;l>=A,j-=A,ui=1<<32-Ot(d)+j|p<vt?(ys=dt,dt=null):ys=dt.sibling;var Ht=Me(me,dt,ge[vt],De);if(Ht===null){dt===null&&(dt=ys);break}l&&dt&&Ht.alternate===null&&d(me,dt),ae=S(Ht,ae,vt),ct===null?rt=Ht:ct.sibling=Ht,ct=Ht,dt=ys}if(vt===ge.length)return p(me,dt),kn&&tl(me,vt),rt;if(dt===null){for(;vtvt?(ys=dt,dt=null):ys=dt.sibling;var lo=Me(me,dt,Ht.value,De);if(lo===null){dt===null&&(dt=ys);break}l&&dt&&lo.alternate===null&&d(me,dt),ae=S(lo,ae,vt),ct===null?rt=lo:ct.sibling=lo,ct=lo,dt=ys}if(Ht.done)return p(me,dt),kn&&tl(me,vt),rt;if(dt===null){for(;!Ht.done;vt++,Ht=ge.next())Ht=Re(me,Ht.value,De),Ht!==null&&(ae=S(Ht,ae,vt),ct===null?rt=Ht:ct.sibling=Ht,ct=Ht);return kn&&tl(me,vt),rt}for(dt=g(me,dt);!Ht.done;vt++,Ht=ge.next())Ht=Je(dt,me,vt,Ht.value,De),Ht!==null&&(l&&Ht.alternate!==null&&dt.delete(Ht.key===null?vt:Ht.key),ae=S(Ht,ae,vt),ct===null?rt=Ht:ct.sibling=Ht,ct=Ht);return l&&dt.forEach(function(LE){return d(me,LE)}),kn&&tl(me,vt),rt}function Hn(me,ae,ge,De){if(typeof ge=="object"&&ge!==null&&ge.type===z&&ge.key===null&&(ge=ge.props.children),typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case L:e:{for(var rt=ge.key,ct=ae;ct!==null;){if(ct.key===rt){if(rt=ge.type,rt===z){if(ct.tag===7){p(me,ct.sibling),ae=j(ct,ge.props.children),ae.return=me,me=ae;break e}}else if(ct.elementType===rt||typeof rt=="object"&&rt!==null&&rt.$$typeof===I&&Pb(rt)===ct.type){p(me,ct.sibling),ae=j(ct,ge.props),ae.ref=Nd(me,ct,ge),ae.return=me,me=ae;break e}p(me,ct);break}else d(me,ct);ct=ct.sibling}ge.type===z?(ae=cl(ge.props.children,me.mode,De,ge.key),ae.return=me,me=ae):(De=Nh(ge.type,ge.key,ge.props,null,me.mode,De),De.ref=Nd(me,ae,ge),De.return=me,me=De)}return A(me);case q:e:{for(ct=ge.key;ae!==null;){if(ae.key===ct)if(ae.tag===4&&ae.stateNode.containerInfo===ge.containerInfo&&ae.stateNode.implementation===ge.implementation){p(me,ae.sibling),ae=j(ae,ge.children||[]),ae.return=me,me=ae;break e}else{p(me,ae);break}else d(me,ae);ae=ae.sibling}ae=px(ge,me.mode,De),ae.return=me,me=ae}return A(me);case I:return ct=ge._init,Hn(me,ae,ct(ge._payload),De)}if(dn(ge))return et(me,ae,ge,De);if(xe(ge))return st(me,ae,ge,De);Yu(me,ge)}return typeof ge=="string"&&ge!==""||typeof ge=="number"?(ge=""+ge,ae!==null&&ae.tag===6?(p(me,ae.sibling),ae=j(ae,ge),ae.return=me,me=ae):(p(me,ae),ae=fx(ge,me.mode,De),ae.return=me,me=ae),A(me)):p(me,ae)}return Hn}var cc=Rb(!0),Lb=Rb(!1),Xu=Yi(null),Zu=null,dc=null,jm=null;function km(){jm=dc=Zu=null}function Sm(l){var d=Xu.current;xn(Xu),l._currentValue=d}function Cm(l,d,p){for(;l!==null;){var g=l.alternate;if((l.childLanes&d)!==d?(l.childLanes|=d,g!==null&&(g.childLanes|=d)):g!==null&&(g.childLanes&d)!==d&&(g.childLanes|=d),l===p)break;l=l.return}}function uc(l,d){Zu=l,jm=dc=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(xr=!0),l.firstContext=null)}function Gr(l){var d=l._currentValue;if(jm!==l)if(l={context:l,memoizedValue:d,next:null},dc===null){if(Zu===null)throw Error(n(308));dc=l,Zu.dependencies={lanes:0,firstContext:l}}else dc=dc.next=l;return d}var nl=null;function Em(l){nl===null?nl=[l]:nl.push(l)}function Ob(l,d,p,g){var j=d.interleaved;return j===null?(p.next=p,Em(d)):(p.next=j.next,j.next=p),d.interleaved=p,fi(l,g)}function fi(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 eo=!1;function Tm(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Db(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 pi(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function to(l,d,p){var g=l.updateQueue;if(g===null)return null;if(g=g.shared,(Bt&2)!==0){var j=g.pending;return j===null?d.next=d:(d.next=j.next,j.next=d),g.pending=d,fi(l,p)}return j=g.interleaved,j===null?(d.next=d,Em(g)):(d.next=j.next,j.next=d),g.interleaved=d,fi(l,p)}function eh(l,d,p){if(d=d.updateQueue,d!==null&&(d=d.shared,(p&4194240)!==0)){var g=d.lanes;g&=l.pendingLanes,p|=g,d.lanes=p,ti(l,p)}}function _b(l,d){var p=l.updateQueue,g=l.alternate;if(g!==null&&(g=g.updateQueue,p===g)){var j=null,S=null;if(p=p.firstBaseUpdate,p!==null){do{var A={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};S===null?j=S=A:S=S.next=A,p=p.next}while(p!==null);S===null?j=S=d:S=S.next=d}else j=S=d;p={baseState:g.baseState,firstBaseUpdate:j,lastBaseUpdate:S,shared:g.shared,effects:g.effects},l.updateQueue=p;return}l=p.lastBaseUpdate,l===null?p.firstBaseUpdate=d:l.next=d,p.lastBaseUpdate=d}function th(l,d,p,g){var j=l.updateQueue;eo=!1;var S=j.firstBaseUpdate,A=j.lastBaseUpdate,W=j.shared.pending;if(W!==null){j.shared.pending=null;var ee=W,ye=ee.next;ee.next=null,A===null?S=ye:A.next=ye,A=ee;var Ae=l.alternate;Ae!==null&&(Ae=Ae.updateQueue,W=Ae.lastBaseUpdate,W!==A&&(W===null?Ae.firstBaseUpdate=ye:W.next=ye,Ae.lastBaseUpdate=ee))}if(S!==null){var Re=j.baseState;A=0,Ae=ye=ee=null,W=S;do{var Me=W.lane,Je=W.eventTime;if((g&Me)===Me){Ae!==null&&(Ae=Ae.next={eventTime:Je,lane:0,tag:W.tag,payload:W.payload,callback:W.callback,next:null});e:{var et=l,st=W;switch(Me=d,Je=p,st.tag){case 1:if(et=st.payload,typeof et=="function"){Re=et.call(Je,Re,Me);break e}Re=et;break e;case 3:et.flags=et.flags&-65537|128;case 0:if(et=st.payload,Me=typeof et=="function"?et.call(Je,Re,Me):et,Me==null)break e;Re=Z({},Re,Me);break e;case 2:eo=!0}}W.callback!==null&&W.lane!==0&&(l.flags|=64,Me=j.effects,Me===null?j.effects=[W]:Me.push(W))}else Je={eventTime:Je,lane:Me,tag:W.tag,payload:W.payload,callback:W.callback,next:null},Ae===null?(ye=Ae=Je,ee=Re):Ae=Ae.next=Je,A|=Me;if(W=W.next,W===null){if(W=j.shared.pending,W===null)break;Me=W,W=Me.next,Me.next=null,j.lastBaseUpdate=Me,j.shared.pending=null}}while(!0);if(Ae===null&&(ee=Re),j.baseState=ee,j.firstBaseUpdate=ye,j.lastBaseUpdate=Ae,d=j.shared.interleaved,d!==null){j=d;do A|=j.lane,j=j.next;while(j!==d)}else S===null&&(j.shared.lanes=0);al|=A,l.lanes=A,l.memoizedState=Re}}function zb(l,d,p){if(l=d.effects,d.effects=null,l!==null)for(d=0;dp?p:4,l(!0);var g=Rm.transition;Rm.transition={};try{l(!1),d()}finally{bt=p,Rm.transition=g}}function sv(){return Jr().memoizedState}function rE(l,d,p){var g=ao(l);if(p={lane:g,action:p,hasEagerState:!1,eagerState:null,next:null},rv(l))av(d,p);else if(p=Ob(l,d,p,g),p!==null){var j=nr();xa(p,l,g,j),iv(p,d,g)}}function aE(l,d,p){var g=ao(l),j={lane:g,action:p,hasEagerState:!1,eagerState:null,next:null};if(rv(l))av(d,j);else{var S=l.alternate;if(l.lanes===0&&(S===null||S.lanes===0)&&(S=d.lastRenderedReducer,S!==null))try{var A=d.lastRenderedState,W=S(A,p);if(j.hasEagerState=!0,j.eagerState=W,ua(W,A)){var ee=d.interleaved;ee===null?(j.next=j,Em(d)):(j.next=ee.next,ee.next=j),d.interleaved=j;return}}catch{}finally{}p=Ob(l,d,j,g),p!==null&&(j=nr(),xa(p,l,g,j),iv(p,d,g))}}function rv(l){var d=l.alternate;return l===An||d!==null&&d===An}function av(l,d){Sd=rh=!0;var p=l.pending;p===null?d.next=d:(d.next=p.next,p.next=d),l.pending=d}function iv(l,d,p){if((p&4194240)!==0){var g=d.lanes;g&=l.pendingLanes,p|=g,d.lanes=p,ti(l,p)}}var oh={readContext:Gr,useCallback:Bs,useContext:Bs,useEffect:Bs,useImperativeHandle:Bs,useInsertionEffect:Bs,useLayoutEffect:Bs,useMemo:Bs,useReducer:Bs,useRef:Bs,useState:Bs,useDebugValue:Bs,useDeferredValue:Bs,useTransition:Bs,useMutableSource:Bs,useSyncExternalStore:Bs,useId:Bs,unstable_isNewReconciler:!1},iE={readContext:Gr,useCallback:function(l,d){return Da().memoizedState=[l,d===void 0?null:d],l},useContext:Gr,useEffect:Jb,useImperativeHandle:function(l,d,p){return p=p!=null?p.concat([l]):null,ah(4194308,4,Xb.bind(null,d,l),p)},useLayoutEffect:function(l,d){return ah(4194308,4,l,d)},useInsertionEffect:function(l,d){return ah(4,2,l,d)},useMemo:function(l,d){var p=Da();return d=d===void 0?null:d,l=l(),p.memoizedState=[l,d],l},useReducer:function(l,d,p){var g=Da();return d=p!==void 0?p(d):d,g.memoizedState=g.baseState=d,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:d},g.queue=l,l=l.dispatch=rE.bind(null,An,l),[g.memoizedState,l]},useRef:function(l){var d=Da();return l={current:l},d.memoizedState=l},useState:qb,useDebugValue:Fm,useDeferredValue:function(l){return Da().memoizedState=l},useTransition:function(){var l=qb(!1),d=l[0];return l=sE.bind(null,l[1]),Da().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,p){var g=An,j=Da();if(kn){if(p===void 0)throw Error(n(407));p=p()}else{if(p=d(),gs===null)throw Error(n(349));(rl&30)!==0||Vb(g,d,p)}j.memoizedState=p;var S={value:p,getSnapshot:d};return j.queue=S,Jb(Ub.bind(null,g,S,l),[l]),g.flags|=2048,Td(9,Hb.bind(null,g,S,p,d),void 0,null),p},useId:function(){var l=Da(),d=gs.identifierPrefix;if(kn){var p=hi,g=ui;p=(g&~(1<<32-Ot(g)-1)).toString(32)+p,d=":"+d+"R"+p,p=Cd++,0<\/script>",l=l.removeChild(l.firstChild)):typeof g.is=="string"?l=A.createElement(p,{is:g.is}):(l=A.createElement(p),p==="select"&&(A=l,g.multiple?A.multiple=!0:g.size&&(A.size=g.size))):l=A.createElementNS(l,p),l[La]=d,l[bd]=g,Cv(l,d,!1,!1),d.stateNode=l;e:{switch(A=is(p,g),p){case"dialog":mn("cancel",l),mn("close",l),j=g;break;case"iframe":case"object":case"embed":mn("load",l),j=g;break;case"video":case"audio":for(j=0;jxc&&(d.flags|=128,g=!0,Md(S,!1),d.lanes=4194304)}else{if(!g)if(l=nh(A),l!==null){if(d.flags|=128,g=!0,p=l.updateQueue,p!==null&&(d.updateQueue=p,d.flags|=4),Md(S,!0),S.tail===null&&S.tailMode==="hidden"&&!A.alternate&&!kn)return Vs(d),null}else 2*zt()-S.renderingStartTime>xc&&p!==1073741824&&(d.flags|=128,g=!0,Md(S,!1),d.lanes=4194304);S.isBackwards?(A.sibling=d.child,d.child=A):(p=S.last,p!==null?p.sibling=A:d.child=A,S.last=A)}return S.tail!==null?(d=S.tail,S.rendering=d,S.tail=d.sibling,S.renderingStartTime=zt(),d.sibling=null,p=Mn.current,un(Mn,g?p&1|2:p&1),d):(Vs(d),null);case 22:case 23:return dx(),g=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==g&&(d.flags|=8192),g&&(d.mode&1)!==0?(Dr&1073741824)!==0&&(Vs(d),d.subtreeFlags&6&&(d.flags|=8192)):Vs(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function pE(l,d){switch(bm(d),d.tag){case 1:return mr(d.type)&&Wu(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return hc(),xn(pr),xn(Fs),Pm(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return Am(d),null;case 13:if(xn(Mn),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));lc()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return xn(Mn),null;case 4:return hc(),null;case 10:return Sm(d.type._context),null;case 22:case 23:return dx(),null;case 24:return null;default:return null}}var uh=!1,Hs=!1,mE=typeof WeakSet=="function"?WeakSet:Set,Xe=null;function pc(l,d){var p=l.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(g){Rn(l,d,g)}else p.current=null}function Xm(l,d,p){try{p()}catch(g){Rn(l,d,g)}}var Mv=!1;function xE(l,d){if(dm=$s,l=ob(),nm(l)){if("selectionStart"in l)var p={start:l.selectionStart,end:l.selectionEnd};else e:{p=(p=l.ownerDocument)&&p.defaultView||window;var g=p.getSelection&&p.getSelection();if(g&&g.rangeCount!==0){p=g.anchorNode;var j=g.anchorOffset,S=g.focusNode;g=g.focusOffset;try{p.nodeType,S.nodeType}catch{p=null;break e}var A=0,W=-1,ee=-1,ye=0,Ae=0,Re=l,Me=null;t:for(;;){for(var Je;Re!==p||j!==0&&Re.nodeType!==3||(W=A+j),Re!==S||g!==0&&Re.nodeType!==3||(ee=A+g),Re.nodeType===3&&(A+=Re.nodeValue.length),(Je=Re.firstChild)!==null;)Me=Re,Re=Je;for(;;){if(Re===l)break t;if(Me===p&&++ye===j&&(W=A),Me===S&&++Ae===g&&(ee=A),(Je=Re.nextSibling)!==null)break;Re=Me,Me=Re.parentNode}Re=Je}p=W===-1||ee===-1?null:{start:W,end:ee}}else p=null}p=p||{start:0,end:0}}else p=null;for(um={focusedElem:l,selectionRange:p},$s=!1,Xe=d;Xe!==null;)if(d=Xe,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,Xe=l;else for(;Xe!==null;){d=Xe;try{var et=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(et!==null){var st=et.memoizedProps,Hn=et.memoizedState,me=d.stateNode,ae=me.getSnapshotBeforeUpdate(d.elementType===d.type?st:fa(d.type,st),Hn);me.__reactInternalSnapshotBeforeUpdate=ae}break;case 3:var ge=d.stateNode.containerInfo;ge.nodeType===1?ge.textContent="":ge.nodeType===9&&ge.documentElement&&ge.removeChild(ge.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(De){Rn(d,d.return,De)}if(l=d.sibling,l!==null){l.return=d.return,Xe=l;break}Xe=d.return}return et=Mv,Mv=!1,et}function Ad(l,d,p){var g=d.updateQueue;if(g=g!==null?g.lastEffect:null,g!==null){var j=g=g.next;do{if((j.tag&l)===l){var S=j.destroy;j.destroy=void 0,S!==void 0&&Xm(d,p,S)}j=j.next}while(j!==g)}}function hh(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 g=p.create;p.destroy=g()}p=p.next}while(p!==d)}}function Zm(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 Av(l){var d=l.alternate;d!==null&&(l.alternate=null,Av(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[La],delete d[bd],delete d[mm],delete d[X4],delete d[Z4])),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 Iv(l){return l.tag===5||l.tag===3||l.tag===4}function Pv(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||Iv(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 ex(l,d,p){var g=l.tag;if(g===5||g===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=Hu));else if(g!==4&&(l=l.child,l!==null))for(ex(l,d,p),l=l.sibling;l!==null;)ex(l,d,p),l=l.sibling}function tx(l,d,p){var g=l.tag;if(g===5||g===6)l=l.stateNode,d?p.insertBefore(l,d):p.appendChild(l);else if(g!==4&&(l=l.child,l!==null))for(tx(l,d,p),l=l.sibling;l!==null;)tx(l,d,p),l=l.sibling}var Ms=null,pa=!1;function no(l,d,p){for(p=p.child;p!==null;)Rv(l,d,p),p=p.sibling}function Rv(l,d,p){if(xt&&typeof xt.onCommitFiberUnmount=="function")try{xt.onCommitFiberUnmount(ht,p)}catch{}switch(p.tag){case 5:Hs||pc(p,d);case 6:var g=Ms,j=pa;Ms=null,no(l,d,p),Ms=g,pa=j,Ms!==null&&(pa?(l=Ms,p=p.stateNode,l.nodeType===8?l.parentNode.removeChild(p):l.removeChild(p)):Ms.removeChild(p.stateNode));break;case 18:Ms!==null&&(pa?(l=Ms,p=p.stateNode,l.nodeType===8?pm(l.parentNode,p):l.nodeType===1&&pm(l,p),Ts(l)):pm(Ms,p.stateNode));break;case 4:g=Ms,j=pa,Ms=p.stateNode.containerInfo,pa=!0,no(l,d,p),Ms=g,pa=j;break;case 0:case 11:case 14:case 15:if(!Hs&&(g=p.updateQueue,g!==null&&(g=g.lastEffect,g!==null))){j=g=g.next;do{var S=j,A=S.destroy;S=S.tag,A!==void 0&&((S&2)!==0||(S&4)!==0)&&Xm(p,d,A),j=j.next}while(j!==g)}no(l,d,p);break;case 1:if(!Hs&&(pc(p,d),g=p.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=p.memoizedProps,g.state=p.memoizedState,g.componentWillUnmount()}catch(W){Rn(p,d,W)}no(l,d,p);break;case 21:no(l,d,p);break;case 22:p.mode&1?(Hs=(g=Hs)||p.memoizedState!==null,no(l,d,p),Hs=g):no(l,d,p);break;default:no(l,d,p)}}function Lv(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var p=l.stateNode;p===null&&(p=l.stateNode=new mE),d.forEach(function(g){var j=SE.bind(null,l,g);p.has(g)||(p.add(g),g.then(j,j))})}}function ma(l,d){var p=d.deletions;if(p!==null)for(var g=0;gj&&(j=A),g&=~S}if(g=j,g=zt()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*yE(g/1960))-g,10l?16:l,ro===null)var g=!1;else{if(l=ro,ro=null,gh=0,(Bt&6)!==0)throw Error(n(331));var j=Bt;for(Bt|=4,Xe=l.current;Xe!==null;){var S=Xe,A=S.child;if((Xe.flags&16)!==0){var W=S.deletions;if(W!==null){for(var ee=0;eezt()-rx?ol(l,0):sx|=p),yr(l,d)}function qv(l,d){d===0&&((l.mode&1)===0?d=1:(d=Cs,Cs<<=1,(Cs&130023424)===0&&(Cs=4194304)));var p=nr();l=fi(l,d),l!==null&&(oa(l,d,p),yr(l,p))}function kE(l){var d=l.memoizedState,p=0;d!==null&&(p=d.retryLane),qv(l,p)}function SE(l,d){var p=0;switch(l.tag){case 13:var g=l.stateNode,j=l.memoizedState;j!==null&&(p=j.retryLane);break;case 19:g=l.stateNode;break;default:throw Error(n(314))}g!==null&&g.delete(d),qv(l,p)}var Gv;Gv=function(l,d,p){if(l!==null)if(l.memoizedProps!==d.pendingProps||pr.current)xr=!0;else{if((l.lanes&p)===0&&(d.flags&128)===0)return xr=!1,hE(l,d,p);xr=(l.flags&131072)!==0}else xr=!1,kn&&(d.flags&1048576)!==0&&Eb(d,Ju,d.index);switch(d.lanes=0,d.tag){case 2:var g=d.type;dh(l,d),l=d.pendingProps;var j=ac(d,Fs.current);uc(d,p),j=Om(null,d,g,l,j,p);var S=Dm();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,mr(g)?(S=!0,Ku(d)):S=!1,d.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,Tm(d),j.updater=lh,d.stateNode=j,j._reactInternals=d,Vm(d,g,l,p),d=Km(null,d,g,!0,S,p)):(d.tag=0,kn&&S&&ym(d),tr(null,d,j,p),d=d.child),d;case 16:g=d.elementType;e:{switch(dh(l,d),l=d.pendingProps,j=g._init,g=j(g._payload),d.type=g,j=d.tag=EE(g),l=fa(g,l),j){case 0:d=Wm(null,d,g,l,p);break e;case 1:d=vv(null,d,g,l,p);break e;case 11:d=mv(null,d,g,l,p);break e;case 14:d=xv(null,d,g,fa(g.type,l),p);break e}throw Error(n(306,g,""))}return d;case 0:return g=d.type,j=d.pendingProps,j=d.elementType===g?j:fa(g,j),Wm(l,d,g,j,p);case 1:return g=d.type,j=d.pendingProps,j=d.elementType===g?j:fa(g,j),vv(l,d,g,j,p);case 3:e:{if(Nv(d),l===null)throw Error(n(387));g=d.pendingProps,S=d.memoizedState,j=S.element,Db(l,d),th(d,g,null,p);var A=d.memoizedState;if(g=A.element,S.isDehydrated)if(S={element:g,isDehydrated:!1,cache:A.cache,pendingSuspenseBoundaries:A.pendingSuspenseBoundaries,transitions:A.transitions},d.updateQueue.baseState=S,d.memoizedState=S,d.flags&256){j=fc(Error(n(423)),d),d=wv(l,d,g,p,j);break e}else if(g!==j){j=fc(Error(n(424)),d),d=wv(l,d,g,p,j);break e}else for(Or=Qi(d.stateNode.containerInfo.firstChild),Lr=d,kn=!0,ha=null,p=Lb(d,null,g,p),d.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(lc(),g===j){d=mi(l,d,p);break e}tr(l,d,g,p)}d=d.child}return d;case 5:return $b(d),l===null&&Nm(d),g=d.type,j=d.pendingProps,S=l!==null?l.memoizedProps:null,A=j.children,hm(g,j)?A=null:S!==null&&hm(g,S)&&(d.flags|=32),bv(l,d),tr(l,d,A,p),d.child;case 6:return l===null&&Nm(d),null;case 13:return jv(l,d,p);case 4:return Mm(d,d.stateNode.containerInfo),g=d.pendingProps,l===null?d.child=cc(d,null,g,p):tr(l,d,g,p),d.child;case 11:return g=d.type,j=d.pendingProps,j=d.elementType===g?j:fa(g,j),mv(l,d,g,j,p);case 7:return tr(l,d,d.pendingProps,p),d.child;case 8:return tr(l,d,d.pendingProps.children,p),d.child;case 12:return tr(l,d,d.pendingProps.children,p),d.child;case 10:e:{if(g=d.type._context,j=d.pendingProps,S=d.memoizedProps,A=j.value,un(Xu,g._currentValue),g._currentValue=A,S!==null)if(ua(S.value,A)){if(S.children===j.children&&!pr.current){d=mi(l,d,p);break e}}else for(S=d.child,S!==null&&(S.return=d);S!==null;){var W=S.dependencies;if(W!==null){A=S.child;for(var ee=W.firstContext;ee!==null;){if(ee.context===g){if(S.tag===1){ee=pi(-1,p&-p),ee.tag=2;var ye=S.updateQueue;if(ye!==null){ye=ye.shared;var Ae=ye.pending;Ae===null?ee.next=ee:(ee.next=Ae.next,Ae.next=ee),ye.pending=ee}}S.lanes|=p,ee=S.alternate,ee!==null&&(ee.lanes|=p),Cm(S.return,p,d),W.lanes|=p;break}ee=ee.next}}else if(S.tag===10)A=S.type===d.type?null:S.child;else if(S.tag===18){if(A=S.return,A===null)throw Error(n(341));A.lanes|=p,W=A.alternate,W!==null&&(W.lanes|=p),Cm(A,p,d),A=S.sibling}else A=S.child;if(A!==null)A.return=S;else for(A=S;A!==null;){if(A===d){A=null;break}if(S=A.sibling,S!==null){S.return=A.return,A=S;break}A=A.return}S=A}tr(l,d,j.children,p),d=d.child}return d;case 9:return j=d.type,g=d.pendingProps.children,uc(d,p),j=Gr(j),g=g(j),d.flags|=1,tr(l,d,g,p),d.child;case 14:return g=d.type,j=fa(g,d.pendingProps),j=fa(g.type,j),xv(l,d,g,j,p);case 15:return gv(l,d,d.type,d.pendingProps,p);case 17:return g=d.type,j=d.pendingProps,j=d.elementType===g?j:fa(g,j),dh(l,d),d.tag=1,mr(g)?(l=!0,Ku(d)):l=!1,uc(d,p),lv(d,g,j),Vm(d,g,j,p),Km(null,d,g,!0,l,p);case 19:return Sv(l,d,p);case 22:return yv(l,d,p)}throw Error(n(156,d.tag))};function Jv(l,d){return Ca(l,d)}function CE(l,d,p,g){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=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Yr(l,d,p,g){return new CE(l,d,p,g)}function hx(l){return l=l.prototype,!(!l||!l.isReactComponent)}function EE(l){if(typeof l=="function")return hx(l)?1:0;if(l!=null){if(l=l.$$typeof,l===V)return 11;if(l===he)return 14}return 2}function oo(l,d){var p=l.alternate;return p===null?(p=Yr(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 Nh(l,d,p,g,j,S){var A=2;if(g=l,typeof l=="function")hx(l)&&(A=1);else if(typeof l=="string")A=5;else e:switch(l){case z:return cl(p.children,j,S,d);case H:A=8,j|=8;break;case R:return l=Yr(12,p,d,j|2),l.elementType=R,l.lanes=S,l;case ie:return l=Yr(13,p,d,j),l.elementType=ie,l.lanes=S,l;case le:return l=Yr(19,p,d,j),l.elementType=le,l.lanes=S,l;case Q:return wh(p,j,S,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case se:A=10;break e;case X:A=9;break e;case V:A=11;break e;case he:A=14;break e;case I:A=16,g=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=Yr(A,p,d,j),d.elementType=l,d.type=g,d.lanes=S,d}function cl(l,d,p,g){return l=Yr(7,l,g,d),l.lanes=p,l}function wh(l,d,p,g){return l=Yr(22,l,g,d),l.elementType=Q,l.lanes=p,l.stateNode={isHidden:!1},l}function fx(l,d,p){return l=Yr(6,l,null,d),l.lanes=p,l}function px(l,d,p){return d=Yr(4,l.children!==null?l.children:[],l.key,d),d.lanes=p,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function TE(l,d,p,g,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=Ta(0),this.expirationTimes=Ta(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ta(0),this.identifierPrefix=g,this.onRecoverableError=j,this.mutableSourceEagerHydrationData=null}function mx(l,d,p,g,j,S,A,W,ee){return l=new TE(l,d,p,W,ee),d===1?(d=1,S===!0&&(d|=8)):d=0,S=Yr(3,null,null,d),l.current=S,S.stateNode=l,S.memoizedState={element:g,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},Tm(S),l}function ME(l,d,p){var g=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Nx.exports=BE(),Nx.exports}var c1;function VE(){if(c1)return Mh;c1=1;var t=Cj();return Mh.createRoot=t.createRoot,Mh.hydrateRoot=t.hydrateRoot,Mh}var HE=VE(),Yc=Cj();const Ej=Sj(Yc);/** - * @remix-run/router v1.23.2 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function ou(){return ou=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function P0(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function WE(){return Math.random().toString(36).substr(2,8)}function u1(t,e){return{usr:t.state,key:t.key,idx:e}}function Ng(t,e,n,r){return n===void 0&&(n=null),ou({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Xc(e):e,{state:n,key:e&&e.key||r||WE()})}function mf(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Xc(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function KE(t,e,n,r){r===void 0&&(r={});let{window:a=document.defaultView,v5Compat:i=!1}=r,o=a.history,c=No.Pop,u=null,h=f();h==null&&(h=0,o.replaceState(ou({},o.state,{idx:h}),""));function f(){return(o.state||{idx:null}).idx}function m(){c=No.Pop;let N=f(),k=N==null?null:N-h;h=N,u&&u({action:c,location:w.location,delta:k})}function x(N,k){c=No.Push;let T=Ng(w.location,N,k);h=f()+1;let C=u1(T,h),P=w.createHref(T);try{o.pushState(C,"",P)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;a.location.assign(P)}i&&u&&u({action:c,location:w.location,delta:1})}function b(N,k){c=No.Replace;let T=Ng(w.location,N,k);h=f();let C=u1(T,h),P=w.createHref(T);o.replaceState(C,"",P),i&&u&&u({action:c,location:w.location,delta:0})}function v(N){let k=a.location.origin!=="null"?a.location.origin:a.location.href,T=typeof N=="string"?N:mf(N);return T=T.replace(/ $/,"%20"),Kn(k,"No window.location.(origin|href) available to create URL for href: "+T),new URL(T,k)}let w={get action(){return c},get location(){return t(a,o)},listen(N){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(d1,m),u=N,()=>{a.removeEventListener(d1,m),u=null}},createHref(N){return e(a,N)},createURL:v,encodeLocation(N){let k=v(N);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:x,replace:b,go(N){return o.go(N)}};return w}var h1;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(h1||(h1={}));function qE(t,e,n){return n===void 0&&(n="/"),GE(t,e,n)}function GE(t,e,n,r){let a=typeof e=="string"?Xc(e):e,i=R0(a.pathname||"/",n);if(i==null)return null;let o=Tj(t);JE(o);let c=null;for(let u=0;c==null&&u{let u={relativePath:c===void 0?i.path||"":c,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};u.relativePath.startsWith("/")&&(Kn(u.relativePath.startsWith(r),'Absolute route path "'+u.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),u.relativePath=u.relativePath.slice(r.length));let h=Eo([r,u.relativePath]),f=n.concat(u);i.children&&i.children.length>0&&(Kn(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+h+'".')),Tj(i.children,e,f,h)),!(i.path==null&&!i.index)&&e.push({path:h,score:nT(h,i.index),routesMeta:f})};return t.forEach((i,o)=>{var c;if(i.path===""||!((c=i.path)!=null&&c.includes("?")))a(i,o);else for(let u of Mj(i.path))a(i,o,u)}),e}function Mj(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return a?[i,""]:[i];let o=Mj(r.join("/")),c=[];return c.push(...o.map(u=>u===""?i:[i,u].join("/"))),a&&c.push(...o),c.map(u=>t.startsWith("/")&&u===""?"/":u)}function JE(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:sT(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const QE=/^:[\w-]+$/,YE=3,XE=2,ZE=1,eT=10,tT=-2,f1=t=>t==="*";function nT(t,e){let n=t.split("/"),r=n.length;return n.some(f1)&&(r+=tT),e&&(r+=XE),n.filter(a=>!f1(a)).reduce((a,i)=>a+(QE.test(i)?YE:i===""?ZE:eT),r)}function sT(t,e){return t.length===e.length&&t.slice(0,-1).every((r,a)=>r===e[a])?t[t.length-1]-e[e.length-1]:0}function rT(t,e,n){let{routesMeta:r}=t,a={},i="/",o=[];for(let c=0;c{let{paramName:x,isOptional:b}=f;if(x==="*"){let w=c[m]||"";o=i.slice(0,i.length-w.length).replace(/(.)\/+$/,"$1")}const v=c[m];return b&&!v?h[x]=void 0:h[x]=(v||"").replace(/%2F/g,"/"),h},{}),pathname:i,pathnameBase:o,pattern:t}}function iT(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),P0(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],a="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,c,u)=>(r.push({paramName:c,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),a+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":t!==""&&t!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,e?void 0:"i"),r]}function oT(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return P0(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function R0(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}const lT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,cT=t=>lT.test(t);function dT(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:a=""}=typeof t=="string"?Xc(t):t,i;if(n)if(cT(n))i=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),P0(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=p1(n.substring(1),"/"):i=p1(n,e)}else i=e;return{pathname:i,search:fT(r),hash:pT(a)}}function p1(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function kx(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function uT(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function L0(t,e){let n=uT(t);return e?n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function O0(t,e,n,r){r===void 0&&(r=!1);let a;typeof t=="string"?a=Xc(t):(a=ou({},t),Kn(!a.pathname||!a.pathname.includes("?"),kx("?","pathname","search",a)),Kn(!a.pathname||!a.pathname.includes("#"),kx("#","pathname","hash",a)),Kn(!a.search||!a.search.includes("#"),kx("#","search","hash",a)));let i=t===""||a.pathname==="",o=i?"/":a.pathname,c;if(o==null)c=n;else{let m=e.length-1;if(!r&&o.startsWith("..")){let x=o.split("/");for(;x[0]==="..";)x.shift(),m-=1;a.pathname=x.join("/")}c=m>=0?e[m]:"/"}let u=dT(a,c),h=o&&o!=="/"&&o.endsWith("/"),f=(i||o===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(h||f)&&(u.pathname+="/"),u}const Eo=t=>t.join("/").replace(/\/\/+/g,"/"),hT=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),fT=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,pT=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function mT(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Aj=["post","put","patch","delete"];new Set(Aj);const xT=["get",...Aj];new Set(xT);/** - * React Router v6.30.3 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function lu(){return lu=Object.assign?Object.assign.bind():function(t){for(var e=1;e{c.current=!0}),y.useCallback(function(h,f){if(f===void 0&&(f={}),!c.current)return;if(typeof h=="number"){r.go(h);return}let m=O0(h,JSON.parse(o),i,f.relative==="path");t==null&&e!=="/"&&(m.pathname=m.pathname==="/"?e:Eo([e,m.pathname])),(f.replace?r.replace:r.push)(m,f.state,f)},[e,r,o,i,t])}const vT=y.createContext(null);function NT(t){let e=y.useContext(Di).outlet;return e&&y.createElement(vT.Provider,{value:t},e)}function Rj(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=y.useContext($o),{matches:a}=y.useContext(Di),{pathname:i}=Fo(),o=JSON.stringify(L0(a,r.v7_relativeSplatPath));return y.useMemo(()=>O0(t,JSON.parse(o),i,n==="path"),[t,o,i,n])}function wT(t,e){return jT(t,e)}function jT(t,e,n,r){Zc()||Kn(!1);let{navigator:a}=y.useContext($o),{matches:i}=y.useContext(Di),o=i[i.length-1],c=o?o.params:{};o&&o.pathname;let u=o?o.pathnameBase:"/";o&&o.route;let h=Fo(),f;if(e){var m;let N=typeof e=="string"?Xc(e):e;u==="/"||(m=N.pathname)!=null&&m.startsWith(u)||Kn(!1),f=N}else f=h;let x=f.pathname||"/",b=x;if(u!=="/"){let N=u.replace(/^\//,"").split("/");b="/"+x.replace(/^\//,"").split("/").slice(N.length).join("/")}let v=qE(t,{pathname:b}),w=TT(v&&v.map(N=>Object.assign({},N,{params:Object.assign({},c,N.params),pathname:Eo([u,a.encodeLocation?a.encodeLocation(N.pathname).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?u:Eo([u,a.encodeLocation?a.encodeLocation(N.pathnameBase).pathname:N.pathnameBase])})),i,n,r);return e&&w?y.createElement(vp.Provider,{value:{location:lu({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:No.Pop}},w):w}function kT(){let t=PT(),e=mT(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},e),n?y.createElement("pre",{style:a},n):null,null)}const ST=y.createElement(kT,null);class CT extends y.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?y.createElement(Di.Provider,{value:this.props.routeContext},y.createElement(Ij.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function ET(t){let{routeContext:e,match:n,children:r}=t,a=y.useContext(D0);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),y.createElement(Di.Provider,{value:e},r)}function TT(t,e,n,r){var a;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var i;if(!n)return null;if(n.errors)t=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,c=(a=n)==null?void 0:a.errors;if(c!=null){let f=o.findIndex(m=>m.route.id&&(c==null?void 0:c[m.route.id])!==void 0);f>=0||Kn(!1),o=o.slice(0,Math.min(o.length,f+1))}let u=!1,h=-1;if(n&&r&&r.v7_partialHydration)for(let f=0;f=0?o=o.slice(0,h+1):o=[o[0]];break}}}return o.reduceRight((f,m,x)=>{let b,v=!1,w=null,N=null;n&&(b=c&&m.route.id?c[m.route.id]:void 0,w=m.route.errorElement||ST,u&&(h<0&&x===0?(LT("route-fallback"),v=!0,N=null):h===x&&(v=!0,N=m.route.hydrateFallbackElement||null)));let k=e.concat(o.slice(0,x+1)),T=()=>{let C;return b?C=w:v?C=N:m.route.Component?C=y.createElement(m.route.Component,null):m.route.element?C=m.route.element:C=f,y.createElement(ET,{match:m,routeContext:{outlet:f,matches:k,isDataRoute:n!=null},children:C})};return n&&(m.route.ErrorBoundary||m.route.errorElement||x===0)?y.createElement(CT,{location:n.location,revalidation:n.revalidation,component:w,error:b,children:T(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):T()},null)}var Lj=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(Lj||{}),Oj=(function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t})(Oj||{});function MT(t){let e=y.useContext(D0);return e||Kn(!1),e}function AT(t){let e=y.useContext(gT);return e||Kn(!1),e}function IT(t){let e=y.useContext(Di);return e||Kn(!1),e}function Dj(t){let e=IT(),n=e.matches[e.matches.length-1];return n.route.id||Kn(!1),n.route.id}function PT(){var t;let e=y.useContext(Ij),n=AT(),r=Dj();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function RT(){let{router:t}=MT(Lj.UseNavigateStable),e=Dj(Oj.UseNavigateStable),n=y.useRef(!1);return Pj(()=>{n.current=!0}),y.useCallback(function(a,i){i===void 0&&(i={}),n.current&&(typeof a=="number"?t.navigate(a):t.navigate(a,lu({fromRouteId:e},i)))},[t,e])}const m1={};function LT(t,e,n){m1[t]||(m1[t]=!0)}function OT(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Ah(t){let{to:e,replace:n,state:r,relative:a}=t;Zc()||Kn(!1);let{future:i,static:o}=y.useContext($o),{matches:c}=y.useContext(Di),{pathname:u}=Fo(),h=Ga(),f=O0(e,L0(c,i.v7_relativeSplatPath),u,a==="path"),m=JSON.stringify(f);return y.useEffect(()=>h(JSON.parse(m),{replace:n,state:r,relative:a}),[h,m,a,n,r]),null}function DT(t){return NT(t.context)}function hn(t){Kn(!1)}function _T(t){let{basename:e="/",children:n=null,location:r,navigationType:a=No.Pop,navigator:i,static:o=!1,future:c}=t;Zc()&&Kn(!1);let u=e.replace(/^\/*/,"/"),h=y.useMemo(()=>({basename:u,navigator:i,static:o,future:lu({v7_relativeSplatPath:!1},c)}),[u,c,i,o]);typeof r=="string"&&(r=Xc(r));let{pathname:f="/",search:m="",hash:x="",state:b=null,key:v="default"}=r,w=y.useMemo(()=>{let N=R0(f,u);return N==null?null:{location:{pathname:N,search:m,hash:x,state:b,key:v},navigationType:a}},[u,f,m,x,b,v,a]);return w==null?null:y.createElement($o.Provider,{value:h},y.createElement(vp.Provider,{children:n,value:w}))}function zT(t){let{children:e,location:n}=t;return wT(wg(e),n)}new Promise(()=>{});function wg(t,e){e===void 0&&(e=[]);let n=[];return y.Children.forEach(t,(r,a)=>{if(!y.isValidElement(r))return;let i=[...e,a];if(r.type===y.Fragment){n.push.apply(n,wg(r.props.children,i));return}r.type!==hn&&Kn(!1),!r.props.index||!r.props.children||Kn(!1);let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=wg(r.props.children,i)),n.push(o)}),n}/** - * React Router DOM v6.30.3 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function jg(){return jg=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[a]=t[a]);return n}function FT(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function BT(t,e){return t.button===0&&(!e||e==="_self")&&!FT(t)}function kg(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(a=>[n,a]):[[n,r]])},[]))}function VT(t,e){let n=kg(t);return e&&e.forEach((r,a)=>{n.has(a)||e.getAll(a).forEach(i=>{n.append(a,i)})}),n}const HT=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],UT="6";try{window.__reactRouterVersion=UT}catch{}const WT="startTransition",x1=bp[WT];function KT(t){let{basename:e,children:n,future:r,window:a}=t,i=y.useRef();i.current==null&&(i.current=UE({window:a,v5Compat:!0}));let o=i.current,[c,u]=y.useState({action:o.action,location:o.location}),{v7_startTransition:h}=r||{},f=y.useCallback(m=>{h&&x1?x1(()=>u(m)):u(m)},[u,h]);return y.useLayoutEffect(()=>o.listen(f),[o,f]),y.useEffect(()=>OT(r),[r]),y.createElement(_T,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:o,future:r})}const qT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",GT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Fc=y.forwardRef(function(e,n){let{onClick:r,relative:a,reloadDocument:i,replace:o,state:c,target:u,to:h,preventScrollReset:f,viewTransition:m}=e,x=$T(e,HT),{basename:b}=y.useContext($o),v,w=!1;if(typeof h=="string"&>.test(h)&&(v=h,qT))try{let C=new URL(window.location.href),P=h.startsWith("//")?new URL(C.protocol+h):new URL(h),L=R0(P.pathname,b);P.origin===C.origin&&L!=null?h=L+P.search+P.hash:w=!0}catch{}let N=yT(h,{relative:a}),k=JT(h,{replace:o,state:c,target:u,preventScrollReset:f,relative:a,viewTransition:m});function T(C){r&&r(C),C.defaultPrevented||k(C)}return y.createElement("a",jg({},x,{href:v||N,onClick:w||i?r:T,ref:n,target:u}))});var g1;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(g1||(g1={}));var y1;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(y1||(y1={}));function JT(t,e){let{target:n,replace:r,state:a,preventScrollReset:i,relative:o,viewTransition:c}=e===void 0?{}:e,u=Ga(),h=Fo(),f=Rj(t,{relative:o});return y.useCallback(m=>{if(BT(m,n)){m.preventDefault();let x=r!==void 0?r:mf(h)===mf(f);u(t,{replace:x,state:a,preventScrollReset:i,relative:o,viewTransition:c})}},[h,u,f,r,a,n,t,i,o,c])}function _0(t){let e=y.useRef(kg(t)),n=y.useRef(!1),r=Fo(),a=y.useMemo(()=>VT(r.search,n.current?null:e.current),[r.search]),i=Ga(),o=y.useCallback((c,u)=>{const h=kg(typeof c=="function"?c(a):c);n.current=!0,i("?"+h,u)},[i,a]);return[a,o]}/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const QT=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),YT=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),b1=t=>{const e=YT(t);return e.charAt(0).toUpperCase()+e.slice(1)},_j=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),XT=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var ZT={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const e5=y.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:i,iconNode:o,...c},u)=>y.createElement("svg",{ref:u,...ZT,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:_j("lucide",a),...!i&&!XT(c)&&{"aria-hidden":"true"},...c},[...o.map(([h,f])=>y.createElement(h,f)),...Array.isArray(i)?i:[i]]));/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ie=(t,e)=>{const n=y.forwardRef(({className:r,...a},i)=>y.createElement(e5,{ref:i,iconNode:e,className:_j(`lucide-${QT(b1(t))}`,`lucide-${t}`,r),...a}));return n.displayName=b1(t),n};/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const t5=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],Sx=Ie("arrow-up-down",t5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const n5=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],s5=Ie("at-sign",n5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const r5=[["path",{d:"M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727",key:"yr8idg"}]],v1=Ie("bitcoin",r5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const a5=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],i5=Ie("bold",a5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const o5=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],wr=Ie("book-open",o5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const l5=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Sg=Ie("calendar",l5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const c5=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],Sc=Ie("chart-column",c5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const d5=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Np=Ie("check",d5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const u5=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Sl=Ie("chevron-down",u5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const h5=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],f5=Ie("chevron-left",h5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const p5=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ml=Ie("chevron-right",p5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const m5=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Cg=Ie("chevron-up",m5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const x5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],zj=Ie("circle-alert",x5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const g5=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Cx=Ie("circle-check-big",g5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const y5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],$j=Ie("circle-check",y5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const b5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Fj=Ie("circle-question-mark",b5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const v5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],Ih=Ie("circle-user",v5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const N5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Bj=Ie("circle-x",N5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const w5=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Eg=Ie("clock",w5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const j5=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],N1=Ie("cloud",j5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const k5=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],S5=Ie("code",k5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const C5=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Vj=Ie("copy",C5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const E5=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],w1=Ie("credit-card",E5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const T5=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],Oc=Ie("crown",T5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const M5=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],xf=Ie("dollar-sign",M5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const A5=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],I5=Ie("download",A5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const P5=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Pi=Ie("external-link",P5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const R5=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],L5=Ie("eye-off",R5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const O5=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],gf=Ie("eye",O5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const D5=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Hj=Ie("file-text",D5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _5=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Uj=Ie("funnel",_5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const z5=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],Tg=Ie("gift",z5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $5=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],F5=Ie("git-merge",$5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const B5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Mg=Ie("globe",B5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const V5=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],H5=Ie("graduation-cap",V5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const U5=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],gi=Ie("grip-vertical",U5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const W5=[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]],K5=Ie("handshake",W5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const q5=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],j1=Ie("hash",q5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const G5=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],J5=Ie("heading-1",G5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Q5=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],Y5=Ie("heading-2",Q5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const X5=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],Z5=Ie("heading-3",X5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const eM=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],tM=Ie("house",eM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Wj=Ie("image",nM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Ph=Ie("info",sM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const rM=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],aM=Ie("italic",rM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const iM=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],Ag=Ie("key",iM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oM=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],lM=Ie("layout-dashboard",oM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cM=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],dM=Ie("layout-grid",cM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const uM=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Ba=Ie("link-2",uM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hM=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],Ig=Ie("link",hM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fM=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],pM=Ie("list-ordered",fM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mM=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],xM=Ie("list",mM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gM=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],yM=Ie("lock",gM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bM=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],vM=Ie("log-out",bM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const NM=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],Kj=Ie("map-pin",NM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wM=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],jM=Ie("menu",wM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kM=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],SM=Ie("message-circle",kM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const CM=[["path",{d:"M5 12h14",key:"1ays0h"}]],EM=Ie("minus",CM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const TM=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],ya=Ie("navigation",TM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const MM=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],AM=Ie("palette",MM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const IM=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],PM=Ie("paperclip",IM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const RM=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],rn=Ie("pen-line",RM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const LM=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],k1=Ie("pencil",LM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const OM=[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]],DM=Ie("percent",OM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _M=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],S1=Ie("phone",_M);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zM=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],C1=Ie("pin",zM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $M=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Un=Ie("plus",$M);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const FM=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],E1=Ie("qr-code",FM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const BM=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],VM=Ie("quote",BM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const HM=[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]],UM=Ie("redo",HM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const WM=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Ve=Ie("refresh-cw",WM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const KM=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],In=Ie("save",KM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const qM=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],va=Ie("search",qM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const GM=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],JM=Ie("send",GM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const QM=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],wo=Ie("settings",QM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const YM=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Rh=Ie("settings-2",YM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const XM=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],ZM=Ie("share-2",XM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const eA=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Pc=Ie("shield-check",eA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const tA=[["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}],["path",{d:"M3.103 6.034h17.794",key:"awc11p"}],["path",{d:"M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z",key:"o988cm"}]],Gd=Ie("shopping-bag",tA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nA=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Cl=Ie("smartphone",nA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],rA=Ie("smile",sA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const aA=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],iA=Ie("sparkles",aA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oA=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],Rc=Ie("star",oA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lA=[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],cA=Ie("strikethrough",lA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dA=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],uA=Ie("table",dA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hA=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],Jd=Ie("tag",hA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fA=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Yn=Ie("trash-2",fA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pA=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],yf=Ie("trending-up",pA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mA=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],Pg=Ie("trophy",mA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const xA=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],qj=Ie("undo-2",xA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gA=[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]],yA=Ie("undo",gA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bA=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],bf=Ie("upload",bA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const vA=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],jo=Ie("user-plus",vA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const NA=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Ci=Ie("user",NA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wA=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Wn=Ie("users",wA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jA=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],kA=Ie("video",jA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const SA=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],Bc=Ie("wallet",SA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const CA=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],EA=Ie("wand-sparkles",CA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const TA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],rs=Ie("x",TA);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const MA=[["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"}]],Ri=Ie("zap",MA),z0="admin_token";function ku(){try{return localStorage.getItem(z0)}catch{return null}}function AA(t){try{localStorage.setItem(z0,t)}catch{}}function Ex(){try{localStorage.removeItem(z0)}catch{}}const IA="https://soulapi.quwanzhi.com",PA=15e3,T1=6e4,RA=()=>IA;function El(t){const e=RA(),n=t.startsWith("/")?t:`/${t}`;return e?`${e}${n}`:n}async function wp(t,e={}){const{data:n,...r}=e,a=El(t),i=new Headers(r.headers),o=ku();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=r.timeout??PA,h=new AbortController,f=setTimeout(()=>h.abort(),u),m=await fetch(a,{...r,headers:i,body:c,credentials:"include",signal:h.signal}).finally(()=>clearTimeout(f)),x=m.headers.get("Content-Type")||"";let b;if(x.includes("application/json"))try{b=await m.json()}catch{throw new Error(`API 响应解析失败 (${m.status})`)}else{const w=await m.text();throw new Error(`API 返回非 JSON 响应 (${m.status}): ${w.slice(0,100)}`)}const v=w=>{const N=w,k=((N==null?void 0:N.message)||(N==null?void 0:N.error)||"").toString();(k.includes("可提现金额不足")||k.includes("可提现不足")||k.includes("余额不足"))&&window.dispatchEvent(new CustomEvent("recharge-alert",{detail:k}))};if(!m.ok){v(b);const w=new Error((b==null?void 0:b.error)||`HTTP ${m.status}`);throw w.status=m.status,w.data=b,w}return v(b),b}function Oe(t,e){return wp(t,{...e,method:"GET"})}function jt(t,e,n){return wp(t,{...n,method:"POST",data:e})}function tn(t,e,n){return wp(t,{...n,method:"PUT",data:e})}function Ei(t,e){return wp(t,{...e,method:"DELETE"})}function LA(){const[t,e]=y.useState(!1),[n,r]=y.useState("");return y.useEffect(()=>{const a=i=>{const o=i.detail;r(o||"可提现/余额不足,请及时充值商户号"),e(!0)};return window.addEventListener("recharge-alert",a),()=>window.removeEventListener("recharge-alert",a)},[]),t?s.jsxs("div",{className:"flex items-center justify-between gap-4 px-4 py-3 bg-red-900/80 border-b border-red-600/50 text-red-100",role:"alert",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(zj,{className:"w-5 h-5 shrink-0 text-red-400"}),s.jsxs("span",{className:"text-sm font-medium",children:[n,s.jsx("span",{className:"ml-2 text-red-300",children:"请及时充值商户号或核对账户后重试。"})]})]}),s.jsx("button",{type:"button",onClick:()=>e(!1),className:"shrink-0 p-1 rounded hover:bg-red-800/50 transition-colors","aria-label":"关闭告警",children:s.jsx(rs,{className:"w-4 h-4"})})]}):null}const OA=[{icon:lM,label:"数据概览",href:"/dashboard"},{icon:wr,label:"内容管理",href:"/content"},{icon:Wn,label:"用户管理",href:"/users"},{icon:F5,label:"找伙伴",href:"/find-partner"},{icon:Bc,label:"推广中心",href:"/distribution"}];function DA(){const t=Fo(),e=Ga(),[n,r]=y.useState(!1),[a,i]=y.useState(!1);y.useEffect(()=>{r(!0)},[]),y.useEffect(()=>{if(!n)return;i(!1);let c=!1;if(!ku()){e("/login",{replace:!0});return}return Oe("/api/admin").then(u=>{c||(u&&u.success!==!1?i(!0):(Ex(),e("/login",{replace:!0,state:{from:t.pathname}})))}).catch(()=>{c||(Ex(),e("/login",{replace:!0,state:{from:t.pathname}}))}),()=>{c=!0}},[t.pathname,n,e]);const o=async()=>{Ex();try{await jt("/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.jsxs("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:[OA.map(c=>{const u=t.pathname===c.href;return s.jsxs(Fc,{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.jsx("div",{className:"pt-4 mt-4 border-t border-gray-700/50",children:s.jsxs(Fc,{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(wo,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"text-sm",children:"系统设置"})]})})]}),s.jsx("div",{className:"p-4 border-t border-gray-700/50 space-y-1",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(vM,{className:"w-5 h-5"}),s.jsx("span",{className:"text-sm",children:"退出登录"})]})})]}),s.jsxs("div",{className:"flex-1 overflow-auto bg-[#0a1628] min-w-0 flex flex-col",children:[s.jsx(LA,{}),s.jsx("div",{className:"w-full min-w-[1024px] min-h-full flex-1",children:s.jsx(DT,{})})]})]})}function M1(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function $0(...t){return e=>{let n=!1;const r=t.map(a=>{const i=M1(a,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a{let{children:i,...o}=r;Gj(i)&&typeof vf=="function"&&(i=vf(i._payload));const c=y.Children.toArray(i),u=c.find(BA);if(u){const h=u.props.children,f=c.map(m=>m===u?y.Children.count(h)>1?y.Children.only(null):y.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:a,children:y.isValidElement(h)?y.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:a,children:i})});return n.displayName=`${t}.Slot`,n}var Qj=Jj("Slot");function $A(t){const e=y.forwardRef((n,r)=>{let{children:a,...i}=n;if(Gj(a)&&typeof vf=="function"&&(a=vf(a._payload)),y.isValidElement(a)){const o=HA(a),c=VA(i,a.props);return a.type!==y.Fragment&&(c.ref=r?$0(r,o):o),y.cloneElement(a,c)}return y.Children.count(a)>1?y.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var FA=Symbol("radix.slottable");function BA(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===FA}function VA(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 HA(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 Yj(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,I1=Xj,Zj=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return I1(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 x=A1(f)||A1(m);return a[h][x]}),c=n&&Object.entries(n).reduce((h,f)=>{let[m,x]=f;return x===void 0||(h[m]=x),h},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,f)=>{let{class:m,className:x,...b}=f;return Object.entries(b).every(v=>{let[w,N]=v;return Array.isArray(N)?N.includes({...i,...c}[w]):{...i,...c}[w]===N})?[...h,m,x]:h},[]);return I1(t,o,u,n==null?void 0:n.class,n==null?void 0:n.className)},UA=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),ek=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),Nf="-",P1=[],KA="arbitrary..",qA=t=>{const e=JA(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return GA(o);const c=o.split(Nf),u=c[0]===""&&c.length>1?1:0;return tk(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=r[o],h=n[o];return u?h?UA(h,u):u:h||P1}return n[o]||P1}}},tk=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const a=t[e],i=n.nextPart.get(a);if(i){const h=tk(t,e+1,i);if(h)return h}const o=n.validators;if(o===null)return;const c=e===0?t.join(Nf):t.slice(e).join(Nf),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?KA+r:void 0})(),JA=t=>{const{theme:e,classGroups:n}=t;return QA(n,e)},QA=(t,e)=>{const n=ek();for(const r in t){const a=t[r];F0(a,n,r,e)}return n},F0=(t,e,n,r)=>{const a=t.length;for(let i=0;i{if(typeof t=="string"){XA(t,e,n);return}if(typeof t=="function"){ZA(t,e,n,r);return}eI(t,e,n,r)},XA=(t,e,n)=>{const r=t===""?e:nk(e,t);r.classGroupId=n},ZA=(t,e,n,r)=>{if(tI(t)){F0(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(WA(n,t))},eI=(t,e,n,r)=>{const a=Object.entries(t),i=a.length;for(let o=0;o{let n=t;const r=e.split(Nf),a=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,nI=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)}}},Rg="!",R1=":",sI=[],L1=(t,e,n,r,a)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),rI=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 L1(i,b,x,v)};if(e){const a=e+R1,i=r;r=o=>o.startsWith(a)?i(o.slice(a.length)):L1(sI,!1,o,void 0,!0)}if(n){const a=r;r=i=>n({className:i,parseClassName:a})}return r},aI=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}},iI=t=>({cache:nI(t.cacheSize),parseClassName:rI(t),sortModifiers:aI(t),...qA(t)}),oI=/\s+/,lI=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:i}=e,o=[],c=t.trim().split(oI);let u="";for(let h=c.length-1;h>=0;h-=1){const f=c[h],{isExternal:m,modifiers:x,hasImportantModifier:b,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 T=x.length===0?"":x.length===1?x[0]:i(x).join(":"),C=b?T+Rg:T,P=C+k;if(o.indexOf(P)>-1)continue;o.push(P);const L=a(k,N);for(let q=0;q0?" "+u:u)}return u},cI=(...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=iI(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=lI(u,n);return a(u,f),f};return i=o,(...u)=>i(cI(...u))},uI=[],ss=t=>{const e=n=>n[t]||uI;return e.isThemeGetter=!0,e},rk=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ak=/^\((?:(\w[\w-]*):)?(.+)\)$/i,hI=/^\d+\/\d+$/,fI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,pI=/\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$/,mI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,xI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,gI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,yc=t=>hI.test(t),Pt=t=>!!t&&!Number.isNaN(Number(t)),co=t=>!!t&&Number.isInteger(Number(t)),Tx=t=>t.endsWith("%")&&Pt(t.slice(0,-1)),yi=t=>fI.test(t),yI=()=>!0,bI=t=>pI.test(t)&&!mI.test(t),ik=()=>!1,vI=t=>xI.test(t),NI=t=>gI.test(t),wI=t=>!tt(t)&&!nt(t),jI=t=>ed(t,ck,ik),tt=t=>rk.test(t),dl=t=>ed(t,dk,bI),Mx=t=>ed(t,TI,Pt),O1=t=>ed(t,ok,ik),kI=t=>ed(t,lk,NI),Lh=t=>ed(t,uk,vI),nt=t=>ak.test(t),Dd=t=>td(t,dk),SI=t=>td(t,MI),D1=t=>td(t,ok),CI=t=>td(t,ck),EI=t=>td(t,lk),Oh=t=>td(t,uk,!0),ed=(t,e,n)=>{const r=rk.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},td=(t,e,n=!1)=>{const r=ak.exec(t);return r?r[1]?e(r[1]):n:!1},ok=t=>t==="position"||t==="percentage",lk=t=>t==="image"||t==="url",ck=t=>t==="length"||t==="size"||t==="bg-size",dk=t=>t==="length",TI=t=>t==="number",MI=t=>t==="family-name",uk=t=>t==="shadow",AI=()=>{const t=ss("color"),e=ss("font"),n=ss("text"),r=ss("font-weight"),a=ss("tracking"),i=ss("leading"),o=ss("breakpoint"),c=ss("container"),u=ss("spacing"),h=ss("radius"),f=ss("shadow"),m=ss("inset-shadow"),x=ss("text-shadow"),b=ss("drop-shadow"),v=ss("blur"),w=ss("perspective"),N=ss("aspect"),k=ss("ease"),T=ss("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...P(),nt,tt],q=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto","contain","none"],H=()=>[nt,tt,u],R=()=>[yc,"full","auto",...H()],se=()=>[co,"none","subgrid",nt,tt],X=()=>["auto",{span:["full",co,nt,tt]},co,nt,tt],V=()=>[co,"auto",nt,tt],ie=()=>["auto","min","max","fr",nt,tt],le=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],he=()=>["start","end","center","stretch","center-safe","end-safe"],I=()=>["auto",...H()],Q=()=>[yc,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...H()],$=()=>[t,nt,tt],xe=()=>[...P(),D1,O1,{position:[nt,tt]}],Z=()=>["no-repeat",{repeat:["","x","y","space","round"]}],F=()=>["auto","cover","contain",CI,jI,{size:[nt,tt]}],U=()=>[Tx,Dd,dl],pe=()=>["","none","full",h,nt,tt],fe=()=>["",Pt,Dd,dl],oe=()=>["solid","dashed","dotted","double"],D=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>[Pt,Tx,D1,O1],_=()=>["","none",v,nt,tt],Y=()=>["none",Pt,nt,tt],te=()=>["none",Pt,nt,tt],Ne=()=>[Pt,nt,tt],Fe=()=>[yc,"full",...H()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[yi],breakpoint:[yi],color:[yI],container:[yi],"drop-shadow":[yi],ease:["in","out","in-out"],font:[wI],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[yi],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[yi],shadow:[yi],spacing:["px",Pt],text:[yi],"text-shadow":[yi],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",yc,tt,nt,N]}],container:["container"],columns:[{columns:[Pt,tt,nt,c]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:L()}],overflow:[{overflow:q()}],"overflow-x":[{"overflow-x":q()}],"overflow-y":[{"overflow-y":q()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:R()}],"inset-x":[{"inset-x":R()}],"inset-y":[{"inset-y":R()}],start:[{start:R()}],end:[{end:R()}],top:[{top:R()}],right:[{right:R()}],bottom:[{bottom:R()}],left:[{left:R()}],visibility:["visible","invisible","collapse"],z:[{z:[co,"auto",nt,tt]}],basis:[{basis:[yc,"full","auto",c,...H()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Pt,yc,"auto","initial","none",tt]}],grow:[{grow:["",Pt,nt,tt]}],shrink:[{shrink:["",Pt,nt,tt]}],order:[{order:[co,"first","last","none",nt,tt]}],"grid-cols":[{"grid-cols":se()}],"col-start-end":[{col:X()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":se()}],"row-start-end":[{row:X()}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ie()}],"auto-rows":[{"auto-rows":ie()}],gap:[{gap:H()}],"gap-x":[{"gap-x":H()}],"gap-y":[{"gap-y":H()}],"justify-content":[{justify:[...le(),"normal"]}],"justify-items":[{"justify-items":[...he(),"normal"]}],"justify-self":[{"justify-self":["auto",...he()]}],"align-content":[{content:["normal",...le()]}],"align-items":[{items:[...he(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...he(),{baseline:["","last"]}]}],"place-content":[{"place-content":le()}],"place-items":[{"place-items":[...he(),"baseline"]}],"place-self":[{"place-self":["auto",...he()]}],p:[{p:H()}],px:[{px:H()}],py:[{py:H()}],ps:[{ps:H()}],pe:[{pe:H()}],pt:[{pt:H()}],pr:[{pr:H()}],pb:[{pb:H()}],pl:[{pl:H()}],m:[{m:I()}],mx:[{mx:I()}],my:[{my:I()}],ms:[{ms:I()}],me:[{me:I()}],mt:[{mt:I()}],mr:[{mr:I()}],mb:[{mb:I()}],ml:[{ml:I()}],"space-x":[{"space-x":H()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":H()}],"space-y-reverse":["space-y-reverse"],size:[{size:Q()}],w:[{w:[c,"screen",...Q()]}],"min-w":[{"min-w":[c,"screen","none",...Q()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...Q()]}],h:[{h:["screen","lh",...Q()]}],"min-h":[{"min-h":["screen","lh","none",...Q()]}],"max-h":[{"max-h":["screen","lh",...Q()]}],"font-size":[{text:["base",n,Dd,dl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,nt,Mx]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Tx,tt]}],"font-family":[{font:[SI,tt,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,nt,tt]}],"line-clamp":[{"line-clamp":[Pt,"none",nt,Mx]}],leading:[{leading:[i,...H()]}],"list-image":[{"list-image":["none",nt,tt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",nt,tt]}],"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:[Pt,"from-font","auto",nt,dl]}],"text-decoration-color":[{decoration:$()}],"underline-offset":[{"underline-offset":[Pt,"auto",nt,tt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:H()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",nt,tt]}],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",nt,tt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:xe()}],"bg-repeat":[{bg:Z()}],"bg-size":[{bg:F()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},co,nt,tt],radial:["",nt,tt],conic:[co,nt,tt]},EI,kI]}],"bg-color":[{bg:$()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:$()}],"gradient-via":[{via:$()}],"gradient-to":[{to:$()}],rounded:[{rounded:pe()}],"rounded-s":[{"rounded-s":pe()}],"rounded-e":[{"rounded-e":pe()}],"rounded-t":[{"rounded-t":pe()}],"rounded-r":[{"rounded-r":pe()}],"rounded-b":[{"rounded-b":pe()}],"rounded-l":[{"rounded-l":pe()}],"rounded-ss":[{"rounded-ss":pe()}],"rounded-se":[{"rounded-se":pe()}],"rounded-ee":[{"rounded-ee":pe()}],"rounded-es":[{"rounded-es":pe()}],"rounded-tl":[{"rounded-tl":pe()}],"rounded-tr":[{"rounded-tr":pe()}],"rounded-br":[{"rounded-br":pe()}],"rounded-bl":[{"rounded-bl":pe()}],"border-w":[{border:fe()}],"border-w-x":[{"border-x":fe()}],"border-w-y":[{"border-y":fe()}],"border-w-s":[{"border-s":fe()}],"border-w-e":[{"border-e":fe()}],"border-w-t":[{"border-t":fe()}],"border-w-r":[{"border-r":fe()}],"border-w-b":[{"border-b":fe()}],"border-w-l":[{"border-l":fe()}],"divide-x":[{"divide-x":fe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":fe()}],"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":[Pt,nt,tt]}],"outline-w":[{outline:["",Pt,Dd,dl]}],"outline-color":[{outline:$()}],shadow:[{shadow:["","none",f,Oh,Lh]}],"shadow-color":[{shadow:$()}],"inset-shadow":[{"inset-shadow":["none",m,Oh,Lh]}],"inset-shadow-color":[{"inset-shadow":$()}],"ring-w":[{ring:fe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:$()}],"ring-offset-w":[{"ring-offset":[Pt,dl]}],"ring-offset-color":[{"ring-offset":$()}],"inset-ring-w":[{"inset-ring":fe()}],"inset-ring-color":[{"inset-ring":$()}],"text-shadow":[{"text-shadow":["none",x,Oh,Lh]}],"text-shadow-color":[{"text-shadow":$()}],opacity:[{opacity:[Pt,nt,tt]}],"mix-blend":[{"mix-blend":[...D(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":D()}],"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":[Pt]}],"mask-image-linear-from-pos":[{"mask-linear-from":K()}],"mask-image-linear-to-pos":[{"mask-linear-to":K()}],"mask-image-linear-from-color":[{"mask-linear-from":$()}],"mask-image-linear-to-color":[{"mask-linear-to":$()}],"mask-image-t-from-pos":[{"mask-t-from":K()}],"mask-image-t-to-pos":[{"mask-t-to":K()}],"mask-image-t-from-color":[{"mask-t-from":$()}],"mask-image-t-to-color":[{"mask-t-to":$()}],"mask-image-r-from-pos":[{"mask-r-from":K()}],"mask-image-r-to-pos":[{"mask-r-to":K()}],"mask-image-r-from-color":[{"mask-r-from":$()}],"mask-image-r-to-color":[{"mask-r-to":$()}],"mask-image-b-from-pos":[{"mask-b-from":K()}],"mask-image-b-to-pos":[{"mask-b-to":K()}],"mask-image-b-from-color":[{"mask-b-from":$()}],"mask-image-b-to-color":[{"mask-b-to":$()}],"mask-image-l-from-pos":[{"mask-l-from":K()}],"mask-image-l-to-pos":[{"mask-l-to":K()}],"mask-image-l-from-color":[{"mask-l-from":$()}],"mask-image-l-to-color":[{"mask-l-to":$()}],"mask-image-x-from-pos":[{"mask-x-from":K()}],"mask-image-x-to-pos":[{"mask-x-to":K()}],"mask-image-x-from-color":[{"mask-x-from":$()}],"mask-image-x-to-color":[{"mask-x-to":$()}],"mask-image-y-from-pos":[{"mask-y-from":K()}],"mask-image-y-to-pos":[{"mask-y-to":K()}],"mask-image-y-from-color":[{"mask-y-from":$()}],"mask-image-y-to-color":[{"mask-y-to":$()}],"mask-image-radial":[{"mask-radial":[nt,tt]}],"mask-image-radial-from-pos":[{"mask-radial-from":K()}],"mask-image-radial-to-pos":[{"mask-radial-to":K()}],"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":P()}],"mask-image-conic-pos":[{"mask-conic":[Pt]}],"mask-image-conic-from-pos":[{"mask-conic-from":K()}],"mask-image-conic-to-pos":[{"mask-conic-to":K()}],"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:xe()}],"mask-repeat":[{mask:Z()}],"mask-size":[{mask:F()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",nt,tt]}],filter:[{filter:["","none",nt,tt]}],blur:[{blur:_()}],brightness:[{brightness:[Pt,nt,tt]}],contrast:[{contrast:[Pt,nt,tt]}],"drop-shadow":[{"drop-shadow":["","none",b,Oh,Lh]}],"drop-shadow-color":[{"drop-shadow":$()}],grayscale:[{grayscale:["",Pt,nt,tt]}],"hue-rotate":[{"hue-rotate":[Pt,nt,tt]}],invert:[{invert:["",Pt,nt,tt]}],saturate:[{saturate:[Pt,nt,tt]}],sepia:[{sepia:["",Pt,nt,tt]}],"backdrop-filter":[{"backdrop-filter":["","none",nt,tt]}],"backdrop-blur":[{"backdrop-blur":_()}],"backdrop-brightness":[{"backdrop-brightness":[Pt,nt,tt]}],"backdrop-contrast":[{"backdrop-contrast":[Pt,nt,tt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Pt,nt,tt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Pt,nt,tt]}],"backdrop-invert":[{"backdrop-invert":["",Pt,nt,tt]}],"backdrop-opacity":[{"backdrop-opacity":[Pt,nt,tt]}],"backdrop-saturate":[{"backdrop-saturate":[Pt,nt,tt]}],"backdrop-sepia":[{"backdrop-sepia":["",Pt,nt,tt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":H()}],"border-spacing-x":[{"border-spacing-x":H()}],"border-spacing-y":[{"border-spacing-y":H()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",nt,tt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Pt,"initial",nt,tt]}],ease:[{ease:["linear","initial",k,nt,tt]}],delay:[{delay:[Pt,nt,tt]}],animate:[{animate:["none",T,nt,tt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,nt,tt]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:Y()}],"rotate-x":[{"rotate-x":Y()}],"rotate-y":[{"rotate-y":Y()}],"rotate-z":[{"rotate-z":Y()}],scale:[{scale:te()}],"scale-x":[{"scale-x":te()}],"scale-y":[{"scale-y":te()}],"scale-z":[{"scale-z":te()}],"scale-3d":["scale-3d"],skew:[{skew:Ne()}],"skew-x":[{"skew-x":Ne()}],"skew-y":[{"skew-y":Ne()}],transform:[{transform:[nt,tt,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Fe()}],"translate-x":[{"translate-x":Fe()}],"translate-y":[{"translate-y":Fe()}],"translate-z":[{"translate-z":Fe()}],"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",nt,tt]}],"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":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"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",nt,tt]}],fill:[{fill:["none",...$()]}],"stroke-w":[{stroke:[Pt,Dd,dl,Mx]}],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=dI(AI);function $t(...t){return II(Xj(t))}function Ua(t){if(!t)return"";let e=t.trim();return e?(e=e.replace(/^(https?)\/\//,"$1://"),e):""}const PI=Zj("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 J({className:t,variant:e,size:n,asChild:r=!1,...a}){const i=r?Qj:"button";return s.jsx(i,{"data-slot":"button",className:$t(PI({variant:e,size:n,className:t})),...a})}function ce({className:t,type:e,...n}){return s.jsx("input",{type:e,"data-slot":"input",className:$t("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 RI(){const t=Ga(),[e,n]=y.useState(""),[r,a]=y.useState(""),[i,o]=y.useState(""),[c,u]=y.useState(!1);y.useEffect(()=>{ku()&&t("/dashboard",{replace:!0})},[t]);const h=async()=>{o(""),u(!0);try{const f=await jt("/api/admin",{username:e.trim(),password:r});if((f==null?void 0:f.success)!==!1&&(f!=null&&f.token)){AA(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(Pc,{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(Ci,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(ce,{type:"text",value:e,onChange:f=>{n(f.target.value),i&&o("")},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(yM,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(ce,{type:"password",value:r,onChange:f=>{a(f.target.value),i&&o("")},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(J,{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 _e=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:$t("rounded-xl border bg-card text-card-foreground shadow",t),...e}));_e.displayName="Card";const ft=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:$t("flex flex-col space-y-1.5 p-6",t),...e}));ft.displayName="CardHeader";const pt=y.forwardRef(({className:t,...e},n)=>s.jsx("h3",{ref:n,className:$t("font-semibold leading-none tracking-tight",t),...e}));pt.displayName="CardTitle";const nn=y.forwardRef(({className:t,...e},n)=>s.jsx("p",{ref:n,className:$t("text-sm text-muted-foreground",t),...e}));nn.displayName="CardDescription";const ze=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:$t("p-6 pt-0",t),...e}));ze.displayName="CardContent";const LI=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:$t("flex items-center p-6 pt-0",t),...e}));LI.displayName="CardFooter";const OI={success:{bg:"#f0fdf4",border:"#22c55e",icon:"✓"},error:{bg:"#fef2f2",border:"#ef4444",icon:"✕"},info:{bg:"#eff6ff",border:"#3b82f6",icon:"ℹ"}};function Ax(t,e="info",n=3e3){const r=`toast-${Date.now()}`,a=OI[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 x;return(x=m.parentNode)==null?void 0:x.removeChild(m)},250))}}const G={success:(t,e)=>Ax(t,"success",e),error:(t,e)=>Ax(t,"error",e),info:(t,e)=>Ax(t,"info",e)};function Tt(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 DI(t,e){const n=y.createContext(e),r=i=>{const{children:o,...c}=i,u=y.useMemo(()=>c,Object.values(c));return s.jsx(n.Provider,{value:u,children:o})};r.displayName=t+"Provider";function a(i){const o=y.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 Bo(t,e=[]){let n=[];function r(i,o){const c=y.createContext(o),u=n.length;n=[...n,o];const h=m=>{var k;const{scope:x,children:b,...v}=m,w=((k=x==null?void 0:x[t])==null?void 0:k[u])||c,N=y.useMemo(()=>v,Object.values(v));return s.jsx(w.Provider,{value:N,children:b})};h.displayName=i+"Provider";function f(m,x){var w;const b=((w=x==null?void 0:x[t])==null?void 0:w[u])||c,v=y.useContext(b);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=>y.createContext(o));return function(c){const u=(c==null?void 0:c[t])||i;return y.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])}};return a.scopeName=t,[r,_I(a,...e)]}function _I(...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 y.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var Ws=globalThis!=null&&globalThis.document?y.useLayoutEffect:()=>{},zI=bp[" useId ".trim().toString()]||(()=>{}),$I=0;function To(t){const[e,n]=y.useState(zI());return Ws(()=>{n(r=>r??String($I++))},[t]),e?`radix-${e}`:""}var FI=bp[" useInsertionEffect ".trim().toString()]||Ws;function Tl({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[a,i,o]=BI({defaultProp:e,onChange:n}),c=t!==void 0,u=c?t:a;{const f=y.useRef(t!==void 0);y.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=y.useCallback(f=>{var m;if(c){const x=VI(f)?f(t):f;x!==t&&((m=o.current)==null||m.call(o,x))}else i(f)},[c,t,i,o]);return[u,h]}function BI({defaultProp:t,onChange:e}){const[n,r]=y.useState(t),a=y.useRef(n),i=y.useRef(e);return FI(()=>{i.current=e},[e]),y.useEffect(()=>{var o;a.current!==n&&((o=i.current)==null||o.call(i,n),a.current=n)},[n,a]),[n,r,i]}function VI(t){return typeof t=="function"}function cu(t){const e=HI(t),n=y.forwardRef((r,a)=>{const{children:i,...o}=r,c=y.Children.toArray(i),u=c.find(WI);if(u){const h=u.props.children,f=c.map(m=>m===u?y.Children.count(h)>1?y.Children.only(null):y.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:a,children:y.isValidElement(h)?y.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:a,children:i})});return n.displayName=`${t}.Slot`,n}function HI(t){const e=y.forwardRef((n,r)=>{const{children:a,...i}=n;if(y.isValidElement(a)){const o=qI(a),c=KI(i,a.props);return a.type!==y.Fragment&&(c.ref=r?$0(r,o):o),y.cloneElement(a,c)}return y.Children.count(a)>1?y.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var UI=Symbol("radix.slottable");function WI(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===UI}function KI(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 qI(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 GI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Rt=GI.reduce((t,e)=>{const n=cu(`Primitive.${e}`),r=y.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 JI(t,e){t&&Yc.flushSync(()=>t.dispatchEvent(e))}function Ro(t){const e=y.useRef(t);return y.useEffect(()=>{e.current=t}),y.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function QI(t,e=globalThis==null?void 0:globalThis.document){const n=Ro(t);y.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 YI="DismissableLayer",Lg="dismissableLayer.update",XI="dismissableLayer.pointerDownOutside",ZI="dismissableLayer.focusOutside",_1,hk=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),B0=y.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,onDismiss:c,...u}=t,h=y.useContext(hk),[f,m]=y.useState(null),x=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=y.useState({}),v=Zt(e,z=>m(z)),w=Array.from(h.layers),[N]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),k=w.indexOf(N),T=f?w.indexOf(f):-1,C=h.layersWithOutsidePointerEventsDisabled.size>0,P=T>=k,L=nP(z=>{const H=z.target,R=[...h.branches].some(se=>se.contains(H));!P||R||(a==null||a(z),o==null||o(z),z.defaultPrevented||c==null||c())},x),q=sP(z=>{const H=z.target;[...h.branches].some(se=>se.contains(H))||(i==null||i(z),o==null||o(z),z.defaultPrevented||c==null||c())},x);return QI(z=>{T===h.layers.size-1&&(r==null||r(z),!z.defaultPrevented&&c&&(z.preventDefault(),c()))},x),y.useEffect(()=>{if(f)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(_1=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),z1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=_1)}},[f,x,n,h]),y.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),z1())},[f,h]),y.useEffect(()=>{const z=()=>b({});return document.addEventListener(Lg,z),()=>document.removeEventListener(Lg,z)},[]),s.jsx(Rt.div,{...u,ref:v,style:{pointerEvents:C?P?"auto":"none":void 0,...t.style},onFocusCapture:Tt(t.onFocusCapture,q.onFocusCapture),onBlurCapture:Tt(t.onBlurCapture,q.onBlurCapture),onPointerDownCapture:Tt(t.onPointerDownCapture,L.onPointerDownCapture)})});B0.displayName=YI;var eP="DismissableLayerBranch",tP=y.forwardRef((t,e)=>{const n=y.useContext(hk),r=y.useRef(null),a=Zt(e,r);return y.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),s.jsx(Rt.div,{...t,ref:a})});tP.displayName=eP;function nP(t,e=globalThis==null?void 0:globalThis.document){const n=Ro(t),r=y.useRef(!1),a=y.useRef(()=>{});return y.useEffect(()=>{const i=c=>{if(c.target&&!r.current){let u=function(){fk(XI,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 sP(t,e=globalThis==null?void 0:globalThis.document){const n=Ro(t),r=y.useRef(!1);return y.useEffect(()=>{const a=i=>{i.target&&!r.current&&fk(ZI,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 z1(){const t=new CustomEvent(Lg);document.dispatchEvent(t)}function fk(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?JI(a,i):a.dispatchEvent(i)}var Ix="focusScope.autoFocusOnMount",Px="focusScope.autoFocusOnUnmount",$1={bubbles:!1,cancelable:!0},rP="FocusScope",V0=y.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=t,[c,u]=y.useState(null),h=Ro(a),f=Ro(i),m=y.useRef(null),x=Zt(e,w=>u(w)),b=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let w=function(C){if(b.paused||!c)return;const P=C.target;c.contains(P)?m.current=P:fo(m.current,{select:!0})},N=function(C){if(b.paused||!c)return;const P=C.relatedTarget;P!==null&&(c.contains(P)||fo(m.current,{select:!0}))},k=function(C){if(document.activeElement===document.body)for(const L of C)L.removedNodes.length>0&&fo(c)};document.addEventListener("focusin",w),document.addEventListener("focusout",N);const T=new MutationObserver(k);return c&&T.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",N),T.disconnect()}}},[r,c,b.paused]),y.useEffect(()=>{if(c){B1.add(b);const w=document.activeElement;if(!c.contains(w)){const k=new CustomEvent(Ix,$1);c.addEventListener(Ix,h),c.dispatchEvent(k),k.defaultPrevented||(aP(dP(pk(c)),{select:!0}),document.activeElement===w&&fo(c))}return()=>{c.removeEventListener(Ix,h),setTimeout(()=>{const k=new CustomEvent(Px,$1);c.addEventListener(Px,f),c.dispatchEvent(k),k.defaultPrevented||fo(w??document.body,{select:!0}),c.removeEventListener(Px,f),B1.remove(b)},0)}}},[c,h,f,b]);const v=y.useCallback(w=>{if(!n&&!r||b.paused)return;const N=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,k=document.activeElement;if(N&&k){const T=w.currentTarget,[C,P]=iP(T);C&&P?!w.shiftKey&&k===P?(w.preventDefault(),n&&fo(C,{select:!0})):w.shiftKey&&k===C&&(w.preventDefault(),n&&fo(P,{select:!0})):k===T&&w.preventDefault()}},[n,r,b.paused]);return s.jsx(Rt.div,{tabIndex:-1,...o,ref:x,onKeyDown:v})});V0.displayName=rP;function aP(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(fo(r,{select:e}),document.activeElement!==n)return}function iP(t){const e=pk(t),n=F1(e,t),r=F1(e.reverse(),t);return[n,r]}function pk(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 F1(t,e){for(const n of t)if(!oP(n,{upTo:e}))return n}function oP(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 lP(t){return t instanceof HTMLInputElement&&"select"in t}function fo(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&lP(t)&&e&&t.select()}}var B1=cP();function cP(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=V1(t,e),t.unshift(e)},remove(e){var n;t=V1(t,e),(n=t[0])==null||n.resume()}}}function V1(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function dP(t){return t.filter(e=>e.tagName!=="A")}var uP="Portal",H0=y.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[a,i]=y.useState(!1);Ws(()=>i(!0),[]);const o=n||a&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return o?Ej.createPortal(s.jsx(Rt.div,{...r,ref:e}),o):null});H0.displayName=uP;function hP(t,e){return y.useReducer((n,r)=>e[n][r]??n,t)}var Su=t=>{const{present:e,children:n}=t,r=fP(e),a=typeof n=="function"?n({present:r.isPresent}):y.Children.only(n),i=Zt(r.ref,pP(a));return typeof n=="function"||r.isPresent?y.cloneElement(a,{ref:i}):null};Su.displayName="Presence";function fP(t){const[e,n]=y.useState(),r=y.useRef(null),a=y.useRef(t),i=y.useRef("none"),o=t?"mounted":"unmounted",[c,u]=hP(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const h=Dh(r.current);i.current=c==="mounted"?h:"none"},[c]),Ws(()=>{const h=r.current,f=a.current;if(f!==t){const x=i.current,b=Dh(h);t?u("MOUNT"):b==="none"||(h==null?void 0:h.display)==="none"?u("UNMOUNT"):u(f&&x!==b?"ANIMATION_OUT":"UNMOUNT"),a.current=t}},[t,u]),Ws(()=>{if(e){let h;const f=e.ownerDocument.defaultView??window,m=b=>{const w=Dh(r.current).includes(CSS.escape(b.animationName));if(b.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)})}},x=b=>{b.target===e&&(i.current=Dh(r.current))};return e.addEventListener("animationstart",x),e.addEventListener("animationcancel",m),e.addEventListener("animationend",m),()=>{f.clearTimeout(h),e.removeEventListener("animationstart",x),e.removeEventListener("animationcancel",m),e.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:y.useCallback(h=>{r.current=h?getComputedStyle(h):null,n(h)},[])}}function Dh(t){return(t==null?void 0:t.animationName)||"none"}function pP(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 Rx=0;function mk(){y.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??H1()),document.body.insertAdjacentElement("beforeend",t[1]??H1()),Rx++,()=>{Rx===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Rx--}},[])}function H1(){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 Fa=function(){return Fa=Object.assign||function(e){for(var n,r=1,a=arguments.length;r"u")return IP;var e=PP(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])}},LP=bk(),Dc="data-scroll-locked",OP=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(xP,` { - overflow: hidden `).concat(r,`; - padding-right: `).concat(c,"px ").concat(r,`; - } - body[`).concat(Dc,`] { - overflow: hidden `).concat(r,`; - overscroll-behavior: contain; - `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&` - padding-left: `.concat(a,`px; - padding-top: `).concat(i,`px; - padding-right: `).concat(o,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(c,"px ").concat(r,`; - `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),` - } - - .`).concat(rf,` { - right: `).concat(c,"px ").concat(r,`; - } - - .`).concat(af,` { - margin-right: `).concat(c,"px ").concat(r,`; - } - - .`).concat(rf," .").concat(rf,` { - right: 0 `).concat(r,`; - } - - .`).concat(af," .").concat(af,` { - margin-right: 0 `).concat(r,`; - } - - body[`).concat(Dc,`] { - `).concat(gP,": ").concat(c,`px; - } -`)},W1=function(){var t=parseInt(document.body.getAttribute(Dc)||"0",10);return isFinite(t)?t:0},DP=function(){y.useEffect(function(){return document.body.setAttribute(Dc,(W1()+1).toString()),function(){var t=W1()-1;t<=0?document.body.removeAttribute(Dc):document.body.setAttribute(Dc,t.toString())}},[])},_P=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,a=r===void 0?"margin":r;DP();var i=y.useMemo(function(){return RP(a)},[a]);return y.createElement(LP,{styles:OP(i,!e,a,n?"":"!important")})},Og=!1;if(typeof window<"u")try{var _h=Object.defineProperty({},"passive",{get:function(){return Og=!0,!0}});window.addEventListener("test",_h,_h),window.removeEventListener("test",_h,_h)}catch{Og=!1}var bc=Og?{passive:!1}:!1,zP=function(t){return t.tagName==="TEXTAREA"},vk=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!zP(t)&&n[e]==="visible")},$P=function(t){return vk(t,"overflowY")},FP=function(t){return vk(t,"overflowX")},K1=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=Nk(t,r);if(a){var i=wk(t,r),o=i[1],c=i[2];if(o>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},BP=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},VP=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},Nk=function(t,e){return t==="v"?$P(e):FP(e)},wk=function(t,e){return t==="v"?BP(e):VP(e)},HP=function(t,e){return t==="h"&&e==="rtl"?-1:1},UP=function(t,e,n,r,a){var i=HP(t,window.getComputedStyle(e).direction),o=i*r,c=n.target,u=e.contains(c),h=!1,f=o>0,m=0,x=0;do{if(!c)break;var b=wk(t,c),v=b[0],w=b[1],N=b[2],k=w-N-i*v;(v||k)&&Nk(t,c)&&(m+=k,x+=v);var T=c.parentNode;c=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!u&&c!==document.body||u&&(e.contains(c)||e===c));return(f&&Math.abs(m)<1||!f&&Math.abs(x)<1)&&(h=!0),h},zh=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},q1=function(t){return[t.deltaX,t.deltaY]},G1=function(t){return t&&"current"in t?t.current:t},WP=function(t,e){return t[0]===e[0]&&t[1]===e[1]},KP=function(t){return` - .block-interactivity-`.concat(t,` {pointer-events: none;} - .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},qP=0,vc=[];function GP(t){var e=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),a=y.useState(qP++)[0],i=y.useState(bk)[0],o=y.useRef(t);y.useEffect(function(){o.current=t},[t]),y.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(a));var w=mP([t.lockRef.current],(t.shards||[]).map(G1),!0).filter(Boolean);return w.forEach(function(N){return N.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),w.forEach(function(N){return N.classList.remove("allow-interactivity-".concat(a))})}}},[t.inert,t.lockRef.current,t.shards]);var c=y.useCallback(function(w,N){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!o.current.allowPinchZoom;var k=zh(w),T=n.current,C="deltaX"in w?w.deltaX:T[0]-k[0],P="deltaY"in w?w.deltaY:T[1]-k[1],L,q=w.target,z=Math.abs(C)>Math.abs(P)?"h":"v";if("touches"in w&&z==="h"&&q.type==="range")return!1;var H=window.getSelection(),R=H&&H.anchorNode,se=R?R===q||R.contains(q):!1;if(se)return!1;var X=K1(z,q);if(!X)return!0;if(X?L=z:(L=z==="v"?"h":"v",X=K1(z,q)),!X)return!1;if(!r.current&&"changedTouches"in w&&(C||P)&&(r.current=L),!L)return!0;var V=r.current||L;return UP(V,N,w,V==="h"?C:P)},[]),u=y.useCallback(function(w){var N=w;if(!(!vc.length||vc[vc.length-1]!==i)){var k="deltaY"in N?q1(N):zh(N),T=e.current.filter(function(L){return L.name===N.type&&(L.target===N.target||N.target===L.shadowParent)&&WP(L.delta,k)})[0];if(T&&T.should){N.cancelable&&N.preventDefault();return}if(!T){var C=(o.current.shards||[]).map(G1).filter(Boolean).filter(function(L){return L.contains(N.target)}),P=C.length>0?c(N,C[0]):!o.current.noIsolation;P&&N.cancelable&&N.preventDefault()}}},[]),h=y.useCallback(function(w,N,k,T){var C={name:w,delta:N,target:k,should:T,shadowParent:JP(k)};e.current.push(C),setTimeout(function(){e.current=e.current.filter(function(P){return P!==C})},1)},[]),f=y.useCallback(function(w){n.current=zh(w),r.current=void 0},[]),m=y.useCallback(function(w){h(w.type,q1(w),w.target,c(w,t.lockRef.current))},[]),x=y.useCallback(function(w){h(w.type,zh(w),w.target,c(w,t.lockRef.current))},[]);y.useEffect(function(){return vc.push(i),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:x}),document.addEventListener("wheel",u,bc),document.addEventListener("touchmove",u,bc),document.addEventListener("touchstart",f,bc),function(){vc=vc.filter(function(w){return w!==i}),document.removeEventListener("wheel",u,bc),document.removeEventListener("touchmove",u,bc),document.removeEventListener("touchstart",f,bc)}},[]);var b=t.removeScrollBar,v=t.inert;return y.createElement(y.Fragment,null,v?y.createElement(i,{styles:KP(a)}):null,b?y.createElement(_P,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function JP(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const QP=kP(yk,GP);var U0=y.forwardRef(function(t,e){return y.createElement(jp,Fa({},t,{ref:e,sideCar:QP}))});U0.classNames=jp.classNames;var YP=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Nc=new WeakMap,$h=new WeakMap,Fh={},_x=0,jk=function(t){return t&&(t.host||jk(t.parentNode))},XP=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=jk(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},ZP=function(t,e,n,r){var a=XP(e,Array.isArray(t)?t:[t]);Fh[n]||(Fh[n]=new WeakMap);var i=Fh[n],o=[],c=new Set,u=new Set(a),h=function(m){!m||c.has(m)||(c.add(m),h(m.parentNode))};a.forEach(h);var f=function(m){!m||u.has(m)||Array.prototype.forEach.call(m.children,function(x){if(c.has(x))f(x);else try{var b=x.getAttribute(r),v=b!==null&&b!=="false",w=(Nc.get(x)||0)+1,N=(i.get(x)||0)+1;Nc.set(x,w),i.set(x,N),o.push(x),w===1&&v&&$h.set(x,!0),N===1&&x.setAttribute(n,"true"),v||x.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",x,k)}})};return f(e),c.clear(),_x++,function(){o.forEach(function(m){var x=Nc.get(m)-1,b=i.get(m)-1;Nc.set(m,x),i.set(m,b),x||($h.has(m)||m.removeAttribute(r),$h.delete(m)),b||m.removeAttribute(n)}),_x--,_x||(Nc=new WeakMap,Nc=new WeakMap,$h=new WeakMap,Fh={})}},kk=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),a=YP(t);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),ZP(r,a,n,"aria-hidden")):function(){return null}},kp="Dialog",[Sk]=Bo(kp),[eR,ka]=Sk(kp),Ck=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:o=!0}=t,c=y.useRef(null),u=y.useRef(null),[h,f]=Tl({prop:r,defaultProp:a??!1,onChange:i,caller:kp});return s.jsx(eR,{scope:e,triggerRef:c,contentRef:u,contentId:To(),titleId:To(),descriptionId:To(),open:h,onOpenChange:f,onOpenToggle:y.useCallback(()=>f(m=>!m),[f]),modal:o,children:n})};Ck.displayName=kp;var Ek="DialogTrigger",tR=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=ka(Ek,n),i=Zt(e,a.triggerRef);return s.jsx(Rt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":q0(a.open),...r,ref:i,onClick:Tt(t.onClick,a.onOpenToggle)})});tR.displayName=Ek;var W0="DialogPortal",[nR,Tk]=Sk(W0,{forceMount:void 0}),Mk=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:a}=t,i=ka(W0,e);return s.jsx(nR,{scope:e,forceMount:n,children:y.Children.map(r,o=>s.jsx(Su,{present:n||i.open,children:s.jsx(H0,{asChild:!0,container:a,children:o})}))})};Mk.displayName=W0;var wf="DialogOverlay",Ak=y.forwardRef((t,e)=>{const n=Tk(wf,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=ka(wf,t.__scopeDialog);return i.modal?s.jsx(Su,{present:r||i.open,children:s.jsx(rR,{...a,ref:e})}):null});Ak.displayName=wf;var sR=cu("DialogOverlay.RemoveScroll"),rR=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=ka(wf,n);return s.jsx(U0,{as:sR,allowPinchZoom:!0,shards:[a.contentRef],children:s.jsx(Rt.div,{"data-state":q0(a.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Ml="DialogContent",Ik=y.forwardRef((t,e)=>{const n=Tk(Ml,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=ka(Ml,t.__scopeDialog);return s.jsx(Su,{present:r||i.open,children:i.modal?s.jsx(aR,{...a,ref:e}):s.jsx(iR,{...a,ref:e})})});Ik.displayName=Ml;var aR=y.forwardRef((t,e)=>{const n=ka(Ml,t.__scopeDialog),r=y.useRef(null),a=Zt(e,n.contentRef,r);return y.useEffect(()=>{const i=r.current;if(i)return kk(i)},[]),s.jsx(Pk,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Tt(t.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Tt(t.onPointerDownOutside,i=>{const o=i.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0;(o.button===2||c)&&i.preventDefault()}),onFocusOutside:Tt(t.onFocusOutside,i=>i.preventDefault())})}),iR=y.forwardRef((t,e)=>{const n=ka(Ml,t.__scopeDialog),r=y.useRef(!1),a=y.useRef(!1);return s.jsx(Pk,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,c;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{var u,h;(u=t.onInteractOutside)==null||u.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const o=i.target;((h=n.triggerRef.current)==null?void 0:h.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),Pk=y.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,...o}=t,c=ka(Ml,n),u=y.useRef(null),h=Zt(e,u);return mk(),s.jsxs(s.Fragment,{children:[s.jsx(V0,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:s.jsx(B0,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":q0(c.open),...o,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(oR,{titleId:c.titleId}),s.jsx(cR,{contentRef:u,descriptionId:c.descriptionId})]})]})}),K0="DialogTitle",Rk=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=ka(K0,n);return s.jsx(Rt.h2,{id:a.titleId,...r,ref:e})});Rk.displayName=K0;var Lk="DialogDescription",Ok=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=ka(Lk,n);return s.jsx(Rt.p,{id:a.descriptionId,...r,ref:e})});Ok.displayName=Lk;var Dk="DialogClose",_k=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=ka(Dk,n);return s.jsx(Rt.button,{type:"button",...r,ref:e,onClick:Tt(t.onClick,()=>a.onOpenChange(!1))})});_k.displayName=Dk;function q0(t){return t?"open":"closed"}var zk="DialogTitleWarning",[BV,$k]=DI(zk,{contentName:Ml,titleName:K0,docsSlug:"dialog"}),oR=({titleId:t})=>{const e=$k(zk),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return y.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},lR="DialogDescriptionWarning",cR=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${$k(lR).contentName}}.`;return y.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},dR=Ck,uR=Mk,hR=Ak,fR=Ik,pR=Rk,mR=Ok,xR=_k;function Wt(t){return s.jsx(dR,{"data-slot":"dialog",...t})}function gR(t){return s.jsx(uR,{...t})}const Fk=y.forwardRef(({className:t,...e},n)=>s.jsx(hR,{ref:n,className:$t("fixed inset-0 z-50 bg-black/50",t),...e}));Fk.displayName="DialogOverlay";const Ut=y.forwardRef(({className:t,children:e,showCloseButton:n=!0,...r},a)=>s.jsxs(gR,{children:[s.jsx(Fk,{}),s.jsxs(fR,{ref:a,"aria-describedby":void 0,className:$t("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(xR,{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(rs,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ut.displayName="DialogContent";function Kt({className:t,...e}){return s.jsx("div",{className:$t("flex flex-col gap-2 text-center sm:text-left",t),...e})}function Sn({className:t,...e}){return s.jsx("div",{className:$t("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function qt(t){return s.jsx(pR,{className:"text-lg font-semibold leading-none",...t})}function jf(t){return s.jsx(mR,{className:"text-sm text-muted-foreground",...t})}const yR=Zj("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 He({className:t,variant:e,asChild:n=!1,...r}){const a=n?Qj:"span";return s.jsx(a,{className:$t(yR({variant:e}),t),...r})}var bR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],vR=bR.reduce((t,e)=>{const n=Jj(`Primitive.${e}`),r=y.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}},{}),NR="Label",Bk=y.forwardRef((t,e)=>s.jsx(vR.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())}}));Bk.displayName=NR;var Vk=Bk;const ne=y.forwardRef(({className:t,...e},n)=>s.jsx(Vk,{ref:n,className:$t("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));ne.displayName=Vk.displayName;function G0(t){const e=t+"CollectionProvider",[n,r]=Bo(e),[a,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=w=>{const{scope:N,children:k}=w,T=sr.useRef(null),C=sr.useRef(new Map).current;return s.jsx(a,{scope:N,itemMap:C,collectionRef:T,children:k})};o.displayName=e;const c=t+"CollectionSlot",u=cu(c),h=sr.forwardRef((w,N)=>{const{scope:k,children:T}=w,C=i(c,k),P=Zt(N,C.collectionRef);return s.jsx(u,{ref:P,children:T})});h.displayName=c;const f=t+"CollectionItemSlot",m="data-radix-collection-item",x=cu(f),b=sr.forwardRef((w,N)=>{const{scope:k,children:T,...C}=w,P=sr.useRef(null),L=Zt(N,P),q=i(f,k);return sr.useEffect(()=>(q.itemMap.set(P,{ref:P,...C}),()=>void q.itemMap.delete(P))),s.jsx(x,{[m]:"",ref:L,children:T})});b.displayName=f;function v(w){const N=i(t+"CollectionConsumer",w);return sr.useCallback(()=>{const T=N.collectionRef.current;if(!T)return[];const C=Array.from(T.querySelectorAll(`[${m}]`));return Array.from(N.itemMap.values()).sort((q,z)=>C.indexOf(q.ref.current)-C.indexOf(z.ref.current))},[N.collectionRef,N.itemMap])}return[{Provider:o,Slot:h,ItemSlot:b},v,r]}var wR=y.createContext(void 0);function Sp(t){const e=y.useContext(wR);return t||e||"ltr"}var zx="rovingFocusGroup.onEntryFocus",jR={bubbles:!1,cancelable:!0},Cu="RovingFocusGroup",[Dg,Hk,kR]=G0(Cu),[SR,Uk]=Bo(Cu,[kR]),[CR,ER]=SR(Cu),Wk=y.forwardRef((t,e)=>s.jsx(Dg.Provider,{scope:t.__scopeRovingFocusGroup,children:s.jsx(Dg.Slot,{scope:t.__scopeRovingFocusGroup,children:s.jsx(TR,{...t,ref:e})})}));Wk.displayName=Cu;var TR=y.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,x=y.useRef(null),b=Zt(e,x),v=Sp(i),[w,N]=Tl({prop:o,defaultProp:c??null,onChange:u,caller:Cu}),[k,T]=y.useState(!1),C=Ro(h),P=Hk(n),L=y.useRef(!1),[q,z]=y.useState(0);return y.useEffect(()=>{const H=x.current;if(H)return H.addEventListener(zx,C),()=>H.removeEventListener(zx,C)},[C]),s.jsx(CR,{scope:n,orientation:r,dir:v,loop:a,currentTabStopId:w,onItemFocus:y.useCallback(H=>N(H),[N]),onItemShiftTab:y.useCallback(()=>T(!0),[]),onFocusableItemAdd:y.useCallback(()=>z(H=>H+1),[]),onFocusableItemRemove:y.useCallback(()=>z(H=>H-1),[]),children:s.jsx(Rt.div,{tabIndex:k||q===0?-1:0,"data-orientation":r,...m,ref:b,style:{outline:"none",...t.style},onMouseDown:Tt(t.onMouseDown,()=>{L.current=!0}),onFocus:Tt(t.onFocus,H=>{const R=!L.current;if(H.target===H.currentTarget&&R&&!k){const se=new CustomEvent(zx,jR);if(H.currentTarget.dispatchEvent(se),!se.defaultPrevented){const X=P().filter(I=>I.focusable),V=X.find(I=>I.active),ie=X.find(I=>I.id===w),he=[V,ie,...X].filter(Boolean).map(I=>I.ref.current);Gk(he,f)}}L.current=!1}),onBlur:Tt(t.onBlur,()=>T(!1))})})}),Kk="RovingFocusGroupItem",qk=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:i,children:o,...c}=t,u=To(),h=i||u,f=ER(Kk,n),m=f.currentTabStopId===h,x=Hk(n),{onFocusableItemAdd:b,onFocusableItemRemove:v,currentTabStopId:w}=f;return y.useEffect(()=>{if(r)return b(),()=>v()},[r,b,v]),s.jsx(Dg.ItemSlot,{scope:n,id:h,focusable:r,active:a,children:s.jsx(Rt.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:Tt(t.onMouseDown,N=>{r?f.onItemFocus(h):N.preventDefault()}),onFocus:Tt(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:Tt(t.onKeyDown,N=>{if(N.key==="Tab"&&N.shiftKey){f.onItemShiftTab();return}if(N.target!==N.currentTarget)return;const k=IR(N,f.orientation,f.dir);if(k!==void 0){if(N.metaKey||N.ctrlKey||N.altKey||N.shiftKey)return;N.preventDefault();let C=x().filter(P=>P.focusable).map(P=>P.ref.current);if(k==="last")C.reverse();else if(k==="prev"||k==="next"){k==="prev"&&C.reverse();const P=C.indexOf(N.currentTarget);C=f.loop?PR(C,P+1):C.slice(P+1)}setTimeout(()=>Gk(C))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:w!=null}):o})})});qk.displayName=Kk;var MR={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function AR(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function IR(t,e,n){const r=AR(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return MR[r]}function Gk(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function PR(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var RR=Wk,LR=qk,Cp="Tabs",[OR]=Bo(Cp,[Uk]),Jk=Uk(),[DR,J0]=OR(Cp),Qk=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:i,orientation:o="horizontal",dir:c,activationMode:u="automatic",...h}=t,f=Sp(c),[m,x]=Tl({prop:r,onChange:a,defaultProp:i??"",caller:Cp});return s.jsx(DR,{scope:n,baseId:To(),value:m,onValueChange:x,orientation:o,dir:f,activationMode:u,children:s.jsx(Rt.div,{dir:f,"data-orientation":o,...h,ref:e})})});Qk.displayName=Cp;var Yk="TabsList",Xk=y.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...a}=t,i=J0(Yk,n),o=Jk(n);return s.jsx(RR,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:s.jsx(Rt.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:e})})});Xk.displayName=Yk;var Zk="TabsTrigger",e2=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...i}=t,o=J0(Zk,n),c=Jk(n),u=s2(o.baseId,r),h=r2(o.baseId,r),f=r===o.value;return s.jsx(LR,{asChild:!0,...c,focusable:!a,active:f,children:s.jsx(Rt.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:Tt(t.onMouseDown,m=>{!a&&m.button===0&&m.ctrlKey===!1?o.onValueChange(r):m.preventDefault()}),onKeyDown:Tt(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&o.onValueChange(r)}),onFocus:Tt(t.onFocus,()=>{const m=o.activationMode!=="manual";!f&&!a&&m&&o.onValueChange(r)})})})});e2.displayName=Zk;var t2="TabsContent",n2=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:a,children:i,...o}=t,c=J0(t2,n),u=s2(c.baseId,r),h=r2(c.baseId,r),f=r===c.value,m=y.useRef(f);return y.useEffect(()=>{const x=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(x)},[]),s.jsx(Su,{present:a||f,children:({present:x})=>s.jsx(Rt.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!x,id:h,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:x&&i})})});n2.displayName=t2;function s2(t,e){return`${t}-trigger-${e}`}function r2(t,e){return`${t}-content-${e}`}var _R=Qk,a2=Xk,i2=e2,o2=n2;const Vc=_R,Al=y.forwardRef(({className:t,...e},n)=>s.jsx(a2,{ref:n,className:$t("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));Al.displayName=a2.displayName;const an=y.forwardRef(({className:t,...e},n)=>s.jsx(i2,{ref:n,className:$t("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}));an.displayName=i2.displayName;const on=y.forwardRef(({className:t,...e},n)=>s.jsx(o2,{ref:n,className:$t("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));on.displayName=o2.displayName;function Q0(t){const e=y.useRef({value:t,previous:t});return y.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function Y0(t){const[e,n]=y.useState(void 0);return Ws(()=>{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 Ep="Switch",[zR]=Bo(Ep),[$R,FR]=zR(Ep),l2=y.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,[x,b]=y.useState(null),v=Zt(e,C=>b(C)),w=y.useRef(!1),N=x?f||!!x.closest("form"):!0,[k,T]=Tl({prop:a,defaultProp:i??!1,onChange:h,caller:Ep});return s.jsxs($R,{scope:n,checked:k,disabled:c,children:[s.jsx(Rt.button,{type:"button",role:"switch","aria-checked":k,"aria-required":o,"data-state":h2(k),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:v,onClick:Tt(t.onClick,C=>{T(P=>!P),N&&(w.current=C.isPropagationStopped(),w.current||C.stopPropagation())})}),N&&s.jsx(u2,{control:x,bubbles:!w.current,name:r,value:u,checked:k,required:o,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});l2.displayName=Ep;var c2="SwitchThumb",d2=y.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,a=FR(c2,n);return s.jsx(Rt.span,{"data-state":h2(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:e})});d2.displayName=c2;var BR="SwitchBubbleInput",u2=y.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...a},i)=>{const o=y.useRef(null),c=Zt(o,i),u=Q0(n),h=Y0(e);return y.useEffect(()=>{const f=o.current;if(!f)return;const m=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&b){const v=new Event("click",{bubbles:r});b.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}})});u2.displayName=BR;function h2(t){return t?"checked":"unchecked"}var f2=l2,VR=d2;const Gt=y.forwardRef(({className:t,...e},n)=>s.jsx(f2,{className:$t("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(VR,{className:$t("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")})}));Gt.displayName=f2.displayName;const HR={view_chapter:"浏览章节",purchase:"购买",match:"派对匹配",login:"登录",register:"注册",share:"分享",bind_phone:"绑定手机",bind_wechat:"绑定微信",fill_profile:"完善资料",fill_avatar:"设置头像",visit_page:"访问页面",first_pay:"首次付款",vip_activate:"开通会员",click_super:"点击超级个体",lead_submit:"提交留资",withdraw:"申请提现",referral_bind:"绑定推荐人",card_click:"点击名片",btn_click:"按钮点击",tab_click:"切换标签",nav_click:"导航点击",page_view:"页面浏览",search:"搜索"};function UR(t){return HR[t]||t||"行为"}function WR(t,e){const n=new Set,r=a=>(t[a]??0)>0;return(r("purchase")||r("first_pay")||r("vip_activate"))&&n.add("已付费"),(r("lead_submit")||r("click_super"))&&n.add("高意向"),r("view_chapter")&&n.add("想学习"),r("match")&&n.add("找合伙人"),r("withdraw")&&n.add("有提现行为"),r("referral_bind")&&n.add("推广参与"),(r("fill_profile")||r("fill_avatar")||r("bind_phone"))&&n.add("资料完善中"),e!=null&&e.hasFullBook&&n.add("全书读者"),e!=null&&e.isVip&&n.add("VIP会员"),e!=null&&e.mbti&&/^[EI][NS][FT][JP]$/i.test(e.mbti)&&n.add(String(e.mbti).toUpperCase()),Array.from(n)}function X0({open:t,onClose:e,userId:n,onUserUpdated:r}){var ra,Qs,ks,Ss,Ys,wn;const[a,i]=y.useState(null),[o,c]=y.useState([]),[u,h]=y.useState({}),[f,m]=y.useState([]),[x,b]=y.useState(null),[v,w]=y.useState(null),[N,k]=y.useState(!1),[T,C]=y.useState(!1),[P,L]=y.useState(!1),[q,z]=y.useState("info"),[H,R]=y.useState(""),[se,X]=y.useState(""),[V,ie]=y.useState(""),[le,he]=y.useState([]),[I,Q]=y.useState(""),[$,xe]=y.useState(""),[Z,F]=y.useState(""),[U,pe]=y.useState(!1),[fe,oe]=y.useState({isVip:!1,vipExpireDate:"",vipRole:"",vipName:"",vipProject:"",vipContact:"",vipBio:""}),[D,K]=y.useState([]),[_,Y]=y.useState(!1),[te,Ne]=y.useState(""),[Fe,We]=y.useState(""),[St,wt]=y.useState(!1),[Vt,_t]=y.useState(!1),[$n,Jt]=y.useState(null),[dn,yn]=y.useState(null),[bn,En]=y.useState(""),[vn,At]=y.useState(""),[Nn,Ft]=y.useState(""),[je,Te]=y.useState(!1),[Ue,it]=y.useState(null),[Dt,Ct]=y.useState(!1),[$e,mt]=y.useState({}),[es,is]=y.useState([]);y.useEffect(()=>{t&&n&&(Ct(!1),z("info"),Jt(null),yn(null),it(null),xe(""),F(""),Fn(),Oe("/api/db/vip-roles").then(re=>{re!=null&&re.success&&re.data&&K(re.data)}).catch(()=>{}))},[t,n]),y.useEffect(()=>{t&&Oe("/api/admin/mbti-avatars").then(re=>{re!=null&&re.avatars&&typeof re.avatars=="object"?mt(re.avatars):mt({})}).catch(()=>mt({}))},[t]);const Gn=(re,ve)=>{const Ye=(re||"").trim();if(Ye)return Ua(Ye);const ut=(ve||"").trim().toUpperCase();return/^[EI][NS][FT][JP]$/.test(ut)?($e[ut]||"").trim():""};async function Fn(){if(n){k(!0);try{const re=await Oe(`/api/db/users?id=${encodeURIComponent(n)}`);if(re!=null&&re.success&&re.user){const ve=re.user;i(ve),R(ve.phone||""),X(ve.wechatId||""),ie(ve.nickname||""),En(ve.phone||""),At(ve.wechatId||""),Ft(ve.openId||"");try{he(typeof ve.tags=="string"?JSON.parse(ve.tags||"[]"):[])}catch{he([])}oe({isVip:!!(ve.isVip??!1),vipExpireDate:ve.vipExpireDate?String(ve.vipExpireDate).slice(0,10):"",vipRole:String(ve.vipRole??""),vipName:String(ve.vipName??""),vipProject:String(ve.vipProject??""),vipContact:String(ve.vipContact??""),vipBio:String(ve.vipBio??"")})}try{const ve=await Oe(`/api/admin/user/track?userId=${encodeURIComponent(n)}&limit=100`);if(ve!=null&&ve.success){h(ve.stats&&typeof ve.stats=="object"?ve.stats:{});const Ye=ve.tracks||[];c(Ye.map(ut=>({...ut,actionLabel:ut.actionLabel||ut.action,timeAgo:ut.timeAgo||""})))}else h({}),c([])}catch{h({}),c([])}try{const ve=await Oe(`/api/db/users/referrals?userId=${encodeURIComponent(n)}`);ve!=null&&ve.success?(m(ve.referrals||[]),b(ve.inboundSource||null)):(m([]),b(null))}catch{m([]),b(null)}try{const ve=await Oe(`/api/admin/users/${encodeURIComponent(n)}/balance`);ve!=null&&ve.success&&ve.data?w(ve.data):w(null)}catch{w(null)}try{const ve=await Oe(`/api/orders?userId=${encodeURIComponent(n)}&status=paid&pageSize=50`);ve!=null&&ve.success&&ve.orders?is(ve.orders):is([])}catch{is([])}}catch(re){console.error("Load user detail error:",re)}finally{k(!1)}}}async function or(){if(!(a!=null&&a.phone)){G.info("用户未绑定手机号,无法同步");return}C(!0);try{const re=await jt("/api/ckb/sync",{action:"full_sync",phone:a.phone,userId:a.id});re!=null&&re.success?(G.success("同步成功"),Fn()):G.error("同步失败: "+(re==null?void 0:re.error))}catch(re){console.error("Sync CKB error:",re),G.error("同步失败")}finally{C(!1)}}async function ls(){if(a){if(fe.isVip&&!fe.vipExpireDate.trim()){G.error("开启 VIP 请填写有效到期日");return}L(!0);try{const re={id:a.id,phone:H.trim()||void 0,wechatId:se.trim(),nickname:V||void 0,tags:JSON.stringify(le),isVip:fe.isVip,vipExpireDate:fe.isVip?fe.vipExpireDate:void 0,vipRole:fe.vipRole||void 0,vipName:fe.vipName||void 0,vipProject:fe.vipProject||void 0,vipContact:fe.vipContact||void 0,vipBio:fe.vipBio||void 0},ve=await tn("/api/db/users",re);ve!=null&&ve.success?(G.success("保存成功"),Fn(),r==null||r()):G.error("保存失败: "+(ve==null?void 0:ve.error))}catch(re){console.error("Save user error:",re),G.error("保存失败")}finally{L(!1)}}}const ws=()=>{I&&!le.includes(I)&&(he([...le,I]),Q(""))},kr=re=>he(le.filter(ve=>ve!==re));async function Pn(){if(a){if(!$){G.error("请输入新密码");return}if($!==Z){G.error("两次密码不一致");return}if($.length<6){G.error("密码至少 6 位");return}pe(!0);try{const re=await tn("/api/db/users",{id:a.id,password:$});re!=null&&re.success?(G.success("修改成功"),xe(""),F("")):G.error("修改失败: "+((re==null?void 0:re.error)||""))}catch{G.error("修改失败")}finally{pe(!1)}}}async function Js(){if(!a)return;const re=parseFloat(te);if(Number.isNaN(re)||re===0){G.error("请输入有效金额(正数增加、负数扣减)");return}wt(!0);try{const ve=await jt(`/api/admin/users/${a.id}/balance/adjust`,{amount:re,remark:Fe||void 0});ve!=null&&ve.success?(G.success("余额已调整"),Y(!1),Ne(""),We(""),Fn(),r==null||r()):G.error("调整失败: "+((ve==null?void 0:ve.error)||""))}catch{G.error("调整失败")}finally{wt(!1)}}async function js(){if(!bn&&!Nn&&!vn){yn("请至少输入手机号、微信号或 OpenID 中的一项");return}_t(!0),yn(null),Jt(null);try{const re=new URLSearchParams;bn&&re.set("phone",bn),Nn&&re.set("openId",Nn),vn&&re.set("wechatId",vn);const ve=await Oe(`/api/admin/shensheshou/query?${re}`);ve!=null&&ve.success&&ve.data?(Jt(ve.data),a&&await Sr(ve.data)):yn((ve==null?void 0:ve.error)||"未查询到数据,该用户可能未在神射手收录")}catch(re){console.error("SSS query error:",re),yn("请求失败,请检查神射手接口配置")}finally{_t(!1)}}async function Sr(re){if(a)try{await jt("/api/admin/shensheshou/enrich",{userId:a.id,phone:bn||a.phone||"",openId:Nn||a.openId||"",wechatId:vn||a.wechatId||""}),Fn()}catch(ve){console.error("SSS enrich error:",ve)}}async function lr(){if(a){Te(!0),it(null);try{const re=Array.from(new Set(o.filter(zs=>zs.action==="view_chapter"||zs.action==="purchase"||zs.action==="first_pay").map(zs=>(zs.chapterTitle||zs.target||"").trim()).filter(Boolean))).slice(0,12),ve={viewChapter:u.view_chapter||0,purchase:u.purchase||0,firstPay:u.first_pay||0},Ye=re.length>0?`意向章节:${re.join("、")}`:"",ut={users:[{phone:a.phone||"",name:a.nickname||"",openId:a.openId||"",tags:le,purchaseIntent:ve,purchaseIntentChapters:re,remark:Ye}]},Bn=await jt("/api/admin/shensheshou/ingest",ut);Bn!=null&&Bn.success&&Bn.data?it(Bn.data):it({error:(Bn==null?void 0:Bn.error)||"推送失败"})}catch(re){console.error("SSS ingest error:",re),it({error:"请求失败"})}finally{Te(!1)}}}const cs=re=>{const Ye={view_chapter:wr,purchase:Gd,match:Wn,login:Ci,register:Ci,share:Ba,bind_phone:S1,bind_wechat:SM,fill_profile:Jd,fill_avatar:Ci,visit_page:ya,first_pay:Gd,vip_activate:Oc,click_super:Wn,lead_submit:S1,withdraw:Ag,referral_bind:Ba,card_click:Ci,btn_click:Ri,tab_click:ya,nav_click:ya,page_view:ya,search:ya}[re]||Eg;return s.jsx(Ye,{className:"w-4 h-4"})};function Cr(re){const ve=String(re||"").trim();return ve.length>22&&/^[a-zA-Z0-9_-]+$/.test(ve)}const cr=y.useMemo(()=>WR(u,a),[u,a]);function dr(){const re=[...le];for(const ve of cr)re.includes(ve)||re.push(ve);he(re),G.success("已将旅程推断标签合并到已选")}return t?s.jsxs(s.Fragment,{children:[s.jsx(Wt,{open:t,onOpenChange:()=>e(),children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[92vh] overflow-hidden flex flex-col p-4 sm:p-5",children:[s.jsx(Kt,{children:s.jsxs(qt,{className:"text-white flex items-center gap-2",children:[s.jsx(Ci,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(a==null?void 0:a.phone)&&s.jsx(He,{className:"bg-green-500/20 text-green-400 border-0 ml-2",children:"已绑定手机"}),(a==null?void 0:a.isVip)&&s.jsx(He,{className:"bg-amber-500/20 text-amber-400 border-0",children:"VIP"})]})}),N?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(Ve,{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 flex-col sm:flex-row gap-2.5 p-2.5 bg-[#0a1628] rounded-lg mb-2 shrink-0",children:[s.jsxs("div",{className:"flex gap-2.5 min-w-0 flex-1",children:[s.jsx("div",{className:"w-11 h-11 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-lg text-[#38bdac] shrink-0",children:Gn(a.avatar,a.mbti)&&!Dt?s.jsx("img",{src:Gn(a.avatar,a.mbti),className:"w-full h-full rounded-full object-cover",alt:"",onError:()=>Ct(!0)}):((ra=a.nickname)==null?void 0:ra.charAt(0))||"?"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.jsx("h3",{className:"text-base font-bold text-white leading-tight",children:a.nickname}),a.isAdmin&&s.jsx(He,{className:"bg-purple-500/20 text-purple-400 border-0 text-[10px] py-0",children:"管理员"}),a.hasFullBook&&s.jsx(He,{className:"bg-green-500/20 text-green-400 border-0 text-[10px] py-0",children:"全书已购"}),a.vipRole&&s.jsx(He,{className:"bg-amber-500/20 text-amber-400 border-0 text-[10px] py-0",children:a.vipRole})]}),a.referralCode&&s.jsxs("p",{className:"text-[10px] text-gray-500 mt-0.5",children:["推荐码 ",s.jsx("code",{className:"text-[#38bdac]",children:a.referralCode})]}),s.jsxs("div",{className:"mt-1 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-1.5 text-[11px]",children:[s.jsxs("div",{className:"px-2 py-1 rounded bg-[#162840] border border-gray-700/50",children:[s.jsx("span",{className:"text-gray-500",children:"昵称"}),s.jsx("p",{className:"text-white truncate",children:V||a.nickname||"—"})]}),s.jsxs("div",{className:"px-2 py-1 rounded bg-[#162840] border border-gray-700/50",children:[s.jsx("span",{className:"text-gray-500",children:"手机号"}),s.jsx("p",{className:"text-white truncate",children:H||"—"})]}),s.jsxs("div",{className:"px-2 py-1 rounded bg-[#162840] border border-gray-700/50",children:[s.jsx("span",{className:"text-gray-500",children:"微信标识"}),s.jsx("p",{className:"text-white truncate",children:se||"—"})]}),s.jsxs("div",{className:"px-2 py-1 rounded bg-[#162840] border border-gray-700/50",children:[s.jsx("span",{className:"text-gray-500",children:"画像"}),s.jsx("p",{className:"text-[#38bdac] truncate",children:[a.region,a.industry,a.position,a.mbti?`MBTI ${a.mbti}`:""].filter(Boolean).join(" · ")||"未完善"})]})]})]})]}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-2 gap-1.5 shrink-0 sm:w-[220px]",children:[s.jsxs("div",{className:"rounded-md bg-[#162840] px-2 py-1.5 border border-gray-700/40",children:[s.jsx("p",{className:"text-[9px] text-gray-500 uppercase tracking-wide",children:"累计佣金"}),s.jsxs("p",{className:"text-sm font-bold text-[#38bdac] leading-tight",children:["¥",(a.earnings??0).toFixed(2)]}),s.jsx("p",{className:"text-[9px] text-gray-600",children:"推广/分佣入账"})]}),s.jsxs("div",{className:"rounded-md bg-[#162840] px-2 py-1.5 border border-gray-700/40",children:[s.jsx("p",{className:"text-[9px] text-gray-500",children:"待提现"}),s.jsxs("p",{className:"text-sm font-bold text-yellow-400 leading-tight",children:["¥",(a.pendingEarnings??0).toFixed(2)]}),s.jsx("p",{className:"text-[9px] text-gray-600",children:"未打款部分"})]}),s.jsxs("div",{className:"rounded-md bg-[#162840] px-2 py-1.5 border border-gray-700/40",children:[s.jsxs("div",{className:"flex items-center justify-between gap-1",children:[s.jsx("p",{className:"text-[9px] text-gray-500",children:"账户余额"}),s.jsx(J,{type:"button",size:"sm",variant:"ghost",className:"h-5 px-1 text-[9px] text-[#38bdac] hover:bg-[#38bdac]/10",onClick:()=>{Ne(""),We(""),Y(!0)},children:"调整"})]}),s.jsxs("p",{className:"text-sm font-bold text-white leading-tight",children:["¥",((v==null?void 0:v.balance)??0).toFixed(2)]}),s.jsx("p",{className:"text-[9px] text-gray-600",children:"可消费/抵扣"})]}),s.jsxs("div",{className:"rounded-md bg-[#162840] px-2 py-1.5 border border-gray-700/40",children:[s.jsx("p",{className:"text-[9px] text-gray-500",children:"推荐人数"}),s.jsx("p",{className:"text-sm font-bold text-white leading-tight",children:a.referralCount??0}),s.jsx("p",{className:"text-[9px] text-gray-600",children:a.createdAt?`注册 ${new Date(a.createdAt).toLocaleDateString()}`:"—"})]})]})]}),s.jsxs(Vc,{value:q,onValueChange:z,className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[s.jsxs(Al,{className:"bg-[#0a1628] border border-gray-700/50 p-0.5 mb-2 flex-wrap h-auto gap-0.5 shrink-0",children:[s.jsx(an,{value:"info",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-[11px] px-2 py-1 h-7",children:"用户信息"}),s.jsxs(an,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-[11px] px-2 py-1 h-7",children:[s.jsx(ya,{className:"w-3 h-3 mr-0.5"}),"旅程与轨迹"]}),s.jsx(an,{value:"relations",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-[11px] px-2 py-1 h-7",children:"关系链路"}),s.jsx(an,{value:"tags",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-[11px] px-2 py-1 h-7",children:"标签体系"})]}),s.jsxs(on,{value:"info",className:"flex-1 min-h-0 overflow-y-auto space-y-2 pr-0.5",children:[s.jsxs("details",{className:"rounded-lg bg-[#0a1628] border border-gray-700/40 p-2 text-[11px] group",children:[s.jsxs("summary",{className:"cursor-pointer text-gray-400 select-none list-none flex items-center gap-1",children:[s.jsx("span",{className:"group-open:text-[#38bdac]",children:"技术标识"}),s.jsx("span",{className:"text-gray-600",children:"(用户ID / OpenID,默认折叠)"})]}),s.jsxs("div",{className:"mt-2 space-y-1.5 text-gray-300 font-mono text-[10px] break-all border-t border-gray-700/30 pt-2",children:[s.jsxs("p",{children:[s.jsx("span",{className:"text-gray-500 not-italic font-sans",children:"用户ID"})," ",a.id]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-gray-500 not-italic font-sans",children:"OpenID"})," ",a.openId||"—"]}),s.jsx("p",{className:"text-gray-500 not-italic font-sans leading-snug",children:"OpenID 为微信用户标识;下方「微信标识」为微信号/wxid,供存客宝归属,与 OpenID 不同。"})]})]}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-400 text-[11px]",children:"昵称"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"昵称",value:V,onChange:re=>ie(re.target.value)})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-400 text-[11px]",children:"手机号(可改,点底部保存生效)"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"11 位手机号",value:H,onChange:re=>R(re.target.value)})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-400 text-[11px]",children:"微信标识(微信号/wxid,非 OpenID)"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"如 wxid_xxx 或自定义微信号",value:se,onChange:re=>X(re.target.value)})]})]}),(a.region||a.industry||a.position||a.mbti)&&s.jsxs("div",{className:"flex flex-wrap gap-1.5 text-[11px]",children:[a.region&&s.jsxs("span",{className:"px-2 py-0.5 rounded bg-[#162840] text-gray-300",children:[s.jsx(Kj,{className:"w-3 h-3 inline mr-0.5"}),a.region]}),a.industry&&s.jsxs("span",{className:"px-2 py-0.5 rounded bg-[#162840] text-gray-300",children:["行业 ",a.industry]}),a.position&&s.jsxs("span",{className:"px-2 py-0.5 rounded bg-[#162840] text-gray-300",children:["职位 ",a.position]}),a.mbti&&s.jsxs("span",{className:"px-2 py-0.5 rounded bg-[#38bdac]/15 text-[#38bdac]",children:["MBTI ",a.mbti]})]}),s.jsxs("div",{className:"p-2 rounded-lg bg-[#0a1628] border border-amber-500/25",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx(Oc,{className:"w-3.5 h-3.5 text-amber-400 shrink-0"}),s.jsx("span",{className:"text-white text-xs font-medium",children:"超级个体"}),a.isVip&&s.jsx(He,{className:"bg-amber-500/20 text-amber-400 border-0 text-[10px] py-0 shrink-0",children:a.vipRole||"VIP"})]}),s.jsx(Gt,{className:"scale-90",checked:fe.isVip,onCheckedChange:re=>oe(ve=>({...ve,isVip:re}))})]}),fe.isVip&&s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-1.5 mt-2",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ne,{className:"text-gray-500 text-[10px]",children:"到期日"}),s.jsx(ce,{type:"date",className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",value:fe.vipExpireDate,onChange:re=>oe(ve=>({...ve,vipExpireDate:re.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ne,{className:"text-gray-500 text-[10px]",children:"角色"}),s.jsxs("select",{className:"w-full bg-[#162840] border border-gray-700 text-white rounded px-1.5 h-7 text-xs",value:fe.vipRole,onChange:re=>oe(ve=>({...ve,vipRole:re.target.value})),children:[s.jsx("option",{value:"",children:"请选择"}),D.map(re=>s.jsx("option",{value:re.name,children:re.name},re.id))]})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ne,{className:"text-gray-500 text-[10px]",children:"展示名"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"展示名",value:fe.vipName,onChange:re=>oe(ve=>({...ve,vipName:re.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ne,{className:"text-gray-500 text-[10px]",children:"项目"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"项目",value:fe.vipProject,onChange:re=>oe(ve=>({...ve,vipProject:re.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ne,{className:"text-gray-500 text-[10px]",children:"联系方式"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"微信/手机",value:fe.vipContact,onChange:re=>oe(ve=>({...ve,vipContact:re.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5 sm:col-span-2",children:[s.jsx(ne,{className:"text-gray-500 text-[10px]",children:"简介"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"简短介绍",value:fe.vipBio,onChange:re=>oe(ve=>({...ve,vipBio:re.target.value}))})]})]})]}),s.jsxs("div",{className:"p-2 rounded-lg bg-[#0a1628] border border-[#38bdac]/20",children:[s.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[s.jsx(Ri,{className:"w-3.5 h-3.5 text-[#38bdac]"}),s.jsx("span",{className:"text-white text-xs font-medium",children:"外部资料 · 神射手 / 存客宝(与上方基础信息联动)"})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-1.5 mb-1.5",children:[s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:手机",value:bn,onChange:re=>En(re.target.value)}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:微信号",value:vn,onChange:re=>At(re.target.value)}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:OpenID",value:Nn,onChange:re=>Ft(re.target.value)})]}),s.jsxs("div",{className:"flex flex-wrap gap-1",children:[s.jsxs(J,{size:"sm",className:"h-7 text-[11px] px-2 bg-[#38bdac] hover:bg-[#2da396]",onClick:js,disabled:Vt,children:[Vt?s.jsx(Ve,{className:"w-3 h-3 animate-spin"}):s.jsx(va,{className:"w-3 h-3 mr-0.5"}),"查询回填"]}),s.jsx(J,{size:"sm",variant:"outline",className:"h-7 text-[11px] px-2 border-purple-500/40 text-purple-300",onClick:lr,disabled:je||!a.phone,children:je?"推送…":"推神射手"}),s.jsx(J,{size:"sm",variant:"outline",className:"h-7 text-[11px] px-2",onClick:or,disabled:T||!a.phone,children:T?"同步…":"存客宝同步"})]}),a.ckbSyncedAt&&s.jsxs("p",{className:"text-[10px] text-gray-500 mt-1",children:["最近存客宝同步:",new Date(a.ckbSyncedAt).toLocaleString()]}),dn&&s.jsx("p",{className:"mt-1 text-red-400 text-[11px]",children:dn}),$n&&s.jsxs("div",{className:"mt-1.5 grid grid-cols-2 gap-1.5",children:[s.jsxs("div",{className:"p-1.5 bg-[#162840] rounded text-[11px]",children:[s.jsx("span",{className:"text-gray-500",children:"RFM"})," ",s.jsx("span",{className:"text-[#38bdac] font-semibold",children:$n.rfm_score??"—"})]}),s.jsxs("div",{className:"p-1.5 bg-[#162840] rounded text-[11px]",children:[s.jsx("span",{className:"text-gray-500",children:"等级"})," ",s.jsx("span",{className:"text-white font-semibold",children:$n.user_level??"—"})]})]}),Ue&&s.jsx("p",{className:"mt-1 text-[11px]",children:Ue.error?s.jsx("span",{className:"text-red-400",children:String(Ue.error)}):s.jsx("span",{className:"text-green-400",children:"推送成功"})})]}),s.jsxs("div",{className:"p-2 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[s.jsx(Ag,{className:"w-3.5 h-3.5 text-yellow-400"}),s.jsx("span",{className:"text-white text-xs font-medium",children:"修改密码"})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-1.5 sm:items-center",children:[s.jsx(ce,{type:"password",className:"bg-[#162840] border-gray-700 text-white h-7 text-xs flex-1",placeholder:"新密码 ≥6 位",value:$,onChange:re=>xe(re.target.value)}),s.jsx(ce,{type:"password",className:"bg-[#162840] border-gray-700 text-white h-7 text-xs flex-1",placeholder:"确认密码",value:Z,onChange:re=>F(re.target.value)}),s.jsx(J,{size:"sm",className:"h-7 text-[11px] shrink-0 bg-yellow-500/20 text-yellow-300 border border-yellow-500/35 hover:bg-yellow-500/30",onClick:Pn,disabled:U||!$||!Z,children:U?"保存中":"确认修改"})]})]})]}),s.jsxs(on,{value:"journey",className:"flex-1 min-h-0 overflow-y-auto space-y-2 pr-0.5",children:[es.length>0&&s.jsxs("div",{className:"p-2 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[s.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[s.jsx(Gd,{className:"w-3.5 h-3.5 text-amber-400"}),s.jsxs("span",{className:"text-white text-xs font-medium",children:["购买清单(",es.length," 笔)"]})]}),s.jsx("div",{className:"space-y-1 max-h-[120px] overflow-y-auto",children:es.map((re,ve)=>s.jsxs("div",{className:"flex items-center justify-between p-1.5 bg-[#162840] rounded text-[11px]",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"text-amber-300",children:re.productType==="fullbook"||re.productType==="vip"?"全书/VIP":`章节 ${re.productId||""}`}),s.jsxs("span",{className:"text-gray-500 ml-2",children:["¥",Number(re.amount||0).toFixed(2)]})]}),s.jsx("span",{className:"text-gray-500 text-[10px] shrink-0",children:re.createdAt?new Date(re.createdAt).toLocaleString("zh-CN"):""})]},re.orderSn||ve))})]}),s.jsxs("div",{className:"p-2 bg-[#0a1628] rounded-lg flex flex-col gap-1.5 text-[11px]",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-gray-400",children:[s.jsx(ya,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0"}),s.jsxs("span",{children:["全站埋点共 ",o.length," 条;用于 RFM 与「标签体系」旅程推断"]})]}),Object.keys(u).length>0&&s.jsx("div",{className:"flex flex-wrap gap-1 pt-1 border-t border-gray-700/40",children:Object.entries(u).sort((re,ve)=>ve[1]-re[1]).map(([re,ve])=>s.jsxs(He,{variant:"outline",className:"text-[10px] border-gray-600 text-gray-300 bg-[#162840] py-0 h-5",children:[UR(re)," ×",ve]},re))})]}),s.jsx("div",{className:"space-y-1.5",children:o.length>0?o.map((re,ve)=>s.jsxs("div",{className:"flex items-start gap-2 p-2 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[s.jsx("div",{className:"w-7 h-7 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-[#38bdac]",children:cs(re.action)}),ve0?((x==null?void 0:x.visits)||[]).map((re,ve)=>s.jsxs("div",{className:"flex items-center justify-between p-1.5 bg-[#162840] rounded text-xs",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("p",{className:"text-white truncate",children:["第 ",re.seq||ve+1," 次 · ",re.referrerNickname||"微信用户",re.referrerId?`(${re.referrerId})`:""]}),re.page?s.jsx("p",{className:"text-gray-500 text-[10px] truncate",children:re.page}):null]}),s.jsx("span",{className:"text-gray-500 text-[10px] shrink-0",children:re.visitedAt?new Date(re.visitedAt).toLocaleString():""})]},`${re.referrerId||"unknown"}_${ve}`)):s.jsx("p",{className:"text-gray-500 text-sm text-center py-2",children:"暂无来源点击记录"})})]}),s.jsxs("div",{className:"p-2 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Ba,{className:"w-3.5 h-3.5 text-[#38bdac]"}),s.jsx("span",{className:"text-white text-sm font-medium",children:"推荐的用户"})]}),s.jsxs(He,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 text-[10px]",children:["共 ",f.length," 人"]})]}),s.jsx("div",{className:"space-y-1 max-h-[min(280px,40vh)] overflow-y-auto",children:f.length>0?f.map((re,ve)=>{var ut;const Ye=re;return s.jsxs("div",{className:"flex items-center justify-between p-1.5 bg-[#162840] rounded text-xs",children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx("div",{className:"w-6 h-6 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-[10px] text-[#38bdac] shrink-0",children:((ut=Ye.nickname)==null?void 0:ut.charAt(0))||"?"}),s.jsx("span",{className:"text-white truncate",children:Ye.nickname})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[Ye.status==="vip"&&s.jsx(He,{className:"bg-green-500/20 text-green-400 border-0 text-[10px] py-0",children:"已购"}),s.jsx("span",{className:"text-gray-500 text-[10px]",children:Ye.createdAt?new Date(Ye.createdAt).toLocaleDateString():""})]})]},Ye.id||ve)}):s.jsx("p",{className:"text-gray-500 text-sm text-center py-3",children:"暂无推荐用户"})})]})]}),s.jsxs(on,{value:"tags",className:"flex-1 min-h-0 overflow-y-auto space-y-3 pr-0.5",children:[s.jsxs("div",{className:"p-2.5 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2 flex-wrap",children:[s.jsx(Jd,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-white text-sm font-medium",children:"用户标签"}),s.jsx("span",{className:"text-gray-500 text-[11px]",children:"《一场 Soul 的创业实验》维度"})]}),s.jsxs("div",{className:"mb-2 p-2 bg-[#38bdac]/5 border border-[#38bdac]/20 rounded-lg flex items-start gap-2 text-[11px] text-gray-400",children:[s.jsx($j,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0 mt-0.5"}),"预设可点选;下方「旅程推断」由轨迹+资料自动算出,可一键并入已选后点弹窗底部保存。"]}),s.jsxs("div",{className:"mb-3 p-2 rounded-lg bg-[#162840]/80 border border-cyan-500/20",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-1.5",children:[s.jsx("span",{className:"text-cyan-300/90 text-xs font-medium",children:"旅程推断标签"}),s.jsx(J,{type:"button",size:"sm",variant:"outline",className:"h-7 text-[11px] border-cyan-500/40 text-cyan-200 hover:bg-cyan-500/10",disabled:cr.length===0,onClick:dr,children:"合并到已选"})]}),cr.length>0?s.jsx("div",{className:"flex flex-wrap gap-1",children:cr.map(re=>s.jsxs(He,{variant:"outline",className:`text-[10px] py-0 h-5 border-cyan-500/30 ${le.includes(re)?"bg-cyan-500/15 text-cyan-200":"text-gray-300"}`,children:[le.includes(re)?"✓ ":"",re]},re))}):s.jsx("p",{className:"text-[11px] text-gray-500",children:"暂无推断(无轨迹或行为未命中规则)"})]}),s.jsx("div",{className:"mb-3 space-y-2",children:[{category:"身份类型",tags:["创业者","打工人","自由职业","学生","投资人","合伙人"]},{category:"行业背景",tags:["电商","内容","传统行业","科技/AI","金融","教育","餐饮"]},{category:"痛点标签",tags:["找资源","找方向","找合伙人","想赚钱","想学习","找情感出口"]},{category:"付费意愿",tags:["高意向","已付费","观望中","薅羊毛"]},{category:"MBTI",tags:["ENTJ","INTJ","ENFP","INFP","ENTP","INTP","ESTJ","ISFJ"]}].map(re=>s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-[11px] mb-1",children:re.category}),s.jsx("div",{className:"flex flex-wrap gap-1",children:re.tags.map(ve=>s.jsxs("button",{type:"button",onClick:()=>{le.includes(ve)?kr(ve):he([...le,ve])},className:`px-1.5 py-0.5 rounded text-[11px] border transition-all ${le.includes(ve)?"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:[le.includes(ve)?"✓ ":"",ve]},ve))})]},re.category))}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-2",children:[s.jsx("p",{className:"text-gray-500 text-[11px] mb-1.5",children:"已选标签(需保存修改写入库)"}),s.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-2 min-h-[28px]",children:[le.map((re,ve)=>s.jsxs(He,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1 text-[11px] py-0",children:[re,s.jsx("button",{type:"button",onClick:()=>kr(re),className:"ml-1 hover:text-red-400",children:s.jsx(rs,{className:"w-3 h-3"})})]},ve)),le.length===0&&s.jsx("span",{className:"text-gray-600 text-xs",children:"暂未选择"})]}),s.jsxs("div",{className:"flex gap-1.5",children:[s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white flex-1 h-8 text-xs",placeholder:"自定义标签,回车添加",value:I,onChange:re=>Q(re.target.value),onKeyDown:re=>re.key==="Enter"&&ws()}),s.jsx(J,{onClick:ws,className:"bg-[#38bdac] hover:bg-[#2da396] h-8 text-xs px-3",children:"添加"})]})]})]}),(()=>{const re=a.tags||a.ckbTags||"";let ve=[];try{const ut=typeof re=="string"?JSON.parse(re||"[]"):[];ve=Array.isArray(ut)?ut:typeof re=="string"?re.split(","):[]}catch{ve=typeof re=="string"?re.split(","):[]}const Ye=ve.map(ut=>String(ut).trim()).filter(Boolean);return Ye.length===0?null:s.jsxs("div",{className:"p-2.5 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[s.jsx(Jd,{className:"w-3.5 h-3.5 text-purple-400"}),s.jsx("span",{className:"text-white text-sm font-medium",children:"存客宝标签"})]}),s.jsx("div",{className:"flex flex-wrap gap-1",children:Ye.map((ut,Bn)=>s.jsx(He,{className:"bg-purple-500/20 text-purple-400 border-0 text-[11px] py-0",children:ut},Bn))})]})})()]})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-gray-700 mt-3 shrink-0",children:[s.jsxs(J,{variant:"outline",onClick:e,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(rs,{className:"w-4 h-4 mr-2"}),"关闭"]}),s.jsxs(J,{onClick:ls,disabled:P,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(In,{className:"w-4 h-4 mr-2"}),P?"保存中...":"保存修改"]})]})]}):s.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}),s.jsx(Wt,{open:_,onOpenChange:Y,children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsx(Kt,{children:s.jsx(qt,{children:"调整余额"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{children:[s.jsx(ne,{className:"text-gray-300 text-sm",children:"调整金额(元)"}),s.jsx(ce,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"正数增加,负数扣减,如 10 或 -5",value:te,onChange:re=>Ne(re.target.value)})]}),s.jsxs("div",{children:[s.jsx(ne,{className:"text-gray-300 text-sm",children:"备注(可选)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"如:活动补偿",value:Fe,onChange:re=>We(re.target.value)})]})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(J,{variant:"outline",onClick:()=>Y(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(J,{onClick:Js,disabled:St,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:St?"提交中...":"确认调整"})]})]})})]}):null}function KR(){const t=Ga(),[e,n]=y.useState(!0),[r,a]=y.useState(!0),[i,o]=y.useState(!0),[c,u]=y.useState([]),[h,f]=y.useState([]),[m,x]=y.useState(0),[b,v]=y.useState(0),[w,N]=y.useState(0),[k,T]=y.useState(0),[C,P]=y.useState(null),[L,q]=y.useState(null),[z,H]=y.useState(!1),[R,se]=y.useState(0),[X,V]=y.useState(!1),[ie,le]=y.useState(null),[he,I]=y.useState("overview"),[Q,$]=y.useState([]),[xe,Z]=y.useState(!1),[F,U]=y.useState("today"),[pe,fe]=y.useState(null),[oe,D]=y.useState(!1),[K,_]=y.useState(!0),[Y,te]=y.useState(null),[Ne,Fe]=y.useState(null),[We,St]=y.useState([]),wt=je=>{const Te=je;if((Te==null?void 0:Te.status)===401)P("登录已过期,请重新登录");else{if((Te==null?void 0:Te.name)==="AbortError")return;P("加载失败,请检查网络或联系管理员")}};async function Vt(je){var Dt,Ct;const Te=je?{signal:je}:void 0;n(!0),P(null);try{const $e=await Oe("/api/admin/dashboard/stats",Te);$e!=null&&$e.success&&(x($e.totalUsers??0),v($e.paidOrderCount??0),N($e.totalRevenue??0),T($e.conversionRate??0))}catch($e){if(($e==null?void 0:$e.name)!=="AbortError"){console.error("stats 失败,尝试 overview 降级",$e);try{const mt=await Oe("/api/admin/dashboard/overview",Te);mt!=null&&mt.success&&(x(mt.totalUsers??0),v(mt.paidOrderCount??0),N(mt.totalRevenue??0),T(mt.conversionRate??0))}catch(mt){wt(mt)}}}finally{n(!1)}try{const $e=await Oe("/api/admin/balance/summary",Te);$e!=null&&$e.success&&$e.data&&se($e.data.totalGifted??0)}catch{}try{const $e=await Oe("/api/db/ckb-plan-stats",Te);$e!=null&&$e.success&&$e.data?le({ckbTotal:$e.data.ckbTotal??0,withContact:$e.data.withContact??0}):le(null)}catch{le(null)}_(!0);try{const[$e,mt]=await Promise.allSettled([Oe("/api/db/match-records?stats=true",Te),Oe("/api/admin/distribution/overview",Te)]);$e.status==="fulfilled"&&((Dt=$e.value)!=null&&Dt.success)&&$e.value.data?te({totalMatches:$e.value.data.totalMatches??0,todayMatches:$e.value.data.todayMatches??0,uniqueUsers:$e.value.data.uniqueUsers??0,paidMatchCount:$e.value.data.paidMatchCount??0}):te(null),mt.status==="fulfilled"&&((Ct=mt.value)!=null&&Ct.success)&&mt.value.overview?Fe({todayClicks:mt.value.overview.todayClicks??0,todayBindings:mt.value.overview.todayBindings??0,todayConversions:mt.value.overview.todayConversions??0,monthClicks:mt.value.overview.monthClicks??0,monthBindings:mt.value.overview.monthBindings??0,monthConversions:mt.value.overview.monthConversions??0,totalClicks:mt.value.overview.totalClicks??0,totalBindings:mt.value.overview.totalBindings??0,totalConversions:mt.value.overview.totalConversions??0,conversionRate:mt.value.overview.conversionRate}):Fe(null)}catch{te(null),Fe(null)}finally{_(!1)}try{const $e=await Oe("/api/db/vip-members?limit=500",Te);$e!=null&&$e.success&&Array.isArray($e.data)?St($e.data):St([])}catch{St([])}a(!0),o(!0);const Ue=async()=>{try{const $e=await Oe("/api/admin/dashboard/recent-orders?limit=10",Te);if($e!=null&&$e.success&&$e.recentOrders)f($e.recentOrders);else throw new Error("no data")}catch($e){if(($e==null?void 0:$e.name)!=="AbortError")try{const mt=await Oe("/api/admin/orders?page=1&pageSize=20&status=paid",Te),is=((mt==null?void 0:mt.orders)??[]).filter(Gn=>["paid","completed","success"].includes(Gn.status||""));f(is.slice(0,5))}catch{f([])}}finally{a(!1)}},it=async()=>{try{const $e=await Oe("/api/admin/dashboard/new-users",Te);if($e!=null&&$e.success&&$e.newUsers)u($e.newUsers);else throw new Error("no data")}catch($e){if(($e==null?void 0:$e.name)!=="AbortError")try{const mt=await Oe("/api/db/users?page=1&pageSize=10",Te);u((mt==null?void 0:mt.users)??[])}catch{u([])}}finally{o(!1)}};await Promise.all([Ue(),it()])}async function _t(je){const Te=je||F;D(!0);try{const Ue=await Oe(`/api/admin/track/stats?period=${Te}`);Ue!=null&&Ue.success&&fe({total:Ue.total??0,byModule:Ue.byModule??{}})}catch{fe(null)}finally{D(!1)}}const $n={home:"首页",chapters:"目录",read:"阅读页",my:"我的",vip:"超级个体",wallet:"钱包",match:"找伙伴",referral:"推广中心",search:"搜索",settings:"设置",about:"关于",member_detail:"成员详情",other:"其他"},Jt={btn_click:"按钮点击",nav_click:"导航点击",card_click:"卡片点击",tab_click:"标签切换",page_view:"页面浏览",share:"分享",purchase:"购买",register:"注册",rule_trigger:"规则触发",view_chapter:"浏览章节",link_click:"链接点击"},dn=je=>je?je.replace(/^part-/,"").replace(/^soulvip_/,"").replace(/^super_?/,"").replace(/^user_/,"").replace(/[_-]+/g," ").trim():"",yn=je=>{if(!je)return"";const Te=je.trim().toLowerCase();if(!Te)return"";const Ue=We.find(Dt=>{const Ct=String(Dt.id||"").toLowerCase();return Ct===Te||Ct.includes(Te)||Te.includes(Ct)});if(Ue)return Ue.name||Ue.nickname||"";const it=We.find(Dt=>{const Ct=String(Dt.token||"").toLowerCase();return Ct&&(Ct===Te||Ct.includes(Te)||Te.includes(Ct))});return it&&(it.name||it.nickname)||""},bn=je=>{if(!je)return"未命名点击";const Te=je.trim(),Ue=Te.toLowerCase();if(/^链接头像[_-]/.test(Te)){const Dt=dn(Te.replace(/^链接头像[_-]/,""));return Dt?`头像:${Dt}`:"头像点击"}if(/^member[_-]?detail$/i.test(Ue)||Ue.includes("member detail"))return"成员详情";if(/^giftpay$/i.test(Ue)||Ue.includes("gift pay"))return"代付入口";if(/^part[-_]/i.test(Ue))return`章节:${dn(Te)}`;if(Ue.includes("soulvip")||Ue.includes("super")){const Dt=Te.replace(/^超级个体[::]?/i,"").replace(/^super[_-]?/i,"").replace(/^soulvip[_-]?/i,"").replace(/^user[_-]?/i,"").trim(),Ct=yn(Dt)||yn(dn(Dt));return Ct?`超级个体:${Ct}`:`超级个体:${dn(Dt)}`}if(Ue.includes("qgdtw")||Ue.includes("token")||Ue.includes("0000"))return`对象:${dn(Te)}`;const it={开始匹配:"开始匹配",mentor:"导师顾问",team:"团队招募",investor:"资源对接",充值:"充值",退款:"退款",wallet:"钱包",设置:"设置",VIP:"VIP会员",推广:"推广中心",目录:"目录",搜索:"搜索",匹配:"找伙伴",settings:"设置",expired:"已过期",active:"活跃",converted:"已转化",fill_profile:"完善资料",register:"注册",purchase:"购买",链接卡若:"链接卡若",更多分享:"更多分享",分享朋友圈文案:"分享朋友圈",选择金额10:"选择金额10元",member_detail:"成员详情",giftPay:"代付入口"};return it[Te]?it[Te]:/^[a-z0-9_-]+$/i.test(Te)&&dn(Te)||Te},En=je=>{const Te=$n[je.module]||$n[je.page]||je.module||je.page||"其他",Ue=Jt[je.action]||je.action||"点击",it=bn(je.target);return`${Te} · ${Ue} · ${it}`};async function vn(){Z(!0);try{const je=await Oe("/api/admin/super-individual/stats");je!=null&&je.success&&Array.isArray(je.data)&&$(je.data)}catch{}finally{Z(!1)}}y.useEffect(()=>{const je=new AbortController;return Vt(je.signal),_t(),vn(),()=>{je.abort()}},[]);const At=m,Nn=je=>{const Te=je.productType||"",Ue=je.description||"";if(Te==="balance_recharge")return{title:`余额充值 ¥${typeof je.amount=="number"?je.amount.toFixed(2):parseFloat(String(je.amount||"0")).toFixed(2)}`,subtitle:"余额充值"};if(Te==="gift_pay")return{title:`代付 ¥${typeof je.amount=="number"?je.amount.toFixed(2):parseFloat(String(je.amount||"0")).toFixed(2)}`,subtitle:"好友代付"};if(Te==="gift_pay_batch"){const it=typeof je.amount=="number"?je.amount.toFixed(2):parseFloat(String(je.amount||"0")).toFixed(2);return{title:Ue||`代付分享 ¥${it}`,subtitle:"代付分享"}}if(Te==="section"&&Ue.includes("代付领取"))return{title:Ue.replace("代付领取 - ",""),subtitle:"代付领取"};if(Ue){if(Te==="section"&&Ue.includes("章节")){if(Ue.includes("-")){const it=Ue.split("-");if(it.length>=3)return{title:`第${it[1]}章 第${it[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:Ue,subtitle:"章节购买"}}return Te==="fullbook"||Ue.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:Te==="vip"||Ue.includes("VIP")?{title:"超级个体开通费用",subtitle:"超级个体"}:Te==="match"||Ue.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:Ue,subtitle:Te==="section"?"单章":Te==="fullbook"?"全书":"其他"}}return Te==="section"?{title:`章节 ${je.productId||""}`,subtitle:"单章购买"}:Te==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:Te==="vip"?{title:"超级个体开通费用",subtitle:"超级个体"}:Te==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:Te||"其他"}},Ft=[{title:"总用户数",value:e?null:At,sub:null,icon:Wn,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:e?null:`¥${(w??0).toFixed(2)}`,sub:R>0?`含代付 ¥${R.toFixed(2)}`:null,icon:yf,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:e?null:b,sub:null,icon:Gd,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:e?null:`${typeof k=="number"?k.toFixed(1):0}%`,sub:null,icon:wr,color:"text-orange-400",bg:"bg-orange-500/20",link:"/distribution"},{title:"存客宝获客",value:ie?ie.ckbTotal??0:null,sub:(ie==null?void 0:ie.withContact)!=null?`含联系方式 ${ie.withContact} 人`:null,icon:jo,color:"text-cyan-400",bg:"bg-cyan-500/20",link:"/users?tab=leads"},{title:"伙伴&推广协同",value:K?null:((Y==null?void 0:Y.totalMatches)??0)+((Ne==null?void 0:Ne.totalClicks)??0),sub:K?null:`找伙伴 ${(Y==null?void 0:Y.totalMatches)??0} / 推广 ${(Ne==null?void 0:Ne.totalClicks)??0}`,icon:Sc,color:"text-emerald-400",bg:"bg-emerald-500/20",link:"/find-partner"}];return s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),C&&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:C}),s.jsx("button",{type:"button",onClick:()=>Vt(),className:"text-amber-400 hover:text-amber-300 underline",children:"重试"})]}),s.jsx("div",{className:"flex flex-nowrap gap-6 mb-8 overflow-x-auto pb-1",children:Ft.map((je,Te)=>s.jsxs(_e,{className:"min-w-[220px] flex-1 bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>je.link&&t(je.link),children:[s.jsxs(ft,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsx(pt,{className:"text-sm font-medium text-gray-400",children:je.title}),s.jsx("div",{className:`p-2 rounded-lg ${je.bg}`,children:s.jsx(je.icon,{className:`w-4 h-4 ${je.color}`})})]}),s.jsx(ze,{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:je.value!=null?je.value:s.jsxs("span",{className:"inline-flex items-center gap-2 text-gray-500",children:[s.jsx(Ve,{className:"w-4 h-4 animate-spin"}),"加载中"]})}),je.sub&&s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:je.sub})]}),s.jsx(ml,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},Te))}),s.jsxs("div",{className:"flex gap-2 mb-6 mt-2",children:[s.jsx("button",{type:"button",onClick:()=>I("overview"),className:`px-5 py-2 rounded-lg text-sm font-medium transition-colors ${he==="overview"?"bg-[#38bdac] text-white":"bg-[#0f2137] text-gray-400 hover:text-white hover:bg-gray-700/50 border border-gray-700/50"}`,children:"数据概览"}),s.jsx("button",{type:"button",onClick:()=>I("tags"),className:`px-5 py-2 rounded-lg text-sm font-medium transition-colors ${he==="tags"?"bg-[#38bdac] text-white":"bg-[#0f2137] text-gray-400 hover:text-white hover:bg-gray-700/50 border border-gray-700/50"}`,children:"用户标签点击统计"}),s.jsx("button",{type:"button",onClick:()=>I("super"),className:`px-5 py-2 rounded-lg text-sm font-medium transition-colors ${he==="super"?"bg-[#38bdac] text-white":"bg-[#0f2137] text-gray-400 hover:text-white hover:bg-gray-700/50 border border-gray-700/50"}`,children:"超级个体统计"})]}),he==="overview"&&s.jsxs("div",{className:"space-y-8",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{className:"flex flex-row items-center justify-between",children:[s.jsx(pt,{className:"text-white",children:"找伙伴 × 推广中心(共统计)"}),s.jsxs("button",{type:"button",onClick:()=>Vt(),disabled:K,className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1 disabled:opacity-50",title:"刷新共统计",children:[s.jsx(Ve,{className:`w-3.5 h-3.5 ${K?"animate-spin":""}`}),"刷新"]})]}),s.jsxs(ze,{children:[K&&!Y&&!Ne?s.jsxs("div",{className:"flex items-center justify-center py-10 text-gray-500",children:[s.jsx(Ve,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-6 gap-4",children:[s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"找伙伴总匹配"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(Y==null?void 0:Y.totalMatches)??0})]}),s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"找伙伴今日"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(Y==null?void 0:Y.todayMatches)??0})]}),s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"找伙伴用户数"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(Y==null?void 0:Y.uniqueUsers)??0})]}),s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"推广总点击"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(Ne==null?void 0:Ne.totalClicks)??0})]}),s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"推广总绑定"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(Ne==null?void 0:Ne.totalBindings)??0})]}),s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"推广总转化"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(Ne==null?void 0:Ne.totalConversions)??0})]})]}),(Ne==null?void 0:Ne.conversionRate)&&s.jsxs("p",{className:"text-xs text-gray-500 mt-3",children:["推广转化率:",Ne.conversionRate]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{className:"flex flex-row items-center justify-between",children:[s.jsx(pt,{className:"text-white",children:"最近订单"}),s.jsxs("button",{type:"button",onClick:()=>Vt(),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(Ve,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(Ve,{className:"w-3.5 h-3.5"}),"刷新"]})]}),s.jsx(ze,{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(Ve,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[h.slice(0,X?10:4).map(je=>{var Ct;const Te=je.referrerId?c.find($e=>$e.id===je.referrerId):void 0,Ue=je.referralCode||(Te==null?void 0:Te.referralCode)||(Te==null?void 0:Te.nickname)||(je.referrerId?String(je.referrerId).slice(0,8):""),it=Nn(je),Dt=je.userNickname||((Ct=c.find($e=>$e.id===je.userId))==null?void 0:Ct.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:[je.userAvatar?s.jsx("img",{src:je.userAvatar,alt:Dt,className:"w-9 h-9 rounded-full object-cover shrink-0 mt-0.5",onError:$e=>{$e.currentTarget.style.display="none";const mt=$e.currentTarget.nextElementSibling;mt&&mt.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] shrink-0 mt-0.5 ${je.userAvatar?"hidden":""}`,children:Dt.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:()=>{je.userId&&(q(je.userId),H(!0))},className:"text-sm text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:Dt}),s.jsx("span",{className:"text-gray-600",children:"·"}),s.jsx("span",{className:"text-sm font-medium text-white truncate",title:it.title,children:it.title})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[it.subtitle&&it.subtitle!=="章节购买"&&s.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:it.subtitle}),s.jsx("span",{children:new Date(je.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),Ue&&s.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",Ue]})]})]}),s.jsxs("div",{className:"text-right ml-4 shrink-0",children:[s.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(je.amount).toFixed(2)]}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:je.paymentMethod||"微信"})]})]},je.id)}),h.length>4&&!X&&s.jsx("button",{type:"button",onClick:()=>V(!0),className:"w-full py-2 text-sm text-[#38bdac] hover:text-[#2da396] border border-dashed border-gray-600 rounded-lg hover:border-[#38bdac]/50 transition-colors",children:"展开更多"}),h.length===0&&!r&&s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Gd,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(ft,{children:s.jsx(pt,{className:"text-white",children:"新注册用户"})}),s.jsx(ze,{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(Ve,{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(je=>{var Te;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:((Te=je.nickname)==null?void 0:Te.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("button",{type:"button",onClick:()=>{q(je.id),H(!0)},className:"text-sm font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:je.nickname||"匿名用户"}),s.jsx("p",{className:"text-xs text-gray-500",children:je.phone||"未绑定手机"})]})]}),s.jsx("p",{className:"text-xs text-gray-400",children:je.createdAt?new Date(je.createdAt).toLocaleDateString():"-"})]},je.id)}),c.length===0&&!i&&s.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})})]})]})]}),he==="tags"&&s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{className:"flex flex-row items-center justify-between",children:[s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(Sc,{className:"w-5 h-5 text-[#38bdac]"}),"分类标签点击统计"]}),s.jsx("div",{className:"flex items-center gap-2",children:["today","week","month","all"].map(je=>s.jsx("button",{type:"button",onClick:()=>{U(je),_t(je)},className:`px-3 py-1 text-xs rounded-full transition-colors ${F===je?"bg-[#38bdac] text-white":"bg-gray-700/50 text-gray-400 hover:bg-gray-700"}`,children:{today:"今日",week:"本周",month:"本月",all:"全部"}[je]},je))})]}),s.jsx(ze,{children:oe&&!pe?s.jsxs("div",{className:"flex items-center justify-center py-12 text-gray-500",children:[s.jsx(Ve,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):pe&&Object.keys(pe.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:pe.total})," 次"]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Object.entries(pe.byModule).sort((je,Te)=>Te[1].reduce((Ue,it)=>Ue+it.count,0)-je[1].reduce((Ue,it)=>Ue+it.count,0)).slice(0,5).map(([je,Te])=>{const Ue=Te.reduce((it,Dt)=>it+Dt.count,0);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:$n[je]||je}),s.jsxs("span",{className:"text-xs text-gray-500",children:[Ue," 次"]})]}),s.jsx("div",{className:"space-y-2",children:Te.sort((it,Dt)=>Dt.count-it.count).slice(0,8).map((it,Dt)=>{const Ct=En(it);return s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-gray-300 truncate mr-2",title:Ct,children:Ct}),s.jsxs("div",{className:"flex items-center gap-2 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:`${Ue>0?it.count/Ue*100:0}%`}})}),s.jsx("span",{className:"text-gray-400 w-8 text-right",children:it.count})]})]},Dt)})})]},je)})})]}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Sc,{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:"小程序端接入埋点后,数据将在此实时展示"})]})})]}),he==="super"&&s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{className:"flex flex-row items-center justify-between",children:[s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(Sc,{className:"w-5 h-5 text-amber-400"}),"超级个体点击统计"]}),s.jsxs(J,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-300 h-8",onClick:vn,disabled:xe,children:[s.jsx(Ve,{className:`w-3.5 h-3.5 mr-1 ${xe?"animate-spin":""}`}),"刷新"]})]}),s.jsx(ze,{children:xe&&Q.length===0?s.jsxs("div",{className:"flex items-center justify-center py-12 text-gray-500",children:[s.jsx(Ve,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):Q.length>0?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:"text-xs text-gray-400 border-b border-gray-700/50",children:[s.jsx("th",{className:"text-left py-2 px-3 font-normal",children:"排名"}),s.jsx("th",{className:"text-left py-2 px-3 font-normal",children:"超级个体"}),s.jsx("th",{className:"text-center py-2 px-3 font-normal",children:"总点击"}),s.jsx("th",{className:"text-center py-2 px-3 font-normal",children:"独立访客"}),s.jsx("th",{className:"text-center py-2 px-3 font-normal",children:"人均点击"}),s.jsx("th",{className:"text-center py-2 px-3 font-normal",title:"该用户绑定 @人物 后,指向其 person 的留资独立人数",children:"获客(去重)"}),s.jsx("th",{className:"text-left py-2 px-3 font-normal",children:"手机号"})]})}),s.jsx("tbody",{children:Q.map((je,Te)=>s.jsxs("tr",{className:"border-b border-gray-700/30 hover:bg-[#0a1628]/80",children:[s.jsx("td",{className:"py-2 px-3 text-gray-500 text-xs",children:Te+1}),s.jsx("td",{className:"py-2 px-3",children:s.jsxs("div",{className:"flex items-center gap-2",children:[je.avatar?s.jsx("img",{src:je.avatar,alt:"",className:"w-7 h-7 rounded-full object-cover"}):s.jsx("div",{className:"w-7 h-7 rounded-full bg-gray-700 flex items-center justify-center text-xs text-gray-400",children:"?"}),s.jsx("button",{type:"button",className:"text-amber-400 hover:text-amber-300 hover:underline text-left text-sm truncate max-w-[160px]",onClick:()=>t(`/users?search=${encodeURIComponent(je.nickname||je.userId)}`),title:"点击跳转用户管理",children:je.nickname||je.userId})]})}),s.jsx("td",{className:"py-2 px-3 text-center text-white font-bold",children:je.clicks}),s.jsx("td",{className:"py-2 px-3 text-center text-[#38bdac]",children:je.uniqueClicks}),s.jsx("td",{className:"py-2 px-3 text-center text-gray-400",children:je.uniqueClicks>0?(je.clicks/je.uniqueClicks).toFixed(1):"-"}),s.jsx("td",{className:"py-2 px-3 text-center text-green-400 text-xs font-medium",children:typeof je.leadCount=="number"?je.leadCount:0}),s.jsx("td",{className:"py-2 px-3 text-gray-400 text-xs",children:je.phone||"-"})]},je.userId))})]})}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Sc,{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(X0,{open:z,onClose:()=>{H(!1),q(null)},userId:L,onUserUpdated:()=>Vt()})]})}const Ls=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{className:"relative w-full overflow-auto",children:s.jsx("table",{ref:n,className:$t("w-full caption-bottom text-sm",t),...e})}));Ls.displayName="Table";const Os=y.forwardRef(({className:t,...e},n)=>s.jsx("thead",{ref:n,className:$t("[&_tr]:border-b",t),...e}));Os.displayName="TableHeader";const Ds=y.forwardRef(({className:t,...e},n)=>s.jsx("tbody",{ref:n,className:$t("[&_tr:last-child]:border-0",t),...e}));Ds.displayName="TableBody";const Nt=y.forwardRef(({className:t,...e},n)=>s.jsx("tr",{ref:n,className:$t("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));Nt.displayName="TableRow";const Ce=y.forwardRef(({className:t,...e},n)=>s.jsx("th",{ref:n,className:$t("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));Ce.displayName="TableHead";const ke=y.forwardRef(({className:t,...e},n)=>s.jsx("td",{ref:n,className:$t("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));ke.displayName="TableCell";function Lo(t,e){const[n,r]=y.useState(t);return y.useEffect(()=>{const a=setTimeout(()=>r(t),e);return()=>clearTimeout(a)},[t,e]),n}function rr({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 qR(){const[t,e]=y.useState([]),[n,r]=y.useState([]),[a,i]=y.useState(0),[o,c]=y.useState(0),[u,h]=y.useState(0),[f,m]=y.useState(1),[x,b]=y.useState(10),[v,w]=y.useState(""),N=Lo(v,300),[k,T]=y.useState("all"),[C,P]=y.useState(!0),[L,q]=y.useState(null),[z,H]=y.useState(null),[R,se]=y.useState(""),[X,V]=y.useState(!1);async function ie(){P(!0),q(null);try{const Z=k==="all"?"":k==="completed"?"completed":k,F=new URLSearchParams({page:String(f),pageSize:String(x),...Z&&{status:Z},...N&&{search:N}}),[U,pe]=await Promise.all([Oe(`/api/admin/orders?${F}`),Oe("/api/db/users?page=1&pageSize=500")]);U!=null&&U.success&&(e(U.orders||[]),i(U.total??0),c(U.totalRevenue??0),h(U.todayRevenue??0)),pe!=null&&pe.success&&pe.users&&r(pe.users)}catch(Z){console.error("加载订单失败",Z),q("加载订单失败,请检查网络后重试")}finally{P(!1)}}y.useEffect(()=>{m(1)},[N,k]),y.useEffect(()=>{ie()},[f,x,N,k]);const le=Z=>{var F;return Z.userNickname||((F=n.find(U=>U.id===Z.userId))==null?void 0:F.nickname)||"匿名用户"},he=Z=>{var F;return((F=n.find(U=>U.id===Z))==null?void 0:F.phone)||"-"},I=Z=>{const F=Z.productType||Z.type||"",U=Z.description||"";if(F==="balance_recharge")return{name:`余额充值 ¥${Number(Z.amount||0).toFixed(2)}`,type:"余额充值"};if(U){if(F==="section"&&(U.includes("章节")||U.includes("代付领取"))){if(U.includes("代付领取"))return{name:U.replace("代付领取 - ",""),type:"代付领取"};if(U.includes("-")){const pe=U.split("-");if(pe.length>=3)return{name:`第${pe[1]}章 第${pe[2]}节`,type:"《一场Soul的创业实验》"}}return{name:U,type:"章节购买"}}return F==="fullbook"||U.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:F==="vip"||U.includes("VIP")?{name:"超级个体开通费用",type:"超级个体"}:F==="match"||U.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:U,type:"其他"}}return F==="section"?{name:`章节 ${Z.productId||Z.sectionId||""}`,type:"单章"}:F==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:F==="vip"?{name:"超级个体开通费用",type:"超级个体"}:F==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:F||"其他"}},Q=Math.ceil(a/x)||1;async function $(){var Z;if(!(!(z!=null&&z.orderSn)&&!(z!=null&&z.id))){V(!0),q(null);try{const F=await tn("/api/admin/orders/refund",{orderSn:z.orderSn||z.id,reason:R||void 0});F!=null&&F.success?(H(null),se(""),ie()):q((F==null?void 0:F.error)||"退款失败")}catch(F){const U=F;q(((Z=U==null?void 0:U.data)==null?void 0:Z.error)||"退款失败,请检查网络后重试")}finally{V(!1)}}}function xe(){if(t.length===0){G.info("暂无数据可导出");return}const Z=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],F=t.map(D=>{const K=I(D);return[D.orderSn||D.id||"",le(D),he(D.userId),K.name,Number(D.amount||0).toFixed(2),D.paymentMethod==="wechat"?"微信支付":D.paymentMethod==="balance"?"余额支付":D.paymentMethod==="alipay"?"支付宝":D.paymentMethod||"微信支付",D.status==="refunded"?"已退款":D.status==="paid"||D.status==="completed"?"已完成":D.status==="pending"||D.status==="created"?"待支付":"已失败",D.status==="refunded"&&D.refundReason?D.refundReason:"-",D.referrerEarnings?Number(D.referrerEarnings).toFixed(2):"-",D.createdAt?new Date(D.createdAt).toLocaleString("zh-CN"):""].join(",")}),U="\uFEFF"+[Z.join(","),...F].join(` -`),pe=new Blob([U],{type:"text/csv;charset=utf-8"}),fe=URL.createObjectURL(pe),oe=document.createElement("a");oe.href=fe,oe.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,oe.click(),URL.revokeObjectURL(fe)}return s.jsxs("div",{className:"p-8 w-full",children:[L&&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:L}),s.jsx("button",{type:"button",onClick:()=>q(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(J,{variant:"outline",onClick:ie,disabled:C,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ve,{className:`w-4 h-4 mr-2 ${C?"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(va,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(ce,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:v,onChange:Z=>w(Z.target.value)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Uj,{className:"w-4 h-4 text-gray-400"}),s.jsxs("select",{value:k,onChange:Z=>T(Z.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(J,{variant:"outline",onClick:xe,disabled:t.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(I5,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(ze,{className:"p-0",children:C?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ve,{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(Ls,{children:[s.jsx(Os,{children:s.jsxs(Nt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400",children:"订单号"}),s.jsx(Ce,{className:"text-gray-400",children:"用户"}),s.jsx(Ce,{className:"text-gray-400",children:"商品"}),s.jsx(Ce,{className:"text-gray-400",children:"金额"}),s.jsx(Ce,{className:"text-gray-400",children:"支付方式"}),s.jsx(Ce,{className:"text-gray-400",children:"状态"}),s.jsx(Ce,{className:"text-gray-400",children:"退款原因"}),s.jsx(Ce,{className:"text-gray-400",children:"分销佣金"}),s.jsx(Ce,{className:"text-gray-400",children:"下单时间"}),s.jsx(Ce,{className:"text-gray-400",children:"操作"})]})}),s.jsxs(Ds,{children:[t.map(Z=>{const F=I(Z);return s.jsxs(Nt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsxs(ke,{className:"font-mono text-xs text-gray-400",children:[(Z.orderSn||Z.id||"").slice(0,12),"..."]}),s.jsx(ke,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[le(Z),Z.paymentMethod==="gift_pay"&&s.jsx(He,{className:"bg-emerald-500/20 text-emerald-400 hover:bg-emerald-500/20 border-0 text-xs",children:"代付领取"}),Z.payerUserId&&Z.paymentMethod!=="gift_pay"&&s.jsx(He,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"代付"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:he(Z.userId)}),Z.payerUserId&&Z.payerNickname&&s.jsxs("p",{className:"text-amber-400/80 text-xs mt-0.5",children:[Z.paymentMethod==="gift_pay"?"赠送人:":"代付人:",Z.payerNickname]})]})}),s.jsx(ke,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[F.name,(Z.productType||Z.type)==="vip"&&s.jsx(He,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"超级个体"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:F.type})]})}),s.jsxs(ke,{className:"text-[#38bdac] font-bold",children:["¥",Number(Z.amount||0).toFixed(2)]}),s.jsx(ke,{className:"text-gray-300",children:Z.paymentMethod==="wechat"?"微信支付":Z.paymentMethod==="balance"?"余额支付":Z.paymentMethod==="alipay"?"支付宝":Z.paymentMethod||"微信支付"}),s.jsx(ke,{children:s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[Z.status==="refunded"?s.jsx(He,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):Z.status==="paid"||Z.status==="completed"?s.jsx(He,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):Z.status==="pending"||Z.status==="created"?s.jsx(He,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):s.jsx(He,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"}),(Z.status==="paid"||Z.status==="completed")&&(Z.webhookPushStatus==="sent"?s.jsx(He,{className:"bg-emerald-500/20 text-emerald-300 hover:bg-emerald-500/20 border-0",children:"已推送"}):s.jsx(He,{className:"bg-orange-500/20 text-orange-300 hover:bg-orange-500/20 border-0",children:"待补推"}))]})}),s.jsx(ke,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:Z.refundReason,children:Z.status==="refunded"&&Z.refundReason?Z.refundReason:"-"}),s.jsx(ke,{className:"text-[#FFD700]",children:Z.referrerEarnings?`¥${Number(Z.referrerEarnings).toFixed(2)}`:"-"}),s.jsx(ke,{className:"text-gray-400 text-sm",children:new Date(Z.createdAt).toLocaleString("zh-CN")}),s.jsx(ke,{children:(Z.status==="paid"||Z.status==="completed")&&Z.paymentMethod!=="balance"&&s.jsxs(J,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{H(Z),se("")},children:[s.jsx(qj,{className:"w-3 h-3 mr-1"}),"退款"]})})]},Z.id)}),t.length===0&&s.jsx(Nt,{children:s.jsx(ke,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),s.jsx(rr,{page:f,totalPages:Q,total:a,pageSize:x,onPageChange:m,onPageSizeChange:Z=>{b(Z),m(1)}})]})})}),s.jsx(Wt,{open:!!z,onOpenChange:Z=>!Z&&H(null),children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Kt,{children:s.jsx(qt,{className:"text-white",children:"订单退款"})}),z&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",z.orderSn||z.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(z.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(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:R,onChange:Z=>se(Z.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(Sn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>H(null),disabled:X,children:"取消"}),s.jsx(J,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:$,disabled:X,children:X?"退款中...":"确认退款"})]})]})})]})}const Il=y.forwardRef(({className:t,...e},n)=>s.jsx("textarea",{className:$t("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}));Il.displayName="Textarea";const J1=["INTJ","INTP","ENTJ","ENTP","INFJ","INFP","ENFJ","ENFP","ISTJ","ISFJ","ESTJ","ESFJ","ISTP","ISFP","ESTP","ESFP"],p2={INTJ:{title:"战略家",group:"NT",mood:"sharp"},INTP:{title:"逻辑学家",group:"NT",mood:"calm"},ENTJ:{title:"指挥官",group:"NT",mood:"sharp"},ENTP:{title:"辩论家",group:"NT",mood:"playful"},INFJ:{title:"提倡者",group:"NF",mood:"warm"},INFP:{title:"调停者",group:"NF",mood:"warm"},ENFJ:{title:"主人公",group:"NF",mood:"warm"},ENFP:{title:"竞选者",group:"NF",mood:"playful"},ISTJ:{title:"物流师",group:"SJ",mood:"calm"},ISFJ:{title:"守卫者",group:"SJ",mood:"warm"},ESTJ:{title:"总经理",group:"SJ",mood:"sharp"},ESFJ:{title:"执政官",group:"SJ",mood:"warm"},ISTP:{title:"鉴赏家",group:"SP",mood:"sharp"},ISFP:{title:"探险家",group:"SP",mood:"playful"},ESTP:{title:"企业家",group:"SP",mood:"playful"},ESFP:{title:"表演者",group:"SP",mood:"playful"}};function GR(t){switch(t){case"NT":return{bg:"#0d1424",body:"#c89a2c",accent:"#ffd66b",hair:"#6d540f",line:"#111827"};case"NF":return{bg:"#0a1721",body:"#2e9f7c",accent:"#84e9c9",hair:"#2d6a4f",line:"#11212a"};case"SJ":return{bg:"#101828",body:"#4f8cb8",accent:"#9bd4ff",hair:"#2e4a66",line:"#111f2d"};case"SP":return{bg:"#161225",body:"#8b6bc0",accent:"#ccb3ff",hair:"#574183",line:"#211832"};default:return{bg:"#0e1422",body:"#38bdac",accent:"#7ee7db",hair:"#1f6f66",line:"#10202d"}}}function JR(t){switch(t){case"sharp":return{eye:"M222 222 L242 220 M270 220 L290 222",brow:"M218 210 L244 202 M268 202 L294 210",mouth:"M234 256 Q256 246 278 256",tilt:-5};case"warm":return{eye:"M222 224 Q232 230 242 224 M270 224 Q280 230 290 224",brow:"M220 210 Q232 206 244 210 M268 210 Q280 206 292 210",mouth:"M232 254 Q256 272 280 254",tilt:2};case"playful":return{eye:"M222 224 Q232 236 242 224 M270 224 Q280 236 290 224",brow:"M220 210 Q234 200 246 208 M266 208 Q278 200 292 210",mouth:"M232 256 Q256 266 280 250",tilt:8};default:return{eye:"M222 224 Q232 220 242 224 M270 224 Q280 220 290 224",brow:"M220 210 Q232 208 244 210 M268 210 Q280 208 292 210",mouth:"M236 256 Q256 260 276 256",tilt:0}}}function QR(t){switch(t){case"sharp":return"M168 370 L206 300 L256 332 L306 300 L344 370 L306 392 L256 374 L206 392 Z";case"warm":return"M166 368 Q188 318 226 314 L256 340 L286 314 Q324 318 346 368 L314 392 Q286 404 256 396 Q226 404 198 392 Z";case"playful":return"M164 370 L198 304 L252 332 L318 300 L350 374 L316 394 L258 378 L196 396 Z";default:return"M166 370 L202 306 L256 336 L310 306 L346 370 L310 392 L256 380 L202 392 Z"}}function Q1(t){const e=p2[t],n=GR(e.group),r=JR(e.mood),a=QR(e.mood),i=` - - - - - - - - - - - - - - - - - - - - - - - - - -`;return`data:image/svg+xml;utf8,${encodeURIComponent(i)}`}function YR(){const[t,e]=y.useState({}),[n,r]=y.useState(!0),[a,i]=y.useState(!1),[o,c]=y.useState(!1),u=y.useCallback(async()=>{r(!0);try{const x=await Oe("/api/admin/mbti-avatars");x!=null&&x.avatars?e(x.avatars):e({})}catch{G.error("加载 MBTI 头像配置失败")}finally{r(!1)}},[]);y.useEffect(()=>{u()},[u]);const h=async()=>{i(!0);try{const x=await jt("/api/admin/mbti-avatars",{avatars:t});if(!x||x.success===!1){G.error((x==null?void 0:x.error)||"保存失败");return}G.success("已保存,后台与小程序默认头像同步生效"),u()}catch{G.error("保存失败")}finally{i(!1)}},f=x=>{const b=Q1(x);e(v=>({...v,[x]:b})),G.success(`${x} 已生成`)},m=()=>{c(!0);try{const x={...t};J1.forEach(b=>{x[b]=Q1(b)}),e(x),G.success("16 型头像已生成(仅人物)")}finally{c(!1)}};return n?s.jsxs("div",{className:"flex items-center justify-center py-16 text-gray-400",children:[s.jsx(Ve,{className:"w-5 h-5 mr-2 animate-spin text-[#38bdac]"}),"加载配置…"]}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-[#38bdac]/25 shadow-xl",children:[s.jsxs(ft,{className:"pb-2",children:[s.jsxs(pt,{className:"text-white flex items-center gap-2 text-lg",children:[s.jsx(rA,{className:"w-5 h-5 text-[#38bdac]"}),"MBTI 头像库"]}),s.jsx(nn,{className:"text-gray-400 text-sm leading-relaxed",children:"采用人物化风格,按 MBTI 性格自动生成。头像内不显示中英文,仅显示人物形象,颜色与站点主题融合。"})]}),s.jsxs(ze,{className:"flex flex-wrap gap-2",children:[s.jsxs(J,{type:"button",size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396]",onClick:m,disabled:o,children:[s.jsx(EA,{className:"w-3.5 h-3.5 mr-1"}),o?"生成中…":"一键生成16头像"]}),s.jsxs(J,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-300",onClick:u,children:[s.jsx(Ve,{className:"w-3.5 h-3.5 mr-1"}),"重新加载"]}),s.jsxs(J,{type:"button",size:"sm",className:"bg-emerald-600 hover:bg-emerald-500",onClick:h,disabled:a,children:[s.jsx(In,{className:"w-3.5 h-3.5 mr-1"}),a?"保存中…":"保存映射"]})]})]}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:J1.map(x=>{const b=t[x]??"",v=p2[x];return s.jsxs("div",{className:"rounded-xl border border-gray-700/60 bg-[#0a1628] p-3 flex flex-col gap-2 hover:border-[#38bdac]/35 transition-colors",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(He,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 font-mono text-xs",children:x}),s.jsx("span",{className:"text-xs text-gray-400 truncate",title:v.title,children:v.title})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-16 h-16 rounded-full shrink-0 overflow-hidden flex items-center justify-center bg-[#081322] ring-2 ring-[#38bdac]/40 ring-offset-2 ring-offset-[#0a1628]",children:b?s.jsx("img",{src:b,alt:x,className:"w-full h-full object-cover scale-110"}):s.jsx("span",{className:"text-gray-600 text-[10px]",children:"未配"})}),s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"https://... 或 data:image/...",value:b,onChange:w=>e(N=>({...N,[x]:w.target.value}))})})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(J,{type:"button",size:"sm",variant:"outline",className:"h-7 text-[11px] border-[#38bdac]/40 text-[#38bdac]",onClick:()=>f(x),children:"生成这张"}),s.jsx(J,{type:"button",size:"sm",variant:"ghost",className:"h-7 text-[11px] text-gray-400",onClick:()=>e(w=>({...w,[x]:""})),children:"清空"})]})]},x)})})]})}const Y1=[{value:"after_login",label:"注册/登录成功",group:"用户状态"},{value:"bind_phone",label:"绑定手机号",group:"用户状态"},{value:"update_avatar",label:"完善头像(非默认图,与昵称分开配置)",group:"用户状态"},{value:"update_nickname",label:"修改昵称(非默认微信昵称,与头像分开)",group:"用户状态"},{value:"fill_profile",label:"完善资料(MBTI/行业/职位,不含头像昵称)",group:"用户状态"},{value:"view_chapter",label:"浏览章节",group:"阅读行为"},{value:"browse_5_chapters",label:"累计浏览5个章节",group:"阅读行为"},{value:"purchase_section",label:"购买单章",group:"付费行为"},{value:"purchase_fullbook",label:"购买全书/VIP",group:"付费行为"},{value:"after_pay",label:"任意付款成功",group:"付费行为"},{value:"after_match",label:"完成派对匹配",group:"社交行为"},{value:"click_super_individual",label:"点击超级个体头像",group:"社交行为"},{value:"lead_submit",label:"提交留资/链接",group:"社交行为"},{value:"referral_bind",label:"被推荐人绑定",group:"分销行为"},{value:"share_action",label:"分享给好友/朋友圈",group:"分销行为"},{value:"withdraw_request",label:"申请提现",group:"分销行为"},{value:"add_wechat",label:"添加微信联系方式",group:"用户状态"}],X1=[{value:"popup",label:"弹窗提示",desc:"在小程序内弹窗引导用户完成下一步"},{value:"navigate",label:"跳转页面",desc:"引导用户跳转到指定页面"},{value:"webhook",label:"推送飞书群",desc:"触发后推送消息到飞书群Webhook"},{value:"tag",label:"自动打标签",desc:"触发后自动给用户打上指定标签"}];function m2(t){if(Array.isArray(t))return t.filter(e=>typeof e=="string");if(typeof t=="string")try{const e=JSON.parse(t);if(Array.isArray(e))return e.filter(n=>typeof n=="string")}catch{try{const e=typeof atob=="function"?atob(t):"",n=JSON.parse(e);if(Array.isArray(n))return n.filter(r=>typeof r=="string")}catch{}}return[]}function XR(t){return{...t,triggerConditions:m2(t.triggerConditions)}}const ZR=[{level:"S",range:"≥85",label:"高价值"},{level:"A",range:"70–84",label:"优质"},{level:"B",range:"50–69",label:"中等"},{level:"C",range:"30–49",label:"潜力"},{level:"D",range:"<30",label:"待激活"}],wc=[{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 Z1(t){return confirm(`确定删除该${t}?此操作不可恢复。`)?window.prompt(`请输入「删除」以确认删除${t}`)==="删除":!1}function e8(){var Yo,Pu,dd,Ru,Lu,Ou,Du;const[t,e]=_0(),n=t.get("pool"),r=t.get("tab")||"users",a=["users","journey","rules","vip-roles","leads"].includes(r)?r:"users",[i,o]=y.useState([]),[c,u]=y.useState(0),[h,f]=y.useState(1),[m,x]=y.useState(10),[b,v]=y.useState(""),w=Lo(b,300),N=n==="vip"?"vip":n==="complete"?"complete":"all",[k,T]=y.useState(N),[C,P]=y.useState(!0),[L,q]=y.useState(!1),[z,H]=y.useState(null),[R,se]=y.useState(!1),[X,V]=y.useState(!1),[ie,le]=y.useState("desc");y.useEffect(()=>{n==="vip"?T("vip"):n==="complete"?T("complete"):n==="all"&&T("all")},[n]);const[he,I]=y.useState(!1),[Q,$]=y.useState(null),[xe,Z]=y.useState(!1),[F,U]=y.useState(!1),[pe,fe]=y.useState({referrals:[],stats:{}}),[oe,D]=y.useState(!1),[K,_]=y.useState(null),[Y,te]=y.useState(!1),[Ne,Fe]=y.useState(null),[We,St]=y.useState(!1),[wt,Vt]=y.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),[_t,$n]=y.useState([]),[Jt,dn]=y.useState(!1),[yn,bn]=y.useState(!1),[En,vn]=y.useState(null),[At,Nn]=y.useState({title:"",description:"",trigger:"",triggerConditions:[],actionType:"popup",sort:0,enabled:!0}),[Ft,je]=y.useState([]),[Te,Ue]=y.useState(!1),[it,Dt]=y.useState(null),[Ct,$e]=y.useState(null),[mt,es]=y.useState({}),[is,Gn]=y.useState(!1),[Fn,or]=y.useState(null),[ls,ws]=y.useState([]),[kr,Pn]=y.useState(!1),[Js,js]=y.useState(null),[Sr,lr]=y.useState(""),[cs,Cr]=y.useState([]),[cr,dr]=y.useState(!1),[ra,Qs]=y.useState({}),[ks,Ss]=y.useState([]),[Ys,wn]=y.useState(0),[re,ve]=y.useState(1),[Ye]=y.useState(20),[ut,Bn]=y.useState(!1),[zs,Vr]=y.useState(null),[aa,Ca]=y.useState(""),ds=Lo(aa,300),[us,Ea]=y.useState(""),[zt,Ya]=y.useState(""),[O,Se]=y.useState({}),[Ze,It]=y.useState(null),[Et,ht]=y.useState(null),[xt,jn]=y.useState([]),[Ot,Er]=y.useState(!1),Xs=y.useRef(null),[Wl,Xa]=y.useState(!1),Cs=y.useCallback(async(M,de)=>{Bn(!0),Vr(null);try{const we=new URLSearchParams({mode:"contact",page:String(re),pageSize:String(Ye)}),Pe=M??ds;Pe&&we.set("search",Pe);const qe=de??us;qe&&we.set("source",qe),zt&&we.set("pushStatus",zt);const Qe=await Oe(`/api/db/ckb-leads?${we}`);if(Qe!=null&&Qe.success)Ss(Qe.records||[]),wn(Qe.total??0),Qe.stats&&Se(Qe.stats);else{const en=(Qe==null?void 0:Qe.error)||"加载获客列表失败";Vr(en),G.error(en),Ss([]),wn(0)}}catch(we){const Pe=we instanceof Error?we.message:"网络错误";Vr(Pe),G.error("加载获客列表失败: "+Pe),Ss([]),wn(0)}finally{Bn(!1)}},[re,Ye,ds,us,zt]);y.useEffect(()=>{jn([])},[ds,us,zt]);function ia(M,de){return{...M,...de.pushStatus!==void 0?{pushStatus:de.pushStatus}:{},...typeof de.retryCount=="number"?{retryCount:de.retryCount}:{},...de.ckbError!==void 0?{ckbError:de.ckbError}:{},...de.lastPushAt!==void 0?{lastPushAt:de.lastPushAt??void 0}:{},...de.nextRetryAt!==void 0?{nextRetryAt:de.nextRetryAt??void 0}:{}}}async function Za(M){if(M){It(M);try{const de=await jt("/api/db/ckb-leads/retry",{id:M});de!=null&&de.success?(G.success(de.pushed?"重推成功":"已发起重推,请刷新查看状态"),de.record&&Ss(we=>we.map(Pe=>Pe.id===M?ia(Pe,de.record):Pe))):G.error((de==null?void 0:de.error)||"重推失败")}catch(de){G.error(de instanceof Error?de.message:"重推请求失败")}finally{It(null)}}}async function od(M){if(M&&confirm("确定删除该条获客记录?删除后不可恢复。")){ht(M);try{const de=await jt("/api/db/ckb-leads/delete",{id:M});de!=null&&de.success?G.success("已删除"):G.error((de==null?void 0:de.error)||"删除失败")}catch(de){G.error(de instanceof Error?de.message:"删除请求失败")}finally{ht(null),Cs()}}}async function zi(){const M=be.filter(Pe=>Pe.pushStatus==="failed");if(M.length===0){G.info("当前页无失败记录");return}Xa(!0);let de=0;for(const Pe of M)try{const qe=await jt("/api/db/ckb-leads/retry",{id:Pe.id});if(qe!=null&&qe.success&&qe.pushed&&de++,qe!=null&&qe.success&&qe.record){const Qe=qe.record;Ss(en=>en.map(Ge=>Ge.id===Pe.id?ia(Ge,Qe):Ge))}}catch{}Xa(!1);const we=M.length;G.success(`批量重推完成:成功 ${de} / ${we}`)}function $i(){const M=be.filter(Ge=>Ge.pushStatus==="failed");if(M.length===0){G.info("当前筛选下无失败记录可导出");return}const de=Ge=>`"${String(Ge??"").replace(/"/g,'""')}"`,Pe=[["ID","昵称","手机号","微信号","对应@人","来源","推送状态","重试次数","失败原因","下次重试时间","创建时间"].join(",")];for(const Ge of M)Pe.push([de(Ge.id),de(Ge.userNickname||Ge.name||""),de(Ge.phone||""),de(Ge.wechatId||""),de(Ge.personName||""),de(Ge.source||""),de(Ge.pushStatus||""),de(typeof Ge.retryCount=="number"?Ge.retryCount:""),de(Ge.ckbError||""),de(Ge.nextRetryAt?new Date(Ge.nextRetryAt).toLocaleString():""),de(Ge.createdAt?new Date(Ge.createdAt).toLocaleString():"")].join(","));const qe=new Blob(["\uFEFF"+Pe.join(` -`)],{type:"text/csv;charset=utf-8;"}),Qe=URL.createObjectURL(qe),en=document.createElement("a");en.href=Qe,en.download=`获客失败清单-${new Date().toISOString().slice(0,19).replace(/[:T]/g,"-")}.csv`,document.body.appendChild(en),en.click(),document.body.removeChild(en),URL.revokeObjectURL(Qe),G.success(`已导出失败清单(${M.length} 条)`)}const Fi=y.useCallback(async()=>{try{const M=await Oe("/api/admin/mbti-avatars"),de=M!=null&&M.avatars&&typeof M.avatars=="object"?M.avatars:{};Qs(de)}catch{Qs({})}},[]);y.useEffect(()=>{t.get("tab")==="leads"&&Cs()},[t.get("tab"),re,Cs]),y.useEffect(()=>{if(a!=="leads")return;const M=window.setInterval(()=>{Cs()},3e4);return()=>window.clearInterval(M)},[a,Cs]),y.useEffect(()=>{Fi()},[Fi]);const Ta=y.useCallback((M,de)=>{const we=(M||"").trim();if(we)return we;const Pe=(de||"").trim().toUpperCase();return/^[EI][NS][FT][JP]$/.test(Pe)?(ra[Pe]||"").trim():""},[ra]),oa=y.useCallback(M=>{const de=!!M.hasFullBook,we=Number(M.purchasedSectionCount||0);return de?{tone:"vip",main:"已购全书",sub:we>0?`另购单章 ${we} 章`:"购买项:VIP / 全书"}:we>0?{tone:"paid",main:`已购 ${we} 章`,sub:"购买项:章节"}:{tone:"free",main:"未购买",sub:""}},[]),[ei,ti]=y.useState(null),bt=y.useCallback(async()=>{try{const M=await Oe("/api/admin/users/online-stats");M!=null&&M.success&&typeof M.onlineCount=="number"?ti(M.onlineCount):ti(0)}catch{ti(null)}},[]);y.useEffect(()=>{bt();const M=setInterval(bt,1e4);return()=>clearInterval(M)},[bt]);async function Hr(M=!1){var de;P(!0),M&&q(!0),H(null);try{if(R){const we=new URLSearchParams({search:w,limit:String(m*5)}),Pe=await Oe(`/api/db/users/rfm?${we}`);if(Pe!=null&&Pe.success){let qe=Pe.users||[];ie==="asc"&&(qe=[...qe].reverse());const Qe=(h-1)*m;o(qe.slice(Qe,Qe+m)),u(((de=Pe.users)==null?void 0:de.length)??0),qe.length===0&&(se(!1),H("暂无订单数据,RFM 排序需要用户有购买记录后才能生效"))}else se(!1),H((Pe==null?void 0:Pe.error)||"RFM 加载失败,已切回普通模式")}else{const we=new URLSearchParams({page:String(h),pageSize:String(m),search:w,...k==="vip"&&{vip:"true"},...k==="complete"&&{pool:"complete"}}),Pe=await Oe(`/api/db/users?${we}`);Pe!=null&&Pe.success?(o(Pe.users||[]),u(Pe.total??0)):H((Pe==null?void 0:Pe.error)||"加载失败")}}catch(we){console.error("Load users error:",we),H("网络错误")}finally{P(!1),M&&q(!1)}}y.useEffect(()=>{f(1)},[w,k,R]),y.useEffect(()=>{Hr()},[h,m,w,k,R,ie]);const ni=Math.ceil(c/m)||1,Ma=()=>{R?ie==="desc"?le("asc"):(se(!1),le("desc")):(se(!0),le("desc"))},Bi=M=>({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"})[M||""]||"bg-gray-500/20 text-gray-400";async function hs(M){var de;if(!Z1("用户")){G.info("已取消删除");return}try{const we=await Ei(`/api/db/users?id=${encodeURIComponent(M)}`);we!=null&&we.success?(G.success("已删除"),Hr()):G.error("删除失败: "+((we==null?void 0:we.error)||"未知错误"))}catch(we){const Pe=we,qe=((de=Pe==null?void 0:Pe.data)==null?void 0:de.error)||(Pe==null?void 0:Pe.message)||"网络错误";G.error("删除失败: "+qe)}}const Kl=M=>{$(M),Vt({phone:M.phone||"",nickname:M.nickname||"",password:"",isAdmin:!!(M.isAdmin??!1),hasFullBook:!!(M.hasFullBook??!1)}),I(!0)},la=()=>{$(null),Vt({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),I(!0)};async function Vi(){if(!wt.phone||!wt.nickname){G.error("请填写手机号和昵称");return}Z(!0);try{if(Q){const M=await tn("/api/db/users",{id:Q.id,phone:wt.phone||void 0,nickname:wt.nickname,isAdmin:wt.isAdmin,hasFullBook:wt.hasFullBook,...wt.password&&{password:wt.password}});if(!(M!=null&&M.success)){G.error("更新失败: "+((M==null?void 0:M.error)||""));return}}else{const M=await jt("/api/db/users",{phone:wt.phone,nickname:wt.nickname,password:wt.password,isAdmin:wt.isAdmin});if(!(M!=null&&M.success)){G.error("创建失败: "+((M==null?void 0:M.error)||""));return}}I(!1),Hr()}catch{G.error("保存失败")}finally{Z(!1)}}async function Tr(M){_(M),U(!0),D(!0);try{const de=await Oe(`/api/db/users/referrals?userId=${encodeURIComponent(M.id)}`);de!=null&&de.success?fe({referrals:de.referrals||[],stats:de.stats||{}}):fe({referrals:[],stats:{}})}catch{fe({referrals:[],stats:{}})}finally{D(!1)}}const Es=y.useCallback(async()=>{dn(!0);try{const M=await Oe("/api/db/user-rules");M!=null&&M.success&&$n((M.rules||[]).map(de=>XR(de)))}catch{}finally{dn(!1)}},[]);async function Mr(){if(!At.title){G.error("请填写规则标题");return}Z(!0);try{if(En){const M=await tn("/api/db/user-rules",{id:En.id,...At});if(!(M!=null&&M.success)){G.error("更新失败: "+((M==null?void 0:M.error)||""));return}}else{const M=await jt("/api/db/user-rules",At);if(!(M!=null&&M.success)){G.error("创建失败: "+((M==null?void 0:M.error)||""));return}}bn(!1),Es()}catch{G.error("保存失败")}finally{Z(!1)}}async function si(M){if(!Z1("规则")){G.info("已取消删除");return}try{const de=await Ei(`/api/db/user-rules?id=${M}`);de!=null&&de.success&&Es()}catch{}}async function Aa(M){try{await tn("/api/db/user-rules",{id:M.id,enabled:!M.enabled}),Es()}catch{}}const sn=y.useCallback(async()=>{Ue(!0);try{const M=await Oe("/api/db/vip-members?limit=500");if(M!=null&&M.success&&M.data){const de=[...M.data].map((we,Pe)=>({...we,vipSort:typeof we.vipSort=="number"?we.vipSort:Pe+1}));de.sort((we,Pe)=>(we.vipSort??999999)-(Pe.vipSort??999999)),je(de)}else M&&M.error&&G.error(M.error)}catch{G.error("加载超级个体列表失败")}finally{Ue(!1)}},[]),[ld,Zs]=y.useState(!1),[ur,Hi]=y.useState(null),[Ar,hr]=y.useState(""),[Ia,ql]=y.useState(!1),[Ir,Ts]=y.useState(!1),[er,$s]=y.useState(null),[Gl,qo]=y.useState(""),[ri,Pa]=y.useState(!1),Ui=["创业者","资源整合者","技术达人","投资人","产品经理","流量操盘手"],Jl=M=>{Hi(M),hr(M.vipRole||""),Zs(!0)},Pr=M=>{$s(M),qo((M.webhookUrl||"").trim()),Ts(!0)},ai=async M=>{const de=M.trim();if(ur){if(!de){G.error("请选择或输入标签");return}ql(!0);try{const we=await tn("/api/db/users",{id:ur.id,vipRole:de});if(!(we!=null&&we.success)){G.error((we==null?void 0:we.error)||"更新超级个体标签失败");return}G.success("已更新超级个体标签"),Zs(!1),Hi(null),await sn()}catch{G.error("更新超级个体标签失败")}finally{ql(!1)}}},Wi=async()=>{if(!er)return;const M=Gl.trim();if(M&&!/^https?:\/\//i.test(M)){G.error("Webhook 地址需以 http/https 开头");return}Pa(!0);try{const de=await tn("/api/db/vip-members/webhook",{userId:er.id,webhookUrl:M});if(!(de!=null&&de.success)){G.error((de==null?void 0:de.error)||"保存飞书群 Webhook 失败");return}G.success(M?"已保存该超级个体的飞书群 Webhook":"已清空该超级个体的飞书群 Webhook"),Ts(!1),$s(null),await sn()}catch{G.error("保存飞书群 Webhook 失败")}finally{Pa(!1)}},[Ql,ca]=y.useState(!1),[Ur,Ki]=y.useState(null),[fs,da]=y.useState(""),[qi,Ra]=y.useState(!1),cd=M=>{Ki(M),da(M.vipSort!=null?String(M.vipSort):""),ca(!0)},Go=async()=>{if(!Ur)return;const M=Number(fs);if(!Number.isFinite(M)){G.error("请输入有效的数字序号");return}Ra(!0);try{const de=await tn("/api/db/users",{id:Ur.id,vipSort:M});if(!(de!=null&&de.success)){G.error((de==null?void 0:de.error)||"更新排序序号失败");return}G.success("已更新排序序号"),ca(!1),Ki(null),await sn()}catch{G.error("更新排序序号失败")}finally{Ra(!1)}},Jo=(M,de)=>{M.dataTransfer.effectAllowed="move",M.dataTransfer.setData("text/plain",de),Dt(de)},ii=(M,de)=>{M.preventDefault(),Ct!==de&&$e(de)},oi=()=>{Dt(null),$e(null)},Gi=async(M,de)=>{M.preventDefault();const we=M.dataTransfer.getData("text/plain")||it;if(Dt(null),$e(null),!we||we===de)return;const Pe=Ft.find(Ge=>Ge.id===we),qe=Ft.find(Ge=>Ge.id===de);if(!Pe||!qe)return;const Qe=Pe.vipSort??Ft.findIndex(Ge=>Ge.id===we)+1,en=qe.vipSort??Ft.findIndex(Ge=>Ge.id===de)+1;je(Ge=>{const Qt=[...Ge],fr=Qt.findIndex(ud=>ud.id===we),Rr=Qt.findIndex(ud=>ud.id===de);if(fr===-1||Rr===-1)return Ge;const Wr=[...Qt],[Xp,Zp]=[Wr[fr],Wr[Rr]];return Wr[fr]={...Zp,vipSort:Qe},Wr[Rr]={...Xp,vipSort:en},Wr});try{const[Ge,Qt]=await Promise.all([tn("/api/db/users",{id:we,vipSort:en}),tn("/api/db/users",{id:de,vipSort:Qe})]);if(!(Ge!=null&&Ge.success)||!(Qt!=null&&Qt.success)){G.error((Ge==null?void 0:Ge.error)||(Qt==null?void 0:Qt.error)||"更新排序失败"),await sn();return}G.success("已更新排序"),await sn()}catch{G.error("更新排序失败"),await sn()}},Qo=y.useCallback(async()=>{Gn(!0);try{const M=await Oe("/api/db/users/journey-stats");M!=null&&M.success&&M.stats&&es(M.stats)}catch{}finally{Gn(!1)}},[]),Yl=y.useCallback(async M=>{or(M),Pn(!0);try{const de=await Oe(`/api/db/users/journey-users?stage=${M}&limit=50`);de!=null&&de.success&&de.users&&ws(de.users)}catch{}finally{Pn(!1)}},[]),Xl=y.useCallback(async(M,de)=>{js(M),lr(de),dr(!0);try{const we=await Oe(`/api/db/users/tracks?userId=${M}&limit=50`);we!=null&&we.success&&we.tracks&&Cr(we.tracks)}catch{}finally{dr(!1)}},[]),[li,E]=y.useState(!1),B=async()=>{E(!0);try{const M=await jt("/api/admin/shensheshou/batch-enrich",{limit:20});M!=null&&M.success?(G.success(`批量补全完成:${M.enriched} 人已补全,${M.skipped} 人跳过`),Hr()):G.error((M==null?void 0:M.error)||"批量补全失败")}catch{G.error("批量补全请求失败")}finally{E(!1)}},ue=M=>{const de=[M.phone,M.nickname,M.avatar,M.wechatId,M.mbti,M.industry,M.region,M.position],we=de.filter(Pe=>Pe!=null&&Pe!=="").length;return Math.round(we/de.length*100)},{leadsRows:be,leadsRawCount:Ke,leadsDeduped:yt}=y.useMemo(()=>{const M=Ge=>(Ge||"").replace(/\D/g,"")||"",de=Ge=>{const Qt=M(Ge.phone);if(Qt)return`phone:${Qt}`;const fr=(Ge.userId||"").trim();if(fr)return`user:${fr}`;const Rr=(Ge.wechatId||"").trim();return Rr?`wechat:${Rr}`:`row:${Ge.id}`},we=ds.trim().toLowerCase();let Pe=ks;we&&(Pe=ks.filter(Ge=>[Ge.userNickname,Ge.name,Ge.phone,Ge.wechatId,Ge.personName,Ge.source,String(Ge.ckbPlanId??"")].filter(Boolean).join(" ").toLowerCase().includes(we)));const qe=[...Pe].sort((Ge,Qt)=>{const fr=Ge.createdAt?new Date(Ge.createdAt).getTime():0;return(Qt.createdAt?new Date(Qt.createdAt).getTime():0)-fr}),Qe=new Set,en=[];for(const Ge of qe){const Qt=de(Ge);Qe.has(Qt)||(Qe.add(Qt),en.push(Ge))}return{leadsRows:en,leadsRawCount:Pe.length,leadsDeduped:Pe.length-en.length}},[ks,ds]);y.useEffect(()=>{const M=be.map(Pe=>Pe.id),de=M.filter(Pe=>xt.includes(Pe)).length,we=Xs.current;we&&(we.indeterminate=de>0&&dewe.id),de=M.length>0&&M.every(we=>xt.includes(we));jn(de?we=>we.filter(Pe=>!M.includes(Pe)):we=>[...new Set([...we,...M])])}function Vn(M){jn(de=>de.includes(M)?de.filter(we=>we!==M):[...de,M])}async function ps(){if(xt.length===0){G.info("请先勾选要删除的记录");return}const M=xt.length;if(!confirm(`确定批量删除选中的 ${M} 条获客记录?删除后不可恢复。`))return;const de=500;Er(!0);try{let we=0;for(let Pe=0;PeM==="success"?s.jsx(He,{className:"bg-emerald-500/20 text-emerald-300 border-0 text-xs",children:"成功"}):M==="failed"?s.jsx(He,{className:"bg-red-500/20 text-red-300 border-0 text-xs",children:"失败"}):s.jsx(He,{className:"bg-amber-500/20 text-amber-300 border-0 text-xs",children:"待推送"}),ms=y.useMemo(()=>{const M=new Map;for(const de of be){if(de.pushStatus!=="failed")continue;const we=(de.ckbError||"未知错误").trim()||"未知错误";M.set(we,(M.get(we)||0)+1)}return Array.from(M.entries()).map(([de,we])=>({reason:de,count:we})).sort((de,we)=>we.count-de.count)},[be]);async function Jn(){const M=be.filter(Qe=>Qe.pushStatus==="failed");if(M.length===0){G.info("当前页无失败记录");return}const de=ms.slice(0,8).map(Qe=>`- ${Qe.reason}:${Qe.count} 条`).join(` -`),we=M.slice(0,30).map(Qe=>Qe.id).join(", "),Pe=M.slice(0,20).map(Qe=>`#${Qe.id} | ${Qe.userNickname||Qe.name||"-"} | 手机:${Qe.phone||"-"} | 来源:${Qe.source||"-"} | 重试:${Qe.retryCount??0} | 错误:${Qe.ckbError||"-"}`).join(` -`),qe=["【获客失败排障信息】",`时间:${new Date().toLocaleString()}`,`当前页失败总数:${M.length}`,"主要失败原因:",de||"- 无",`最近失败记录ID(最多30条):${we||"无"}`,"","失败记录明细(最多20条):",Pe||"无"].join(` -`);try{await navigator.clipboard.writeText(qe),G.success("已复制排障信息")}catch{G.error("复制失败,请检查浏览器剪贴板权限")}}return s.jsxs("div",{className:"p-8 w-full",children:[z&&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:z}),s.jsx("button",{type:"button",onClick:()=>H(null),children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-start gap-6 mb-6 flex-wrap",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"用户管理"}),s.jsxs("p",{className:"text-gray-400 mt-1 text-sm",children:["共 ",c," 位注册用户",ei!==null&&s.jsxs("span",{className:"text-[#38bdac] ml-1",children:["· 在线 ",ei," 人"]}),R&&" · RFM 排序中"]})]}),s.jsx(_e,{className:"shrink-0 w-full max-w-md border-[#38bdac]/35 bg-[#0f2137]/90",children:s.jsxs(ze,{className:"p-3 sm:p-4 space-y-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsxs("button",{type:"button",onClick:()=>V(M=>!M),className:"flex items-center gap-2 min-w-0 flex-1 text-left rounded-lg px-1 py-0.5 hover:bg-white/5 transition-colors","aria-expanded":X,children:[s.jsx(yf,{className:"w-5 h-5 text-[#38bdac] shrink-0"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-semibold text-white",children:"算法配置"}),s.jsx("div",{className:"text-xs text-gray-500 truncate",children:X?"RFM · Are you good(用户价值分层)":"RFM · 点击展开说明"})]}),X?s.jsx(Cg,{className:"w-4 h-4 text-gray-400 shrink-0"}):s.jsx(Sl,{className:"w-4 h-4 text-gray-400 shrink-0"})]}),s.jsx(J,{type:"button",variant:"outline",size:"sm",onClick:Ma,className:"border-[#38bdac]/50 text-[#38bdac] hover:bg-[#38bdac]/10 bg-transparent shrink-0",children:R?ie==="desc"?"RFM 降序":"RFM 升序":"按 RFM 排序"})]}),X&&s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-xs text-gray-400 leading-relaxed",children:["综合分 0–100(六维度):最近消费 R(25%)+ 订单频次 F(20%)+ 累计金额 M(20%)+ 推荐人数(15%)+ 行为轨迹(10%)+ 资料完善(10%)。各维度在全量用户中归一化,与后端"," ",s.jsx("code",{className:"text-gray-500",children:"/api/db/users/rfm"})," 一致。"]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:ZR.map(({level:M,range:de,label:we})=>s.jsxs(He,{variant:"outline",className:`text-[10px] border-0 ${Bi(M)}`,children:[M," ",de," · ",we]},M))})]})]})})]}),s.jsxs(Vc,{value:a,onValueChange:M=>{const de=new URLSearchParams(t);M==="users"?de.delete("tab"):de.set("tab",M),e(de)},className:"w-full",children:[s.jsxs(Al,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-6 flex-wrap h-auto gap-1",children:[s.jsxs(an,{value:"users",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",children:[s.jsx(Wn,{className:"w-4 h-4"})," 用户列表"]}),s.jsxs(an,{value:"leads",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:()=>Cs(),children:[s.jsx(jo,{className:"w-4 h-4"})," 获客列表"]}),s.jsxs(an,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Qo,children:[s.jsx(ya,{className:"w-4 h-4"})," 用户旅程总览"]}),s.jsxs(an,{value:"rules",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Es,children:[s.jsx(wo,{className:"w-4 h-4"})," 规则配置"]}),s.jsxs(an,{value:"vip-roles",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:sn,children:[s.jsx(Oc,{className:"w-4 h-4"})," 超级个体列表"]})]}),s.jsxs(on,{value:"users",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4 justify-end flex-wrap",children:[s.jsxs(J,{variant:"outline",onClick:B,disabled:li,className:"border-purple-500/50 text-purple-400 hover:bg-purple-500/10 bg-transparent",title:"批量调用神射手补全有手机号用户的资料",children:[li?s.jsx(Ve,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(Ri,{className:"w-4 h-4 mr-2"}),"批量补全"]}),s.jsxs(J,{variant:"outline",onClick:()=>Hr(!0),disabled:L,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ve,{className:`w-4 h-4 mr-2 ${L?"animate-spin":""}`})," 刷新"]}),s.jsxs("select",{value:k,onChange:M=>{const de=M.target.value;T(de),f(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:R,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(va,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(ce,{type:"text",placeholder:"搜索用户...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500 w-56",value:b,onChange:M=>v(M.target.value)})]}),s.jsxs(J,{onClick:la,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(jo,{className:"w-4 h-4 mr-2"})," 添加用户"]})]}),s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(ze,{className:"p-0",children:C?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ve,{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(Ls,{children:[s.jsx(Os,{children:s.jsxs(Nt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400",children:"用户信息"}),s.jsx(Ce,{className:"text-gray-400",children:"绑定信息"}),s.jsx(Ce,{className:"text-gray-400",children:"购买状态"}),s.jsx(Ce,{className:"text-gray-400",children:"分销收益"}),s.jsxs(Ce,{className:"text-gray-400 cursor-pointer select-none",onClick:Ma,children:[s.jsxs("div",{className:"flex items-center gap-1 group",children:[s.jsx(yf,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"RFM分值"}),R?ie==="desc"?s.jsx(Sl,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(Cg,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(Sx,{className:"w-3.5 h-3.5 text-gray-600 group-hover:text-gray-400"})]}),R&&s.jsx("div",{className:"text-[10px] text-[#38bdac] font-normal mt-0.5",children:"点击切换方向/关闭"})]}),s.jsx(Ce,{className:"text-gray-400",children:"资料完善"}),s.jsx(Ce,{className:"text-gray-400",children:"注册时间"}),s.jsx(Ce,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(Ds,{children:[i.map(M=>{var de,we,Pe;return s.jsxs(Nt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ke,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[(()=>{var en;const qe=Ta(M.avatar,M.mbti),Qe=((en=M.nickname)==null?void 0:en.charAt(0))||"?";return s.jsx("button",{type:"button",title:"点击管理 MBTI 默认头像库",onClick:()=>St(!0),className:"w-10 h-10 shrink-0 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] overflow-hidden ring-1 ring-transparent hover:ring-[#38bdac]/60 transition",children:qe?s.jsx("img",{src:qe,className:"w-full h-full rounded-full object-cover",alt:"",onError:Ge=>{var Rr;const Qt=Ge.target;if(Qt.style.display="none",Qt.nextElementSibling)return;const fr=document.createElement("span");fr.textContent=Qe,(Rr=Qt.parentElement)==null||Rr.appendChild(fr)}}):Qe})})(),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("button",{type:"button",onClick:()=>{Fe(M.id),te(!0)},className:"font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left truncate max-w-[120px]",children:M.nickname}),M.isAdmin&&s.jsx(He,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),M.openId&&!((de=M.id)!=null&&de.startsWith("user_"))&&s.jsx(He,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0 text-xs",children:"微信"})]}),s.jsxs("p",{className:"text-xs text-gray-500 font-mono truncate max-w-[140px]",title:M.id,children:[(we=M.id)==null?void 0:we.slice(0,16),(((Pe=M.id)==null?void 0:Pe.length)??0)>16?"…":""]})]})]})}),s.jsx(ke,{children:s.jsxs("div",{className:"space-y-1",children:[M.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:M.phone})]}),M.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:M.wechatId})]}),!M.phone&&!M.wechatId&&s.jsx("span",{className:"text-gray-600 text-xs",children:"未绑定"})]})}),s.jsx(ke,{children:(()=>{const qe=oa(M);return qe.tone==="vip"?s.jsxs("div",{className:"space-y-1",children:[s.jsx(He,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:qe.main}),qe.sub&&s.jsx("p",{className:"text-[11px] text-amber-300/80",children:qe.sub})]}):qe.tone==="paid"?s.jsxs("div",{className:"space-y-1",children:[s.jsx(He,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:qe.main}),qe.sub&&s.jsx("p",{className:"text-[11px] text-blue-300/80",children:qe.sub})]}):s.jsx(He,{variant:"outline",className:"text-gray-500 border-gray-600",children:qe.main})})()}),s.jsx(ke,{children:s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(M.earnings||0)).toFixed(2)]}),parseFloat(String(M.pendingEarnings||0))>0&&s.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String(M.pendingEarnings||0)).toFixed(2)]}),s.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>Tr(M),role:"button",tabIndex:0,onKeyDown:qe=>qe.key==="Enter"&&Tr(M),children:[s.jsx(Wn,{className:"w-3 h-3"})," 绑定",M.referralCount||0,"人"]})]})}),s.jsx(ke,{children:M.rfmScore!=null&&M.rfmScore!==void 0?s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-white font-bold text-base",children:M.rfmScore}),s.jsx(He,{className:`border-0 text-xs ${Bi(M.rfmLevel)}`,children:M.rfmLevel})]}):s.jsx("span",{className:"text-gray-600 text-xs",children:"无订单"})}),s.jsx(ke,{children:(()=>{const qe=ue(M),Qe=qe>=75?"text-green-400":qe>=50?"text-yellow-400":"text-gray-500";return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-12 h-1.5 bg-gray-700 rounded-full overflow-hidden",children:s.jsx("div",{className:`h-full rounded-full ${qe>=75?"bg-green-500":qe>=50?"bg-yellow-500":"bg-gray-500"}`,style:{width:`${qe}%`}})}),s.jsxs("span",{className:`text-xs ${Qe}`,children:[qe,"%"]})]})})()}),s.jsx(ke,{className:"text-gray-400",children:M.createdAt?new Date(M.createdAt).toLocaleDateString():"-"}),s.jsx(ke,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>{Fe(M.id),te(!0)},className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"用户详情",children:s.jsx(gf,{className:"w-4 h-4"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>Kl(M),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑用户",children:s.jsx(rn,{className:"w-4 h-4"})}),s.jsx(J,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>hs(M.id),title:"删除",children:s.jsx(Yn,{className:"w-4 h-4"})})]})})]},M.id)}),i.length===0&&s.jsx(Nt,{children:s.jsx(ke,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),s.jsx(rr,{page:h,totalPages:ni,total:c,pageSize:m,onPageChange:f,onPageSizeChange:M=>{x(M),f(1)}})]})})})]}),s.jsxs(on,{value:"leads",children:[zs&&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:zs}),s.jsx("button",{type:"button",className:"shrink-0 ml-2",onClick:()=>Vr(null),"aria-label":"关闭",children:"×"})]}),!ut&&s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-4",children:[s.jsxs("div",{className:"p-3 bg-[#0f2137] border border-gray-700/50 rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs",children:"总留资条数"}),s.jsx("p",{className:"text-xl font-bold text-white",children:Ys})]}),s.jsxs("div",{className:"p-3 bg-[#0f2137] border border-gray-700/50 rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs",children:"去重用户数(按 userId)"}),s.jsx("p",{className:"text-xl font-bold text-[#38bdac]",title:"后端 COUNT(DISTINCT user_id)",children:O.uniqueUsers??0})]}),(O.sourceStats&&O.sourceStats.length>0?O.sourceStats.slice(0,2):[]).map(M=>s.jsxs("div",{className:"p-3 bg-[#0f2137] border border-gray-700/50 rounded-lg",children:[s.jsxs("p",{className:"text-gray-500 text-xs",children:["来源:",M.source]}),s.jsx("p",{className:"text-xl font-bold text-purple-400",children:M.cnt})]},M.source))]}),!ut&&ms.length>0&&s.jsx(_e,{className:"bg-[#3a1010]/35 border-red-900/60 shadow-lg mb-4",children:s.jsxs(ze,{className:"p-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 mb-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-red-200 font-medium",children:"失败原因聚合"}),s.jsx("p",{className:"text-red-300/70 text-xs",children:"基于当前页筛选结果,按失败原因聚合统计"})]}),s.jsx(J,{type:"button",variant:"outline",onClick:Jn,className:"border-red-600/70 text-red-200 hover:bg-red-500/10 bg-transparent",children:"一键复制排障信息"})]}),s.jsx("div",{className:"flex flex-wrap gap-2",children:ms.slice(0,8).map(M=>s.jsxs(He,{className:"bg-red-500/15 text-red-200 border border-red-600/40",children:[M.reason," · ",M.count]},M.reason))})]})}),s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 mb-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 flex-1 min-w-[200px]",children:[s.jsxs("div",{className:"relative flex-1 max-w-xs",children:[s.jsx(va,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(ce,{placeholder:"搜索昵称/手机/微信/@人/来源…",value:aa,onChange:M=>Ca(M.target.value),className:"pl-9 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"})]}),O.sourceStats&&O.sourceStats.length>0&&s.jsxs("select",{value:us,onChange:M=>{Ea(M.target.value),ve(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部来源"}),O.sourceStats.map(M=>s.jsxs("option",{value:M.source,children:[M.source,"(",M.cnt,")"]},M.source))]}),s.jsxs("select",{value:zt,onChange:M=>{Ya(M.target.value),ve(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部状态"}),s.jsx("option",{value:"pending",children:"待推送"}),s.jsx("option",{value:"success",children:"推送成功"}),s.jsx("option",{value:"failed",children:"推送失败"})]}),s.jsx(J,{type:"button",variant:"outline",onClick:()=>{Ya("failed"),ve(1)},className:"border-red-600/60 text-red-300 hover:bg-red-500/10 bg-transparent text-xs h-9",children:"只看失败"}),s.jsxs("span",{className:"text-xs text-gray-500 whitespace-nowrap max-w-[min(100%,20rem)]",title:"同一页内:相同手机号或相同用户 ID(含微信侧标识)只保留最近一条",children:["本页 ",Ke," 条",yt>0?` · 已合并 ${yt} 条重复`:""]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx(J,{variant:"outline",onClick:$i,disabled:ut,className:"border-cyan-600/60 text-cyan-300 hover:bg-cyan-500/10 bg-transparent",children:"导出失败清单"}),s.jsxs(J,{variant:"outline",onClick:zi,disabled:Wl||Ot||ut,className:"border-amber-600/60 text-amber-300 hover:bg-amber-500/10 bg-transparent",children:[s.jsx(Ve,{className:`w-4 h-4 mr-2 ${Wl?"animate-spin":""}`}),"重推本页失败项"]}),s.jsxs(J,{variant:"outline",onClick:()=>void ps(),disabled:Ot||xt.length===0||ut,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[s.jsx(Yn,{className:`w-4 h-4 mr-2 ${Ot?"animate-pulse":""}`}),Ot?"删除中…":`批量删除(${xt.length})`]}),s.jsxs(J,{variant:"outline",onClick:()=>Cs(),disabled:ut,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ve,{className:`w-4 h-4 mr-2 ${ut?"animate-spin":""}`})," 刷新"]})]})]}),!ut&&be.length>0&&s.jsxs("p",{className:"text-xs text-gray-500 mb-2",children:["已选 ",s.jsx("span",{className:"text-[#38bdac]",children:xt.length})," 条 · 可翻页继续勾选 · 改搜索/筛选会清空选择",xt.length>0&&s.jsx("button",{type:"button",className:"ml-2 text-gray-400 hover:text-gray-200 underline",onClick:()=>jn([]),children:"清空"})]}),s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(ze,{className:"p-0",children:ut?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ve,{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(Ls,{children:[s.jsx(Os,{children:s.jsxs(Nt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400 w-10 text-center",children:s.jsx("input",{ref:Xs,type:"checkbox",checked:be.length>0&&be.every(M=>xt.includes(M.id)),onChange:kt,className:"w-4 h-4 rounded border-gray-600 bg-[#0f2137] accent-[#38bdac] cursor-pointer",title:"全选本页(展示行)"})}),s.jsx(Ce,{className:"text-gray-400",children:"昵称"}),s.jsx(Ce,{className:"text-gray-400",children:"手机号"}),s.jsx(Ce,{className:"text-gray-400",children:"微信号"}),s.jsx(Ce,{className:"text-gray-400",children:"对应 @人"}),s.jsx(Ce,{className:"text-gray-400",children:"获客计划"}),s.jsx(Ce,{className:"text-gray-400",children:"来源"}),s.jsx(Ce,{className:"text-gray-400",children:"推送状态"}),s.jsx(Ce,{className:"text-gray-400",children:"重试"}),s.jsx(Ce,{className:"text-gray-400",children:"时间"})]})}),s.jsxs(Ds,{children:[be.map(M=>s.jsxs(Nt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ke,{className:"text-center align-middle w-10",children:s.jsx("input",{type:"checkbox",checked:xt.includes(M.id),onChange:()=>Vn(M.id),disabled:Ot,className:"w-4 h-4 rounded border-gray-600 bg-[#0f2137] accent-[#38bdac] cursor-pointer"})}),s.jsx(ke,{className:"text-gray-300",children:M.userNickname||M.name||"-"}),s.jsx(ke,{className:"text-gray-300",children:M.phone||"-"}),s.jsx(ke,{className:"text-gray-300",children:M.wechatId||"-"}),s.jsx(ke,{className:"text-[#38bdac]",children:M.personName||"-"}),s.jsx(ke,{className:"text-gray-400",children:M.ckbPlanId?`#${M.ckbPlanId}`:"-"}),s.jsx(ke,{children:s.jsx(He,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:M.source||"未知"})}),s.jsx(ke,{children:s.jsxs("div",{className:"space-y-1",children:[Tn(M.pushStatus),!!M.ckbError&&s.jsx("p",{className:"text-[11px] text-red-300 max-w-[220px] truncate",title:M.ckbError,children:M.ckbError})]})}),s.jsx(ke,{className:"text-gray-400 text-xs",children:s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{children:typeof M.retryCount=="number"?`第 ${M.retryCount} 次`:"-"}),s.jsxs(J,{size:"sm",variant:"outline",disabled:Ot||Ze===M.id||Et===M.id,onClick:()=>Za(M.id),className:"h-7 px-2 text-[11px] border-gray-600 text-gray-200 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ve,{className:`w-3 h-3 mr-1 ${Ze===M.id?"animate-spin":""}`}),"重推"]}),s.jsxs(J,{size:"sm",variant:"outline",disabled:Ot||Et===M.id||Ze===M.id,onClick:()=>od(M.id),className:"h-7 px-2 text-[11px] border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[s.jsx(Yn,{className:`w-3 h-3 mr-1 ${Et===M.id?"animate-pulse":""}`}),"删除"]})]})}),s.jsx(ke,{className:"text-gray-400",children:M.createdAt?new Date(M.createdAt).toLocaleString():"-"})]},M.id)),be.length===0&&s.jsx(Nt,{children:s.jsx(ke,{colSpan:10,className:"p-0 align-top",children:s.jsxs("div",{className:"py-16 px-6 text-center border-t border-gray-700/40 bg-[#0a1628]/30",children:[s.jsx(jo,{className:"w-14 h-14 text-[#38bdac]/20 mx-auto mb-4","aria-hidden":!0}),s.jsx("p",{className:"text-gray-200 font-medium mb-1",children:"暂无获客线索"}),s.jsx("p",{className:"text-gray-500 text-sm mb-6 max-w-md mx-auto leading-relaxed",children:ds.trim()||us?"当前搜索或来源筛选下没有匹配记录,可清空条件后重试。":"存客宝场景产生的手机号 / 微信留资会出现在此列表。请确认获客计划已开启,并有用户完成留资。"}),s.jsxs(J,{type:"button",variant:"outline",onClick:()=>Cs(),disabled:ut,className:"border-[#38bdac]/40 text-[#38bdac] hover:bg-[#38bdac]/10 bg-transparent",children:[s.jsx(Ve,{className:`w-4 h-4 mr-2 ${ut?"animate-spin":""}`}),"重新加载"]})]})})})]})]}),s.jsx(rr,{page:re,totalPages:Math.ceil(Ys/Ye)||1,total:Ys,pageSize:Ye,onPageChange:ve,onPageSizeChange:()=>{}})]})})})]}),s.jsxs(on,{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(J,{variant:"outline",onClick:Qo,disabled:is,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ve,{className:`w-4 h-4 mr-2 ${is?"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:wc.map((M,de)=>s.jsxs("div",{className:"relative flex flex-col items-center",children:[s.jsxs("div",{className:`relative w-full p-3 rounded-xl border ${M.color} text-center cursor-pointer hover:opacity-80 transition-opacity ${Fn===M.id?"ring-2 ring-[#38bdac]":""}`,onClick:()=>Yl(M.id),title:`点击查看「${M.label}」阶段的用户`,children:[s.jsx("div",{className:"text-2xl mb-1",children:M.icon}),s.jsx("div",{className:`text-xs font-medium ${M.color.split(" ").find(we=>we.startsWith("text-"))}`,children:M.label}),mt[M.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:mt[M.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:de+1})]}),des.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:M.step}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-300",children:M.action}),s.jsxs("p",{className:"text-gray-600 text-xs",children:["→ ",M.next]})]})]},M.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(wr,{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:"实时更新"})]}),is?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(Ve,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Object.keys(mt).length>0?s.jsx("div",{className:"space-y-2",children:wc.map(M=>{const de=mt[M.id]||0,we=Math.max(...wc.map(qe=>mt[qe.id]||0),1),Pe=Math.round(de/we*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:[M.icon," ",M.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:`${Pe}%`}})}),s.jsx("span",{className:"text-gray-400 text-xs w-10 text-right",children:de})]},M.id)})}):s.jsx("div",{className:"text-center py-8",children:s.jsx("p",{className:"text-gray-500 text-sm",children:"点击「刷新数据」加载统计"})})]})]}),Fn&&s.jsxs("div",{className:"mt-6 bg-[#0f2137] border border-gray-700/50 rounded-lg p-4",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(Wn,{className:"w-4 h-4 text-[#38bdac]"}),s.jsxs("span",{className:"text-white font-medium",children:[(Yo=wc.find(M=>M.id===Fn))==null?void 0:Yo.icon," ",(Pu=wc.find(M=>M.id===Fn))==null?void 0:Pu.label," 阶段用户"]}),s.jsxs(He,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-xs",children:[ls.length," 人"]})]}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>or(null),className:"text-gray-400 hover:text-white",children:s.jsx(rs,{className:"w-4 h-4"})})]}),kr?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(Ve,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):ls.length===0?s.jsx("p",{className:"text-gray-500 text-center py-6",children:"该阶段暂无用户"}):s.jsxs(Ls,{children:[s.jsx(Os,{children:s.jsxs(Nt,{className:"border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400",children:"昵称"}),s.jsx(Ce,{className:"text-gray-400",children:"手机号"}),s.jsx(Ce,{className:"text-gray-400",children:"注册时间"}),s.jsx(Ce,{className:"text-gray-400 text-right",children:"操作"})]})}),s.jsx(Ds,{children:ls.map(M=>s.jsxs(Nt,{className:"border-gray-700/50 hover:bg-[#0a1628]",children:[s.jsx(ke,{className:"text-white",children:M.nickname||"微信用户"}),s.jsx(ke,{className:"text-gray-300",children:M.phone||"-"}),s.jsx(ke,{className:"text-gray-400 text-xs",children:M.createdAt?new Date(M.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx(ke,{className:"text-right",children:s.jsxs(J,{variant:"ghost",size:"sm",className:"text-[#38bdac] hover:bg-[#38bdac]/10",onClick:()=>Xl(M.id,M.nickname||"微信用户"),children:[s.jsx(gf,{className:"w-4 h-4 mr-1"})," 行为轨迹"]})})]},M.id))})]})]}),s.jsx(Wt,{open:!!Js,onOpenChange:M=>{M||js(null)},children:s.jsxs(Ut,{className:"sm:max-w-[600px] bg-[#0f2137] border-gray-700 text-white max-h-[80vh] overflow-y-auto",children:[s.jsx(Kt,{children:s.jsxs(qt,{className:"text-white flex items-center gap-2",children:[s.jsx(ya,{className:"w-5 h-5 text-[#38bdac]"}),Sr," 的行为轨迹"]})}),cr?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Ve,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):cs.length===0?s.jsx("p",{className:"text-gray-500 text-center py-8",children:"该用户暂无行为记录"}):s.jsxs("div",{className:"relative pl-6 space-y-0",children:[s.jsx("div",{className:"absolute left-[11px] top-2 bottom-2 w-0.5 bg-gray-700"}),cs.map((M,de)=>s.jsxs("div",{className:"relative flex items-start gap-3 py-2",children:[s.jsx("div",{className:"absolute left-[-13px] top-3 w-2.5 h-2.5 rounded-full bg-[#38bdac] border-2 border-[#0f2137] z-10"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"text-white text-sm font-medium",children:M.actionLabel}),M.module&&s.jsx(He,{className:"bg-purple-500/10 text-purple-400 border border-purple-500/30 text-[10px]",children:M.module})]}),(M.chapterTitle||M.target)&&s.jsx("p",{className:"text-gray-400 text-xs mt-0.5 truncate",children:M.chapterTitle||M.target}),s.jsxs("p",{className:"text-gray-600 text-[10px] mt-0.5",children:[M.timeAgo," · ",M.createdAt?new Date(M.createdAt).toLocaleString("zh-CN"):""]})]})]},M.id||de))]})]})})]}),s.jsxs(on,{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(J,{variant:"outline",onClick:Es,disabled:Jt,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ve,{className:`w-4 h-4 mr-2 ${Jt?"animate-spin":""}`})," 刷新"]}),s.jsxs(J,{onClick:()=>{vn(null),Nn({title:"",description:"",trigger:"",triggerConditions:[],actionType:"popup",sort:0,enabled:!0}),bn(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Un,{className:"w-4 h-4 mr-2"})," 添加规则"]})]})]}),Jt?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Ve,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):_t.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(wr,{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(J,{onClick:Es,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Ve,{className:"w-4 h-4 mr-2"})," 重新加载"]})]}):s.jsx("div",{className:"space-y-2",children:_t.map(M=>{var we;const de=m2(M.triggerConditions);return s.jsxs("div",{className:`p-3 rounded-lg border transition-all ${M.enabled?"bg-[#0f2137] border-gray-700/50":"bg-[#0a1628]/50 border-gray-700/30 opacity-55"}`,children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[s.jsxs("span",{className:"text-gray-600 text-xs font-mono w-5 shrink-0 text-right",children:["#",M.sort]}),s.jsx(rn,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0"}),s.jsx("span",{className:"text-white font-medium text-sm truncate",children:M.title}),M.trigger&&s.jsx(He,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-[10px] shrink-0",children:M.trigger}),de.length>0&&s.jsxs("div",{className:"flex flex-wrap gap-0.5 ml-1",children:[de.slice(0,3).map(Pe=>{const qe=Y1.find(Qe=>Qe.value===Pe);return s.jsx(He,{className:"bg-purple-500/10 text-purple-400 border border-purple-500/30 text-[9px]",children:(qe==null?void 0:qe.label)||Pe},Pe)}),de.length>3&&s.jsxs("span",{className:"text-gray-500 text-[9px]",children:["+",de.length-3]})]}),M.actionType&&M.actionType!=="popup"&&s.jsx(He,{className:"bg-amber-500/10 text-amber-400 border border-amber-500/30 text-[9px] shrink-0",children:((we=X1.find(Pe=>Pe.value===M.actionType))==null?void 0:we.label)||M.actionType})]}),s.jsxs("div",{className:"flex items-center gap-1.5 ml-3 shrink-0",children:[s.jsx(Gt,{checked:M.enabled,onCheckedChange:()=>Aa(M)}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>{vn(M),Nn({title:M.title,description:M.description,trigger:M.trigger,triggerConditions:de,actionType:M.actionType||"popup",sort:M.sort,enabled:M.enabled}),bn(!0)},className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10 h-7 w-7 p-0",children:s.jsx(rn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>si(M.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10 h-7 w-7 p-0",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]}),M.description&&s.jsxs("details",{className:"ml-[52px] mt-1",children:[s.jsxs("summary",{className:"text-gray-500 text-xs cursor-pointer hover:text-gray-400 select-none",children:["查看完整描述",s.jsxs("span",{className:"text-gray-600 ml-1",children:["(",M.description.length," 字,默认折叠)"]})]}),s.jsx("p",{className:"text-gray-400 text-sm mt-1 pl-1 border-l-2 border-gray-700 whitespace-pre-wrap",children:M.description})]})]},M.id)})})]}),s.jsxs(on,{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(J,{variant:"outline",onClick:sn,disabled:Te,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ve,{className:`w-4 h-4 mr-2 ${Te?"animate-spin":""}`})," ","刷新"]})})]}),Te?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ve,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):Ft.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(Oc,{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(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(ze,{className:"p-0",children:s.jsxs(Ls,{children:[s.jsx(Os,{children:s.jsxs(Nt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400 w-12",children:"序号"}),s.jsx(Ce,{className:"text-gray-400",children:"成员"}),s.jsx(Ce,{className:"text-gray-400 min-w-40",children:"超级个体标签"}),s.jsx(Ce,{className:"text-gray-400 w-16 text-center",children:"头像点击"}),s.jsx(Ce,{className:"text-gray-400 w-16 text-center",children:"获客数"}),s.jsx(Ce,{className:"text-gray-400 w-20",children:"排序值"}),s.jsx(Ce,{className:"text-gray-400 w-36",children:"飞书群"}),s.jsx(Ce,{className:"text-gray-400 w-36 text-right",children:"操作"})]})}),s.jsx(Ds,{children:Ft.map((M,de)=>{var qe;const we=it===M.id,Pe=Ct===M.id;return s.jsxs(Nt,{draggable:!0,onDragStart:Qe=>Jo(Qe,M.id),onDragOver:Qe=>ii(Qe,M.id),onDrop:Qe=>Gi(Qe,M.id),onDragEnd:oi,className:`border-gray-700/50 cursor-grab active:cursor-grabbing select-none ${we?"opacity-60":""} ${Pe?"bg-[#38bdac]/10":""}`,children:[s.jsx(ke,{className:"text-gray-300",children:de+1}),s.jsx(ke,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[Ta(M.avatar,M.mbti)?s.jsx("img",{src:Ta(M.avatar,M.mbti),className:"w-8 h-8 rounded-full object-cover border border-amber-400/60",alt:"",onError:Qe=>{var Ge,Qt;Qe.target.style.display="none";const en=document.createElement("div");en.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",en.textContent=((Ge=M.name)==null?void 0:Ge[0])||"创",(Qt=Qe.target.parentElement)==null||Qt.appendChild(en)}}):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:((qe=M.name)==null?void 0:qe[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:M.name})})]})}),s.jsx(ke,{className:"text-gray-300 whitespace-nowrap",children:M.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置)"})}),s.jsx(ke,{className:"text-center text-blue-400 text-xs font-mono",children:M.clickCount!=null?String(M.clickCount):"-"}),s.jsx(ke,{className:"text-center text-green-400 text-xs font-mono",children:M.leadCount!=null?String(M.leadCount):"-"}),s.jsx(ke,{className:"text-gray-300",children:M.vipSort??de+1}),s.jsx(ke,{className:"text-xs",children:M.webhookUrl?s.jsx("span",{className:"text-[#38bdac] truncate block max-w-[180px]",title:M.webhookUrl,children:"已配置"}):s.jsx("span",{className:"text-gray-500",children:"未配置"})}),s.jsx(ke,{className:"text-right text-xs text-gray-300",children:s.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[s.jsx(J,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-amber-300 hover:text-amber-200",onClick:()=>Jl(M),title:"设置超级个体标签",children:s.jsx(Jd,{className:"w-3.5 h-3.5"})}),s.jsx(J,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-[#38bdac] hover:text-[#5fe0cd]",onClick:()=>Pr(M),title:"编辑飞书群Webhook",children:s.jsx(rn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-sky-300 hover:text-sky-200",onClick:()=>cd(M),title:"设置排序序号",children:s.jsx(Sx,{className:"w-3.5 h-3.5"})})]})})]},M.id)})})]})})})]})]}),s.jsx(Wt,{open:We,onOpenChange:St,children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-6xl",children:[s.jsx(Kt,{children:s.jsx(qt,{className:"text-white",children:"MBTI 默认头像库"})}),s.jsx(YR,{})]})}),s.jsx(Wt,{open:Ql,onOpenChange:M=>{ca(M),M||Ki(null)},children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(Kt,{children:s.jsxs(qt,{className:"text-white flex items-center gap-2",children:[s.jsx(Sx,{className:"w-5 h-5 text-[#38bdac]"}),"设置排序 — ",Ur==null?void 0:Ur.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(ne,{className:"text-gray-300 text-sm",children:"排序序号(数字越小越靠前)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:1",value:fs,onChange:M=>da(M.target.value)})]}),s.jsxs(Sn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>ca(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(rs,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:Go,disabled:qi,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(In,{className:"w-4 h-4 mr-2"}),qi?"保存中...":"保存"]})]})]})}),s.jsx(Wt,{open:ld,onOpenChange:M=>{Zs(M),M||Hi(null)},children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Kt,{children:s.jsxs(qt,{className:"text-white flex items-center gap-2",children:[s.jsx(Oc,{className:"w-5 h-5 text-amber-400"}),"设置超级个体标签 — ",ur==null?void 0:ur.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(ne,{className:"text-gray-300 text-sm",children:"选择或输入标签"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:Ui.map(M=>s.jsx(J,{variant:Ar===M?"default":"outline",size:"sm",className:Ar===M?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50",onClick:()=>hr(M),children:M},M))}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"或手动输入"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创业者、资源整合者等",value:Ar,onChange:M=>hr(M.target.value)})]})]}),s.jsxs(Sn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>Zs(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(rs,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:()=>ai(Ar),disabled:Ia,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(In,{className:"w-4 h-4 mr-2"}),Ia?"保存中...":"保存"]})]})]})}),s.jsx(Wt,{open:Ir,onOpenChange:M=>{Ts(M),M||$s(null)},children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-xl",children:[s.jsx(Kt,{children:s.jsxs(qt,{className:"text-white flex items-center gap-2",children:[s.jsx(rn,{className:"w-5 h-5 text-[#38bdac]"}),"设置飞书群 Webhook — ",er==null?void 0:er.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(ne,{className:"text-gray-300 text-sm",children:"VOX Webhook 地址(留空即清空)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",value:Gl,onChange:M=>qo(M.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"当用户点击该超级个体头像并提交链接时,线索将优先推送到这里配置的飞书群。"})]}),s.jsxs(Sn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>Ts(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(rs,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:Wi,disabled:ri,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(In,{className:"w-4 h-4 mr-2"}),ri?"保存中...":"保存"]})]})]})}),s.jsx(Wt,{open:he,onOpenChange:I,children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(Kt,{children:s.jsxs(qt,{className:"text-white flex items-center gap-2",children:[Q?s.jsx(rn,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(jo,{className:"w-5 h-5 text-[#38bdac]"}),Q?"编辑用户":"添加用户"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"手机号"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:wt.phone,onChange:M=>Vt({...wt,phone:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"昵称"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:wt.nickname,onChange:M=>Vt({...wt,nickname:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:Q?"新密码 (留空则不修改)":"密码"}),s.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:Q?"留空则不修改":"请输入密码",value:wt.password,onChange:M=>Vt({...wt,password:M.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(ne,{className:"text-gray-300",children:"管理员权限"}),s.jsx(Gt,{checked:wt.isAdmin,onCheckedChange:M=>Vt({...wt,isAdmin:M})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(ne,{className:"text-gray-300",children:"已购全书"}),s.jsx(Gt,{checked:wt.hasFullBook,onCheckedChange:M=>Vt({...wt,hasFullBook:M})})]})]}),s.jsxs(Sn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>I(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(rs,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:Vi,disabled:xe,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(In,{className:"w-4 h-4 mr-2"}),xe?"保存中...":"保存"]})]})]})}),s.jsx(Wt,{open:yn,onOpenChange:bn,children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[90vh] overflow-y-auto",children:[s.jsx(Kt,{children:s.jsxs(qt,{className:"text-white flex items-center gap-2",children:[s.jsx(rn,{className:"w-5 h-5 text-[#38bdac]"}),En?"编辑规则":"添加规则"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"规则标题 *"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:匹配后填写头像、付款1980需填写信息",value:At.title,onChange:M=>Nn({...At,title:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"规则描述"}),s.jsx(Il,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[60px] resize-none",placeholder:"弹窗内容/推送文案...",value:At.description,onChange:M=>Nn({...At,description:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"触发条件(可多选)"}),s.jsx("div",{className:"space-y-2",children:["用户状态","阅读行为","付费行为","社交行为","分销行为"].map(M=>{const de=Y1.filter(we=>we.group===M);return de.length===0?null:s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] text-gray-500 mb-1",children:M}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:de.map(we=>{const Pe=(At.triggerConditions||[]).includes(we.value);return s.jsx("button",{type:"button",className:`px-2.5 py-1 rounded-md text-xs border transition-colors ${Pe?"bg-[#38bdac]/20 border-[#38bdac]/50 text-[#38bdac]":"bg-[#0a1628] border-gray-700 text-gray-400 hover:border-gray-500"}`,onClick:()=>{const qe=At.triggerConditions||[],Qe=Pe?qe.filter(en=>en!==we.value):[...qe,we.value];Nn({...At,triggerConditions:Qe})},children:we.label},we.value)})})]},M)})}),(At.triggerConditions||[]).length>0&&s.jsxs("p",{className:"text-[10px] text-[#38bdac]",children:["已选 ",(At.triggerConditions||[]).length," 个触发条件(满足任一即触发)"]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"兼容触发标识(旧版)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white text-xs h-8",placeholder:"与小程序一致:注册、完成付款、update_avatar、update_nickname 等",value:At.trigger,onChange:M=>Nn({...At,trigger:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"推送动作"}),s.jsx("div",{className:"grid grid-cols-2 gap-2",children:X1.map(M=>s.jsxs("button",{type:"button",className:`p-2 rounded-lg border text-left transition-colors ${At.actionType===M.value?"bg-[#38bdac]/15 border-[#38bdac]/50":"bg-[#0a1628] border-gray-700 hover:border-gray-500"}`,onClick:()=>Nn({...At,actionType:M.value}),children:[s.jsx("span",{className:`text-xs font-medium ${At.actionType===M.value?"text-[#38bdac]":"text-gray-300"}`,children:M.label}),s.jsx("p",{className:"text-[10px] text-gray-500 mt-0.5",children:M.desc})]},M.value))})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{children:s.jsx(ne,{className:"text-gray-300",children:"启用状态"})}),s.jsx(Gt,{checked:At.enabled,onCheckedChange:M=>Nn({...At,enabled:M})})]})]}),s.jsxs(Sn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>bn(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(rs,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:Mr,disabled:xe,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(In,{className:"w-4 h-4 mr-2"}),xe?"保存中...":"保存"]})]})]})}),s.jsx(Wt,{open:F,onOpenChange:U,children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[s.jsx(Kt,{children:s.jsxs(qt,{className:"text-white flex items-center gap-2",children:[s.jsx(Wn,{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:((dd=pe.stats)==null?void 0:dd.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:((Ru=pe.stats)==null?void 0:Ru.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:["¥",(((Lu=pe.stats)==null?void 0:Lu.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:["¥",(((Ou=pe.stats)==null?void 0:Ou.pendingEarnings)||0).toFixed(2)]}),s.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),oe?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(Ve,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((Du=pe.referrals)==null?void 0:Du.length)??0)>0?s.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(pe.referrals??[]).map((M,de)=>{var Pe;const we=M;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:((Pe=we.nickname)==null?void 0:Pe.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white text-sm",children:we.nickname}),s.jsx("div",{className:"text-xs text-gray-500",children:we.phone||(we.hasOpenId?"微信用户":"未绑定")})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[we.status==="vip"&&s.jsx(He,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),we.status==="paid"&&s.jsxs(He,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",we.purchasedSections,"章"]}),we.status==="free"&&s.jsx(He,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),s.jsx("span",{className:"text-xs text-gray-500",children:we.createdAt?new Date(we.createdAt).toLocaleDateString():""})]})]},we.id||de)})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),s.jsx(Sn,{children:s.jsx(J,{variant:"outline",onClick:()=>U(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),s.jsx(X0,{open:Y,onClose:()=>te(!1),userId:Ne,onUserUpdated:Hr})]})}function kf(t,[e,n]){return Math.min(n,Math.max(e,t))}var x2=["PageUp","PageDown"],g2=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],y2={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},nd="Slider",[_g,t8,n8]=G0(nd),[b2]=Bo(nd,[n8]),[s8,Tp]=b2(nd),v2=y.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:x=()=>{},inverted:b=!1,form:v,...w}=t,N=y.useRef(new Set),k=y.useRef(0),C=o==="horizontal"?r8:a8,[P=[],L]=Tl({prop:f,defaultProp:h,onChange:X=>{var ie;(ie=[...N.current][k.current])==null||ie.focus(),m(X)}}),q=y.useRef(P);function z(X){const V=d8(P,X);se(X,V)}function H(X){se(X,k.current)}function R(){const X=q.current[k.current];P[k.current]!==X&&x(P)}function se(X,V,{commit:ie}={commit:!1}){const le=p8(i),he=m8(Math.round((X-r)/i)*i+r,le),I=kf(he,[r,a]);L((Q=[])=>{const $=l8(Q,I,V);if(f8($,u*i)){k.current=$.indexOf(I);const xe=String($)!==String(Q);return xe&&ie&&x($),xe?$:Q}else return Q})}return s.jsx(s8,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:a,valueIndexToChangeRef:k,thumbs:N.current,values:P,orientation:o,form:v,children:s.jsx(_g.Provider,{scope:t.__scopeSlider,children:s.jsx(_g.Slot,{scope:t.__scopeSlider,children:s.jsx(C,{"aria-disabled":c,"data-disabled":c?"":void 0,...w,ref:e,onPointerDown:Tt(w.onPointerDown,()=>{c||(q.current=P)}),min:r,max:a,inverted:b,onSlideStart:c?void 0:z,onSlideMove:c?void 0:H,onSlideEnd:c?void 0:R,onHomeKeyDown:()=>!c&&se(r,0,{commit:!0}),onEndKeyDown:()=>!c&&se(a,P.length-1,{commit:!0}),onStepKeyDown:({event:X,direction:V})=>{if(!c){const he=x2.includes(X.key)||X.shiftKey&&g2.includes(X.key)?10:1,I=k.current,Q=P[I],$=i*he*V;se(Q+$,I,{commit:!0})}}})})})})});v2.displayName=nd;var[N2,w2]=b2(nd,{startEdge:"left",endEdge:"right",size:"width",direction:1}),r8=y.forwardRef((t,e)=>{const{min:n,max:r,dir:a,inverted:i,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onStepKeyDown:h,...f}=t,[m,x]=y.useState(null),b=Zt(e,C=>x(C)),v=y.useRef(void 0),w=Sp(a),N=w==="ltr",k=N&&!i||!N&&i;function T(C){const P=v.current||m.getBoundingClientRect(),L=[0,P.width],z=Z0(L,k?[n,r]:[r,n]);return v.current=P,z(C-P.left)}return s.jsx(N2,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:s.jsx(j2,{dir:w,"data-orientation":"horizontal",...f,ref:b,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:C=>{const P=T(C.clientX);o==null||o(P)},onSlideMove:C=>{const P=T(C.clientX);c==null||c(P)},onSlideEnd:()=>{v.current=void 0,u==null||u()},onStepKeyDown:C=>{const L=y2[k?"from-left":"from-right"].includes(C.key);h==null||h({event:C,direction:L?-1:1})}})})}),a8=y.forwardRef((t,e)=>{const{min:n,max:r,inverted:a,onSlideStart:i,onSlideMove:o,onSlideEnd:c,onStepKeyDown:u,...h}=t,f=y.useRef(null),m=Zt(e,f),x=y.useRef(void 0),b=!a;function v(w){const N=x.current||f.current.getBoundingClientRect(),k=[0,N.height],C=Z0(k,b?[r,n]:[n,r]);return x.current=N,C(w-N.top)}return s.jsx(N2,{scope:t.__scopeSlider,startEdge:b?"bottom":"top",endEdge:b?"top":"bottom",size:"height",direction:b?1:-1,children:s.jsx(j2,{"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:()=>{x.current=void 0,c==null||c()},onStepKeyDown:w=>{const k=y2[b?"from-bottom":"from-top"].includes(w.key);u==null||u({event:w,direction:k?-1:1})}})})}),j2=y.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:a,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:c,onStepKeyDown:u,...h}=t,f=Tp(nd,n);return s.jsx(Rt.span,{...h,ref:e,onKeyDown:Tt(t.onKeyDown,m=>{m.key==="Home"?(o(m),m.preventDefault()):m.key==="End"?(c(m),m.preventDefault()):x2.concat(g2).includes(m.key)&&(u(m),m.preventDefault())}),onPointerDown:Tt(t.onPointerDown,m=>{const x=m.target;x.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(x)?x.focus():r(m)}),onPointerMove:Tt(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&a(m)}),onPointerUp:Tt(t.onPointerUp,m=>{const x=m.target;x.hasPointerCapture(m.pointerId)&&(x.releasePointerCapture(m.pointerId),i(m))})})}),k2="SliderTrack",S2=y.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=Tp(k2,n);return s.jsx(Rt.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...r,ref:e})});S2.displayName=k2;var zg="SliderRange",C2=y.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=Tp(zg,n),i=w2(zg,n),o=y.useRef(null),c=Zt(e,o),u=a.values.length,h=a.values.map(x=>M2(x,a.min,a.max)),f=u>1?Math.min(...h):0,m=100-Math.max(...h);return s.jsx(Rt.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...r,ref:c,style:{...t.style,[i.startEdge]:f+"%",[i.endEdge]:m+"%"}})});C2.displayName=zg;var $g="SliderThumb",E2=y.forwardRef((t,e)=>{const n=t8(t.__scopeSlider),[r,a]=y.useState(null),i=Zt(e,c=>a(c)),o=y.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return s.jsx(i8,{...t,ref:i,index:o})}),i8=y.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:a,...i}=t,o=Tp($g,n),c=w2($g,n),[u,h]=y.useState(null),f=Zt(e,T=>h(T)),m=u?o.form||!!u.closest("form"):!0,x=Y0(u),b=o.values[r],v=b===void 0?0:M2(b,o.min,o.max),w=c8(r,o.values.length),N=x==null?void 0:x[c.size],k=N?u8(N,v,c.direction):0;return y.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(_g.ItemSlot,{scope:t.__scopeSlider,children:s.jsx(Rt.span,{role:"slider","aria-label":t["aria-label"]||w,"aria-valuemin":o.min,"aria-valuenow":b,"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:b===void 0?{display:"none"}:t.style,onFocus:Tt(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),m&&s.jsx(T2,{name:a??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:b},r)]})});E2.displayName=$g;var o8="RadioBubbleInput",T2=y.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const a=y.useRef(null),i=Zt(a,r),o=Q0(e);return y.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(Rt.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});T2.displayName=o8;function l8(t=[],e,n){const r=[...t];return r[n]=e,r.sort((a,i)=>a-i)}function M2(t,e,n){const i=100/(n-e)*(t-e);return kf(i,[0,100])}function c8(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function d8(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 u8(t,e,n){const r=t/2,i=Z0([0,50],[0,r]);return(r-i(e)*n)*n}function h8(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function f8(t,e){if(e>0){const n=h8(t);return Math.min(...n)>=e}return!0}function Z0(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 p8(t){return(String(t).split(".")[1]||"").length}function m8(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var x8=v2,g8=S2,y8=C2,b8=E2;function v8({className:t,defaultValue:e,value:n,min:r=0,max:a=100,...i}){const o=y.useMemo(()=>Array.isArray(n)?n:Array.isArray(e)?e:[r,a],[n,e,r,a]);return s.jsxs(x8,{defaultValue:e,value:n,min:r,max:a,className:$t("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",t),...i,children:[s.jsx(g8,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:s.jsx(y8,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:o.length},(c,u)=>s.jsx(b8,{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 N8={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,withdrawFee:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function A2(t){const e=!!(t!=null&&t.embedded),[n,r]=y.useState(N8),[a,i]=y.useState(!0),[o,c]=y.useState(!1);y.useEffect(()=>{Oe("/api/admin/referral-settings").then(f=>{const m=f==null?void 0:f.data;m&&typeof m=="object"&&r({distributorShare:m.distributorShare??90,minWithdrawAmount:m.minWithdrawAmount??10,bindingDays:m.bindingDays??30,userDiscount:m.userDiscount??5,withdrawFee:m.withdrawFee??5,enableAutoWithdraw:m.enableAutoWithdraw??!1,vipOrderShareVip:m.vipOrderShareVip??20,vipOrderShareNonVip:m.vipOrderShareNonVip??10})}).catch(console.error).finally(()=>i(!1))},[]);const u=async()=>{c(!0);try{const f={distributorShare:Number(n.distributorShare)||0,minWithdrawAmount:Number(n.minWithdrawAmount)||0,bindingDays:Number(n.bindingDays)||0,userDiscount:Number(n.userDiscount)||0,withdrawFee:Number(n.withdrawFee)??5,enableAutoWithdraw:!!n.enableAutoWithdraw,vipOrderShareVip:Number(n.vipOrderShareVip)||20,vipOrderShareNonVip:Number(n.vipOrderShareNonVip)||10},m=await jt("/api/admin/referral-settings",f);if(!m||m.success===!1){G.error("保存失败: "+(m&&typeof m=="object"&&"error"in m?m.error:""));return}G.success(`✅ 分销配置已保存成功! - -• 小程序与网站的推广规则会一起生效 -• 绑定关系会使用新的天数配置 -• 佣金比例会立即应用到新订单 - -如有缓存,请刷新前台/小程序页面。`)}catch(f){console.error(f),G.error("保存失败: "+(f instanceof Error?f.message:String(f)))}finally{c(!1)}},h=f=>m=>{const x=parseFloat(m.target.value||"0");r(b=>({...b,[f]:isNaN(x)?0:x}))};return a?s.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):s.jsxs("div",{className:e?"p-4 w-full":"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(Bc,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置(与系统设置中的「推广功能」开关配合:开关在"," ",s.jsx(Fc,{to:"/settings",className:"text-[#38bdac] underline hover:text-[#5ee0d1]",children:"系统设置 → 功能开关"}),")。"]})]}),s.jsxs(J,{onClick:u,disabled:o||a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(In,{className:"w-4 h-4 mr-2"}),o?"保存中...":"保存配置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{children:[s.jsxs(pt,{className:"flex items-center gap-2 text-white",children:[s.jsx(DM,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),s.jsx(nn,{className:"text-gray-400",children:"这三项会直接体现在小程序「推广规则」卡片上,同时影响实收佣金计算。"})]}),s.jsx(ze,{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(ne,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Ph,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),s.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:n.userDiscount,onChange:h("userDiscount")}),s.jsx("p",{className:"text-xs text-gray-500",children:"例如 5 表示好友立减 5%(在价格配置基础上生效)。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Wn,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(v8,{className:"flex-1",min:10,max:100,step:1,value:[n.distributorShare],onValueChange:([f])=>r(m=>({...m,distributorShare:f}))}),s.jsx(ce,{type:"number",min:0,max:100,className:"w-20 bg-[#0a1628] border-gray-700 text-white text-center",value:n.distributorShare,onChange:h("distributorShare")})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["内容订单佣金 = 订单金额 ×"," ",s.jsxs("span",{className:"text-[#38bdac] font-mono",children:[n.distributorShare,"%"]}),";会员订单见下方。"]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Ph,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),s.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:n.vipOrderShareVip,onChange:h("vipOrderShareVip")}),s.jsx("p",{className:"text-xs text-gray-500",children:"推广者已是会员时,会员订单佣金比例,默认 20%。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Ph,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),s.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:n.vipOrderShareNonVip,onChange:h("vipOrderShareNonVip")}),s.jsx("p",{className:"text-xs text-gray-500",children:"推广者非会员时,会员订单佣金比例,默认 10%。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Wn,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),s.jsx(ce,{type:"number",min:1,max:365,className:"bg-[#0a1628] border-gray-700 text-white",value:n.bindingDays,onChange:h("bindingDays")}),s.jsx("p",{className:"text-xs text-gray-500",children:"好友通过你的链接进来并登录后,绑定在你名下的天数。"})]})]})})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{children:[s.jsxs(pt,{className:"flex items-center gap-2 text-white",children:[s.jsx(Bc,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),s.jsx(nn,{className:"text-gray-400",children:"与「提现中心」「自动提现」相关的参数,影响推广者看到的可提现金额和最低门槛。"})]}),s.jsx(ze,{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(ne,{className:"text-gray-300",children:"最低提现金额(元)"}),s.jsx(ce,{type:"number",min:0,step:1,className:"bg-[#0a1628] border-gray-700 text-white",value:n.minWithdrawAmount,onChange:h("minWithdrawAmount")}),s.jsx("p",{className:"text-xs text-gray-500",children:"小程序「满 X 元可提现」展示的门槛,同时用于后端接口校验。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"提现手续费(%)"}),s.jsx(ce,{type:"number",min:0,max:100,step:.5,className:"bg-[#0a1628] border-gray-700 text-white",value:n.withdrawFee,onChange:h("withdrawFee")}),s.jsx("p",{className:"text-xs text-gray-500",children:"批准提现时按此比例扣除后打款,如 5 表示申请 100 元实际到账 95 元。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:["自动提现开关",s.jsx(He,{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(Gt,{checked:n.enableAutoWithdraw,onCheckedChange:f=>r(m=>({...m,enableAutoWithdraw:f}))}),s.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(ft,{children:s.jsxs(pt,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[s.jsx(Ph,{className:"w-4 h-4 text-[#38bdac]"}),"使用说明"]})}),s.jsxs(ze,{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 w8(){const[t]=_0(),[e,n]=y.useState("overview"),[r,a]=y.useState("orders"),[i,o]=y.useState([]),[c,u]=y.useState(null),[h,f]=y.useState([]),[m,x]=y.useState([]),[b,v]=y.useState([]),[w,N]=y.useState(!0),[k,T]=y.useState(null),[C,P]=y.useState(""),[L,q]=y.useState("all"),[z,H]=y.useState(1),[R,se]=y.useState(10),[X,V]=y.useState(0),[ie,le]=y.useState(new Set),[he,I]=y.useState(null),[Q,$]=y.useState(""),[xe,Z]=y.useState(!1),[F,U]=y.useState(null),[pe,fe]=y.useState(""),[oe,D]=y.useState(!1),[K,_]=y.useState(!1),[Y,te]=y.useState(!1),[Ne,Fe]=y.useState([]),[We,St]=y.useState(1),[wt,Vt]=y.useState(0),[_t,$n]=y.useState(""),[Jt,dn]=y.useState([]),[yn,bn]=y.useState(0),[En,vn]=y.useState(1),[At,Nn]=y.useState(10),[Ft,je]=y.useState(!1),[Te,Ue]=y.useState(null),[it,Dt]=y.useState(""),Ct=Lo(it,300),[$e,mt]=y.useState(""),[es,is]=y.useState(""),[Gn,Fn]=y.useState({}),[or,ls]=y.useState(null),[ws,kr]=y.useState(null),[Pn,Js]=y.useState([]),[js,Sr]=y.useState(!1),lr=y.useRef(null),cs=y.useCallback(async()=>{je(!0),Ue(null);try{const O=new URLSearchParams({mode:"contact",page:String(En),pageSize:String(At)});Ct.trim()&&O.set("search",Ct.trim()),$e&&O.set("source",$e),es&&O.set("pushStatus",es);const Se=await Oe(`/api/db/ckb-leads?${O}`);if(Se!=null&&Se.success)dn(Se.records||[]),bn(Se.total??0),Se.stats&&Fn(Se.stats);else{const Ze=(Se==null?void 0:Se.error)||"加载获客情况失败";Ue(Ze),G.error(Ze),dn([]),bn(0)}}catch(O){const Se=O instanceof Error?O.message:"网络错误";Ue(Se),G.error("加载获客情况失败: "+Se),dn([]),bn(0)}finally{je(!1)}},[En,At,Ct,$e,es]);y.useEffect(()=>{Js([])},[Ct,$e,es]),y.useEffect(()=>{const O=Jt.map(It=>It.id),Se=O.filter(It=>Pn.includes(It)).length,Ze=lr.current;Ze&&(Ze.indeterminate=Se>0&&SeZe.id),Se=O.length>0&&O.every(Ze=>Pn.includes(Ze));Js(Se?Ze=>Ze.filter(It=>!O.includes(It)):Ze=>[...new Set([...Ze,...O])])}function cr(O){Js(Se=>Se.includes(O)?Se.filter(Ze=>Ze!==O):[...Se,O])}async function dr(){if(Pn.length===0){G.info("请先勾选要删除的记录");return}const O=Pn.length;if(!confirm(`确定批量删除选中的 ${O} 条获客记录?删除后不可恢复。`))return;const Se=500;Sr(!0);try{let Ze=0;for(let It=0;ItZe.map(It=>It.id===O?ra(It,Se.record):It))):G.error((Se==null?void 0:Se.error)||"重推失败")}catch(Se){G.error(Se instanceof Error?Se.message:"重推请求失败")}finally{ls(null)}}}async function ks(O){if(O&&confirm("确定删除该条获客记录?删除后不可恢复,用户可再次提交留资。")){kr(O);try{const Se=await jt("/api/db/ckb-leads/delete",{id:O});Se!=null&&Se.success?G.success("已删除"):G.error((Se==null?void 0:Se.error)||"删除失败")}catch(Se){G.error(Se instanceof Error?Se.message:"删除请求失败")}finally{kr(null),cs()}}}function Ss(O){return O==="success"?s.jsx(He,{className:"bg-emerald-500/20 text-emerald-300 border-0 text-xs",children:"成功"}):O==="failed"?s.jsx(He,{className:"bg-red-500/20 text-red-300 border-0 text-xs",children:"失败"}):s.jsx(He,{className:"bg-amber-500/20 text-amber-300 border-0 text-xs",children:"待推送"})}y.useEffect(()=>{Ys()},[]),y.useEffect(()=>{const O=t.get("tab");(O==="overview"||O==="orders"||O==="bindings"||O==="withdrawals"||O==="settings"||O==="leads")&&n(O)},[t]),y.useEffect(()=>{H(1)},[e,L]),y.useEffect(()=>{if(e==="leads"){N(!1);return}wn(e)},[e]),y.useEffect(()=>{if(e==="orders"&&r==="giftpay"){wn("giftPay",!0);return}["orders","bindings","withdrawals"].includes(e)&&wn(e,!0),e==="leads"&&cs()},[z,R,L,C,e,r,We,_t,En,At,cs]),y.useEffect(()=>{e==="withdrawals"&&Bn()},[e]);async function Ys(){T(null);try{const O=await Oe("/api/admin/distribution/overview");O!=null&&O.success&&O.overview&&u(O.overview)}catch(O){console.error("[Admin] 概览接口异常:",O),T("加载概览失败")}try{const O=await Oe("/api/db/users");v((O==null?void 0:O.users)||[])}catch(O){console.error("[Admin] 用户数据加载失败:",O)}}async function wn(O,Se=!1){var Ze;if(!(!Se&&ie.has(O))){N(!0);try{const It=b;switch(O){case"overview":break;case"orders":{try{const Et=new URLSearchParams({page:String(z),pageSize:String(R),...L!=="all"&&{status:L},...C&&{search:C}}),ht=await Oe(`/api/admin/orders?${Et}`);if(ht!=null&&ht.success&&ht.orders){const xt=ht.orders.map(jn=>{const Ot=It.find(Xs=>Xs.id===jn.userId),Er=jn.referrerId?It.find(Xs=>Xs.id===jn.referrerId):null;return{...jn,amount:parseFloat(String(jn.amount))||0,userNickname:(Ot==null?void 0:Ot.nickname)||jn.userNickname||"未知用户",userPhone:(Ot==null?void 0:Ot.phone)||jn.userPhone||"-",referrerNickname:(Er==null?void 0:Er.nickname)||null,referrerCode:(Er==null?void 0:Er.referralCode)??null,type:jn.productType||jn.type}});o(xt),V(ht.total??xt.length)}else o([]),V(0)}catch(Et){console.error(Et),T("加载订单失败"),o([])}break}case"bindings":{try{const Et=new URLSearchParams({page:String(z),pageSize:String(R),...L!=="all"&&{status:L}}),ht=await Oe(`/api/db/distribution?${Et}`);f((ht==null?void 0:ht.bindings)||[]),V((ht==null?void 0:ht.total)??((Ze=ht==null?void 0:ht.bindings)==null?void 0:Ze.length)??0)}catch(Et){console.error(Et),T("加载绑定数据失败"),f([])}break}case"withdrawals":{try{const Et=L==="completed"?"success":L==="rejected"?"failed":L,ht=new URLSearchParams({...Et&&Et!=="all"&&{status:Et},page:String(z),pageSize:String(R)}),xt=await Oe(`/api/admin/withdrawals?${ht}`);if(xt!=null&&xt.success&&xt.withdrawals){const jn=xt.withdrawals.map(Ot=>({...Ot,account:Ot.account??"未绑定微信号",status:Ot.status==="success"?"completed":Ot.status==="failed"?"rejected":Ot.status}));x(jn),V((xt==null?void 0:xt.total)??jn.length)}else xt!=null&&xt.success||T(`获取提现记录失败: ${(xt==null?void 0:xt.error)||"未知错误"}`),x([])}catch(Et){console.error(Et),T("加载提现数据失败"),x([])}break}case"giftPay":{try{const Et=new URLSearchParams({page:String(We),pageSize:"20",..._t&&{status:_t}}),ht=await Oe(`/api/admin/gift-pay-requests?${Et}`);ht!=null&&ht.success&&ht.data?(Fe(ht.data),Vt(ht.total??ht.data.length)):(Fe([]),Vt(0))}catch(Et){console.error(Et),T("加载代付请求失败"),Fe([])}break}case"leads":break}le(Et=>new Set(Et).add(O))}catch(It){console.error(It)}finally{N(!1)}}}async function re(){if(T(null),e==="leads"){await cs();return}le(O=>{const Se=new Set(O);return Se.delete(e),e==="orders"&&r==="giftpay"&&Se.delete("giftPay"),Se}),e==="overview"&&Ys(),e==="orders"&&r==="giftpay"?await wn("giftPay",!0):await wn(e,!0)}async function ve(O){if(confirm("确认审核通过并打款?"))try{const Se=await tn("/api/admin/withdrawals",{id:O,action:"approve"});if(!(Se!=null&&Se.success)){const Ze=(Se==null?void 0:Se.message)||(Se==null?void 0:Se.error)||"操作失败";G.error(Ze);return}await re()}catch(Se){console.error(Se),G.error("操作失败")}}function Ye(O){U(O),fe("")}async function ut(){const O=F;if(!O)return;const Se=pe.trim();if(!Se){G.error("请填写拒绝原因");return}D(!0);try{const Ze=await tn("/api/admin/withdrawals",{id:O,action:"reject",errorMessage:Se});if(!(Ze!=null&&Ze.success)){G.error((Ze==null?void 0:Ze.error)||"操作失败");return}G.success("已拒绝该提现申请"),U(null),fe(""),await re()}catch(Ze){console.error(Ze),G.error("操作失败")}finally{D(!1)}}async function Bn(){try{const O=await Oe("/api/admin/withdrawals/auto-approve");O!=null&&O.success&&typeof O.enableAutoApprove=="boolean"&&_(O.enableAutoApprove)}catch{}}async function zs(O){te(!0);try{const Se=await tn("/api/admin/withdrawals/auto-approve",{enableAutoApprove:O});Se!=null&&Se.success?(_(O),G.success(O?"已开启自动审批,新提现将自动打款":"已关闭自动审批")):G.error("更新失败: "+((Se==null?void 0:Se.error)??""))}catch{G.error("更新失败")}finally{te(!1)}}function Vr(){F&&G.info("已取消操作"),U(null),fe("")}async function aa(){var O;if(!(!(he!=null&&he.orderSn)&&!(he!=null&&he.id))){Z(!0),T(null);try{const Se=await tn("/api/admin/orders/refund",{orderSn:he.orderSn||he.id,reason:Q||void 0});Se!=null&&Se.success?(I(null),$(""),await wn("orders",!0)):T((Se==null?void 0:Se.error)||"退款失败")}catch(Se){const Ze=Se;T(((O=Ze==null?void 0:Ze.data)==null?void 0:O.error)||"退款失败,请检查网络后重试")}finally{Z(!1)}}}function Ca(O){const Se={active:"bg-green-500/20 text-green-400",converted:"bg-blue-500/20 text-blue-400",expired:"bg-gray-500/20 text-gray-400",cancelled:"bg-red-500/20 text-red-400",pending:"bg-orange-500/20 text-orange-400",pending_confirm:"bg-orange-500/20 text-orange-400",processing:"bg-blue-500/20 text-blue-400",completed:"bg-green-500/20 text-green-400",rejected:"bg-red-500/20 text-red-400"},Ze={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return s.jsx(He,{className:`${Se[O]||"bg-gray-500/20 text-gray-400"} border-0`,children:Ze[O]||O})}const ds=Math.ceil(X/R)||1,us=Math.ceil(yn/At)||1,Ea=i,zt=h.filter(O=>{var Ze,It,Et,ht;if(!C)return!0;const Se=C.toLowerCase();return((Ze=O.refereeNickname)==null?void 0:Ze.toLowerCase().includes(Se))||((It=O.refereePhone)==null?void 0:It.includes(Se))||((Et=O.referrerName)==null?void 0:Et.toLowerCase().includes(Se))||((ht=O.referrerCode)==null?void 0:ht.toLowerCase().includes(Se))}),Ya=m.filter(O=>{var Ze;if(!C)return!0;const Se=C.toLowerCase();return((Ze=O.userName)==null?void 0:Ze.toLowerCase().includes(Se))||O.account&&O.account.toLowerCase().includes(Se)});return s.jsxs("div",{className:"p-8 w-full",children:[k&&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:k}),s.jsx("button",{type:"button",onClick:()=>T(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-semibold text-white",children:"推广中心"}),s.jsx("p",{className:"text-gray-500 text-sm mt-0.5",children:"分销绑定、提现审核、推广设置"})]}),s.jsxs(J,{onClick:re,disabled:w||e==="leads"&&Ft,variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[s.jsx(Ve,{className:`w-3.5 h-3.5 mr-1.5 ${w||e==="leads"&&Ft?"animate-spin":""}`}),"刷新"]})]}),s.jsx("div",{className:"flex gap-1 mb-6 bg-[#0a1628] rounded-lg p-1 border border-gray-700/40",children:[{key:"overview",label:"数据概览",icon:yf},{key:"orders",label:"订单与代付",icon:xf},{key:"bindings",label:"绑定管理",icon:Ba},{key:"withdrawals",label:"提现审核",icon:Bc},{key:"settings",label:"推广设置",icon:wo},{key:"leads",label:"获客情况",icon:jo}].map(O=>s.jsxs("button",{type:"button",onClick:()=>{n(O.key),q("all"),P(""),O.key!=="orders"&&a("orders"),O.key==="leads"&&vn(1)},className:`flex-1 flex items-center justify-center gap-1.5 px-3 py-2 rounded-md text-sm transition-all ${e===O.key?"bg-[#38bdac] text-white shadow-md":"text-gray-400 hover:text-white hover:bg-gray-700/40"}`,children:[s.jsx(O.icon,{className:"w-3.5 h-3.5"}),O.label]},O.key))}),w?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(Ve,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[e==="overview"&&c&&s.jsxs("div",{className:"space-y-6",children:[s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(ze,{className:"p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("span",{className:"text-sm font-medium text-gray-300 flex items-center gap-2",children:[s.jsx(Ri,{className:"w-4 h-4 text-amber-400"}),"推广转化漏斗"]}),s.jsx(J,{type:"button",size:"sm",variant:"ghost",onClick:()=>void re(),disabled:w,className:"text-gray-400 h-7",children:s.jsx(Ve,{className:`w-3.5 h-3.5 ${w?"animate-spin":""}`})})]}),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:"text-gray-500 text-xs border-b border-gray-700/50",children:[s.jsx("th",{className:"pb-2 text-left font-normal",children:"指标"}),s.jsx("th",{className:"pb-2 text-right font-normal",children:"今日"}),s.jsx("th",{className:"pb-2 text-right font-normal",children:"本月"}),s.jsx("th",{className:"pb-2 text-right font-normal",children:"累计"})]})}),s.jsxs("tbody",{className:"text-white",children:[s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(gf,{className:"w-4 h-4 text-blue-400"}),"点击数"]}),s.jsx("td",{className:"py-2.5 text-right font-bold",children:c.todayClicks}),s.jsx("td",{className:"py-2.5 text-right",children:c.monthClicks}),s.jsx("td",{className:"py-2.5 text-right",children:c.totalClicks})]}),s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(Ba,{className:"w-4 h-4 text-green-400"}),"绑定关系"]}),s.jsx("td",{className:"py-2.5 text-right font-bold",children:c.todayBindings}),s.jsx("td",{className:"py-2.5 text-right",children:c.monthBindings}),s.jsx("td",{className:"py-2.5 text-right",children:c.totalBindings})]}),s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(Cx,{className:"w-4 h-4 text-purple-400"}),"付款转化"]}),s.jsx("td",{className:"py-2.5 text-right font-bold",children:c.todayConversions}),s.jsx("td",{className:"py-2.5 text-right",children:c.monthConversions}),s.jsx("td",{className:"py-2.5 text-right",children:c.totalConversions})]}),s.jsxs("tr",{children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(xf,{className:"w-4 h-4 text-[#38bdac]"}),"佣金收入"]}),s.jsxs("td",{className:"py-2.5 text-right font-bold text-[#38bdac]",children:["¥",(c.todayEarnings??0).toFixed(0)]}),s.jsxs("td",{className:"py-2.5 text-right text-[#38bdac]",children:["¥",(c.monthEarnings??0).toFixed(0)]}),s.jsxs("td",{className:"py-2.5 text-right text-[#38bdac]",children:["¥",(c.totalEarnings??0).toFixed(0)]})]})]})]})}),c.conversionRate&&s.jsxs("p",{className:"text-xs text-gray-500 mt-3 text-right",children:["综合转化率 ",c.conversionRate]})]})}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(_e,{className:"bg-orange-500/10 border-orange-500/30",children:s.jsx(ze,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Eg,{className:"w-5 h-5 text-orange-400 shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-orange-300 font-medium text-sm",children:"即将过期绑定"}),s.jsxs("p",{className:"text-xl font-bold text-white",children:[c.expiringBindings," ",s.jsx("span",{className:"text-sm font-normal text-orange-300/60",children:"个 · 7天内"})]})]})]})})}),s.jsx(_e,{className:"bg-blue-500/10 border-blue-500/30",children:s.jsx(ze,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Bc,{className:"w-5 h-5 text-blue-400 shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-blue-300 font-medium text-sm",children:"待审核提现"}),s.jsxs("p",{className:"text-xl font-bold text-white",children:[c.pendingWithdrawals," ",s.jsxs("span",{className:"text-sm font-normal text-blue-300/60",children:["笔 · ¥",(c.pendingWithdrawAmount??0).toFixed(0)]})]})]}),s.jsx(J,{onClick:()=>n("withdrawals"),variant:"outline",size:"sm",className:"border-blue-500/50 text-blue-400 hover:bg-blue-500/20 shrink-0",children:"去审核"})]})})})]}),s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(ze,{className:"p-4",children:s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-white/5",children:[s.jsx(Wn,{className:"w-5 h-5 text-gray-400 shrink-0"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-lg font-bold text-white",children:c.totalDistributors}),s.jsx("p",{className:"text-[10px] text-gray-500",children:"推广用户"})]})]}),s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-white/5",children:[s.jsx(Cx,{className:"w-5 h-5 text-green-400 shrink-0"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-lg font-bold text-green-400",children:c.activeDistributors}),s.jsx("p",{className:"text-[10px] text-gray-500",children:"有收益用户"})]})]})]})})})]}),e==="orders"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2 mb-2",children:[s.jsx("button",{type:"button",className:`px-3 py-1.5 rounded-md text-xs font-medium transition-all ${r==="orders"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,onClick:()=>a("orders"),children:"普通订单"}),s.jsxs("button",{type:"button",className:`px-3 py-1.5 rounded-md text-xs font-medium transition-all ${r==="giftpay"?"bg-amber-500/20 text-amber-400 border border-amber-500/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,onClick:()=>{a("giftpay"),wn("giftPay",!0)},children:[s.jsx(Tg,{className:"w-3 h-3 inline mr-1"}),"代付请求"]})]}),r==="orders"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(va,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ce,{value:C,onChange:O=>P(O.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:L,onChange:O=>q(O.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white shrink-0",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.jsxs(J,{type:"button",variant:"outline",onClick:()=>void re(),disabled:w,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(Ve,{className:`w-4 h-4 mr-2 ${w?"animate-spin":""}`}),"刷新"]})]}),s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(ze,{className:"p-0",children:[i.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:Ea.map(O=>{var Se,Ze;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:[(Se=O.id)==null?void 0:Se.slice(0,12),"..."]}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:O.userNickname}),s.jsx("p",{className:"text-gray-500 text-xs",children:O.userPhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:(()=>{const It=O.productType||O.type,Et=O.description||"",ht=String(O.productId||O.sectionId||""),xt=It==="vip"||Et.includes("VIP")||Et.toLowerCase().includes("vip")||ht.toLowerCase().includes("vip");return It==="balance_recharge"?`余额充值 ¥${typeof O.amount=="number"?O.amount.toFixed(2):parseFloat(String(O.amount||"0")).toFixed(2)}`:xt?"超级个体开通费用":It==="fullbook"?`${O.bookName||"《底层逻辑》"} - 全本`:It==="match"?"匹配次数购买":`${O.bookName||"《底层逻辑》"} - ${O.sectionTitle||O.chapterTitle||`章节${O.productId||O.sectionId||""}`}`})()}),s.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const It=O.productType||O.type,Et=O.description||"",ht=String(O.productId||O.sectionId||""),xt=It==="vip"||Et.includes("VIP")||Et.toLowerCase().includes("vip")||ht.toLowerCase().includes("vip");return It==="balance_recharge"?"余额充值":xt?"超级个体":It==="fullbook"?"全书解锁":It==="match"?"功能权益":O.chapterTitle||"单章购买"})()})]})}),s.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof O.amount=="number"?O.amount.toFixed(2):parseFloat(String(O.amount||"0")).toFixed(2)]}),s.jsx("td",{className:"p-4 text-gray-300",children:O.paymentMethod==="wechat"?"微信支付":O.paymentMethod==="balance"?"余额支付":O.paymentMethod==="alipay"?"支付宝":O.paymentMethod||"微信支付"}),s.jsx("td",{className:"p-4",children:O.status==="refunded"?s.jsx(He,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):O.status==="completed"||O.status==="paid"?s.jsx(He,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):O.status==="pending"||O.status==="created"?s.jsx(He,{className:"bg-yellow-500/20 text-yellow-400 border-0",children:"待支付"}):s.jsx(He,{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:O.refundReason,children:O.status==="refunded"&&O.refundReason?O.refundReason:"-"}),s.jsx("td",{className:"p-4 text-gray-300 text-sm",children:O.referrerId||O.referralCode?s.jsxs("span",{title:O.referralCode||O.referrerCode||O.referrerId||"",children:[O.referrerNickname||O.referralCode||O.referrerCode||((Ze=O.referrerId)==null?void 0:Ze.slice(0,8)),(O.referralCode||O.referrerCode)&&` (${O.referralCode||O.referrerCode})`]}):"-"}),s.jsx("td",{className:"p-4 text-[#FFD700]",children:O.referrerEarnings?`¥${(typeof O.referrerEarnings=="number"?O.referrerEarnings:parseFloat(String(O.referrerEarnings))).toFixed(2)}`:"-"}),s.jsx("td",{className:"p-4 text-gray-400 text-sm",children:O.createdAt?new Date(O.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:(O.status==="paid"||O.status==="completed")&&s.jsxs(J,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{I(O),$("")},children:[s.jsx(qj,{className:"w-3 h-3 mr-1"}),"退款"]})})]},O.id)})})]})}),e==="orders"&&s.jsx(rr,{page:z,totalPages:ds,total:X,pageSize:R,onPageChange:H,onPageSizeChange:O=>{se(O),H(1)}})]})})]}),r==="giftpay"&&s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(ft,{children:s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[s.jsx(pt,{className:"text-white text-base",children:"代付请求列表"}),s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsxs("select",{className:"bg-[#0a1628] border border-gray-700 text-white rounded px-3 py-1.5 text-sm",value:_t,onChange:O=>{$n(O.target.value),St(1)},children:[s.jsx("option",{value:"",children:"全部状态"}),s.jsx("option",{value:"pending",children:"待支付(旧)"}),s.jsx("option",{value:"pending_pay",children:"待发起人支付"}),s.jsx("option",{value:"paid",children:"已支付"}),s.jsx("option",{value:"refunded",children:"已退款"}),s.jsx("option",{value:"cancelled",children:"已取消"}),s.jsx("option",{value:"expired",children:"已过期"})]}),s.jsxs(J,{size:"sm",variant:"outline",onClick:()=>void wn("giftPay",!0),disabled:w,className:"border-gray-600 text-gray-300",children:[s.jsx(Ve,{className:`w-3.5 h-3.5 mr-1 ${w?"animate-spin":""}`}),"刷新"]})]})]})}),s.jsxs(ze,{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/50",children:[s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"请求号"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"发起人"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"商品/金额"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"份数/已领"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"付款人"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"状态"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"创建时间"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Ne.map(O=>s.jsxs("tr",{className:"hover:bg-[#0a1628]",children:[s.jsx("td",{className:"p-3 font-mono text-xs text-gray-400",children:O.requestSn}),s.jsx("td",{className:"p-3 text-white text-sm",children:O.initiatorNick||O.initiatorUserId}),s.jsxs("td",{className:"p-3",children:[s.jsxs("p",{className:"text-white",children:[O.productType," · ¥",O.amount.toFixed(2)]}),O.description&&s.jsx("p",{className:"text-gray-500 text-xs",children:O.description})]}),s.jsx("td",{className:"p-3 text-gray-400",children:(O.quantity??1)>1?`${O.quantity}份 / 已领${O.redeemedCount??0}`:"-"}),s.jsx("td",{className:"p-3 text-gray-400",children:O.payerNick||(O.payerUserId?O.payerUserId:"-")}),s.jsx("td",{className:"p-3",children:s.jsx(He,{className:O.status==="paid"?"bg-green-500/20 text-green-400 border-0":O.status==="pending"||O.status==="pending_pay"?"bg-amber-500/20 text-amber-400 border-0":O.status==="refunded"?"bg-red-500/20 text-red-400 border-0":"bg-gray-500/20 text-gray-400 border-0",children:O.status==="paid"?"已支付":O.status==="pending"||O.status==="pending_pay"?"待支付":O.status==="refunded"?"已退款":O.status==="cancelled"?"已取消":"已过期"})}),s.jsx("td",{className:"p-3 text-gray-400 text-xs",children:O.createdAt?new Date(O.createdAt).toLocaleString("zh-CN"):"-"})]},O.id))})]})}),Ne.length===0&&!w&&s.jsx("p",{className:"text-center py-8 text-gray-500",children:"暂无代付请求"}),wt>20&&s.jsx("div",{className:"mt-4 flex justify-center",children:s.jsx(rr,{page:We,totalPages:Math.ceil(wt/20),total:wt,pageSize:20,onPageChange:St,onPageSizeChange:()=>{}})})]})]})]}),e==="bindings"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(va,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ce,{value:C,onChange:O=>P(O.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:L,onChange:O=>q(O.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white shrink-0",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.jsxs(J,{type:"button",variant:"outline",onClick:()=>void re(),disabled:w,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(Ve,{className:`w-4 h-4 mr-2 ${w?"animate-spin":""}`}),"刷新"]})]}),s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(ze,{className:"p-0",children:[zt.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:zt.map(O=>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:O.refereeNickname||"匿名用户"}),s.jsx("p",{className:"text-gray-500 text-xs",children:O.refereePhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white",children:O.referrerName||"-"}),s.jsx("p",{className:"text-gray-500 text-xs font-mono",children:O.referrerCode})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:O.boundAt?new Date(O.boundAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:O.expiresAt?new Date(O.expiresAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:Ca(O.status)}),s.jsx("td",{className:"p-4",children:O.commission?s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",O.commission.toFixed(2)]}):s.jsx("span",{className:"text-gray-500",children:"-"})})]},O.id))})]})}),e==="bindings"&&s.jsx(rr,{page:z,totalPages:ds,total:X,pageSize:R,onPageChange:H,onPageSizeChange:O=>{se(O),H(1)}})]})})]}),e==="withdrawals"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(va,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ce,{value:C,onChange:O=>P(O.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:L,onChange:O=>q(O.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white shrink-0",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.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-[#0f2137] border border-gray-700/50 shrink-0",children:[s.jsx(Ri,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-sm text-gray-300",children:"自动审批"}),s.jsx(Gt,{checked:K,onCheckedChange:zs,disabled:Y,className:"data-[state=checked]:bg-[#38bdac]"})]}),s.jsxs(J,{type:"button",variant:"outline",onClick:()=>void re(),disabled:w,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(Ve,{className:`w-4 h-4 mr-2 ${w?"animate-spin":""}`}),"刷新"]})]}),s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(ze,{className:"p-0",children:[Ya.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-right font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Ya.map(O=>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:[O.userAvatar?s.jsx("img",{src:O.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:(O.userName||O.name||"?").slice(0,1)}),s.jsx("p",{className:"text-white font-medium",children:O.userName||O.name})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",O.amount.toFixed(2)]})}),s.jsx("td",{className:"p-4",children:s.jsx(He,{className:O.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:O.method==="wechat"?"微信":"支付宝"})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-mono text-xs",children:O.account}),s.jsx("p",{className:"text-gray-500 text-xs",children:O.name})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:O.createdAt?new Date(O.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:Ca(O.status)}),s.jsx("td",{className:"p-4 max-w-[160px]",children:s.jsx("span",{className:`text-xs ${O.status==="rejected"||O.status==="failed"?"text-red-400":"text-gray-400"}`,title:O.remark,children:O.remark||"-"})}),s.jsx("td",{className:"p-4 text-right",children:O.status==="pending"&&s.jsxs("div",{className:"flex gap-2 justify-end",children:[s.jsxs(J,{size:"sm",onClick:()=>ve(O.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cx,{className:"w-4 h-4 mr-1"}),"通过"]}),s.jsxs(J,{size:"sm",variant:"outline",onClick:()=>Ye(O.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[s.jsx(Bj,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},O.id))})]})}),e==="withdrawals"&&s.jsx(rr,{page:z,totalPages:ds,total:X,pageSize:R,onPageChange:H,onPageSizeChange:O=>{se(O),H(1)}})]})})]}),e==="leads"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-500 text-sm",children:["展示用户通过文章 @、首页等入口留下的线索,以及转发存客宝接口的推送状态与失败原因(数据来自"," ",s.jsx("code",{className:"text-gray-400",children:"ckb_lead_records"}),")。"]}),Te&&s.jsxs("div",{className:"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:Te}),s.jsx("button",{type:"button",className:"shrink-0 ml-2 hover:text-red-300",onClick:()=>Ue(null),children:"×"})]}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[s.jsxs("div",{className:"p-3 bg-[#0f2137] border border-gray-700/50 rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs",children:"总留资条数"}),s.jsx("p",{className:"text-xl font-bold text-white",children:yn})]}),s.jsxs("div",{className:"p-3 bg-[#0f2137] border border-gray-700/50 rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs",children:"去重用户数"}),s.jsx("p",{className:"text-xl font-bold text-[#38bdac]",children:Gn.uniqueUsers??0})]}),(Gn.sourceStats||[]).slice(0,2).map(O=>s.jsxs("div",{className:"p-3 bg-[#0f2137] border border-gray-700/50 rounded-lg",children:[s.jsxs("p",{className:"text-gray-500 text-xs",children:["来源:",O.source]}),s.jsx("p",{className:"text-xl font-bold text-purple-400",children:O.cnt})]},O.source))]}),s.jsxs("div",{className:"flex flex-wrap gap-3 items-center",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(va,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ce,{value:it,onChange:O=>{Dt(O.target.value),vn(1)},placeholder:"搜索昵称 / 手机 / 微信 / 姓名…",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),Gn.sourceStats&&Gn.sourceStats.length>0&&s.jsxs("select",{value:$e,onChange:O=>{mt(O.target.value),vn(1)},className:"px-3 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white text-sm shrink-0",children:[s.jsx("option",{value:"",children:"全部来源"}),Gn.sourceStats.map(O=>s.jsxs("option",{value:O.source,children:[O.source,"(",O.cnt,")"]},O.source))]}),s.jsxs("select",{value:es,onChange:O=>{is(O.target.value),vn(1)},className:"px-3 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white text-sm shrink-0",children:[s.jsx("option",{value:"",children:"推送状态:全部"}),s.jsx("option",{value:"pending",children:"待推送"}),s.jsx("option",{value:"success",children:"成功"}),s.jsx("option",{value:"failed",children:"失败"})]}),s.jsxs(J,{type:"button",variant:"outline",onClick:()=>void cs(),disabled:Ft,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(Ve,{className:`w-4 h-4 mr-2 ${Ft?"animate-spin":""}`}),"刷新列表"]})]}),Jt.length>0&&s.jsxs("div",{className:"flex flex-wrap items-center gap-3 px-1 py-2 rounded-lg bg-[#0a1628]/80 border border-gray-700/40",children:[s.jsxs("span",{className:"text-sm text-gray-400",children:["已选 ",s.jsx("span",{className:"text-[#38bdac] font-medium",children:Pn.length})," 条(可翻页继续勾选;改搜索或来源/状态筛选会清空)"]}),s.jsxs(J,{type:"button",variant:"outline",size:"sm",disabled:js||Pn.length===0,onClick:()=>void dr(),className:"border-red-500/50 text-red-400 hover:bg-red-500/15 bg-transparent",children:[s.jsx(Yn,{className:`w-3.5 h-3.5 mr-1.5 ${js?"animate-pulse":""}`}),js?"删除中…":"批量删除选中"]}),Pn.length>0&&s.jsx(J,{type:"button",variant:"ghost",size:"sm",className:"text-gray-500 hover:text-gray-300",onClick:()=>Js([]),children:"清空选择"})]}),s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(ze,{className:"p-0",children:Jt.length===0&&!Ft?s.jsxs("div",{className:"py-16 text-center text-gray-500",children:[s.jsx(jo,{className:"w-12 h-12 mx-auto mb-3 text-[#38bdac]/30"}),s.jsx("p",{children:"暂无记录,或当前筛选无匹配"})]}):Jt.length===0&&Ft?s.jsxs("div",{className:"flex items-center justify-center py-16",children:[s.jsx(Ve,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载获客情况…"})]}):s.jsxs("div",{className:"relative min-h-[200px]",children:[s.jsxs("div",{className:Ft?"pointer-events-none select-none opacity-50":"",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-3 w-10 text-center font-medium",children:s.jsx("input",{ref:lr,type:"checkbox",checked:Jt.length>0&&Jt.every(O=>Pn.includes(O.id)),onChange:Cr,disabled:Ft,className:"w-4 h-4 rounded border-gray-600 bg-[#0f2137] accent-[#38bdac] cursor-pointer",title:"全选本页"})}),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:Jt.map(O=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-3 w-10 text-center align-middle",children:s.jsx("input",{type:"checkbox",checked:Pn.includes(O.id),onChange:()=>cr(O.id),disabled:js||Ft,className:"w-4 h-4 rounded border-gray-600 bg-[#0f2137] accent-[#38bdac] cursor-pointer"})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-2 min-w-[10rem]",children:[O.userAvatar?s.jsx("img",{src:O.userAvatar,alt:"",className:"w-9 h-9 rounded-full object-cover shrink-0"}):s.jsx("div",{className:"w-9 h-9 rounded-full bg-gray-600 flex items-center justify-center text-white text-sm shrink-0",children:(O.userNickname||O.name||"?").slice(0,1)}),s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-medium",children:O.userNickname||O.name||"-"}),O.userId&&s.jsx("p",{className:"text-gray-500 text-xs font-mono truncate max-w-[8rem]",children:O.userId})]})]})}),s.jsx("td",{className:"p-4 text-[#38bdac]",children:O.personName||"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("p",{children:O.phone||"-"}),s.jsx("p",{className:"text-xs",children:O.wechatId||"-"})]})}),s.jsx("td",{className:"p-4",children:s.jsx(He,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:O.source||"未知"})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{className:"space-y-1 max-w-[14rem]",children:[Ss(O.pushStatus),O.ckbError?s.jsx("p",{className:"text-xs text-red-300 break-words",title:O.ckbError,children:O.ckbError}):s.jsx("p",{className:"text-xs text-gray-500",children:"—"}),s.jsxs("p",{className:"text-xs text-gray-500",children:["重试 ",typeof O.retryCount=="number"?O.retryCount:0," 次"]})]})}),s.jsx("td",{className:"p-4 text-gray-400 text-xs",children:O.lastPushAt?new Date(O.lastPushAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4 text-gray-400 text-xs",children:O.createdAt?new Date(O.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4 text-right",children:s.jsxs("div",{className:"flex flex-wrap gap-2 justify-end",children:[s.jsxs(J,{size:"sm",variant:"outline",disabled:Ft||js||or===O.id||ws===O.id,onClick:()=>Qs(O.id),className:"border-gray-600 text-gray-200 hover:bg-gray-700/50 bg-transparent h-8",children:[s.jsx(Ve,{className:`w-3.5 h-3.5 mr-1 ${or===O.id?"animate-spin":""}`}),"重推"]}),s.jsxs(J,{size:"sm",variant:"outline",disabled:Ft||js||ws===O.id||or===O.id,onClick:()=>ks(O.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/15 bg-transparent h-8",children:[s.jsx(Yn,{className:`w-3.5 h-3.5 mr-1 ${ws===O.id?"animate-pulse":""}`}),"删除"]})]})})]},O.id))})]})}),s.jsx(rr,{page:En,totalPages:us,total:yn,pageSize:At,onPageChange:vn,onPageSizeChange:O=>{Nn(O),vn(1)}})]}),Ft&&s.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center rounded-b-lg bg-[#0f2137]/85 backdrop-blur-[2px]","aria-busy":"true","aria-label":"加载中",children:[s.jsx(Ve,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"mt-2 text-sm text-gray-400",children:"加载中…"})]})]})})})]})]}),s.jsx(Wt,{open:!!he,onOpenChange:O=>!O&&I(null),children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Kt,{children:s.jsx(qt,{className:"text-white",children:"订单退款"})}),he&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",he.orderSn||he.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof he.amount=="number"?he.amount.toFixed(2):parseFloat(String(he.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(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:Q,onChange:O=>$(O.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(Sn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>I(null),disabled:xe,children:"取消"}),s.jsx(J,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:aa,disabled:xe,children:xe?"退款中...":"确认退款"})]})]})}),s.jsx(Wt,{open:!!F,onOpenChange:O=>!O&&Vr(),children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Kt,{children:s.jsx(qt,{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(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:pe,onChange:O=>fe(O.target.value)})})]})]}),s.jsxs(Sn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:Vr,disabled:oe,children:"取消"}),s.jsx(J,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:ut,disabled:oe||!pe.trim(),children:oe?"提交中...":"确认拒绝"})]})]})}),e==="settings"&&s.jsx("div",{className:"-mx-8 -mt-6",children:s.jsx(A2,{embedded:!0})})]})}function j8(){const[t,e]=y.useState([]),[n,r]=y.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[a,i]=y.useState(!0),[o,c]=y.useState(null),[u,h]=y.useState("all"),[f,m]=y.useState(1),[x,b]=y.useState(10),[v,w]=y.useState(0),[N,k]=y.useState(null),[T,C]=y.useState(null),[P,L]=y.useState(""),[q,z]=y.useState(!1);async function H(){var I,Q,$,xe,Z,F,U;i(!0),c(null);try{const pe=new URLSearchParams({status:u,page:String(f),pageSize:String(x)}),fe=await Oe(`/api/admin/withdrawals?${pe}`);if(fe!=null&&fe.success){const oe=fe.withdrawals||[];e(oe),w(fe.total??((I=fe.stats)==null?void 0:I.total)??oe.length),r({total:((Q=fe.stats)==null?void 0:Q.total)??fe.total??oe.length,pendingCount:(($=fe.stats)==null?void 0:$.pendingCount)??0,pendingAmount:((xe=fe.stats)==null?void 0:xe.pendingAmount)??0,successCount:((Z=fe.stats)==null?void 0:Z.successCount)??0,successAmount:((F=fe.stats)==null?void 0:F.successAmount)??0,failedCount:((U=fe.stats)==null?void 0:U.failedCount)??0})}else c("加载提现记录失败")}catch(pe){console.error("Load withdrawals error:",pe),c("加载失败,请检查网络后重试")}finally{i(!1)}}y.useEffect(()=>{m(1)},[u]),y.useEffect(()=>{H()},[u,f,x]);const R=Math.ceil(v/x)||1;async function se(I){const Q=t.find($=>$.id===I);if(Q!=null&&Q.userCommissionInfo&&Q.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${Q.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。 - -确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;k(I);try{const $=await tn("/api/admin/withdrawals",{id:I,action:"approve"});$!=null&&$.success?H():G.error("操作失败: "+(($==null?void 0:$.error)??""))}catch{G.error("操作失败")}finally{k(null)}}async function X(I){if(confirm("确认撤回该笔打款?仅在用户未确认收款前可撤回。")){k(I);try{const Q=await jt("/api/admin/withdrawals/cancel",{id:I});Q!=null&&Q.success?(G.success("已撤回打款"),H()):G.error("撤回失败: "+((Q==null?void 0:Q.error)??"未知错误"))}catch{G.error("撤回失败")}finally{k(null)}}}function V(I){C(I),L("")}async function ie(){const I=T;if(!I)return;const Q=P.trim();if(!Q){G.error("请填写拒绝原因");return}z(!0);try{const $=await tn("/api/admin/withdrawals",{id:I,action:"reject",errorMessage:Q});$!=null&&$.success?(G.success("已拒绝该提现申请"),C(null),L(""),H()):G.error("操作失败: "+(($==null?void 0:$.error)??""))}catch{G.error("操作失败")}finally{z(!1)}}function le(){T&&G.info("已取消操作"),C(null),L("")}function he(I){switch(I){case"pending":return s.jsx(He,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待处理"});case"pending_confirm":return s.jsx(He,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待用户确认"});case"processing":return s.jsx(He,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:"已审批等待打款"});case"success":case"completed":return s.jsx(He,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"});case"failed":case"rejected":return s.jsx(He,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已拒绝"});default:return s.jsx(He,{className:"bg-gray-500/20 text-gray-400 border-0",children:I})}}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(J,{variant:"outline",onClick:H,disabled:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ve,{className:`w-4 h-4 mr-2 ${a?"animate-spin":""}`}),"刷新"]})]}),s.jsx(_e,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:s.jsx(ze,{className:"p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(xf,{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(_e,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(ze,{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(_e,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(ze,{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(_e,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(ze,{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(_e,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(ze,{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","processing","pending_confirm","success","failed"].map(I=>s.jsx(J,{variant:u===I?"default":"outline",size:"sm",onClick:()=>h(I),className:u===I?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:I==="all"?"全部":I==="pending"?"待处理":I==="processing"?"处理中":I==="pending_confirm"?"待确认收款":I==="success"?"已完成":"已拒绝"},I))}),s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(ze,{className:"p-0",children:a?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ve,{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(Bc,{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-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(I=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4 text-gray-400",children:new Date(I.createdAt??"").toLocaleString()}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[I.userAvatar?s.jsx("img",{src:Ua(I.userAvatar),alt:I.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:(I.userName??"?").charAt(0)}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-white",children:I.userName??"未知"}),s.jsx("p",{className:"text-xs text-gray-500",children:I.userPhone??I.referralCode??(I.userId??"").slice(0,10)})]})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(I.amount).toFixed(2)]})}),s.jsx("td",{className:"p-4",children:I.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:["¥",I.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:["¥",I.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:["¥",I.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:I.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",I.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):s.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),s.jsx("td",{className:"p-4",children:he(I.status)}),s.jsx("td",{className:"p-4 max-w-[180px]",children:s.jsx("span",{className:`text-xs ${I.status==="rejected"||I.status==="failed"?"text-red-400":"text-gray-400"}`,title:I.remark,children:I.remark||"-"})}),s.jsx("td",{className:"p-4 text-gray-400",children:I.processedAt?new Date(I.processedAt).toLocaleString():"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:I.userConfirmedAt?s.jsxs("span",{className:"text-green-400",title:I.userConfirmedAt,children:["已确认 ",new Date(I.userConfirmedAt).toLocaleString()]}):"-"}),s.jsxs("td",{className:"p-4 text-right",children:[(I.status==="pending"||I.status==="pending_confirm")&&s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsxs(J,{size:"sm",onClick:()=>se(I.id),disabled:N===I.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[s.jsx(Np,{className:"w-4 h-4 mr-1"}),"批准"]}),s.jsxs(J,{size:"sm",variant:"outline",onClick:()=>V(I.id),disabled:N===I.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[s.jsx(rs,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(I.status==="processing"||I.status==="pending_confirm")&&s.jsx("div",{className:"mt-2 flex items-center justify-end gap-2",children:s.jsx(J,{size:"sm",variant:"outline",onClick:()=>X(I.id),disabled:N===I.id,className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:"撤回打款"})}),(I.status==="success"||I.status==="completed")&&I.transactionId&&s.jsx("span",{className:"text-xs text-gray-500 font-mono",children:I.transactionId})]})]},I.id))})]})}),s.jsx(rr,{page:f,totalPages:R,total:v,pageSize:x,onPageChange:m,onPageSizeChange:I=>{b(I),m(1)}})]})})}),s.jsx(Wt,{open:!!T,onOpenChange:I=>!I&&le(),children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Kt,{children:s.jsx(qt,{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(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:P,onChange:I=>L(I.target.value)})})]})]}),s.jsxs(Sn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:le,disabled:q,children:"取消"}),s.jsx(J,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:ie,disabled:q||!P.trim(),children:q?"提交中...":"确认拒绝"})]})]})})]})}var $x={exports:{}},Fx={};/** - * @license React - * use-sync-external-store-shim.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var eN;function k8(){if(eN)return Fx;eN=1;var t=ju();function e(m,x){return m===x&&(m!==0||1/m===1/x)||m!==m&&x!==x}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,a=t.useEffect,i=t.useLayoutEffect,o=t.useDebugValue;function c(m,x){var b=x(),v=r({inst:{value:b,getSnapshot:x}}),w=v[0].inst,N=v[1];return i(function(){w.value=b,w.getSnapshot=x,u(w)&&N({inst:w})},[m,b,x]),a(function(){return u(w)&&N({inst:w}),m(function(){u(w)&&N({inst:w})})},[m]),o(b),b}function u(m){var x=m.getSnapshot;m=m.value;try{var b=x();return!n(m,b)}catch{return!0}}function h(m,x){return x()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:c;return Fx.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,Fx}var tN;function I2(){return tN||(tN=1,$x.exports=k8()),$x.exports}var P2=I2();function Is(t){this.content=t}Is.prototype={constructor:Is,find:function(t){for(var e=0;e>1}};Is.from=function(t){if(t instanceof Is)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Is(e)};function R2(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let a=t.child(r),i=e.child(r);if(a==i){n+=a.nodeSize;continue}if(!a.sameMarkup(i))return n;if(a.isText&&a.text!=i.text){for(let o=0;a.text[o]==i.text[o];o++)n++;return n}if(a.content.size||i.content.size){let o=R2(a.content,i.content,n+1);if(o!=null)return o}n+=a.nodeSize}}function L2(t,e,n,r){for(let a=t.childCount,i=e.childCount;;){if(a==0||i==0)return a==i?null:{a:n,b:r};let o=t.child(--a),c=e.child(--i),u=o.nodeSize;if(o==c){n-=u,r-=u;continue}if(!o.sameMarkup(c))return{a:n,b:r};if(o.isText&&o.text!=c.text){let h=0,f=Math.min(o.text.length,c.text.length);for(;he&&r(u,a+c,i||null,o)!==!1&&u.content.size){let f=c+1;u.nodesBetween(Math.max(0,e-f),Math.min(u.content.size,n-f),r,a+f)}c=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,a){let i="",o=!0;return this.nodesBetween(e,n,(c,u)=>{let h=c.isText?c.text.slice(Math.max(e,u)-u,n-u):c.isLeaf?a?typeof a=="function"?a(c):a:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&h||c.isTextblock)&&r&&(o?o=!1:i+=r),i+=h},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,a=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(a[a.length-1]=n.withText(n.text+r.text),i=1);ie)for(let i=0,o=0;oe&&((on)&&(c.isText?c=c.cut(Math.max(0,e-o),Math.min(c.text.length,n-o)):c=c.cut(Math.max(0,e-o-1),Math.min(c.content.size,n-o-1))),r.push(c),a+=c.nodeSize),o=u}return new Ee(r,a)}cutByIndex(e,n){return e==n?Ee.empty:e==0&&n==this.content.length?this:new Ee(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let a=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return a[e]=n,new Ee(a,i)}addToStart(e){return new Ee([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Ee(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let a=this.child(n),i=r+a.nodeSize;if(i>=e)return i==e?Bh(n+1,i):Bh(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return Ee.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Ee(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Ee.empty;let n,r=0;for(let a=0;athis.type.rank&&(n||(n=e.slice(0,a)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-a.type.rank),n}};cn.none=[];class Cf extends Error{}class Be{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=D2(this.content,e+this.openStart,n);return r&&new Be(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Be(O2(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Be.empty;let r=n.openStart||0,a=n.openEnd||0;if(typeof r!="number"||typeof a!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Be(Ee.fromJSON(e,n.content),r,a)}static maxOpen(e,n=!0){let r=0,a=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)a++;return new Be(e,r,a)}}Be.empty=new Be(Ee.empty,0,0);function O2(t,e,n){let{index:r,offset:a}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:c}=t.findIndex(n);if(a==e||i.isText){if(c!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(O2(i.content,e-a-1,n-a-1)))}function D2(t,e,n,r){let{index:a,offset:i}=t.findIndex(e),o=t.maybeChild(a);if(i==e||o.isText)return r&&!r.canReplace(a,a,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=D2(o.content,e-i-1,n,o);return c&&t.replaceChild(a,o.copy(c))}function S8(t,e,n){if(n.openStart>t.depth)throw new Cf("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Cf("Inconsistent open depths");return _2(t,e,n,0)}function _2(t,e,n,r){let a=t.index(r),i=t.node(r);if(a==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Qd(t,e,n,r){let a=(e||t).node(n),i=0,o=e?e.index(n):a.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(vl(t.nodeAfter,r),i++));for(let c=i;ca&&Bg(t,e,a+1),o=r.depth>a&&Bg(n,r,a+1),c=[];return Qd(null,t,a,c),i&&o&&e.index(a)==n.index(a)?(z2(i,o),vl(Nl(i,$2(t,e,n,r,a+1)),c)):(i&&vl(Nl(i,Ef(t,e,a+1)),c),Qd(e,n,a,c),o&&vl(Nl(o,Ef(n,r,a+1)),c)),Qd(r,null,a,c),new Ee(c)}function Ef(t,e,n){let r=[];if(Qd(null,t,n,r),t.depth>n){let a=Bg(t,e,n+1);vl(Nl(a,Ef(t,e,n+1)),r)}return Qd(e,null,n,r),new Ee(r)}function C8(t,e){let n=e.depth-t.openStart,a=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)a=e.node(i).copy(Ee.from(a));return{start:a.resolveNoCache(t.openStart+n),end:a.resolveNoCache(a.content.size-t.openEnd-n)}}class du{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],a=e.child(n);return r?e.child(n).cut(r):a}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],a=n==0?0:this.path[n*3-1]+1;for(let i=0;i0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Tf(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],a=0,i=n;for(let o=e;;){let{index:c,offset:u}=o.content.findIndex(i),h=i-u;if(r.push(o,c,a+u),!h||(o=o.child(c),o.isText))break;i=h-1,a+=u+1}return new du(n,r,i)}static resolveCached(e,n){let r=nN.get(e);if(r)for(let i=0;ie&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(a=!0),!a)),a}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),F2(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=Ee.empty,a=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,a,i),c=o&&o.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let u=a;un.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let a=Ee.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,a,r);return i.type.checkAttrs(i.attrs),i}};Mi.prototype.text=void 0;class Mf extends Mi{constructor(e,n,r,a){if(super(e,n,null,a),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):F2(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Mf(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Mf(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function F2(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Pl{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new A8(e,n);if(r.next==null)return Pl.empty;let a=B2(r);r.next&&r.err("Unexpected trailing text");let i=_8(D8(a));return z8(i,r),i}matchType(e){for(let n=0;nh.createAndFill()));for(let h=0;h=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let a=0;a{let i=a+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return i}).join(` -`)}}Pl.empty=new Pl(!0);class A8{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function B2(t){let e=[];do e.push(I8(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function I8(t){let e=[];do e.push(P8(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function P8(t){let e=O8(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=R8(t,e);else break;return e}function sN(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function R8(t,e){let n=sN(t),r=n;return t.eat(",")&&(t.next!="}"?r=sN(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function L8(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let a=[];for(let i in n){let o=n[i];o.isInGroup(e)&&a.push(o)}return a.length==0&&t.err("No node type or group '"+e+"' found"),a}function O8(t){if(t.eat("(")){let e=B2(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=L8(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function D8(t){let e=[[]];return a(i(t,0),n()),e;function n(){return e.push([])-1}function r(o,c,u){let h={term:u,to:c};return e[o].push(h),h}function a(o,c){o.forEach(u=>u.to=c)}function i(o,c){if(o.type=="choice")return o.exprs.reduce((u,h)=>u.concat(i(h,c)),[]);if(o.type=="seq")for(let u=0;;u++){let h=i(o.exprs[u],c);if(u==o.exprs.length-1)return h;a(h,c=n())}else if(o.type=="star"){let u=n();return r(c,u),a(i(o.expr,u),u),[r(u)]}else if(o.type=="plus"){let u=n();return a(i(o.expr,c),u),a(i(o.expr,u),u),[r(u)]}else{if(o.type=="opt")return[r(c)].concat(i(o.expr,c));if(o.type=="range"){let u=c;for(let h=0;h{t[o].forEach(({term:c,to:u})=>{if(!c)return;let h;for(let f=0;f{h||a.push([c,h=[]]),h.indexOf(f)==-1&&h.push(f)})})});let i=e[r.join(",")]=new Pl(r.indexOf(t.length-1)>-1);for(let o=0;o-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:U2(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Mi(this,this.computeAttrs(e),Ee.from(n),cn.setFrom(r))}createChecked(e=null,n,r){return n=Ee.from(n),this.checkContent(n),new Mi(this,this.computeAttrs(e),n,cn.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=Ee.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let a=this.contentMatch.matchFragment(n),i=a&&a.fillBefore(Ee.empty,!0);return i?new Mi(this,e,n.append(i),cn.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;nr[i]=new q2(i,n,o));let a=n.spec.topNode||"doc";if(!r[a])throw new RangeError("Schema is missing its top node type ('"+a+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function $8(t,e,n){let r=n.split("|");return a=>{let i=a===null?"null":typeof a;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class F8{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?$8(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Mp{constructor(e,n,r,a){this.name=e,this.rank=n,this.schema=r,this.spec=a,this.attrs=K2(e,a.attrs),this.excluded=null;let i=H2(this.attrs);this.instance=i?new cn(this,i):null}create(e=null){return!e&&this.instance?this.instance:new cn(this,U2(this.attrs,e))}static compile(e,n){let r=Object.create(null),a=0;return e.forEach((i,o)=>r[i]=new Mp(i,a++,n,o)),r}removeFromSet(e){for(var n=0;n-1}}class G2{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let a in e)n[a]=e[a];n.nodes=Is.from(e.nodes),n.marks=Is.from(e.marks||{}),this.nodes=aN.compile(this.spec.nodes,this),this.marks=Mp.compile(this.spec.marks,this);let r=Object.create(null);for(let a in this.nodes){if(a in this.marks)throw new RangeError(a+" can not be both a node and a mark");let i=this.nodes[a],o=i.spec.content||"",c=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=Pl.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=c=="_"?null:c?iN(this,c.split(" ")):c==""||!i.inlineContent?[]:null}for(let a in this.marks){let i=this.marks[a],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:iN(this,o.split(" "))}this.nodeFromJSON=a=>Mi.fromJSON(this,a),this.markFromJSON=a=>cn.fromJSON(this,a),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,a){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof aN){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,a)}text(e,n){let r=this.nodes.text;return new Mf(r,r.defaultAttrs,e,cn.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function iN(t,e){let n=[];for(let r=0;r-1)&&n.push(o=u)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function B8(t){return t.tag!=null}function V8(t){return t.style!=null}class Mo{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(a=>{if(B8(a))this.tags.push(a);else if(V8(a)){let i=/[^=]*/.exec(a.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(a)}}),this.normalizeLists=!this.tags.some(a=>{if(!/^(ul|ol)\b/.test(a.tag)||!a.node)return!1;let i=e.nodes[a.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new lN(this,n,!1);return r.addAll(e,cn.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new lN(this,n,!0);return r.addAll(e,cn.none,n.from,n.to),Be.maxOpen(r.finish())}matchTag(e,n,r){for(let a=r?this.tags.indexOf(r)+1:0;ae.length&&(c.charCodeAt(e.length)!=61||c.slice(e.length+1)!=n))){if(o.getAttrs){let u=o.getAttrs(n);if(u===!1)continue;o.attrs=u||void 0}return o}}}static schemaRules(e){let n=[];function r(a){let i=a.priority==null?50:a.priority,o=0;for(;o{r(o=cN(o)),o.mark||o.ignore||o.clearMark||(o.mark=a)})}for(let a in e.nodes){let i=e.nodes[a].spec.parseDOM;i&&i.forEach(o=>{r(o=cN(o)),o.node||o.ignore||o.mark||(o.node=a)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Mo(e,Mo.schemaRules(e)))}}const J2={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},H8={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Q2={ol:!0,ul:!0},uu=1,Hg=2,Yd=4;function oN(t,e,n){return e!=null?(e?uu:0)|(e==="full"?Hg:0):t&&t.whitespace=="pre"?uu|Hg:n&~Yd}class Vh{constructor(e,n,r,a,i,o){this.type=e,this.attrs=n,this.marks=r,this.solid=a,this.options=o,this.content=[],this.activeMarks=cn.none,this.match=i||(o&Yd?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Ee.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,a;return(a=r.findWrapping(e.type))?(this.match=r,a):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&uu)){let r=this.content[this.content.length-1],a;if(r&&r.isText&&(a=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==a[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-a[0].length))}}let n=Ee.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(Ee.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!J2.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class lN{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let a=n.topNode,i,o=oN(null,n.preserveWhitespace,0)|(r?Yd:0);a?i=new Vh(a.type,a.attrs,cn.none,!0,n.topMatch||a.type.contentMatch,o):r?i=new Vh(null,null,cn.none,!0,null,o):i=new Vh(e.schema.topNodeType,null,cn.none,!0,null,o),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,a=this.top,i=a.options&Hg?"full":this.localPreserveWS||(a.options&uu)>0,{schema:o}=this.parser;if(i==="full"||a.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,` -`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let c=r.split(/\r?\n|\r/);for(let u=0;u!u.clearMark(h)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)c=u;else break}}return n}addElementByRule(e,n,r,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):dN(h.type,e))?(u=h.addToSet(u),!1):!0),this.nodes.push(new Vh(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|=uu)}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 U8(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Q2.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function W8(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function cN(t){let e={};for(let n in t)e[n]=t[n];return e}function dN(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&&of(Vx(r),a(e,n),null,e.attrs)}static renderSpec(e,n,r=null,a){return of(e,n,r,a)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Vl(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=uN(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return uN(e.marks)}}function uN(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Vx(t){return t.document||window.document}const hN=new WeakMap;function K8(t){let e=hN.get(t);return e===void 0&&hN.set(t,e=q8(t)),e}function q8(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 x=m.indexOf(" ");x>0?u.setAttributeNS(m.slice(0,x),m.slice(x+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:b,contentDOM:v}=of(t,x,n,r);if(u.appendChild(b),v){if(c)throw new RangeError("Multiple content holes");c=v}}}return{dom:u,contentDOM:c}}const Y2=65535,X2=Math.pow(2,16);function G8(t,e){return t+e*X2}function fN(t){return t&Y2}function J8(t){return(t-(t&Y2))/X2}const Z2=1,eS=2,lf=4,tS=8;class Ug{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&tS)>0}get deletedBefore(){return(this.delInfo&(Z2|lf))>0}get deletedAfter(){return(this.delInfo&(eS|lf))>0}get deletedAcross(){return(this.delInfo&lf)>0}}class zr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&zr.empty)return zr.empty}recover(e){let n=0,r=fN(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 x=h?e==u?-1:e==m?1:n:n,b=u+a+(x<0?0:f);if(r)return b;let v=e==(n<0?u:m)?null:G8(c/3,e-u),w=e==u?eS:e==m?Z2:lf;return(n<0?e!=u:e!=m)&&(w|=tS),new Ug(b,w,v)}a+=f-h}return r?e+a:new Ug(e+a,0,null)}touches(e,n){let r=0,a=fN(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 hu;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 Xn.fromReplace(e,this.from,this.to,i)}invert(){return new Na(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 ko(n.pos,r.pos,this.mark)}merge(e){return e instanceof ko&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ko(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 ko(n.from,n.to,e.markFromJSON(n.mark))}}Gs.jsonID("addMark",ko);class Na extends Gs{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 Be(ey(n.content,a=>a.mark(this.mark.removeFromSet(a.marks)),e),n.openStart,n.openEnd);return Xn.fromReplace(e,this.from,this.to,r)}invert(){return new ko(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 Na(n.pos,r.pos,this.mark)}merge(e){return e instanceof Na&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Na(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 Na(n.from,n.to,e.markFromJSON(n.mark))}}Gs.jsonID("removeMark",Na);class So extends Gs{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Xn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Xn.fromReplace(e,this.pos,this.pos+1,new Be(Ee.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 vs(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 vs(n.from,n.to,n.gapFrom,n.gapTo,Be.fromJSON(e,n.slice),n.insert,!!n.structure)}}Gs.jsonID("replaceAround",vs);function Wg(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 Q8(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 x=Math.max(h,e),b=Math.min(h+u.nodeSize,n),v=r.addToSet(m);for(let w=0;wt.step(u)),i.forEach(u=>t.step(u))}function Y8(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 Mp){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 Na(o.from,o.to,o.style)))}function ty(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 X8(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function sd(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=Ee.from(r.node(v).copy(f)),m++):u--;let x=Ee.empty,b=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=Ee.from(n[o].type.create(n[o].attrs,r))}let a=e.start,i=e.end;t.step(new vs(a,i,a,i,new Be(r,0,0),n.length,!0))}function sL(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)&&rL(t.doc,t.mapping.slice(i).map(c),r)){let h=null;if(r.schema.linebreakReplacement){let b=r.whitespace=="pre",v=!!r.contentMatch.matchType(r.schema.linebreakReplacement);b&&!v?h=!1:!b&&v&&(h=!0)}h===!1&&sS(t,o,c,i),ty(t,t.mapping.slice(i).map(c,1),r,void 0,h===null);let f=t.mapping.slice(i),m=f.map(c,1),x=f.map(c+o.nodeSize,1);return t.step(new vs(m,x,m+1,x-1,new Be(Ee.from(r.create(u,null,o.marks)),0,0),1,!0)),h===!0&&nS(t,o,c,i),!1}})}function nS(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 sS(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 rL(t,e,n){let r=t.resolve(e),a=r.index();return r.parent.canReplaceWith(a,a+1,n)}function aL(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 vs(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new Be(Ee.from(o),0,0),1,!0))}function Ai(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),x=a.index(h);if(m.type.spec.isolating)return!1;let b=m.content.cutByIndex(x,m.childCount),v=r&&r[f+1];v&&(b=b.replaceChild(0,v.type.create(v.attrs)));let w=r&&r[f]||m;if(!m.canReplace(x+1,m.childCount)||!w.type.validContent(b))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 iL(t,e,n=1,r){let a=t.doc.resolve(e),i=Ee.empty,o=Ee.empty;for(let c=a.depth,u=a.depth-n,h=n-1;c>u;c--,h--){i=Ee.from(a.node(c).copy(i));let f=r&&r[h];o=Ee.from(f?f.type.create(f.attrs,o):a.node(c).copy(o))}t.step(new bs(e,e,new Be(i.append(o),n,n),!0))}function Vo(t,e){let n=t.resolve(e),r=n.index();return rS(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function oL(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&&rS(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 lL(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);sS(t,f.node(),f.before(),c)}o.inlineContent&&ty(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 bs(h,u.map(e+n,-1),Be.empty,!0)),r===!0){let f=t.doc.resolve(h);nS(t,f.node(),f.before(),t.steps.length)}return t}function cL(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 Ip(t,e,n=e,r=Be.empty){if(e==n&&!r.size)return null;let a=t.resolve(e),i=t.resolve(n);return iS(a,i,r)?new bs(e,n,r):new dL(a,i,r).fit()}function iS(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class dL{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=Ee.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=Ee.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 Be(i,o,c);return e>-1?new vs(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new bs(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=Ux(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(Ee.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=Ux(e,n);return!a.childCount||a.firstChild.isLeaf?!1:(this.unplaced=new Be(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=Ux(e,n);if(a.childCount<=1&&n>0){let i=e.size-n<=n+a.size;this.unplaced=new Be(Bd(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new Be(Bd(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(oS(w.mark(x.allowedMarks(w.marks)),h==1?u:0,h==c.childCount?b:-1)))}let v=h==c.childCount;v||(b=-1),this.placed=Vd(this.placed,n,Ee.from(f)),this.frontier[n].match=m,v&&b<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=Wx(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=Vd(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=Vd(this.placed,this.depth,Ee.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(Ee.empty,!0);n.childCount&&(this.placed=Vd(this.placed,this.frontier.length,n))}}function Bd(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Bd(t.firstChild.content,e-1,n)))}function Vd(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Vd(t.lastChild.content,e-1,n)))}function Ux(t,e){for(let n=0;n1&&(r=r.replaceChild(0,oS(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(Ee.empty,!0)))),t.copy(r)}function Wx(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&&!uL(n,i.content,o)?c:null}function uL(t,e,n){for(let r=n;r0;x--,b--){let v=a.node(x).type.spec;if(v.defining||v.definingAsContext||v.isolating)break;o.indexOf(x)>-1?c=x:a.before(x)==b&&o.splice(1,0,-x)}let u=o.indexOf(c),h=[],f=r.openStart;for(let x=r.content,b=0;;b++){let v=x.firstChild;if(h.push(v),b==r.openStart)break;x=v.content}for(let x=f-1;x>=0;x--){let b=h[x],v=hL(b.type);if(v&&!b.sameMarkup(a.node(Math.abs(c)-1)))f=x;else if(v||!b.type.isTextblock)break}for(let x=r.openStart;x>=0;x--){let b=(x+f+1)%(r.openStart+1),v=h[b];if(v)for(let w=0;w=0&&(t.replace(e,n,r),!(t.steps.length>m));x--){let b=o[x];b<0||(e=a.before(b),n=i.after(b))}}function lS(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(Ee.empty,!0))}return t}function pL(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let a=cL(t.doc,e,r.type);a!=null&&(e=n=a)}t.replaceRange(e,n,new Be(Ee.from(r),0,0))}function mL(t,e,n){let r=t.doc.resolve(e),a=t.doc.resolve(n),i=cS(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 cS(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 _c extends Gs{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 Xn.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 Xn.fromReplace(e,this.pos,this.pos+1,new Be(Ee.from(a),0,n.isLeaf?0:1))}getMap(){return zr.empty}invert(e){return new _c(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 _c(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 _c(n.pos,n.attr,n.value)}}Gs.jsonID("attr",_c);class fu extends Gs{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 Xn.ok(r)}getMap(){return zr.empty}invert(e){return new fu(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 fu(n.attr,n.value)}}Gs.jsonID("docAttr",fu);let Hc=class extends Error{};Hc=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Hc.prototype=Object.create(Error.prototype);Hc.prototype.constructor=Hc;Hc.prototype.name="TransformError";class sy{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new hu}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Hc(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=Be.empty){let a=Ip(this.doc,e,n,r);return a&&this.step(a),this}replaceWith(e,n,r){return this.replace(e,n,new Be(Ee.from(r),0,0))}delete(e,n){return this.replace(e,n,Be.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return fL(this,e,n,r),this}replaceRangeWith(e,n,r){return pL(this,e,n,r),this}deleteRange(e,n){return mL(this,e,n),this}lift(e,n){return Z8(this,e,n),this}join(e,n=1){return lL(this,e,n),this}wrap(e,n){return nL(this,e,n),this}setBlockType(e,n=e,r,a=null){return sL(this,e,n,r,a),this}setNodeMarkup(e,n,r=null,a){return aL(this,e,n,r,a),this}setNodeAttribute(e,n,r){return this.step(new _c(e,n,r)),this}setDocAttribute(e,n){return this.step(new fu(e,n)),this}addNodeMark(e,n){return this.step(new So(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 cn)n.isInSet(r.marks)&&this.step(new Rl(e,n));else{let a=r.marks,i,o=[];for(;i=n.isInSet(a);)o.push(new Rl(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 iL(this,e,n,r),this}addMark(e,n,r){return Q8(this,e,n,r),this}removeMark(e,n,r){return Y8(this,e,n,r),this}clearIncompatible(e,n,r){return ty(this,e,n,r),this}}const Kx=Object.create(null);class gt{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new dS(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?Cc(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):Cc(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 Cc(e,e,0,0,1)||new Fr(e)}static atEnd(e){return Cc(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=Kx[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 Kx)throw new RangeError("Duplicate use of selection JSON ID "+e);return Kx[e]=n,n.prototype.jsonID=e,n}getBookmark(){return lt.between(this.$anchor,this.$head).getBookmark()}}gt.prototype.visible=!0;class dS{constructor(e,n){this.$from=e,this.$to=n}}let mN=!1;function xN(t){!mN&&!t.parent.inlineContent&&(mN=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class lt extends gt{constructor(e,n=e){xN(e),xN(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 gt.near(r);let a=e.resolve(n.map(this.anchor));return new lt(a.parent.inlineContent?a:r,r)}replace(e,n=Be.empty){if(super.replace(e,n),n==Be.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof lt&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Pp(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 lt(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=gt.findFrom(n,r,!0)||gt.findFrom(n,-r,!0);if(i)n=i.$head;else return gt.near(n,r)}return e.parent.inlineContent||(a==0?e=n:(e=(gt.findFrom(e,-r,!0)||gt.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&&ot.isSelectable(c))return ot.create(t,n-(a<0?c.nodeSize:0))}else{let u=Cc(t,c,n+a,a<0?c.childCount:0,a,i);if(u)return u}n+=c.nodeSize*a}return null}function gN(t,e,n){let r=t.steps.length-1;if(r{o==null&&(o=f)}),t.setSelection(gt.near(t.doc.resolve(o),n))}const yN=1,Hh=2,bN=4;class gL extends sy{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|=Hh,this}ensureMarks(e){return cn.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&Hh)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Hh,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)||cn.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(gt.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|=bN,this}get scrolledIntoView(){return(this.updated&bN)>0}}function vN(t,e){return!e||!t?t:t.bind(e)}class Hd{constructor(e,n,r){this.name=e,this.init=vN(n.init,r),this.apply=vN(n.apply,r)}}const yL=[new Hd("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Hd("selection",{init(t,e){return t.selection||gt.atStart(e.doc)},apply(t){return t.selection}}),new Hd("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Hd("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class qx{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=yL.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 Hd(r.key,r.spec.state,r))})}}class Lc{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 qx(e.schema,e.plugins),i=new Lc(a);return a.fields.forEach(o=>{if(o.name=="doc")i.doc=Mi.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=gt.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 uS(t,e,n){for(let r in t){let a=t[r];a instanceof Function?a=a.bind(e):r=="handleDOMEvents"&&(a=uS(a,e,{})),n[r]=a}return n}class pn{constructor(e){this.spec=e,this.props={},e.props&&uS(e.props,this,this.props),this.key=e.key?e.key.key:hS("plugin")}getState(e){return e[this.key]}}const Gx=Object.create(null);function hS(t){return t in Gx?t+"$"+ ++Gx[t]:(Gx[t]=0,t+"$")}class Cn{constructor(e="key"){this.key=hS(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const ay=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function fS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const pS=(t,e,n)=>{let r=fS(t,n);if(!r)return!1;let a=iy(r);if(!a){let o=r.blockRange(),c=o&&sd(o);return c==null?!1:(e&&e(t.tr.lift(o,c).scrollIntoView()),!0)}let i=a.nodeBefore;if(jS(t,a,e,-1))return!0;if(r.parent.content.size==0&&(Uc(i,"end")||ot.isSelectable(i)))for(let o=r.depth;;o--){let c=Ip(t.doc,r.before(o),r.after(o),Be.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},bL=(t,e,n)=>{let r=fS(t,n);if(!r)return!1;let a=iy(r);return a?mS(t,a,e):!1},vL=(t,e,n)=>{let r=gS(t,n);if(!r)return!1;let a=oy(r);return a?mS(t,a,e):!1};function mS(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=Ip(t.doc,i,u,Be.empty);if(!h||h.from!=i||h instanceof bs&&h.slice.size>=u-i)return!1;if(n){let f=t.tr.step(h);f.setSelection(lt.create(f.doc,i)),n(f.scrollIntoView())}return!0}function Uc(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 xS=(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=iy(r)}let o=i&&i.nodeBefore;return!o||!ot.isSelectable(o)?!1:(e&&e(t.tr.setSelection(ot.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function iy(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 gS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=gS(t,n);if(!r)return!1;let a=oy(r);if(!a)return!1;let i=a.nodeAfter;if(jS(t,a,e,1))return!0;if(r.parent.content.size==0&&(Uc(i,"start")||ot.isSelectable(i))){let o=Ip(t.doc,r.before(),r.after(),Be.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 ot,a;if(r){if(n.node.isTextblock||!Vo(t.doc,n.from))return!1;a=n.from}else if(a=Ap(t.doc,n.from,-1),a==null)return!1;if(e){let i=t.tr.join(a);r&&i.setSelection(ot.create(i.doc,a-t.doc.resolve(a).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},wL=(t,e)=>{let n=t.selection,r;if(n instanceof ot){if(n.node.isTextblock||!Vo(t.doc,n.to))return!1;r=n.to}else if(r=Ap(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},jL=(t,e)=>{let{$from:n,$to:r}=t.selection,a=n.blockRange(r),i=a&&sd(a);return i==null?!1:(e&&e(t.tr.lift(a,i).scrollIntoView()),!0)},vS=(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 ly(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=ly(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(gt.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},NS=(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=ly(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(Ai(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),a=r&&sd(r);return a==null?!1:(e&&e(t.tr.lift(r,a).scrollIntoView()),!0)};function SL(t){return(e,n)=>{let{$from:r,$to:a}=e.selection;if(e.selection instanceof ot&&e.selection.node.isBlock)return!r.parentOffset||!Ai(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 b=r.depth;;b--)if(r.node(b).isBlock){u=r.end(b)==r.pos+(r.depth-b),h=r.start(b)==r.pos-(r.depth-b),c=ly(r.node(b-1).contentMatchAt(r.indexAfter(b-1))),i.unshift(u&&c?{type:c}:null),o=b;break}else{if(b==1)return!1;i.unshift(null)}let f=e.tr;(e.selection instanceof lt||e.selection instanceof Fr)&&f.deleteSelection();let m=f.mapping.map(r.pos),x=Ai(f.doc,m,i.length,i);if(x||(i[0]=c?{type:c}:null,x=Ai(f.doc,m,i.length,i)),!x)return!1;if(f.split(m,i.length,i),!u&&h&&r.node(o).type!=c){let b=f.mapping.map(r.before(o)),v=f.doc.resolve(b);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 CL=SL(),EL=(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(ot.create(t.doc,a))),!0)};function TL(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||Vo(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function jS(t,e,n,r){let a=e.nodeBefore,i=e.nodeAfter,o,c,u=a.type.spec.isolating||i.type.spec.isolating;if(!u&&TL(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 b=e.pos+i.nodeSize,v=Ee.empty;for(let k=o.length-1;k>=0;k--)v=Ee.from(o[k].create(null,v));v=Ee.from(a.copy(v));let w=t.tr.step(new vs(e.pos-1,b,e.pos,b,new Be(v,1,0),o.length,!0)),N=w.doc.resolve(b+2*o.length);N.nodeAfter&&N.nodeAfter.type==a.type&&Vo(w.doc,N.pos)&&w.join(N.pos),n(w.scrollIntoView())}return!0}let f=i.type.spec.isolating||r>0&&u?null:gt.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),x=m&&sd(m);if(x!=null&&x>=e.depth)return n&&n(t.tr.lift(m,x).scrollIntoView()),!0;if(h&&Uc(i,"start",!0)&&Uc(a,"end")){let b=a,v=[];for(;v.push(b),!b.isTextblock;)b=b.lastChild;let w=i,N=1;for(;!w.isTextblock;w=w.firstChild)N++;if(b.canReplace(b.childCount,b.childCount,w.content)){if(n){let k=Ee.empty;for(let C=v.length-1;C>=0;C--)k=Ee.from(v[C].copy(k));let T=t.tr.step(new vs(e.pos-v.length,e.pos+i.nodeSize,e.pos+N,e.pos+i.nodeSize-N,new Be(k,v.length,0),0,!0));n(T.scrollIntoView())}return!0}}return!1}function kS(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(lt.create(e.doc,t<0?a.start(i):a.end(i)))),!0):!1}}const ML=kS(-1),AL=kS(1);function IL(t,e=null){return function(n,r){let{$from:a,$to:i}=n.selection,o=a.blockRange(i),c=o&&ny(o,t,e);return c?(r&&r(n.tr.wrap(o,c).scrollIntoView()),!0):!1}}function NN(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 Tf(u,u,e.depth),e.endIndex=0;f--)i=Ee.from(n[f].type.create(n[f].attrs,i));t.step(new vs(e.start-(r?2:0),e.end,e.start,e.end,new Be(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?DL(e,n,t,i):_L(e,n,i):!0:!1}}function DL(t,e,n,r){let a=t.tr,i=r.end,o=r.$to.end(r.depth);iw;v--)b-=a.child(v).nodeSize,r.delete(b-1,b+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?Ee.empty:Ee.from(a))))return!1;let m=i.pos,x=m+o.nodeSize;return r.step(new vs(m-(c?1:0),x+(u?1:0),m+1,x-1,new Be((c?Ee.empty:Ee.from(a.copy(Ee.empty))).append(u?Ee.empty:Ee.from(a.copy(Ee.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function zL(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=Ee.from(h?t.create():null),m=new Be(Ee.from(t.create(null,Ee.from(c.type.create(null,f)))),h?3:1,0),x=i.start,b=i.end;n(e.tr.step(new vs(x-(h?3:1),b,x,b,m,1,!0)).scrollIntoView())}return!0}}const Ps=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Wc=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Kg=null;const ki=function(t,e,n){let r=Kg||(Kg=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},$L=function(){Kg=null},Ll=function(t,e,n,r){return n&&(wN(t,e,n,r,-1)||wN(t,e,n,r,1))},FL=/^(img|br|input|textarea|hr)$/i;function wN(t,e,n,r,a){for(var i;;){if(t==n&&e==r)return!0;if(e==(a<0?0:ta(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Eu(t)||FL.test(t.nodeName)||t.contentEditable=="false")return!1;e=Ps(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?ta(t):0}else return!1}}function ta(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function BL(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=ta(t)}else if(t.parentNode&&!Eu(t))e=Ps(t),t=t.parentNode;else return null}}function VL(t,e){for(;;){if(t.nodeType==3&&e2),ea=Kc||(Wa?/Mac/.test(Wa.platform):!1),ES=Wa?/Win/.test(Wa.platform):!1,Ti=/Android \d/.test(Ho),Tu=!!jN&&"webkitFontSmoothing"in jN.documentElement.style,KL=Tu?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function qL(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 bi(t,e){return typeof t=="number"?t:t[e]}function GL(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 kN(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=Wc(o);continue}let c=o,u=c==i.body,h=u?qL(i):GL(c),f=0,m=0;if(e.toph.bottom-bi(r,"bottom")&&(m=e.bottom-e.top>h.bottom-h.top?e.top+bi(a,"top")-h.top:e.bottom-h.bottom+bi(a,"bottom")),e.lefth.right-bi(r,"right")&&(f=e.right-h.right+bi(a,"right")),f||m)if(u)i.defaultView.scrollBy(f,m);else{let b=c.scrollLeft,v=c.scrollTop;m&&(c.scrollTop+=m),f&&(c.scrollLeft+=f);let w=c.scrollLeft-b,N=c.scrollTop-v;e={left:e.left-w,top:e.top-N,right:e.right-w,bottom:e.bottom-N}}let x=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(x))break;o=x=="absolute"?o.offsetParent:Wc(o)}}function JL(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:TS(t.dom)}}function TS(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Wc(r));return e}function QL({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;MS(n,r==0?0:r-e)}function MS(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?XL(n,a):!n||r&&n.nodeType==1?{node:t,offset:i}:AS(n,a)}function XL(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 dy(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function ZL(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 t6(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 IS(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&a++}let h;Tu&&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=t6(t,r,a,e))}c==null&&(c=e6(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function SN(t){return t.top=0&&a==r.nodeValue.length?(u--,f=1):n<0?u--:h++,_d(po(ki(r,u,h),f),f<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&a&&(n<0||a==ta(r))){let u=r.childNodes[a-1];if(u.nodeType==1)return Jx(u.getBoundingClientRect(),!1)}if(i==null&&a=0)}if(i==null&&a&&(n<0||a==ta(r))){let u=r.childNodes[a-1],h=u.nodeType==3?ki(u,ta(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(h)return _d(po(h,1),!1)}if(i==null&&a=0)}function _d(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 Jx(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 RS(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 r6(t,e,n){let r=e.selection,a=n=="up"?r.$from:r.$to;return RS(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=PS(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=ki(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 a6=/[\u0590-\u08ac]/;function i6(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?!a6.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?i:o:RS(t,e,()=>{let{focusNode:u,focusOffset:h,anchorNode:f,anchorOffset:m}=t.domSelectionRange(),x=c.caretBidiLevel;c.modify("move",n,"character");let b=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:v,focusOffset:w}=t.domSelectionRange(),N=v&&!b.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 x!=null&&(c.caretBidiLevel=x),N}):r.pos==r.start()||r.pos==r.end()}let CN=null,EN=null,TN=!1;function o6(t,e,n){return CN==e&&EN==n?TN:(CN=e,EN=n,TN=n=="up"||n=="down"?r6(t,e,n):i6(t,e,n))}const sa=0,MN=1,xl=2,Ka=3;class Mu{constructor(e,n,r,a){this.parent=e,this.children=n,this.dom=r,this.contentDOM=a,this.dirty=sa,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;nPs(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 OS){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 LS&&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?Ps(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 x=this.children[m-1];if(x.size&&x.dom.parentNode==this.contentDOM&&!x.emptyChildAt(1)){a=Ps(x.dom)+1;break}e-=x.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 b=document.createRange();b.setEnd(u.node,u.offset),b.setStart(c.node,c.offset),h.removeAllRanges(),h.addRange(b)}}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?xl:MN,e==c&&n==u&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Ka:i.markDirty(e-c,n-c);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?xl:Ka}r=o}this.dirty=xl}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?xl:MN;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==sa&&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 l6 extends Mu{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 Ol extends Mu{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=Vl.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Ol(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Ka||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ka&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=sa){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(i=Yg(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}=Vl.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 x=f;return f=zS(f,r,n),h?u=new c6(e,n,r,a,f,m||null,x,h,i,o+1):n.isText?new Lp(e,n,r,a,f,x,i):new Io(e,n,r,a,f,m||null,x,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=()=>Ee.empty)}return e}matchesNode(e,n,r){return this.dirty==sa&&e.eq(this.node)&&Af(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 u6(this,o&&o.node,e);p6(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?cn.none:this.node.child(f).marks,r,e,f),u.placeWidget(h,e,a)},(h,f,m,x)=>{u.syncToMarks(h.marks,r,e,x);let b;u.findNodeMatch(h,f,m,x)||c&&e.state.selection.from>a&&e.state.selection.to-1&&u.updateNodeAt(h,f,m,b,e)||u.updateNextNode(h,f,m,e,x,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==xl)&&(o&&this.protectLocalComposition(e,o),DS(this.contentDOM,this.children,e),Kc&&m6(this.dom))}localCompositionInfo(e,n){let{from:r,to:a}=e.state.selection;if(!(e.state.selection instanceof lt)||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=x6(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 l6(this,i,n,a);e.input.compositionNodes.push(o),this.children=Yg(this.children,r,r+a.length,e,o)}update(e,n,r,a){return this.dirty==Ka||!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=sa}updateOuterDeco(e){if(Af(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=_S(this.dom,this.nodeDOM,Qg(this.outerDeco,this.node,n),Qg(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 AN(t,e,n,r,a){zS(r,e,t);let i=new Io(void 0,t,e,n,r,r,r,a,0);return i.contentDOM&&i.updateChildren(a,0),i}class Lp extends Io{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==Ka||this.dirty!=sa&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=sa||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=sa,!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 Lp(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=Ka)}get domAtom(){return!1}isText(e){return this.node.text==e}}class OS extends Mu{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==sa&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class c6 extends Io{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==Ka)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 DS(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=Ol.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 Ol)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 f6(t,e){return t.type.side-e.type.side}function p6(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+x.nodeSize;if(x.isText){let N=v;o!N.inline):c.slice();r(x,w,e.forChild(i,x),b),i=v}}function m6(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 x6(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 Yg(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 uy(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(Rp(n)){for(u=o;a&&!a.node;)a=a.parent;let m=a.node;if(a&&m.isAtom&&ot.isSelectable(m)&&a.parent&&!(m.isInline&&HL(n.focusNode,n.focusOffset,a.dom))){let x=a.posBefore;h=new ot(o==x?c:r.resolve(x))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let m=o,x=o;for(let b=0;b{(n.anchorNode!=r||n.anchorOffset!=a)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!$S(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function y6(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Ps(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&jr&&Ao<=11&&(n.disabled=!0,n.disabled=!1)}function FS(t,e){if(e instanceof ot){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(ON(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else ON(t)}function ON(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function hy(t,e,n,r){return t.someProp("createSelectionBetween",a=>a(t,e,n))||lt.between(e,n,r)}function DN(t){return t.editable&&!t.hasFocus()?!1:BS(t)}function BS(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 b6(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Ll(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Xg(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&>.findFrom(i,e)}function mo(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function _N(t,e,n){let r=t.state.selection;if(r instanceof lt)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 mo(t,new lt(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let a=Xg(t.state,e);return a&&a instanceof ot?mo(t,a):!1}else if(!(ea&&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?ot.isSelectable(i)?mo(t,new ot(e<0?t.state.doc.resolve(a.pos-i.nodeSize):a)):Tu?mo(t,new lt(t.state.doc.resolve(e<0?c:c+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof ot&&r.node.isInline)return mo(t,new lt(e>0?r.$to:r.$from));{let a=Xg(t.state,e);return a?mo(t,a):!1}}}function If(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Zd(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function kc(t,e){return e<0?v6(t):N6(t)}function v6(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a,i,o=!1;for(na&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(Zd(c,-1))a=n,i=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(VS(n))break;{let c=n.previousSibling;for(;c&&Zd(c,-1);)a=n.parentNode,i=Ps(c),c=c.previousSibling;if(c)n=c,r=If(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Zg(t,n,r):a&&Zg(t,a,i)}function N6(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a=If(n),i,o;for(;;)if(r{t.state==a&&Ii(t)},50)}function zN(t,e){let n=t.state.doc.resolve(e);if(!(_s||ES)&&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 $N(t,e,n){let r=t.state.selection;if(r instanceof lt&&!r.empty||n.indexOf("s")>-1||ea&&n.indexOf("m")>-1)return!1;let{$from:a,$to:i}=r;if(!a.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Xg(t.state,e);if(o&&o instanceof ot)return mo(t,o)}if(!a.parent.inlineContent){let o=e<0?a:i,c=r instanceof Fr?gt.near(o,e):gt.findFrom(o,e);return c?mo(t,c):!1}return!1}function FN(t,e){if(!(t.state.selection instanceof lt))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 BN(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function k6(t){if(!Ks||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;BN(t,r,"true"),setTimeout(()=>BN(t,r,"false"),20)}return!1}function S6(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function C6(t,e){let n=e.keyCode,r=S6(e);if(n==8||ea&&n==72&&r=="c")return FN(t,-1)||kc(t,-1);if(n==46&&!e.shiftKey||ea&&n==68&&r=="c")return FN(t,1)||kc(t,1);if(n==13||n==27)return!0;if(n==37||ea&&n==66&&r=="c"){let a=n==37?zN(t,t.state.selection.from)=="ltr"?-1:1:-1;return _N(t,a,r)||kc(t,a)}else if(n==39||ea&&n==70&&r=="c"){let a=n==39?zN(t,t.state.selection.from)=="ltr"?1:-1:1;return _N(t,a,r)||kc(t,a)}else{if(n==38||ea&&n==80&&r=="c")return $N(t,-1,r)||kc(t,-1);if(n==40||ea&&n==78&&r=="c")return k6(t)||$N(t,1,r)||kc(t,1);if(r==(ea?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function fy(t,e){t.someProp("transformCopied",b=>{e=b(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 b=r.firstChild;n.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),r=b.content}let o=t.someProp("clipboardSerializer")||Vl.fromSchema(t.state.schema),c=GS(),u=c.createElement("div");u.appendChild(o.serializeFragment(r,{document:c}));let h=u.firstChild,f,m=0;for(;h&&h.nodeType==1&&(f=qS[h.nodeName.toLowerCase()]);){for(let b=f.length-1;b>=0;b--){let v=c.createElement(f[b]);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 x=t.someProp("clipboardTextSerializer",b=>b(e,t))||e.content.textBetween(0,e.content.size,` - -`);return{dom:u,text:x,slice:e}}function HS(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",x=>{e=x(e,i||r,t)}),i)return c=new Be(Ee.from(t.state.schema.text(e.replace(/\r\n?/g,` -`))),0,0),t.someProp("transformPasted",x=>{c=x(c,t,!0)}),c;let m=t.someProp("clipboardTextParser",x=>x(e,a,r,t));if(m)c=m;else{let x=a.marks(),{schema:b}=t.state,v=Vl.fromSchema(b);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(w=>{let N=o.appendChild(document.createElement("p"));w&&N.appendChild(v.serializeNode(b.text(w,x)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),o=A6(n),Tu&&I6(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 x=o.firstChild;for(;x&&x.nodeType!=1;)x=x.nextSibling;if(!x)break;o=x}if(c||(c=(t.someProp("clipboardParser")||t.someProp("domParser")||Mo.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||f),context:a,ruleFromNode(x){return x.nodeName=="BR"&&!x.nextSibling&&x.parentNode&&!E6.test(x.parentNode.nodeName)?{ignore:!0}:null}})),f)c=P6(VN(c,+f[1],+f[2]),f[4]);else if(c=Be.maxOpen(T6(c.content,a),!0),c.openStart||c.openEnd){let m=0,x=0;for(let b=c.content.firstChild;m{c=m(c,t,u)}),c}const E6=/^(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 T6(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&&WS(u,i,c,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=KS(o[o.length-1],i.length));let f=US(c,u);o.push(f),a=a.matchType(f.type),i=u}}),o)return Ee.from(o)}return t}function US(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,Ee.from(t));return t}function WS(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(Ee.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(c))}function VN(t,e,n){return en})),Yx.createHTML(t)):t}function A6(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=GS().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),a;if((a=r&&qS[r[1].toLowerCase()])&&(t=a.map(i=>"<"+i+">").join("")+t+a.map(i=>"").reverse().join("")),n.innerHTML=M6(t),a)for(let i=0;i=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;a=Ee.from(u.create(r[c+1],a)),i++,o++}return new Be(a,i,o)}const ar={},ir={},R6={touchstart:!0,touchmove:!0};class L6{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 O6(t){for(let e in ar){let n=ar[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{_6(t,r)&&!py(t,r)&&(t.editable||!(r.type in ir))&&n(t,r)},R6[e]?{passive:!0}:void 0)}Ks&&t.dom.addEventListener("input",()=>null),t0(t)}function Co(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function D6(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 t0(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>py(t,r))})}function py(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function _6(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 z6(t,e){!py(t,e)&&ar[e.type]&&(t.editable||!(e.type in ir))&&ar[e.type](t,e)}ir.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!QS(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Ti&&_s&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Kc&&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,hl(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||C6(t,n)?n.preventDefault():Co(t,"key")};ir.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};ir.keypress=(t,e)=>{let n=e;if(QS(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||ea&&n.metaKey)return;if(t.someProp("handleKeyPress",a=>a(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof lt)||!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 Op(t){return{left:t.clientX,top:t.clientY}}function $6(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function my(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 zc(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 F6(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&ot.isSelectable(r)?(zc(t,new ot(n)),!0):!1}function B6(t,e){if(e==-1)return!1;let n=t.state.selection,r,a;n instanceof ot&&(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(ot.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?(zc(t,ot.create(t.state.doc,a)),!0):!1}function V6(t,e,n,r,a){return my(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(a?B6(t,n):F6(t,n))}function H6(t,e,n,r){return my(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",a=>a(t,e,r))}function U6(t,e,n,r){return my(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",a=>a(t,e,r))||W6(t,n,r)}function W6(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(zc(t,lt.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)zc(t,lt.create(r,c+1,c+1+o.content.size));else if(ot.isSelectable(o))zc(t,ot.create(r,c));else continue;return!0}}function xy(t){return Pf(t)}const JS=ea?"metaKey":"ctrlKey";ar.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=xy(t),a=Date.now(),i="singleClick";a-t.input.lastClick.time<500&&$6(n,t.input.lastClick)&&!n[JS]&&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(Op(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new K6(t,o,n,!!r)):(i=="doubleClick"?H6:U6)(t,o.pos,o.inside,n)?n.preventDefault():Co(t,"pointer"))};class K6{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[JS],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 ot&&h.from<=o&&h.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&na&&!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)),Co(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(()=>Ii(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(Op(e))),this.updateAllowDefault(e),this.allowDefault||!n?Co(this.view,"pointer"):V6(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ks&&this.mightDrag&&!this.mightDrag.node.isAtom||_s&&!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)?(zc(this.view,gt.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Co(this.view,"pointer")}move(e){this.updateAllowDefault(e),Co(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)}}ar.touchstart=t=>{t.input.lastTouch=Date.now(),xy(t),Co(t,"pointer")};ar.touchmove=t=>{t.input.lastTouch=Date.now(),Co(t,"pointer")};ar.contextmenu=t=>xy(t);function QS(t,e){return t.composing?!0:Ks&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const q6=Ti?5e3:-1;ir.compositionstart=ir.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof lt&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||_s&&ES&&G6(t)))t.markCursor=t.state.storedMarks||n.marks(),Pf(t,!0),t.markCursor=null;else if(Pf(t,!e.selection.empty),na&&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}YS(t,q6)};function G6(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"}ir.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++,YS(t,20))};function YS(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Pf(t),e))}function XS(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Q6());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function J6(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=BL(e.focusNode,e.focusOffset),r=VL(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 Q6(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Pf(t,e=!1){if(!(Ti&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),XS(t),e||t.docView&&t.docView.dirty){let n=uy(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 Y6(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 pu=jr&&Ao<15||Kc&&KL<604;ar.copy=ir.cut=(t,e)=>{let n=e,r=t.state.selection,a=n.type=="cut";if(r.empty)return;let i=pu?null:n.clipboardData,o=r.content(),{dom:c,text:u}=fy(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",c.innerHTML),i.setData("text/plain",u)):Y6(t,c),a&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function X6(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Z6(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?mu(t,r.value,null,a,e):mu(t,r.textContent,r.innerHTML,a,e)},50)}function mu(t,e,n,r,a){let i=HS(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,a,i||Be.empty)))return!0;if(!i)return!1;let o=X6(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 ZS(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," "):""}ir.paste=(t,e)=>{let n=e;if(t.composing&&!Ti)return;let r=pu?null:n.clipboardData,a=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&mu(t,ZS(r),r.getData("text/html"),a,n)?n.preventDefault():Z6(t,n)};class eC{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const eO=ea?"altKey":"ctrlKey";function tC(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[eO]}ar.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(Op(n)),o;if(!(i&&i.pos>=a.from&&i.pos<=(a instanceof ot?a.to-1:a.to))){if(r&&r.mightDrag)o=ot.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=ot.create(t.state.doc,m.posBefore))}}let c=(o||t.state.selection).content(),{dom:u,text:h,slice:f}=fy(t,c);(!n.dataTransfer.files.length||!_s||CS>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(pu?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",pu||n.dataTransfer.setData("text/plain",h),t.dragging=new eC(f,tC(t,n),o)};ar.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};ir.dragover=ir.dragenter=(t,e)=>e.preventDefault();ir.drop=(t,e)=>{try{tO(t,e,t.dragging)}finally{t.dragging=null}};function tO(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Op(e));if(!r)return;let a=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",b=>{i=b(i,t,!1)}):i=HS(t,ZS(e.dataTransfer),pu?null:e.dataTransfer.getData("text/html"),!1,a);let o=!!(n&&tC(t,e));if(t.someProp("handleDrop",b=>b(t,e,i||Be.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let c=i?aS(t.state.doc,a.pos,i):a.pos;c==null&&(c=a.pos);let u=t.state.tr;if(o){let{node:b}=n;b?b.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 x=u.doc.resolve(h);if(f&&ot.isSelectable(i.content.firstChild)&&x.nodeAfter&&x.nodeAfter.sameMarkup(i.content.firstChild))u.setSelection(new ot(x));else{let b=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((v,w,N,k)=>b=k),u.setSelection(hy(t,x,u.doc.resolve(b)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}ar.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())&&Ii(t)},20))};ar.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)};ar.beforeinput=(t,e)=>{if(_s&&Ti&&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,hl(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 ir)ar[t]=ir[t];function xu(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 Rf{constructor(e,n){this.toDOM=e,this.spec=n||wl,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 as(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Rf&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&xu(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Po{constructor(e,n){this.attrs=e,this.spec=n||wl}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 as(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==Us||e.maps.length==0?this:this.mapInner(e,n,0,0,r||wl)}mapInner(e,n,r,a,i){let o;for(let c=0;c{let h=u+r,f;if(f=sC(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 Po){let h=Math.max(i,u.from)-i,f=Math.min(o,u.to)-i;ha.map(e,n,wl));return yo.from(r)}forChild(e,n){if(n.isLeaf)return ln.empty;let r=[];for(let a=0;an instanceof ln)?e:e.reduce((n,r)=>n.concat(r instanceof ln?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let N=w-v-(b-x);for(let k=0;kT+f-m)continue;let C=c[k]+f-m;b>=C?c[k+1]=x<=C?-2:-1:x>=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 x=n.map(t[h+1]+i,-1),b=x-a,{index:v,offset:w}=r.content.findIndex(m),N=r.maybeChild(v);if(N&&w==m&&w+N.nodeSize==b){let k=c[h+2].mapInner(n,N,f+1,t[h]+i+1,o);k!=Us?(c[h]=m,c[h+1]=b,c[h+2]=k):(c[h+1]=-2,u=!0)}else u=!0}if(u){let h=sO(c,t,e,n,a,i,o),f=Lf(h,r,0,o);e=f.local;for(let m=0;mn&&o.to{let h=sC(t,c,u+n);if(h){i=!0;let f=Lf(h,c,n+u+1,r);f!=Us&&a.push(u,u+c.nodeSize,f)}});let o=nC(i?rC(t):t,-n).sort(jl);for(let c=0;c0;)e++;t.splice(e,0,n)}function Xx(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Us&&e.push(r)}),t.cursorWrapper&&e.push(ln.create(t.state.doc,[t.cursorWrapper.deco])),yo.from(e)}const rO={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},aO=jr&&Ao<=11;class iO{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 oO{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new iO,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():Ks&&e.composing&&r.some(a=>a.type=="childList"&&a.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),aO&&(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,rO)),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(DN(this.view)){if(this.suppressingSelectionUpdates)return Ii(this.view);if(jr&&Ao<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Ll(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=Wc(i))n.add(i);for(let i=e.anchorNode;i;i=Wc(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)&&DN(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(na&&u.length){let f=u.filter(m=>m.nodeName=="BR");if(f.length==2){let[m,x]=f;m.parentNode&&m.parentNode.parentNode==x.parentNode?x.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let x of f){let b=x.parentNode;b&&b.nodeName=="LI"&&(!m||dO(e,m)!=b)&&x.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),lO(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,uO(e,u)),this.handleDOMChange(i,o,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Ii(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],T=k.pmViewDesc;if(k.nodeName=="BR"&&!T){i=N;break}if(!T||T.size)break}let m=t.state.doc,x=t.someProp("domParser")||Mo.fromSchema(t.state.schema),b=m.resolve(o),v=null,w=x.parse(r,{topNode:b.parent,topMatch:b.parent.contentMatchAt(b.index()),topOpen:!0,from:a,to:i,preserveWhitespace:b.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:fO,context:b});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 fO(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Ks&&/^(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||Ks&&/^(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 pO=/^(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 mO(t,e,n,r,a){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let z=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,H=uy(t,z);if(H&&!t.state.selection.eq(H)){if(_s&&Ti&&t.input.lastKeyCode===13&&Date.now()-100se(t,hl(13,"Enter"))))return;let R=t.state.tr.setSelection(H);z=="pointer"?R.setMeta("pointer",!0):z=="key"&&R.scrollIntoView(),i&&R.setMeta("composition",i),t.dispatch(R)}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=hO(t,e,n),f=t.state.doc,m=f.slice(h.from,h.to),x,b;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||Ti)&&a.some(z=>z.nodeType==1&&!pO.test(z.nodeName))&&(!v||v.endA>=v.endB)&&t.someProp("handleKeyDown",z=>z(t,hl(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!v)if(r&&u instanceof lt&&!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 z=GN(t,t.state.doc,h.sel);if(z&&!z.eq(t.state.selection)){let H=t.state.tr.setSelection(z);i&&H.setMeta("composition",i),t.dispatch(H)}}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)),jr&&Ao<=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),T=w.sameParent(N)&&w.parent.inlineContent&&k.end()>=v.endA;if((Kc&&t.input.lastIOSEnter>Date.now()-225&&(!T||a.some(z=>z.nodeName=="DIV"||z.nodeName=="P"))||!T&&w.posz(t,hl(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>v.start&&gO(f,v.start,v.endA,w,N)&&t.someProp("handleKeyDown",z=>z(t,hl(8,"Backspace")))){Ti&&_s&&t.domObserver.suppressSelectionUpdates();return}_s&&v.endB==v.start&&(t.input.lastChromeDelete=Date.now()),Ti&&!T&&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(z){return z(t,hl(13,"Enter"))})},20));let C=v.start,P=v.endA,L=z=>{let H=z||t.state.tr.replace(C,P,h.doc.slice(v.start-h.from,v.endB-h.from));if(h.sel){let R=GN(t,H.doc,h.sel);R&&!(_s&&t.composing&&R.empty&&(v.start!=v.endB||t.input.lastChromeDeleteIi(t),20));let z=L(t.state.tr.delete(C,P)),H=f.resolve(v.start).marksAcross(f.resolve(v.endA));H&&z.ensureMarks(H),t.dispatch(z)}else if(v.endA==v.endB&&(q=xO(w.parent.content.cut(w.parentOffset,N.parentOffset),k.parent.content.cut(k.parentOffset,v.endA-k.start())))){let z=L(t.state.tr);q.type=="add"?z.addMark(C,P,q.mark):z.removeMark(C,P,q.mark),t.dispatch(z)}else if(w.parent.child(w.index()).isText&&w.index()==N.index()-(N.textOffset?0:1)){let z=w.parent.textBetween(w.parentOffset,N.parentOffset),H=()=>L(t.state.tr.insertText(z,C,P));t.someProp("handleTextInput",R=>R(t,C,P,z,H))||t.dispatch(H())}else t.dispatch(L());else t.dispatch(L())}function GN(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:hy(t,e.resolve(n.anchor),e.resolve(n.head))}function xO(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||Zx(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 yO(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 aC{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 L6,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(ew),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=XN(this),YN(this),this.nodeViews=ZN(this),this.docView=AN(this.state.doc,QN(this),Xx(this),this.dom,this),this.domObserver=new oO(this,(r,a,i,o)=>mO(this,r,a,i,o)),this.domObserver.start(),O6(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&&t0(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ew),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&&(XS(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 b=ZN(this);vO(b,this.nodeViews)&&(this.nodeViews=b,i=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&t0(this),this.editable=XN(this),YN(this);let u=Xx(this),h=QN(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 x=f=="preserve"&&o&&this.dom.style.overflowAnchor==null&&JL(this);if(o){this.domObserver.stop();let b=m&&(jr||_s)&&!this.composing&&!a.selection.empty&&!e.selection.empty&&bO(a.selection,e.selection);if(m){let v=_s?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=J6(this)),(i||!this.docView.update(e.doc,h,u,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=AN(e.doc,h,u,this.dom,this)),v&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(b=!0)}b||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&b6(this))?Ii(this,b):(FS(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():x&&QL(x)}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 ot){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&kN(this,n.getBoundingClientRect(),e)}else kN(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 eC(e.slice,e.move,a<0?void 0:ot.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 n6(this,e)}coordsAtPos(e,n=1){return PS(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 o6(this,n||this.state,e)}pasteHTML(e,n){return mu(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return mu(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return fy(this,e)}destroy(){this.docView&&(D6(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Xx(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,$L())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return z6(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ks&&this.root.nodeType===11&&UL(this.dom.ownerDocument)==this.dom&&cO(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}aC.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function QN(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"),[as.node(0,t.state.doc.content.size,e)]}function YN(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:as.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function XN(t){return!t.someProp("editable",e=>e(t.state)===!1)}function bO(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 ZN(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 vO(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 ew(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 Oo={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:"'"},Of={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},NO=typeof navigator<"u"&&/Mac/.test(navigator.platform),wO=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Rs=0;Rs<10;Rs++)Oo[48+Rs]=Oo[96+Rs]=String(Rs);for(var Rs=1;Rs<=24;Rs++)Oo[Rs+111]="F"+Rs;for(var Rs=65;Rs<=90;Rs++)Oo[Rs]=String.fromCharCode(Rs+32),Of[Rs]=String.fromCharCode(Rs);for(var eg in Oo)Of.hasOwnProperty(eg)||(Of[eg]=Oo[eg]);function jO(t){var e=NO&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||wO&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Of:Oo)[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 kO=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),SO=typeof navigator<"u"&&/Win/.test(navigator.platform);function CO(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)MO(t,n,{get:e[n],enumerable:!0})};function Dp(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 _p=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,x])=>[m,(...v)=>{const w=this.buildProps(u,e),N=x(...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:Dp({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}},iC={};vy(iC,{blur:()=>AO,clearContent:()=>IO,clearNodes:()=>PO,command:()=>RO,createParagraphNear:()=>LO,cut:()=>OO,deleteCurrentNode:()=>DO,deleteNode:()=>_O,deleteRange:()=>zO,deleteSelection:()=>$O,enter:()=>FO,exitCode:()=>BO,extendMarkRange:()=>VO,first:()=>HO,focus:()=>WO,forEach:()=>KO,insertContent:()=>qO,insertContentAt:()=>QO,joinBackward:()=>ZO,joinDown:()=>XO,joinForward:()=>eD,joinItemBackward:()=>tD,joinItemForward:()=>nD,joinTextblockBackward:()=>sD,joinTextblockForward:()=>rD,joinUp:()=>YO,keyboardShortcut:()=>iD,lift:()=>oD,liftEmptyBlock:()=>lD,liftListItem:()=>cD,newlineInCode:()=>dD,resetAttributes:()=>uD,scrollIntoView:()=>hD,selectAll:()=>fD,selectNodeBackward:()=>pD,selectNodeForward:()=>mD,selectParentNode:()=>xD,selectTextblockEnd:()=>gD,selectTextblockStart:()=>yD,setContent:()=>bD,setMark:()=>$D,setMeta:()=>FD,setNode:()=>BD,setNodeSelection:()=>VD,setTextDirection:()=>HD,setTextSelection:()=>UD,sinkListItem:()=>WD,splitBlock:()=>KD,splitListItem:()=>qD,toggleList:()=>GD,toggleMark:()=>JD,toggleNode:()=>QD,toggleWrap:()=>YD,undoInputRule:()=>XD,unsetAllMarks:()=>ZD,unsetMark:()=>e_,unsetTextDirection:()=>t_,updateAttributes:()=>n_,wrapIn:()=>s_,wrapInList:()=>r_});var AO=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),IO=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),PO=()=>({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)),x=h.resolve(f.map(u+c.nodeSize)),b=m.blockRange(x);if(!b)return;const v=sd(b);if(c.type.isTextblock){const{defaultType:w}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(b.start,w)}(v||v===0)&&e.lift(b,v)})}),!0},RO=t=>e=>t(e),LO=()=>({state:t,dispatch:e})=>NS(t,e),OO=(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 lt(r.doc.resolve(Math.max(o-1,0)))),!0},DO=()=>({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 Zn(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 _O=t=>({tr:e,state:n,dispatch:r})=>{const a=Zn(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},zO=t=>({tr:e,dispatch:n})=>{const{from:r,to:a}=t;return n&&e.delete(r,a),!0},$O=()=>({state:t,dispatch:e})=>ay(t,e),FO=()=>({commands:t})=>t.keyboardShortcut("Enter"),BO=()=>({state:t,dispatch:e})=>kL(t,e);function Ny(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Df(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(a=>n.strict?e[a]===t[a]:Ny(e[a])?e[a].test(t[a]):e[a]===t[a]):!0}function oC(t,e,n={}){return t.find(r=>r.type===e&&Df(Object.fromEntries(Object.keys(n).map(a=>[a,r.attrs[a]])),n))}function tw(t,e,n={}){return!!oC(t,e,n)}function wy(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),!oC([...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&&tw([...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=_i(t,r.schema),{doc:o,selection:c}=n,{$from:u,from:h,to:f}=c;if(a){const m=wy(u,i,e);if(m&&m.from<=h&&m.to>=f){const x=lt.create(o,m.from,m.to);n.setSelection(x)}}return!0},HO=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=()=>{(_f()||nw())&&r.dom.focus(),UO()&&!_f()&&!nw()&&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&&!lC(n.state.selection))return o(),!0;const c=cC(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},KO=(t,e)=>n=>t.every((r,a)=>e(r,{...n,index:a})),qO=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),dC=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&&dC(r)}return t};function Uh(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 dC(n)}function gu(t,e,n){if(t instanceof Mi||t instanceof Ee)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 Ee.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),gu("",e,n)}if(a){if(n.errorOnInvalidContent){let o=!1,c="";const u=new G2({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?Mo.fromSchema(u).parseSlice(Uh(t),n.parseOptions):Mo.fromSchema(u).parse(Uh(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const i=Mo.fromSchema(e);return n.slice?i.parseSlice(Uh(t),n.parseOptions).content:i.parse(Uh(t),n.parseOptions)}return gu("",e,n)}function GO(t,e,n){const r=t.steps.length-1;if(r{o===0&&(o=f)}),t.setSelection(gt.near(t.doc.resolve(o),n))}var JO=t=>!("type"in t),QO=(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{gu(e,i.schema,{parseOptions:h,errorOnInvalidContent:!0})}catch(N){u(N)}try{c=gu(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},x=!0,b=!0;if((JO(c)?c:[c]).forEach(N=>{N.check(),x=x?N.isText&&N.marks.length===0:!1,b=b?N.isBlock:!1}),f===m&&b){const{parent:N}=r.doc.resolve(f);N.isTextblock&&!N.type.spec.code&&!N.childCount&&(f-=1,m+=1)}let w;if(x){if(Array.isArray(e))w=e.map(N=>N.text||"").join("");else if(e instanceof Ee){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(),T=N.parentOffset===0,C=k.isText||k.isTextblock,P=k.content.size>0;T&&C&&P&&(f=Math.max(0,f-1)),r.replaceWith(f,m,w)}n.updateSelection&&GO(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},YO=()=>({state:t,dispatch:e})=>NL(t,e),XO=()=>({state:t,dispatch:e})=>wL(t,e),ZO=()=>({state:t,dispatch:e})=>pS(t,e),eD=()=>({state:t,dispatch:e})=>yS(t,e),tD=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Ap(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},nD=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Ap(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},sD=()=>({state:t,dispatch:e})=>bL(t,e),rD=()=>({state:t,dispatch:e})=>vL(t,e);function uC(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function aD(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=aD(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 Do(t,e,n={}){const{from:r,to:a,empty:i}=t.selection,o=e?Zn(e,t.schema):null,c=[];t.doc.nodesBetween(r,a,(m,x)=>{if(m.isText)return;const b=Math.max(r,x),v=Math.min(a,x+m.nodeSize);c.push({node:m,from:b,to:v})});const u=a-r,h=c.filter(m=>o?o.name===m.node.type.name:!0).filter(m=>Df(m.node.attrs,n,{strict:!1}));return i?!!h.length:h.reduce((m,x)=>m+x.to-x.from,0)>=u}var oD=(t,e={})=>({state:n,dispatch:r})=>{const a=Zn(t,n.schema);return Do(n,a,e)?jL(n,r):!1},lD=()=>({state:t,dispatch:e})=>wS(t,e),cD=t=>({state:e,dispatch:n})=>{const r=Zn(t,e.schema);return OL(r)(e,n)},dD=()=>({state:t,dispatch:e})=>vS(t,e);function zp(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function sw(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 uD=(t,e)=>({tr:n,state:r,dispatch:a})=>{let i=null,o=null;const c=zp(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(i=Zn(t,r.schema)),c==="mark"&&(o=_i(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,sw(f.attrs,e))),o&&f.marks.length&&f.marks.forEach(x=>{o===x.type&&(u=!0,a&&n.addMark(m,m+f.nodeSize,o.create(sw(x.attrs,e))))})})}),u},hD=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),fD=()=>({tr:t,dispatch:e})=>{if(e){const n=new Fr(t.doc);t.setSelection(n)}return!0},pD=()=>({state:t,dispatch:e})=>xS(t,e),mD=()=>({state:t,dispatch:e})=>bS(t,e),xD=()=>({state:t,dispatch:e})=>EL(t,e),gD=()=>({state:t,dispatch:e})=>AL(t,e),yD=()=>({state:t,dispatch:e})=>ML(t,e);function n0(t,e,n={},r={}){return gu(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var bD=(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=n0(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 hC(t,e){const n=_i(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 fC(t,e){const n=new sy(t);return e.forEach(r=>{r.steps.forEach(a=>{n.step(a)})}),n}function vD(t){for(let e=0;e{n(a)&&r.push({node:a,pos:i})}),r}function pC(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 $p(t){return e=>pC(e.$from,t)}function at(t,e,n){return t.config[e]===void 0&&t.parent?at(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?at(t.parent,e,n):null}):t.config[e]}function jy(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=at(e,"addExtensions",n);return r?[e,...jy(r())]:e}).flat(10)}function ky(t,e){const n=Vl.fromSchema(e).serializeFragment(t),a=document.implementation.createHTMLDocument().createElement("div");return a.appendChild(n),a.innerHTML}function mC(t){return typeof t=="function"}function Yt(t,e=void 0,...n){return mC(t)?e?t.bind(e)(...n):t(...n):t}function wD(t={}){return Object.keys(t).length===0&&t.constructor===Object}function qc(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 xC(t){const e=[],{nodeExtensions:n,markExtensions:r}=qc(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=at(h,"addGlobalAttributes",f);if(!m)return;m().forEach(b=>{let v;Array.isArray(b.types)?v=b.types:b.types==="*"?v=u:b.types==="nodes"?v=o:b.types==="marks"?v=c:v=[],v.forEach(w=>{Object.entries(b.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=at(h,"addAttributes",f);if(!m)return;const x=m();Object.entries(x).forEach(([b,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:b,attribute:w})})}),e}function jD(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 rw(t){const e=[],n=jD(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([...rw(r[a]),...rw(i)]);r[a]=Array.from(c.entries()).map(([u,h])=>`${u}: ${h}`).join("; ")}else r[a]=i}),r},{})}function yu(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)=>Xt(n,r),{})}function kD(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function aw(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):kD(n.getAttribute(o.name));return c==null?i:{...i,[o.name]:c}},{});return{...r,...a}}}}function iw(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&wD(n)?!1:n!=null))}function ow(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 SD(t,e){var n;const r=xC(t),{nodeExtensions:a,markExtensions:i}=qc(t),o=(n=a.find(h=>at(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},x=t.reduce((k,T)=>{const C=at(T,"extendNodeSchema",m);return{...k,...C?C(h):{}}},{}),b=iw({...x,content:Yt(at(h,"content",m)),marks:Yt(at(h,"marks",m)),group:Yt(at(h,"group",m)),inline:Yt(at(h,"inline",m)),atom:Yt(at(h,"atom",m)),selectable:Yt(at(h,"selectable",m)),draggable:Yt(at(h,"draggable",m)),code:Yt(at(h,"code",m)),whitespace:Yt(at(h,"whitespace",m)),linebreakReplacement:Yt(at(h,"linebreakReplacement",m)),defining:Yt(at(h,"defining",m)),isolating:Yt(at(h,"isolating",m)),attrs:Object.fromEntries(f.map(ow))}),v=Yt(at(h,"parseHTML",m));v&&(b.parseDOM=v.map(k=>aw(k,f)));const w=at(h,"renderHTML",m);w&&(b.toDOM=k=>w({node:k,HTMLAttributes:yu(k,f)}));const N=at(h,"renderText",m);return N&&(b.toText=N),[h.name,b]})),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},x=t.reduce((N,k)=>{const T=at(k,"extendMarkSchema",m);return{...N,...T?T(h):{}}},{}),b=iw({...x,inclusive:Yt(at(h,"inclusive",m)),excludes:Yt(at(h,"excludes",m)),group:Yt(at(h,"group",m)),spanning:Yt(at(h,"spanning",m)),code:Yt(at(h,"code",m)),attrs:Object.fromEntries(f.map(ow))}),v=Yt(at(h,"parseHTML",m));v&&(b.parseDOM=v.map(N=>aw(N,f)));const w=at(h,"renderHTML",m);return w&&(b.toDOM=N=>w({mark:N,HTMLAttributes:yu(N,f)})),[h.name,b]}));return new G2({topNode:o,nodes:c,marks:u})}function CD(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function eu(t){return t.sort((n,r)=>{const a=at(n,"priority")||100,i=at(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 yC(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 x;u.isBlock&&h>r&&(c+=i);const b=o==null?void 0:o[u.type.name];if(b)return f&&(c+=b({node:u,pos:h,parent:f,index:m,range:e})),!1;u.isText&&(c+=(x=u==null?void 0:u.text)==null?void 0:x.slice(Math.max(r,h)-h,a-h))}),c}function ED(t,e){const n={from:0,to:t.content.size};return yC(t,n,e)}function bC(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function TD(t,e){const n=Zn(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 vC(t,e){const n=zp(typeof e=="string"?e:e.name,t.schema);return n==="node"?TD(t,e):n==="mark"?hC(t,e):{}}function MD(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 AD(t){const e=MD(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 NC(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),x=e.invert().map(f);r.push({oldRange:{from:m,to:x},newRange:{from:h,to:f}})})}),AD(r)}function Sy(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(a=>{const i=n.resolve(t),o=wy(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 ID=(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 zd(t,e){return e.nodes[t]||e.marks[t]||null}function cf(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 PD=(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 s0(t,e,n={}){const{empty:r,ranges:a}=t.selection,i=e?_i(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>i?i.name===m.type.name:!0).find(m=>Df(m.attrs,n,{strict:!1}));let o=0;const c=[];if(a.forEach(({$from:m,$to:x})=>{const b=m.pos,v=x.pos;t.doc.nodesBetween(b,v,(w,N)=>{if(i&&w.inlineContent&&!w.type.allowsMarkType(i))return!1;if(!w.isText&&!w.marks.length)return;const k=Math.max(b,N),T=Math.min(v,N+w.nodeSize),C=T-k;o+=C,c.push(...w.marks.map(P=>({mark:P,from:k,to:T})))})}),o===0)return!1;const u=c.filter(m=>i?i.name===m.mark.type.name:!0).filter(m=>Df(m.mark.attrs,n,{strict:!1})).reduce((m,x)=>m+x.to-x.from,0),h=c.filter(m=>i?m.mark.type!==i&&m.mark.type.excludes(i):!0).reduce((m,x)=>m+x.to-x.from,0);return(u>0?u+h:u)>=o}function RD(t,e,n={}){if(!e)return Do(t,null,n)||s0(t,null,n);const r=zp(e,t.schema);return r==="node"?Do(t,e,n):r==="mark"?s0(t,e,n):!1}var LD=(t,e)=>{const{$from:n,$to:r,$anchor:a}=t.selection;if(e){const i=$p(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 lw(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function cw(t,e){const{nodeExtensions:n}=qc(e),r=n.find(o=>o.name===t);if(!r)return!1;const a={name:r.name,options:r.options,storage:r.storage},i=Yt(at(r,"group",a));return typeof i!="string"?!1:i.split(" ").includes("list")}function Fp(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&&(Fp(i,{ignoreWhitespace:n,checkChildren:e})||(a=!1))}),a}return!1}function wC(t){return t instanceof ot}var jC=class kC{constructor(e){this.position=e}static fromJSON(e){return new kC(e.position)}toJSON(){return{position:this.position}}};function DD(t,e){const n=e.mapping.mapResult(t.position);return{position:new jC(n.pos),mapResult:n}}function _D(t){return new jC(t)}function zD(t,e,n){var r;const{selection:a}=e;let i=null;if(lC(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,x)=>{if(h)return!1;if(f.isInline){const b=!x||x.type.allowsMarkType(n),v=!!n.isInSet(f.marks)||!f.marks.some(w=>w.type.excludes(n));h=b&&v}return!h}),h})}var $D=(t,e={})=>({tr:n,state:r,dispatch:a})=>{const{selection:i}=n,{empty:o,ranges:c}=i,u=_i(t,r.schema);if(a)if(o){const h=hC(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,(x,b)=>{const v=Math.max(b,f),w=Math.min(b+x.nodeSize,m);x.marks.find(k=>k.type===u)?x.marks.forEach(k=>{u===k.type&&n.addMark(v,w,u.create({...k.attrs,...e}))}):n.addMark(v,w,u.create(e))})});return zD(r,n,u)},FD=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),BD=(t,e={})=>({state:n,dispatch:r,chain:a})=>{const i=Zn(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})=>NN(i,{...o,...e})(n)?!0:c.clearNodes()).command(({state:c})=>NN(i,{...o,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},VD=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,a=yl(t,0,r.content.size),i=ot.create(r,a);e.setSelection(i)}return!0},HD=(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},UD=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:a,to:i}=typeof t=="number"?{from:t,to:t}:t,o=lt.atStart(r).from,c=lt.atEnd(r).to,u=yl(a,o,c),h=yl(i,o,c),f=lt.create(r,u,h);e.setSelection(f)}return!0},WD=t=>({state:e,dispatch:n})=>{const r=Zn(t,e.schema);return zL(r)(e,n)};function dw(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 KD=({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=cf(h,c.node().type.name,c.node().attrs);if(i instanceof ot&&i.node.isBlock)return!c.parentOffset||!Ai(o,c.pos)?!1:(r&&(t&&dw(n,a.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const m=u.parentOffset===u.parent.content.size,x=c.depth===0?void 0:vD(c.node(-1).contentMatchAt(c.indexAfter(-1)));let b=m&&x?[{type:x,attrs:f}]:void 0,v=Ai(e.doc,e.mapping.map(c.pos),1,b);if(!b&&!v&&Ai(e.doc,e.mapping.map(c.pos),1,x?[{type:x}]:void 0)&&(v=!0,b=x?[{type:x,attrs:f}]:void 0),r){if(v&&(i instanceof lt&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,b),x&&!m&&!c.parentOffset&&c.parent.type!==x)){const w=e.mapping.map(c.before()),N=e.doc.resolve(w);c.node(-1).canReplaceWith(N.index(),N.index()+1,x)&&e.setNodeMarkup(e.mapping.map(c.before()),x)}t&&dw(n,a.extensionManager.splittableMarks),e.scrollIntoView()}return v},qD=(t,e={})=>({tr:n,state:r,dispatch:a,editor:i})=>{var o;const c=Zn(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 x=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=Ee.empty;const T=u.index(-1)?1:u.index(-2)?2:3;for(let H=u.depth-T;H>=u.depth-3;H-=1)k=Ee.from(u.node(H).copy(k));const C=u.indexAfter(-1){if(z>-1)return!1;H.isTextblock&&H.content.size===0&&(z=R+1)}),z>-1&&n.setSelection(lt.near(n.doc.resolve(z))),n.scrollIntoView()}return!0}const b=h.pos===u.end()?m.contentMatchAt(0).defaultType:null,v={...cf(x,m.type.name,m.attrs),...e},w={...cf(x,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,h.pos);const N=b?[{type:c,attrs:v},{type:b,attrs:w}]:[{type:c,attrs:v}];if(!Ai(n.doc,u.pos,2))return!1;if(a){const{selection:k,storedMarks:T}=r,{splittableMarks:C}=i.extensionManager,P=T||k.$to.parentOffset&&k.$from.marks();if(n.split(u.pos,2,N).scrollIntoView(),!P||!a)return!0;const L=P.filter(q=>C.includes(q.type.name));n.ensureMarks(L)}return!0},ng=(t,e)=>{const n=$p(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)&&Vo(t.doc,n.pos)&&t.join(n.pos),!0},sg=(t,e)=>{const n=$p(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)&&Vo(t.doc,r)&&t.join(r),!0},GD=(t,e,n,r={})=>({editor:a,tr:i,state:o,dispatch:c,chain:u,commands:h,can:f})=>{const{extensions:m,splittableMarks:x}=a.extensionManager,b=Zn(t,o.schema),v=Zn(e,o.schema),{selection:w,storedMarks:N}=o,{$from:k,$to:T}=w,C=k.blockRange(T),P=N||w.$to.parentOffset&&w.$from.marks();if(!C)return!1;const L=$p(q=>cw(q.type.name,m))(w);if(C.depth>=1&&L&&C.depth-L.depth<=1){if(L.node.type===b)return h.liftListItem(v);if(cw(L.node.type.name,m)&&b.validContent(L.node.content)&&c)return u().command(()=>(i.setNodeMarkup(L.pos,b),!0)).command(()=>ng(i,b)).command(()=>sg(i,b)).run()}return!n||!P||!c?u().command(()=>f().wrapInList(b,r)?!0:h.clearNodes()).wrapInList(b,r).command(()=>ng(i,b)).command(()=>sg(i,b)).run():u().command(()=>{const q=f().wrapInList(b,r),z=P.filter(H=>x.includes(H.type.name));return i.ensureMarks(z),q?!0:h.clearNodes()}).wrapInList(b,r).command(()=>ng(i,b)).command(()=>sg(i,b)).run()},JD=(t,e={},n={})=>({state:r,commands:a})=>{const{extendEmptyMarkRange:i=!1}=n,o=_i(t,r.schema);return s0(r,o,e)?a.unsetMark(o,{extendEmptyMarkRange:i}):a.setMark(o,e)},QD=(t,e,n={})=>({state:r,commands:a})=>{const i=Zn(t,r.schema),o=Zn(e,r.schema),c=Do(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})},YD=(t,e={})=>({state:n,commands:r})=>{const a=Zn(t,n.schema);return Do(n,a,e)?r.lift(a):r.wrapIn(a,e)},XD=()=>({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},ZD=()=>({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},e_=(t,e={})=>({tr:n,state:r,dispatch:a})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:c}=n,u=_i(t,r.schema),{$from:h,empty:f,ranges:m}=c;if(!a)return!0;if(f&&o){let{from:x,to:b}=c;const v=(i=h.marks().find(N=>N.type===u))==null?void 0:i.attrs,w=wy(h,u,v);w&&(x=w.from,b=w.to),n.removeMark(x,b,u)}else m.forEach(x=>{n.removeMark(x.$from.pos,x.$to.pos,u)});return n.removeStoredMark(u),!0},t_=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},n_=(t,e={})=>({tr:n,state:r,dispatch:a})=>{let i=null,o=null;const c=zp(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(i=Zn(t,r.schema)),c==="mark"&&(o=_i(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;let x,b,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),x=k,b=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(T=>{if(o===T.type&&(u=!0,a)){const C=Math.max(k,f),P=Math.min(k+N.nodeSize,m);n.addMark(C,P,o.create({...T.attrs,...e}))}}))}),b&&(x!==void 0&&a&&n.setNodeMarkup(x,void 0,{...b.attrs,...e}),o&&b.marks.length&&b.marks.forEach(N=>{o===N.type&&a&&n.addMark(v,w,o.create({...N.attrs,...e}))}))}),u},s_=(t,e={})=>({state:n,dispatch:r})=>{const a=Zn(t,n.schema);return IL(a,e)(n,r)},r_=(t,e={})=>({state:n,dispatch:r})=>{const a=Zn(t,n.schema);return PL(a,e)(n,r)},a_=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={}}},Bp=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},i_=(t,e)=>{if(Ny(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 Wh(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(x=>x.type.spec.code))return!1;let f=!1;const m=PD(h)+i;return o.forEach(x=>{if(f)return;const b=i_(m,x.find);if(!b)return;const v=u.state.tr,w=Dp({state:u.state,transaction:v}),N={from:r-(b[0].length-i.length),to:a},{commands:k,chain:T,can:C}=new _p({editor:n,state:w});x.handler({state:w,range:N,match:b,commands:k,chain:T,can:C})===null||!v.steps.length||(x.undoable&&v.setMeta(c,{transform:v,from:r,to:a,text:i}),u.dispatch(v),f=!0)}),f}function o_(t){const{editor:e,rules:n}=t,r=new pn({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=ky(Ee.from(f),o.schema);const{from:m}=u,x=m+f.length;Wh({editor:e,from:m,to:x,text:f,rules:n,plugin:r})}),a.selectionSet||a.docChanged?null:i}},props:{handleTextInput(a,i,o,c){return Wh({editor:e,from:i,to:o,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:a=>(setTimeout(()=>{const{$cursor:i}=a.state.selection;i&&Wh({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?Wh({editor:e,from:o.pos,to:o.pos,text:` -`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function l_(t){return Object.prototype.toString.call(t).slice(8,-1)}function Kh(t){return l_(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function SC(t,e){const n={...t};return Kh(t)&&Kh(e)&&Object.keys(e).forEach(r=>{Kh(e[r])&&Kh(t[r])?n[r]=SC(t[r],e[r]):n[r]=e[r]}),n}var Cy=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{...Yt(at(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Yt(at(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>SC(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}},Hl=class CC extends Cy{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new CC(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 c_(t){return typeof t=="number"}var d_=class{constructor(t){this.find=t.find,this.handler=t.handler}},u_=(t,e,n)=>{if(Ny(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 h_(t){const{editor:e,state:n,from:r,to:a,rule:i,pasteEvent:o,dropEvent:c}=t,{commands:u,chain:h,can:f}=new _p({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,a,(b,v)=>{var w,N,k,T,C;if((N=(w=b.type)==null?void 0:w.spec)!=null&&N.code||!(b.isText||b.isTextblock||b.isInline))return;const P=(C=(T=(k=b.content)==null?void 0:k.size)!=null?T:b.nodeSize)!=null?C:0,L=Math.max(r,v),q=Math.min(a,v+P);if(L>=q)return;const z=b.isText?b.text||"":b.textBetween(L-v,q-v,void 0,"");u_(z,i.find,o).forEach(R=>{if(R.index===void 0)return;const se=L+R.index+1,X=se+R[0].length,V={from:n.tr.mapping.map(se),to:n.tr.mapping.map(X)},ie=i.handler({state:n,range:V,match:R,commands:u,chain:h,can:f,pasteEvent:o,dropEvent:c});m.push(ie)})}),m.every(b=>b!==null)}var qh=null,f_=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function p_(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:x,rule:b,pasteEvt:v})=>{const w=f.tr,N=Dp({state:f,transaction:w});if(!(!h_({editor:e,state:N,from:Math.max(m-1,0),to:x.b-1,rule:b,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 pn({view(m){const x=v=>{var w;r=(w=m.dom.parentElement)!=null&&w.contains(v.target)?m.dom.parentElement:null,r&&(qh=e)},b=()=>{qh&&(qh=null)};return window.addEventListener("dragstart",x),window.addEventListener("dragend",b),{destroy(){window.removeEventListener("dragstart",x),window.removeEventListener("dragend",b)}}},props:{handleDOMEvents:{drop:(m,x)=>{if(i=r===m.dom.parentElement,c=x,!i){const b=qh;b!=null&&b.isEditable&&setTimeout(()=>{const v=b.state.selection;v&&b.commands.deleteRange({from:v.from,to:v.to})},10)}return!1},paste:(m,x)=>{var b;const v=(b=x.clipboardData)==null?void 0:b.getData("text/html");return o=x,a=!!(v!=null&&v.includes("data-pm-slice")),!1}}},appendTransaction:(m,x,b)=>{const v=m[0],w=v.getMeta("uiEvent")==="paste"&&!a,N=v.getMeta("uiEvent")==="drop"&&!i,k=v.getMeta("applyPasteRules"),T=!!k;if(!w&&!N&&!T)return;if(T){let{text:L}=k;typeof L=="string"?L=L:L=ky(Ee.from(L),b.schema);const{from:q}=k,z=q+L.length,H=f_(L);return u({rule:f,state:b,from:q,to:{b:z},pasteEvt:H})}const C=x.doc.content.findDiffStart(b.doc.content),P=x.doc.content.findDiffEnd(b.doc.content);if(!(!c_(C)||!P||C===P.b))return u({rule:f,state:b,from:C,to:P,pasteEvt:o})}}))}var Vp=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=gC(t),this.schema=SD(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:zd(e.name,this.schema)},r=at(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return eu([...this.extensions].reverse()).flatMap(r=>{const a={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:zd(r.name,this.schema)},i=[],o=at(r,"addKeyboardShortcuts",a);let c={};if(r.type==="mark"&&at(r,"exitable",a)&&(c.ArrowRight=()=>Hl.handleExit({editor:t,mark:r})),o){const x=Object.fromEntries(Object.entries(o()).map(([b,v])=>[b,()=>v({editor:t})]));c={...c,...x}}const u=TO(c);i.push(u);const h=at(r,"addInputRules",a);if(lw(r,t.options.enableInputRules)&&h){const x=h();if(x&&x.length){const b=o_({editor:t,rules:x}),v=Array.isArray(b)?b:[b];i.push(...v)}}const f=at(r,"addPasteRules",a);if(lw(r,t.options.enablePasteRules)&&f){const x=f();if(x&&x.length){const b=p_({editor:t,rules:x});i.push(...b)}}const m=at(r,"addProseMirrorPlugins",a);if(m){const x=m();i.push(...x)}return i})}get attributes(){return xC(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=qc(this.extensions);return Object.fromEntries(e.filter(n=>!!at(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:Zn(n.name,this.schema)},i=at(n,"addNodeView",a);if(!i)return[];const o=i();if(!o)return[];const c=(u,h,f,m,x)=>{const b=yu(u,r);return o({node:u,view:h,getPos:f,decorations:m,innerDecorations:x,editor:t,extension:n,HTMLAttributes:b})};return[n.name,c]}))}dispatchTransaction(t){const{editor:e}=this;return eu([...this.extensions].reverse()).reduceRight((r,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:zd(a.name,this.schema)},o=at(a,"dispatchTransaction",i);return o?c=>{o.call(i,{transaction:c,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return eu([...this.extensions]).reduce((r,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:zd(a.name,this.schema)},o=at(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}=qc(this.extensions);return Object.fromEntries(e.filter(n=>!!at(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:_i(n.name,this.schema)},i=at(n,"addMarkView",a);if(!i)return[];const o=(c,u,h)=>{const f=yu(c,r);return i()({mark:c,view:u,inline:h,editor:t,extension:n,HTMLAttributes:f,updateAttributes:m=>{M_(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:zd(e.name,this.schema)};e.type==="mark"&&((n=Yt(at(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const a=at(e,"onBeforeCreate",r),i=at(e,"onCreate",r),o=at(e,"onUpdate",r),c=at(e,"onSelectionUpdate",r),u=at(e,"onTransaction",r),h=at(e,"onFocus",r),f=at(e,"onBlur",r),m=at(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)})}};Vp.resolve=gC;Vp.sort=eu;Vp.flatten=jy;var m_={};vy(m_,{ClipboardTextSerializer:()=>TC,Commands:()=>MC,Delete:()=>AC,Drop:()=>IC,Editable:()=>PC,FocusEvents:()=>LC,Keymap:()=>OC,Paste:()=>DC,Tabindex:()=>_C,TextDirection:()=>zC,focusEventsPluginKey:()=>RC});var zn=class EC extends Cy{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new EC(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},TC=zn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new pn({key:new Cn("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=bC(n);return yC(r,{from:o,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),MC=zn.create({name:"commands",addCommands(){return{...iC}}}),AC=zn.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=fC(t.before,[t,...e]);NC(f).forEach(b=>{f.mapping.mapResult(b.oldRange.from).deletedAfter&&f.mapping.mapResult(b.oldRange.to).deletedBefore&&f.before.nodesBetween(b.oldRange.from,b.oldRange.to,(v,w)=>{const N=w+v.nodeSize-2,k=b.oldRange.from<=w&&N<=b.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:b.oldRange,newRange:b.newRange,partial:!k,editor:this.editor,transaction:t,combinedTransform:f})})});const x=f.mapping;f.steps.forEach((b,v)=>{var w,N;if(b instanceof Na){const k=x.slice(v).map(b.from,-1),T=x.slice(v).map(b.to),C=x.invert().map(k,-1),P=x.invert().map(T),L=(w=f.doc.nodeAt(k-1))==null?void 0:w.marks.some(z=>z.eq(b.mark)),q=(N=f.doc.nodeAt(T))==null?void 0:N.marks.some(z=>z.eq(b.mark));this.editor.emit("delete",{type:"mark",mark:b.mark,from:b.from,to:b.to,deletedRange:{from:C,to:P},newRange:{from:k,to:T},partial:!!(q||L),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()}}),IC=zn.create({name:"drop",addProseMirrorPlugins(){return[new pn({key:new Cn("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),PC=zn.create({name:"editable",addProseMirrorPlugins(){return[new pn({key:new Cn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),RC=new Cn("focusEvents"),LC=zn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new pn({key:RC,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}}}})]}}),OC=zn.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:x,parent:b}=m,v=m.parent.isTextblock&&x>0?c.doc.resolve(x-1):m,w=v.parent.type.spec.isolating,N=m.pos-m.parentOffset,k=w&&v.parent.childCount===1?N===m.pos:gt.atStart(h).from===x;return!f||!b.type.isTextblock||b.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 _f()||uC()?i:a},addProseMirrorPlugins(){return[new pn({key:new Cn("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=gt.atStart(e.doc).from,h=gt.atEnd(e.doc).to;if(i||!(o===u&&c===h)||!Fp(n.doc))return;const x=n.tr,b=Dp({state:n,transaction:x}),{commands:v}=new _p({editor:this.editor,state:b});if(v.clearNodes(),!!x.steps.length)return x}})]}}),DC=zn.create({name:"paste",addProseMirrorPlugins(){return[new pn({key:new Cn("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),_C=zn.create({name:"tabindex",addProseMirrorPlugins(){return[new pn({key:new Cn("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),zC=zn.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=qc(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 pn({key:new Cn("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),x_=class Ud{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 Ud(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 Ud(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 Ud(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 Ud(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)}},g_=`.ProseMirror { - position: relative; -} - -.ProseMirror { - word-wrap: break-word; - white-space: pre-wrap; - white-space: break-spaces; - -webkit-font-variant-ligatures: none; - font-variant-ligatures: none; - font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ -} - -.ProseMirror [contenteditable="false"] { - white-space: normal; -} - -.ProseMirror [contenteditable="false"] [contenteditable="true"] { - white-space: pre-wrap; -} - -.ProseMirror pre { - white-space: pre-wrap; -} - -img.ProseMirror-separator { - display: inline !important; - border: none !important; - margin: 0 !important; - width: 0 !important; - height: 0 !important; -} - -.ProseMirror-gapcursor { - display: none; - pointer-events: none; - position: absolute; - margin: 0; -} - -.ProseMirror-gapcursor:after { - content: ""; - display: block; - position: absolute; - top: -2px; - width: 20px; - border-top: 1px solid black; - animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; -} - -@keyframes ProseMirror-cursor-blink { - to { - visibility: hidden; - } -} - -.ProseMirror-hideselection *::selection { - background: transparent; -} - -.ProseMirror-hideselection *::-moz-selection { - background: transparent; -} - -.ProseMirror-hideselection * { - caret-color: transparent; -} - -.ProseMirror-focused .ProseMirror-gapcursor { - display: block; -}`;function y_(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const a=document.createElement("style");return e&&a.setAttribute("nonce",e),a.setAttribute("data-tiptap-style",""),a.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(a),a}var b_=class extends a_{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:DD,createMappablePosition:_D},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:a,moved:i})=>this.options.onDrop(r,a,i)),this.on("paste",({event:r,slice:a})=>this.options.onPaste(r,a)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=cC(e,this.options.autofocus);this.editorState=Lc.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t!=null&&t.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=y_(g_,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=mC(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(a=>{const i=typeof a=="string"?`${a}$`:a.key;n=n.filter(o=>!o.key.startsWith(i))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[PC,TC.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),MC,LC,OC,_C,IC,DC,AC,zC.configure({direction:this.options.textDirection})].filter(a=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[a.name]!==!1:!0):[],...this.options.extensions].filter(a=>["extension","node","mark"].includes(a==null?void 0:a.type));this.extensionManager=new Vp(r,this)}createCommandManager(){this.commandManager=new _p({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=n0(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=n0(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),a=n?this.extensionManager.dispatchTransaction(r):r,i=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(i);this.editorView=new aC(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:a,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const c=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(c),this.prependClass(),this.injectCSS();const u=this.view.dom;u.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(h=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(h)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),a=n.includes(t),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!a)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(h=>h.getMeta("focus")||h.getMeta("blur")),c=o==null?void 0:o.getMeta("focus"),u=o==null?void 0:o.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:o}),u&&this.emit("blur",{editor:this,event:u.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(h=>h.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return vC(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return RD(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return ky(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=` - -`,textSerializers:n={}}=t||{};return ED(this.state.doc,{blockSeparator:e,textSerializers:{...bC(this.schema),...n}})}get isEmpty(){return Fp(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new x_(e,this)}get $doc(){return this.$pos(0)}};function Gc(t){return new Bp({find:t.find,handler:({state:e,range:n,match:r})=>{const a=Yt(t.getAttributes,void 0,r);if(a===!1||a===null)return null;const{tr:i}=e,o=r[r.length-1],c=r[0];if(o){const u=c.search(/\S/),h=n.from+c.indexOf(o),f=h+o.length;if(Sy(n.from,n.to,e.doc).filter(b=>b.mark.type.excluded.find(w=>w===t.type&&w!==b.mark.type)).filter(b=>b.to>h).length)return null;fn.from&&i.delete(n.from+u,h);const x=n.from+u+o.length;i.addMark(n.from+u,x,t.type.create(a||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function $C(t){return new Bp({find:t.find,handler:({state:e,range:n,match:r})=>{const a=Yt(t.getAttributes,void 0,r)||{},{tr:i}=e,o=n.from;let c=n.to;const u=t.type.create(a);if(r[1]){const h=r[0].lastIndexOf(r[1]);let f=o+h;f>c?f=c:c=f+r[1].length;const m=r[0][r[0].length-1];i.insertText(m,o+r[0].length-1),i.replaceWith(f,c,u)}else if(r[0]){const h=t.type.isInline?o:o-1;i.insert(h,t.type.create(a)).delete(i.mapping.map(o),i.mapping.map(c))}i.scrollIntoView()},undoable:t.undoable})}function r0(t){return new Bp({find:t.find,handler:({state:e,range:n,match:r})=>{const a=e.doc.resolve(n.from),i=Yt(t.getAttributes,void 0,r)||{};if(!a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable})}function Jc(t){return new Bp({find:t.find,handler:({state:e,range:n,match:r,chain:a})=>{const i=Yt(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),u=o.doc.resolve(n.from).blockRange(),h=u&&ny(u,t.type,i);if(!h)return null;if(o.wrap(u,h),t.keepMarks&&t.editor){const{selection:m,storedMarks:x}=e,{splittableMarks:b}=t.editor.extensionManager,v=x||m.$to.parentOffset&&m.$from.marks();if(v){const w=v.filter(N=>b.includes(N.type.name));o.ensureMarks(w)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";a().updateAttributes(m,i).run()}const f=o.doc.resolve(n.from-1).nodeBefore;f&&f.type===t.type&&Vo(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,f))&&o.join(n.from-1)},undoable:t.undoable})}var v_=t=>"touches"in t,N_=class{constructor(t){this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.clientX-this.startX,h=c.clientY-this.startY;this.handleResize(u,h)},this.handleTouchMove=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.touches[0];if(!u)return;const h=u.clientX-this.startX,f=u.clientY-this.startY;this.handleResize(h,f)},this.handleMouseUp=()=>{if(!this.isResizing)return;const c=this.element.offsetWidth,u=this.element.offsetHeight;this.onCommit(c,u),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=c=>{c.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=c=>{c.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,n,r,a,i,o;this.node=t.node,this.editor=t.editor,this.element=t.element,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(e=t.options)!=null&&e.min&&(this.minSize={...this.minSize,...t.options.min}),(n=t.options)!=null&&n.max&&(this.maxSize=t.options.max),(r=t==null?void 0:t.options)!=null&&r.directions&&(this.directions=t.options.directions),(a=t.options)!=null&&a.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(i=t.options)!=null&&i.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),(o=t.options)!=null&&o.createCustomHandle&&(this.createCustomHandle=t.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var t;return(t=this.contentElement)!=null?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display="flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),a=e.includes("left"),i=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),a&&(t.style.left="0"),i&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,v_(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:a}=this.calculateNewDimensions(this.activeHandle,t,e),i=this.applyConstraints(r,a,n);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,a=this.startHeight;const i=t.includes("right"),o=t.includes("left"),c=t.includes("bottom"),u=t.includes("top");return i?r=this.startWidth+e:o&&(r=this.startWidth-e),c?a=this.startHeight+n:u&&(a=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(i?e:-e)),(t==="top"||t==="bottom")&&(a=this.startHeight+(c?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,a,t):{width:r,height:a}}applyConstraints(t,e,n){var r,a,i,o;if(!n){let h=Math.max(this.minSize.width,t),f=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(h=Math.min(this.maxSize.width,h)),(a=this.maxSize)!=null&&a.height&&(f=Math.min(this.maxSize.height,f)),{width:h,height:f}}let c=t,u=e;return cthis.maxSize.width&&(c=this.maxSize.width,u=c/this.aspectRatio),(o=this.maxSize)!=null&&o.height&&u>this.maxSize.height&&(u=this.maxSize.height,c=u*this.aspectRatio),{width:c,height:u}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",a=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:a?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};function w_(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof ot){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let a=r.depth;for(;a>=0;){const i=r.index(a);if(r.node(a).contentMatchAt(i).matchType(e))return!0;a-=1}return!1}function j_(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var k_={};vy(k_,{createAtomBlockMarkdownSpec:()=>S_,createBlockMarkdownSpec:()=>C_,createInlineMarkdownSpec:()=>FC,parseAttributes:()=>Ey,parseIndentedBlocks:()=>a0,renderNestedMarkdownContent:()=>My,serializeAttributes:()=>Ty});function Ey(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,h=>(n.push(h),`__QUOTED_${n.length-1}__`)),a=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(a){const h=a.map(f=>f.trim().slice(1));e.class=h.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,h,f])=>{var m;const x=parseInt(((m=f.match(/__QUOTED_(\d+)__/))==null?void 0:m[1])||"0",10),b=n[x];b&&(e[h]=b.slice(1,-1))});const u=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return u&&u.split(/\s+/).filter(Boolean).forEach(f=>{f.match(/^[a-zA-Z][\w-]*$/)&&(e[f]=!0)}),e}function Ty(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function S_(t){const{nodeName:e,name:n,parseAttributes:r=Ey,serializeAttributes:a=Ty,defaultAttributes:i={},requiredAttributes:o=[],allowedAttributes:c}=t,u=n||e,h=f=>{if(!c)return f;const m={};return c.forEach(x=>{x in f&&(m[x]=f[x])}),m};return{parseMarkdown:(f,m)=>{const x={...i,...f.attributes};return m.createNode(e,x,[])},markdownTokenizer:{name:e,level:"block",start(f){var m;const x=new RegExp(`^:::${u}(?:\\s|$)`,"m"),b=(m=f.match(x))==null?void 0:m.index;return b!==void 0?b:-1},tokenize(f,m,x){const b=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),v=f.match(b);if(!v)return;const w=v[1]||"",N=r(w);if(!o.find(T=>!(T in N)))return{type:e,raw:v[0],attributes:N}}},renderMarkdown:f=>{const m=h(f.attrs||{}),x=a(m),b=x?` {${x}}`:"";return`:::${u}${b} :::`}}}function C_(t){const{nodeName:e,name:n,getContent:r,parseAttributes:a=Ey,serializeAttributes:i=Ty,defaultAttributes:o={},content:c="block",allowedAttributes:u}=t,h=n||e,f=m=>{if(!u)return m;const x={};return u.forEach(b=>{b in m&&(x[b]=m[b])}),x};return{parseMarkdown:(m,x)=>{let b;if(r){const w=r(m);b=typeof w=="string"?[{type:"text",text:w}]:w}else c==="block"?b=x.parseChildren(m.tokens||[]):b=x.parseInline(m.tokens||[]);const v={...o,...m.attributes};return x.createNode(e,v,b)},markdownTokenizer:{name:e,level:"block",start(m){var x;const b=new RegExp(`^:::${h}`,"m"),v=(x=m.match(b))==null?void 0:x.index;return v!==void 0?v:-1},tokenize(m,x,b){var v;const w=new RegExp(`^:::${h}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),N=m.match(w);if(!N)return;const[k,T=""]=N,C=a(T);let P=1;const L=k.length;let q="";const z=/^:::([\w-]*)(\s.*)?/gm,H=m.slice(L);for(z.lastIndex=0;;){const R=z.exec(H);if(R===null)break;const se=R.index,X=R[1];if(!((v=R[2])!=null&&v.endsWith(":::"))){if(X)P+=1;else if(P-=1,P===0){const V=H.slice(0,se);q=V.trim();const ie=m.slice(0,L+se+R[0].length);let le=[];if(q)if(c==="block")for(le=b.blockTokens(V),le.forEach(he=>{he.text&&(!he.tokens||he.tokens.length===0)&&(he.tokens=b.inlineTokens(he.text))});le.length>0;){const he=le[le.length-1];if(he.type==="paragraph"&&(!he.text||he.text.trim()===""))le.pop();else break}else le=b.inlineTokens(q);return{type:e,raw:ie,attributes:C,content:q,tokens:le}}}}}},renderMarkdown:(m,x)=>{const b=f(m.attrs||{}),v=i(b),w=v?` {${v}}`:"",N=x.renderChildren(m.content||[],` - -`);return`:::${h}${w} - -${N} - -:::`}}}function E_(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,a,i,o]=r;e[a]=i||o,r=n.exec(t)}return e}function T_(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function FC(t){const{nodeName:e,name:n,getContent:r,parseAttributes:a=E_,serializeAttributes:i=T_,defaultAttributes:o={},selfClosing:c=!1,allowedAttributes:u}=t,h=n||e,f=x=>{if(!u)return x;const b={};return u.forEach(v=>{const w=typeof v=="string"?v:v.name,N=typeof v=="string"?void 0:v.skipIfDefault;if(w in x){const k=x[w];if(N!==void 0&&k===N)return;b[w]=k}}),b},m=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(x,b)=>{const v={...o,...x.attributes};if(c)return b.createNode(e,v);const w=r?r(x):x.content||"";return w?b.createNode(e,v,[b.createTextNode(w)]):b.createNode(e,v,[])},markdownTokenizer:{name:e,level:"inline",start(x){const b=c?new RegExp(`\\[${m}\\s*[^\\]]*\\]`):new RegExp(`\\[${m}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${m}\\]`),v=x.match(b),w=v==null?void 0:v.index;return w!==void 0?w:-1},tokenize(x,b,v){const w=c?new RegExp(`^\\[${m}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${m}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${m}\\]`),N=x.match(w);if(!N)return;let k="",T="";if(c){const[,P]=N;T=P}else{const[,P,L]=N;T=P,k=L||""}const C=a(T.trim());return{type:e,raw:N[0],content:k.trim(),attributes:C}}},renderMarkdown:x=>{let b="";r?b=r(x):x.content&&x.content.length>0&&(b=x.content.filter(k=>k.type==="text").map(k=>k.text).join(""));const v=f(x.attrs||{}),w=i(v),N=w?` ${w}`:"";return c?`[${h}${N}]`:`[${h}${N}]${b}[/${h}]`}}}function a0(t,e,n){var r,a,i,o;const c=t.split(` -`),u=[];let h="",f=0;const m=e.baseIndentSize||2;for(;f0)break;if(x.trim()===""){f+=1,h=`${h}${x} -`;continue}else return}const v=e.extractItemData(b),{indentLevel:w,mainContent:N}=v;h=`${h}${x} -`;const k=[N];for(f+=1;fse.trim()!=="");if(z===-1)break;if((((a=(r=c[f+1+z].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:a.length)||0)>w){k.push(L),h=`${h}${L} -`,f+=1;continue}else break}if((((o=(i=L.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:o.length)||0)>w)k.push(L),h=`${h}${L} -`,f+=1;else break}let T;const C=k.slice(1);if(C.length>0){const L=C.map(q=>q.slice(w+m)).join(` -`);L.trim()&&(e.customNestedParser?T=e.customNestedParser(L):T=n.blockTokens(L))}const P=e.createToken(v,T);u.push(P)}if(u.length!==0)return{items:u,raw:h}}function My(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const a=typeof n=="function"?n(r):n,[i,...o]=t.content,c=e.renderChildren([i]),u=[`${a}${c}`];return o&&o.length>0&&o.forEach(h=>{const f=e.renderChildren([h]);if(f){const m=f.split(` -`).map(x=>x?e.indent(x):"").join(` -`);u.push(m)}}),u.join(` -`)}function M_(t,e,n={}){const{state:r}=e,{doc:a,tr:i}=r,o=t;a.descendants((c,u)=>{const h=i.mapping.map(u),f=i.mapping.map(u)+c.nodeSize;let m=null;if(c.marks.forEach(b=>{if(b!==o)return!1;m=b}),!m)return;let x=!1;if(Object.keys(n).forEach(b=>{n[b]!==m.attrs[b]&&(x=!0)}),x){const b=t.type.create({...t.attrs,...n});i.removeMark(h,f,t.type),i.addMark(h,f,b)}}),i.docChanged&&e.view.dispatch(i)}var qn=class BC extends Cy{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new BC(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Dl(t){return new d_({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:a})=>{const i=Yt(t.getAttributes,void 0,r,a);if(i===!1||i===null)return null;const{tr:o}=e,c=r[r.length-1],u=r[0];let h=n.to;if(c){const f=u.search(/\S/),m=n.from+u.indexOf(c),x=m+c.length;if(Sy(n.from,n.to,e.doc).filter(v=>v.mark.type.excluded.find(N=>N===t.type&&N!==v.mark.type)).filter(v=>v.to>m).length)return null;xn.from&&o.delete(n.from+f,m),h=n.from+f+c.length,o.addMark(n.from+f,h,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:A_,getOwnPropertySymbols:I_}=Object,{hasOwnProperty:P_}=Object.prototype;function rg(t,e){return function(r,a,i){return t(r,a,i)&&e(r,a,i)}}function Gh(t){return function(n,r,a){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,a);const{cache:i}=a,o=i.get(n),c=i.get(r);if(o&&c)return o===r&&c===n;i.set(n,r),i.set(r,n);const u=t(n,r,a);return i.delete(n),i.delete(r),u}}function R_(t){return t!=null?t[Symbol.toStringTag]:void 0}function uw(t){return A_(t).concat(I_(t))}const L_=Object.hasOwn||((t,e)=>P_.call(t,e));function Ul(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const O_="__v",D_="__o",__="_owner",{getOwnPropertyDescriptor:hw,keys:fw}=Object;function z_(t,e){return t.byteLength===e.byteLength&&zf(new Uint8Array(t),new Uint8Array(e))}function $_(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function F_(t,e){return t.byteLength===e.byteLength&&zf(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function B_(t,e){return Ul(t.getTime(),e.getTime())}function V_(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function H_(t,e){return t===e}function pw(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const a=new Array(r),i=t.entries();let o,c,u=0;for(;(o=i.next())&&!o.done;){const h=e.entries();let f=!1,m=0;for(;(c=h.next())&&!c.done;){if(a[m]){m++;continue}const x=o.value,b=c.value;if(n.equals(x[0],b[0],u,m,t,e,n)&&n.equals(x[1],b[1],x[0],b[0],t,e,n)){f=a[m]=!0;break}m++}if(!f)return!1;u++}return!0}const U_=Ul;function W_(t,e,n){const r=fw(t);let a=r.length;if(fw(e).length!==a)return!1;for(;a-- >0;)if(!VC(t,e,n,r[a]))return!1;return!0}function $d(t,e,n){const r=uw(t);let a=r.length;if(uw(e).length!==a)return!1;let i,o,c;for(;a-- >0;)if(i=r[a],!VC(t,e,n,i)||(o=hw(t,i),c=hw(e,i),(o||c)&&(!o||!c||o.configurable!==c.configurable||o.enumerable!==c.enumerable||o.writable!==c.writable)))return!1;return!0}function K_(t,e){return Ul(t.valueOf(),e.valueOf())}function q_(t,e){return t.source===e.source&&t.flags===e.flags}function mw(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const a=new Array(r),i=t.values();let o,c;for(;(o=i.next())&&!o.done;){const u=e.values();let h=!1,f=0;for(;(c=u.next())&&!c.done;){if(!a[f]&&n.equals(o.value,c.value,o.value,c.value,t,e,n)){h=a[f]=!0;break}f++}if(!h)return!1}return!0}function zf(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function G_(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function VC(t,e,n,r){return(r===__||r===D_||r===O_)&&(t.$$typeof||e.$$typeof)?!0:L_(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const J_="[object ArrayBuffer]",Q_="[object Arguments]",Y_="[object Boolean]",X_="[object DataView]",Z_="[object Date]",e7="[object Error]",t7="[object Map]",n7="[object Number]",s7="[object Object]",r7="[object RegExp]",a7="[object Set]",i7="[object String]",o7={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},l7="[object URL]",c7=Object.prototype.toString;function d7({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:a,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:c,areObjectsEqual:u,arePrimitiveWrappersEqual:h,areRegExpsEqual:f,areSetsEqual:m,areTypedArraysEqual:x,areUrlsEqual:b,unknownTagComparators:v}){return function(N,k,T){if(N===k)return!0;if(N==null||k==null)return!1;const C=typeof N;if(C!==typeof k)return!1;if(C!=="object")return C==="number"?c(N,k,T):C==="function"?i(N,k,T):!1;const P=N.constructor;if(P!==k.constructor)return!1;if(P===Object)return u(N,k,T);if(Array.isArray(N))return e(N,k,T);if(P===Date)return r(N,k,T);if(P===RegExp)return f(N,k,T);if(P===Map)return o(N,k,T);if(P===Set)return m(N,k,T);const L=c7.call(N);if(L===Z_)return r(N,k,T);if(L===r7)return f(N,k,T);if(L===t7)return o(N,k,T);if(L===a7)return m(N,k,T);if(L===s7)return typeof N.then!="function"&&typeof k.then!="function"&&u(N,k,T);if(L===l7)return b(N,k,T);if(L===e7)return a(N,k,T);if(L===Q_)return u(N,k,T);if(o7[L])return x(N,k,T);if(L===J_)return t(N,k,T);if(L===X_)return n(N,k,T);if(L===Y_||L===n7||L===i7)return h(N,k,T);if(v){let q=v[L];if(!q){const z=R_(N);z&&(q=v[z])}if(q)return q(N,k,T)}return!1}}function u7({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:z_,areArraysEqual:n?$d:$_,areDataViewsEqual:F_,areDatesEqual:B_,areErrorsEqual:V_,areFunctionsEqual:H_,areMapsEqual:n?rg(pw,$d):pw,areNumbersEqual:U_,areObjectsEqual:n?$d:W_,arePrimitiveWrappersEqual:K_,areRegExpsEqual:q_,areSetsEqual:n?rg(mw,$d):mw,areTypedArraysEqual:n?rg(zf,$d):zf,areUrlsEqual:G_,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const a=Gh(r.areArraysEqual),i=Gh(r.areMapsEqual),o=Gh(r.areObjectsEqual),c=Gh(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:a,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:c})}return r}function h7(t){return function(e,n,r,a,i,o,c){return t(e,n,c)}}function f7({circular:t,comparator:e,createState:n,equals:r,strict:a}){if(n)return function(c,u){const{cache:h=t?new WeakMap:void 0,meta:f}=n();return e(c,u,{cache:h,equals:r,meta:f,strict:a})};if(t)return function(c,u){return e(c,u,{cache:new WeakMap,equals:r,meta:void 0,strict:a})};const i={cache:void 0,equals:r,meta:void 0,strict:a};return function(c,u){return e(c,u,i)}}const p7=Uo();Uo({strict:!0});Uo({circular:!0});Uo({circular:!0,strict:!0});Uo({createInternalComparator:()=>Ul});Uo({strict:!0,createInternalComparator:()=>Ul});Uo({circular:!0,createInternalComparator:()=>Ul});Uo({circular:!0,createInternalComparator:()=>Ul,strict:!0});function Uo(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:a=!1}=t,i=u7(t),o=d7(i),c=n?n(o):h7(o);return f7({circular:e,comparator:o,createState:r,equals:c,strict:a})}var ag={exports:{}},ig={};/** - * @license React - * use-sync-external-store-shim/with-selector.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var xw;function m7(){if(xw)return ig;xw=1;var t=ju(),e=I2();function n(h,f){return h===f&&(h!==0||1/h===1/f)||h!==h&&f!==f}var r=typeof Object.is=="function"?Object.is:n,a=e.useSyncExternalStore,i=t.useRef,o=t.useEffect,c=t.useMemo,u=t.useDebugValue;return ig.useSyncExternalStoreWithSelector=function(h,f,m,x,b){var v=i(null);if(v.current===null){var w={hasValue:!1,value:null};v.current=w}else w=v.current;v=c(function(){function k(q){if(!T){if(T=!0,C=q,q=x(q),b!==void 0&&w.hasValue){var z=w.value;if(b(z,q))return P=z}return P=q}if(z=P,r(C,q))return z;var H=x(q);return b!==void 0&&b(z,H)?(C=q,z):(C=q,P=H)}var T=!1,C,P,L=m===void 0?null:m;return[function(){return k(f())},L===null?void 0:function(){return k(L())}]},[f,m,x,b]);var N=a(h,v[0],v[1]);return o(function(){w.hasValue=!0,w.value=N},[N]),u(N),N},ig}var gw;function x7(){return gw||(gw=1,ag.exports=m7()),ag.exports}var g7=x7(),y7=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},b7=({contentComponent:t})=>{const e=P2.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return s.jsx(s.Fragment,{children:Object.values(e)})};function v7(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:Ej.createPortal(r.reactElement,r.element,n)},t.forEach(a=>a())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(a=>a())}}}var N7=class extends sr.Component{constructor(t){var e;super(t),this.editorContentRef=sr.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=v7(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:y7(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&s.jsx(b7,{contentComponent:t.contentComponent})]})}},w7=y.forwardRef((t,e)=>{const n=sr.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return sr.createElement(N7,{key:n,innerRef:e,...t})}),HC=sr.memo(w7),j7=typeof window<"u"?y.useLayoutEffect:y.useEffect,k7=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function S7(t){var e;const[n]=y.useState(()=>new k7(t.editor)),r=g7.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:p7);return j7(()=>n.watch(t.editor),[t.editor,n]),y.useDebugValue(r),r}var C7=!1,i0=typeof window>"u",E7=i0||!!(typeof window<"u"&&window.next),T7=class UC{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?i0||E7?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var a,i;return(i=(a=this.options.current).onBeforeCreate)==null?void 0:i.call(a,...r)},onBlur:(...r)=>{var a,i;return(i=(a=this.options.current).onBlur)==null?void 0:i.call(a,...r)},onCreate:(...r)=>{var a,i;return(i=(a=this.options.current).onCreate)==null?void 0:i.call(a,...r)},onDestroy:(...r)=>{var a,i;return(i=(a=this.options.current).onDestroy)==null?void 0:i.call(a,...r)},onFocus:(...r)=>{var a,i;return(i=(a=this.options.current).onFocus)==null?void 0:i.call(a,...r)},onSelectionUpdate:(...r)=>{var a,i;return(i=(a=this.options.current).onSelectionUpdate)==null?void 0:i.call(a,...r)},onTransaction:(...r)=>{var a,i;return(i=(a=this.options.current).onTransaction)==null?void 0:i.call(a,...r)},onUpdate:(...r)=>{var a,i;return(i=(a=this.options.current).onUpdate)==null?void 0:i.call(a,...r)},onContentError:(...r)=>{var a,i;return(i=(a=this.options.current).onContentError)==null?void 0:i.call(a,...r)},onDrop:(...r)=>{var a,i;return(i=(a=this.options.current).onDrop)==null?void 0:i.call(a,...r)},onPaste:(...r)=>{var a,i;return(i=(a=this.options.current).onPaste)==null?void 0:i.call(a,...r)},onDelete:(...r)=>{var a,i;return(i=(a=this.options.current).onDelete)==null?void 0:i.call(a,...r)}};return new b_(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((a,i)=>{var o;return a===((o=n.extensions)==null?void 0:o[i])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?UC.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,a)=>r===e[a]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function M7(t={},e=[]){const n=y.useRef(t);n.current=t;const[r]=y.useState(()=>new T7(n)),a=P2.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return y.useDebugValue(a),y.useEffect(r.onRender(e)),S7({editor:a,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),a}var WC=y.createContext({editor:null});WC.Consumer;var A7=y.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),I7=()=>y.useContext(A7);sr.forwardRef((t,e)=>{const{onDragStart:n}=I7(),r=t.as||"div";return s.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});sr.createContext({markViewContentRef:()=>{}});var Ay=y.createContext({get editor(){throw new Error("useTiptap must be used within a provider")}});Ay.displayName="TiptapContext";var P7=()=>y.useContext(Ay);function KC({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const a=y.useMemo(()=>({editor:r}),[r]),i=y.useMemo(()=>({editor:r}),[r]);return s.jsx(WC.Provider,{value:i,children:s.jsx(Ay.Provider,{value:a,children:n})})}KC.displayName="Tiptap";function qC({...t}){const{editor:e}=P7();return s.jsx(HC,{editor:e,...t})}qC.displayName="Tiptap.Content";Object.assign(KC,{Content:qC});var $f=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},R7=/^\s*>\s$/,L7=qn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return $f("blockquote",{...Xt(this.options.HTMLAttributes,t),children:$f("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach(a=>{const c=e.renderChildren([a]).split(` -`).map(u=>u.trim()===""?n:`${n} ${u}`);r.push(c.join(` -`))}),r.join(` -${n} -`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Jc({find:R7,type:this.type})]}}),O7=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,D7=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,_7=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,z7=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,$7=Hl.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return $f("strong",{...Xt(this.options.HTMLAttributes,t),children:$f("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Gc({find:O7,type:this.type}),Gc({find:_7,type:this.type})]},addPasteRules(){return[Dl({find:D7,type:this.type}),Dl({find:z7,type:this.type})]}}),F7=/(^|[^`])`([^`]+)`(?!`)$/,B7=/(^|[^`])`([^`]+)`(?!`)/g,V7=Hl.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Xt(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Gc({find:F7,type:this.type})]},addPasteRules(){return[Dl({find:B7,type:this.type})]}}),og=4,H7=/^```([a-z]+)?[\s\n]$/,U7=/^~~~([a-z]+)?[\s\n]$/,W7=qn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:og,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const i=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Xt(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&((r=t.raw)==null?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const a=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${a}`,e.renderChildren(t.content),"```"].join(` -`):r=`\`\`\`${a} - -\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:og,{state:r}=t,{selection:a}=r,{$from:i,empty:o}=a;if(i.parent.type!==this.type)return!1;const c=" ".repeat(n);return o?t.commands.insertContent(c):t.commands.command(({tr:u})=>{const{from:h,to:f}=a,b=r.doc.textBetween(h,f,` -`,` -`).split(` -`).map(v=>c+v).join(` -`);return u.replaceWith(h,f,r.schema.text(b)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:og,{state:r}=t,{selection:a}=r,{$from:i,empty:o}=a;return i.parent.type!==this.type?!1:o?t.commands.command(({tr:c})=>{var u;const{pos:h}=i,f=i.start(),m=i.end(),b=r.doc.textBetween(f,m,` -`,` -`).split(` -`);let v=0,w=0;const N=h-f;for(let q=0;q=N){v=q;break}w+=b[q].length+1}const T=((u=b[v].match(/^ */))==null?void 0:u[0])||"",C=Math.min(T.length,n);if(C===0)return!0;let P=f;for(let q=0;q{const{from:u,to:h}=a,x=r.doc.textBetween(u,h,` -`,` -`).split(` -`).map(b=>{var v;const w=((v=b.match(/^ */))==null?void 0:v[0])||"",N=Math.min(w.length,n);return b.slice(N)}).join(` -`);return c.replaceWith(u,h,r.schema.text(x)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:a}=n;if(!a||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(` - -`);return!i||!o?!1:t.chain().command(({tr:c})=>(c.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:a,empty:i}=n;if(!i||a.parent.type!==this.type||!(a.parentOffset===a.parent.nodeSize-2))return!1;const c=a.after();return c===void 0?!1:r.nodeAt(c)?t.commands.command(({tr:h})=>(h.setSelection(gt.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[r0({find:H7,type:this.type,getAttributes:t=>({language:t[1]})}),r0({find:U7,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new pn({key:new Cn("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),a=r?JSON.parse(r):void 0,i=a==null?void 0:a.mode;if(!n||!i)return!1;const{tr:o,schema:c}=t.state,u=c.text(n.replace(/\r\n?/g,` -`));return o.replaceSelectionWith(this.type.create({language:i},u)),o.selection.$from.parent.type!==this.type&&o.setSelection(lt.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),K7=qn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` - -`):""}),q7=qn.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",Xt(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(x=>c.includes(x.type.name));h.ensureMarks(m)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),G7=qn.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]}`,Xt(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=>r0({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),J7=qn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Xt(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!w_(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,a=t();return wC(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(lt.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(ot.create(o.doc,u.pos)):o.setSelection(lt.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(lt.create(o.doc,h+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[$C({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Q7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Y7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,X7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Z7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,ez=Hl.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",Xt(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[Gc({find:Q7,type:this.type}),Gc({find:X7,type:this.type})]},addPasteRules(){return[Dl({find:Y7,type:this.type}),Dl({find:Z7,type:this.type})]}});const tz="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",nz="ελ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",o0="numeric",l0="ascii",c0="alpha",tu="asciinumeric",Wd="alphanumeric",d0="domain",GC="emoji",sz="scheme",rz="slashscheme",lg="whitespace";function az(t,e){return t in e||(e[t]=[]),e[t]}function bl(t,e,n){e[o0]&&(e[tu]=!0,e[Wd]=!0),e[l0]&&(e[tu]=!0,e[c0]=!0),e[tu]&&(e[Wd]=!0),e[c0]&&(e[Wd]=!0),e[Wd]&&(e[d0]=!0),e[GC]&&(e[d0]=!0);for(const r in e){const a=az(r,n);a.indexOf(t)<0&&a.push(t)}}function iz(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Nr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Nr.groups={};Nr.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),Ln=(t,e,n,r,a)=>t.tr(e,n,r,a),yw=(t,e,n,r,a)=>t.ts(e,n,r,a),Le=(t,e,n,r,a)=>t.tt(e,n,r,a),wi="WORD",u0="UWORD",JC="ASCIINUMERICAL",QC="ALPHANUMERICAL",bu="LOCALHOST",h0="TLD",f0="UTLD",df="SCHEME",Tc="SLASH_SCHEME",Iy="NUM",p0="WS",Py="NL",nu="OPENBRACE",su="CLOSEBRACE",Ff="OPENBRACKET",Bf="CLOSEBRACKET",Vf="OPENPAREN",Hf="CLOSEPAREN",Uf="OPENANGLEBRACKET",Wf="CLOSEANGLEBRACKET",Kf="FULLWIDTHLEFTPAREN",qf="FULLWIDTHRIGHTPAREN",Gf="LEFTCORNERBRACKET",Jf="RIGHTCORNERBRACKET",Qf="LEFTWHITECORNERBRACKET",Yf="RIGHTWHITECORNERBRACKET",Xf="FULLWIDTHLESSTHAN",Zf="FULLWIDTHGREATERTHAN",ep="AMPERSAND",tp="APOSTROPHE",np="ASTERISK",xo="AT",sp="BACKSLASH",rp="BACKTICK",ap="CARET",bo="COLON",Ry="COMMA",ip="DOLLAR",za="DOT",op="EQUALS",Ly="EXCLAMATION",Zr="HYPHEN",ru="PERCENT",lp="PIPE",cp="PLUS",dp="POUND",au="QUERY",Oy="QUOTE",YC="FULLWIDTHMIDDLEDOT",Dy="SEMI",$a="SLASH",iu="TILDE",up="UNDERSCORE",XC="EMOJI",hp="SYM";var ZC=Object.freeze({__proto__:null,ALPHANUMERICAL:QC,AMPERSAND:ep,APOSTROPHE:tp,ASCIINUMERICAL:JC,ASTERISK:np,AT:xo,BACKSLASH:sp,BACKTICK:rp,CARET:ap,CLOSEANGLEBRACKET:Wf,CLOSEBRACE:su,CLOSEBRACKET:Bf,CLOSEPAREN:Hf,COLON:bo,COMMA:Ry,DOLLAR:ip,DOT:za,EMOJI:XC,EQUALS:op,EXCLAMATION:Ly,FULLWIDTHGREATERTHAN:Zf,FULLWIDTHLEFTPAREN:Kf,FULLWIDTHLESSTHAN:Xf,FULLWIDTHMIDDLEDOT:YC,FULLWIDTHRIGHTPAREN:qf,HYPHEN:Zr,LEFTCORNERBRACKET:Gf,LEFTWHITECORNERBRACKET:Qf,LOCALHOST:bu,NL:Py,NUM:Iy,OPENANGLEBRACKET:Uf,OPENBRACE:nu,OPENBRACKET:Ff,OPENPAREN:Vf,PERCENT:ru,PIPE:lp,PLUS:cp,POUND:dp,QUERY:au,QUOTE:Oy,RIGHTCORNERBRACKET:Jf,RIGHTWHITECORNERBRACKET:Yf,SCHEME:df,SEMI:Dy,SLASH:$a,SLASH_SCHEME:Tc,SYM:hp,TILDE:iu,TLD:h0,UNDERSCORE:up,UTLD:f0,UWORD:u0,WORD:wi,WS:p0});const vi=/[a-z]/,Fd=new RegExp("\\p{L}","u"),cg=new RegExp("\\p{Emoji}","u"),Ni=/\d/,dg=/\s/,bw="\r",ug=` -`,oz="️",lz="‍",hg="";let Jh=null,Qh=null;function cz(t=[]){const e={};Nr.groups=e;const n=new Nr;Jh==null&&(Jh=vw(tz)),Qh==null&&(Qh=vw(nz)),Le(n,"'",tp),Le(n,"{",nu),Le(n,"}",su),Le(n,"[",Ff),Le(n,"]",Bf),Le(n,"(",Vf),Le(n,")",Hf),Le(n,"<",Uf),Le(n,">",Wf),Le(n,"(",Kf),Le(n,")",qf),Le(n,"「",Gf),Le(n,"」",Jf),Le(n,"『",Qf),Le(n,"』",Yf),Le(n,"<",Xf),Le(n,">",Zf),Le(n,"&",ep),Le(n,"*",np),Le(n,"@",xo),Le(n,"`",rp),Le(n,"^",ap),Le(n,":",bo),Le(n,",",Ry),Le(n,"$",ip),Le(n,".",za),Le(n,"=",op),Le(n,"!",Ly),Le(n,"-",Zr),Le(n,"%",ru),Le(n,"|",lp),Le(n,"+",cp),Le(n,"#",dp),Le(n,"?",au),Le(n,'"',Oy),Le(n,"/",$a),Le(n,";",Dy),Le(n,"~",iu),Le(n,"_",up),Le(n,"\\",sp),Le(n,"・",YC);const r=Ln(n,Ni,Iy,{[o0]:!0});Ln(r,Ni,r);const a=Ln(r,vi,JC,{[tu]:!0}),i=Ln(r,Fd,QC,{[Wd]:!0}),o=Ln(n,vi,wi,{[l0]:!0});Ln(o,Ni,a),Ln(o,vi,o),Ln(a,Ni,a),Ln(a,vi,a);const c=Ln(n,Fd,u0,{[c0]:!0});Ln(c,vi),Ln(c,Ni,i),Ln(c,Fd,c),Ln(i,Ni,i),Ln(i,vi),Ln(i,Fd,i);const u=Le(n,ug,Py,{[lg]:!0}),h=Le(n,bw,p0,{[lg]:!0}),f=Ln(n,dg,p0,{[lg]:!0});Le(n,hg,f),Le(h,ug,u),Le(h,hg,f),Ln(h,dg,f),Le(f,bw),Le(f,ug),Ln(f,dg,f),Le(f,hg,f);const m=Ln(n,cg,XC,{[GC]:!0});Le(m,"#"),Ln(m,cg,m),Le(m,oz,m);const x=Le(m,lz);Le(x,"#"),Ln(x,cg,m);const b=[[vi,o],[Ni,a]],v=[[vi,null],[Fd,c],[Ni,i]];for(let w=0;ww[0]>N[0]?1:-1);for(let w=0;w=0?T[d0]=!0:vi.test(N)?Ni.test(N)?T[tu]=!0:T[l0]=!0:T[o0]=!0,yw(n,N,N,T)}return yw(n,"localhost",bu,{ascii:!0}),n.jd=new Nr(hp),{start:n,tokens:Object.assign({groups:e},ZC)}}function e3(t,e){const n=dz(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,a=[];let i=0,o=0;for(;o=0&&(m+=n[o].length,x++),h+=n[o].length,i+=n[o].length,o++;i-=m,o-=x,h-=m,a.push({t:f.t,v:e.slice(i-h,i),s:i-h,e:i})}return a}function dz(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 uo(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 vu={defaultProtocol:"http",events:null,format:Nw,formatHref:Nw,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function _y(t,e=null){let n=Object.assign({},vu);t&&(n=Object.assign(n,t instanceof _y?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=vu.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 Hp(t,e){class n extends t3{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 ww=Hp("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),jw=Hp("text"),uz=Hp("nl"),Yh=Hp("url",{isLink:!0,toHref(t=vu.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==bu&&t[1].t===bo}}),Xr=t=>new Nr(t);function hz({groups:t}){const e=t.domain.concat([ep,np,xo,sp,rp,ap,ip,op,Zr,Iy,ru,lp,cp,dp,$a,hp,iu,up]),n=[tp,bo,Ry,za,Ly,ru,au,Oy,Dy,Uf,Wf,nu,su,Bf,Ff,Vf,Hf,Kf,qf,Gf,Jf,Qf,Yf,Xf,Zf],r=[ep,tp,np,sp,rp,ap,ip,op,Zr,nu,su,ru,lp,cp,dp,au,$a,hp,iu,up],a=Xr(),i=Le(a,iu);Mt(i,r,i),Mt(i,t.domain,i);const o=Xr(),c=Xr(),u=Xr();Mt(a,t.domain,o),Mt(a,t.scheme,c),Mt(a,t.slashscheme,u),Mt(o,r,i),Mt(o,t.domain,o);const h=Le(o,xo);Le(i,xo,h),Le(c,xo,h),Le(u,xo,h);const f=Le(i,za);Mt(f,r,i),Mt(f,t.domain,i);const m=Xr();Mt(h,t.domain,m),Mt(m,t.domain,m);const x=Le(m,za);Mt(x,t.domain,m);const b=Xr(ww);Mt(x,t.tld,b),Mt(x,t.utld,b),Le(h,bu,b);const v=Le(m,Zr);Le(v,Zr,v),Mt(v,t.domain,m),Mt(b,t.domain,m),Le(b,za,x),Le(b,Zr,v);const w=Le(b,bo);Mt(w,t.numeric,ww);const N=Le(o,Zr),k=Le(o,za);Le(N,Zr,N),Mt(N,t.domain,o),Mt(k,r,i),Mt(k,t.domain,o);const T=Xr(Yh);Mt(k,t.tld,T),Mt(k,t.utld,T),Mt(T,t.domain,o),Mt(T,r,i),Le(T,za,k),Le(T,Zr,N),Le(T,xo,h);const C=Le(T,bo),P=Xr(Yh);Mt(C,t.numeric,P);const L=Xr(Yh),q=Xr();Mt(L,e,L),Mt(L,n,q),Mt(q,e,L),Mt(q,n,q),Le(T,$a,L),Le(P,$a,L);const z=Le(c,bo),H=Le(u,bo),R=Le(H,$a),se=Le(R,$a);Mt(c,t.domain,o),Le(c,za,k),Le(c,Zr,N),Mt(u,t.domain,o),Le(u,za,k),Le(u,Zr,N),Mt(z,t.domain,L),Le(z,$a,L),Le(z,au,L),Mt(se,t.domain,L),Mt(se,e,L),Le(se,$a,L);const X=[[nu,su],[Ff,Bf],[Vf,Hf],[Uf,Wf],[Kf,qf],[Gf,Jf],[Qf,Yf],[Xf,Zf]];for(let V=0;V=0&&x++,a++,f++;if(x<0)a-=f,a0&&(i.push(fg(jw,e,o)),o=[]),a-=x,f-=x;const b=m.t,v=n.slice(a-f,a);i.push(fg(b,e,v))}}return o.length>0&&i.push(fg(jw,e,o)),i}function fg(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 pz=typeof console<"u"&&console&&console.warn||(()=>{}),mz="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",gn={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function xz(){return Nr.groups={},gn.scanner=null,gn.parser=null,gn.tokenQueue=[],gn.pluginQueue=[],gn.customSchemes=[],gn.initialized=!1,gn}function kw(t,e=!1){if(gn.initialized&&pz(`linkifyjs: already initialized - will not register custom scheme "${t}" ${mz}`),!/^[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`);gn.customSchemes.push([t,e])}function gz(){gn.scanner=cz(gn.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=fC(n.doc,[...e]);if(NC(c).forEach(({newRange:h})=>{const f=ND(r.doc,h,b=>b.isTextblock);let m,x;if(f.length>1)m=f[0],x=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(f.length){const b=r.doc.textBetween(h.from,h.to," "," ");if(!bz.test(b))return;m=f[0],x=r.doc.textBetween(m.pos,h.to,void 0," ")}if(m&&x){const b=x.split(yz).filter(Boolean);if(b.length<=0)return!1;const v=b[b.length-1],w=m.pos+x.lastIndexOf(v);if(!v)return!1;const N=zy(v).map(k=>k.toObject(t.defaultProtocol));if(!Nz(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=>{Sy(k.from,k.to,r.doc).some(T=>T.mark.type===t.type)||o.addMark(k.from,k.to,t.type.create({href:k.href}))})}}),!!o.steps.length)return o}})}function jz(t){return new pn({key:new Cn("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=vC(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 kz(t){return new pn({key:new Cn("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=n3(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 ul(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(vz,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Sz=Hl.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"){kw(t);return}kw(t.scheme,t.optionalSlashes)})},onDestroy(){xz()},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)=>!!ul(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=>!!ul(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=>!!ul(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Xt(this.options.HTMLAttributes,t),0]:["a",Xt(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=>!!ul(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=>!!ul(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[Dl({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,a=n3(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!ul(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(wz({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:a=>!!ul(a,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(jz({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(kz({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),Cz=Object.defineProperty,Ez=(t,e)=>{for(var n in e)Cz(t,n,{get:e[n],enumerable:!0})},Tz="listItem",Sw="textStyle",Cw=/^\s*([-+*])\s$/,s3=qn.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",Xt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` -`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Tz,this.editor.getAttributes(Sw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Jc({find:Cw,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Jc({find:Cw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Sw),editor:this.editor})),[t]}}),r3=qn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Xt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(a=>a.type==="paragraph"))n=e.parseChildren(t.tokens);else{const a=t.tokens[0];if(a&&a.type==="text"&&a.tokens&&a.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(a.tokens)}],t.tokens.length>1){const o=t.tokens.slice(1),c=e.parseChildren(o);n.push(...c)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>My(t,e,r=>{var a,i;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((i=(a=r.meta)==null?void 0:a.parentAttrs)==null?void 0:i.start)||1)+r.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Mz={};Ez(Mz,{findListItemPos:()=>Au,getNextListDepth:()=>Fy,handleBackspace:()=>m0,handleDelete:()=>x0,hasListBefore:()=>a3,hasListItemAfter:()=>Az,hasListItemBefore:()=>i3,listItemHasSubList:()=>o3,nextListIsDeeper:()=>l3,nextListIsHigher:()=>c3});var Au=(t,e)=>{const{$from:n}=e.selection,r=Zn(t,e.schema);let a=null,i=n.depth,o=n.pos,c=null;for(;i>0&&c===null;)a=n.node(i),a.type===r?c=i:(i-=1,o-=1);return c===null?null:{$pos:e.doc.resolve(o),depth:c}},Fy=(t,e)=>{const n=Au(t,e);if(!n)return!1;const[,r]=ID(e,t,n.$pos.pos+4);return r},a3=(t,e,n)=>{const{$anchor:r}=t.selection,a=Math.max(0,r.pos-2),i=t.doc.resolve(a).node();return!(!i||!n.includes(i.type.name))},i3=(t,e)=>{var n;const{$anchor:r}=e.selection,a=e.doc.resolve(r.pos-2);return!(a.index()===0||((n=a.nodeBefore)==null?void 0:n.type.name)!==t)},o3=(t,e,n)=>{if(!n)return!1;const r=Zn(t,e.schema);let a=!1;return n.descendants(i=>{i.type===r&&(a=!0)}),a},m0=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Do(t.state,e)&&a3(t.state,e,n)){const{$anchor:c}=t.state.selection,u=t.state.doc.resolve(c.before()-1),h=[];u.node().descendants((x,b)=>{x.type.name===e&&h.push({node:x,pos:b})});const f=h.at(-1);if(!f)return!1;const m=t.state.doc.resolve(u.start()+f.pos+1);return t.chain().cut({from:c.start()-1,to:c.end()+1},m.end()).joinForward().run()}if(!Do(t.state,e)||!OD(t.state))return!1;const r=Au(e,t.state);if(!r)return!1;const i=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=o3(e,t.state,i);return i3(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},l3=(t,e)=>{const n=Fy(t,e),r=Au(t,e);return!r||!n?!1:n>r.depth},c3=(t,e)=>{const n=Fy(t,e),r=Au(t,e);return!r||!n?!1:n{if(!Do(t.state,e)||!LD(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:a}=n;return!n.empty&&r.sameParent(a)?!1:l3(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():c3(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},Az=(t,e)=>{var n;const{$anchor:r}=e.selection,a=e.doc.resolve(r.pos-r.parentOffset-2);return!(a.index()===a.parent.childCount-1||((n=a.nodeAfter)==null?void 0:n.type.name)!==t)},d3=zn.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&x0(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&x0(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&m0(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&m0(t,n,r)&&(e=!0)}),e}}}}),Ew=/^(\s*)(\d+)\.\s+(.*)$/,Iz=/^\s/;function Pz(t){const e=[];let n=0,r=0;for(;ne;)x.push(t[m]),m+=1;if(x.length>0){const b=Math.min(...x.map(w=>w.indent)),v=u3(x,b,n);h.push({type:"list",ordered:!0,start:x[0].number,items:v,raw:x.map(w=>w.raw).join(` -`)})}a.push({type:"list_item",raw:o.raw,tokens:h}),i=m}else i+=1}return a}function Rz(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(a=>{if(a.type==="paragraph"||a.type==="list"||a.type==="blockquote"||a.type==="code")r.push(...e.parseChildren([a]));else if(a.type==="text"&&a.tokens){const i=e.parseChildren([a]);r.push({type:"paragraph",content:i})}else{const i=e.parseChildren([a]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var Lz="listItem",Tw="textStyle",Mw=/^(\d+)\.\s$/,h3=qn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Xt(this.options.HTMLAttributes,n),0]:["ol",Xt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?Rz(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` -`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e==null?void 0:e.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const a=t.split(` -`),[i,o]=Pz(a);if(i.length===0)return;const c=u3(i,0,n);return c.length===0?void 0:{type:"list",ordered:!0,start:((r=i[0])==null?void 0:r.number)||1,items:c,raw:a.slice(0,o).join(` -`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Lz,this.editor.getAttributes(Tw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Jc({find:Mw,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Jc({find:Mw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Tw)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),Oz=/^\s*(\[([( |x])?\])\s$/,Dz=qn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Xt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const a=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return My(t,e,a)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const a=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),c=document.createElement("input"),u=document.createElement("div"),h=m=>{var x,b;c.ariaLabel=((b=(x=this.options.a11y)==null?void 0:x.checkboxLabel)==null?void 0:b.call(x,m,c.checked))||`Task item checkbox for ${m.textContent||"empty task item"}`};h(t),i.contentEditable="false",c.type="checkbox",c.addEventListener("mousedown",m=>m.preventDefault()),c.addEventListener("change",m=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){c.checked=!c.checked;return}const{checked:x}=m.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:b})=>{const v=n();if(typeof v!="number")return!1;const w=b.doc.nodeAt(v);return b.setNodeMarkup(v,void 0,{...w==null?void 0:w.attrs,checked:x}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,x)||(c.checked=!c.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([m,x])=>{a.setAttribute(m,x)}),a.dataset.checked=t.attrs.checked,c.checked=t.attrs.checked,i.append(c,o),a.append(i,u),Object.entries(e).forEach(([m,x])=>{a.setAttribute(m,x)});let f=new Set(Object.keys(e));return{dom:a,contentDOM:u,update:m=>{if(m.type!==this.type)return!1;a.dataset.checked=m.attrs.checked,c.checked=m.attrs.checked,h(m);const x=r.extensionManager.attributes,b=yu(m,x),v=new Set(Object.keys(b)),w=this.options.HTMLAttributes;return f.forEach(N=>{v.has(N)||(N in w?a.setAttribute(N,w[N]):a.removeAttribute(N))}),Object.entries(b).forEach(([N,k])=>{k==null?N in w?a.setAttribute(N,w[N]):a.removeAttribute(N):a.setAttribute(N,k)}),f=v,!0}}}},addInputRules(){return[Jc({find:Oz,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),_z=qn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",Xt(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` -`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=i=>{const o=a0(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:c=>({indentLevel:c[1].length,mainContent:c[4],checked:c[3].toLowerCase()==="x"}),createToken:(c,u)=>({type:"taskItem",raw:"",mainContent:c.mainContent,indentLevel:c.indentLevel,checked:c.checked,text:c.mainContent,tokens:n.inlineTokens(c.mainContent),nestedTokens:u}),customNestedParser:r},n);return o?[{type:"taskList",raw:o.raw,items:o.items}]:n.blockTokens(i)},a=a0(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},n);if(a)return{type:"taskList",raw:a.raw,items:a.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});zn.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(s3.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(r3.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(d3.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(h3.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Dz.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(_z.configure(this.options.taskList)),t}});var Aw=" ",zz=" ",$z=qn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Xt(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return r.length===1&&r[0].type==="text"&&(r[0].text===Aw||r[0].text===zz)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e)=>{if(!t)return"";const n=Array.isArray(t.content)?t.content:[];return n.length===0?Aw:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Fz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Bz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Vz=Hl.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Xt(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Gc({find:Fz,type:this.type})]},addPasteRules(){return[Dl({find:Bz,type:this.type})]}}),Hz=qn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),Uz=Hl.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",Xt(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const a=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!a)return;const i=a[2].trim();return{type:"underline",raw:a[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Wz(t={}){return new pn({view(e){return new Kz(e,t)}})}class Kz{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(a=>{let i=o=>{this[a](o)};return e.dom.addEventListener(a,i),{name:a,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,a=this.editorView.dom,i=a.getBoundingClientRect(),o=i.width/a.offsetWidth,c=i.height/a.offsetHeight;if(n){let m=e.nodeBefore,x=e.nodeAfter;if(m||x){let b=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(b){let v=b.getBoundingClientRect(),w=m?v.bottom:v.top;m&&x&&(w=(w+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let N=this.width/2*c;r={left:v.left,right:v.right,top:w-N,bottom:w+N}}}}if(!r){let m=this.editorView.coordsAtPos(this.cursorPos),x=this.width/2*o;r={left:m.left-x,right:m.left+x,top:m.top,bottom:m.bottom}}let u=this.editorView.dom.offsetParent;this.element||(this.element=u.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let h,f;if(!u||u==document.body&&getComputedStyle(u).position=="static")h=-pageXOffset,f=-pageYOffset;else{let m=u.getBoundingClientRect(),x=m.width/u.offsetWidth,b=m.height/u.offsetHeight;h=m.left-u.scrollLeft*x,f=m.top-u.scrollTop*b}this.element.style.left=(r.left-h)/o+"px",this.element.style.top=(r.top-f)/c+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/c+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),a=r&&r.type.spec.disableDropCursor,i=typeof a=="function"?a(this.editorView,n,e):a;if(n&&!i){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=aS(this.editorView.state.doc,o,this.editorView.dragging.slice);c!=null&&(o=c)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Dn extends gt{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Dn.valid(r)?new Dn(r):gt.near(r)}content(){return Be.empty}eq(e){return e instanceof Dn&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Dn(e.resolve(n.pos))}getBookmark(){return new By(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!qz(e)||!Gz(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let a=n.contentMatchAt(e.index()).defaultType;return a&&a.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Dn.valid(e))return e;let a=e.pos,i=null;for(let o=e.depth;;o--){let c=e.node(o);if(n>0?e.indexAfter(o)0){i=c.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;a+=n;let u=e.doc.resolve(a);if(Dn.valid(u))return u}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!ot.isSelectable(i)){e=e.doc.resolve(a+i.nodeSize*n),r=!1;continue e}break}i=o,a+=n;let c=e.doc.resolve(a);if(Dn.valid(c))return c}return null}}}Dn.prototype.visible=!1;Dn.findFrom=Dn.findGapCursorFrom;gt.jsonID("gapcursor",Dn);class By{constructor(e){this.pos=e}map(e){return new By(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Dn.valid(n)?new Dn(n):gt.near(n)}}function f3(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function qz(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let a=r.child(n-1);;a=a.lastChild){if(a.childCount==0&&!a.inlineContent||f3(a.type))return!0;if(a.inlineContent)return!1}}return!0}function Gz(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let a=r.child(n);;a=a.firstChild){if(a.childCount==0&&!a.inlineContent||f3(a.type))return!0;if(a.inlineContent)return!1}}return!0}function Jz(){return new pn({props:{decorations:Zz,createSelectionBetween(t,e,n){return e.pos==n.pos&&Dn.valid(n)?new Dn(n):null},handleClick:Yz,handleKeyDown:Qz,handleDOMEvents:{beforeinput:Xz}}})}const Qz=by({ArrowLeft:Xh("horiz",-1),ArrowRight:Xh("horiz",1),ArrowUp:Xh("vert",-1),ArrowDown:Xh("vert",1)});function Xh(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,a,i){let o=r.selection,c=e>0?o.$to:o.$from,u=o.empty;if(o instanceof lt){if(!i.endOfTextblock(n)||c.depth==0)return!1;u=!1,c=r.doc.resolve(e>0?c.after():c.before())}let h=Dn.findGapCursorFrom(c,e,u);return h?(a&&a(r.tr.setSelection(new Dn(h))),!0):!1}}function Yz(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Dn.valid(r))return!1;let a=t.posAtCoords({left:n.clientX,top:n.clientY});return a&&a.inside>-1&&ot.isSelectable(t.state.doc.nodeAt(a.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Dn(r))),!0)}function Xz(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Dn))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let a=Ee.empty;for(let o=r.length-1;o>=0;o--)a=Ee.from(r[o].createAndFill(null,a));let i=t.state.tr.replace(n.pos,n.pos,new Be(a,0,0));return i.setSelection(lt.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function Zz(t){if(!(t.selection instanceof Dn))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ln.create(t.doc,[as.widget(t.selection.head,e,{key:"gapcursor"})])}var fp=200,Ns=function(){};Ns.prototype.append=function(e){return e.length?(e=Ns.from(e),!this.length&&e||e.length=n?Ns.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Ns.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Ns.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Ns.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var a=[];return this.forEach(function(i,o){return a.push(e(i,o))},n,r),a};Ns.from=function(e){return e instanceof Ns?e:e&&e.length?new p3(e):Ns.empty};var p3=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(a,i){return a==0&&i==this.length?this:new e(this.values.slice(a,i))},e.prototype.getInner=function(a){return this.values[a]},e.prototype.forEachInner=function(a,i,o,c){for(var u=i;u=o;u--)if(a(this.values[u],c+u)===!1)return!1},e.prototype.leafAppend=function(a){if(this.length+a.length<=fp)return new e(this.values.concat(a.flatten()))},e.prototype.leafPrepend=function(a){if(this.length+a.length<=fp)return new e(a.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Ns);Ns.empty=new p3([]);var e$=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return rc&&this.right.forEachInner(r,Math.max(a-c,0),Math.min(this.length,i)-c,o+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,a,i,o){var c=this.left.length;if(a>c&&this.right.forEachInvertedInner(r,a-c,Math.max(i,c)-c,o+c)===!1||i=i?this.right.slice(r-i,a-i):this.left.slice(r,i).append(this.right.slice(0,a-i))},e.prototype.leafAppend=function(r){var a=this.right.leafAppend(r);if(a)return new e(this.left,a)},e.prototype.leafPrepend=function(r){var a=this.left.leafPrepend(r);if(a)return new e(a,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Ns);const t$=500;class ba{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let a,i;n&&(a=this.remapping(r,this.items.length),i=a.maps.length);let o=e.tr,c,u,h=[],f=[];return this.items.forEach((m,x)=>{if(!m.step){a||(a=this.remapping(r,x+1),i=a.maps.length),i--,f.push(m);return}if(a){f.push(new ho(m.map));let b=m.step.map(a.slice(i)),v;b&&o.maybeStep(b).doc&&(v=o.mapping.maps[o.mapping.maps.length-1],h.push(new ho(v,void 0,void 0,h.length+f.length))),i--,v&&a.appendMap(v,i)}else o.maybeStep(m.step);if(m.selection)return c=a?m.selection.map(a.slice(i)):m.selection,u=new ba(this.items.slice(0,r).append(f.reverse().concat(h)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:o,selection:c}}addTransform(e,n,r,a){let i=[],o=this.eventCount,c=this.items,u=!a&&c.length?c.get(c.length-1):null;for(let f=0;fs$&&(c=n$(c,h),o-=h),new ba(c.append(i),o)}remapping(e,n){let r=new hu;return this.items.forEach((a,i)=>{let o=a.mirrorOffset!=null&&i-a.mirrorOffset>=e?r.maps.length-a.mirrorOffset:void 0;r.appendMap(a.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new ba(this.items.append(e.map(n=>new ho(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],a=Math.max(0,this.items.length-n),i=e.mapping,o=e.steps.length,c=this.eventCount;this.items.forEach(x=>{x.selection&&c--},a);let u=n;this.items.forEach(x=>{let b=i.getMirror(--u);if(b==null)return;o=Math.min(o,b);let v=i.maps[b];if(x.step){let w=e.steps[b].invert(e.docs[b]),N=x.selection&&x.selection.map(i.slice(u+1,b));N&&c++,r.push(new ho(v,w,N))}else r.push(new ho(v))},a);let h=[];for(let x=n;xt$&&(m=m.compress(this.items.length-r.length)),m}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,a=[],i=0;return this.items.forEach((o,c)=>{if(c>=e)a.push(o),o.selection&&i++;else if(o.step){let u=o.step.map(n.slice(r)),h=u&&u.getMap();if(r--,h&&n.appendMap(h,r),u){let f=o.selection&&o.selection.map(n.slice(r));f&&i++;let m=new ho(h.invert(),u,f),x,b=a.length-1;(x=a.length&&a[b].merge(m))?a[b]=x:a.push(m)}}else o.map&&r--},this.items.length,0),new ba(Ns.from(a.reverse()),i)}}ba.empty=new ba(Ns.empty,0);function n$(t,e){let n;return t.forEach((r,a)=>{if(r.selection&&e--==0)return n=a,!1}),t.slice(n)}let ho=class m3{constructor(e,n,r,a){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=a}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new m3(n.getMap().invert(),n,this.selection)}}};class go{constructor(e,n,r,a,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=a,this.prevComposition=i}}const s$=20;function r$(t,e,n,r){let a=n.getMeta(kl),i;if(a)return a.historyState;n.getMeta(o$)&&(t=new go(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(kl))return o.getMeta(kl).redo?new go(t.done.addTransform(n,void 0,r,uf(e)),t.undone,Iw(n.mapping.maps),t.prevTime,t.prevComposition):new go(t.done,t.undone.addTransform(n,void 0,r,uf(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let c=n.getMeta("composition"),u=t.prevTime==0||!o&&t.prevComposition!=c&&(t.prevTime<(n.time||0)-r.newGroupDelay||!a$(n,t.prevRanges)),h=o?pg(t.prevRanges,n.mapping):Iw(n.mapping.maps);return new go(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,uf(e)),ba.empty,h,n.time,c??t.prevComposition)}else return(i=n.getMeta("rebased"))?new go(t.done.rebased(n,i),t.undone.rebased(n,i),pg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new go(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),pg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function a$(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,a)=>{for(let i=0;i=e[i]&&(n=!0)}),n}function Iw(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,a,i,o)=>e.push(i,o));return e}function pg(t,e){if(!t)return null;let n=[];for(let r=0;r{let a=kl.getState(n);if(!a||(t?a.undone:a.done).eventCount==0)return!1;if(r){let i=i$(a,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const g3=x3(!1,!0),y3=x3(!0,!0);zn.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new pn({key:new Cn("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const a=this.options.limit;if(a==null||a===0){t=!0;return}const i=this.storage.characters({node:r.doc});if(i>a){const o=i-a,c=0,u=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${a} characters. Content was automatically trimmed.`);const h=r.tr.deleteRange(c,u);return t=!0,h}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const a=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||a>r&&i>r&&i<=a)return!0;if(a>r&&i>r&&i>a||!e.getMeta("paste"))return!1;const c=e.selection.$head.pos,u=i-r,h=c-u,f=c;return e.deleteRange(h,f),!(this.storage.characters({node:e.doc})>r)}})]}});var c$=zn.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Wz(this.options)]}});zn.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new pn({key:new Cn("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:a}=e,i=[];if(!n||!r)return ln.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((u,h)=>{if(u.isText)return;if(!(a>=h&&a<=h+u.nodeSize-1))return!1;o+=1});let c=0;return t.descendants((u,h)=>{if(u.isText||!(a>=h&&a<=h+u.nodeSize-1))return!1;if(c+=1,this.options.mode==="deepest"&&o-c>0||this.options.mode==="shallowest"&&c>1)return this.options.mode==="deepest";i.push(as.node(h,h+u.nodeSize,{class:this.options.className}))}),ln.create(t,i)}}})]}});var d$=zn.create({name:"gapCursor",addProseMirrorPlugins(){return[Jz()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Yt(at(t,"allowGapCursor",n)))!=null?e:null}}}),Rw="placeholder";function u$(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var h$=zn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Rw,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${u$(this.options.dataAttribute)}`:`data-${Rw}`;return[new pn({key:new Cn("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:a}=n,i=[];if(!r)return null;const o=this.editor.isEmpty;return e.descendants((c,u)=>{const h=a>=u&&a<=u+c.nodeSize,f=!c.isLeaf&&Fp(c);if((h||!this.options.showOnlyCurrent)&&f){const m=[this.options.emptyNodeClass];o&&m.push(this.options.emptyEditorClass);const x=as.node(u,u+c.nodeSize,{class:m.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:c,pos:u,hasAnchor:h}):this.options.placeholder});i.push(x)}return this.options.includeChildren}),ln.create(e,i)}}})]}});zn.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new pn({key:new Cn("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||wC(n.selection)||t.view.dragging?null:ln.create(n.doc,[as.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Lw({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var f$=zn.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Cn(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,a])=>a).filter(a=>(this.options.notAfter||[]).concat(n).includes(a.name));return[new pn({key:e,appendTransaction:(a,i,o)=>{const{doc:c,tr:u,schema:h}=o,f=e.getState(o),m=c.content.size,x=h.nodes[n];if(f)return u.insert(m,x.create())},state:{init:(a,i)=>{const o=i.tr.doc.lastChild;return!Lw({node:o,types:r})},apply:(a,i)=>{if(!a.docChanged||a.getMeta("__uniqueIDTransaction"))return i;const o=a.doc.lastChild;return!Lw({node:o,types:r})}}})]}}),p$=zn.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>g3(t,e),redo:()=>({state:t,dispatch:e})=>y3(t,e)}},addProseMirrorPlugins(){return[l$(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),m$=zn.create({name:"starterKit",addExtensions(){var t,e,n,r;const a=[];return this.options.bold!==!1&&a.push($7.configure(this.options.bold)),this.options.blockquote!==!1&&a.push(L7.configure(this.options.blockquote)),this.options.bulletList!==!1&&a.push(s3.configure(this.options.bulletList)),this.options.code!==!1&&a.push(V7.configure(this.options.code)),this.options.codeBlock!==!1&&a.push(W7.configure(this.options.codeBlock)),this.options.document!==!1&&a.push(K7.configure(this.options.document)),this.options.dropcursor!==!1&&a.push(c$.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&a.push(d$.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&a.push(q7.configure(this.options.hardBreak)),this.options.heading!==!1&&a.push(G7.configure(this.options.heading)),this.options.undoRedo!==!1&&a.push(p$.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&a.push(J7.configure(this.options.horizontalRule)),this.options.italic!==!1&&a.push(ez.configure(this.options.italic)),this.options.listItem!==!1&&a.push(r3.configure(this.options.listItem)),this.options.listKeymap!==!1&&a.push(d3.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&a.push(Sz.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&a.push(h3.configure(this.options.orderedList)),this.options.paragraph!==!1&&a.push($z.configure(this.options.paragraph)),this.options.strike!==!1&&a.push(Vz.configure(this.options.strike)),this.options.text!==!1&&a.push(Hz.configure(this.options.text)),this.options.underline!==!1&&a.push(Uz.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&a.push(f$.configure((r=this.options)==null?void 0:r.trailingNode)),a}}),x$=m$,g$=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,y$=qn.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",Xt(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,a,i,o;const c=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",u=(a=(r=t.attrs)==null?void 0:r.alt)!=null?a:"",h=(o=(i=t.attrs)==null?void 0:i.title)!=null?o:"";return h?`![${u}](${c} "${h}")`:`![${u}](${c})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:a,getPos:i,HTMLAttributes:o,editor:c})=>{const u=document.createElement("img");Object.entries(o).forEach(([m,x])=>{if(x!=null)switch(m){case"width":case"height":break;default:u.setAttribute(m,x);break}}),u.src=o.src;const h=new N_({element:u,editor:c,node:a,getPos:i,onResize:(m,x)=>{u.style.width=`${m}px`,u.style.height=`${x}px`},onCommit:(m,x)=>{const b=i();b!==void 0&&this.editor.chain().setNodeSelection(b).updateAttributes(this.name,{width:m,height:x}).run()},onUpdate:(m,x,b)=>m.type===a.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),f=h.dom;return f.style.visibility="hidden",f.style.pointerEvents="none",u.onload=()=>{f.style.visibility="",f.style.pointerEvents=""},h}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[$C({find:g$,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),b$=y$;function v$(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:o,$position:c}=t,u=r&&!a,h=j_(n),f=new RegExp(`\\s${h}$`),m=o?"^":"",x=a?"":h,b=u?new RegExp(`${m}${h}.*?(?=\\s${x}|$)`,"gm"):new RegExp(`${m}(?:^)?${h}[^\\s${x}]*`,"gm"),v=((e=c.nodeBefore)==null?void 0:e.isText)&&c.nodeBefore.text;if(!v)return null;const w=c.pos-v.length,N=Array.from(v.matchAll(b)).pop();if(!N||N.input===void 0||N.index===void 0)return null;const k=N.input.slice(Math.max(0,N.index-1),N.index),T=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(k);if(i!==null&&!T)return null;const C=w+N.index;let P=C+N[0].length;return u&&f.test(v.slice(P-1,P+1))&&(N[0]+=" ",P+=1),C=c.pos?{range:{from:C,to:P},query:N[0].slice(n.length),text:N[0]}:null}var N$=new Cn("suggestion");function w$({pluginKey:t=N$,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:a=!1,allowedPrefixes:i=[" "],startOfLine:o=!1,decorationTag:c="span",decorationClass:u="suggestion",decorationContent:h="",decorationEmptyClass:f="is-empty",command:m=()=>null,items:x=()=>[],render:b=()=>({}),allow:v=()=>!0,findSuggestionMatch:w=v$,shouldShow:N}){let k;const T=b==null?void 0:b(),C=()=>{const z=e.state.selection.$anchor.pos,H=e.view.coordsAtPos(z),{top:R,right:se,bottom:X,left:V}=H;try{return new DOMRect(V,R,se-V,X-R)}catch{return null}},P=(z,H)=>H?()=>{const R=t.getState(e.state),se=R==null?void 0:R.decorationId,X=z.dom.querySelector(`[data-decoration-id="${se}"]`);return(X==null?void 0:X.getBoundingClientRect())||null}:C;function L(z,H){var R;try{const X=t.getState(z.state),V=X!=null&&X.decorationId?z.dom.querySelector(`[data-decoration-id="${X.decorationId}"]`):null,ie={editor:e,range:(X==null?void 0:X.range)||{from:0,to:0},query:(X==null?void 0:X.query)||null,text:(X==null?void 0:X.text)||null,items:[],command:le=>m({editor:e,range:(X==null?void 0:X.range)||{from:0,to:0},props:le}),decorationNode:V,clientRect:P(z,V)};(R=T==null?void 0:T.onExit)==null||R.call(T,ie)}catch{}const se=z.state.tr.setMeta(H,{exit:!0});z.dispatch(se)}const q=new pn({key:t,view(){return{update:async(z,H)=>{var R,se,X,V,ie,le,he;const I=(R=this.key)==null?void 0:R.getState(H),Q=(se=this.key)==null?void 0:se.getState(z.state),$=I.active&&Q.active&&I.range.from!==Q.range.from,xe=!I.active&&Q.active,Z=I.active&&!Q.active,F=!xe&&!Z&&I.query!==Q.query,U=xe||$&&F,pe=F||$,fe=Z||$&&F;if(!U&&!pe&&!fe)return;const oe=fe&&!U?I:Q,D=z.dom.querySelector(`[data-decoration-id="${oe.decorationId}"]`);k={editor:e,range:oe.range,query:oe.query,text:oe.text,items:[],command:K=>m({editor:e,range:oe.range,props:K}),decorationNode:D,clientRect:P(z,D)},U&&((X=T==null?void 0:T.onBeforeStart)==null||X.call(T,k)),pe&&((V=T==null?void 0:T.onBeforeUpdate)==null||V.call(T,k)),(pe||U)&&(k.items=await x({editor:e,query:oe.query})),fe&&((ie=T==null?void 0:T.onExit)==null||ie.call(T,k)),pe&&((le=T==null?void 0:T.onUpdate)==null||le.call(T,k)),U&&((he=T==null?void 0:T.onStart)==null||he.call(T,k))},destroy:()=>{var z;k&&((z=T==null?void 0:T.onExit)==null||z.call(T,k))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(z,H,R,se){const{isEditable:X}=e,{composing:V}=e.view,{selection:ie}=z,{empty:le,from:he}=ie,I={...H},Q=z.getMeta(t);if(Q&&Q.exit)return I.active=!1,I.decorationId=null,I.range={from:0,to:0},I.query=null,I.text=null,I;if(I.composing=V,X&&(le||e.view.composing)){(heH.range.to)&&!V&&!H.composing&&(I.active=!1);const $=w({char:n,allowSpaces:r,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:o,$position:ie.$from}),xe=`id_${Math.floor(Math.random()*4294967295)}`;$&&v({editor:e,state:se,range:$.range,isActive:H.active})&&(!N||N({editor:e,range:$.range,query:$.query,text:$.text,transaction:z}))?(I.active=!0,I.decorationId=H.decorationId?H.decorationId:xe,I.range=$.range,I.query=$.query,I.text=$.text):I.active=!1}else I.active=!1;return I.active||(I.decorationId=null,I.range={from:0,to:0},I.query=null,I.text=null),I}},props:{handleKeyDown(z,H){var R,se,X,V;const{active:ie,range:le}=q.getState(z.state);if(!ie)return!1;if(H.key==="Escape"||H.key==="Esc"){const I=q.getState(z.state),Q=(R=k==null?void 0:k.decorationNode)!=null?R:null,$=Q??(I!=null&&I.decorationId?z.dom.querySelector(`[data-decoration-id="${I.decorationId}"]`):null);if(((se=T==null?void 0:T.onKeyDown)==null?void 0:se.call(T,{view:z,event:H,range:I.range}))||!1)return!0;const Z={editor:e,range:I.range,query:I.query,text:I.text,items:[],command:F=>m({editor:e,range:I.range,props:F}),decorationNode:$,clientRect:$?()=>$.getBoundingClientRect()||null:null};return(X=T==null?void 0:T.onExit)==null||X.call(T,Z),L(z,t),!0}return((V=T==null?void 0:T.onKeyDown)==null?void 0:V.call(T,{view:z,event:H,range:le}))||!1},decorations(z){const{active:H,range:R,decorationId:se,query:X}=q.getState(z);if(!H)return null;const V=!(X!=null&&X.length),ie=[u];return V&&ie.push(f),ln.create(z.doc,[as.inline(R.from,R.to,{nodeName:c,class:ie.join(" "),"data-decoration-id":se,"data-decoration-content":h})])}}});return q}function j$({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const a=new Cn;return{editor:t,char:r,pluginKey:a,command:({editor:i,range:o,props:c})=>{var u,h,f;const m=i.view.state.selection.$to.nodeAfter;((u=m==null?void 0:m.text)==null?void 0:u.startsWith(" "))&&(o.to+=1),i.chain().focus().insertContentAt(o,[{type:n,attrs:{...c,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(f=(h=i.view.dom.ownerDocument.defaultView)==null?void 0:h.getSelection())==null||f.collapseToEnd()},allow:({state:i,range:o})=>{const c=i.doc.resolve(o.from),u=i.schema.nodes[n];return!!c.parent.type.contentMatch.matchType(u)},...e}}function b3(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>j$({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function Ow(t,e){const n=b3(t),r=n.find(a=>a.char===e);return r||(n.length?n[0]:null)}var k$=qn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!=null?n:"@"}${(r=t.attrs.label)!=null?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,a;return["span",Xt(this.HTMLAttributes,t.HTMLAttributes),`${(r=n==null?void 0:n.char)!=null?r:"@"}${(a=e.attrs.label)!=null?a:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=Ow(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Xt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=Xt({"data-type":this.name},this.options.HTMLAttributes,e);const a=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof a=="string"?["span",Xt({"data-type":this.name},this.options.HTMLAttributes,e),a]:a},...FC({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:t=>{const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,a,i,o]=r,c=i??o;e[a==="char"?"mentionSuggestionChar":a]=c,r=n.exec(t)}return e},serializeAttributes:t=>Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e==="mentionSuggestionChar"?"char":e}="${n}"`).join(" ")}),renderText({node:t}){const e={options:this.options,node:t,suggestion:Ow(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:a,anchor:i}=r;if(!a)return!1;let o=new Mi,c=0;return e.doc.nodesBetween(i-1,i,(u,h)=>{if(u.type.name===this.name)return n=!0,o=u,c=h,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":o.attrs.mentionSuggestionChar,c,c+o.nodeSize),n})}},addProseMirrorPlugins(){return b3(this).map(w$)}}),S$=k$,C$=h$;let g0,y0;if(typeof WeakMap<"u"){let t=new WeakMap;g0=e=>t.get(e),y0=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;g0=r=>{for(let a=0;a(n==10&&(n=0),t[n++]=r,t[n++]=a)}var _n=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e=n){(i||(i=[])).push({type:"overlong_rowspan",pos:f,n:k-C});break}const P=a+C*e;for(let L=0;Lr&&(i+=h.attrs.colspan)}}for(let o=0;o1&&(n=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function M$(t,e,n){t.problems||(t.problems=[]);const r={};for(let a=0;a0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function I$(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function Sa(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function Up(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=_l(e.$head)||P$(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function P$(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function b0(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function R$(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Vy(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function v3(t,e,n){const r=t.node(-1),a=_n.get(r),i=t.start(-1),o=a.nextCell(t.pos-i,e,n);return o==null?null:t.node(0).resolve(i+o)}function zl(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(a=>a>0)||(r.colwidth=null)),r}function N3(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let a=0;af!=n.pos-i);u.unshift(n.pos-i);const h=u.map(f=>{const m=r.nodeAt(f);if(!m)throw new RangeError(`No cell with offset ${f} found`);const x=i+f+1;return new dS(c.resolve(x),c.resolve(x+m.content.size))});super(h[0].$from,h[0].$to,h),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),a=e.resolve(n.map(this.$headCell.pos));if(b0(r)&&b0(a)&&Vy(r,a)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?ji.rowSelection(r,a):i&&this.isColSelection()?ji.colSelection(r,a):new ji(r,a)}return lt.between(r,a)}content(){const e=this.$anchorCell.node(-1),n=_n.get(e),r=this.$anchorCell.start(-1),a=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},o=[];for(let u=a.top;u0||N>0){let k=v.attrs;if(w>0&&(k=zl(k,0,w)),N>0&&(k=zl(k,k.colspan-N,N)),b.lefta.bottom){const k={...v.attrs,rowspan:Math.min(b.bottom,a.bottom)-Math.max(b.top,a.top)};b.top0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,a=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,a)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),a=_n.get(r),i=e.start(-1),o=a.findCell(e.pos-i),c=a.findCell(n.pos-i),u=e.node(0);return o.top<=c.top?(o.top>0&&(e=u.resolve(i+a.map[o.left])),c.bottom0&&(n=u.resolve(i+a.map[c.left])),o.bottom0)return!1;const o=a+this.$anchorCell.nodeAfter.attrs.colspan,c=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,c)==n.width}eq(e){return e instanceof ji&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),a=_n.get(r),i=e.start(-1),o=a.findCell(e.pos-i),c=a.findCell(n.pos-i),u=e.node(0);return o.left<=c.left?(o.left>0&&(e=u.resolve(i+a.map[o.top*a.width])),c.right0&&(n=u.resolve(i+a.map[c.top*a.width])),o.right{e.push(as.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ln.create(t.doc,e)}function _$({$from:t,$to:e}){if(t.pos==e.pos||t.pos=0&&!(t.after(a+1)=0&&!(e.before(i+1)>e.start(i));i--,r--);return n==r&&/row|table/.test(t.node(a).type.spec.tableRole)}function z$({$from:t,$to:e}){let n,r;for(let a=t.depth;a>0;a--){const i=t.node(a);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let a=e.depth;a>0;a--){const i=e.node(a);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return n!==r&&e.parentOffset===0}function $$(t,e,n){const r=(e||t).selection,a=(e||t).doc;let i,o;if(r instanceof ot&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")i=fn.create(a,r.from);else if(o=="row"){const c=a.resolve(r.from+1);i=fn.rowSelection(c,c)}else if(!n){const c=_n.get(r.node),u=r.from+1,h=u+c.map[c.width*c.height-1];i=fn.create(a,u+1,h)}}else r instanceof lt&&_$(r)?i=lt.create(a,r.from):r instanceof lt&&z$(r)&&(i=lt.create(a,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}const F$=new Cn("fix-tables");function j3(t,e,n,r){const a=t.childCount,i=e.childCount;e:for(let o=0,c=0;o{a.type.spec.tableRole=="table"&&(n=B$(t,a,i,n))};return e?e.doc!=t.doc&&j3(e.doc,t.doc,0,r):t.doc.descendants(r),n}function B$(t,e,n,r){const a=_n.get(e);if(!a.problems)return r;r||(r=t.tr);const i=[];for(let u=0;u0){let b="cell";f.firstChild&&(b=f.firstChild.type.spec.tableRole);const v=[];for(let N=0;N0?-1:0;L$(e,r,a+i)&&(i=a==0||a==e.width?null:0);for(let o=0;o0&&a0&&e.map[c-1]==u||a0?-1:0;K$(e,r,a+c)&&(c=a==0||a==e.height?null:0);for(let h=0,f=e.width*a;h0&&a0&&m==e.map[f-e.width]){const x=n.nodeAt(m).attrs;t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...x,rowspan:x.rowspan-1}),h+=x.colspan-1}else if(a0&&n[i]==n[i-1]||r.right0&&n[a]==n[a-t]||r.bottom0){const f=u+1+h.content.size,m=Dw(h)?u+1:f;i.replaceWith(m+r.tableStart,f+r.tableStart,c)}i.setSelection(new fn(i.doc.resolve(u+r.tableStart))),e(i)}return!0}function zw(t,e){const n=qs(t.schema);return X$(({node:r})=>n[r.type.spec.tableRole])(t,e)}function X$(t){return(e,n)=>{const r=e.selection;let a,i;if(r instanceof fn){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;a=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{var o;if(a=I$(r.$from),!a)return!1;i=(o=_l(r.$from))===null||o===void 0?void 0:o.pos}if(a==null||i==null||a.attrs.colspan==1&&a.attrs.rowspan==1)return!1;if(n){let c=a.attrs;const u=[],h=c.colwidth;c.rowspan>1&&(c={...c,rowspan:1}),c.colspan>1&&(c={...c,colspan:1});const f=Ja(e),m=e.tr;for(let b=0;b{o.attrs[t]!==e&&i.setNodeMarkup(c,null,{...o.attrs,[t]:e})}):i.setNodeMarkup(a.pos,null,{...a.nodeAfter.attrs,[t]:e}),r(i)}return!0}}function eF(t){return function(e,n){if(!Sa(e))return!1;if(n){const r=qs(e.schema),a=Ja(e),i=e.tr,o=a.map.cellsInRect(t=="column"?{left:a.left,top:0,right:a.right,bottom:a.map.height}:t=="row"?{left:0,top:a.top,right:a.map.width,bottom:a.bottom}:a),c=o.map(u=>a.table.nodeAt(u));for(let u=0;u{const b=x+i.tableStart,v=o.doc.nodeAt(b);v&&o.setNodeMarkup(b,m,v.attrs)}),r(o)}return!0}}Nu("row",{useDeprecatedLogic:!0});Nu("column",{useDeprecatedLogic:!0});const tF=Nu("cell",{useDeprecatedLogic:!0});function nF(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,a=t.before();r>=0;r--){const i=t.node(-1).child(r),o=i.lastChild;if(o)return a-1-o.nodeSize;a-=i.nodeSize}}else{if(t.index()0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Zh(t,e){const n=t.selection;if(!(n instanceof fn))return!1;if(e){const r=t.tr,a=qs(t.schema).cell.createAndFill().content;n.forEachCell((i,o)=>{i.content.eq(a)||r.replace(r.mapping.map(o+1),r.mapping.map(o+i.nodeSize-1),new Be(a,0,0))}),r.docChanged&&e(r)}return!0}function rF(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const a=e.child(0),i=a.type.spec.tableRole,o=a.type.schema,c=[];if(i=="row")for(let u=0;u=0;o--){const{rowspan:c,colspan:u}=i.child(o).attrs;for(let h=a;h=e.length&&e.push(Ee.empty),n[a]r&&(x=x.type.createChecked(zl(x.attrs,x.attrs.colspan,f+x.attrs.colspan-r),x.content)),h.push(x),f+=x.attrs.colspan;for(let b=1;ba&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,a-m.attrs.rowspan)},m.content)),u.push(m)}i.push(Ee.from(u))}n=i,e=a}return{width:t,height:e,rows:n}}function oF(t,e,n,r,a,i,o){const c=t.doc.type.schema,u=qs(c);let h,f;if(a>e.width)for(let m=0,x=0;me.height){const m=[];for(let v=0,w=(e.height-1)*e.width;v=e.width?!1:n.nodeAt(e.map[w+v]).type==u.header_cell;m.push(N?f||(f=u.header_cell.createAndFill()):h||(h=u.cell.createAndFill()))}const x=u.row.create(null,Ee.from(m)),b=[];for(let v=e.height;v{if(!a)return!1;const i=n.selection;if(i instanceof fn)return hf(n,r,gt.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const o=E3(a,t,e);if(o==null)return!1;if(t=="horiz")return hf(n,r,gt.near(n.doc.resolve(i.head+e),e));{const c=n.doc.resolve(o),u=v3(c,t,e);let h;return u?h=gt.near(u,1):e<0?h=gt.near(n.doc.resolve(c.before(-1)),-1):h=gt.near(n.doc.resolve(c.after(-1)),1),hf(n,r,h)}}}function tf(t,e){return(n,r,a)=>{if(!a)return!1;const i=n.selection;let o;if(i instanceof fn)o=i;else{const u=E3(a,t,e);if(u==null)return!1;o=new fn(n.doc.resolve(u))}const c=v3(o.$headCell,t,e);return c?hf(n,r,new fn(o.$anchorCell,c)):!1}}function cF(t,e){const n=t.state.doc,r=_l(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new fn(r))),!0):!1}function dF(t,e,n){if(!Sa(t.state))return!1;let r=rF(n);const a=t.state.selection;if(a instanceof fn){r||(r={width:1,height:1,rows:[Ee.from(v0(qs(t.state.schema).cell,n))]});const i=a.$anchorCell.node(-1),o=a.$anchorCell.start(-1),c=_n.get(i).rectBetween(a.$anchorCell.pos-o,a.$headCell.pos-o);return r=iF(r,c.right-c.left,c.bottom-c.top),Hw(t.state,t.dispatch,o,c,r),!0}else if(r){const i=Up(t.state),o=i.start(-1);return Hw(t.state,t.dispatch,o,_n.get(i.node(-1)).findCell(i.pos-o),r),!0}else return!1}function uF(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=Uw(t,e.target);let a;if(e.shiftKey&&t.state.selection instanceof fn)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(a=_l(t.state.selection.$anchor))!=null&&((n=xg(t,e))===null||n===void 0?void 0:n.pos)!=a.pos)i(a,e),e.preventDefault();else if(!r)return;function i(u,h){let f=xg(t,h);const m=vo.getState(t.state)==null;if(!f||!Vy(u,f))if(m)f=u;else return;const x=new fn(u,f);if(m||!t.state.selection.eq(x)){const b=t.state.tr.setSelection(x);m&&b.setMeta(vo,u.pos),t.dispatch(b)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",c),vo.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(vo,-1))}function c(u){const h=u,f=vo.getState(t.state);let m;if(f!=null)m=t.state.doc.resolve(f);else if(Uw(t,h.target)!=r&&(m=xg(t,e),!m))return o();m&&i(m,h)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",c)}function E3(t,e,n){if(!(t.state.selection instanceof lt))return null;const{$head:r}=t.state.selection;for(let a=r.depth-1;a>=0;a--){const i=r.node(a);if((n<0?r.index(a):r.indexAfter(a))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const o=r.before(a),c=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?o:null}}return null}function Uw(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function xg(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:a}=n;return r>=0&&_l(t.state.doc.resolve(r))||_l(t.state.doc.resolve(a))}var hF=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),N0(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,N0(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function N0(t,e,n,r,a,i){let o=0,c=!0,u=e.firstChild;const h=t.firstChild;if(h){for(let m=0,x=0;mnew r(m,n,x)),new pF(-1,!1)},apply(o,c){return c.apply(o)}},props:{attributes:o=>{const c=$r.getState(o);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,c)=>{mF(o,c,t,a)},mouseleave:o=>{xF(o)},mousedown:(o,c)=>{gF(o,c,e,n)}},decorations:o=>{const c=$r.getState(o);if(c&&c.activeHandle>-1)return wF(o,c.activeHandle)},nodeViews:{}}});return i}var pF=class ff{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta($r);if(r&&r.setHandle!=null)return new ff(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new ff(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let a=e.mapping.map(n.activeHandle,-1);return b0(e.doc.resolve(a))||(a=-1),new ff(a,n.dragging)}return n}};function mF(t,e,n,r){if(!t.editable)return;const a=$r.getState(t.state);if(a&&!a.dragging){const i=bF(e.target);let o=-1;if(i){const{left:c,right:u}=i.getBoundingClientRect();e.clientX-c<=n?o=Ww(t,e,"left",n):u-e.clientX<=n&&(o=Ww(t,e,"right",n))}if(o!=a.activeHandle){if(!r&&o!==-1){const c=t.state.doc.resolve(o),u=c.node(-1),h=_n.get(u),f=c.start(-1);if(h.colCount(c.pos-f)+c.nodeAfter.attrs.colspan-1==h.width-1)return}T3(t,o)}}}function xF(t){if(!t.editable)return;const e=$r.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&T3(t,-1)}function gF(t,e,n,r){var a;if(!t.editable)return!1;const i=(a=t.dom.ownerDocument.defaultView)!==null&&a!==void 0?a:window,o=$r.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const c=t.state.doc.nodeAt(o.activeHandle),u=yF(t,o.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta($r,{setDragging:{startX:e.clientX,startWidth:u}}));function h(m){i.removeEventListener("mouseup",h),i.removeEventListener("mousemove",f);const x=$r.getState(t.state);x!=null&&x.dragging&&(vF(t,x.activeHandle,Kw(x.dragging,m,n)),t.dispatch(t.state.tr.setMeta($r,{setDragging:null})))}function f(m){if(!m.which)return h(m);const x=$r.getState(t.state);if(x&&x.dragging){const b=Kw(x.dragging,m,n);qw(t,x.activeHandle,b,r)}}return qw(t,o.activeHandle,u,r),i.addEventListener("mouseup",h),i.addEventListener("mousemove",f),e.preventDefault(),!0}function yF(t,e,{colspan:n,colwidth:r}){const a=r&&r[r.length-1];if(a)return a;const i=t.domAtPos(e);let o=i.node.childNodes[i.offset].offsetWidth,c=n;if(r)for(let u=0;u{var e,n;const r=t.getAttribute("colwidth"),a=r?r.split(",").map(i=>parseInt(i,10)):null;if(!a){const i=(e=t.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),o=Array.from(((n=t.parentElement)==null?void 0:n.children)||[]).indexOf(t);if(o&&o>-1&&i&&i[o]){const c=i[o].getAttribute("width");return c?[parseInt(c,10)]:null}}return a}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Xt(this.options.HTMLAttributes,t),0]}}),A3=qn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",Xt(this.options.HTMLAttributes,t),0]}}),I3=qn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Xt(this.options.HTMLAttributes,t),0]}});function w0(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Gw(t,e,n,r,a,i){var o;let c=0,u=!0,h=e.firstChild;const f=t.firstChild;if(f!==null)for(let x=0,b=0;x{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function EF(t,e,n,r,a){const i=CF(t),o=[],c=[];for(let h=0;h{const{selection:e}=t.state;if(!TF(e))return!1;let n=0;const r=pC(e.ranges[0].$from,i=>i.type.name==="table");return r==null||r.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},MF="";function AF(t){return(t||"").replace(/\s+/g," ").trim()}function IF(t,e,n={}){var r;const a=(r=n.cellLineSeparator)!=null?r:MF;if(!t||!t.content||t.content.length===0)return"";const i=[];t.content.forEach(v=>{const w=[];v.content&&v.content.forEach(N=>{let k="";N.content&&Array.isArray(N.content)&&N.content.length>1?k=N.content.map(L=>e.renderChildren(L)).join(a):k=N.content?e.renderChildren(N.content):"";const T=AF(k),C=N.type==="tableHeader";w.push({text:T,isHeader:C})}),i.push(w)});const o=i.reduce((v,w)=>Math.max(v,w.length),0);if(o===0)return"";const c=new Array(o).fill(0);i.forEach(v=>{var w;for(let N=0;Nc[N]&&(c[N]=T),c[N]<3&&(c[N]=3)}});const u=(v,w)=>v+" ".repeat(Math.max(0,w-v.length)),h=i[0],f=h.some(v=>v.isHeader);let m=` -`;const x=new Array(o).fill(0).map((v,w)=>f&&h[w]&&h[w].text||"");return m+=`| ${x.map((v,w)=>u(v,c[w])).join(" | ")} | -`,m+=`| ${c.map(v=>"-".repeat(Math.max(3,v))).join(" | ")} | -`,(f?i.slice(1):i).forEach(v=>{m+=`| ${new Array(o).fill(0).map((w,N)=>u(v[N]&&v[N].text||"",c[N])).join(" | ")} | -`}),m}var PF=IF,P3=qn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:kF,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:a}=SF(t,this.options.cellMinWidth),i=e.style;function o(){return i||(r?`width: ${r}`:`min-width: ${a}`)}const c=["table",Xt(this.options.HTMLAttributes,e,{style:o()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},c]:c},parseMarkdown:(t,e)=>{const n=[];if(t.header){const r=[];t.header.forEach(a=>{r.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(a.tokens)}]))}),n.push(e.createNode("tableRow",{},r))}return t.rows&&t.rows.forEach(r=>{const a=[];r.forEach(i=>{a.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),n.push(e.createNode("tableRow",{},a))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>PF(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:a,editor:i})=>{const o=EF(i.schema,t,e,n);if(a){const c=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(lt.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>V$(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>H$(t,e),deleteColumn:()=>({state:t,dispatch:e})=>W$(t,e),addRowBefore:()=>({state:t,dispatch:e})=>q$(t,e),addRowAfter:()=>({state:t,dispatch:e})=>G$(t,e),deleteRow:()=>({state:t,dispatch:e})=>Q$(t,e),deleteTable:()=>({state:t,dispatch:e})=>sF(t,e),mergeCells:()=>({state:t,dispatch:e})=>_w(t,e),splitCell:()=>({state:t,dispatch:e})=>zw(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Nu("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Nu("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>tF(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>_w(t,e)?!0:zw(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>Z$(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Fw(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Fw(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&k3(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=fn.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:nf,"Mod-Backspace":nf,Delete:nf,"Mod-Delete":nf}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[fF({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],jF({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:Yt(at(t,"tableRole",e))}}});zn.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(P3.configure(this.options.table)),this.options.tableCell!==!1&&t.push(M3.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(A3.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(I3.configure(this.options.tableRow)),t}});function RF(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function LF(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}function OF(t){if(!t)return"";let e=t;return e=e.replace(/]*>(.*?)<\/h1>/gi,`# $1 - -`),e=e.replace(/]*>(.*?)<\/h2>/gi,`## $1 - -`),e=e.replace(/]*>(.*?)<\/h3>/gi,`### $1 - -`),e=e.replace(/]*>(.*?)<\/strong>/gi,"**$1**"),e=e.replace(/]*>(.*?)<\/b>/gi,"**$1**"),e=e.replace(/]*>(.*?)<\/em>/gi,"*$1*"),e=e.replace(/]*>(.*?)<\/i>/gi,"*$1*"),e=e.replace(/]*>(.*?)<\/s>/gi,"~~$1~~"),e=e.replace(/]*>(.*?)<\/del>/gi,"~~$1~~"),e=e.replace(/]*>(.*?)<\/code>/gi,"`$1`"),e=e.replace(/]*>(.*?)<\/blockquote>/gi,`> $1 - -`),e=e.replace(/]*src="([^"]*)"[^>]*alt="([^"]*)"[^>]*>/gi,"![$2]($1)"),e=e.replace(/]*src="([^"]*)"[^>]*>/gi,"![]($1)"),e=e.replace(/]*href="([^"]*)"[^>]*>(.*?)<\/a>/gi,"[$2]($1)"),e=e.replace(/]*>(.*?)<\/li>/gi,`- $1 -`),e=e.replace(/<\/?[uo]l[^>]*>/gi,` -`),e=e.replace(//gi,` -`),e=e.replace(/]*>(.*?)<\/p>/gi,`$1 - -`),e=e.replace(//gi,`--- - -`),e=e.replace(/]*data-type="mention"[^>]*data-id="([^"]*)"[^>]*>@([^<]*)<\/span>/gi,"@$2"),e=e.replace(/]*data-type="linkTag"[^>]*data-url="([^"]*)"[^>]*>#([^<]*)<\/span>/gi,"#[$2]($1)"),e=e.replace(/<[^>]+>/g,""),e=e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'"),e=e.replace(/\n{3,}/g,` - -`),e.trim()}function Qw(t){if(!t)return"";if(t.startsWith("<")&&t.includes("$1"),e=e.replace(/^## (.+)$/gm,"

$1

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

$1

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

$1

"),e=e.replace(/^---$/gm,"
"),e=e.replace(/^- (.+)$/gm,"
  • $1
  • ");const n=e.split(` -`),r=[];for(const 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 DF=qn.create({name:"videoEmbed",group:"block",atom:!0,draggable:!0,addAttributes(){return{src:{default:null}}},parseHTML(){return[{tag:"div.rich-video-wrap",getAttrs:t=>{const e=t.querySelector("video"),n=e==null?void 0:e.getAttribute("src");return n?{src:n}:!1}},{tag:"video[src]",getAttrs:t=>({src:t.getAttribute("src")})}]},renderHTML({node:t}){const e=t.attrs.src||"";return["div",{class:"rich-video-wrap"},["video",{src:e,controls:!0,preload:"metadata"}],["div",{class:"rich-video-caption"},"视频(预览已缩小,保存后 C 端全宽播放)"]]}}),_F=qn.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",Xt(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}`]}});function Yw(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}const zF=t=>({items:({query:e})=>{const n=e.trim().toLowerCase();return(n?t.filter(a=>a.name.toLowerCase().includes(n)||a.id.toLowerCase().includes(n)||a.label&&a.label.toLowerCase().includes(n)||a.userId&&a.userId.toLowerCase().includes(n)):t).slice(0,16)},render:()=>{let e=null,n=0,r=[],a=null;const i=()=>{e&&(e.innerHTML=r.map((o,c)=>`
    - @${Yw(o.name)} - ${Yw(o.label||o.id)} -
    `).join(""),e.querySelectorAll(".mention-item").forEach(o=>{o.addEventListener("click",()=>{const c=parseInt(o.getAttribute("data-index")||"0");a&&r[c]&&a({id:r[c].id,label:r[c].name})})}))};return{onStart:o=>{if(e=document.createElement("div"),e.className="mention-popup",document.body.appendChild(e),r=o.items,a=o.command,n=0,i(),o.clientRect){const c=o.clientRect();c&&(e.style.top=`${c.bottom+4}px`,e.style.left=`${c.left}px`)}},onUpdate:o=>{if(r=o.items,a=o.command,n=0,i(),o.clientRect&&e){const c=o.clientRect();c&&(e.style.top=`${c.bottom+4}px`,e.style.left=`${c.left}px`)}},onKeyDown:o=>o.event.key==="ArrowUp"?(n=Math.max(0,n-1),i(),!0):o.event.key==="ArrowDown"?(n=Math.min(r.length-1,n+1),i(),!0):o.event.key==="Enter"?(a&&r[n]&&a({id:r[n].id,label:r[n].name}),!0):o.event.key==="Escape"?(e==null||e.remove(),e=null,!0):!1,onExit:()=>{e==null||e.remove(),e=null}}}});function $F(t){var r;const e=[],n=(r=t.clipboardData)==null?void 0:r.items;if(!n)return e;for(let a=0;a{const h=y.useRef(null),f=y.useRef(null),m=y.useRef(null),x=y.useRef(null),[b,v]=y.useState(""),[w,N]=y.useState(!1),k=y.useRef(Qw(t)),T=y.useCallback((X,V)=>{var I;const ie=x.current;if(!ie||!n)return!1;const le=$F(V);if(le.length>0)return V.preventDefault(),(async()=>{for(const Q of le)try{const $=await n(Q);$&&ie.chain().focus().setImage({src:$}).run()}catch($){console.error("粘贴图片上传失败",$)}})(),!0;const he=(I=V.clipboardData)==null?void 0:I.getData("text/html");if(he&&/data:image\/[^;"']+;base64,/i.test(he)){V.preventDefault();const{from:Q,to:$}=ie.state.selection;return(async()=>{try{const xe=await VF(he,n);ie.chain().focus().insertContentAt({from:Q,to:$},xe).run()}catch(xe){console.error("粘贴 HTML 内 base64 转换失败",xe)}})(),!0}return!1},[n]),C=M7({extensions:[x$.configure({link:{openOnClick:!1,HTMLAttributes:{class:"rich-link"}}}),b$.configure({inline:!0,allowBase64:!0,HTMLAttributes:{class:"rich-editor-img-thumb"}}),DF,S$.configure({HTMLAttributes:{class:"mention-tag"},suggestion:zF(a)}),_F,C$.configure({placeholder:o}),P3.configure({resizable:!0}),I3,M3,A3],content:k.current,onUpdate:({editor:X})=>{e(X.getHTML())},editorProps:{attributes:{class:"rich-editor-content"},handlePaste:T}});y.useEffect(()=>{x.current=C??null},[C]),y.useImperativeHandle(u,()=>({getHTML:()=>(C==null?void 0:C.getHTML())||"",getMarkdown:()=>OF((C==null?void 0:C.getHTML())||"")})),y.useEffect(()=>{if(C&&t!==C.getHTML()){const X=Qw(t);X!==C.getHTML()&&C.commands.setContent(X)}},[t]);const P=y.useCallback(async X=>{if(r)return r(X);if(n)return n(X);throw new Error("未配置上传")},[n,r]),L=y.useCallback(async X=>{var ie;const V=(ie=X.target.files)==null?void 0:ie[0];if(!(!V||!C)){if(n){const le=await n(V);le&&C.chain().focus().setImage({src:le}).run()}else{const le=new FileReader;le.onload=()=>{typeof le.result=="string"&&C.chain().focus().setImage({src:le.result}).run()},le.readAsDataURL(V)}X.target.value=""}},[C,n]),q=y.useCallback(async X=>{var ie;const V=(ie=X.target.files)==null?void 0:ie[0];if(!(!V||!C)){try{const le=await P(V);le&&C.chain().focus().insertContent({type:"videoEmbed",attrs:{src:le}}).run()}catch(le){console.error(le)}X.target.value=""}},[C,P]),z=y.useCallback(async X=>{var ie;const V=(ie=X.target.files)==null?void 0:ie[0];if(!(!V||!C)){try{const le=await P(V);if(!le)return;const he=V.name||"附件";C.chain().focus().insertContent(`

    附件 ${RF(he)}

    `).run()}catch(le){console.error(le)}X.target.value=""}},[C,P]),H=y.useCallback(()=>{C&&C.chain().focus().insertContent("@").run()},[C]),R=y.useCallback(X=>{C&&C.chain().focus().insertContent([{type:"linkTag",attrs:{label:X.label,url:X.url||"",tagType:X.type||"url",tagId:X.id||"",pagePath:X.pagePath||"",appId:X.appId||"",mpKey:X.type==="miniprogram"&&X.appId||""}},{type:"text",text:" "}]).run()},[C]),se=y.useCallback(()=>{!C||!b||(C.chain().focus().setLink({href:b}).run(),v(""),N(!1))},[C,b]);return C?s.jsxs("div",{className:`rich-editor-wrapper ${c||""}`,children:[s.jsxs("div",{className:"rich-editor-toolbar",children:[s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>C.chain().focus().toggleBold().run(),className:C.isActive("bold")?"is-active":"",type:"button",children:s.jsx(i5,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().toggleItalic().run(),className:C.isActive("italic")?"is-active":"",type:"button",children:s.jsx(aM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().toggleStrike().run(),className:C.isActive("strike")?"is-active":"",type:"button",children:s.jsx(cA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().toggleCode().run(),className:C.isActive("code")?"is-active":"",type:"button",children:s.jsx(S5,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>C.chain().focus().toggleHeading({level:1}).run(),className:C.isActive("heading",{level:1})?"is-active":"",type:"button",children:s.jsx(J5,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().toggleHeading({level:2}).run(),className:C.isActive("heading",{level:2})?"is-active":"",type:"button",children:s.jsx(Y5,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().toggleHeading({level:3}).run(),className:C.isActive("heading",{level:3})?"is-active":"",type:"button",children:s.jsx(Z5,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>C.chain().focus().toggleBulletList().run(),className:C.isActive("bulletList")?"is-active":"",type:"button",children:s.jsx(xM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().toggleOrderedList().run(),className:C.isActive("orderedList")?"is-active":"",type:"button",children:s.jsx(pM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().toggleBlockquote().run(),className:C.isActive("blockquote")?"is-active":"",type:"button",children:s.jsx(VM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().setHorizontalRule().run(),type:"button",children:s.jsx(EM,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("input",{ref:h,type:"file",accept:"image/*",onChange:L,className:"hidden"}),s.jsx("input",{ref:f,type:"file",accept:"video/*",onChange:q,className:"hidden"}),s.jsx("input",{ref:m,type:"file",onChange:z,className:"hidden"}),s.jsx("button",{onClick:()=>{var X;return(X=h.current)==null?void 0:X.click()},type:"button",title:"上传图片",children:s.jsx(Wj,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>{var X;return(X=f.current)==null?void 0:X.click()},type:"button",title:"上传视频",disabled:!r&&!n,children:s.jsx(kA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>{var X;return(X=m.current)==null?void 0:X.click()},type:"button",title:"上传附件(生成下载链接)",disabled:!r&&!n,children:s.jsx(PM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:H,type:"button",title:"插入 @ 并选择人物",className:a.length?"mention-trigger-btn":"",disabled:a.length===0,children:s.jsx(s5,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>N(!w),className:C.isActive("link")?"is-active":"",type:"button",title:"链接",children:s.jsx(Ig,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),type:"button",title:"表格",children:s.jsx(uA,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>C.chain().focus().undo().run(),disabled:!C.can().undo(),type:"button",children:s.jsx(yA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().redo().run(),disabled:!C.can().redo(),type:"button",children:s.jsx(UM,{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:X=>{const V=i.find(ie=>ie.id===X.target.value);V&&R(V),X.target.value=""},defaultValue:"",children:[s.jsx("option",{value:"",disabled:!0,children:"# 插入链接标签"}),i.map(X=>s.jsx("option",{value:X.id,children:X.label},X.id))]})})]})]}),w&&s.jsxs("div",{className:"link-input-bar",children:[s.jsx("input",{type:"url",placeholder:"输入链接地址...",value:b,onChange:X=>v(X.target.value),onKeyDown:X=>X.key==="Enter"&&se(),className:"link-input"}),s.jsx("button",{onClick:se,className:"link-confirm",type:"button",children:"确定"}),s.jsx("button",{onClick:()=>{C.chain().focus().unsetLink().run(),N(!1)},className:"link-remove",type:"button",children:"移除"})]}),s.jsx(HC,{editor:C})]}):null});j0.displayName="RichEditor";const HF=["top","right","bottom","left"],_o=Math.min,_r=Math.max,pp=Math.round,sf=Math.floor,Ha=t=>({x:t,y:t}),UF={left:"right",right:"left",bottom:"top",top:"bottom"},WF={start:"end",end:"start"};function k0(t,e,n){return _r(t,_o(e,n))}function Li(t,e){return typeof t=="function"?t(e):t}function Oi(t){return t.split("-")[0]}function rd(t){return t.split("-")[1]}function Hy(t){return t==="x"?"y":"x"}function Uy(t){return t==="y"?"height":"width"}const KF=new Set(["top","bottom"]);function Va(t){return KF.has(Oi(t))?"y":"x"}function Wy(t){return Hy(Va(t))}function qF(t,e,n){n===void 0&&(n=!1);const r=rd(t),a=Wy(t),i=Uy(a);let o=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=mp(o)),[o,mp(o)]}function GF(t){const e=mp(t);return[S0(t),e,S0(e)]}function S0(t){return t.replace(/start|end/g,e=>WF[e])}const Xw=["left","right"],Zw=["right","left"],JF=["top","bottom"],QF=["bottom","top"];function YF(t,e,n){switch(t){case"top":case"bottom":return n?e?Zw:Xw:e?Xw:Zw;case"left":case"right":return e?JF:QF;default:return[]}}function XF(t,e,n,r){const a=rd(t);let i=YF(Oi(t),n==="start",r);return a&&(i=i.map(o=>o+"-"+a),e&&(i=i.concat(i.map(S0)))),i}function mp(t){return t.replace(/left|right|bottom|top/g,e=>UF[e])}function ZF(t){return{top:0,right:0,bottom:0,left:0,...t}}function R3(t){return typeof t!="number"?ZF(t):{top:t,right:t,bottom:t,left:t}}function xp(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 ej(t,e,n){let{reference:r,floating:a}=t;const i=Va(e),o=Wy(e),c=Uy(o),u=Oi(e),h=i==="y",f=r.x+r.width/2-a.width/2,m=r.y+r.height/2-a.height/2,x=r[c]/2-a[c]/2;let b;switch(u){case"top":b={x:f,y:r.y-a.height};break;case"bottom":b={x:f,y:r.y+r.height};break;case"right":b={x:r.x+r.width,y:m};break;case"left":b={x:r.x-a.width,y:m};break;default:b={x:r.x,y:r.y}}switch(rd(e)){case"start":b[o]-=x*(n&&h?-1:1);break;case"end":b[o]+=x*(n&&h?-1:1);break}return b}async function eB(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:x=!1,padding:b=0}=Li(e,t),v=R3(b),N=c[x?m==="floating"?"reference":"floating":m],k=xp(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})),T=m==="floating"?{x:r,y:a,width:o.floating.width,height:o.floating.height}:o.reference,C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),P=await(i.isElement==null?void 0:i.isElement(C))?await(i.getScale==null?void 0:i.getScale(C))||{x:1,y:1}:{x:1,y:1},L=xp(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:T,offsetParent:C,strategy:u}):T);return{top:(k.top-L.top+v.top)/P.y,bottom:(L.bottom-k.bottom+v.bottom)/P.y,left:(k.left-L.left+v.left)/P.x,right:(L.right-k.right+v.right)/P.x}}const tB=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}=ej(h,r,u),x=r,b={},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}=Li(t,e)||{};if(h==null)return{};const m=R3(f),x={x:n,y:r},b=Wy(a),v=Uy(b),w=await o.getDimensions(h),N=b==="y",k=N?"top":"left",T=N?"bottom":"right",C=N?"clientHeight":"clientWidth",P=i.reference[v]+i.reference[b]-x[b]-i.floating[v],L=x[b]-i.reference[b],q=await(o.getOffsetParent==null?void 0:o.getOffsetParent(h));let z=q?q[C]:0;(!z||!await(o.isElement==null?void 0:o.isElement(q)))&&(z=c.floating[C]||i.floating[v]);const H=P/2-L/2,R=z/2-w[v]/2-1,se=_o(m[k],R),X=_o(m[T],R),V=se,ie=z-w[v]-X,le=z/2-w[v]/2+H,he=k0(V,le,ie),I=!u.arrow&&rd(a)!=null&&le!==he&&i.reference[v]/2-(lele<=0)){var X,V;const le=(((X=i.flip)==null?void 0:X.index)||0)+1,he=z[le];if(he&&(!(m==="alignment"?T!==Va(he):!1)||se.every($=>Va($.placement)===T?$.overflows[0]>0:!0)))return{data:{index:le,overflows:se},reset:{placement:he}};let I=(V=se.filter(Q=>Q.overflows[0]<=0).sort((Q,$)=>Q.overflows[1]-$.overflows[1])[0])==null?void 0:V.placement;if(!I)switch(b){case"bestFit":{var ie;const Q=(ie=se.filter($=>{if(q){const xe=Va($.placement);return xe===T||xe==="y"}return!0}).map($=>[$.placement,$.overflows.filter(xe=>xe>0).reduce((xe,Z)=>xe+Z,0)]).sort(($,xe)=>$[1]-xe[1])[0])==null?void 0:ie[0];Q&&(I=Q);break}case"initialPlacement":I=c;break}if(a!==I)return{reset:{placement:I}}}return{}}}};function tj(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function nj(t){return HF.some(e=>t[e]>=0)}const rB=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:a="referenceHidden",...i}=Li(t,e);switch(a){case"referenceHidden":{const o=await r.detectOverflow(e,{...i,elementContext:"reference"}),c=tj(o,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:nj(c)}}}case"escaped":{const o=await r.detectOverflow(e,{...i,altBoundary:!0}),c=tj(o,n.floating);return{data:{escapedOffsets:c,escaped:nj(c)}}}default:return{}}}}},L3=new Set(["left","top"]);async function aB(t,e){const{placement:n,platform:r,elements:a}=t,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),o=Oi(n),c=rd(n),u=Va(n)==="y",h=L3.has(o)?-1:1,f=i&&u?-1:1,m=Li(e,t);let{mainAxis:x,crossAxis:b,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"&&(b=c==="end"?v*-1:v),u?{x:b*f,y:x*h}:{x:x*h,y:b*f}}const iB=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 aB(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}}}}},oB=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:T,y:C}=k;return{x:T,y:C}}},...h}=Li(t,e),f={x:n,y:r},m=await i.detectOverflow(e,h),x=Va(Oi(a)),b=Hy(x);let v=f[b],w=f[x];if(o){const k=b==="y"?"top":"left",T=b==="y"?"bottom":"right",C=v+m[k],P=v-m[T];v=k0(C,v,P)}if(c){const k=x==="y"?"top":"left",T=x==="y"?"bottom":"right",C=w+m[k],P=w-m[T];w=k0(C,w,P)}const N=u.fn({...e,[b]:v,[x]:w});return{...N,data:{x:N.x-n,y:N.y-r,enabled:{[b]:o,[x]:c}}}}}},lB=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}=Li(t,e),f={x:n,y:r},m=Va(a),x=Hy(m);let b=f[x],v=f[m];const w=Li(c,e),N=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(u){const C=x==="y"?"height":"width",P=i.reference[x]-i.floating[C]+N.mainAxis,L=i.reference[x]+i.reference[C]-N.mainAxis;bL&&(b=L)}if(h){var k,T;const C=x==="y"?"width":"height",P=L3.has(Oi(a)),L=i.reference[m]-i.floating[C]+(P&&((k=o.offset)==null?void 0:k[m])||0)+(P?0:N.crossAxis),q=i.reference[m]+i.reference[C]+(P?0:((T=o.offset)==null?void 0:T[m])||0)-(P?N.crossAxis:0);vq&&(v=q)}return{[x]:b,[m]:v}}}},cB=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}=Li(t,e),f=await o.detectOverflow(e,h),m=Oi(a),x=rd(a),b=Va(a)==="y",{width:v,height:w}=i.floating;let N,k;m==="top"||m==="bottom"?(N=m,k=x===(await(o.isRTL==null?void 0:o.isRTL(c.floating))?"start":"end")?"left":"right"):(k=m,N=x==="end"?"top":"bottom");const T=w-f.top-f.bottom,C=v-f.left-f.right,P=_o(w-f[N],T),L=_o(v-f[k],C),q=!e.middlewareData.shift;let z=P,H=L;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(H=C),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(z=T),q&&!x){const se=_r(f.left,0),X=_r(f.right,0),V=_r(f.top,0),ie=_r(f.bottom,0);b?H=v-2*(se!==0||X!==0?se+X:_r(f.left,f.right)):z=w-2*(V!==0||ie!==0?V+ie:_r(f.top,f.bottom))}await u({...e,availableWidth:H,availableHeight:z});const R=await o.getDimensions(c.floating);return v!==R.width||w!==R.height?{reset:{rects:!0}}:{}}}};function Wp(){return typeof window<"u"}function ad(t){return O3(t)?(t.nodeName||"").toLowerCase():"#document"}function Br(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Qa(t){var e;return(e=(O3(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function O3(t){return Wp()?t instanceof Node||t instanceof Br(t).Node:!1}function wa(t){return Wp()?t instanceof Element||t instanceof Br(t).Element:!1}function qa(t){return Wp()?t instanceof HTMLElement||t instanceof Br(t).HTMLElement:!1}function sj(t){return!Wp()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Br(t).ShadowRoot}const dB=new Set(["inline","contents"]);function Iu(t){const{overflow:e,overflowX:n,overflowY:r,display:a}=ja(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!dB.has(a)}const uB=new Set(["table","td","th"]);function hB(t){return uB.has(ad(t))}const fB=[":popover-open",":modal"];function Kp(t){return fB.some(e=>{try{return t.matches(e)}catch{return!1}})}const pB=["transform","translate","scale","rotate","perspective"],mB=["transform","translate","scale","rotate","perspective","filter"],xB=["paint","layout","strict","content"];function Ky(t){const e=qy(),n=wa(t)?ja(t):t;return pB.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)||mB.some(r=>(n.willChange||"").includes(r))||xB.some(r=>(n.contain||"").includes(r))}function gB(t){let e=zo(t);for(;qa(e)&&!Qc(e);){if(Ky(e))return e;if(Kp(e))return null;e=zo(e)}return null}function qy(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const yB=new Set(["html","body","#document"]);function Qc(t){return yB.has(ad(t))}function ja(t){return Br(t).getComputedStyle(t)}function qp(t){return wa(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function zo(t){if(ad(t)==="html")return t;const e=t.assignedSlot||t.parentNode||sj(t)&&t.host||Qa(t);return sj(e)?e.host:e}function D3(t){const e=zo(t);return Qc(e)?t.ownerDocument?t.ownerDocument.body:t.body:qa(e)&&Iu(e)?e:D3(e)}function wu(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const a=D3(t),i=a===((r=t.ownerDocument)==null?void 0:r.body),o=Br(a);if(i){const c=C0(o);return e.concat(o,o.visualViewport||[],Iu(a)?a:[],c&&n?wu(c):[])}return e.concat(a,wu(a,[],n))}function C0(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function _3(t){const e=ja(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const a=qa(t),i=a?t.offsetWidth:n,o=a?t.offsetHeight:r,c=pp(n)!==i||pp(r)!==o;return c&&(n=i,r=o),{width:n,height:r,$:c}}function Gy(t){return wa(t)?t:t.contextElement}function $c(t){const e=Gy(t);if(!qa(e))return Ha(1);const n=e.getBoundingClientRect(),{width:r,height:a,$:i}=_3(e);let o=(i?pp(n.width):n.width)/r,c=(i?pp(n.height):n.height)/a;return(!o||!Number.isFinite(o))&&(o=1),(!c||!Number.isFinite(c))&&(c=1),{x:o,y:c}}const bB=Ha(0);function z3(t){const e=Br(t);return!qy()||!e.visualViewport?bB:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function vB(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Br(t)?!1:e}function $l(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const a=t.getBoundingClientRect(),i=Gy(t);let o=Ha(1);e&&(r?wa(r)&&(o=$c(r)):o=$c(t));const c=vB(i,n,r)?z3(i):Ha(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 x=Br(i),b=r&&wa(r)?Br(r):r;let v=x,w=C0(v);for(;w&&r&&b!==v;){const N=$c(w),k=w.getBoundingClientRect(),T=ja(w),C=k.left+(w.clientLeft+parseFloat(T.paddingLeft))*N.x,P=k.top+(w.clientTop+parseFloat(T.paddingTop))*N.y;u*=N.x,h*=N.y,f*=N.x,m*=N.y,u+=C,h+=P,v=Br(w),w=C0(v)}}return xp({width:f,height:m,x:u,y:h})}function Gp(t,e){const n=qp(t).scrollLeft;return e?e.left+n:$l(Qa(t)).left+n}function $3(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-Gp(t,n),a=n.top+e.scrollTop;return{x:r,y:a}}function NB(t){let{elements:e,rect:n,offsetParent:r,strategy:a}=t;const i=a==="fixed",o=Qa(r),c=e?Kp(e.floating):!1;if(r===o||c&&i)return n;let u={scrollLeft:0,scrollTop:0},h=Ha(1);const f=Ha(0),m=qa(r);if((m||!m&&!i)&&((ad(r)!=="body"||Iu(o))&&(u=qp(r)),qa(r))){const b=$l(r);h=$c(r),f.x=b.x+r.clientLeft,f.y=b.y+r.clientTop}const x=o&&!m&&!i?$3(o,u):Ha(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-u.scrollLeft*h.x+f.x+x.x,y:n.y*h.y-u.scrollTop*h.y+f.y+x.y}}function wB(t){return Array.from(t.getClientRects())}function jB(t){const e=Qa(t),n=qp(t),r=t.ownerDocument.body,a=_r(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=_r(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Gp(t);const c=-n.scrollTop;return ja(r).direction==="rtl"&&(o+=_r(e.clientWidth,r.clientWidth)-a),{width:a,height:i,x:o,y:c}}const rj=25;function kB(t,e){const n=Br(t),r=Qa(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=qy();(!f||f&&e==="fixed")&&(c=a.offsetLeft,u=a.offsetTop)}const h=Gp(r);if(h<=0){const f=r.ownerDocument,m=f.body,x=getComputedStyle(m),b=f.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,v=Math.abs(r.clientWidth-m.clientWidth-b);v<=rj&&(i-=v)}else h<=rj&&(i+=h);return{width:i,height:o,x:c,y:u}}const SB=new Set(["absolute","fixed"]);function CB(t,e){const n=$l(t,!0,e==="fixed"),r=n.top+t.clientTop,a=n.left+t.clientLeft,i=qa(t)?$c(t):Ha(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 aj(t,e,n){let r;if(e==="viewport")r=kB(t,n);else if(e==="document")r=jB(Qa(t));else if(wa(e))r=CB(e,n);else{const a=z3(t);r={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return xp(r)}function F3(t,e){const n=zo(t);return n===e||!wa(n)||Qc(n)?!1:ja(n).position==="fixed"||F3(n,e)}function EB(t,e){const n=e.get(t);if(n)return n;let r=wu(t,[],!1).filter(c=>wa(c)&&ad(c)!=="body"),a=null;const i=ja(t).position==="fixed";let o=i?zo(t):t;for(;wa(o)&&!Qc(o);){const c=ja(o),u=Ky(o);!u&&c.position==="fixed"&&(a=null),(i?!u&&!a:!u&&c.position==="static"&&!!a&&SB.has(a.position)||Iu(o)&&!u&&F3(t,o))?r=r.filter(f=>f!==o):a=c,o=zo(o)}return e.set(t,r),r}function TB(t){let{element:e,boundary:n,rootBoundary:r,strategy:a}=t;const o=[...n==="clippingAncestors"?Kp(e)?[]:EB(e,this._c):[].concat(n),r],c=o[0],u=o.reduce((h,f)=>{const m=aj(e,f,a);return h.top=_r(m.top,h.top),h.right=_o(m.right,h.right),h.bottom=_o(m.bottom,h.bottom),h.left=_r(m.left,h.left),h},aj(e,c,a));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function MB(t){const{width:e,height:n}=_3(t);return{width:e,height:n}}function AB(t,e,n){const r=qa(e),a=Qa(e),i=n==="fixed",o=$l(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const u=Ha(0);function h(){u.x=Gp(a)}if(r||!r&&!i)if((ad(e)!=="body"||Iu(a))&&(c=qp(e)),r){const b=$l(e,!0,i,e);u.x=b.x+e.clientLeft,u.y=b.y+e.clientTop}else a&&h();i&&!r&&a&&h();const f=a&&!r&&!i?$3(a,c):Ha(0),m=o.left+c.scrollLeft-u.x-f.x,x=o.top+c.scrollTop-u.y-f.y;return{x:m,y:x,width:o.width,height:o.height}}function gg(t){return ja(t).position==="static"}function ij(t,e){if(!qa(t)||ja(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Qa(t)===n&&(n=n.ownerDocument.body),n}function B3(t,e){const n=Br(t);if(Kp(t))return n;if(!qa(t)){let a=zo(t);for(;a&&!Qc(a);){if(wa(a)&&!gg(a))return a;a=zo(a)}return n}let r=ij(t,e);for(;r&&hB(r)&&gg(r);)r=ij(r,e);return r&&Qc(r)&&gg(r)&&!Ky(r)?n:r||gB(t)||n}const IB=async function(t){const e=this.getOffsetParent||B3,n=this.getDimensions,r=await n(t.floating);return{reference:AB(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function PB(t){return ja(t).direction==="rtl"}const RB={convertOffsetParentRelativeRectToViewportRelativeRect:NB,getDocumentElement:Qa,getClippingRect:TB,getOffsetParent:B3,getElementRects:IB,getClientRects:wB,getDimensions:MB,getScale:$c,isElement:wa,isRTL:PB};function V3(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function LB(t,e){let n=null,r;const a=Qa(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:x,height:b}=h;if(c||e(),!x||!b)return;const v=sf(m),w=sf(a.clientWidth-(f+x)),N=sf(a.clientHeight-(m+b)),k=sf(f),C={rootMargin:-v+"px "+-w+"px "+-N+"px "+-k+"px",threshold:_r(0,_o(1,u))||1};let P=!0;function L(q){const z=q[0].intersectionRatio;if(z!==u){if(!P)return o();z?o(!1,z):r=setTimeout(()=>{o(!1,1e-7)},1e3)}z===1&&!V3(h,t.getBoundingClientRect())&&o(),P=!1}try{n=new IntersectionObserver(L,{...C,root:a.ownerDocument})}catch{n=new IntersectionObserver(L,C)}n.observe(t)}return o(!0),i}function OB(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=Gy(t),f=a||i?[...h?wu(h):[],...wu(e)]:[];f.forEach(k=>{a&&k.addEventListener("scroll",n,{passive:!0}),i&&k.addEventListener("resize",n)});const m=h&&c?LB(h,n):null;let x=-1,b=null;o&&(b=new ResizeObserver(k=>{let[T]=k;T&&T.target===h&&b&&(b.unobserve(e),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var C;(C=b)==null||C.observe(e)})),n()}),h&&!u&&b.observe(h),b.observe(e));let v,w=u?$l(t):null;u&&N();function N(){const k=$l(t);w&&!V3(w,k)&&n(),w=k,v=requestAnimationFrame(N)}return n(),()=>{var k;f.forEach(T=>{a&&T.removeEventListener("scroll",n),i&&T.removeEventListener("resize",n)}),m==null||m(),(k=b)==null||k.disconnect(),b=null,u&&cancelAnimationFrame(v)}}const DB=iB,_B=oB,zB=sB,$B=cB,FB=rB,oj=nB,BB=lB,VB=(t,e,n)=>{const r=new Map,a={platform:RB,...n},i={...a.platform,_c:r};return tB(t,e,{...a,platform:i})};var HB=typeof document<"u",UB=function(){},pf=HB?y.useLayoutEffect:UB;function gp(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(!gp(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)&&!gp(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function H3(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function lj(t,e){const n=H3(t);return Math.round(e*n)/n}function yg(t){const e=y.useRef(t);return pf(()=>{e.current=t}),e}function WB(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]=y.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[x,b]=y.useState(r);gp(x,r)||b(r);const[v,w]=y.useState(null),[N,k]=y.useState(null),T=y.useCallback($=>{$!==q.current&&(q.current=$,w($))},[]),C=y.useCallback($=>{$!==z.current&&(z.current=$,k($))},[]),P=i||v,L=o||N,q=y.useRef(null),z=y.useRef(null),H=y.useRef(f),R=u!=null,se=yg(u),X=yg(a),V=yg(h),ie=y.useCallback(()=>{if(!q.current||!z.current)return;const $={placement:e,strategy:n,middleware:x};X.current&&($.platform=X.current),VB(q.current,z.current,$).then(xe=>{const Z={...xe,isPositioned:V.current!==!1};le.current&&!gp(H.current,Z)&&(H.current=Z,Yc.flushSync(()=>{m(Z)}))})},[x,e,n,X,V]);pf(()=>{h===!1&&H.current.isPositioned&&(H.current.isPositioned=!1,m($=>({...$,isPositioned:!1})))},[h]);const le=y.useRef(!1);pf(()=>(le.current=!0,()=>{le.current=!1}),[]),pf(()=>{if(P&&(q.current=P),L&&(z.current=L),P&&L){if(se.current)return se.current(P,L,ie);ie()}},[P,L,ie,se,R]);const he=y.useMemo(()=>({reference:q,floating:z,setReference:T,setFloating:C}),[T,C]),I=y.useMemo(()=>({reference:P,floating:L}),[P,L]),Q=y.useMemo(()=>{const $={position:n,left:0,top:0};if(!I.floating)return $;const xe=lj(I.floating,f.x),Z=lj(I.floating,f.y);return c?{...$,transform:"translate("+xe+"px, "+Z+"px)",...H3(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:xe,top:Z}},[n,c,I.floating,f.x,f.y]);return y.useMemo(()=>({...f,update:ie,refs:he,elements:I,floatingStyles:Q}),[f,ie,he,I,Q])}const KB=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?oj({element:r.current,padding:a}).fn(n):{}:r?oj({element:r,padding:a}).fn(n):{}}}},qB=(t,e)=>({...DB(t),options:[t,e]}),GB=(t,e)=>({..._B(t),options:[t,e]}),JB=(t,e)=>({...BB(t),options:[t,e]}),QB=(t,e)=>({...zB(t),options:[t,e]}),YB=(t,e)=>({...$B(t),options:[t,e]}),XB=(t,e)=>({...FB(t),options:[t,e]}),ZB=(t,e)=>({...KB(t),options:[t,e]});var e9="Arrow",U3=y.forwardRef((t,e)=>{const{children:n,width:r=10,height:a=5,...i}=t;return s.jsx(Rt.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"})})});U3.displayName=e9;var t9=U3,Jy="Popper",[W3,K3]=Bo(Jy),[n9,q3]=W3(Jy),G3=t=>{const{__scopePopper:e,children:n}=t,[r,a]=y.useState(null);return s.jsx(n9,{scope:e,anchor:r,onAnchorChange:a,children:n})};G3.displayName=Jy;var J3="PopperAnchor",Q3=y.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...a}=t,i=q3(J3,n),o=y.useRef(null),c=Zt(e,o),u=y.useRef(null);return y.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(Rt.div,{...a,ref:c})});Q3.displayName=J3;var Qy="PopperContent",[s9,r9]=W3(Qy),Y3=y.forwardRef((t,e)=>{var K,_,Y,te,Ne,Fe;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:x=!1,updatePositionStrategy:b="optimized",onPlaced:v,...w}=t,N=q3(Qy,n),[k,T]=y.useState(null),C=Zt(e,We=>T(We)),[P,L]=y.useState(null),q=Y0(P),z=(q==null?void 0:q.width)??0,H=(q==null?void 0:q.height)??0,R=r+(i!=="center"?"-"+i:""),se=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},X=Array.isArray(h)?h:[h],V=X.length>0,ie={padding:se,boundary:X.filter(i9),altBoundary:V},{refs:le,floatingStyles:he,placement:I,isPositioned:Q,middlewareData:$}=WB({strategy:"fixed",placement:R,whileElementsMounted:(...We)=>OB(...We,{animationFrame:b==="always"}),elements:{reference:N.anchor},middleware:[qB({mainAxis:a+H,alignmentAxis:o}),u&&GB({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?JB():void 0,...ie}),u&&QB({...ie}),YB({...ie,apply:({elements:We,rects:St,availableWidth:wt,availableHeight:Vt})=>{const{width:_t,height:$n}=St.reference,Jt=We.floating.style;Jt.setProperty("--radix-popper-available-width",`${wt}px`),Jt.setProperty("--radix-popper-available-height",`${Vt}px`),Jt.setProperty("--radix-popper-anchor-width",`${_t}px`),Jt.setProperty("--radix-popper-anchor-height",`${$n}px`)}}),P&&ZB({element:P,padding:c}),o9({arrowWidth:z,arrowHeight:H}),x&&XB({strategy:"referenceHidden",...ie})]}),[xe,Z]=e4(I),F=Ro(v);Ws(()=>{Q&&(F==null||F())},[Q,F]);const U=(K=$.arrow)==null?void 0:K.x,pe=(_=$.arrow)==null?void 0:_.y,fe=((Y=$.arrow)==null?void 0:Y.centerOffset)!==0,[oe,D]=y.useState();return Ws(()=>{k&&D(window.getComputedStyle(k).zIndex)},[k]),s.jsx("div",{ref:le.setFloating,"data-radix-popper-content-wrapper":"",style:{...he,transform:Q?he.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:oe,"--radix-popper-transform-origin":[(te=$.transformOrigin)==null?void 0:te.x,(Ne=$.transformOrigin)==null?void 0:Ne.y].join(" "),...((Fe=$.hide)==null?void 0:Fe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:s.jsx(s9,{scope:n,placedSide:xe,onArrowChange:L,arrowX:U,arrowY:pe,shouldHideArrow:fe,children:s.jsx(Rt.div,{"data-side":xe,"data-align":Z,...w,ref:C,style:{...w.style,animation:Q?void 0:"none"}})})})});Y3.displayName=Qy;var X3="PopperArrow",a9={top:"bottom",right:"left",bottom:"top",left:"right"},Z3=y.forwardRef(function(e,n){const{__scopePopper:r,...a}=e,i=r9(X3,r),o=a9[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(t9,{...a,ref:n,style:{...a.style,display:"block"}})})});Z3.displayName=X3;function i9(t){return t!==null}var o9=t=>({name:"transformOrigin",options:t,fn(e){var N,k,T;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]=e4(n),m={start:"0%",center:"50%",end:"100%"}[f],x=(((k=a.arrow)==null?void 0:k.x)??0)+c/2,b=(((T=a.arrow)==null?void 0:T.y)??0)+u/2;let v="",w="";return h==="bottom"?(v=o?m:`${x}px`,w=`${-u}px`):h==="top"?(v=o?m:`${x}px`,w=`${r.floating.height+u}px`):h==="right"?(v=`${-u}px`,w=o?m:`${b}px`):h==="left"&&(v=`${r.floating.width+u}px`,w=o?m:`${b}px`),{data:{x:v,y:w}}}});function e4(t){const[e,n="center"]=t.split("-");return[e,n]}var l9=G3,c9=Q3,d9=Y3,u9=Z3,t4=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"}),h9="VisuallyHidden",f9=y.forwardRef((t,e)=>s.jsx(Rt.span,{...t,ref:e,style:{...t4,...t.style}}));f9.displayName=h9;var p9=[" ","Enter","ArrowUp","ArrowDown"],m9=[" ","Enter"],Fl="Select",[Jp,Qp,x9]=G0(Fl),[id]=Bo(Fl,[x9,K3]),Yp=K3(),[g9,Wo]=id(Fl),[y9,b9]=id(Fl),n4=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:x,required:b,form:v}=t,w=Yp(e),[N,k]=y.useState(null),[T,C]=y.useState(null),[P,L]=y.useState(!1),q=Sp(h),[z,H]=Tl({prop:r,defaultProp:a??!1,onChange:i,caller:Fl}),[R,se]=Tl({prop:o,defaultProp:c,onChange:u,caller:Fl}),X=y.useRef(null),V=N?v||!!N.closest("form"):!0,[ie,le]=y.useState(new Set),he=Array.from(ie).map(I=>I.props.value).join(";");return s.jsx(l9,{...w,children:s.jsxs(g9,{required:b,scope:e,trigger:N,onTriggerChange:k,valueNode:T,onValueNodeChange:C,valueNodeHasChildren:P,onValueNodeHasChildrenChange:L,contentId:To(),value:R,onValueChange:se,open:z,onOpenChange:H,dir:q,triggerPointerDownPosRef:X,disabled:x,children:[s.jsx(Jp.Provider,{scope:e,children:s.jsx(y9,{scope:t.__scopeSelect,onNativeOptionAdd:y.useCallback(I=>{le(Q=>new Set(Q).add(I))},[]),onNativeOptionRemove:y.useCallback(I=>{le(Q=>{const $=new Set(Q);return $.delete(I),$})},[]),children:n})}),V?s.jsxs(k4,{"aria-hidden":!0,required:b,tabIndex:-1,name:f,autoComplete:m,value:R,onChange:I=>se(I.target.value),disabled:x,form:v,children:[R===void 0?s.jsx("option",{value:""}):null,Array.from(ie)]},he):null]})})};n4.displayName=Fl;var s4="SelectTrigger",r4=y.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...a}=t,i=Yp(n),o=Wo(s4,n),c=o.disabled||r,u=Zt(e,o.onTriggerChange),h=Qp(n),f=y.useRef("touch"),[m,x,b]=C4(w=>{const N=h().filter(C=>!C.disabled),k=N.find(C=>C.value===o.value),T=E4(N,w,k);T!==void 0&&o.onValueChange(T.value)}),v=w=>{c||(o.onOpenChange(!0),b()),w&&(o.triggerPointerDownPosRef.current={x:Math.round(w.pageX),y:Math.round(w.pageY)})};return s.jsx(c9,{asChild:!0,...i,children:s.jsx(Rt.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":S4(o.value)?"":void 0,...a,ref:u,onClick:Tt(a.onClick,w=>{w.currentTarget.focus(),f.current!=="mouse"&&v(w)}),onPointerDown:Tt(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:Tt(a.onKeyDown,w=>{const N=m.current!=="";!(w.ctrlKey||w.altKey||w.metaKey)&&w.key.length===1&&x(w.key),!(N&&w.key===" ")&&p9.includes(w.key)&&(v(),w.preventDefault())})})})});r4.displayName=s4;var a4="SelectValue",i4=y.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,children:i,placeholder:o="",...c}=t,u=Wo(a4,n),{onValueNodeHasChildrenChange:h}=u,f=i!==void 0,m=Zt(e,u.onValueNodeChange);return Ws(()=>{h(f)},[h,f]),s.jsx(Rt.span,{...c,ref:m,style:{pointerEvents:"none"},children:S4(u.value)?s.jsx(s.Fragment,{children:o}):i})});i4.displayName=a4;var v9="SelectIcon",o4=y.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...a}=t;return s.jsx(Rt.span,{"aria-hidden":!0,...a,ref:e,children:r||"▼"})});o4.displayName=v9;var N9="SelectPortal",l4=t=>s.jsx(H0,{asChild:!0,...t});l4.displayName=N9;var Bl="SelectContent",c4=y.forwardRef((t,e)=>{const n=Wo(Bl,t.__scopeSelect),[r,a]=y.useState();if(Ws(()=>{a(new DocumentFragment)},[]),!n.open){const i=r;return i?Yc.createPortal(s.jsx(d4,{scope:t.__scopeSelect,children:s.jsx(Jp.Slot,{scope:t.__scopeSelect,children:s.jsx("div",{children:t.children})})}),i):null}return s.jsx(u4,{...t,ref:e})});c4.displayName=Bl;var ga=10,[d4,Ko]=id(Bl),w9="SelectContentImpl",j9=cu("SelectContent.RemoveScroll"),u4=y.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:x,collisionPadding:b,sticky:v,hideWhenDetached:w,avoidCollisions:N,...k}=t,T=Wo(Bl,n),[C,P]=y.useState(null),[L,q]=y.useState(null),z=Zt(e,K=>P(K)),[H,R]=y.useState(null),[se,X]=y.useState(null),V=Qp(n),[ie,le]=y.useState(!1),he=y.useRef(!1);y.useEffect(()=>{if(C)return kk(C)},[C]),mk();const I=y.useCallback(K=>{const[_,...Y]=V().map(Fe=>Fe.ref.current),[te]=Y.slice(-1),Ne=document.activeElement;for(const Fe of K)if(Fe===Ne||(Fe==null||Fe.scrollIntoView({block:"nearest"}),Fe===_&&L&&(L.scrollTop=0),Fe===te&&L&&(L.scrollTop=L.scrollHeight),Fe==null||Fe.focus(),document.activeElement!==Ne))return},[V,L]),Q=y.useCallback(()=>I([H,C]),[I,H,C]);y.useEffect(()=>{ie&&Q()},[ie,Q]);const{onOpenChange:$,triggerPointerDownPosRef:xe}=T;y.useEffect(()=>{if(C){let K={x:0,y:0};const _=te=>{var Ne,Fe;K={x:Math.abs(Math.round(te.pageX)-(((Ne=xe.current)==null?void 0:Ne.x)??0)),y:Math.abs(Math.round(te.pageY)-(((Fe=xe.current)==null?void 0:Fe.y)??0))}},Y=te=>{K.x<=10&&K.y<=10?te.preventDefault():C.contains(te.target)||$(!1),document.removeEventListener("pointermove",_),xe.current=null};return xe.current!==null&&(document.addEventListener("pointermove",_),document.addEventListener("pointerup",Y,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",_),document.removeEventListener("pointerup",Y,{capture:!0})}}},[C,$,xe]),y.useEffect(()=>{const K=()=>$(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[$]);const[Z,F]=C4(K=>{const _=V().filter(Ne=>!Ne.disabled),Y=_.find(Ne=>Ne.ref.current===document.activeElement),te=E4(_,K,Y);te&&setTimeout(()=>te.ref.current.focus())}),U=y.useCallback((K,_,Y)=>{const te=!he.current&&!Y;(T.value!==void 0&&T.value===_||te)&&(R(K),te&&(he.current=!0))},[T.value]),pe=y.useCallback(()=>C==null?void 0:C.focus(),[C]),fe=y.useCallback((K,_,Y)=>{const te=!he.current&&!Y;(T.value!==void 0&&T.value===_||te)&&X(K)},[T.value]),oe=r==="popper"?E0:h4,D=oe===E0?{side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:x,collisionPadding:b,sticky:v,hideWhenDetached:w,avoidCollisions:N}:{};return s.jsx(d4,{scope:n,content:C,viewport:L,onViewportChange:q,itemRefCallback:U,selectedItem:H,onItemLeave:pe,itemTextRefCallback:fe,focusSelectedItem:Q,selectedItemText:se,position:r,isPositioned:ie,searchRef:Z,children:s.jsx(U0,{as:j9,allowPinchZoom:!0,children:s.jsx(V0,{asChild:!0,trapped:T.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:Tt(a,K=>{var _;(_=T.trigger)==null||_.focus({preventScroll:!0}),K.preventDefault()}),children:s.jsx(B0,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:s.jsx(oe,{role:"listbox",id:T.contentId,"data-state":T.open?"open":"closed",dir:T.dir,onContextMenu:K=>K.preventDefault(),...k,...D,onPlaced:()=>le(!0),ref:z,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:Tt(k.onKeyDown,K=>{const _=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!_&&K.key.length===1&&F(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let te=V().filter(Ne=>!Ne.disabled).map(Ne=>Ne.ref.current);if(["ArrowUp","End"].includes(K.key)&&(te=te.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const Ne=K.target,Fe=te.indexOf(Ne);te=te.slice(Fe+1)}setTimeout(()=>I(te)),K.preventDefault()}})})})})})})});u4.displayName=w9;var k9="SelectItemAlignedPosition",h4=y.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...a}=t,i=Wo(Bl,n),o=Ko(Bl,n),[c,u]=y.useState(null),[h,f]=y.useState(null),m=Zt(e,z=>f(z)),x=Qp(n),b=y.useRef(!1),v=y.useRef(!0),{viewport:w,selectedItem:N,selectedItemText:k,focusSelectedItem:T}=o,C=y.useCallback(()=>{if(i.trigger&&i.valueNode&&c&&h&&w&&N&&k){const z=i.trigger.getBoundingClientRect(),H=h.getBoundingClientRect(),R=i.valueNode.getBoundingClientRect(),se=k.getBoundingClientRect();if(i.dir!=="rtl"){const Ne=se.left-H.left,Fe=R.left-Ne,We=z.left-Fe,St=z.width+We,wt=Math.max(St,H.width),Vt=window.innerWidth-ga,_t=kf(Fe,[ga,Math.max(ga,Vt-wt)]);c.style.minWidth=St+"px",c.style.left=_t+"px"}else{const Ne=H.right-se.right,Fe=window.innerWidth-R.right-Ne,We=window.innerWidth-z.right-Fe,St=z.width+We,wt=Math.max(St,H.width),Vt=window.innerWidth-ga,_t=kf(Fe,[ga,Math.max(ga,Vt-wt)]);c.style.minWidth=St+"px",c.style.right=_t+"px"}const X=x(),V=window.innerHeight-ga*2,ie=w.scrollHeight,le=window.getComputedStyle(h),he=parseInt(le.borderTopWidth,10),I=parseInt(le.paddingTop,10),Q=parseInt(le.borderBottomWidth,10),$=parseInt(le.paddingBottom,10),xe=he+I+ie+$+Q,Z=Math.min(N.offsetHeight*5,xe),F=window.getComputedStyle(w),U=parseInt(F.paddingTop,10),pe=parseInt(F.paddingBottom,10),fe=z.top+z.height/2-ga,oe=V-fe,D=N.offsetHeight/2,K=N.offsetTop+D,_=he+I+K,Y=xe-_;if(_<=fe){const Ne=X.length>0&&N===X[X.length-1].ref.current;c.style.bottom="0px";const Fe=h.clientHeight-w.offsetTop-w.offsetHeight,We=Math.max(oe,D+(Ne?pe:0)+Fe+Q),St=_+We;c.style.height=St+"px"}else{const Ne=X.length>0&&N===X[0].ref.current;c.style.top="0px";const We=Math.max(fe,he+w.offsetTop+(Ne?U:0)+D)+Y;c.style.height=We+"px",w.scrollTop=_-fe+w.offsetTop}c.style.margin=`${ga}px 0`,c.style.minHeight=Z+"px",c.style.maxHeight=V+"px",r==null||r(),requestAnimationFrame(()=>b.current=!0)}},[x,i.trigger,i.valueNode,c,h,w,N,k,i.dir,r]);Ws(()=>C(),[C]);const[P,L]=y.useState();Ws(()=>{h&&L(window.getComputedStyle(h).zIndex)},[h]);const q=y.useCallback(z=>{z&&v.current===!0&&(C(),T==null||T(),v.current=!1)},[C,T]);return s.jsx(C9,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:b,onScrollButtonChange:q,children:s.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:P},children:s.jsx(Rt.div,{...a,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});h4.displayName=k9;var S9="SelectPopperPosition",E0=y.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=ga,...i}=t,o=Yp(n);return s.jsx(d9,{...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)"}})});E0.displayName=S9;var[C9,Yy]=id(Bl,{}),T0="SelectViewport",f4=y.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...a}=t,i=Ko(T0,n),o=Yy(T0,n),c=Zt(e,i.onViewportChange),u=y.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(Jp.Slot,{scope:n,children:s.jsx(Rt.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Tt(a.onScroll,h=>{const f=h.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:x}=o;if(x!=null&&x.current&&m){const b=Math.abs(u.current-f.scrollTop);if(b>0){const v=window.innerHeight-ga*2,w=parseFloat(m.style.minHeight),N=parseFloat(m.style.height),k=Math.max(w,N);if(k0?P:0,m.style.justifyContent="flex-end")}}}u.current=f.scrollTop})})})]})});f4.displayName=T0;var p4="SelectGroup",[E9,T9]=id(p4),M9=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=To();return s.jsx(E9,{scope:n,id:a,children:s.jsx(Rt.div,{role:"group","aria-labelledby":a,...r,ref:e})})});M9.displayName=p4;var m4="SelectLabel",A9=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=T9(m4,n);return s.jsx(Rt.div,{id:a.id,...r,ref:e})});A9.displayName=m4;var yp="SelectItem",[I9,x4]=id(yp),g4=y.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:i,...o}=t,c=Wo(yp,n),u=Ko(yp,n),h=c.value===r,[f,m]=y.useState(i??""),[x,b]=y.useState(!1),v=Zt(e,T=>{var C;return(C=u.itemRefCallback)==null?void 0:C.call(u,T,r,a)}),w=To(),N=y.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(I9,{scope:n,value:r,disabled:a,textId:w,isSelected:h,onItemTextChange:y.useCallback(T=>{m(C=>C||((T==null?void 0:T.textContent)??"").trim())},[]),children:s.jsx(Jp.ItemSlot,{scope:n,value:r,disabled:a,textValue:f,children:s.jsx(Rt.div,{role:"option","aria-labelledby":w,"data-highlighted":x?"":void 0,"aria-selected":h&&x,"data-state":h?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...o,ref:v,onFocus:Tt(o.onFocus,()=>b(!0)),onBlur:Tt(o.onBlur,()=>b(!1)),onClick:Tt(o.onClick,()=>{N.current!=="mouse"&&k()}),onPointerUp:Tt(o.onPointerUp,()=>{N.current==="mouse"&&k()}),onPointerDown:Tt(o.onPointerDown,T=>{N.current=T.pointerType}),onPointerMove:Tt(o.onPointerMove,T=>{var C;N.current=T.pointerType,a?(C=u.onItemLeave)==null||C.call(u):N.current==="mouse"&&T.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Tt(o.onPointerLeave,T=>{var C;T.currentTarget===document.activeElement&&((C=u.onItemLeave)==null||C.call(u))}),onKeyDown:Tt(o.onKeyDown,T=>{var P;((P=u.searchRef)==null?void 0:P.current)!==""&&T.key===" "||(m9.includes(T.key)&&k(),T.key===" "&&T.preventDefault())})})})})});g4.displayName=yp;var Kd="SelectItemText",y4=y.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,...i}=t,o=Wo(Kd,n),c=Ko(Kd,n),u=x4(Kd,n),h=b9(Kd,n),[f,m]=y.useState(null),x=Zt(e,k=>m(k),u.onItemTextChange,k=>{var T;return(T=c.itemTextRefCallback)==null?void 0:T.call(c,k,u.value,u.disabled)}),b=f==null?void 0:f.textContent,v=y.useMemo(()=>s.jsx("option",{value:u.value,disabled:u.disabled,children:b},u.value),[u.disabled,u.value,b]),{onNativeOptionAdd:w,onNativeOptionRemove:N}=h;return Ws(()=>(w(v),()=>N(v)),[w,N,v]),s.jsxs(s.Fragment,{children:[s.jsx(Rt.span,{id:u.textId,...i,ref:x}),u.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Yc.createPortal(i.children,o.valueNode):null]})});y4.displayName=Kd;var b4="SelectItemIndicator",v4=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return x4(b4,n).isSelected?s.jsx(Rt.span,{"aria-hidden":!0,...r,ref:e}):null});v4.displayName=b4;var M0="SelectScrollUpButton",N4=y.forwardRef((t,e)=>{const n=Ko(M0,t.__scopeSelect),r=Yy(M0,t.__scopeSelect),[a,i]=y.useState(!1),o=Zt(e,r.onScrollButtonChange);return Ws(()=>{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(j4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});N4.displayName=M0;var A0="SelectScrollDownButton",w4=y.forwardRef((t,e)=>{const n=Ko(A0,t.__scopeSelect),r=Yy(A0,t.__scopeSelect),[a,i]=y.useState(!1),o=Zt(e,r.onScrollButtonChange);return Ws(()=>{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(j4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});w4.displayName=A0;var j4=y.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=t,i=Ko("SelectScrollButton",n),o=y.useRef(null),c=Qp(n),u=y.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return y.useEffect(()=>()=>u(),[u]),Ws(()=>{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(Rt.div,{"aria-hidden":!0,...a,ref:e,style:{flexShrink:0,...a.style},onPointerDown:Tt(a.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Tt(a.onPointerMove,()=>{var h;(h=i.onItemLeave)==null||h.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Tt(a.onPointerLeave,()=>{u()})})}),P9="SelectSeparator",R9=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return s.jsx(Rt.div,{"aria-hidden":!0,...r,ref:e})});R9.displayName=P9;var I0="SelectArrow",L9=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=Yp(n),i=Wo(I0,n),o=Ko(I0,n);return i.open&&o.position==="popper"?s.jsx(u9,{...a,...r,ref:e}):null});L9.displayName=I0;var O9="SelectBubbleInput",k4=y.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const a=y.useRef(null),i=Zt(r,a),o=Q0(e);return y.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(Rt.select,{...n,style:{...t4,...n.style},ref:i,defaultValue:e})});k4.displayName=O9;function S4(t){return t===""||t===void 0}function C4(t){const e=Ro(t),n=y.useRef(""),r=y.useRef(0),a=y.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=y.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,i]}function E4(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=D9(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 D9(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var _9=n4,T4=r4,z9=i4,$9=o4,F9=l4,M4=c4,B9=f4,A4=g4,V9=y4,H9=v4,U9=N4,W9=w4;const Mc=_9,Ac=z9,fl=y.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(T4,{ref:r,className:$t("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($9,{asChild:!0,children:s.jsx(Sl,{className:"h-4 w-4 opacity-50"})})]}));fl.displayName=T4.displayName;const pl=y.forwardRef(({className:t,children:e,position:n="popper",...r},a)=>s.jsx(F9,{children:s.jsxs(M4,{ref:a,className:$t("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-[#0b1828] border-gray-700 text-white shadow-lg",n==="popper"&&"data-[side=bottom]:translate-y-1",t),position:n,...r,children:[s.jsx(U9,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(Cg,{className:"h-4 w-4"})}),s.jsx(B9,{className:"p-1",children:e}),s.jsx(W9,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(Sl,{className:"h-4 w-4"})})]})}));pl.displayName=M4.displayName;const vr=y.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(A4,{ref:r,className:$t("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(H9,{children:s.jsx(Np,{className:"h-4 w-4"})})}),s.jsx(V9,{children:e})]}));vr.displayName=A4.displayName;const cj=["📖","📕","📗","📘","📙","📓","📔","📒","📚","📖"];function K9(t){return t.title==="序言"||t.title.includes("序言")}function dj(t){const e=[];for(const n of t.chapters)for(const r of n.sections)e.push(r.id);return e.length===0?"暂无章节":e.length===1?e[0]:`${e[0]}~${e[e.length-1]}`}function bg(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 q9({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:x=[],onToggleSectionSelect:b,onShowSectionOrders:v,pinnedSectionIds:w=[]}){const[N,k]=y.useState(null),[T,C]=y.useState(null),P=(V,ie)=>(N==null?void 0:N.type)===V&&(N==null?void 0:N.id)===ie,L=(V,ie)=>(T==null?void 0:T.type)===V&&(T==null?void 0:T.id)===ie,q=y.useCallback(()=>{const V=[];for(const ie of t)for(const le of ie.chapters)for(const he of le.sections)V.push({id:he.id,partId:ie.id,partTitle:ie.title,chapterId:le.id,chapterTitle:le.title});return V},[t]),z=y.useCallback(async(V,ie,le,he)=>{var Z;V.preventDefault(),V.stopPropagation();const I=V.dataTransfer.getData("text/plain"),Q=bg(I);if(!Q||Q.type===ie&&Q.id===le)return;const $=q(),xe=new Map($.map(F=>[F.id,F]));if(Q.type==="part"&&ie==="part"){const F=t.map(D=>D.id),U=F.indexOf(Q.id),pe=F.indexOf(le);if(U===-1||pe===-1)return;const fe=[...F];fe.splice(U,1),fe.splice(U_.id===D);if(K)for(const _ of K.chapters)for(const Y of _.sections){const te=xe.get(Y.id);te&&oe.push(te)}}await r(oe);return}if(Q.type==="chapter"&&(ie==="chapter"||ie==="section"||ie==="part")){const F=t.find(te=>te.chapters.some(Ne=>Ne.id===Q.id)),U=F==null?void 0:F.chapters.find(te=>te.id===Q.id);if(!F||!U)return;let pe,fe,oe=null;if(ie==="section"){const te=xe.get(le);if(!te)return;pe=te.partId,fe=te.partTitle,oe=le}else if(ie==="chapter"){const te=t.find(We=>We.chapters.some(St=>St.id===le)),Ne=te==null?void 0:te.chapters.find(We=>We.id===le);if(!te||!Ne)return;pe=te.id,fe=te.title;const Fe=$.filter(We=>We.chapterId===le).pop();oe=(Fe==null?void 0:Fe.id)??null}else{const te=t.find(Ne=>Ne.id===le);if(!te)return;if(pe=te.id,fe=te.title,te.chapters[0]){const Ne=$.filter(Fe=>Fe.partId===te.id&&Fe.chapterId===te.chapters[0].id);oe=((Z=Ne[Ne.length-1])==null?void 0:Z.id)??null}}const D=U.sections.map(te=>te.id),K=$.filter(te=>!D.includes(te.id));let _=K.length;if(oe){const te=K.findIndex(Ne=>Ne.id===oe);te>=0&&(_=te+1)}const Y=D.map(te=>({...xe.get(te),partId:pe,partTitle:fe,chapterId:U.id,chapterTitle:U.title}));await r([...K.slice(0,_),...Y,...K.slice(_)]);return}if(Q.type==="section"&&(ie==="section"||ie==="chapter"||ie==="part")){if(!he)return;const{partId:F,partTitle:U,chapterId:pe,chapterTitle:fe}=he,oe=$.findIndex(te=>te.id===Q.id);if(oe===-1)return;const D=$.filter(te=>te.id!==Q.id);let K;if(ie==="section"){const te=D.findIndex(Ne=>Ne.id===le);K=te>=0?te+1:D.length}else if(ie==="chapter"){const te=D.filter(Ne=>Ne.chapterId===le).pop();K=te?D.findIndex(Ne=>Ne.id===te.id)+1:D.length}else{const te=t.find(Ne=>Ne.id===le);if(te!=null&&te.chapters[0]){const Ne=D.filter(We=>We.partId===te.id&&We.chapterId===te.chapters[0].id),Fe=Ne[Ne.length-1];K=Fe?D.findIndex(We=>We.id===Fe.id)+1:D.length}else K=D.length}const Y={...$[oe],partId:F,partTitle:U,chapterId:pe,chapterTitle:fe};D.splice(K,0,Y),await r(D)}},[t,q,r]),H=(V,ie,le)=>({onDragEnter:he=>{he.preventDefault(),he.stopPropagation(),he.dataTransfer.dropEffect="move",C({type:V,id:ie})},onDragOver:he=>{he.preventDefault(),he.stopPropagation(),he.dataTransfer.dropEffect="move",C({type:V,id:ie})},onDragLeave:()=>C(null),onDrop:he=>{C(null);const I=bg(he.dataTransfer.getData("text/plain"));I&&(V==="section"&&I.type==="section"&&I.id===ie||(V==="part"?I.type==="part"?z(he,"part",ie):le&&z(he,"part",ie,le):V==="chapter"&&le?(I.type==="section"||I.type==="chapter")&&z(he,"chapter",ie,le):V==="section"&&le&&z(he,"section",ie,le)))}}),R=V=>cj[V%cj.length],se=V=>t.slice(0,V).filter(ie=>!K9(ie)).length,X=V=>s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-gray-500 font-mono text-xs tabular-nums shrink-0 mr-1.5 max-w-[72px] truncate",title:`章节ID: ${V.id}`,children:V.id}),s.jsx("span",{className:"truncate",children:V.title})]});return s.jsx("div",{className:"space-y-3",children:t.map((V,ie)=>{var U,pe,fe,oe;const le=V.title==="序言"||V.title.includes("序言"),he=V.title==="尾声"||V.title.includes("尾声"),I=V.title==="附录"||V.title.includes("附录"),Q=L("part",V.id),$=e.includes(V.id),xe=V.chapters.length,Z=V.chapters.reduce((D,K)=>D+K.sections.length,0);if(le&&V.chapters.length===1&&V.chapters[0].sections.length===1){const D=V.chapters[0].sections[0],K=L("section",D.id),_={partId:V.id,partTitle:V.title,chapterId:V.chapters[0].id,chapterTitle:V.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:Y=>{Y.stopPropagation(),Y.dataTransfer.setData("text/plain","section:"+D.id),Y.dataTransfer.effectAllowed="move",k({type:"section",id:D.id})},onDragEnd:()=>{k(null),C(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${K?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${P("section",D.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...H("section",D.id,_),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(gi,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:Y=>Y.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:x.includes(D.id),onChange:()=>b(D.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(wr,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[V.chapters[0].title," | ",D.title]}),w.includes(D.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(Rc,{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:Y=>Y.stopPropagation(),onClick:Y=>Y.stopPropagation(),children:[D.price===0||D.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:["¥",D.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",D.clickCount??0," · 付款 ",D.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(D.hotScore??0).toFixed(1)," · 第",D.hotRank&&D.hotRank>0?D.hotRank:"-","名"]}),v&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(D),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(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(D),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(rn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(D),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]})]},V.id)}if(V.title==="2026每日派对干货"||V.title.includes("2026每日派对干货")){const D=L("part",V.id);return s.jsxs("div",{className:`rounded-xl border overflow-hidden transition-all duration-200 ${D?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50 bg-[#1C1C1E]"}`,...H("part",V.id,{partId:V.id,partTitle:V.title,chapterId:((U=V.chapters[0])==null?void 0:U.id)??"",chapterTitle:((pe=V.chapters[0])==null?void 0:pe.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:K=>{K.stopPropagation(),K.dataTransfer.setData("text/plain","part:"+V.id),K.dataTransfer.effectAllowed="move",k({type:"part",id:V.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${P("part",V.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/50"}`,children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(gi,{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:V.badgeText||"派"}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:V.title}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:dj(V)})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:K=>K.stopPropagation(),onClick:K=>K.stopPropagation(),children:[o&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(V),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx(Un,{className:"w-3.5 h-3.5"})}),h&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(V),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx(rn,{className:"w-3.5 h-3.5"})}),f&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(V),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",title:"本篇章数与节数",children:[xe," 章 · ",Z," 节"]}),s.jsx("button",{type:"button",draggable:!1,className:"p-1 rounded-md hover:bg-white/10 text-gray-500",title:$?"收起":"展开",onMouseDown:K=>K.stopPropagation(),onClick:K=>{K.stopPropagation(),n(V.id)},children:$?s.jsx(Sl,{className:"w-5 h-5"}):s.jsx(ml,{className:"w-5 h-5"})})]})]}),$&&V.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:V.chapters.map(K=>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:K.title}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:_=>_.stopPropagation(),children:[m&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>m(V,K),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(rn,{className:"w-3.5 h-3.5"})}),c&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>c(V),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx(Un,{className:"w-3.5 h-3.5"})}),u&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>u(V,K),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:K.sections.map(_=>{const Y=L("section",_.id);return s.jsxs("div",{draggable:!0,onDragStart:te=>{te.stopPropagation(),te.dataTransfer.setData("text/plain","section:"+_.id),te.dataTransfer.effectAllowed="move",k({type:"section",id:_.id})},onDragEnd:()=>{k(null),C(null)},onClick:()=>a(_),className:`flex items-center justify-between py-2 px-3 rounded-lg min-h-[40px] cursor-pointer select-none transition-all duration-200 ${Y?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${P("section",_.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...H("section",_.id,{partId:V.id,partTitle:V.title,chapterId:K.id,chapterTitle:K.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(gi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:te=>te.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:x.includes(_.id),onChange:()=>b(_.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx("span",{className:"text-sm text-gray-200 truncate flex items-center min-w-0",children:X(_)}),w.includes(_.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(Rc,{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:te=>te.stopPropagation(),children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",_.clickCount??0," · 付款 ",_.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(_.hotScore??0).toFixed(1)," · 第",_.hotRank&&_.hotRank>0?_.hotRank:"-","名"]}),v&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>v(_),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(rn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(_),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]},_.id)})})]},K.id))})]},V.id)}if(I)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:V.chapters.map((D,K)=>D.sections.length>0?D.sections.map(_=>{const Y=L("section",_.id);return s.jsxs("div",{draggable:!0,onDragStart:te=>{te.stopPropagation(),te.dataTransfer.setData("text/plain","section:"+_.id),te.dataTransfer.effectAllowed="move",k({type:"section",id:_.id})},onDragEnd:()=>{k(null),C(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 group cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${Y?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${P("section",_.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...H("section",_.id,{partId:V.id,partTitle:V.title,chapterId:D.id,chapterTitle:D.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(gi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:te=>te.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:x.includes(_.id),onChange:()=>b(_.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:["附录",K+1," | ",D.title," | ",_.title]}),w.includes(_.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(Rc,{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:["点击 ",_.clickCount??0," · 付款 ",_.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(_.hotScore??0).toFixed(1)," · 第",_.hotRank&&_.hotRank>0?_.hotRank:"-","名"]}),v&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>v(_),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(J,{variant:"ghost",size:"sm",onClick:()=>a(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(rn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>i(_),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]}),s.jsx(ml,{className:"w-4 h-4 text-gray-500 shrink-0"})]},_.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:["附录",K+1," | ",D.title,"(空)"]}),s.jsx(ml,{className:"w-4 h-4 text-gray-500 shrink-0"})]},D.id))})]},V.id);if(he&&V.chapters.length===1&&V.chapters[0].sections.length===1){const D=V.chapters[0].sections[0],K=L("section",D.id),_={partId:V.id,partTitle:V.title,chapterId:V.chapters[0].id,chapterTitle:V.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:Y=>{Y.stopPropagation(),Y.dataTransfer.setData("text/plain","section:"+D.id),Y.dataTransfer.effectAllowed="move",k({type:"section",id:D.id})},onDragEnd:()=>{k(null),C(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${K?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${P("section",D.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...H("section",D.id,_),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(gi,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:Y=>Y.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:x.includes(D.id),onChange:()=>b(D.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(wr,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[V.chapters[0].title," | ",D.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:Y=>Y.stopPropagation(),onClick:Y=>Y.stopPropagation(),children:[D.price===0||D.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:["¥",D.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",D.clickCount??0," · 付款 ",D.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(D.hotScore??0).toFixed(1)," · 第",D.hotRank&&D.hotRank>0?D.hotRank:"-","名"]}),v&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(D),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(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(D),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(rn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(D),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]})]},V.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:V.chapters.map(D=>D.sections.map(K=>{const _=L("section",K.id);return s.jsxs("div",{draggable:!0,onDragStart:Y=>{Y.stopPropagation(),Y.dataTransfer.setData("text/plain","section:"+K.id),Y.dataTransfer.effectAllowed="move",k({type:"section",id:K.id})},onDragEnd:()=>{k(null),C(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${_?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${P("section",K.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...H("section",K.id,{partId:V.id,partTitle:V.title,chapterId:D.id,chapterTitle:D.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(gi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:Y=>Y.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:x.includes(K.id),onChange:()=>b(K.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:[D.title," | ",K.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",K.clickCount??0," · 付款 ",K.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(K.hotScore??0).toFixed(1)," · 第",K.hotRank&&K.hotRank>0?K.hotRank:"-","名"]}),v&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(K),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(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(K),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(rn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(K),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]})]},K.id)}))})]},V.id):s.jsxs("div",{className:`rounded-xl border bg-[#1C1C1E] overflow-hidden transition-all duration-200 ${Q?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50"}`,...H("part",V.id,{partId:V.id,partTitle:V.title,chapterId:((fe=V.chapters[0])==null?void 0:fe.id)??"",chapterTitle:((oe=V.chapters[0])==null?void 0:oe.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:D=>{D.stopPropagation(),D.dataTransfer.setData("text/plain","part:"+V.id),D.dataTransfer.effectAllowed="move",k({type:"part",id:V.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${P("part",V.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] rounded-xl shadow-xl shadow-[#38bdac]/20":"hover:bg-[#162840]/50"}`,children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(gi,{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-lg shadow-lg shadow-[#38bdac]/30 shrink-0",children:V.badgeText||R(se(ie))}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:V.title}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:dj(V)})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:D=>D.stopPropagation(),onClick:D=>D.stopPropagation(),children:[o&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(V),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx(Un,{className:"w-3.5 h-3.5"})}),h&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(V),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx(rn,{className:"w-3.5 h-3.5"})}),f&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(V),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",title:"本篇章数与节数",children:[xe," 章 · ",Z," 节"]}),s.jsx("button",{type:"button",draggable:!1,className:"p-1 rounded-md hover:bg-white/10 text-gray-500",title:$?"收起":"展开",onMouseDown:D=>D.stopPropagation(),onClick:D=>{D.stopPropagation(),n(V.id)},children:$?s.jsx(Sl,{className:"w-5 h-5"}):s.jsx(ml,{className:"w-5 h-5"})})]})]}),$&&s.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:V.chapters.map(D=>{const K=L("chapter",D.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:_=>{_.stopPropagation(),_.dataTransfer.setData("text/plain","chapter:"+D.id),_.dataTransfer.effectAllowed="move",k({type:"chapter",id:D.id})},onDragEnd:()=>{k(null),C(null)},onDragEnter:_=>{_.preventDefault(),_.stopPropagation(),_.dataTransfer.dropEffect="move",C({type:"chapter",id:D.id})},onDragOver:_=>{_.preventDefault(),_.stopPropagation(),_.dataTransfer.dropEffect="move",C({type:"chapter",id:D.id})},onDragLeave:()=>C(null),onDrop:_=>{C(null);const Y=bg(_.dataTransfer.getData("text/plain"));if(!Y)return;const te={partId:V.id,partTitle:V.title,chapterId:D.id,chapterTitle:D.title};(Y.type==="section"||Y.type==="chapter")&&z(_,"chapter",D.id,te)},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 ${K?"bg-[#38bdac]/15 ring-1 ring-[#38bdac]/50":""} ${P("chapter",D.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/30"}`,children:[s.jsx(gi,{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:D.title})]}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:_=>_.stopPropagation(),children:[m&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>m(V,D),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(rn,{className:"w-3.5 h-3.5"})}),c&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>c(V),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx(Un,{className:"w-3.5 h-3.5"})}),u&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>u(V,D),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:D.sections.map(_=>{const Y=L("section",_.id);return s.jsxs("div",{draggable:!0,onDragStart:te=>{te.stopPropagation(),te.dataTransfer.setData("text/plain","section:"+_.id),te.dataTransfer.effectAllowed="move",k({type:"section",id:_.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between py-2 px-3 rounded-lg group cursor-grab active:cursor-grabbing select-none min-h-[40px] transition-all duration-200 ${Y?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${P("section",_.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] shadow-lg":"hover:bg-[#162840]/50"}`,...H("section",_.id,{partId:V.id,partTitle:V.title,chapterId:D.id,chapterTitle:D.title}),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:te=>te.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:x.includes(_.id),onChange:()=>b(_.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx(gi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),s.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${_.price===0||_.isFree?"border-2 border-[#38bdac] bg-transparent":"bg-gray-500"}`}),s.jsx("span",{className:"text-sm text-gray-200 truncate flex items-center min-w-0",children:X(_)}),w.includes(_.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(Rc,{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:te=>te.stopPropagation(),onClick:te=>te.stopPropagation(),children:[_.isNew&&s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"NEW"}),_.price===0||_.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:["¥",_.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",title:"点击次数 · 付款笔数",children:["点击 ",_.clickCount??0," · 付款 ",_.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(_.hotScore??0).toFixed(1)," · 第",_.hotRank&&_.hotRank>0?_.hotRank:"-","名"]}),v&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>v(_),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(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(rn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(_),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]})]},_.id)})})]},D.id)})})]},V.id)})})}function G9(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 Oe(r)}function J9(t){return Oe(`/api/db/person?personId=${encodeURIComponent(t)}`)}function Q9(t){var r;const e=new URLSearchParams;e.set("page",String(t.page)),e.set("limit",String(t.limit)),(r=t==null?void 0:t.keyword)!=null&&r.trim()&&e.set("keyword",t.keyword.trim());const n=e.toString();return Oe(n?`/api/admin/ckb/plans?${n}`:"/api/admin/ckb/plans")}const Y9=10;function I4(t){const e=(t??"").trim();if(!e)return"";if(/^https?:\/\//i.test(e))return Ua(e);const n=e.startsWith("/")?e:`/${e}`;return Ua(El(n))}function X9(t){const{nickname:e,avatar:n}=t,r=I4(n);return s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"h-8 w-8 shrink-0 overflow-hidden rounded-full bg-gray-800",children:r?s.jsx("img",{src:r,alt:"",className:"h-full w-full object-cover",onError:a=>{a.currentTarget.style.display="none"}}):s.jsx("span",{className:"flex h-full w-full items-center justify-center text-[10px] text-gray-500",children:e.slice(0,1)})}),s.jsx("span",{className:"min-w-0 truncate text-left font-medium text-white",children:e})]})}function Z9(t,e){const n=new Set(t.map(a=>a.id).filter(Boolean)),r=[...t];for(const a of e){const i=a.id;i&&!n.has(i)&&(n.add(i),r.push(a))}return r}function eV({id:t,label:e,value:n,preview:r,previewLoading:a=!1,onSelect:i,onClear:o,containerOpen:c,disabled:u=!1,hint:h,className:f,portalMountRef:m,positionContainerRef:x}){const[b,v]=y.useState(!1),[w,N]=y.useState(""),k=Lo(w,300),[T,C]=y.useState([]),[P,L]=y.useState(!1),[q,z]=y.useState(!1),[H,R]=y.useState(0),se=y.useRef(1),X=y.useRef(!1),V=y.useRef(!1),ie=y.useRef(null),le=y.useRef(null),[he,I]=y.useState({top:0,left:0,width:320,maxH:360}),Q=y.useCallback(()=>{const D=le.current;if(!D||typeof window>"u")return;const K=D.getBoundingClientRect(),_=Math.min(400,Math.max(200,window.innerHeight-K.bottom-16)),Y=x==null?void 0:x.current;if(Y){const te=Y.getBoundingClientRect();I({top:K.bottom-te.top+6,left:K.left-te.left,width:Math.max(K.width,300),maxH:_})}else I({top:K.bottom+6,left:K.left,width:Math.max(K.width,300),maxH:_})},[x]);y.useEffect(()=>{c||(v(!1),N(""))},[c]),y.useLayoutEffect(()=>{if(b)return Q(),window.addEventListener("scroll",Q,!0),window.addEventListener("resize",Q),()=>{window.removeEventListener("scroll",Q,!0),window.removeEventListener("resize",Q)}},[b,Q]);const $=y.useCallback(async(D,K,_)=>{if(!X.current){X.current=!0,_?z(!0):L(!0);try{const Y=new URLSearchParams({page:String(D),pageSize:String(Y9),search:K.trim()}),te=await Oe(`/api/db/users?${Y}`);if(te!=null&&te.success&&Array.isArray(te.users)){const Ne=te.users,Fe=typeof te.total=="number"?te.total:0;R(Fe),_?Ne.length===0?V.current=!0:C(We=>{const St=Z9(We,Ne);return St.length===We.length?V.current=!0:se.current=D,St}):(C(Ne),se.current=D)}else te!=null&&te.error&&G.error(te.error)}catch(Y){G.error(Y instanceof Error?Y.message:"加载用户列表失败")}finally{X.current=!1,L(!1),z(!1)}}},[]);y.useEffect(()=>{b&&(se.current=1,V.current=!1,$(1,k,!1))},[b,k,$]);const xe=y.useCallback(()=>{P||q||X.current||V.current||H>0&&T.length>=H||$(se.current+1,k,!0)},[k,$,P,q,H,T.length]);y.useLayoutEffect(()=>{if(!b||P||q||V.current||H>0&&T.length>=H||T.length===0)return;const D=ie.current;D&&(D.scrollHeight>D.clientHeight+12||xe())},[b,T.length,P,q,H,xe]);const Z=D=>{(D.id||"").trim()&&(i(D),v(!1),N(""))},F=D=>{D.preventDefault(),D.stopPropagation(),!(u||a)&&o()},U=!!n.trim(),pe=H>0,fe=typeof document>"u"?null:(m==null?void 0:m.current)??document.body,oe=b&&fe&&Yc.createPortal(s.jsxs("div",{"data-member-user-select-portal":"",children:[s.jsx("div",{className:"fixed inset-0 z-40 bg-transparent","aria-hidden":!0,onMouseDown:D=>{D.preventDefault(),v(!1)}}),s.jsxs("div",{role:"listbox",className:"fixed z-50 overflow-hidden rounded-lg border border-gray-700 bg-[#0b1828] shadow-xl",style:{top:he.top,left:he.left,width:he.width,height:he.maxH,maxHeight:he.maxH,display:"grid",gridTemplateRows:pe?"auto auto minmax(0, 1fr) auto":"auto minmax(0, 1fr) auto"},children:[s.jsx("div",{className:"border-b border-gray-700/60 p-2 min-h-0",children:s.jsx(ce,{className:"bg-[#050c18] border-gray-700 text-white h-9 text-sm",placeholder:"搜索昵称、手机号、用户 id…",value:w,onChange:D=>N(D.target.value),onMouseDown:D=>D.stopPropagation(),autoFocus:!0})}),pe?s.jsxs("p",{className:"text-[11px] text-gray-500 px-3 pt-1.5 min-h-0 leading-snug",children:["已加载 ",T.length," / ",H," 条",T.length{const K=D.currentTarget;P||q||V.current||H>0&&T.length>=H||K.scrollHeight-K.scrollTop-K.clientHeight<100&&xe()},children:P&&T.length===0?s.jsx("div",{className:"flex h-40 items-center justify-center text-gray-400 text-sm",children:"正在加载…"}):T.length===0?s.jsx("div",{className:"flex h-40 items-center justify-center text-gray-500 text-sm px-3 text-center",children:"暂无用户,请调整搜索条件"}):s.jsxs("div",{className:"p-1.5 space-y-0.5",children:[T.map(D=>{const K=D.id||"",_=n===K,Y=I4(D.avatar),te=D.nickname&&String(D.nickname).trim()||"(无昵称)";return s.jsxs("button",{type:"button",role:"option","aria-selected":_,className:$t("flex w-full items-center gap-2 rounded-md border px-2.5 py-2 text-left text-sm transition-colors",_?"border-[#38bdac] bg-[#38bdac]/15 text-white":"border-transparent bg-[#050c18] hover:border-[#38bdac]/40 hover:bg-[#0a1628]"),onMouseDown:Ne=>Ne.preventDefault(),onClick:()=>Z(D),children:[s.jsx("span",{className:"h-9 w-9 shrink-0 overflow-hidden rounded-full bg-gray-800",children:Y?s.jsx("img",{src:Y,alt:"",className:"h-full w-full object-cover",onError:Ne=>{Ne.currentTarget.style.display="none"}}):s.jsx("span",{className:"flex h-full w-full items-center justify-center text-[11px] text-gray-500",children:te.slice(0,1)})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"font-medium truncate",children:te}),s.jsxs("div",{className:"text-[11px] text-gray-500 font-mono truncate mt-0.5",children:[D.phone?`${D.phone} · `:"",K]})]})]},K)}),q&&s.jsx("div",{className:"py-2 text-center text-gray-500 text-xs",children:"加载更多…"})]})}),s.jsx("div",{className:"flex justify-end gap-2 border-t border-gray-700/60 px-2 py-1.5 min-h-0",children:s.jsx(J,{type:"button",variant:"ghost",size:"sm",className:"text-gray-400 h-8 text-xs",onMouseDown:D=>D.preventDefault(),onClick:()=>{o(),v(!1)},children:"清除绑定"})})]})]}),fe);return s.jsxs("div",{className:$t("space-y-1.5",f),children:[typeof e=="string"?s.jsx(ne,{htmlFor:t,className:"text-gray-400 text-xs",children:e}):e,s.jsxs("div",{className:"flex gap-2 items-stretch",children:[s.jsxs("button",{ref:le,id:t,type:"button",disabled:u,"aria-haspopup":"listbox","aria-expanded":b,className:$t("flex h-10 min-w-0 flex-1 items-center gap-2 rounded-md border bg-[#0a1628] px-3 text-left text-sm transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-[#38bdac]/50 focus-visible:ring-offset-0",u&&"cursor-not-allowed opacity-50",b?"border-[#38bdac] ring-1 ring-[#38bdac]/35":"border-gray-700 hover:border-gray-600"),onClick:()=>{u||(b||(N(""),Q()),v(D=>!D))},children:[s.jsx("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate",children:a?s.jsx("span",{className:"text-gray-500",children:"正在加载已绑定用户…"}):U?s.jsx(X9,{nickname:(r==null?void 0:r.nickname)||n,avatar:r==null?void 0:r.avatar}):s.jsx("span",{className:"text-gray-500",children:"选择会员用户(可搜索,可不绑定)"})}),s.jsx(Sl,{className:$t("h-4 w-4 shrink-0 text-gray-400 transition-transform",b&&"rotate-180")})]}),U&&s.jsx(J,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0 border-gray-600 text-gray-400 hover:text-white",disabled:u||a,"aria-label":"清除已选用户",onClick:F,children:s.jsx(rs,{className:"h-4 w-4"})})]}),h&&s.jsx("div",{className:"text-[11px] text-gray-500",children:h}),oe]})}const P4=11,uj={personId:"",name:"",boundUserId:"",aliases:"",label:"",sceneId:P4,ckbApiKey:"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:"phone",remarkFormat:"",addFriendInterval:1,startTime:"06:00",endTime:"22:00",deviceGroups:""};function tV({open:t,onOpenChange:e,editingPerson:n,onSubmit:r}){var K;const a=!!n,i=y.useRef(null),o=y.useRef(null),[c,u]=y.useState(uj),[h,f]=y.useState(!1),[m,x]=y.useState(!1),[b,v]=y.useState([]),[w,N]=y.useState(!1),[k,T]=y.useState(""),[C,P]=y.useState([]),[L,q]=y.useState(!1),[z,H]=y.useState(""),[R,se]=y.useState(!1),[X,V]=y.useState(null),[ie,le]=y.useState(!1),[he,I]=y.useState({}),[Q,$]=y.useState({loading:!1,messages:[]}),xe=Lo(c.name,400),Z=Lo(c.aliases,400);y.useEffect(()=>{if(!t){$({loading:!1,messages:[]});return}const _=xe.trim(),Y=Z.trim();if(!_&&!Y){$({loading:!1,messages:[]});return}let te=!1;$(We=>({...We,loading:!0}));const Ne=a?((n==null?void 0:n.personId)??"").trim():"",Fe=new URLSearchParams;return _&&Fe.set("name",xe.trim()),Fe.set("aliases",Z),Ne&&Fe.set("excludePersonId",Ne),Oe(`/api/db/persons/check-unique?${Fe.toString()}`).then(We=>{if(!te){if((We==null?void 0:We.success)===!1&&(We!=null&&We.error)){$({loading:!1,messages:[We.error]});return}if((We==null?void 0:We.ok)===!1&&Array.isArray(We.messages)&&We.messages.length>0){$({loading:!1,messages:We.messages});return}$({loading:!1,messages:[]})}}).catch(()=>{te||$({loading:!1,messages:[]})}),()=>{te=!0}},[t,xe,Z,a,n==null?void 0:n.personId]),y.useEffect(()=>{if(t){if(T(""),V(null),le(!1),n){u({personId:n.personId??n.name??"",name:n.name??"",boundUserId:n.userId??"",aliases:n.aliases??"",label:n.label??"",sceneId:P4,ckbApiKey:n.ckbApiKey??"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:n.remarkType??"phone",remarkFormat:n.remarkFormat??"",addFriendInterval:n.addFriendInterval??1,startTime:n.startTime??"06:00",endTime:n.endTime??"22:00",deviceGroups:n.deviceGroups??""});const _=(n.userId??"").trim();_&&(le(!0),Oe(`/api/db/users?id=${encodeURIComponent(_)}`).then(Y=>{const te=Y==null?void 0:Y.user;te!=null&&te.id?V({id:te.id,nickname:te.nickname&&String(te.nickname).trim()||te.id,phone:te.phone,avatar:te.avatar??void 0}):V({id:_,nickname:_,phone:void 0,avatar:void 0})}).catch(()=>{V({id:_,nickname:_,phone:void 0,avatar:void 0})}).finally(()=>le(!1)))}else u({...uj});I({}),b.length===0&&F(""),C.length===0&&U("")}},[t,n]);const F=async _=>{N(!0);try{const Y=await G9({page:1,limit:50,keyword:_});Y!=null&&Y.success&&Array.isArray(Y.devices)?v(Y.devices):Y!=null&&Y.error&&G.error(Y.error)}catch(Y){G.error(Y instanceof Error?Y.message:"加载设备列表失败")}finally{N(!1)}},U=async _=>{q(!0);try{const Y=await Q9({page:1,limit:100,keyword:_});Y!=null&&Y.success&&Array.isArray(Y.plans)?P(Y.plans):Y!=null&&Y.error&&G.error(Y.error)}catch{G.error("加载计划列表失败")}finally{q(!1)}},pe=()=>{u(_=>{const Y=(_.boundUserId||"").trim(),te={..._,boundUserId:""};return!a&&Y&&(_.personId||"").trim()===Y&&(te.personId=""),te}),V(null)},fe=_=>{const Y=Array.isArray(_.deviceGroups)?_.deviceGroups.map(String).join(","):"";u(te=>({...te,ckbApiKey:_.apiKey||"",greeting:_.greeting||te.greeting,tips:_.tips||te.tips,remarkType:_.remarkType||te.remarkType,remarkFormat:_.remarkFormat||te.remarkFormat,addFriendInterval:_.addInterval||te.addFriendInterval,startTime:_.startTime||te.startTime,endTime:_.endTime||te.endTime,deviceGroups:Y||te.deviceGroups})),se(!1),G.success(`已选择计划「${_.name}」,参数已覆盖`)},oe=z.trim()?C.filter(_=>(_.name||"").includes(z.trim())||String(_.id).includes(z.trim())):C,D=async()=>{var Ne;const _={};(!c.name||!String(c.name).trim())&&(_.name="请填写名称");const Y=c.addFriendInterval;if((typeof Y!="number"||Y<1)&&(_.addFriendInterval="添加间隔至少为 1 分钟"),(((Ne=c.deviceGroups)==null?void 0:Ne.split(",").map(Fe=>Fe.trim()).filter(Boolean))??[]).length===0&&(_.deviceGroups="请至少选择 1 台设备"),I(_),Object.keys(_).length>0){G.error(_.name||_.addFriendInterval||_.deviceGroups||"请完善必填项");return}if(Q.messages.length>0){G.error(Q.messages[0]??"名称或别名与他人重复");return}f(!0);try{await r(c),e(!1)}catch(Fe){G.error(Fe instanceof Error?Fe.message:"保存失败")}finally{f(!1)}};return s.jsx(Wt,{open:t,onOpenChange:e,children:s.jsxs(Ut,{ref:i,className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] flex min-h-0 flex-col gap-0 p-0",children:[s.jsxs("div",{ref:o,className:"relative flex min-h-0 flex-1 flex-col overflow-visible",children:[s.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pt-6",children:[s.jsxs(Kt,{children:[s.jsx(qt,{className:"text-[#38bdac]",children:a?"编辑人物":"添加人物 — 存客宝 API 获客"}),s.jsx(jf,{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(ne,{className:"text-gray-400 text-xs",children:["名称 ",s.jsx("span",{className:"text-red-400",children:"*"})]}),s.jsx(ce,{className:`bg-[#0a1628] text-white ${he.name?"border-red-500 focus-visible:ring-red-500":Q.messages.length>0?"border-amber-600 focus-visible:ring-amber-600/50":"border-gray-700"}`,placeholder:"如 卡若",value:c.name,onChange:_=>{u(Y=>({...Y,name:_.target.value})),he.name&&I(Y=>({...Y,name:void 0}))}}),he.name&&s.jsx("p",{className:"text-xs text-red-400",children:he.name})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"人物ID(可选)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"自动生成",value:(c.boundUserId||"").trim()?c.boundUserId:c.personId,onChange:_=>u(Y=>({...Y,personId:_.target.value})),disabled:a||!!(c.boundUserId||"").trim()})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"标签(身份/角色)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 超级个体",value:c.label,onChange:_=>u(Y=>({...Y,label:_.target.value}))})]}),s.jsx(eV,{className:"col-span-3",id:"person-bound-member-user",label:"绑定会员用户(可选,与「用户管理」中用户一致)",containerOpen:t,portalMountRef:o,positionContainerRef:i,value:c.boundUserId,preview:X,previewLoading:ie,onSelect:_=>{const Y=(_.id||"").trim();Y&&(u(te=>({...te,boundUserId:Y,...a?{}:{personId:Y}})),V({id:Y,nickname:_.nickname&&String(_.nickname).trim()||Y,phone:_.phone,avatar:_.avatar??void 0}))},onClear:pe,hint:s.jsx("span",{children:"单选;保存时后端校验用户是否存在。同一会员只能绑定一个 @人物;绑定后获客统计可与超级个体对齐。"})}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"别名(逗号分隔,@ 可匹配)"}),s.jsx(ce,{className:`bg-[#0a1628] text-white ${Q.messages.length>0?"border-amber-600 focus-visible:ring-amber-600/50":"border-gray-700"}`,placeholder:"如 卡卡, 若若",value:c.aliases,onChange:_=>u(Y=>({...Y,aliases:_.target.value}))})]}),s.jsx("div",{className:"col-span-3 space-y-1",children:Q.loading?s.jsx("p",{className:"text-xs text-gray-500",children:"正在检测名称与别名是否与他人重复…"}):Q.messages.length>0?s.jsx("div",{className:"rounded-md border border-amber-600/60 bg-amber-950/25 px-3 py-2 text-xs text-amber-200 space-y-1",children:Q.messages.map((_,Y)=>s.jsx("p",{children:_},`${Y}-${_.slice(0,24)}`))}):null})]})]}),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 relative",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"选择存客宝获客计划"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("div",{className:"flex-1 flex items-center bg-[#0a1628] border border-gray-700 rounded-md px-3 py-2 cursor-pointer hover:border-[#38bdac]/60 text-sm",onClick:()=>se(!R),children:c.ckbApiKey?s.jsx("span",{className:"text-white truncate",children:((K=C.find(_=>_.apiKey===c.ckbApiKey))==null?void 0:K.name)||`获客计划 (${c.ckbApiKey.slice(0,8)}…)`}):s.jsx("span",{className:"text-gray-500",children:"点击选择已有计划 / 新建时自动创建"})}),s.jsx(J,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-200 shrink-0",onClick:()=>{U(z),se(!0)},disabled:L,children:L?"加载...":"刷新"})]}),R&&s.jsxs("div",{className:"absolute z-50 top-full left-0 right-0 mt-1 bg-[#0b1828] border border-gray-700 rounded-lg shadow-xl max-h-64 flex flex-col",children:[s.jsx("div",{className:"p-2 border-b border-gray-700/60",children:s.jsx(ce,{className:"bg-[#050c18] border-gray-700 text-white h-8 text-xs",placeholder:"搜索计划名称...",value:z,onChange:_=>H(_.target.value),onKeyDown:_=>{_.key==="Enter"&&U(z)},autoFocus:!0})}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:oe.length===0?s.jsx("div",{className:"text-center py-4 text-gray-500 text-xs",children:L?"加载中...":"暂无计划"}):oe.map(_=>s.jsxs("div",{className:`px-3 py-2 cursor-pointer hover:bg-[#38bdac]/10 text-sm flex items-center justify-between ${c.ckbApiKey===_.apiKey?"bg-[#38bdac]/20 text-[#38bdac]":"text-white"}`,onClick:()=>fe(_),children:[s.jsxs("div",{className:"truncate",children:[s.jsx("span",{className:"font-medium",children:_.name}),s.jsxs("span",{className:"text-xs text-gray-500 ml-2",children:["ID:",String(_.id)]})]}),_.enabled?s.jsx("span",{className:"text-[10px] text-green-400 bg-green-400/10 px-1.5 rounded shrink-0 ml-2",children:"启用"}):s.jsx("span",{className:"text-[10px] text-gray-500 bg-gray-500/10 px-1.5 rounded shrink-0 ml-2",children:"停用"})]},String(_.id)))}),s.jsx("div",{className:"p-2 border-t border-gray-700/60 flex justify-end",children:s.jsx(J,{type:"button",size:"sm",variant:"ghost",className:"text-gray-400 h-7 text-xs",onClick:()=>se(!1),children:"关闭"})})]}),s.jsx("p",{className:"text-xs text-gray-500",children:"选择计划后自动覆盖下方参数。新建人物时若不选择则自动创建新计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(ne,{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 ${he.deviceGroups?"border-red-500":"border-gray-700"}`,children:[s.jsx(ce,{className:"bg-[#0a1628] border-0 text-white focus-visible:ring-0 focus-visible:ring-offset-0",placeholder:"未选择设备",readOnly:!0,value:c.deviceGroups?`已选择 ${c.deviceGroups.split(",").filter(Boolean).length} 个设备`:"",onClick:()=>x(!0)}),s.jsx(J,{type:"button",variant:"outline",className:"border-0 border-l border-inherit rounded-r-md text-gray-200",onClick:()=>x(!0),children:"选择"})]}),he.deviceGroups?s.jsx("p",{className:"text-xs text-red-400",children:he.deviceGroups}):s.jsx("p",{className:"text-xs text-gray-500",children:"从存客宝设备列表中选择,至少选择 1 台设备参与获客计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"好友备注"}),s.jsxs(Mc,{value:c.remarkType,onValueChange:_=>u(Y=>({...Y,remarkType:_})),children:[s.jsx(fl,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(Ac,{placeholder:"选择备注类型"})}),s.jsxs(pl,{children:[s.jsx(vr,{value:"phone",children:"手机号"}),s.jsx(vr,{value:"nickname",children:"昵称"}),s.jsx(vr,{value:"source",children:"来源"})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"备注格式(手机号+标签,标签不超过6字)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 {手机号}-{来源标签},总长不超过10字",value:c.remarkFormat,onChange:_=>u(Y=>({...Y,remarkFormat:_.target.value}))}),s.jsx("p",{className:"text-xs text-gray-500",children:"格式:手机号+来源标签(标签≤6字,总长≤10字)"})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"打招呼语"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"你好,请通过",value:c.greeting,onChange:_=>u(Y=>({...Y,greeting:_.target.value}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"添加间隔(分钟)"}),s.jsx(ce,{type:"number",min:1,className:`bg-[#0a1628] text-white ${he.addFriendInterval?"border-red-500 focus-visible:ring-red-500":"border-gray-700"}`,value:c.addFriendInterval,onChange:_=>{u(Y=>({...Y,addFriendInterval:Number(_.target.value)||1})),he.addFriendInterval&&I(Y=>({...Y,addFriendInterval:void 0}))}}),he.addFriendInterval&&s.jsx("p",{className:"text-xs text-red-400",children:he.addFriendInterval})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"允许加人时间段"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ce,{type:"time",className:"bg-[#0a1628] border-gray-700 text-white w-24",value:c.startTime,onChange:_=>u(Y=>({...Y,startTime:_.target.value}))}),s.jsx("span",{className:"text-gray-500 text-sm shrink-0",children:"至"}),s.jsx(ce,{type:"time",className:"bg-[#0a1628] border-gray-700 text-white w-24",value:c.endTime,onChange:_=>u(Y=>({...Y,endTime:_.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"获客成功提示"}),s.jsx(Il,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[72px] resize-none",placeholder:"请注意消息,稍后加你微信",value:c.tips,onChange:_=>u(Y=>({...Y,tips:_.target.value}))})]})]})]})]})]})]}),s.jsxs(Sn,{className:"gap-3 border-t border-gray-700/40 px-6 py-4 shrink-0",children:[s.jsx(J,{variant:"outline",onClick:()=>e(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(J,{onClick:D,disabled:h||Q.messages.length>0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:h?"保存中...":a?"保存":"添加"})]})]}),m&&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(J,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-200 h-8",onClick:()=>{const _=b.map(Ne=>String(Ne.id??"")),Y=c.deviceGroups?c.deviceGroups.split(",").map(Ne=>Ne.trim()).filter(Boolean):[],te=_.length>0&&_.every(Ne=>Y.includes(Ne));u(Ne=>({...Ne,deviceGroups:te?"":_.join(",")})),!te&&_.length>0&&I(Ne=>({...Ne,deviceGroups:void 0}))},children:(()=>{const _=b.map(te=>String(te.id??"")),Y=c.deviceGroups?c.deviceGroups.split(",").map(te=>te.trim()).filter(Boolean):[];return _.length>0&&_.every(te=>Y.includes(te))?"取消全选":"全选"})()}),s.jsx(ce,{className:"bg-[#050c18] border-gray-700 text-white h-8 w-52",placeholder:"搜索备注/微信号/IMEI",value:k,onChange:_=>T(_.target.value),onKeyDown:_=>{_.key==="Enter"&&F(k)}}),s.jsx(J,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-200 h-8",onClick:()=>F(k),disabled:w,children:"刷新"}),s.jsx(J,{type:"button",size:"icon",variant:"outline",className:"border-gray-600 text-gray-300 h-8 w-8",onClick:()=>x(!1),children:"✕"})]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:w?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-400 text-sm",children:"正在加载设备列表…"}):b.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:b.map(_=>{const Y=String(_.id??""),te=c.deviceGroups?c.deviceGroups.split(",").map(We=>We.trim()).filter(Boolean):[],Ne=te.includes(Y),Fe=()=>{let We;Ne?We=te.filter(St=>St!==Y):We=[...te,Y],u(St=>({...St,deviceGroups:We.join(",")})),We.length>0&&I(St=>({...St,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:Ne,onChange:Fe}),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:_.memo||_.wechatId||`设备 ${Y}`}),_.status==="online"&&s.jsx("span",{className:"rounded-full bg-emerald-500/20 text-emerald-400 text-[11px] px-2 py-0.5",children:"在线"}),_.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: ",Y]}),_.wechatId&&s.jsxs("span",{className:"mr-3",children:["微信号: ",_.wechatId]}),typeof _.totalFriend=="number"&&s.jsxs("span",{children:["好友数: ",_.totalFriend]})]})]})]},Y)})})}),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:["已选择"," ",c.deviceGroups?c.deviceGroups.split(",").filter(Boolean).length:0," ","台设备"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(J,{type:"button",variant:"outline",className:"border-gray-600 text-gray-200 h-8 px-4",onClick:()=>x(!1),children:"取消"}),s.jsx(J,{type:"button",className:"bg-[#38bdac] hover:bg-[#2da396] text-white h-8 px-4",onClick:()=>x(!1),children:"确定"})]})]})]})})]})})}function Ic(t){if(t!=null){if(typeof t=="number"&&Number.isFinite(t))return Math.round(t);if(typeof t=="string"&&t.trim()!==""){const e=Number(t.trim().replace(/%/g,""));if(Number.isFinite(e))return Math.round(e)}}}function nV(t,e,n){const r=new Map;for(const o of t){const c=o.partId||"part-1",u=o.partTitle||"未分类",h=o.chapterId||"chapter-1",f=o.chapterTitle||"未分类";r.has(c)||r.set(c,{id:c,title:u,badgeText:n[c]||"",chapters:new Map});const m=r.get(c);m.chapters.has(h)||m.chapters.set(h,{id:h,title:f,sections:[]}),m.chapters.get(h).sections.push({id:o.id,mid:o.mid,title:o.title,price:o.price??1,filePath:o.filePath,isFree:o.isFree,isNew:o.isNew,clickCount:o.clickCount??0,payCount:o.payCount??0,hotScore:o.hotScore??0,hotRank:e.get(o.id)??0,previewPercent:Ic(o.previewPercent)})}const a=Array.from(r.values()).map(o=>({...o,chapters:Array.from(o.chapters.values())})),i=new Map;for(let o=0;o{const u=i.get(o.id),h=i.get(c.id);return u!==void 0&&h!==void 0&&u!==h?u-h:u!==void 0&&h===void 0?-1:u===void 0&&h!==void 0?1:o.id.localeCompare(c.id)})}function sV(){var Yl,Xl,li;const t=Ga(),[e,n]=y.useState([]),[r,a]=y.useState(!0),[i,o]=y.useState([]),[c,u]=y.useState(null),[h,f]=y.useState(!1),[m,x]=y.useState(!1),[b,v]=y.useState(!1),[w,N]=y.useState(""),[k,T]=y.useState([]),[C,P]=y.useState(!1),[L,q]=y.useState({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),[z,H]=y.useState(null),[R,se]=y.useState(!1),[X,V]=y.useState(!1),[ie,le]=y.useState(null),[he,I]=y.useState(!1),[Q,$]=y.useState([]),[xe,Z]=y.useState(!1),[F,U]=y.useState(""),[pe,fe]=y.useState(""),[oe,D]=y.useState(!1),[K,_]=y.useState(""),[Y,te]=y.useState(!1),[Ne,Fe]=y.useState(null),[We,St]=y.useState(!1),[wt,Vt]=y.useState(!1),[_t,$n]=y.useState({readWeight:.5,recencyWeight:.3,payWeight:.2}),[Jt,dn]=y.useState(!1),[yn,bn]=y.useState(!1),[En,vn]=y.useState(1),[At,Nn]=y.useState([]),[Ft,je]=y.useState(!1),[Te,Ue]=y.useState([]),[it,Dt]=y.useState(!1),[Ct,$e]=y.useState(20),[mt,es]=y.useState(!1),[is,Gn]=y.useState(!1),[Fn,or]=y.useState([]),[ls,ws]=y.useState([]),[kr,Pn]=y.useState([]),[Js,js]=y.useState(!1),[Sr,lr]=y.useState(1),[cs,Cr]=y.useState(20),[cr,dr]=y.useState(0),[ra,Qs]=y.useState(1),[ks,Ss]=y.useState(""),[Ys,wn]=y.useState(!1),[re,ve]=y.useState(null),[Ye,ut]=y.useState({tagId:"",label:"",aliases:"",url:"",type:"url",appId:"",appSecret:"",pagePath:""}),[Bn,zs]=y.useState(!1),[Vr,aa]=y.useState(!1),[Ca,ds]=y.useState(null),[us,Ea]=y.useState(null),[zt,Ya]=y.useState({}),[O,Se]=y.useState(!1),[Ze,It]=y.useState(""),[Et,ht]=y.useState(""),[xt,jn]=y.useState([]),[Ot,Er]=y.useState(0),[Xs,Wl]=y.useState(1),[Xa,Cs]=y.useState(!1),[ia,Za]=y.useState(""),od=y.useRef(null),zi=y.useCallback(async(E,B)=>{var yt;const ue=new FormData;ue.append("file",E),ue.append("folder",B);const Ke=await(await fetch(El("/api/upload"),{method:"POST",body:ue,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((yt=Ke==null?void 0:Ke.data)==null?void 0:yt.url)||(Ke==null?void 0:Ke.url)||""},[]),$i=y.useCallback(E=>zi(E,"book-images"),[zi]),Fi=y.useCallback(E=>{const B=E.type.startsWith("video/")?"book-videos":"book-attachments";return zi(E,B)},[zi]),[Ta,oa]=y.useState({}),ei=E=>String(E||"").trim().slice(0,8),ti=y.useMemo(()=>{const E=new Map;return At.forEach((B,ue)=>{E.set(B.id,ue+1)}),E},[At]),bt=nV(e,ti,Ta),Hr=e.length,ni=10,Ma=Math.max(1,Math.ceil(At.length/ni)),Bi=At.slice((En-1)*ni,En*ni),hs=async()=>{a(!0);try{const E=await Oe("/api/db/book?action=list",{cache:"no-store"});n(Array.isArray(E==null?void 0:E.sections)?E.sections:[])}catch(E){console.error(E),n([])}finally{a(!1)}},Kl=async()=>{try{const E=await Oe("/api/db/config?key=book_part_badges",{cache:"no-store"});let B={};if(E&&Array.isArray(E.data)){const be=E.data.find(Ke=>Ke&&Ke.configKey==="book_part_badges");be&&be.configValue&&typeof be.configValue=="object"&&!Array.isArray(be.configValue)&&(B=be.configValue)}else E&&E.data&&typeof E.data=="object"&&!Array.isArray(E.data)&&(B=E.data);const ue={};Object.keys(B).forEach(be=>{const Ke=ei(B[be]);Ke&&(ue[be]=Ke)}),oa(ue)}catch(E){console.error(E),oa({})}},la=async()=>{je(!0);try{const E=await Oe("/api/db/book?action=ranking",{cache:"no-store"}),B=Array.isArray(E==null?void 0:E.sections)?E.sections:[];Nn(B);const ue=B.filter(be=>be.isPinned).map(be=>be.id);Ue(ue)}catch(E){console.error(E),Nn([])}finally{je(!1)}};y.useEffect(()=>{hs(),la(),Kl()},[]);const Vi=E=>{o(B=>B.includes(E)?B.filter(ue=>ue!==E):[...B,E])},Tr=y.useCallback(E=>{const B=e,ue=E.flatMap(be=>{const Ke=B.find(yt=>yt.id===be.id);return Ke?[{...Ke,partId:be.partId,partTitle:be.partTitle,chapterId:be.chapterId,chapterTitle:be.chapterTitle}]:[]});return n(ue),tn("/api/db/book",{action:"reorder",items:E}).then(be=>{be&&be.success===!1&&(n(B),G.error("排序失败: "+(be&&typeof be=="object"&&"error"in be?be.error:"未知错误")))}).catch(be=>{n(B),console.error("排序失败:",be),G.error("排序失败: "+(be instanceof Error?be.message:"网络或服务异常"))}),Promise.resolve()},[e]),Es=async E=>{if(confirm(`确定要删除章节「${E.title}」吗?此操作不可恢复。`))try{const B=await Ei(`/api/db/book?id=${encodeURIComponent(E.id)}`);B&&B.success!==!1?(G.success("已删除"),hs(),la()):G.error("删除失败: "+(B&&typeof B=="object"&&"error"in B?B.error:"未知错误"))}catch(B){console.error(B),G.error("删除失败")}},Mr=y.useCallback(async()=>{dn(!0);try{const E=await Oe("/api/db/config/full?key=article_ranking_weights",{cache:"no-store"}),B=E&&E.data;B&&typeof B.readWeight=="number"&&typeof B.recencyWeight=="number"&&typeof B.payWeight=="number"&&$n({readWeight:Math.max(0,Math.min(1,B.readWeight)),recencyWeight:Math.max(0,Math.min(1,B.recencyWeight)),payWeight:Math.max(0,Math.min(1,B.payWeight))})}catch{}finally{dn(!1)}},[]);y.useEffect(()=>{wt&&Mr()},[wt,Mr]);const si=async()=>{const{readWeight:E,recencyWeight:B,payWeight:ue}=_t,be=E+B+ue;if(Math.abs(be-1)>.001){G.error("三个权重之和必须等于 1");return}bn(!0);try{const Ke=await jt("/api/db/config",{key:"article_ranking_weights",value:{readWeight:E,recencyWeight:B,payWeight:ue},description:"文章排名算法权重"});Ke&&Ke.success!==!1?(G.success("排名权重已保存"),Vt(!1),hs(),la()):G.error("保存失败: "+(Ke&&typeof Ke=="object"&&"error"in Ke?Ke.error:""))}catch(Ke){console.error(Ke),G.error("保存失败")}finally{bn(!1)}},Aa=y.useCallback(async()=>{Dt(!0);try{const E=await Oe("/api/db/config/full?key=pinned_section_ids",{cache:"no-store"}),B=E&&E.data;Array.isArray(B)&&Ue(B)}catch{}finally{Dt(!1)}},[]),sn=y.useCallback(async()=>{try{const E=await Oe("/api/db/persons");E!=null&&E.success&&E.persons&&or(E.persons.map(B=>{const ue=B.deviceGroups,be=Array.isArray(ue)?ue.join(","):ue??"";return{id:B.token??B.personId??"",personId:B.personId,name:B.name,personSource:B.personSource??"",userId:B.userId,aliases:B.aliases??"",label:B.label??"",ckbApiKey:B.ckbApiKey??"",ckbPlanId:B.ckbPlanId,remarkType:B.remarkType,remarkFormat:B.remarkFormat,addFriendInterval:B.addFriendInterval,startTime:B.startTime,endTime:B.endTime,deviceGroups:be,isPinned:!!B.isPinned}}))}catch{}},[]),ld=y.useCallback(async(E,B)=>{const ue=(E.personId||E.id||"").trim();if(!ue){G.error("缺少 personId");return}B&&!(E.userId||"").trim()&&G.info("未绑定会员时,小程序仍显示 @ 名称,头像可能为默认图");try{const be=await tn("/api/db/persons/pin",{personId:ue,isPinned:B});if(!(be!=null&&be.success)){G.error((be==null?void 0:be.error)||"置顶失败");return}G.success(B?"已设为小程序首页置顶(全局仅一条)":"已取消置顶"),await sn()}catch(be){G.error(be instanceof Error?be.message:"操作失败")}},[sn]),Zs=y.useCallback(async()=>{try{const E=await Oe("/api/db/link-tags");E!=null&&E.success&&E.linkTags&&ws(E.linkTags.map(B=>({id:B.tagId,label:B.label,url:B.url,type:B.type||"url",appId:B.appId||"",pagePath:B.pagePath||"",hasAppSecret:!!B.hasAppSecret})))}catch{}},[]),ur=y.useCallback(async()=>{try{const E=await Oe("/api/db/config/full?key=ckb_lead_webhook_url",{cache:"no-store"});E!=null&&E.success&&typeof E.data=="string"&&Za(E.data)}catch{}},[]),Hi=y.useCallback(async()=>{try{const E=await Oe("/api/db/ckb-person-leads");if(E!=null&&E.success&&E.byPerson){const B={};for(const ue of E.byPerson)B[ue.token]=ue.total;Ya(B)}}catch{}},[]),Ar=y.useCallback(async(E,B,ue=1)=>{It(E),ht(B),Se(!0),Wl(ue),Cs(!0);try{const be=await Oe(`/api/db/ckb-person-leads?token=${encodeURIComponent(E)}&page=${ue}&pageSize=20`);be!=null&&be.success?(jn(be.records||[]),Er(be.total||0)):G.error((be==null?void 0:be.error)||"加载获客详情失败")}catch(be){G.error(be instanceof Error?be.message:"加载获客详情失败")}finally{Cs(!1)}},[]),hr=y.useCallback(async()=>{js(!0);try{const E=new URLSearchParams({page:String(Sr),pageSize:String(cs)}),B=ks.trim();B&&E.set("search",B);const ue=await Oe(`/api/db/link-tags?${E.toString()}`);if(ue!=null&&ue.success){const be=Array.isArray(ue.linkTags)?ue.linkTags:[];Pn(be.map(Ke=>({id:Ke.tagId,label:Ke.label,aliases:Ke.aliases||"",url:Ke.url,type:Ke.type||"url",appId:Ke.appId||"",pagePath:Ke.pagePath||"",hasAppSecret:!!Ke.hasAppSecret}))),dr(typeof ue.total=="number"?ue.total:0),Qs(typeof ue.totalPages=="number"&&ue.totalPages>0?ue.totalPages:1)}}catch(E){console.error(E),G.error("加载链接标签失败")}finally{js(!1)}},[Sr,cs,ks]),[Ia,ql]=y.useState([]),[Ir,Ts]=y.useState(""),[er,$s]=y.useState(!1),Gl=y.useRef(null),qo=y.useCallback(async()=>{try{const E=await Oe("/api/admin/linked-miniprograms");E!=null&&E.success&&Array.isArray(E.data)&&ql(E.data.map(B=>({...B,key:B.key})))}catch{}},[]),ri=Ia.filter(E=>!Ir.trim()||E.name.toLowerCase().includes(Ir.toLowerCase())||E.key&&E.key.toLowerCase().includes(Ir.toLowerCase())||E.appId.toLowerCase().includes(Ir.toLowerCase())),Pa=async E=>{const B=Te.includes(E)?Te.filter(ue=>ue!==E):[...Te,E];Ue(B);try{await jt("/api/db/config",{key:"pinned_section_ids",value:B,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"}),la()}catch{Ue(Te)}},Ui=y.useCallback(async()=>{es(!0);try{const E=await Oe("/api/db/config/full?key=unpaid_preview_percent",{cache:"no-store"}),B=E&&E.data;typeof B=="number"&&B>0&&B<=100&&$e(B)}catch{}finally{es(!1)}},[]),Jl=async()=>{if(Ct<1||Ct>100){G.error("预览比例需在 1~100 之间");return}Gn(!0);try{const E=await jt("/api/db/config",{key:"unpaid_preview_percent",value:Ct,description:"小程序未付费内容默认预览比例(%)"});E&&E.success!==!1?G.success("预览比例已保存"):G.error("保存失败: "+(E.error||""))}catch{G.error("保存失败")}finally{Gn(!1)}};y.useEffect(()=>{Aa(),Ui(),sn(),Zs(),Hi(),qo(),ur()},[Aa,Ui,sn,Zs,Hi,qo,ur]),y.useEffect(()=>{hr()},[hr]);const Pr=async E=>{Fe({section:E,orders:[]}),St(!0);try{const B=await Oe(`/api/db/book?action=section-orders&id=${encodeURIComponent(E.id)}`),ue=B!=null&&B.success&&Array.isArray(B.orders)?B.orders:[];Fe(be=>be?{...be,orders:ue}:null)}catch(B){console.error(B),Fe(ue=>ue?{...ue,orders:[]}:null)}finally{St(!1)}},ai=async E=>{x(!0);try{const B=E.mid!=null&&E.mid>0?`/api/db/book?action=read&mid=${E.mid}`:`/api/db/book?action=read&id=${encodeURIComponent(E.id)}`,ue=await Oe(B);if(ue!=null&&ue.success&&ue.section){const be=ue.section,Ke=be.editionPremium===!0,yt=Ic(be.previewPercent)??Ic(be.preview_percent),kt=Ic(E.previewPercent);u({id:E.id,originalId:E.id,title:ue.section.title??E.title,price:ue.section.price??E.price,content:ue.section.content??"",filePath:E.filePath,isFree:E.isFree||E.price===0,isNew:be.isNew??E.isNew,isPinned:Te.includes(E.id),hotScore:E.hotScore??0,previewPercent:yt??kt??void 0,editionStandard:Ke?!1:be.editionStandard??!0,editionPremium:Ke})}else u({id:E.id,originalId:E.id,title:E.title,price:E.price,content:"",filePath:E.filePath,isFree:E.isFree,isNew:E.isNew,isPinned:Te.includes(E.id),hotScore:E.hotScore??0,previewPercent:Ic(E.previewPercent),editionStandard:!0,editionPremium:!1}),ue&&!ue.success&&G.error("无法读取文件内容: "+(ue.error||"未知错误"))}catch(B){console.error(B),u({id:E.id,title:E.title,price:E.price,content:"",filePath:E.filePath,isFree:E.isFree,previewPercent:Ic(E.previewPercent)})}finally{x(!1)}},Wi=async()=>{var E;if(c){v(!0);try{let B=c.content||"";const ue=[new RegExp(`^#+\\s*${c.id.replace(".","\\.")}\\s+.*$`,"gm"),new RegExp(`^#+\\s*${c.id.replace(".","\\.")}[::].*$`,"gm"),new RegExp(`^#\\s+.*${(E=c.title)==null?void 0:E.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const ps of ue)B=B.replace(ps,"");B=B.replace(/^\s*\n+/,"").trim();const be=c.originalId||c.id,Ke=c.id!==be,yt={id:be,...Ke?{newId:c.id}:{},title:c.title,price:c.isFree?0:c.price,content:B,isFree:c.isFree||c.price===0,isNew:c.isNew,hotScore:c.hotScore,editionStandard:c.editionPremium?!1:c.editionStandard??!0,editionPremium:c.editionPremium??!1,saveToFile:!0};c.previewPercent===null?yt.previewPercent=null:typeof c.previewPercent=="number"&&Number.isFinite(c.previewPercent)&&(yt.previewPercent=c.previewPercent);const kt=await tn("/api/db/book",yt,{timeout:T1}),Vn=Ke?c.id:be;c.isPinned!==Te.includes(Vn)&&await Pa(Vn),kt&&kt.success!==!1?(G.success(`已保存:${c.title}`),u(null),hs(),sn(),Zs()):G.error("保存失败: "+(kt&&typeof kt=="object"&&"error"in kt?kt.error:"未知错误"))}catch(B){console.error(B);const ue=B instanceof Error&&B.name==="AbortError"?"保存超时,请检查网络或稍后重试":"保存失败";G.error(ue)}finally{v(!1)}}},Ql=async()=>{if(!L.id||!L.title){G.error("请填写章节ID和标题");return}v(!0);try{const E=bt.find(be=>be.id===L.partId),B=E==null?void 0:E.chapters.find(be=>be.id===L.chapterId),ue=await tn("/api/db/book",{id:L.id,title:L.title,price:L.isFree?0:L.price,content:L.content||"",partId:L.partId,partTitle:(E==null?void 0:E.title)??"",chapterId:L.chapterId,chapterTitle:(B==null?void 0:B.title)??"",isFree:L.isFree,isNew:L.isNew,editionStandard:L.editionPremium?!1:L.editionStandard??!0,editionPremium:L.editionPremium??!1,hotScore:L.hotScore??0,saveToFile:!1},{timeout:T1});if(ue&&ue.success!==!1){if(L.isPinned){const be=[...Te,L.id];Ue(be);try{await jt("/api/db/config",{key:"pinned_section_ids",value:be,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"})}catch{}}G.success(`章节创建成功:${L.title}`),f(!1),q({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),hs(),sn(),Zs()}else G.error("创建失败: "+(ue&&typeof ue=="object"&&"error"in ue?ue.error:"未知错误"))}catch(E){console.error(E),G.error("创建失败")}finally{v(!1)}},ca=E=>{q(B=>{var ue;return{...B,partId:E.id,chapterId:((ue=E.chapters[0])==null?void 0:ue.id)??"chapter-1"}}),f(!0)},Ur=E=>{H({id:E.id,title:E.title,badgeText:ei(E.badgeText)})},Ki=async()=>{var E;if((E=z==null?void 0:z.title)!=null&&E.trim()){se(!0);try{const B=e.map(be=>({id:be.id,partId:be.partId||"part-1",partTitle:be.partId===z.id?z.title.trim():be.partTitle||"",chapterId:be.chapterId||"chapter-1",chapterTitle:be.chapterTitle||""})),ue=await tn("/api/db/book",{action:"reorder",items:B});if(ue&&ue.success!==!1){const be=z.title.trim(),Ke={...Ta},yt=ei(z.badgeText);yt?Ke[z.id]=yt:delete Ke[z.id];const kt=await jt("/api/db/config",{key:"book_part_badges",value:Ke,description:"目录篇名角标(key=part_id, value=角标文案)"});if(kt&&kt.success===!1){G.error("更新篇名角标失败: "+(kt.error||"未知错误"));return}oa(Ke),n(Vn=>Vn.map(ps=>ps.partId===z.id?{...ps,partTitle:be}:ps)),H(null),hs()}else G.error("更新篇名失败: "+(ue&&typeof ue=="object"&&"error"in ue?ue.error:"未知错误"))}catch(B){console.error(B),G.error("更新篇名失败")}finally{se(!1)}}},fs=E=>{const B=E.chapters.length+1,ue=`chapter-${E.id}-${B}-${Date.now()}`;q({id:`${B}.1`,title:"新章节",price:1,partId:E.id,chapterId:ue,content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),f(!0)},da=(E,B)=>{const ue=B.sections;let be=1,Ke=!1,yt=!1;if(ue.length>0){const kt=typeof ue[0].price=="number"?ue[0].price:Number(ue[0].price)||1,Vn=!!(ue[0].isFree||kt===0);yt=ue.some(ps=>{const Tn=typeof ps.price=="number"?ps.price:Number(ps.price)||1,ms=!!(ps.isFree||Tn===0);return Tn!==kt||ms!==Vn}),be=Vn?0:kt,Ke=Vn}le({part:E,chapter:B,title:B.title,price:be,isFree:Ke,priceMixed:yt,initialTitle:B.title,initialPrice:be,initialIsFree:Ke})},qi=async()=>{var Ke;if(!((Ke=ie==null?void 0:ie.title)!=null&&Ke.trim()))return;const E=ie,B=E.title.trim(),ue=B!==E.initialTitle,be=E.isFree!==E.initialIsFree||!E.isFree&&Number(E.price)!==Number(E.initialPrice);if(!ue&&!be){G.info("未修改任何内容"),le(null);return}if(E.priceMixed&&be){const yt=E.chapter.sections.length,kt=E.isFree?"全部设为免费":`全部设为 ¥${E.price}`;if(!confirm(`本章 ${yt} 节当前定价不一致,保存后将${kt},确定?`))return}I(!0);try{if(ue){const yt=e.map(Tn=>({id:Tn.id,partId:Tn.partId||E.part.id,partTitle:Tn.partId===E.part.id?E.part.title:Tn.partTitle||"",chapterId:Tn.chapterId||E.chapter.id,chapterTitle:Tn.partId===E.part.id&&Tn.chapterId===E.chapter.id?B:Tn.chapterTitle||""})),kt=await tn("/api/db/book",{action:"reorder",items:yt});if(kt&&kt.success===!1){G.error("保存章节名失败: "+(kt&&typeof kt=="object"&&"error"in kt?kt.error:"未知错误"));return}const Vn=E.part.id,ps=E.chapter.id;n(Tn=>Tn.map(ms=>ms.partId===Vn&&ms.chapterId===ps?{...ms,chapterTitle:B}:ms))}if(be){const yt=await tn("/api/db/book",{action:"update-chapter-pricing",partId:E.part.id,chapterId:E.chapter.id,price:E.isFree?0:Number(E.price)||0,isFree:E.isFree});if(yt&&yt.success===!1){G.error("保存定价失败: "+(yt&&typeof yt=="object"&&"error"in yt?yt.error:"未知错误")),ue&&hs();return}}le(null),hs(),G.success("已保存")}catch(yt){console.error(yt),G.error("保存失败")}finally{I(!1)}},Ra=async(E,B)=>{const ue=B.sections.map(be=>be.id);if(ue.length===0){G.info("该章下无小节,无需删除");return}if(confirm(`确定要删除「第${E.chapters.indexOf(B)+1}章 | ${B.title}」吗?将删除共 ${ue.length} 节,此操作不可恢复。`))try{for(const be of ue)await Ei(`/api/db/book?id=${encodeURIComponent(be)}`);hs()}catch(be){console.error(be),G.error("删除失败")}},cd=async()=>{if(!K.trim()){G.error("请输入篇名");return}te(!0);try{const E=`part-new-${Date.now()}`,B="chapter-1",ue=`part-placeholder-${Date.now()}`,be=await tn("/api/db/book",{id:ue,title:"占位节(可编辑)",price:0,content:"",partId:E,partTitle:K.trim(),chapterId:B,chapterTitle:"第1章 | 待编辑",saveToFile:!1});be&&be.success!==!1?(G.success(`篇「${K}」创建成功`),V(!1),_(""),hs()):G.error("创建失败: "+(be&&typeof be=="object"&&"error"in be?be.error:"未知错误"))}catch(E){console.error(E),G.error("创建失败")}finally{te(!1)}},Go=async()=>{if(Q.length===0){G.error("请先勾选要移动的章节");return}const E=bt.find(ue=>ue.id===F),B=E==null?void 0:E.chapters.find(ue=>ue.id===pe);if(!E||!B||!F||!pe){G.error("请选择目标篇和章");return}D(!0);try{const ue=()=>{const kt=new Set(Q),Vn=e.map(Jn=>({id:Jn.id,partId:Jn.partId||"",partTitle:Jn.partTitle||"",chapterId:Jn.chapterId||"",chapterTitle:Jn.chapterTitle||""})),ps=Vn.filter(Jn=>kt.has(Jn.id)).map(Jn=>({...Jn,partId:F,partTitle:E.title||F,chapterId:pe,chapterTitle:B.title||pe})),Tn=Vn.filter(Jn=>!kt.has(Jn.id));let ms=Tn.length;for(let Jn=Tn.length-1;Jn>=0;Jn-=1){const Yo=Tn[Jn];if(Yo.partId===F&&Yo.chapterId===pe){ms=Jn+1;break}}return[...Tn.slice(0,ms),...ps,...Tn.slice(ms)]},be=async()=>{const kt=ue(),Vn=await tn("/api/db/book",{action:"reorder",items:kt});return Vn&&Vn.success!==!1?(G.success(`已移动 ${Q.length} 节到「${E.title}」-「${B.title}」`),Z(!1),$([]),await hs(),!0):!1},Ke={action:"move-sections",sectionIds:Q,targetPartId:F,targetChapterId:pe,targetPartTitle:E.title||F,targetChapterTitle:B.title||pe},yt=await tn("/api/db/book",Ke);if(yt&&yt.success!==!1)G.success(`已移动 ${yt.count??Q.length} 节到「${E.title}」-「${B.title}」`),Z(!1),$([]),await hs();else{const kt=yt&&typeof yt=="object"&&"error"in yt?yt.error||"":"未知错误";if((kt.includes("缺少 id")||kt.includes("无效的 action"))&&await be())return;G.error("移动失败: "+kt)}}catch(ue){console.error(ue),G.error("移动失败: "+(ue instanceof Error?ue.message:"网络或服务异常"))}finally{D(!1)}},Jo=E=>{$(B=>B.includes(E)?B.filter(ue=>ue!==E):[...B,E])},ii=async E=>{const B=e.filter(ue=>ue.partId===E.id).map(ue=>ue.id);if(B.length===0){G.info("该篇下暂无小节可删除");return}if(confirm(`确定要删除「${E.title}」整篇吗?将删除共 ${B.length} 节内容,此操作不可恢复。`))try{for(const ue of B)await Ei(`/api/db/book?id=${encodeURIComponent(ue)}`);hs()}catch(ue){console.error(ue),G.error("删除失败")}},oi=async()=>{var E;if(w.trim()){P(!0);try{const B=await Oe(`/api/search?q=${encodeURIComponent(w)}`);B!=null&&B.success&&((E=B.data)!=null&&E.results)?T(B.data.results):(T([]),B&&!B.success&&G.error("搜索失败: "+B.error))}catch(B){console.error(B),T([]),G.error("搜索失败")}finally{P(!1)}}},Gi=bt.find(E=>E.id===L.partId),Qo=(Gi==null?void 0:Gi.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:["共 ",bt.length," 篇 · ",Hr," 节内容"]})]}),s.jsx("div",{className:"flex gap-2",children:s.jsxs(J,{onClick:()=>Vt(!0),variant:"outline",className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:[s.jsx(Rh,{className:"w-4 h-4 mr-2"}),"排名算法"]})})]}),s.jsx(Wt,{open:h,onOpenChange:f,children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white inset-0 translate-x-0 translate-y-0 w-screen h-screen max-w-none max-h-none rounded-none flex flex-col p-0 gap-0",showCloseButton:!0,children:[s.jsx(Kt,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs(qt,{className:"text-white flex items-center gap-2",children:[s.jsx(Un,{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(ne,{className:"text-gray-300",children:"章节ID *"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 9.15",value:L.id,onChange:E=>q({...L,id:E.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"价格 (元)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:L.isFree?0:L.price,onChange:E=>q({...L,price:Number(E.target.value),isFree:Number(E.target.value)===0}),disabled:L.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{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:L.isFree,onChange:E=>q({...L,isFree:E.target.checked,price:E.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(ne,{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:L.isNew,onChange:E=>q({...L,isNew:E.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(ne,{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:L.isPinned,onChange:E=>q({...L,isPinned:E.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(ne,{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:L.editionPremium!==!0,onChange:()=>q({...L,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:L.editionPremium===!0,onChange:()=>q({...L,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(ne,{className:"text-gray-300",children:"热度分"}),s.jsx(ce,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:L.hotScore??0,onChange:E=>q({...L,hotScore:Math.max(0,parseFloat(E.target.value)||0)})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"章节标题 *"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入章节标题",value:L.title,onChange:E=>q({...L,title:E.target.value})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"所属篇"}),s.jsxs(Mc,{value:L.partId,onValueChange:E=>{var ue;const B=bt.find(be=>be.id===E);q({...L,partId:E,chapterId:((ue=B==null?void 0:B.chapters[0])==null?void 0:ue.id)??"chapter-1"})},children:[s.jsx(fl,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(Ac,{})}),s.jsxs(pl,{className:"bg-[#0f2137] border-gray-700",children:[bt.map(E=>s.jsx(vr,{value:E.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:E.title},E.id)),bt.length===0&&s.jsx(vr,{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(ne,{className:"text-gray-300",children:"所属章"}),s.jsxs(Mc,{value:L.chapterId,onValueChange:E=>q({...L,chapterId:E}),children:[s.jsx(fl,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(Ac,{})}),s.jsxs(pl,{className:"bg-[#0f2137] border-gray-700",children:[Qo.map(E=>s.jsx(vr,{value:E.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:E.title},E.id)),Qo.length===0&&s.jsx(vr,{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(ne,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),s.jsx(j0,{content:L.content||"",onChange:E=>q({...L,content:E}),onImageUpload:$i,onMediaUpload:Fi,persons:Fn,linkTags:ls,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(Sn,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[s.jsx(J,{variant:"outline",onClick:()=>f(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(J,{onClick:Ql,disabled:b||!L.id||!L.title,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:b?s.jsxs(s.Fragment,{children:[s.jsx(Ve,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Un,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),s.jsx(Wt,{open:!!z,onOpenChange:E=>!E&&H(null),children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Kt,{children:s.jsxs(qt,{className:"text-white flex items-center gap-2",children:[s.jsx(rn,{className:"w-5 h-5 text-[#38bdac]"}),"编辑篇名"]})}),z&&s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"篇名"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:z.title,onChange:E=>H({...z,title:E.target.value}),placeholder:"输入篇名"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"左侧图标文字(可选)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:z.badgeText||"",onChange:E=>H({...z,badgeText:ei(E.target.value)}),placeholder:"例如:派 / 新 / 热",maxLength:8}),s.jsx("p",{className:"text-xs text-gray-500",children:"保存后会同步到目录左侧图标文字(小程序与管理端目录树)。"})]})]}),s.jsxs(Sn,{children:[s.jsx(J,{variant:"outline",onClick:()=>H(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(J,{onClick:Ki,disabled:R||!((Yl=z==null?void 0:z.title)!=null&&Yl.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:R?s.jsxs(s.Fragment,{children:[s.jsx(Ve,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(In,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Wt,{open:!!ie,onOpenChange:E=>!E&&le(null),children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsxs(Kt,{children:[s.jsxs(qt,{className:"text-white flex items-center gap-2",children:[s.jsx(rn,{className:"w-5 h-5 text-[#38bdac]"}),"章节设置"]}),s.jsx("p",{className:"text-gray-400 text-sm font-normal pt-1",children:"修改本章显示名称,或为本章下全部节设置统一金额(仍可在单节编辑里单独改某一节)。"})]}),ie&&s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"章节名称(如:第8章|底层结构)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:ie.title,onChange:E=>le({...ie,title:E.target.value}),placeholder:"输入章节名称"})]}),s.jsxs("div",{className:"space-y-2 border-t border-gray-700/60 pt-4",children:[s.jsxs(ne,{className:"text-gray-300",children:["本章统一定价(应用于本章全部 ",ie.chapter.sections.length," 节)"]}),ie.priceMixed&&s.jsx("p",{className:"text-amber-400/90 text-xs",children:"当前各节定价不一致,保存后将按下方设置全部统一。"}),s.jsxs("div",{className:"flex flex-wrap items-end gap-4",children:[s.jsxs("div",{className:"space-y-1 flex-1 min-w-[120px]",children:[s.jsx("span",{className:"text-gray-500 text-xs",children:"价格 (元)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:ie.isFree?0:ie.price,onChange:E=>le({...ie,price:Number(E.target.value),isFree:Number(E.target.value)===0}),disabled:ie.isFree,min:0,step:.01})]}),s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer pb-2",children:[s.jsx("input",{type:"checkbox",checked:ie.isFree||ie.price===0,onChange:E=>le({...ie,isFree:E.target.checked,price:E.target.checked?0:ie.initialPrice>0?ie.initialPrice:1}),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac]"}),s.jsx("span",{className:"text-gray-400 text-sm",children:"本章全部免费"})]})]})]})]}),s.jsxs(Sn,{children:[s.jsx(J,{variant:"outline",onClick:()=>le(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(J,{onClick:qi,disabled:he||!((Xl=ie==null?void 0:ie.title)!=null&&Xl.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:he?s.jsxs(s.Fragment,{children:[s.jsx(Ve,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(In,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Wt,{open:xe,onOpenChange:E=>{var B;if(Z(E),E&&bt.length>0){const ue=bt[0];U(ue.id),fe(((B=ue.chapters[0])==null?void 0:B.id)??"")}},children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Kt,{children:s.jsx(qt,{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:Q.length})," 节,请选择目标篇与章。"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"目标篇"}),s.jsxs(Mc,{value:F,onValueChange:E=>{var ue;U(E);const B=bt.find(be=>be.id===E);fe(((ue=B==null?void 0:B.chapters[0])==null?void 0:ue.id)??"")},children:[s.jsx(fl,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(Ac,{placeholder:"选择篇"})}),s.jsx(pl,{className:"bg-[#0f2137] border-gray-700",children:bt.map(E=>s.jsx(vr,{value:E.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:E.title},E.id))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"目标章"}),s.jsxs(Mc,{value:pe,onValueChange:fe,children:[s.jsx(fl,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(Ac,{placeholder:"选择章"})}),s.jsx(pl,{className:"bg-[#0f2137] border-gray-700",children:(((li=bt.find(E=>E.id===F))==null?void 0:li.chapters)??[]).map(E=>s.jsx(vr,{value:E.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:E.title},E.id))})]})]})]}),s.jsxs(Sn,{children:[s.jsx(J,{variant:"outline",onClick:()=>Z(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(J,{onClick:Go,disabled:oe||Q.length===0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:oe?s.jsxs(s.Fragment,{children:[s.jsx(Ve,{className:"w-4 h-4 mr-2 animate-spin"}),"移动中..."]}):"确认移动"})]})]})}),s.jsx(Wt,{open:!!Ne,onOpenChange:E=>!E&&Fe(null),children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",showCloseButton:!0,children:[s.jsx(Kt,{children:s.jsxs(qt,{className:"text-white",children:["付款记录 — ",(Ne==null?void 0:Ne.section.title)??""]})}),s.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:We?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(Ve,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):Ne&&Ne.orders.length===0?s.jsx("p",{className:"text-gray-500 text-center py-6",children:"暂无付款记录"}):Ne?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:Ne.orders.map(E=>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:`查看订单 ${E.orderSn}`,onClick:()=>window.open(`/orders?search=${E.orderSn??E.id??""}`,"_blank"),children:E.orderSn?E.orderSn.length>16?E.orderSn.slice(0,8)+"..."+E.orderSn.slice(-6):E.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:`查看用户 ${E.userId??E.openId??""}`,onClick:()=>window.open(`/users?search=${E.userId??E.openId??""}`,"_blank"),children:(()=>{const B=E.userId??E.openId??"-";return B.length>12?B.slice(0,6)+"..."+B.slice(-4):B})()})}),s.jsxs("td",{className:"py-2 pr-2 text-gray-300",children:["¥",E.amount??0]}),s.jsx("td",{className:"py-2 pr-2 text-gray-300",children:E.status??"-"}),s.jsx("td",{className:"py-2 pr-2 text-gray-500",children:E.payTime??E.createdAt??"-"})]},E.id??E.orderSn??""))})]}):null})]})}),s.jsx(Wt,{open:wt,onOpenChange:Vt,children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Kt,{children:s.jsxs(qt,{className:"text-white flex items-center gap-2",children:[s.jsx(Rh,{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:"热度积分 = 阅读权重×阅读排名分 + 新度权重×新度排名分 + 付款权重×付款排名分(三权重之和须为 1)"}),Jt?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(ne,{className:"text-gray-400 text-xs",children:"阅读权重"}),s.jsx(ce,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:_t.readWeight,onChange:E=>$n(B=>({...B,readWeight:Math.max(0,Math.min(1,parseFloat(E.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"新度权重"}),s.jsx(ce,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:_t.recencyWeight,onChange:E=>$n(B=>({...B,recencyWeight:Math.max(0,Math.min(1,parseFloat(E.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"付款权重"}),s.jsx(ce,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:_t.payWeight,onChange:E=>$n(B=>({...B,payWeight:Math.max(0,Math.min(1,parseFloat(E.target.value)||0))}))})]})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["当前之和: ",(_t.readWeight+_t.recencyWeight+_t.payWeight).toFixed(1)]}),s.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs text-gray-400",children:[s.jsx("li",{children:"阅读量前 20 名:第1名=20分、第2名=19分...第20名=1分"}),s.jsx("li",{children:"最近更新前 30 篇:第1名=30分、第2名=29分...第30名=1分"}),s.jsx("li",{children:"付款数前 20 名:第1名=20分、第2名=19分...第20名=1分"}),s.jsx("li",{children:"热度分可在编辑章节中手动覆盖"})]}),s.jsx(J,{onClick:si,disabled:yn||Math.abs(_t.readWeight+_t.recencyWeight+_t.payWeight-1)>.001,className:"w-full bg-amber-500 hover:bg-amber-600 text-white",children:yn?"保存中...":"保存权重"})]})]})]})}),s.jsx(Wt,{open:X,onOpenChange:V,children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Kt,{children:s.jsxs(qt,{className:"text-white flex items-center gap-2",children:[s.jsx(Un,{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(ne,{className:"text-gray-300",children:"篇名(如:第六篇|真实的社会)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:K,onChange:E=>_(E.target.value),placeholder:"输入篇名"})]})}),s.jsxs(Sn,{children:[s.jsx(J,{variant:"outline",onClick:()=>{V(!1),_("")},className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(J,{onClick:cd,disabled:Y||!K.trim(),className:"bg-amber-500 hover:bg-amber-600 text-white",children:Y?s.jsxs(s.Fragment,{children:[s.jsx(Ve,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Un,{className:"w-4 h-4 mr-2"}),"创建篇"]})})]})]})}),s.jsx(Wt,{open:!!c,onOpenChange:()=>u(null),children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white inset-0 translate-x-0 translate-y-0 w-screen h-screen max-w-none max-h-none rounded-none flex flex-col p-0 gap-0",showCloseButton:!0,children:[s.jsx(Kt,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs(qt,{className:"text-white flex items-center gap-2",children:[s.jsx(rn,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节"]})}),c&&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(ne,{className:"text-gray-300",children:"章节ID"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:c.id,onChange:E=>u({...c,id:E.target.value}),placeholder:"如: 9.15"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"价格 (元)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:c.isFree?0:c.price,onChange:E=>u({...c,price:Number(E.target.value),isFree:Number(E.target.value)===0}),disabled:c.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{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:c.isFree||c.price===0,onChange:E=>u({...c,isFree:E.target.checked,price:E.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(ne,{className:"text-gray-300",children:"预览%"}),s.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",placeholder:`全局 ${Ct}%`,value:c.previewPercent!=null?String(c.previewPercent):"",onChange:E=>{const B=E.target.value.trim();if(B===""){u({...c,previewPercent:null});return}const ue=Number(B);Number.isFinite(ue)&&u({...c,previewPercent:Math.min(100,Math.max(1,Math.round(ue)))})}})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{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:c.isNew??!1,onChange:E=>u({...c,isNew:E.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(ne,{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:c.isPinned??!1,onChange:E=>u({...c,isPinned:E.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(ne,{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:c.editionPremium!==!0,onChange:()=>u({...c,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:c.editionPremium===!0,onChange:()=>u({...c,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(ne,{className:"text-gray-300",children:"热度分"}),s.jsx(ce,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:c.hotScore??0,onChange:E=>u({...c,hotScore:Math.max(0,parseFloat(E.target.value)||0)})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"章节标题"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:c.title,onChange:E=>u({...c,title:E.target.value})})]}),c.filePath&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"文件路径"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-gray-400 text-sm",value:c.filePath,disabled:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),m?s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700 rounded-md min-h-[400px] flex items-center justify-center",children:[s.jsx(Ve,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(j0,{ref:od,content:c.content||"",onChange:E=>u({...c,content:E}),onImageUpload:$i,onMediaUpload:Fi,persons:Fn,linkTags:ls,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(Sn,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[c&&s.jsxs(J,{variant:"outline",onClick:()=>Pr({id:c.id,title:c.title,price:c.price}),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent mr-auto",children:[s.jsx(wr,{className:"w-4 h-4 mr-2"}),"付款记录"]}),s.jsxs(J,{variant:"outline",onClick:()=>u(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(rs,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsx(J,{onClick:Wi,disabled:b,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:b?s.jsxs(s.Fragment,{children:[s.jsx(Ve,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(In,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),s.jsxs(Vc,{defaultValue:"chapters",className:"space-y-6",children:[s.jsxs(Al,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(an,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(wr,{className:"w-4 h-4 mr-2"}),"章节管理"]}),s.jsxs(an,{value:"ranking",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(Pg,{className:"w-4 h-4 mr-2"}),"内容排行榜"]}),s.jsxs(an,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(va,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),s.jsxs(an,{value:"link-person",className:"data-[state=active]:bg-purple-500/20 data-[state=active]:text-purple-400 text-gray-400",children:[s.jsx(Ba,{className:"w-4 h-4 mr-2"}),"@列表"]}),s.jsxs(an,{value:"link-tag",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(j1,{className:"w-4 h-4 mr-2"}),"链接标签"]})]}),s.jsxs(on,{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(wr,{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:Hr}),s.jsx("span",{className:"text-xs text-gray-500",children:"章节"})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(J,{onClick:()=>f(!0),className:"flex-1 min-w-[120px] bg-[#38bdac]/10 hover:bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/30",children:[s.jsx(Un,{className:"w-4 h-4 mr-2"}),"新建章节"]}),s.jsxs(J,{onClick:()=>V(!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(Un,{className:"w-4 h-4 mr-2"}),"新建篇"]}),s.jsxs(J,{variant:"outline",onClick:()=>Z(!0),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:["批量移动(已选 ",Q.length," 节)"]})]}),r?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Ve,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(q9,{parts:bt,expandedParts:i,onTogglePart:Vi,onReorder:Tr,onReadSection:ai,onDeleteSection:Es,onAddSectionInPart:ca,onAddChapterInPart:fs,onDeleteChapter:Ra,onEditPart:Ur,onDeletePart:ii,onEditChapter:da,selectedSectionIds:Q,onToggleSectionSelect:Jo,onShowSectionOrders:Pr,pinnedSectionIds:Te})]}),s.jsx(on,{value:"search",className:"space-y-4",children:s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(ft,{children:s.jsx(pt,{className:"text-white",children:"内容搜索"})}),s.jsxs(ze,{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",placeholder:"搜索标题或内容...",value:w,onChange:E=>N(E.target.value),onKeyDown:E=>E.key==="Enter"&&oi()}),s.jsx(J,{onClick:oi,disabled:C||!w.trim(),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:C?s.jsx(Ve,{className:"w-4 h-4 animate-spin"}):s.jsx(va,{className:"w-4 h-4"})})]}),k.length>0&&s.jsxs("div",{className:"space-y-2 mt-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["找到 ",k.length," 个结果"]}),k.map(E=>s.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors",onClick:()=>{const B=e.find(ue=>ue.id===E.id);ai({id:E.id,mid:E.mid,title:E.title,price:E.price??1,filePath:"",previewPercent:B==null?void 0:B.previewPercent})},children:[s.jsxs("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:E.id}),s.jsx("span",{className:"text-white",children:E.title}),Te.includes(E.id)&&s.jsx(Rc,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})]}),s.jsx(He,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:E.matchType==="title"?"标题匹配":"内容匹配"})]}),E.snippet&&s.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:E.snippet}),(E.partTitle||E.chapterTitle)&&s.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[E.partTitle," · ",E.chapterTitle]})]},E.id))]})]})]})}),s.jsxs(on,{value:"ranking",className:"space-y-4",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(ft,{className:"pb-3",children:s.jsxs(pt,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Rh,{className:"w-4 h-4 text-[#38bdac]"}),"内容显示规则"]})}),s.jsx(ze,{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(ne,{className:"text-gray-400 text-sm whitespace-nowrap",children:"未付费预览比例"}),s.jsx(ce,{type:"number",min:"1",max:"100",className:"bg-[#0a1628] border-gray-700 text-white w-20",value:Ct,onChange:E=>$e(Math.max(1,Math.min(100,Number(E.target.value)||20))),disabled:mt}),s.jsx("span",{className:"text-gray-500 text-sm",children:"%"})]}),s.jsx(J,{size:"sm",onClick:Jl,disabled:is,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:is?"保存中...":"保存"}),s.jsxs("span",{className:"text-xs text-gray-500",children:["小程序未付费用户默认显示文章前 ",Ct,"% 内容"]})]})})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(ft,{className:"pb-3",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs(pt,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Pg,{className:"w-4 h-4 text-amber-400"}),"内容排行榜",s.jsxs("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["按热度排行 · 共 ",At.length," 节"]})]}),s.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>la(),disabled:Ft,className:"text-gray-400 hover:text-white h-7 w-7 p-0",title:"刷新排行榜",children:s.jsx(Ve,{className:`w-4 h-4 ${Ft?"animate-spin":""}`})}),s.jsx(J,{variant:"ghost",size:"sm",disabled:En<=1||Ft,onClick:()=>vn(E=>Math.max(1,E-1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(f5,{className:"w-4 h-4"})}),s.jsxs("span",{className:"text-gray-400 min-w-[60px] text-center",children:[En," / ",Ma]}),s.jsx(J,{variant:"ghost",size:"sm",disabled:En>=Ma||Ft,onClick:()=>vn(E=>Math.min(Ma,E+1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(ml,{className:"w-4 h-4"})})]})]})}),s.jsx(ze,{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:"编辑"})]}),Bi.map((E,B)=>{const ue=(En-1)*ni+B+1,be=E.isPinned??Te.includes(E.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 ${be?"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(J,{variant:"ghost",size:"sm",className:`h-6 w-6 p-0 ${be?"text-amber-400":"text-gray-600 hover:text-amber-400"}`,onClick:()=>Pa(E.id),disabled:it,title:be?"取消置顶":"强制置顶(精选推荐/首页最新更新)",children:be?s.jsx(Rc,{className:"w-3.5 h-3.5 fill-current"}):s.jsx(C1,{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:E.title}),s.jsxs("span",{className:"text-gray-600 text-xs",children:[E.partTitle," · ",E.chapterTitle]})]}),s.jsx("span",{className:"text-right text-sm text-blue-400 font-mono",children:E.clickCount??0}),s.jsx("span",{className:"text-right text-sm text-green-400 font-mono",children:E.payCount??0}),s.jsx("span",{className:"text-right text-sm text-amber-400 font-mono",children:(E.hotScore??0).toFixed(1)}),s.jsx("div",{className:"text-right",children:s.jsx(J,{variant:"ghost",size:"sm",className:"text-gray-500 hover:text-[#38bdac] h-6 px-1",onClick:()=>ai({id:E.id,mid:E.mid,title:E.title,price:E.price,filePath:"",previewPercent:E.previewPercent}),title:"编辑文章",children:s.jsx(rn,{className:"w-3 h-3"})})})]},E.id)}),Bi.length===0&&s.jsx("div",{className:"py-8 text-center text-gray-500",children:"暂无数据"})]})})]})]}),s.jsxs(on,{value:"link-person",className:"space-y-4",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{className:"pb-3",children:[s.jsxs(pt,{className:"text-white text-base flex items-center gap-2",children:[s.jsx("span",{className:"text-[#38bdac] text-lg font-bold",children:"@"}),"AI列表 — @列表(编辑器内输入 @ 可链接)"]}),s.jsxs("div",{className:"text-xs text-gray-500 mt-1 space-y-1",children:[s.jsxs("p",{children:["文章 @ 存 ",s.jsx("span",{className:"text-gray-400",children:"token"}),";小程序点 @ 用 token 换存客宝密钥后加好友/拉群。"]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-purple-300",children:"超级个体"}),":开通且昵称合法会自动进本列表可 @;共用「超级个体拉群」统一获客计划(话术由技术侧在系统里配置,本页不填 plan/apiKey,避免误操作)。"]}),s.jsx("p",{children:"点「添加」新建的人物:每人单独一条存客宝计划(SOUL链接人与事-名称)。"})]})]}),s.jsxs(ze,{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:"本页只管理可 @ 的人物列表"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(J,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 hover:bg-gray-700/50",onClick:()=>{sn()},title:"刷新",children:s.jsx(Ve,{className:"w-4 h-4"})}),s.jsxs(J,{size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",onClick:()=>{ds(null),aa(!0)},children:[s.jsx(Un,{className:"w-4 h-4 mr-2"}),"添加"]})]})]}),s.jsx("div",{className:"max-h-[400px] overflow-y-auto",children:Fn.length>0?s.jsxs("table",{className:"w-full text-sm border-collapse",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"text-xs text-gray-500 border-b border-gray-700/50",children:[s.jsx("th",{className:"text-left py-1.5 px-3 w-[280px] font-normal",children:"token"}),s.jsx("th",{className:"text-left py-1.5 px-3 w-24 font-normal",children:"@的人"}),s.jsx("th",{className:"text-left py-1.5 px-3 w-[72px] font-normal text-xs",children:"来源"}),s.jsx("th",{className:"text-left py-1.5 px-3 w-[100px] font-normal text-xs",children:"会员"}),s.jsx("th",{className:"py-1.5 px-3 w-16 font-normal text-center",children:"获客数"}),s.jsx("th",{className:"text-left py-1.5 px-3 font-normal",children:"获客计划"}),s.jsx("th",{className:"text-center py-1.5 px-2 w-14 font-normal text-xs",children:"置顶"}),s.jsx("th",{className:"text-left py-1.5 px-3 w-16 font-normal",children:"状态"}),s.jsx("th",{className:"text-left py-1.5 px-2 w-24 font-normal",children:"操作"})]})}),s.jsx("tbody",{children:Fn.map(E=>s.jsxs("tr",{className:"border-b border-gray-700/30 hover:bg-[#0a1628]/80",children:[s.jsx("td",{className:"py-2 px-3 text-gray-400 text-xs font-mono",title:"32位token",children:E.id}),s.jsx("td",{className:"py-2 px-3 truncate max-w-[96px]",children:s.jsx("button",{type:"button",className:"text-amber-400 hover:text-amber-300 hover:underline text-left",onClick:()=>{zt[E.id]&&Ar(E.id,E.name)},title:zt[E.id]?"点击查看获客详情":E.name,children:E.name})}),s.jsx("td",{className:"py-2 px-3",children:E.personSource==="vip_sync"?s.jsx("span",{className:"text-[10px] text-purple-300 bg-purple-500/15 px-1.5 py-0.5 rounded whitespace-nowrap",children:"超级个体"}):s.jsx("span",{className:"text-[10px] text-gray-500 bg-gray-500/10 px-1.5 py-0.5 rounded whitespace-nowrap",children:"手工"})}),s.jsx("td",{className:"py-2 px-3 text-xs",children:E.userId?s.jsxs("div",{className:"flex flex-col gap-0.5 items-start max-w-[100px]",children:[E.personSource==="vip_sync"&&s.jsx("span",{className:"text-[10px] text-purple-300/90 leading-tight",children:"已绑定超级个体"}),s.jsx("button",{type:"button",className:"text-[#38bdac] hover:underline truncate max-w-[96px] block text-left",title:`用户ID: ${E.userId}`,onClick:()=>t(`/users?search=${encodeURIComponent(E.userId||"")}`),children:E.name})]}):s.jsx("span",{className:"text-gray-600",children:"—"})}),(()=>{const B=zt[E.id]||0;return s.jsx("td",{className:`py-2 px-3 shrink-0 w-16 text-center text-xs font-bold cursor-pointer ${B>0?"text-green-400 hover:text-green-300 hover:underline":"text-gray-600"}`,title:B>0?"点击查看获客详情":"暂无获客",onClick:()=>{B>0&&Ar(E.id,E.name)},children:B})})(),s.jsx("td",{className:"py-2 px-3 text-white truncate max-w-[220px]",title:`planId: ${E.ckbPlanId??"-"}`,children:s.jsx("div",{className:"flex items-center gap-1.5",children:s.jsx("span",{className:"truncate",children:E.ckbPlanId?E.personSource==="vip_sync"?"超级个体拉群(统一计划)":`SOUL链接人与事-${E.name}`:"—"})})}),s.jsx("td",{className:"py-2 px-2 text-center",children:s.jsx(J,{type:"button",variant:"ghost",size:"sm",className:E.isPinned?"text-amber-400 hover:text-amber-300 h-7 px-2":"text-gray-500 hover:text-amber-400/90 h-7 px-2",title:E.isPinned?"取消小程序首页置顶":"设为小程序首页置顶(全局唯一)",onClick:()=>void ld(E,!E.isPinned),children:s.jsx(C1,{className:`w-3.5 h-3.5 ${E.isPinned?"fill-amber-400":""}`})})}),s.jsx("td",{className:"py-2 px-3 text-center",children:E.ckbPlanId?s.jsx("span",{className:"text-[10px] text-green-400 bg-green-400/10 px-1.5 py-0.5 rounded",children:"启用"}):s.jsx("span",{className:"text-[10px] text-gray-500 bg-gray-500/10 px-1.5 py-0.5 rounded",children:"未配置"})}),s.jsx("td",{className:"py-2 px-2",children:s.jsxs("div",{className:"flex items-center gap-0",children:[s.jsx(J,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-[#38bdac] h-6 px-2",title:"编辑",onClick:async()=>{try{const B=await J9(E.personId||"");if(B!=null&&B.success&&B.person){const ue=B.person;ds({id:ue.token??ue.personId,personId:ue.personId,name:ue.name,personSource:ue.personSource??"",userId:ue.userId??"",label:ue.label??"",ckbApiKey:ue.ckbApiKey??"",remarkType:ue.remarkType,remarkFormat:ue.remarkFormat,addFriendInterval:ue.addFriendInterval,startTime:ue.startTime,endTime:ue.endTime,deviceGroups:ue.deviceGroups})}else ds(E),B!=null&&B.error&&G.error(B.error)}catch(B){console.error(B),ds(E),G.error(B instanceof Error?B.message:"加载人物详情失败")}aa(!0)},children:s.jsx(k1,{className:"w-3 h-3"})}),s.jsx(J,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-green-400 h-6 px-2",title:"查看新客户",onClick:()=>Ar(E.id,E.name),children:s.jsx(Wn,{className:"w-3 h-3"})}),s.jsx(J,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",title:E.personSource==="vip_sync"?"删除本地 @人物(不删统一获客计划)":"删除(同时删除存客宝对应获客计划)",onClick:()=>Ea(E),children:s.jsx(rs,{className:"w-3 h-3"})})]})})]},E.id))})]}):s.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无AI人物,添加后可在编辑器中 @链接"})})]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{className:"pb-3",children:[s.jsxs(pt,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(ZM,{className:"w-4 h-4 text-[#38bdac]"}),"存客宝绑定"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"配置存客宝 API 后,文章中 @人物 或 #标签 点击可自动进入存客宝流量池"})]}),s.jsxs(ze,{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(ne,{className:"text-gray-400 text-xs",children:"存客宝 API 地址"}),s.jsx(ce,{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(ne,{className:"text-gray-400 text-xs",children:"绑定计划"}),s.jsx(ce,{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.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{className:"pb-3",children:[s.jsxs(pt,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Rh,{className:"w-4 h-4 text-blue-400"}),"获客 Webhook 通知"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"配置后新获客线索将自动推送到群聊(支持企业微信/飞书 Webhook)"})]}),s.jsxs(ze,{className:"space-y-3",children:[s.jsxs("div",{className:"flex gap-3 items-end",children:[s.jsxs("div",{className:"flex-1 space-y-1",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"Webhook URL"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm font-mono",placeholder:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=...",value:ia,onChange:E=>Za(E.target.value)})]}),s.jsxs(J,{size:"sm",className:"bg-blue-500 hover:bg-blue-600 text-white h-8",onClick:async()=>{const E=ia.trim();try{const B=await jt("/api/db/config",{key:"ckb_lead_webhook_url",value:E,description:"获客线索 Webhook 通知 URL(企微/飞书)"});B!=null&&B.success?G.success(E?"Webhook 已保存":"Webhook 已清除"):G.error((B==null?void 0:B.error)??"保存失败")}catch{G.error("保存失败")}},children:[s.jsx(In,{className:"w-3.5 h-3.5 mr-1"}),"保存"]})]}),s.jsx("p",{className:"text-xs text-gray-500",children:"配置企业微信或飞书群机器人 Webhook URL,获客成功后自动推送通知"})]})]})]}),s.jsxs(on,{value:"link-tag",className:"space-y-4",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{className:"pb-3",children:[s.jsxs(pt,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(j1,{className:"w-4 h-4 text-amber-400"}),"链接标签 — 链接事与物(编辑器内 #标签 可跳转链接/小程序/存客宝)"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"小程序端点击 #标签 可直接跳转对应链接,进入流量池"})]}),s.jsxs(ze,{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-end justify-between gap-3 flex-wrap",children:[s.jsxs("div",{className:"flex items-end gap-2 flex-wrap",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"搜索"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-48",placeholder:"按标签ID/显示文字搜索",value:ks,onChange:E=>{Ss(E.target.value),lr(1)}})]}),s.jsx(J,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 hover:bg-gray-700/50 h-8",onClick:()=>{Zs(),hr()},title:"刷新",children:s.jsx(Ve,{className:"w-4 h-4"})})]}),s.jsxs(J,{size:"sm",className:"bg-amber-500 hover:bg-amber-600 text-white h-8",onClick:()=>{ve(null),ut({tagId:"",label:"",aliases:"",url:"",type:"url",appId:"",appSecret:"",pagePath:""}),Ts(""),$s(!1),wn(!0)},children:[s.jsx(Un,{className:"w-4 h-4 mr-2"}),"添加标签"]})]}),s.jsxs("div",{className:"rounded-md border border-gray-700/50 overflow-hidden",children:[s.jsx("div",{className:"max-h-[420px] overflow-y-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{className:"bg-[#0a1628] border-b border-gray-700/50",children:s.jsxs("tr",{children:[s.jsx("th",{className:"text-left px-3 py-2 text-gray-400 w-32",children:"标签"}),s.jsx("th",{className:"text-left px-3 py-2 text-gray-400 w-28",children:"别名"}),s.jsx("th",{className:"text-left px-3 py-2 text-gray-400 w-20",children:"类型"}),s.jsx("th",{className:"text-left px-3 py-2 text-gray-400",children:"目标 / AppID"}),s.jsx("th",{className:"text-right px-3 py-2 text-gray-400 w-28",children:"操作"})]})}),s.jsx("tbody",{children:Js?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:"加载中..."})}):kr.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:"暂无链接标签,添加后可在编辑器中使用 #标签 跳转"})}):kr.map(E=>s.jsxs("tr",{className:"border-b border-gray-700/30 hover:bg-white/5",children:[s.jsx("td",{className:"px-3 py-2",children:s.jsxs("button",{type:"button",className:"text-amber-400 font-semibold hover:text-amber-300 hover:underline text-left",onClick:()=>{ve(E),ut({tagId:E.id,label:E.label,aliases:E.aliases??"",url:E.url,type:E.type,appId:E.appId??"",appSecret:"",pagePath:E.pagePath??""}),Ts(E.appId??""),$s(!1),wn(!0)},title:"点击编辑标签",children:["#",E.label]})}),s.jsx("td",{className:"px-3 py-2 text-gray-500 text-xs truncate max-w-[120px]",title:E.aliases||"",children:E.aliases||"—"}),s.jsx("td",{className:"px-3 py-2",children:s.jsx(He,{variant:"secondary",className:`text-[10px] ${E.type==="ckb"?"bg-green-500/20 text-green-300 border-green-500/30":E.type==="miniprogram"||E.type==="wxlink"?"bg-[#38bdac]/20 text-[#38bdac] border-[#38bdac]/30":"bg-gray-700 text-gray-300"}`,children:E.type==="url"?"网页":E.type==="ckb"?"存客宝":E.type==="wxlink"?"小程序链接":"小程序"})}),s.jsx("td",{className:"px-3 py-2 text-gray-300",children:E.type==="miniprogram"?s.jsxs("div",{className:"space-y-0.5",children:[(()=>{const B=Ia.find(ue=>ue.key===E.appId);return s.jsxs(s.Fragment,{children:[B&&s.jsx("div",{className:"text-xs text-white",children:B.name}),s.jsxs("div",{className:"text-xs font-mono text-[#38bdac]",children:["AppID: ",(B==null?void 0:B.appId)||E.appId||"—"]})]})})(),E.pagePath&&s.jsx("div",{className:"text-xs text-gray-500 font-mono",children:E.pagePath}),s.jsxs("div",{className:`text-xs ${E.hasAppSecret?"text-emerald-400/90":"text-amber-500/80"}`,children:["AppSecret:",E.hasAppSecret?"已保存(仅服务端)":"未配置"]})]}):E.type==="wxlink"?s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("div",{className:"text-xs text-[#38bdac] truncate max-w-[420px] font-mono",title:E.url,children:E.url||"—"}),s.jsx("div",{className:"text-[11px] text-gray-500",children:"小程序内点击 → web-view 打开 → 自动唤起目标小程序"})]}):E.url?s.jsxs("a",{href:E.url,target:"_blank",rel:"noreferrer",className:"text-blue-400 text-xs truncate max-w-[420px] hover:underline inline-flex items-center gap-1",children:[E.url," ",s.jsx(Pi,{className:"w-3 h-3 shrink-0"})]}):s.jsx("span",{className:"text-gray-500 text-xs",children:"—"})}),s.jsx("td",{className:"px-3 py-2",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(J,{variant:"ghost",size:"sm",className:"text-gray-300 hover:text-white h-7 px-2",onClick:()=>{ve(E),ut({tagId:E.id,label:E.label,aliases:E.aliases??"",url:E.url,type:E.type,appId:E.appId??"",appSecret:"",pagePath:E.pagePath??""}),Ts(E.appId??""),$s(!1),wn(!0)},title:"编辑",children:s.jsx(k1,{className:"w-3 h-3"})}),s.jsx(J,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-7 px-2",onClick:async()=>{if(confirm(`确定要删除「#${E.label}」吗?`))try{const B=await Ei(`/api/db/link-tags?tagId=${encodeURIComponent(E.id)}`);B!=null&&B.success?(G.success("已删除"),Zs(),hr()):G.error((B==null?void 0:B.error)??"删除失败")}catch(B){console.error(B),G.error("删除失败")}},title:"删除",children:s.jsx(rs,{className:"w-3 h-3"})})]})})]},E.id))})]})}),s.jsx(rr,{page:Sr,pageSize:cs,total:cr,totalPages:ra,onPageChange:E=>lr(E),onPageSizeChange:E=>{Cr(E),lr(1)}})]})]})]}),s.jsx(Wt,{open:Ys,onOpenChange:wn,children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg p-4 gap-3",children:[s.jsxs(Kt,{className:"gap-1",children:[s.jsx(qt,{className:"text-base",children:re?"编辑链接标签":"添加链接标签"}),s.jsx(jf,{className:"text-gray-400 text-xs",children:"配置后可在富文本编辑器中通过 #标签 插入,并在小程序端点击跳转。小程序类型需填 mpKey 或微信 AppID;AppSecret 仅存服务端(不下发小程序),供后续开放接口与台账使用。"})]}),s.jsxs("div",{className:"space-y-3 py-2",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-300 text-sm",children:"标签ID"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm font-mono",placeholder:"留空自动生成;或自定义短 ID(如 kr),最长 50 字符",value:Ye.tagId,disabled:!!re,onChange:E=>ut(B=>({...B,tagId:E.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-300 text-sm",children:"显示文字"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"如 神仙团队",value:Ye.label,onChange:E=>ut(B=>({...B,label:E.target.value}))})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-300 text-sm",children:"别名(多个用逗号分隔,同指向一个目标)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"如 团队招募, 团队合伙人",value:Ye.aliases,onChange:E=>ut(B=>({...B,aliases:E.target.value}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 items-end",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-300 text-sm",children:"类型"}),s.jsxs(Mc,{value:Ye.type,onValueChange:E=>ut(B=>({...B,type:E})),children:[s.jsx(fl,{className:"bg-[#0a1628] border-gray-700 text-white h-8",children:s.jsx(Ac,{})}),s.jsxs(pl,{className:"bg-[#0f2137] border-gray-700 text-white",children:[s.jsx(vr,{value:"url",children:"网页链接"}),s.jsx(vr,{value:"miniprogram",children:"小程序(API跳转)"}),s.jsx(vr,{value:"wxlink",children:"小程序链接(右上角复制)"}),s.jsx(vr,{value:"ckb",children:"存客宝"})]})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-300 text-sm",children:Ye.type==="url"?"URL地址":Ye.type==="ckb"?"存客宝计划URL":Ye.type==="wxlink"?"小程序链接":"小程序 mpKey / 微信 AppID"}),Ye.type==="wxlink"?s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"粘贴小程序右上角 ... → 复制链接 得到的 URL",value:Ye.url,onChange:E=>ut(B=>({...B,url:E.target.value}))}):Ye.type==="miniprogram"&&Ia.length>0?s.jsxs("div",{ref:Gl,className:"relative",children:[s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"搜索名称或密钥",value:er?Ir:Ye.appId,onChange:E=>{const B=E.target.value;Ts(B),$s(!0),Ia.some(ue=>ue.key===B)||ut(ue=>({...ue,appId:B}))},onFocus:()=>{Ts(Ye.appId),$s(!0)},onBlur:()=>setTimeout(()=>$s(!1),150)}),er&&s.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 max-h-48 overflow-y-auto rounded-md border border-gray-700 bg-[#0a1628] shadow-lg z-50",children:ri.length===0?s.jsx("div",{className:"px-3 py-2 text-gray-500 text-xs",children:"无匹配,可手动输入密钥"}):ri.map(E=>s.jsxs("button",{type:"button",className:"w-full px-3 py-2 text-left text-sm text-white hover:bg-[#38bdac]/20 flex flex-col gap-0.5",onMouseDown:B=>{B.preventDefault(),ut(ue=>({...ue,appId:E.key,pagePath:E.path||""})),Ts(""),$s(!1)},children:[s.jsx("span",{children:E.name}),s.jsx("span",{className:"text-xs text-gray-400 font-mono",children:E.key})]},E.key))})]}):s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:Ye.type==="url"?"https://...":Ye.type==="ckb"?"https://ckbapi.quwanzhi.com/...":"关联配置的 key,或直接填 wx 开头的 AppID",value:Ye.type==="url"||Ye.type==="ckb"?Ye.url:Ye.appId,onChange:E=>{Ye.type==="url"||Ye.type==="ckb"?ut(B=>({...B,url:E.target.value})):ut(B=>({...B,appId:E.target.value}))}})]})]}),Ye.type==="wxlink"&&s.jsx("p",{className:"text-[11px] text-amber-400/80 leading-snug px-0.5",children:"操作:打开目标小程序 → 右上角「...」→「复制链接」→ 粘贴到上面。小程序内点击此标签会在 web-view 中打开,微信自动唤起目标小程序,无需修改小程序版本。"}),Ye.type==="miniprogram"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-300 text-sm",children:"页面路径(可选)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm font-mono",placeholder:"pages/index/index",value:Ye.pagePath,onChange:E=>ut(B=>({...B,pagePath:E.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-300 text-sm",children:"AppSecret(微信公众平台 · 仅服务端存储)"}),s.jsx(ce,{type:"password",autoComplete:"new-password",className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm font-mono",placeholder:re!=null&&re.hasAppSecret?"已保存密钥,留空不改;填写则覆盖":"粘贴目标小程序 AppSecret",value:Ye.appSecret,onChange:E=>ut(B=>({...B,appSecret:E.target.value}))}),s.jsx("p",{className:"text-[11px] text-gray-500 leading-snug",children:"与 AppID 成对落库;接口响应与小程序配置中均不会返回此字段。"})]})]})]}),s.jsxs(Sn,{className:"gap-2 pt-1",children:[s.jsx(J,{variant:"outline",onClick:()=>wn(!1),className:"border-gray-600",children:"取消"}),s.jsx(J,{onClick:async()=>{const E={tagId:Ye.tagId.trim(),label:Ye.label.trim(),aliases:Ye.aliases.trim(),url:Ye.url.trim(),type:Ye.type,appId:Ye.appId.trim(),appSecret:Ye.appSecret.trim(),pagePath:Ye.pagePath.trim()};if(E.tagId){const B=E.tagId;if([...B].length>50){G.error("标签ID 最长 50 个字符");return}if(/[#,\n\r\t]/.test(B)){G.error("标签ID 不能含 #、逗号或换行");return}}if(!E.label){G.error("显示文字必填");return}E.type==="miniprogram"&&(E.url=""),E.type==="wxlink"&&(E.appId="",E.pagePath=""),zs(!0);try{const B=await jt("/api/db/link-tags",E);B!=null&&B.success?(G.success(re?"已更新":"已添加"),wn(!1),Zs(),hr()):G.error((B==null?void 0:B.error)??"保存失败")}catch(B){console.error(B),G.error("保存失败")}finally{zs(!1)}},disabled:Bn,className:"bg-amber-500 hover:bg-amber-600 text-white",children:Bn?"保存中...":"保存"})]})]})})]})]}),s.jsx(tV,{open:Vr,onOpenChange:aa,editingPerson:Ca,onSubmit:async E=>{var be;const B={personId:E.personId||E.name.toLowerCase().replace(/\s+/g,"_")+"_"+Date.now().toString(36),name:E.name,userId:E.boundUserId,aliases:E.aliases||void 0,label:E.label,ckbApiKey:E.ckbApiKey||void 0,greeting:E.greeting||void 0,tips:E.tips||void 0,remarkType:E.remarkType||void 0,remarkFormat:E.remarkFormat||void 0,addFriendInterval:E.addFriendInterval,startTime:E.startTime||void 0,endTime:E.endTime||void 0,deviceGroups:(be=E.deviceGroups)!=null&&be.trim()?E.deviceGroups.split(",").map(Ke=>parseInt(Ke.trim(),10)).filter(Ke=>!Number.isNaN(Ke)):void 0},ue=await jt("/api/db/persons",B);if(ue&&ue.success===!1){const Ke=ue;Ke.ckbResponse&&console.log("存客宝返回",Ke.ckbResponse);const yt=Ke.error||"操作失败";throw new Error(yt)}if(sn(),G.success(Ca?"已保存":"已添加"),ue!=null&&ue.ckbCreateResult&&Object.keys(ue.ckbCreateResult).length>0){const Ke=ue.ckbCreateResult;console.log("存客宝创建结果",Ke);const yt=Ke.planId??Ke.id,kt=yt!=null?[`planId: ${yt}`]:[];Ke.apiKey!=null&&kt.push("apiKey: ***"),G.info(kt.length?`存客宝创建结果:${kt.join(",")}`:"存客宝创建结果见控制台")}}}),s.jsx(Wt,{open:!!us,onOpenChange:E=>{E||Ea(null)},children:s.jsxs(Ut,{showCloseButton:!0,className:"bg-[#0f2137] border-gray-700 text-white max-w-md p-4 gap-3",children:[s.jsxs(Kt,{className:"gap-1",children:[s.jsx(qt,{className:"text-white text-base",children:"确认删除"}),s.jsx(jf,{className:"text-gray-400 text-sm leading-relaxed wrap-break-word",children:us&&s.jsxs(s.Fragment,{children:[us.personSource==="vip_sync"?s.jsxs(s.Fragment,{children:[s.jsxs("p",{children:["确定删除超级个体「",us.name,"」对应的 @人物?"]}),s.jsxs("p",{className:"mt-1.5 text-amber-200/90",children:["仅删除本系统的 Person 与独立 token,",s.jsx("strong",{children:"不会"}),"删除存客宝里的「超级个体统一获客计划」(其他超级个体仍在使用该计划)。"]})]}):s.jsx(s.Fragment,{children:s.jsxs("p",{children:["确定删除「SOUL链接人与事-",us.name,"」?将同时删除存客宝对应获客计划。"]})}),s.jsxs("p",{className:"mt-1.5",children:["二次确认:删除后无法恢复,文章中的 @",us.name," 将无法正常跳转。"]})]})})]}),s.jsxs(Sn,{className:"gap-2 sm:gap-2 pt-1",children:[s.jsx(J,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-300",onClick:()=>Ea(null),children:"取消"}),s.jsx(J,{variant:"destructive",size:"sm",className:"bg-red-600 hover:bg-red-700",onClick:async()=>{us&&(await Ei(`/api/db/persons?personId=${us.personId}`),Ea(null),sn(),G.success("已删除"))},children:"确定删除"})]})]})}),s.jsx(Wt,{open:O,onOpenChange:Se,children:s.jsxs(Ut,{className:"max-w-2xl bg-[#0f2137] border-gray-700",children:[s.jsx(Kt,{children:s.jsxs(qt,{className:"text-white flex items-center gap-2",children:[s.jsx(Wn,{className:"w-5 h-5 text-green-400"}),Et," — 获客详情(共 ",Ot," 条)"]})}),s.jsx("div",{className:"max-h-[450px] overflow-y-auto space-y-2",children:Xa?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(Ve,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):xt.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-[40px_1fr_90px_90px_70px_60px_110px] 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:"状态"}),s.jsx("span",{children:"时间"})]}),xt.map((E,B)=>s.jsxs("div",{className:"grid grid-cols-[40px_1fr_90px_90px_70px_60px_110px] gap-2 px-3 py-2 bg-[#0a1628] rounded text-sm",children:[s.jsx("span",{className:"text-gray-500 text-xs",children:(Xs-1)*20+B+1}),s.jsx("span",{className:"text-white truncate",children:E.nickname||E.name||E.userId||"-"}),s.jsx("span",{className:"text-gray-300 text-xs",children:E.phone||"-"}),s.jsx("span",{className:"text-gray-300 text-xs truncate",children:E.wechatId||"-"}),s.jsx("span",{className:"text-xs",children:E.source==="article_mention"?s.jsx("span",{className:"text-purple-400",children:"文章@"}):E.source==="index_lead"?s.jsx("span",{className:"text-blue-400",children:"首页"}):s.jsx("span",{className:"text-gray-500",children:E.source||"-"})}),s.jsx("span",{className:"text-[10px]",children:s.jsx("span",{className:"text-green-400 bg-green-400/10 px-1 py-0.5 rounded",children:"已添加"})}),s.jsx("span",{className:"text-gray-500 text-xs",children:E.createdAt?new Date(E.createdAt).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"-"})]},E.id))]})}),Ot>20&&s.jsxs("div",{className:"flex items-center justify-center gap-2 pt-2",children:[s.jsx(J,{size:"sm",variant:"outline",disabled:Xs<=1,onClick:()=>Ar(Ze,Et,Xs-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:[Xs," / ",Math.ceil(Ot/20)]}),s.jsx(J,{size:"sm",variant:"outline",disabled:Xs>=Math.ceil(Ot/20),onClick:()=>Ar(Ze,Et,Xs+1),className:"border-gray-600 text-gray-300 bg-transparent h-7 px-3",children:"下一页"})]})]})})]})}const Si={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 hj(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):Si.stats}function fj(t){return Array.isArray(t)?t.map(e=>typeof e=="string"?e:String(e??"")).filter(Boolean):Si.highlights}function rV(){const[t,e]=y.useState(Si),[n,r]=y.useState(!0),[a,i]=y.useState(!1),[o,c]=y.useState(!1),u=y.useRef(null);y.useEffect(()=>{Oe("/api/admin/author-settings").then(k=>{const T=k==null?void 0:k.data;T&&typeof T=="object"&&e({name:String(T.name??Si.name),avatar:String(T.avatar??Si.avatar),avatarImg:String(T.avatarImg??""),title:String(T.title??Si.title),bio:String(T.bio??Si.bio),stats:hj(T.stats).length?hj(T.stats):Si.stats,highlights:fj(T.highlights).length?fj(T.highlights):Si.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(P=>P.label||P.value),highlights:t.highlights.filter(Boolean)},T=await jt("/api/admin/author-settings",k);if(!T||T.success===!1){G.error("保存失败: "+(T&&typeof T=="object"&&"error"in T?T.error:""));return}i(!1);const C=document.createElement("div");C.className="fixed top-4 right-4 z-50 px-4 py-2 rounded-lg bg-[#38bdac] text-white text-sm shadow-lg",C.textContent="作者设置已保存",document.body.appendChild(C),setTimeout(()=>C.remove(),2e3)}catch(k){console.error(k),G.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{i(!1)}},f=async k=>{var C;const T=(C=k.target.files)==null?void 0:C[0];if(T){c(!0);try{const P=new FormData;P.append("file",T),P.append("folder","avatars");const L=ku(),q={};L&&(q.Authorization=`Bearer ${L}`);const H=await(await fetch(El("/api/upload"),{method:"POST",body:P,credentials:"include",headers:q})).json();H!=null&&H.success&&(H!=null&&H.url)?e(R=>({...R,avatarImg:H.url})):G.error("上传失败: "+((H==null?void 0:H.error)||"未知错误"))}catch(P){console.error(P),G.error("上传失败")}finally{c(!1),u.current&&(u.current.value="")}}},m=()=>e(k=>({...k,stats:[...k.stats,{label:"",value:""}]})),x=k=>e(T=>({...T,stats:T.stats.filter((C,P)=>P!==k)})),b=(k,T,C)=>e(P=>({...P,stats:P.stats.map((L,q)=>q===k?{...L,[T]:C}:L)})),v=()=>e(k=>({...k,highlights:[...k.highlights,""]})),w=k=>e(T=>({...T,highlights:T.highlights.filter((C,P)=>P!==k)})),N=(k,T)=>e(C=>({...C,highlights:C.highlights.map((P,L)=>L===k?T:P)}));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(Ci,{className:"w-5 h-5 text-[#38bdac]"}),"作者详情"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置小程序「关于作者」页展示的作者信息,包括头像、简介、统计数据与亮点标签。"})]}),s.jsxs(J,{onClick:h,disabled:a||n,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(In,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{children:[s.jsxs(pt,{className:"flex items-center gap-2 text-white",children:[s.jsx(Ci,{className:"w-4 h-4 text-[#38bdac]"}),"基本信息"]}),s.jsx(nn,{className:"text-gray-400",children:"作者姓名、头像、头衔与个人简介,将展示在「关于作者」页顶部。"})]}),s.jsxs(ze,{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(ne,{className:"text-gray-300",children:"姓名"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.name,onChange:k=>e(T=>({...T,name:k.target.value})),placeholder:"卡若"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"首字母占位(无头像时显示)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white w-20",value:t.avatar,onChange:k=>e(T=>({...T,avatar:k.target.value.slice(0,1)||"K"})),placeholder:"K"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Wj,{className:"w-3 h-3 text-[#38bdac]"}),"头像图片"]}),s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:t.avatarImg,onChange:k=>e(T=>({...T,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(J,{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(bf,{className:"w-4 h-4 mr-2"}),o?"上传中...":"上传"]})]}),t.avatarImg&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:Ua(t.avatarImg.startsWith("http")?t.avatarImg:El(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(ne,{className:"text-gray-300",children:"头衔"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.title,onChange:k=>e(T=>({...T,title:k.target.value})),placeholder:"Soul派对房主理人 · 私域运营专家"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"个人简介"}),s.jsx(Il,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[120px]",value:t.bio,onChange:k=>e(T=>({...T,bio:k.target.value})),placeholder:"每天早上6点到9点..."})]})]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{children:[s.jsx(pt,{className:"text-white",children:"统计数据"}),s.jsx(nn,{className:"text-gray-400",children:"展示在作者卡片中的数字指标,如「商业案例 62」「连续直播 365天」。第一个「商业案例」的值可由书籍统计自动更新。"})]}),s.jsxs(ze,{className:"space-y-3",children:[t.stats.map((k,T)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.label,onChange:C=>b(T,"label",C.target.value),placeholder:"标签"}),s.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.value,onChange:C=>b(T,"value",C.target.value),placeholder:"数值"}),s.jsx(J,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>x(T),children:s.jsx(rs,{className:"w-4 h-4"})})]},T)),s.jsxs(J,{variant:"outline",size:"sm",onClick:m,className:"border-gray-600 text-gray-400",children:[s.jsx(Un,{className:"w-4 h-4 mr-2"}),"添加统计项"]})]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{children:[s.jsx(pt,{className:"text-white",children:"亮点标签"}),s.jsx(nn,{className:"text-gray-400",children:"作者优势或成就的简短描述,以标签形式展示。"})]}),s.jsxs(ze,{className:"space-y-3",children:[t.highlights.map((k,T)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k,onChange:C=>N(T,C.target.value),placeholder:"5年私域运营经验"}),s.jsx(J,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>w(T),children:s.jsx(rs,{className:"w-4 h-4"})})]},T)),s.jsxs(J,{variant:"outline",size:"sm",onClick:v,className:"border-gray-600 text-gray-400",children:[s.jsx(Un,{className:"w-4 h-4 mr-2"}),"添加亮点"]})]})]})]})]})}function aV(t){return confirm(`确定删除该${t}?此操作不可恢复。`)?window.prompt(`请输入「删除」以确认删除${t}`)==="删除":!1}function iV(){const[t,e]=y.useState([]),[n,r]=y.useState(0),[a,i]=y.useState(1),[o]=y.useState(10),[c,u]=y.useState(0),[h,f]=y.useState(""),m=Lo(h,300),[x,b]=y.useState(!0),[v,w]=y.useState(null),[N,k]=y.useState(!1),[T,C]=y.useState(null),[P,L]=y.useState(""),[q,z]=y.useState(""),[H,R]=y.useState(""),[se,X]=y.useState("admin"),[V,ie]=y.useState("active"),[le,he]=y.useState(!1);async function I(){var U;b(!0),w(null);try{const pe=new URLSearchParams({page:String(a),pageSize:String(o)});m.trim()&&pe.set("search",m.trim());const fe=await Oe(`/api/admin/users?${pe}`);fe!=null&&fe.success?(e(fe.records||[]),r(fe.total??0),u(fe.totalPages??0)):w(fe.error||"加载失败")}catch(pe){const fe=pe;w(fe.status===403?"无权限访问":((U=fe==null?void 0:fe.data)==null?void 0:U.error)||"加载失败"),e([])}finally{b(!1)}}y.useEffect(()=>{I()},[a,o,m]);const Q=()=>{C(null),L(""),z(""),R(""),X("admin"),ie("active"),k(!0)},$=U=>{C(U),L(U.username),z(""),R(U.name||""),X(U.role==="super_admin"?"super_admin":"admin"),ie(U.status==="disabled"?"disabled":"active"),k(!0)},xe=async()=>{var U;if(!P.trim()){w("用户名不能为空");return}if(!T&&!q){w("新建时密码必填,至少 6 位");return}if(q&&q.length<6){w("密码至少 6 位");return}w(null),he(!0);try{if(T){const pe=await tn("/api/admin/users",{id:T.id,password:q||void 0,name:H.trim(),role:se,status:V});pe!=null&&pe.success?(k(!1),I()):w((pe==null?void 0:pe.error)||"保存失败")}else{const pe=await jt("/api/admin/users",{username:P.trim(),password:q,name:H.trim(),role:se});pe!=null&&pe.success?(k(!1),I()):w((pe==null?void 0:pe.error)||"保存失败")}}catch(pe){const fe=pe;w(((U=fe==null?void 0:fe.data)==null?void 0:U.error)||"保存失败")}finally{he(!1)}},Z=async U=>{var pe;if(!aV("管理员")){w("已取消删除");return}try{const fe=await Ei(`/api/admin/users?id=${U}`);fe!=null&&fe.success?I():w((fe==null?void 0:fe.error)||"删除失败")}catch(fe){const oe=fe;w(((pe=oe==null?void 0:oe.data)==null?void 0:pe.error)||"删除失败")}},F=U=>{if(!U)return"-";try{const pe=new Date(U);return isNaN(pe.getTime())?U:pe.toLocaleString("zh-CN")}catch{return U}};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(Pc,{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(ce,{placeholder:"搜索用户名/昵称",value:h,onChange:U=>f(U.target.value),className:"w-48 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"}),s.jsx(J,{variant:"outline",size:"sm",onClick:I,disabled:x,className:"border-gray-600 text-gray-300",children:s.jsx(Ve,{className:`w-4 h-4 ${x?"animate-spin":""}`})}),s.jsxs(J,{onClick:Q,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Un,{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(_e,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(ze,{className:"p-0",children:x?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(s.Fragment,{children:[s.jsxs(Ls,{children:[s.jsx(Os,{children:s.jsxs(Nt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400",children:"ID"}),s.jsx(Ce,{className:"text-gray-400",children:"用户名"}),s.jsx(Ce,{className:"text-gray-400",children:"昵称"}),s.jsx(Ce,{className:"text-gray-400",children:"角色"}),s.jsx(Ce,{className:"text-gray-400",children:"状态"}),s.jsx(Ce,{className:"text-gray-400",children:"创建时间"}),s.jsx(Ce,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(Ds,{children:[t.map(U=>s.jsxs(Nt,{className:"border-gray-700/50",children:[s.jsx(ke,{className:"text-gray-300",children:U.id}),s.jsx(ke,{className:"text-white font-medium",children:U.username}),s.jsx(ke,{className:"text-gray-400",children:U.name||"-"}),s.jsx(ke,{children:s.jsx(He,{variant:"outline",className:U.role==="super_admin"?"border-amber-500/50 text-amber-400":"border-gray-600 text-gray-400",children:U.role==="super_admin"?"超级管理员":"管理员"})}),s.jsx(ke,{children:s.jsx(He,{variant:"outline",className:U.status==="active"?"border-[#38bdac]/50 text-[#38bdac]":"border-gray-500 text-gray-500",children:U.status==="active"?"正常":"已禁用"})}),s.jsx(ke,{className:"text-gray-500 text-sm",children:F(U.createdAt)}),s.jsxs(ke,{className:"text-right",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>$(U),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(rn,{className:"w-4 h-4"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>Z(U.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(Yn,{className:"w-4 h-4"})})]})]},U.id)),t.length===0&&!x&&s.jsx(Nt,{children:s.jsx(ke,{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(rr,{page:a,pageSize:o,total:n,totalPages:c,onPageChange:i})})]})})}),s.jsx(Wt,{open:N,onOpenChange:k,children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(Kt,{children:s.jsx(qt,{className:"text-white",children:T?"编辑管理员":"新增管理员"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"用户名"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"登录用户名",value:P,onChange:U=>L(U.target.value),disabled:!!T}),T&&s.jsx("p",{className:"text-xs text-gray-500",children:"用户名不可修改"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:T?"新密码(留空不改)":"密码"}),s.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:T?"留空表示不修改":"至少 6 位",value:q,onChange:U=>z(U.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"昵称"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"显示名称",value:H,onChange:U=>R(U.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"角色"}),s.jsxs("select",{value:se,onChange:U=>X(U.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:"超级管理员"})]})]}),T&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"状态"}),s.jsxs("select",{value:V,onChange:U=>ie(U.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(Sn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>k(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(rs,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:xe,disabled:le,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(In,{className:"w-4 h-4 mr-2"}),le?"保存中...":"保存"]})]})]})})]})}function On({method:t,url:e,desc:n,headers:r,bodyTitle:a,body:i,response:o}){const c=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 ${c}`,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(` -`)})]}),i&&s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:a??"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:i})]}),o&&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:o})]})]})}function R4(){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(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ft,{className:"pb-3",children:s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(Ag,{className:"w-5 h-5 text-[#38bdac]"}),"1. Authentication"]})}),s.jsx(ze,{className:"space-y-4",children:s.jsx(On,{method:"POST",url:"/api/admin",desc:"登录,返回 JWT token",headers:["Content-Type: application/json"],body:`{ - "username": "admin", - "password": "your_password" -}`,response:`{ - "success": true, - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", - "expires_at": "2026-03-16T12:00:00Z" -}`})})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ft,{className:"pb-3",children:s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(wr,{className:"w-5 h-5 text-[#38bdac]"}),"2. 章节管理 (Chapters)"]})}),s.jsxs(ze,{className:"space-y-4",children:[s.jsx(On,{method:"GET",url:"/api/db/book?action=chapters",desc:"获取章节树",headers:t,response:`{ - "success": true, - "data": [ - { "id": "part-1", "title": "第一篇", "children": [...] }, - { "id": "section-1", "title": "第1节", "price": 1.0, "isFree": false } - ] -}`}),s.jsx(On,{method:"GET",url:"/api/db/book?action=section&id={id}",desc:"获取单篇内容",headers:t,response:`{ - "success": true, - "data": { - "id": "section-1", - "title": "标题", - "content": "正文...", - "price": 1.0, - "isFree": false, - "partId": "part-1", - "chapterId": "ch-1" - } -}`}),s.jsx(On,{method:"POST",url:"/api/db/book",desc:"新建章节 (action=create-section)",headers:t,body:`{ - "action": "create-section", - "title": "新章节标题", - "content": "正文内容", - "price": 0, - "isFree": true, - "partId": "part-1", - "chapterId": "ch-1", - "partTitle": "第一篇", - "chapterTitle": "第1章" -}`,response:`{ - "success": true, - "data": { "id": "section-new-id", "title": "新章节标题", ... } -}`}),s.jsx(On,{method:"POST",url:"/api/db/book",desc:"更新章节内容 (action=update-section)",headers:t,body:`{ - "action": "update-section", - "id": "section-1", - "title": "更新后的标题", - "content": "更新后的正文", - "price": 1.0, - "isFree": false -}`,response:`{ - "success": true, - "data": { "id": "section-1", "title": "更新后的标题", ... } -}`}),s.jsx(On,{method:"POST",url:"/api/db/book",desc:"删除章节 (action=delete-section)",headers:t,body:`{ - "action": "delete-section", - "id": "section-1" -}`,response:`{ - "success": true, - "message": "已删除" -}`}),s.jsxs("div",{className:"rounded-lg border border-[#38bdac]/30 bg-[#0a1628]/40 p-4 space-y-2",children:[s.jsx("p",{className:"text-[#38bdac] text-sm font-medium",children:"富文本流程说明(编辑器 ⇄ 接口)"}),s.jsxs("ol",{className:"text-gray-400 text-xs space-y-2 list-decimal list-inside leading-relaxed",children:[s.jsxs("li",{children:["先 ",s.jsx("code",{className:"text-[#38bdac]",children:"POST /api/upload"})," 上传素材,得到"," ",s.jsx("code",{className:"text-amber-200/90",children:"url"}),"(可为相对路径 ",s.jsx("code",{className:"text-amber-200/90",children:"/uploads/..."})," 或 OSS 完整 URL)。"]}),s.jsxs("li",{children:["将返回的 ",s.jsx("code",{className:"text-amber-200/90",children:"url"})," 填入正文 HTML:图片用"," ",s.jsx("code",{className:"text-green-400/90",children:''}),";视频用"," ",s.jsx("code",{className:"text-green-400/90",children:'
    '}),";附件用带链接的段落或"," ",s.jsx("code",{className:"text-green-400/90",children:'文件名'}),"。"]}),s.jsxs("li",{children:["最后把完整 HTML 字符串写入"," ",s.jsx("code",{className:"text-[#38bdac]",children:"create-section"})," /"," ",s.jsx("code",{className:"text-[#38bdac]",children:"update-section"})," 的 ",s.jsx("code",{className:"text-amber-200/90",children:"content"})," 字段。"]})]}),s.jsxs("p",{className:"text-gray-500 text-xs",children:["管理后台编辑器内图片/视频仅作小预览(CSS 类 ",s.jsx("code",{className:"text-gray-400",children:".rich-editor-content"}),"),不影响已保存 HTML;C 端按小程序/Web 自己的样式渲染全尺寸。"]})]}),s.jsx(On,{method:"POST",url:"/api/upload",desc:"上传章节富文本素材:图片 / 视频 / 附件(multipart,与后台「内容管理」编辑器一致)。按 form 字段 folder 区分类型与大小上限。",headers:["Authorization: Bearer {token}(建议携带,与后台一致)","Content-Type: multipart/form-data(由浏览器自动带 boundary,不要手写为 application/json)"],bodyTitle:"Request (multipart/form-data)",body:`字段: - file — 二进制文件(必填) - folder — 存储子目录(必填约定): - • book-images 图片,≤5MB,image/* - • book-videos 视频,≤100MB,video/*(如 mp4、mov、webm) - • book-attachments 附件,≤30MB,pdf/zip/Office/txt 等 - -成功时 data.url 与根字段 url 均为可访问地址。`,response:`{ - "success": true, - "url": "/uploads/book-images/1730000000000_abc123.jpg", - "data": { - "url": "/uploads/book-images/1730000000000_abc123.jpg", - "fileName": "1730000000000_abc123.jpg", - "size": 102400, - "type": "image/jpeg" - } -}`}),s.jsx(On,{method:"DELETE",url:"/api/upload?path={encodeURIComponent(文件URL)}",desc:"按 URL 删除已上传文件(本地或 OSS,需与上传返回的 url 一致)",headers:["Authorization: Bearer {token}(建议携带)"],response:`{ - "success": true, - "message": "删除成功" -}`})]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ft,{className:"pb-3",children:s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(Ci,{className:"w-5 h-5 text-[#38bdac]"}),"3. 人物管理 (@Mentions)"]})}),s.jsxs(ze,{className:"space-y-4",children:[s.jsx(On,{method:"GET",url:"/api/db/persons",desc:"人物列表",headers:t,response:`{ - "success": true, - "data": [ - { "personId": "p1", "label": "张三", "aliases": ["老张"], ... } - ] -}`}),s.jsx(On,{method:"GET",url:"/api/db/person?personId={id}",desc:"人物详情",headers:t,response:`{ - "success": true, - "data": { - "personId": "p1", - "label": "张三", - "aliases": ["老张"], - "description": "..." - } -}`}),s.jsx(On,{method:"POST",url:"/api/db/persons",desc:"新增/更新人物(含 aliases 字段)",headers:t,body:`{ - "personId": "p1", - "label": "张三", - "aliases": ["老张", "张三丰"], - "description": "可选描述" -}`,response:`{ - "success": true, - "data": { "personId": "p1", "label": "张三", ... } -}`}),s.jsx(On,{method:"DELETE",url:"/api/db/persons?personId={id}",desc:"删除人物",headers:t,response:`{ - "success": true, - "message": "已删除" -}`})]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ft,{className:"pb-3",children:s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(Jd,{className:"w-5 h-5 text-[#38bdac]"}),"4. 链接标签 (#LinkTags)"]})}),s.jsxs(ze,{className:"space-y-4",children:[s.jsx(On,{method:"GET",url:"/api/db/link-tags",desc:"标签列表",headers:t,response:`{ - "success": true, - "data": [ - { "tagId": "t1", "label": "官网", "aliases": [], "type": "url", "url": "https://..." } - ] -}`}),s.jsx(On,{method:"POST",url:"/api/db/link-tags",desc:"新增/更新标签(含 aliases, type: url/miniprogram/ckb)",headers:t,body:`{ - "tagId": "t1", - "label": "官网", - "aliases": ["官方网站"], - "type": "url", - "url": "https://example.com" -} - -// type 可选: url | miniprogram | ckb`,response:`{ - "success": true, - "data": { "tagId": "t1", "label": "官网", "type": "url", ... } -}`}),s.jsx(On,{method:"DELETE",url:"/api/db/link-tags?tagId={id}",desc:"删除标签",headers:t,response:`{ - "success": true, - "message": "已删除" -}`})]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ft,{className:"pb-3",children:s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(va,{className:"w-5 h-5 text-[#38bdac]"}),"5. 内容搜索"]})}),s.jsx(ze,{className:"space-y-4",children:s.jsx(On,{method:"GET",url:"/api/search?q={keyword}",desc:"搜索(标题优先 3 条 + 内容匹配)",headers:t,response:`{ - "success": true, - "data": { - "titleMatches": [{ "id": "s1", "title": "...", "snippet": "..." }], - "contentMatches": [{ "id": "s2", "title": "...", "snippet": "..." }] - } -}`})})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ft,{className:"pb-3",children:s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(Pg,{className:"w-5 h-5 text-[#38bdac]"}),"6. 内容排行"]})}),s.jsx(ze,{className:"space-y-4",children:s.jsx(On,{method:"GET",url:"/api/db/book?action=ranking",desc:"排行榜数据",headers:t,response:`{ - "success": true, - "data": [ - { "id": "s1", "title": "...", "clickCount": 100, "payCount": 50, "hotScore": 120, "hotRank": 1 } - ] -}`})})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ft,{className:"pb-3",children:s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(Cl,{className:"w-5 h-5 text-[#38bdac]"}),"7. 小程序接口"]})}),s.jsxs(ze,{className:"space-y-4",children:[s.jsx(On,{method:"GET",url:"/api/miniprogram/config/read-extras",desc:"阅读页懒加载:linkTags、linkedMiniprograms、mentionPersons(@ 自动解析:name/label/aliases + token,与 persons 表一致;inPool 表示已绑定会员即超级个体侧流量池人物)",headers:["Content-Type: application/json"],response:`{ - "linkTags": [], - "linkedMiniprograms": [], - "mentionPersons": [ - { "personId": "xxx", "token": "32位...", "name": "陈周", "aliases": "", "label": "", "inPool": true } - ] -}`}),s.jsx(On,{method:"GET",url:"/api/miniprogram/book/all-chapters",desc:"全部章节(小程序用)",headers:["Content-Type: application/json"],response:`{ - "success": true, - "data": [ { "id": "s1", "title": "...", "price": 1.0, "isFree": false }, ... ] -}`}),s.jsx(On,{method:"GET",url:"/api/miniprogram/balance?userId={id}",desc:"查余额",headers:["Content-Type: application/json"],response:`{ - "success": true, - "data": { "balance": 100.50, "userId": "xxx" } -}`}),s.jsx(On,{method:"POST",url:"/api/miniprogram/balance/gift",desc:"代付",headers:["Content-Type: application/json"],body:`{ - "userId": "xxx", - "amount": 10.00, - "remark": "可选备注" -}`,response:`{ - "success": true, - "data": { "balance": 110.50 } -}`}),s.jsx(On,{method:"POST",url:"/api/miniprogram/balance/gift/redeem",desc:"领取代付",headers:["Content-Type: application/json"],body:`{ - "code": "GIFT_XXXX" -}`,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/upload(与后台编辑器一致)。小程序使用 /api/miniprogram/*。完整实现见 soul-api 源码。"})]})}const oV={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},lV={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},cV={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...lV},ckbLeadApiKey:""},dV={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0},uV={tabBar:{home:"首页",chapters:"目录",match:"找伙伴",my:"我的"},chaptersPage:{bookTitle:"一场SOUL的创业实验场",bookSubtitle:"来自Soul派对房的真实商业故事",newBadgeText:"NEW"},homePage:{logoTitle:"卡若创业派对",logoSubtitle:"来自派对房的真实故事",linkKaruoText:"点击链接卡若",linkKaruoAvatar:"",searchPlaceholder:"搜索章节标题或内容...",bannerTag:"推荐",bannerReadMoreText:"点击阅读",superSectionTitle:"超级个体",superSectionLinkText:"获客入口",superSectionLinkPath:"/pages/match/match",pickSectionTitle:"精选推荐",latestSectionTitle:"最新新增"},myPage:{cardLabel:"名片",vipLabelVip:"会员中心",vipLabelGuest:"成为会员",cardPath:"",vipPath:"/pages/vip/vip",readStatLabel:"已读章节",recentReadTitle:"最近阅读",readStatPath:"/pages/reading-records/reading-records?focus=all",recentReadPath:"/pages/reading-records/reading-records?focus=recent"}},hV=["system","author","admin","api-docs"],pj=["basic","mp","oss","features"];function fV(){const[t,e]=_0(),n=t.get("tab")??"system",r=hV.includes(n)?n:"system",a=t.get("section")??"basic",i=pj.includes(a)?a:"basic",[o,c]=y.useState(cV),[u,h]=y.useState(dV),[f,m]=y.useState(oV),[x,b]=y.useState("{}"),[v,w]=y.useState("NEW"),[N,k]=y.useState({}),[T,C]=y.useState(!1),[P,L]=y.useState(!0),[q,z]=y.useState(!1),[H,R]=y.useState(""),[se,X]=y.useState(""),[V,ie]=y.useState(!1),[le,he]=y.useState(!1),I=(oe,D,K=!1)=>{R(oe),X(D),ie(K),z(!0)};y.useEffect(()=>{(async()=>{try{const D=await Oe("/api/admin/settings");if(!D||D.success===!1)return;if(D.featureConfig&&Object.keys(D.featureConfig).length&&h(K=>({...K,...D.featureConfig})),D.mpConfig&&typeof D.mpConfig=="object"){const K={...D.mpConfig};m(Fe=>({...Fe,...K}));const _=K.mpUi,Y=_!=null&&typeof _=="object"&&!Array.isArray(_)?_:{},te=Y.chaptersPage&&typeof Y.chaptersPage=="object"&&!Array.isArray(Y.chaptersPage)?Y.chaptersPage:{},Ne=te.newBadgeText??te.sectionNewBadgeText;w(typeof Ne=="string"&&Ne.trim()?Ne.trim():"NEW"),b(JSON.stringify(Y,null,2))}if(D.ossConfig&&typeof D.ossConfig=="object"&&k(K=>({...K,...D.ossConfig})),D.siteSettings&&typeof D.siteSettings=="object"){const K=D.siteSettings;c(_=>({..._,...typeof K.sectionPrice=="number"&&{sectionPrice:K.sectionPrice},...typeof K.baseBookPrice=="number"&&{baseBookPrice:K.baseBookPrice},...typeof K.distributorShare=="number"&&{distributorShare:K.distributorShare},...K.authorInfo&&typeof K.authorInfo=="object"&&{authorInfo:{..._.authorInfo,...K.authorInfo}},...typeof K.ckbLeadApiKey=="string"&&{ckbLeadApiKey:K.ckbLeadApiKey}}))}}catch(D){console.error("Load settings error:",D)}finally{L(!1)}})()},[]);const Q=async(oe,D)=>{he(!0);try{const K=await jt("/api/admin/settings",{featureConfig:oe});if(!K||K.success===!1){D(),I("保存失败",(K==null?void 0:K.error)??"未知错误",!0);return}I("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(K){console.error("Save feature config error:",K),D(),I("保存失败",K instanceof Error?K.message:String(K),!0)}finally{he(!1)}},$=(oe,D)=>{const K=u,_={...K,[oe]:D};h(_),Q(_,()=>h(K))},[xe,Z]=y.useState(!1),F=async oe=>{const D=f,K={...D,auditMode:oe};m(K),Z(!0);try{const _=await jt("/api/admin/settings",{mpConfig:K});if(!_||_.success===!1){m(D),I("保存失败",(_==null?void 0:_.error)??"未知错误",!0);return}I("已保存",oe?"审核模式已开启,小程序将隐藏所有支付入口。":"审核模式已关闭,支付功能已恢复。")}catch(_){m(D),I("保存失败",_ instanceof Error?_.message:String(_),!0)}finally{Z(!1)}},U=async()=>{C(!0);try{let oe={};try{const te=x.trim();if(te){const Ne=JSON.parse(te);if(Ne&&typeof Ne=="object"&&!Array.isArray(Ne))oe=Ne;else{I("保存失败","小程序文案 mpUi 须为 JSON 对象(非数组)",!0),C(!1);return}}}catch{I("保存失败","小程序文案 mpUi 不是合法 JSON",!0),C(!1);return}const D=oe.chaptersPage,K=D&&typeof D=="object"&&!Array.isArray(D)?{...D}:{},_=v.trim();_?K.newBadgeText=_:delete K.newBadgeText,delete K.sectionNewBadgeText,oe.chaptersPage=K;const Y=await jt("/api/admin/settings",{featureConfig:u,siteSettings:{sectionPrice:o.sectionPrice,baseBookPrice:o.baseBookPrice,distributorShare:o.distributorShare,authorInfo:o.authorInfo,ckbLeadApiKey:o.ckbLeadApiKey||void 0},mpConfig:{...f,appId:f.appId||"",withdrawSubscribeTmplId:f.withdrawSubscribeTmplId||"",mchId:f.mchId||"",minWithdraw:typeof f.minWithdraw=="number"?f.minWithdraw:10,auditMode:f.auditMode??!1,mpUi:oe},ossConfig:Object.keys(N).length?{endpoint:N.endpoint??"",bucket:N.bucket??"",region:N.region??"",accessKeyId:N.accessKeyId??"",accessKeySecret:N.accessKeySecret??""}:void 0});if(!Y||Y.success===!1){I("保存失败",(Y==null?void 0:Y.error)??"未知错误",!0);return}I("已保存","设置已保存成功。")}catch(oe){console.error("Save settings error:",oe),I("保存失败",oe instanceof Error?oe.message:String(oe),!0)}finally{C(!1)}},pe=oe=>{if(oe==="system"){const D=new URLSearchParams(t);D.delete("tab"),pj.includes(D.get("section")||"basic")||D.set("section","basic"),e(D);return}e({tab:oe})},fe=oe=>{const D=new URLSearchParams(t);D.delete("tab"),D.set("section",oe),e(D)};return P?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(J,{onClick:U,disabled:T,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(In,{className:"w-4 h-4 mr-2"}),T?"保存中...":"保存设置"]})]}),s.jsxs(Vc,{value:r,onValueChange:pe,className:"w-full",children:[s.jsxs(Al,{className:"mb-6 bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(an,{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(wo,{className:"w-4 h-4 mr-2"}),"系统设置"]}),s.jsxs(an,{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(Ih,{className:"w-4 h-4 mr-2"}),"作者详情"]}),s.jsxs(an,{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(Pc,{className:"w-4 h-4 mr-2"}),"管理员"]}),s.jsxs(an,{value:"api-docs",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",onClick:oe=>{oe.preventDefault(),window.open("/api-docs","_blank")},children:[s.jsx(Hj,{className:"w-4 h-4 mr-2"}),"API 文档 ↗"]})]}),s.jsxs(on,{value:"system",className:"mt-0",children:[s.jsxs("p",{className:"text-xs text-gray-500 mb-3",children:["MBTI 默认头像已迁至"," ",s.jsx(Fc,{to:"/users",className:"text-[#38bdac] underline",children:"用户管理(用户列表点头像打开)"})]}),s.jsxs(Vc,{value:i,onValueChange:fe,className:"w-full",children:[s.jsxs(Al,{className:"mb-4 bg-[#0a1628] border border-gray-700/50 p-1 flex-wrap h-auto gap-1",children:[s.jsxs(an,{value:"basic",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(dM,{className:"w-3.5 h-3.5 mr-1"}),"基础与价格"]}),s.jsxs(an,{value:"mp",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(Cl,{className:"w-3.5 h-3.5 mr-1"}),"小程序与审核"]}),s.jsxs(an,{value:"oss",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(N1,{className:"w-3.5 h-3.5 mr-1"}),"OSS"]}),s.jsxs(an,{value:"features",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(wo,{className:"w-3.5 h-3.5 mr-1"}),"功能开关"]})]}),s.jsxs(on,{value:"basic",className:"space-y-6 mt-0",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{children:[s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(Ih,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),s.jsx(nn,{className:"text-gray-400",children:'配置作者信息,将在"关于作者"页面显示'})]}),s.jsxs(ze,{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(ne,{htmlFor:"author-name",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Ih,{className:"w-3 h-3"}),"主理人名称"]}),s.jsx(ce,{id:"author-name",className:"bg-[#0a1628] border-gray-700 text-white",value:o.authorInfo.name??"",onChange:oe=>c(D=>({...D,authorInfo:{...D.authorInfo,name:oe.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{htmlFor:"start-date",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Sg,{className:"w-3 h-3"}),"开播日期"]}),s.jsx(ce,{id:"start-date",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 2025年10月15日",value:o.authorInfo.startDate??"",onChange:oe=>c(D=>({...D,authorInfo:{...D.authorInfo,startDate:oe.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{htmlFor:"live-time",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Sg,{className:"w-3 h-3"}),"直播时间"]}),s.jsx(ce,{id:"live-time",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 06:00-09:00",value:o.authorInfo.liveTime??"",onChange:oe=>c(D=>({...D,authorInfo:{...D.authorInfo,liveTime:oe.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{htmlFor:"platform",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Kj,{className:"w-3 h-3"}),"直播平台"]}),s.jsx(ce,{id:"platform",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: Soul派对房",value:o.authorInfo.platform??"",onChange:oe=>c(D=>({...D,authorInfo:{...D.authorInfo,platform:oe.target.value}}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{htmlFor:"description",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(wr,{className:"w-3 h-3"}),"简介描述"]}),s.jsx(ce,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:o.authorInfo.description??"",onChange:oe=>c(D=>({...D,authorInfo:{...D.authorInfo,description:oe.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),s.jsx(Il,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:o.authorInfo.bio??"",onChange:oe=>c(D=>({...D,authorInfo:{...D.authorInfo,bio:oe.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{htmlFor:"ckb-lead-api-key",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Ba,{className:"w-3 h-3"}),"链接卡若存客宝密钥"]}),s.jsx(ce,{id:"ckb-lead-api-key",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 xxxxx-xxxxx-xxxxx-xxxxx(留空则用 .env 默认)",value:o.ckbLeadApiKey??"",onChange:oe=>c(D=>({...D,ckbLeadApiKey:oe.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-linear-to-br from-[#00CED1] to-[#20B2AA] flex items-center justify-center text-xl font-bold text-white",children:(o.authorInfo.name??"K").charAt(0)}),s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-semibold",children:o.authorInfo.name}),s.jsx("p",{className:"text-gray-400 text-xs",children:o.authorInfo.description}),s.jsxs("p",{className:"text-[#38bdac] text-xs mt-1",children:["每日 ",o.authorInfo.liveTime," · ",o.authorInfo.platform]})]})]})]})]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{children:[s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(xf,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),s.jsx(nn,{className:"text-gray-400",children:"配置书籍和章节的定价"})]}),s.jsx(ze,{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(ne,{className:"text-gray-300",children:"单节价格 (元)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.sectionPrice,onChange:oe=>c(D=>({...D,sectionPrice:Number.parseFloat(oe.target.value)||1}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"整本价格 (元)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.baseBookPrice,onChange:oe=>c(D=>({...D,baseBookPrice:Number.parseFloat(oe.target.value)||9.9}))})]})]})})]})]}),s.jsxs(on,{value:"mp",className:"space-y-6 mt-0",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{children:[s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(Cl,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),s.jsx(nn,{className:"text-gray-400",children:"订阅消息模板、支付商户号等,小程序从 /api/miniprogram/config 读取(API 地址由 app.js baseUrl 控制)"})]}),s.jsxs(ze,{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(ne,{className:"text-gray-300",children:"小程序 AppID"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:f.appId??"",onChange:oe=>m(D=>({...D,appId:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"提现订阅模板 ID"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"用户申请提现时需授权",value:f.withdrawSubscribeTmplId??"",onChange:oe=>m(D=>({...D,withdrawSubscribeTmplId:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"微信支付商户号"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"1318592501",value:f.mchId??"",onChange:oe=>m(D=>({...D,mchId:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"最低提现金额 (元)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:f.minWithdraw??10,onChange:oe=>m(D=>({...D,minWithdraw:Number.parseFloat(oe.target.value)||10}))})]})]}),s.jsxs("div",{className:"space-y-2 pt-2 border-t border-gray-700/50",children:[s.jsx("div",{className:"grid grid-cols-2 gap-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"目录 NEW 角标文案"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如:NEW / 最新 / 刚更新",value:v,maxLength:8,onChange:oe=>w(oe.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"用于小程序目录页章节角标,保存后约 5 分钟内生效(可与下方 mpUi JSON 同步保存)。"})]})}),s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsx(ne,{className:"text-gray-300",children:"小程序界面文案 mpUi(JSON)"}),s.jsx(J,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-200",onClick:()=>b(JSON.stringify(uV,null,2)),children:"填入默认模板"})]}),s.jsx("p",{className:"text-xs text-gray-500",children:"覆盖 Tab 文案、首页/目录标题、我的页名片与阅读记录路径等;仅填需要改的字段也可(与后端默认值深合并)。保存后小程序约 5 分钟内通过 config 缓存刷新。"}),s.jsx(Il,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm min-h-[280px]",spellCheck:!1,value:x,onChange:oe=>b(oe.target.value)})]})]})]}),s.jsxs(_e,{className:`bg-[#0f2137] shadow-xl ${f.auditMode?"border-amber-500/50 border-2":"border-gray-700/50"}`,children:[s.jsxs(ft,{children:[s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(Pc,{className:"w-5 h-5 text-amber-400"}),"小程序审核模式"]}),s.jsx(nn,{className:"text-gray-400",children:"提交微信审核前开启,审核通过后关闭即可恢复支付功能"})]}),s.jsx(ze,{children:s.jsxs("div",{className:`flex items-center justify-between p-4 rounded-lg border ${f.auditMode?"bg-amber-500/10 border-amber-500/30":"bg-[#0a1628] 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(Pc,{className:`w-4 h-4 ${f.auditMode?"text-amber-400":"text-gray-400"}`}),s.jsx(ne,{htmlFor:"audit-mode",className:"text-white font-medium cursor-pointer",children:f.auditMode?"审核模式(已开启)":"审核模式(已关闭)"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:f.auditMode?"当前已隐藏所有支付、VIP、充值、收益等入口,审核员看不到任何付费内容":"关闭状态,小程序正常显示所有功能(含支付、VIP 等)"})]}),s.jsx(Gt,{id:"audit-mode",checked:f.auditMode??!1,disabled:xe,onCheckedChange:F})]})})]})]}),s.jsx(on,{value:"oss",className:"space-y-6 mt-0",children:s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{children:[s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(N1,{className:"w-5 h-5 text-[#38bdac]"}),"OSS 配置(阿里云对象存储)"]}),s.jsx(nn,{className:"text-gray-400",children:"endpoint、bucket、accessKey 等,用于图片/文件上传"})]}),s.jsx(ze,{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(ne,{className:"text-gray-300",children:"Endpoint"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"oss-cn-hangzhou.aliyuncs.com",value:N.endpoint??"",onChange:oe=>k(D=>({...D,endpoint:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"Bucket"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"bucket 名称",value:N.bucket??"",onChange:oe=>k(D=>({...D,bucket:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"Region"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"oss-cn-hangzhou",value:N.region??"",onChange:oe=>k(D=>({...D,region:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"AccessKey ID"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"AccessKey ID",value:N.accessKeyId??"",onChange:oe=>k(D=>({...D,accessKeyId:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"AccessKey Secret"}),s.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"AccessKey Secret",value:N.accessKeySecret??"",onChange:oe=>k(D=>({...D,accessKeySecret:oe.target.value}))})]})]})})]})}),s.jsxs(on,{value:"features",className:"space-y-6 mt-0",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{children:[s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(wo,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),s.jsx(nn,{className:"text-gray-400",children:"控制各个功能模块的显示/隐藏"})]}),s.jsxs(ze,{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(Wn,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(ne,{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(Gt,{id:"match-enabled",checked:u.matchEnabled,disabled:le,onCheckedChange:oe=>$("matchEnabled",oe)})]}),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(Tg,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(ne,{htmlFor:"referral-enabled",className:"text-white font-medium cursor-pointer",children:"推广功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制推广中心的显示(我的页面入口)"}),s.jsxs("p",{className:"text-xs text-amber-400/80 ml-6 mt-1",children:["佣金比例、绑定期、提现规则等与",s.jsx(Fc,{to:"/distribution?tab=settings",className:"underline mx-1 text-[#38bdac]",children:"推广中心 → 推广设置"}),"为同一套接口,在此仅控制是否展示入口。"]})]}),s.jsx(Gt,{id:"referral-enabled",checked:u.referralEnabled,disabled:le,onCheckedChange:oe=>$("referralEnabled",oe)})]}),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(wr,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(ne,{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(Gt,{id:"search-enabled",checked:u.searchEnabled,disabled:le,onCheckedChange:oe=>$("searchEnabled",oe)})]}),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(wo,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(ne,{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(Gt,{id:"about-enabled",checked:u.aboutEnabled,disabled:le,onCheckedChange:oe=>$("aboutEnabled",oe)})]})]}),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.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{children:[s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(gf,{className:"w-5 h-5 text-[#38bdac]"}),"小程序模块显隐说明"]}),s.jsx(nn,{className:"text-gray-400",children:"以下模块受上方开关和审核模式共同控制"})]}),s.jsx(ze,{children:s.jsx("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[{mod:"找伙伴",ctrl:"找伙伴功能开关",icon:s.jsx(Wn,{className:"w-3 h-3"})},{mod:"推广中心 / 推荐好友",ctrl:"推广功能开关",icon:s.jsx(Tg,{className:"w-3 h-3"})},{mod:"搜索",ctrl:"搜索功能开关",icon:s.jsx(wr,{className:"w-3 h-3"})},{mod:"关于页面",ctrl:"关于页面开关",icon:s.jsx(Ih,{className:"w-3 h-3"})},{mod:"支付 / VIP / 充值 / 收益",ctrl:"审核模式",icon:s.jsx(Pc,{className:"w-3 h-3"})},{mod:"超级个体名片",ctrl:"审核模式",icon:s.jsx(iA,{className:"w-3 h-3"})},{mod:"首页获客入口",ctrl:"已移除",icon:s.jsx(L5,{className:"w-3 h-3"})}].map(oe=>s.jsxs("div",{className:"flex items-center gap-2 p-2 rounded bg-[#0a1628] border border-gray-700/30",children:[oe.icon,s.jsxs("div",{children:[s.jsx("span",{className:"text-white",children:oe.mod}),s.jsxs("span",{className:"text-gray-500 ml-1",children:["← ",oe.ctrl]})]})]},oe.mod))})})]})]})]})]}),s.jsx(on,{value:"author",className:"mt-0",children:s.jsx(rV,{})}),s.jsx(on,{value:"admin",className:"mt-0",children:s.jsx(iV,{})}),s.jsx(on,{value:"api-docs",className:"mt-0",children:s.jsx(R4,{})})]}),s.jsx(Wt,{open:q,onOpenChange:z,children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsxs(Kt,{children:[s.jsx(qt,{className:V?"text-red-400":"text-[#38bdac]",children:H}),s.jsx(jf,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:se})]}),s.jsx(Sn,{className:"mt-4",children:s.jsx(J,{onClick:()=>z(!1),className:V?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const mj={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 pV(){const[t,e]=y.useState(!1),[n,r]=y.useState(mj),[a,i]=y.useState(""),o=async()=>{e(!0);try{const k=await Oe("/api/config");k!=null&&k.paymentMethods&&r({...mj,...k.paymentMethods})}catch(k){console.error(k)}finally{e(!1)}};y.useEffect(()=>{o()},[]);const c=async()=>{e(!0);try{await jt("/api/db/config",{key:"payment_methods",value:n,description:"支付方式配置"}),G.success("配置已保存!")}catch(k){console.error("保存失败:",k),G.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{e(!1)}},u=(k,T)=>{navigator.clipboard.writeText(k),i(T),setTimeout(()=>i(""),2e3)},h=(k,T)=>{r(C=>({...C,wechat:{...C.wechat,[k]:T}}))},f=(k,T)=>{r(C=>({...C,alipay:{...C.alipay,[k]:T}}))},m=(k,T)=>{r(C=>({...C,usdt:{...C.usdt,[k]:T}}))},x=(k,T)=>{r(C=>({...C,paypal:{...C.paypal,[k]:T}}))},b=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(J,{variant:"outline",onClick:o,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ve,{className:`w-4 h-4 mr-2 ${t?"animate-spin":""}`}),"同步配置"]}),s.jsxs(J,{onClick:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(In,{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(Fj,{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(Vc,{defaultValue:"wechat",className:"space-y-6",children:[s.jsxs(Al,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[s.jsxs(an,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[s.jsx(Cl,{className:"w-4 h-4 mr-2"}),"微信"]}),s.jsxs(an,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[s.jsx(w1,{className:"w-4 h-4 mr-2"}),"支付宝"]}),s.jsxs(an,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[s.jsx(v1,{className:"w-4 h-4 mr-2"}),"USDT"]}),s.jsxs(an,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[s.jsx(Mg,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),s.jsx(on,{value:"wechat",className:"space-y-4",children:s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(pt,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(Cl,{className:"w-5 h-5"}),"微信支付配置"]}),s.jsx(nn,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),s.jsx(Gt,{checked:!!b.enabled,onCheckedChange:k=>h("enabled",k)})]}),s.jsxs(ze,{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(ne,{className:"text-gray-300",children:"网站AppID"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(b.websiteAppId??""),onChange:k=>h("websiteAppId",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"商户号"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(b.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(Pi,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置(核心功能)"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"微信收款码/支付链接"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://收款码图片URL 或 weixin://支付链接",value:String(b.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(ne,{className:"text-[#07C160] font-medium",children:"微信群跳转链接(支付成功后跳转)"}),s.jsx(ce,{className:"bg-[#0a1628] border-[#07C160]/30 text-white placeholder:text-gray-500",placeholder:"https://weixin.qq.com/g/... 或微信群二维码图片URL",value:String(b.groupQrCode??""),onChange:k=>h("groupQrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-[#07C160]/70",children:"用户支付成功后将自动跳转到此链接,进入指定微信群"})]})]})]})]})}),s.jsx(on,{value:"alipay",className:"space-y-4",children:s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(pt,{className:"text-[#1677FF] flex items-center gap-2",children:[s.jsx(w1,{className:"w-5 h-5"}),"支付宝配置"]}),s.jsx(nn,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),s.jsx(Gt,{checked:!!v.enabled,onCheckedChange:k=>f("enabled",k)})]}),s.jsxs(ze,{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(ne,{className:"text-gray-300",children:"合作者身份 (PID)"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(v.partnerId??""),onChange:k=>f("partnerId",k.target.value)}),s.jsx(J,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>u(String(v.partnerId??""),"pid"),children:a==="pid"?s.jsx(Np,{className:"w-4 h-4 text-green-500"}):s.jsx(Vj,{className:"w-4 h-4 text-gray-400"})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"安全校验码 (Key)"}),s.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(v.securityKey??""),onChange:k=>f("securityKey",k.target.value)})]})]}),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(Pi,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"支付宝收款码/跳转链接"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://qr.alipay.com/... 或收款码图片URL",value:String(v.qrCode??""),onChange:k=>f("qrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户点击支付宝支付后显示的二维码"})]})]})]})]})}),s.jsx(on,{value:"usdt",className:"space-y-4",children:s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(pt,{className:"text-[#26A17B] flex items-center gap-2",children:[s.jsx(v1,{className:"w-5 h-5"}),"USDT配置"]}),s.jsx(nn,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),s.jsx(Gt,{checked:!!w.enabled,onCheckedChange:k=>m("enabled",k)})]}),s.jsxs(ze,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{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(ne,{className:"text-gray-300",children:"收款地址"}),s.jsx(ce,{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(ne,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(ce,{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(on,{value:"paypal",className:"space-y-4",children:s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(pt,{className:"text-[#169BD7] flex items-center gap-2",children:[s.jsx(Mg,{className:"w-5 h-5"}),"PayPal配置"]}),s.jsx(nn,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),s.jsx(Gt,{checked:!!N.enabled,onCheckedChange:k=>x("enabled",k)})]}),s.jsxs(ze,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"PayPal邮箱"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"your@email.com",value:String(N.email??""),onChange:k=>x("email",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(N.exchangeRate)??7.2,onChange:k=>x("exchangeRate",Number(k.target.value)||7.2)})]})]})]})})]})]})}const mV={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},xV={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},gV={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function yV(){const[t,e]=y.useState({siteConfig:{...mV},menuConfig:{...xV},pageConfig:{...gV}}),[n,r]=y.useState(!1),[a,i]=y.useState(!1);y.useEffect(()=>{Oe("/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 jt("/api/db/config",{key:"site_config",value:t.siteConfig,description:"网站基础配置"}),await jt("/api/db/config",{key:"menu_config",value:t.menuConfig,description:"底部菜单配置"}),await jt("/api/db/config",{key:"page_config",value:t.pageConfig,description:"页面标题配置"}),r(!0),setTimeout(()=>r(!1),2e3),G.success("配置已保存")}catch(f){console.error(f),G.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(J,{onClick:o,disabled:a,className:`${n?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[s.jsx(In,{className:"w-4 h-4 mr-2"}),a?"保存中...":n?"已保存":"保存设置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{children:[s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(Mg,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),s.jsx(nn,{className:"text-gray-400",children:"配置网站名称、标题和描述"})]}),s.jsxs(ze,{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(ne,{htmlFor:"site-name",className:"text-gray-300",children:"网站名称"}),s.jsx(ce,{id:"site-name",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteName??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteName:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{htmlFor:"site-title",className:"text-gray-300",children:"网站标题"}),s.jsx(ce,{id:"site-title",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteTitle??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteTitle:f.target.value}}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{htmlFor:"site-desc",className:"text-gray-300",children:"网站描述"}),s.jsx(ce,{id:"site-desc",className:"bg-[#0a1628] border-gray-700 text-white",value:c.siteDescription??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,siteDescription:f.target.value}}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{htmlFor:"logo",className:"text-gray-300",children:"Logo地址"}),s.jsx(ce,{id:"logo",className:"bg-[#0a1628] border-gray-700 text-white",value:c.logo??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,logo:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{htmlFor:"favicon",className:"text-gray-300",children:"Favicon地址"}),s.jsx(ce,{id:"favicon",className:"bg-[#0a1628] border-gray-700 text-white",value:c.favicon??"",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,favicon:f.target.value}}))})]})]})]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{children:[s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(AM,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),s.jsx(nn,{className:"text-gray-400",children:"配置网站主题色"})]}),s.jsx(ze,{children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("div",{className:"space-y-2 flex-1",children:[s.jsx(ne,{htmlFor:"primary-color",className:"text-gray-300",children:"主色调"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(ce,{id:"primary-color",type:"color",className:"w-16 h-10 bg-[#0a1628] border-gray-700 cursor-pointer p-1",value:c.primaryColor??"#00CED1",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,primaryColor:f.target.value}}))}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white flex-1",value:c.primaryColor??"#00CED1",onChange:f=>e(m=>({...m,siteConfig:{...m.siteConfig,primaryColor:f.target.value}}))})]})]}),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(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{children:[s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(jM,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),s.jsx(nn,{className:"text-gray-400",children:"控制底部导航栏菜单的显示和名称"})]}),s.jsx(ze,{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(Gt,{checked:(m==null?void 0:m.enabled)??!0,onCheckedChange:x=>e(b=>({...b,menuConfig:{...b.menuConfig,[f]:{...m,enabled:x}}}))}),s.jsx("span",{className:"text-gray-300 w-16 capitalize",children:f}),s.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white max-w-[200px]",value:(m==null?void 0:m.label)??"",onChange:x=>e(b=>({...b,menuConfig:{...b.menuConfig,[f]:{...m,label:x.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(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ft,{children:[s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(Hj,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),s.jsx(nn,{className:"text-gray-400",children:"配置各个页面的标题和副标题"})]}),s.jsxs(ze,{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(ne,{className:"text-gray-300",children:"首页标题"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.homeTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,homeTitle:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"首页副标题"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.homeSubtitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,homeSubtitle:f.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"目录页标题"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.chaptersTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,chaptersTitle:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"匹配页标题"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.matchTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,matchTitle:f.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"我的页标题"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.myTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,myTitle:f.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"关于作者标题"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.aboutTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,aboutTitle:f.target.value}}))})]})]})]})]})]})]})}function bV(){const[t,e]=y.useState(""),[n,r]=y.useState(""),[a,i]=y.useState(""),[o,c]=y.useState({}),u=async()=>{var b,v,w,N;try{const k=await Oe("/api/config"),T=(v=(b=k==null?void 0:k.liveQRCodes)==null?void 0:b[0])==null?void 0:v.urls;Array.isArray(T)&&e(T.join(` -`));const C=(N=(w=k==null?void 0:k.paymentMethods)==null?void 0:w.wechat)==null?void 0:N.groupQrCode;C&&r(C),c({paymentMethods:k==null?void 0:k.paymentMethods,liveQRCodes:k==null?void 0:k.liveQRCodes})}catch(k){console.error(k)}};y.useEffect(()=>{u()},[]);const h=(b,v)=>{navigator.clipboard.writeText(b),i(v),setTimeout(()=>i(""),2e3)},f=async()=>{try{const b=t.split(` -`).map(w=>w.trim()).filter(Boolean),v=[...o.liveQRCodes||[]];v[0]?v[0].urls=b:v.push({id:"live-1",name:"微信群活码",urls:b,clickCount:0}),await jt("/api/db/config",{key:"live_qr_codes",value:v,description:"群活码配置"}),G.success("群活码配置已保存!"),await u()}catch(b){console.error(b),G.error("保存失败: "+(b instanceof Error?b.message:String(b)))}},m=async()=>{var b;try{await jt("/api/db/config",{key:"payment_methods",value:{...o.paymentMethods||{},wechat:{...((b=o.paymentMethods)==null?void 0:b.wechat)||{},groupQrCode:n}},description:"支付方式配置"}),G.success("微信群链接已保存!用户支付成功后将自动跳转"),await u()}catch(v){console.error(v),G.error("保存失败: "+(v instanceof Error?v.message:String(v)))}},x=()=>{n?window.open(n,"_blank"):G.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(Fj,{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(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(ft,{children:[s.jsxs(pt,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(E1,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),s.jsx(nn,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),s.jsxs(ze,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Ig,{className:"w-4 h-4"}),"微信群链接 / 活码链接"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ce,{placeholder:"https://cli.im/xxxxx 或 https://weixin.qq.com/g/...",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",value:n,onChange:b=>r(b.target.value)}),s.jsx(J,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>h(n,"group"),children:a==="group"?s.jsx(Np,{className:"w-4 h-4 text-green-500"}):s.jsx(Vj,{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(Pi,{className:"w-3 h-3"}),"支持格式:草料短链、微信群链接(https://weixin.qq.com/g/...)、企业微信链接等"]})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(J,{onClick:m,className:"flex-1 bg-[#07C160] hover:bg-[#06AD51] text-white",children:[s.jsx(bf,{className:"w-4 h-4 mr-2"}),"保存配置"]}),s.jsxs(J,{onClick:x,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[s.jsx(Pi,{className:"w-4 h-4 mr-2"}),"测试跳转"]})]})]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(ft,{children:[s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(E1,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),s.jsx(nn,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),s.jsxs(ze,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Ig,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),s.jsx(Il,{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:b=>e(b.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(J,{onClick:f,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(bf,{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 xj={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}},vV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function NV(){const[t,e]=y.useState(xj),[n,r]=y.useState(!0),[a,i]=y.useState(!1),[o,c]=y.useState(!1),[u,h]=y.useState(null),[f,m]=y.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),x=async()=>{r(!0);try{const C=await Oe("/api/db/config/full?key=match_config"),P=(C==null?void 0:C.data)??(C==null?void 0:C.config);P&&e({...xj,...P})}catch(C){console.error("加载匹配配置失败:",C)}finally{r(!1)}};y.useEffect(()=>{x()},[]);const b=async()=>{i(!0);try{const C=await jt("/api/db/config",{key:"match_config",value:t,description:"匹配功能配置"});C&&C.success!==!1?G.success("配置保存成功!"):G.error("保存失败: "+(C&&typeof C=="object"&&"error"in C?C.error:"未知错误"))}catch(C){console.error("保存配置失败:",C),G.error("保存失败")}finally{i(!1)}},v=C=>{h(C),m({id:C.id,label:C.label,matchLabel:C.matchLabel,icon:C.icon,matchFromDB:C.matchFromDB,showJoinAfterMatch:C.showJoinAfterMatch,price:C.price,enabled:C.enabled}),c(!0)},w=()=>{h(null),m({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),c(!0)},N=()=>{if(!f.id||!f.label){G.error("请填写类型ID和名称");return}const C=[...t.matchTypes];if(u){const P=C.findIndex(L=>L.id===u.id);P!==-1&&(C[P]={...f})}else{if(C.some(P=>P.id===f.id)){G.error("类型ID已存在");return}C.push({...f})}e({...t,matchTypes:C}),c(!1)},k=C=>{confirm("确定要删除这个匹配类型吗?")&&e({...t,matchTypes:t.matchTypes.filter(P=>P.id!==C)})},T=C=>{e({...t,matchTypes:t.matchTypes.map(P=>P.id===C?{...P,enabled:!P.enabled}:P)})};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(wo,{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(J,{variant:"outline",onClick:x,disabled:n,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ve,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]}),s.jsxs(J,{onClick:b,disabled:a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(In,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存配置"]})]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(ft,{children:[s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(Ri,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),s.jsx(nn,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),s.jsxs(ze,{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(ne,{className:"text-gray-300",children:"每日免费匹配次数"}),s.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.freeMatchLimit,onChange:C=>e({...t,freeMatchLimit:parseInt(C.target.value,10)||0})}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户每天可免费匹配的次数"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"付费匹配价格(元)"}),s.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:t.matchPrice,onChange:C=>e({...t,matchPrice:parseFloat(C.target.value)||1})}),s.jsx("p",{className:"text-xs text-gray-500",children:"免费次数用完后的单次匹配价格"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"每日最大匹配次数"}),s.jsx(ce,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.settings.maxMatchesPerDay,onChange:C=>e({...t,settings:{...t.settings,maxMatchesPerDay:parseInt(C.target.value,10)||10}})}),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(Gt,{checked:t.settings.enableFreeMatches,onCheckedChange:C=>e({...t,settings:{...t.settings,enableFreeMatches:C}})}),s.jsx(ne,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Gt,{checked:t.settings.enablePaidMatches,onCheckedChange:C=>e({...t,settings:{...t.settings,enablePaidMatches:C}})}),s.jsx(ne,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(ft,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(Wn,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),s.jsx(nn,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(J,{onClick:w,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Un,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),s.jsx(ze,{children:s.jsxs(Ls,{children:[s.jsx(Os,{children:s.jsxs(Nt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400",children:"图标"}),s.jsx(Ce,{className:"text-gray-400",children:"类型ID"}),s.jsx(Ce,{className:"text-gray-400",children:"显示名称"}),s.jsx(Ce,{className:"text-gray-400",children:"匹配标签"}),s.jsx(Ce,{className:"text-gray-400",children:"价格"}),s.jsx(Ce,{className:"text-gray-400",children:"数据库匹配"}),s.jsx(Ce,{className:"text-gray-400",children:"状态"}),s.jsx(Ce,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsx(Ds,{children:t.matchTypes.map(C=>s.jsxs(Nt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ke,{children:s.jsx("span",{className:"text-2xl",children:C.icon})}),s.jsx(ke,{className:"font-mono text-gray-300",children:C.id}),s.jsx(ke,{className:"text-white font-medium",children:C.label}),s.jsx(ke,{className:"text-gray-300",children:C.matchLabel}),s.jsx(ke,{children:s.jsxs(He,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",C.price]})}),s.jsx(ke,{children:C.matchFromDB?s.jsx(He,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):s.jsx(He,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),s.jsx(ke,{children:s.jsx(Gt,{checked:C.enabled,onCheckedChange:()=>T(C.id)})}),s.jsx(ke,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>v(C),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(rn,{className:"w-4 h-4"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>k(C.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(Yn,{className:"w-4 h-4"})})]})})]},C.id))})]})})]}),s.jsx(Wt,{open:o,onOpenChange:c,children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(Kt,{children:s.jsxs(qt,{className:"text-white flex items-center gap-2",children:[u?s.jsx(rn,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(Un,{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(ne,{className:"text-gray-300",children:"类型ID(英文)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:f.id,onChange:C=>m({...f,id:C.target.value}),disabled:!!u})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:vV.map(C=>s.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${f.icon===C?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>m({...f,icon:C}),children:C},C))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"显示名称"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业合伙",value:f.label,onChange:C=>m({...f,label:C.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"匹配标签"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业伙伴",value:f.matchLabel,onChange:C=>m({...f,matchLabel:C.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"单次匹配价格(元)"}),s.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:f.price,onChange:C=>m({...f,price:parseFloat(C.target.value)||1})})]}),s.jsxs("div",{className:"flex gap-6 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Gt,{checked:f.matchFromDB,onCheckedChange:C=>m({...f,matchFromDB:C})}),s.jsx(ne,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Gt,{checked:f.showJoinAfterMatch,onCheckedChange:C=>m({...f,showJoinAfterMatch:C})}),s.jsx(ne,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Gt,{checked:f.enabled,onCheckedChange:C=>m({...f,enabled:C})}),s.jsx(ne,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(Sn,{children:[s.jsx(J,{variant:"outline",onClick:()=>c(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsxs(J,{onClick:N,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(In,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const gj={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function wV(){const[t,e]=y.useState([]),[n,r]=y.useState(0),[a,i]=y.useState(1),[o,c]=y.useState(10),[u,h]=y.useState(""),[f,m]=y.useState(!0),[x,b]=y.useState(null);async function v(){m(!0),b(null);try{const N=new URLSearchParams({page:String(a),pageSize:String(o)});u&&N.set("matchType",u);const k=await Oe(`/api/db/match-records?${N}`);k!=null&&k.success?(e(k.records||[]),r(k.total??0)):b("加载匹配记录失败")}catch(N){console.error("加载匹配记录失败",N),b("加载失败,请检查网络后重试")}finally{m(!1)}}y.useEffect(()=>{v()},[a,u]);const w=Math.ceil(n/o)||1;return s.jsxs("div",{className:"p-8 w-full",children:[x&&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:x}),s.jsx("button",{type:"button",onClick:()=>b(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(gj).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(Ve,{className:`w-4 h-4 ${f?"animate-spin":""}`}),"刷新"]})]})]}),s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(ze,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Ve,{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(Ls,{children:[s.jsx(Os,{children:s.jsxs(Nt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400",children:"发起人"}),s.jsx(Ce,{className:"text-gray-400",children:"匹配到"}),s.jsx(Ce,{className:"text-gray-400",children:"类型"}),s.jsx(Ce,{className:"text-gray-400",children:"联系方式"}),s.jsx(Ce,{className:"text-gray-400",children:"匹配时间"})]})}),s.jsxs(Ds,{children:[t.map(N=>s.jsxs(Nt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ke,{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:Ua(N.userAvatar),alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const T=k.currentTarget.nextElementSibling;T&&T.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(ke,{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:Ua(N.matchedUserAvatar),alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const T=k.currentTarget.nextElementSibling;T&&T.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(ke,{children:s.jsx(He,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:gj[N.matchType]||N.matchType})}),s.jsxs(ke,{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(ke,{className:"text-gray-400",children:N.createdAt?new Date(N.createdAt).toLocaleString():"-"})]},N.id)),t.length===0&&s.jsx(Nt,{children:s.jsx(ke,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(rr,{page:a,totalPages:w,total:n,pageSize:o,onPageChange:i,onPageSizeChange:N=>{c(N),i(1)}})]})})})]})}function jV(){const[t,e]=y.useState([]),[n,r]=y.useState(!0);async function a(){r(!0);try{const i=await Oe("/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),G.error("加载 VIP 成员失败")}finally{r(!1)}}return y.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(Oc,{className:"w-5 h-5 text-amber-400"}),"用户管理 / 超级个体列表"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"这里展示所有有效超级个体用户,仅用于查看其基本信息与排序值。"})]})}),s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(ze,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(Ls,{children:[s.jsx(Os,{children:s.jsxs(Nt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400 w-20",children:"序号"}),s.jsx(Ce,{className:"text-gray-400",children:"成员"}),s.jsx(Ce,{className:"text-gray-400 w-40",children:"超级个体"}),s.jsx(Ce,{className:"text-gray-400 w-28",children:"排序值"})]})}),s.jsxs(Ds,{children:[t.map((i,o)=>{var c;return s.jsxs(Nt,{className:"border-gray-700/50",children:[s.jsx(ke,{className:"text-gray-300",children:o+1}),s.jsx(ke,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[i.avatar?s.jsx("img",{src:Ua(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(ke,{className:"text-gray-300",children:i.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置超级个体)"})}),s.jsx(ke,{className:"text-gray-300",children:i.vipSort??o+1})]},i.id)}),t.length===0&&s.jsx(Nt,{children:s.jsx(ke,{colSpan:5,className:"text-center py-12 text-gray-500",children:"当前没有有效的超级个体用户。"})})]})]})})})]})}function L4(t){const e=Ga(),[n,r]=y.useState([]),[a,i]=y.useState(!0),[o,c]=y.useState(!1),[u,h]=y.useState(null),[f,m]=y.useState({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:0,enabled:!0}),[x,b]=y.useState(!1),[v,w]=y.useState(!1),N=y.useRef(null),k=async R=>{var X;const se=(X=R.target.files)==null?void 0:X[0];if(se){w(!0);try{const V=new FormData;V.append("file",se),V.append("folder","mentors");const ie=ku(),le={};ie&&(le.Authorization=`Bearer ${ie}`);const I=await(await fetch(El("/api/upload"),{method:"POST",body:V,credentials:"include",headers:le})).json();I!=null&&I.success&&(I!=null&&I.url)?m(Q=>({...Q,avatar:I.url})):G.error("上传失败: "+((I==null?void 0:I.error)||"未知错误"))}catch(V){console.error(V),G.error("上传失败")}finally{w(!1),N.current&&(N.current.value="")}}};async function T(){i(!0);try{const R=await Oe("/api/db/mentors");R!=null&&R.success&&R.data&&r(R.data)}catch(R){console.error("Load mentors error:",R)}finally{i(!1)}}y.useEffect(()=>{T()},[]);const C=()=>{m({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:n.length>0?Math.max(...n.map(R=>R.sort))+1:0,enabled:!0})},P=()=>{h(null),C(),c(!0)},L=R=>{h(R),m({name:R.name,avatar:R.avatar||"",intro:R.intro||"",tags:R.tags||"",priceSingle:R.priceSingle!=null?String(R.priceSingle):"",priceHalfYear:R.priceHalfYear!=null?String(R.priceHalfYear):"",priceYear:R.priceYear!=null?String(R.priceYear):"",quote:R.quote||"",whyFind:R.whyFind||"",offering:R.offering||"",judgmentStyle:R.judgmentStyle||"",sort:R.sort,enabled:R.enabled??!0}),c(!0)},q=async()=>{if(!f.name.trim()){G.error("导师姓名不能为空");return}b(!0);try{const R=X=>X===""?void 0:parseFloat(X),se={name:f.name.trim(),avatar:f.avatar.trim()||void 0,intro:f.intro.trim()||void 0,tags:f.tags.trim()||void 0,priceSingle:R(f.priceSingle),priceHalfYear:R(f.priceHalfYear),priceYear:R(f.priceYear),quote:f.quote.trim()||void 0,whyFind:f.whyFind.trim()||void 0,offering:f.offering.trim()||void 0,judgmentStyle:f.judgmentStyle.trim()||void 0,sort:f.sort,enabled:f.enabled};if(u){const X=await tn("/api/db/mentors",{id:u.id,...se});X!=null&&X.success?(c(!1),T()):G.error("更新失败: "+(X==null?void 0:X.error))}else{const X=await jt("/api/db/mentors",se);X!=null&&X.success?(c(!1),T()):G.error("新增失败: "+(X==null?void 0:X.error))}}catch(R){console.error("Save error:",R),G.error("保存失败")}finally{b(!1)}},z=async R=>{if(confirm("确定删除该导师?"))try{const se=await Ei(`/api/db/mentors?id=${R}`);se!=null&&se.success?T():G.error("删除失败: "+(se==null?void 0:se.error))}catch(se){console.error("Delete error:",se),G.error("删除失败")}},H=R=>R!=null?`¥${R}`:"-";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(Wn,{className:"w-5 h-5 text-[#38bdac]"}),"导师管理"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师列表,支持每个导师独立配置单次/半年/年度价格"})]}),s.jsxs(J,{onClick:P,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Un,{className:"w-4 h-4 mr-2"}),"新增导师"]})]}),s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(ze,{className:"p-0",children:a?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(Ls,{children:[s.jsx(Os,{children:s.jsxs(Nt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400",children:"ID"}),s.jsx(Ce,{className:"text-gray-400",children:"姓名"}),s.jsx(Ce,{className:"text-gray-400",children:"简介"}),s.jsx(Ce,{className:"text-gray-400",children:"单次"}),s.jsx(Ce,{className:"text-gray-400",children:"半年"}),s.jsx(Ce,{className:"text-gray-400",children:"年度"}),s.jsx(Ce,{className:"text-gray-400",children:"排序"}),s.jsx(Ce,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(Ds,{children:[n.map(R=>s.jsxs(Nt,{className:"border-gray-700/50",children:[s.jsx(ke,{className:"text-gray-300",children:R.id}),s.jsx(ke,{children:s.jsxs("button",{type:"button",onClick:()=>e(`/users?search=${encodeURIComponent(R.name)}`),className:"text-[#38bdac] hover:text-[#2da396] hover:underline flex items-center gap-1",title:"在用户管理中查看",children:[R.name,s.jsx(Pi,{className:"w-3 h-3"})]})}),s.jsx(ke,{className:"text-gray-400 max-w-[200px] truncate",children:R.intro||"-"}),s.jsx(ke,{className:"text-gray-400",children:H(R.priceSingle)}),s.jsx(ke,{className:"text-gray-400",children:H(R.priceHalfYear)}),s.jsx(ke,{className:"text-gray-400",children:H(R.priceYear)}),s.jsx(ke,{className:"text-gray-400",children:R.sort}),s.jsxs(ke,{className:"text-right",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>L(R),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(rn,{className:"w-4 h-4"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>z(R.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(Yn,{className:"w-4 h-4"})})]})]},R.id)),n.length===0&&s.jsx(Nt,{children:s.jsx(ke,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无导师,点击「新增导师」添加"})})]})]})})}),s.jsx(Wt,{open:o,onOpenChange:c,children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg max-h-[90vh] overflow-y-auto",children:[s.jsx(Kt,{children:s.jsx(qt,{className:"text-white",children: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(ne,{className:"text-gray-300",children:"姓名 *"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:卡若",value:f.name,onChange:R=>m(se=>({...se,name:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"排序"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:f.sort,onChange:R=>m(se=>({...se,sort:parseInt(R.target.value,10)||0}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"头像"}),s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:f.avatar,onChange:R=>m(se=>({...se,avatar:R.target.value})),placeholder:"点击上传或粘贴图片地址"}),s.jsx("input",{ref:N,type:"file",accept:"image/*",className:"hidden",onChange:k}),s.jsxs(J,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:v,onClick:()=>{var R;return(R=N.current)==null?void 0:R.click()},children:[s.jsx(bf,{className:"w-4 h-4 mr-2"}),v?"上传中...":"上传"]})]}),f.avatar&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:Ua(f.avatar.startsWith("http")?f.avatar:El(f.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(ne,{className:"text-gray-300",children:"简介"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:结构判断型咨询 · Decision > Execution",value:f.intro,onChange:R=>m(se=>({...se,intro:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"技能标签(逗号分隔)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:项目结构判断、风险止损、人×项目匹配",value:f.tags,onChange:R=>m(se=>({...se,tags:R.target.value}))})]}),s.jsxs("div",{className:"border-t border-gray-700 pt-4",children:[s.jsx(ne,{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(ne,{className:"text-gray-500 text-xs",children:"单次咨询 ¥"}),s.jsx(ce,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"980",value:f.priceSingle,onChange:R=>m(se=>({...se,priceSingle:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-500 text-xs",children:"半年咨询 ¥"}),s.jsx(ce,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"19800",value:f.priceHalfYear,onChange:R=>m(se=>({...se,priceHalfYear:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-500 text-xs",children:"年度咨询 ¥"}),s.jsx(ce,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"29800",value:f.priceYear,onChange:R=>m(se=>({...se,priceYear:R.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"引言"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:大多数人失败,不是因为不努力...",value:f.quote,onChange:R=>m(se=>({...se,quote:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"为什么找(文本)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:f.whyFind,onChange:R=>m(se=>({...se,whyFind:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"提供什么(文本)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:f.offering,onChange:R=>m(se=>({...se,offering:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"判断风格(逗号分隔)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:冷静、克制、偏风险视角",value:f.judgmentStyle,onChange:R=>m(se=>({...se,judgmentStyle:R.target.value}))})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",id:"enabled",checked:f.enabled,onChange:R=>m(se=>({...se,enabled:R.target.checked})),className:"rounded border-gray-600 bg-[#0a1628]"}),s.jsx(ne,{htmlFor:"enabled",className:"text-gray-300 cursor-pointer",children:"上架(小程序可见)"})]})]}),s.jsxs(Sn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>c(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(rs,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:q,disabled:x,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(In,{className:"w-4 h-4 mr-2"}),x?"保存中...":"保存"]})]})]})})]})}function kV(){const[t,e]=y.useState([]),[n,r]=y.useState(!0),[a,i]=y.useState("");async function o(){r(!0);try{const h=a?`/api/db/mentor-consultations?status=${a}`:"/api/db/mentor-consultations",f=await Oe(h);f!=null&&f.success&&f.data&&e(f.data)}catch(h){console.error("Load consultations error:",h)}finally{r(!1)}}y.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(Sg,{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(J,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300",children:[s.jsx(Ve,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]})]})]}),s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(ze,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(Ls,{children:[s.jsx(Os,{children:s.jsxs(Nt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400",children:"ID"}),s.jsx(Ce,{className:"text-gray-400",children:"用户ID"}),s.jsx(Ce,{className:"text-gray-400",children:"导师ID"}),s.jsx(Ce,{className:"text-gray-400",children:"类型"}),s.jsx(Ce,{className:"text-gray-400",children:"金额"}),s.jsx(Ce,{className:"text-gray-400",children:"状态"}),s.jsx(Ce,{className:"text-gray-400",children:"创建时间"})]})}),s.jsxs(Ds,{children:[t.map(h=>s.jsxs(Nt,{className:"border-gray-700/50",children:[s.jsx(ke,{className:"text-gray-300",children:h.id}),s.jsx(ke,{className:"text-gray-400",children:h.userId}),s.jsx(ke,{className:"text-gray-400",children:h.mentorId}),s.jsx(ke,{className:"text-gray-400",children:u[h.consultationType]||h.consultationType}),s.jsxs(ke,{className:"text-white",children:["¥",h.amount]}),s.jsx(ke,{className:"text-gray-400",children:c[h.status]||h.status}),s.jsx(ke,{className:"text-gray-500 text-sm",children:h.createdAt})]},h.id)),t.length===0&&s.jsx(Nt,{children:s.jsx(ke,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}const qd={poolSource:["vip"],requirePhone:!0,requireNickname:!0,requireAvatar:!1,requireBusiness:!1},yj={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:qd},SV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function CV(){const t=Ga(),[e,n]=y.useState(yj),[r,a]=y.useState(!0),[i,o]=y.useState(!1),[c,u]=y.useState(!1),[h,f]=y.useState(null),[m,x]=y.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),[b,v]=y.useState(null),[w,N]=y.useState(!1),k=async()=>{N(!0);try{const R=await Oe("/api/db/match-pool-counts");R!=null&&R.success&&R.data&&v(R.data)}catch(R){console.error("加载池子人数失败:",R)}finally{N(!1)}},T=async()=>{a(!0);try{const R=await Oe("/api/db/config/full?key=match_config"),se=(R==null?void 0:R.data)??(R==null?void 0:R.config);if(se){let X=se.poolSettings??qd;X.poolSource&&!Array.isArray(X.poolSource)&&(X={...X,poolSource:[X.poolSource]}),n({...yj,...se,poolSettings:X})}}catch(R){console.error("加载匹配配置失败:",R)}finally{a(!1)}};y.useEffect(()=>{T(),k()},[]);const C=async()=>{o(!0);try{const R=await jt("/api/db/config",{key:"match_config",value:e,description:"匹配功能配置"});G.error((R==null?void 0:R.success)!==!1?"配置保存成功!":"保存失败: "+((R==null?void 0:R.error)||"未知错误"))}catch(R){console.error(R),G.error("保存失败")}finally{o(!1)}},P=R=>{f(R),x({...R}),u(!0)},L=()=>{f(null),x({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),u(!0)},q=()=>{if(!m.id||!m.label){G.error("请填写类型ID和名称");return}const R=[...e.matchTypes];if(h){const se=R.findIndex(X=>X.id===h.id);se!==-1&&(R[se]={...m})}else{if(R.some(se=>se.id===m.id)){G.error("类型ID已存在");return}R.push({...m})}n({...e,matchTypes:R}),u(!1)},z=R=>{confirm("确定要删除这个匹配类型吗?")&&n({...e,matchTypes:e.matchTypes.filter(se=>se.id!==R)})},H=R=>{n({...e,matchTypes:e.matchTypes.map(se=>se.id===R?{...se,enabled:!se.enabled}:se)})};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsxs(J,{variant:"outline",onClick:T,disabled:r,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ve,{className:`w-4 h-4 mr-2 ${r?"animate-spin":""}`})," 刷新"]}),s.jsxs(J,{onClick:C,disabled:i,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(In,{className:"w-4 h-4 mr-2"})," ",i?"保存中...":"保存配置"]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(ft,{children:[s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(Uj,{className:"w-5 h-5 text-blue-400"})," 匹配池选择"]}),s.jsx(nn,{className:"text-gray-400",children:"选择匹配的用户池和完善程度要求,只有满足条件的用户才可被匹配到"})]}),s.jsxs(ze,{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx(ne,{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(R=>{const se=e.poolSettings??qd,V=(Array.isArray(se.poolSource)?se.poolSource:[se.poolSource]).includes(R.value),ie=b==null?void 0:b[R.countKey],le=()=>{const he=Array.isArray(se.poolSource)?[...se.poolSource]:[se.poolSource],I=V?he.filter(Q=>Q!==R.value):[...he,R.value];I.length===0&&I.push(R.value),n({...e,poolSettings:{...se,poolSource:I}})};return s.jsxs("button",{type:"button",onClick:le,className:`p-4 rounded-lg border text-left transition-all ${V?"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 ${V?"border-[#38bdac] bg-[#38bdac] text-white":"border-gray-600"}`,children:V&&"✓"}),s.jsx("span",{className:"text-xl",children:R.icon}),s.jsx("span",{className:`text-sm font-medium ${V?"text-[#38bdac]":"text-gray-300"}`,children:R.label})]}),s.jsxs("span",{className:"text-lg font-bold text-white",children:[w?"...":ie??"-",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:R.desc}),s.jsx("span",{role:"link",tabIndex:0,onClick:he=>{he.stopPropagation(),t(`/users?pool=${R.value}`)},onKeyDown:he=>{he.key==="Enter"&&(he.stopPropagation(),t(`/users?pool=${R.value}`))},className:"text-[#38bdac] text-xs mt-2 inline-block hover:underline cursor-pointer",children:"查看用户列表 →"})]},R.value)})})]}),s.jsxs("div",{className:"space-y-3 pt-4 border-t border-gray-700/50",children:[s.jsx(ne,{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(R=>{const X=(e.poolSettings??qd)[R.key];return s.jsxs("div",{className:"flex items-center gap-3 bg-[#0a1628] rounded-lg p-3",children:[s.jsx(Gt,{checked:X,onCheckedChange:V=>n({...e,poolSettings:{...e.poolSettings??qd,[R.key]:V}})}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{children:R.icon}),s.jsx(ne,{className:"text-gray-300 text-sm",children:R.label})]})]},R.key)})})]})]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(ft,{children:[s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(Ri,{className:"w-5 h-5 text-yellow-400"})," 基础设置"]}),s.jsx(nn,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),s.jsxs(ze,{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(ne,{className:"text-gray-300",children:"每日免费匹配次数"}),s.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.freeMatchLimit,onChange:R=>n({...e,freeMatchLimit:parseInt(R.target.value,10)||0})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"付费匹配价格(元)"}),s.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:e.matchPrice,onChange:R=>n({...e,matchPrice:parseFloat(R.target.value)||1})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"每日最大匹配次数"}),s.jsx(ce,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.settings.maxMatchesPerDay,onChange:R=>n({...e,settings:{...e.settings,maxMatchesPerDay:parseInt(R.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(Gt,{checked:e.settings.enableFreeMatches,onCheckedChange:R=>n({...e,settings:{...e.settings,enableFreeMatches:R}})}),s.jsx(ne,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Gt,{checked:e.settings.enablePaidMatches,onCheckedChange:R=>n({...e,settings:{...e.settings,enablePaidMatches:R}})}),s.jsx(ne,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(ft,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(pt,{className:"text-white flex items-center gap-2",children:[s.jsx(Wn,{className:"w-5 h-5 text-[#38bdac]"})," 匹配类型管理"]}),s.jsx(nn,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(J,{onClick:L,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Un,{className:"w-4 h-4 mr-1"})," 添加类型"]})]}),s.jsx(ze,{children:s.jsxs(Ls,{children:[s.jsx(Os,{children:s.jsxs(Nt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400",children:"图标"}),s.jsx(Ce,{className:"text-gray-400",children:"类型ID"}),s.jsx(Ce,{className:"text-gray-400",children:"显示名称"}),s.jsx(Ce,{className:"text-gray-400",children:"匹配标签"}),s.jsx(Ce,{className:"text-gray-400",children:"价格"}),s.jsx(Ce,{className:"text-gray-400",children:"数据库匹配"}),s.jsx(Ce,{className:"text-gray-400",children:"状态"}),s.jsx(Ce,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsx(Ds,{children:e.matchTypes.map(R=>s.jsxs(Nt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ke,{children:s.jsx("span",{className:"text-2xl",children:R.icon})}),s.jsx(ke,{className:"font-mono text-gray-300",children:R.id}),s.jsx(ke,{className:"text-white font-medium",children:R.label}),s.jsx(ke,{className:"text-gray-300",children:R.matchLabel}),s.jsx(ke,{children:s.jsxs(He,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",R.price]})}),s.jsx(ke,{children:R.matchFromDB?s.jsx(He,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):s.jsx(He,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),s.jsx(ke,{children:s.jsx(Gt,{checked:R.enabled,onCheckedChange:()=>H(R.id)})}),s.jsx(ke,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>P(R),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(rn,{className:"w-4 h-4"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>z(R.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(Yn,{className:"w-4 h-4"})})]})})]},R.id))})]})})]}),s.jsx(Wt,{open:c,onOpenChange:u,children:s.jsxs(Ut,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(Kt,{children:s.jsxs(qt,{className:"text-white flex items-center gap-2",children:[h?s.jsx(rn,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(Un,{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(ne,{className:"text-gray-300",children:"类型ID(英文)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:m.id,onChange:R=>x({...m,id:R.target.value}),disabled:!!h})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:SV.map(R=>s.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${m.icon===R?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>x({...m,icon:R}),children:R},R))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"显示名称"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.label,onChange:R=>x({...m,label:R.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"匹配标签"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.matchLabel,onChange:R=>x({...m,matchLabel:R.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"单次匹配价格(元)"}),s.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:m.price,onChange:R=>x({...m,price:parseFloat(R.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(Gt,{checked:m.matchFromDB,onCheckedChange:R=>x({...m,matchFromDB:R})}),s.jsx(ne,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Gt,{checked:m.showJoinAfterMatch,onCheckedChange:R=>x({...m,showJoinAfterMatch:R})}),s.jsx(ne,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Gt,{checked:m.enabled,onCheckedChange:R=>x({...m,enabled:R})}),s.jsx(ne,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(Sn,{children:[s.jsx(J,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsxs(J,{onClick:q,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(In,{className:"w-4 h-4 mr-2"})," 保存"]})]})]})})]})}const bj={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function EV(){const[t,e]=y.useState([]),[n,r]=y.useState(0),[a,i]=y.useState(1),[o,c]=y.useState(10),[u,h]=y.useState(""),[f,m]=y.useState(!0),[x,b]=y.useState(null),[v,w]=y.useState(null);async function N(){m(!0),b(null);try{const C=new URLSearchParams({page:String(a),pageSize:String(o)});u&&C.set("matchType",u);const P=await Oe(`/api/db/match-records?${C}`);P!=null&&P.success?(e(P.records||[]),r(P.total??0)):b("加载匹配记录失败")}catch{b("加载失败,请检查网络后重试")}finally{m(!1)}}y.useEffect(()=>{N()},[a,u]);const k=Math.ceil(n/o)||1,T=({userId:C,nickname:P,avatar:L})=>s.jsxs("div",{className:"flex items-center gap-3 cursor-pointer group",onClick:()=>w(C),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:[L?s.jsx("img",{src:Ua(L),alt:"",className:"w-full h-full object-cover",onError:q=>{q.currentTarget.style.display="none"}}):null,s.jsx("span",{className:L?"hidden":"",children:(P||C||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white group-hover:text-[#38bdac] transition-colors",children:P||C}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[C==null?void 0:C.slice(0,16),(C==null?void 0:C.length)>16?"...":""]})]})]});return s.jsxs("div",{children:[x&&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:x}),s.jsx("button",{type:"button",onClick:()=>b(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:C=>{h(C.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(bj).map(([C,P])=>s.jsx("option",{value:C,children:P},C))]}),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(Ve,{className:`w-4 h-4 ${f?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(ze,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Ve,{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(Ls,{children:[s.jsx(Os,{children:s.jsxs(Nt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400",children:"发起人"}),s.jsx(Ce,{className:"text-gray-400",children:"匹配到"}),s.jsx(Ce,{className:"text-gray-400",children:"类型"}),s.jsx(Ce,{className:"text-gray-400",children:"联系方式"}),s.jsx(Ce,{className:"text-gray-400",children:"匹配时间"})]})}),s.jsxs(Ds,{children:[t.map(C=>s.jsxs(Nt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ke,{children:s.jsx(T,{userId:C.userId,nickname:C.userNickname,avatar:C.userAvatar})}),s.jsx(ke,{children:C.matchedUserId?s.jsx(T,{userId:C.matchedUserId,nickname:C.matchedNickname,avatar:C.matchedUserAvatar}):s.jsx("span",{className:"text-gray-500",children:"—"})}),s.jsx(ke,{children:s.jsx(He,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:bj[C.matchType]||C.matchType})}),s.jsxs(ke,{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(ke,{className:"text-gray-400",children:C.createdAt?new Date(C.createdAt).toLocaleString():"-"})]},C.id)),t.length===0&&s.jsx(Nt,{children:s.jsx(ke,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(rr,{page:a,totalPages:k,total:n,pageSize:o,onPageChange:i,onPageSizeChange:C=>{c(C),i(1)}})]})})}),s.jsx(X0,{open:!!v,onClose:()=>w(null),userId:v,onUserUpdated:N})]})}function TV(){const[t,e]=y.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(EV,{}),t==="pool"&&s.jsx(CV,{})]})}const vj={investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function MV(){const[t,e]=y.useState([]),[n,r]=y.useState(0),[a,i]=y.useState(1),[o,c]=y.useState(10),[u,h]=y.useState(!0),[f,m]=y.useState("investor"),[x,b]=y.useState(null);async function v(){h(!0);try{const T=new URLSearchParams({page:String(a),pageSize:String(o),matchType:f}),C=await Oe(`/api/db/match-records?${T}`);C!=null&&C.success&&(e(C.records||[]),r(C.total??0))}catch(T){console.error(T)}finally{h(!1)}}y.useEffect(()=>{v()},[a,f]);const w=async T=>{if(!T.phone&&!T.wechatId){G.info("该记录无联系方式,无法推送到存客宝");return}b(T.id);try{const C=await jt("/api/ckb/join",{type:T.matchType||"investor",phone:T.phone||"",wechat:T.wechatId||"",userId:T.userId,name:T.userNickname||""});G.error((C==null?void 0:C.message)||(C!=null&&C.success?"推送成功":"推送失败"))}catch(C){G.error("推送失败: "+(C instanceof Error?C.message:"网络错误"))}finally{b(null)}},N=Math.ceil(n/o)||1,k=T=>!!(T.phone||T.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:T=>{m(T.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:Object.entries(vj).map(([T,C])=>s.jsx("option",{value:T,children:C},T))}),s.jsxs(J,{onClick:v,disabled:u,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ve,{className:`w-4 h-4 mr-2 ${u?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(ze,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Ve,{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(Ls,{children:[s.jsx(Os,{children:s.jsxs(Nt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400",children:"发起人"}),s.jsx(Ce,{className:"text-gray-400",children:"匹配到"}),s.jsx(Ce,{className:"text-gray-400",children:"类型"}),s.jsx(Ce,{className:"text-gray-400",children:"联系方式"}),s.jsx(Ce,{className:"text-gray-400",children:"时间"}),s.jsx(Ce,{className:"text-gray-400 text-right",children:"操作"})]})}),s.jsxs(Ds,{children:[t.map(T=>{var C,P;return s.jsxs(Nt,{className:`border-gray-700/50 ${k(T)?"hover:bg-[#0a1628]":"opacity-60"}`,children:[s.jsx(ke,{className:"text-white",children:T.userNickname||((C=T.userId)==null?void 0:C.slice(0,12))}),s.jsx(ke,{className:"text-white",children:T.matchedNickname||((P=T.matchedUserId)==null?void 0:P.slice(0,12))}),s.jsx(ke,{children:s.jsx(He,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:vj[T.matchType]||T.matchType})}),s.jsxs(ke,{className:"text-sm",children:[T.phone&&s.jsxs("div",{className:"text-green-400",children:["📱 ",T.phone]}),T.wechatId&&s.jsxs("div",{className:"text-blue-400",children:["💬 ",T.wechatId]}),!T.phone&&!T.wechatId&&s.jsx("span",{className:"text-gray-600",children:"无联系方式"})]}),s.jsx(ke,{className:"text-gray-400 text-sm",children:T.createdAt?new Date(T.createdAt).toLocaleString():"-"}),s.jsx(ke,{className:"text-right",children:k(T)?s.jsxs(J,{size:"sm",onClick:()=>w(T),disabled:x===T.id,className:"bg-[#38bdac] hover:bg-[#2da396] text-white text-xs h-7 px-3",children:[s.jsx(JM,{className:"w-3 h-3 mr-1"}),x===T.id?"推送中...":"推送CKB"]}):s.jsx("span",{className:"text-gray-600 text-xs",children:"—"})})]},T.id)}),t.length===0&&s.jsx(Nt,{children:s.jsx(ke,{colSpan:6,className:"text-center py-12 text-gray-500",children:"暂无记录"})})]})]}),s.jsx(rr,{page:a,totalPages:N,total:n,pageSize:o,onPageChange:i,onPageSizeChange:T=>{c(T),i(1)}})]})})})]})}const Nj={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},AV={single:"单次",half_year:"半年",year:"年度"};function IV(){const[t,e]=y.useState([]),[n,r]=y.useState(!0),[a,i]=y.useState("");async function o(){r(!0);try{const c=a?`/api/db/mentor-consultations?status=${a}`:"/api/db/mentor-consultations",u=await Oe(c);u!=null&&u.success&&u.data&&e(u.data)}catch(c){console.error(c)}finally{r(!1)}}return y.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(Nj).map(([c,u])=>s.jsx("option",{value:c,children:u},c))]}),s.jsxs(J,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ve,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(ze,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(Ls,{children:[s.jsx(Os,{children:s.jsxs(Nt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400",children:"ID"}),s.jsx(Ce,{className:"text-gray-400",children:"用户ID"}),s.jsx(Ce,{className:"text-gray-400",children:"导师ID"}),s.jsx(Ce,{className:"text-gray-400",children:"类型"}),s.jsx(Ce,{className:"text-gray-400",children:"金额"}),s.jsx(Ce,{className:"text-gray-400",children:"状态"}),s.jsx(Ce,{className:"text-gray-400",children:"创建时间"})]})}),s.jsxs(Ds,{children:[t.map(c=>s.jsxs(Nt,{className:"border-gray-700/50",children:[s.jsx(ke,{className:"text-gray-300",children:c.id}),s.jsx(ke,{className:"text-gray-400",children:c.userId}),s.jsx(ke,{className:"text-gray-400",children:c.mentorId}),s.jsx(ke,{className:"text-gray-400",children:AV[c.consultationType]||c.consultationType}),s.jsxs(ke,{className:"text-white",children:["¥",c.amount]}),s.jsx(ke,{className:"text-gray-400",children:Nj[c.status]||c.status}),s.jsx(ke,{className:"text-gray-500 text-sm",children:c.createdAt?new Date(c.createdAt).toLocaleString():"-"})]},c.id)),t.length===0&&s.jsx(Nt,{children:s.jsx(ke,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}function PV(){const[t,e]=y.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(IV,{}),t==="manage"&&s.jsx("div",{className:"-mx-8",children:s.jsx(L4,{embedded:!0})})]})}function RV(){const[t,e]=y.useState([]),[n,r]=y.useState(0),[a,i]=y.useState(1),[o,c]=y.useState(10),[u,h]=y.useState(!0);async function f(){h(!0);try{const x=new URLSearchParams({page:String(a),pageSize:String(o),matchType:"team"}),b=await Oe(`/api/db/match-records?${x}`);b!=null&&b.success&&(e(b.records||[]),r(b.total??0))}catch(x){console.error(x)}finally{h(!1)}}y.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(Ve,{className:`w-4 h-4 ${u?"animate-spin":""}`})," 刷新"]})]}),s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(ze,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(Ve,{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(Ls,{children:[s.jsx(Os,{children:s.jsxs(Nt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Ce,{className:"text-gray-400",children:"发起人"}),s.jsx(Ce,{className:"text-gray-400",children:"匹配到"}),s.jsx(Ce,{className:"text-gray-400",children:"联系方式"}),s.jsx(Ce,{className:"text-gray-400",children:"时间"})]})}),s.jsxs(Ds,{children:[t.map(x=>s.jsxs(Nt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ke,{className:"text-white",children:x.userNickname||x.userId}),s.jsx(ke,{className:"text-white",children:x.matchedNickname||x.matchedUserId}),s.jsxs(ke,{className:"text-gray-400 text-sm",children:[x.phone&&s.jsxs("div",{children:["📱 ",x.phone]}),x.wechatId&&s.jsxs("div",{children:["💬 ",x.wechatId]}),!x.phone&&!x.wechatId&&"-"]}),s.jsx(ke,{className:"text-gray-400",children:x.createdAt?new Date(x.createdAt).toLocaleString():"-"})]},x.id)),t.length===0&&s.jsx(Nt,{children:s.jsx(ke,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无团队招募记录"})})]})]}),s.jsx(rr,{page:a,totalPages:m,total:n,pageSize:o,onPageChange:i,onPageSizeChange:x=>{c(x),i(1)}})]})})})]})}const wj={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募",join:"加入",match:"匹配"},jj={partner:"⭐",investor:"👥",mentor:"❤️",team:"🎮",join:"📋",match:"🔗"};function LV({onSwitchTab:t,onOpenCKB:e}={}){const n=Ga(),[r,a]=y.useState(null),[i,o]=y.useState(null),[c,u]=y.useState(!0),h=y.useCallback(async()=>{var x,b;u(!0);try{const[v,w]=await Promise.allSettled([Oe("/api/db/match-records?stats=true"),Oe("/api/db/ckb-plan-stats")]);if(v.status==="fulfilled"&&((x=v.value)!=null&&x.success)&&v.value.data){let N=v.value.data;if(N.totalMatches>0&&(!N.uniqueUsers||N.uniqueUsers===0))try{const k=await Oe("/api/db/match-records?page=1&pageSize=200");if(k!=null&&k.success&&k.records){const T=new Set(k.records.map(C=>C.userId).filter(Boolean));N={...N,uniqueUsers:T.size}}}catch{}a(N)}w.status==="fulfilled"&&((b=w.value)!=null&&b.success)&&w.value.data&&o(w.value.data)}catch(v){console.error("加载统计失败:",v)}finally{u(!1)}},[]);y.useEffect(()=>{h()},[h]);const f=x=>c?"—":String(x??0),m=r!=null&&r.uniqueUsers?(r.totalMatches/r.uniqueUsers).toFixed(1):"0";return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-5 gap-3",children:[s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/40 cursor-pointer hover:border-[#38bdac]/60 transition-all",onClick:()=>t==null?void 0:t("partner"),children:s.jsxs(ze,{className:"p-4",children:[s.jsx("p",{className:"text-gray-400 text-xs",children:"总匹配"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:f(r==null?void 0:r.totalMatches)}),s.jsxs("p",{className:"text-[#38bdac] text-[10px] mt-1 flex items-center gap-0.5",children:[s.jsx(Pi,{className:"w-2.5 h-2.5"})," 查看记录"]})]})}),s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/40",children:s.jsxs(ze,{className:"p-4",children:[s.jsx("p",{className:"text-gray-400 text-xs",children:"今日"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:f(r==null?void 0:r.todayMatches)}),s.jsxs("p",{className:"text-yellow-400/60 text-[10px] mt-1 flex items-center gap-0.5",children:[s.jsx(Ri,{className:"w-2.5 h-2.5"})," 实时"]})]})}),s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/40 cursor-pointer hover:border-blue-500/60 transition-all",onClick:()=>n("/users"),children:s.jsxs(ze,{className:"p-4",children:[s.jsx("p",{className:"text-gray-400 text-xs",children:"用户数"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:f(r==null?void 0:r.uniqueUsers)}),s.jsxs("p",{className:"text-blue-400/60 text-[10px] mt-1 flex items-center gap-0.5",children:[s.jsx(Wn,{className:"w-2.5 h-2.5"})," 查看用户"]})]})}),s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/40",children:s.jsxs(ze,{className:"p-4",children:[s.jsx("p",{className:"text-gray-400 text-xs",children:"人均匹配"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:c?"—":m})]})}),s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/40",children:s.jsxs(ze,{className:"p-4",children:[s.jsx("p",{className:"text-gray-400 text-xs",children:"付费匹配"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:f(r==null?void 0:r.paidMatchCount)})]})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/40",children:s.jsxs(ze,{className:"p-4",children:[s.jsx("h4",{className:"text-sm font-medium text-white mb-3",children:"匹配类型分布"}),r!=null&&r.byType&&r.byType.length>0?s.jsx("div",{className:"space-y-2",children:r.byType.map(x=>{const b=r.totalMatches>0?x.count/r.totalMatches*100:0;return s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-lg shrink-0",children:jj[x.matchType]||"📊"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex justify-between text-xs mb-0.5",children:[s.jsx("span",{className:"text-gray-300",children:wj[x.matchType]||x.matchType}),s.jsxs("span",{className:"text-gray-500",children:[x.count," (",b.toFixed(0),"%)"]})]}),s.jsx("div",{className:"w-full h-1.5 bg-gray-700/50 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-[#38bdac] rounded-full",style:{width:`${Math.min(b,100)}%`}})})]})]},x.matchType)})}):s.jsx("p",{className:"text-gray-500 text-xs",children:"暂无数据"})]})}),s.jsx(_e,{className:"bg-[#0f2137] border-orange-500/20",children:s.jsxs(ze,{className:"p-4",children:[s.jsxs("h4",{className:"text-sm font-medium text-white mb-3 flex items-center gap-1.5",children:[s.jsx(Ba,{className:"w-4 h-4 text-orange-400"})," AI 获客"]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-3",children:[s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 cursor-pointer hover:border-orange-500/50 border border-transparent transition-colors",onClick:()=>e==null?void 0:e("submitted"),children:[s.jsx("p",{className:"text-gray-400 text-xs",children:"已提交线索"}),s.jsx("p",{className:"text-xl font-bold text-white",children:c?"—":(i==null?void 0:i.ckbTotal)??0})]}),s.jsxs("div",{className:"bg-[#0a1628] rounded-lg p-3 cursor-pointer hover:border-orange-500/50 border border-transparent transition-colors",onClick:()=>e==null?void 0:e("contact"),children:[s.jsx("p",{className:"text-gray-400 text-xs",children:"有联系方式"}),s.jsx("p",{className:"text-xl font-bold text-white",children:c?"—":(i==null?void 0:i.withContact)??0})]})]}),(i==null?void 0:i.byType)&&i.byType.length>0&&s.jsx("div",{className:"space-y-1.5",children:i.byType.map(x=>s.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[s.jsx("span",{children:jj[x.matchType]||"📋"}),s.jsx("span",{className:"text-gray-400",children:wj[x.matchType]||x.matchType}),s.jsx("span",{className:"ml-auto text-white font-medium",children:x.total})]},x.matchType))}),s.jsx("button",{type:"button",onClick:()=>e==null?void 0:e("test"),className:"mt-3 w-full text-xs text-orange-400 hover:text-orange-300 text-center py-1.5 bg-orange-500/10 rounded",children:"查看 AI 添加进度 →"})]})})]})]})}const OV=["partner","investor","mentor","team"],vg=[{key:"join_partner",label:"找伙伴场景"},{key:"join_investor",label:"资源对接场景"},{key:"join_mentor",label:"导师顾问场景"},{key:"join_team",label:"团队招募场景"},{key:"match",label:"匹配上报"},{key:"lead",label:"链接卡若"}],kj=`# 场景获客接口摘要 -- 地址:POST /v1/api/scenarios -- 必填:apiKey、sign、timestamp -- 主标识:phone 或 wechatId 至少一项 -- 可选:name、source、remark、tags、siteTags、portrait -- 签名:排除 sign/apiKey/portrait,键名升序拼接值后双重 MD5 -- 成功:code=200,message=新增成功 或 已存在`;function DV({initialTab:t="overview"}){const[e,n]=y.useState(t),[r,a]=y.useState("13800000000"),[i,o]=y.useState(""),[c,u]=y.useState(""),[h,f]=y.useState(kj),[m,x]=y.useState(!1),[b,v]=y.useState(!1),[w,N]=y.useState([]),[k,T]=y.useState([]),[C,P]=y.useState({}),[L,q]=y.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"}]),z=y.useMemo(()=>{const I={};return vg.forEach(Q=>{I[Q.key]=C[Q.key]||{apiUrl:"https://ckbapi.quwanzhi.com/v1/api/scenarios",apiKey:"fyngh-ecy9h-qkdae-epwd5-rz6kd",source:"",tags:"",siteTags:"创业实验APP",notes:""}}),I},[C]),H=I=>{const Q=r.trim(),$=i.trim();return I<=3?{type:OV[I],phone:Q||void 0,wechat:$||void 0,userId:"admin_test",name:"后台测试"}:I===4?{matchType:"partner",phone:Q||void 0,wechat:$||void 0,userId:"admin_test",nickname:"后台测试",matchedUser:{id:"test",nickname:"测试",matchScore:88}}:I===5?{phone:Q||void 0,wechatId:$||void 0,userId:"admin_test",name:"后台测试"}:{}};async function R(){v(!0);try{const[I,Q,$]=await Promise.all([Oe("/api/db/config/full?key=ckb_config"),Oe("/api/db/ckb-leads?mode=submitted&page=1&pageSize=50"),Oe("/api/db/ckb-leads?mode=contact&page=1&pageSize=50")]),xe=I==null?void 0:I.data;xe!=null&&xe.routes&&P(xe.routes),xe!=null&&xe.docNotes&&u(xe.docNotes),xe!=null&&xe.docContent&&f(xe.docContent),Q!=null&&Q.success&&N(Q.records||[]),$!=null&&$.success&&T($.records||[])}finally{v(!1)}}y.useEffect(()=>{n(t)},[t]),y.useEffect(()=>{R()},[]);const se=y.useMemo(()=>{const I=F=>(F||"").replace(/\D/g,"")||"",Q=F=>{const U=I(F.phone);if(U)return`phone:${U}`;const pe=(F.userId||"").trim();if(pe)return`user:${pe}`;const fe=(F.wechatId||"").trim();return fe?`wechat:${fe}`:`row:${F.id}`},$=[...k].sort((F,U)=>{const pe=F.createdAt?new Date(F.createdAt).getTime():0;return(U.createdAt?new Date(U.createdAt).getTime():0)-pe}),xe=new Set,Z=[];for(const F of $){const U=Q(F);xe.has(U)||(xe.add(U),Z.push(F))}return Z},[k]);async function X(){x(!0);try{const I=await jt("/api/db/config",{key:"ckb_config",value:{routes:z,docNotes:c,docContent:h},description:"存客宝接口配置"});G.error((I==null?void 0:I.success)!==!1?"存客宝配置已保存":`保存失败: ${(I==null?void 0:I.error)||"未知错误"}`)}catch(I){G.error(`保存失败: ${I instanceof Error?I.message:"网络错误"}`)}finally{x(!1)}}const V=(I,Q)=>{P($=>({...$,[I]:{...z[I],...Q}}))},ie=async I=>{const Q=L[I];if(Q.method==="POST"&&!r.trim()&&!i.trim()){G.error("请填写测试手机号");return}const $=[...L];$[I]={...Q,status:"testing",message:void 0,responseTime:void 0},q($);const xe=performance.now();try{const Z=Q.method==="GET"?await Oe(Q.endpoint):await jt(Q.endpoint,H(I)),F=Math.round(performance.now()-xe),U=(Z==null?void 0:Z.message)||"",pe=(Z==null?void 0:Z.success)===!0||U.includes("已存在")||U.includes("已加入")||U.includes("已提交"),fe=[...L];fe[I]={...Q,status:pe?"success":"error",message:U||(pe?"正常":"异常"),responseTime:F},q(fe),await R()}catch(Z){const F=Math.round(performance.now()-xe),U=[...L];U[I]={...Q,status:"error",message:Z instanceof Error?Z.message:"失败",responseTime:F},q(U)}},le=async()=>{if(!r.trim()&&!i.trim()){G.error("请填写测试手机号");return}for(let I=0;Is.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:I.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"p-0 align-top",children:s.jsxs("div",{className:"py-14 px-6 text-center bg-[#0a1628]/40 border-t border-gray-700/30",children:[s.jsx(Cl,{className:"w-12 h-12 text-orange-400/25 mx-auto mb-3","aria-hidden":!0}),s.jsx("p",{className:"text-gray-300 font-medium",children:Q}),$?s.jsx("p",{className:"text-gray-500 text-sm mt-2 max-w-md mx-auto leading-relaxed",children:$}):null]})})}):I.map(xe=>s.jsxs("tr",{className:"border-t border-gray-700/30",children:[s.jsx("td",{className:"px-4 py-3 text-white",children:xe.userNickname||xe.userId}),s.jsx("td",{className:"px-4 py-3 text-gray-300",children:xe.matchType}),s.jsx("td",{className:"px-4 py-3 text-green-400",children:xe.phone||"—"}),s.jsx("td",{className:"px-4 py-3 text-blue-400",children:xe.wechatId||"—"}),s.jsx("td",{className:"px-4 py-3 text-gray-400",children:xe.createdAt?new Date(xe.createdAt).toLocaleString():"—"})]},String(xe.id)))})]})});return s.jsx(_e,{className:"bg-[#0f2137] border-orange-500/30 mb-6",children:s.jsxs(ze,{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(He,{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(Pi,{className:"w-3 h-3"})," API 文档"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(J,{onClick:()=>R(),variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Ve,{className:`w-3.5 h-3.5 mr-1 ${b?"animate-spin":""}`})," 刷新"]}),s.jsxs(J,{onClick:X,disabled:m,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(In,{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(([I,Q])=>s.jsx("button",{type:"button",onClick:()=>n(I),className:`px-4 py-2 rounded-lg text-sm transition-colors ${e===I?"bg-orange-500 text-white":"bg-[#0a1628] text-gray-400 hover:text-white"}`,children:Q},I))}),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:se.length}),k.length!==se.length&&s.jsxs("p",{className:"text-[10px] text-gray-500 mt-1",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:vg.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"&&he(w,"暂无已提交线索","用户通过场景提交后会出现于此。"),e==="contact"&&s.jsxs("div",{className:"space-y-2",children:[k.length>se.length&&s.jsxs("p",{className:"text-xs text-gray-500",children:["已合并 ",k.length-se.length," 条重复(同手机号或同用户 ID 仅保留最近一条)"]}),he(se,"暂无有联系方式线索","存客宝留资同步后显示;完整列表与筛选请前往「用户管理 → 获客列表」。")]}),e==="config"&&s.jsx("div",{className:"space-y-4",children:vg.map(I=>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:I.label}),s.jsx(He,{className:"bg-orange-500/20 text-orange-300 border-0 text-xs",children:I.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(ne,{className:"text-gray-500 text-xs",children:"API 地址"}),s.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:z[I.key].apiUrl,onChange:Q=>V(I.key,{apiUrl:Q.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-500 text-xs",children:"API Key"}),s.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:z[I.key].apiKey,onChange:Q=>V(I.key,{apiKey:Q.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-500 text-xs",children:"Source"}),s.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:z[I.key].source,onChange:Q=>V(I.key,{source:Q.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-500 text-xs",children:"Tags"}),s.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:z[I.key].tags,onChange:Q=>V(I.key,{tags:Q.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-500 text-xs",children:"SiteTags"}),s.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:z[I.key].siteTags,onChange:Q=>V(I.key,{siteTags:Q.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-500 text-xs",children:"说明备注"}),s.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:z[I.key].notes,onChange:Q=>V(I.key,{notes:Q.target.value})})]})]})]},I.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(Cl,{className:"w-4 h-4 text-gray-500 shrink-0"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(ne,{className:"text-gray-500 text-xs",children:"测试手机号"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:r,onChange:I=>a(I.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(ne,{className:"text-gray-500 text-xs",children:"微信号(可选)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:i,onChange:I=>o(I.target.value)})]})]}),s.jsx("div",{className:"flex items-end",children:s.jsxs(J,{onClick:le,className:"bg-orange-500 hover:bg-orange-600 text-white",children:[s.jsx(Ri,{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:L.map((I,Q)=>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:[I.status==="idle"&&s.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-600 shrink-0"}),I.status==="testing"&&s.jsx(Ve,{className:"w-3 h-3 text-yellow-400 animate-spin shrink-0"}),I.status==="success"&&s.jsx($j,{className:"w-3 h-3 text-green-400 shrink-0"}),I.status==="error"&&s.jsx(Bj,{className:"w-3 h-3 text-red-400 shrink-0"}),s.jsx("span",{className:"text-white text-xs truncate",children:I.label})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[I.responseTime!==void 0&&s.jsxs("span",{className:"text-gray-600 text-[10px]",children:[I.responseTime,"ms"]}),s.jsx("button",{type:"button",onClick:()=>ie(Q),disabled:I.status==="testing",className:"text-orange-400/60 hover:text-orange-400 text-[10px] disabled:opacity-50",children:"测试"})]})]},`${I.endpoint}-${Q}`))})]}),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(Pi,{className:"w-3 h-3"})," 打开外链"]})]}),s.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-400 leading-6",children:h||kj})]}),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:I=>u(I.target.value),placeholder:"记录 Token、入口差异、回复率统计规则、对接约定等。"})]})]})]})})}const _V=[{id:"stats",label:"数据统计",icon:Sc,desc:"匹配与获客概览"},{id:"partner",label:"找伙伴",icon:Wn,desc:"匹配池与记录"},{id:"resource",label:"资源对接",icon:K5,desc:"人脉资源"},{id:"mentor",label:"导师预约",icon:H5,desc:"预约与管理"},{id:"team",label:"团队招募",icon:jo,desc:"团队协作"}];function zV(){const[t,e]=y.useState("stats"),[n,r]=y.useState(!1),[a,i]=y.useState("overview");return s.jsxs("div",{className:"p-8 w-full max-w-7xl mx-auto",children:[s.jsxs("div",{className:"mb-8 flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-xl font-semibold text-white flex items-center gap-2",children:[s.jsx(Wn,{className:"w-5 h-5 text-[#38bdac]"}),"找伙伴"]}),s.jsx("p",{className:"text-gray-500 text-sm mt-0.5",children:"匹配、获客、导师与团队管理"})]}),s.jsxs(J,{type:"button",variant:"outline",size:"sm",onClick:()=>r(o=>!o),className:`border-orange-500/30 text-orange-300 hover:bg-orange-500/10 bg-transparent text-xs ${n?"bg-orange-500/10":""}`,children:[s.jsx(Ba,{className:"w-3.5 h-3.5 mr-1.5"}),"存客宝",s.jsx(ml,{className:`w-3 h-3 ml-1 transition-transform ${n?"rotate-90":""}`})]})]}),n&&s.jsx(DV,{initialTab:a}),s.jsx("div",{className:"flex gap-1 mb-6 bg-[#0a1628] rounded-lg p-1 border border-gray-700/40",children:_V.map(o=>{const c=t===o.id;return s.jsxs("button",{type:"button",onClick:()=>e(o.id),className:`flex-1 flex items-center justify-center gap-1.5 px-3 py-2 rounded-md text-sm transition-all ${c?"bg-[#38bdac] text-white shadow-md":"text-gray-400 hover:text-white hover:bg-gray-700/40"}`,children:[s.jsx(o.icon,{className:"w-3.5 h-3.5"}),o.label]},o.id)})}),t==="stats"&&s.jsx(LV,{onSwitchTab:o=>e(o),onOpenCKB:o=>{i(o||"overview"),r(!0)}}),t==="partner"&&s.jsx(TV,{}),t==="resource"&&s.jsx(MV,{}),t==="mentor"&&s.jsx(PV,{}),t==="team"&&s.jsx(RV,{})]})}function $V(){const t=Fo();return s.jsx("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-8",children:s.jsxs("div",{className:"text-center max-w-md",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-20 h-20 rounded-full bg-red-500/20 text-red-400 mb-6",children:s.jsx(zj,{className:"w-10 h-10"})}),s.jsx("h1",{className:"text-4xl font-bold text-white mb-2",children:"404"}),s.jsx("p",{className:"text-gray-400 mb-1",children:"页面不存在"}),s.jsx("p",{className:"text-sm text-gray-500 font-mono mb-8 break-all",children:t.pathname}),s.jsx(J,{asChild:!0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:s.jsxs(Fc,{to:"/",children:[s.jsx(tM,{className:"w-4 h-4 mr-2"}),"返回首页"]})})]})})}function FV(){return s.jsxs(zT,{children:[s.jsx(hn,{path:"/login",element:s.jsx(RI,{})}),s.jsxs(hn,{path:"/",element:s.jsx(DA,{}),children:[s.jsx(hn,{index:!0,element:s.jsx(Ah,{to:"/dashboard",replace:!0})}),s.jsx(hn,{path:"dashboard",element:s.jsx(KR,{})}),s.jsx(hn,{path:"orders",element:s.jsx(qR,{})}),s.jsx(hn,{path:"users",element:s.jsx(e8,{})}),s.jsx(hn,{path:"distribution",element:s.jsx(w8,{})}),s.jsx(hn,{path:"withdrawals",element:s.jsx(j8,{})}),s.jsx(hn,{path:"content",element:s.jsx(sV,{})}),s.jsx(hn,{path:"referral-settings",element:s.jsx(A2,{})}),s.jsx(hn,{path:"author-settings",element:s.jsx(Ah,{to:"/settings?tab=author",replace:!0})}),s.jsx(hn,{path:"vip-roles",element:s.jsx(jV,{})}),s.jsx(hn,{path:"mentors",element:s.jsx(L4,{})}),s.jsx(hn,{path:"mentor-consultations",element:s.jsx(kV,{})}),s.jsx(hn,{path:"admin-users",element:s.jsx(Ah,{to:"/settings?tab=admin",replace:!0})}),s.jsx(hn,{path:"settings",element:s.jsx(fV,{})}),s.jsx(hn,{path:"payment",element:s.jsx(pV,{})}),s.jsx(hn,{path:"site",element:s.jsx(yV,{})}),s.jsx(hn,{path:"qrcodes",element:s.jsx(bV,{})}),s.jsx(hn,{path:"find-partner",element:s.jsx(zV,{})}),s.jsx(hn,{path:"match",element:s.jsx(NV,{})}),s.jsx(hn,{path:"match-records",element:s.jsx(wV,{})}),s.jsx(hn,{path:"api-doc",element:s.jsx(Ah,{to:"/api-docs",replace:!0})}),s.jsx(hn,{path:"api-docs",element:s.jsx(R4,{})})]}),s.jsx(hn,{path:"*",element:s.jsx($V,{})})]})}HE.createRoot(document.getElementById("root")).render(s.jsx(y.StrictMode,{children:s.jsx(KT,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:s.jsx(FV,{})})})); diff --git a/soul-admin/dist/assets/index-i0PBc3Gp.js b/soul-admin/dist/assets/index-i0PBc3Gp.js new file mode 100644 index 00000000..7b003540 --- /dev/null +++ b/soul-admin/dist/assets/index-i0PBc3Gp.js @@ -0,0 +1,1010 @@ +function RE(t,e){for(var n=0;nr[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}})();function Sj(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Sg={exports:{}},Vd={},Cg={exports:{}},At={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var s1;function LE(){if(s1)return At;s1=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),o=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),m=Symbol.iterator;function g(F){return F===null||typeof F!="object"?null:(F=m&&F[m]||F["@@iterator"],typeof F=="function"?F:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,j={};function v(F,W,fe){this.props=F,this.context=W,this.refs=j,this.updater=fe||b}v.prototype.isReactComponent={},v.prototype.setState=function(F,W){if(typeof F!="object"&&typeof F!="function"&&F!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,F,W,"setState")},v.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function k(){}k.prototype=v.prototype;function T(F,W,fe){this.props=F,this.context=W,this.refs=j,this.updater=fe||b}var C=T.prototype=new k;C.constructor=T,N(C,v.prototype),C.isPureReactComponent=!0;var P=Array.isArray,L=Object.prototype.hasOwnProperty,U={current:null},_={key:!0,ref:!0,__self:!0,__source:!0};function H(F,W,fe){var he,oe={},D=null,q=null;if(W!=null)for(he in W.ref!==void 0&&(q=W.ref),W.key!==void 0&&(D=""+W.key),W)L.call(W,he)&&!_.hasOwnProperty(he)&&(oe[he]=W[he]);var O=arguments.length-2;if(O===1)oe.children=fe;else if(1>>1,W=z[F];if(0>>1;Fa(oe,X))Da(q,oe)?(z[F]=q,z[D]=X,F=D):(z[F]=oe,z[he]=X,F=he);else if(Da(q,X))z[F]=q,z[D]=X,F=D;else break e}}return ge}function a(z,ge){var X=z.sortIndex-ge.sortIndex;return X!==0?X:z.id-ge.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,c=o.now();t.unstable_now=function(){return o.now()-c}}var u=[],h=[],f=1,m=null,g=3,b=!1,N=!1,j=!1,v=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(z){for(var ge=n(h);ge!==null;){if(ge.callback===null)r(h);else if(ge.startTime<=z)r(h),ge.sortIndex=ge.expirationTime,e(u,ge);else break;ge=n(h)}}function P(z){if(j=!1,C(z),!N)if(n(u)!==null)N=!0,I(L);else{var ge=n(h);ge!==null&&J(P,ge.startTime-z)}}function L(z,ge){N=!1,j&&(j=!1,k(H),H=-1),b=!0;var X=g;try{for(C(ge),m=n(u);m!==null&&(!(m.expirationTime>ge)||z&&!re());){var F=m.callback;if(typeof F=="function"){m.callback=null,g=m.priorityLevel;var W=F(m.expirationTime<=ge);ge=t.unstable_now(),typeof W=="function"?m.callback=W:m===n(u)&&r(u),C(ge)}else r(u);m=n(u)}if(m!==null)var fe=!0;else{var he=n(h);he!==null&&J(P,he.startTime-ge),fe=!1}return fe}finally{m=null,g=X,b=!1}}var U=!1,_=null,H=-1,R=5,Z=-1;function re(){return!(t.unstable_now()-Zz||125F?(z.sortIndex=X,e(h,z),n(u)===null&&z===n(h)&&(j?(k(H),H=-1):j=!0,J(P,X-F))):(z.sortIndex=W,e(u,z),N||b||(N=!0,I(L))),z},t.unstable_shouldYield=re,t.unstable_wrapCallback=function(z){var ge=g;return function(){var X=g;g=ge;try{return z.apply(this,arguments)}finally{g=X}}}})(Mg)),Mg}var l1;function $E(){return l1||(l1=1,Tg.exports=_E()),Tg.exports}/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var c1;function zE(){if(c1)return ir;c1=1;var t=Iu(),e=$E();function n(l){for(var d="https://reactjs.org/docs/error-decoder.html?invariant="+l,p=1;p"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,h=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},m={};function g(l){return u.call(m,l)?!0:u.call(f,l)?!1:h.test(l)?m[l]=!0:(f[l]=!0,!1)}function b(l,d,p,x){if(p!==null&&p.type===0)return!1;switch(typeof d){case"function":case"symbol":return!0;case"boolean":return x?!1:p!==null?!p.acceptsBooleans:(l=l.toLowerCase().slice(0,5),l!=="data-"&&l!=="aria-");default:return!1}}function N(l,d,p,x){if(d===null||typeof d>"u"||b(l,d,p,x))return!0;if(x)return!1;if(p!==null)switch(p.type){case 3:return!d;case 4:return d===!1;case 5:return isNaN(d);case 6:return isNaN(d)||1>d}return!1}function j(l,d,p,x,w,S,A){this.acceptsBooleans=d===2||d===3||d===4,this.attributeName=x,this.attributeNamespace=w,this.mustUseProperty=p,this.propertyName=l,this.type=d,this.sanitizeURL=S,this.removeEmptyString=A}var v={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){v[l]=new j(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var d=l[0];v[d]=new j(d,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){v[l]=new j(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){v[l]=new j(l,2,!1,l,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(l){v[l]=new j(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){v[l]=new j(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){v[l]=new j(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){v[l]=new j(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){v[l]=new j(l,5,!1,l.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function T(l){return l[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(l){var d=l.replace(k,T);v[d]=new j(d,1,!1,l,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(l){var d=l.replace(k,T);v[d]=new j(d,1,!1,l,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(l){var d=l.replace(k,T);v[d]=new j(d,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){v[l]=new j(l,1,!1,l.toLowerCase(),null,!1,!1)}),v.xlinkHref=new j("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){v[l]=new j(l,1,!1,l.toLowerCase(),null,!0,!0)});function C(l,d,p,x){var w=v.hasOwnProperty(d)?v[d]:null;(w!==null?w.type!==0:x||!(2K||w[A]!==S[K]){var te=` +`+w[A].replace(" at new "," at ");return l.displayName&&te.includes("")&&(te=te.replace("",l.displayName)),te}while(1<=A&&0<=K);break}}}finally{fe=!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=he(l.type,!1),l;case 11:return l=he(l.type.render,!1),l;case 1:return l=he(l.type,!0),l;default:return""}}function D(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 U:return"Portal";case R:return"Profiler";case H:return"StrictMode";case ie:return"Suspense";case ce:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case re:return(l.displayName||"Context")+".Consumer";case Z:return(l._context.displayName||"Context")+".Provider";case $:var d=l.render;return l=l.displayName,l||(l=d.displayName||d.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case me:return d=l.displayName||null,d!==null?d:D(l.type)||"Memo";case I:d=l._payload,l=l._init;try{return D(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 D(d);case 8:return d===H?"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 O(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function Q(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function se(l){var d=Q(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 w=p.get,S=p.set;return Object.defineProperty(l,d,{configurable:!0,get:function(){return w.call(this)},set:function(A){x=""+A,S.call(this,A)}}),Object.defineProperty(l,d,{enumerable:p.enumerable}),{getValue:function(){return x},setValue:function(A){x=""+A},stopTracking:function(){l._valueTracker=null,delete l[d]}}}}function ve(l){l._valueTracker||(l._valueTracker=se(l))}function ze(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var p=d.getValue(),x="";return l&&(x=Q(l)?l.checked?"true":"false":l.value),l=x,l!==p?(d.setValue(l),!0):!1}function Ue(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 jt(l,d){var p=d.checked;return X({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??l._wrapperState.initialChecked})}function Nn(l,d){var p=d.defaultValue==null?"":d.defaultValue,x=d.checked!=null?d.checked:d.defaultChecked;p=O(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 pt(l,d){d=d.checked,d!=null&&C(l,"checked",d,!1)}function It(l,d){pt(l,d);var p=O(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")?Bn(l,d.type,p):d.hasOwnProperty("defaultValue")&&Bn(l,d.type,O(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(l.defaultChecked=!!d.defaultChecked)}function un(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 Bn(l,d,p){(d!=="number"||Ue(l.ownerDocument)!==l)&&(p==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+p&&(l.defaultValue=""+p))}var hn=Array.isArray;function Wt(l,d,p,x){if(l=l.options,d){d={};for(var w=0;w"+d.valueOf().toString()+"",d=we.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;d.firstChild;)l.appendChild(d.firstChild)}});function We(l,d){if(d){var p=l.firstChild;if(p&&p===l.lastChild&&p.nodeType===3){p.nodeValue=d;return}}l.textContent=d}var at={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},Lt=["Webkit","ms","Moz","O"];Object.keys(at).forEach(function(l){Lt.forEach(function(d){d=d+l.charAt(0).toUpperCase()+l.substring(1),at[d]=at[l]})});function Ct(l,d,p){return d==null||typeof d=="boolean"||d===""?"":p||typeof d!="number"||d===0||at.hasOwnProperty(l)&&at[l]?(""+d).trim():d+"px"}function $e(l,d){l=l.style;for(var p in d)if(d.hasOwnProperty(p)){var x=p.indexOf("--")===0,w=Ct(p,d[p],x);p==="float"&&(p="cssFloat"),x?l.setProperty(p,w):l[p]=w}}var V=X({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 Qe(l,d){if(d){if(V[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 vt(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 Dt=null;function xt(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var yt=null,Pt=null,Jt=null;function wn(l){if(l=Ed(l)){if(typeof yt!="function")throw Error(n(280));var d=l.stateNode;d&&(d=Gu(d),yt(l.stateNode,l.type,d))}}function Os(l){Pt?Jt?Jt.push(l):Jt=[l]:Pt=l}function hr(){if(Pt){var l=Pt,d=Jt;if(Jt=Pt=null,wn(l),d)for(l=0;l>>=0,l===0?32:31-(Ko(l)/Zr|0)|0}var mr=64,$s=4194304;function ea(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 Na(l,d){var p=l.pendingLanes;if(p===0)return 0;var x=0,w=l.suspendedLanes,S=l.pingedLanes,A=p&268435455;if(A!==0){var K=A&~w;K!==0?x=ea(K):(S&=A,S!==0&&(x=ea(S)))}else A=p&~w,A!==0?x=ea(A):S!==0&&(x=ea(S));if(x===0)return 0;if(d!==0&&d!==x&&(d&w)===0&&(w=x&-x,S=d&-d,w>=S||w===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 ta(l,d,p){l.pendingLanes|=d,d!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,d=31-qn(d),l[d]=p}function wa(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=Hi),md=" ",gd=!1;function xd(l,d){switch(l){case"keyup":return hd.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yd(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var M=!1;function ee(l,d){switch(l){case"compositionend":return yd(d);case"keypress":return d.which!==32?null:(gd=!0,md);case"textInput":return l=d.data,l===md&&gd?null:l;default:return null}}function be(l,d){if(M)return l==="compositionend"||!fd&&xd(l,d)?(l=Ma(),na=ti=er=null,M=!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=ib(p)}}function lb(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?lb(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function cb(){for(var l=window,d=Ue();d instanceof l.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)l=d.contentWindow;else break;d=Ue(l.document)}return d}function lm(l){var d=l&&l.nodeName&&l.nodeName.toLowerCase();return d&&(d==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||d==="textarea"||l.contentEditable==="true")}function F4(l){var d=cb(),p=l.focusedElem,x=l.selectionRange;if(d!==p&&p&&p.ownerDocument&&lb(p.ownerDocument.documentElement,p)){if(x!==null&&lm(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 w=p.textContent.length,S=Math.min(x.start,w);x=x.end===void 0?S:Math.min(x.end,w),!l.extend&&S>x&&(w=x,x=S,S=w),w=ob(p,S);var A=ob(p,x);w&&A&&(l.rangeCount!==1||l.anchorNode!==w.node||l.anchorOffset!==w.offset||l.focusNode!==A.node||l.focusOffset!==A.offset)&&(d=d.createRange(),d.setStart(w.node,w.offset),l.removeAllRanges(),S>x?(l.addRange(d),l.extend(A.node,A.offset)):(d.setEnd(A.node,A.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,sc=null,cm=null,wd=null,dm=!1;function db(l,d,p){var x=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;dm||sc==null||sc!==Ue(x)||(x=sc,"selectionStart"in x&&lm(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}),wd&&Nd(wd,x)||(wd=x,x=Wu(cm,"onSelect"),0lc||(l.current=wm[lc],wm[lc]=null,lc--)}function on(l,d){lc++,wm[lc]=l.current,l.current=d}var Gi={},Cs=qi(Gi),tr=qi(!1),rl=Gi;function cc(l,d){var p=l.type.contextTypes;if(!p)return Gi;var x=l.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===d)return x.__reactInternalMemoizedMaskedChildContext;var w={},S;for(S in p)w[S]=d[S];return x&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=d,l.__reactInternalMemoizedMaskedChildContext=w),w}function nr(l){return l=l.childContextTypes,l!=null}function Ju(){pn(tr),pn(Cs)}function Sb(l,d,p){if(Cs.current!==Gi)throw Error(n(168));on(Cs,d),on(tr,p)}function Cb(l,d,p){var x=l.stateNode;if(d=d.childContextTypes,typeof x.getChildContext!="function")return p;x=x.getChildContext();for(var w in x)if(!(w in d))throw Error(n(108,q(l)||"Unknown",w));return X({},p,x)}function Qu(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||Gi,rl=Cs.current,on(Cs,l),on(tr,tr.current),!0}function Eb(l,d,p){var x=l.stateNode;if(!x)throw Error(n(169));p?(l=Cb(l,d,rl),x.__reactInternalMemoizedMergedChildContext=l,pn(tr),pn(Cs),on(Cs,l)):pn(tr),on(tr,p)}var oi=null,Yu=!1,jm=!1;function Tb(l){oi===null?oi=[l]:oi.push(l)}function X4(l){Yu=!0,Tb(l)}function Ji(){if(!jm&&oi!==null){jm=!0;var l=0,d=lt;try{var p=oi;for(lt=1;l>=A,w-=A,li=1<<32-qn(d)+w|p<gt?(is=dt,dt=null):is=dt.sibling;var Ft=Ee(pe,dt,xe[gt],Le);if(Ft===null){dt===null&&(dt=is);break}l&&dt&&Ft.alternate===null&&d(pe,dt),ae=S(Ft,ae,gt),ct===null?st=Ft:ct.sibling=Ft,ct=Ft,dt=is}if(gt===xe.length)return p(pe,dt),bn&&il(pe,gt),st;if(dt===null){for(;gtgt?(is=dt,dt=null):is=dt.sibling;var ro=Ee(pe,dt,Ft.value,Le);if(ro===null){dt===null&&(dt=is);break}l&&dt&&ro.alternate===null&&d(pe,dt),ae=S(ro,ae,gt),ct===null?st=ro:ct.sibling=ro,ct=ro,dt=is}if(Ft.done)return p(pe,dt),bn&&il(pe,gt),st;if(dt===null){for(;!Ft.done;gt++,Ft=xe.next())Ft=Pe(pe,Ft.value,Le),Ft!==null&&(ae=S(Ft,ae,gt),ct===null?st=Ft:ct.sibling=Ft,ct=Ft);return bn&&il(pe,gt),st}for(dt=x(pe,dt);!Ft.done;gt++,Ft=xe.next())Ft=qe(dt,pe,gt,Ft.value,Le),Ft!==null&&(l&&Ft.alternate!==null&&dt.delete(Ft.key===null?gt:Ft.key),ae=S(Ft,ae,gt),ct===null?st=Ft:ct.sibling=Ft,ct=Ft);return l&&dt.forEach(function(PE){return d(pe,PE)}),bn&&il(pe,gt),st}function _n(pe,ae,xe,Le){if(typeof xe=="object"&&xe!==null&&xe.type===_&&xe.key===null&&(xe=xe.props.children),typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case L:e:{for(var st=xe.key,ct=ae;ct!==null;){if(ct.key===st){if(st=xe.type,st===_){if(ct.tag===7){p(pe,ct.sibling),ae=w(ct,xe.props.children),ae.return=pe,pe=ae;break e}}else if(ct.elementType===st||typeof st=="object"&&st!==null&&st.$$typeof===I&&Lb(st)===ct.type){p(pe,ct.sibling),ae=w(ct,xe.props),ae.ref=Td(pe,ct,xe),ae.return=pe,pe=ae;break e}p(pe,ct);break}else d(pe,ct);ct=ct.sibling}xe.type===_?(ae=pl(xe.props.children,pe.mode,Le,xe.key),ae.return=pe,pe=ae):(Le=Sh(xe.type,xe.key,xe.props,null,pe.mode,Le),Le.ref=Td(pe,ae,xe),Le.return=pe,pe=Le)}return A(pe);case U:e:{for(ct=xe.key;ae!==null;){if(ae.key===ct)if(ae.tag===4&&ae.stateNode.containerInfo===xe.containerInfo&&ae.stateNode.implementation===xe.implementation){p(pe,ae.sibling),ae=w(ae,xe.children||[]),ae.return=pe,pe=ae;break e}else{p(pe,ae);break}else d(pe,ae);ae=ae.sibling}ae=vg(xe,pe.mode,Le),ae.return=pe,pe=ae}return A(pe);case I:return ct=xe._init,_n(pe,ae,ct(xe._payload),Le)}if(hn(xe))return Ze(pe,ae,xe,Le);if(ge(xe))return nt(pe,ae,xe,Le);th(pe,xe)}return typeof xe=="string"&&xe!==""||typeof xe=="number"?(xe=""+xe,ae!==null&&ae.tag===6?(p(pe,ae.sibling),ae=w(ae,xe),ae.return=pe,pe=ae):(p(pe,ae),ae=bg(xe,pe.mode,Le),ae.return=pe,pe=ae),A(pe)):p(pe,ae)}return _n}var fc=Ob(!0),Db=Ob(!1),nh=qi(null),sh=null,pc=null,Mm=null;function Am(){Mm=pc=sh=null}function Im(l){var d=nh.current;pn(nh),l._currentValue=d}function Pm(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 mc(l,d){sh=l,Mm=pc=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(sr=!0),l.firstContext=null)}function $r(l){var d=l._currentValue;if(Mm!==l)if(l={context:l,memoizedValue:d,next:null},pc===null){if(sh===null)throw Error(n(308));pc=l,sh.dependencies={lanes:0,firstContext:l}}else pc=pc.next=l;return d}var ol=null;function Rm(l){ol===null?ol=[l]:ol.push(l)}function _b(l,d,p,x){var w=d.interleaved;return w===null?(p.next=p,Rm(d)):(p.next=w.next,w.next=p),d.interleaved=p,di(l,x)}function di(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 Qi=!1;function Lm(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function $b(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 ui(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function Yi(l,d,p){var x=l.updateQueue;if(x===null)return null;if(x=x.shared,(_t&2)!==0){var w=x.pending;return w===null?d.next=d:(d.next=w.next,w.next=d),x.pending=d,di(l,p)}return w=x.interleaved,w===null?(d.next=d,Rm(x)):(d.next=w.next,w.next=d),x.interleaved=d,di(l,p)}function rh(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,qo(l,p)}}function zb(l,d){var p=l.updateQueue,x=l.alternate;if(x!==null&&(x=x.updateQueue,p===x)){var w=null,S=null;if(p=p.firstBaseUpdate,p!==null){do{var A={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};S===null?w=S=A:S=S.next=A,p=p.next}while(p!==null);S===null?w=S=d:S=S.next=d}else w=S=d;p={baseState:x.baseState,firstBaseUpdate:w,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 ah(l,d,p,x){var w=l.updateQueue;Qi=!1;var S=w.firstBaseUpdate,A=w.lastBaseUpdate,K=w.shared.pending;if(K!==null){w.shared.pending=null;var te=K,ye=te.next;te.next=null,A===null?S=ye:A.next=ye,A=te;var Ae=l.alternate;Ae!==null&&(Ae=Ae.updateQueue,K=Ae.lastBaseUpdate,K!==A&&(K===null?Ae.firstBaseUpdate=ye:K.next=ye,Ae.lastBaseUpdate=te))}if(S!==null){var Pe=w.baseState;A=0,Ae=ye=te=null,K=S;do{var Ee=K.lane,qe=K.eventTime;if((x&Ee)===Ee){Ae!==null&&(Ae=Ae.next={eventTime:qe,lane:0,tag:K.tag,payload:K.payload,callback:K.callback,next:null});e:{var Ze=l,nt=K;switch(Ee=d,qe=p,nt.tag){case 1:if(Ze=nt.payload,typeof Ze=="function"){Pe=Ze.call(qe,Pe,Ee);break e}Pe=Ze;break e;case 3:Ze.flags=Ze.flags&-65537|128;case 0:if(Ze=nt.payload,Ee=typeof Ze=="function"?Ze.call(qe,Pe,Ee):Ze,Ee==null)break e;Pe=X({},Pe,Ee);break e;case 2:Qi=!0}}K.callback!==null&&K.lane!==0&&(l.flags|=64,Ee=w.effects,Ee===null?w.effects=[K]:Ee.push(K))}else qe={eventTime:qe,lane:Ee,tag:K.tag,payload:K.payload,callback:K.callback,next:null},Ae===null?(ye=Ae=qe,te=Pe):Ae=Ae.next=qe,A|=Ee;if(K=K.next,K===null){if(K=w.shared.pending,K===null)break;Ee=K,K=Ee.next,Ee.next=null,w.lastBaseUpdate=Ee,w.shared.pending=null}}while(!0);if(Ae===null&&(te=Pe),w.baseState=te,w.firstBaseUpdate=ye,w.lastBaseUpdate=Ae,d=w.shared.interleaved,d!==null){w=d;do A|=w.lane,w=w.next;while(w!==d)}else S===null&&(w.shared.lanes=0);dl|=A,l.lanes=A,l.memoizedState=Pe}}function Fb(l,d,p){if(l=d.effects,d.effects=null,l!==null)for(d=0;dp?p:4,l(!0);var x=zm.transition;zm.transition={};try{l(!1),d()}finally{lt=p,zm.transition=x}}function av(){return zr().memoizedState}function nE(l,d,p){var x=to(l);if(p={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null},iv(l))ov(d,p);else if(p=_b(l,d,p,x),p!==null){var w=Bs();ca(p,l,x,w),lv(p,d,x)}}function sE(l,d,p){var x=to(l),w={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null};if(iv(l))ov(d,w);else{var S=l.alternate;if(l.lanes===0&&(S===null||S.lanes===0)&&(S=d.lastRenderedReducer,S!==null))try{var A=d.lastRenderedState,K=S(A,p);if(w.hasEagerState=!0,w.eagerState=K,ra(K,A)){var te=d.interleaved;te===null?(w.next=w,Rm(d)):(w.next=te.next,te.next=w),d.interleaved=w;return}}catch{}finally{}p=_b(l,d,w,x),p!==null&&(w=Bs(),ca(p,l,x,w),lv(p,d,x))}}function iv(l){var d=l.alternate;return l===Sn||d!==null&&d===Sn}function ov(l,d){Pd=lh=!0;var p=l.pending;p===null?d.next=d:(d.next=p.next,p.next=d),l.pending=d}function lv(l,d,p){if((p&4194240)!==0){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,qo(l,p)}}var uh={readContext:$r,useCallback:Es,useContext:Es,useEffect:Es,useImperativeHandle:Es,useInsertionEffect:Es,useLayoutEffect:Es,useMemo:Es,useReducer:Es,useRef:Es,useState:Es,useDebugValue:Es,useDeferredValue:Es,useTransition:Es,useMutableSource:Es,useSyncExternalStore:Es,useId:Es,unstable_isNewReconciler:!1},rE={readContext:$r,useCallback:function(l,d){return Ra().memoizedState=[l,d===void 0?null:d],l},useContext:$r,useEffect:Yb,useImperativeHandle:function(l,d,p){return p=p!=null?p.concat([l]):null,ch(4194308,4,ev.bind(null,d,l),p)},useLayoutEffect:function(l,d){return ch(4194308,4,l,d)},useInsertionEffect:function(l,d){return ch(4,2,l,d)},useMemo:function(l,d){var p=Ra();return d=d===void 0?null:d,l=l(),p.memoizedState=[l,d],l},useReducer:function(l,d,p){var x=Ra();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=nE.bind(null,Sn,l),[x.memoizedState,l]},useRef:function(l){var d=Ra();return l={current:l},d.memoizedState=l},useState:Jb,useDebugValue:Km,useDeferredValue:function(l){return Ra().memoizedState=l},useTransition:function(){var l=Jb(!1),d=l[0];return l=tE.bind(null,l[1]),Ra().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,p){var x=Sn,w=Ra();if(bn){if(p===void 0)throw Error(n(407));p=p()}else{if(p=d(),as===null)throw Error(n(349));(cl&30)!==0||Ub(x,d,p)}w.memoizedState=p;var S={value:p,getSnapshot:d};return w.queue=S,Yb(Kb.bind(null,x,S,l),[l]),x.flags|=2048,Od(9,Wb.bind(null,x,S,p,d),void 0,null),p},useId:function(){var l=Ra(),d=as.identifierPrefix;if(bn){var p=ci,x=li;p=(x&~(1<<32-qn(x)-1)).toString(32)+p,d=":"+d+"R"+p,p=Rd++,0<\/script>",l=l.removeChild(l.firstChild)):typeof x.is=="string"?l=A.createElement(p,{is:x.is}):(l=A.createElement(p),p==="select"&&(A=l,x.multiple?A.multiple=!0:x.size&&(A.size=x.size))):l=A.createElementNS(l,p),l[Ia]=d,l[Cd]=x,Tv(l,d,!1,!1),d.stateNode=l;e:{switch(A=vt(p,x),p){case"dialog":fn("cancel",l),fn("close",l),w=x;break;case"iframe":case"object":case"embed":fn("load",l),w=x;break;case"video":case"audio":for(w=0;wvc&&(d.flags|=128,x=!0,Dd(S,!1),d.lanes=4194304)}else{if(!x)if(l=ih(A),l!==null){if(d.flags|=128,x=!0,p=l.updateQueue,p!==null&&(d.updateQueue=p,d.flags|=4),Dd(S,!0),S.tail===null&&S.tailMode==="hidden"&&!A.alternate&&!bn)return Ts(d),null}else 2*en()-S.renderingStartTime>vc&&p!==1073741824&&(d.flags|=128,x=!0,Dd(S,!1),d.lanes=4194304);S.isBackwards?(A.sibling=d.child,d.child=A):(p=S.last,p!==null?p.sibling=A:d.child=A,S.last=A)}return S.tail!==null?(d=S.tail,S.rendering=d,S.tail=d.sibling,S.renderingStartTime=en(),d.sibling=null,p=kn.current,on(kn,x?p&1|2:p&1),d):(Ts(d),null);case 22:case 23:return gg(),x=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==x&&(d.flags|=8192),x&&(d.mode&1)!==0?(wr&1073741824)!==0&&(Ts(d),d.subtreeFlags&6&&(d.flags|=8192)):Ts(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function hE(l,d){switch(Sm(d),d.tag){case 1:return nr(d.type)&&Ju(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return gc(),pn(tr),pn(Cs),$m(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return Dm(d),null;case 13:if(pn(kn),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));hc()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return pn(kn),null;case 4:return gc(),null;case 10:return Im(d.type._context),null;case 22:case 23:return gg(),null;case 24:return null;default:return null}}var mh=!1,Ms=!1,fE=typeof WeakSet=="function"?WeakSet:Set,Ye=null;function yc(l,d){var p=l.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(x){Mn(l,d,x)}else p.current=null}function rg(l,d,p){try{p()}catch(x){Mn(l,d,x)}}var Iv=!1;function pE(l,d){if(gm=Zs,l=cb(),lm(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 w=x.anchorOffset,S=x.focusNode;x=x.focusOffset;try{p.nodeType,S.nodeType}catch{p=null;break e}var A=0,K=-1,te=-1,ye=0,Ae=0,Pe=l,Ee=null;t:for(;;){for(var qe;Pe!==p||w!==0&&Pe.nodeType!==3||(K=A+w),Pe!==S||x!==0&&Pe.nodeType!==3||(te=A+x),Pe.nodeType===3&&(A+=Pe.nodeValue.length),(qe=Pe.firstChild)!==null;)Ee=Pe,Pe=qe;for(;;){if(Pe===l)break t;if(Ee===p&&++ye===w&&(K=A),Ee===S&&++Ae===x&&(te=A),(qe=Pe.nextSibling)!==null)break;Pe=Ee,Ee=Pe.parentNode}Pe=qe}p=K===-1||te===-1?null:{start:K,end:te}}else p=null}p=p||{start:0,end:0}}else p=null;for(xm={focusedElem:l,selectionRange:p},Zs=!1,Ye=d;Ye!==null;)if(d=Ye,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,Ye=l;else for(;Ye!==null;){d=Ye;try{var Ze=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(Ze!==null){var nt=Ze.memoizedProps,_n=Ze.memoizedState,pe=d.stateNode,ae=pe.getSnapshotBeforeUpdate(d.elementType===d.type?nt:ia(d.type,nt),_n);pe.__reactInternalSnapshotBeforeUpdate=ae}break;case 3:var xe=d.stateNode.containerInfo;xe.nodeType===1?xe.textContent="":xe.nodeType===9&&xe.documentElement&&xe.removeChild(xe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Le){Mn(d,d.return,Le)}if(l=d.sibling,l!==null){l.return=d.return,Ye=l;break}Ye=d.return}return Ze=Iv,Iv=!1,Ze}function _d(l,d,p){var x=d.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var w=x=x.next;do{if((w.tag&l)===l){var S=w.destroy;w.destroy=void 0,S!==void 0&&rg(d,p,S)}w=w.next}while(w!==x)}}function gh(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 ag(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 Pv(l){var d=l.alternate;d!==null&&(l.alternate=null,Pv(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[Ia],delete d[Cd],delete d[Nm],delete d[Q4],delete d[Y4])),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 Rv(l){return l.tag===5||l.tag===3||l.tag===4}function Lv(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||Rv(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 ig(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=qu));else if(x!==4&&(l=l.child,l!==null))for(ig(l,d,p),l=l.sibling;l!==null;)ig(l,d,p),l=l.sibling}function og(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(og(l,d,p),l=l.sibling;l!==null;)og(l,d,p),l=l.sibling}var ms=null,oa=!1;function Xi(l,d,p){for(p=p.child;p!==null;)Ov(l,d,p),p=p.sibling}function Ov(l,d,p){if(_s&&typeof _s.onCommitFiberUnmount=="function")try{_s.onCommitFiberUnmount(Gs,p)}catch{}switch(p.tag){case 5:Ms||yc(p,d);case 6:var x=ms,w=oa;ms=null,Xi(l,d,p),ms=x,oa=w,ms!==null&&(oa?(l=ms,p=p.stateNode,l.nodeType===8?l.parentNode.removeChild(p):l.removeChild(p)):ms.removeChild(p.stateNode));break;case 18:ms!==null&&(oa?(l=ms,p=p.stateNode,l.nodeType===8?vm(l.parentNode,p):l.nodeType===1&&vm(l,p),Xs(l)):vm(ms,p.stateNode));break;case 4:x=ms,w=oa,ms=p.stateNode.containerInfo,oa=!0,Xi(l,d,p),ms=x,oa=w;break;case 0:case 11:case 14:case 15:if(!Ms&&(x=p.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){w=x=x.next;do{var S=w,A=S.destroy;S=S.tag,A!==void 0&&((S&2)!==0||(S&4)!==0)&&rg(p,d,A),w=w.next}while(w!==x)}Xi(l,d,p);break;case 1:if(!Ms&&(yc(p,d),x=p.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=p.memoizedProps,x.state=p.memoizedState,x.componentWillUnmount()}catch(K){Mn(p,d,K)}Xi(l,d,p);break;case 21:Xi(l,d,p);break;case 22:p.mode&1?(Ms=(x=Ms)||p.memoizedState!==null,Xi(l,d,p),Ms=x):Xi(l,d,p);break;default:Xi(l,d,p)}}function Dv(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var p=l.stateNode;p===null&&(p=l.stateNode=new fE),d.forEach(function(x){var w=jE.bind(null,l,x);p.has(x)||(p.add(x),x.then(w,w))})}}function la(l,d){var p=d.deletions;if(p!==null)for(var x=0;xw&&(w=A),x&=~S}if(x=w,x=en()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*gE(x/1960))-x,10l?16:l,eo===null)var x=!1;else{if(l=eo,eo=null,Nh=0,(_t&6)!==0)throw Error(n(331));var w=_t;for(_t|=4,Ye=l.current;Ye!==null;){var S=Ye,A=S.child;if((Ye.flags&16)!==0){var K=S.deletions;if(K!==null){for(var te=0;teen()-dg?hl(l,0):cg|=p),ar(l,d)}function Jv(l,d){d===0&&((l.mode&1)===0?d=1:(d=$s,$s<<=1,($s&130023424)===0&&($s=4194304)));var p=Bs();l=di(l,d),l!==null&&(ta(l,d,p),ar(l,p))}function wE(l){var d=l.memoizedState,p=0;d!==null&&(p=d.retryLane),Jv(l,p)}function jE(l,d){var p=0;switch(l.tag){case 13:var x=l.stateNode,w=l.memoizedState;w!==null&&(p=w.retryLane);break;case 19:x=l.stateNode;break;default:throw Error(n(314))}x!==null&&x.delete(d),Jv(l,p)}var Qv;Qv=function(l,d,p){if(l!==null)if(l.memoizedProps!==d.pendingProps||tr.current)sr=!0;else{if((l.lanes&p)===0&&(d.flags&128)===0)return sr=!1,dE(l,d,p);sr=(l.flags&131072)!==0}else sr=!1,bn&&(d.flags&1048576)!==0&&Mb(d,Zu,d.index);switch(d.lanes=0,d.tag){case 2:var x=d.type;ph(l,d),l=d.pendingProps;var w=cc(d,Cs.current);mc(d,p),w=Bm(null,d,x,l,w,p);var S=Vm();return d.flags|=1,typeof w=="object"&&w!==null&&typeof w.render=="function"&&w.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,nr(x)?(S=!0,Qu(d)):S=!1,d.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,Lm(d),w.updater=hh,d.stateNode=w,w._reactInternals=d,Gm(d,x,l,p),d=Xm(null,d,x,!0,S,p)):(d.tag=0,bn&&S&&km(d),Fs(null,d,w,p),d=d.child),d;case 16:x=d.elementType;e:{switch(ph(l,d),l=d.pendingProps,w=x._init,x=w(x._payload),d.type=x,w=d.tag=SE(x),l=ia(x,l),w){case 0:d=Ym(null,d,x,l,p);break e;case 1:d=wv(null,d,x,l,p);break e;case 11:d=xv(null,d,x,l,p);break e;case 14:d=yv(null,d,x,ia(x.type,l),p);break e}throw Error(n(306,x,""))}return d;case 0:return x=d.type,w=d.pendingProps,w=d.elementType===x?w:ia(x,w),Ym(l,d,x,w,p);case 1:return x=d.type,w=d.pendingProps,w=d.elementType===x?w:ia(x,w),wv(l,d,x,w,p);case 3:e:{if(jv(d),l===null)throw Error(n(387));x=d.pendingProps,S=d.memoizedState,w=S.element,$b(l,d),ah(d,x,null,p);var A=d.memoizedState;if(x=A.element,S.isDehydrated)if(S={element:x,isDehydrated:!1,cache:A.cache,pendingSuspenseBoundaries:A.pendingSuspenseBoundaries,transitions:A.transitions},d.updateQueue.baseState=S,d.memoizedState=S,d.flags&256){w=xc(Error(n(423)),d),d=kv(l,d,x,p,w);break e}else if(x!==w){w=xc(Error(n(424)),d),d=kv(l,d,x,p,w);break e}else for(Nr=Ki(d.stateNode.containerInfo.firstChild),vr=d,bn=!0,aa=null,p=Db(d,null,x,p),d.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(hc(),x===w){d=hi(l,d,p);break e}Fs(l,d,x,p)}d=d.child}return d;case 5:return Bb(d),l===null&&Em(d),x=d.type,w=d.pendingProps,S=l!==null?l.memoizedProps:null,A=w.children,ym(x,w)?A=null:S!==null&&ym(x,S)&&(d.flags|=32),Nv(l,d),Fs(l,d,A,p),d.child;case 6:return l===null&&Em(d),null;case 13:return Sv(l,d,p);case 4:return Om(d,d.stateNode.containerInfo),x=d.pendingProps,l===null?d.child=fc(d,null,x,p):Fs(l,d,x,p),d.child;case 11:return x=d.type,w=d.pendingProps,w=d.elementType===x?w:ia(x,w),xv(l,d,x,w,p);case 7:return Fs(l,d,d.pendingProps,p),d.child;case 8:return Fs(l,d,d.pendingProps.children,p),d.child;case 12:return Fs(l,d,d.pendingProps.children,p),d.child;case 10:e:{if(x=d.type._context,w=d.pendingProps,S=d.memoizedProps,A=w.value,on(nh,x._currentValue),x._currentValue=A,S!==null)if(ra(S.value,A)){if(S.children===w.children&&!tr.current){d=hi(l,d,p);break e}}else for(S=d.child,S!==null&&(S.return=d);S!==null;){var K=S.dependencies;if(K!==null){A=S.child;for(var te=K.firstContext;te!==null;){if(te.context===x){if(S.tag===1){te=ui(-1,p&-p),te.tag=2;var ye=S.updateQueue;if(ye!==null){ye=ye.shared;var Ae=ye.pending;Ae===null?te.next=te:(te.next=Ae.next,Ae.next=te),ye.pending=te}}S.lanes|=p,te=S.alternate,te!==null&&(te.lanes|=p),Pm(S.return,p,d),K.lanes|=p;break}te=te.next}}else if(S.tag===10)A=S.type===d.type?null:S.child;else if(S.tag===18){if(A=S.return,A===null)throw Error(n(341));A.lanes|=p,K=A.alternate,K!==null&&(K.lanes|=p),Pm(A,p,d),A=S.sibling}else A=S.child;if(A!==null)A.return=S;else for(A=S;A!==null;){if(A===d){A=null;break}if(S=A.sibling,S!==null){S.return=A.return,A=S;break}A=A.return}S=A}Fs(l,d,w.children,p),d=d.child}return d;case 9:return w=d.type,x=d.pendingProps.children,mc(d,p),w=$r(w),x=x(w),d.flags|=1,Fs(l,d,x,p),d.child;case 14:return x=d.type,w=ia(x,d.pendingProps),w=ia(x.type,w),yv(l,d,x,w,p);case 15:return bv(l,d,d.type,d.pendingProps,p);case 17:return x=d.type,w=d.pendingProps,w=d.elementType===x?w:ia(x,w),ph(l,d),d.tag=1,nr(x)?(l=!0,Qu(d)):l=!1,mc(d,p),dv(d,x,w),Gm(d,x,w,p),Xm(null,d,x,!0,l,p);case 19:return Ev(l,d,p);case 22:return vv(l,d,p)}throw Error(n(156,d.tag))};function Yv(l,d){return Li(l,d)}function kE(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 Br(l,d,p,x){return new kE(l,d,p,x)}function yg(l){return l=l.prototype,!(!l||!l.isReactComponent)}function SE(l){if(typeof l=="function")return yg(l)?1:0;if(l!=null){if(l=l.$$typeof,l===$)return 11;if(l===me)return 14}return 2}function so(l,d){var p=l.alternate;return p===null?(p=Br(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 Sh(l,d,p,x,w,S){var A=2;if(x=l,typeof l=="function")yg(l)&&(A=1);else if(typeof l=="string")A=5;else e:switch(l){case _:return pl(p.children,w,S,d);case H:A=8,w|=8;break;case R:return l=Br(12,p,d,w|2),l.elementType=R,l.lanes=S,l;case ie:return l=Br(13,p,d,w),l.elementType=ie,l.lanes=S,l;case ce:return l=Br(19,p,d,w),l.elementType=ce,l.lanes=S,l;case J:return Ch(p,w,S,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case Z:A=10;break e;case re:A=9;break e;case $:A=11;break e;case me:A=14;break e;case I:A=16,x=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=Br(A,p,d,w),d.elementType=l,d.type=x,d.lanes=S,d}function pl(l,d,p,x){return l=Br(7,l,x,d),l.lanes=p,l}function Ch(l,d,p,x){return l=Br(22,l,x,d),l.elementType=J,l.lanes=p,l.stateNode={isHidden:!1},l}function bg(l,d,p){return l=Br(6,l,null,d),l.lanes=p,l}function vg(l,d,p){return d=Br(4,l.children!==null?l.children:[],l.key,d),d.lanes=p,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function CE(l,d,p,x,w){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=$i(0),this.expirationTimes=$i(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$i(0),this.identifierPrefix=x,this.onRecoverableError=w,this.mutableSourceEagerHydrationData=null}function Ng(l,d,p,x,w,S,A,K,te){return l=new CE(l,d,p,K,te),d===1?(d=1,S===!0&&(d|=8)):d=0,S=Br(3,null,null,d),l.current=S,S.stateNode=l,S.memoizedState={element:x,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},Lm(S),l}function EE(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(),Eg.exports=zE(),Eg.exports}var u1;function FE(){if(u1)return Rh;u1=1;var t=Cj();return Rh.createRoot=t.createRoot,Rh.hydrateRoot=t.hydrateRoot,Rh}var BE=FE(),ed=Cj();const Ej=Sj(ed);/** + * @remix-run/router v1.23.2 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function mu(){return mu=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function $0(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function HE(){return Math.random().toString(36).substr(2,8)}function f1(t,e){return{usr:t.state,key:t.key,idx:e}}function Ex(t,e,n,r){return n===void 0&&(n=null),mu({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?td(e):e,{state:n,key:e&&e.key||r||HE()})}function bf(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function td(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function UE(t,e,n,r){r===void 0&&(r={});let{window:a=document.defaultView,v5Compat:i=!1}=r,o=a.history,c=xo.Pop,u=null,h=f();h==null&&(h=0,o.replaceState(mu({},o.state,{idx:h}),""));function f(){return(o.state||{idx:null}).idx}function m(){c=xo.Pop;let v=f(),k=v==null?null:v-h;h=v,u&&u({action:c,location:j.location,delta:k})}function g(v,k){c=xo.Push;let T=Ex(j.location,v,k);h=f()+1;let C=f1(T,h),P=j.createHref(T);try{o.pushState(C,"",P)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;a.location.assign(P)}i&&u&&u({action:c,location:j.location,delta:1})}function b(v,k){c=xo.Replace;let T=Ex(j.location,v,k);h=f();let C=f1(T,h),P=j.createHref(T);o.replaceState(C,"",P),i&&u&&u({action:c,location:j.location,delta:0})}function N(v){let k=a.location.origin!=="null"?a.location.origin:a.location.href,T=typeof v=="string"?v:bf(v);return T=T.replace(/ $/,"%20"),zn(k,"No window.location.(origin|href) available to create URL for href: "+T),new URL(T,k)}let j={get action(){return c},get location(){return t(a,o)},listen(v){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(h1,m),u=v,()=>{a.removeEventListener(h1,m),u=null}},createHref(v){return e(a,v)},createURL:N,encodeLocation(v){let k=N(v);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:g,replace:b,go(v){return o.go(v)}};return j}var p1;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(p1||(p1={}));function WE(t,e,n){return n===void 0&&(n="/"),KE(t,e,n)}function KE(t,e,n,r){let a=typeof e=="string"?td(e):e,i=z0(a.pathname||"/",n);if(i==null)return null;let o=Tj(t);qE(o);let c=null;for(let u=0;c==null&&u{let u={relativePath:c===void 0?i.path||"":c,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};u.relativePath.startsWith("/")&&(zn(u.relativePath.startsWith(r),'Absolute route path "'+u.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),u.relativePath=u.relativePath.slice(r.length));let h=wo([r,u.relativePath]),f=n.concat(u);i.children&&i.children.length>0&&(zn(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+h+'".')),Tj(i.children,e,f,h)),!(i.path==null&&!i.index)&&e.push({path:h,score:eT(h,i.index),routesMeta:f})};return t.forEach((i,o)=>{var c;if(i.path===""||!((c=i.path)!=null&&c.includes("?")))a(i,o);else for(let u of Mj(i.path))a(i,o,u)}),e}function Mj(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,a=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return a?[i,""]:[i];let o=Mj(r.join("/")),c=[];return c.push(...o.map(u=>u===""?i:[i,u].join("/"))),a&&c.push(...o),c.map(u=>t.startsWith("/")&&u===""?"/":u)}function qE(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:tT(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const GE=/^:[\w-]+$/,JE=3,QE=2,YE=1,XE=10,ZE=-2,m1=t=>t==="*";function eT(t,e){let n=t.split("/"),r=n.length;return n.some(m1)&&(r+=ZE),e&&(r+=QE),n.filter(a=>!m1(a)).reduce((a,i)=>a+(GE.test(i)?JE:i===""?YE:XE),r)}function tT(t,e){return t.length===e.length&&t.slice(0,-1).every((r,a)=>r===e[a])?t[t.length-1]-e[e.length-1]:0}function nT(t,e,n){let{routesMeta:r}=t,a={},i="/",o=[];for(let c=0;c{let{paramName:g,isOptional:b}=f;if(g==="*"){let j=c[m]||"";o=i.slice(0,i.length-j.length).replace(/(.)\/+$/,"$1")}const N=c[m];return b&&!N?h[g]=void 0:h[g]=(N||"").replace(/%2F/g,"/"),h},{}),pathname:i,pathnameBase:o,pattern:t}}function rT(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),$0(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],a="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,c,u)=>(r.push({paramName:c,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),a+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":t!==""&&t!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,e?void 0:"i"),r]}function aT(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return $0(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function z0(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}const iT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,oT=t=>iT.test(t);function lT(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:a=""}=typeof t=="string"?td(t):t,i;if(n)if(oT(n))i=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),$0(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=g1(n.substring(1),"/"):i=g1(n,e)}else i=e;return{pathname:i,search:uT(r),hash:hT(a)}}function g1(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function Ag(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function cT(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function F0(t,e){let n=cT(t);return e?n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function B0(t,e,n,r){r===void 0&&(r=!1);let a;typeof t=="string"?a=td(t):(a=mu({},t),zn(!a.pathname||!a.pathname.includes("?"),Ag("?","pathname","search",a)),zn(!a.pathname||!a.pathname.includes("#"),Ag("#","pathname","hash",a)),zn(!a.search||!a.search.includes("#"),Ag("#","search","hash",a)));let i=t===""||a.pathname==="",o=i?"/":a.pathname,c;if(o==null)c=n;else{let m=e.length-1;if(!r&&o.startsWith("..")){let g=o.split("/");for(;g[0]==="..";)g.shift(),m-=1;a.pathname=g.join("/")}c=m>=0?e[m]:"/"}let u=lT(a,c),h=o&&o!=="/"&&o.endsWith("/"),f=(i||o===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(h||f)&&(u.pathname+="/"),u}const wo=t=>t.join("/").replace(/\/\/+/g,"/"),dT=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),uT=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,hT=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function fT(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Aj=["post","put","patch","delete"];new Set(Aj);const pT=["get",...Aj];new Set(pT);/** + * React Router v6.30.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function gu(){return gu=Object.assign?Object.assign.bind():function(t){for(var e=1;e{c.current=!0}),y.useCallback(function(h,f){if(f===void 0&&(f={}),!c.current)return;if(typeof h=="number"){r.go(h);return}let m=B0(h,JSON.parse(o),i,f.relative==="path");t==null&&e!=="/"&&(m.pathname=m.pathname==="/"?e:wo([e,m.pathname])),(f.replace?r.replace:r.push)(m,f.state,f)},[e,r,o,i,t])}const yT=y.createContext(null);function bT(t){let e=y.useContext(Pi).outlet;return e&&y.createElement(yT.Provider,{value:t},e)}function Rj(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=y.useContext(Oo),{matches:a}=y.useContext(Pi),{pathname:i}=Do(),o=JSON.stringify(F0(a,r.v7_relativeSplatPath));return y.useMemo(()=>B0(t,JSON.parse(o),i,n==="path"),[t,o,i,n])}function vT(t,e){return NT(t,e)}function NT(t,e,n,r){nd()||zn(!1);let{navigator:a}=y.useContext(Oo),{matches:i}=y.useContext(Pi),o=i[i.length-1],c=o?o.params:{};o&&o.pathname;let u=o?o.pathnameBase:"/";o&&o.route;let h=Do(),f;if(e){var m;let v=typeof e=="string"?td(e):e;u==="/"||(m=v.pathname)!=null&&m.startsWith(u)||zn(!1),f=v}else f=h;let g=f.pathname||"/",b=g;if(u!=="/"){let v=u.replace(/^\//,"").split("/");b="/"+g.replace(/^\//,"").split("/").slice(v.length).join("/")}let N=WE(t,{pathname:b}),j=CT(N&&N.map(v=>Object.assign({},v,{params:Object.assign({},c,v.params),pathname:wo([u,a.encodeLocation?a.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?u:wo([u,a.encodeLocation?a.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),i,n,r);return e&&j?y.createElement(kp.Provider,{value:{location:gu({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:xo.Pop}},j):j}function wT(){let t=AT(),e=fT(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},e),n?y.createElement("pre",{style:a},n):null,null)}const jT=y.createElement(wT,null);class kT extends y.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?y.createElement(Pi.Provider,{value:this.props.routeContext},y.createElement(Ij.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function ST(t){let{routeContext:e,match:n,children:r}=t,a=y.useContext(V0);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),y.createElement(Pi.Provider,{value:e},r)}function CT(t,e,n,r){var a;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var i;if(!n)return null;if(n.errors)t=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,c=(a=n)==null?void 0:a.errors;if(c!=null){let f=o.findIndex(m=>m.route.id&&(c==null?void 0:c[m.route.id])!==void 0);f>=0||zn(!1),o=o.slice(0,Math.min(o.length,f+1))}let u=!1,h=-1;if(n&&r&&r.v7_partialHydration)for(let f=0;f=0?o=o.slice(0,h+1):o=[o[0]];break}}}return o.reduceRight((f,m,g)=>{let b,N=!1,j=null,v=null;n&&(b=c&&m.route.id?c[m.route.id]:void 0,j=m.route.errorElement||jT,u&&(h<0&&g===0?(PT("route-fallback"),N=!0,v=null):h===g&&(N=!0,v=m.route.hydrateFallbackElement||null)));let k=e.concat(o.slice(0,g+1)),T=()=>{let C;return b?C=j:N?C=v:m.route.Component?C=y.createElement(m.route.Component,null):m.route.element?C=m.route.element:C=f,y.createElement(ST,{match:m,routeContext:{outlet:f,matches:k,isDataRoute:n!=null},children:C})};return n&&(m.route.ErrorBoundary||m.route.errorElement||g===0)?y.createElement(kT,{location:n.location,revalidation:n.revalidation,component:j,error:b,children:T(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):T()},null)}var Lj=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(Lj||{}),Oj=(function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t})(Oj||{});function ET(t){let e=y.useContext(V0);return e||zn(!1),e}function TT(t){let e=y.useContext(mT);return e||zn(!1),e}function MT(t){let e=y.useContext(Pi);return e||zn(!1),e}function Dj(t){let e=MT(),n=e.matches[e.matches.length-1];return n.route.id||zn(!1),n.route.id}function AT(){var t;let e=y.useContext(Ij),n=TT(),r=Dj();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function IT(){let{router:t}=ET(Lj.UseNavigateStable),e=Dj(Oj.UseNavigateStable),n=y.useRef(!1);return Pj(()=>{n.current=!0}),y.useCallback(function(a,i){i===void 0&&(i={}),n.current&&(typeof a=="number"?t.navigate(a):t.navigate(a,gu({fromRouteId:e},i)))},[t,e])}const x1={};function PT(t,e,n){x1[t]||(x1[t]=!0)}function RT(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Lh(t){let{to:e,replace:n,state:r,relative:a}=t;nd()||zn(!1);let{future:i,static:o}=y.useContext(Oo),{matches:c}=y.useContext(Pi),{pathname:u}=Do(),h=Ua(),f=B0(e,F0(c,i.v7_relativeSplatPath),u,a==="path"),m=JSON.stringify(f);return y.useEffect(()=>h(JSON.parse(m),{replace:n,state:r,relative:a}),[h,m,a,n,r]),null}function LT(t){return bT(t.context)}function ln(t){zn(!1)}function OT(t){let{basename:e="/",children:n=null,location:r,navigationType:a=xo.Pop,navigator:i,static:o=!1,future:c}=t;nd()&&zn(!1);let u=e.replace(/^\/*/,"/"),h=y.useMemo(()=>({basename:u,navigator:i,static:o,future:gu({v7_relativeSplatPath:!1},c)}),[u,c,i,o]);typeof r=="string"&&(r=td(r));let{pathname:f="/",search:m="",hash:g="",state:b=null,key:N="default"}=r,j=y.useMemo(()=>{let v=z0(f,u);return v==null?null:{location:{pathname:v,search:m,hash:g,state:b,key:N},navigationType:a}},[u,f,m,g,b,N,a]);return j==null?null:y.createElement(Oo.Provider,{value:h},y.createElement(kp.Provider,{children:n,value:j}))}function DT(t){let{children:e,location:n}=t;return vT(Tx(e),n)}new Promise(()=>{});function Tx(t,e){e===void 0&&(e=[]);let n=[];return y.Children.forEach(t,(r,a)=>{if(!y.isValidElement(r))return;let i=[...e,a];if(r.type===y.Fragment){n.push.apply(n,Tx(r.props.children,i));return}r.type!==ln&&zn(!1),!r.props.index||!r.props.children||zn(!1);let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=Tx(r.props.children,i)),n.push(o)}),n}/** + * React Router DOM v6.30.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Mx(){return Mx=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[a]=t[a]);return n}function $T(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function zT(t,e){return t.button===0&&(!e||e==="_self")&&!$T(t)}function Ax(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(a=>[n,a]):[[n,r]])},[]))}function FT(t,e){let n=Ax(t);return e&&e.forEach((r,a)=>{n.has(a)||e.getAll(a).forEach(i=>{n.append(a,i)})}),n}const BT=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],VT="6";try{window.__reactRouterVersion=VT}catch{}const HT="startTransition",y1=jp[HT];function UT(t){let{basename:e,children:n,future:r,window:a}=t,i=y.useRef();i.current==null&&(i.current=VE({window:a,v5Compat:!0}));let o=i.current,[c,u]=y.useState({action:o.action,location:o.location}),{v7_startTransition:h}=r||{},f=y.useCallback(m=>{h&&y1?y1(()=>u(m)):u(m)},[u,h]);return y.useLayoutEffect(()=>o.listen(f),[o,f]),y.useEffect(()=>RT(r),[r]),y.createElement(OT,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:o,future:r})}const WT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",KT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Al=y.forwardRef(function(e,n){let{onClick:r,relative:a,reloadDocument:i,replace:o,state:c,target:u,to:h,preventScrollReset:f,viewTransition:m}=e,g=_T(e,BT),{basename:b}=y.useContext(Oo),N,j=!1;if(typeof h=="string"&&KT.test(h)&&(N=h,WT))try{let C=new URL(window.location.href),P=h.startsWith("//")?new URL(C.protocol+h):new URL(h),L=z0(P.pathname,b);P.origin===C.origin&&L!=null?h=L+P.search+P.hash:j=!0}catch{}let v=gT(h,{relative:a}),k=qT(h,{replace:o,state:c,target:u,preventScrollReset:f,relative:a,viewTransition:m});function T(C){r&&r(C),C.defaultPrevented||k(C)}return y.createElement("a",Mx({},g,{href:N||v,onClick:j||i?r:T,ref:n,target:u}))});var b1;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(b1||(b1={}));var v1;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(v1||(v1={}));function qT(t,e){let{target:n,replace:r,state:a,preventScrollReset:i,relative:o,viewTransition:c}=e===void 0?{}:e,u=Ua(),h=Do(),f=Rj(t,{relative:o});return y.useCallback(m=>{if(zT(m,n)){m.preventDefault();let g=r!==void 0?r:bf(h)===bf(f);u(t,{replace:g,state:a,preventScrollReset:i,relative:o,viewTransition:c})}},[h,u,f,r,a,n,t,i,o,c])}function H0(t){let e=y.useRef(Ax(t)),n=y.useRef(!1),r=Do(),a=y.useMemo(()=>FT(r.search,n.current?null:e.current),[r.search]),i=Ua(),o=y.useCallback((c,u)=>{const h=Ax(typeof c=="function"?c(a):c);n.current=!0,i("?"+h,u)},[i,a]);return[a,o]}/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const GT=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),JT=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),N1=t=>{const e=JT(t);return e.charAt(0).toUpperCase()+e.slice(1)},_j=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),QT=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var YT={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const XT=y.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:i,iconNode:o,...c},u)=>y.createElement("svg",{ref:u,...YT,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:_j("lucide",a),...!i&&!QT(c)&&{"aria-hidden":"true"},...c},[...o.map(([h,f])=>y.createElement(h,f)),...Array.isArray(i)?i:[i]]));/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ie=(t,e)=>{const n=y.forwardRef(({className:r,...a},i)=>y.createElement(XT,{ref:i,iconNode:e,className:_j(`lucide-${GT(N1(t))}`,`lucide-${t}`,r),...a}));return n.displayName=N1(t),n};/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ZT=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],Ig=Ie("arrow-up-down",ZT);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const e5=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],t5=Ie("at-sign",e5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const n5=[["path",{d:"M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727",key:"yr8idg"}]],w1=Ie("bitcoin",n5);/** + * @license lucide-react v0.562.0 - ISC + * + * 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:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],r5=Ie("bold",s5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const a5=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],dr=Ie("book-open",a5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const i5=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Ix=Ie("calendar",i5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const o5=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],Hd=Ie("chart-column",o5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const l5=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Sp=Ie("check",l5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const c5=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Il=Ie("chevron-down",c5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const d5=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],u5=Ie("chevron-left",d5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const h5=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],vl=Ie("chevron-right",h5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const f5=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Px=Ie("chevron-up",f5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const p5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],$j=Ie("circle-alert",p5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const m5=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Pg=Ie("circle-check-big",m5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const g5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],zj=Ie("circle-check",g5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const x5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Fj=Ie("circle-question-mark",x5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const y5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],Oh=Ie("circle-user",y5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const b5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Bj=Ie("circle-x",b5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const v5=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Rx=Ie("clock",v5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const N5=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],j1=Ie("cloud",N5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const w5=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],j5=Ie("code",w5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const k5=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Vj=Ie("copy",k5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const S5=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],k1=Ie("credit-card",S5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const C5=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],zc=Ie("crown",C5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const E5=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],vf=Ie("dollar-sign",E5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const T5=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],M5=Ie("download",T5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const A5=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],To=Ie("external-link",A5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const I5=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],P5=Ie("eye-off",I5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const R5=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Nf=Ie("eye",R5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const L5=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Hj=Ie("file-text",L5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const O5=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],Uj=Ie("funnel",O5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const D5=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],Lx=Ie("gift",D5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _5=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],$5=Ie("git-merge",_5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const z5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Ox=Ie("globe",z5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const F5=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],B5=Ie("graduation-cap",F5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const V5=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],pi=Ie("grip-vertical",V5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const H5=[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]],U5=Ie("handshake",H5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const W5=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],S1=Ie("hash",W5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const K5=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],q5=Ie("heading-1",K5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const G5=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],J5=Ie("heading-2",G5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Q5=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],Y5=Ie("heading-3",Q5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const X5=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],Z5=Ie("house",X5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const eM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Wj=Ie("image",eM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const tM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Dh=Ie("info",tM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nM=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],sM=Ie("italic",nM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rM=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],Dx=Ie("key",rM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const aM=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],iM=Ie("layout-dashboard",aM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const oM=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],lM=Ie("layout-grid",oM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const cM=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Si=Ie("link-2",cM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dM=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],_x=Ie("link",dM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const uM=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],hM=Ie("list-ordered",uM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fM=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],pM=Ie("list",fM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const mM=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],gM=Ie("lock",mM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xM=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],yM=Ie("log-out",xM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bM=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],Kj=Ie("map-pin",bM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vM=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],NM=Ie("menu",vM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wM=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],jM=Ie("message-circle",wM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kM=[["path",{d:"M5 12h14",key:"1ays0h"}]],SM=Ie("minus",kM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CM=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],ua=Ie("navigation",CM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const EM=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],TM=Ie("palette",EM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const MM=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],AM=Ie("paperclip",MM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const IM=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],tn=Ie("pen-line",IM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const PM=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],C1=Ie("pencil",PM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const RM=[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]],LM=Ie("percent",RM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const OM=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],E1=Ie("phone",OM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const DM=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],T1=Ie("pin",DM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _M=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],$n=Ie("plus",_M);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $M=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],M1=Ie("qr-code",$M);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zM=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],FM=Ie("quote",zM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const BM=[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]],VM=Ie("redo",BM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const HM=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],He=Ie("refresh-cw",HM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const UM=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Cn=Ie("save",UM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const WM=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],za=Ie("search",WM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const KM=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],qM=Ie("send",KM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const GM=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],yo=Ie("settings",GM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const JM=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],_h=Ie("settings-2",JM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const QM=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],YM=Ie("share-2",QM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const XM=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Oc=Ie("shield-check",XM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ZM=[["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}],["path",{d:"M3.103 6.034h17.794",key:"awc11p"}],["path",{d:"M3.4 5.467a2 2 0 0 0-.4 1.2V20a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6.667a2 2 0 0 0-.4-1.2l-2-2.667A2 2 0 0 0 17 2H7a2 2 0 0 0-1.6.8z",key:"o988cm"}]],nu=Ie("shopping-bag",ZM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const eA=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Pl=Ie("smartphone",eA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const tA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],nA=Ie("smile",tA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const sA=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],rA=Ie("sparkles",sA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const aA=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],Dc=Ie("star",aA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const iA=[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],oA=Ie("strikethrough",iA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const lA=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],cA=Ie("table",lA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dA=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],su=Ie("tag",dA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const uA=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],ls=Ie("trash-2",uA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hA=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],wf=Ie("trending-up",hA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fA=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],$x=Ie("trophy",fA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const pA=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],qj=Ie("undo-2",pA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const mA=[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]],gA=Ie("undo",mA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xA=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],jf=Ie("upload",xA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yA=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],_c=Ie("user-plus",yA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bA=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],ji=Ie("user",bA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vA=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Un=Ie("users",vA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const NA=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],wA=Ie("video",NA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const jA=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],Uc=Ie("wallet",jA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kA=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],SA=Ie("wand-sparkles",kA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Yn=Ie("x",CA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const EA=[["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"}]],Mo=Ie("zap",EA),U0="admin_token";function Pu(){try{return localStorage.getItem(U0)}catch{return null}}function TA(t){try{localStorage.setItem(U0,t)}catch{}}function Rg(){try{localStorage.removeItem(U0)}catch{}}const MA="https://soulapi.quwanzhi.com",AA=15e3,A1=6e4,IA=()=>MA;function Rl(t){const e=IA(),n=t.startsWith("/")?t:`/${t}`;return e?`${e}${n}`:n}async function Cp(t,e={}){const{data:n,...r}=e,a=Rl(t),i=new Headers(r.headers),o=Pu();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=r.timeout??AA,h=new AbortController,f=setTimeout(()=>h.abort(),u),m=await fetch(a,{...r,headers:i,body:c,credentials:"include",signal:h.signal}).finally(()=>clearTimeout(f)),g=m.headers.get("Content-Type")||"";let b;if(g.includes("application/json"))try{b=await m.json()}catch{throw new Error(`API 响应解析失败 (${m.status})`)}else{const j=await m.text();throw new Error(`API 返回非 JSON 响应 (${m.status}): ${j.slice(0,100)}`)}const N=j=>{const v=j,k=((v==null?void 0:v.message)||(v==null?void 0:v.error)||"").toString();(k.includes("可提现金额不足")||k.includes("可提现不足")||k.includes("余额不足"))&&window.dispatchEvent(new CustomEvent("recharge-alert",{detail:k}))};if(!m.ok){N(b);const j=new Error((b==null?void 0:b.error)||`HTTP ${m.status}`);throw j.status=m.status,j.data=b,j}return N(b),b}function Oe(t,e){return Cp(t,{...e,method:"GET"})}function kt(t,e,n){return Cp(t,{...n,method:"POST",data:e})}function Yt(t,e,n){return Cp(t,{...n,method:"PUT",data:e})}function ki(t,e){return Cp(t,{...e,method:"DELETE"})}function PA(){const[t,e]=y.useState(!1),[n,r]=y.useState("");return y.useEffect(()=>{const a=i=>{const o=i.detail;r(o||"可提现/余额不足,请及时充值商户号"),e(!0)};return window.addEventListener("recharge-alert",a),()=>window.removeEventListener("recharge-alert",a)},[]),t?s.jsxs("div",{className:"flex items-center justify-between gap-4 px-4 py-3 bg-red-900/80 border-b border-red-600/50 text-red-100",role:"alert",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx($j,{className:"w-5 h-5 shrink-0 text-red-400"}),s.jsxs("span",{className:"text-sm font-medium",children:[n,s.jsx("span",{className:"ml-2 text-red-300",children:"请及时充值商户号或核对账户后重试。"})]})]}),s.jsx("button",{type:"button",onClick:()=>e(!1),className:"shrink-0 p-1 rounded hover:bg-red-800/50 transition-colors","aria-label":"关闭告警",children:s.jsx(Yn,{className:"w-4 h-4"})})]}):null}const RA=[{icon:iM,label:"数据概览",href:"/dashboard"},{icon:dr,label:"内容管理",href:"/content"},{icon:Un,label:"用户管理",href:"/users"},{icon:$5,label:"找伙伴",href:"/find-partner"},{icon:Uc,label:"推广中心",href:"/distribution"}];function LA(){const t=Do(),e=y.useRef(t.pathname);e.current=t.pathname;const n=Ua(),[r,a]=y.useState(!1),[i,o]=y.useState(!1);y.useEffect(()=>{a(!0)},[]),y.useEffect(()=>{if(!r)return;let u=!1;if(!Pu()){n("/login",{replace:!0});return}return Oe("/api/admin").then(h=>{u||(h&&h.success!==!1?o(!0):(Rg(),n("/login",{replace:!0,state:{from:e.current}})))}).catch(()=>{u||(Rg(),n("/login",{replace:!0,state:{from:e.current}}))}),()=>{u=!0}},[r,n]);const c=async()=>{Rg();try{await kt("/api/admin/logout",{})}catch{}n("/login",{replace:!0})};return!r||!i?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.jsxs("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:[RA.map(u=>{const h=t.pathname===u.href;return s.jsxs(Al,{to:u.href,className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${h?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[s.jsx(u.icon,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"text-sm",children:u.label})]},u.href)}),s.jsx("div",{className:"pt-4 mt-4 border-t border-gray-700/50",children:s.jsxs(Al,{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(yo,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"text-sm",children:"系统设置"})]})})]}),s.jsx("div",{className:"p-4 border-t border-gray-700/50 space-y-1",children:s.jsxs("button",{type:"button",onClick:c,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(yM,{className:"w-5 h-5"}),s.jsx("span",{className:"text-sm",children:"退出登录"})]})})]}),s.jsxs("div",{className:"flex-1 overflow-auto bg-[#0a1628] min-w-0 flex flex-col",children:[s.jsx(PA,{}),s.jsx("div",{className:"w-full min-w-0 min-h-full flex-1",children:s.jsx(LT,{})})]})]})}function I1(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function W0(...t){return e=>{let n=!1;const r=t.map(a=>{const i=I1(a,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a{let{children:i,...o}=r;Gj(i)&&typeof kf=="function"&&(i=kf(i._payload));const c=y.Children.toArray(i),u=c.find(zA);if(u){const h=u.props.children,f=c.map(m=>m===u?y.Children.count(h)>1?y.Children.only(null):y.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:a,children:y.isValidElement(h)?y.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:a,children:i})});return n.displayName=`${t}.Slot`,n}var Qj=Jj("Slot");function _A(t){const e=y.forwardRef((n,r)=>{let{children:a,...i}=n;if(Gj(a)&&typeof kf=="function"&&(a=kf(a._payload)),y.isValidElement(a)){const o=BA(a),c=FA(i,a.props);return a.type!==y.Fragment&&(c.ref=r?W0(r,o):o),y.cloneElement(a,c)}return y.Children.count(a)>1?y.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var $A=Symbol("radix.slottable");function zA(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===$A}function FA(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 BA(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 Yj(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,R1=Xj,Zj=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return R1(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=P1(f)||P1(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,...b}=f;return Object.entries(b).every(N=>{let[j,v]=N;return Array.isArray(v)?v.includes({...i,...c}[j]):{...i,...c}[j]===v})?[...h,m,g]:h},[]);return R1(t,o,u,n==null?void 0:n.class,n==null?void 0:n.className)},VA=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),ek=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),Sf="-",L1=[],UA="arbitrary..",WA=t=>{const e=qA(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return KA(o);const c=o.split(Sf),u=c[0]===""&&c.length>1?1:0;return tk(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=r[o],h=n[o];return u?h?VA(h,u):u:h||L1}return n[o]||L1}}},tk=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const a=t[e],i=n.nextPart.get(a);if(i){const h=tk(t,e+1,i);if(h)return h}const o=n.validators;if(o===null)return;const c=e===0?t.join(Sf):t.slice(e).join(Sf),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?UA+r:void 0})(),qA=t=>{const{theme:e,classGroups:n}=t;return GA(n,e)},GA=(t,e)=>{const n=ek();for(const r in t){const a=t[r];K0(a,n,r,e)}return n},K0=(t,e,n,r)=>{const a=t.length;for(let i=0;i{if(typeof t=="string"){QA(t,e,n);return}if(typeof t=="function"){YA(t,e,n,r);return}XA(t,e,n,r)},QA=(t,e,n)=>{const r=t===""?e:nk(e,t);r.classGroupId=n},YA=(t,e,n,r)=>{if(ZA(t)){K0(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(HA(n,t))},XA=(t,e,n,r)=>{const a=Object.entries(t),i=a.length;for(let o=0;o{let n=t;const r=e.split(Sf),a=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,eI=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)}}},zx="!",O1=":",tI=[],D1=(t,e,n,r,a)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),nI=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 j=0;ju?h-u:void 0;return D1(i,b,g,N)};if(e){const a=e+O1,i=r;r=o=>o.startsWith(a)?i(o.slice(a.length)):D1(tI,!1,o,void 0,!0)}if(n){const a=r;r=i=>n({className:i,parseClassName:a})}return r},sI=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}},rI=t=>({cache:eI(t.cacheSize),parseClassName:nI(t),sortModifiers:sI(t),...WA(t)}),aI=/\s+/,iI=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:i}=e,o=[],c=t.trim().split(aI);let u="";for(let h=c.length-1;h>=0;h-=1){const f=c[h],{isExternal:m,modifiers:g,hasImportantModifier:b,baseClassName:N,maybePostfixModifierPosition:j}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let v=!!j,k=r(v?N.substring(0,j):N);if(!k){if(!v){u=f+(u.length>0?" "+u:u);continue}if(k=r(N),!k){u=f+(u.length>0?" "+u:u);continue}v=!1}const T=g.length===0?"":g.length===1?g[0]:i(g).join(":"),C=b?T+zx:T,P=C+k;if(o.indexOf(P)>-1)continue;o.push(P);const L=a(k,v);for(let U=0;U0?" "+u:u)}return u},oI=(...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=rI(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=iI(u,n);return a(u,f),f};return i=o,(...u)=>i(oI(...u))},cI=[],Qn=t=>{const e=n=>n[t]||cI;return e.isThemeGetter=!0,e},rk=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ak=/^\((?:(\w[\w-]*):)?(.+)\)$/i,dI=/^\d+\/\d+$/,uI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,hI=/\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$/,fI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,pI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,mI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,wc=t=>dI.test(t),Tt=t=>!!t&&!Number.isNaN(Number(t)),ao=t=>!!t&&Number.isInteger(Number(t)),Lg=t=>t.endsWith("%")&&Tt(t.slice(0,-1)),mi=t=>uI.test(t),gI=()=>!0,xI=t=>hI.test(t)&&!fI.test(t),ik=()=>!1,yI=t=>pI.test(t),bI=t=>mI.test(t),vI=t=>!et(t)&&!tt(t),NI=t=>sd(t,ck,ik),et=t=>rk.test(t),ml=t=>sd(t,dk,xI),Og=t=>sd(t,CI,Tt),_1=t=>sd(t,ok,ik),wI=t=>sd(t,lk,bI),$h=t=>sd(t,uk,yI),tt=t=>ak.test(t),Ud=t=>rd(t,dk),jI=t=>rd(t,EI),$1=t=>rd(t,ok),kI=t=>rd(t,ck),SI=t=>rd(t,lk),zh=t=>rd(t,uk,!0),sd=(t,e,n)=>{const r=rk.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},rd=(t,e,n=!1)=>{const r=ak.exec(t);return r?r[1]?e(r[1]):n:!1},ok=t=>t==="position"||t==="percentage",lk=t=>t==="image"||t==="url",ck=t=>t==="length"||t==="size"||t==="bg-size",dk=t=>t==="length",CI=t=>t==="number",EI=t=>t==="family-name",uk=t=>t==="shadow",TI=()=>{const t=Qn("color"),e=Qn("font"),n=Qn("text"),r=Qn("font-weight"),a=Qn("tracking"),i=Qn("leading"),o=Qn("breakpoint"),c=Qn("container"),u=Qn("spacing"),h=Qn("radius"),f=Qn("shadow"),m=Qn("inset-shadow"),g=Qn("text-shadow"),b=Qn("drop-shadow"),N=Qn("blur"),j=Qn("perspective"),v=Qn("aspect"),k=Qn("ease"),T=Qn("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...P(),tt,et],U=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],H=()=>[tt,et,u],R=()=>[wc,"full","auto",...H()],Z=()=>[ao,"none","subgrid",tt,et],re=()=>["auto",{span:["full",ao,tt,et]},ao,tt,et],$=()=>[ao,"auto",tt,et],ie=()=>["auto","min","max","fr",tt,et],ce=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],me=()=>["start","end","center","stretch","center-safe","end-safe"],I=()=>["auto",...H()],J=()=>[wc,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...H()],z=()=>[t,tt,et],ge=()=>[...P(),$1,_1,{position:[tt,et]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],F=()=>["auto","cover","contain",kI,NI,{size:[tt,et]}],W=()=>[Lg,Ud,ml],fe=()=>["","none","full",h,tt,et],he=()=>["",Tt,Ud,ml],oe=()=>["solid","dashed","dotted","double"],D=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],q=()=>[Tt,Lg,$1,_1],O=()=>["","none",N,tt,et],Q=()=>["none",Tt,tt,et],se=()=>["none",Tt,tt,et],ve=()=>[Tt,tt,et],ze=()=>[wc,"full",...H()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[mi],breakpoint:[mi],color:[gI],container:[mi],"drop-shadow":[mi],ease:["in","out","in-out"],font:[vI],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[mi],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[mi],shadow:[mi],spacing:["px",Tt],text:[mi],"text-shadow":[mi],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",wc,et,tt,v]}],container:["container"],columns:[{columns:[Tt,et,tt,c]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:L()}],overflow:[{overflow:U()}],"overflow-x":[{"overflow-x":U()}],"overflow-y":[{"overflow-y":U()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:R()}],"inset-x":[{"inset-x":R()}],"inset-y":[{"inset-y":R()}],start:[{start:R()}],end:[{end:R()}],top:[{top:R()}],right:[{right:R()}],bottom:[{bottom:R()}],left:[{left:R()}],visibility:["visible","invisible","collapse"],z:[{z:[ao,"auto",tt,et]}],basis:[{basis:[wc,"full","auto",c,...H()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Tt,wc,"auto","initial","none",et]}],grow:[{grow:["",Tt,tt,et]}],shrink:[{shrink:["",Tt,tt,et]}],order:[{order:[ao,"first","last","none",tt,et]}],"grid-cols":[{"grid-cols":Z()}],"col-start-end":[{col:re()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":Z()}],"row-start-end":[{row:re()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ie()}],"auto-rows":[{"auto-rows":ie()}],gap:[{gap:H()}],"gap-x":[{"gap-x":H()}],"gap-y":[{"gap-y":H()}],"justify-content":[{justify:[...ce(),"normal"]}],"justify-items":[{"justify-items":[...me(),"normal"]}],"justify-self":[{"justify-self":["auto",...me()]}],"align-content":[{content:["normal",...ce()]}],"align-items":[{items:[...me(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...me(),{baseline:["","last"]}]}],"place-content":[{"place-content":ce()}],"place-items":[{"place-items":[...me(),"baseline"]}],"place-self":[{"place-self":["auto",...me()]}],p:[{p:H()}],px:[{px:H()}],py:[{py:H()}],ps:[{ps:H()}],pe:[{pe:H()}],pt:[{pt:H()}],pr:[{pr:H()}],pb:[{pb:H()}],pl:[{pl:H()}],m:[{m:I()}],mx:[{mx:I()}],my:[{my:I()}],ms:[{ms:I()}],me:[{me:I()}],mt:[{mt:I()}],mr:[{mr:I()}],mb:[{mb:I()}],ml:[{ml:I()}],"space-x":[{"space-x":H()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":H()}],"space-y-reverse":["space-y-reverse"],size:[{size:J()}],w:[{w:[c,"screen",...J()]}],"min-w":[{"min-w":[c,"screen","none",...J()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...J()]}],h:[{h:["screen","lh",...J()]}],"min-h":[{"min-h":["screen","lh","none",...J()]}],"max-h":[{"max-h":["screen","lh",...J()]}],"font-size":[{text:["base",n,Ud,ml]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,tt,Og]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Lg,et]}],"font-family":[{font:[jI,et,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,tt,et]}],"line-clamp":[{"line-clamp":[Tt,"none",tt,Og]}],leading:[{leading:[i,...H()]}],"list-image":[{"list-image":["none",tt,et]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",tt,et]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:z()}],"text-color":[{text:z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:[Tt,"from-font","auto",tt,ml]}],"text-decoration-color":[{decoration:z()}],"underline-offset":[{"underline-offset":[Tt,"auto",tt,et]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:H()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",tt,et]}],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",tt,et]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ge()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:F()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ao,tt,et],radial:["",tt,et],conic:[ao,tt,et]},SI,wI]}],"bg-color":[{bg:z()}],"gradient-from-pos":[{from:W()}],"gradient-via-pos":[{via:W()}],"gradient-to-pos":[{to:W()}],"gradient-from":[{from:z()}],"gradient-via":[{via:z()}],"gradient-to":[{to:z()}],rounded:[{rounded:fe()}],"rounded-s":[{"rounded-s":fe()}],"rounded-e":[{"rounded-e":fe()}],"rounded-t":[{"rounded-t":fe()}],"rounded-r":[{"rounded-r":fe()}],"rounded-b":[{"rounded-b":fe()}],"rounded-l":[{"rounded-l":fe()}],"rounded-ss":[{"rounded-ss":fe()}],"rounded-se":[{"rounded-se":fe()}],"rounded-ee":[{"rounded-ee":fe()}],"rounded-es":[{"rounded-es":fe()}],"rounded-tl":[{"rounded-tl":fe()}],"rounded-tr":[{"rounded-tr":fe()}],"rounded-br":[{"rounded-br":fe()}],"rounded-bl":[{"rounded-bl":fe()}],"border-w":[{border:he()}],"border-w-x":[{"border-x":he()}],"border-w-y":[{"border-y":he()}],"border-w-s":[{"border-s":he()}],"border-w-e":[{"border-e":he()}],"border-w-t":[{"border-t":he()}],"border-w-r":[{"border-r":he()}],"border-w-b":[{"border-b":he()}],"border-w-l":[{"border-l":he()}],"divide-x":[{"divide-x":he()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":he()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...oe(),"hidden","none"]}],"divide-style":[{divide:[...oe(),"hidden","none"]}],"border-color":[{border:z()}],"border-color-x":[{"border-x":z()}],"border-color-y":[{"border-y":z()}],"border-color-s":[{"border-s":z()}],"border-color-e":[{"border-e":z()}],"border-color-t":[{"border-t":z()}],"border-color-r":[{"border-r":z()}],"border-color-b":[{"border-b":z()}],"border-color-l":[{"border-l":z()}],"divide-color":[{divide:z()}],"outline-style":[{outline:[...oe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Tt,tt,et]}],"outline-w":[{outline:["",Tt,Ud,ml]}],"outline-color":[{outline:z()}],shadow:[{shadow:["","none",f,zh,$h]}],"shadow-color":[{shadow:z()}],"inset-shadow":[{"inset-shadow":["none",m,zh,$h]}],"inset-shadow-color":[{"inset-shadow":z()}],"ring-w":[{ring:he()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:z()}],"ring-offset-w":[{"ring-offset":[Tt,ml]}],"ring-offset-color":[{"ring-offset":z()}],"inset-ring-w":[{"inset-ring":he()}],"inset-ring-color":[{"inset-ring":z()}],"text-shadow":[{"text-shadow":["none",g,zh,$h]}],"text-shadow-color":[{"text-shadow":z()}],opacity:[{opacity:[Tt,tt,et]}],"mix-blend":[{"mix-blend":[...D(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":D()}],"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":[Tt]}],"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":z()}],"mask-image-linear-to-color":[{"mask-linear-to":z()}],"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":z()}],"mask-image-t-to-color":[{"mask-t-to":z()}],"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":z()}],"mask-image-r-to-color":[{"mask-r-to":z()}],"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":z()}],"mask-image-b-to-color":[{"mask-b-to":z()}],"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":z()}],"mask-image-l-to-color":[{"mask-l-to":z()}],"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":z()}],"mask-image-x-to-color":[{"mask-x-to":z()}],"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":z()}],"mask-image-y-to-color":[{"mask-y-to":z()}],"mask-image-radial":[{"mask-radial":[tt,et]}],"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":z()}],"mask-image-radial-to-color":[{"mask-radial-to":z()}],"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":P()}],"mask-image-conic-pos":[{"mask-conic":[Tt]}],"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":z()}],"mask-image-conic-to-color":[{"mask-conic-to":z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ge()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:F()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",tt,et]}],filter:[{filter:["","none",tt,et]}],blur:[{blur:O()}],brightness:[{brightness:[Tt,tt,et]}],contrast:[{contrast:[Tt,tt,et]}],"drop-shadow":[{"drop-shadow":["","none",b,zh,$h]}],"drop-shadow-color":[{"drop-shadow":z()}],grayscale:[{grayscale:["",Tt,tt,et]}],"hue-rotate":[{"hue-rotate":[Tt,tt,et]}],invert:[{invert:["",Tt,tt,et]}],saturate:[{saturate:[Tt,tt,et]}],sepia:[{sepia:["",Tt,tt,et]}],"backdrop-filter":[{"backdrop-filter":["","none",tt,et]}],"backdrop-blur":[{"backdrop-blur":O()}],"backdrop-brightness":[{"backdrop-brightness":[Tt,tt,et]}],"backdrop-contrast":[{"backdrop-contrast":[Tt,tt,et]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Tt,tt,et]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Tt,tt,et]}],"backdrop-invert":[{"backdrop-invert":["",Tt,tt,et]}],"backdrop-opacity":[{"backdrop-opacity":[Tt,tt,et]}],"backdrop-saturate":[{"backdrop-saturate":[Tt,tt,et]}],"backdrop-sepia":[{"backdrop-sepia":["",Tt,tt,et]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":H()}],"border-spacing-x":[{"border-spacing-x":H()}],"border-spacing-y":[{"border-spacing-y":H()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",tt,et]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Tt,"initial",tt,et]}],ease:[{ease:["linear","initial",k,tt,et]}],delay:[{delay:[Tt,tt,et]}],animate:[{animate:["none",T,tt,et]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,tt,et]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:Q()}],"rotate-x":[{"rotate-x":Q()}],"rotate-y":[{"rotate-y":Q()}],"rotate-z":[{"rotate-z":Q()}],scale:[{scale:se()}],"scale-x":[{"scale-x":se()}],"scale-y":[{"scale-y":se()}],"scale-z":[{"scale-z":se()}],"scale-3d":["scale-3d"],skew:[{skew:ve()}],"skew-x":[{"skew-x":ve()}],"skew-y":[{"skew-y":ve()}],transform:[{transform:[tt,et,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ze()}],"translate-x":[{"translate-x":ze()}],"translate-y":[{"translate-y":ze()}],"translate-z":[{"translate-z":ze()}],"translate-none":["translate-none"],accent:[{accent:z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:z()}],"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",tt,et]}],"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":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"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",tt,et]}],fill:[{fill:["none",...z()]}],"stroke-w":[{stroke:[Tt,Ud,ml,Og]}],stroke:[{stroke:["none",...z()]}],"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"]}},MI=lI(TI);function Ot(...t){return MI(Xj(t))}function pa(t){if(!t)return"";let e=t.trim();return e?(e=e.replace(/^(https?)\/\//,"$1://"),e):""}const AI=Zj("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 G({className:t,variant:e,size:n,asChild:r=!1,...a}){const i=r?Qj:"button";return s.jsx(i,{"data-slot":"button",className:Ot(AI({variant:e,size:n,className:t})),...a})}function de({className:t,type:e,...n}){return s.jsx("input",{type:e,"data-slot":"input",className:Ot("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 II(){const t=Ua(),[e,n]=y.useState(""),[r,a]=y.useState(""),[i,o]=y.useState(""),[c,u]=y.useState(!1);y.useEffect(()=>{Pu()&&t("/dashboard",{replace:!0})},[t]);const h=async()=>{o(""),u(!0);try{const f=await kt("/api/admin",{username:e.trim(),password:r});if((f==null?void 0:f.success)!==!1&&(f!=null&&f.token)){TA(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(Oc,{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(ji,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(de,{type:"text",value:e,onChange:f=>{n(f.target.value),i&&o("")},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(gM,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(de,{type:"password",value:r,onChange:f=>{a(f.target.value),i&&o("")},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(G,{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 De=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ot("rounded-xl border bg-card text-card-foreground shadow",t),...e}));De.displayName="Card";const ut=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ot("flex flex-col space-y-1.5 p-6",t),...e}));ut.displayName="CardHeader";const ht=y.forwardRef(({className:t,...e},n)=>s.jsx("h3",{ref:n,className:Ot("font-semibold leading-none tracking-tight",t),...e}));ht.displayName="CardTitle";const Xt=y.forwardRef(({className:t,...e},n)=>s.jsx("p",{ref:n,className:Ot("text-sm text-muted-foreground",t),...e}));Xt.displayName="CardDescription";const _e=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ot("p-6 pt-0",t),...e}));_e.displayName="CardContent";const PI=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Ot("flex items-center p-6 pt-0",t),...e}));PI.displayName="CardFooter";const RI={success:{bg:"#f0fdf4",border:"#22c55e",icon:"✓"},error:{bg:"#fef2f2",border:"#ef4444",icon:"✕"},info:{bg:"#eff6ff",border:"#3b82f6",icon:"ℹ"}};function Dg(t,e="info",n=3e3){const r=`toast-${Date.now()}`,a=RI[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 Y={success:(t,e)=>Dg(t,"success",e),error:(t,e)=>Dg(t,"error",e),info:(t,e)=>Dg(t,"info",e)};function St(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 LI(t,e){const n=y.createContext(e),r=i=>{const{children:o,...c}=i,u=y.useMemo(()=>c,Object.values(c));return s.jsx(n.Provider,{value:u,children:o})};r.displayName=t+"Provider";function a(i){const o=y.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 _o(t,e=[]){let n=[];function r(i,o){const c=y.createContext(o),u=n.length;n=[...n,o];const h=m=>{var k;const{scope:g,children:b,...N}=m,j=((k=g==null?void 0:g[t])==null?void 0:k[u])||c,v=y.useMemo(()=>N,Object.values(N));return s.jsx(j.Provider,{value:v,children:b})};h.displayName=i+"Provider";function f(m,g){var j;const b=((j=g==null?void 0:g[t])==null?void 0:j[u])||c,N=y.useContext(b);if(N)return N;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=>y.createContext(o));return function(c){const u=(c==null?void 0:c[t])||i;return y.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])}};return a.scopeName=t,[r,OI(a,...e)]}function OI(...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 y.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var Is=globalThis!=null&&globalThis.document?y.useLayoutEffect:()=>{},DI=jp[" useId ".trim().toString()]||(()=>{}),_I=0;function jo(t){const[e,n]=y.useState(DI());return Is(()=>{n(r=>r??String(_I++))},[t]),e?`radix-${e}`:""}var $I=jp[" useInsertionEffect ".trim().toString()]||Is;function Ll({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[a,i,o]=zI({defaultProp:e,onChange:n}),c=t!==void 0,u=c?t:a;{const f=y.useRef(t!==void 0);y.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=y.useCallback(f=>{var m;if(c){const g=FI(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 zI({defaultProp:t,onChange:e}){const[n,r]=y.useState(t),a=y.useRef(n),i=y.useRef(e);return $I(()=>{i.current=e},[e]),y.useEffect(()=>{var o;a.current!==n&&((o=i.current)==null||o.call(i,n),a.current=n)},[n,a]),[n,r,i]}function FI(t){return typeof t=="function"}function xu(t){const e=BI(t),n=y.forwardRef((r,a)=>{const{children:i,...o}=r,c=y.Children.toArray(i),u=c.find(HI);if(u){const h=u.props.children,f=c.map(m=>m===u?y.Children.count(h)>1?y.Children.only(null):y.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:a,children:y.isValidElement(h)?y.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:a,children:i})});return n.displayName=`${t}.Slot`,n}function BI(t){const e=y.forwardRef((n,r)=>{const{children:a,...i}=n;if(y.isValidElement(a)){const o=WI(a),c=UI(i,a.props);return a.type!==y.Fragment&&(c.ref=r?W0(r,o):o),y.cloneElement(a,c)}return y.Children.count(a)>1?y.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var VI=Symbol("radix.slottable");function HI(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===VI}function UI(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 KI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Mt=KI.reduce((t,e)=>{const n=xu(`Primitive.${e}`),r=y.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 qI(t,e){t&&ed.flushSync(()=>t.dispatchEvent(e))}function Ao(t){const e=y.useRef(t);return y.useEffect(()=>{e.current=t}),y.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function GI(t,e=globalThis==null?void 0:globalThis.document){const n=Ao(t);y.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 JI="DismissableLayer",Fx="dismissableLayer.update",QI="dismissableLayer.pointerDownOutside",YI="dismissableLayer.focusOutside",z1,hk=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),q0=y.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,onDismiss:c,...u}=t,h=y.useContext(hk),[f,m]=y.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=y.useState({}),N=Gt(e,_=>m(_)),j=Array.from(h.layers),[v]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),k=j.indexOf(v),T=f?j.indexOf(f):-1,C=h.layersWithOutsidePointerEventsDisabled.size>0,P=T>=k,L=eP(_=>{const H=_.target,R=[...h.branches].some(Z=>Z.contains(H));!P||R||(a==null||a(_),o==null||o(_),_.defaultPrevented||c==null||c())},g),U=tP(_=>{const H=_.target;[...h.branches].some(Z=>Z.contains(H))||(i==null||i(_),o==null||o(_),_.defaultPrevented||c==null||c())},g);return GI(_=>{T===h.layers.size-1&&(r==null||r(_),!_.defaultPrevented&&c&&(_.preventDefault(),c()))},g),y.useEffect(()=>{if(f)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(z1=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),F1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=z1)}},[f,g,n,h]),y.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),F1())},[f,h]),y.useEffect(()=>{const _=()=>b({});return document.addEventListener(Fx,_),()=>document.removeEventListener(Fx,_)},[]),s.jsx(Mt.div,{...u,ref:N,style:{pointerEvents:C?P?"auto":"none":void 0,...t.style},onFocusCapture:St(t.onFocusCapture,U.onFocusCapture),onBlurCapture:St(t.onBlurCapture,U.onBlurCapture),onPointerDownCapture:St(t.onPointerDownCapture,L.onPointerDownCapture)})});q0.displayName=JI;var XI="DismissableLayerBranch",ZI=y.forwardRef((t,e)=>{const n=y.useContext(hk),r=y.useRef(null),a=Gt(e,r);return y.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),s.jsx(Mt.div,{...t,ref:a})});ZI.displayName=XI;function eP(t,e=globalThis==null?void 0:globalThis.document){const n=Ao(t),r=y.useRef(!1),a=y.useRef(()=>{});return y.useEffect(()=>{const i=c=>{if(c.target&&!r.current){let u=function(){fk(QI,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 tP(t,e=globalThis==null?void 0:globalThis.document){const n=Ao(t),r=y.useRef(!1);return y.useEffect(()=>{const a=i=>{i.target&&!r.current&&fk(YI,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 F1(){const t=new CustomEvent(Fx);document.dispatchEvent(t)}function fk(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?qI(a,i):a.dispatchEvent(i)}var _g="focusScope.autoFocusOnMount",$g="focusScope.autoFocusOnUnmount",B1={bubbles:!1,cancelable:!0},nP="FocusScope",G0=y.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=t,[c,u]=y.useState(null),h=Ao(a),f=Ao(i),m=y.useRef(null),g=Gt(e,j=>u(j)),b=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let j=function(C){if(b.paused||!c)return;const P=C.target;c.contains(P)?m.current=P:lo(m.current,{select:!0})},v=function(C){if(b.paused||!c)return;const P=C.relatedTarget;P!==null&&(c.contains(P)||lo(m.current,{select:!0}))},k=function(C){if(document.activeElement===document.body)for(const L of C)L.removedNodes.length>0&&lo(c)};document.addEventListener("focusin",j),document.addEventListener("focusout",v);const T=new MutationObserver(k);return c&&T.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",v),T.disconnect()}}},[r,c,b.paused]),y.useEffect(()=>{if(c){H1.add(b);const j=document.activeElement;if(!c.contains(j)){const k=new CustomEvent(_g,B1);c.addEventListener(_g,h),c.dispatchEvent(k),k.defaultPrevented||(sP(lP(pk(c)),{select:!0}),document.activeElement===j&&lo(c))}return()=>{c.removeEventListener(_g,h),setTimeout(()=>{const k=new CustomEvent($g,B1);c.addEventListener($g,f),c.dispatchEvent(k),k.defaultPrevented||lo(j??document.body,{select:!0}),c.removeEventListener($g,f),H1.remove(b)},0)}}},[c,h,f,b]);const N=y.useCallback(j=>{if(!n&&!r||b.paused)return;const v=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,k=document.activeElement;if(v&&k){const T=j.currentTarget,[C,P]=rP(T);C&&P?!j.shiftKey&&k===P?(j.preventDefault(),n&&lo(C,{select:!0})):j.shiftKey&&k===C&&(j.preventDefault(),n&&lo(P,{select:!0})):k===T&&j.preventDefault()}},[n,r,b.paused]);return s.jsx(Mt.div,{tabIndex:-1,...o,ref:g,onKeyDown:N})});G0.displayName=nP;function sP(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(lo(r,{select:e}),document.activeElement!==n)return}function rP(t){const e=pk(t),n=V1(e,t),r=V1(e.reverse(),t);return[n,r]}function pk(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 V1(t,e){for(const n of t)if(!aP(n,{upTo:e}))return n}function aP(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 iP(t){return t instanceof HTMLInputElement&&"select"in t}function lo(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&iP(t)&&e&&t.select()}}var H1=oP();function oP(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=U1(t,e),t.unshift(e)},remove(e){var n;t=U1(t,e),(n=t[0])==null||n.resume()}}}function U1(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function lP(t){return t.filter(e=>e.tagName!=="A")}var cP="Portal",J0=y.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[a,i]=y.useState(!1);Is(()=>i(!0),[]);const o=n||a&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return o?Ej.createPortal(s.jsx(Mt.div,{...r,ref:e}),o):null});J0.displayName=cP;function dP(t,e){return y.useReducer((n,r)=>e[n][r]??n,t)}var Ru=t=>{const{present:e,children:n}=t,r=uP(e),a=typeof n=="function"?n({present:r.isPresent}):y.Children.only(n),i=Gt(r.ref,hP(a));return typeof n=="function"||r.isPresent?y.cloneElement(a,{ref:i}):null};Ru.displayName="Presence";function uP(t){const[e,n]=y.useState(),r=y.useRef(null),a=y.useRef(t),i=y.useRef("none"),o=t?"mounted":"unmounted",[c,u]=dP(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const h=Fh(r.current);i.current=c==="mounted"?h:"none"},[c]),Is(()=>{const h=r.current,f=a.current;if(f!==t){const g=i.current,b=Fh(h);t?u("MOUNT"):b==="none"||(h==null?void 0:h.display)==="none"?u("UNMOUNT"):u(f&&g!==b?"ANIMATION_OUT":"UNMOUNT"),a.current=t}},[t,u]),Is(()=>{if(e){let h;const f=e.ownerDocument.defaultView??window,m=b=>{const j=Fh(r.current).includes(CSS.escape(b.animationName));if(b.target===e&&j&&(u("ANIMATION_END"),!a.current)){const v=e.style.animationFillMode;e.style.animationFillMode="forwards",h=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=v)})}},g=b=>{b.target===e&&(i.current=Fh(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:y.useCallback(h=>{r.current=h?getComputedStyle(h):null,n(h)},[])}}function Fh(t){return(t==null?void 0:t.animationName)||"none"}function hP(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 zg=0;function mk(){y.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??W1()),document.body.insertAdjacentElement("beforeend",t[1]??W1()),zg++,()=>{zg===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),zg--}},[])}function W1(){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 _a=function(){return _a=Object.assign||function(e){for(var n,r=1,a=arguments.length;r"u")return MP;var e=AP(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])}},PP=bk(),Fc="data-scroll-locked",RP=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(pP,` { + overflow: hidden `).concat(r,`; + padding-right: `).concat(c,"px ").concat(r,`; + } + body[`).concat(Fc,`] { + overflow: hidden `).concat(r,`; + overscroll-behavior: contain; + `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&` + padding-left: `.concat(a,`px; + padding-top: `).concat(i,`px; + padding-right: `).concat(o,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(c,"px ").concat(r,`; + `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),` + } + + .`).concat(cf,` { + right: `).concat(c,"px ").concat(r,`; + } + + .`).concat(df,` { + margin-right: `).concat(c,"px ").concat(r,`; + } + + .`).concat(cf," .").concat(cf,` { + right: 0 `).concat(r,`; + } + + .`).concat(df," .").concat(df,` { + margin-right: 0 `).concat(r,`; + } + + body[`).concat(Fc,`] { + `).concat(mP,": ").concat(c,`px; + } +`)},q1=function(){var t=parseInt(document.body.getAttribute(Fc)||"0",10);return isFinite(t)?t:0},LP=function(){y.useEffect(function(){return document.body.setAttribute(Fc,(q1()+1).toString()),function(){var t=q1()-1;t<=0?document.body.removeAttribute(Fc):document.body.setAttribute(Fc,t.toString())}},[])},OP=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,a=r===void 0?"margin":r;LP();var i=y.useMemo(function(){return IP(a)},[a]);return y.createElement(PP,{styles:RP(i,!e,a,n?"":"!important")})},Bx=!1;if(typeof window<"u")try{var Bh=Object.defineProperty({},"passive",{get:function(){return Bx=!0,!0}});window.addEventListener("test",Bh,Bh),window.removeEventListener("test",Bh,Bh)}catch{Bx=!1}var jc=Bx?{passive:!1}:!1,DP=function(t){return t.tagName==="TEXTAREA"},vk=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!DP(t)&&n[e]==="visible")},_P=function(t){return vk(t,"overflowY")},$P=function(t){return vk(t,"overflowX")},G1=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=Nk(t,r);if(a){var i=wk(t,r),o=i[1],c=i[2];if(o>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},zP=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},FP=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},Nk=function(t,e){return t==="v"?_P(e):$P(e)},wk=function(t,e){return t==="v"?zP(e):FP(e)},BP=function(t,e){return t==="h"&&e==="rtl"?-1:1},VP=function(t,e,n,r,a){var i=BP(t,window.getComputedStyle(e).direction),o=i*r,c=n.target,u=e.contains(c),h=!1,f=o>0,m=0,g=0;do{if(!c)break;var b=wk(t,c),N=b[0],j=b[1],v=b[2],k=j-v-i*N;(N||k)&&Nk(t,c)&&(m+=k,g+=N);var T=c.parentNode;c=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!u&&c!==document.body||u&&(e.contains(c)||e===c));return(f&&Math.abs(m)<1||!f&&Math.abs(g)<1)&&(h=!0),h},Vh=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},J1=function(t){return[t.deltaX,t.deltaY]},Q1=function(t){return t&&"current"in t?t.current:t},HP=function(t,e){return t[0]===e[0]&&t[1]===e[1]},UP=function(t){return` + .block-interactivity-`.concat(t,` {pointer-events: none;} + .allow-interactivity-`).concat(t,` {pointer-events: all;} +`)},WP=0,kc=[];function KP(t){var e=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),a=y.useState(WP++)[0],i=y.useState(bk)[0],o=y.useRef(t);y.useEffect(function(){o.current=t},[t]),y.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(a));var j=fP([t.lockRef.current],(t.shards||[]).map(Q1),!0).filter(Boolean);return j.forEach(function(v){return v.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),j.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(a))})}}},[t.inert,t.lockRef.current,t.shards]);var c=y.useCallback(function(j,v){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!o.current.allowPinchZoom;var k=Vh(j),T=n.current,C="deltaX"in j?j.deltaX:T[0]-k[0],P="deltaY"in j?j.deltaY:T[1]-k[1],L,U=j.target,_=Math.abs(C)>Math.abs(P)?"h":"v";if("touches"in j&&_==="h"&&U.type==="range")return!1;var H=window.getSelection(),R=H&&H.anchorNode,Z=R?R===U||R.contains(U):!1;if(Z)return!1;var re=G1(_,U);if(!re)return!0;if(re?L=_:(L=_==="v"?"h":"v",re=G1(_,U)),!re)return!1;if(!r.current&&"changedTouches"in j&&(C||P)&&(r.current=L),!L)return!0;var $=r.current||L;return VP($,v,j,$==="h"?C:P)},[]),u=y.useCallback(function(j){var v=j;if(!(!kc.length||kc[kc.length-1]!==i)){var k="deltaY"in v?J1(v):Vh(v),T=e.current.filter(function(L){return L.name===v.type&&(L.target===v.target||v.target===L.shadowParent)&&HP(L.delta,k)})[0];if(T&&T.should){v.cancelable&&v.preventDefault();return}if(!T){var C=(o.current.shards||[]).map(Q1).filter(Boolean).filter(function(L){return L.contains(v.target)}),P=C.length>0?c(v,C[0]):!o.current.noIsolation;P&&v.cancelable&&v.preventDefault()}}},[]),h=y.useCallback(function(j,v,k,T){var C={name:j,delta:v,target:k,should:T,shadowParent:qP(k)};e.current.push(C),setTimeout(function(){e.current=e.current.filter(function(P){return P!==C})},1)},[]),f=y.useCallback(function(j){n.current=Vh(j),r.current=void 0},[]),m=y.useCallback(function(j){h(j.type,J1(j),j.target,c(j,t.lockRef.current))},[]),g=y.useCallback(function(j){h(j.type,Vh(j),j.target,c(j,t.lockRef.current))},[]);y.useEffect(function(){return kc.push(i),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",u,jc),document.addEventListener("touchmove",u,jc),document.addEventListener("touchstart",f,jc),function(){kc=kc.filter(function(j){return j!==i}),document.removeEventListener("wheel",u,jc),document.removeEventListener("touchmove",u,jc),document.removeEventListener("touchstart",f,jc)}},[]);var b=t.removeScrollBar,N=t.inert;return y.createElement(y.Fragment,null,N?y.createElement(i,{styles:UP(a)}):null,b?y.createElement(OP,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function qP(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const GP=wP(yk,KP);var Q0=y.forwardRef(function(t,e){return y.createElement(Ep,_a({},t,{ref:e,sideCar:GP}))});Q0.classNames=Ep.classNames;var JP=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Sc=new WeakMap,Hh=new WeakMap,Uh={},Hg=0,jk=function(t){return t&&(t.host||jk(t.parentNode))},QP=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=jk(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},YP=function(t,e,n,r){var a=QP(e,Array.isArray(t)?t:[t]);Uh[n]||(Uh[n]=new WeakMap);var i=Uh[n],o=[],c=new Set,u=new Set(a),h=function(m){!m||c.has(m)||(c.add(m),h(m.parentNode))};a.forEach(h);var f=function(m){!m||u.has(m)||Array.prototype.forEach.call(m.children,function(g){if(c.has(g))f(g);else try{var b=g.getAttribute(r),N=b!==null&&b!=="false",j=(Sc.get(g)||0)+1,v=(i.get(g)||0)+1;Sc.set(g,j),i.set(g,v),o.push(g),j===1&&N&&Hh.set(g,!0),v===1&&g.setAttribute(n,"true"),N||g.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",g,k)}})};return f(e),c.clear(),Hg++,function(){o.forEach(function(m){var g=Sc.get(m)-1,b=i.get(m)-1;Sc.set(m,g),i.set(m,b),g||(Hh.has(m)||m.removeAttribute(r),Hh.delete(m)),b||m.removeAttribute(n)}),Hg--,Hg||(Sc=new WeakMap,Sc=new WeakMap,Hh=new WeakMap,Uh={})}},kk=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),a=JP(t);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),YP(r,a,n,"aria-hidden")):function(){return null}},Tp="Dialog",[Sk]=_o(Tp),[XP,xa]=Sk(Tp),Ck=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:o=!0}=t,c=y.useRef(null),u=y.useRef(null),[h,f]=Ll({prop:r,defaultProp:a??!1,onChange:i,caller:Tp});return s.jsx(XP,{scope:e,triggerRef:c,contentRef:u,contentId:jo(),titleId:jo(),descriptionId:jo(),open:h,onOpenChange:f,onOpenToggle:y.useCallback(()=>f(m=>!m),[f]),modal:o,children:n})};Ck.displayName=Tp;var Ek="DialogTrigger",ZP=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=xa(Ek,n),i=Gt(e,a.triggerRef);return s.jsx(Mt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Z0(a.open),...r,ref:i,onClick:St(t.onClick,a.onOpenToggle)})});ZP.displayName=Ek;var Y0="DialogPortal",[eR,Tk]=Sk(Y0,{forceMount:void 0}),Mk=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:a}=t,i=xa(Y0,e);return s.jsx(eR,{scope:e,forceMount:n,children:y.Children.map(r,o=>s.jsx(Ru,{present:n||i.open,children:s.jsx(J0,{asChild:!0,container:a,children:o})}))})};Mk.displayName=Y0;var Cf="DialogOverlay",Ak=y.forwardRef((t,e)=>{const n=Tk(Cf,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=xa(Cf,t.__scopeDialog);return i.modal?s.jsx(Ru,{present:r||i.open,children:s.jsx(nR,{...a,ref:e})}):null});Ak.displayName=Cf;var tR=xu("DialogOverlay.RemoveScroll"),nR=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=xa(Cf,n);return s.jsx(Q0,{as:tR,allowPinchZoom:!0,shards:[a.contentRef],children:s.jsx(Mt.div,{"data-state":Z0(a.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Ol="DialogContent",Ik=y.forwardRef((t,e)=>{const n=Tk(Ol,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=xa(Ol,t.__scopeDialog);return s.jsx(Ru,{present:r||i.open,children:i.modal?s.jsx(sR,{...a,ref:e}):s.jsx(rR,{...a,ref:e})})});Ik.displayName=Ol;var sR=y.forwardRef((t,e)=>{const n=xa(Ol,t.__scopeDialog),r=y.useRef(null),a=Gt(e,n.contentRef,r);return y.useEffect(()=>{const i=r.current;if(i)return kk(i)},[]),s.jsx(Pk,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:St(t.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:St(t.onPointerDownOutside,i=>{const o=i.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0;(o.button===2||c)&&i.preventDefault()}),onFocusOutside:St(t.onFocusOutside,i=>i.preventDefault())})}),rR=y.forwardRef((t,e)=>{const n=xa(Ol,t.__scopeDialog),r=y.useRef(!1),a=y.useRef(!1);return s.jsx(Pk,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,c;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),i.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:i=>{var u,h;(u=t.onInteractOutside)==null||u.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const o=i.target;((h=n.triggerRef.current)==null?void 0:h.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&a.current&&i.preventDefault()}})}),Pk=y.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,...o}=t,c=xa(Ol,n),u=y.useRef(null),h=Gt(e,u);return mk(),s.jsxs(s.Fragment,{children:[s.jsx(G0,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:s.jsx(q0,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":Z0(c.open),...o,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(aR,{titleId:c.titleId}),s.jsx(oR,{contentRef:u,descriptionId:c.descriptionId})]})]})}),X0="DialogTitle",Rk=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=xa(X0,n);return s.jsx(Mt.h2,{id:a.titleId,...r,ref:e})});Rk.displayName=X0;var Lk="DialogDescription",Ok=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=xa(Lk,n);return s.jsx(Mt.p,{id:a.descriptionId,...r,ref:e})});Ok.displayName=Lk;var Dk="DialogClose",_k=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=xa(Dk,n);return s.jsx(Mt.button,{type:"button",...r,ref:e,onClick:St(t.onClick,()=>a.onOpenChange(!1))})});_k.displayName=Dk;function Z0(t){return t?"open":"closed"}var $k="DialogTitleWarning",[FV,zk]=LI($k,{contentName:Ol,titleName:X0,docsSlug:"dialog"}),aR=({titleId:t})=>{const e=zk($k),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. + +If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component. + +For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return y.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},iR="DialogDescriptionWarning",oR=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${zk(iR).contentName}}.`;return y.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},lR=Ck,cR=Mk,dR=Ak,uR=Ik,hR=Rk,fR=Ok,pR=_k;function Bt(t){return s.jsx(lR,{"data-slot":"dialog",...t})}function mR(t){return s.jsx(cR,{...t})}const Fk=y.forwardRef(({className:t,...e},n)=>s.jsx(dR,{ref:n,className:Ot("fixed inset-0 z-50 bg-black/50",t),...e}));Fk.displayName="DialogOverlay";const $t=y.forwardRef(({className:t,children:e,showCloseButton:n=!0,...r},a)=>s.jsxs(mR,{children:[s.jsx(Fk,{}),s.jsxs(uR,{ref:a,"aria-describedby":void 0,className:Ot("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(pR,{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(Yn,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));$t.displayName="DialogContent";function Vt({className:t,...e}){return s.jsx("div",{className:Ot("flex flex-col gap-2 text-center sm:text-left",t),...e})}function gn({className:t,...e}){return s.jsx("div",{className:Ot("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function Ht(t){return s.jsx(hR,{className:"text-lg font-semibold leading-none",...t})}function Ef(t){return s.jsx(fR,{className:"text-sm text-muted-foreground",...t})}const gR=Zj("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 Be({className:t,variant:e,asChild:n=!1,...r}){const a=n?Qj:"span";return s.jsx(a,{className:Ot(gR({variant:e}),t),...r})}var xR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],yR=xR.reduce((t,e)=>{const n=Jj(`Primitive.${e}`),r=y.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}},{}),bR="Label",Bk=y.forwardRef((t,e)=>s.jsx(yR.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())}}));Bk.displayName=bR;var Vk=Bk;const ne=y.forwardRef(({className:t,...e},n)=>s.jsx(Vk,{ref:n,className:Ot("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));ne.displayName=Vk.displayName;function ey(t){const e=t+"CollectionProvider",[n,r]=_o(e),[a,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=j=>{const{scope:v,children:k}=j,T=Vs.useRef(null),C=Vs.useRef(new Map).current;return s.jsx(a,{scope:v,itemMap:C,collectionRef:T,children:k})};o.displayName=e;const c=t+"CollectionSlot",u=xu(c),h=Vs.forwardRef((j,v)=>{const{scope:k,children:T}=j,C=i(c,k),P=Gt(v,C.collectionRef);return s.jsx(u,{ref:P,children:T})});h.displayName=c;const f=t+"CollectionItemSlot",m="data-radix-collection-item",g=xu(f),b=Vs.forwardRef((j,v)=>{const{scope:k,children:T,...C}=j,P=Vs.useRef(null),L=Gt(v,P),U=i(f,k);return Vs.useEffect(()=>(U.itemMap.set(P,{ref:P,...C}),()=>void U.itemMap.delete(P))),s.jsx(g,{[m]:"",ref:L,children:T})});b.displayName=f;function N(j){const v=i(t+"CollectionConsumer",j);return Vs.useCallback(()=>{const T=v.collectionRef.current;if(!T)return[];const C=Array.from(T.querySelectorAll(`[${m}]`));return Array.from(v.itemMap.values()).sort((U,_)=>C.indexOf(U.ref.current)-C.indexOf(_.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:o,Slot:h,ItemSlot:b},N,r]}var vR=y.createContext(void 0);function Mp(t){const e=y.useContext(vR);return t||e||"ltr"}var Ug="rovingFocusGroup.onEntryFocus",NR={bubbles:!1,cancelable:!0},Lu="RovingFocusGroup",[Vx,Hk,wR]=ey(Lu),[jR,Uk]=_o(Lu,[wR]),[kR,SR]=jR(Lu),Wk=y.forwardRef((t,e)=>s.jsx(Vx.Provider,{scope:t.__scopeRovingFocusGroup,children:s.jsx(Vx.Slot,{scope:t.__scopeRovingFocusGroup,children:s.jsx(CR,{...t,ref:e})})}));Wk.displayName=Lu;var CR=y.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=y.useRef(null),b=Gt(e,g),N=Mp(i),[j,v]=Ll({prop:o,defaultProp:c??null,onChange:u,caller:Lu}),[k,T]=y.useState(!1),C=Ao(h),P=Hk(n),L=y.useRef(!1),[U,_]=y.useState(0);return y.useEffect(()=>{const H=g.current;if(H)return H.addEventListener(Ug,C),()=>H.removeEventListener(Ug,C)},[C]),s.jsx(kR,{scope:n,orientation:r,dir:N,loop:a,currentTabStopId:j,onItemFocus:y.useCallback(H=>v(H),[v]),onItemShiftTab:y.useCallback(()=>T(!0),[]),onFocusableItemAdd:y.useCallback(()=>_(H=>H+1),[]),onFocusableItemRemove:y.useCallback(()=>_(H=>H-1),[]),children:s.jsx(Mt.div,{tabIndex:k||U===0?-1:0,"data-orientation":r,...m,ref:b,style:{outline:"none",...t.style},onMouseDown:St(t.onMouseDown,()=>{L.current=!0}),onFocus:St(t.onFocus,H=>{const R=!L.current;if(H.target===H.currentTarget&&R&&!k){const Z=new CustomEvent(Ug,NR);if(H.currentTarget.dispatchEvent(Z),!Z.defaultPrevented){const re=P().filter(I=>I.focusable),$=re.find(I=>I.active),ie=re.find(I=>I.id===j),me=[$,ie,...re].filter(Boolean).map(I=>I.ref.current);Gk(me,f)}}L.current=!1}),onBlur:St(t.onBlur,()=>T(!1))})})}),Kk="RovingFocusGroupItem",qk=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:i,children:o,...c}=t,u=jo(),h=i||u,f=SR(Kk,n),m=f.currentTabStopId===h,g=Hk(n),{onFocusableItemAdd:b,onFocusableItemRemove:N,currentTabStopId:j}=f;return y.useEffect(()=>{if(r)return b(),()=>N()},[r,b,N]),s.jsx(Vx.ItemSlot,{scope:n,id:h,focusable:r,active:a,children:s.jsx(Mt.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:St(t.onMouseDown,v=>{r?f.onItemFocus(h):v.preventDefault()}),onFocus:St(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:St(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){f.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const k=MR(v,f.orientation,f.dir);if(k!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let C=g().filter(P=>P.focusable).map(P=>P.ref.current);if(k==="last")C.reverse();else if(k==="prev"||k==="next"){k==="prev"&&C.reverse();const P=C.indexOf(v.currentTarget);C=f.loop?AR(C,P+1):C.slice(P+1)}setTimeout(()=>Gk(C))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:j!=null}):o})})});qk.displayName=Kk;var ER={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function TR(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function MR(t,e,n){const r=TR(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return ER[r]}function Gk(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function AR(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var IR=Wk,PR=qk,Ap="Tabs",[RR]=_o(Ap,[Uk]),Jk=Uk(),[LR,ty]=RR(Ap),Qk=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:i,orientation:o="horizontal",dir:c,activationMode:u="automatic",...h}=t,f=Mp(c),[m,g]=Ll({prop:r,onChange:a,defaultProp:i??"",caller:Ap});return s.jsx(LR,{scope:n,baseId:jo(),value:m,onValueChange:g,orientation:o,dir:f,activationMode:u,children:s.jsx(Mt.div,{dir:f,"data-orientation":o,...h,ref:e})})});Qk.displayName=Ap;var Yk="TabsList",Xk=y.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...a}=t,i=ty(Yk,n),o=Jk(n);return s.jsx(IR,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:s.jsx(Mt.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:e})})});Xk.displayName=Yk;var Zk="TabsTrigger",e2=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...i}=t,o=ty(Zk,n),c=Jk(n),u=s2(o.baseId,r),h=r2(o.baseId,r),f=r===o.value;return s.jsx(PR,{asChild:!0,...c,focusable:!a,active:f,children:s.jsx(Mt.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:St(t.onMouseDown,m=>{!a&&m.button===0&&m.ctrlKey===!1?o.onValueChange(r):m.preventDefault()}),onKeyDown:St(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&o.onValueChange(r)}),onFocus:St(t.onFocus,()=>{const m=o.activationMode!=="manual";!f&&!a&&m&&o.onValueChange(r)})})})});e2.displayName=Zk;var t2="TabsContent",n2=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:a,children:i,...o}=t,c=ty(t2,n),u=s2(c.baseId,r),h=r2(c.baseId,r),f=r===c.value,m=y.useRef(f);return y.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),s.jsx(Ru,{present:a||f,children:({present:g})=>s.jsx(Mt.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})})});n2.displayName=t2;function s2(t,e){return`${t}-trigger-${e}`}function r2(t,e){return`${t}-content-${e}`}var OR=Qk,a2=Xk,i2=e2,o2=n2;const Wc=OR,Dl=y.forwardRef(({className:t,...e},n)=>s.jsx(a2,{ref:n,className:Ot("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));Dl.displayName=a2.displayName;const nn=y.forwardRef(({className:t,...e},n)=>s.jsx(i2,{ref:n,className:Ot("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}));nn.displayName=i2.displayName;const sn=y.forwardRef(({className:t,...e},n)=>s.jsx(o2,{ref:n,className:Ot("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));sn.displayName=o2.displayName;function ny(t){const e=y.useRef({value:t,previous:t});return y.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function sy(t){const[e,n]=y.useState(void 0);return Is(()=>{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 Ip="Switch",[DR]=_o(Ip),[_R,$R]=DR(Ip),l2=y.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,b]=y.useState(null),N=Gt(e,C=>b(C)),j=y.useRef(!1),v=g?f||!!g.closest("form"):!0,[k,T]=Ll({prop:a,defaultProp:i??!1,onChange:h,caller:Ip});return s.jsxs(_R,{scope:n,checked:k,disabled:c,children:[s.jsx(Mt.button,{type:"button",role:"switch","aria-checked":k,"aria-required":o,"data-state":h2(k),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:N,onClick:St(t.onClick,C=>{T(P=>!P),v&&(j.current=C.isPropagationStopped(),j.current||C.stopPropagation())})}),v&&s.jsx(u2,{control:g,bubbles:!j.current,name:r,value:u,checked:k,required:o,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});l2.displayName=Ip;var c2="SwitchThumb",d2=y.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,a=$R(c2,n);return s.jsx(Mt.span,{"data-state":h2(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:e})});d2.displayName=c2;var zR="SwitchBubbleInput",u2=y.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...a},i)=>{const o=y.useRef(null),c=Gt(o,i),u=ny(n),h=sy(e);return y.useEffect(()=>{const f=o.current;if(!f)return;const m=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&b){const N=new Event("click",{bubbles:r});b.call(f,n),f.dispatchEvent(N)}},[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}})});u2.displayName=zR;function h2(t){return t?"checked":"unchecked"}var f2=l2,FR=d2;const Ut=y.forwardRef(({className:t,...e},n)=>s.jsx(f2,{className:Ot("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(FR,{className:Ot("pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Ut.displayName=f2.displayName;const BR={view_chapter:"浏览章节",purchase:"购买",match:"派对匹配",login:"登录",register:"注册",share:"分享",bind_phone:"绑定手机",bind_wechat:"绑定微信",fill_profile:"完善资料",fill_avatar:"设置头像",visit_page:"访问页面",first_pay:"首次付款",vip_activate:"开通会员",click_super:"点击超级个体",lead_submit:"提交留资",withdraw:"申请提现",referral_bind:"绑定推荐人",card_click:"点击名片",btn_click:"按钮点击",tab_click:"切换标签",nav_click:"导航点击",page_view:"页面浏览",search:"搜索"};function VR(t){return BR[t]||t||"行为"}function HR(t,e){const n=new Set,r=a=>(t[a]??0)>0;return(r("purchase")||r("first_pay")||r("vip_activate"))&&n.add("已付费"),(r("lead_submit")||r("click_super"))&&n.add("高意向"),r("view_chapter")&&n.add("想学习"),r("match")&&n.add("找合伙人"),r("withdraw")&&n.add("有提现行为"),r("referral_bind")&&n.add("推广参与"),(r("fill_profile")||r("fill_avatar")||r("bind_phone"))&&n.add("资料完善中"),e!=null&&e.hasFullBook&&n.add("全书读者"),e!=null&&e.isVip&&n.add("VIP会员"),e!=null&&e.mbti&&/^[EI][NS][FT][JP]$/i.test(e.mbti)&&n.add(String(e.mbti).toUpperCase()),Array.from(n)}function ry({open:t,onClose:e,userId:n,onUserUpdated:r}){var Ga,fr,Ws,pr,Ks,Ds;const[a,i]=y.useState(null),[o,c]=y.useState([]),[u,h]=y.useState({}),[f,m]=y.useState([]),[g,b]=y.useState(null),[N,j]=y.useState(null),[v,k]=y.useState(!1),[T,C]=y.useState(!1),[P,L]=y.useState(!1),[U,_]=y.useState("info"),[H,R]=y.useState(""),[Z,re]=y.useState(""),[$,ie]=y.useState(""),[ce,me]=y.useState([]),[I,J]=y.useState(""),[z,ge]=y.useState(""),[X,F]=y.useState(""),[W,fe]=y.useState(!1),[he,oe]=y.useState({isVip:!1,vipExpireDate:"",vipRole:"",vipName:"",vipProject:"",vipContact:"",vipBio:""}),[D,q]=y.useState([]),[O,Q]=y.useState(!1),[se,ve]=y.useState(""),[ze,Ue]=y.useState(""),[jt,Nn]=y.useState(!1),[pt,It]=y.useState(!1),[un,Bn]=y.useState(null),[hn,Wt]=y.useState(null),[xn,En]=y.useState(""),[Vn,Zn]=y.useState(""),[Rt,yn]=y.useState(""),[we,Te]=y.useState(!1),[We,at]=y.useState(null),[Lt,Ct]=y.useState(!1),[$e,V]=y.useState({}),[Qe,vt]=y.useState([]);y.useEffect(()=>{t&&n&&(Ct(!1),_("info"),Bn(null),Wt(null),at(null),ge(""),F(""),xt(),Oe("/api/db/vip-roles").then(le=>{le!=null&&le.success&&le.data&&q(le.data)}).catch(()=>{}))},[t,n]),y.useEffect(()=>{t&&Oe("/api/admin/mbti-avatars").then(le=>{le!=null&&le.avatars&&typeof le.avatars=="object"?V(le.avatars):V({})}).catch(()=>V({}))},[t]);const Dt=(le,Ne)=>{const Xe=(le||"").trim();if(Xe)return pa(Xe);const Nt=(Ne||"").trim().toUpperCase();return/^[EI][NS][FT][JP]$/.test(Nt)?($e[Nt]||"").trim():""};async function xt(){if(n){k(!0);try{const le=await Oe(`/api/db/users?id=${encodeURIComponent(n)}`);if(le!=null&&le.success&&le.user){const Ne=le.user;i(Ne),R(Ne.phone||""),re(Ne.wechatId||""),ie(Ne.nickname||""),En(Ne.phone||""),Zn(Ne.wechatId||""),yn(Ne.openId||"");try{me(typeof Ne.tags=="string"?JSON.parse(Ne.tags||"[]"):[])}catch{me([])}oe({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 Oe(`/api/admin/user/track?userId=${encodeURIComponent(n)}&limit=100`);if(Ne!=null&&Ne.success){h(Ne.stats&&typeof Ne.stats=="object"?Ne.stats:{});const Xe=Ne.tracks||[];c(Xe.map(Nt=>({...Nt,actionLabel:Nt.actionLabel||Nt.action,timeAgo:Nt.timeAgo||""})))}else h({}),c([])}catch{h({}),c([])}try{const Ne=await Oe(`/api/db/users/referrals?userId=${encodeURIComponent(n)}`);Ne!=null&&Ne.success?(m(Ne.referrals||[]),b(Ne.inboundSource||null)):(m([]),b(null))}catch{m([]),b(null)}try{const Ne=await Oe(`/api/admin/users/${encodeURIComponent(n)}/balance`);Ne!=null&&Ne.success&&Ne.data?j(Ne.data):j(null)}catch{j(null)}try{const Ne=await Oe(`/api/orders?userId=${encodeURIComponent(n)}&status=paid&pageSize=50`);Ne!=null&&Ne.success&&Ne.orders?vt(Ne.orders):vt([])}catch{vt([])}}catch(le){console.error("Load user detail error:",le)}finally{k(!1)}}}async function yt(){if(!(a!=null&&a.phone)){Y.info("用户未绑定手机号,无法同步");return}C(!0);try{const le=await kt("/api/ckb/sync",{action:"full_sync",phone:a.phone,userId:a.id});le!=null&&le.success?(Y.success("同步成功"),xt()):Y.error("同步失败: "+(le==null?void 0:le.error))}catch(le){console.error("Sync CKB error:",le),Y.error("同步失败")}finally{C(!1)}}async function Pt(){if(a){if(he.isVip&&!he.vipExpireDate.trim()){Y.error("开启 VIP 请填写有效到期日");return}L(!0);try{const le={id:a.id,phone:H.trim()||void 0,wechatId:Z.trim(),nickname:$||void 0,tags:JSON.stringify(ce),isVip:he.isVip,vipExpireDate:he.isVip?he.vipExpireDate:void 0,vipRole:he.vipRole||void 0,vipName:he.vipName||void 0,vipProject:he.vipProject||void 0,vipContact:he.vipContact||void 0,vipBio:he.vipBio||void 0},Ne=await Yt("/api/db/users",le);Ne!=null&&Ne.success?(Y.success("保存成功"),xt(),r==null||r()):Y.error("保存失败: "+(Ne==null?void 0:Ne.error))}catch(le){console.error("Save user error:",le),Y.error("保存失败")}finally{L(!1)}}}const Jt=()=>{I&&!ce.includes(I)&&(me([...ce,I]),J(""))},wn=le=>me(ce.filter(Ne=>Ne!==le));async function Os(){if(a){if(!z){Y.error("请输入新密码");return}if(z!==X){Y.error("两次密码不一致");return}if(z.length<6){Y.error("密码至少 6 位");return}fe(!0);try{const le=await Yt("/api/db/users",{id:a.id,password:z});le!=null&&le.success?(Y.success("修改成功"),ge(""),F("")):Y.error("修改失败: "+((le==null?void 0:le.error)||""))}catch{Y.error("修改失败")}finally{fe(!1)}}}async function hr(){if(!a)return;const le=parseFloat(se);if(Number.isNaN(le)||le===0){Y.error("请输入有效金额(正数增加、负数扣减)");return}Nn(!0);try{const Ne=await kt(`/api/admin/users/${a.id}/balance/adjust`,{amount:le,remark:ze||void 0});Ne!=null&&Ne.success?(Y.success("余额已调整"),Q(!1),ve(""),Ue(""),xt(),r==null||r()):Y.error("调整失败: "+((Ne==null?void 0:Ne.error)||""))}catch{Y.error("调整失败")}finally{Nn(!1)}}async function qa(){if(!xn&&!Rt&&!Vn){Wt("请至少输入手机号、微信号或 OpenID 中的一项");return}It(!0),Wt(null),Bn(null);try{const le=new URLSearchParams;xn&&le.set("phone",xn),Rt&&le.set("openId",Rt),Vn&&le.set("wechatId",Vn);const Ne=await Oe(`/api/admin/shensheshou/query?${le}`);Ne!=null&&Ne.success&&Ne.data?(Bn(Ne.data),a&&await Gr(Ne.data)):Wt((Ne==null?void 0:Ne.error)||"未查询到数据,该用户可能未在神射手收录")}catch(le){console.error("SSS query error:",le),Wt("请求失败,请检查神射手接口配置")}finally{It(!1)}}async function Gr(le){if(a)try{await kt("/api/admin/shensheshou/enrich",{userId:a.id,phone:xn||a.phone||"",openId:Rt||a.openId||"",wechatId:Vn||a.wechatId||""}),xt()}catch(Ne){console.error("SSS enrich error:",Ne)}}async function Jr(){if(a){Te(!0),at(null);try{const le=Array.from(new Set(o.filter(qs=>qs.action==="view_chapter"||qs.action==="purchase"||qs.action==="first_pay").map(qs=>(qs.chapterTitle||qs.target||"").trim()).filter(Boolean))).slice(0,12),Ne={viewChapter:u.view_chapter||0,purchase:u.purchase||0,firstPay:u.first_pay||0},Xe=le.length>0?`意向章节:${le.join("、")}`:"",Nt={users:[{phone:a.phone||"",name:a.nickname||"",openId:a.openId||"",tags:ce,purchaseIntent:Ne,purchaseIntentChapters:le,remark:Xe}]},Zt=await kt("/api/admin/shensheshou/ingest",Nt);Zt!=null&&Zt.success&&Zt.data?at(Zt.data):at({error:(Zt==null?void 0:Zt.error)||"推送失败"})}catch(le){console.error("SSS ingest error:",le),at({error:"请求失败"})}finally{Te(!1)}}}const ba=le=>{const Xe={view_chapter:dr,purchase:nu,match:Un,login:ji,register:ji,share:Si,bind_phone:E1,bind_wechat:jM,fill_profile:su,fill_avatar:ji,visit_page:ua,first_pay:nu,vip_activate:zc,click_super:Un,lead_submit:E1,withdraw:Dx,referral_bind:Si,card_click:ji,btn_click:Mo,tab_click:ua,nav_click:ua,page_view:ua,search:ua}[le]||Rx;return s.jsx(Xe,{className:"w-4 h-4"})};function Tr(le){const Ne=String(le||"").trim();return Ne.length>22&&/^[a-zA-Z0-9_-]+$/.test(Ne)}const Mr=y.useMemo(()=>HR(u,a),[u,a]);function Qr(){const le=[...ce];for(const Ne of Mr)le.includes(Ne)||le.push(Ne);me(le),Y.success("已将旅程推断标签合并到已选")}return t?s.jsxs(s.Fragment,{children:[s.jsx(Bt,{open:t,onOpenChange:()=>e(),children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[92vh] overflow-hidden flex flex-col p-4 sm:p-5",children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(ji,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(a==null?void 0:a.phone)&&s.jsx(Be,{className:"bg-green-500/20 text-green-400 border-0 ml-2",children:"已绑定手机"}),(a==null?void 0:a.isVip)&&s.jsx(Be,{className:"bg-amber-500/20 text-amber-400 border-0",children:"VIP"})]})}),v?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(He,{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 flex-col sm:flex-row gap-2.5 p-2.5 bg-[#0a1628] rounded-lg mb-2 shrink-0",children:[s.jsxs("div",{className:"flex gap-2.5 min-w-0 flex-1",children:[s.jsx("div",{className:"w-11 h-11 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-lg text-[#38bdac] shrink-0",children:Dt(a.avatar,a.mbti)&&!Lt?s.jsx("img",{src:Dt(a.avatar,a.mbti),className:"w-full h-full rounded-full object-cover",alt:"",onError:()=>Ct(!0)}):((Ga=a.nickname)==null?void 0:Ga.charAt(0))||"?"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.jsx("h3",{className:"text-base font-bold text-white leading-tight",children:a.nickname}),a.isAdmin&&s.jsx(Be,{className:"bg-purple-500/20 text-purple-400 border-0 text-[10px] py-0",children:"管理员"}),a.hasFullBook&&s.jsx(Be,{className:"bg-green-500/20 text-green-400 border-0 text-[10px] py-0",children:"全书已购"}),a.vipRole&&s.jsx(Be,{className:"bg-amber-500/20 text-amber-400 border-0 text-[10px] py-0",children:a.vipRole})]}),a.referralCode&&s.jsxs("p",{className:"text-[10px] text-gray-500 mt-0.5",children:["推荐码 ",s.jsx("code",{className:"text-[#38bdac]",children:a.referralCode})]}),s.jsxs("div",{className:"mt-1 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-1.5 text-[11px]",children:[s.jsxs("div",{className:"px-2 py-1 rounded bg-[#162840] border border-gray-700/50",children:[s.jsx("span",{className:"text-gray-500",children:"昵称"}),s.jsx("p",{className:"text-white truncate",children:$||a.nickname||"—"})]}),s.jsxs("div",{className:"px-2 py-1 rounded bg-[#162840] border border-gray-700/50",children:[s.jsx("span",{className:"text-gray-500",children:"手机号"}),s.jsx("p",{className:"text-white truncate",children:H||"—"})]}),s.jsxs("div",{className:"px-2 py-1 rounded bg-[#162840] border border-gray-700/50",children:[s.jsx("span",{className:"text-gray-500",children:"微信标识"}),s.jsx("p",{className:"text-white truncate",children:Z||"—"})]}),s.jsxs("div",{className:"px-2 py-1 rounded bg-[#162840] border border-gray-700/50",children:[s.jsx("span",{className:"text-gray-500",children:"画像"}),s.jsx("p",{className:"text-[#38bdac] truncate",children:[a.region,a.industry,a.position,a.mbti?`MBTI ${a.mbti}`:""].filter(Boolean).join(" · ")||"未完善"})]})]})]})]}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-2 gap-1.5 shrink-0 sm:w-[220px]",children:[s.jsxs("div",{className:"rounded-md bg-[#162840] px-2 py-1.5 border border-gray-700/40",children:[s.jsx("p",{className:"text-[9px] text-gray-500 uppercase tracking-wide",children:"累计佣金"}),s.jsxs("p",{className:"text-sm font-bold text-[#38bdac] leading-tight",children:["¥",(a.earnings??0).toFixed(2)]}),s.jsx("p",{className:"text-[9px] text-gray-600",children:"推广/分佣入账"})]}),s.jsxs("div",{className:"rounded-md bg-[#162840] px-2 py-1.5 border border-gray-700/40",children:[s.jsx("p",{className:"text-[9px] text-gray-500",children:"待提现"}),s.jsxs("p",{className:"text-sm font-bold text-yellow-400 leading-tight",children:["¥",(a.pendingEarnings??0).toFixed(2)]}),s.jsx("p",{className:"text-[9px] text-gray-600",children:"未打款部分"})]}),s.jsxs("div",{className:"rounded-md bg-[#162840] px-2 py-1.5 border border-gray-700/40",children:[s.jsxs("div",{className:"flex items-center justify-between gap-1",children:[s.jsx("p",{className:"text-[9px] text-gray-500",children:"账户余额"}),s.jsx(G,{type:"button",size:"sm",variant:"ghost",className:"h-5 px-1 text-[9px] text-[#38bdac] hover:bg-[#38bdac]/10",onClick:()=>{ve(""),Ue(""),Q(!0)},children:"调整"})]}),s.jsxs("p",{className:"text-sm font-bold text-white leading-tight",children:["¥",((N==null?void 0:N.balance)??0).toFixed(2)]}),s.jsx("p",{className:"text-[9px] text-gray-600",children:"可消费/抵扣"})]}),s.jsxs("div",{className:"rounded-md bg-[#162840] px-2 py-1.5 border border-gray-700/40",children:[s.jsx("p",{className:"text-[9px] text-gray-500",children:"推荐人数"}),s.jsx("p",{className:"text-sm font-bold text-white leading-tight",children:a.referralCount??0}),s.jsx("p",{className:"text-[9px] text-gray-600",children:a.createdAt?`注册 ${new Date(a.createdAt).toLocaleDateString()}`:"—"})]})]})]}),s.jsxs(Wc,{value:U,onValueChange:_,className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[s.jsxs(Dl,{className:"bg-[#0a1628] border border-gray-700/50 p-0.5 mb-2 flex-wrap h-auto gap-0.5 shrink-0",children:[s.jsx(nn,{value:"info",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-[11px] px-2 py-1 h-7",children:"用户信息"}),s.jsxs(nn,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-[11px] px-2 py-1 h-7",children:[s.jsx(ua,{className:"w-3 h-3 mr-0.5"}),"旅程与轨迹"]}),s.jsx(nn,{value:"relations",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-[11px] px-2 py-1 h-7",children:"关系链路"}),s.jsx(nn,{value:"tags",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-[11px] px-2 py-1 h-7",children:"标签体系"})]}),s.jsxs(sn,{value:"info",className:"flex-1 min-h-0 overflow-y-auto space-y-2 pr-0.5",children:[s.jsxs("details",{className:"rounded-lg bg-[#0a1628] border border-gray-700/40 p-2 text-[11px] group",children:[s.jsxs("summary",{className:"cursor-pointer text-gray-400 select-none list-none flex items-center gap-1",children:[s.jsx("span",{className:"group-open:text-[#38bdac]",children:"技术标识"}),s.jsx("span",{className:"text-gray-600",children:"(用户ID / OpenID,默认折叠)"})]}),s.jsxs("div",{className:"mt-2 space-y-1.5 text-gray-300 font-mono text-[10px] break-all border-t border-gray-700/30 pt-2",children:[s.jsxs("p",{children:[s.jsx("span",{className:"text-gray-500 not-italic font-sans",children:"用户ID"})," ",a.id]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-gray-500 not-italic font-sans",children:"OpenID"})," ",a.openId||"—"]}),s.jsx("p",{className:"text-gray-500 not-italic font-sans leading-snug",children:"OpenID 为微信用户标识;下方「微信标识」为微信号/wxid,供存客宝归属,与 OpenID 不同。"})]})]}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-400 text-[11px]",children:"昵称"}),s.jsx(de,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"昵称",value:$,onChange:le=>ie(le.target.value)})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-400 text-[11px]",children:"手机号(可改,点底部保存生效)"}),s.jsx(de,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"11 位手机号",value:H,onChange:le=>R(le.target.value)})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-400 text-[11px]",children:"微信标识(微信号/wxid,非 OpenID)"}),s.jsx(de,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"如 wxid_xxx 或自定义微信号",value:Z,onChange:le=>re(le.target.value)})]})]}),(a.region||a.industry||a.position||a.mbti)&&s.jsxs("div",{className:"flex flex-wrap gap-1.5 text-[11px]",children:[a.region&&s.jsxs("span",{className:"px-2 py-0.5 rounded bg-[#162840] text-gray-300",children:[s.jsx(Kj,{className:"w-3 h-3 inline mr-0.5"}),a.region]}),a.industry&&s.jsxs("span",{className:"px-2 py-0.5 rounded bg-[#162840] text-gray-300",children:["行业 ",a.industry]}),a.position&&s.jsxs("span",{className:"px-2 py-0.5 rounded bg-[#162840] text-gray-300",children:["职位 ",a.position]}),a.mbti&&s.jsxs("span",{className:"px-2 py-0.5 rounded bg-[#38bdac]/15 text-[#38bdac]",children:["MBTI ",a.mbti]})]}),s.jsxs("div",{className:"p-2 rounded-lg bg-[#0a1628] border border-amber-500/25",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx(zc,{className:"w-3.5 h-3.5 text-amber-400 shrink-0"}),s.jsx("span",{className:"text-white text-xs font-medium",children:"超级个体"}),a.isVip&&s.jsx(Be,{className:"bg-amber-500/20 text-amber-400 border-0 text-[10px] py-0 shrink-0",children:a.vipRole||"VIP"})]}),s.jsx(Ut,{className:"scale-90",checked:he.isVip,onCheckedChange:le=>oe(Ne=>({...Ne,isVip:le}))})]}),he.isVip&&s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-1.5 mt-2",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ne,{className:"text-gray-500 text-[10px]",children:"到期日"}),s.jsx(de,{type:"date",className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",value:he.vipExpireDate,onChange:le=>oe(Ne=>({...Ne,vipExpireDate:le.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ne,{className:"text-gray-500 text-[10px]",children:"角色"}),s.jsxs("select",{className:"w-full bg-[#162840] border border-gray-700 text-white rounded px-1.5 h-7 text-xs",value:he.vipRole,onChange:le=>oe(Ne=>({...Ne,vipRole:le.target.value})),children:[s.jsx("option",{value:"",children:"请选择"}),D.map(le=>s.jsx("option",{value:le.name,children:le.name},le.id))]})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ne,{className:"text-gray-500 text-[10px]",children:"展示名"}),s.jsx(de,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"展示名",value:he.vipName,onChange:le=>oe(Ne=>({...Ne,vipName:le.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ne,{className:"text-gray-500 text-[10px]",children:"项目"}),s.jsx(de,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"项目",value:he.vipProject,onChange:le=>oe(Ne=>({...Ne,vipProject:le.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ne,{className:"text-gray-500 text-[10px]",children:"联系方式"}),s.jsx(de,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"微信/手机",value:he.vipContact,onChange:le=>oe(Ne=>({...Ne,vipContact:le.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5 sm:col-span-2",children:[s.jsx(ne,{className:"text-gray-500 text-[10px]",children:"简介"}),s.jsx(de,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"简短介绍",value:he.vipBio,onChange:le=>oe(Ne=>({...Ne,vipBio:le.target.value}))})]})]})]}),s.jsxs("div",{className:"p-2 rounded-lg bg-[#0a1628] border border-[#38bdac]/20",children:[s.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[s.jsx(Mo,{className:"w-3.5 h-3.5 text-[#38bdac]"}),s.jsx("span",{className:"text-white text-xs font-medium",children:"外部资料 · 神射手 / 存客宝(与上方基础信息联动)"})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-1.5 mb-1.5",children:[s.jsx(de,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:手机",value:xn,onChange:le=>En(le.target.value)}),s.jsx(de,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:微信号",value:Vn,onChange:le=>Zn(le.target.value)}),s.jsx(de,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:OpenID",value:Rt,onChange:le=>yn(le.target.value)})]}),s.jsxs("div",{className:"flex flex-wrap gap-1",children:[s.jsxs(G,{size:"sm",className:"h-7 text-[11px] px-2 bg-[#38bdac] hover:bg-[#2da396]",onClick:qa,disabled:pt,children:[pt?s.jsx(He,{className:"w-3 h-3 animate-spin"}):s.jsx(za,{className:"w-3 h-3 mr-0.5"}),"查询回填"]}),s.jsx(G,{size:"sm",variant:"outline",className:"h-7 text-[11px] px-2 border-purple-500/40 text-purple-300",onClick:Jr,disabled:we||!a.phone,children:we?"推送…":"推神射手"}),s.jsx(G,{size:"sm",variant:"outline",className:"h-7 text-[11px] px-2",onClick:yt,disabled:T||!a.phone,children:T?"同步…":"存客宝同步"})]}),a.ckbSyncedAt&&s.jsxs("p",{className:"text-[10px] text-gray-500 mt-1",children:["最近存客宝同步:",new Date(a.ckbSyncedAt).toLocaleString()]}),hn&&s.jsx("p",{className:"mt-1 text-red-400 text-[11px]",children:hn}),un&&s.jsxs("div",{className:"mt-1.5 grid grid-cols-2 gap-1.5",children:[s.jsxs("div",{className:"p-1.5 bg-[#162840] rounded text-[11px]",children:[s.jsx("span",{className:"text-gray-500",children:"RFM"})," ",s.jsx("span",{className:"text-[#38bdac] font-semibold",children:un.rfm_score??"—"})]}),s.jsxs("div",{className:"p-1.5 bg-[#162840] rounded text-[11px]",children:[s.jsx("span",{className:"text-gray-500",children:"等级"})," ",s.jsx("span",{className:"text-white font-semibold",children:un.user_level??"—"})]})]}),We&&s.jsx("p",{className:"mt-1 text-[11px]",children:We.error?s.jsx("span",{className:"text-red-400",children:String(We.error)}):s.jsx("span",{className:"text-green-400",children:"推送成功"})})]}),s.jsxs("div",{className:"p-2 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[s.jsx(Dx,{className:"w-3.5 h-3.5 text-yellow-400"}),s.jsx("span",{className:"text-white text-xs font-medium",children:"修改密码"})]}),s.jsxs("div",{className:"flex flex-col sm:flex-row gap-1.5 sm:items-center",children:[s.jsx(de,{type:"password",className:"bg-[#162840] border-gray-700 text-white h-7 text-xs flex-1",placeholder:"新密码 ≥6 位",value:z,onChange:le=>ge(le.target.value)}),s.jsx(de,{type:"password",className:"bg-[#162840] border-gray-700 text-white h-7 text-xs flex-1",placeholder:"确认密码",value:X,onChange:le=>F(le.target.value)}),s.jsx(G,{size:"sm",className:"h-7 text-[11px] shrink-0 bg-yellow-500/20 text-yellow-300 border border-yellow-500/35 hover:bg-yellow-500/30",onClick:Os,disabled:W||!z||!X,children:W?"保存中":"确认修改"})]})]})]}),s.jsxs(sn,{value:"journey",className:"flex-1 min-h-0 overflow-y-auto space-y-2 pr-0.5",children:[Qe.length>0&&s.jsxs("div",{className:"p-2 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[s.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[s.jsx(nu,{className:"w-3.5 h-3.5 text-amber-400"}),s.jsxs("span",{className:"text-white text-xs font-medium",children:["购买清单(",Qe.length," 笔)"]})]}),s.jsx("div",{className:"space-y-1 max-h-[120px] overflow-y-auto",children:Qe.map((le,Ne)=>s.jsxs("div",{className:"flex items-center justify-between p-1.5 bg-[#162840] rounded text-[11px]",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"text-amber-300",children:le.productType==="fullbook"||le.productType==="vip"?"全书/VIP":`章节 ${le.productId||""}`}),s.jsxs("span",{className:"text-gray-500 ml-2",children:["¥",Number(le.amount||0).toFixed(2)]})]}),s.jsx("span",{className:"text-gray-500 text-[10px] shrink-0",children:le.createdAt?new Date(le.createdAt).toLocaleString("zh-CN"):""})]},le.orderSn||Ne))})]}),s.jsxs("div",{className:"p-2 bg-[#0a1628] rounded-lg flex flex-col gap-1.5 text-[11px]",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-gray-400",children:[s.jsx(ua,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0"}),s.jsxs("span",{children:["全站埋点共 ",o.length," 条;用于 RFM 与「标签体系」旅程推断"]})]}),Object.keys(u).length>0&&s.jsx("div",{className:"flex flex-wrap gap-1 pt-1 border-t border-gray-700/40",children:Object.entries(u).sort((le,Ne)=>Ne[1]-le[1]).map(([le,Ne])=>s.jsxs(Be,{variant:"outline",className:"text-[10px] border-gray-600 text-gray-300 bg-[#162840] py-0 h-5",children:[VR(le)," ×",Ne]},le))})]}),s.jsx("div",{className:"space-y-1.5",children:o.length>0?o.map((le,Ne)=>s.jsxs("div",{className:"flex items-start gap-2 p-2 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[s.jsx("div",{className:"w-7 h-7 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-[#38bdac]",children:ba(le.action)}),Ne0?((g==null?void 0:g.visits)||[]).map((le,Ne)=>s.jsxs("div",{className:"flex items-center justify-between p-1.5 bg-[#162840] rounded text-xs",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("p",{className:"text-white truncate",children:["第 ",le.seq||Ne+1," 次 · ",le.referrerNickname||"微信用户",le.referrerId?`(${le.referrerId})`:""]}),le.page?s.jsx("p",{className:"text-gray-500 text-[10px] truncate",children:le.page}):null]}),s.jsx("span",{className:"text-gray-500 text-[10px] shrink-0",children:le.visitedAt?new Date(le.visitedAt).toLocaleString():""})]},`${le.referrerId||"unknown"}_${Ne}`)):s.jsx("p",{className:"text-gray-500 text-sm text-center py-2",children:"暂无来源点击记录"})})]}),s.jsxs("div",{className:"p-2 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Si,{className:"w-3.5 h-3.5 text-[#38bdac]"}),s.jsx("span",{className:"text-white text-sm font-medium",children:"推荐的用户"})]}),s.jsxs(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 text-[10px]",children:["共 ",f.length," 人"]})]}),s.jsx("div",{className:"space-y-1 max-h-[min(280px,40vh)] overflow-y-auto",children:f.length>0?f.map((le,Ne)=>{var Nt;const Xe=le;return s.jsxs("div",{className:"flex items-center justify-between p-1.5 bg-[#162840] rounded text-xs",children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx("div",{className:"w-6 h-6 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-[10px] text-[#38bdac] shrink-0",children:((Nt=Xe.nickname)==null?void 0:Nt.charAt(0))||"?"}),s.jsx("span",{className:"text-white truncate",children:Xe.nickname})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[Xe.status==="vip"&&s.jsx(Be,{className:"bg-green-500/20 text-green-400 border-0 text-[10px] py-0",children:"已购"}),s.jsx("span",{className:"text-gray-500 text-[10px]",children:Xe.createdAt?new Date(Xe.createdAt).toLocaleDateString():""})]})]},Xe.id||Ne)}):s.jsx("p",{className:"text-gray-500 text-sm text-center py-3",children:"暂无推荐用户"})})]})]}),s.jsxs(sn,{value:"tags",className:"flex-1 min-h-0 overflow-y-auto space-y-3 pr-0.5",children:[s.jsxs("div",{className:"p-2.5 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2 flex-wrap",children:[s.jsx(su,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-white text-sm font-medium",children:"用户标签"}),s.jsx("span",{className:"text-gray-500 text-[11px]",children:"《一场 Soul 的创业实验》维度"})]}),s.jsxs("div",{className:"mb-2 p-2 bg-[#38bdac]/5 border border-[#38bdac]/20 rounded-lg flex items-start gap-2 text-[11px] text-gray-400",children:[s.jsx(zj,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0 mt-0.5"}),"预设可点选;下方「旅程推断」由轨迹+资料自动算出,可一键并入已选后点弹窗底部保存。"]}),s.jsxs("div",{className:"mb-3 p-2 rounded-lg bg-[#162840]/80 border border-cyan-500/20",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-1.5",children:[s.jsx("span",{className:"text-cyan-300/90 text-xs font-medium",children:"旅程推断标签"}),s.jsx(G,{type:"button",size:"sm",variant:"outline",className:"h-7 text-[11px] border-cyan-500/40 text-cyan-200 hover:bg-cyan-500/10",disabled:Mr.length===0,onClick:Qr,children:"合并到已选"})]}),Mr.length>0?s.jsx("div",{className:"flex flex-wrap gap-1",children:Mr.map(le=>s.jsxs(Be,{variant:"outline",className:`text-[10px] py-0 h-5 border-cyan-500/30 ${ce.includes(le)?"bg-cyan-500/15 text-cyan-200":"text-gray-300"}`,children:[ce.includes(le)?"✓ ":"",le]},le))}):s.jsx("p",{className:"text-[11px] text-gray-500",children:"暂无推断(无轨迹或行为未命中规则)"})]}),s.jsx("div",{className:"mb-3 space-y-2",children:[{category:"身份类型",tags:["创业者","打工人","自由职业","学生","投资人","合伙人"]},{category:"行业背景",tags:["电商","内容","传统行业","科技/AI","金融","教育","餐饮"]},{category:"痛点标签",tags:["找资源","找方向","找合伙人","想赚钱","想学习","找情感出口"]},{category:"付费意愿",tags:["高意向","已付费","观望中","薅羊毛"]},{category:"MBTI",tags:["ENTJ","INTJ","ENFP","INFP","ENTP","INTP","ESTJ","ISFJ"]}].map(le=>s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-[11px] mb-1",children:le.category}),s.jsx("div",{className:"flex flex-wrap gap-1",children:le.tags.map(Ne=>s.jsxs("button",{type:"button",onClick:()=>{ce.includes(Ne)?wn(Ne):me([...ce,Ne])},className:`px-1.5 py-0.5 rounded text-[11px] border transition-all ${ce.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:[ce.includes(Ne)?"✓ ":"",Ne]},Ne))})]},le.category))}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-2",children:[s.jsx("p",{className:"text-gray-500 text-[11px] mb-1.5",children:"已选标签(需保存修改写入库)"}),s.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-2 min-h-[28px]",children:[ce.map((le,Ne)=>s.jsxs(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1 text-[11px] py-0",children:[le,s.jsx("button",{type:"button",onClick:()=>wn(le),className:"ml-1 hover:text-red-400",children:s.jsx(Yn,{className:"w-3 h-3"})})]},Ne)),ce.length===0&&s.jsx("span",{className:"text-gray-600 text-xs",children:"暂未选择"})]}),s.jsxs("div",{className:"flex gap-1.5",children:[s.jsx(de,{className:"bg-[#162840] border-gray-700 text-white flex-1 h-8 text-xs",placeholder:"自定义标签,回车添加",value:I,onChange:le=>J(le.target.value),onKeyDown:le=>le.key==="Enter"&&Jt()}),s.jsx(G,{onClick:Jt,className:"bg-[#38bdac] hover:bg-[#2da396] h-8 text-xs px-3",children:"添加"})]})]})]}),(()=>{const le=a.tags||a.ckbTags||"";let Ne=[];try{const Nt=typeof le=="string"?JSON.parse(le||"[]"):[];Ne=Array.isArray(Nt)?Nt:typeof le=="string"?le.split(","):[]}catch{Ne=typeof le=="string"?le.split(","):[]}const Xe=Ne.map(Nt=>String(Nt).trim()).filter(Boolean);return Xe.length===0?null:s.jsxs("div",{className:"p-2.5 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[s.jsx(su,{className:"w-3.5 h-3.5 text-purple-400"}),s.jsx("span",{className:"text-white text-sm font-medium",children:"存客宝标签"})]}),s.jsx("div",{className:"flex flex-wrap gap-1",children:Xe.map((Nt,Zt)=>s.jsx(Be,{className:"bg-purple-500/20 text-purple-400 border-0 text-[11px] py-0",children:Nt},Zt))})]})})()]})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-gray-700 mt-3 shrink-0",children:[s.jsxs(G,{variant:"outline",onClick:e,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"关闭"]}),s.jsxs(G,{onClick:Pt,disabled:P,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),P?"保存中...":"保存修改"]})]})]}):s.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}),s.jsx(Bt,{open:O,onOpenChange:Q,children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsx(Vt,{children:s.jsx(Ht,{children:"调整余额"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{children:[s.jsx(ne,{className:"text-gray-300 text-sm",children:"调整金额(元)"}),s.jsx(de,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"正数增加,负数扣减,如 10 或 -5",value:se,onChange:le=>ve(le.target.value)})]}),s.jsxs("div",{children:[s.jsx(ne,{className:"text-gray-300 text-sm",children:"备注(可选)"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"如:活动补偿",value:ze,onChange:le=>Ue(le.target.value)})]})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(G,{variant:"outline",onClick:()=>Q(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(G,{onClick:hr,disabled:jt,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:jt?"提交中...":"确认调整"})]})]})})]}):null}function UR(){const t=Ua(),[e,n]=y.useState(!0),[r,a]=y.useState(!0),[i,o]=y.useState(!0),[c,u]=y.useState([]),[h,f]=y.useState([]),[m,g]=y.useState(0),[b,N]=y.useState(0),[j,v]=y.useState(0),[k,T]=y.useState(0),[C,P]=y.useState(null),[L,U]=y.useState(null),[_,H]=y.useState(!1),[R,Z]=y.useState(0),[re,$]=y.useState(!1),[ie,ce]=y.useState(null),[me,I]=y.useState("overview"),[J,z]=y.useState([]),[ge,X]=y.useState(!1),[F,W]=y.useState("today"),[fe,he]=y.useState(null),[oe,D]=y.useState(!1),[q,O]=y.useState(!0),[Q,se]=y.useState(null),[ve,ze]=y.useState(null),[Ue,jt]=y.useState([]),Nn=we=>{const Te=we;if((Te==null?void 0:Te.status)===401)P("登录已过期,请重新登录");else{if((Te==null?void 0:Te.name)==="AbortError")return;P("加载失败,请检查网络或联系管理员")}};async function pt(we){var Lt,Ct;const Te=we?{signal:we}:void 0;n(!0),P(null);try{const $e=await Oe("/api/admin/dashboard/stats",Te);$e!=null&&$e.success&&(g($e.totalUsers??0),N($e.paidOrderCount??0),v($e.totalRevenue??0),T($e.conversionRate??0))}catch($e){if(($e==null?void 0:$e.name)!=="AbortError"){console.error("stats 失败,尝试 overview 降级",$e);try{const V=await Oe("/api/admin/dashboard/overview",Te);V!=null&&V.success&&(g(V.totalUsers??0),N(V.paidOrderCount??0),v(V.totalRevenue??0),T(V.conversionRate??0))}catch(V){Nn(V)}}}finally{n(!1)}try{const $e=await Oe("/api/admin/balance/summary",Te);$e!=null&&$e.success&&$e.data&&Z($e.data.totalGifted??0)}catch{}try{const $e=await Oe("/api/db/ckb-plan-stats",Te);$e!=null&&$e.success&&$e.data?ce({ckbTotal:$e.data.ckbTotal??0,withContact:$e.data.withContact??0}):ce(null)}catch{ce(null)}O(!0);try{const[$e,V]=await Promise.allSettled([Oe("/api/db/match-records?stats=true",Te),Oe("/api/admin/distribution/overview",Te)]);$e.status==="fulfilled"&&((Lt=$e.value)!=null&&Lt.success)&&$e.value.data?se({totalMatches:$e.value.data.totalMatches??0,todayMatches:$e.value.data.todayMatches??0,uniqueUsers:$e.value.data.uniqueUsers??0,paidMatchCount:$e.value.data.paidMatchCount??0}):se(null),V.status==="fulfilled"&&((Ct=V.value)!=null&&Ct.success)&&V.value.overview?ze({todayClicks:V.value.overview.todayClicks??0,todayBindings:V.value.overview.todayBindings??0,todayConversions:V.value.overview.todayConversions??0,monthClicks:V.value.overview.monthClicks??0,monthBindings:V.value.overview.monthBindings??0,monthConversions:V.value.overview.monthConversions??0,totalClicks:V.value.overview.totalClicks??0,totalBindings:V.value.overview.totalBindings??0,totalConversions:V.value.overview.totalConversions??0,conversionRate:V.value.overview.conversionRate}):ze(null)}catch{se(null),ze(null)}finally{O(!1)}try{const $e=await Oe("/api/db/vip-members?limit=500",Te);$e!=null&&$e.success&&Array.isArray($e.data)?jt($e.data):jt([])}catch{jt([])}a(!0),o(!0);const We=async()=>{try{const $e=await Oe("/api/admin/dashboard/recent-orders?limit=10",Te);if($e!=null&&$e.success&&$e.recentOrders)f($e.recentOrders);else throw new Error("no data")}catch($e){if(($e==null?void 0:$e.name)!=="AbortError")try{const V=await Oe("/api/admin/orders?page=1&pageSize=20&status=paid",Te),vt=((V==null?void 0:V.orders)??[]).filter(Dt=>["paid","completed","success"].includes(Dt.status||""));f(vt.slice(0,5))}catch{f([])}}finally{a(!1)}},at=async()=>{try{const $e=await Oe("/api/admin/dashboard/new-users",Te);if($e!=null&&$e.success&&$e.newUsers)u($e.newUsers);else throw new Error("no data")}catch($e){if(($e==null?void 0:$e.name)!=="AbortError")try{const V=await Oe("/api/db/users?page=1&pageSize=10",Te);u((V==null?void 0:V.users)??[])}catch{u([])}}finally{o(!1)}};await Promise.all([We(),at()])}async function It(we){const Te=we||F;D(!0);try{const We=await Oe(`/api/admin/track/stats?period=${Te}`);We!=null&&We.success&&he({total:We.total??0,byModule:We.byModule??{}})}catch{he(null)}finally{D(!1)}}const un={home:"首页",chapters:"目录",read:"阅读页",my:"我的",vip:"超级个体",wallet:"钱包",match:"找伙伴",referral:"推广中心",search:"搜索",settings:"设置",about:"关于",member_detail:"成员详情",other:"其他"},Bn={btn_click:"按钮点击",nav_click:"导航点击",card_click:"卡片点击",tab_click:"标签切换",page_view:"页面浏览",share:"分享",purchase:"购买",register:"注册",rule_trigger:"规则触发",view_chapter:"浏览章节",link_click:"链接点击"},hn=we=>we?we.replace(/^part-/,"").replace(/^soulvip_/,"").replace(/^super_?/,"").replace(/^user_/,"").replace(/[_-]+/g," ").trim():"",Wt=we=>{if(!we)return"";const Te=we.trim().toLowerCase();if(!Te)return"";const We=Ue.find(Lt=>{const Ct=String(Lt.id||"").toLowerCase();return Ct===Te||Ct.includes(Te)||Te.includes(Ct)});if(We)return We.name||We.nickname||"";const at=Ue.find(Lt=>{const Ct=String(Lt.token||"").toLowerCase();return Ct&&(Ct===Te||Ct.includes(Te)||Te.includes(Ct))});return at&&(at.name||at.nickname)||""},xn=we=>{if(!we)return"未命名点击";const Te=we.trim(),We=Te.toLowerCase();if(/^链接头像[_-]/.test(Te)){const Lt=hn(Te.replace(/^链接头像[_-]/,""));return Lt?`头像:${Lt}`:"头像点击"}if(/^member[_-]?detail$/i.test(We)||We.includes("member detail"))return"成员详情";if(/^giftpay$/i.test(We)||We.includes("gift pay"))return"代付入口";if(/^part[-_]/i.test(We))return`章节:${hn(Te)}`;if(We.includes("soulvip")||We.includes("super")){const Lt=Te.replace(/^超级个体[::]?/i,"").replace(/^super[_-]?/i,"").replace(/^soulvip[_-]?/i,"").replace(/^user[_-]?/i,"").trim(),Ct=Wt(Lt)||Wt(hn(Lt));return Ct?`超级个体:${Ct}`:`超级个体:${hn(Lt)}`}if(We.includes("qgdtw")||We.includes("token")||We.includes("0000"))return`对象:${hn(Te)}`;const at={开始匹配:"开始匹配",mentor:"导师顾问",team:"团队招募",investor:"资源对接",充值:"充值",退款:"退款",wallet:"钱包",设置:"设置",VIP:"VIP会员",推广:"推广中心",目录:"目录",搜索:"搜索",匹配:"找伙伴",settings:"设置",expired:"已过期",active:"活跃",converted:"已转化",fill_profile:"完善资料",register:"注册",purchase:"购买",链接卡若:"链接卡若",更多分享:"更多分享",分享朋友圈文案:"分享朋友圈",选择金额10:"选择金额10元",member_detail:"成员详情",giftPay:"代付入口"};return at[Te]?at[Te]:/^[a-z0-9_-]+$/i.test(Te)&&hn(Te)||Te},En=we=>{const Te=un[we.module]||un[we.page]||we.module||we.page||"其他",We=Bn[we.action]||we.action||"点击",at=xn(we.target);return`${Te} · ${We} · ${at}`};async function Vn(){X(!0);try{const we=await Oe("/api/admin/super-individual/stats");we!=null&&we.success&&Array.isArray(we.data)&&z(we.data)}catch{}finally{X(!1)}}y.useEffect(()=>{const we=new AbortController;return pt(we.signal),It(),Vn(),()=>{we.abort()}},[]);const Zn=m,Rt=we=>{const Te=we.productType||"",We=we.description||"";if(Te==="balance_recharge")return{title:`余额充值 ¥${typeof we.amount=="number"?we.amount.toFixed(2):parseFloat(String(we.amount||"0")).toFixed(2)}`,subtitle:"余额充值"};if(Te==="gift_pay")return{title:`代付 ¥${typeof we.amount=="number"?we.amount.toFixed(2):parseFloat(String(we.amount||"0")).toFixed(2)}`,subtitle:"好友代付"};if(Te==="gift_pay_batch"){const at=typeof we.amount=="number"?we.amount.toFixed(2):parseFloat(String(we.amount||"0")).toFixed(2);return{title:We||`代付分享 ¥${at}`,subtitle:"代付分享"}}if(Te==="section"&&We.includes("代付领取"))return{title:We.replace("代付领取 - ",""),subtitle:"代付领取"};if(We){if(Te==="section"&&We.includes("章节")){if(We.includes("-")){const at=We.split("-");if(at.length>=3)return{title:`第${at[1]}章 第${at[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:We,subtitle:"章节购买"}}return Te==="fullbook"||We.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:Te==="vip"||We.includes("VIP")?{title:"超级个体开通费用",subtitle:"超级个体"}:Te==="match"||We.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:We,subtitle:Te==="section"?"单章":Te==="fullbook"?"全书":"其他"}}return Te==="section"?{title:`章节 ${we.productId||""}`,subtitle:"单章购买"}:Te==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:Te==="vip"?{title:"超级个体开通费用",subtitle:"超级个体"}:Te==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:Te||"其他"}},yn=[{title:"总用户数",value:e?null:Zn,sub:null,icon:Un,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:e?null:`¥${(j??0).toFixed(2)}`,sub:R>0?`含代付 ¥${R.toFixed(2)}`:null,icon:wf,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:e?null:b,sub:null,icon:nu,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:e?null:`${typeof k=="number"?k.toFixed(1):0}%`,sub:null,icon:dr,color:"text-orange-400",bg:"bg-orange-500/20",link:"/distribution"},{title:"存客宝获客",value:ie?ie.ckbTotal??0:null,sub:(ie==null?void 0:ie.withContact)!=null?`含联系方式 ${ie.withContact} 人`:null,icon:_c,color:"text-cyan-400",bg:"bg-cyan-500/20",link:"/users?tab=leads"},{title:"伙伴&推广协同",value:q?null:((Q==null?void 0:Q.totalMatches)??0)+((ve==null?void 0:ve.totalClicks)??0),sub:q?null:`找伙伴 ${(Q==null?void 0:Q.totalMatches)??0} / 推广 ${(ve==null?void 0:ve.totalClicks)??0}`,icon:Hd,color:"text-emerald-400",bg:"bg-emerald-500/20",link:"/find-partner"}];return s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),C&&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:C}),s.jsx("button",{type:"button",onClick:()=>pt(),className:"text-amber-400 hover:text-amber-300 underline",children:"重试"})]}),s.jsx("div",{className:"grid gap-6 mb-8 grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 xl:grid-cols-6",children:yn.map((we,Te)=>s.jsxs(De,{className:"min-w-0 bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>we.link&&t(we.link),children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsx(ht,{className:"text-sm font-medium text-gray-400",children:we.title}),s.jsx("div",{className:`p-2 rounded-lg ${we.bg}`,children:s.jsx(we.icon,{className:`w-4 h-4 ${we.color}`})})]}),s.jsx(_e,{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:we.value!=null?we.value:s.jsxs("span",{className:"inline-flex items-center gap-2 text-gray-500",children:[s.jsx(He,{className:"w-4 h-4 animate-spin"}),"加载中"]})}),we.sub&&s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:we.sub})]}),s.jsx(vl,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},Te))}),s.jsxs("div",{className:"flex gap-2 mb-6 mt-2",children:[s.jsx("button",{type:"button",onClick:()=>I("overview"),className:`px-5 py-2 rounded-lg text-sm font-medium transition-colors ${me==="overview"?"bg-[#38bdac] text-white":"bg-[#0f2137] text-gray-400 hover:text-white hover:bg-gray-700/50 border border-gray-700/50"}`,children:"数据概览"}),s.jsx("button",{type:"button",onClick:()=>I("tags"),className:`px-5 py-2 rounded-lg text-sm font-medium transition-colors ${me==="tags"?"bg-[#38bdac] text-white":"bg-[#0f2137] text-gray-400 hover:text-white hover:bg-gray-700/50 border border-gray-700/50"}`,children:"用户标签点击统计"}),s.jsx("button",{type:"button",onClick:()=>I("super"),className:`px-5 py-2 rounded-lg text-sm font-medium transition-colors ${me==="super"?"bg-[#38bdac] text-white":"bg-[#0f2137] text-gray-400 hover:text-white hover:bg-gray-700/50 border border-gray-700/50"}`,children:"超级个体统计"})]}),me==="overview"&&s.jsxs("div",{className:"space-y-8",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between",children:[s.jsx(ht,{className:"text-white",children:"找伙伴 × 推广中心(共统计)"}),s.jsxs("button",{type:"button",onClick:()=>pt(),disabled:q,className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1 disabled:opacity-50",title:"刷新共统计",children:[s.jsx(He,{className:`w-3.5 h-3.5 ${q?"animate-spin":""}`}),"刷新"]})]}),s.jsxs(_e,{children:[q&&!Q&&!ve?s.jsxs("div",{className:"flex items-center justify-center py-10 text-gray-500",children:[s.jsx(He,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-6 gap-4",children:[s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"找伙伴总匹配"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(Q==null?void 0:Q.totalMatches)??0})]}),s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"找伙伴今日"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(Q==null?void 0:Q.todayMatches)??0})]}),s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"找伙伴用户数"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(Q==null?void 0:Q.uniqueUsers)??0})]}),s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"推广总点击"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(ve==null?void 0:ve.totalClicks)??0})]}),s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"推广总绑定"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(ve==null?void 0:ve.totalBindings)??0})]}),s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"推广总转化"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(ve==null?void 0:ve.totalConversions)??0})]})]}),(ve==null?void 0:ve.conversionRate)&&s.jsxs("p",{className:"text-xs text-gray-500 mt-3",children:["推广转化率:",ve.conversionRate]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between",children:[s.jsx(ht,{className:"text-white",children:"最近订单"}),s.jsxs("button",{type:"button",onClick:()=>pt(),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(He,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(He,{className:"w-3.5 h-3.5"}),"刷新"]})]}),s.jsx(_e,{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(He,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[h.slice(0,re?10:4).map(we=>{var Ct;const Te=we.referrerId?c.find($e=>$e.id===we.referrerId):void 0,We=we.referralCode||(Te==null?void 0:Te.referralCode)||(Te==null?void 0:Te.nickname)||(we.referrerId?String(we.referrerId).slice(0,8):""),at=Rt(we),Lt=we.userNickname||((Ct=c.find($e=>$e.id===we.userId))==null?void 0:Ct.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:[we.userAvatar?s.jsx("img",{src:we.userAvatar,alt:Lt,className:"w-9 h-9 rounded-full object-cover shrink-0 mt-0.5",onError:$e=>{$e.currentTarget.style.display="none";const V=$e.currentTarget.nextElementSibling;V&&V.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] shrink-0 mt-0.5 ${we.userAvatar?"hidden":""}`,children:Lt.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:()=>{we.userId&&(U(we.userId),H(!0))},className:"text-sm text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:Lt}),s.jsx("span",{className:"text-gray-600",children:"·"}),s.jsx("span",{className:"text-sm font-medium text-white truncate",title:at.title,children:at.title})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[at.subtitle&&at.subtitle!=="章节购买"&&s.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:at.subtitle}),s.jsx("span",{children:new Date(we.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),We&&s.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",We]})]})]}),s.jsxs("div",{className:"text-right ml-4 shrink-0",children:[s.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(we.amount).toFixed(2)]}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:we.paymentMethod||"微信"})]})]},we.id)}),h.length>4&&!re&&s.jsx("button",{type:"button",onClick:()=>$(!0),className:"w-full py-2 text-sm text-[#38bdac] hover:text-[#2da396] border border-dashed border-gray-600 rounded-lg hover:border-[#38bdac]/50 transition-colors",children:"展开更多"}),h.length===0&&!r&&s.jsxs("div",{className:"text-center py-12",children:[s.jsx(nu,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(ut,{children:s.jsx(ht,{className:"text-white",children:"新注册用户"})}),s.jsx(_e,{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(He,{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(we=>{var Te;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:((Te=we.nickname)==null?void 0:Te.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("button",{type:"button",onClick:()=>{U(we.id),H(!0)},className:"text-sm font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:we.nickname||"匿名用户"}),s.jsx("p",{className:"text-xs text-gray-500",children:we.phone||"未绑定手机"})]})]}),s.jsx("p",{className:"text-xs text-gray-400",children:we.createdAt?new Date(we.createdAt).toLocaleDateString():"-"})]},we.id)}),c.length===0&&!i&&s.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})})]})]})]}),me==="tags"&&s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between",children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Hd,{className:"w-5 h-5 text-[#38bdac]"}),"分类标签点击统计"]}),s.jsx("div",{className:"flex items-center gap-2",children:["today","week","month","all"].map(we=>s.jsx("button",{type:"button",onClick:()=>{W(we),It(we)},className:`px-3 py-1 text-xs rounded-full transition-colors ${F===we?"bg-[#38bdac] text-white":"bg-gray-700/50 text-gray-400 hover:bg-gray-700"}`,children:{today:"今日",week:"本周",month:"本月",all:"全部"}[we]},we))})]}),s.jsx(_e,{children:oe&&!fe?s.jsxs("div",{className:"flex items-center justify-center py-12 text-gray-500",children:[s.jsx(He,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):fe&&Object.keys(fe.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:fe.total})," 次"]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Object.entries(fe.byModule).sort((we,Te)=>Te[1].reduce((We,at)=>We+at.count,0)-we[1].reduce((We,at)=>We+at.count,0)).slice(0,5).map(([we,Te])=>{const We=Te.reduce((at,Lt)=>at+Lt.count,0);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:un[we]||we}),s.jsxs("span",{className:"text-xs text-gray-500",children:[We," 次"]})]}),s.jsx("div",{className:"space-y-2",children:Te.sort((at,Lt)=>Lt.count-at.count).slice(0,8).map((at,Lt)=>{const Ct=En(at);return s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-gray-300 truncate mr-2",title:Ct,children:Ct}),s.jsxs("div",{className:"flex items-center gap-2 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:`${We>0?at.count/We*100:0}%`}})}),s.jsx("span",{className:"text-gray-400 w-8 text-right",children:at.count})]})]},Lt)})})]},we)})})]}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Hd,{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:"小程序端接入埋点后,数据将在此实时展示"})]})})]}),me==="super"&&s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between",children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Hd,{className:"w-5 h-5 text-amber-400"}),"超级个体点击统计"]}),s.jsxs(G,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-300 h-8",onClick:Vn,disabled:ge,children:[s.jsx(He,{className:`w-3.5 h-3.5 mr-1 ${ge?"animate-spin":""}`}),"刷新"]})]}),s.jsx(_e,{children:ge&&J.length===0?s.jsxs("div",{className:"flex items-center justify-center py-12 text-gray-500",children:[s.jsx(He,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):J.length>0?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:"text-xs text-gray-400 border-b border-gray-700/50",children:[s.jsx("th",{className:"text-left py-2 px-3 font-normal",children:"排名"}),s.jsx("th",{className:"text-left py-2 px-3 font-normal",children:"超级个体"}),s.jsx("th",{className:"text-center py-2 px-3 font-normal",children:"总点击"}),s.jsx("th",{className:"text-center py-2 px-3 font-normal",children:"独立访客"}),s.jsx("th",{className:"text-center py-2 px-3 font-normal",children:"人均点击"}),s.jsx("th",{className:"text-center py-2 px-3 font-normal",title:"该用户绑定 @人物 后,指向其 person 的留资独立人数",children:"获客(去重)"}),s.jsx("th",{className:"text-left py-2 px-3 font-normal",children:"手机号"})]})}),s.jsx("tbody",{children:J.map((we,Te)=>s.jsxs("tr",{className:"border-b border-gray-700/30 hover:bg-[#0a1628]/80",children:[s.jsx("td",{className:"py-2 px-3 text-gray-500 text-xs",children:Te+1}),s.jsx("td",{className:"py-2 px-3",children:s.jsxs("div",{className:"flex items-center gap-2",children:[we.avatar?s.jsx("img",{src:we.avatar,alt:"",className:"w-7 h-7 rounded-full object-cover"}):s.jsx("div",{className:"w-7 h-7 rounded-full bg-gray-700 flex items-center justify-center text-xs text-gray-400",children:"?"}),s.jsx("button",{type:"button",className:"text-amber-400 hover:text-amber-300 hover:underline text-left text-sm truncate max-w-[160px]",onClick:()=>t(`/users?search=${encodeURIComponent(we.nickname||we.userId)}`),title:"点击跳转用户管理",children:we.nickname||we.userId})]})}),s.jsx("td",{className:"py-2 px-3 text-center text-white font-bold",children:we.clicks}),s.jsx("td",{className:"py-2 px-3 text-center text-[#38bdac]",children:we.uniqueClicks}),s.jsx("td",{className:"py-2 px-3 text-center text-gray-400",children:we.uniqueClicks>0?(we.clicks/we.uniqueClicks).toFixed(1):"-"}),s.jsx("td",{className:"py-2 px-3 text-center text-green-400 text-xs font-medium",children:typeof we.leadCount=="number"?we.leadCount:0}),s.jsx("td",{className:"py-2 px-3 text-gray-400 text-xs",children:we.phone||"-"})]},we.userId))})]})}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Hd,{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(ry,{open:_,onClose:()=>{H(!1),U(null)},userId:L,onUserUpdated:()=>pt()})]})}const vs=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{className:"relative w-full overflow-auto",children:s.jsx("table",{ref:n,className:Ot("w-full caption-bottom text-sm",t),...e})}));vs.displayName="Table";const Ns=y.forwardRef(({className:t,...e},n)=>s.jsx("thead",{ref:n,className:Ot("[&_tr]:border-b",t),...e}));Ns.displayName="TableHeader";const ws=y.forwardRef(({className:t,...e},n)=>s.jsx("tbody",{ref:n,className:Ot("[&_tr:last-child]:border-0",t),...e}));ws.displayName="TableBody";const bt=y.forwardRef(({className:t,...e},n)=>s.jsx("tr",{ref:n,className:Ot("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));bt.displayName="TableRow";const Se=y.forwardRef(({className:t,...e},n)=>s.jsx("th",{ref:n,className:Ot("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));Se.displayName="TableHead";const ke=y.forwardRef(({className:t,...e},n)=>s.jsx("td",{ref:n,className:Ot("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));ke.displayName="TableCell";function _l(t,e){const[n,r]=y.useState(t);return y.useEffect(()=>{const a=setTimeout(()=>r(t),e);return()=>clearTimeout(a)},[t,e]),n}function cr({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 WR(){const[t,e]=y.useState([]),[n,r]=y.useState([]),[a,i]=y.useState(0),[o,c]=y.useState(0),[u,h]=y.useState(0),[f,m]=y.useState(1),[g,b]=y.useState(10),[N,j]=y.useState(""),v=_l(N,300),[k,T]=y.useState("all"),[C,P]=y.useState(!0),[L,U]=y.useState(null),[_,H]=y.useState(null),[R,Z]=y.useState(""),[re,$]=y.useState(!1);async function ie(){P(!0),U(null);try{const X=k==="all"?"":k==="completed"?"completed":k,F=new URLSearchParams({page:String(f),pageSize:String(g),...X&&{status:X},...v&&{search:v}}),[W,fe]=await Promise.all([Oe(`/api/admin/orders?${F}`),Oe("/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)),fe!=null&&fe.success&&fe.users&&r(fe.users)}catch(X){console.error("加载订单失败",X),U("加载订单失败,请检查网络后重试")}finally{P(!1)}}y.useEffect(()=>{m(1)},[v,k]),y.useEffect(()=>{ie()},[f,g,v,k]);const ce=X=>{var F;return X.userNickname||((F=n.find(W=>W.id===X.userId))==null?void 0:F.nickname)||"匿名用户"},me=X=>{var F;return((F=n.find(W=>W.id===X))==null?void 0:F.phone)||"-"},I=X=>{const F=X.productType||X.type||"",W=X.description||"";if(F==="balance_recharge")return{name:`余额充值 ¥${Number(X.amount||0).toFixed(2)}`,type:"余额充值"};if(W){if(F==="section"&&(W.includes("章节")||W.includes("代付领取"))){if(W.includes("代付领取"))return{name:W.replace("代付领取 - ",""),type:"代付领取"};if(W.includes("-")){const fe=W.split("-");if(fe.length>=3)return{name:`第${fe[1]}章 第${fe[2]}节`,type:"《一场Soul的创业实验》"}}return{name:W,type:"章节购买"}}return F==="fullbook"||W.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:F==="vip"||W.includes("VIP")?{name:"超级个体开通费用",type:"超级个体"}:F==="match"||W.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:W,type:"其他"}}return F==="section"?{name:`章节 ${X.productId||X.sectionId||""}`,type:"单章"}:F==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:F==="vip"?{name:"超级个体开通费用",type:"超级个体"}:F==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:F||"其他"}},J=Math.ceil(a/g)||1;async function z(){var X;if(!(!(_!=null&&_.orderSn)&&!(_!=null&&_.id))){$(!0),U(null);try{const F=await Yt("/api/admin/orders/refund",{orderSn:_.orderSn||_.id,reason:R||void 0});F!=null&&F.success?(H(null),Z(""),ie()):U((F==null?void 0:F.error)||"退款失败")}catch(F){const W=F;U(((X=W==null?void 0:W.data)==null?void 0:X.error)||"退款失败,请检查网络后重试")}finally{$(!1)}}}function ge(){if(t.length===0){Y.info("暂无数据可导出");return}const X=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],F=t.map(D=>{const q=I(D);return[D.orderSn||D.id||"",ce(D),me(D.userId),q.name,Number(D.amount||0).toFixed(2),D.paymentMethod==="wechat"?"微信支付":D.paymentMethod==="balance"?"余额支付":D.paymentMethod==="alipay"?"支付宝":D.paymentMethod||"微信支付",D.status==="refunded"?"已退款":D.status==="paid"||D.status==="completed"?"已完成":D.status==="pending"||D.status==="created"?"待支付":"已失败",D.status==="refunded"&&D.refundReason?D.refundReason:"-",D.referrerEarnings?Number(D.referrerEarnings).toFixed(2):"-",D.createdAt?new Date(D.createdAt).toLocaleString("zh-CN"):""].join(",")}),W="\uFEFF"+[X.join(","),...F].join(` +`),fe=new Blob([W],{type:"text/csv;charset=utf-8"}),he=URL.createObjectURL(fe),oe=document.createElement("a");oe.href=he,oe.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,oe.click(),URL.revokeObjectURL(he)}return s.jsxs("div",{className:"p-8 w-full",children:[L&&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:L}),s.jsx("button",{type:"button",onClick:()=>U(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(G,{variant:"outline",onClick:ie,disabled:C,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${C?"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(za,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(de,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:N,onChange:X=>j(X.target.value)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Uj,{className:"w-4 h-4 text-gray-400"}),s.jsxs("select",{value:k,onChange:X=>T(X.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(G,{variant:"outline",onClick:ge,disabled:t.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(M5,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:C?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{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(vs,{children:[s.jsx(Ns,{children:s.jsxs(bt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Se,{className:"text-gray-400",children:"订单号"}),s.jsx(Se,{className:"text-gray-400",children:"用户"}),s.jsx(Se,{className:"text-gray-400",children:"商品"}),s.jsx(Se,{className:"text-gray-400",children:"金额"}),s.jsx(Se,{className:"text-gray-400",children:"支付方式"}),s.jsx(Se,{className:"text-gray-400",children:"状态"}),s.jsx(Se,{className:"text-gray-400",children:"退款原因"}),s.jsx(Se,{className:"text-gray-400",children:"分销佣金"}),s.jsx(Se,{className:"text-gray-400",children:"下单时间"}),s.jsx(Se,{className:"text-gray-400",children:"操作"})]})}),s.jsxs(ws,{children:[t.map(X=>{const F=I(X);return s.jsxs(bt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsxs(ke,{className:"font-mono text-xs text-gray-400",children:[(X.orderSn||X.id||"").slice(0,12),"..."]}),s.jsx(ke,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[ce(X),X.paymentMethod==="gift_pay"&&s.jsx(Be,{className:"bg-emerald-500/20 text-emerald-400 hover:bg-emerald-500/20 border-0 text-xs",children:"代付领取"}),X.payerUserId&&X.paymentMethod!=="gift_pay"&&s.jsx(Be,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"代付"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:me(X.userId)}),X.payerUserId&&X.payerNickname&&s.jsxs("p",{className:"text-amber-400/80 text-xs mt-0.5",children:[X.paymentMethod==="gift_pay"?"赠送人:":"代付人:",X.payerNickname]})]})}),s.jsx(ke,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[F.name,(X.productType||X.type)==="vip"&&s.jsx(Be,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"超级个体"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:F.type})]})}),s.jsxs(ke,{className:"text-[#38bdac] font-bold",children:["¥",Number(X.amount||0).toFixed(2)]}),s.jsx(ke,{className:"text-gray-300",children:X.paymentMethod==="wechat"?"微信支付":X.paymentMethod==="balance"?"余额支付":X.paymentMethod==="alipay"?"支付宝":X.paymentMethod||"微信支付"}),s.jsx(ke,{children:s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[X.status==="refunded"?s.jsx(Be,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):X.status==="paid"||X.status==="completed"?s.jsx(Be,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):X.status==="pending"||X.status==="created"?s.jsx(Be,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):s.jsx(Be,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"}),(X.status==="paid"||X.status==="completed")&&(X.webhookPushStatus==="sent"?s.jsx(Be,{className:"bg-emerald-500/20 text-emerald-300 hover:bg-emerald-500/20 border-0",children:"已推送"}):s.jsx(Be,{className:"bg-orange-500/20 text-orange-300 hover:bg-orange-500/20 border-0",children:"待补推"}))]})}),s.jsx(ke,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:X.refundReason,children:X.status==="refunded"&&X.refundReason?X.refundReason:"-"}),s.jsx(ke,{className:"text-[#FFD700]",children:X.referrerEarnings?`¥${Number(X.referrerEarnings).toFixed(2)}`:"-"}),s.jsx(ke,{className:"text-gray-400 text-sm",children:new Date(X.createdAt).toLocaleString("zh-CN")}),s.jsx(ke,{children:(X.status==="paid"||X.status==="completed")&&X.paymentMethod!=="balance"&&s.jsxs(G,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{H(X),Z("")},children:[s.jsx(qj,{className:"w-3 h-3 mr-1"}),"退款"]})})]},X.id)}),t.length===0&&s.jsx(bt,{children:s.jsx(ke,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),s.jsx(cr,{page:f,totalPages:J,total:a,pageSize:g,onPageChange:m,onPageSizeChange:X=>{b(X),m(1)}})]})})}),s.jsx(Bt,{open:!!_,onOpenChange:X=>!X&&H(null),children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Vt,{children:s.jsx(Ht,{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(de,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:R,onChange:X=>Z(X.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(gn,{children:[s.jsx(G,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>H(null),disabled:re,children:"取消"}),s.jsx(G,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:z,disabled:re,children:re?"退款中...":"确认退款"})]})]})})]})}const $l=y.forwardRef(({className:t,...e},n)=>s.jsx("textarea",{className:Ot("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}));$l.displayName="Textarea";const Y1=["INTJ","INTP","ENTJ","ENTP","INFJ","INFP","ENFJ","ENFP","ISTJ","ISFJ","ESTJ","ESFJ","ISTP","ISFP","ESTP","ESFP"],p2={INTJ:{title:"战略家",group:"NT",mood:"sharp"},INTP:{title:"逻辑学家",group:"NT",mood:"calm"},ENTJ:{title:"指挥官",group:"NT",mood:"sharp"},ENTP:{title:"辩论家",group:"NT",mood:"playful"},INFJ:{title:"提倡者",group:"NF",mood:"warm"},INFP:{title:"调停者",group:"NF",mood:"warm"},ENFJ:{title:"主人公",group:"NF",mood:"warm"},ENFP:{title:"竞选者",group:"NF",mood:"playful"},ISTJ:{title:"物流师",group:"SJ",mood:"calm"},ISFJ:{title:"守卫者",group:"SJ",mood:"warm"},ESTJ:{title:"总经理",group:"SJ",mood:"sharp"},ESFJ:{title:"执政官",group:"SJ",mood:"warm"},ISTP:{title:"鉴赏家",group:"SP",mood:"sharp"},ISFP:{title:"探险家",group:"SP",mood:"playful"},ESTP:{title:"企业家",group:"SP",mood:"playful"},ESFP:{title:"表演者",group:"SP",mood:"playful"}};function KR(t){switch(t){case"NT":return{bg:"#0d1424",body:"#c89a2c",accent:"#ffd66b",hair:"#6d540f",line:"#111827"};case"NF":return{bg:"#0a1721",body:"#2e9f7c",accent:"#84e9c9",hair:"#2d6a4f",line:"#11212a"};case"SJ":return{bg:"#101828",body:"#4f8cb8",accent:"#9bd4ff",hair:"#2e4a66",line:"#111f2d"};case"SP":return{bg:"#161225",body:"#8b6bc0",accent:"#ccb3ff",hair:"#574183",line:"#211832"};default:return{bg:"#0e1422",body:"#38bdac",accent:"#7ee7db",hair:"#1f6f66",line:"#10202d"}}}function qR(t){switch(t){case"sharp":return{eye:"M222 222 L242 220 M270 220 L290 222",brow:"M218 210 L244 202 M268 202 L294 210",mouth:"M234 256 Q256 246 278 256",tilt:-5};case"warm":return{eye:"M222 224 Q232 230 242 224 M270 224 Q280 230 290 224",brow:"M220 210 Q232 206 244 210 M268 210 Q280 206 292 210",mouth:"M232 254 Q256 272 280 254",tilt:2};case"playful":return{eye:"M222 224 Q232 236 242 224 M270 224 Q280 236 290 224",brow:"M220 210 Q234 200 246 208 M266 208 Q278 200 292 210",mouth:"M232 256 Q256 266 280 250",tilt:8};default:return{eye:"M222 224 Q232 220 242 224 M270 224 Q280 220 290 224",brow:"M220 210 Q232 208 244 210 M268 210 Q280 208 292 210",mouth:"M236 256 Q256 260 276 256",tilt:0}}}function GR(t){switch(t){case"sharp":return"M168 370 L206 300 L256 332 L306 300 L344 370 L306 392 L256 374 L206 392 Z";case"warm":return"M166 368 Q188 318 226 314 L256 340 L286 314 Q324 318 346 368 L314 392 Q286 404 256 396 Q226 404 198 392 Z";case"playful":return"M164 370 L198 304 L252 332 L318 300 L350 374 L316 394 L258 378 L196 396 Z";default:return"M166 370 L202 306 L256 336 L310 306 L346 370 L310 392 L256 380 L202 392 Z"}}function X1(t){const e=p2[t],n=KR(e.group),r=qR(e.mood),a=GR(e.mood),i=` + + + + + + + + + + + + + + + + + + + + + + + + + +`;return`data:image/svg+xml;utf8,${encodeURIComponent(i)}`}function JR(){const[t,e]=y.useState({}),[n,r]=y.useState(!0),[a,i]=y.useState(!1),[o,c]=y.useState(!1),u=y.useCallback(async()=>{r(!0);try{const g=await Oe("/api/admin/mbti-avatars");g!=null&&g.avatars?e(g.avatars):e({})}catch{Y.error("加载 MBTI 头像配置失败")}finally{r(!1)}},[]);y.useEffect(()=>{u()},[u]);const h=async()=>{i(!0);try{const g=await kt("/api/admin/mbti-avatars",{avatars:t});if(!g||g.success===!1){Y.error((g==null?void 0:g.error)||"保存失败");return}Y.success("已保存,后台与小程序默认头像同步生效"),u()}catch{Y.error("保存失败")}finally{i(!1)}},f=g=>{const b=X1(g);e(N=>({...N,[g]:b})),Y.success(`${g} 已生成`)},m=()=>{c(!0);try{const g={...t};Y1.forEach(b=>{g[b]=X1(b)}),e(g),Y.success("16 型头像已生成(仅人物)")}finally{c(!1)}};return n?s.jsxs("div",{className:"flex items-center justify-center py-16 text-gray-400",children:[s.jsx(He,{className:"w-5 h-5 mr-2 animate-spin text-[#38bdac]"}),"加载配置…"]}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs(De,{className:"bg-[#0f2137] border-[#38bdac]/25 shadow-xl",children:[s.jsxs(ut,{className:"pb-2",children:[s.jsxs(ht,{className:"text-white flex items-center gap-2 text-lg",children:[s.jsx(nA,{className:"w-5 h-5 text-[#38bdac]"}),"MBTI 头像库"]}),s.jsx(Xt,{className:"text-gray-400 text-sm leading-relaxed",children:"采用人物化风格,按 MBTI 性格自动生成。头像内不显示中英文,仅显示人物形象,颜色与站点主题融合。"})]}),s.jsxs(_e,{className:"flex flex-wrap gap-2",children:[s.jsxs(G,{type:"button",size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396]",onClick:m,disabled:o,children:[s.jsx(SA,{className:"w-3.5 h-3.5 mr-1"}),o?"生成中…":"一键生成16头像"]}),s.jsxs(G,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-300",onClick:u,children:[s.jsx(He,{className:"w-3.5 h-3.5 mr-1"}),"重新加载"]}),s.jsxs(G,{type:"button",size:"sm",className:"bg-emerald-600 hover:bg-emerald-500",onClick:h,disabled:a,children:[s.jsx(Cn,{className:"w-3.5 h-3.5 mr-1"}),a?"保存中…":"保存映射"]})]})]}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:Y1.map(g=>{const b=t[g]??"",N=p2[g];return s.jsxs("div",{className:"rounded-xl border border-gray-700/60 bg-[#0a1628] p-3 flex flex-col gap-2 hover:border-[#38bdac]/35 transition-colors",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 font-mono text-xs",children:g}),s.jsx("span",{className:"text-xs text-gray-400 truncate",title:N.title,children:N.title})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-16 h-16 rounded-full shrink-0 overflow-hidden flex items-center justify-center bg-[#081322] ring-2 ring-[#38bdac]/40 ring-offset-2 ring-offset-[#0a1628]",children:b?s.jsx("img",{src:b,alt:g,className:"w-full h-full object-cover scale-110"}):s.jsx("span",{className:"text-gray-600 text-[10px]",children:"未配"})}),s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx(de,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"https://... 或 data:image/...",value:b,onChange:j=>e(v=>({...v,[g]:j.target.value}))})})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(G,{type:"button",size:"sm",variant:"outline",className:"h-7 text-[11px] border-[#38bdac]/40 text-[#38bdac]",onClick:()=>f(g),children:"生成这张"}),s.jsx(G,{type:"button",size:"sm",variant:"ghost",className:"h-7 text-[11px] text-gray-400",onClick:()=>e(j=>({...j,[g]:""})),children:"清空"})]})]},g)})})]})}const Z1=[{value:"after_login",label:"注册/登录成功",group:"用户状态"},{value:"bind_phone",label:"绑定手机号",group:"用户状态"},{value:"update_avatar",label:"完善头像(非默认图,与昵称分开配置)",group:"用户状态"},{value:"update_nickname",label:"修改昵称(非默认微信昵称,与头像分开)",group:"用户状态"},{value:"fill_profile",label:"完善资料(MBTI/行业/职位,不含头像昵称)",group:"用户状态"},{value:"view_chapter",label:"浏览章节",group:"阅读行为"},{value:"browse_5_chapters",label:"累计浏览5个章节",group:"阅读行为"},{value:"purchase_section",label:"购买单章",group:"付费行为"},{value:"purchase_fullbook",label:"购买全书/VIP",group:"付费行为"},{value:"after_pay",label:"任意付款成功",group:"付费行为"},{value:"after_match",label:"完成派对匹配",group:"社交行为"},{value:"click_super_individual",label:"点击超级个体头像",group:"社交行为"},{value:"lead_submit",label:"提交留资/链接",group:"社交行为"},{value:"referral_bind",label:"被推荐人绑定",group:"分销行为"},{value:"share_action",label:"分享给好友/朋友圈",group:"分销行为"},{value:"withdraw_request",label:"申请提现",group:"分销行为"},{value:"add_wechat",label:"添加微信联系方式",group:"用户状态"}],eN=[{value:"popup",label:"弹窗提示",desc:"在小程序内弹窗引导用户完成下一步"},{value:"navigate",label:"跳转页面",desc:"引导用户跳转到指定页面"},{value:"webhook",label:"推送飞书群",desc:"触发后推送消息到飞书群Webhook"},{value:"tag",label:"自动打标签",desc:"触发后自动给用户打上指定标签"}];function m2(t){if(Array.isArray(t))return t.filter(e=>typeof e=="string");if(typeof t=="string")try{const e=JSON.parse(t);if(Array.isArray(e))return e.filter(n=>typeof n=="string")}catch{try{const e=typeof atob=="function"?atob(t):"",n=JSON.parse(e);if(Array.isArray(n))return n.filter(r=>typeof r=="string")}catch{}}return[]}function QR(t){return{...t,triggerConditions:m2(t.triggerConditions)}}const YR=[{level:"S",range:"≥85",label:"高价值"},{level:"A",range:"70–84",label:"优质"},{level:"B",range:"50–69",label:"中等"},{level:"C",range:"30–49",label:"潜力"},{level:"D",range:"<30",label:"待激活"}],Cc=[{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 tN(t){return confirm(`确定删除该${t}?此操作不可恢复。`)?window.prompt(`请输入「删除」以确认删除${t}`)==="删除":!1}function XR({userId:t,userAvatar:e,nickname:n,name:r,onOpenDetail:a}){const[i,o]=y.useState(!1),c=n||r||"-",u=(c==="-"?"?":c).charAt(0),h=!!(e!=null&&e.trim())&&!i;return s.jsxs("div",{className:"flex items-center gap-2 min-w-0 max-w-[220px]",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/15 flex items-center justify-center text-xs font-medium text-[#38bdac] flex-shrink-0 overflow-hidden border border-gray-600/50","aria-hidden":!0,children:h?s.jsx("img",{src:pa(e),alt:"",className:"w-full h-full object-cover",onError:()=>o(!0)}):s.jsx("span",{children:u})}),s.jsx("button",{type:"button",className:`text-left truncate min-w-0 ${t?"hover:text-[#38bdac] cursor-pointer":"cursor-default text-gray-300"}`,disabled:!t,title:t?"查看用户详情":void 0,onClick:()=>{t&&a(t)},children:c})]})}function ZR(t){const e=(t||"").trim();if(!e)return"";try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function e8(){var Hi,Bu,pd,md,gd,xd,yd;const[t,e]=H0(),n=t.get("pool"),r=t.get("tab")||"users",a=["users","journey","rules","vip-roles","leads"].includes(r)?r:"users",i=(t.get("leadAction")||"").trim(),[o,c]=y.useState([]),[u,h]=y.useState(0),[f,m]=y.useState(1),[g,b]=y.useState(10),[N,j]=y.useState(""),v=_l(N,300),k=n==="vip"?"vip":n==="complete"?"complete":"all",[T,C]=y.useState(k),[P,L]=y.useState(!0),[U,_]=y.useState(!1),[H,R]=y.useState(null),[Z,re]=y.useState(!1),[$,ie]=y.useState(!1),[ce,me]=y.useState("desc");y.useEffect(()=>{n==="vip"?C("vip"):n==="complete"?C("complete"):n==="all"&&C("all")},[n]);const[I,J]=y.useState(!1),[z,ge]=y.useState(null),[X,F]=y.useState(!1),[W,fe]=y.useState(!1),[he,oe]=y.useState({referrals:[],stats:{}}),[D,q]=y.useState(!1),[O,Q]=y.useState(null),[se,ve]=y.useState(!1),[ze,Ue]=y.useState(null),[jt,Nn]=y.useState(!1),[pt,It]=y.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),[un,Bn]=y.useState([]),[hn,Wt]=y.useState(!1),[xn,En]=y.useState(!1),[Vn,Zn]=y.useState(null),[Rt,yn]=y.useState({title:"",description:"",trigger:"",triggerConditions:[],actionType:"popup",sort:0,enabled:!0}),[we,Te]=y.useState([]),[We,at]=y.useState(!1),[Lt,Ct]=y.useState(null),[$e,V]=y.useState(null),[Qe,vt]=y.useState({}),[Dt,xt]=y.useState(!1),[yt,Pt]=y.useState(null),[Jt,wn]=y.useState([]),[Os,hr]=y.useState(!1),[qa,Gr]=y.useState(null),[Jr,ba]=y.useState(""),[Tr,Mr]=y.useState([]),[Qr,Ga]=y.useState(!1),[fr,Ws]=y.useState({}),[pr,Ks]=y.useState([]),[Ds,le]=y.useState(0),[Ne,Xe]=y.useState(1),[Nt]=y.useState(10),[Zt,qs]=y.useState(!1),[Ho,Yr]=y.useState(null),[Li,Ja]=y.useState(""),hs=_l(Li,300),[Ar,en]=y.useState(""),[Qa,Oi]=y.useState(""),[Xr,va]=y.useState(""),[Uo,Di]=y.useState(!1),[Gs,_s]=y.useState({}),[Wo,qn]=y.useState(null),[Ko,Zr]=y.useState(null),[fs,mr]=y.useState([]),[$s,ea]=y.useState(!1),Na=y.useRef(null),[Xl,Ya]=y.useState(!1),[_i,Xa]=y.useState(!1),[$i,ta]=y.useState("存客宝返回 data"),[wa,qo]=y.useState(""),lt=y.useCallback(async(M,ee)=>{qs(!0),Yr(null);try{const be=new URLSearchParams({mode:"contact",page:String(Ne),pageSize:String(Nt)}),Me=M??hs;Me&&be.set("search",Me);const Ge=ee??Ar;Ge&&be.set("source",Ge),Qa&&be.set("action",Qa),Xr&&be.set("pushStatus",Xr);const Je=await Oe(`/api/db/ckb-leads?${be}`);if(Je!=null&&Je.success)Ks(Je.records||[]),le(Je.total??0),Je.stats&&_s(Je.stats);else{const zt=(Je==null?void 0:Je.error)||"加载获客列表失败";Yr(zt),Y.error(zt),Ks([]),le(0)}}catch(be){const Me=be instanceof Error?be.message:"网络错误";Yr(Me),Y.error("加载获客列表失败: "+Me),Ks([]),le(0)}finally{qs(!1)}},[Ne,Nt,hs,Ar,Qa,Xr]);y.useEffect(()=>{mr([])},[hs,Ar,Qa,Xr]),y.useEffect(()=>{a==="leads"&&Oi(i)},[a,i]);function zi(M,ee){return{...M,...ee.pushStatus!==void 0?{pushStatus:ee.pushStatus}:{},...typeof ee.retryCount=="number"?{retryCount:ee.retryCount}:{},...typeof ee.ckbCode=="number"?{ckbCode:ee.ckbCode}:{},...ee.ckbMessage!==void 0?{ckbMessage:ee.ckbMessage}:{},...ee.ckbData!==void 0?{ckbData:ee.ckbData}:{},...ee.ckbError!==void 0?{ckbError:ee.ckbError}:{},...ee.lastPushAt!==void 0?{lastPushAt:ee.lastPushAt??void 0}:{},...ee.nextRetryAt!==void 0?{nextRetryAt:ee.nextRetryAt??void 0}:{}}}async function Za(M){if(M){qn(M);try{const ee=await kt("/api/db/ckb-leads/retry",{id:M});ee!=null&&ee.success?(Y.success(ee.pushed?"重推成功":"已发起重推,请刷新查看状态"),ee.record&&Ks(be=>be.map(Me=>Me.id===M?zi(Me,ee.record):Me))):Y.error((ee==null?void 0:ee.error)||"重推失败")}catch(ee){Y.error(ee instanceof Error?ee.message:"重推请求失败")}finally{qn(null)}}}async function ei(M){if(M&&confirm("确定删除该条获客记录?删除后不可恢复。")){Zr(M);try{const ee=await kt("/api/db/ckb-leads/delete",{id:M});ee!=null&&ee.success?Y.success("已删除"):Y.error((ee==null?void 0:ee.error)||"删除失败")}catch(ee){Y.error(ee instanceof Error?ee.message:"删除请求失败")}finally{Zr(null),lt()}}}async function Go(){const M=ks.filter(Me=>Me.pushStatus==="failed");if(M.length===0){Y.info("当前页无失败记录");return}Ya(!0);let ee=0;for(const Me of M)try{const Ge=await kt("/api/db/ckb-leads/retry",{id:Me.id});if(Ge!=null&&Ge.success&&Ge.pushed&&ee++,Ge!=null&&Ge.success&&Ge.record){const Je=Ge.record;Ks(zt=>zt.map(Ve=>Ve.id===Me.id?zi(Ve,Je):Ve))}}catch{}Ya(!1);const be=M.length;Y.success(`批量重推完成:成功 ${ee} / ${be}`)}function es(){const M=ks.filter(Ve=>Ve.pushStatus==="failed");if(M.length===0){Y.info("当前筛选下无失败记录可导出");return}const ee=Ve=>`"${String(Ve??"").replace(/"/g,'""')}"`,Me=[["ID","昵称","手机号","微信号","对应@人","计划Key","来源","推送状态","重试次数","失败原因","下次重试时间","创建时间"].join(",")];for(const Ve of M)Me.push([ee(Ve.id),ee(Ve.userNickname||Ve.name||""),ee(Ve.phone||""),ee(Ve.wechatId||""),ee(Ve.personName||""),ee(Ve.planApiKey||""),ee(Ve.source||""),ee(Ve.pushStatus||""),ee(typeof Ve.retryCount=="number"?Ve.retryCount:""),ee(Ve.ckbError||""),ee(Ve.nextRetryAt?new Date(Ve.nextRetryAt).toLocaleString():""),ee(Ve.createdAt?new Date(Ve.createdAt).toLocaleString():"")].join(","));const Ge=new Blob(["\uFEFF"+Me.join(` +`)],{type:"text/csv;charset=utf-8;"}),Je=URL.createObjectURL(Ge),zt=document.createElement("a");zt.href=Je,zt.download=`获客失败清单-${new Date().toISOString().slice(0,19).replace(/[:T]/g,"-")}.csv`,document.body.appendChild(zt),zt.click(),document.body.removeChild(zt),URL.revokeObjectURL(Je),Y.success(`已导出失败清单(${M.length} 条)`)}const Jo=y.useCallback(async()=>{try{const M=await Oe("/api/admin/mbti-avatars"),ee=M!=null&&M.avatars&&typeof M.avatars=="object"?M.avatars:{};Ws(ee)}catch{Ws({})}},[]);y.useEffect(()=>{t.get("tab")==="leads"&<()},[t.get("tab"),Ne,lt]),y.useEffect(()=>{if(a!=="leads")return;const M=window.setInterval(()=>{lt()},3e4);return()=>window.clearInterval(M)},[a,lt]),y.useEffect(()=>{Jo()},[Jo]);const gr=y.useCallback((M,ee)=>{const be=(M||"").trim();if(be)return be;const Me=(ee||"").trim().toUpperCase();return/^[EI][NS][FT][JP]$/.test(Me)?(fr[Me]||"").trim():""},[fr]),Fi=y.useCallback(M=>{const ee=!!M.hasFullBook,be=Number(M.purchasedSectionCount||0);return ee?{tone:"vip",main:"已购全书",sub:be>0?`另购单章 ${be} 章`:"购买项:VIP / 全书"}:be>0?{tone:"paid",main:`已购 ${be} 章`,sub:"购买项:章节"}:{tone:"free",main:"未购买",sub:""}},[]),[xr,Js]=y.useState(null),zs=y.useCallback(async()=>{try{const M=await Oe("/api/admin/users/online-stats");M!=null&&M.success&&typeof M.onlineCount=="number"?Js(M.onlineCount):Js(0)}catch{Js(null)}},[]);y.useEffect(()=>{zs();const M=setInterval(zs,1e4);return()=>clearInterval(M)},[zs]);async function Qs(M=!1){var ee;L(!0),M&&_(!0),R(null);try{if(Z){const be=new URLSearchParams({search:v,limit:String(g*5)}),Me=await Oe(`/api/db/users/rfm?${be}`);if(Me!=null&&Me.success){let Ge=Me.users||[];ce==="asc"&&(Ge=[...Ge].reverse());const Je=(f-1)*g;c(Ge.slice(Je,Je+g)),h(((ee=Me.users)==null?void 0:ee.length)??0),Ge.length===0&&(re(!1),R("暂无订单数据,RFM 排序需要用户有购买记录后才能生效"))}else re(!1),R((Me==null?void 0:Me.error)||"RFM 加载失败,已切回普通模式")}else{const be=new URLSearchParams({page:String(f),pageSize:String(g),search:v,...T==="vip"&&{vip:"true"},...T==="complete"&&{pool:"complete"}}),Me=await Oe(`/api/db/users?${be}`);Me!=null&&Me.success?(c(Me.users||[]),h(Me.total??0)):R((Me==null?void 0:Me.error)||"加载失败")}}catch(be){console.error("Load users error:",be),R("网络错误")}finally{L(!1),M&&_(!1)}}y.useEffect(()=>{m(1)},[v,T,Z]),y.useEffect(()=>{Qs()},[f,g,v,T,Z,ce]);const ja=Math.ceil(u/g)||1,On=()=>{Z?ce==="desc"?me("asc"):(re(!1),me("desc")):(re(!0),me("desc"))},Zl=M=>({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"})[M||""]||"bg-gray-500/20 text-gray-400";async function Ir(M){var ee;if(!tN("用户")){Y.info("已取消删除");return}try{const be=await ki(`/api/db/users?id=${encodeURIComponent(M)}`);be!=null&&be.success?(Y.success("已删除"),Qs()):Y.error("删除失败: "+((be==null?void 0:be.error)||"未知错误"))}catch(be){const Me=be,Ge=((ee=Me==null?void 0:Me.data)==null?void 0:ee.error)||(Me==null?void 0:Me.message)||"网络错误";Y.error("删除失败: "+Ge)}}const ka=M=>{ge(M),It({phone:M.phone||"",nickname:M.nickname||"",password:"",isAdmin:!!(M.isAdmin??!1),hasFullBook:!!(M.hasFullBook??!1)}),J(!0)},ec=()=>{ge(null),It({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),J(!0)};async function Sa(){if(!pt.phone||!pt.nickname){Y.error("请填写手机号和昵称");return}F(!0);try{if(z){const M=await Yt("/api/db/users",{id:z.id,phone:pt.phone||void 0,nickname:pt.nickname,isAdmin:pt.isAdmin,hasFullBook:pt.hasFullBook,...pt.password&&{password:pt.password}});if(!(M!=null&&M.success)){Y.error("更新失败: "+((M==null?void 0:M.error)||""));return}}else{const M=await kt("/api/db/users",{phone:pt.phone,nickname:pt.nickname,password:pt.password,isAdmin:pt.isAdmin});if(!(M!=null&&M.success)){Y.error("创建失败: "+((M==null?void 0:M.error)||""));return}}J(!1),Qs()}catch{Y.error("保存失败")}finally{F(!1)}}async function yr(M){Q(M),fe(!0),q(!0);try{const ee=await Oe(`/api/db/users/referrals?userId=${encodeURIComponent(M.id)}`);ee!=null&&ee.success?oe({referrals:ee.referrals||[],stats:ee.stats||{}}):oe({referrals:[],stats:{}})}catch{oe({referrals:[],stats:{}})}finally{q(!1)}}const Ys=y.useCallback(async()=>{Wt(!0);try{const M=await Oe("/api/db/user-rules");M!=null&&M.success&&Bn((M.rules||[]).map(ee=>QR(ee)))}catch{}finally{Wt(!1)}},[]);async function dd(){if(!Rt.title){Y.error("请填写规则标题");return}F(!0);try{if(Vn){const M=await Yt("/api/db/user-rules",{id:Vn.id,...Rt});if(!(M!=null&&M.success)){Y.error("更新失败: "+((M==null?void 0:M.error)||""));return}}else{const M=await kt("/api/db/user-rules",Rt);if(!(M!=null&&M.success)){Y.error("创建失败: "+((M==null?void 0:M.error)||""));return}}En(!1),Ys()}catch{Y.error("保存失败")}finally{F(!1)}}async function br(M){if(!tN("规则")){Y.info("已取消删除");return}try{const ee=await ki(`/api/db/user-rules?id=${M}`);ee!=null&&ee.success&&Ys()}catch{}}async function Xs(M){try{await Yt("/api/db/user-rules",{id:M.id,enabled:!M.enabled}),Ys()}catch{}}const ts=y.useCallback(async()=>{at(!0);try{const M=await Oe("/api/db/vip-members?limit=500");if(M!=null&&M.success&&M.data){const ee=[...M.data].map((be,Me)=>({...be,vipSort:typeof be.vipSort=="number"?be.vipSort:Me+1}));ee.sort((be,Me)=>(be.vipSort??999999)-(Me.vipSort??999999)),Te(ee)}else M&&M.error&&Y.error(M.error)}catch{Y.error("加载超级个体列表失败")}finally{at(!1)}},[]),[Zs,Bi]=y.useState(!1),[Ca,Ea]=y.useState(null),[Pr,Ta]=y.useState(""),[Qo,er]=y.useState(!1),[ti,na]=y.useState(!1),[Ma,Aa]=y.useState(null),[ni,Yo]=y.useState(""),[ns,sa]=y.useState(!1),Xo=["创业者","资源整合者","技术达人","投资人","产品经理","流量操盘手"],si=M=>{Ea(M),Ta(M.vipRole||""),Bi(!0)},ud=M=>{Aa(M),Yo((M.webhookUrl||"").trim()),na(!0)},Zo=async M=>{const ee=M.trim();if(Ca){if(!ee){Y.error("请选择或输入标签");return}er(!0);try{const be=await Yt("/api/db/users",{id:Ca.id,vipRole:ee});if(!(be!=null&&be.success)){Y.error((be==null?void 0:be.error)||"更新超级个体标签失败");return}Y.success("已更新超级个体标签"),Bi(!1),Ea(null),await ts()}catch{Y.error("更新超级个体标签失败")}finally{er(!1)}}},el=async()=>{if(!Ma)return;const M=ni.trim();if(M&&!/^https?:\/\//i.test(M)){Y.error("Webhook 地址需以 http/https 开头");return}sa(!0);try{const ee=await Yt("/api/db/vip-members/webhook",{userId:Ma.id,webhookUrl:M});if(!(ee!=null&&ee.success)){Y.error((ee==null?void 0:ee.error)||"保存飞书群 Webhook 失败");return}Y.success(M?"已保存该超级个体的飞书群 Webhook":"已清空该超级个体的飞书群 Webhook"),na(!1),Aa(null),await ts()}catch{Y.error("保存飞书群 Webhook 失败")}finally{sa(!1)}},[ri,Rr]=y.useState(!1),[Lr,Vi]=y.useState(null),[tl,nl]=y.useState(""),[ai,E]=y.useState(!1),B=M=>{Vi(M),nl(M.vipSort!=null?String(M.vipSort):""),Rr(!0)},ue=async()=>{if(!Lr)return;const M=Number(tl);if(!Number.isFinite(M)){Y.error("请输入有效的数字序号");return}E(!0);try{const ee=await Yt("/api/db/users",{id:Lr.id,vipSort:M});if(!(ee!=null&&ee.success)){Y.error((ee==null?void 0:ee.error)||"更新排序序号失败");return}Y.success("已更新排序序号"),Rr(!1),Vi(null),await ts()}catch{Y.error("更新排序序号失败")}finally{E(!1)}},je=(M,ee)=>{M.dataTransfer.effectAllowed="move",M.dataTransfer.setData("text/plain",ee),Ct(ee)},Ke=(M,ee)=>{M.preventDefault(),$e!==ee&&V(ee)},mt=()=>{Ct(null),V(null)},wt=async(M,ee)=>{M.preventDefault();const be=M.dataTransfer.getData("text/plain")||Lt;if(Ct(null),V(null),!be||be===ee)return;const Me=we.find(Ve=>Ve.id===be),Ge=we.find(Ve=>Ve.id===ee);if(!Me||!Ge)return;const Je=Me.vipSort??we.findIndex(Ve=>Ve.id===be)+1,zt=Ge.vipSort??we.findIndex(Ve=>Ve.id===ee)+1;Te(Ve=>{const Qt=[...Ve],Ss=Qt.findIndex(nc=>nc.id===be),Or=Qt.findIndex(nc=>nc.id===ee);if(Ss===-1||Or===-1)return Ve;const Ui=[...Qt],[bd,vd]=[Ui[Ss],Ui[Or]];return Ui[Ss]={...vd,vipSort:Je},Ui[Or]={...bd,vipSort:zt},Ui});try{const[Ve,Qt]=await Promise.all([Yt("/api/db/users",{id:be,vipSort:zt}),Yt("/api/db/users",{id:ee,vipSort:Je})]);if(!(Ve!=null&&Ve.success)||!(Qt!=null&&Qt.success)){Y.error((Ve==null?void 0:Ve.error)||(Qt==null?void 0:Qt.error)||"更新排序失败"),await ts();return}Y.success("已更新排序"),await ts()}catch{Y.error("更新排序失败"),await ts()}},Tn=y.useCallback(async()=>{xt(!0);try{const M=await Oe("/api/db/users/journey-stats");M!=null&&M.success&&M.stats&&vt(M.stats)}catch{}finally{xt(!1)}},[]),ss=y.useCallback(async M=>{Pt(M),hr(!0);try{const ee=await Oe(`/api/db/users/journey-users?stage=${M}&limit=50`);ee!=null&&ee.success&&ee.users&&wn(ee.users)}catch{}finally{hr(!1)}},[]),jn=y.useCallback(async(M,ee)=>{Gr(M),ba(ee),Ga(!0);try{const be=await Oe(`/api/db/users/tracks?userId=${M}&limit=50`);be!=null&&be.success&&be.tracks&&Mr(be.tracks)}catch{}finally{Ga(!1)}},[]),[ps,Dn]=y.useState(!1),tc=async()=>{Dn(!0);try{const M=await kt("/api/admin/shensheshou/batch-enrich",{limit:20});M!=null&&M.success?(Y.success(`批量补全完成:${M.enriched} 人已补全,${M.skipped} 人跳过`),Qs()):Y.error((M==null?void 0:M.error)||"批量补全失败")}catch{Y.error("批量补全请求失败")}finally{Dn(!1)}},nm=M=>{const ee=[M.phone,M.nickname,M.avatar,M.wechatId,M.mbti,M.industry,M.region,M.position],be=ee.filter(Me=>Me!=null&&Me!=="").length;return Math.round(be/ee.length*100)},{leadsRows:ks,leadsRawCount:sm,leadsDeduped:Fu}=y.useMemo(()=>{const M=Ve=>(Ve||"").replace(/\D/g,"")||"",ee=Ve=>{const Qt=M(Ve.phone);if(Qt)return`phone:${Qt}`;const Ss=(Ve.userId||"").trim();if(Ss)return`user:${Ss}`;const Or=(Ve.wechatId||"").trim();return Or?`wechat:${Or}`:`row:${Ve.id}`},be=hs.trim().toLowerCase();let Me=pr;be&&(Me=pr.filter(Ve=>[Ve.userNickname,Ve.name,Ve.phone,Ve.wechatId,Ve.personName,Ve.source,Ve.planApiKey].filter(Boolean).join(" ").toLowerCase().includes(be)));const Ge=[...Me].sort((Ve,Qt)=>{const Ss=Ve.createdAt?new Date(Ve.createdAt).getTime():0;return(Qt.createdAt?new Date(Qt.createdAt).getTime():0)-Ss});if(!Uo)return{leadsRows:Ge,leadsRawCount:Me.length,leadsDeduped:0};const Je=new Set,zt=[];for(const Ve of Ge){const Qt=ee(Ve);Je.has(Qt)||(Je.add(Qt),zt.push(Ve))}return{leadsRows:zt,leadsRawCount:Me.length,leadsDeduped:Me.length-zt.length}},[pr,hs,Uo]);y.useEffect(()=>{const M=ks.map(Me=>Me.id),ee=M.filter(Me=>fs.includes(Me)).length,be=Na.current;be&&(be.indeterminate=ee>0&&eebe.id),ee=M.length>0&&M.every(be=>fs.includes(be));mr(ee?be=>be.filter(Me=>!M.includes(Me)):be=>[...new Set([...be,...M])])}function am(M){mr(ee=>ee.includes(M)?ee.filter(be=>be!==M):[...ee,M])}async function im(){if(fs.length===0){Y.info("请先勾选要删除的记录");return}const M=fs.length;if(!confirm(`确定批量删除选中的 ${M} 条获客记录?删除后不可恢复。`))return;const ee=500;ea(!0);try{let be=0;for(let Me=0;Me{const ee=M||"";return ee==="success"?s.jsx(Be,{className:"bg-emerald-500/20 text-emerald-300 border-0 text-xs",children:"已推送(存客宝已接收)"}):ee==="pending_verify"?s.jsx(Be,{className:"bg-sky-500/20 text-sky-300 border-0 text-xs",children:"待通过 / 处理中"}):ee==="expired"?s.jsx(Be,{className:"bg-gray-500/20 text-gray-300 border-0 text-xs",children:"已过期"}):ee==="failed"?s.jsx(Be,{className:"bg-red-500/20 text-red-300 border-0 text-xs",children:"失败"}):ee==="pending"?s.jsx(Be,{className:"bg-amber-500/20 text-amber-300 border-0 text-xs",children:"待推送"}):ee?s.jsx(Be,{className:"bg-violet-500/20 text-violet-300 border-0 text-xs",title:ee,children:ee}):s.jsx(Be,{className:"bg-amber-500/20 text-amber-300 border-0 text-xs",children:"待推送"})},hd=y.useMemo(()=>{const M=new Map;for(const ee of ks){if(ee.pushStatus!=="failed")continue;const be=(ee.ckbError||"未知错误").trim()||"未知错误";M.set(be,(M.get(be)||0)+1)}return Array.from(M.entries()).map(([ee,be])=>({reason:ee,count:be})).sort((ee,be)=>be.count-ee.count)},[ks]);async function fd(){const M=ks.filter(Je=>Je.pushStatus==="failed");if(M.length===0){Y.info("当前页无失败记录");return}const ee=hd.slice(0,8).map(Je=>`- ${Je.reason}:${Je.count} 条`).join(` +`),be=M.slice(0,30).map(Je=>Je.id).join(", "),Me=M.slice(0,20).map(Je=>`#${Je.id} | ${Je.userNickname||Je.name||"-"} | 手机:${Je.phone||"-"} | 来源:${Je.source||"-"} | 重试:${Je.retryCount??0} | 错误:${Je.ckbError||"-"}`).join(` +`),Ge=["【获客失败排障信息】",`时间:${new Date().toLocaleString()}`,`当前页失败总数:${M.length}`,"主要失败原因:",ee||"- 无",`最近失败记录ID(最多30条):${be||"无"}`,"","失败记录明细(最多20条):",Me||"无"].join(` +`);try{await navigator.clipboard.writeText(Ge),Y.success("已复制排障信息")}catch{Y.error("复制失败,请检查浏览器剪贴板权限")}}return s.jsxs("div",{className:"p-8 w-full",children:[H&&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:H}),s.jsx("button",{type:"button",onClick:()=>R(null),children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-start gap-6 mb-6 flex-wrap",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"用户管理"}),s.jsxs("p",{className:"text-gray-400 mt-1 text-sm",children:["共 ",u," 位注册用户",xr!==null&&s.jsxs("span",{className:"text-[#38bdac] ml-1",children:["· 在线 ",xr," 人"]}),Z&&" · RFM 排序中"]})]}),s.jsx(De,{className:"shrink-0 w-full max-w-md border-[#38bdac]/35 bg-[#0f2137]/90",children:s.jsxs(_e,{className:"p-3 sm:p-4 space-y-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsxs("button",{type:"button",onClick:()=>ie(M=>!M),className:"flex items-center gap-2 min-w-0 flex-1 text-left rounded-lg px-1 py-0.5 hover:bg-white/5 transition-colors","aria-expanded":$,children:[s.jsx(wf,{className:"w-5 h-5 text-[#38bdac] shrink-0"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-semibold text-white",children:"算法配置"}),s.jsx("div",{className:"text-xs text-gray-500 truncate",children:$?"RFM · Are you good(用户价值分层)":"RFM · 点击展开说明"})]}),$?s.jsx(Px,{className:"w-4 h-4 text-gray-400 shrink-0"}):s.jsx(Il,{className:"w-4 h-4 text-gray-400 shrink-0"})]}),s.jsx(G,{type:"button",variant:"outline",size:"sm",onClick:On,className:"border-[#38bdac]/50 text-[#38bdac] hover:bg-[#38bdac]/10 bg-transparent shrink-0",children:Z?ce==="desc"?"RFM 降序":"RFM 升序":"按 RFM 排序"})]}),$&&s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-xs text-gray-400 leading-relaxed",children:["综合分 0–100(六维度):最近消费 R(25%)+ 订单频次 F(20%)+ 累计金额 M(20%)+ 推荐人数(15%)+ 行为轨迹(10%)+ 资料完善(10%)。各维度在全量用户中归一化,与后端"," ",s.jsx("code",{className:"text-gray-500",children:"/api/db/users/rfm"})," 一致。"]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:YR.map(({level:M,range:ee,label:be})=>s.jsxs(Be,{variant:"outline",className:`text-[10px] border-0 ${Zl(M)}`,children:[M," ",ee," · ",be]},M))})]})]})})]}),s.jsxs(Wc,{value:a,onValueChange:M=>{const ee=new URLSearchParams(t);M==="users"?ee.delete("tab"):ee.set("tab",M),e(ee)},className:"w-full",children:[s.jsxs(Dl,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-6 flex-wrap h-auto gap-1",children:[s.jsxs(nn,{value:"users",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",children:[s.jsx(Un,{className:"w-4 h-4"})," 用户列表"]}),s.jsxs(nn,{value:"leads",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:()=>lt(),children:[s.jsx(_c,{className:"w-4 h-4"})," 获客列表"]}),s.jsxs(nn,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Tn,children:[s.jsx(ua,{className:"w-4 h-4"})," 用户旅程总览"]}),s.jsxs(nn,{value:"rules",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Ys,children:[s.jsx(yo,{className:"w-4 h-4"})," 规则配置"]}),s.jsxs(nn,{value:"vip-roles",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:ts,children:[s.jsx(zc,{className:"w-4 h-4"})," 超级个体列表"]})]}),s.jsxs(sn,{value:"users",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4 justify-end flex-wrap",children:[s.jsxs(G,{variant:"outline",onClick:tc,disabled:ps,className:"border-purple-500/50 text-purple-400 hover:bg-purple-500/10 bg-transparent",title:"批量调用神射手补全有手机号用户的资料",children:[ps?s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(Mo,{className:"w-4 h-4 mr-2"}),"批量补全"]}),s.jsxs(G,{variant:"outline",onClick:()=>Qs(!0),disabled:U,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${U?"animate-spin":""}`})," 刷新"]}),s.jsxs("select",{value:T,onChange:M=>{const ee=M.target.value;C(ee),m(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:Z,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(za,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(de,{type:"text",placeholder:"搜索用户...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500 w-56",value:N,onChange:M=>j(M.target.value)})]}),s.jsxs(G,{onClick:ec,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(_c,{className:"w-4 h-4 mr-2"})," 添加用户"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:P?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{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(vs,{children:[s.jsx(Ns,{children:s.jsxs(bt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Se,{className:"text-gray-400",children:"用户信息"}),s.jsx(Se,{className:"text-gray-400",children:"绑定信息"}),s.jsx(Se,{className:"text-gray-400",children:"购买状态"}),s.jsx(Se,{className:"text-gray-400",children:"分销收益"}),s.jsxs(Se,{className:"text-gray-400 cursor-pointer select-none",onClick:On,children:[s.jsxs("div",{className:"flex items-center gap-1 group",children:[s.jsx(wf,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"RFM分值"}),Z?ce==="desc"?s.jsx(Il,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(Px,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(Ig,{className:"w-3.5 h-3.5 text-gray-600 group-hover:text-gray-400"})]}),Z&&s.jsx("div",{className:"text-[10px] text-[#38bdac] font-normal mt-0.5",children:"点击切换方向/关闭"})]}),s.jsx(Se,{className:"text-gray-400",children:"资料完善"}),s.jsx(Se,{className:"text-gray-400",children:"注册时间"}),s.jsx(Se,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(ws,{children:[o.map(M=>{var ee,be,Me;return s.jsxs(bt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ke,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[(()=>{var zt;const Ge=gr(M.avatar,M.mbti),Je=((zt=M.nickname)==null?void 0:zt.charAt(0))||"?";return s.jsx("button",{type:"button",title:"点击管理 MBTI 默认头像库",onClick:()=>Nn(!0),className:"w-10 h-10 shrink-0 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] overflow-hidden ring-1 ring-transparent hover:ring-[#38bdac]/60 transition",children:Ge?s.jsx("img",{src:Ge,className:"w-full h-full rounded-full object-cover",alt:"",onError:Ve=>{var Or;const Qt=Ve.target;if(Qt.style.display="none",Qt.nextElementSibling)return;const Ss=document.createElement("span");Ss.textContent=Je,(Or=Qt.parentElement)==null||Or.appendChild(Ss)}}):Je})})(),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("button",{type:"button",onClick:()=>{Ue(M.id),ve(!0)},className:"font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left truncate max-w-[120px]",children:M.nickname}),M.isAdmin&&s.jsx(Be,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),M.openId&&!((ee=M.id)!=null&&ee.startsWith("user_"))&&s.jsx(Be,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0 text-xs",children:"微信"})]}),s.jsxs("p",{className:"text-xs text-gray-500 font-mono truncate max-w-[140px]",title:M.id,children:[(be=M.id)==null?void 0:be.slice(0,16),(((Me=M.id)==null?void 0:Me.length)??0)>16?"…":""]})]})]})}),s.jsx(ke,{children:s.jsxs("div",{className:"space-y-1",children:[M.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:M.phone})]}),M.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:M.wechatId})]}),!M.phone&&!M.wechatId&&s.jsx("span",{className:"text-gray-600 text-xs",children:"未绑定"})]})}),s.jsx(ke,{children:(()=>{const Ge=Fi(M);return Ge.tone==="vip"?s.jsxs("div",{className:"space-y-1",children:[s.jsx(Be,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:Ge.main}),Ge.sub&&s.jsx("p",{className:"text-[11px] text-amber-300/80",children:Ge.sub})]}):Ge.tone==="paid"?s.jsxs("div",{className:"space-y-1",children:[s.jsx(Be,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:Ge.main}),Ge.sub&&s.jsx("p",{className:"text-[11px] text-blue-300/80",children:Ge.sub})]}):s.jsx(Be,{variant:"outline",className:"text-gray-500 border-gray-600",children:Ge.main})})()}),s.jsx(ke,{children:s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(M.earnings||0)).toFixed(2)]}),parseFloat(String(M.pendingEarnings||0))>0&&s.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String(M.pendingEarnings||0)).toFixed(2)]}),s.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>yr(M),role:"button",tabIndex:0,onKeyDown:Ge=>Ge.key==="Enter"&&yr(M),children:[s.jsx(Un,{className:"w-3 h-3"})," 绑定",M.referralCount||0,"人"]})]})}),s.jsx(ke,{children:M.rfmScore!=null&&M.rfmScore!==void 0?s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-white font-bold text-base",children:M.rfmScore}),s.jsx(Be,{className:`border-0 text-xs ${Zl(M.rfmLevel)}`,children:M.rfmLevel})]}):s.jsx("span",{className:"text-gray-600 text-xs",children:"无订单"})}),s.jsx(ke,{children:(()=>{const Ge=nm(M),Je=Ge>=75?"text-green-400":Ge>=50?"text-yellow-400":"text-gray-500";return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-12 h-1.5 bg-gray-700 rounded-full overflow-hidden",children:s.jsx("div",{className:`h-full rounded-full ${Ge>=75?"bg-green-500":Ge>=50?"bg-yellow-500":"bg-gray-500"}`,style:{width:`${Ge}%`}})}),s.jsxs("span",{className:`text-xs ${Je}`,children:[Ge,"%"]})]})})()}),s.jsx(ke,{className:"text-gray-400",children:M.createdAt?new Date(M.createdAt).toLocaleDateString():"-"}),s.jsx(ke,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(G,{variant:"ghost",size:"sm",onClick:()=>{Ue(M.id),ve(!0)},className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"用户详情",children:s.jsx(Nf,{className:"w-4 h-4"})}),s.jsx(G,{variant:"ghost",size:"sm",onClick:()=>ka(M),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑用户",children:s.jsx(tn,{className:"w-4 h-4"})}),s.jsx(G,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>Ir(M.id),title:"删除",children:s.jsx(ls,{className:"w-4 h-4"})})]})})]},M.id)}),o.length===0&&s.jsx(bt,{children:s.jsx(ke,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),s.jsx(cr,{page:f,totalPages:ja,total:u,pageSize:g,onPageChange:m,onPageSizeChange:M=>{b(M),m(1)}})]})})})]}),s.jsxs(sn,{value:"leads",children:[Ho&&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:Ho}),s.jsx("button",{type:"button",className:"shrink-0 ml-2",onClick:()=>Yr(null),"aria-label":"关闭",children:"×"})]}),!Zt&&s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-4",children:[s.jsxs("div",{className:"p-3 bg-[#0f2137] border border-gray-700/50 rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs",children:"线索总条数(含留资/加入/匹配)"}),s.jsx("p",{className:"text-xl font-bold text-white",children:Ds})]}),s.jsxs("div",{className:"p-3 bg-[#0f2137] border border-gray-700/50 rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs",children:"去重用户数(按 userId)"}),s.jsx("p",{className:"text-xl font-bold text-[#38bdac]",title:"后端 COUNT(DISTINCT user_id)",children:Gs.uniqueUsers??0})]}),(Gs.sourceStats&&Gs.sourceStats.length>0?Gs.sourceStats.slice(0,2):[]).map(M=>s.jsxs("div",{className:"p-3 bg-[#0f2137] border border-gray-700/50 rounded-lg",children:[s.jsxs("p",{className:"text-gray-500 text-xs",children:["来源:",M.source]}),s.jsx("p",{className:"text-xl font-bold text-purple-400",children:M.cnt})]},M.source))]}),!Zt&&hd.length>0&&s.jsx(De,{className:"bg-[#3a1010]/35 border-red-900/60 shadow-lg mb-4",children:s.jsxs(_e,{className:"p-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 mb-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-red-200 font-medium",children:"失败原因聚合"}),s.jsx("p",{className:"text-red-300/70 text-xs",children:"基于当前页筛选结果,按失败原因聚合统计"})]}),s.jsx(G,{type:"button",variant:"outline",onClick:fd,className:"border-red-600/70 text-red-200 hover:bg-red-500/10 bg-transparent",children:"一键复制排障信息"})]}),s.jsx("div",{className:"flex flex-wrap gap-2",children:hd.slice(0,8).map(M=>s.jsxs(Be,{className:"bg-red-500/15 text-red-200 border border-red-600/40",children:[M.reason," · ",M.count]},M.reason))})]})}),s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 mb-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 flex-1 min-w-[200px]",children:[s.jsxs("div",{className:"relative flex-1 max-w-xs",children:[s.jsx(za,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(de,{placeholder:"搜索昵称/手机/微信/@人/来源/类型…",value:Li,onChange:M=>Ja(M.target.value),className:"pl-9 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"})]}),Gs.sourceStats&&Gs.sourceStats.length>0&&s.jsxs("select",{value:Ar,onChange:M=>{en(M.target.value),Xe(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部来源"}),Gs.sourceStats.map(M=>s.jsxs("option",{value:M.source,children:[M.source,"(",M.cnt,")"]},M.source))]}),s.jsxs("select",{value:Qa,onChange:M=>{const ee=M.target.value;Oi(ee),Xe(1),e(be=>{const Me=new URLSearchParams(be);return Me.set("tab","leads"),ee?Me.set("leadAction",ee):Me.delete("leadAction"),Me})},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",title:"按业务类型筛选",children:[s.jsx("option",{value:"",children:"全部类型"}),s.jsx("option",{value:"lead",children:"留资线索(文章@ / 首页链接)"}),s.jsx("option",{value:"join",children:"加入报名(导师 / 资源对接 / 团队)"}),s.jsx("option",{value:"match",children:"匹配上报(找伙伴匹配)"})]}),s.jsxs("label",{className:"flex items-center gap-2 text-xs text-gray-400 select-none bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2",children:[s.jsx("input",{type:"checkbox",checked:Uo,onChange:M=>Di(M.target.checked),className:"w-4 h-4 rounded border-gray-600 bg-[#0f2137] accent-[#38bdac] cursor-pointer"}),"去重展示"]}),s.jsxs("select",{value:Xr,onChange:M=>{va(M.target.value),Xe(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部状态"}),s.jsx("option",{value:"pending",children:"待推送"}),s.jsx("option",{value:"success",children:"已推送(存客宝已接收)"}),s.jsx("option",{value:"pending_verify",children:"待通过 / 处理中"}),s.jsx("option",{value:"expired",children:"已过期"}),s.jsx("option",{value:"failed",children:"推送失败"})]}),s.jsx(G,{type:"button",variant:"outline",onClick:()=>{va("failed"),Xe(1)},className:"border-red-600/60 text-red-300 hover:bg-red-500/10 bg-transparent text-xs h-9",children:"只看失败"}),s.jsxs("span",{className:"text-xs text-gray-500 whitespace-nowrap max-w-[min(100%,20rem)]",title:"同一页内:相同手机号或相同用户 ID(含微信侧标识)只保留最近一条",children:["本页 ",sm," 条",Fu>0?` · 已合并 ${Fu} 条重复`:""]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx(G,{variant:"outline",onClick:es,disabled:Zt,className:"border-cyan-600/60 text-cyan-300 hover:bg-cyan-500/10 bg-transparent",children:"导出失败清单"}),s.jsxs(G,{variant:"outline",onClick:Go,disabled:Xl||$s||Zt,className:"border-amber-600/60 text-amber-300 hover:bg-amber-500/10 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${Xl?"animate-spin":""}`}),"重推本页失败项"]}),s.jsxs(G,{variant:"outline",onClick:()=>void im(),disabled:$s||fs.length===0||Zt,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[s.jsx(ls,{className:`w-4 h-4 mr-2 ${$s?"animate-pulse":""}`}),$s?"删除中…":`批量删除(${fs.length})`]}),s.jsxs(G,{variant:"outline",onClick:()=>lt(),disabled:Zt,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${Zt?"animate-spin":""}`})," 刷新"]})]})]}),!Zt&&ks.length>0&&s.jsxs("p",{className:"text-xs text-gray-500 mb-2",children:["已选 ",s.jsx("span",{className:"text-[#38bdac]",children:fs.length})," 条 · 可翻页继续勾选 · 改搜索/筛选会清空选择",fs.length>0&&s.jsx("button",{type:"button",className:"ml-2 text-gray-400 hover:text-gray-200 underline",onClick:()=>mr([]),children:"清空"})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:Zt?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{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(vs,{children:[s.jsx(Ns,{children:s.jsxs(bt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Se,{className:"text-gray-400 w-10 text-center",children:s.jsx("input",{ref:Na,type:"checkbox",checked:ks.length>0&&ks.every(M=>fs.includes(M.id)),onChange:rm,className:"w-4 h-4 rounded border-gray-600 bg-[#0f2137] accent-[#38bdac] cursor-pointer",title:"全选本页(展示行)"})}),s.jsx(Se,{className:"text-gray-400",children:"昵称"}),s.jsx(Se,{className:"text-gray-400",children:"手机号"}),s.jsx(Se,{className:"text-gray-400",children:"微信号"}),s.jsx(Se,{className:"text-gray-400",children:"对应 @人"}),s.jsx(Se,{className:"text-gray-400",children:"获客计划(Key)"}),s.jsx(Se,{className:"text-gray-400",children:"推送状态"}),s.jsx(Se,{className:"text-gray-400",children:"时间"}),s.jsx(Se,{className:"text-gray-400",children:"重试"})]})}),s.jsxs(ws,{children:[ks.map(M=>s.jsxs(bt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ke,{className:"text-center align-middle w-10",children:s.jsx("input",{type:"checkbox",checked:fs.includes(M.id),onChange:()=>am(M.id),disabled:$s,className:"w-4 h-4 rounded border-gray-600 bg-[#0f2137] accent-[#38bdac] cursor-pointer"})}),s.jsx(ke,{className:"text-gray-300 align-middle",children:s.jsx(XR,{userId:M.userId,userAvatar:M.userAvatar,nickname:M.userNickname,name:M.name,onOpenDetail:ee=>{Ue(ee),ve(!0)}})}),s.jsx(ke,{className:"text-gray-300",children:M.phone||"-"}),s.jsx(ke,{className:"text-gray-300",children:M.wechatId||"-"}),s.jsx(ke,{className:"text-[#38bdac]",children:M.personName||"-"}),s.jsx(ke,{className:"text-gray-400 text-xs",children:(()=>{const ee=(M.planApiKey||"").trim();if(!ee)return"-";const be=ee.length<=10?ee:`${ee.slice(0,6)}…${ee.slice(-4)}`;return s.jsx("button",{type:"button",className:"font-mono text-gray-400 hover:text-gray-200 underline decoration-dotted",title:ee,onClick:async()=>{try{await navigator.clipboard.writeText(ee),Y.success("已复制计划Key")}catch{Y.error("复制失败,请手动复制")}},children:be})})()}),s.jsx(ke,{children:s.jsxs("div",{className:"space-y-1",children:[om(M.pushStatus),(typeof M.ckbCode=="number"||(M.ckbMessage||"").trim())&&s.jsx("p",{className:"text-[11px] text-gray-500 max-w-[260px] truncate",title:[typeof M.ckbCode=="number"?`code=${M.ckbCode}`:"",(M.ckbMessage||"").trim()?`message=${String(M.ckbMessage).trim()}`:"",(M.ckbData||"").trim()?`data=${String(M.ckbData).trim()}`:""].filter(Boolean).join(" | "),children:[typeof M.ckbCode=="number"?`code=${M.ckbCode}`:"",(M.ckbMessage||"").trim()?String(M.ckbMessage).trim():""].filter(Boolean).join(" · ")}),!!(M.ckbData||"").trim()&&s.jsx("button",{type:"button",className:"text-[11px] text-sky-300/90 hover:text-sky-200 underline decoration-dotted",onClick:()=>{const ee=String(M.ckbData||"").trim();ta(`存客宝返回 data(#${M.id})`),qo(ZR(ee)),Xa(!0)},children:"查看 data"}),!!M.ckbError&&s.jsx("p",{className:"text-[11px] text-red-300 max-w-[220px] truncate",title:M.ckbError,children:M.ckbError})]})}),s.jsx(ke,{className:"text-gray-400 whitespace-nowrap",children:M.createdAt?new Date(M.createdAt).toLocaleString():"-"}),s.jsx(ke,{className:"text-gray-400 text-xs align-top py-3 min-w-[148px]",children:s.jsxs("div",{className:"flex flex-col gap-3",children:[s.jsx("p",{className:"text-gray-400 leading-snug",children:typeof M.retryCount=="number"?`第 ${M.retryCount} 次`:"-"}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs(G,{size:"sm",variant:"outline",disabled:$s||Wo===M.id||Ko===M.id,onClick:()=>Za(M.id),className:"h-8 px-2.5 text-[11px] border-gray-600 text-gray-200 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(He,{className:`w-3 h-3 mr-1 ${Wo===M.id?"animate-spin":""}`}),"重推"]}),s.jsxs(G,{size:"sm",variant:"outline",disabled:$s||Ko===M.id||Wo===M.id,onClick:()=>ei(M.id),className:"h-8 px-2.5 text-[11px] border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent shrink-0",children:[s.jsx(ls,{className:`w-3 h-3 mr-1 ${Ko===M.id?"animate-pulse":""}`}),"删除"]})]})]})})]},M.id)),ks.length===0&&s.jsx(bt,{children:s.jsx(ke,{colSpan:9,className:"p-0 align-top",children:s.jsxs("div",{className:"py-16 px-6 text-center border-t border-gray-700/40 bg-[#0a1628]/30",children:[s.jsx(_c,{className:"w-14 h-14 text-[#38bdac]/20 mx-auto mb-4","aria-hidden":!0}),s.jsx("p",{className:"text-gray-200 font-medium mb-1",children:"暂无获客线索"}),s.jsx("p",{className:"text-gray-500 text-sm mb-6 max-w-md mx-auto leading-relaxed",children:hs.trim()||Ar?"当前搜索或来源筛选下没有匹配记录,可清空条件后重试。":"存客宝场景产生的手机号 / 微信留资会出现在此列表。请确认获客计划已开启,并有用户完成留资。"}),s.jsxs(G,{type:"button",variant:"outline",onClick:()=>lt(),disabled:Zt,className:"border-[#38bdac]/40 text-[#38bdac] hover:bg-[#38bdac]/10 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${Zt?"animate-spin":""}`}),"重新加载"]})]})})})]})]}),s.jsx(cr,{page:Ne,totalPages:Math.ceil(Ds/Nt)||1,total:Ds,pageSize:Nt,onPageChange:Xe,onPageSizeChange:()=>{}})]})})})]}),s.jsxs(sn,{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(G,{variant:"outline",onClick:Tn,disabled:Dt,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${Dt?"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:Cc.map((M,ee)=>s.jsxs("div",{className:"relative flex flex-col items-center",children:[s.jsxs("div",{className:`relative w-full p-3 rounded-xl border ${M.color} text-center cursor-pointer hover:opacity-80 transition-opacity ${yt===M.id?"ring-2 ring-[#38bdac]":""}`,onClick:()=>ss(M.id),title:`点击查看「${M.label}」阶段的用户`,children:[s.jsx("div",{className:"text-2xl mb-1",children:M.icon}),s.jsx("div",{className:`text-xs font-medium ${M.color.split(" ").find(be=>be.startsWith("text-"))}`,children:M.label}),Qe[M.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:Qe[M.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:ee+1})]}),ees.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:M.step}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-300",children:M.action}),s.jsxs("p",{className:"text-gray-600 text-xs",children:["→ ",M.next]})]})]},M.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(dr,{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:"实时更新"})]}),Dt?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(He,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Object.keys(Qe).length>0?s.jsx("div",{className:"space-y-2",children:(()=>{const M=Cc.reduce((ee,be)=>ee+(Qe[be.id]||0),0);return Cc.map(ee=>{const be=Qe[ee.id]||0,Me=M>0?Math.round(be/M*100):0,Ge=be>0?Math.max(Me,6):0;return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-gray-500 text-xs w-[5.5rem] shrink-0 leading-tight",children:[ee.icon," ",ee.label]}),s.jsx("div",{className:"flex-1 h-2.5 bg-[#0a1628] rounded-full overflow-hidden border border-gray-700/40",children:s.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-[#38bdac]/50 to-[#38bdac] transition-all",style:{width:`${Ge}%`}})}),s.jsx("span",{className:"text-gray-400 text-xs w-14 text-right tabular-nums",children:be}),s.jsx("span",{className:"text-gray-600 text-[10px] w-8 text-right tabular-nums",children:M>0?`${Me}%`:"—"})]},ee.id)})})()}):s.jsx("div",{className:"text-center py-8",children:s.jsx("p",{className:"text-gray-500 text-sm",children:"点击「刷新数据」加载统计"})})]})]}),yt&&s.jsxs("div",{className:"mt-6 bg-[#0f2137] border border-gray-700/50 rounded-lg p-4",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(Un,{className:"w-4 h-4 text-[#38bdac]"}),s.jsxs("span",{className:"text-white font-medium",children:[(Hi=Cc.find(M=>M.id===yt))==null?void 0:Hi.icon," ",(Bu=Cc.find(M=>M.id===yt))==null?void 0:Bu.label," 阶段用户"]}),s.jsxs(Be,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-xs",children:[Jt.length," 人"]})]}),s.jsx(G,{variant:"ghost",size:"sm",onClick:()=>Pt(null),className:"text-gray-400 hover:text-white",children:s.jsx(Yn,{className:"w-4 h-4"})})]}),Os?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(He,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Jt.length===0?s.jsx("p",{className:"text-gray-500 text-center py-6",children:"该阶段暂无用户"}):s.jsxs(vs,{children:[s.jsx(Ns,{children:s.jsxs(bt,{className:"border-gray-700",children:[s.jsx(Se,{className:"text-gray-400",children:"昵称"}),s.jsx(Se,{className:"text-gray-400",children:"手机号"}),s.jsx(Se,{className:"text-gray-400",children:"注册时间"}),s.jsx(Se,{className:"text-gray-400 text-right",children:"操作"})]})}),s.jsx(ws,{children:Jt.map(M=>s.jsxs(bt,{className:"border-gray-700/50 hover:bg-[#0a1628]",children:[s.jsx(ke,{className:"text-white",children:M.nickname||"微信用户"}),s.jsx(ke,{className:"text-gray-300",children:M.phone||"-"}),s.jsx(ke,{className:"text-gray-400 text-xs",children:M.createdAt?new Date(M.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx(ke,{className:"text-right",children:s.jsxs(G,{variant:"ghost",size:"sm",className:"text-[#38bdac] hover:bg-[#38bdac]/10",onClick:()=>jn(M.id,M.nickname||"微信用户"),children:[s.jsx(Nf,{className:"w-4 h-4 mr-1"})," 行为轨迹"]})})]},M.id))})]})]}),s.jsx(Bt,{open:!!qa,onOpenChange:M=>{M||Gr(null)},children:s.jsxs($t,{className:"sm:max-w-[600px] bg-[#0f2137] border-gray-700 text-white max-h-[80vh] overflow-y-auto",children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(ua,{className:"w-5 h-5 text-[#38bdac]"}),Jr," 的行为轨迹"]})}),Qr?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):Tr.length===0?s.jsx("p",{className:"text-gray-500 text-center py-8",children:"该用户暂无行为记录"}):s.jsxs("div",{className:"relative pl-6 space-y-0",children:[s.jsx("div",{className:"absolute left-[11px] top-2 bottom-2 w-0.5 bg-gray-700"}),Tr.map((M,ee)=>s.jsxs("div",{className:"relative flex items-start gap-3 py-2",children:[s.jsx("div",{className:"absolute left-[-13px] top-3 w-2.5 h-2.5 rounded-full bg-[#38bdac] border-2 border-[#0f2137] z-10"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"text-white text-sm font-medium",children:M.actionLabel}),M.module&&s.jsx(Be,{className:"bg-purple-500/10 text-purple-400 border border-purple-500/30 text-[10px]",children:M.module})]}),(M.chapterTitle||M.target)&&s.jsx("p",{className:"text-gray-400 text-xs mt-0.5 truncate",children:M.chapterTitle||M.target}),s.jsxs("p",{className:"text-gray-600 text-[10px] mt-0.5",children:[M.timeAgo," · ",M.createdAt?new Date(M.createdAt).toLocaleString("zh-CN"):""]})]})]},M.id||ee))]})]})})]}),s.jsxs(sn,{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(G,{variant:"outline",onClick:Ys,disabled:hn,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${hn?"animate-spin":""}`})," 刷新"]}),s.jsxs(G,{onClick:()=>{Zn(null),yn({title:"",description:"",trigger:"",triggerConditions:[],actionType:"popup",sort:0,enabled:!0}),En(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx($n,{className:"w-4 h-4 mr-2"})," 添加规则"]})]})]}),hn?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):un.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(dr,{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(G,{onClick:Ys,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(He,{className:"w-4 h-4 mr-2"})," 重新加载"]})]}):s.jsx("div",{className:"space-y-2",children:un.map(M=>{var be;const ee=m2(M.triggerConditions);return s.jsxs("div",{className:`p-3 rounded-lg border transition-all ${M.enabled?"bg-[#0f2137] border-gray-700/50":"bg-[#0a1628]/50 border-gray-700/30 opacity-55"}`,children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[s.jsxs("span",{className:"text-gray-600 text-xs font-mono w-5 shrink-0 text-right",children:["#",M.sort]}),s.jsx(tn,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0"}),s.jsx("span",{className:"text-white font-medium text-sm truncate",children:M.title}),M.trigger&&s.jsx(Be,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-[10px] shrink-0",children:M.trigger}),ee.length>0&&s.jsxs("div",{className:"flex flex-wrap gap-0.5 ml-1",children:[ee.slice(0,3).map(Me=>{const Ge=Z1.find(Je=>Je.value===Me);return s.jsx(Be,{className:"bg-purple-500/10 text-purple-400 border border-purple-500/30 text-[9px]",children:(Ge==null?void 0:Ge.label)||Me},Me)}),ee.length>3&&s.jsxs("span",{className:"text-gray-500 text-[9px]",children:["+",ee.length-3]})]}),M.actionType&&M.actionType!=="popup"&&s.jsx(Be,{className:"bg-amber-500/10 text-amber-400 border border-amber-500/30 text-[9px] shrink-0",children:((be=eN.find(Me=>Me.value===M.actionType))==null?void 0:be.label)||M.actionType})]}),s.jsxs("div",{className:"flex items-center gap-1.5 ml-3 shrink-0",children:[s.jsx(Ut,{checked:M.enabled,onCheckedChange:()=>Xs(M)}),s.jsx(G,{variant:"ghost",size:"sm",onClick:()=>{Zn(M),yn({title:M.title,description:M.description,trigger:M.trigger,triggerConditions:ee,actionType:M.actionType||"popup",sort:M.sort,enabled:M.enabled}),En(!0)},className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10 h-7 w-7 p-0",children:s.jsx(tn,{className:"w-3.5 h-3.5"})}),s.jsx(G,{variant:"ghost",size:"sm",onClick:()=>br(M.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10 h-7 w-7 p-0",children:s.jsx(ls,{className:"w-3.5 h-3.5"})})]})]}),M.description&&s.jsxs("details",{className:"ml-[52px] mt-1",children:[s.jsxs("summary",{className:"text-gray-500 text-xs cursor-pointer hover:text-gray-400 select-none",children:["查看完整描述",s.jsxs("span",{className:"text-gray-600 ml-1",children:["(",M.description.length," 字,默认折叠)"]})]}),s.jsx("p",{className:"text-gray-400 text-sm mt-1 pl-1 border-l-2 border-gray-700 whitespace-pre-wrap",children:M.description})]})]},M.id)})})]}),s.jsxs(sn,{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(G,{variant:"outline",onClick:ts,disabled:We,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${We?"animate-spin":""}`})," ","刷新"]})})]}),We?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):we.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(zc,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:s.jsxs(vs,{children:[s.jsx(Ns,{children:s.jsxs(bt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Se,{className:"text-gray-400 w-12",children:"序号"}),s.jsx(Se,{className:"text-gray-400",children:"成员"}),s.jsx(Se,{className:"text-gray-400 min-w-40",children:"超级个体标签"}),s.jsx(Se,{className:"text-gray-400 w-16 text-center",children:"头像点击"}),s.jsx(Se,{className:"text-gray-400 w-16 text-center",children:"获客数"}),s.jsx(Se,{className:"text-gray-400 w-20",children:"排序值"}),s.jsx(Se,{className:"text-gray-400 w-36",children:"飞书群"}),s.jsx(Se,{className:"text-gray-400 w-36 text-right",children:"操作"})]})}),s.jsx(ws,{children:we.map((M,ee)=>{var Ge;const be=Lt===M.id,Me=$e===M.id;return s.jsxs(bt,{draggable:!0,onDragStart:Je=>je(Je,M.id),onDragOver:Je=>Ke(Je,M.id),onDrop:Je=>wt(Je,M.id),onDragEnd:mt,className:`border-gray-700/50 cursor-grab active:cursor-grabbing select-none ${be?"opacity-60":""} ${Me?"bg-[#38bdac]/10":""}`,children:[s.jsx(ke,{className:"text-gray-300",children:ee+1}),s.jsx(ke,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[gr(M.avatar,M.mbti)?s.jsx("img",{src:gr(M.avatar,M.mbti),className:"w-8 h-8 rounded-full object-cover border border-amber-400/60",alt:"",onError:Je=>{var Ve,Qt;Je.target.style.display="none";const zt=document.createElement("div");zt.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",zt.textContent=((Ve=M.name)==null?void 0:Ve[0])||"创",(Qt=Je.target.parentElement)==null||Qt.appendChild(zt)}}):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:((Ge=M.name)==null?void 0:Ge[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:M.name})})]})}),s.jsx(ke,{className:"text-gray-300 whitespace-nowrap",children:M.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置)"})}),s.jsx(ke,{className:"text-center text-blue-400 text-xs font-mono",children:M.clickCount!=null?String(M.clickCount):"-"}),s.jsx(ke,{className:"text-center text-green-400 text-xs font-mono",children:M.leadCount!=null?String(M.leadCount):"-"}),s.jsx(ke,{className:"text-gray-300",children:M.vipSort??ee+1}),s.jsx(ke,{className:"text-xs",children:M.webhookUrl?s.jsx("span",{className:"text-[#38bdac] truncate block max-w-[180px]",title:M.webhookUrl,children:"已配置"}):s.jsx("span",{className:"text-gray-500",children:"未配置"})}),s.jsx(ke,{className:"text-right text-xs text-gray-300",children:s.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[s.jsx(G,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-amber-300 hover:text-amber-200",onClick:()=>si(M),title:"设置超级个体标签",children:s.jsx(su,{className:"w-3.5 h-3.5"})}),s.jsx(G,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-[#38bdac] hover:text-[#5fe0cd]",onClick:()=>ud(M),title:"编辑飞书群Webhook",children:s.jsx(tn,{className:"w-3.5 h-3.5"})}),s.jsx(G,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-sky-300 hover:text-sky-200",onClick:()=>B(M),title:"设置排序序号",children:s.jsx(Ig,{className:"w-3.5 h-3.5"})})]})})]},M.id)})})]})})})]})]}),s.jsx(Bt,{open:jt,onOpenChange:Nn,children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-6xl",children:[s.jsx(Vt,{children:s.jsx(Ht,{className:"text-white",children:"MBTI 默认头像库"})}),s.jsx(JR,{})]})}),s.jsx(Bt,{open:ri,onOpenChange:M=>{Rr(M),M||Vi(null)},children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Ig,{className:"w-5 h-5 text-[#38bdac]"}),"设置排序 — ",Lr==null?void 0:Lr.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(ne,{className:"text-gray-300 text-sm",children:"排序序号(数字越小越靠前)"}),s.jsx(de,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:1",value:tl,onChange:M=>nl(M.target.value)})]}),s.jsxs(gn,{children:[s.jsxs(G,{variant:"outline",onClick:()=>Rr(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(G,{onClick:ue,disabled:ai,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),ai?"保存中...":"保存"]})]})]})}),s.jsx(Bt,{open:Zs,onOpenChange:M=>{Bi(M),M||Ea(null)},children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(zc,{className:"w-5 h-5 text-amber-400"}),"设置超级个体标签 — ",Ca==null?void 0:Ca.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(ne,{className:"text-gray-300 text-sm",children:"选择或输入标签"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:Xo.map(M=>s.jsx(G,{variant:Pr===M?"default":"outline",size:"sm",className:Pr===M?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50",onClick:()=>Ta(M),children:M},M))}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"或手动输入"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创业者、资源整合者等",value:Pr,onChange:M=>Ta(M.target.value)})]})]}),s.jsxs(gn,{children:[s.jsxs(G,{variant:"outline",onClick:()=>Bi(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(G,{onClick:()=>Zo(Pr),disabled:Qo,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),Qo?"保存中...":"保存"]})]})]})}),s.jsx(Bt,{open:ti,onOpenChange:M=>{na(M),M||Aa(null)},children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-xl",children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(tn,{className:"w-5 h-5 text-[#38bdac]"}),"设置飞书群 Webhook — ",Ma==null?void 0:Ma.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(ne,{className:"text-gray-300 text-sm",children:"VOX Webhook 地址(留空即清空)"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",value:ni,onChange:M=>Yo(M.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"当用户点击该超级个体头像并提交链接时,线索将优先推送到这里配置的飞书群。"})]}),s.jsxs(gn,{children:[s.jsxs(G,{variant:"outline",onClick:()=>na(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(G,{onClick:el,disabled:ns,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),ns?"保存中...":"保存"]})]})]})}),s.jsx(Bt,{open:I,onOpenChange:J,children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[z?s.jsx(tn,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(_c,{className:"w-5 h-5 text-[#38bdac]"}),z?"编辑用户":"添加用户"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"手机号"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:pt.phone,onChange:M=>It({...pt,phone:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"昵称"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:pt.nickname,onChange:M=>It({...pt,nickname:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:z?"新密码 (留空则不修改)":"密码"}),s.jsx(de,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:z?"留空则不修改":"请输入密码",value:pt.password,onChange:M=>It({...pt,password:M.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(ne,{className:"text-gray-300",children:"管理员权限"}),s.jsx(Ut,{checked:pt.isAdmin,onCheckedChange:M=>It({...pt,isAdmin:M})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(ne,{className:"text-gray-300",children:"已购全书"}),s.jsx(Ut,{checked:pt.hasFullBook,onCheckedChange:M=>It({...pt,hasFullBook:M})})]})]}),s.jsxs(gn,{children:[s.jsxs(G,{variant:"outline",onClick:()=>J(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(G,{onClick:Sa,disabled:X,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),X?"保存中...":"保存"]})]})]})}),s.jsx(Bt,{open:xn,onOpenChange:En,children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[90vh] overflow-y-auto",children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(tn,{className:"w-5 h-5 text-[#38bdac]"}),Vn?"编辑规则":"添加规则"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"规则标题 *"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:匹配后填写头像、付款1980需填写信息",value:Rt.title,onChange:M=>yn({...Rt,title:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"规则描述"}),s.jsx($l,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[60px] resize-none",placeholder:"弹窗内容/推送文案...",value:Rt.description,onChange:M=>yn({...Rt,description:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"触发条件(可多选)"}),s.jsx("div",{className:"space-y-2",children:["用户状态","阅读行为","付费行为","社交行为","分销行为"].map(M=>{const ee=Z1.filter(be=>be.group===M);return ee.length===0?null:s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] text-gray-500 mb-1",children:M}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:ee.map(be=>{const Me=(Rt.triggerConditions||[]).includes(be.value);return s.jsx("button",{type:"button",className:`px-2.5 py-1 rounded-md text-xs border transition-colors ${Me?"bg-[#38bdac]/20 border-[#38bdac]/50 text-[#38bdac]":"bg-[#0a1628] border-gray-700 text-gray-400 hover:border-gray-500"}`,onClick:()=>{const Ge=Rt.triggerConditions||[],Je=Me?Ge.filter(zt=>zt!==be.value):[...Ge,be.value];yn({...Rt,triggerConditions:Je})},children:be.label},be.value)})})]},M)})}),(Rt.triggerConditions||[]).length>0&&s.jsxs("p",{className:"text-[10px] text-[#38bdac]",children:["已选 ",(Rt.triggerConditions||[]).length," 个触发条件(满足任一即触发)"]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"兼容触发标识(旧版)"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white text-xs h-8",placeholder:"与小程序一致:注册、完成付款、update_avatar、update_nickname 等",value:Rt.trigger,onChange:M=>yn({...Rt,trigger:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"推送动作"}),s.jsx("div",{className:"grid grid-cols-2 gap-2",children:eN.map(M=>s.jsxs("button",{type:"button",className:`p-2 rounded-lg border text-left transition-colors ${Rt.actionType===M.value?"bg-[#38bdac]/15 border-[#38bdac]/50":"bg-[#0a1628] border-gray-700 hover:border-gray-500"}`,onClick:()=>yn({...Rt,actionType:M.value}),children:[s.jsx("span",{className:`text-xs font-medium ${Rt.actionType===M.value?"text-[#38bdac]":"text-gray-300"}`,children:M.label}),s.jsx("p",{className:"text-[10px] text-gray-500 mt-0.5",children:M.desc})]},M.value))})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{children:s.jsx(ne,{className:"text-gray-300",children:"启用状态"})}),s.jsx(Ut,{checked:Rt.enabled,onCheckedChange:M=>yn({...Rt,enabled:M})})]})]}),s.jsxs(gn,{children:[s.jsxs(G,{variant:"outline",onClick:()=>En(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(G,{onClick:dd,disabled:X,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),X?"保存中...":"保存"]})]})]})}),s.jsx(Bt,{open:W,onOpenChange:fe,children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Un,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系 - ",O==null?void 0:O.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:((pd=he.stats)==null?void 0:pd.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:((md=he.stats)==null?void 0:md.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:["¥",(((gd=he.stats)==null?void 0:gd.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:["¥",(((xd=he.stats)==null?void 0:xd.pendingEarnings)||0).toFixed(2)]}),s.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),D?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(He,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((yd=he.referrals)==null?void 0:yd.length)??0)>0?s.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(he.referrals??[]).map((M,ee)=>{var Me;const be=M;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:((Me=be.nickname)==null?void 0:Me.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white text-sm",children:be.nickname}),s.jsx("div",{className:"text-xs text-gray-500",children:be.phone||(be.hasOpenId?"微信用户":"未绑定")})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[be.status==="vip"&&s.jsx(Be,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),be.status==="paid"&&s.jsxs(Be,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",be.purchasedSections,"章"]}),be.status==="free"&&s.jsx(Be,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),s.jsx("span",{className:"text-xs text-gray-500",children:be.createdAt?new Date(be.createdAt).toLocaleDateString():""})]})]},be.id||ee)})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),s.jsx(gn,{children:s.jsx(G,{variant:"outline",onClick:()=>fe(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),s.jsx(ry,{open:se,onClose:()=>ve(!1),userId:ze,onUserUpdated:Qs}),s.jsx(Bt,{open:_i,onOpenChange:Xa,children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700/60 text-white max-w-2xl",children:[s.jsx(Vt,{children:s.jsx(Ht,{className:"text-white",children:$i})}),s.jsx("div",{className:"mt-2",children:s.jsx("pre",{className:"text-xs text-gray-200 bg-[#0a1628] border border-gray-700/60 rounded-lg p-3 max-h-[520px] overflow-auto whitespace-pre-wrap break-words",children:wa||"—"})}),s.jsxs(gn,{children:[s.jsx(G,{type:"button",variant:"outline",className:"border-gray-600 text-gray-200 hover:bg-gray-700/50 bg-transparent",onClick:async()=>{try{await navigator.clipboard.writeText(wa||""),Y.success("已复制 data")}catch{Y.error("复制失败,请手动复制")}},disabled:!wa,children:"复制 data"}),s.jsx(G,{type:"button",className:"bg-[#38bdac] hover:bg-[#2aa896] text-white",onClick:()=>Xa(!1),children:"关闭"})]})]})})]})}function Tf(t,[e,n]){return Math.min(n,Math.max(e,t))}var g2=["PageUp","PageDown"],x2=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],y2={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},ad="Slider",[Hx,t8,n8]=ey(ad),[b2]=_o(ad,[n8]),[s8,Pp]=b2(ad),v2=y.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:b=!1,form:N,...j}=t,v=y.useRef(new Set),k=y.useRef(0),C=o==="horizontal"?r8:a8,[P=[],L]=Ll({prop:f,defaultProp:h,onChange:re=>{var ie;(ie=[...v.current][k.current])==null||ie.focus(),m(re)}}),U=y.useRef(P);function _(re){const $=d8(P,re);Z(re,$)}function H(re){Z(re,k.current)}function R(){const re=U.current[k.current];P[k.current]!==re&&g(P)}function Z(re,$,{commit:ie}={commit:!1}){const ce=p8(i),me=m8(Math.round((re-r)/i)*i+r,ce),I=Tf(me,[r,a]);L((J=[])=>{const z=l8(J,I,$);if(f8(z,u*i)){k.current=z.indexOf(I);const ge=String(z)!==String(J);return ge&&ie&&g(z),ge?z:J}else return J})}return s.jsx(s8,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:a,valueIndexToChangeRef:k,thumbs:v.current,values:P,orientation:o,form:N,children:s.jsx(Hx.Provider,{scope:t.__scopeSlider,children:s.jsx(Hx.Slot,{scope:t.__scopeSlider,children:s.jsx(C,{"aria-disabled":c,"data-disabled":c?"":void 0,...j,ref:e,onPointerDown:St(j.onPointerDown,()=>{c||(U.current=P)}),min:r,max:a,inverted:b,onSlideStart:c?void 0:_,onSlideMove:c?void 0:H,onSlideEnd:c?void 0:R,onHomeKeyDown:()=>!c&&Z(r,0,{commit:!0}),onEndKeyDown:()=>!c&&Z(a,P.length-1,{commit:!0}),onStepKeyDown:({event:re,direction:$})=>{if(!c){const me=g2.includes(re.key)||re.shiftKey&&x2.includes(re.key)?10:1,I=k.current,J=P[I],z=i*me*$;Z(J+z,I,{commit:!0})}}})})})})});v2.displayName=ad;var[N2,w2]=b2(ad,{startEdge:"left",endEdge:"right",size:"width",direction:1}),r8=y.forwardRef((t,e)=>{const{min:n,max:r,dir:a,inverted:i,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onStepKeyDown:h,...f}=t,[m,g]=y.useState(null),b=Gt(e,C=>g(C)),N=y.useRef(void 0),j=Mp(a),v=j==="ltr",k=v&&!i||!v&&i;function T(C){const P=N.current||m.getBoundingClientRect(),L=[0,P.width],_=ay(L,k?[n,r]:[r,n]);return N.current=P,_(C-P.left)}return s.jsx(N2,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:s.jsx(j2,{dir:j,"data-orientation":"horizontal",...f,ref:b,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:C=>{const P=T(C.clientX);o==null||o(P)},onSlideMove:C=>{const P=T(C.clientX);c==null||c(P)},onSlideEnd:()=>{N.current=void 0,u==null||u()},onStepKeyDown:C=>{const L=y2[k?"from-left":"from-right"].includes(C.key);h==null||h({event:C,direction:L?-1:1})}})})}),a8=y.forwardRef((t,e)=>{const{min:n,max:r,inverted:a,onSlideStart:i,onSlideMove:o,onSlideEnd:c,onStepKeyDown:u,...h}=t,f=y.useRef(null),m=Gt(e,f),g=y.useRef(void 0),b=!a;function N(j){const v=g.current||f.current.getBoundingClientRect(),k=[0,v.height],C=ay(k,b?[r,n]:[n,r]);return g.current=v,C(j-v.top)}return s.jsx(N2,{scope:t.__scopeSlider,startEdge:b?"bottom":"top",endEdge:b?"top":"bottom",size:"height",direction:b?1:-1,children:s.jsx(j2,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:j=>{const v=N(j.clientY);i==null||i(v)},onSlideMove:j=>{const v=N(j.clientY);o==null||o(v)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:j=>{const k=y2[b?"from-bottom":"from-top"].includes(j.key);u==null||u({event:j,direction:k?-1:1})}})})}),j2=y.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:a,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:c,onStepKeyDown:u,...h}=t,f=Pp(ad,n);return s.jsx(Mt.span,{...h,ref:e,onKeyDown:St(t.onKeyDown,m=>{m.key==="Home"?(o(m),m.preventDefault()):m.key==="End"?(c(m),m.preventDefault()):g2.concat(x2).includes(m.key)&&(u(m),m.preventDefault())}),onPointerDown:St(t.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(g)?g.focus():r(m)}),onPointerMove:St(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&a(m)}),onPointerUp:St(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),i(m))})})}),k2="SliderTrack",S2=y.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=Pp(k2,n);return s.jsx(Mt.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...r,ref:e})});S2.displayName=k2;var Ux="SliderRange",C2=y.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=Pp(Ux,n),i=w2(Ux,n),o=y.useRef(null),c=Gt(e,o),u=a.values.length,h=a.values.map(g=>M2(g,a.min,a.max)),f=u>1?Math.min(...h):0,m=100-Math.max(...h);return s.jsx(Mt.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...r,ref:c,style:{...t.style,[i.startEdge]:f+"%",[i.endEdge]:m+"%"}})});C2.displayName=Ux;var Wx="SliderThumb",E2=y.forwardRef((t,e)=>{const n=t8(t.__scopeSlider),[r,a]=y.useState(null),i=Gt(e,c=>a(c)),o=y.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return s.jsx(i8,{...t,ref:i,index:o})}),i8=y.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:a,...i}=t,o=Pp(Wx,n),c=w2(Wx,n),[u,h]=y.useState(null),f=Gt(e,T=>h(T)),m=u?o.form||!!u.closest("form"):!0,g=sy(u),b=o.values[r],N=b===void 0?0:M2(b,o.min,o.max),j=c8(r,o.values.length),v=g==null?void 0:g[c.size],k=v?u8(v,N,c.direction):0;return y.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(${N}% + ${k}px)`},children:[s.jsx(Hx.ItemSlot,{scope:t.__scopeSlider,children:s.jsx(Mt.span,{role:"slider","aria-label":t["aria-label"]||j,"aria-valuemin":o.min,"aria-valuenow":b,"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:b===void 0?{display:"none"}:t.style,onFocus:St(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),m&&s.jsx(T2,{name:a??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:b},r)]})});E2.displayName=Wx;var o8="RadioBubbleInput",T2=y.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const a=y.useRef(null),i=Gt(a,r),o=ny(e);return y.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(Mt.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});T2.displayName=o8;function l8(t=[],e,n){const r=[...t];return r[n]=e,r.sort((a,i)=>a-i)}function M2(t,e,n){const i=100/(n-e)*(t-e);return Tf(i,[0,100])}function c8(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function d8(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 u8(t,e,n){const r=t/2,i=ay([0,50],[0,r]);return(r-i(e)*n)*n}function h8(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function f8(t,e){if(e>0){const n=h8(t);return Math.min(...n)>=e}return!0}function ay(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 p8(t){return(String(t).split(".")[1]||"").length}function m8(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var g8=v2,x8=S2,y8=C2,b8=E2;function v8({className:t,defaultValue:e,value:n,min:r=0,max:a=100,...i}){const o=y.useMemo(()=>Array.isArray(n)?n:Array.isArray(e)?e:[r,a],[n,e,r,a]);return s.jsxs(g8,{defaultValue:e,value:n,min:r,max:a,className:Ot("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",t),...i,children:[s.jsx(x8,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:s.jsx(y8,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:o.length},(c,u)=>s.jsx(b8,{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 N8={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,withdrawFee:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function A2(t){const e=!!(t!=null&&t.embedded),[n,r]=y.useState(N8),[a,i]=y.useState(!0),[o,c]=y.useState(!1);y.useEffect(()=>{Oe("/api/admin/referral-settings").then(f=>{const m=f==null?void 0:f.data;m&&typeof m=="object"&&r({distributorShare:m.distributorShare??90,minWithdrawAmount:m.minWithdrawAmount??10,bindingDays:m.bindingDays??30,userDiscount:m.userDiscount??5,withdrawFee:m.withdrawFee??5,enableAutoWithdraw:m.enableAutoWithdraw??!1,vipOrderShareVip:m.vipOrderShareVip??20,vipOrderShareNonVip:m.vipOrderShareNonVip??10})}).catch(console.error).finally(()=>i(!1))},[]);const u=async()=>{c(!0);try{const f={distributorShare:Number(n.distributorShare)||0,minWithdrawAmount:Number(n.minWithdrawAmount)||0,bindingDays:Number(n.bindingDays)||0,userDiscount:Number(n.userDiscount)||0,withdrawFee:Number(n.withdrawFee)??5,enableAutoWithdraw:!!n.enableAutoWithdraw,vipOrderShareVip:Number(n.vipOrderShareVip)||20,vipOrderShareNonVip:Number(n.vipOrderShareNonVip)||10},m=await kt("/api/admin/referral-settings",f);if(!m||m.success===!1){Y.error("保存失败: "+(m&&typeof m=="object"&&"error"in m?m.error:""));return}Y.success(`✅ 分销配置已保存成功! + +• 小程序与网站的推广规则会一起生效 +• 绑定关系会使用新的天数配置 +• 佣金比例会立即应用到新订单 + +如有缓存,请刷新前台/小程序页面。`)}catch(f){console.error(f),Y.error("保存失败: "+(f instanceof Error?f.message:String(f)))}finally{c(!1)}},h=f=>m=>{const g=parseFloat(m.target.value||"0");r(b=>({...b,[f]:isNaN(g)?0:g}))};return a?s.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):s.jsxs("div",{className:e?"p-4 w-full":"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(Uc,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置(与系统设置中的「推广功能」开关配合:开关在"," ",s.jsx(Al,{to:"/settings",className:"text-[#38bdac] underline hover:text-[#5ee0d1]",children:"系统设置 → 功能开关"}),")。"]})]}),s.jsxs(G,{onClick:u,disabled:o||a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),o?"保存中...":"保存配置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"flex items-center gap-2 text-white",children:[s.jsx(LM,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),s.jsx(Xt,{className:"text-gray-400",children:"这三项会直接体现在小程序「推广规则」卡片上,同时影响实收佣金计算。"})]}),s.jsx(_e,{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(ne,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Dh,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),s.jsx(de,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:n.userDiscount,onChange:h("userDiscount")}),s.jsx("p",{className:"text-xs text-gray-500",children:"例如 5 表示好友立减 5%(在价格配置基础上生效)。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Un,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(v8,{className:"flex-1",min:10,max:100,step:1,value:[n.distributorShare],onValueChange:([f])=>r(m=>({...m,distributorShare:f}))}),s.jsx(de,{type:"number",min:0,max:100,className:"w-20 bg-[#0a1628] border-gray-700 text-white text-center",value:n.distributorShare,onChange:h("distributorShare")})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["内容订单佣金 = 订单金额 ×"," ",s.jsxs("span",{className:"text-[#38bdac] font-mono",children:[n.distributorShare,"%"]}),";会员订单见下方。"]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Dh,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),s.jsx(de,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:n.vipOrderShareVip,onChange:h("vipOrderShareVip")}),s.jsx("p",{className:"text-xs text-gray-500",children:"推广者已是会员时,会员订单佣金比例,默认 20%。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Dh,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),s.jsx(de,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:n.vipOrderShareNonVip,onChange:h("vipOrderShareNonVip")}),s.jsx("p",{className:"text-xs text-gray-500",children:"推广者非会员时,会员订单佣金比例,默认 10%。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Un,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),s.jsx(de,{type:"number",min:1,max:365,className:"bg-[#0a1628] border-gray-700 text-white",value:n.bindingDays,onChange:h("bindingDays")}),s.jsx("p",{className:"text-xs text-gray-500",children:"好友通过你的链接进来并登录后,绑定在你名下的天数。"})]})]})})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"flex items-center gap-2 text-white",children:[s.jsx(Uc,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),s.jsx(Xt,{className:"text-gray-400",children:"与「提现中心」「自动提现」相关的参数,影响推广者看到的可提现金额和最低门槛。"})]}),s.jsx(_e,{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(ne,{className:"text-gray-300",children:"最低提现金额(元)"}),s.jsx(de,{type:"number",min:0,step:1,className:"bg-[#0a1628] border-gray-700 text-white",value:n.minWithdrawAmount,onChange:h("minWithdrawAmount")}),s.jsx("p",{className:"text-xs text-gray-500",children:"小程序「满 X 元可提现」展示的门槛,同时用于后端接口校验。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"提现手续费(%)"}),s.jsx(de,{type:"number",min:0,max:100,step:.5,className:"bg-[#0a1628] border-gray-700 text-white",value:n.withdrawFee,onChange:h("withdrawFee")}),s.jsx("p",{className:"text-xs text-gray-500",children:"批准提现时按此比例扣除后打款,如 5 表示申请 100 元实际到账 95 元。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:["自动提现开关",s.jsx(Be,{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(Ut,{checked:n.enableAutoWithdraw,onCheckedChange:f=>r(m=>({...m,enableAutoWithdraw:f}))}),s.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(ut,{children:s.jsxs(ht,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[s.jsx(Dh,{className:"w-4 h-4 text-[#38bdac]"}),"使用说明"]})}),s.jsxs(_e,{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 w8(){const[t]=H0(),e=Ua(),[n,r]=y.useState("overview"),[a,i]=y.useState("orders"),[o,c]=y.useState([]),[u,h]=y.useState(null),[f,m]=y.useState([]),[g,b]=y.useState([]),[N,j]=y.useState([]),[v,k]=y.useState(!0),[T,C]=y.useState(null),[P,L]=y.useState(""),[U,_]=y.useState("all"),[H,R]=y.useState(1),[Z,re]=y.useState(10),[$,ie]=y.useState(0),[ce,me]=y.useState(new Set),[I,J]=y.useState(null),[z,ge]=y.useState(""),[X,F]=y.useState(!1),[W,fe]=y.useState(null),[he,oe]=y.useState(""),[D,q]=y.useState(!1),[O,Q]=y.useState(!1),[se,ve]=y.useState(!1),[ze,Ue]=y.useState([]),[jt,Nn]=y.useState(1),[pt,It]=y.useState(0),[un,Bn]=y.useState("");y.useEffect(()=>{t.get("tab")==="leads"&&e("/users?tab=leads",{replace:!0})},[t,e]),y.useEffect(()=>{hn()},[]),y.useEffect(()=>{const V=t.get("tab");(V==="overview"||V==="orders"||V==="bindings"||V==="withdrawals"||V==="settings")&&r(V)},[t]),y.useEffect(()=>{R(1)},[n,U]),y.useEffect(()=>{Wt(n)},[n]),y.useEffect(()=>{if(n==="orders"&&a==="giftpay"){Wt("giftPay",!0);return}["orders","bindings","withdrawals"].includes(n)&&Wt(n,!0)},[H,Z,U,P,n,a,jt,un]),y.useEffect(()=>{n==="withdrawals"&&Rt()},[n]);async function hn(){C(null);try{const V=await Oe("/api/admin/distribution/overview");V!=null&&V.success&&V.overview&&h(V.overview)}catch(V){console.error("[Admin] 概览接口异常:",V),C("加载概览失败")}try{const V=await Oe("/api/db/users");j((V==null?void 0:V.users)||[])}catch(V){console.error("[Admin] 用户数据加载失败:",V)}}async function Wt(V,Qe=!1){var vt;if(!(!Qe&&ce.has(V))){k(!0);try{const Dt=N;switch(V){case"overview":break;case"orders":{try{const xt=new URLSearchParams({page:String(H),pageSize:String(Z),...U!=="all"&&{status:U},...P&&{search:P}}),yt=await Oe(`/api/admin/orders?${xt}`);if(yt!=null&&yt.success&&yt.orders){const Pt=yt.orders.map(Jt=>{const wn=Dt.find(hr=>hr.id===Jt.userId),Os=Jt.referrerId?Dt.find(hr=>hr.id===Jt.referrerId):null;return{...Jt,amount:parseFloat(String(Jt.amount))||0,userNickname:(wn==null?void 0:wn.nickname)||Jt.userNickname||"未知用户",userPhone:(wn==null?void 0:wn.phone)||Jt.userPhone||"-",referrerNickname:(Os==null?void 0:Os.nickname)||null,referrerCode:(Os==null?void 0:Os.referralCode)??null,type:Jt.productType||Jt.type}});c(Pt),ie(yt.total??Pt.length)}else c([]),ie(0)}catch(xt){console.error(xt),C("加载订单失败"),c([])}break}case"bindings":{try{const xt=new URLSearchParams({page:String(H),pageSize:String(Z),...U!=="all"&&{status:U}}),yt=await Oe(`/api/db/distribution?${xt}`);m((yt==null?void 0:yt.bindings)||[]),ie((yt==null?void 0:yt.total)??((vt=yt==null?void 0:yt.bindings)==null?void 0:vt.length)??0)}catch(xt){console.error(xt),C("加载绑定数据失败"),m([])}break}case"withdrawals":{try{const xt=U==="completed"?"success":U==="rejected"?"failed":U,yt=new URLSearchParams({...xt&&xt!=="all"&&{status:xt},page:String(H),pageSize:String(Z)}),Pt=await Oe(`/api/admin/withdrawals?${yt}`);if(Pt!=null&&Pt.success&&Pt.withdrawals){const Jt=Pt.withdrawals.map(wn=>({...wn,account:wn.account??"未绑定微信号",status:wn.status==="success"?"completed":wn.status==="failed"?"rejected":wn.status}));b(Jt),ie((Pt==null?void 0:Pt.total)??Jt.length)}else Pt!=null&&Pt.success||C(`获取提现记录失败: ${(Pt==null?void 0:Pt.error)||"未知错误"}`),b([])}catch(xt){console.error(xt),C("加载提现数据失败"),b([])}break}case"giftPay":{try{const xt=new URLSearchParams({page:String(jt),pageSize:"20",...un&&{status:un}}),yt=await Oe(`/api/admin/gift-pay-requests?${xt}`);yt!=null&&yt.success&&yt.data?(Ue(yt.data),It(yt.total??yt.data.length)):(Ue([]),It(0))}catch(xt){console.error(xt),C("加载代付请求失败"),Ue([])}break}}me(xt=>new Set(xt).add(V))}catch(Dt){console.error(Dt)}finally{k(!1)}}}async function xn(){C(null),me(V=>{const Qe=new Set(V);return Qe.delete(n),n==="orders"&&a==="giftpay"&&Qe.delete("giftPay"),Qe}),n==="overview"&&hn(),n==="orders"&&a==="giftpay"?await Wt("giftPay",!0):await Wt(n,!0)}async function En(V){if(confirm("确认审核通过并打款?"))try{const Qe=await Yt("/api/admin/withdrawals",{id:V,action:"approve"});if(!(Qe!=null&&Qe.success)){const vt=(Qe==null?void 0:Qe.message)||(Qe==null?void 0:Qe.error)||"操作失败";Y.error(vt);return}await xn()}catch(Qe){console.error(Qe),Y.error("操作失败")}}function Vn(V){fe(V),oe("")}async function Zn(){const V=W;if(!V)return;const Qe=he.trim();if(!Qe){Y.error("请填写拒绝原因");return}q(!0);try{const vt=await Yt("/api/admin/withdrawals",{id:V,action:"reject",errorMessage:Qe});if(!(vt!=null&&vt.success)){Y.error((vt==null?void 0:vt.error)||"操作失败");return}Y.success("已拒绝该提现申请"),fe(null),oe(""),await xn()}catch(vt){console.error(vt),Y.error("操作失败")}finally{q(!1)}}async function Rt(){try{const V=await Oe("/api/admin/withdrawals/auto-approve");V!=null&&V.success&&typeof V.enableAutoApprove=="boolean"&&Q(V.enableAutoApprove)}catch{}}async function yn(V){ve(!0);try{const Qe=await Yt("/api/admin/withdrawals/auto-approve",{enableAutoApprove:V});Qe!=null&&Qe.success?(Q(V),Y.success(V?"已开启自动审批,新提现将自动打款":"已关闭自动审批")):Y.error("更新失败: "+((Qe==null?void 0:Qe.error)??""))}catch{Y.error("更新失败")}finally{ve(!1)}}function we(){W&&Y.info("已取消操作"),fe(null),oe("")}async function Te(){var V;if(!(!(I!=null&&I.orderSn)&&!(I!=null&&I.id))){F(!0),C(null);try{const Qe=await Yt("/api/admin/orders/refund",{orderSn:I.orderSn||I.id,reason:z||void 0});Qe!=null&&Qe.success?(J(null),ge(""),await Wt("orders",!0)):C((Qe==null?void 0:Qe.error)||"退款失败")}catch(Qe){const vt=Qe;C(((V=vt==null?void 0:vt.data)==null?void 0:V.error)||"退款失败,请检查网络后重试")}finally{F(!1)}}}function We(V){const Qe={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"},vt={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return s.jsx(Be,{className:`${Qe[V]||"bg-gray-500/20 text-gray-400"} border-0`,children:vt[V]||V})}const at=Math.ceil($/Z)||1,Lt=o,Ct=f.filter(V=>{var vt,Dt,xt,yt;if(!P)return!0;const Qe=P.toLowerCase();return((vt=V.refereeNickname)==null?void 0:vt.toLowerCase().includes(Qe))||((Dt=V.refereePhone)==null?void 0:Dt.includes(Qe))||((xt=V.referrerName)==null?void 0:xt.toLowerCase().includes(Qe))||((yt=V.referrerCode)==null?void 0:yt.toLowerCase().includes(Qe))}),$e=g.filter(V=>{var vt;if(!P)return!0;const Qe=P.toLowerCase();return((vt=V.userName)==null?void 0:vt.toLowerCase().includes(Qe))||V.account&&V.account.toLowerCase().includes(Qe)});return s.jsxs("div",{className:"p-8 w-full",children:[T&&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:T}),s.jsx("button",{type:"button",onClick:()=>C(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-semibold text-white",children:"推广中心"}),s.jsx("p",{className:"text-gray-500 text-sm mt-0.5",children:"分销绑定、提现审核、推广设置"})]}),s.jsxs(G,{onClick:xn,disabled:v,variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[s.jsx(He,{className:`w-3.5 h-3.5 mr-1.5 ${v?"animate-spin":""}`}),"刷新"]})]}),s.jsx("div",{className:"flex gap-1 mb-6 bg-[#0a1628] rounded-lg p-1 border border-gray-700/40",children:[{key:"overview",label:"数据概览",icon:wf},{key:"orders",label:"订单与代付",icon:vf},{key:"bindings",label:"绑定管理",icon:Si},{key:"withdrawals",label:"提现审核",icon:Uc},{key:"settings",label:"推广设置",icon:yo}].map(V=>s.jsxs("button",{type:"button",onClick:()=>{r(V.key),_("all"),L(""),V.key!=="orders"&&i("orders")},className:`flex-1 flex items-center justify-center gap-1.5 px-3 py-2 rounded-md text-sm transition-all ${n===V.key?"bg-[#38bdac] text-white shadow-md":"text-gray-400 hover:text-white hover:bg-gray-700/40"}`,children:[s.jsx(V.icon,{className:"w-3.5 h-3.5"}),V.label]},V.key))}),v?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(He,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[n==="overview"&&u&&s.jsxs("div",{className:"space-y-6",children:[s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("span",{className:"text-sm font-medium text-gray-300 flex items-center gap-2",children:[s.jsx(Mo,{className:"w-4 h-4 text-amber-400"}),"推广转化漏斗"]}),s.jsx(G,{type:"button",size:"sm",variant:"ghost",onClick:()=>void xn(),disabled:v,className:"text-gray-400 h-7",children:s.jsx(He,{className:`w-3.5 h-3.5 ${v?"animate-spin":""}`})})]}),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:"text-gray-500 text-xs border-b border-gray-700/50",children:[s.jsx("th",{className:"pb-2 text-left font-normal",children:"指标"}),s.jsx("th",{className:"pb-2 text-right font-normal",children:"今日"}),s.jsx("th",{className:"pb-2 text-right font-normal",children:"本月"}),s.jsx("th",{className:"pb-2 text-right font-normal",children:"累计"})]})}),s.jsxs("tbody",{className:"text-white",children:[s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(Nf,{className:"w-4 h-4 text-blue-400"}),"点击数"]}),s.jsx("td",{className:"py-2.5 text-right font-bold",children:u.todayClicks}),s.jsx("td",{className:"py-2.5 text-right",children:u.monthClicks}),s.jsx("td",{className:"py-2.5 text-right",children:u.totalClicks})]}),s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(Si,{className:"w-4 h-4 text-green-400"}),"绑定关系"]}),s.jsx("td",{className:"py-2.5 text-right font-bold",children:u.todayBindings}),s.jsx("td",{className:"py-2.5 text-right",children:u.monthBindings}),s.jsx("td",{className:"py-2.5 text-right",children:u.totalBindings})]}),s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(Pg,{className:"w-4 h-4 text-purple-400"}),"付款转化"]}),s.jsx("td",{className:"py-2.5 text-right font-bold",children:u.todayConversions}),s.jsx("td",{className:"py-2.5 text-right",children:u.monthConversions}),s.jsx("td",{className:"py-2.5 text-right",children:u.totalConversions})]}),s.jsxs("tr",{children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(vf,{className:"w-4 h-4 text-[#38bdac]"}),"佣金收入"]}),s.jsxs("td",{className:"py-2.5 text-right font-bold text-[#38bdac]",children:["¥",(u.todayEarnings??0).toFixed(0)]}),s.jsxs("td",{className:"py-2.5 text-right text-[#38bdac]",children:["¥",(u.monthEarnings??0).toFixed(0)]}),s.jsxs("td",{className:"py-2.5 text-right text-[#38bdac]",children:["¥",(u.totalEarnings??0).toFixed(0)]})]})]})]})}),u.conversionRate&&s.jsxs("p",{className:"text-xs text-gray-500 mt-3 text-right",children:["综合转化率 ",u.conversionRate]})]})}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(De,{className:"bg-orange-500/10 border-orange-500/30",children:s.jsx(_e,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Rx,{className:"w-5 h-5 text-orange-400 shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-orange-300 font-medium text-sm",children:"即将过期绑定"}),s.jsxs("p",{className:"text-xl font-bold text-white",children:[u.expiringBindings," ",s.jsx("span",{className:"text-sm font-normal text-orange-300/60",children:"个 · 7天内"})]})]})]})})}),s.jsx(De,{className:"bg-blue-500/10 border-blue-500/30",children:s.jsx(_e,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Uc,{className:"w-5 h-5 text-blue-400 shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-blue-300 font-medium text-sm",children:"待审核提现"}),s.jsxs("p",{className:"text-xl font-bold text-white",children:[u.pendingWithdrawals," ",s.jsxs("span",{className:"text-sm font-normal text-blue-300/60",children:["笔 · ¥",(u.pendingWithdrawAmount??0).toFixed(0)]})]})]}),s.jsx(G,{onClick:()=>r("withdrawals"),variant:"outline",size:"sm",className:"border-blue-500/50 text-blue-400 hover:bg-blue-500/20 shrink-0",children:"去审核"})]})})})]}),s.jsx(De,{className:"bg-emerald-500/10 border-emerald-500/30",children:s.jsxs(_e,{className:"p-4 flex flex-wrap items-center justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-emerald-300 font-medium text-sm",children:"获客线索(存客宝)"}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"留资列表、推送状态与重试已统一至「用户管理 → 获客列表」,避免与推广中心重复维护。"})]}),s.jsx(Al,{to:"/users?tab=leads",className:"shrink-0",children:s.jsx(G,{type:"button",variant:"outline",size:"sm",className:"border-emerald-500/50 text-emerald-400 hover:bg-emerald-500/15 bg-transparent",children:"打开获客列表"})})]})}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-4",children:s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-white/5",children:[s.jsx(Un,{className:"w-5 h-5 text-gray-400 shrink-0"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-lg font-bold text-white",children:u.totalDistributors}),s.jsx("p",{className:"text-[10px] text-gray-500",children:"推广用户"})]})]}),s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-white/5",children:[s.jsx(Pg,{className:"w-5 h-5 text-green-400 shrink-0"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-lg font-bold text-green-400",children:u.activeDistributors}),s.jsx("p",{className:"text-[10px] text-gray-500",children:"有收益用户"})]})]})]})})})]}),n==="orders"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2 mb-2",children:[s.jsx("button",{type:"button",className:`px-3 py-1.5 rounded-md text-xs font-medium transition-all ${a==="orders"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,onClick:()=>i("orders"),children:"普通订单"}),s.jsxs("button",{type:"button",className:`px-3 py-1.5 rounded-md text-xs font-medium transition-all ${a==="giftpay"?"bg-amber-500/20 text-amber-400 border border-amber-500/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,onClick:()=>{i("giftpay"),Wt("giftPay",!0)},children:[s.jsx(Lx,{className:"w-3 h-3 inline mr-1"}),"代付请求"]})]}),a==="orders"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(za,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(de,{value:P,onChange:V=>L(V.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:U,onChange:V=>_(V.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white shrink-0",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.jsxs(G,{type:"button",variant:"outline",onClick:()=>void xn(),disabled:v,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${v?"animate-spin":""}`}),"刷新"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-0",children:[o.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:Lt.map(V=>{var Qe,vt;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:[(Qe=V.id)==null?void 0:Qe.slice(0,12),"..."]}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:V.userNickname}),s.jsx("p",{className:"text-gray-500 text-xs",children:V.userPhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:(()=>{const Dt=V.productType||V.type,xt=V.description||"",yt=String(V.productId||V.sectionId||""),Pt=Dt==="vip"||xt.includes("VIP")||xt.toLowerCase().includes("vip")||yt.toLowerCase().includes("vip");return Dt==="balance_recharge"?`余额充值 ¥${typeof V.amount=="number"?V.amount.toFixed(2):parseFloat(String(V.amount||"0")).toFixed(2)}`:Pt?"超级个体开通费用":Dt==="fullbook"?`${V.bookName||"《底层逻辑》"} - 全本`:Dt==="match"?"匹配次数购买":`${V.bookName||"《底层逻辑》"} - ${V.sectionTitle||V.chapterTitle||`章节${V.productId||V.sectionId||""}`}`})()}),s.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const Dt=V.productType||V.type,xt=V.description||"",yt=String(V.productId||V.sectionId||""),Pt=Dt==="vip"||xt.includes("VIP")||xt.toLowerCase().includes("vip")||yt.toLowerCase().includes("vip");return Dt==="balance_recharge"?"余额充值":Pt?"超级个体":Dt==="fullbook"?"全书解锁":Dt==="match"?"功能权益":V.chapterTitle||"单章购买"})()})]})}),s.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof V.amount=="number"?V.amount.toFixed(2):parseFloat(String(V.amount||"0")).toFixed(2)]}),s.jsx("td",{className:"p-4 text-gray-300",children:V.paymentMethod==="wechat"?"微信支付":V.paymentMethod==="balance"?"余额支付":V.paymentMethod==="alipay"?"支付宝":V.paymentMethod||"微信支付"}),s.jsx("td",{className:"p-4",children:V.status==="refunded"?s.jsx(Be,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):V.status==="completed"||V.status==="paid"?s.jsx(Be,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):V.status==="pending"||V.status==="created"?s.jsx(Be,{className:"bg-yellow-500/20 text-yellow-400 border-0",children:"待支付"}):s.jsx(Be,{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:V.refundReason,children:V.status==="refunded"&&V.refundReason?V.refundReason:"-"}),s.jsx("td",{className:"p-4 text-gray-300 text-sm",children:V.referrerId||V.referralCode?s.jsxs("span",{title:V.referralCode||V.referrerCode||V.referrerId||"",children:[V.referrerNickname||V.referralCode||V.referrerCode||((vt=V.referrerId)==null?void 0:vt.slice(0,8)),(V.referralCode||V.referrerCode)&&` (${V.referralCode||V.referrerCode})`]}):"-"}),s.jsx("td",{className:"p-4 text-[#FFD700]",children:V.referrerEarnings?`¥${(typeof V.referrerEarnings=="number"?V.referrerEarnings:parseFloat(String(V.referrerEarnings))).toFixed(2)}`:"-"}),s.jsx("td",{className:"p-4 text-gray-400 text-sm",children:V.createdAt?new Date(V.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:(V.status==="paid"||V.status==="completed")&&s.jsxs(G,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{J(V),ge("")},children:[s.jsx(qj,{className:"w-3 h-3 mr-1"}),"退款"]})})]},V.id)})})]})}),n==="orders"&&s.jsx(cr,{page:H,totalPages:at,total:$,pageSize:Z,onPageChange:R,onPageSizeChange:V=>{re(V),R(1)}})]})})]}),a==="giftpay"&&s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(ut,{children:s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[s.jsx(ht,{className:"text-white text-base",children:"代付请求列表"}),s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsxs("select",{className:"bg-[#0a1628] border border-gray-700 text-white rounded px-3 py-1.5 text-sm",value:un,onChange:V=>{Bn(V.target.value),Nn(1)},children:[s.jsx("option",{value:"",children:"全部状态"}),s.jsx("option",{value:"pending",children:"待支付(旧)"}),s.jsx("option",{value:"pending_pay",children:"待发起人支付"}),s.jsx("option",{value:"paid",children:"已支付"}),s.jsx("option",{value:"refunded",children:"已退款"}),s.jsx("option",{value:"cancelled",children:"已取消"}),s.jsx("option",{value:"expired",children:"已过期"})]}),s.jsxs(G,{size:"sm",variant:"outline",onClick:()=>void Wt("giftPay",!0),disabled:v,className:"border-gray-600 text-gray-300",children:[s.jsx(He,{className:`w-3.5 h-3.5 mr-1 ${v?"animate-spin":""}`}),"刷新"]})]})]})}),s.jsxs(_e,{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/50",children:[s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"请求号"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"发起人"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"商品/金额"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"份数/已领"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"付款人"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"状态"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"创建时间"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:ze.map(V=>s.jsxs("tr",{className:"hover:bg-[#0a1628]",children:[s.jsx("td",{className:"p-3 font-mono text-xs text-gray-400",children:V.requestSn}),s.jsx("td",{className:"p-3 text-white text-sm",children:V.initiatorNick||V.initiatorUserId}),s.jsxs("td",{className:"p-3",children:[s.jsxs("p",{className:"text-white",children:[V.productType," · ¥",V.amount.toFixed(2)]}),V.description&&s.jsx("p",{className:"text-gray-500 text-xs",children:V.description})]}),s.jsx("td",{className:"p-3 text-gray-400",children:(V.quantity??1)>1?`${V.quantity}份 / 已领${V.redeemedCount??0}`:"-"}),s.jsx("td",{className:"p-3 text-gray-400",children:V.payerNick||(V.payerUserId?V.payerUserId:"-")}),s.jsx("td",{className:"p-3",children:s.jsx(Be,{className:V.status==="paid"?"bg-green-500/20 text-green-400 border-0":V.status==="pending"||V.status==="pending_pay"?"bg-amber-500/20 text-amber-400 border-0":V.status==="refunded"?"bg-red-500/20 text-red-400 border-0":"bg-gray-500/20 text-gray-400 border-0",children:V.status==="paid"?"已支付":V.status==="pending"||V.status==="pending_pay"?"待支付":V.status==="refunded"?"已退款":V.status==="cancelled"?"已取消":"已过期"})}),s.jsx("td",{className:"p-3 text-gray-400 text-xs",children:V.createdAt?new Date(V.createdAt).toLocaleString("zh-CN"):"-"})]},V.id))})]})}),ze.length===0&&!v&&s.jsx("p",{className:"text-center py-8 text-gray-500",children:"暂无代付请求"}),pt>20&&s.jsx("div",{className:"mt-4 flex justify-center",children:s.jsx(cr,{page:jt,totalPages:Math.ceil(pt/20),total:pt,pageSize:20,onPageChange:Nn,onPageSizeChange:()=>{}})})]})]})]}),n==="bindings"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(za,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(de,{value:P,onChange:V=>L(V.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:U,onChange:V=>_(V.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white shrink-0",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.jsxs(G,{type:"button",variant:"outline",onClick:()=>void xn(),disabled:v,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${v?"animate-spin":""}`}),"刷新"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-0",children:[Ct.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:Ct.map(V=>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:V.refereeNickname||"匿名用户"}),s.jsx("p",{className:"text-gray-500 text-xs",children:V.refereePhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white",children:V.referrerName||"-"}),s.jsx("p",{className:"text-gray-500 text-xs font-mono",children:V.referrerCode})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:V.boundAt?new Date(V.boundAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:V.expiresAt?new Date(V.expiresAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:We(V.status)}),s.jsx("td",{className:"p-4",children:V.commission?s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",V.commission.toFixed(2)]}):s.jsx("span",{className:"text-gray-500",children:"-"})})]},V.id))})]})}),n==="bindings"&&s.jsx(cr,{page:H,totalPages:at,total:$,pageSize:Z,onPageChange:R,onPageSizeChange:V=>{re(V),R(1)}})]})})]}),n==="withdrawals"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(za,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(de,{value:P,onChange:V=>L(V.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:U,onChange:V=>_(V.target.value),className:"px-4 py-2 bg-[#0f2137] border border-gray-700 rounded-lg text-white shrink-0",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.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-[#0f2137] border border-gray-700/50 shrink-0",children:[s.jsx(Mo,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-sm text-gray-300",children:"自动审批"}),s.jsx(Ut,{checked:O,onCheckedChange:yn,disabled:se,className:"data-[state=checked]:bg-[#38bdac]"})]}),s.jsxs(G,{type:"button",variant:"outline",onClick:()=>void xn(),disabled:v,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${v?"animate-spin":""}`}),"刷新"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-0",children:[$e.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-right font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:$e.map(V=>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:[V.userAvatar?s.jsx("img",{src:V.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:(V.userName||V.name||"?").slice(0,1)}),s.jsx("p",{className:"text-white font-medium",children:V.userName||V.name})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",V.amount.toFixed(2)]})}),s.jsx("td",{className:"p-4",children:s.jsx(Be,{className:V.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:V.method==="wechat"?"微信":"支付宝"})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-mono text-xs",children:V.account}),s.jsx("p",{className:"text-gray-500 text-xs",children:V.name})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:V.createdAt?new Date(V.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:We(V.status)}),s.jsx("td",{className:"p-4 max-w-[160px]",children:s.jsx("span",{className:`text-xs ${V.status==="rejected"||V.status==="failed"?"text-red-400":"text-gray-400"}`,title:V.remark,children:V.remark||"-"})}),s.jsx("td",{className:"p-4 text-right",children:V.status==="pending"&&s.jsxs("div",{className:"flex gap-2 justify-end",children:[s.jsxs(G,{size:"sm",onClick:()=>En(V.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Pg,{className:"w-4 h-4 mr-1"}),"通过"]}),s.jsxs(G,{size:"sm",variant:"outline",onClick:()=>Vn(V.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[s.jsx(Bj,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},V.id))})]})}),n==="withdrawals"&&s.jsx(cr,{page:H,totalPages:at,total:$,pageSize:Z,onPageChange:R,onPageSizeChange:V=>{re(V),R(1)}})]})})]})]}),s.jsx(Bt,{open:!!I,onOpenChange:V=>!V&&J(null),children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Vt,{children:s.jsx(Ht,{className:"text-white",children:"订单退款"})}),I&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",I.orderSn||I.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof I.amount=="number"?I.amount.toFixed(2):parseFloat(String(I.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(de,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:z,onChange:V=>ge(V.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(gn,{children:[s.jsx(G,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>J(null),disabled:X,children:"取消"}),s.jsx(G,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:Te,disabled:X,children:X?"退款中...":"确认退款"})]})]})}),s.jsx(Bt,{open:!!W,onOpenChange:V=>!V&&we(),children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Vt,{children:s.jsx(Ht,{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(de,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:he,onChange:V=>oe(V.target.value)})})]})]}),s.jsxs(gn,{children:[s.jsx(G,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:we,disabled:D,children:"取消"}),s.jsx(G,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:Zn,disabled:D||!he.trim(),children:D?"提交中...":"确认拒绝"})]})]})}),n==="settings"&&s.jsx("div",{className:"-mx-8 -mt-6",children:s.jsx(A2,{embedded:!0})})]})}function j8(){const[t,e]=y.useState([]),[n,r]=y.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[a,i]=y.useState(!0),[o,c]=y.useState(null),[u,h]=y.useState("all"),[f,m]=y.useState(1),[g,b]=y.useState(10),[N,j]=y.useState(0),[v,k]=y.useState(null),[T,C]=y.useState(null),[P,L]=y.useState(""),[U,_]=y.useState(!1);async function H(){var I,J,z,ge,X,F,W;i(!0),c(null);try{const fe=new URLSearchParams({status:u,page:String(f),pageSize:String(g)}),he=await Oe(`/api/admin/withdrawals?${fe}`);if(he!=null&&he.success){const oe=he.withdrawals||[];e(oe),j(he.total??((I=he.stats)==null?void 0:I.total)??oe.length),r({total:((J=he.stats)==null?void 0:J.total)??he.total??oe.length,pendingCount:((z=he.stats)==null?void 0:z.pendingCount)??0,pendingAmount:((ge=he.stats)==null?void 0:ge.pendingAmount)??0,successCount:((X=he.stats)==null?void 0:X.successCount)??0,successAmount:((F=he.stats)==null?void 0:F.successAmount)??0,failedCount:((W=he.stats)==null?void 0:W.failedCount)??0})}else c("加载提现记录失败")}catch(fe){console.error("Load withdrawals error:",fe),c("加载失败,请检查网络后重试")}finally{i(!1)}}y.useEffect(()=>{m(1)},[u]),y.useEffect(()=>{H()},[u,f,g]);const R=Math.ceil(N/g)||1;async function Z(I){const J=t.find(z=>z.id===I);if(J!=null&&J.userCommissionInfo&&J.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${J.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。 + +确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;k(I);try{const z=await Yt("/api/admin/withdrawals",{id:I,action:"approve"});z!=null&&z.success?H():Y.error("操作失败: "+((z==null?void 0:z.error)??""))}catch{Y.error("操作失败")}finally{k(null)}}async function re(I){if(confirm("确认撤回该笔打款?仅在用户未确认收款前可撤回。")){k(I);try{const J=await kt("/api/admin/withdrawals/cancel",{id:I});J!=null&&J.success?(Y.success("已撤回打款"),H()):Y.error("撤回失败: "+((J==null?void 0:J.error)??"未知错误"))}catch{Y.error("撤回失败")}finally{k(null)}}}function $(I){C(I),L("")}async function ie(){const I=T;if(!I)return;const J=P.trim();if(!J){Y.error("请填写拒绝原因");return}_(!0);try{const z=await Yt("/api/admin/withdrawals",{id:I,action:"reject",errorMessage:J});z!=null&&z.success?(Y.success("已拒绝该提现申请"),C(null),L(""),H()):Y.error("操作失败: "+((z==null?void 0:z.error)??""))}catch{Y.error("操作失败")}finally{_(!1)}}function ce(){T&&Y.info("已取消操作"),C(null),L("")}function me(I){switch(I){case"pending":return s.jsx(Be,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待处理"});case"pending_confirm":return s.jsx(Be,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待用户确认"});case"processing":return s.jsx(Be,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:"已审批等待打款"});case"success":case"completed":return s.jsx(Be,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"});case"failed":case"rejected":return s.jsx(Be,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已拒绝"});default:return s.jsx(Be,{className:"bg-gray-500/20 text-gray-400 border-0",children:I})}}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(G,{variant:"outline",onClick:H,disabled:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${a?"animate-spin":""}`}),"刷新"]})]}),s.jsx(De,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:s.jsx(_e,{className:"p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(vf,{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(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{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(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{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(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{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(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{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","processing","pending_confirm","success","failed"].map(I=>s.jsx(G,{variant:u===I?"default":"outline",size:"sm",onClick:()=>h(I),className:u===I?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:I==="all"?"全部":I==="pending"?"待处理":I==="processing"?"处理中":I==="pending_confirm"?"待确认收款":I==="success"?"已完成":"已拒绝"},I))}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:a?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{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(Uc,{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-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(I=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4 text-gray-400",children:new Date(I.createdAt??"").toLocaleString()}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[I.userAvatar?s.jsx("img",{src:pa(I.userAvatar),alt:I.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:(I.userName??"?").charAt(0)}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-white",children:I.userName??"未知"}),s.jsx("p",{className:"text-xs text-gray-500",children:I.userPhone??I.referralCode??(I.userId??"").slice(0,10)})]})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(I.amount).toFixed(2)]})}),s.jsx("td",{className:"p-4",children:I.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:["¥",I.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:["¥",I.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:["¥",I.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:I.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",I.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):s.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),s.jsx("td",{className:"p-4",children:me(I.status)}),s.jsx("td",{className:"p-4 max-w-[180px]",children:s.jsx("span",{className:`text-xs ${I.status==="rejected"||I.status==="failed"?"text-red-400":"text-gray-400"}`,title:I.remark,children:I.remark||"-"})}),s.jsx("td",{className:"p-4 text-gray-400",children:I.processedAt?new Date(I.processedAt).toLocaleString():"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:I.userConfirmedAt?s.jsxs("span",{className:"text-green-400",title:I.userConfirmedAt,children:["已确认 ",new Date(I.userConfirmedAt).toLocaleString()]}):"-"}),s.jsxs("td",{className:"p-4 text-right",children:[(I.status==="pending"||I.status==="pending_confirm")&&s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsxs(G,{size:"sm",onClick:()=>Z(I.id),disabled:v===I.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[s.jsx(Sp,{className:"w-4 h-4 mr-1"}),"批准"]}),s.jsxs(G,{size:"sm",variant:"outline",onClick:()=>$(I.id),disabled:v===I.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[s.jsx(Yn,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(I.status==="processing"||I.status==="pending_confirm")&&s.jsx("div",{className:"mt-2 flex items-center justify-end gap-2",children:s.jsx(G,{size:"sm",variant:"outline",onClick:()=>re(I.id),disabled:v===I.id,className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:"撤回打款"})}),(I.status==="success"||I.status==="completed")&&I.transactionId&&s.jsx("span",{className:"text-xs text-gray-500 font-mono",children:I.transactionId})]})]},I.id))})]})}),s.jsx(cr,{page:f,totalPages:R,total:N,pageSize:g,onPageChange:m,onPageSizeChange:I=>{b(I),m(1)}})]})})}),s.jsx(Bt,{open:!!T,onOpenChange:I=>!I&&ce(),children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Vt,{children:s.jsx(Ht,{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(de,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:P,onChange:I=>L(I.target.value)})})]})]}),s.jsxs(gn,{children:[s.jsx(G,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:ce,disabled:U,children:"取消"}),s.jsx(G,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:ie,disabled:U||!P.trim(),children:U?"提交中...":"确认拒绝"})]})]})})]})}var Wg={exports:{}},Kg={};/** + * @license React + * use-sync-external-store-shim.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var nN;function k8(){if(nN)return Kg;nN=1;var t=Iu();function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,a=t.useEffect,i=t.useLayoutEffect,o=t.useDebugValue;function c(m,g){var b=g(),N=r({inst:{value:b,getSnapshot:g}}),j=N[0].inst,v=N[1];return i(function(){j.value=b,j.getSnapshot=g,u(j)&&v({inst:j})},[m,b,g]),a(function(){return u(j)&&v({inst:j}),m(function(){u(j)&&v({inst:j})})},[m]),o(b),b}function u(m){var g=m.getSnapshot;m=m.value;try{var b=g();return!n(m,b)}catch{return!0}}function h(m,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:c;return Kg.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,Kg}var sN;function I2(){return sN||(sN=1,Wg.exports=k8()),Wg.exports}var P2=I2();function xs(t){this.content=t}xs.prototype={constructor:xs,find:function(t){for(var e=0;e>1}};xs.from=function(t){if(t instanceof xs)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new xs(e)};function R2(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let a=t.child(r),i=e.child(r);if(a==i){n+=a.nodeSize;continue}if(!a.sameMarkup(i))return n;if(a.isText&&a.text!=i.text){for(let o=0;a.text[o]==i.text[o];o++)n++;return n}if(a.content.size||i.content.size){let o=R2(a.content,i.content,n+1);if(o!=null)return o}n+=a.nodeSize}}function L2(t,e,n,r){for(let a=t.childCount,i=e.childCount;;){if(a==0||i==0)return a==i?null:{a:n,b:r};let o=t.child(--a),c=e.child(--i),u=o.nodeSize;if(o==c){n-=u,r-=u;continue}if(!o.sameMarkup(c))return{a:n,b:r};if(o.isText&&o.text!=c.text){let h=0,f=Math.min(o.text.length,c.text.length);for(;he&&r(u,a+c,i||null,o)!==!1&&u.content.size){let f=c+1;u.nodesBetween(Math.max(0,e-f),Math.min(u.content.size,n-f),r,a+f)}c=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,a){let i="",o=!0;return this.nodesBetween(e,n,(c,u)=>{let h=c.isText?c.text.slice(Math.max(e,u)-u,n-u):c.isLeaf?a?typeof a=="function"?a(c):a:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&h||c.isTextblock)&&r&&(o?o=!1:i+=r),i+=h},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,a=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(a[a.length-1]=n.withText(n.text+r.text),i=1);ie)for(let i=0,o=0;oe&&((on)&&(c.isText?c=c.cut(Math.max(0,e-o),Math.min(c.text.length,n-o)):c=c.cut(Math.max(0,e-o-1),Math.min(c.content.size,n-o-1))),r.push(c),a+=c.nodeSize),o=u}return new Ce(r,a)}cutByIndex(e,n){return e==n?Ce.empty:e==0&&n==this.content.length?this:new Ce(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let a=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return a[e]=n,new Ce(a,i)}addToStart(e){return new Ce([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Ce(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let a=this.child(n),i=r+a.nodeSize;if(i>=e)return i==e?Wh(n+1,i):Wh(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return Ce.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Ce(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Ce.empty;let n,r=0;for(let a=0;athis.type.rank&&(n||(n=e.slice(0,a)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-a.type.rank),n}};an.none=[];class Af extends Error{}class Fe{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=D2(this.content,e+this.openStart,n);return r&&new Fe(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Fe(O2(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Fe.empty;let r=n.openStart||0,a=n.openEnd||0;if(typeof r!="number"||typeof a!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Fe(Ce.fromJSON(e,n.content),r,a)}static maxOpen(e,n=!0){let r=0,a=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)a++;return new Fe(e,r,a)}}Fe.empty=new Fe(Ce.empty,0,0);function O2(t,e,n){let{index:r,offset:a}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:c}=t.findIndex(n);if(a==e||i.isText){if(c!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(O2(i.content,e-a-1,n-a-1)))}function D2(t,e,n,r){let{index:a,offset:i}=t.findIndex(e),o=t.maybeChild(a);if(i==e||o.isText)return r&&!r.canReplace(a,a,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=D2(o.content,e-i-1,n,o);return c&&t.replaceChild(a,o.copy(c))}function S8(t,e,n){if(n.openStart>t.depth)throw new Af("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Af("Inconsistent open depths");return _2(t,e,n,0)}function _2(t,e,n,r){let a=t.index(r),i=t.node(r);if(a==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function ru(t,e,n,r){let a=(e||t).node(n),i=0,o=e?e.index(n):a.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(Sl(t.nodeAfter,r),i++));for(let c=i;ca&&qx(t,e,a+1),o=r.depth>a&&qx(n,r,a+1),c=[];return ru(null,t,a,c),i&&o&&e.index(a)==n.index(a)?($2(i,o),Sl(Cl(i,z2(t,e,n,r,a+1)),c)):(i&&Sl(Cl(i,If(t,e,a+1)),c),ru(e,n,a,c),o&&Sl(Cl(o,If(n,r,a+1)),c)),ru(r,null,a,c),new Ce(c)}function If(t,e,n){let r=[];if(ru(null,t,n,r),t.depth>n){let a=qx(t,e,n+1);Sl(Cl(a,If(t,e,n+1)),r)}return ru(e,null,n,r),new Ce(r)}function C8(t,e){let n=e.depth-t.openStart,a=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)a=e.node(i).copy(Ce.from(a));return{start:a.resolveNoCache(t.openStart+n),end:a.resolveNoCache(a.content.size-t.openEnd-n)}}class yu{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],a=e.child(n);return r?e.child(n).cut(r):a}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],a=n==0?0:this.path[n*3-1]+1;for(let i=0;i0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Pf(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],a=0,i=n;for(let o=e;;){let{index:c,offset:u}=o.content.findIndex(i),h=i-u;if(r.push(o,c,a+u),!h||(o=o.child(c),o.isText))break;i=h-1,a+=u+1}return new yu(n,r,i)}static resolveCached(e,n){let r=rN.get(e);if(r)for(let i=0;ie&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(a=!0),!a)),a}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),F2(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=Ce.empty,a=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,a,i),c=o&&o.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let u=a;un.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let a=Ce.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,a,r);return i.type.checkAttrs(i.attrs),i}};Ei.prototype.text=void 0;class Rf extends Ei{constructor(e,n,r,a){if(super(e,n,null,a),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):F2(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Rf(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Rf(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function F2(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class zl{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new A8(e,n);if(r.next==null)return zl.empty;let a=B2(r);r.next&&r.err("Unexpected trailing text");let i=_8(D8(a));return $8(i,r),i}matchType(e){for(let n=0;nh.createAndFill()));for(let h=0;h=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let a=0;a{let i=a+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return i}).join(` +`)}}zl.empty=new zl(!0);class A8{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function B2(t){let e=[];do e.push(I8(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function I8(t){let e=[];do e.push(P8(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function P8(t){let e=O8(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=R8(t,e);else break;return e}function aN(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function R8(t,e){let n=aN(t),r=n;return t.eat(",")&&(t.next!="}"?r=aN(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function L8(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let a=[];for(let i in n){let o=n[i];o.isInGroup(e)&&a.push(o)}return a.length==0&&t.err("No node type or group '"+e+"' found"),a}function O8(t){if(t.eat("(")){let e=B2(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=L8(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function D8(t){let e=[[]];return a(i(t,0),n()),e;function n(){return e.push([])-1}function r(o,c,u){let h={term:u,to:c};return e[o].push(h),h}function a(o,c){o.forEach(u=>u.to=c)}function i(o,c){if(o.type=="choice")return o.exprs.reduce((u,h)=>u.concat(i(h,c)),[]);if(o.type=="seq")for(let u=0;;u++){let h=i(o.exprs[u],c);if(u==o.exprs.length-1)return h;a(h,c=n())}else if(o.type=="star"){let u=n();return r(c,u),a(i(o.expr,u),u),[r(u)]}else if(o.type=="plus"){let u=n();return a(i(o.expr,c),u),a(i(o.expr,u),u),[r(u)]}else{if(o.type=="opt")return[r(c)].concat(i(o.expr,c));if(o.type=="range"){let u=c;for(let h=0;h{t[o].forEach(({term:c,to:u})=>{if(!c)return;let h;for(let f=0;f{h||a.push([c,h=[]]),h.indexOf(f)==-1&&h.push(f)})})});let i=e[r.join(",")]=new zl(r.indexOf(t.length-1)>-1);for(let o=0;o-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:U2(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ei(this,this.computeAttrs(e),Ce.from(n),an.setFrom(r))}createChecked(e=null,n,r){return n=Ce.from(n),this.checkContent(n),new Ei(this,this.computeAttrs(e),n,an.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=Ce.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let a=this.contentMatch.matchFragment(n),i=a&&a.fillBefore(Ce.empty,!0);return i?new Ei(this,e,n.append(i),an.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;nr[i]=new q2(i,n,o));let a=n.spec.topNode||"doc";if(!r[a])throw new RangeError("Schema is missing its top node type ('"+a+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function z8(t,e,n){let r=n.split("|");return a=>{let i=a===null?"null":typeof a;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class F8{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?z8(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Rp{constructor(e,n,r,a){this.name=e,this.rank=n,this.schema=r,this.spec=a,this.attrs=K2(e,a.attrs),this.excluded=null;let i=H2(this.attrs);this.instance=i?new an(this,i):null}create(e=null){return!e&&this.instance?this.instance:new an(this,U2(this.attrs,e))}static compile(e,n){let r=Object.create(null),a=0;return e.forEach((i,o)=>r[i]=new Rp(i,a++,n,o)),r}removeFromSet(e){for(var n=0;n-1}}class G2{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let a in e)n[a]=e[a];n.nodes=xs.from(e.nodes),n.marks=xs.from(e.marks||{}),this.nodes=oN.compile(this.spec.nodes,this),this.marks=Rp.compile(this.spec.marks,this);let r=Object.create(null);for(let a in this.nodes){if(a in this.marks)throw new RangeError(a+" can not be both a node and a mark");let i=this.nodes[a],o=i.spec.content||"",c=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=zl.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=c=="_"?null:c?lN(this,c.split(" ")):c==""||!i.inlineContent?[]:null}for(let a in this.marks){let i=this.marks[a],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:lN(this,o.split(" "))}this.nodeFromJSON=a=>Ei.fromJSON(this,a),this.markFromJSON=a=>an.fromJSON(this,a),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,a){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof oN){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,a)}text(e,n){let r=this.nodes.text;return new Rf(r,r.defaultAttrs,e,an.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function lN(t,e){let n=[];for(let r=0;r-1)&&n.push(o=u)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function B8(t){return t.tag!=null}function V8(t){return t.style!=null}class ko{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(a=>{if(B8(a))this.tags.push(a);else if(V8(a)){let i=/[^=]*/.exec(a.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(a)}}),this.normalizeLists=!this.tags.some(a=>{if(!/^(ul|ol)\b/.test(a.tag)||!a.node)return!1;let i=e.nodes[a.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new dN(this,n,!1);return r.addAll(e,an.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new dN(this,n,!0);return r.addAll(e,an.none,n.from,n.to),Fe.maxOpen(r.finish())}matchTag(e,n,r){for(let a=r?this.tags.indexOf(r)+1:0;ae.length&&(c.charCodeAt(e.length)!=61||c.slice(e.length+1)!=n))){if(o.getAttrs){let u=o.getAttrs(n);if(u===!1)continue;o.attrs=u||void 0}return o}}}static schemaRules(e){let n=[];function r(a){let i=a.priority==null?50:a.priority,o=0;for(;o{r(o=uN(o)),o.mark||o.ignore||o.clearMark||(o.mark=a)})}for(let a in e.nodes){let i=e.nodes[a].spec.parseDOM;i&&i.forEach(o=>{r(o=uN(o)),o.node||o.ignore||o.mark||(o.node=a)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ko(e,ko.schemaRules(e)))}}const J2={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},H8={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Q2={ol:!0,ul:!0},bu=1,Jx=2,au=4;function cN(t,e,n){return e!=null?(e?bu:0)|(e==="full"?Jx:0):t&&t.whitespace=="pre"?bu|Jx:n&~au}class Kh{constructor(e,n,r,a,i,o){this.type=e,this.attrs=n,this.marks=r,this.solid=a,this.options=o,this.content=[],this.activeMarks=an.none,this.match=i||(o&au?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Ce.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,a;return(a=r.findWrapping(e.type))?(this.match=r,a):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&bu)){let r=this.content[this.content.length-1],a;if(r&&r.isText&&(a=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==a[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-a[0].length))}}let n=Ce.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(Ce.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!J2.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class dN{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let a=n.topNode,i,o=cN(null,n.preserveWhitespace,0)|(r?au:0);a?i=new Kh(a.type,a.attrs,an.none,!0,n.topMatch||a.type.contentMatch,o):r?i=new Kh(null,null,an.none,!0,null,o):i=new Kh(e.schema.topNodeType,null,an.none,!0,null,o),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,a=this.top,i=a.options&Jx?"full":this.localPreserveWS||(a.options&bu)>0,{schema:o}=this.parser;if(i==="full"||a.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,` +`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let c=r.split(/\r?\n|\r/);for(let u=0;u!u.clearMark(h)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)c=u;else break}}return n}addElementByRule(e,n,r,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):hN(h.type,e))?(u=h.addToSet(u),!1):!0),this.nodes.push(new Kh(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|=bu)}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 U8(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Q2.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function W8(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function uN(t){let e={};for(let n in t)e[n]=t[n];return e}function hN(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&&uf(Gg(r),a(e,n),null,e.attrs)}static renderSpec(e,n,r=null,a){return uf(e,n,r,a)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Jl(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=fN(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return fN(e.marks)}}function fN(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Gg(t){return t.document||window.document}const pN=new WeakMap;function K8(t){let e=pN.get(t);return e===void 0&&pN.set(t,e=q8(t)),e}function q8(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:b,contentDOM:N}=uf(t,g,n,r);if(u.appendChild(b),N){if(c)throw new RangeError("Multiple content holes");c=N}}}return{dom:u,contentDOM:c}}const Y2=65535,X2=Math.pow(2,16);function G8(t,e){return t+e*X2}function mN(t){return t&Y2}function J8(t){return(t-(t&Y2))/X2}const Z2=1,eS=2,hf=4,tS=8;class Qx{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&tS)>0}get deletedBefore(){return(this.delInfo&(Z2|hf))>0}get deletedAfter(){return(this.delInfo&(eS|hf))>0}get deletedAcross(){return(this.delInfo&hf)>0}}class kr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&kr.empty)return kr.empty}recover(e){let n=0,r=mN(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,b=u+a+(g<0?0:f);if(r)return b;let N=e==(n<0?u:m)?null:G8(c/3,e-u),j=e==u?eS:e==m?Z2:hf;return(n<0?e!=u:e!=m)&&(j|=tS),new Qx(b,j,N)}a+=f-h}return r?e+a:new Qx(e+a,0,null)}touches(e,n){let r=0,a=mN(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 vu;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 Wn.fromReplace(e,this.from,this.to,i)}invert(){return new fa(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 bo(n.pos,r.pos,this.mark)}merge(e){return e instanceof bo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new bo(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 bo(n.from,n.to,e.markFromJSON(n.mark))}}Ls.jsonID("addMark",bo);class fa extends Ls{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 Fe(iy(n.content,a=>a.mark(this.mark.removeFromSet(a.marks)),e),n.openStart,n.openEnd);return Wn.fromReplace(e,this.from,this.to,r)}invert(){return new bo(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 fa(n.pos,r.pos,this.mark)}merge(e){return e instanceof fa&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new fa(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 fa(n.from,n.to,e.markFromJSON(n.mark))}}Ls.jsonID("removeMark",fa);class vo extends Ls{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Wn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Wn.fromReplace(e,this.pos,this.pos+1,new Fe(Ce.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 ds(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 ds(n.from,n.to,n.gapFrom,n.gapTo,Fe.fromJSON(e,n.slice),n.insert,!!n.structure)}}Ls.jsonID("replaceAround",ds);function Yx(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 Q8(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),b=Math.min(h+u.nodeSize,n),N=r.addToSet(m);for(let j=0;jt.step(u)),i.forEach(u=>t.step(u))}function Y8(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 Rp){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 fa(o.from,o.to,o.style)))}function oy(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 X8(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function id(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;N--)j||r.index(N)>0?(j=!0,f=Ce.from(r.node(N).copy(f)),m++):u--;let g=Ce.empty,b=0;for(let N=i,j=!1;N>n;N--)j||a.after(N+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=Ce.from(n[o].type.create(n[o].attrs,r))}let a=e.start,i=e.end;t.step(new ds(a,i,a,i,new Fe(r,0,0),n.length,!0))}function sL(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)&&rL(t.doc,t.mapping.slice(i).map(c),r)){let h=null;if(r.schema.linebreakReplacement){let b=r.whitespace=="pre",N=!!r.contentMatch.matchType(r.schema.linebreakReplacement);b&&!N?h=!1:!b&&N&&(h=!0)}h===!1&&sS(t,o,c,i),oy(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 ds(m,g,m+1,g-1,new Fe(Ce.from(r.create(u,null,o.marks)),0,0),1,!0)),h===!0&&nS(t,o,c,i),!1}})}function nS(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 sS(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 rL(t,e,n){let r=t.resolve(e),a=r.index();return r.parent.canReplaceWith(a,a+1,n)}function aL(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 ds(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new Fe(Ce.from(o),0,0),1,!0))}function Ti(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 b=m.content.cutByIndex(g,m.childCount),N=r&&r[f+1];N&&(b=b.replaceChild(0,N.type.create(N.attrs)));let j=r&&r[f]||m;if(!m.canReplace(g+1,m.childCount)||!j.type.validContent(b))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 iL(t,e,n=1,r){let a=t.doc.resolve(e),i=Ce.empty,o=Ce.empty;for(let c=a.depth,u=a.depth-n,h=n-1;c>u;c--,h--){i=Ce.from(a.node(c).copy(i));let f=r&&r[h];o=Ce.from(f?f.type.create(f.attrs,o):a.node(c).copy(o))}t.step(new cs(e,e,new Fe(i.append(o),n,n),!0))}function $o(t,e){let n=t.resolve(e),r=n.index();return rS(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function oL(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&&rS(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 lL(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);sS(t,f.node(),f.before(),c)}o.inlineContent&&oy(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 cs(h,u.map(e+n,-1),Fe.empty,!0)),r===!0){let f=t.doc.resolve(h);nS(t,f.node(),f.before(),t.steps.length)}return t}function cL(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 Op(t,e,n=e,r=Fe.empty){if(e==n&&!r.size)return null;let a=t.resolve(e),i=t.resolve(n);return iS(a,i,r)?new cs(e,n,r):new dL(a,i,r).fit()}function iS(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class dL{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=Ce.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=Ce.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 Fe(i,o,c);return e>-1?new ds(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new cs(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=Qg(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(Ce.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=Qg(e,n);return!a.childCount||a.firstChild.isLeaf?!1:(this.unplaced=new Fe(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=Qg(e,n);if(a.childCount<=1&&n>0){let i=e.size-n<=n+a.size;this.unplaced=new Fe(Jd(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new Fe(Jd(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 j=0;j1||u==0||j.content.size)&&(m=v,f.push(oS(j.mark(g.allowedMarks(j.marks)),h==1?u:0,h==c.childCount?b:-1)))}let N=h==c.childCount;N||(b=-1),this.placed=Qd(this.placed,n,Ce.from(f)),this.frontier[n].match=m,N&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let j=0,v=c;j1&&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=Yg(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=Qd(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=Qd(this.placed,this.depth,Ce.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(Ce.empty,!0);n.childCount&&(this.placed=Qd(this.placed,this.frontier.length,n))}}function Jd(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Jd(t.firstChild.content,e-1,n)))}function Qd(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Qd(t.lastChild.content,e-1,n)))}function Qg(t,e){for(let n=0;n1&&(r=r.replaceChild(0,oS(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(Ce.empty,!0)))),t.copy(r)}function Yg(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&&!uL(n,i.content,o)?c:null}function uL(t,e,n){for(let r=n;r0;g--,b--){let N=a.node(g).type.spec;if(N.defining||N.definingAsContext||N.isolating)break;o.indexOf(g)>-1?c=g:a.before(g)==b&&o.splice(1,0,-g)}let u=o.indexOf(c),h=[],f=r.openStart;for(let g=r.content,b=0;;b++){let N=g.firstChild;if(h.push(N),b==r.openStart)break;g=N.content}for(let g=f-1;g>=0;g--){let b=h[g],N=hL(b.type);if(N&&!b.sameMarkup(a.node(Math.abs(c)-1)))f=g;else if(N||!b.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let b=(g+f+1)%(r.openStart+1),N=h[b];if(N)for(let j=0;j=0&&(t.replace(e,n,r),!(t.steps.length>m));g--){let b=o[g];b<0||(e=a.before(b),n=i.after(b))}}function lS(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(Ce.empty,!0))}return t}function pL(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let a=cL(t.doc,e,r.type);a!=null&&(e=n=a)}t.replaceRange(e,n,new Fe(Ce.from(r),0,0))}function mL(t,e,n){let r=t.doc.resolve(e),a=t.doc.resolve(n),i=cS(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 cS(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 Bc extends Ls{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 Wn.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 Wn.fromReplace(e,this.pos,this.pos+1,new Fe(Ce.from(a),0,n.isLeaf?0:1))}getMap(){return kr.empty}invert(e){return new Bc(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 Bc(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 Bc(n.pos,n.attr,n.value)}}Ls.jsonID("attr",Bc);class Nu extends Ls{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 Wn.ok(r)}getMap(){return kr.empty}invert(e){return new Nu(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 Nu(n.attr,n.value)}}Ls.jsonID("docAttr",Nu);let Kc=class extends Error{};Kc=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Kc.prototype=Object.create(Error.prototype);Kc.prototype.constructor=Kc;Kc.prototype.name="TransformError";class cy{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new vu}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Kc(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=Fe.empty){let a=Op(this.doc,e,n,r);return a&&this.step(a),this}replaceWith(e,n,r){return this.replace(e,n,new Fe(Ce.from(r),0,0))}delete(e,n){return this.replace(e,n,Fe.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return fL(this,e,n,r),this}replaceRangeWith(e,n,r){return pL(this,e,n,r),this}deleteRange(e,n){return mL(this,e,n),this}lift(e,n){return Z8(this,e,n),this}join(e,n=1){return lL(this,e,n),this}wrap(e,n){return nL(this,e,n),this}setBlockType(e,n=e,r,a=null){return sL(this,e,n,r,a),this}setNodeMarkup(e,n,r=null,a){return aL(this,e,n,r,a),this}setNodeAttribute(e,n,r){return this.step(new Bc(e,n,r)),this}setDocAttribute(e,n){return this.step(new Nu(e,n)),this}addNodeMark(e,n){return this.step(new vo(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 an)n.isInSet(r.marks)&&this.step(new Fl(e,n));else{let a=r.marks,i,o=[];for(;i=n.isInSet(a);)o.push(new Fl(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 iL(this,e,n,r),this}addMark(e,n,r){return Q8(this,e,n,r),this}removeMark(e,n,r){return Y8(this,e,n,r),this}clearIncompatible(e,n,r){return oy(this,e,n,r),this}}const Xg=Object.create(null);class ft{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new dS(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?Mc(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):Mc(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 Cr(e.node(0))}static atStart(e){return Mc(e,e,0,0,1)||new Cr(e)}static atEnd(e){return Mc(e,e,e.content.size,e.childCount,-1)||new Cr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Xg[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 Xg)throw new RangeError("Duplicate use of selection JSON ID "+e);return Xg[e]=n,n.prototype.jsonID=e,n}getBookmark(){return ot.between(this.$anchor,this.$head).getBookmark()}}ft.prototype.visible=!0;class dS{constructor(e,n){this.$from=e,this.$to=n}}let xN=!1;function yN(t){!xN&&!t.parent.inlineContent&&(xN=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class ot extends ft{constructor(e,n=e){yN(e),yN(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 ft.near(r);let a=e.resolve(n.map(this.anchor));return new ot(a.parent.inlineContent?a:r,r)}replace(e,n=Fe.empty){if(super.replace(e,n),n==Fe.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ot&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Dp(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 ot(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=ft.findFrom(n,r,!0)||ft.findFrom(n,-r,!0);if(i)n=i.$head;else return ft.near(n,r)}return e.parent.inlineContent||(a==0?e=n:(e=(ft.findFrom(e,-r,!0)||ft.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&&it.isSelectable(c))return it.create(t,n-(a<0?c.nodeSize:0))}else{let u=Mc(t,c,n+a,a<0?c.childCount:0,a,i);if(u)return u}n+=c.nodeSize*a}return null}function bN(t,e,n){let r=t.steps.length-1;if(r{o==null&&(o=f)}),t.setSelection(ft.near(t.doc.resolve(o),n))}const vN=1,qh=2,NN=4;class xL extends cy{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|=qh,this}ensureMarks(e){return an.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&qh)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~qh,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)||an.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(ft.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|=NN,this}get scrolledIntoView(){return(this.updated&NN)>0}}function wN(t,e){return!e||!t?t:t.bind(e)}class Yd{constructor(e,n,r){this.name=e,this.init=wN(n.init,r),this.apply=wN(n.apply,r)}}const yL=[new Yd("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Yd("selection",{init(t,e){return t.selection||ft.atStart(e.doc)},apply(t){return t.selection}}),new Yd("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Yd("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Zg{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=yL.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 Yd(r.key,r.spec.state,r))})}}class $c{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 Zg(e.schema,e.plugins),i=new $c(a);return a.fields.forEach(o=>{if(o.name=="doc")i.doc=Ei.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=ft.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 uS(t,e,n){for(let r in t){let a=t[r];a instanceof Function?a=a.bind(e):r=="handleDOMEvents"&&(a=uS(a,e,{})),n[r]=a}return n}class dn{constructor(e){this.spec=e,this.props={},e.props&&uS(e.props,this,this.props),this.key=e.key?e.key.key:hS("plugin")}getState(e){return e[this.key]}}const ex=Object.create(null);function hS(t){return t in ex?t+"$"+ ++ex[t]:(ex[t]=0,t+"$")}class vn{constructor(e="key"){this.key=hS(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const uy=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function fS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const pS=(t,e,n)=>{let r=fS(t,n);if(!r)return!1;let a=hy(r);if(!a){let o=r.blockRange(),c=o&&id(o);return c==null?!1:(e&&e(t.tr.lift(o,c).scrollIntoView()),!0)}let i=a.nodeBefore;if(jS(t,a,e,-1))return!0;if(r.parent.content.size==0&&(qc(i,"end")||it.isSelectable(i)))for(let o=r.depth;;o--){let c=Op(t.doc,r.before(o),r.after(o),Fe.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},bL=(t,e,n)=>{let r=fS(t,n);if(!r)return!1;let a=hy(r);return a?mS(t,a,e):!1},vL=(t,e,n)=>{let r=xS(t,n);if(!r)return!1;let a=fy(r);return a?mS(t,a,e):!1};function mS(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=Op(t.doc,i,u,Fe.empty);if(!h||h.from!=i||h instanceof cs&&h.slice.size>=u-i)return!1;if(n){let f=t.tr.step(h);f.setSelection(ot.create(f.doc,i)),n(f.scrollIntoView())}return!0}function qc(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 gS=(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=hy(r)}let o=i&&i.nodeBefore;return!o||!it.isSelectable(o)?!1:(e&&e(t.tr.setSelection(it.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function hy(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 xS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=xS(t,n);if(!r)return!1;let a=fy(r);if(!a)return!1;let i=a.nodeAfter;if(jS(t,a,e,1))return!0;if(r.parent.content.size==0&&(qc(i,"start")||it.isSelectable(i))){let o=Op(t.doc,r.before(),r.after(),Fe.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 it,a;if(r){if(n.node.isTextblock||!$o(t.doc,n.from))return!1;a=n.from}else if(a=Lp(t.doc,n.from,-1),a==null)return!1;if(e){let i=t.tr.join(a);r&&i.setSelection(it.create(i.doc,a-t.doc.resolve(a).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},wL=(t,e)=>{let n=t.selection,r;if(n instanceof it){if(n.node.isTextblock||!$o(t.doc,n.to))return!1;r=n.to}else if(r=Lp(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},jL=(t,e)=>{let{$from:n,$to:r}=t.selection,a=n.blockRange(r),i=a&&id(a);return i==null?!1:(e&&e(t.tr.lift(a,i).scrollIntoView()),!0)},vS=(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 py(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=py(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(ft.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},NS=(t,e)=>{let n=t.selection,{$from:r,$to:a}=n;if(n instanceof Cr||r.parent.inlineContent||a.parent.inlineContent)return!1;let i=py(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(Ti(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),a=r&&id(r);return a==null?!1:(e&&e(t.tr.lift(r,a).scrollIntoView()),!0)};function SL(t){return(e,n)=>{let{$from:r,$to:a}=e.selection;if(e.selection instanceof it&&e.selection.node.isBlock)return!r.parentOffset||!Ti(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 b=r.depth;;b--)if(r.node(b).isBlock){u=r.end(b)==r.pos+(r.depth-b),h=r.start(b)==r.pos-(r.depth-b),c=py(r.node(b-1).contentMatchAt(r.indexAfter(b-1))),i.unshift(u&&c?{type:c}:null),o=b;break}else{if(b==1)return!1;i.unshift(null)}let f=e.tr;(e.selection instanceof ot||e.selection instanceof Cr)&&f.deleteSelection();let m=f.mapping.map(r.pos),g=Ti(f.doc,m,i.length,i);if(g||(i[0]=c?{type:c}:null,g=Ti(f.doc,m,i.length,i)),!g)return!1;if(f.split(m,i.length,i),!u&&h&&r.node(o).type!=c){let b=f.mapping.map(r.before(o)),N=f.doc.resolve(b);c&&r.node(o-1).canReplaceWith(N.index(),N.index()+1,c)&&f.setNodeMarkup(f.mapping.map(r.before(o)),c)}return n&&n(f.scrollIntoView()),!0}}const CL=SL(),EL=(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(it.create(t.doc,a))),!0)};function TL(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||$o(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function jS(t,e,n,r){let a=e.nodeBefore,i=e.nodeAfter,o,c,u=a.type.spec.isolating||i.type.spec.isolating;if(!u&&TL(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 b=e.pos+i.nodeSize,N=Ce.empty;for(let k=o.length-1;k>=0;k--)N=Ce.from(o[k].create(null,N));N=Ce.from(a.copy(N));let j=t.tr.step(new ds(e.pos-1,b,e.pos,b,new Fe(N,1,0),o.length,!0)),v=j.doc.resolve(b+2*o.length);v.nodeAfter&&v.nodeAfter.type==a.type&&$o(j.doc,v.pos)&&j.join(v.pos),n(j.scrollIntoView())}return!0}let f=i.type.spec.isolating||r>0&&u?null:ft.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),g=m&&id(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(h&&qc(i,"start",!0)&&qc(a,"end")){let b=a,N=[];for(;N.push(b),!b.isTextblock;)b=b.lastChild;let j=i,v=1;for(;!j.isTextblock;j=j.firstChild)v++;if(b.canReplace(b.childCount,b.childCount,j.content)){if(n){let k=Ce.empty;for(let C=N.length-1;C>=0;C--)k=Ce.from(N[C].copy(k));let T=t.tr.step(new ds(e.pos-N.length,e.pos+i.nodeSize,e.pos+v,e.pos+i.nodeSize-v,new Fe(k,N.length,0),0,!0));n(T.scrollIntoView())}return!0}}return!1}function kS(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(ot.create(e.doc,t<0?a.start(i):a.end(i)))),!0):!1}}const ML=kS(-1),AL=kS(1);function IL(t,e=null){return function(n,r){let{$from:a,$to:i}=n.selection,o=a.blockRange(i),c=o&&ly(o,t,e);return c?(r&&r(n.tr.wrap(o,c).scrollIntoView()),!0):!1}}function jN(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 Pf(u,u,e.depth),e.endIndex=0;f--)i=Ce.from(n[f].type.create(n[f].attrs,i));t.step(new ds(e.start-(r?2:0),e.end,e.start,e.end,new Fe(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?DL(e,n,t,i):_L(e,n,i):!0:!1}}function DL(t,e,n,r){let a=t.tr,i=r.end,o=r.$to.end(r.depth);ij;N--)b-=a.child(N).nodeSize,r.delete(b-1,b+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?Ce.empty:Ce.from(a))))return!1;let m=i.pos,g=m+o.nodeSize;return r.step(new ds(m-(c?1:0),g+(u?1:0),m+1,g-1,new Fe((c?Ce.empty:Ce.from(a.copy(Ce.empty))).append(u?Ce.empty:Ce.from(a.copy(Ce.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function $L(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=Ce.from(h?t.create():null),m=new Fe(Ce.from(t.create(null,Ce.from(c.type.create(null,f)))),h?3:1,0),g=i.start,b=i.end;n(e.tr.step(new ds(g-(h?3:1),b,g,b,m,1,!0)).scrollIntoView())}return!0}}const ys=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Gc=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Xx=null;const Ni=function(t,e,n){let r=Xx||(Xx=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},zL=function(){Xx=null},Bl=function(t,e,n,r){return n&&(kN(t,e,n,r,-1)||kN(t,e,n,r,1))},FL=/^(img|br|input|textarea|hr)$/i;function kN(t,e,n,r,a){for(var i;;){if(t==n&&e==r)return!0;if(e==(a<0?0:Wr(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Ou(t)||FL.test(t.nodeName)||t.contentEditable=="false")return!1;e=ys(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?Wr(t):0}else return!1}}function Wr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function BL(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=Wr(t)}else if(t.parentNode&&!Ou(t))e=ys(t),t=t.parentNode;else return null}}function VL(t,e){for(;;){if(t.nodeType==3&&e2),Ur=Jc||(Ba?/Mac/.test(Ba.platform):!1),ES=Ba?/Win/.test(Ba.platform):!1,Ci=/Android \d/.test(zo),Du=!!SN&&"webkitFontSmoothing"in SN.documentElement.style,KL=Du?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function qL(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 gi(t,e){return typeof t=="number"?t:t[e]}function GL(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 CN(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=Gc(o);continue}let c=o,u=c==i.body,h=u?qL(i):GL(c),f=0,m=0;if(e.toph.bottom-gi(r,"bottom")&&(m=e.bottom-e.top>h.bottom-h.top?e.top+gi(a,"top")-h.top:e.bottom-h.bottom+gi(a,"bottom")),e.lefth.right-gi(r,"right")&&(f=e.right-h.right+gi(a,"right")),f||m)if(u)i.defaultView.scrollBy(f,m);else{let b=c.scrollLeft,N=c.scrollTop;m&&(c.scrollTop+=m),f&&(c.scrollLeft+=f);let j=c.scrollLeft-b,v=c.scrollTop-N;e={left:e.left-j,top:e.top-v,right:e.right-j,bottom:e.bottom-v}}let g=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(g))break;o=g=="absolute"?o.offsetParent:Gc(o)}}function JL(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:TS(t.dom)}}function TS(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Gc(r));return e}function QL({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;MS(n,r==0?0:r-e)}function MS(t,e){for(let n=0;n=c){o=Math.max(N.bottom,o),c=Math.min(N.top,c);let j=N.left>e.left?N.left-e.left:N.right=(N.left+N.right)/2?1:0));continue}}else N.top>e.top&&!u&&N.left<=e.left&&N.right>=e.left&&(u=f,h={left:Math.max(N.left,Math.min(N.right,e.left)),top:N.top});!n&&(e.left>=N.right&&e.top>=N.top||e.left>=N.left&&e.top>=N.bottom)&&(i=m+1)}}return!n&&u&&(n=u,a=h,r=0),n&&n.nodeType==3?XL(n,a):!n||r&&n.nodeType==1?{node:t,offset:i}:AS(n,a)}function XL(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 gy(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function ZL(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 tO(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 IS(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&a++}let h;Du&&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=tO(t,r,a,e))}c==null&&(c=eO(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function EN(t){return t.top=0&&a==r.nodeValue.length?(u--,f=1):n<0?u--:h++,Wd(co(Ni(r,u,h),f),f<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&a&&(n<0||a==Wr(r))){let u=r.childNodes[a-1];if(u.nodeType==1)return tx(u.getBoundingClientRect(),!1)}if(i==null&&a=0)}if(i==null&&a&&(n<0||a==Wr(r))){let u=r.childNodes[a-1],h=u.nodeType==3?Ni(u,Wr(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(h)return Wd(co(h,1),!1)}if(i==null&&a=0)}function Wd(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 tx(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 RS(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 rO(t,e,n){let r=e.selection,a=n=="up"?r.$from:r.$to;return RS(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=PS(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=Ni(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 aO=/[\u0590-\u08ac]/;function iO(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?!aO.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?i:o:RS(t,e,()=>{let{focusNode:u,focusOffset:h,anchorNode:f,anchorOffset:m}=t.domSelectionRange(),g=c.caretBidiLevel;c.modify("move",n,"character");let b=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:N,focusOffset:j}=t.domSelectionRange(),v=N&&!b.contains(N.nodeType==1?N:N.parentNode)||u==N&&h==j;try{c.collapse(f,m),u&&(u!=f||h!=m)&&c.extend&&c.extend(u,h)}catch{}return g!=null&&(c.caretBidiLevel=g),v}):r.pos==r.start()||r.pos==r.end()}let TN=null,MN=null,AN=!1;function oO(t,e,n){return TN==e&&MN==n?AN:(TN=e,MN=n,AN=n=="up"||n=="down"?rO(t,e,n):iO(t,e,n))}const qr=0,IN=1,Nl=2,Va=3;class _u{constructor(e,n,r,a){this.parent=e,this.children=n,this.dom=r,this.contentDOM=a,this.dirty=qr,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;nys(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 OS){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 LS&&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?ys(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=ys(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;fN&&on){let N=c;c=u,u=N}let b=document.createRange();b.setEnd(u.node,u.offset),b.setStart(c.node,c.offset),h.removeAllRanges(),h.addRange(b)}}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?Nl:IN,e==c&&n==u&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Va:i.markDirty(e-c,n-c);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Nl:Va}r=o}this.dirty=Nl}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Nl:IN;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==qr&&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 lO extends _u{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 Vl extends _u{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=Jl.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Vl(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Va||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Va&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=qr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(i=s0(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}=Jl.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=$S(f,r,n),h?u=new cO(e,n,r,a,f,m||null,g,h,i,o+1):n.isText?new $p(e,n,r,a,f,g,i):new Co(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=()=>Ce.empty)}return e}matchesNode(e,n,r){return this.dirty==qr&&e.eq(this.node)&&Lf(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 uO(this,o&&o.node,e);pO(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?an.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 b;u.findNodeMatch(h,f,m,g)||c&&e.state.selection.from>a&&e.state.selection.to-1&&u.updateNodeAt(h,f,m,b,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==Nl)&&(o&&this.protectLocalComposition(e,o),DS(this.contentDOM,this.children,e),Jc&&mO(this.dom))}localCompositionInfo(e,n){let{from:r,to:a}=e.state.selection;if(!(e.state.selection instanceof ot)||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=gO(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 lO(this,i,n,a);e.input.compositionNodes.push(o),this.children=s0(this.children,r,r+a.length,e,o)}update(e,n,r,a){return this.dirty==Va||!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=qr}updateOuterDeco(e){if(Lf(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=_S(this.dom,this.nodeDOM,n0(this.outerDeco,this.node,n),n0(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 PN(t,e,n,r,a){$S(r,e,t);let i=new Co(void 0,t,e,n,r,r,r,a,0);return i.contentDOM&&i.updateChildren(a,0),i}class $p extends Co{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==Va||this.dirty!=qr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=qr||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=qr,!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 $p(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=Va)}get domAtom(){return!1}isText(e){return this.node.text==e}}class OS extends _u{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==qr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class cO extends Co{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==Va)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 DS(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=Vl.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 Vl)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 fO(t,e){return t.type.side-e.type.side}function pO(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 N=i+g.nodeSize;if(g.isText){let v=N;o!v.inline):c.slice();r(g,j,e.forChild(i,g),b),i=N}}function mO(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 gO(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 s0(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 xy(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(_p(n)){for(u=o;a&&!a.node;)a=a.parent;let m=a.node;if(a&&m.isAtom&&it.isSelectable(m)&&a.parent&&!(m.isInline&&HL(n.focusNode,n.focusOffset,a.dom))){let g=a.posBefore;h=new it(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 b=0;b{(n.anchorNode!=r||n.anchorOffset!=a)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!zS(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function yO(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,ys(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&ur&&So<=11&&(n.disabled=!0,n.disabled=!1)}function FS(t,e){if(e instanceof it){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(_N(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else _N(t)}function _N(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function yy(t,e,n,r){return t.someProp("createSelectionBetween",a=>a(t,e,n))||ot.between(e,n,r)}function $N(t){return t.editable&&!t.hasFocus()?!1:BS(t)}function BS(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 bO(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Bl(e.node,e.offset,n.anchorNode,n.anchorOffset)}function r0(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&&ft.findFrom(i,e)}function uo(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function zN(t,e,n){let r=t.state.selection;if(r instanceof ot)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 uo(t,new ot(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let a=r0(t.state,e);return a&&a instanceof it?uo(t,a):!1}else if(!(Ur&&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?it.isSelectable(i)?uo(t,new it(e<0?t.state.doc.resolve(a.pos-i.nodeSize):a)):Du?uo(t,new ot(t.state.doc.resolve(e<0?c:c+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof it&&r.node.isInline)return uo(t,new ot(e>0?r.$to:r.$from));{let a=r0(t.state,e);return a?uo(t,a):!1}}}function Of(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function ou(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Tc(t,e){return e<0?vO(t):NO(t)}function vO(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a,i,o=!1;for(Kr&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(ou(c,-1))a=n,i=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(VS(n))break;{let c=n.previousSibling;for(;c&&ou(c,-1);)a=n.parentNode,i=ys(c),c=c.previousSibling;if(c)n=c,r=Of(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?a0(t,n,r):a&&a0(t,a,i)}function NO(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a=Of(n),i,o;for(;;)if(r{t.state==a&&Mi(t)},50)}function FN(t,e){let n=t.state.doc.resolve(e);if(!(js||ES)&&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 BN(t,e,n){let r=t.state.selection;if(r instanceof ot&&!r.empty||n.indexOf("s")>-1||Ur&&n.indexOf("m")>-1)return!1;let{$from:a,$to:i}=r;if(!a.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=r0(t.state,e);if(o&&o instanceof it)return uo(t,o)}if(!a.parent.inlineContent){let o=e<0?a:i,c=r instanceof Cr?ft.near(o,e):ft.findFrom(o,e);return c?uo(t,c):!1}return!1}function VN(t,e){if(!(t.state.selection instanceof ot))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 HN(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function kO(t){if(!Ps||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;HN(t,r,"true"),setTimeout(()=>HN(t,r,"false"),20)}return!1}function SO(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function CO(t,e){let n=e.keyCode,r=SO(e);if(n==8||Ur&&n==72&&r=="c")return VN(t,-1)||Tc(t,-1);if(n==46&&!e.shiftKey||Ur&&n==68&&r=="c")return VN(t,1)||Tc(t,1);if(n==13||n==27)return!0;if(n==37||Ur&&n==66&&r=="c"){let a=n==37?FN(t,t.state.selection.from)=="ltr"?-1:1:-1;return zN(t,a,r)||Tc(t,a)}else if(n==39||Ur&&n==70&&r=="c"){let a=n==39?FN(t,t.state.selection.from)=="ltr"?1:-1:1;return zN(t,a,r)||Tc(t,a)}else{if(n==38||Ur&&n==80&&r=="c")return BN(t,-1,r)||Tc(t,-1);if(n==40||Ur&&n==78&&r=="c")return kO(t)||BN(t,1,r)||Tc(t,1);if(r==(Ur?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function by(t,e){t.someProp("transformCopied",b=>{e=b(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 b=r.firstChild;n.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),r=b.content}let o=t.someProp("clipboardSerializer")||Jl.fromSchema(t.state.schema),c=GS(),u=c.createElement("div");u.appendChild(o.serializeFragment(r,{document:c}));let h=u.firstChild,f,m=0;for(;h&&h.nodeType==1&&(f=qS[h.nodeName.toLowerCase()]);){for(let b=f.length-1;b>=0;b--){let N=c.createElement(f[b]);for(;u.firstChild;)N.appendChild(u.firstChild);u.appendChild(N),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",b=>b(e,t))||e.content.textBetween(0,e.content.size,` + +`);return{dom:u,text:g,slice:e}}function HS(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 Fe(Ce.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:b}=t.state,N=Jl.fromSchema(b);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(j=>{let v=o.appendChild(document.createElement("p"));j&&v.appendChild(N.serializeNode(b.text(j,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),o=AO(n),Du&&IO(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")||ko.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||f),context:a,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!EO.test(g.parentNode.nodeName)?{ignore:!0}:null}})),f)c=PO(UN(c,+f[1],+f[2]),f[4]);else if(c=Fe.maxOpen(TO(c.content,a),!0),c.openStart||c.openEnd){let m=0,g=0;for(let b=c.content.firstChild;m{c=m(c,t,u)}),c}const EO=/^(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 TO(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&&WS(u,i,c,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=KS(o[o.length-1],i.length));let f=US(c,u);o.push(f),a=a.matchType(f.type),i=u}}),o)return Ce.from(o)}return t}function US(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,Ce.from(t));return t}function WS(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(Ce.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(c))}function UN(t,e,n){return en})),sx.createHTML(t)):t}function AO(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=GS().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),a;if((a=r&&qS[r[1].toLowerCase()])&&(t=a.map(i=>"<"+i+">").join("")+t+a.map(i=>"").reverse().join("")),n.innerHTML=MO(t),a)for(let i=0;i=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;a=Ce.from(u.create(r[c+1],a)),i++,o++}return new Fe(a,i,o)}const Hs={},Us={},RO={touchstart:!0,touchmove:!0};class LO{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 OO(t){for(let e in Hs){let n=Hs[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{_O(t,r)&&!vy(t,r)&&(t.editable||!(r.type in Us))&&n(t,r)},RO[e]?{passive:!0}:void 0)}Ps&&t.dom.addEventListener("input",()=>null),o0(t)}function No(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function DO(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 o0(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>vy(t,r))})}function vy(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function _O(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 $O(t,e){!vy(t,e)&&Hs[e.type]&&(t.editable||!(e.type in Us))&&Hs[e.type](t,e)}Us.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!QS(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Ci&&js&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Jc&&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,xl(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||CO(t,n)?n.preventDefault():No(t,"key")};Us.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Us.keypress=(t,e)=>{let n=e;if(QS(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Ur&&n.metaKey)return;if(t.someProp("handleKeyPress",a=>a(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof ot)||!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 zp(t){return{left:t.clientX,top:t.clientY}}function zO(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Ny(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 Vc(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 FO(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&it.isSelectable(r)?(Vc(t,new it(n)),!0):!1}function BO(t,e){if(e==-1)return!1;let n=t.state.selection,r,a;n instanceof it&&(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(it.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?(Vc(t,it.create(t.state.doc,a)),!0):!1}function VO(t,e,n,r,a){return Ny(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(a?BO(t,n):FO(t,n))}function HO(t,e,n,r){return Ny(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",a=>a(t,e,r))}function UO(t,e,n,r){return Ny(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",a=>a(t,e,r))||WO(t,n,r)}function WO(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Vc(t,ot.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)Vc(t,ot.create(r,c+1,c+1+o.content.size));else if(it.isSelectable(o))Vc(t,it.create(r,c));else continue;return!0}}function wy(t){return Df(t)}const JS=Ur?"metaKey":"ctrlKey";Hs.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=wy(t),a=Date.now(),i="singleClick";a-t.input.lastClick.time<500&&zO(n,t.input.lastClick)&&!n[JS]&&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(zp(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new KO(t,o,n,!!r)):(i=="doubleClick"?HO:UO)(t,o.pos,o.inside,n)?n.preventDefault():No(t,"pointer"))};class KO{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[JS],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 it&&h.from<=o&&h.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Kr&&!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)),No(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(()=>Mi(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(zp(e))),this.updateAllowDefault(e),this.allowDefault||!n?No(this.view,"pointer"):VO(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ps&&this.mightDrag&&!this.mightDrag.node.isAtom||js&&!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)?(Vc(this.view,ft.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):No(this.view,"pointer")}move(e){this.updateAllowDefault(e),No(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)}}Hs.touchstart=t=>{t.input.lastTouch=Date.now(),wy(t),No(t,"pointer")};Hs.touchmove=t=>{t.input.lastTouch=Date.now(),No(t,"pointer")};Hs.contextmenu=t=>wy(t);function QS(t,e){return t.composing?!0:Ps&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const qO=Ci?5e3:-1;Us.compositionstart=Us.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof ot&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||js&&ES&&GO(t)))t.markCursor=t.state.storedMarks||n.marks(),Df(t,!0),t.markCursor=null;else if(Df(t,!e.selection.empty),Kr&&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}YS(t,qO)};function GO(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"}Us.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++,YS(t,20))};function YS(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Df(t),e))}function XS(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=QO());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function JO(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=BL(e.focusNode,e.focusOffset),r=VL(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 QO(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Df(t,e=!1){if(!(Ci&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),XS(t),e||t.docView&&t.docView.dirty){let n=xy(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 YO(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 wu=ur&&So<15||Jc&&KL<604;Hs.copy=Us.cut=(t,e)=>{let n=e,r=t.state.selection,a=n.type=="cut";if(r.empty)return;let i=wu?null:n.clipboardData,o=r.content(),{dom:c,text:u}=by(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",c.innerHTML),i.setData("text/plain",u)):YO(t,c),a&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function XO(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function ZO(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?ju(t,r.value,null,a,e):ju(t,r.textContent,r.innerHTML,a,e)},50)}function ju(t,e,n,r,a){let i=HS(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,a,i||Fe.empty)))return!0;if(!i)return!1;let o=XO(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 ZS(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," "):""}Us.paste=(t,e)=>{let n=e;if(t.composing&&!Ci)return;let r=wu?null:n.clipboardData,a=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&ju(t,ZS(r),r.getData("text/html"),a,n)?n.preventDefault():ZO(t,n)};class eC{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const e6=Ur?"altKey":"ctrlKey";function tC(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[e6]}Hs.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(zp(n)),o;if(!(i&&i.pos>=a.from&&i.pos<=(a instanceof it?a.to-1:a.to))){if(r&&r.mightDrag)o=it.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=it.create(t.state.doc,m.posBefore))}}let c=(o||t.state.selection).content(),{dom:u,text:h,slice:f}=by(t,c);(!n.dataTransfer.files.length||!js||CS>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(wu?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",wu||n.dataTransfer.setData("text/plain",h),t.dragging=new eC(f,tC(t,n),o)};Hs.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Us.dragover=Us.dragenter=(t,e)=>e.preventDefault();Us.drop=(t,e)=>{try{t6(t,e,t.dragging)}finally{t.dragging=null}};function t6(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(zp(e));if(!r)return;let a=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",b=>{i=b(i,t,!1)}):i=HS(t,ZS(e.dataTransfer),wu?null:e.dataTransfer.getData("text/html"),!1,a);let o=!!(n&&tC(t,e));if(t.someProp("handleDrop",b=>b(t,e,i||Fe.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let c=i?aS(t.state.doc,a.pos,i):a.pos;c==null&&(c=a.pos);let u=t.state.tr;if(o){let{node:b}=n;b?b.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&&it.isSelectable(i.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(i.content.firstChild))u.setSelection(new it(g));else{let b=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((N,j,v,k)=>b=k),u.setSelection(yy(t,g,u.doc.resolve(b)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}Hs.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())&&Mi(t)},20))};Hs.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)};Hs.beforeinput=(t,e)=>{if(js&&Ci&&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,xl(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 Us)Hs[t]=Us[t];function ku(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 _f{constructor(e,n){this.toDOM=e,this.spec=n||El,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 Xn(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof _f&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ku(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Eo{constructor(e,n){this.attrs=e,this.spec=n||El}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 Xn(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==As||e.maps.length==0?this:this.mapInner(e,n,0,0,r||El)}mapInner(e,n,r,a,i){let o;for(let c=0;c{let h=u+r,f;if(f=sC(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 Eo){let h=Math.max(i,u.from)-i,f=Math.min(o,u.to)-i;ha.map(e,n,El));return po.from(r)}forChild(e,n){if(n.isLeaf)return rn.empty;let r=[];for(let a=0;an instanceof rn)?e:e.reduce((n,r)=>n.concat(r instanceof rn?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let v=j-N-(b-g);for(let k=0;kT+f-m)continue;let C=c[k]+f-m;b>=C?c[k+1]=g<=C?-2:-1:g>=f&&v&&(c[k]+=v,c[k+1]+=v)}m+=v}),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),b=g-a,{index:N,offset:j}=r.content.findIndex(m),v=r.maybeChild(N);if(v&&j==m&&j+v.nodeSize==b){let k=c[h+2].mapInner(n,v,f+1,t[h]+i+1,o);k!=As?(c[h]=m,c[h+1]=b,c[h+2]=k):(c[h+1]=-2,u=!0)}else u=!0}if(u){let h=s6(c,t,e,n,a,i,o),f=$f(h,r,0,o);e=f.local;for(let m=0;mn&&o.to{let h=sC(t,c,u+n);if(h){i=!0;let f=$f(h,c,n+u+1,r);f!=As&&a.push(u,u+c.nodeSize,f)}});let o=nC(i?rC(t):t,-n).sort(Tl);for(let c=0;c0;)e++;t.splice(e,0,n)}function rx(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=As&&e.push(r)}),t.cursorWrapper&&e.push(rn.create(t.state.doc,[t.cursorWrapper.deco])),po.from(e)}const r6={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},a6=ur&&So<=11;class i6{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 o6{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new i6,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():Ps&&e.composing&&r.some(a=>a.type=="childList"&&a.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),a6&&(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,r6)),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($N(this.view)){if(this.suppressingSelectionUpdates)return Mi(this.view);if(ur&&So<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Bl(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=Gc(i))n.add(i);for(let i=e.anchorNode;i;i=Gc(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)&&$N(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(Kr&&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 b=g.parentNode;b&&b.nodeName=="LI"&&(!m||d6(e,m)!=b)&&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),l6(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,u6(e,u)),this.handleDOMChange(i,o,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Mi(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;v--){let k=r.childNodes[v-1],T=k.pmViewDesc;if(k.nodeName=="BR"&&!T){i=v;break}if(!T||T.size)break}let m=t.state.doc,g=t.someProp("domParser")||ko.fromSchema(t.state.schema),b=m.resolve(o),N=null,j=g.parse(r,{topNode:b.parent,topMatch:b.parent.contentMatchAt(b.index()),topOpen:!0,from:a,to:i,preserveWhitespace:b.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:f6,context:b});if(h&&h[0].pos!=null){let v=h[0].pos,k=h[1]&&h[1].pos;k==null&&(k=v),N={anchor:v+o,head:k+o}}return{doc:j,sel:N,from:o,to:c}}function f6(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Ps&&/^(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||Ps&&/^(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 p6=/^(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 m6(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,H=xy(t,_);if(H&&!t.state.selection.eq(H)){if(js&&Ci&&t.input.lastKeyCode===13&&Date.now()-100Z(t,xl(13,"Enter"))))return;let R=t.state.tr.setSelection(H);_=="pointer"?R.setMeta("pointer",!0):_=="key"&&R.scrollIntoView(),i&&R.setMeta("composition",i),t.dispatch(R)}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=h6(t,e,n),f=t.state.doc,m=f.slice(h.from,h.to),g,b;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||Ci)&&a.some(_=>_.nodeType==1&&!p6.test(_.nodeName))&&(!N||N.endA>=N.endB)&&t.someProp("handleKeyDown",_=>_(t,xl(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!N)if(r&&u instanceof ot&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(h.sel&&h.sel.anchor!=h.sel.head))N={start:u.from,endA:u.to,endB:u.to};else{if(h.sel){let _=QN(t,t.state.doc,h.sel);if(_&&!_.eq(t.state.selection)){let H=t.state.tr.setSelection(_);i&&H.setMeta("composition",i),t.dispatch(H)}}return}t.state.selection.fromt.state.selection.from&&N.start<=t.state.selection.from+2&&t.state.selection.from>=h.from?N.start=t.state.selection.from:N.endA=t.state.selection.to-2&&t.state.selection.to<=h.to&&(N.endB+=t.state.selection.to-N.endA,N.endA=t.state.selection.to)),ur&&So<=11&&N.endB==N.start+1&&N.endA==N.start&&N.start>h.from&&h.doc.textBetween(N.start-h.from-1,N.start-h.from+1)=="  "&&(N.start--,N.endA--,N.endB--);let j=h.doc.resolveNoCache(N.start-h.from),v=h.doc.resolveNoCache(N.endB-h.from),k=f.resolve(N.start),T=j.sameParent(v)&&j.parent.inlineContent&&k.end()>=N.endA;if((Jc&&t.input.lastIOSEnter>Date.now()-225&&(!T||a.some(_=>_.nodeName=="DIV"||_.nodeName=="P"))||!T&&j.pos_(t,xl(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>N.start&&x6(f,N.start,N.endA,j,v)&&t.someProp("handleKeyDown",_=>_(t,xl(8,"Backspace")))){Ci&&js&&t.domObserver.suppressSelectionUpdates();return}js&&N.endB==N.start&&(t.input.lastChromeDelete=Date.now()),Ci&&!T&&j.start()!=v.start()&&v.parentOffset==0&&j.depth==v.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==N.endA&&(N.endB-=2,v=h.doc.resolveNoCache(N.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function(_){return _(t,xl(13,"Enter"))})},20));let C=N.start,P=N.endA,L=_=>{let H=_||t.state.tr.replace(C,P,h.doc.slice(N.start-h.from,N.endB-h.from));if(h.sel){let R=QN(t,H.doc,h.sel);R&&!(js&&t.composing&&R.empty&&(N.start!=N.endB||t.input.lastChromeDeleteMi(t),20));let _=L(t.state.tr.delete(C,P)),H=f.resolve(N.start).marksAcross(f.resolve(N.endA));H&&_.ensureMarks(H),t.dispatch(_)}else if(N.endA==N.endB&&(U=g6(j.parent.content.cut(j.parentOffset,v.parentOffset),k.parent.content.cut(k.parentOffset,N.endA-k.start())))){let _=L(t.state.tr);U.type=="add"?_.addMark(C,P,U.mark):_.removeMark(C,P,U.mark),t.dispatch(_)}else if(j.parent.child(j.index()).isText&&j.index()==v.index()-(v.textOffset?0:1)){let _=j.parent.textBetween(j.parentOffset,v.parentOffset),H=()=>L(t.state.tr.insertText(_,C,P));t.someProp("handleTextInput",R=>R(t,C,P,_,H))||t.dispatch(H())}else t.dispatch(L());else t.dispatch(L())}function QN(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:yy(t,e.resolve(n.anchor),e.resolve(n.head))}function g6(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||ax(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 y6(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 aC{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 LO,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(nw),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=ew(this),ZN(this),this.nodeViews=tw(this),this.docView=PN(this.state.doc,XN(this),rx(this),this.dom,this),this.domObserver=new o6(this,(r,a,i,o)=>m6(this,r,a,i,o)),this.domObserver.start(),OO(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&&o0(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(nw),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&&(XS(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 b=tw(this);v6(b,this.nodeViews)&&(this.nodeViews=b,i=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&o0(this),this.editable=ew(this),ZN(this);let u=rx(this),h=XN(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&&JL(this);if(o){this.domObserver.stop();let b=m&&(ur||js)&&!this.composing&&!a.selection.empty&&!e.selection.empty&&b6(a.selection,e.selection);if(m){let N=js?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=JO(this)),(i||!this.docView.update(e.doc,h,u,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=PN(e.doc,h,u,this.dom,this)),N&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(b=!0)}b||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&bO(this))?Mi(this,b):(FS(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&&QL(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 it){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&CN(this,n.getBoundingClientRect(),e)}else CN(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 eC(e.slice,e.move,a<0?void 0:it.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 nO(this,e)}coordsAtPos(e,n=1){return PS(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 oO(this,n||this.state,e)}pasteHTML(e,n){return ju(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ju(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return by(this,e)}destroy(){this.docView&&(DO(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],rx(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,zL())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return $O(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ps&&this.root.nodeType===11&&UL(this.dom.ownerDocument)==this.dom&&c6(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}aC.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function XN(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"),[Xn.node(0,t.state.doc.content.size,e)]}function ZN(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:Xn.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function ew(t){return!t.someProp("editable",e=>e(t.state)===!1)}function b6(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 tw(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 v6(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 nw(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 Io={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:"'"},zf={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},N6=typeof navigator<"u"&&/Mac/.test(navigator.platform),w6=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var bs=0;bs<10;bs++)Io[48+bs]=Io[96+bs]=String(bs);for(var bs=1;bs<=24;bs++)Io[bs+111]="F"+bs;for(var bs=65;bs<=90;bs++)Io[bs]=String.fromCharCode(bs+32),zf[bs]=String.fromCharCode(bs);for(var ix in Io)zf.hasOwnProperty(ix)||(zf[ix]=Io[ix]);function j6(t){var e=N6&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||w6&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?zf:Io)[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 k6=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),S6=typeof navigator<"u"&&/Win/.test(navigator.platform);function C6(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)M6(t,n,{get:e[n],enumerable:!0})};function Fp(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 Bp=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,(...N)=>{const j=this.buildProps(u,e),v=g(...N)(j);return o.push(v),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:Fp({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}},iC={};Cy(iC,{blur:()=>A6,clearContent:()=>I6,clearNodes:()=>P6,command:()=>R6,createParagraphNear:()=>L6,cut:()=>O6,deleteCurrentNode:()=>D6,deleteNode:()=>_6,deleteRange:()=>$6,deleteSelection:()=>z6,enter:()=>F6,exitCode:()=>B6,extendMarkRange:()=>V6,first:()=>H6,focus:()=>W6,forEach:()=>K6,insertContent:()=>q6,insertContentAt:()=>Q6,joinBackward:()=>Z6,joinDown:()=>X6,joinForward:()=>eD,joinItemBackward:()=>tD,joinItemForward:()=>nD,joinTextblockBackward:()=>sD,joinTextblockForward:()=>rD,joinUp:()=>Y6,keyboardShortcut:()=>iD,lift:()=>oD,liftEmptyBlock:()=>lD,liftListItem:()=>cD,newlineInCode:()=>dD,resetAttributes:()=>uD,scrollIntoView:()=>hD,selectAll:()=>fD,selectNodeBackward:()=>pD,selectNodeForward:()=>mD,selectParentNode:()=>gD,selectTextblockEnd:()=>xD,selectTextblockStart:()=>yD,setContent:()=>bD,setMark:()=>zD,setMeta:()=>FD,setNode:()=>BD,setNodeSelection:()=>VD,setTextDirection:()=>HD,setTextSelection:()=>UD,sinkListItem:()=>WD,splitBlock:()=>KD,splitListItem:()=>qD,toggleList:()=>GD,toggleMark:()=>JD,toggleNode:()=>QD,toggleWrap:()=>YD,undoInputRule:()=>XD,unsetAllMarks:()=>ZD,unsetMark:()=>e_,unsetTextDirection:()=>t_,updateAttributes:()=>n_,wrapIn:()=>s_,wrapInList:()=>r_});var A6=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),I6=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),P6=()=>({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)),b=m.blockRange(g);if(!b)return;const N=id(b);if(c.type.isTextblock){const{defaultType:j}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(b.start,j)}(N||N===0)&&e.lift(b,N)})}),!0},R6=t=>e=>t(e),L6=()=>({state:t,dispatch:e})=>NS(t,e),O6=(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 ot(r.doc.resolve(Math.max(o-1,0)))),!0},D6=()=>({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 Kn(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 _6=t=>({tr:e,state:n,dispatch:r})=>{const a=Kn(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},$6=t=>({tr:e,dispatch:n})=>{const{from:r,to:a}=t;return n&&e.delete(r,a),!0},z6=()=>({state:t,dispatch:e})=>uy(t,e),F6=()=>({commands:t})=>t.keyboardShortcut("Enter"),B6=()=>({state:t,dispatch:e})=>kL(t,e);function Ey(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Ff(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(a=>n.strict?e[a]===t[a]:Ey(e[a])?e[a].test(t[a]):e[a]===t[a]):!0}function oC(t,e,n={}){return t.find(r=>r.type===e&&Ff(Object.fromEntries(Object.keys(n).map(a=>[a,r.attrs[a]])),n))}function sw(t,e,n={}){return!!oC(t,e,n)}function Ty(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),!oC([...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&&sw([...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=Ri(t,r.schema),{doc:o,selection:c}=n,{$from:u,from:h,to:f}=c;if(a){const m=Ty(u,i,e);if(m&&m.from<=h&&m.to>=f){const g=ot.create(o,m.from,m.to);n.setSelection(g)}}return!0},H6=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=()=>{(Bf()||rw())&&r.dom.focus(),U6()&&!Bf()&&!rw()&&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&&!lC(n.state.selection))return o(),!0;const c=cC(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},K6=(t,e)=>n=>t.every((r,a)=>e(r,{...n,index:a})),q6=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),dC=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&&dC(r)}return t};function Gh(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 dC(n)}function Su(t,e,n){if(t instanceof Ei||t instanceof Ce)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 Ce.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),Su("",e,n)}if(a){if(n.errorOnInvalidContent){let o=!1,c="";const u=new G2({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?ko.fromSchema(u).parseSlice(Gh(t),n.parseOptions):ko.fromSchema(u).parse(Gh(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const i=ko.fromSchema(e);return n.slice?i.parseSlice(Gh(t),n.parseOptions).content:i.parse(Gh(t),n.parseOptions)}return Su("",e,n)}function G6(t,e,n){const r=t.steps.length-1;if(r{o===0&&(o=f)}),t.setSelection(ft.near(t.doc.resolve(o),n))}var J6=t=>!("type"in t),Q6=(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=v=>{i.emit("contentError",{editor:i,error:v,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{Su(e,i.schema,{parseOptions:h,errorOnInvalidContent:!0})}catch(v){u(v)}try{c=Su(e,i.schema,{parseOptions:h,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(v){return u(v),!1}let{from:f,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,b=!0;if((J6(c)?c:[c]).forEach(v=>{v.check(),g=g?v.isText&&v.marks.length===0:!1,b=b?v.isBlock:!1}),f===m&&b){const{parent:v}=r.doc.resolve(f);v.isTextblock&&!v.type.spec.code&&!v.childCount&&(f-=1,m+=1)}let j;if(g){if(Array.isArray(e))j=e.map(v=>v.text||"").join("");else if(e instanceof Ce){let v="";e.forEach(k=>{k.text&&(v+=k.text)}),j=v}else typeof e=="object"&&e&&e.text?j=e.text:j=e;r.insertText(j,f,m)}else{j=c;const v=r.doc.resolve(f),k=v.node(),T=v.parentOffset===0,C=k.isText||k.isTextblock,P=k.content.size>0;T&&C&&P&&(f=Math.max(0,f-1)),r.replaceWith(f,m,j)}n.updateSelection&&G6(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:f,text:j}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:f,text:j})}return!0},Y6=()=>({state:t,dispatch:e})=>NL(t,e),X6=()=>({state:t,dispatch:e})=>wL(t,e),Z6=()=>({state:t,dispatch:e})=>pS(t,e),eD=()=>({state:t,dispatch:e})=>yS(t,e),tD=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Lp(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},nD=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Lp(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},sD=()=>({state:t,dispatch:e})=>bL(t,e),rD=()=>({state:t,dispatch:e})=>vL(t,e);function uC(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function aD(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=aD(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 Po(t,e,n={}){const{from:r,to:a,empty:i}=t.selection,o=e?Kn(e,t.schema):null,c=[];t.doc.nodesBetween(r,a,(m,g)=>{if(m.isText)return;const b=Math.max(r,g),N=Math.min(a,g+m.nodeSize);c.push({node:m,from:b,to:N})});const u=a-r,h=c.filter(m=>o?o.name===m.node.type.name:!0).filter(m=>Ff(m.node.attrs,n,{strict:!1}));return i?!!h.length:h.reduce((m,g)=>m+g.to-g.from,0)>=u}var oD=(t,e={})=>({state:n,dispatch:r})=>{const a=Kn(t,n.schema);return Po(n,a,e)?jL(n,r):!1},lD=()=>({state:t,dispatch:e})=>wS(t,e),cD=t=>({state:e,dispatch:n})=>{const r=Kn(t,e.schema);return OL(r)(e,n)},dD=()=>({state:t,dispatch:e})=>vS(t,e);function Vp(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function aw(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 uD=(t,e)=>({tr:n,state:r,dispatch:a})=>{let i=null,o=null;const c=Vp(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(i=Kn(t,r.schema)),c==="mark"&&(o=Ri(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,aw(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(aw(g.attrs,e))))})})}),u},hD=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),fD=()=>({tr:t,dispatch:e})=>{if(e){const n=new Cr(t.doc);t.setSelection(n)}return!0},pD=()=>({state:t,dispatch:e})=>gS(t,e),mD=()=>({state:t,dispatch:e})=>bS(t,e),gD=()=>({state:t,dispatch:e})=>EL(t,e),xD=()=>({state:t,dispatch:e})=>AL(t,e),yD=()=>({state:t,dispatch:e})=>ML(t,e);function l0(t,e,n={},r={}){return Su(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var bD=(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=l0(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 hC(t,e){const n=Ri(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 fC(t,e){const n=new cy(t);return e.forEach(r=>{r.steps.forEach(a=>{n.step(a)})}),n}function vD(t){for(let e=0;e{n(a)&&r.push({node:a,pos:i})}),r}function pC(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 Hp(t){return e=>pC(e.$from,t)}function rt(t,e,n){return t.config[e]===void 0&&t.parent?rt(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?rt(t.parent,e,n):null}):t.config[e]}function My(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=rt(e,"addExtensions",n);return r?[e,...My(r())]:e}).flat(10)}function Ay(t,e){const n=Jl.fromSchema(e).serializeFragment(t),a=document.implementation.createHTMLDocument().createElement("div");return a.appendChild(n),a.innerHTML}function mC(t){return typeof t=="function"}function Kt(t,e=void 0,...n){return mC(t)?e?t.bind(e)(...n):t(...n):t}function wD(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Qc(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 gC(t){const e=[],{nodeExtensions:n,markExtensions:r}=Qc(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=rt(h,"addGlobalAttributes",f);if(!m)return;m().forEach(b=>{let N;Array.isArray(b.types)?N=b.types:b.types==="*"?N=u:b.types==="nodes"?N=o:b.types==="marks"?N=c:N=[],N.forEach(j=>{Object.entries(b.attributes).forEach(([v,k])=>{e.push({type:j,name:v,attribute:{...i,...k}})})})})}),a.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage},m=rt(h,"addAttributes",f);if(!m)return;const g=m();Object.entries(g).forEach(([b,N])=>{const j={...i,...N};typeof(j==null?void 0:j.default)=="function"&&(j.default=j.default()),j!=null&&j.isRequired&&(j==null?void 0:j.default)===void 0&&delete j.default,e.push({type:h.name,name:b,attribute:j})})}),e}function jD(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 iw(t){const e=[],n=jD(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([...iw(r[a]),...iw(i)]);r[a]=Array.from(c.entries()).map(([u,h])=>`${u}: ${h}`).join("; ")}else r[a]=i}),r},{})}function Cu(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)=>qt(n,r),{})}function kD(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function ow(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):kD(n.getAttribute(o.name));return c==null?i:{...i,[o.name]:c}},{});return{...r,...a}}}}function lw(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&wD(n)?!1:n!=null))}function cw(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 SD(t,e){var n;const r=gC(t),{nodeExtensions:a,markExtensions:i}=Qc(t),o=(n=a.find(h=>rt(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,T)=>{const C=rt(T,"extendNodeSchema",m);return{...k,...C?C(h):{}}},{}),b=lw({...g,content:Kt(rt(h,"content",m)),marks:Kt(rt(h,"marks",m)),group:Kt(rt(h,"group",m)),inline:Kt(rt(h,"inline",m)),atom:Kt(rt(h,"atom",m)),selectable:Kt(rt(h,"selectable",m)),draggable:Kt(rt(h,"draggable",m)),code:Kt(rt(h,"code",m)),whitespace:Kt(rt(h,"whitespace",m)),linebreakReplacement:Kt(rt(h,"linebreakReplacement",m)),defining:Kt(rt(h,"defining",m)),isolating:Kt(rt(h,"isolating",m)),attrs:Object.fromEntries(f.map(cw))}),N=Kt(rt(h,"parseHTML",m));N&&(b.parseDOM=N.map(k=>ow(k,f)));const j=rt(h,"renderHTML",m);j&&(b.toDOM=k=>j({node:k,HTMLAttributes:Cu(k,f)}));const v=rt(h,"renderText",m);return v&&(b.toText=v),[h.name,b]})),u=Object.fromEntries(i.map(h=>{const f=r.filter(v=>v.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((v,k)=>{const T=rt(k,"extendMarkSchema",m);return{...v,...T?T(h):{}}},{}),b=lw({...g,inclusive:Kt(rt(h,"inclusive",m)),excludes:Kt(rt(h,"excludes",m)),group:Kt(rt(h,"group",m)),spanning:Kt(rt(h,"spanning",m)),code:Kt(rt(h,"code",m)),attrs:Object.fromEntries(f.map(cw))}),N=Kt(rt(h,"parseHTML",m));N&&(b.parseDOM=N.map(v=>ow(v,f)));const j=rt(h,"renderHTML",m);return j&&(b.toDOM=v=>j({mark:v,HTMLAttributes:Cu(v,f)})),[h.name,b]}));return new G2({topNode:o,nodes:c,marks:u})}function CD(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function lu(t){return t.sort((n,r)=>{const a=rt(n,"priority")||100,i=rt(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 yC(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 b=o==null?void 0:o[u.type.name];if(b)return f&&(c+=b({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 ED(t,e){const n={from:0,to:t.content.size};return yC(t,n,e)}function bC(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function TD(t,e){const n=Kn(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 vC(t,e){const n=Vp(typeof e=="string"?e:e.name,t.schema);return n==="node"?TD(t,e):n==="mark"?hC(t,e):{}}function MD(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 AD(t){const e=MD(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 NC(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}})})}),AD(r)}function Iy(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(a=>{const i=n.resolve(t),o=Ty(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 ID=(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 Kd(t,e){return e.nodes[t]||e.marks[t]||null}function ff(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 PD=(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 c0(t,e,n={}){const{empty:r,ranges:a}=t.selection,i=e?Ri(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>i?i.name===m.type.name:!0).find(m=>Ff(m.attrs,n,{strict:!1}));let o=0;const c=[];if(a.forEach(({$from:m,$to:g})=>{const b=m.pos,N=g.pos;t.doc.nodesBetween(b,N,(j,v)=>{if(i&&j.inlineContent&&!j.type.allowsMarkType(i))return!1;if(!j.isText&&!j.marks.length)return;const k=Math.max(b,v),T=Math.min(N,v+j.nodeSize),C=T-k;o+=C,c.push(...j.marks.map(P=>({mark:P,from:k,to:T})))})}),o===0)return!1;const u=c.filter(m=>i?i.name===m.mark.type.name:!0).filter(m=>Ff(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 RD(t,e,n={}){if(!e)return Po(t,null,n)||c0(t,null,n);const r=Vp(e,t.schema);return r==="node"?Po(t,e,n):r==="mark"?c0(t,e,n):!1}var LD=(t,e)=>{const{$from:n,$to:r,$anchor:a}=t.selection;if(e){const i=Hp(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 dw(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function uw(t,e){const{nodeExtensions:n}=Qc(e),r=n.find(o=>o.name===t);if(!r)return!1;const a={name:r.name,options:r.options,storage:r.storage},i=Kt(rt(r,"group",a));return typeof i!="string"?!1:i.split(" ").includes("list")}function Up(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&&(Up(i,{ignoreWhitespace:n,checkChildren:e})||(a=!1))}),a}return!1}function wC(t){return t instanceof it}var jC=class kC{constructor(e){this.position=e}static fromJSON(e){return new kC(e.position)}toJSON(){return{position:this.position}}};function DD(t,e){const n=e.mapping.mapResult(t.position);return{position:new jC(n.pos),mapResult:n}}function _D(t){return new jC(t)}function $D(t,e,n){var r;const{selection:a}=e;let i=null;if(lC(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 b=!g||g.type.allowsMarkType(n),N=!!n.isInSet(f.marks)||!f.marks.some(j=>j.type.excludes(n));h=b&&N}return!h}),h})}var zD=(t,e={})=>({tr:n,state:r,dispatch:a})=>{const{selection:i}=n,{empty:o,ranges:c}=i,u=Ri(t,r.schema);if(a)if(o){const h=hC(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,b)=>{const N=Math.max(b,f),j=Math.min(b+g.nodeSize,m);g.marks.find(k=>k.type===u)?g.marks.forEach(k=>{u===k.type&&n.addMark(N,j,u.create({...k.attrs,...e}))}):n.addMark(N,j,u.create(e))})});return $D(r,n,u)},FD=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),BD=(t,e={})=>({state:n,dispatch:r,chain:a})=>{const i=Kn(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})=>jN(i,{...o,...e})(n)?!0:c.clearNodes()).command(({state:c})=>jN(i,{...o,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},VD=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,a=jl(t,0,r.content.size),i=it.create(r,a);e.setSelection(i)}return!0},HD=(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},UD=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:a,to:i}=typeof t=="number"?{from:t,to:t}:t,o=ot.atStart(r).from,c=ot.atEnd(r).to,u=jl(a,o,c),h=jl(i,o,c),f=ot.create(r,u,h);e.setSelection(f)}return!0},WD=t=>({state:e,dispatch:n})=>{const r=Kn(t,e.schema);return $L(r)(e,n)};function hw(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 KD=({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=ff(h,c.node().type.name,c.node().attrs);if(i instanceof it&&i.node.isBlock)return!c.parentOffset||!Ti(o,c.pos)?!1:(r&&(t&&hw(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:vD(c.node(-1).contentMatchAt(c.indexAfter(-1)));let b=m&&g?[{type:g,attrs:f}]:void 0,N=Ti(e.doc,e.mapping.map(c.pos),1,b);if(!b&&!N&&Ti(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(N=!0,b=g?[{type:g,attrs:f}]:void 0),r){if(N&&(i instanceof ot&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,b),g&&!m&&!c.parentOffset&&c.parent.type!==g)){const j=e.mapping.map(c.before()),v=e.doc.resolve(j);c.node(-1).canReplaceWith(v.index(),v.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}t&&hw(n,a.extensionManager.splittableMarks),e.scrollIntoView()}return N},qD=(t,e={})=>({tr:n,state:r,dispatch:a,editor:i})=>{var o;const c=Kn(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=Ce.empty;const T=u.index(-1)?1:u.index(-2)?2:3;for(let H=u.depth-T;H>=u.depth-3;H-=1)k=Ce.from(u.node(H).copy(k));const C=u.indexAfter(-1){if(_>-1)return!1;H.isTextblock&&H.content.size===0&&(_=R+1)}),_>-1&&n.setSelection(ot.near(n.doc.resolve(_))),n.scrollIntoView()}return!0}const b=h.pos===u.end()?m.contentMatchAt(0).defaultType:null,N={...ff(g,m.type.name,m.attrs),...e},j={...ff(g,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,h.pos);const v=b?[{type:c,attrs:N},{type:b,attrs:j}]:[{type:c,attrs:N}];if(!Ti(n.doc,u.pos,2))return!1;if(a){const{selection:k,storedMarks:T}=r,{splittableMarks:C}=i.extensionManager,P=T||k.$to.parentOffset&&k.$from.marks();if(n.split(u.pos,2,v).scrollIntoView(),!P||!a)return!0;const L=P.filter(U=>C.includes(U.type.name));n.ensureMarks(L)}return!0},lx=(t,e)=>{const n=Hp(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)&&$o(t.doc,n.pos)&&t.join(n.pos),!0},cx=(t,e)=>{const n=Hp(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)&&$o(t.doc,r)&&t.join(r),!0},GD=(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,b=Kn(t,o.schema),N=Kn(e,o.schema),{selection:j,storedMarks:v}=o,{$from:k,$to:T}=j,C=k.blockRange(T),P=v||j.$to.parentOffset&&j.$from.marks();if(!C)return!1;const L=Hp(U=>uw(U.type.name,m))(j);if(C.depth>=1&&L&&C.depth-L.depth<=1){if(L.node.type===b)return h.liftListItem(N);if(uw(L.node.type.name,m)&&b.validContent(L.node.content)&&c)return u().command(()=>(i.setNodeMarkup(L.pos,b),!0)).command(()=>lx(i,b)).command(()=>cx(i,b)).run()}return!n||!P||!c?u().command(()=>f().wrapInList(b,r)?!0:h.clearNodes()).wrapInList(b,r).command(()=>lx(i,b)).command(()=>cx(i,b)).run():u().command(()=>{const U=f().wrapInList(b,r),_=P.filter(H=>g.includes(H.type.name));return i.ensureMarks(_),U?!0:h.clearNodes()}).wrapInList(b,r).command(()=>lx(i,b)).command(()=>cx(i,b)).run()},JD=(t,e={},n={})=>({state:r,commands:a})=>{const{extendEmptyMarkRange:i=!1}=n,o=Ri(t,r.schema);return c0(r,o,e)?a.unsetMark(o,{extendEmptyMarkRange:i}):a.setMark(o,e)},QD=(t,e,n={})=>({state:r,commands:a})=>{const i=Kn(t,r.schema),o=Kn(e,r.schema),c=Po(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})},YD=(t,e={})=>({state:n,commands:r})=>{const a=Kn(t,n.schema);return Po(n,a,e)?r.lift(a):r.wrapIn(a,e)},XD=()=>({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},ZD=()=>({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},e_=(t,e={})=>({tr:n,state:r,dispatch:a})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:c}=n,u=Ri(t,r.schema),{$from:h,empty:f,ranges:m}=c;if(!a)return!0;if(f&&o){let{from:g,to:b}=c;const N=(i=h.marks().find(v=>v.type===u))==null?void 0:i.attrs,j=Ty(h,u,N);j&&(g=j.from,b=j.to),n.removeMark(g,b,u)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,u)});return n.removeStoredMark(u),!0},t_=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},n_=(t,e={})=>({tr:n,state:r,dispatch:a})=>{let i=null,o=null;const c=Vp(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(i=Kn(t,r.schema)),c==="mark"&&(o=Ri(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;let g,b,N,j;n.selection.empty?r.doc.nodesBetween(f,m,(v,k)=>{i&&i===v.type&&(u=!0,N=Math.max(k,f),j=Math.min(k+v.nodeSize,m),g=k,b=v)}):r.doc.nodesBetween(f,m,(v,k)=>{k=f&&k<=m&&(i&&i===v.type&&(u=!0,a&&n.setNodeMarkup(k,void 0,{...v.attrs,...e})),o&&v.marks.length&&v.marks.forEach(T=>{if(o===T.type&&(u=!0,a)){const C=Math.max(k,f),P=Math.min(k+v.nodeSize,m);n.addMark(C,P,o.create({...T.attrs,...e}))}}))}),b&&(g!==void 0&&a&&n.setNodeMarkup(g,void 0,{...b.attrs,...e}),o&&b.marks.length&&b.marks.forEach(v=>{o===v.type&&a&&n.addMark(N,j,o.create({...v.attrs,...e}))}))}),u},s_=(t,e={})=>({state:n,dispatch:r})=>{const a=Kn(t,n.schema);return IL(a,e)(n,r)},r_=(t,e={})=>({state:n,dispatch:r})=>{const a=Kn(t,n.schema);return PL(a,e)(n,r)},a_=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={}}},Wp=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},i_=(t,e)=>{if(Ey(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 Jh(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=PD(h)+i;return o.forEach(g=>{if(f)return;const b=i_(m,g.find);if(!b)return;const N=u.state.tr,j=Fp({state:u.state,transaction:N}),v={from:r-(b[0].length-i.length),to:a},{commands:k,chain:T,can:C}=new Bp({editor:n,state:j});g.handler({state:j,range:v,match:b,commands:k,chain:T,can:C})===null||!N.steps.length||(g.undoable&&N.setMeta(c,{transform:N,from:r,to:a,text:i}),u.dispatch(N),f=!0)}),f}function o_(t){const{editor:e,rules:n}=t,r=new dn({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=Ay(Ce.from(f),o.schema);const{from:m}=u,g=m+f.length;Jh({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 Jh({editor:e,from:i,to:o,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:a=>(setTimeout(()=>{const{$cursor:i}=a.state.selection;i&&Jh({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?Jh({editor:e,from:o.pos,to:o.pos,text:` +`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function l_(t){return Object.prototype.toString.call(t).slice(8,-1)}function Qh(t){return l_(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function SC(t,e){const n={...t};return Qh(t)&&Qh(e)&&Object.keys(e).forEach(r=>{Qh(e[r])&&Qh(t[r])?n[r]=SC(t[r],e[r]):n[r]=e[r]}),n}var Py=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{...Kt(rt(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Kt(rt(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>SC(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}},Ql=class CC extends Py{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new CC(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 c_(t){return typeof t=="number"}var d_=class{constructor(t){this.find=t.find,this.handler=t.handler}},u_=(t,e,n)=>{if(Ey(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 h_(t){const{editor:e,state:n,from:r,to:a,rule:i,pasteEvent:o,dropEvent:c}=t,{commands:u,chain:h,can:f}=new Bp({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,a,(b,N)=>{var j,v,k,T,C;if((v=(j=b.type)==null?void 0:j.spec)!=null&&v.code||!(b.isText||b.isTextblock||b.isInline))return;const P=(C=(T=(k=b.content)==null?void 0:k.size)!=null?T:b.nodeSize)!=null?C:0,L=Math.max(r,N),U=Math.min(a,N+P);if(L>=U)return;const _=b.isText?b.text||"":b.textBetween(L-N,U-N,void 0,"");u_(_,i.find,o).forEach(R=>{if(R.index===void 0)return;const Z=L+R.index+1,re=Z+R[0].length,$={from:n.tr.mapping.map(Z),to:n.tr.mapping.map(re)},ie=i.handler({state:n,range:$,match:R,commands:u,chain:h,can:f,pasteEvent:o,dropEvent:c});m.push(ie)})}),m.every(b=>b!==null)}var Yh=null,f_=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function p_(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:b,pasteEvt:N})=>{const j=f.tr,v=Fp({state:f,transaction:j});if(!(!h_({editor:e,state:v,from:Math.max(m-1,0),to:g.b-1,rule:b,pasteEvent:N,dropEvent:c})||!j.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,j}};return n.map(f=>new dn({view(m){const g=N=>{var j;r=(j=m.dom.parentElement)!=null&&j.contains(N.target)?m.dom.parentElement:null,r&&(Yh=e)},b=()=>{Yh&&(Yh=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",b),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",b)}}},props:{handleDOMEvents:{drop:(m,g)=>{if(i=r===m.dom.parentElement,c=g,!i){const b=Yh;b!=null&&b.isEditable&&setTimeout(()=>{const N=b.state.selection;N&&b.commands.deleteRange({from:N.from,to:N.to})},10)}return!1},paste:(m,g)=>{var b;const N=(b=g.clipboardData)==null?void 0:b.getData("text/html");return o=g,a=!!(N!=null&&N.includes("data-pm-slice")),!1}}},appendTransaction:(m,g,b)=>{const N=m[0],j=N.getMeta("uiEvent")==="paste"&&!a,v=N.getMeta("uiEvent")==="drop"&&!i,k=N.getMeta("applyPasteRules"),T=!!k;if(!j&&!v&&!T)return;if(T){let{text:L}=k;typeof L=="string"?L=L:L=Ay(Ce.from(L),b.schema);const{from:U}=k,_=U+L.length,H=f_(L);return u({rule:f,state:b,from:U,to:{b:_},pasteEvt:H})}const C=g.doc.content.findDiffStart(b.doc.content),P=g.doc.content.findDiffEnd(b.doc.content);if(!(!c_(C)||!P||C===P.b))return u({rule:f,state:b,from:C,to:P,pasteEvt:o})}}))}var Kp=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=xC(t),this.schema=SD(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:Kd(e.name,this.schema)},r=rt(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return lu([...this.extensions].reverse()).flatMap(r=>{const a={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Kd(r.name,this.schema)},i=[],o=rt(r,"addKeyboardShortcuts",a);let c={};if(r.type==="mark"&&rt(r,"exitable",a)&&(c.ArrowRight=()=>Ql.handleExit({editor:t,mark:r})),o){const g=Object.fromEntries(Object.entries(o()).map(([b,N])=>[b,()=>N({editor:t})]));c={...c,...g}}const u=T6(c);i.push(u);const h=rt(r,"addInputRules",a);if(dw(r,t.options.enableInputRules)&&h){const g=h();if(g&&g.length){const b=o_({editor:t,rules:g}),N=Array.isArray(b)?b:[b];i.push(...N)}}const f=rt(r,"addPasteRules",a);if(dw(r,t.options.enablePasteRules)&&f){const g=f();if(g&&g.length){const b=p_({editor:t,rules:g});i.push(...b)}}const m=rt(r,"addProseMirrorPlugins",a);if(m){const g=m();i.push(...g)}return i})}get attributes(){return gC(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Qc(this.extensions);return Object.fromEntries(e.filter(n=>!!rt(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:Kn(n.name,this.schema)},i=rt(n,"addNodeView",a);if(!i)return[];const o=i();if(!o)return[];const c=(u,h,f,m,g)=>{const b=Cu(u,r);return o({node:u,view:h,getPos:f,decorations:m,innerDecorations:g,editor:t,extension:n,HTMLAttributes:b})};return[n.name,c]}))}dispatchTransaction(t){const{editor:e}=this;return lu([...this.extensions].reverse()).reduceRight((r,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:Kd(a.name,this.schema)},o=rt(a,"dispatchTransaction",i);return o?c=>{o.call(i,{transaction:c,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return lu([...this.extensions]).reduce((r,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:Kd(a.name,this.schema)},o=rt(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}=Qc(this.extensions);return Object.fromEntries(e.filter(n=>!!rt(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:Ri(n.name,this.schema)},i=rt(n,"addMarkView",a);if(!i)return[];const o=(c,u,h)=>{const f=Cu(c,r);return i()({mark:c,view:u,inline:h,editor:t,extension:n,HTMLAttributes:f,updateAttributes:m=>{M_(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:Kd(e.name,this.schema)};e.type==="mark"&&((n=Kt(rt(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const a=rt(e,"onBeforeCreate",r),i=rt(e,"onCreate",r),o=rt(e,"onUpdate",r),c=rt(e,"onSelectionUpdate",r),u=rt(e,"onTransaction",r),h=rt(e,"onFocus",r),f=rt(e,"onBlur",r),m=rt(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)})}};Kp.resolve=xC;Kp.sort=lu;Kp.flatten=My;var m_={};Cy(m_,{ClipboardTextSerializer:()=>TC,Commands:()=>MC,Delete:()=>AC,Drop:()=>IC,Editable:()=>PC,FocusEvents:()=>LC,Keymap:()=>OC,Paste:()=>DC,Tabindex:()=>_C,TextDirection:()=>$C,focusEventsPluginKey:()=>RC});var Ln=class EC extends Py{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new EC(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},TC=Ln.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new dn({key:new vn("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=bC(n);return yC(r,{from:o,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),MC=Ln.create({name:"commands",addCommands(){return{...iC}}}),AC=Ln.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=fC(t.before,[t,...e]);NC(f).forEach(b=>{f.mapping.mapResult(b.oldRange.from).deletedAfter&&f.mapping.mapResult(b.oldRange.to).deletedBefore&&f.before.nodesBetween(b.oldRange.from,b.oldRange.to,(N,j)=>{const v=j+N.nodeSize-2,k=b.oldRange.from<=j&&v<=b.oldRange.to;this.editor.emit("delete",{type:"node",node:N,from:j,to:v,newFrom:f.mapping.map(j),newTo:f.mapping.map(v),deletedRange:b.oldRange,newRange:b.newRange,partial:!k,editor:this.editor,transaction:t,combinedTransform:f})})});const g=f.mapping;f.steps.forEach((b,N)=>{var j,v;if(b instanceof fa){const k=g.slice(N).map(b.from,-1),T=g.slice(N).map(b.to),C=g.invert().map(k,-1),P=g.invert().map(T),L=(j=f.doc.nodeAt(k-1))==null?void 0:j.marks.some(_=>_.eq(b.mark)),U=(v=f.doc.nodeAt(T))==null?void 0:v.marks.some(_=>_.eq(b.mark));this.editor.emit("delete",{type:"mark",mark:b.mark,from:b.from,to:b.to,deletedRange:{from:C,to:P},newRange:{from:k,to:T},partial:!!(U||L),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()}}),IC=Ln.create({name:"drop",addProseMirrorPlugins(){return[new dn({key:new vn("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),PC=Ln.create({name:"editable",addProseMirrorPlugins(){return[new dn({key:new vn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),RC=new vn("focusEvents"),LC=Ln.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new dn({key:RC,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}}}})]}}),OC=Ln.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:b}=m,N=m.parent.isTextblock&&g>0?c.doc.resolve(g-1):m,j=N.parent.type.spec.isolating,v=m.pos-m.parentOffset,k=j&&N.parent.childCount===1?v===m.pos:ft.atStart(h).from===g;return!f||!b.type.isTextblock||b.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 Bf()||uC()?i:a},addProseMirrorPlugins(){return[new dn({key:new vn("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(j=>j.getMeta("composition")))return;const r=t.some(j=>j.docChanged)&&!e.doc.eq(n.doc),a=t.some(j=>j.getMeta("preventClearDocument"));if(!r||a)return;const{empty:i,from:o,to:c}=e.selection,u=ft.atStart(e.doc).from,h=ft.atEnd(e.doc).to;if(i||!(o===u&&c===h)||!Up(n.doc))return;const g=n.tr,b=Fp({state:n,transaction:g}),{commands:N}=new Bp({editor:this.editor,state:b});if(N.clearNodes(),!!g.steps.length)return g}})]}}),DC=Ln.create({name:"paste",addProseMirrorPlugins(){return[new dn({key:new vn("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),_C=Ln.create({name:"tabindex",addProseMirrorPlugins(){return[new dn({key:new vn("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),$C=Ln.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Qc(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 dn({key:new vn("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),g_=class Xd{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 Xd(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 Xd(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 Xd(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 Xd(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)}},x_=`.ProseMirror { + position: relative; +} + +.ProseMirror { + word-wrap: break-word; + white-space: pre-wrap; + white-space: break-spaces; + -webkit-font-variant-ligatures: none; + font-variant-ligatures: none; + font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ +} + +.ProseMirror [contenteditable="false"] { + white-space: normal; +} + +.ProseMirror [contenteditable="false"] [contenteditable="true"] { + white-space: pre-wrap; +} + +.ProseMirror pre { + white-space: pre-wrap; +} + +img.ProseMirror-separator { + display: inline !important; + border: none !important; + margin: 0 !important; + width: 0 !important; + height: 0 !important; +} + +.ProseMirror-gapcursor { + display: none; + pointer-events: none; + position: absolute; + margin: 0; +} + +.ProseMirror-gapcursor:after { + content: ""; + display: block; + position: absolute; + top: -2px; + width: 20px; + border-top: 1px solid black; + animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; +} + +@keyframes ProseMirror-cursor-blink { + to { + visibility: hidden; + } +} + +.ProseMirror-hideselection *::selection { + background: transparent; +} + +.ProseMirror-hideselection *::-moz-selection { + background: transparent; +} + +.ProseMirror-hideselection * { + caret-color: transparent; +} + +.ProseMirror-focused .ProseMirror-gapcursor { + display: block; +}`;function y_(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const a=document.createElement("style");return e&&a.setAttribute("nonce",e),a.setAttribute("data-tiptap-style",""),a.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(a),a}var b_=class extends a_{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:DD,createMappablePosition:_D},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:a,moved:i})=>this.options.onDrop(r,a,i)),this.on("paste",({event:r,slice:a})=>this.options.onPaste(r,a)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=cC(e,this.options.autofocus);this.editorState=$c.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t!=null&&t.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=y_(x_,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=mC(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(a=>{const i=typeof a=="string"?`${a}$`:a.key;n=n.filter(o=>!o.key.startsWith(i))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[PC,TC.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),MC,LC,OC,_C,IC,DC,AC,$C.configure({direction:this.options.textDirection})].filter(a=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[a.name]!==!1:!0):[],...this.options.extensions].filter(a=>["extension","node","mark"].includes(a==null?void 0:a.type));this.extensionManager=new Kp(r,this)}createCommandManager(){this.commandManager=new Bp({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=l0(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=l0(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),a=n?this.extensionManager.dispatchTransaction(r):r,i=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(i);this.editorView=new aC(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:a,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const c=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(c),this.prependClass(),this.injectCSS();const u=this.view.dom;u.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(h=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(h)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),a=n.includes(t),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!a)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(h=>h.getMeta("focus")||h.getMeta("blur")),c=o==null?void 0:o.getMeta("focus"),u=o==null?void 0:o.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:o}),u&&this.emit("blur",{editor:this,event:u.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(h=>h.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return vC(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return RD(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Ay(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=` + +`,textSerializers:n={}}=t||{};return ED(this.state.doc,{blockSeparator:e,textSerializers:{...bC(this.schema),...n}})}get isEmpty(){return Up(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new g_(e,this)}get $doc(){return this.$pos(0)}};function Yc(t){return new Wp({find:t.find,handler:({state:e,range:n,match:r})=>{const a=Kt(t.getAttributes,void 0,r);if(a===!1||a===null)return null;const{tr:i}=e,o=r[r.length-1],c=r[0];if(o){const u=c.search(/\S/),h=n.from+c.indexOf(o),f=h+o.length;if(Iy(n.from,n.to,e.doc).filter(b=>b.mark.type.excluded.find(j=>j===t.type&&j!==b.mark.type)).filter(b=>b.to>h).length)return null;fn.from&&i.delete(n.from+u,h);const g=n.from+u+o.length;i.addMark(n.from+u,g,t.type.create(a||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function zC(t){return new Wp({find:t.find,handler:({state:e,range:n,match:r})=>{const a=Kt(t.getAttributes,void 0,r)||{},{tr:i}=e,o=n.from;let c=n.to;const u=t.type.create(a);if(r[1]){const h=r[0].lastIndexOf(r[1]);let f=o+h;f>c?f=c:c=f+r[1].length;const m=r[0][r[0].length-1];i.insertText(m,o+r[0].length-1),i.replaceWith(f,c,u)}else if(r[0]){const h=t.type.isInline?o:o-1;i.insert(h,t.type.create(a)).delete(i.mapping.map(o),i.mapping.map(c))}i.scrollIntoView()},undoable:t.undoable})}function d0(t){return new Wp({find:t.find,handler:({state:e,range:n,match:r})=>{const a=e.doc.resolve(n.from),i=Kt(t.getAttributes,void 0,r)||{};if(!a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable})}function Xc(t){return new Wp({find:t.find,handler:({state:e,range:n,match:r,chain:a})=>{const i=Kt(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),u=o.doc.resolve(n.from).blockRange(),h=u&&ly(u,t.type,i);if(!h)return null;if(o.wrap(u,h),t.keepMarks&&t.editor){const{selection:m,storedMarks:g}=e,{splittableMarks:b}=t.editor.extensionManager,N=g||m.$to.parentOffset&&m.$from.marks();if(N){const j=N.filter(v=>b.includes(v.type.name));o.ensureMarks(j)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";a().updateAttributes(m,i).run()}const f=o.doc.resolve(n.from-1).nodeBefore;f&&f.type===t.type&&$o(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,f))&&o.join(n.from-1)},undoable:t.undoable})}var v_=t=>"touches"in t,N_=class{constructor(t){this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.clientX-this.startX,h=c.clientY-this.startY;this.handleResize(u,h)},this.handleTouchMove=c=>{if(!this.isResizing||!this.activeHandle)return;const u=c.touches[0];if(!u)return;const h=u.clientX-this.startX,f=u.clientY-this.startY;this.handleResize(h,f)},this.handleMouseUp=()=>{if(!this.isResizing)return;const c=this.element.offsetWidth,u=this.element.offsetHeight;this.onCommit(c,u),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=c=>{c.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=c=>{c.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,n,r,a,i,o;this.node=t.node,this.editor=t.editor,this.element=t.element,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(e=t.options)!=null&&e.min&&(this.minSize={...this.minSize,...t.options.min}),(n=t.options)!=null&&n.max&&(this.maxSize=t.options.max),(r=t==null?void 0:t.options)!=null&&r.directions&&(this.directions=t.options.directions),(a=t.options)!=null&&a.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(i=t.options)!=null&&i.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),(o=t.options)!=null&&o.createCustomHandle&&(this.createCustomHandle=t.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var t;return(t=this.contentElement)!=null?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display="flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),a=e.includes("left"),i=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),a&&(t.style.left="0"),i&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,v_(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:a}=this.calculateNewDimensions(this.activeHandle,t,e),i=this.applyConstraints(r,a,n);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,a=this.startHeight;const i=t.includes("right"),o=t.includes("left"),c=t.includes("bottom"),u=t.includes("top");return i?r=this.startWidth+e:o&&(r=this.startWidth-e),c?a=this.startHeight+n:u&&(a=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(i?e:-e)),(t==="top"||t==="bottom")&&(a=this.startHeight+(c?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,a,t):{width:r,height:a}}applyConstraints(t,e,n){var r,a,i,o;if(!n){let h=Math.max(this.minSize.width,t),f=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(h=Math.min(this.maxSize.width,h)),(a=this.maxSize)!=null&&a.height&&(f=Math.min(this.maxSize.height,f)),{width:h,height:f}}let c=t,u=e;return cthis.maxSize.width&&(c=this.maxSize.width,u=c/this.aspectRatio),(o=this.maxSize)!=null&&o.height&&u>this.maxSize.height&&(u=this.maxSize.height,c=u*this.aspectRatio),{width:c,height:u}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",a=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:a?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};function w_(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof it){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let a=r.depth;for(;a>=0;){const i=r.index(a);if(r.node(a).contentMatchAt(i).matchType(e))return!0;a-=1}return!1}function j_(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var k_={};Cy(k_,{createAtomBlockMarkdownSpec:()=>S_,createBlockMarkdownSpec:()=>C_,createInlineMarkdownSpec:()=>FC,parseAttributes:()=>Ry,parseIndentedBlocks:()=>u0,renderNestedMarkdownContent:()=>Oy,serializeAttributes:()=>Ly});function Ry(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,h=>(n.push(h),`__QUOTED_${n.length-1}__`)),a=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(a){const h=a.map(f=>f.trim().slice(1));e.class=h.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,h,f])=>{var m;const g=parseInt(((m=f.match(/__QUOTED_(\d+)__/))==null?void 0:m[1])||"0",10),b=n[g];b&&(e[h]=b.slice(1,-1))});const u=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return u&&u.split(/\s+/).filter(Boolean).forEach(f=>{f.match(/^[a-zA-Z][\w-]*$/)&&(e[f]=!0)}),e}function Ly(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function S_(t){const{nodeName:e,name:n,parseAttributes:r=Ry,serializeAttributes:a=Ly,defaultAttributes:i={},requiredAttributes:o=[],allowedAttributes:c}=t,u=n||e,h=f=>{if(!c)return f;const m={};return c.forEach(g=>{g in f&&(m[g]=f[g])}),m};return{parseMarkdown:(f,m)=>{const g={...i,...f.attributes};return m.createNode(e,g,[])},markdownTokenizer:{name:e,level:"block",start(f){var m;const g=new RegExp(`^:::${u}(?:\\s|$)`,"m"),b=(m=f.match(g))==null?void 0:m.index;return b!==void 0?b:-1},tokenize(f,m,g){const b=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),N=f.match(b);if(!N)return;const j=N[1]||"",v=r(j);if(!o.find(T=>!(T in v)))return{type:e,raw:N[0],attributes:v}}},renderMarkdown:f=>{const m=h(f.attrs||{}),g=a(m),b=g?` {${g}}`:"";return`:::${u}${b} :::`}}}function C_(t){const{nodeName:e,name:n,getContent:r,parseAttributes:a=Ry,serializeAttributes:i=Ly,defaultAttributes:o={},content:c="block",allowedAttributes:u}=t,h=n||e,f=m=>{if(!u)return m;const g={};return u.forEach(b=>{b in m&&(g[b]=m[b])}),g};return{parseMarkdown:(m,g)=>{let b;if(r){const j=r(m);b=typeof j=="string"?[{type:"text",text:j}]:j}else c==="block"?b=g.parseChildren(m.tokens||[]):b=g.parseInline(m.tokens||[]);const N={...o,...m.attributes};return g.createNode(e,N,b)},markdownTokenizer:{name:e,level:"block",start(m){var g;const b=new RegExp(`^:::${h}`,"m"),N=(g=m.match(b))==null?void 0:g.index;return N!==void 0?N:-1},tokenize(m,g,b){var N;const j=new RegExp(`^:::${h}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),v=m.match(j);if(!v)return;const[k,T=""]=v,C=a(T);let P=1;const L=k.length;let U="";const _=/^:::([\w-]*)(\s.*)?/gm,H=m.slice(L);for(_.lastIndex=0;;){const R=_.exec(H);if(R===null)break;const Z=R.index,re=R[1];if(!((N=R[2])!=null&&N.endsWith(":::"))){if(re)P+=1;else if(P-=1,P===0){const $=H.slice(0,Z);U=$.trim();const ie=m.slice(0,L+Z+R[0].length);let ce=[];if(U)if(c==="block")for(ce=b.blockTokens($),ce.forEach(me=>{me.text&&(!me.tokens||me.tokens.length===0)&&(me.tokens=b.inlineTokens(me.text))});ce.length>0;){const me=ce[ce.length-1];if(me.type==="paragraph"&&(!me.text||me.text.trim()===""))ce.pop();else break}else ce=b.inlineTokens(U);return{type:e,raw:ie,attributes:C,content:U,tokens:ce}}}}}},renderMarkdown:(m,g)=>{const b=f(m.attrs||{}),N=i(b),j=N?` {${N}}`:"",v=g.renderChildren(m.content||[],` + +`);return`:::${h}${j} + +${v} + +:::`}}}function E_(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,a,i,o]=r;e[a]=i||o,r=n.exec(t)}return e}function T_(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function FC(t){const{nodeName:e,name:n,getContent:r,parseAttributes:a=E_,serializeAttributes:i=T_,defaultAttributes:o={},selfClosing:c=!1,allowedAttributes:u}=t,h=n||e,f=g=>{if(!u)return g;const b={};return u.forEach(N=>{const j=typeof N=="string"?N:N.name,v=typeof N=="string"?void 0:N.skipIfDefault;if(j in g){const k=g[j];if(v!==void 0&&k===v)return;b[j]=k}}),b},m=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(g,b)=>{const N={...o,...g.attributes};if(c)return b.createNode(e,N);const j=r?r(g):g.content||"";return j?b.createNode(e,N,[b.createTextNode(j)]):b.createNode(e,N,[])},markdownTokenizer:{name:e,level:"inline",start(g){const b=c?new RegExp(`\\[${m}\\s*[^\\]]*\\]`):new RegExp(`\\[${m}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${m}\\]`),N=g.match(b),j=N==null?void 0:N.index;return j!==void 0?j:-1},tokenize(g,b,N){const j=c?new RegExp(`^\\[${m}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${m}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${m}\\]`),v=g.match(j);if(!v)return;let k="",T="";if(c){const[,P]=v;T=P}else{const[,P,L]=v;T=P,k=L||""}const C=a(T.trim());return{type:e,raw:v[0],content:k.trim(),attributes:C}}},renderMarkdown:g=>{let b="";r?b=r(g):g.content&&g.content.length>0&&(b=g.content.filter(k=>k.type==="text").map(k=>k.text).join(""));const N=f(g.attrs||{}),j=i(N),v=j?` ${j}`:"";return c?`[${h}${v}]`:`[${h}${v}]${b}[/${h}]`}}}function u0(t,e,n){var r,a,i,o;const c=t.split(` +`),u=[];let h="",f=0;const m=e.baseIndentSize||2;for(;f0)break;if(g.trim()===""){f+=1,h=`${h}${g} +`;continue}else return}const N=e.extractItemData(b),{indentLevel:j,mainContent:v}=N;h=`${h}${g} +`;const k=[v];for(f+=1;fZ.trim()!=="");if(_===-1)break;if((((a=(r=c[f+1+_].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:a.length)||0)>j){k.push(L),h=`${h}${L} +`,f+=1;continue}else break}if((((o=(i=L.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:o.length)||0)>j)k.push(L),h=`${h}${L} +`,f+=1;else break}let T;const C=k.slice(1);if(C.length>0){const L=C.map(U=>U.slice(j+m)).join(` +`);L.trim()&&(e.customNestedParser?T=e.customNestedParser(L):T=n.blockTokens(L))}const P=e.createToken(N,T);u.push(P)}if(u.length!==0)return{items:u,raw:h}}function Oy(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const a=typeof n=="function"?n(r):n,[i,...o]=t.content,c=e.renderChildren([i]),u=[`${a}${c}`];return o&&o.length>0&&o.forEach(h=>{const f=e.renderChildren([h]);if(f){const m=f.split(` +`).map(g=>g?e.indent(g):"").join(` +`);u.push(m)}}),u.join(` +`)}function M_(t,e,n={}){const{state:r}=e,{doc:a,tr:i}=r,o=t;a.descendants((c,u)=>{const h=i.mapping.map(u),f=i.mapping.map(u)+c.nodeSize;let m=null;if(c.marks.forEach(b=>{if(b!==o)return!1;m=b}),!m)return;let g=!1;if(Object.keys(n).forEach(b=>{n[b]!==m.attrs[b]&&(g=!0)}),g){const b=t.type.create({...t.attrs,...n});i.removeMark(h,f,t.type),i.addMark(h,f,b)}}),i.docChanged&&e.view.dispatch(i)}var Fn=class BC extends Py{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new BC(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Hl(t){return new d_({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:a})=>{const i=Kt(t.getAttributes,void 0,r,a);if(i===!1||i===null)return null;const{tr:o}=e,c=r[r.length-1],u=r[0];let h=n.to;if(c){const f=u.search(/\S/),m=n.from+u.indexOf(c),g=m+c.length;if(Iy(n.from,n.to,e.doc).filter(N=>N.mark.type.excluded.find(v=>v===t.type&&v!==N.mark.type)).filter(N=>N.to>m).length)return null;gn.from&&o.delete(n.from+f,m),h=n.from+f+c.length,o.addMark(n.from+f,h,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:A_,getOwnPropertySymbols:I_}=Object,{hasOwnProperty:P_}=Object.prototype;function dx(t,e){return function(r,a,i){return t(r,a,i)&&e(r,a,i)}}function Xh(t){return function(n,r,a){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,a);const{cache:i}=a,o=i.get(n),c=i.get(r);if(o&&c)return o===r&&c===n;i.set(n,r),i.set(r,n);const u=t(n,r,a);return i.delete(n),i.delete(r),u}}function R_(t){return t!=null?t[Symbol.toStringTag]:void 0}function fw(t){return A_(t).concat(I_(t))}const L_=Object.hasOwn||((t,e)=>P_.call(t,e));function Yl(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const O_="__v",D_="__o",__="_owner",{getOwnPropertyDescriptor:pw,keys:mw}=Object;function $_(t,e){return t.byteLength===e.byteLength&&Vf(new Uint8Array(t),new Uint8Array(e))}function z_(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function F_(t,e){return t.byteLength===e.byteLength&&Vf(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function B_(t,e){return Yl(t.getTime(),e.getTime())}function V_(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function H_(t,e){return t===e}function gw(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const a=new Array(r),i=t.entries();let o,c,u=0;for(;(o=i.next())&&!o.done;){const h=e.entries();let f=!1,m=0;for(;(c=h.next())&&!c.done;){if(a[m]){m++;continue}const g=o.value,b=c.value;if(n.equals(g[0],b[0],u,m,t,e,n)&&n.equals(g[1],b[1],g[0],b[0],t,e,n)){f=a[m]=!0;break}m++}if(!f)return!1;u++}return!0}const U_=Yl;function W_(t,e,n){const r=mw(t);let a=r.length;if(mw(e).length!==a)return!1;for(;a-- >0;)if(!VC(t,e,n,r[a]))return!1;return!0}function qd(t,e,n){const r=fw(t);let a=r.length;if(fw(e).length!==a)return!1;let i,o,c;for(;a-- >0;)if(i=r[a],!VC(t,e,n,i)||(o=pw(t,i),c=pw(e,i),(o||c)&&(!o||!c||o.configurable!==c.configurable||o.enumerable!==c.enumerable||o.writable!==c.writable)))return!1;return!0}function K_(t,e){return Yl(t.valueOf(),e.valueOf())}function q_(t,e){return t.source===e.source&&t.flags===e.flags}function xw(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const a=new Array(r),i=t.values();let o,c;for(;(o=i.next())&&!o.done;){const u=e.values();let h=!1,f=0;for(;(c=u.next())&&!c.done;){if(!a[f]&&n.equals(o.value,c.value,o.value,c.value,t,e,n)){h=a[f]=!0;break}f++}if(!h)return!1}return!0}function Vf(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function G_(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function VC(t,e,n,r){return(r===__||r===D_||r===O_)&&(t.$$typeof||e.$$typeof)?!0:L_(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const J_="[object ArrayBuffer]",Q_="[object Arguments]",Y_="[object Boolean]",X_="[object DataView]",Z_="[object Date]",e7="[object Error]",t7="[object Map]",n7="[object Number]",s7="[object Object]",r7="[object RegExp]",a7="[object Set]",i7="[object String]",o7={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},l7="[object URL]",c7=Object.prototype.toString;function d7({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:a,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:c,areObjectsEqual:u,arePrimitiveWrappersEqual:h,areRegExpsEqual:f,areSetsEqual:m,areTypedArraysEqual:g,areUrlsEqual:b,unknownTagComparators:N}){return function(v,k,T){if(v===k)return!0;if(v==null||k==null)return!1;const C=typeof v;if(C!==typeof k)return!1;if(C!=="object")return C==="number"?c(v,k,T):C==="function"?i(v,k,T):!1;const P=v.constructor;if(P!==k.constructor)return!1;if(P===Object)return u(v,k,T);if(Array.isArray(v))return e(v,k,T);if(P===Date)return r(v,k,T);if(P===RegExp)return f(v,k,T);if(P===Map)return o(v,k,T);if(P===Set)return m(v,k,T);const L=c7.call(v);if(L===Z_)return r(v,k,T);if(L===r7)return f(v,k,T);if(L===t7)return o(v,k,T);if(L===a7)return m(v,k,T);if(L===s7)return typeof v.then!="function"&&typeof k.then!="function"&&u(v,k,T);if(L===l7)return b(v,k,T);if(L===e7)return a(v,k,T);if(L===Q_)return u(v,k,T);if(o7[L])return g(v,k,T);if(L===J_)return t(v,k,T);if(L===X_)return n(v,k,T);if(L===Y_||L===n7||L===i7)return h(v,k,T);if(N){let U=N[L];if(!U){const _=R_(v);_&&(U=N[_])}if(U)return U(v,k,T)}return!1}}function u7({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:$_,areArraysEqual:n?qd:z_,areDataViewsEqual:F_,areDatesEqual:B_,areErrorsEqual:V_,areFunctionsEqual:H_,areMapsEqual:n?dx(gw,qd):gw,areNumbersEqual:U_,areObjectsEqual:n?qd:W_,arePrimitiveWrappersEqual:K_,areRegExpsEqual:q_,areSetsEqual:n?dx(xw,qd):xw,areTypedArraysEqual:n?dx(Vf,qd):Vf,areUrlsEqual:G_,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const a=Xh(r.areArraysEqual),i=Xh(r.areMapsEqual),o=Xh(r.areObjectsEqual),c=Xh(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:a,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:c})}return r}function h7(t){return function(e,n,r,a,i,o,c){return t(e,n,c)}}function f7({circular:t,comparator:e,createState:n,equals:r,strict:a}){if(n)return function(c,u){const{cache:h=t?new WeakMap:void 0,meta:f}=n();return e(c,u,{cache:h,equals:r,meta:f,strict:a})};if(t)return function(c,u){return e(c,u,{cache:new WeakMap,equals:r,meta:void 0,strict:a})};const i={cache:void 0,equals:r,meta:void 0,strict:a};return function(c,u){return e(c,u,i)}}const p7=Fo();Fo({strict:!0});Fo({circular:!0});Fo({circular:!0,strict:!0});Fo({createInternalComparator:()=>Yl});Fo({strict:!0,createInternalComparator:()=>Yl});Fo({circular:!0,createInternalComparator:()=>Yl});Fo({circular:!0,createInternalComparator:()=>Yl,strict:!0});function Fo(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:a=!1}=t,i=u7(t),o=d7(i),c=n?n(o):h7(o);return f7({circular:e,comparator:o,createState:r,equals:c,strict:a})}var ux={exports:{}},hx={};/** + * @license React + * use-sync-external-store-shim/with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var yw;function m7(){if(yw)return hx;yw=1;var t=Iu(),e=I2();function n(h,f){return h===f&&(h!==0||1/h===1/f)||h!==h&&f!==f}var r=typeof Object.is=="function"?Object.is:n,a=e.useSyncExternalStore,i=t.useRef,o=t.useEffect,c=t.useMemo,u=t.useDebugValue;return hx.useSyncExternalStoreWithSelector=function(h,f,m,g,b){var N=i(null);if(N.current===null){var j={hasValue:!1,value:null};N.current=j}else j=N.current;N=c(function(){function k(U){if(!T){if(T=!0,C=U,U=g(U),b!==void 0&&j.hasValue){var _=j.value;if(b(_,U))return P=_}return P=U}if(_=P,r(C,U))return _;var H=g(U);return b!==void 0&&b(_,H)?(C=U,_):(C=U,P=H)}var T=!1,C,P,L=m===void 0?null:m;return[function(){return k(f())},L===null?void 0:function(){return k(L())}]},[f,m,g,b]);var v=a(h,N[0],N[1]);return o(function(){j.hasValue=!0,j.value=v},[v]),u(v),v},hx}var bw;function g7(){return bw||(bw=1,ux.exports=m7()),ux.exports}var x7=g7(),y7=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},b7=({contentComponent:t})=>{const e=P2.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return s.jsx(s.Fragment,{children:Object.values(e)})};function v7(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:Ej.createPortal(r.reactElement,r.element,n)},t.forEach(a=>a())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(a=>a())}}}var N7=class extends Vs.Component{constructor(t){var e;super(t),this.editorContentRef=Vs.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=v7(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:y7(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&s.jsx(b7,{contentComponent:t.contentComponent})]})}},w7=y.forwardRef((t,e)=>{const n=Vs.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Vs.createElement(N7,{key:n,innerRef:e,...t})}),HC=Vs.memo(w7),j7=typeof window<"u"?y.useLayoutEffect:y.useEffect,k7=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function S7(t){var e;const[n]=y.useState(()=>new k7(t.editor)),r=x7.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:p7);return j7(()=>n.watch(t.editor),[t.editor,n]),y.useDebugValue(r),r}var C7=!1,h0=typeof window>"u",E7=h0||!!(typeof window<"u"&&window.next),T7=class UC{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?h0||E7?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var a,i;return(i=(a=this.options.current).onBeforeCreate)==null?void 0:i.call(a,...r)},onBlur:(...r)=>{var a,i;return(i=(a=this.options.current).onBlur)==null?void 0:i.call(a,...r)},onCreate:(...r)=>{var a,i;return(i=(a=this.options.current).onCreate)==null?void 0:i.call(a,...r)},onDestroy:(...r)=>{var a,i;return(i=(a=this.options.current).onDestroy)==null?void 0:i.call(a,...r)},onFocus:(...r)=>{var a,i;return(i=(a=this.options.current).onFocus)==null?void 0:i.call(a,...r)},onSelectionUpdate:(...r)=>{var a,i;return(i=(a=this.options.current).onSelectionUpdate)==null?void 0:i.call(a,...r)},onTransaction:(...r)=>{var a,i;return(i=(a=this.options.current).onTransaction)==null?void 0:i.call(a,...r)},onUpdate:(...r)=>{var a,i;return(i=(a=this.options.current).onUpdate)==null?void 0:i.call(a,...r)},onContentError:(...r)=>{var a,i;return(i=(a=this.options.current).onContentError)==null?void 0:i.call(a,...r)},onDrop:(...r)=>{var a,i;return(i=(a=this.options.current).onDrop)==null?void 0:i.call(a,...r)},onPaste:(...r)=>{var a,i;return(i=(a=this.options.current).onPaste)==null?void 0:i.call(a,...r)},onDelete:(...r)=>{var a,i;return(i=(a=this.options.current).onDelete)==null?void 0:i.call(a,...r)}};return new b_(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((a,i)=>{var o;return a===((o=n.extensions)==null?void 0:o[i])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?UC.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,a)=>r===e[a]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function M7(t={},e=[]){const n=y.useRef(t);n.current=t;const[r]=y.useState(()=>new T7(n)),a=P2.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return y.useDebugValue(a),y.useEffect(r.onRender(e)),S7({editor:a,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),a}var WC=y.createContext({editor:null});WC.Consumer;var A7=y.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),I7=()=>y.useContext(A7);Vs.forwardRef((t,e)=>{const{onDragStart:n}=I7(),r=t.as||"div";return s.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});Vs.createContext({markViewContentRef:()=>{}});var Dy=y.createContext({get editor(){throw new Error("useTiptap must be used within a provider")}});Dy.displayName="TiptapContext";var P7=()=>y.useContext(Dy);function KC({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const a=y.useMemo(()=>({editor:r}),[r]),i=y.useMemo(()=>({editor:r}),[r]);return s.jsx(WC.Provider,{value:i,children:s.jsx(Dy.Provider,{value:a,children:n})})}KC.displayName="Tiptap";function qC({...t}){const{editor:e}=P7();return s.jsx(HC,{editor:e,...t})}qC.displayName="Tiptap.Content";Object.assign(KC,{Content:qC});var Hf=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},R7=/^\s*>\s$/,L7=Fn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Hf("blockquote",{...qt(this.options.HTMLAttributes,t),children:Hf("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach(a=>{const c=e.renderChildren([a]).split(` +`).map(u=>u.trim()===""?n:`${n} ${u}`);r.push(c.join(` +`))}),r.join(` +${n} +`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Xc({find:R7,type:this.type})]}}),O7=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,D7=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,_7=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,$7=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,z7=Ql.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return Hf("strong",{...qt(this.options.HTMLAttributes,t),children:Hf("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Yc({find:O7,type:this.type}),Yc({find:_7,type:this.type})]},addPasteRules(){return[Hl({find:D7,type:this.type}),Hl({find:$7,type:this.type})]}}),F7=/(^|[^`])`([^`]+)`(?!`)$/,B7=/(^|[^`])`([^`]+)`(?!`)/g,V7=Ql.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",qt(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Yc({find:F7,type:this.type})]},addPasteRules(){return[Hl({find:B7,type:this.type})]}}),fx=4,H7=/^```([a-z]+)?[\s\n]$/,U7=/^~~~([a-z]+)?[\s\n]$/,W7=Fn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:fx,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const i=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",qt(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&((r=t.raw)==null?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const a=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${a}`,e.renderChildren(t.content),"```"].join(` +`):r=`\`\`\`${a} + +\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:fx,{state:r}=t,{selection:a}=r,{$from:i,empty:o}=a;if(i.parent.type!==this.type)return!1;const c=" ".repeat(n);return o?t.commands.insertContent(c):t.commands.command(({tr:u})=>{const{from:h,to:f}=a,b=r.doc.textBetween(h,f,` +`,` +`).split(` +`).map(N=>c+N).join(` +`);return u.replaceWith(h,f,r.schema.text(b)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:fx,{state:r}=t,{selection:a}=r,{$from:i,empty:o}=a;return i.parent.type!==this.type?!1:o?t.commands.command(({tr:c})=>{var u;const{pos:h}=i,f=i.start(),m=i.end(),b=r.doc.textBetween(f,m,` +`,` +`).split(` +`);let N=0,j=0;const v=h-f;for(let U=0;U=v){N=U;break}j+=b[U].length+1}const T=((u=b[N].match(/^ */))==null?void 0:u[0])||"",C=Math.min(T.length,n);if(C===0)return!0;let P=f;for(let U=0;U{const{from:u,to:h}=a,g=r.doc.textBetween(u,h,` +`,` +`).split(` +`).map(b=>{var N;const j=((N=b.match(/^ */))==null?void 0:N[0])||"",v=Math.min(j.length,n);return b.slice(v)}).join(` +`);return c.replaceWith(u,h,r.schema.text(g)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:a}=n;if(!a||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(` + +`);return!i||!o?!1:t.chain().command(({tr:c})=>(c.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:a,empty:i}=n;if(!i||a.parent.type!==this.type||!(a.parentOffset===a.parent.nodeSize-2))return!1;const c=a.after();return c===void 0?!1:r.nodeAt(c)?t.commands.command(({tr:h})=>(h.setSelection(ft.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[d0({find:H7,type:this.type,getAttributes:t=>({language:t[1]})}),d0({find:U7,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new dn({key:new vn("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),a=r?JSON.parse(r):void 0,i=a==null?void 0:a.mode;if(!n||!i)return!1;const{tr:o,schema:c}=t.state,u=c.text(n.replace(/\r\n?/g,` +`));return o.replaceSelectionWith(this.type.create({language:i},u)),o.selection.$from.parent.type!==this.type&&o.setSelection(ot.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),K7=Fn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` + +`):""}),q7=Fn.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",qt(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()}}}),G7=Fn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,qt(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=>d0({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),J7=Fn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",qt(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!w_(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,a=t();return wC(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(ot.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(it.create(o.doc,u.pos)):o.setSelection(ot.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(ot.create(o.doc,h+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[zC({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Q7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Y7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,X7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Z7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,e$=Ql.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",qt(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[Yc({find:Q7,type:this.type}),Yc({find:X7,type:this.type})]},addPasteRules(){return[Hl({find:Y7,type:this.type}),Hl({find:Z7,type:this.type})]}});const t$="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",n$="ελ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",f0="numeric",p0="ascii",m0="alpha",cu="asciinumeric",Zd="alphanumeric",g0="domain",GC="emoji",s$="scheme",r$="slashscheme",px="whitespace";function a$(t,e){return t in e||(e[t]=[]),e[t]}function kl(t,e,n){e[f0]&&(e[cu]=!0,e[Zd]=!0),e[p0]&&(e[cu]=!0,e[m0]=!0),e[cu]&&(e[Zd]=!0),e[m0]&&(e[Zd]=!0),e[Zd]&&(e[g0]=!0),e[GC]&&(e[g0]=!0);for(const r in e){const a=a$(r,n);a.indexOf(t)<0&&a.push(t)}}function i$(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function lr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}lr.groups={};lr.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),vw=(t,e,n,r,a)=>t.ts(e,n,r,a),Re=(t,e,n,r,a)=>t.tt(e,n,r,a),bi="WORD",x0="UWORD",JC="ASCIINUMERICAL",QC="ALPHANUMERICAL",Eu="LOCALHOST",y0="TLD",b0="UTLD",pf="SCHEME",Ic="SLASH_SCHEME",_y="NUM",v0="WS",$y="NL",du="OPENBRACE",uu="CLOSEBRACE",Uf="OPENBRACKET",Wf="CLOSEBRACKET",Kf="OPENPAREN",qf="CLOSEPAREN",Gf="OPENANGLEBRACKET",Jf="CLOSEANGLEBRACKET",Qf="FULLWIDTHLEFTPAREN",Yf="FULLWIDTHRIGHTPAREN",Xf="LEFTCORNERBRACKET",Zf="RIGHTCORNERBRACKET",ep="LEFTWHITECORNERBRACKET",tp="RIGHTWHITECORNERBRACKET",np="FULLWIDTHLESSTHAN",sp="FULLWIDTHGREATERTHAN",rp="AMPERSAND",ap="APOSTROPHE",ip="ASTERISK",ho="AT",op="BACKSLASH",lp="BACKTICK",cp="CARET",mo="COLON",zy="COMMA",dp="DOLLAR",Oa="DOT",up="EQUALS",Fy="EXCLAMATION",Hr="HYPHEN",hu="PERCENT",hp="PIPE",fp="PLUS",pp="POUND",fu="QUERY",By="QUOTE",YC="FULLWIDTHMIDDLEDOT",Vy="SEMI",Da="SLASH",pu="TILDE",mp="UNDERSCORE",XC="EMOJI",gp="SYM";var ZC=Object.freeze({__proto__:null,ALPHANUMERICAL:QC,AMPERSAND:rp,APOSTROPHE:ap,ASCIINUMERICAL:JC,ASTERISK:ip,AT:ho,BACKSLASH:op,BACKTICK:lp,CARET:cp,CLOSEANGLEBRACKET:Jf,CLOSEBRACE:uu,CLOSEBRACKET:Wf,CLOSEPAREN:qf,COLON:mo,COMMA:zy,DOLLAR:dp,DOT:Oa,EMOJI:XC,EQUALS:up,EXCLAMATION:Fy,FULLWIDTHGREATERTHAN:sp,FULLWIDTHLEFTPAREN:Qf,FULLWIDTHLESSTHAN:np,FULLWIDTHMIDDLEDOT:YC,FULLWIDTHRIGHTPAREN:Yf,HYPHEN:Hr,LEFTCORNERBRACKET:Xf,LEFTWHITECORNERBRACKET:ep,LOCALHOST:Eu,NL:$y,NUM:_y,OPENANGLEBRACKET:Gf,OPENBRACE:du,OPENBRACKET:Uf,OPENPAREN:Kf,PERCENT:hu,PIPE:hp,PLUS:fp,POUND:pp,QUERY:fu,QUOTE:By,RIGHTCORNERBRACKET:Zf,RIGHTWHITECORNERBRACKET:tp,SCHEME:pf,SEMI:Vy,SLASH:Da,SLASH_SCHEME:Ic,SYM:gp,TILDE:pu,TLD:y0,UNDERSCORE:mp,UTLD:b0,UWORD:x0,WORD:bi,WS:v0});const xi=/[a-z]/,Gd=new RegExp("\\p{L}","u"),mx=new RegExp("\\p{Emoji}","u"),yi=/\d/,gx=/\s/,Nw="\r",xx=` +`,o$="️",l$="‍",yx="";let Zh=null,ef=null;function c$(t=[]){const e={};lr.groups=e;const n=new lr;Zh==null&&(Zh=ww(t$)),ef==null&&(ef=ww(n$)),Re(n,"'",ap),Re(n,"{",du),Re(n,"}",uu),Re(n,"[",Uf),Re(n,"]",Wf),Re(n,"(",Kf),Re(n,")",qf),Re(n,"<",Gf),Re(n,">",Jf),Re(n,"(",Qf),Re(n,")",Yf),Re(n,"「",Xf),Re(n,"」",Zf),Re(n,"『",ep),Re(n,"』",tp),Re(n,"<",np),Re(n,">",sp),Re(n,"&",rp),Re(n,"*",ip),Re(n,"@",ho),Re(n,"`",lp),Re(n,"^",cp),Re(n,":",mo),Re(n,",",zy),Re(n,"$",dp),Re(n,".",Oa),Re(n,"=",up),Re(n,"!",Fy),Re(n,"-",Hr),Re(n,"%",hu),Re(n,"|",hp),Re(n,"+",fp),Re(n,"#",pp),Re(n,"?",fu),Re(n,'"',By),Re(n,"/",Da),Re(n,";",Vy),Re(n,"~",pu),Re(n,"_",mp),Re(n,"\\",op),Re(n,"・",YC);const r=An(n,yi,_y,{[f0]:!0});An(r,yi,r);const a=An(r,xi,JC,{[cu]:!0}),i=An(r,Gd,QC,{[Zd]:!0}),o=An(n,xi,bi,{[p0]:!0});An(o,yi,a),An(o,xi,o),An(a,yi,a),An(a,xi,a);const c=An(n,Gd,x0,{[m0]:!0});An(c,xi),An(c,yi,i),An(c,Gd,c),An(i,yi,i),An(i,xi),An(i,Gd,i);const u=Re(n,xx,$y,{[px]:!0}),h=Re(n,Nw,v0,{[px]:!0}),f=An(n,gx,v0,{[px]:!0});Re(n,yx,f),Re(h,xx,u),Re(h,yx,f),An(h,gx,f),Re(f,Nw),Re(f,xx),An(f,gx,f),Re(f,yx,f);const m=An(n,mx,XC,{[GC]:!0});Re(m,"#"),An(m,mx,m),Re(m,o$,m);const g=Re(m,l$);Re(g,"#"),An(g,mx,m);const b=[[xi,o],[yi,a]],N=[[xi,null],[Gd,c],[yi,i]];for(let j=0;jj[0]>v[0]?1:-1);for(let j=0;j=0?T[g0]=!0:xi.test(v)?yi.test(v)?T[cu]=!0:T[p0]=!0:T[f0]=!0,vw(n,v,v,T)}return vw(n,"localhost",Eu,{ascii:!0}),n.jd=new lr(gp),{start:n,tokens:Object.assign({groups:e},ZC)}}function e3(t,e){const n=d$(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 d$(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 io(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 Tu={defaultProtocol:"http",events:null,format:jw,formatHref:jw,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Hy(t,e=null){let n=Object.assign({},Tu);t&&(n=Object.assign(n,t instanceof Hy?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=Tu.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 qp(t,e){class n extends t3{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 kw=qp("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Sw=qp("text"),u$=qp("nl"),tf=qp("url",{isLink:!0,toHref(t=Tu.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Eu&&t[1].t===mo}}),Vr=t=>new lr(t);function h$({groups:t}){const e=t.domain.concat([rp,ip,ho,op,lp,cp,dp,up,Hr,_y,hu,hp,fp,pp,Da,gp,pu,mp]),n=[ap,mo,zy,Oa,Fy,hu,fu,By,Vy,Gf,Jf,du,uu,Wf,Uf,Kf,qf,Qf,Yf,Xf,Zf,ep,tp,np,sp],r=[rp,ap,ip,op,lp,cp,dp,up,Hr,du,uu,hu,hp,fp,pp,fu,Da,gp,pu,mp],a=Vr(),i=Re(a,pu);Et(i,r,i),Et(i,t.domain,i);const o=Vr(),c=Vr(),u=Vr();Et(a,t.domain,o),Et(a,t.scheme,c),Et(a,t.slashscheme,u),Et(o,r,i),Et(o,t.domain,o);const h=Re(o,ho);Re(i,ho,h),Re(c,ho,h),Re(u,ho,h);const f=Re(i,Oa);Et(f,r,i),Et(f,t.domain,i);const m=Vr();Et(h,t.domain,m),Et(m,t.domain,m);const g=Re(m,Oa);Et(g,t.domain,m);const b=Vr(kw);Et(g,t.tld,b),Et(g,t.utld,b),Re(h,Eu,b);const N=Re(m,Hr);Re(N,Hr,N),Et(N,t.domain,m),Et(b,t.domain,m),Re(b,Oa,g),Re(b,Hr,N);const j=Re(b,mo);Et(j,t.numeric,kw);const v=Re(o,Hr),k=Re(o,Oa);Re(v,Hr,v),Et(v,t.domain,o),Et(k,r,i),Et(k,t.domain,o);const T=Vr(tf);Et(k,t.tld,T),Et(k,t.utld,T),Et(T,t.domain,o),Et(T,r,i),Re(T,Oa,k),Re(T,Hr,v),Re(T,ho,h);const C=Re(T,mo),P=Vr(tf);Et(C,t.numeric,P);const L=Vr(tf),U=Vr();Et(L,e,L),Et(L,n,U),Et(U,e,L),Et(U,n,U),Re(T,Da,L),Re(P,Da,L);const _=Re(c,mo),H=Re(u,mo),R=Re(H,Da),Z=Re(R,Da);Et(c,t.domain,o),Re(c,Oa,k),Re(c,Hr,v),Et(u,t.domain,o),Re(u,Oa,k),Re(u,Hr,v),Et(_,t.domain,L),Re(_,Da,L),Re(_,fu,L),Et(Z,t.domain,L),Et(Z,e,L),Re(Z,Da,L);const re=[[du,uu],[Uf,Wf],[Kf,qf],[Gf,Jf],[Qf,Yf],[Xf,Zf],[ep,tp],[np,sp]];for(let $=0;$=0&&g++,a++,f++;if(g<0)a-=f,a0&&(i.push(bx(Sw,e,o)),o=[]),a-=g,f-=g;const b=m.t,N=n.slice(a-f,a);i.push(bx(b,e,N))}}return o.length>0&&i.push(bx(Sw,e,o)),i}function bx(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 p$=typeof console<"u"&&console&&console.warn||(()=>{}),m$="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",mn={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function g$(){return lr.groups={},mn.scanner=null,mn.parser=null,mn.tokenQueue=[],mn.pluginQueue=[],mn.customSchemes=[],mn.initialized=!1,mn}function Cw(t,e=!1){if(mn.initialized&&p$(`linkifyjs: already initialized - will not register custom scheme "${t}" ${m$}`),!/^[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`);mn.customSchemes.push([t,e])}function x$(){mn.scanner=c$(mn.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=fC(n.doc,[...e]);if(NC(c).forEach(({newRange:h})=>{const f=ND(r.doc,h,b=>b.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 b=r.doc.textBetween(h.from,h.to," "," ");if(!b$.test(b))return;m=f[0],g=r.doc.textBetween(m.pos,h.to,void 0," ")}if(m&&g){const b=g.split(y$).filter(Boolean);if(b.length<=0)return!1;const N=b[b.length-1],j=m.pos+g.lastIndexOf(N);if(!N)return!1;const v=Uy(N).map(k=>k.toObject(t.defaultProtocol));if(!N$(v))return!1;v.filter(k=>k.isLink).map(k=>({...k,from:j+k.start+1,to:j+k.end+1})).filter(k=>r.schema.marks.code?!r.doc.rangeHasMark(k.from,k.to,r.schema.marks.code):!0).filter(k=>t.validate(k.value)).filter(k=>t.shouldAutoLink(k.value)).forEach(k=>{Iy(k.from,k.to,r.doc).some(T=>T.mark.type===t.type)||o.addMark(k.from,k.to,t.type.create({href:k.href}))})}}),!!o.steps.length)return o}})}function j$(t){return new dn({key:new vn("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=vC(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 k$(t){return new dn({key:new vn("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=n3(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 gl(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(v$,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var S$=Ql.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"){Cw(t);return}Cw(t.scheme,t.optionalSlashes)})},onDestroy(){g$()},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)=>!!gl(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=>!!gl(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=>!!gl(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",qt(this.options.HTMLAttributes,t),0]:["a",qt(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=>!!gl(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=>!!gl(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[Hl({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,a=n3(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!gl(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(w$({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:a=>!!gl(a,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(j$({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(k$({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),C$=Object.defineProperty,E$=(t,e)=>{for(var n in e)C$(t,n,{get:e[n],enumerable:!0})},T$="listItem",Ew="textStyle",Tw=/^\s*([-+*])\s$/,s3=Fn.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",qt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` +`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(T$,this.editor.getAttributes(Ew)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Xc({find:Tw,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Xc({find:Tw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Ew),editor:this.editor})),[t]}}),r3=Fn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",qt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(a=>a.type==="paragraph"))n=e.parseChildren(t.tokens);else{const a=t.tokens[0];if(a&&a.type==="text"&&a.tokens&&a.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(a.tokens)}],t.tokens.length>1){const o=t.tokens.slice(1),c=e.parseChildren(o);n.push(...c)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>Oy(t,e,r=>{var a,i;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((i=(a=r.meta)==null?void 0:a.parentAttrs)==null?void 0:i.start)||1)+r.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),M$={};E$(M$,{findListItemPos:()=>$u,getNextListDepth:()=>Ky,handleBackspace:()=>N0,handleDelete:()=>w0,hasListBefore:()=>a3,hasListItemAfter:()=>A$,hasListItemBefore:()=>i3,listItemHasSubList:()=>o3,nextListIsDeeper:()=>l3,nextListIsHigher:()=>c3});var $u=(t,e)=>{const{$from:n}=e.selection,r=Kn(t,e.schema);let a=null,i=n.depth,o=n.pos,c=null;for(;i>0&&c===null;)a=n.node(i),a.type===r?c=i:(i-=1,o-=1);return c===null?null:{$pos:e.doc.resolve(o),depth:c}},Ky=(t,e)=>{const n=$u(t,e);if(!n)return!1;const[,r]=ID(e,t,n.$pos.pos+4);return r},a3=(t,e,n)=>{const{$anchor:r}=t.selection,a=Math.max(0,r.pos-2),i=t.doc.resolve(a).node();return!(!i||!n.includes(i.type.name))},i3=(t,e)=>{var n;const{$anchor:r}=e.selection,a=e.doc.resolve(r.pos-2);return!(a.index()===0||((n=a.nodeBefore)==null?void 0:n.type.name)!==t)},o3=(t,e,n)=>{if(!n)return!1;const r=Kn(t,e.schema);let a=!1;return n.descendants(i=>{i.type===r&&(a=!0)}),a},N0=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Po(t.state,e)&&a3(t.state,e,n)){const{$anchor:c}=t.state.selection,u=t.state.doc.resolve(c.before()-1),h=[];u.node().descendants((g,b)=>{g.type.name===e&&h.push({node:g,pos:b})});const f=h.at(-1);if(!f)return!1;const m=t.state.doc.resolve(u.start()+f.pos+1);return t.chain().cut({from:c.start()-1,to:c.end()+1},m.end()).joinForward().run()}if(!Po(t.state,e)||!OD(t.state))return!1;const r=$u(e,t.state);if(!r)return!1;const i=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=o3(e,t.state,i);return i3(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},l3=(t,e)=>{const n=Ky(t,e),r=$u(t,e);return!r||!n?!1:n>r.depth},c3=(t,e)=>{const n=Ky(t,e),r=$u(t,e);return!r||!n?!1:n{if(!Po(t.state,e)||!LD(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:a}=n;return!n.empty&&r.sameParent(a)?!1:l3(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():c3(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},A$=(t,e)=>{var n;const{$anchor:r}=e.selection,a=e.doc.resolve(r.pos-r.parentOffset-2);return!(a.index()===a.parent.childCount-1||((n=a.nodeAfter)==null?void 0:n.type.name)!==t)},d3=Ln.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&w0(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&w0(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&N0(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&N0(t,n,r)&&(e=!0)}),e}}}}),Mw=/^(\s*)(\d+)\.\s+(.*)$/,I$=/^\s/;function P$(t){const e=[];let n=0,r=0;for(;ne;)g.push(t[m]),m+=1;if(g.length>0){const b=Math.min(...g.map(j=>j.indent)),N=u3(g,b,n);h.push({type:"list",ordered:!0,start:g[0].number,items:N,raw:g.map(j=>j.raw).join(` +`)})}a.push({type:"list_item",raw:o.raw,tokens:h}),i=m}else i+=1}return a}function R$(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(a=>{if(a.type==="paragraph"||a.type==="list"||a.type==="blockquote"||a.type==="code")r.push(...e.parseChildren([a]));else if(a.type==="text"&&a.tokens){const i=e.parseChildren([a]);r.push({type:"paragraph",content:i})}else{const i=e.parseChildren([a]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var L$="listItem",Aw="textStyle",Iw=/^(\d+)\.\s$/,h3=Fn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",qt(this.options.HTMLAttributes,n),0]:["ol",qt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?R$(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` +`):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e==null?void 0:e.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const a=t.split(` +`),[i,o]=P$(a);if(i.length===0)return;const c=u3(i,0,n);return c.length===0?void 0:{type:"list",ordered:!0,start:((r=i[0])==null?void 0:r.number)||1,items:c,raw:a.slice(0,o).join(` +`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(L$,this.editor.getAttributes(Aw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Xc({find:Iw,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Xc({find:Iw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Aw)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),O$=/^\s*(\[([( |x])?\])\s$/,D$=Fn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",qt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const a=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return Oy(t,e,a)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const a=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),c=document.createElement("input"),u=document.createElement("div"),h=m=>{var g,b;c.ariaLabel=((b=(g=this.options.a11y)==null?void 0:g.checkboxLabel)==null?void 0:b.call(g,m,c.checked))||`Task item checkbox for ${m.textContent||"empty task item"}`};h(t),i.contentEditable="false",c.type="checkbox",c.addEventListener("mousedown",m=>m.preventDefault()),c.addEventListener("change",m=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){c.checked=!c.checked;return}const{checked:g}=m.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:b})=>{const N=n();if(typeof N!="number")return!1;const j=b.doc.nodeAt(N);return b.setNodeMarkup(N,void 0,{...j==null?void 0:j.attrs,checked:g}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,g)||(c.checked=!c.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([m,g])=>{a.setAttribute(m,g)}),a.dataset.checked=t.attrs.checked,c.checked=t.attrs.checked,i.append(c,o),a.append(i,u),Object.entries(e).forEach(([m,g])=>{a.setAttribute(m,g)});let f=new Set(Object.keys(e));return{dom:a,contentDOM:u,update:m=>{if(m.type!==this.type)return!1;a.dataset.checked=m.attrs.checked,c.checked=m.attrs.checked,h(m);const g=r.extensionManager.attributes,b=Cu(m,g),N=new Set(Object.keys(b)),j=this.options.HTMLAttributes;return f.forEach(v=>{N.has(v)||(v in j?a.setAttribute(v,j[v]):a.removeAttribute(v))}),Object.entries(b).forEach(([v,k])=>{k==null?v in j?a.setAttribute(v,j[v]):a.removeAttribute(v):a.setAttribute(v,k)}),f=N,!0}}}},addInputRules(){return[Xc({find:O$,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),_$=Fn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",qt(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` +`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=i=>{const o=u0(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:c=>({indentLevel:c[1].length,mainContent:c[4],checked:c[3].toLowerCase()==="x"}),createToken:(c,u)=>({type:"taskItem",raw:"",mainContent:c.mainContent,indentLevel:c.indentLevel,checked:c.checked,text:c.mainContent,tokens:n.inlineTokens(c.mainContent),nestedTokens:u}),customNestedParser:r},n);return o?[{type:"taskList",raw:o.raw,items:o.items}]:n.blockTokens(i)},a=u0(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},n);if(a)return{type:"taskList",raw:a.raw,items:a.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Ln.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(s3.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(r3.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(d3.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(h3.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(D$.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(_$.configure(this.options.taskList)),t}});var Pw=" ",$$=" ",z$=Fn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",qt(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return r.length===1&&r[0].type==="text"&&(r[0].text===Pw||r[0].text===$$)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e)=>{if(!t)return"";const n=Array.isArray(t.content)?t.content:[];return n.length===0?Pw:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),F$=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,B$=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,V$=Ql.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",qt(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Yc({find:F$,type:this.type})]},addPasteRules(){return[Hl({find:B$,type:this.type})]}}),H$=Fn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),U$=Ql.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",qt(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const a=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!a)return;const i=a[2].trim();return{type:"underline",raw:a[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function W$(t={}){return new dn({view(e){return new K$(e,t)}})}class K${constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(a=>{let i=o=>{this[a](o)};return e.dom.addEventListener(a,i),{name:a,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,a=this.editorView.dom,i=a.getBoundingClientRect(),o=i.width/a.offsetWidth,c=i.height/a.offsetHeight;if(n){let m=e.nodeBefore,g=e.nodeAfter;if(m||g){let b=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(b){let N=b.getBoundingClientRect(),j=m?N.bottom:N.top;m&&g&&(j=(j+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let v=this.width/2*c;r={left:N.left,right:N.right,top:j-v,bottom:j+v}}}}if(!r){let m=this.editorView.coordsAtPos(this.cursorPos),g=this.width/2*o;r={left:m.left-g,right:m.left+g,top:m.top,bottom:m.bottom}}let u=this.editorView.dom.offsetParent;this.element||(this.element=u.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let h,f;if(!u||u==document.body&&getComputedStyle(u).position=="static")h=-pageXOffset,f=-pageYOffset;else{let m=u.getBoundingClientRect(),g=m.width/u.offsetWidth,b=m.height/u.offsetHeight;h=m.left-u.scrollLeft*g,f=m.top-u.scrollTop*b}this.element.style.left=(r.left-h)/o+"px",this.element.style.top=(r.top-f)/c+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/c+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),a=r&&r.type.spec.disableDropCursor,i=typeof a=="function"?a(this.editorView,n,e):a;if(n&&!i){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=aS(this.editorView.state.doc,o,this.editorView.dragging.slice);c!=null&&(o=c)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Pn extends ft{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Pn.valid(r)?new Pn(r):ft.near(r)}content(){return Fe.empty}eq(e){return e instanceof Pn&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Pn(e.resolve(n.pos))}getBookmark(){return new qy(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!q$(e)||!G$(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let a=n.contentMatchAt(e.index()).defaultType;return a&&a.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Pn.valid(e))return e;let a=e.pos,i=null;for(let o=e.depth;;o--){let c=e.node(o);if(n>0?e.indexAfter(o)0){i=c.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;a+=n;let u=e.doc.resolve(a);if(Pn.valid(u))return u}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!it.isSelectable(i)){e=e.doc.resolve(a+i.nodeSize*n),r=!1;continue e}break}i=o,a+=n;let c=e.doc.resolve(a);if(Pn.valid(c))return c}return null}}}Pn.prototype.visible=!1;Pn.findFrom=Pn.findGapCursorFrom;ft.jsonID("gapcursor",Pn);class qy{constructor(e){this.pos=e}map(e){return new qy(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Pn.valid(n)?new Pn(n):ft.near(n)}}function f3(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function q$(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let a=r.child(n-1);;a=a.lastChild){if(a.childCount==0&&!a.inlineContent||f3(a.type))return!0;if(a.inlineContent)return!1}}return!0}function G$(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let a=r.child(n);;a=a.firstChild){if(a.childCount==0&&!a.inlineContent||f3(a.type))return!0;if(a.inlineContent)return!1}}return!0}function J$(){return new dn({props:{decorations:Z$,createSelectionBetween(t,e,n){return e.pos==n.pos&&Pn.valid(n)?new Pn(n):null},handleClick:Y$,handleKeyDown:Q$,handleDOMEvents:{beforeinput:X$}}})}const Q$=Sy({ArrowLeft:nf("horiz",-1),ArrowRight:nf("horiz",1),ArrowUp:nf("vert",-1),ArrowDown:nf("vert",1)});function nf(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,a,i){let o=r.selection,c=e>0?o.$to:o.$from,u=o.empty;if(o instanceof ot){if(!i.endOfTextblock(n)||c.depth==0)return!1;u=!1,c=r.doc.resolve(e>0?c.after():c.before())}let h=Pn.findGapCursorFrom(c,e,u);return h?(a&&a(r.tr.setSelection(new Pn(h))),!0):!1}}function Y$(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Pn.valid(r))return!1;let a=t.posAtCoords({left:n.clientX,top:n.clientY});return a&&a.inside>-1&&it.isSelectable(t.state.doc.nodeAt(a.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Pn(r))),!0)}function X$(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Pn))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let a=Ce.empty;for(let o=r.length-1;o>=0;o--)a=Ce.from(r[o].createAndFill(null,a));let i=t.state.tr.replace(n.pos,n.pos,new Fe(a,0,0));return i.setSelection(ot.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function Z$(t){if(!(t.selection instanceof Pn))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",rn.create(t.doc,[Xn.widget(t.selection.head,e,{key:"gapcursor"})])}var xp=200,us=function(){};us.prototype.append=function(e){return e.length?(e=us.from(e),!this.length&&e||e.length=n?us.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};us.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};us.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};us.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var a=[];return this.forEach(function(i,o){return a.push(e(i,o))},n,r),a};us.from=function(e){return e instanceof us?e:e&&e.length?new p3(e):us.empty};var p3=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(a,i){return a==0&&i==this.length?this:new e(this.values.slice(a,i))},e.prototype.getInner=function(a){return this.values[a]},e.prototype.forEachInner=function(a,i,o,c){for(var u=i;u=o;u--)if(a(this.values[u],c+u)===!1)return!1},e.prototype.leafAppend=function(a){if(this.length+a.length<=xp)return new e(this.values.concat(a.flatten()))},e.prototype.leafPrepend=function(a){if(this.length+a.length<=xp)return new e(a.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(us);us.empty=new p3([]);var ez=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return rc&&this.right.forEachInner(r,Math.max(a-c,0),Math.min(this.length,i)-c,o+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,a,i,o){var c=this.left.length;if(a>c&&this.right.forEachInvertedInner(r,a-c,Math.max(i,c)-c,o+c)===!1||i=i?this.right.slice(r-i,a-i):this.left.slice(r,i).append(this.right.slice(0,a-i))},e.prototype.leafAppend=function(r){var a=this.right.leafAppend(r);if(a)return new e(this.left,a)},e.prototype.leafPrepend=function(r){var a=this.left.leafPrepend(r);if(a)return new e(a,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(us);const tz=500;class ha{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let a,i;n&&(a=this.remapping(r,this.items.length),i=a.maps.length);let o=e.tr,c,u,h=[],f=[];return this.items.forEach((m,g)=>{if(!m.step){a||(a=this.remapping(r,g+1),i=a.maps.length),i--,f.push(m);return}if(a){f.push(new oo(m.map));let b=m.step.map(a.slice(i)),N;b&&o.maybeStep(b).doc&&(N=o.mapping.maps[o.mapping.maps.length-1],h.push(new oo(N,void 0,void 0,h.length+f.length))),i--,N&&a.appendMap(N,i)}else o.maybeStep(m.step);if(m.selection)return c=a?m.selection.map(a.slice(i)):m.selection,u=new ha(this.items.slice(0,r).append(f.reverse().concat(h)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:o,selection:c}}addTransform(e,n,r,a){let i=[],o=this.eventCount,c=this.items,u=!a&&c.length?c.get(c.length-1):null;for(let f=0;fsz&&(c=nz(c,h),o-=h),new ha(c.append(i),o)}remapping(e,n){let r=new vu;return this.items.forEach((a,i)=>{let o=a.mirrorOffset!=null&&i-a.mirrorOffset>=e?r.maps.length-a.mirrorOffset:void 0;r.appendMap(a.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new ha(this.items.append(e.map(n=>new oo(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],a=Math.max(0,this.items.length-n),i=e.mapping,o=e.steps.length,c=this.eventCount;this.items.forEach(g=>{g.selection&&c--},a);let u=n;this.items.forEach(g=>{let b=i.getMirror(--u);if(b==null)return;o=Math.min(o,b);let N=i.maps[b];if(g.step){let j=e.steps[b].invert(e.docs[b]),v=g.selection&&g.selection.map(i.slice(u+1,b));v&&c++,r.push(new oo(N,j,v))}else r.push(new oo(N))},a);let h=[];for(let g=n;gtz&&(m=m.compress(this.items.length-r.length)),m}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,a=[],i=0;return this.items.forEach((o,c)=>{if(c>=e)a.push(o),o.selection&&i++;else if(o.step){let u=o.step.map(n.slice(r)),h=u&&u.getMap();if(r--,h&&n.appendMap(h,r),u){let f=o.selection&&o.selection.map(n.slice(r));f&&i++;let m=new oo(h.invert(),u,f),g,b=a.length-1;(g=a.length&&a[b].merge(m))?a[b]=g:a.push(m)}}else o.map&&r--},this.items.length,0),new ha(us.from(a.reverse()),i)}}ha.empty=new ha(us.empty,0);function nz(t,e){let n;return t.forEach((r,a)=>{if(r.selection&&e--==0)return n=a,!1}),t.slice(n)}let oo=class m3{constructor(e,n,r,a){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=a}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new m3(n.getMap().invert(),n,this.selection)}}};class fo{constructor(e,n,r,a,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=a,this.prevComposition=i}}const sz=20;function rz(t,e,n,r){let a=n.getMeta(Ml),i;if(a)return a.historyState;n.getMeta(oz)&&(t=new fo(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(Ml))return o.getMeta(Ml).redo?new fo(t.done.addTransform(n,void 0,r,mf(e)),t.undone,Rw(n.mapping.maps),t.prevTime,t.prevComposition):new fo(t.done,t.undone.addTransform(n,void 0,r,mf(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let c=n.getMeta("composition"),u=t.prevTime==0||!o&&t.prevComposition!=c&&(t.prevTime<(n.time||0)-r.newGroupDelay||!az(n,t.prevRanges)),h=o?vx(t.prevRanges,n.mapping):Rw(n.mapping.maps);return new fo(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,mf(e)),ha.empty,h,n.time,c??t.prevComposition)}else return(i=n.getMeta("rebased"))?new fo(t.done.rebased(n,i),t.undone.rebased(n,i),vx(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new fo(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),vx(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function az(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,a)=>{for(let i=0;i=e[i]&&(n=!0)}),n}function Rw(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,a,i,o)=>e.push(i,o));return e}function vx(t,e){if(!t)return null;let n=[];for(let r=0;r{let a=Ml.getState(n);if(!a||(t?a.undone:a.done).eventCount==0)return!1;if(r){let i=iz(a,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const x3=g3(!1,!0),y3=g3(!0,!0);Ln.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new dn({key:new vn("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const a=this.options.limit;if(a==null||a===0){t=!0;return}const i=this.storage.characters({node:r.doc});if(i>a){const o=i-a,c=0,u=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${a} characters. Content was automatically trimmed.`);const h=r.tr.deleteRange(c,u);return t=!0,h}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const a=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||a>r&&i>r&&i<=a)return!0;if(a>r&&i>r&&i>a||!e.getMeta("paste"))return!1;const c=e.selection.$head.pos,u=i-r,h=c-u,f=c;return e.deleteRange(h,f),!(this.storage.characters({node:e.doc})>r)}})]}});var cz=Ln.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[W$(this.options)]}});Ln.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new dn({key:new vn("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:a}=e,i=[];if(!n||!r)return rn.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((u,h)=>{if(u.isText)return;if(!(a>=h&&a<=h+u.nodeSize-1))return!1;o+=1});let c=0;return t.descendants((u,h)=>{if(u.isText||!(a>=h&&a<=h+u.nodeSize-1))return!1;if(c+=1,this.options.mode==="deepest"&&o-c>0||this.options.mode==="shallowest"&&c>1)return this.options.mode==="deepest";i.push(Xn.node(h,h+u.nodeSize,{class:this.options.className}))}),rn.create(t,i)}}})]}});var dz=Ln.create({name:"gapCursor",addProseMirrorPlugins(){return[J$()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Kt(rt(t,"allowGapCursor",n)))!=null?e:null}}}),Ow="placeholder";function uz(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var hz=Ln.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Ow,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${uz(this.options.dataAttribute)}`:`data-${Ow}`;return[new dn({key:new vn("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:a}=n,i=[];if(!r)return null;const o=this.editor.isEmpty;return e.descendants((c,u)=>{const h=a>=u&&a<=u+c.nodeSize,f=!c.isLeaf&&Up(c);if((h||!this.options.showOnlyCurrent)&&f){const m=[this.options.emptyNodeClass];o&&m.push(this.options.emptyEditorClass);const g=Xn.node(u,u+c.nodeSize,{class:m.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:c,pos:u,hasAnchor:h}):this.options.placeholder});i.push(g)}return this.options.includeChildren}),rn.create(e,i)}}})]}});Ln.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new dn({key:new vn("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||wC(n.selection)||t.view.dragging?null:rn.create(n.doc,[Xn.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Dw({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var fz=Ln.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new vn(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,a])=>a).filter(a=>(this.options.notAfter||[]).concat(n).includes(a.name));return[new dn({key:e,appendTransaction:(a,i,o)=>{const{doc:c,tr:u,schema:h}=o,f=e.getState(o),m=c.content.size,g=h.nodes[n];if(f)return u.insert(m,g.create())},state:{init:(a,i)=>{const o=i.tr.doc.lastChild;return!Dw({node:o,types:r})},apply:(a,i)=>{if(!a.docChanged||a.getMeta("__uniqueIDTransaction"))return i;const o=a.doc.lastChild;return!Dw({node:o,types:r})}}})]}}),pz=Ln.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>x3(t,e),redo:()=>({state:t,dispatch:e})=>y3(t,e)}},addProseMirrorPlugins(){return[lz(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),mz=Ln.create({name:"starterKit",addExtensions(){var t,e,n,r;const a=[];return this.options.bold!==!1&&a.push(z7.configure(this.options.bold)),this.options.blockquote!==!1&&a.push(L7.configure(this.options.blockquote)),this.options.bulletList!==!1&&a.push(s3.configure(this.options.bulletList)),this.options.code!==!1&&a.push(V7.configure(this.options.code)),this.options.codeBlock!==!1&&a.push(W7.configure(this.options.codeBlock)),this.options.document!==!1&&a.push(K7.configure(this.options.document)),this.options.dropcursor!==!1&&a.push(cz.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&a.push(dz.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&a.push(q7.configure(this.options.hardBreak)),this.options.heading!==!1&&a.push(G7.configure(this.options.heading)),this.options.undoRedo!==!1&&a.push(pz.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&a.push(J7.configure(this.options.horizontalRule)),this.options.italic!==!1&&a.push(e$.configure(this.options.italic)),this.options.listItem!==!1&&a.push(r3.configure(this.options.listItem)),this.options.listKeymap!==!1&&a.push(d3.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&a.push(S$.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&a.push(h3.configure(this.options.orderedList)),this.options.paragraph!==!1&&a.push(z$.configure(this.options.paragraph)),this.options.strike!==!1&&a.push(V$.configure(this.options.strike)),this.options.text!==!1&&a.push(H$.configure(this.options.text)),this.options.underline!==!1&&a.push(U$.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&a.push(fz.configure((r=this.options)==null?void 0:r.trailingNode)),a}}),gz=mz,xz=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,yz=Fn.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",qt(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,a,i,o;const c=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",u=(a=(r=t.attrs)==null?void 0:r.alt)!=null?a:"",h=(o=(i=t.attrs)==null?void 0:i.title)!=null?o:"";return h?`![${u}](${c} "${h}")`:`![${u}](${c})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:a,getPos:i,HTMLAttributes:o,editor:c})=>{const u=document.createElement("img");Object.entries(o).forEach(([m,g])=>{if(g!=null)switch(m){case"width":case"height":break;default:u.setAttribute(m,g);break}}),u.src=o.src;const h=new N_({element:u,editor:c,node:a,getPos:i,onResize:(m,g)=>{u.style.width=`${m}px`,u.style.height=`${g}px`},onCommit:(m,g)=>{const b=i();b!==void 0&&this.editor.chain().setNodeSelection(b).updateAttributes(this.name,{width:m,height:g}).run()},onUpdate:(m,g,b)=>m.type===a.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),f=h.dom;return f.style.visibility="hidden",f.style.pointerEvents="none",u.onload=()=>{f.style.visibility="",f.style.pointerEvents=""},h}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[zC({find:xz,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),bz=yz;function vz(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:o,$position:c}=t,u=r&&!a,h=j_(n),f=new RegExp(`\\s${h}$`),m=o?"^":"",g=a?"":h,b=u?new RegExp(`${m}${h}.*?(?=\\s${g}|$)`,"gm"):new RegExp(`${m}(?:^)?${h}[^\\s${g}]*`,"gm"),N=((e=c.nodeBefore)==null?void 0:e.isText)&&c.nodeBefore.text;if(!N)return null;const j=c.pos-N.length,v=Array.from(N.matchAll(b)).pop();if(!v||v.input===void 0||v.index===void 0)return null;const k=v.input.slice(Math.max(0,v.index-1),v.index),T=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(k);if(i!==null&&!T)return null;const C=j+v.index;let P=C+v[0].length;return u&&f.test(N.slice(P-1,P+1))&&(v[0]+=" ",P+=1),C=c.pos?{range:{from:C,to:P},query:v[0].slice(n.length),text:v[0]}:null}var Nz=new vn("suggestion");function wz({pluginKey:t=Nz,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:a=!1,allowedPrefixes:i=[" "],startOfLine:o=!1,decorationTag:c="span",decorationClass:u="suggestion",decorationContent:h="",decorationEmptyClass:f="is-empty",command:m=()=>null,items:g=()=>[],render:b=()=>({}),allow:N=()=>!0,findSuggestionMatch:j=vz,shouldShow:v}){let k;const T=b==null?void 0:b(),C=()=>{const _=e.state.selection.$anchor.pos,H=e.view.coordsAtPos(_),{top:R,right:Z,bottom:re,left:$}=H;try{return new DOMRect($,R,Z-$,re-R)}catch{return null}},P=(_,H)=>H?()=>{const R=t.getState(e.state),Z=R==null?void 0:R.decorationId,re=_.dom.querySelector(`[data-decoration-id="${Z}"]`);return(re==null?void 0:re.getBoundingClientRect())||null}:C;function L(_,H){var R;try{const re=t.getState(_.state),$=re!=null&&re.decorationId?_.dom.querySelector(`[data-decoration-id="${re.decorationId}"]`):null,ie={editor:e,range:(re==null?void 0:re.range)||{from:0,to:0},query:(re==null?void 0:re.query)||null,text:(re==null?void 0:re.text)||null,items:[],command:ce=>m({editor:e,range:(re==null?void 0:re.range)||{from:0,to:0},props:ce}),decorationNode:$,clientRect:P(_,$)};(R=T==null?void 0:T.onExit)==null||R.call(T,ie)}catch{}const Z=_.state.tr.setMeta(H,{exit:!0});_.dispatch(Z)}const U=new dn({key:t,view(){return{update:async(_,H)=>{var R,Z,re,$,ie,ce,me;const I=(R=this.key)==null?void 0:R.getState(H),J=(Z=this.key)==null?void 0:Z.getState(_.state),z=I.active&&J.active&&I.range.from!==J.range.from,ge=!I.active&&J.active,X=I.active&&!J.active,F=!ge&&!X&&I.query!==J.query,W=ge||z&&F,fe=F||z,he=X||z&&F;if(!W&&!fe&&!he)return;const oe=he&&!W?I:J,D=_.dom.querySelector(`[data-decoration-id="${oe.decorationId}"]`);k={editor:e,range:oe.range,query:oe.query,text:oe.text,items:[],command:q=>m({editor:e,range:oe.range,props:q}),decorationNode:D,clientRect:P(_,D)},W&&((re=T==null?void 0:T.onBeforeStart)==null||re.call(T,k)),fe&&(($=T==null?void 0:T.onBeforeUpdate)==null||$.call(T,k)),(fe||W)&&(k.items=await g({editor:e,query:oe.query})),he&&((ie=T==null?void 0:T.onExit)==null||ie.call(T,k)),fe&&((ce=T==null?void 0:T.onUpdate)==null||ce.call(T,k)),W&&((me=T==null?void 0:T.onStart)==null||me.call(T,k))},destroy:()=>{var _;k&&((_=T==null?void 0:T.onExit)==null||_.call(T,k))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(_,H,R,Z){const{isEditable:re}=e,{composing:$}=e.view,{selection:ie}=_,{empty:ce,from:me}=ie,I={...H},J=_.getMeta(t);if(J&&J.exit)return I.active=!1,I.decorationId=null,I.range={from:0,to:0},I.query=null,I.text=null,I;if(I.composing=$,re&&(ce||e.view.composing)){(meH.range.to)&&!$&&!H.composing&&(I.active=!1);const z=j({char:n,allowSpaces:r,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:o,$position:ie.$from}),ge=`id_${Math.floor(Math.random()*4294967295)}`;z&&N({editor:e,state:Z,range:z.range,isActive:H.active})&&(!v||v({editor:e,range:z.range,query:z.query,text:z.text,transaction:_}))?(I.active=!0,I.decorationId=H.decorationId?H.decorationId:ge,I.range=z.range,I.query=z.query,I.text=z.text):I.active=!1}else I.active=!1;return I.active||(I.decorationId=null,I.range={from:0,to:0},I.query=null,I.text=null),I}},props:{handleKeyDown(_,H){var R,Z,re,$;const{active:ie,range:ce}=U.getState(_.state);if(!ie)return!1;if(H.key==="Escape"||H.key==="Esc"){const I=U.getState(_.state),J=(R=k==null?void 0:k.decorationNode)!=null?R:null,z=J??(I!=null&&I.decorationId?_.dom.querySelector(`[data-decoration-id="${I.decorationId}"]`):null);if(((Z=T==null?void 0:T.onKeyDown)==null?void 0:Z.call(T,{view:_,event:H,range:I.range}))||!1)return!0;const X={editor:e,range:I.range,query:I.query,text:I.text,items:[],command:F=>m({editor:e,range:I.range,props:F}),decorationNode:z,clientRect:z?()=>z.getBoundingClientRect()||null:null};return(re=T==null?void 0:T.onExit)==null||re.call(T,X),L(_,t),!0}return(($=T==null?void 0:T.onKeyDown)==null?void 0:$.call(T,{view:_,event:H,range:ce}))||!1},decorations(_){const{active:H,range:R,decorationId:Z,query:re}=U.getState(_);if(!H)return null;const $=!(re!=null&&re.length),ie=[u];return $&&ie.push(f),rn.create(_.doc,[Xn.inline(R.from,R.to,{nodeName:c,class:ie.join(" "),"data-decoration-id":Z,"data-decoration-content":h})])}}});return U}function jz({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const a=new vn;return{editor:t,char:r,pluginKey:a,command:({editor:i,range:o,props:c})=>{var u,h,f;const m=i.view.state.selection.$to.nodeAfter;((u=m==null?void 0:m.text)==null?void 0:u.startsWith(" "))&&(o.to+=1),i.chain().focus().insertContentAt(o,[{type:n,attrs:{...c,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(f=(h=i.view.dom.ownerDocument.defaultView)==null?void 0:h.getSelection())==null||f.collapseToEnd()},allow:({state:i,range:o})=>{const c=i.doc.resolve(o.from),u=i.schema.nodes[n];return!!c.parent.type.contentMatch.matchType(u)},...e}}function b3(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>jz({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function _w(t,e){const n=b3(t),r=n.find(a=>a.char===e);return r||(n.length?n[0]:null)}var kz=Fn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!=null?n:"@"}${(r=t.attrs.label)!=null?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,a;return["span",qt(this.HTMLAttributes,t.HTMLAttributes),`${(r=n==null?void 0:n.char)!=null?r:"@"}${(a=e.attrs.label)!=null?a:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=_w(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",qt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=qt({"data-type":this.name},this.options.HTMLAttributes,e);const a=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof a=="string"?["span",qt({"data-type":this.name},this.options.HTMLAttributes,e),a]:a},...FC({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:t=>{const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,a,i,o]=r,c=i??o;e[a==="char"?"mentionSuggestionChar":a]=c,r=n.exec(t)}return e},serializeAttributes:t=>Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e==="mentionSuggestionChar"?"char":e}="${n}"`).join(" ")}),renderText({node:t}){const e={options:this.options,node:t,suggestion:_w(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:a,anchor:i}=r;if(!a)return!1;let o=new Ei,c=0;return e.doc.nodesBetween(i-1,i,(u,h)=>{if(u.type.name===this.name)return n=!0,o=u,c=h,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":o.attrs.mentionSuggestionChar,c,c+o.nodeSize),n})}},addProseMirrorPlugins(){return b3(this).map(wz)}}),Sz=kz,Cz=hz;let j0,k0;if(typeof WeakMap<"u"){let t=new WeakMap;j0=e=>t.get(e),k0=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;j0=r=>{for(let a=0;a(n==10&&(n=0),t[n++]=r,t[n++]=a)}var Rn=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e=n){(i||(i=[])).push({type:"overlong_rowspan",pos:f,n:k-C});break}const P=a+C*e;for(let L=0;Lr&&(i+=h.attrs.colspan)}}for(let o=0;o1&&(n=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function Mz(t,e,n){t.problems||(t.problems=[]);const r={};for(let a=0;a0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function Iz(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function ya(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function Gp(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=Ul(e.$head)||Pz(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Pz(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function S0(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function Rz(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Gy(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function v3(t,e,n){const r=t.node(-1),a=Rn.get(r),i=t.start(-1),o=a.nextCell(t.pos-i,e,n);return o==null?null:t.node(0).resolve(i+o)}function Wl(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(a=>a>0)||(r.colwidth=null)),r}function N3(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let a=0;af!=n.pos-i);u.unshift(n.pos-i);const h=u.map(f=>{const m=r.nodeAt(f);if(!m)throw new RangeError(`No cell with offset ${f} found`);const g=i+f+1;return new dS(c.resolve(g),c.resolve(g+m.content.size))});super(h[0].$from,h[0].$to,h),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),a=e.resolve(n.map(this.$headCell.pos));if(S0(r)&&S0(a)&&Gy(r,a)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?vi.rowSelection(r,a):i&&this.isColSelection()?vi.colSelection(r,a):new vi(r,a)}return ot.between(r,a)}content(){const e=this.$anchorCell.node(-1),n=Rn.get(e),r=this.$anchorCell.start(-1),a=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},o=[];for(let u=a.top;u0||v>0){let k=N.attrs;if(j>0&&(k=Wl(k,0,j)),v>0&&(k=Wl(k,k.colspan-v,v)),b.lefta.bottom){const k={...N.attrs,rowspan:Math.min(b.bottom,a.bottom)-Math.max(b.top,a.top)};b.top0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,a=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,a)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),a=Rn.get(r),i=e.start(-1),o=a.findCell(e.pos-i),c=a.findCell(n.pos-i),u=e.node(0);return o.top<=c.top?(o.top>0&&(e=u.resolve(i+a.map[o.left])),c.bottom0&&(n=u.resolve(i+a.map[c.left])),o.bottom0)return!1;const o=a+this.$anchorCell.nodeAfter.attrs.colspan,c=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,c)==n.width}eq(e){return e instanceof vi&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),a=Rn.get(r),i=e.start(-1),o=a.findCell(e.pos-i),c=a.findCell(n.pos-i),u=e.node(0);return o.left<=c.left?(o.left>0&&(e=u.resolve(i+a.map[o.top*a.width])),c.right0&&(n=u.resolve(i+a.map[c.top*a.width])),o.right{e.push(Xn.node(r,r+n.nodeSize,{class:"selectedCell"}))}),rn.create(t.doc,e)}function _z({$from:t,$to:e}){if(t.pos==e.pos||t.pos=0&&!(t.after(a+1)=0&&!(e.before(i+1)>e.start(i));i--,r--);return n==r&&/row|table/.test(t.node(a).type.spec.tableRole)}function $z({$from:t,$to:e}){let n,r;for(let a=t.depth;a>0;a--){const i=t.node(a);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let a=e.depth;a>0;a--){const i=e.node(a);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return n!==r&&e.parentOffset===0}function zz(t,e,n){const r=(e||t).selection,a=(e||t).doc;let i,o;if(r instanceof it&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")i=cn.create(a,r.from);else if(o=="row"){const c=a.resolve(r.from+1);i=cn.rowSelection(c,c)}else if(!n){const c=Rn.get(r.node),u=r.from+1,h=u+c.map[c.width*c.height-1];i=cn.create(a,u+1,h)}}else r instanceof ot&&_z(r)?i=ot.create(a,r.from):r instanceof ot&&$z(r)&&(i=ot.create(a,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}const Fz=new vn("fix-tables");function j3(t,e,n,r){const a=t.childCount,i=e.childCount;e:for(let o=0,c=0;o{a.type.spec.tableRole=="table"&&(n=Bz(t,a,i,n))};return e?e.doc!=t.doc&&j3(e.doc,t.doc,0,r):t.doc.descendants(r),n}function Bz(t,e,n,r){const a=Rn.get(e);if(!a.problems)return r;r||(r=t.tr);const i=[];for(let u=0;u0){let b="cell";f.firstChild&&(b=f.firstChild.type.spec.tableRole);const N=[];for(let v=0;v0?-1:0;Lz(e,r,a+i)&&(i=a==0||a==e.width?null:0);for(let o=0;o0&&a0&&e.map[c-1]==u||a0?-1:0;Kz(e,r,a+c)&&(c=a==0||a==e.height?null:0);for(let h=0,f=e.width*a;h0&&a0&&m==e.map[f-e.width]){const g=n.nodeAt(m).attrs;t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...g,rowspan:g.rowspan-1}),h+=g.colspan-1}else if(a0&&n[i]==n[i-1]||r.right0&&n[a]==n[a-t]||r.bottom0){const f=u+1+h.content.size,m=$w(h)?u+1:f;i.replaceWith(m+r.tableStart,f+r.tableStart,c)}i.setSelection(new cn(i.doc.resolve(u+r.tableStart))),e(i)}return!0}function Fw(t,e){const n=Rs(t.schema);return Xz(({node:r})=>n[r.type.spec.tableRole])(t,e)}function Xz(t){return(e,n)=>{const r=e.selection;let a,i;if(r instanceof cn){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;a=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{var o;if(a=Iz(r.$from),!a)return!1;i=(o=Ul(r.$from))===null||o===void 0?void 0:o.pos}if(a==null||i==null||a.attrs.colspan==1&&a.attrs.rowspan==1)return!1;if(n){let c=a.attrs;const u=[],h=c.colwidth;c.rowspan>1&&(c={...c,rowspan:1}),c.colspan>1&&(c={...c,colspan:1});const f=Wa(e),m=e.tr;for(let b=0;b{o.attrs[t]!==e&&i.setNodeMarkup(c,null,{...o.attrs,[t]:e})}):i.setNodeMarkup(a.pos,null,{...a.nodeAfter.attrs,[t]:e}),r(i)}return!0}}function eF(t){return function(e,n){if(!ya(e))return!1;if(n){const r=Rs(e.schema),a=Wa(e),i=e.tr,o=a.map.cellsInRect(t=="column"?{left:a.left,top:0,right:a.right,bottom:a.map.height}:t=="row"?{left:0,top:a.top,right:a.map.width,bottom:a.bottom}:a),c=o.map(u=>a.table.nodeAt(u));for(let u=0;u{const b=g+i.tableStart,N=o.doc.nodeAt(b);N&&o.setNodeMarkup(b,m,N.attrs)}),r(o)}return!0}}Mu("row",{useDeprecatedLogic:!0});Mu("column",{useDeprecatedLogic:!0});const tF=Mu("cell",{useDeprecatedLogic:!0});function nF(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,a=t.before();r>=0;r--){const i=t.node(-1).child(r),o=i.lastChild;if(o)return a-1-o.nodeSize;a-=i.nodeSize}}else{if(t.index()0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function sf(t,e){const n=t.selection;if(!(n instanceof cn))return!1;if(e){const r=t.tr,a=Rs(t.schema).cell.createAndFill().content;n.forEachCell((i,o)=>{i.content.eq(a)||r.replace(r.mapping.map(o+1),r.mapping.map(o+i.nodeSize-1),new Fe(a,0,0))}),r.docChanged&&e(r)}return!0}function rF(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const a=e.child(0),i=a.type.spec.tableRole,o=a.type.schema,c=[];if(i=="row")for(let u=0;u=0;o--){const{rowspan:c,colspan:u}=i.child(o).attrs;for(let h=a;h=e.length&&e.push(Ce.empty),n[a]r&&(g=g.type.createChecked(Wl(g.attrs,g.attrs.colspan,f+g.attrs.colspan-r),g.content)),h.push(g),f+=g.attrs.colspan;for(let b=1;ba&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,a-m.attrs.rowspan)},m.content)),u.push(m)}i.push(Ce.from(u))}n=i,e=a}return{width:t,height:e,rows:n}}function oF(t,e,n,r,a,i,o){const c=t.doc.type.schema,u=Rs(c);let h,f;if(a>e.width)for(let m=0,g=0;me.height){const m=[];for(let N=0,j=(e.height-1)*e.width;N=e.width?!1:n.nodeAt(e.map[j+N]).type==u.header_cell;m.push(v?f||(f=u.header_cell.createAndFill()):h||(h=u.cell.createAndFill()))}const g=u.row.create(null,Ce.from(m)),b=[];for(let N=e.height;N{if(!a)return!1;const i=n.selection;if(i instanceof cn)return gf(n,r,ft.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const o=E3(a,t,e);if(o==null)return!1;if(t=="horiz")return gf(n,r,ft.near(n.doc.resolve(i.head+e),e));{const c=n.doc.resolve(o),u=v3(c,t,e);let h;return u?h=ft.near(u,1):e<0?h=ft.near(n.doc.resolve(c.before(-1)),-1):h=ft.near(n.doc.resolve(c.after(-1)),1),gf(n,r,h)}}}function af(t,e){return(n,r,a)=>{if(!a)return!1;const i=n.selection;let o;if(i instanceof cn)o=i;else{const u=E3(a,t,e);if(u==null)return!1;o=new cn(n.doc.resolve(u))}const c=v3(o.$headCell,t,e);return c?gf(n,r,new cn(o.$anchorCell,c)):!1}}function cF(t,e){const n=t.state.doc,r=Ul(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new cn(r))),!0):!1}function dF(t,e,n){if(!ya(t.state))return!1;let r=rF(n);const a=t.state.selection;if(a instanceof cn){r||(r={width:1,height:1,rows:[Ce.from(C0(Rs(t.state.schema).cell,n))]});const i=a.$anchorCell.node(-1),o=a.$anchorCell.start(-1),c=Rn.get(i).rectBetween(a.$anchorCell.pos-o,a.$headCell.pos-o);return r=iF(r,c.right-c.left,c.bottom-c.top),Ww(t.state,t.dispatch,o,c,r),!0}else if(r){const i=Gp(t.state),o=i.start(-1);return Ww(t.state,t.dispatch,o,Rn.get(i.node(-1)).findCell(i.pos-o),r),!0}else return!1}function uF(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=Kw(t,e.target);let a;if(e.shiftKey&&t.state.selection instanceof cn)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(a=Ul(t.state.selection.$anchor))!=null&&((n=wx(t,e))===null||n===void 0?void 0:n.pos)!=a.pos)i(a,e),e.preventDefault();else if(!r)return;function i(u,h){let f=wx(t,h);const m=go.getState(t.state)==null;if(!f||!Gy(u,f))if(m)f=u;else return;const g=new cn(u,f);if(m||!t.state.selection.eq(g)){const b=t.state.tr.setSelection(g);m&&b.setMeta(go,u.pos),t.dispatch(b)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",c),go.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(go,-1))}function c(u){const h=u,f=go.getState(t.state);let m;if(f!=null)m=t.state.doc.resolve(f);else if(Kw(t,h.target)!=r&&(m=wx(t,e),!m))return o();m&&i(m,h)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",c)}function E3(t,e,n){if(!(t.state.selection instanceof ot))return null;const{$head:r}=t.state.selection;for(let a=r.depth-1;a>=0;a--){const i=r.node(a);if((n<0?r.index(a):r.indexAfter(a))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const o=r.before(a),c=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?o:null}}return null}function Kw(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function wx(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:a}=n;return r>=0&&Ul(t.state.doc.resolve(r))||Ul(t.state.doc.resolve(a))}var hF=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),E0(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,E0(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function E0(t,e,n,r,a,i){let o=0,c=!0,u=e.firstChild;const h=t.firstChild;if(h){for(let m=0,g=0;mnew r(m,n,g)),new pF(-1,!1)},apply(o,c){return c.apply(o)}},props:{attributes:o=>{const c=Sr.getState(o);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,c)=>{mF(o,c,t,a)},mouseleave:o=>{gF(o)},mousedown:(o,c)=>{xF(o,c,e,n)}},decorations:o=>{const c=Sr.getState(o);if(c&&c.activeHandle>-1)return wF(o,c.activeHandle)},nodeViews:{}}});return i}var pF=class xf{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Sr);if(r&&r.setHandle!=null)return new xf(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new xf(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let a=e.mapping.map(n.activeHandle,-1);return S0(e.doc.resolve(a))||(a=-1),new xf(a,n.dragging)}return n}};function mF(t,e,n,r){if(!t.editable)return;const a=Sr.getState(t.state);if(a&&!a.dragging){const i=bF(e.target);let o=-1;if(i){const{left:c,right:u}=i.getBoundingClientRect();e.clientX-c<=n?o=qw(t,e,"left",n):u-e.clientX<=n&&(o=qw(t,e,"right",n))}if(o!=a.activeHandle){if(!r&&o!==-1){const c=t.state.doc.resolve(o),u=c.node(-1),h=Rn.get(u),f=c.start(-1);if(h.colCount(c.pos-f)+c.nodeAfter.attrs.colspan-1==h.width-1)return}T3(t,o)}}}function gF(t){if(!t.editable)return;const e=Sr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&T3(t,-1)}function xF(t,e,n,r){var a;if(!t.editable)return!1;const i=(a=t.dom.ownerDocument.defaultView)!==null&&a!==void 0?a:window,o=Sr.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const c=t.state.doc.nodeAt(o.activeHandle),u=yF(t,o.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta(Sr,{setDragging:{startX:e.clientX,startWidth:u}}));function h(m){i.removeEventListener("mouseup",h),i.removeEventListener("mousemove",f);const g=Sr.getState(t.state);g!=null&&g.dragging&&(vF(t,g.activeHandle,Gw(g.dragging,m,n)),t.dispatch(t.state.tr.setMeta(Sr,{setDragging:null})))}function f(m){if(!m.which)return h(m);const g=Sr.getState(t.state);if(g&&g.dragging){const b=Gw(g.dragging,m,n);Jw(t,g.activeHandle,b,r)}}return Jw(t,o.activeHandle,u,r),i.addEventListener("mouseup",h),i.addEventListener("mousemove",f),e.preventDefault(),!0}function yF(t,e,{colspan:n,colwidth:r}){const a=r&&r[r.length-1];if(a)return a;const i=t.domAtPos(e);let o=i.node.childNodes[i.offset].offsetWidth,c=n;if(r)for(let u=0;u{var e,n;const r=t.getAttribute("colwidth"),a=r?r.split(",").map(i=>parseInt(i,10)):null;if(!a){const i=(e=t.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),o=Array.from(((n=t.parentElement)==null?void 0:n.children)||[]).indexOf(t);if(o&&o>-1&&i&&i[o]){const c=i[o].getAttribute("width");return c?[parseInt(c,10)]:null}}return a}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",qt(this.options.HTMLAttributes,t),0]}}),A3=Fn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",qt(this.options.HTMLAttributes,t),0]}}),I3=Fn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",qt(this.options.HTMLAttributes,t),0]}});function T0(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Qw(t,e,n,r,a,i){var o;let c=0,u=!0,h=e.firstChild;const f=t.firstChild;if(f!==null)for(let g=0,b=0;g{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function EF(t,e,n,r,a){const i=CF(t),o=[],c=[];for(let h=0;h{const{selection:e}=t.state;if(!TF(e))return!1;let n=0;const r=pC(e.ranges[0].$from,i=>i.type.name==="table");return r==null||r.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},MF="";function AF(t){return(t||"").replace(/\s+/g," ").trim()}function IF(t,e,n={}){var r;const a=(r=n.cellLineSeparator)!=null?r:MF;if(!t||!t.content||t.content.length===0)return"";const i=[];t.content.forEach(N=>{const j=[];N.content&&N.content.forEach(v=>{let k="";v.content&&Array.isArray(v.content)&&v.content.length>1?k=v.content.map(L=>e.renderChildren(L)).join(a):k=v.content?e.renderChildren(v.content):"";const T=AF(k),C=v.type==="tableHeader";j.push({text:T,isHeader:C})}),i.push(j)});const o=i.reduce((N,j)=>Math.max(N,j.length),0);if(o===0)return"";const c=new Array(o).fill(0);i.forEach(N=>{var j;for(let v=0;vc[v]&&(c[v]=T),c[v]<3&&(c[v]=3)}});const u=(N,j)=>N+" ".repeat(Math.max(0,j-N.length)),h=i[0],f=h.some(N=>N.isHeader);let m=` +`;const g=new Array(o).fill(0).map((N,j)=>f&&h[j]&&h[j].text||"");return m+=`| ${g.map((N,j)=>u(N,c[j])).join(" | ")} | +`,m+=`| ${c.map(N=>"-".repeat(Math.max(3,N))).join(" | ")} | +`,(f?i.slice(1):i).forEach(N=>{m+=`| ${new Array(o).fill(0).map((j,v)=>u(N[v]&&N[v].text||"",c[v])).join(" | ")} | +`}),m}var PF=IF,P3=Fn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:kF,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:a}=SF(t,this.options.cellMinWidth),i=e.style;function o(){return i||(r?`width: ${r}`:`min-width: ${a}`)}const c=["table",qt(this.options.HTMLAttributes,e,{style:o()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},c]:c},parseMarkdown:(t,e)=>{const n=[];if(t.header){const r=[];t.header.forEach(a=>{r.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(a.tokens)}]))}),n.push(e.createNode("tableRow",{},r))}return t.rows&&t.rows.forEach(r=>{const a=[];r.forEach(i=>{a.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),n.push(e.createNode("tableRow",{},a))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>PF(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:a,editor:i})=>{const o=EF(i.schema,t,e,n);if(a){const c=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(ot.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>Vz(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>Hz(t,e),deleteColumn:()=>({state:t,dispatch:e})=>Wz(t,e),addRowBefore:()=>({state:t,dispatch:e})=>qz(t,e),addRowAfter:()=>({state:t,dispatch:e})=>Gz(t,e),deleteRow:()=>({state:t,dispatch:e})=>Qz(t,e),deleteTable:()=>({state:t,dispatch:e})=>sF(t,e),mergeCells:()=>({state:t,dispatch:e})=>zw(t,e),splitCell:()=>({state:t,dispatch:e})=>Fw(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Mu("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Mu("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>tF(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>zw(t,e)?!0:Fw(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>Zz(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Vw(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Vw(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&k3(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=cn.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:of,"Mod-Backspace":of,Delete:of,"Mod-Delete":of}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[fF({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],jF({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:Kt(rt(t,"tableRole",e))}}});Ln.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(P3.configure(this.options.table)),this.options.tableCell!==!1&&t.push(M3.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(A3.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(I3.configure(this.options.tableRow)),t}});function RF(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function LF(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}function OF(t){if(!t)return"";let e=t;return e=e.replace(/]*>(.*?)<\/h1>/gi,`# $1 + +`),e=e.replace(/]*>(.*?)<\/h2>/gi,`## $1 + +`),e=e.replace(/]*>(.*?)<\/h3>/gi,`### $1 + +`),e=e.replace(/]*>(.*?)<\/strong>/gi,"**$1**"),e=e.replace(/]*>(.*?)<\/b>/gi,"**$1**"),e=e.replace(/]*>(.*?)<\/em>/gi,"*$1*"),e=e.replace(/]*>(.*?)<\/i>/gi,"*$1*"),e=e.replace(/]*>(.*?)<\/s>/gi,"~~$1~~"),e=e.replace(/]*>(.*?)<\/del>/gi,"~~$1~~"),e=e.replace(/]*>(.*?)<\/code>/gi,"`$1`"),e=e.replace(/]*>(.*?)<\/blockquote>/gi,`> $1 + +`),e=e.replace(/]*src="([^"]*)"[^>]*alt="([^"]*)"[^>]*>/gi,"![$2]($1)"),e=e.replace(/]*src="([^"]*)"[^>]*>/gi,"![]($1)"),e=e.replace(/]*href="([^"]*)"[^>]*>(.*?)<\/a>/gi,"[$2]($1)"),e=e.replace(/]*>(.*?)<\/li>/gi,`- $1 +`),e=e.replace(/<\/?[uo]l[^>]*>/gi,` +`),e=e.replace(//gi,` +`),e=e.replace(/]*>(.*?)<\/p>/gi,`$1 + +`),e=e.replace(//gi,`--- + +`),e=e.replace(/]*data-type="mention"[^>]*data-id="([^"]*)"[^>]*>@([^<]*)<\/span>/gi,"@$2"),e=e.replace(/]*data-type="linkTag"[^>]*data-url="([^"]*)"[^>]*>#([^<]*)<\/span>/gi,"#[$2]($1)"),e=e.replace(/<[^>]+>/g,""),e=e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'"),e=e.replace(/\n{3,}/g,` + +`),e.trim()}function Xw(t){if(!t)return"";if(t.startsWith("<")&&t.includes("$1"),e=e.replace(/^## (.+)$/gm,"

    $1

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

    $1

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

    $1

    "),e=e.replace(/^---$/gm,"
    "),e=e.replace(/^- (.+)$/gm,"
  • $1
  • ");const n=e.split(` +`),r=[];for(const 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 DF=Fn.create({name:"videoEmbed",group:"block",atom:!0,draggable:!0,addAttributes(){return{src:{default:null}}},parseHTML(){return[{tag:"div.rich-video-wrap",getAttrs:t=>{const e=t.querySelector("video"),n=e==null?void 0:e.getAttribute("src");return n?{src:n}:!1}},{tag:"video[src]",getAttrs:t=>({src:t.getAttribute("src")})}]},renderHTML({node:t}){const e=t.attrs.src||"";return["div",{class:"rich-video-wrap"},["video",{src:e,controls:!0,preload:"metadata"}],["div",{class:"rich-video-caption"},"视频(预览已缩小,保存后 C 端全宽播放)"]]}}),_F=Fn.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",qt(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}`]}});function Zw(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}const $F=t=>({items:({query:e})=>{const n=e.trim().toLowerCase();return(n?t.filter(a=>a.name.toLowerCase().includes(n)||a.id.toLowerCase().includes(n)||a.label&&a.label.toLowerCase().includes(n)||a.userId&&a.userId.toLowerCase().includes(n)):t).slice(0,16)},render:()=>{let e=null,n=0,r=[],a=null;const i=()=>{e&&(e.innerHTML=r.map((o,c)=>`
    + @${Zw(o.name)} + ${Zw(o.label||o.id)} +
    `).join(""),e.querySelectorAll(".mention-item").forEach(o=>{o.addEventListener("click",()=>{const c=parseInt(o.getAttribute("data-index")||"0");a&&r[c]&&a({id:r[c].id,label:r[c].name})})}))};return{onStart:o=>{if(e=document.createElement("div"),e.className="mention-popup",document.body.appendChild(e),r=o.items,a=o.command,n=0,i(),o.clientRect){const c=o.clientRect();c&&(e.style.top=`${c.bottom+4}px`,e.style.left=`${c.left}px`)}},onUpdate:o=>{if(r=o.items,a=o.command,n=0,i(),o.clientRect&&e){const c=o.clientRect();c&&(e.style.top=`${c.bottom+4}px`,e.style.left=`${c.left}px`)}},onKeyDown:o=>o.event.key==="ArrowUp"?(n=Math.max(0,n-1),i(),!0):o.event.key==="ArrowDown"?(n=Math.min(r.length-1,n+1),i(),!0):o.event.key==="Enter"?(a&&r[n]&&a({id:r[n].id,label:r[n].name}),!0):o.event.key==="Escape"?(e==null||e.remove(),e=null,!0):!1,onExit:()=>{e==null||e.remove(),e=null}}}});function zF(t){var r;const e=[],n=(r=t.clipboardData)==null?void 0:r.items;if(!n)return e;for(let a=0;a{const h=y.useRef(null),f=y.useRef(null),m=y.useRef(null),g=y.useRef(null),[b,N]=y.useState(""),[j,v]=y.useState(!1),k=y.useRef(Xw(t)),T=y.useCallback((re,$)=>{var I;const ie=g.current;if(!ie||!n)return!1;const ce=zF($);if(ce.length>0)return $.preventDefault(),(async()=>{for(const J of ce)try{const z=await n(J);z&&ie.chain().focus().setImage({src:z}).run()}catch(z){console.error("粘贴图片上传失败",z)}})(),!0;const me=(I=$.clipboardData)==null?void 0:I.getData("text/html");if(me&&/data:image\/[^;"']+;base64,/i.test(me)){$.preventDefault();const{from:J,to:z}=ie.state.selection;return(async()=>{try{const ge=await VF(me,n);ie.chain().focus().insertContentAt({from:J,to:z},ge).run()}catch(ge){console.error("粘贴 HTML 内 base64 转换失败",ge)}})(),!0}return!1},[n]),C=M7({extensions:[gz.configure({link:{openOnClick:!1,HTMLAttributes:{class:"rich-link"}}}),bz.configure({inline:!0,allowBase64:!0,HTMLAttributes:{class:"rich-editor-img-thumb"}}),DF,Sz.configure({HTMLAttributes:{class:"mention-tag"},suggestion:$F(a)}),_F,Cz.configure({placeholder:o}),P3.configure({resizable:!0}),I3,M3,A3],content:k.current,onUpdate:({editor:re})=>{e(re.getHTML())},editorProps:{attributes:{class:"rich-editor-content"},handlePaste:T}});y.useEffect(()=>{g.current=C??null},[C]),y.useImperativeHandle(u,()=>({getHTML:()=>(C==null?void 0:C.getHTML())||"",getMarkdown:()=>OF((C==null?void 0:C.getHTML())||"")})),y.useEffect(()=>{if(C&&t!==C.getHTML()){const re=Xw(t);re!==C.getHTML()&&C.commands.setContent(re)}},[t]);const P=y.useCallback(async re=>{if(r)return r(re);if(n)return n(re);throw new Error("未配置上传")},[n,r]),L=y.useCallback(async re=>{var ie;const $=(ie=re.target.files)==null?void 0:ie[0];if(!(!$||!C)){if(n){const ce=await n($);ce&&C.chain().focus().setImage({src:ce}).run()}else{const ce=new FileReader;ce.onload=()=>{typeof ce.result=="string"&&C.chain().focus().setImage({src:ce.result}).run()},ce.readAsDataURL($)}re.target.value=""}},[C,n]),U=y.useCallback(async re=>{var ie;const $=(ie=re.target.files)==null?void 0:ie[0];if(!(!$||!C)){try{const ce=await P($);ce&&C.chain().focus().insertContent({type:"videoEmbed",attrs:{src:ce}}).run()}catch(ce){console.error(ce)}re.target.value=""}},[C,P]),_=y.useCallback(async re=>{var ie;const $=(ie=re.target.files)==null?void 0:ie[0];if(!(!$||!C)){try{const ce=await P($);if(!ce)return;const me=$.name||"附件";C.chain().focus().insertContent(`

    附件 ${RF(me)}

    `).run()}catch(ce){console.error(ce)}re.target.value=""}},[C,P]),H=y.useCallback(()=>{C&&C.chain().focus().insertContent("@").run()},[C]),R=y.useCallback(re=>{C&&C.chain().focus().insertContent([{type:"linkTag",attrs:{label:re.label,url:re.url||"",tagType:re.type||"url",tagId:re.id||"",pagePath:re.pagePath||"",appId:re.appId||"",mpKey:re.type==="miniprogram"&&re.appId||""}},{type:"text",text:" "}]).run()},[C]),Z=y.useCallback(()=>{!C||!b||(C.chain().focus().setLink({href:b}).run(),N(""),v(!1))},[C,b]);return C?s.jsxs("div",{className:`rich-editor-wrapper ${c||""}`,children:[s.jsxs("div",{className:"rich-editor-toolbar",children:[s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>C.chain().focus().toggleBold().run(),className:C.isActive("bold")?"is-active":"",type:"button",children:s.jsx(r5,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().toggleItalic().run(),className:C.isActive("italic")?"is-active":"",type:"button",children:s.jsx(sM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().toggleStrike().run(),className:C.isActive("strike")?"is-active":"",type:"button",children:s.jsx(oA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().toggleCode().run(),className:C.isActive("code")?"is-active":"",type:"button",children:s.jsx(j5,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>C.chain().focus().toggleHeading({level:1}).run(),className:C.isActive("heading",{level:1})?"is-active":"",type:"button",children:s.jsx(q5,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().toggleHeading({level:2}).run(),className:C.isActive("heading",{level:2})?"is-active":"",type:"button",children:s.jsx(J5,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().toggleHeading({level:3}).run(),className:C.isActive("heading",{level:3})?"is-active":"",type:"button",children:s.jsx(Y5,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>C.chain().focus().toggleBulletList().run(),className:C.isActive("bulletList")?"is-active":"",type:"button",children:s.jsx(pM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().toggleOrderedList().run(),className:C.isActive("orderedList")?"is-active":"",type:"button",children:s.jsx(hM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().toggleBlockquote().run(),className:C.isActive("blockquote")?"is-active":"",type:"button",children:s.jsx(FM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().setHorizontalRule().run(),type:"button",children:s.jsx(SM,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("input",{ref:h,type:"file",accept:"image/*",onChange:L,className:"hidden"}),s.jsx("input",{ref:f,type:"file",accept:"video/*",onChange:U,className:"hidden"}),s.jsx("input",{ref:m,type:"file",onChange:_,className:"hidden"}),s.jsx("button",{onClick:()=>{var re;return(re=h.current)==null?void 0:re.click()},type:"button",title:"上传图片",children:s.jsx(Wj,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>{var re;return(re=f.current)==null?void 0:re.click()},type:"button",title:"上传视频",disabled:!r&&!n,children:s.jsx(wA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>{var re;return(re=m.current)==null?void 0:re.click()},type:"button",title:"上传附件(生成下载链接)",disabled:!r&&!n,children:s.jsx(AM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:H,type:"button",title:"插入 @ 并选择人物",className:a.length?"mention-trigger-btn":"",disabled:a.length===0,children:s.jsx(t5,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>v(!j),className:C.isActive("link")?"is-active":"",type:"button",title:"链接",children:s.jsx(_x,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),type:"button",title:"表格",children:s.jsx(cA,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>C.chain().focus().undo().run(),disabled:!C.can().undo(),type:"button",children:s.jsx(gA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().redo().run(),disabled:!C.can().redo(),type:"button",children:s.jsx(VM,{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:re=>{const $=i.find(ie=>ie.id===re.target.value);$&&R($),re.target.value=""},defaultValue:"",children:[s.jsx("option",{value:"",disabled:!0,children:"# 插入链接标签"}),i.map(re=>s.jsx("option",{value:re.id,children:re.label},re.id))]})})]})]}),j&&s.jsxs("div",{className:"link-input-bar",children:[s.jsx("input",{type:"url",placeholder:"输入链接地址...",value:b,onChange:re=>N(re.target.value),onKeyDown:re=>re.key==="Enter"&&Z(),className:"link-input"}),s.jsx("button",{onClick:Z,className:"link-confirm",type:"button",children:"确定"}),s.jsx("button",{onClick:()=>{C.chain().focus().unsetLink().run(),v(!1)},className:"link-remove",type:"button",children:"移除"})]}),s.jsx(HC,{editor:C})]}):null});M0.displayName="RichEditor";const HF=["top","right","bottom","left"],Ro=Math.min,jr=Math.max,yp=Math.round,lf=Math.floor,Fa=t=>({x:t,y:t}),UF={left:"right",right:"left",bottom:"top",top:"bottom"},WF={start:"end",end:"start"};function A0(t,e,n){return jr(t,Ro(e,n))}function Ai(t,e){return typeof t=="function"?t(e):t}function Ii(t){return t.split("-")[0]}function od(t){return t.split("-")[1]}function Jy(t){return t==="x"?"y":"x"}function Qy(t){return t==="y"?"height":"width"}const KF=new Set(["top","bottom"]);function $a(t){return KF.has(Ii(t))?"y":"x"}function Yy(t){return Jy($a(t))}function qF(t,e,n){n===void 0&&(n=!1);const r=od(t),a=Yy(t),i=Qy(a);let o=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=bp(o)),[o,bp(o)]}function GF(t){const e=bp(t);return[I0(t),e,I0(e)]}function I0(t){return t.replace(/start|end/g,e=>WF[e])}const ej=["left","right"],tj=["right","left"],JF=["top","bottom"],QF=["bottom","top"];function YF(t,e,n){switch(t){case"top":case"bottom":return n?e?tj:ej:e?ej:tj;case"left":case"right":return e?JF:QF;default:return[]}}function XF(t,e,n,r){const a=od(t);let i=YF(Ii(t),n==="start",r);return a&&(i=i.map(o=>o+"-"+a),e&&(i=i.concat(i.map(I0)))),i}function bp(t){return t.replace(/left|right|bottom|top/g,e=>UF[e])}function ZF(t){return{top:0,right:0,bottom:0,left:0,...t}}function R3(t){return typeof t!="number"?ZF(t):{top:t,right:t,bottom:t,left:t}}function vp(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 nj(t,e,n){let{reference:r,floating:a}=t;const i=$a(e),o=Yy(e),c=Qy(o),u=Ii(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 b;switch(u){case"top":b={x:f,y:r.y-a.height};break;case"bottom":b={x:f,y:r.y+r.height};break;case"right":b={x:r.x+r.width,y:m};break;case"left":b={x:r.x-a.width,y:m};break;default:b={x:r.x,y:r.y}}switch(od(e)){case"start":b[o]-=g*(n&&h?-1:1);break;case"end":b[o]+=g*(n&&h?-1:1);break}return b}async function eB(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:b=0}=Ai(e,t),N=R3(b),v=c[g?m==="floating"?"reference":"floating":m],k=vp(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:h,rootBoundary:f,strategy:u})),T=m==="floating"?{x:r,y:a,width:o.floating.width,height:o.floating.height}:o.reference,C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),P=await(i.isElement==null?void 0:i.isElement(C))?await(i.getScale==null?void 0:i.getScale(C))||{x:1,y:1}:{x:1,y:1},L=vp(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:T,offsetParent:C,strategy:u}):T);return{top:(k.top-L.top+N.top)/P.y,bottom:(L.bottom-k.bottom+N.bottom)/P.y,left:(k.left-L.left+N.left)/P.x,right:(L.right-k.right+N.right)/P.x}}const tB=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}=nj(h,r,u),g=r,b={},N=0;for(let v=0;v({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}=Ai(t,e)||{};if(h==null)return{};const m=R3(f),g={x:n,y:r},b=Yy(a),N=Qy(b),j=await o.getDimensions(h),v=b==="y",k=v?"top":"left",T=v?"bottom":"right",C=v?"clientHeight":"clientWidth",P=i.reference[N]+i.reference[b]-g[b]-i.floating[N],L=g[b]-i.reference[b],U=await(o.getOffsetParent==null?void 0:o.getOffsetParent(h));let _=U?U[C]:0;(!_||!await(o.isElement==null?void 0:o.isElement(U)))&&(_=c.floating[C]||i.floating[N]);const H=P/2-L/2,R=_/2-j[N]/2-1,Z=Ro(m[k],R),re=Ro(m[T],R),$=Z,ie=_-j[N]-re,ce=_/2-j[N]/2+H,me=A0($,ce,ie),I=!u.arrow&&od(a)!=null&&ce!==me&&i.reference[N]/2-(ce<$?Z:re)-j[N]/2<0,J=I?ce<$?ce-$:ce-ie:0;return{[b]:g[b]+J,data:{[b]:me,centerOffset:ce-me-J,...I&&{alignmentOffset:J}},reset:I}}}),sB=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:a,middlewareData:i,rects:o,initialPlacement:c,platform:u,elements:h}=e,{mainAxis:f=!0,crossAxis:m=!0,fallbackPlacements:g,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:N="none",flipAlignment:j=!0,...v}=Ai(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const k=Ii(a),T=$a(c),C=Ii(c)===c,P=await(u.isRTL==null?void 0:u.isRTL(h.floating)),L=g||(C||!j?[bp(c)]:GF(c)),U=N!=="none";!g&&U&&L.push(...XF(c,j,N,P));const _=[c,...L],H=await u.detectOverflow(e,v),R=[];let Z=((r=i.flip)==null?void 0:r.overflows)||[];if(f&&R.push(H[k]),m){const ce=qF(a,o,P);R.push(H[ce[0]],H[ce[1]])}if(Z=[...Z,{placement:a,overflows:R}],!R.every(ce=>ce<=0)){var re,$;const ce=(((re=i.flip)==null?void 0:re.index)||0)+1,me=_[ce];if(me&&(!(m==="alignment"?T!==$a(me):!1)||Z.every(z=>$a(z.placement)===T?z.overflows[0]>0:!0)))return{data:{index:ce,overflows:Z},reset:{placement:me}};let I=($=Z.filter(J=>J.overflows[0]<=0).sort((J,z)=>J.overflows[1]-z.overflows[1])[0])==null?void 0:$.placement;if(!I)switch(b){case"bestFit":{var ie;const J=(ie=Z.filter(z=>{if(U){const ge=$a(z.placement);return ge===T||ge==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(ge=>ge>0).reduce((ge,X)=>ge+X,0)]).sort((z,ge)=>z[1]-ge[1])[0])==null?void 0:ie[0];J&&(I=J);break}case"initialPlacement":I=c;break}if(a!==I)return{reset:{placement:I}}}return{}}}};function sj(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function rj(t){return HF.some(e=>t[e]>=0)}const rB=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:a="referenceHidden",...i}=Ai(t,e);switch(a){case"referenceHidden":{const o=await r.detectOverflow(e,{...i,elementContext:"reference"}),c=sj(o,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:rj(c)}}}case"escaped":{const o=await r.detectOverflow(e,{...i,altBoundary:!0}),c=sj(o,n.floating);return{data:{escapedOffsets:c,escaped:rj(c)}}}default:return{}}}}},L3=new Set(["left","top"]);async function aB(t,e){const{placement:n,platform:r,elements:a}=t,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),o=Ii(n),c=od(n),u=$a(n)==="y",h=L3.has(o)?-1:1,f=i&&u?-1:1,m=Ai(e,t);let{mainAxis:g,crossAxis:b,alignmentAxis:N}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof N=="number"&&(b=c==="end"?N*-1:N),u?{x:b*f,y:g*h}:{x:g*h,y:b*f}}const iB=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 aB(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}}}}},oB=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:T,y:C}=k;return{x:T,y:C}}},...h}=Ai(t,e),f={x:n,y:r},m=await i.detectOverflow(e,h),g=$a(Ii(a)),b=Jy(g);let N=f[b],j=f[g];if(o){const k=b==="y"?"top":"left",T=b==="y"?"bottom":"right",C=N+m[k],P=N-m[T];N=A0(C,N,P)}if(c){const k=g==="y"?"top":"left",T=g==="y"?"bottom":"right",C=j+m[k],P=j-m[T];j=A0(C,j,P)}const v=u.fn({...e,[b]:N,[g]:j});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[b]:o,[g]:c}}}}}},lB=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}=Ai(t,e),f={x:n,y:r},m=$a(a),g=Jy(m);let b=f[g],N=f[m];const j=Ai(c,e),v=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(u){const C=g==="y"?"height":"width",P=i.reference[g]-i.floating[C]+v.mainAxis,L=i.reference[g]+i.reference[C]-v.mainAxis;bL&&(b=L)}if(h){var k,T;const C=g==="y"?"width":"height",P=L3.has(Ii(a)),L=i.reference[m]-i.floating[C]+(P&&((k=o.offset)==null?void 0:k[m])||0)+(P?0:v.crossAxis),U=i.reference[m]+i.reference[C]+(P?0:((T=o.offset)==null?void 0:T[m])||0)-(P?v.crossAxis:0);NU&&(N=U)}return{[g]:b,[m]:N}}}},cB=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}=Ai(t,e),f=await o.detectOverflow(e,h),m=Ii(a),g=od(a),b=$a(a)==="y",{width:N,height:j}=i.floating;let v,k;m==="top"||m==="bottom"?(v=m,k=g===(await(o.isRTL==null?void 0:o.isRTL(c.floating))?"start":"end")?"left":"right"):(k=m,v=g==="end"?"top":"bottom");const T=j-f.top-f.bottom,C=N-f.left-f.right,P=Ro(j-f[v],T),L=Ro(N-f[k],C),U=!e.middlewareData.shift;let _=P,H=L;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(H=C),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(_=T),U&&!g){const Z=jr(f.left,0),re=jr(f.right,0),$=jr(f.top,0),ie=jr(f.bottom,0);b?H=N-2*(Z!==0||re!==0?Z+re:jr(f.left,f.right)):_=j-2*($!==0||ie!==0?$+ie:jr(f.top,f.bottom))}await u({...e,availableWidth:H,availableHeight:_});const R=await o.getDimensions(c.floating);return N!==R.width||j!==R.height?{reset:{rects:!0}}:{}}}};function Jp(){return typeof window<"u"}function ld(t){return O3(t)?(t.nodeName||"").toLowerCase():"#document"}function Er(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Ka(t){var e;return(e=(O3(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function O3(t){return Jp()?t instanceof Node||t instanceof Er(t).Node:!1}function ma(t){return Jp()?t instanceof Element||t instanceof Er(t).Element:!1}function Ha(t){return Jp()?t instanceof HTMLElement||t instanceof Er(t).HTMLElement:!1}function aj(t){return!Jp()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Er(t).ShadowRoot}const dB=new Set(["inline","contents"]);function zu(t){const{overflow:e,overflowX:n,overflowY:r,display:a}=ga(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!dB.has(a)}const uB=new Set(["table","td","th"]);function hB(t){return uB.has(ld(t))}const fB=[":popover-open",":modal"];function Qp(t){return fB.some(e=>{try{return t.matches(e)}catch{return!1}})}const pB=["transform","translate","scale","rotate","perspective"],mB=["transform","translate","scale","rotate","perspective","filter"],gB=["paint","layout","strict","content"];function Xy(t){const e=Zy(),n=ma(t)?ga(t):t;return pB.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)||mB.some(r=>(n.willChange||"").includes(r))||gB.some(r=>(n.contain||"").includes(r))}function xB(t){let e=Lo(t);for(;Ha(e)&&!Zc(e);){if(Xy(e))return e;if(Qp(e))return null;e=Lo(e)}return null}function Zy(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const yB=new Set(["html","body","#document"]);function Zc(t){return yB.has(ld(t))}function ga(t){return Er(t).getComputedStyle(t)}function Yp(t){return ma(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Lo(t){if(ld(t)==="html")return t;const e=t.assignedSlot||t.parentNode||aj(t)&&t.host||Ka(t);return aj(e)?e.host:e}function D3(t){const e=Lo(t);return Zc(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ha(e)&&zu(e)?e:D3(e)}function Au(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const a=D3(t),i=a===((r=t.ownerDocument)==null?void 0:r.body),o=Er(a);if(i){const c=P0(o);return e.concat(o,o.visualViewport||[],zu(a)?a:[],c&&n?Au(c):[])}return e.concat(a,Au(a,[],n))}function P0(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function _3(t){const e=ga(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const a=Ha(t),i=a?t.offsetWidth:n,o=a?t.offsetHeight:r,c=yp(n)!==i||yp(r)!==o;return c&&(n=i,r=o),{width:n,height:r,$:c}}function eb(t){return ma(t)?t:t.contextElement}function Hc(t){const e=eb(t);if(!Ha(e))return Fa(1);const n=e.getBoundingClientRect(),{width:r,height:a,$:i}=_3(e);let o=(i?yp(n.width):n.width)/r,c=(i?yp(n.height):n.height)/a;return(!o||!Number.isFinite(o))&&(o=1),(!c||!Number.isFinite(c))&&(c=1),{x:o,y:c}}const bB=Fa(0);function $3(t){const e=Er(t);return!Zy()||!e.visualViewport?bB:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function vB(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Er(t)?!1:e}function Kl(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const a=t.getBoundingClientRect(),i=eb(t);let o=Fa(1);e&&(r?ma(r)&&(o=Hc(r)):o=Hc(t));const c=vB(i,n,r)?$3(i):Fa(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=Er(i),b=r&&ma(r)?Er(r):r;let N=g,j=P0(N);for(;j&&r&&b!==N;){const v=Hc(j),k=j.getBoundingClientRect(),T=ga(j),C=k.left+(j.clientLeft+parseFloat(T.paddingLeft))*v.x,P=k.top+(j.clientTop+parseFloat(T.paddingTop))*v.y;u*=v.x,h*=v.y,f*=v.x,m*=v.y,u+=C,h+=P,N=Er(j),j=P0(N)}}return vp({width:f,height:m,x:u,y:h})}function Xp(t,e){const n=Yp(t).scrollLeft;return e?e.left+n:Kl(Ka(t)).left+n}function z3(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-Xp(t,n),a=n.top+e.scrollTop;return{x:r,y:a}}function NB(t){let{elements:e,rect:n,offsetParent:r,strategy:a}=t;const i=a==="fixed",o=Ka(r),c=e?Qp(e.floating):!1;if(r===o||c&&i)return n;let u={scrollLeft:0,scrollTop:0},h=Fa(1);const f=Fa(0),m=Ha(r);if((m||!m&&!i)&&((ld(r)!=="body"||zu(o))&&(u=Yp(r)),Ha(r))){const b=Kl(r);h=Hc(r),f.x=b.x+r.clientLeft,f.y=b.y+r.clientTop}const g=o&&!m&&!i?z3(o,u):Fa(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 wB(t){return Array.from(t.getClientRects())}function jB(t){const e=Ka(t),n=Yp(t),r=t.ownerDocument.body,a=jr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=jr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Xp(t);const c=-n.scrollTop;return ga(r).direction==="rtl"&&(o+=jr(e.clientWidth,r.clientWidth)-a),{width:a,height:i,x:o,y:c}}const ij=25;function kB(t,e){const n=Er(t),r=Ka(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=Zy();(!f||f&&e==="fixed")&&(c=a.offsetLeft,u=a.offsetTop)}const h=Xp(r);if(h<=0){const f=r.ownerDocument,m=f.body,g=getComputedStyle(m),b=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,N=Math.abs(r.clientWidth-m.clientWidth-b);N<=ij&&(i-=N)}else h<=ij&&(i+=h);return{width:i,height:o,x:c,y:u}}const SB=new Set(["absolute","fixed"]);function CB(t,e){const n=Kl(t,!0,e==="fixed"),r=n.top+t.clientTop,a=n.left+t.clientLeft,i=Ha(t)?Hc(t):Fa(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 oj(t,e,n){let r;if(e==="viewport")r=kB(t,n);else if(e==="document")r=jB(Ka(t));else if(ma(e))r=CB(e,n);else{const a=$3(t);r={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return vp(r)}function F3(t,e){const n=Lo(t);return n===e||!ma(n)||Zc(n)?!1:ga(n).position==="fixed"||F3(n,e)}function EB(t,e){const n=e.get(t);if(n)return n;let r=Au(t,[],!1).filter(c=>ma(c)&&ld(c)!=="body"),a=null;const i=ga(t).position==="fixed";let o=i?Lo(t):t;for(;ma(o)&&!Zc(o);){const c=ga(o),u=Xy(o);!u&&c.position==="fixed"&&(a=null),(i?!u&&!a:!u&&c.position==="static"&&!!a&&SB.has(a.position)||zu(o)&&!u&&F3(t,o))?r=r.filter(f=>f!==o):a=c,o=Lo(o)}return e.set(t,r),r}function TB(t){let{element:e,boundary:n,rootBoundary:r,strategy:a}=t;const o=[...n==="clippingAncestors"?Qp(e)?[]:EB(e,this._c):[].concat(n),r],c=o[0],u=o.reduce((h,f)=>{const m=oj(e,f,a);return h.top=jr(m.top,h.top),h.right=Ro(m.right,h.right),h.bottom=Ro(m.bottom,h.bottom),h.left=jr(m.left,h.left),h},oj(e,c,a));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function MB(t){const{width:e,height:n}=_3(t);return{width:e,height:n}}function AB(t,e,n){const r=Ha(e),a=Ka(e),i=n==="fixed",o=Kl(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const u=Fa(0);function h(){u.x=Xp(a)}if(r||!r&&!i)if((ld(e)!=="body"||zu(a))&&(c=Yp(e)),r){const b=Kl(e,!0,i,e);u.x=b.x+e.clientLeft,u.y=b.y+e.clientTop}else a&&h();i&&!r&&a&&h();const f=a&&!r&&!i?z3(a,c):Fa(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 jx(t){return ga(t).position==="static"}function lj(t,e){if(!Ha(t)||ga(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Ka(t)===n&&(n=n.ownerDocument.body),n}function B3(t,e){const n=Er(t);if(Qp(t))return n;if(!Ha(t)){let a=Lo(t);for(;a&&!Zc(a);){if(ma(a)&&!jx(a))return a;a=Lo(a)}return n}let r=lj(t,e);for(;r&&hB(r)&&jx(r);)r=lj(r,e);return r&&Zc(r)&&jx(r)&&!Xy(r)?n:r||xB(t)||n}const IB=async function(t){const e=this.getOffsetParent||B3,n=this.getDimensions,r=await n(t.floating);return{reference:AB(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function PB(t){return ga(t).direction==="rtl"}const RB={convertOffsetParentRelativeRectToViewportRelativeRect:NB,getDocumentElement:Ka,getClippingRect:TB,getOffsetParent:B3,getElementRects:IB,getClientRects:wB,getDimensions:MB,getScale:Hc,isElement:ma,isRTL:PB};function V3(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function LB(t,e){let n=null,r;const a=Ka(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:b}=h;if(c||e(),!g||!b)return;const N=lf(m),j=lf(a.clientWidth-(f+g)),v=lf(a.clientHeight-(m+b)),k=lf(f),C={rootMargin:-N+"px "+-j+"px "+-v+"px "+-k+"px",threshold:jr(0,Ro(1,u))||1};let P=!0;function L(U){const _=U[0].intersectionRatio;if(_!==u){if(!P)return o();_?o(!1,_):r=setTimeout(()=>{o(!1,1e-7)},1e3)}_===1&&!V3(h,t.getBoundingClientRect())&&o(),P=!1}try{n=new IntersectionObserver(L,{...C,root:a.ownerDocument})}catch{n=new IntersectionObserver(L,C)}n.observe(t)}return o(!0),i}function OB(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=eb(t),f=a||i?[...h?Au(h):[],...Au(e)]:[];f.forEach(k=>{a&&k.addEventListener("scroll",n,{passive:!0}),i&&k.addEventListener("resize",n)});const m=h&&c?LB(h,n):null;let g=-1,b=null;o&&(b=new ResizeObserver(k=>{let[T]=k;T&&T.target===h&&b&&(b.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var C;(C=b)==null||C.observe(e)})),n()}),h&&!u&&b.observe(h),b.observe(e));let N,j=u?Kl(t):null;u&&v();function v(){const k=Kl(t);j&&!V3(j,k)&&n(),j=k,N=requestAnimationFrame(v)}return n(),()=>{var k;f.forEach(T=>{a&&T.removeEventListener("scroll",n),i&&T.removeEventListener("resize",n)}),m==null||m(),(k=b)==null||k.disconnect(),b=null,u&&cancelAnimationFrame(N)}}const DB=iB,_B=oB,$B=sB,zB=cB,FB=rB,cj=nB,BB=lB,VB=(t,e,n)=>{const r=new Map,a={platform:RB,...n},i={...a.platform,_c:r};return tB(t,e,{...a,platform:i})};var HB=typeof document<"u",UB=function(){},yf=HB?y.useLayoutEffect:UB;function Np(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(!Np(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)&&!Np(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function H3(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function dj(t,e){const n=H3(t);return Math.round(e*n)/n}function kx(t){const e=y.useRef(t);return yf(()=>{e.current=t}),e}function WB(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]=y.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[g,b]=y.useState(r);Np(g,r)||b(r);const[N,j]=y.useState(null),[v,k]=y.useState(null),T=y.useCallback(z=>{z!==U.current&&(U.current=z,j(z))},[]),C=y.useCallback(z=>{z!==_.current&&(_.current=z,k(z))},[]),P=i||N,L=o||v,U=y.useRef(null),_=y.useRef(null),H=y.useRef(f),R=u!=null,Z=kx(u),re=kx(a),$=kx(h),ie=y.useCallback(()=>{if(!U.current||!_.current)return;const z={placement:e,strategy:n,middleware:g};re.current&&(z.platform=re.current),VB(U.current,_.current,z).then(ge=>{const X={...ge,isPositioned:$.current!==!1};ce.current&&!Np(H.current,X)&&(H.current=X,ed.flushSync(()=>{m(X)}))})},[g,e,n,re,$]);yf(()=>{h===!1&&H.current.isPositioned&&(H.current.isPositioned=!1,m(z=>({...z,isPositioned:!1})))},[h]);const ce=y.useRef(!1);yf(()=>(ce.current=!0,()=>{ce.current=!1}),[]),yf(()=>{if(P&&(U.current=P),L&&(_.current=L),P&&L){if(Z.current)return Z.current(P,L,ie);ie()}},[P,L,ie,Z,R]);const me=y.useMemo(()=>({reference:U,floating:_,setReference:T,setFloating:C}),[T,C]),I=y.useMemo(()=>({reference:P,floating:L}),[P,L]),J=y.useMemo(()=>{const z={position:n,left:0,top:0};if(!I.floating)return z;const ge=dj(I.floating,f.x),X=dj(I.floating,f.y);return c?{...z,transform:"translate("+ge+"px, "+X+"px)",...H3(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ge,top:X}},[n,c,I.floating,f.x,f.y]);return y.useMemo(()=>({...f,update:ie,refs:me,elements:I,floatingStyles:J}),[f,ie,me,I,J])}const KB=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?cj({element:r.current,padding:a}).fn(n):{}:r?cj({element:r,padding:a}).fn(n):{}}}},qB=(t,e)=>({...DB(t),options:[t,e]}),GB=(t,e)=>({..._B(t),options:[t,e]}),JB=(t,e)=>({...BB(t),options:[t,e]}),QB=(t,e)=>({...$B(t),options:[t,e]}),YB=(t,e)=>({...zB(t),options:[t,e]}),XB=(t,e)=>({...FB(t),options:[t,e]}),ZB=(t,e)=>({...KB(t),options:[t,e]});var e9="Arrow",U3=y.forwardRef((t,e)=>{const{children:n,width:r=10,height:a=5,...i}=t;return s.jsx(Mt.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"})})});U3.displayName=e9;var t9=U3,tb="Popper",[W3,K3]=_o(tb),[n9,q3]=W3(tb),G3=t=>{const{__scopePopper:e,children:n}=t,[r,a]=y.useState(null);return s.jsx(n9,{scope:e,anchor:r,onAnchorChange:a,children:n})};G3.displayName=tb;var J3="PopperAnchor",Q3=y.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...a}=t,i=q3(J3,n),o=y.useRef(null),c=Gt(e,o),u=y.useRef(null);return y.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(Mt.div,{...a,ref:c})});Q3.displayName=J3;var nb="PopperContent",[s9,r9]=W3(nb),Y3=y.forwardRef((t,e)=>{var q,O,Q,se,ve,ze;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:b="optimized",onPlaced:N,...j}=t,v=q3(nb,n),[k,T]=y.useState(null),C=Gt(e,Ue=>T(Ue)),[P,L]=y.useState(null),U=sy(P),_=(U==null?void 0:U.width)??0,H=(U==null?void 0:U.height)??0,R=r+(i!=="center"?"-"+i:""),Z=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},re=Array.isArray(h)?h:[h],$=re.length>0,ie={padding:Z,boundary:re.filter(i9),altBoundary:$},{refs:ce,floatingStyles:me,placement:I,isPositioned:J,middlewareData:z}=WB({strategy:"fixed",placement:R,whileElementsMounted:(...Ue)=>OB(...Ue,{animationFrame:b==="always"}),elements:{reference:v.anchor},middleware:[qB({mainAxis:a+H,alignmentAxis:o}),u&&GB({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?JB():void 0,...ie}),u&&QB({...ie}),YB({...ie,apply:({elements:Ue,rects:jt,availableWidth:Nn,availableHeight:pt})=>{const{width:It,height:un}=jt.reference,Bn=Ue.floating.style;Bn.setProperty("--radix-popper-available-width",`${Nn}px`),Bn.setProperty("--radix-popper-available-height",`${pt}px`),Bn.setProperty("--radix-popper-anchor-width",`${It}px`),Bn.setProperty("--radix-popper-anchor-height",`${un}px`)}}),P&&ZB({element:P,padding:c}),o9({arrowWidth:_,arrowHeight:H}),g&&XB({strategy:"referenceHidden",...ie})]}),[ge,X]=e4(I),F=Ao(N);Is(()=>{J&&(F==null||F())},[J,F]);const W=(q=z.arrow)==null?void 0:q.x,fe=(O=z.arrow)==null?void 0:O.y,he=((Q=z.arrow)==null?void 0:Q.centerOffset)!==0,[oe,D]=y.useState();return Is(()=>{k&&D(window.getComputedStyle(k).zIndex)},[k]),s.jsx("div",{ref:ce.setFloating,"data-radix-popper-content-wrapper":"",style:{...me,transform:J?me.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:oe,"--radix-popper-transform-origin":[(se=z.transformOrigin)==null?void 0:se.x,(ve=z.transformOrigin)==null?void 0:ve.y].join(" "),...((ze=z.hide)==null?void 0:ze.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:s.jsx(s9,{scope:n,placedSide:ge,onArrowChange:L,arrowX:W,arrowY:fe,shouldHideArrow:he,children:s.jsx(Mt.div,{"data-side":ge,"data-align":X,...j,ref:C,style:{...j.style,animation:J?void 0:"none"}})})})});Y3.displayName=nb;var X3="PopperArrow",a9={top:"bottom",right:"left",bottom:"top",left:"right"},Z3=y.forwardRef(function(e,n){const{__scopePopper:r,...a}=e,i=r9(X3,r),o=a9[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(t9,{...a,ref:n,style:{...a.style,display:"block"}})})});Z3.displayName=X3;function i9(t){return t!==null}var o9=t=>({name:"transformOrigin",options:t,fn(e){var v,k,T;const{placement:n,rects:r,middlewareData:a}=e,o=((v=a.arrow)==null?void 0:v.centerOffset)!==0,c=o?0:t.arrowWidth,u=o?0:t.arrowHeight,[h,f]=e4(n),m={start:"0%",center:"50%",end:"100%"}[f],g=(((k=a.arrow)==null?void 0:k.x)??0)+c/2,b=(((T=a.arrow)==null?void 0:T.y)??0)+u/2;let N="",j="";return h==="bottom"?(N=o?m:`${g}px`,j=`${-u}px`):h==="top"?(N=o?m:`${g}px`,j=`${r.floating.height+u}px`):h==="right"?(N=`${-u}px`,j=o?m:`${b}px`):h==="left"&&(N=`${r.floating.width+u}px`,j=o?m:`${b}px`),{data:{x:N,y:j}}}});function e4(t){const[e,n="center"]=t.split("-");return[e,n]}var l9=G3,c9=Q3,d9=Y3,u9=Z3,t4=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"}),h9="VisuallyHidden",f9=y.forwardRef((t,e)=>s.jsx(Mt.span,{...t,ref:e,style:{...t4,...t.style}}));f9.displayName=h9;var p9=[" ","Enter","ArrowUp","ArrowDown"],m9=[" ","Enter"],ql="Select",[Zp,em,g9]=ey(ql),[cd]=_o(ql,[g9,K3]),tm=K3(),[x9,Bo]=cd(ql),[y9,b9]=cd(ql),n4=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:b,form:N}=t,j=tm(e),[v,k]=y.useState(null),[T,C]=y.useState(null),[P,L]=y.useState(!1),U=Mp(h),[_,H]=Ll({prop:r,defaultProp:a??!1,onChange:i,caller:ql}),[R,Z]=Ll({prop:o,defaultProp:c,onChange:u,caller:ql}),re=y.useRef(null),$=v?N||!!v.closest("form"):!0,[ie,ce]=y.useState(new Set),me=Array.from(ie).map(I=>I.props.value).join(";");return s.jsx(l9,{...j,children:s.jsxs(x9,{required:b,scope:e,trigger:v,onTriggerChange:k,valueNode:T,onValueNodeChange:C,valueNodeHasChildren:P,onValueNodeHasChildrenChange:L,contentId:jo(),value:R,onValueChange:Z,open:_,onOpenChange:H,dir:U,triggerPointerDownPosRef:re,disabled:g,children:[s.jsx(Zp.Provider,{scope:e,children:s.jsx(y9,{scope:t.__scopeSelect,onNativeOptionAdd:y.useCallback(I=>{ce(J=>new Set(J).add(I))},[]),onNativeOptionRemove:y.useCallback(I=>{ce(J=>{const z=new Set(J);return z.delete(I),z})},[]),children:n})}),$?s.jsxs(k4,{"aria-hidden":!0,required:b,tabIndex:-1,name:f,autoComplete:m,value:R,onChange:I=>Z(I.target.value),disabled:g,form:N,children:[R===void 0?s.jsx("option",{value:""}):null,Array.from(ie)]},me):null]})})};n4.displayName=ql;var s4="SelectTrigger",r4=y.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...a}=t,i=tm(n),o=Bo(s4,n),c=o.disabled||r,u=Gt(e,o.onTriggerChange),h=em(n),f=y.useRef("touch"),[m,g,b]=C4(j=>{const v=h().filter(C=>!C.disabled),k=v.find(C=>C.value===o.value),T=E4(v,j,k);T!==void 0&&o.onValueChange(T.value)}),N=j=>{c||(o.onOpenChange(!0),b()),j&&(o.triggerPointerDownPosRef.current={x:Math.round(j.pageX),y:Math.round(j.pageY)})};return s.jsx(c9,{asChild:!0,...i,children:s.jsx(Mt.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":S4(o.value)?"":void 0,...a,ref:u,onClick:St(a.onClick,j=>{j.currentTarget.focus(),f.current!=="mouse"&&N(j)}),onPointerDown:St(a.onPointerDown,j=>{f.current=j.pointerType;const v=j.target;v.hasPointerCapture(j.pointerId)&&v.releasePointerCapture(j.pointerId),j.button===0&&j.ctrlKey===!1&&j.pointerType==="mouse"&&(N(j),j.preventDefault())}),onKeyDown:St(a.onKeyDown,j=>{const v=m.current!=="";!(j.ctrlKey||j.altKey||j.metaKey)&&j.key.length===1&&g(j.key),!(v&&j.key===" ")&&p9.includes(j.key)&&(N(),j.preventDefault())})})})});r4.displayName=s4;var a4="SelectValue",i4=y.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,children:i,placeholder:o="",...c}=t,u=Bo(a4,n),{onValueNodeHasChildrenChange:h}=u,f=i!==void 0,m=Gt(e,u.onValueNodeChange);return Is(()=>{h(f)},[h,f]),s.jsx(Mt.span,{...c,ref:m,style:{pointerEvents:"none"},children:S4(u.value)?s.jsx(s.Fragment,{children:o}):i})});i4.displayName=a4;var v9="SelectIcon",o4=y.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...a}=t;return s.jsx(Mt.span,{"aria-hidden":!0,...a,ref:e,children:r||"▼"})});o4.displayName=v9;var N9="SelectPortal",l4=t=>s.jsx(J0,{asChild:!0,...t});l4.displayName=N9;var Gl="SelectContent",c4=y.forwardRef((t,e)=>{const n=Bo(Gl,t.__scopeSelect),[r,a]=y.useState();if(Is(()=>{a(new DocumentFragment)},[]),!n.open){const i=r;return i?ed.createPortal(s.jsx(d4,{scope:t.__scopeSelect,children:s.jsx(Zp.Slot,{scope:t.__scopeSelect,children:s.jsx("div",{children:t.children})})}),i):null}return s.jsx(u4,{...t,ref:e})});c4.displayName=Gl;var da=10,[d4,Vo]=cd(Gl),w9="SelectContentImpl",j9=xu("SelectContent.RemoveScroll"),u4=y.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:b,sticky:N,hideWhenDetached:j,avoidCollisions:v,...k}=t,T=Bo(Gl,n),[C,P]=y.useState(null),[L,U]=y.useState(null),_=Gt(e,q=>P(q)),[H,R]=y.useState(null),[Z,re]=y.useState(null),$=em(n),[ie,ce]=y.useState(!1),me=y.useRef(!1);y.useEffect(()=>{if(C)return kk(C)},[C]),mk();const I=y.useCallback(q=>{const[O,...Q]=$().map(ze=>ze.ref.current),[se]=Q.slice(-1),ve=document.activeElement;for(const ze of q)if(ze===ve||(ze==null||ze.scrollIntoView({block:"nearest"}),ze===O&&L&&(L.scrollTop=0),ze===se&&L&&(L.scrollTop=L.scrollHeight),ze==null||ze.focus(),document.activeElement!==ve))return},[$,L]),J=y.useCallback(()=>I([H,C]),[I,H,C]);y.useEffect(()=>{ie&&J()},[ie,J]);const{onOpenChange:z,triggerPointerDownPosRef:ge}=T;y.useEffect(()=>{if(C){let q={x:0,y:0};const O=se=>{var ve,ze;q={x:Math.abs(Math.round(se.pageX)-(((ve=ge.current)==null?void 0:ve.x)??0)),y:Math.abs(Math.round(se.pageY)-(((ze=ge.current)==null?void 0:ze.y)??0))}},Q=se=>{q.x<=10&&q.y<=10?se.preventDefault():C.contains(se.target)||z(!1),document.removeEventListener("pointermove",O),ge.current=null};return ge.current!==null&&(document.addEventListener("pointermove",O),document.addEventListener("pointerup",Q,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",O),document.removeEventListener("pointerup",Q,{capture:!0})}}},[C,z,ge]),y.useEffect(()=>{const q=()=>z(!1);return window.addEventListener("blur",q),window.addEventListener("resize",q),()=>{window.removeEventListener("blur",q),window.removeEventListener("resize",q)}},[z]);const[X,F]=C4(q=>{const O=$().filter(ve=>!ve.disabled),Q=O.find(ve=>ve.ref.current===document.activeElement),se=E4(O,q,Q);se&&setTimeout(()=>se.ref.current.focus())}),W=y.useCallback((q,O,Q)=>{const se=!me.current&&!Q;(T.value!==void 0&&T.value===O||se)&&(R(q),se&&(me.current=!0))},[T.value]),fe=y.useCallback(()=>C==null?void 0:C.focus(),[C]),he=y.useCallback((q,O,Q)=>{const se=!me.current&&!Q;(T.value!==void 0&&T.value===O||se)&&re(q)},[T.value]),oe=r==="popper"?R0:h4,D=oe===R0?{side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:b,sticky:N,hideWhenDetached:j,avoidCollisions:v}:{};return s.jsx(d4,{scope:n,content:C,viewport:L,onViewportChange:U,itemRefCallback:W,selectedItem:H,onItemLeave:fe,itemTextRefCallback:he,focusSelectedItem:J,selectedItemText:Z,position:r,isPositioned:ie,searchRef:X,children:s.jsx(Q0,{as:j9,allowPinchZoom:!0,children:s.jsx(G0,{asChild:!0,trapped:T.open,onMountAutoFocus:q=>{q.preventDefault()},onUnmountAutoFocus:St(a,q=>{var O;(O=T.trigger)==null||O.focus({preventScroll:!0}),q.preventDefault()}),children:s.jsx(q0,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:q=>q.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:s.jsx(oe,{role:"listbox",id:T.contentId,"data-state":T.open?"open":"closed",dir:T.dir,onContextMenu:q=>q.preventDefault(),...k,...D,onPlaced:()=>ce(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:St(k.onKeyDown,q=>{const O=q.ctrlKey||q.altKey||q.metaKey;if(q.key==="Tab"&&q.preventDefault(),!O&&q.key.length===1&&F(q.key),["ArrowUp","ArrowDown","Home","End"].includes(q.key)){let se=$().filter(ve=>!ve.disabled).map(ve=>ve.ref.current);if(["ArrowUp","End"].includes(q.key)&&(se=se.slice().reverse()),["ArrowUp","ArrowDown"].includes(q.key)){const ve=q.target,ze=se.indexOf(ve);se=se.slice(ze+1)}setTimeout(()=>I(se)),q.preventDefault()}})})})})})})});u4.displayName=w9;var k9="SelectItemAlignedPosition",h4=y.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...a}=t,i=Bo(Gl,n),o=Vo(Gl,n),[c,u]=y.useState(null),[h,f]=y.useState(null),m=Gt(e,_=>f(_)),g=em(n),b=y.useRef(!1),N=y.useRef(!0),{viewport:j,selectedItem:v,selectedItemText:k,focusSelectedItem:T}=o,C=y.useCallback(()=>{if(i.trigger&&i.valueNode&&c&&h&&j&&v&&k){const _=i.trigger.getBoundingClientRect(),H=h.getBoundingClientRect(),R=i.valueNode.getBoundingClientRect(),Z=k.getBoundingClientRect();if(i.dir!=="rtl"){const ve=Z.left-H.left,ze=R.left-ve,Ue=_.left-ze,jt=_.width+Ue,Nn=Math.max(jt,H.width),pt=window.innerWidth-da,It=Tf(ze,[da,Math.max(da,pt-Nn)]);c.style.minWidth=jt+"px",c.style.left=It+"px"}else{const ve=H.right-Z.right,ze=window.innerWidth-R.right-ve,Ue=window.innerWidth-_.right-ze,jt=_.width+Ue,Nn=Math.max(jt,H.width),pt=window.innerWidth-da,It=Tf(ze,[da,Math.max(da,pt-Nn)]);c.style.minWidth=jt+"px",c.style.right=It+"px"}const re=g(),$=window.innerHeight-da*2,ie=j.scrollHeight,ce=window.getComputedStyle(h),me=parseInt(ce.borderTopWidth,10),I=parseInt(ce.paddingTop,10),J=parseInt(ce.borderBottomWidth,10),z=parseInt(ce.paddingBottom,10),ge=me+I+ie+z+J,X=Math.min(v.offsetHeight*5,ge),F=window.getComputedStyle(j),W=parseInt(F.paddingTop,10),fe=parseInt(F.paddingBottom,10),he=_.top+_.height/2-da,oe=$-he,D=v.offsetHeight/2,q=v.offsetTop+D,O=me+I+q,Q=ge-O;if(O<=he){const ve=re.length>0&&v===re[re.length-1].ref.current;c.style.bottom="0px";const ze=h.clientHeight-j.offsetTop-j.offsetHeight,Ue=Math.max(oe,D+(ve?fe:0)+ze+J),jt=O+Ue;c.style.height=jt+"px"}else{const ve=re.length>0&&v===re[0].ref.current;c.style.top="0px";const Ue=Math.max(he,me+j.offsetTop+(ve?W:0)+D)+Q;c.style.height=Ue+"px",j.scrollTop=O-he+j.offsetTop}c.style.margin=`${da}px 0`,c.style.minHeight=X+"px",c.style.maxHeight=$+"px",r==null||r(),requestAnimationFrame(()=>b.current=!0)}},[g,i.trigger,i.valueNode,c,h,j,v,k,i.dir,r]);Is(()=>C(),[C]);const[P,L]=y.useState();Is(()=>{h&&L(window.getComputedStyle(h).zIndex)},[h]);const U=y.useCallback(_=>{_&&N.current===!0&&(C(),T==null||T(),N.current=!1)},[C,T]);return s.jsx(C9,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:b,onScrollButtonChange:U,children:s.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:P},children:s.jsx(Mt.div,{...a,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});h4.displayName=k9;var S9="SelectPopperPosition",R0=y.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=da,...i}=t,o=tm(n);return s.jsx(d9,{...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)"}})});R0.displayName=S9;var[C9,sb]=cd(Gl,{}),L0="SelectViewport",f4=y.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...a}=t,i=Vo(L0,n),o=sb(L0,n),c=Gt(e,i.onViewportChange),u=y.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(Zp.Slot,{scope:n,children:s.jsx(Mt.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:St(a.onScroll,h=>{const f=h.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:g}=o;if(g!=null&&g.current&&m){const b=Math.abs(u.current-f.scrollTop);if(b>0){const N=window.innerHeight-da*2,j=parseFloat(m.style.minHeight),v=parseFloat(m.style.height),k=Math.max(j,v);if(k0?P:0,m.style.justifyContent="flex-end")}}}u.current=f.scrollTop})})})]})});f4.displayName=L0;var p4="SelectGroup",[E9,T9]=cd(p4),M9=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=jo();return s.jsx(E9,{scope:n,id:a,children:s.jsx(Mt.div,{role:"group","aria-labelledby":a,...r,ref:e})})});M9.displayName=p4;var m4="SelectLabel",A9=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=T9(m4,n);return s.jsx(Mt.div,{id:a.id,...r,ref:e})});A9.displayName=m4;var wp="SelectItem",[I9,g4]=cd(wp),x4=y.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:i,...o}=t,c=Bo(wp,n),u=Vo(wp,n),h=c.value===r,[f,m]=y.useState(i??""),[g,b]=y.useState(!1),N=Gt(e,T=>{var C;return(C=u.itemRefCallback)==null?void 0:C.call(u,T,r,a)}),j=jo(),v=y.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(I9,{scope:n,value:r,disabled:a,textId:j,isSelected:h,onItemTextChange:y.useCallback(T=>{m(C=>C||((T==null?void 0:T.textContent)??"").trim())},[]),children:s.jsx(Zp.ItemSlot,{scope:n,value:r,disabled:a,textValue:f,children:s.jsx(Mt.div,{role:"option","aria-labelledby":j,"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:N,onFocus:St(o.onFocus,()=>b(!0)),onBlur:St(o.onBlur,()=>b(!1)),onClick:St(o.onClick,()=>{v.current!=="mouse"&&k()}),onPointerUp:St(o.onPointerUp,()=>{v.current==="mouse"&&k()}),onPointerDown:St(o.onPointerDown,T=>{v.current=T.pointerType}),onPointerMove:St(o.onPointerMove,T=>{var C;v.current=T.pointerType,a?(C=u.onItemLeave)==null||C.call(u):v.current==="mouse"&&T.currentTarget.focus({preventScroll:!0})}),onPointerLeave:St(o.onPointerLeave,T=>{var C;T.currentTarget===document.activeElement&&((C=u.onItemLeave)==null||C.call(u))}),onKeyDown:St(o.onKeyDown,T=>{var P;((P=u.searchRef)==null?void 0:P.current)!==""&&T.key===" "||(m9.includes(T.key)&&k(),T.key===" "&&T.preventDefault())})})})})});x4.displayName=wp;var eu="SelectItemText",y4=y.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,...i}=t,o=Bo(eu,n),c=Vo(eu,n),u=g4(eu,n),h=b9(eu,n),[f,m]=y.useState(null),g=Gt(e,k=>m(k),u.onItemTextChange,k=>{var T;return(T=c.itemTextRefCallback)==null?void 0:T.call(c,k,u.value,u.disabled)}),b=f==null?void 0:f.textContent,N=y.useMemo(()=>s.jsx("option",{value:u.value,disabled:u.disabled,children:b},u.value),[u.disabled,u.value,b]),{onNativeOptionAdd:j,onNativeOptionRemove:v}=h;return Is(()=>(j(N),()=>v(N)),[j,v,N]),s.jsxs(s.Fragment,{children:[s.jsx(Mt.span,{id:u.textId,...i,ref:g}),u.isSelected&&o.valueNode&&!o.valueNodeHasChildren?ed.createPortal(i.children,o.valueNode):null]})});y4.displayName=eu;var b4="SelectItemIndicator",v4=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return g4(b4,n).isSelected?s.jsx(Mt.span,{"aria-hidden":!0,...r,ref:e}):null});v4.displayName=b4;var O0="SelectScrollUpButton",N4=y.forwardRef((t,e)=>{const n=Vo(O0,t.__scopeSelect),r=sb(O0,t.__scopeSelect),[a,i]=y.useState(!1),o=Gt(e,r.onScrollButtonChange);return Is(()=>{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(j4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});N4.displayName=O0;var D0="SelectScrollDownButton",w4=y.forwardRef((t,e)=>{const n=Vo(D0,t.__scopeSelect),r=sb(D0,t.__scopeSelect),[a,i]=y.useState(!1),o=Gt(e,r.onScrollButtonChange);return Is(()=>{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(j4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});w4.displayName=D0;var j4=y.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=t,i=Vo("SelectScrollButton",n),o=y.useRef(null),c=em(n),u=y.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return y.useEffect(()=>()=>u(),[u]),Is(()=>{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(Mt.div,{"aria-hidden":!0,...a,ref:e,style:{flexShrink:0,...a.style},onPointerDown:St(a.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:St(a.onPointerMove,()=>{var h;(h=i.onItemLeave)==null||h.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:St(a.onPointerLeave,()=>{u()})})}),P9="SelectSeparator",R9=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return s.jsx(Mt.div,{"aria-hidden":!0,...r,ref:e})});R9.displayName=P9;var _0="SelectArrow",L9=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=tm(n),i=Bo(_0,n),o=Vo(_0,n);return i.open&&o.position==="popper"?s.jsx(u9,{...a,...r,ref:e}):null});L9.displayName=_0;var O9="SelectBubbleInput",k4=y.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const a=y.useRef(null),i=Gt(r,a),o=ny(e);return y.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(Mt.select,{...n,style:{...t4,...n.style},ref:i,defaultValue:e})});k4.displayName=O9;function S4(t){return t===""||t===void 0}function C4(t){const e=Ao(t),n=y.useRef(""),r=y.useRef(0),a=y.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=y.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,i]}function E4(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=D9(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 D9(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var _9=n4,T4=r4,$9=i4,z9=o4,F9=l4,M4=c4,B9=f4,A4=x4,V9=y4,H9=v4,U9=N4,W9=w4;const Pc=_9,Rc=$9,yl=y.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(T4,{ref:r,className:Ot("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(z9,{asChild:!0,children:s.jsx(Il,{className:"h-4 w-4 opacity-50"})})]}));yl.displayName=T4.displayName;const bl=y.forwardRef(({className:t,children:e,position:n="popper",...r},a)=>s.jsx(F9,{children:s.jsxs(M4,{ref:a,className:Ot("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-[#0b1828] border-gray-700 text-white shadow-lg",n==="popper"&&"data-[side=bottom]:translate-y-1",t),position:n,...r,children:[s.jsx(U9,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(Px,{className:"h-4 w-4"})}),s.jsx(B9,{className:"p-1",children:e}),s.jsx(W9,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(Il,{className:"h-4 w-4"})})]})}));bl.displayName=M4.displayName;const or=y.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(A4,{ref:r,className:Ot("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(H9,{children:s.jsx(Sp,{className:"h-4 w-4"})})}),s.jsx(V9,{children:e})]}));or.displayName=A4.displayName;const uj=["📖","📕","📗","📘","📙","📓","📔","📒","📚","📖"];function K9(t){return t.title==="序言"||t.title.includes("序言")}function hj(t){const e=[];for(const n of t.chapters)for(const r of n.sections)e.push(r.id);return e.length===0?"暂无章节":e.length===1?e[0]:`${e[0]}~${e[e.length-1]}`}function Sx(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 q9({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:b,onShowSectionOrders:N,pinnedSectionIds:j=[]}){const[v,k]=y.useState(null),[T,C]=y.useState(null),P=($,ie)=>(v==null?void 0:v.type)===$&&(v==null?void 0:v.id)===ie,L=($,ie)=>(T==null?void 0:T.type)===$&&(T==null?void 0:T.id)===ie,U=y.useCallback(()=>{const $=[];for(const ie of t)for(const ce of ie.chapters)for(const me of ce.sections)$.push({id:me.id,partId:ie.id,partTitle:ie.title,chapterId:ce.id,chapterTitle:ce.title});return $},[t]),_=y.useCallback(async($,ie,ce,me)=>{var X;$.preventDefault(),$.stopPropagation();const I=$.dataTransfer.getData("text/plain"),J=Sx(I);if(!J||J.type===ie&&J.id===ce)return;const z=U(),ge=new Map(z.map(F=>[F.id,F]));if(J.type==="part"&&ie==="part"){const F=t.map(D=>D.id),W=F.indexOf(J.id),fe=F.indexOf(ce);if(W===-1||fe===-1)return;const he=[...F];he.splice(W,1),he.splice(WO.id===D);if(q)for(const O of q.chapters)for(const Q of O.sections){const se=ge.get(Q.id);se&&oe.push(se)}}await r(oe);return}if(J.type==="chapter"&&(ie==="chapter"||ie==="section"||ie==="part")){const F=t.find(se=>se.chapters.some(ve=>ve.id===J.id)),W=F==null?void 0:F.chapters.find(se=>se.id===J.id);if(!F||!W)return;let fe,he,oe=null;if(ie==="section"){const se=ge.get(ce);if(!se)return;fe=se.partId,he=se.partTitle,oe=ce}else if(ie==="chapter"){const se=t.find(Ue=>Ue.chapters.some(jt=>jt.id===ce)),ve=se==null?void 0:se.chapters.find(Ue=>Ue.id===ce);if(!se||!ve)return;fe=se.id,he=se.title;const ze=z.filter(Ue=>Ue.chapterId===ce).pop();oe=(ze==null?void 0:ze.id)??null}else{const se=t.find(ve=>ve.id===ce);if(!se)return;if(fe=se.id,he=se.title,se.chapters[0]){const ve=z.filter(ze=>ze.partId===se.id&&ze.chapterId===se.chapters[0].id);oe=((X=ve[ve.length-1])==null?void 0:X.id)??null}}const D=W.sections.map(se=>se.id),q=z.filter(se=>!D.includes(se.id));let O=q.length;if(oe){const se=q.findIndex(ve=>ve.id===oe);se>=0&&(O=se+1)}const Q=D.map(se=>({...ge.get(se),partId:fe,partTitle:he,chapterId:W.id,chapterTitle:W.title}));await r([...q.slice(0,O),...Q,...q.slice(O)]);return}if(J.type==="section"&&(ie==="section"||ie==="chapter"||ie==="part")){if(!me)return;const{partId:F,partTitle:W,chapterId:fe,chapterTitle:he}=me,oe=z.findIndex(se=>se.id===J.id);if(oe===-1)return;const D=z.filter(se=>se.id!==J.id);let q;if(ie==="section"){const se=D.findIndex(ve=>ve.id===ce);q=se>=0?se+1:D.length}else if(ie==="chapter"){const se=D.filter(ve=>ve.chapterId===ce).pop();q=se?D.findIndex(ve=>ve.id===se.id)+1:D.length}else{const se=t.find(ve=>ve.id===ce);if(se!=null&&se.chapters[0]){const ve=D.filter(Ue=>Ue.partId===se.id&&Ue.chapterId===se.chapters[0].id),ze=ve[ve.length-1];q=ze?D.findIndex(Ue=>Ue.id===ze.id)+1:D.length}else q=D.length}const Q={...z[oe],partId:F,partTitle:W,chapterId:fe,chapterTitle:he};D.splice(q,0,Q),await r(D)}},[t,U,r]),H=($,ie,ce)=>({onDragEnter:me=>{me.preventDefault(),me.stopPropagation(),me.dataTransfer.dropEffect="move",C({type:$,id:ie})},onDragOver:me=>{me.preventDefault(),me.stopPropagation(),me.dataTransfer.dropEffect="move",C({type:$,id:ie})},onDragLeave:()=>C(null),onDrop:me=>{C(null);const I=Sx(me.dataTransfer.getData("text/plain"));I&&($==="section"&&I.type==="section"&&I.id===ie||($==="part"?I.type==="part"?_(me,"part",ie):ce&&_(me,"part",ie,ce):$==="chapter"&&ce?(I.type==="section"||I.type==="chapter")&&_(me,"chapter",ie,ce):$==="section"&&ce&&_(me,"section",ie,ce)))}}),R=$=>uj[$%uj.length],Z=$=>t.slice(0,$).filter(ie=>!K9(ie)).length,re=$=>s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-gray-500 font-mono text-xs tabular-nums shrink-0 mr-1.5 max-w-[72px] truncate",title:`章节ID: ${$.id}`,children:$.id}),s.jsx("span",{className:"truncate",children:$.title})]});return s.jsx("div",{className:"space-y-3",children:t.map(($,ie)=>{var W,fe,he,oe;const ce=$.title==="序言"||$.title.includes("序言"),me=$.title==="尾声"||$.title.includes("尾声"),I=$.title==="附录"||$.title.includes("附录"),J=L("part",$.id),z=e.includes($.id),ge=$.chapters.length,X=$.chapters.reduce((D,q)=>D+q.sections.length,0);if(ce&&$.chapters.length===1&&$.chapters[0].sections.length===1){const D=$.chapters[0].sections[0],q=L("section",D.id),O={partId:$.id,partTitle:$.title,chapterId:$.chapters[0].id,chapterTitle:$.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:Q=>{Q.stopPropagation(),Q.dataTransfer.setData("text/plain","section:"+D.id),Q.dataTransfer.effectAllowed="move",k({type:"section",id:D.id})},onDragEnd:()=>{k(null),C(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${q?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${P("section",D.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...H("section",D.id,O),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(pi,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:Q=>Q.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(D.id),onChange:()=>b(D.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(dr,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[$.chapters[0].title," | ",D.title]}),j.includes(D.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(Dc,{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:[D.price===0||D.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:["¥",D.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",D.clickCount??0," · 付款 ",D.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(D.hotScore??0).toFixed(1)," · 第",D.hotRank&&D.hotRank>0?D.hotRank:"-","名"]}),N&&s.jsx(G,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>N(D),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(G,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(D),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(tn,{className:"w-3.5 h-3.5"})}),s.jsx(G,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(D),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(ls,{className:"w-3.5 h-3.5"})})]})]})]},$.id)}if($.title==="2026每日派对干货"||$.title.includes("2026每日派对干货")){const D=L("part",$.id);return s.jsxs("div",{className:`rounded-xl border overflow-hidden transition-all duration-200 ${D?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50 bg-[#1C1C1E]"}`,...H("part",$.id,{partId:$.id,partTitle:$.title,chapterId:((W=$.chapters[0])==null?void 0:W.id)??"",chapterTitle:((fe=$.chapters[0])==null?void 0:fe.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:q=>{q.stopPropagation(),q.dataTransfer.setData("text/plain","part:"+$.id),q.dataTransfer.effectAllowed="move",k({type:"part",id:$.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${P("part",$.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/50"}`,children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(pi,{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:$.badgeText||"派"}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:$.title}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:hj($)})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:q=>q.stopPropagation(),onClick:q=>q.stopPropagation(),children:[o&&s.jsx(G,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o($),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx($n,{className:"w-3.5 h-3.5"})}),h&&s.jsx(G,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h($),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx(tn,{className:"w-3.5 h-3.5"})}),f&&s.jsx(G,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f($),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(ls,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",title:"本篇章数与节数",children:[ge," 章 · ",X," 节"]}),s.jsx("button",{type:"button",draggable:!1,className:"p-1 rounded-md hover:bg-white/10 text-gray-500",title:z?"收起":"展开",onMouseDown:q=>q.stopPropagation(),onClick:q=>{q.stopPropagation(),n($.id)},children:z?s.jsx(Il,{className:"w-5 h-5"}):s.jsx(vl,{className:"w-5 h-5"})})]})]}),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:$.chapters.map(q=>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:q.title}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:O=>O.stopPropagation(),children:[m&&s.jsx(G,{variant:"ghost",size:"sm",onClick:()=>m($,q),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(tn,{className:"w-3.5 h-3.5"})}),c&&s.jsx(G,{variant:"ghost",size:"sm",onClick:()=>c($),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx($n,{className:"w-3.5 h-3.5"})}),u&&s.jsx(G,{variant:"ghost",size:"sm",onClick:()=>u($,q),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(ls,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:q.sections.map(O=>{const Q=L("section",O.id);return s.jsxs("div",{draggable:!0,onDragStart:se=>{se.stopPropagation(),se.dataTransfer.setData("text/plain","section:"+O.id),se.dataTransfer.effectAllowed="move",k({type:"section",id:O.id})},onDragEnd:()=>{k(null),C(null)},onClick:()=>a(O),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"} ${P("section",O.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...H("section",O.id,{partId:$.id,partTitle:$.title,chapterId:q.id,chapterTitle:q.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(pi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:se=>se.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(O.id),onChange:()=>b(O.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx("span",{className:"text-sm text-gray-200 truncate flex items-center min-w-0",children:re(O)}),j.includes(O.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(Dc,{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:["点击 ",O.clickCount??0," · 付款 ",O.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(O.hotScore??0).toFixed(1)," · 第",O.hotRank&&O.hotRank>0?O.hotRank:"-","名"]}),N&&s.jsx(G,{variant:"ghost",size:"sm",onClick:()=>N(O),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsx(G,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(O),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(tn,{className:"w-3.5 h-3.5"})}),s.jsx(G,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(O),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(ls,{className:"w-3.5 h-3.5"})})]})]},O.id)})})]},q.id))})]},$.id)}if(I)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:$.chapters.map((D,q)=>D.sections.length>0?D.sections.map(O=>{const Q=L("section",O.id);return s.jsxs("div",{draggable:!0,onDragStart:se=>{se.stopPropagation(),se.dataTransfer.setData("text/plain","section:"+O.id),se.dataTransfer.effectAllowed="move",k({type:"section",id:O.id})},onDragEnd:()=>{k(null),C(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 group cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${Q?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${P("section",O.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...H("section",O.id,{partId:$.id,partTitle:$.title,chapterId:D.id,chapterTitle:D.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(pi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:se=>se.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(O.id),onChange:()=>b(O.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:["附录",q+1," | ",D.title," | ",O.title]}),j.includes(O.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(Dc,{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:["点击 ",O.clickCount??0," · 付款 ",O.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(O.hotScore??0).toFixed(1)," · 第",O.hotRank&&O.hotRank>0?O.hotRank:"-","名"]}),N&&s.jsx(G,{variant:"ghost",size:"sm",onClick:()=>N(O),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(G,{variant:"ghost",size:"sm",onClick:()=>a(O),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(tn,{className:"w-3.5 h-3.5"})}),s.jsx(G,{variant:"ghost",size:"sm",onClick:()=>i(O),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(ls,{className:"w-3.5 h-3.5"})})]})]}),s.jsx(vl,{className:"w-4 h-4 text-gray-500 shrink-0"})]},O.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:["附录",q+1," | ",D.title,"(空)"]}),s.jsx(vl,{className:"w-4 h-4 text-gray-500 shrink-0"})]},D.id))})]},$.id);if(me&&$.chapters.length===1&&$.chapters[0].sections.length===1){const D=$.chapters[0].sections[0],q=L("section",D.id),O={partId:$.id,partTitle:$.title,chapterId:$.chapters[0].id,chapterTitle:$.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:Q=>{Q.stopPropagation(),Q.dataTransfer.setData("text/plain","section:"+D.id),Q.dataTransfer.effectAllowed="move",k({type:"section",id:D.id})},onDragEnd:()=>{k(null),C(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${q?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${P("section",D.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...H("section",D.id,O),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(pi,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:Q=>Q.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(D.id),onChange:()=>b(D.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(dr,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[$.chapters[0].title," | ",D.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:Q=>Q.stopPropagation(),onClick:Q=>Q.stopPropagation(),children:[D.price===0||D.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:["¥",D.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",D.clickCount??0," · 付款 ",D.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(D.hotScore??0).toFixed(1)," · 第",D.hotRank&&D.hotRank>0?D.hotRank:"-","名"]}),N&&s.jsx(G,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>N(D),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(G,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(D),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(tn,{className:"w-3.5 h-3.5"})}),s.jsx(G,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(D),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(ls,{className:"w-3.5 h-3.5"})})]})]})]},$.id)}return me?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:$.chapters.map(D=>D.sections.map(q=>{const O=L("section",q.id);return s.jsxs("div",{draggable:!0,onDragStart:Q=>{Q.stopPropagation(),Q.dataTransfer.setData("text/plain","section:"+q.id),Q.dataTransfer.effectAllowed="move",k({type:"section",id:q.id})},onDragEnd:()=>{k(null),C(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${O?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${P("section",q.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...H("section",q.id,{partId:$.id,partTitle:$.title,chapterId:D.id,chapterTitle:D.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(pi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:Q=>Q.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(q.id),onChange:()=>b(q.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:[D.title," | ",q.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",q.clickCount??0," · 付款 ",q.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(q.hotScore??0).toFixed(1)," · 第",q.hotRank&&q.hotRank>0?q.hotRank:"-","名"]}),N&&s.jsx(G,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>N(q),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(G,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(q),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(tn,{className:"w-3.5 h-3.5"})}),s.jsx(G,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(q),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(ls,{className:"w-3.5 h-3.5"})})]})]})]},q.id)}))})]},$.id):s.jsxs("div",{className:`rounded-xl border bg-[#1C1C1E] overflow-hidden transition-all duration-200 ${J?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50"}`,...H("part",$.id,{partId:$.id,partTitle:$.title,chapterId:((he=$.chapters[0])==null?void 0:he.id)??"",chapterTitle:((oe=$.chapters[0])==null?void 0:oe.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:D=>{D.stopPropagation(),D.dataTransfer.setData("text/plain","part:"+$.id),D.dataTransfer.effectAllowed="move",k({type:"part",id:$.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${P("part",$.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] rounded-xl shadow-xl shadow-[#38bdac]/20":"hover:bg-[#162840]/50"}`,children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(pi,{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-lg shadow-lg shadow-[#38bdac]/30 shrink-0",children:$.badgeText||R(Z(ie))}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:$.title}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:hj($)})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:D=>D.stopPropagation(),onClick:D=>D.stopPropagation(),children:[o&&s.jsx(G,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o($),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx($n,{className:"w-3.5 h-3.5"})}),h&&s.jsx(G,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h($),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx(tn,{className:"w-3.5 h-3.5"})}),f&&s.jsx(G,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f($),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(ls,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",title:"本篇章数与节数",children:[ge," 章 · ",X," 节"]}),s.jsx("button",{type:"button",draggable:!1,className:"p-1 rounded-md hover:bg-white/10 text-gray-500",title:z?"收起":"展开",onMouseDown:D=>D.stopPropagation(),onClick:D=>{D.stopPropagation(),n($.id)},children:z?s.jsx(Il,{className:"w-5 h-5"}):s.jsx(vl,{className:"w-5 h-5"})})]})]}),z&&s.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:$.chapters.map(D=>{const q=L("chapter",D.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:O=>{O.stopPropagation(),O.dataTransfer.setData("text/plain","chapter:"+D.id),O.dataTransfer.effectAllowed="move",k({type:"chapter",id:D.id})},onDragEnd:()=>{k(null),C(null)},onDragEnter:O=>{O.preventDefault(),O.stopPropagation(),O.dataTransfer.dropEffect="move",C({type:"chapter",id:D.id})},onDragOver:O=>{O.preventDefault(),O.stopPropagation(),O.dataTransfer.dropEffect="move",C({type:"chapter",id:D.id})},onDragLeave:()=>C(null),onDrop:O=>{C(null);const Q=Sx(O.dataTransfer.getData("text/plain"));if(!Q)return;const se={partId:$.id,partTitle:$.title,chapterId:D.id,chapterTitle:D.title};(Q.type==="section"||Q.type==="chapter")&&_(O,"chapter",D.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 ${q?"bg-[#38bdac]/15 ring-1 ring-[#38bdac]/50":""} ${P("chapter",D.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/30"}`,children:[s.jsx(pi,{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:D.title})]}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:O=>O.stopPropagation(),children:[m&&s.jsx(G,{variant:"ghost",size:"sm",onClick:()=>m($,D),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(tn,{className:"w-3.5 h-3.5"})}),c&&s.jsx(G,{variant:"ghost",size:"sm",onClick:()=>c($),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx($n,{className:"w-3.5 h-3.5"})}),u&&s.jsx(G,{variant:"ghost",size:"sm",onClick:()=>u($,D),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(ls,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:D.sections.map(O=>{const Q=L("section",O.id);return s.jsxs("div",{draggable:!0,onDragStart:se=>{se.stopPropagation(),se.dataTransfer.setData("text/plain","section:"+O.id),se.dataTransfer.effectAllowed="move",k({type:"section",id:O.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between py-2 px-3 rounded-lg group cursor-grab active:cursor-grabbing select-none min-h-[40px] transition-all duration-200 ${Q?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${P("section",O.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] shadow-lg":"hover:bg-[#162840]/50"}`,...H("section",O.id,{partId:$.id,partTitle:$.title,chapterId:D.id,chapterTitle:D.title}),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:se=>se.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(O.id),onChange:()=>b(O.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx(pi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),s.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${O.price===0||O.isFree?"border-2 border-[#38bdac] bg-transparent":"bg-gray-500"}`}),s.jsx("span",{className:"text-sm text-gray-200 truncate flex items-center min-w-0",children:re(O)}),j.includes(O.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(Dc,{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:[O.isNew&&s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"NEW"}),O.price===0||O.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:["¥",O.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",title:"点击次数 · 付款笔数",children:["点击 ",O.clickCount??0," · 付款 ",O.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(O.hotScore??0).toFixed(1)," · 第",O.hotRank&&O.hotRank>0?O.hotRank:"-","名"]}),N&&s.jsx(G,{variant:"ghost",size:"sm",onClick:()=>N(O),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(G,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(O),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(tn,{className:"w-3.5 h-3.5"})}),s.jsx(G,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(O),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(ls,{className:"w-3.5 h-3.5"})})]})]})]},O.id)})})]},D.id)})})]},$.id)})})}function G9(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 Oe(r)}function J9(t){return Oe(`/api/db/person?personId=${encodeURIComponent(t)}`)}function Q9(t){var r;const e=new URLSearchParams;e.set("page",String(t.page)),e.set("limit",String(t.limit)),(r=t==null?void 0:t.keyword)!=null&&r.trim()&&e.set("keyword",t.keyword.trim());const n=e.toString();return Oe(n?`/api/admin/ckb/plans?${n}`:"/api/admin/ckb/plans")}const Y9=10;function I4(t){const e=(t??"").trim();if(!e)return"";if(/^https?:\/\//i.test(e))return pa(e);const n=e.startsWith("/")?e:`/${e}`;return pa(Rl(n))}function X9(t){const{nickname:e,avatar:n}=t,r=I4(n);return s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"h-8 w-8 shrink-0 overflow-hidden rounded-full bg-gray-800",children:r?s.jsx("img",{src:r,alt:"",className:"h-full w-full object-cover",onError:a=>{a.currentTarget.style.display="none"}}):s.jsx("span",{className:"flex h-full w-full items-center justify-center text-[10px] text-gray-500",children:e.slice(0,1)})}),s.jsx("span",{className:"min-w-0 truncate text-left font-medium text-white",children:e})]})}function Z9(t,e){const n=new Set(t.map(a=>a.id).filter(Boolean)),r=[...t];for(const a of e){const i=a.id;i&&!n.has(i)&&(n.add(i),r.push(a))}return r}function eV({id:t,label:e,value:n,preview:r,previewLoading:a=!1,onSelect:i,onClear:o,containerOpen:c,disabled:u=!1,hint:h,className:f,portalMountRef:m,positionContainerRef:g}){const[b,N]=y.useState(!1),[j,v]=y.useState(""),k=_l(j,300),[T,C]=y.useState([]),[P,L]=y.useState(!1),[U,_]=y.useState(!1),[H,R]=y.useState(0),Z=y.useRef(1),re=y.useRef(!1),$=y.useRef(!1),ie=y.useRef(null),ce=y.useRef(null),[me,I]=y.useState({top:0,left:0,width:320,maxH:360}),J=y.useCallback(()=>{const D=ce.current;if(!D||typeof window>"u")return;const q=D.getBoundingClientRect(),O=Math.min(400,Math.max(200,window.innerHeight-q.bottom-16)),Q=g==null?void 0:g.current;if(Q){const se=Q.getBoundingClientRect();I({top:q.bottom-se.top+6,left:q.left-se.left,width:Math.max(q.width,300),maxH:O})}else I({top:q.bottom+6,left:q.left,width:Math.max(q.width,300),maxH:O})},[g]);y.useEffect(()=>{c||(N(!1),v(""))},[c]),y.useLayoutEffect(()=>{if(b)return J(),window.addEventListener("scroll",J,!0),window.addEventListener("resize",J),()=>{window.removeEventListener("scroll",J,!0),window.removeEventListener("resize",J)}},[b,J]);const z=y.useCallback(async(D,q,O)=>{if(!re.current){re.current=!0,O?_(!0):L(!0);try{const Q=new URLSearchParams({page:String(D),pageSize:String(Y9),search:q.trim()}),se=await Oe(`/api/db/users?${Q}`);if(se!=null&&se.success&&Array.isArray(se.users)){const ve=se.users,ze=typeof se.total=="number"?se.total:0;R(ze),O?ve.length===0?$.current=!0:C(Ue=>{const jt=Z9(Ue,ve);return jt.length===Ue.length?$.current=!0:Z.current=D,jt}):(C(ve),Z.current=D)}else se!=null&&se.error&&Y.error(se.error)}catch(Q){Y.error(Q instanceof Error?Q.message:"加载用户列表失败")}finally{re.current=!1,L(!1),_(!1)}}},[]);y.useEffect(()=>{b&&(Z.current=1,$.current=!1,z(1,k,!1))},[b,k,z]);const ge=y.useCallback(()=>{P||U||re.current||$.current||H>0&&T.length>=H||z(Z.current+1,k,!0)},[k,z,P,U,H,T.length]);y.useLayoutEffect(()=>{if(!b||P||U||$.current||H>0&&T.length>=H||T.length===0)return;const D=ie.current;D&&(D.scrollHeight>D.clientHeight+12||ge())},[b,T.length,P,U,H,ge]);const X=D=>{(D.id||"").trim()&&(i(D),N(!1),v(""))},F=D=>{D.preventDefault(),D.stopPropagation(),!(u||a)&&o()},W=!!n.trim(),fe=H>0,he=typeof document>"u"?null:(m==null?void 0:m.current)??document.body,oe=b&&he&&ed.createPortal(s.jsxs("div",{"data-member-user-select-portal":"",children:[s.jsx("div",{className:"fixed inset-0 z-40 bg-transparent","aria-hidden":!0,onMouseDown:D=>{D.preventDefault(),N(!1)}}),s.jsxs("div",{role:"listbox",className:"fixed z-50 overflow-hidden rounded-lg border border-gray-700 bg-[#0b1828] shadow-xl",style:{top:me.top,left:me.left,width:me.width,height:me.maxH,maxHeight:me.maxH,display:"grid",gridTemplateRows:fe?"auto auto minmax(0, 1fr) auto":"auto minmax(0, 1fr) auto"},children:[s.jsx("div",{className:"border-b border-gray-700/60 p-2 min-h-0",children:s.jsx(de,{className:"bg-[#050c18] border-gray-700 text-white h-9 text-sm",placeholder:"搜索昵称、手机号、用户 id…",value:j,onChange:D=>v(D.target.value),onMouseDown:D=>D.stopPropagation(),autoFocus:!0})}),fe?s.jsxs("p",{className:"text-[11px] text-gray-500 px-3 pt-1.5 min-h-0 leading-snug",children:["已加载 ",T.length," / ",H," 条",T.length{const q=D.currentTarget;P||U||$.current||H>0&&T.length>=H||q.scrollHeight-q.scrollTop-q.clientHeight<100&&ge()},children:P&&T.length===0?s.jsx("div",{className:"flex h-40 items-center justify-center text-gray-400 text-sm",children:"正在加载…"}):T.length===0?s.jsx("div",{className:"flex h-40 items-center justify-center text-gray-500 text-sm px-3 text-center",children:"暂无用户,请调整搜索条件"}):s.jsxs("div",{className:"p-1.5 space-y-0.5",children:[T.map(D=>{const q=D.id||"",O=n===q,Q=I4(D.avatar),se=D.nickname&&String(D.nickname).trim()||"(无昵称)";return s.jsxs("button",{type:"button",role:"option","aria-selected":O,className:Ot("flex w-full items-center gap-2 rounded-md border px-2.5 py-2 text-left text-sm transition-colors",O?"border-[#38bdac] bg-[#38bdac]/15 text-white":"border-transparent bg-[#050c18] hover:border-[#38bdac]/40 hover:bg-[#0a1628]"),onMouseDown:ve=>ve.preventDefault(),onClick:()=>X(D),children:[s.jsx("span",{className:"h-9 w-9 shrink-0 overflow-hidden rounded-full bg-gray-800",children:Q?s.jsx("img",{src:Q,alt:"",className:"h-full w-full object-cover",onError:ve=>{ve.currentTarget.style.display="none"}}):s.jsx("span",{className:"flex h-full w-full items-center justify-center text-[11px] text-gray-500",children:se.slice(0,1)})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"font-medium truncate",children:se}),s.jsxs("div",{className:"text-[11px] text-gray-500 font-mono truncate mt-0.5",children:[D.phone?`${D.phone} · `:"",q]})]})]},q)}),U&&s.jsx("div",{className:"py-2 text-center text-gray-500 text-xs",children:"加载更多…"})]})}),s.jsx("div",{className:"flex justify-end gap-2 border-t border-gray-700/60 px-2 py-1.5 min-h-0",children:s.jsx(G,{type:"button",variant:"ghost",size:"sm",className:"text-gray-400 h-8 text-xs",onMouseDown:D=>D.preventDefault(),onClick:()=>{o(),N(!1)},children:"清除绑定"})})]})]}),he);return s.jsxs("div",{className:Ot("space-y-1.5",f),children:[typeof e=="string"?s.jsx(ne,{htmlFor:t,className:"text-gray-400 text-xs",children:e}):e,s.jsxs("div",{className:"flex gap-2 items-stretch",children:[s.jsxs("button",{ref:ce,id:t,type:"button",disabled:u,"aria-haspopup":"listbox","aria-expanded":b,className:Ot("flex h-10 min-w-0 flex-1 items-center gap-2 rounded-md border bg-[#0a1628] px-3 text-left text-sm transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-[#38bdac]/50 focus-visible:ring-offset-0",u&&"cursor-not-allowed opacity-50",b?"border-[#38bdac] ring-1 ring-[#38bdac]/35":"border-gray-700 hover:border-gray-600"),onClick:()=>{u||(b||(v(""),J()),N(D=>!D))},children:[s.jsx("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate",children:a?s.jsx("span",{className:"text-gray-500",children:"正在加载已绑定用户…"}):W?s.jsx(X9,{nickname:(r==null?void 0:r.nickname)||n,avatar:r==null?void 0:r.avatar}):s.jsx("span",{className:"text-gray-500",children:"选择会员用户(可搜索,可不绑定)"})}),s.jsx(Il,{className:Ot("h-4 w-4 shrink-0 text-gray-400 transition-transform",b&&"rotate-180")})]}),W&&s.jsx(G,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0 border-gray-600 text-gray-400 hover:text-white",disabled:u||a,"aria-label":"清除已选用户",onClick:F,children:s.jsx(Yn,{className:"h-4 w-4"})})]}),h&&s.jsx("div",{className:"text-[11px] text-gray-500",children:h}),oe]})}const P4=11,fj={personId:"",name:"",boundUserId:"",aliases:"",label:"",sceneId:P4,ckbApiKey:"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:"phone",remarkFormat:"",addFriendInterval:1,startTime:"06:00",endTime:"22:00",deviceGroups:""};function tV({open:t,onOpenChange:e,editingPerson:n,onSubmit:r}){var q;const a=!!n,i=y.useRef(null),o=y.useRef(null),[c,u]=y.useState(fj),[h,f]=y.useState(!1),[m,g]=y.useState(!1),[b,N]=y.useState([]),[j,v]=y.useState(!1),[k,T]=y.useState(""),[C,P]=y.useState([]),[L,U]=y.useState(!1),[_,H]=y.useState(""),[R,Z]=y.useState(!1),[re,$]=y.useState(null),[ie,ce]=y.useState(!1),[me,I]=y.useState({}),[J,z]=y.useState({loading:!1,messages:[]}),ge=_l(c.name,400),X=_l(c.aliases,400);y.useEffect(()=>{if(!t){z({loading:!1,messages:[]});return}const O=ge.trim(),Q=X.trim();if(!O&&!Q){z({loading:!1,messages:[]});return}let se=!1;z(Ue=>({...Ue,loading:!0}));const ve=a?((n==null?void 0:n.personId)??"").trim():"",ze=new URLSearchParams;return O&&ze.set("name",ge.trim()),ze.set("aliases",X),ve&&ze.set("excludePersonId",ve),Oe(`/api/db/persons/check-unique?${ze.toString()}`).then(Ue=>{if(!se){if((Ue==null?void 0:Ue.success)===!1&&(Ue!=null&&Ue.error)){z({loading:!1,messages:[Ue.error]});return}if((Ue==null?void 0:Ue.ok)===!1&&Array.isArray(Ue.messages)&&Ue.messages.length>0){z({loading:!1,messages:Ue.messages});return}z({loading:!1,messages:[]})}}).catch(()=>{se||z({loading:!1,messages:[]})}),()=>{se=!0}},[t,ge,X,a,n==null?void 0:n.personId]),y.useEffect(()=>{if(t){if(T(""),$(null),ce(!1),n){u({personId:n.personId??n.name??"",name:n.name??"",boundUserId:n.userId??"",aliases:n.aliases??"",label:n.label??"",sceneId:P4,ckbApiKey:n.ckbApiKey??"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:n.remarkType??"phone",remarkFormat:n.remarkFormat??"",addFriendInterval:n.addFriendInterval??1,startTime:n.startTime??"06:00",endTime:n.endTime??"22:00",deviceGroups:n.deviceGroups??""});const O=(n.userId??"").trim();O&&(ce(!0),Oe(`/api/db/users?id=${encodeURIComponent(O)}`).then(Q=>{const se=Q==null?void 0:Q.user;se!=null&&se.id?$({id:se.id,nickname:se.nickname&&String(se.nickname).trim()||se.id,phone:se.phone,avatar:se.avatar??void 0}):$({id:O,nickname:O,phone:void 0,avatar:void 0})}).catch(()=>{$({id:O,nickname:O,phone:void 0,avatar:void 0})}).finally(()=>ce(!1)))}else u({...fj});I({}),b.length===0&&F(""),C.length===0&&W("")}},[t,n]);const F=async O=>{v(!0);try{const Q=await G9({page:1,limit:50,keyword:O});Q!=null&&Q.success&&Array.isArray(Q.devices)?N(Q.devices):Q!=null&&Q.error&&Y.error(Q.error)}catch(Q){Y.error(Q instanceof Error?Q.message:"加载设备列表失败")}finally{v(!1)}},W=async O=>{U(!0);try{const Q=await Q9({page:1,limit:100,keyword:O});Q!=null&&Q.success&&Array.isArray(Q.plans)?P(Q.plans):Q!=null&&Q.error&&Y.error(Q.error)}catch{Y.error("加载计划列表失败")}finally{U(!1)}},fe=()=>{u(O=>{const Q=(O.boundUserId||"").trim(),se={...O,boundUserId:""};return!a&&Q&&(O.personId||"").trim()===Q&&(se.personId=""),se}),$(null)},he=O=>{const Q=Array.isArray(O.deviceGroups)?O.deviceGroups.map(String).join(","):"";u(se=>({...se,ckbApiKey:O.apiKey||"",greeting:O.greeting||se.greeting,tips:O.tips||se.tips,remarkType:O.remarkType||se.remarkType,remarkFormat:O.remarkFormat||se.remarkFormat,addFriendInterval:O.addInterval||se.addFriendInterval,startTime:O.startTime||se.startTime,endTime:O.endTime||se.endTime,deviceGroups:Q||se.deviceGroups})),Z(!1),Y.success(`已选择计划「${O.name}」,参数已覆盖`)},oe=_.trim()?C.filter(O=>(O.name||"").includes(_.trim())||String(O.id).includes(_.trim())):C,D=async()=>{var ve;const O={};(!c.name||!String(c.name).trim())&&(O.name="请填写名称");const Q=c.addFriendInterval;if((typeof Q!="number"||Q<1)&&(O.addFriendInterval="添加间隔至少为 1 分钟"),(((ve=c.deviceGroups)==null?void 0:ve.split(",").map(ze=>ze.trim()).filter(Boolean))??[]).length===0&&(O.deviceGroups="请至少选择 1 台设备"),I(O),Object.keys(O).length>0){Y.error(O.name||O.addFriendInterval||O.deviceGroups||"请完善必填项");return}if(J.messages.length>0){Y.error(J.messages[0]??"名称或别名与他人重复");return}f(!0);try{await r(c),e(!1)}catch(ze){Y.error(ze instanceof Error?ze.message:"保存失败")}finally{f(!1)}};return s.jsx(Bt,{open:t,onOpenChange:e,children:s.jsxs($t,{ref:i,className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] flex min-h-0 flex-col gap-0 p-0",children:[s.jsxs("div",{ref:o,className:"relative flex min-h-0 flex-1 flex-col overflow-visible",children:[s.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pt-6",children:[s.jsxs(Vt,{children:[s.jsx(Ht,{className:"text-[#38bdac]",children:a?"编辑人物":"添加人物 — 存客宝 API 获客"}),s.jsx(Ef,{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(ne,{className:"text-gray-400 text-xs",children:["名称 ",s.jsx("span",{className:"text-red-400",children:"*"})]}),s.jsx(de,{className:`bg-[#0a1628] text-white ${me.name?"border-red-500 focus-visible:ring-red-500":J.messages.length>0?"border-amber-600 focus-visible:ring-amber-600/50":"border-gray-700"}`,placeholder:"如 卡若",value:c.name,onChange:O=>{u(Q=>({...Q,name:O.target.value})),me.name&&I(Q=>({...Q,name:void 0}))}}),me.name&&s.jsx("p",{className:"text-xs text-red-400",children:me.name})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"人物ID(可选)"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"自动生成",value:(c.boundUserId||"").trim()?c.boundUserId:c.personId,onChange:O=>u(Q=>({...Q,personId:O.target.value})),disabled:a||!!(c.boundUserId||"").trim()})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"标签(身份/角色)"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 超级个体",value:c.label,onChange:O=>u(Q=>({...Q,label:O.target.value}))})]}),s.jsx(eV,{className:"col-span-3",id:"person-bound-member-user",label:"绑定会员用户(可选,与「用户管理」中用户一致)",containerOpen:t,portalMountRef:o,positionContainerRef:i,value:c.boundUserId,preview:re,previewLoading:ie,onSelect:O=>{const Q=(O.id||"").trim();Q&&(u(se=>({...se,boundUserId:Q,...a?{}:{personId:Q}})),$({id:Q,nickname:O.nickname&&String(O.nickname).trim()||Q,phone:O.phone,avatar:O.avatar??void 0}))},onClear:fe,hint:s.jsx("span",{children:"单选;保存时后端校验用户是否存在。同一会员只能绑定一个 @人物;绑定后获客统计可与超级个体对齐。"})}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"别名(逗号分隔,@ 可匹配)"}),s.jsx(de,{className:`bg-[#0a1628] text-white ${J.messages.length>0?"border-amber-600 focus-visible:ring-amber-600/50":"border-gray-700"}`,placeholder:"如 卡卡, 若若",value:c.aliases,onChange:O=>u(Q=>({...Q,aliases:O.target.value}))})]}),s.jsx("div",{className:"col-span-3 space-y-1",children:J.loading?s.jsx("p",{className:"text-xs text-gray-500",children:"正在检测名称与别名是否与他人重复…"}):J.messages.length>0?s.jsx("div",{className:"rounded-md border border-amber-600/60 bg-amber-950/25 px-3 py-2 text-xs text-amber-200 space-y-1",children:J.messages.map((O,Q)=>s.jsx("p",{children:O},`${Q}-${O.slice(0,24)}`))}):null})]})]}),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 relative",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"选择存客宝获客计划"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("div",{className:"flex-1 flex items-center bg-[#0a1628] border border-gray-700 rounded-md px-3 py-2 cursor-pointer hover:border-[#38bdac]/60 text-sm",onClick:()=>Z(!R),children:c.ckbApiKey?s.jsx("span",{className:"text-white truncate",children:((q=C.find(O=>O.apiKey===c.ckbApiKey))==null?void 0:q.name)||`获客计划 (${c.ckbApiKey.slice(0,8)}…)`}):s.jsx("span",{className:"text-gray-500",children:"点击选择已有计划 / 新建时自动创建"})}),s.jsx(G,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-200 shrink-0",onClick:()=>{W(_),Z(!0)},disabled:L,children:L?"加载...":"刷新"})]}),R&&s.jsxs("div",{className:"absolute z-50 top-full left-0 right-0 mt-1 bg-[#0b1828] border border-gray-700 rounded-lg shadow-xl max-h-64 flex flex-col",children:[s.jsx("div",{className:"p-2 border-b border-gray-700/60",children:s.jsx(de,{className:"bg-[#050c18] border-gray-700 text-white h-8 text-xs",placeholder:"搜索计划名称...",value:_,onChange:O=>H(O.target.value),onKeyDown:O=>{O.key==="Enter"&&W(_)},autoFocus:!0})}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:oe.length===0?s.jsx("div",{className:"text-center py-4 text-gray-500 text-xs",children:L?"加载中...":"暂无计划"}):oe.map(O=>s.jsxs("div",{className:`px-3 py-2 cursor-pointer hover:bg-[#38bdac]/10 text-sm flex items-center justify-between ${c.ckbApiKey===O.apiKey?"bg-[#38bdac]/20 text-[#38bdac]":"text-white"}`,onClick:()=>he(O),children:[s.jsxs("div",{className:"truncate",children:[s.jsx("span",{className:"font-medium",children:O.name}),s.jsxs("span",{className:"text-xs text-gray-500 ml-2",children:["ID:",String(O.id)]})]}),O.enabled?s.jsx("span",{className:"text-[10px] text-green-400 bg-green-400/10 px-1.5 rounded shrink-0 ml-2",children:"启用"}):s.jsx("span",{className:"text-[10px] text-gray-500 bg-gray-500/10 px-1.5 rounded shrink-0 ml-2",children:"停用"})]},String(O.id)))}),s.jsx("div",{className:"p-2 border-t border-gray-700/60 flex justify-end",children:s.jsx(G,{type:"button",size:"sm",variant:"ghost",className:"text-gray-400 h-7 text-xs",onClick:()=>Z(!1),children:"关闭"})})]}),s.jsx("p",{className:"text-xs text-gray-500",children:"选择计划后自动覆盖下方参数。新建人物时若不选择则自动创建新计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(ne,{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 ${me.deviceGroups?"border-red-500":"border-gray-700"}`,children:[s.jsx(de,{className:"bg-[#0a1628] border-0 text-white focus-visible:ring-0 focus-visible:ring-offset-0",placeholder:"未选择设备",readOnly:!0,value:c.deviceGroups?`已选择 ${c.deviceGroups.split(",").filter(Boolean).length} 个设备`:"",onClick:()=>g(!0)}),s.jsx(G,{type:"button",variant:"outline",className:"border-0 border-l border-inherit rounded-r-md text-gray-200",onClick:()=>g(!0),children:"选择"})]}),me.deviceGroups?s.jsx("p",{className:"text-xs text-red-400",children:me.deviceGroups}):s.jsx("p",{className:"text-xs text-gray-500",children:"从存客宝设备列表中选择,至少选择 1 台设备参与获客计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"好友备注"}),s.jsxs(Pc,{value:c.remarkType,onValueChange:O=>u(Q=>({...Q,remarkType:O})),children:[s.jsx(yl,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(Rc,{placeholder:"选择备注类型"})}),s.jsxs(bl,{children:[s.jsx(or,{value:"phone",children:"手机号"}),s.jsx(or,{value:"nickname",children:"昵称"}),s.jsx(or,{value:"source",children:"来源"})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"备注格式(手机号+标签,标签不超过6字)"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 {手机号}-{来源标签},总长不超过10字",value:c.remarkFormat,onChange:O=>u(Q=>({...Q,remarkFormat:O.target.value}))}),s.jsx("p",{className:"text-xs text-gray-500",children:"格式:手机号+来源标签(标签≤6字,总长≤10字)"})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"打招呼语"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"你好,请通过",value:c.greeting,onChange:O=>u(Q=>({...Q,greeting:O.target.value}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"添加间隔(分钟)"}),s.jsx(de,{type:"number",min:1,className:`bg-[#0a1628] text-white ${me.addFriendInterval?"border-red-500 focus-visible:ring-red-500":"border-gray-700"}`,value:c.addFriendInterval,onChange:O=>{u(Q=>({...Q,addFriendInterval:Number(O.target.value)||1})),me.addFriendInterval&&I(Q=>({...Q,addFriendInterval:void 0}))}}),me.addFriendInterval&&s.jsx("p",{className:"text-xs text-red-400",children:me.addFriendInterval})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"允许加人时间段"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(de,{type:"time",className:"bg-[#0a1628] border-gray-700 text-white w-24",value:c.startTime,onChange:O=>u(Q=>({...Q,startTime:O.target.value}))}),s.jsx("span",{className:"text-gray-500 text-sm shrink-0",children:"至"}),s.jsx(de,{type:"time",className:"bg-[#0a1628] border-gray-700 text-white w-24",value:c.endTime,onChange:O=>u(Q=>({...Q,endTime:O.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"获客成功提示"}),s.jsx($l,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[72px] resize-none",placeholder:"请注意消息,稍后加你微信",value:c.tips,onChange:O=>u(Q=>({...Q,tips:O.target.value}))})]})]})]})]})]})]}),s.jsxs(gn,{className:"gap-3 border-t border-gray-700/40 px-6 py-4 shrink-0",children:[s.jsx(G,{variant:"outline",onClick:()=>e(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(G,{onClick:D,disabled:h||J.messages.length>0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:h?"保存中...":a?"保存":"添加"})]})]}),m&&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(G,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-200 h-8",onClick:()=>{const O=b.map(ve=>String(ve.id??"")),Q=c.deviceGroups?c.deviceGroups.split(",").map(ve=>ve.trim()).filter(Boolean):[],se=O.length>0&&O.every(ve=>Q.includes(ve));u(ve=>({...ve,deviceGroups:se?"":O.join(",")})),!se&&O.length>0&&I(ve=>({...ve,deviceGroups:void 0}))},children:(()=>{const O=b.map(se=>String(se.id??"")),Q=c.deviceGroups?c.deviceGroups.split(",").map(se=>se.trim()).filter(Boolean):[];return O.length>0&&O.every(se=>Q.includes(se))?"取消全选":"全选"})()}),s.jsx(de,{className:"bg-[#050c18] border-gray-700 text-white h-8 w-52",placeholder:"搜索备注/微信号/IMEI",value:k,onChange:O=>T(O.target.value),onKeyDown:O=>{O.key==="Enter"&&F(k)}}),s.jsx(G,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-200 h-8",onClick:()=>F(k),disabled:j,children:"刷新"}),s.jsx(G,{type:"button",size:"icon",variant:"outline",className:"border-gray-600 text-gray-300 h-8 w-8",onClick:()=>g(!1),children:"✕"})]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:j?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-400 text-sm",children:"正在加载设备列表…"}):b.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:b.map(O=>{const Q=String(O.id??""),se=c.deviceGroups?c.deviceGroups.split(",").map(Ue=>Ue.trim()).filter(Boolean):[],ve=se.includes(Q),ze=()=>{let Ue;ve?Ue=se.filter(jt=>jt!==Q):Ue=[...se,Q],u(jt=>({...jt,deviceGroups:Ue.join(",")})),Ue.length>0&&I(jt=>({...jt,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:ve,onChange:ze}),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:O.memo||O.wechatId||`设备 ${Q}`}),O.status==="online"&&s.jsx("span",{className:"rounded-full bg-emerald-500/20 text-emerald-400 text-[11px] px-2 py-0.5",children:"在线"}),O.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: ",Q]}),O.wechatId&&s.jsxs("span",{className:"mr-3",children:["微信号: ",O.wechatId]}),typeof O.totalFriend=="number"&&s.jsxs("span",{children:["好友数: ",O.totalFriend]})]})]})]},Q)})})}),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:["已选择"," ",c.deviceGroups?c.deviceGroups.split(",").filter(Boolean).length:0," ","台设备"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(G,{type:"button",variant:"outline",className:"border-gray-600 text-gray-200 h-8 px-4",onClick:()=>g(!1),children:"取消"}),s.jsx(G,{type:"button",className:"bg-[#38bdac] hover:bg-[#2da396] text-white h-8 px-4",onClick:()=>g(!1),children:"确定"})]})]})]})})]})})}function Lc(t){if(t!=null){if(typeof t=="number"&&Number.isFinite(t))return Math.round(t);if(typeof t=="string"&&t.trim()!==""){const e=Number(t.trim().replace(/%/g,""));if(Number.isFinite(e))return Math.round(e)}}}function nV(t,e,n){const r=new Map;for(const o of t){const c=o.partId||"part-1",u=o.partTitle||"未分类",h=o.chapterId||"chapter-1",f=o.chapterTitle||"未分类";r.has(c)||r.set(c,{id:c,title:u,badgeText:n[c]||"",chapters:new Map});const m=r.get(c);m.chapters.has(h)||m.chapters.set(h,{id:h,title:f,sections:[]}),m.chapters.get(h).sections.push({id:o.id,mid:o.mid,title:o.title,price:o.price??1,filePath:o.filePath,isFree:o.isFree,isNew:o.isNew,clickCount:o.clickCount??0,payCount:o.payCount??0,hotScore:o.hotScore??0,hotRank:e.get(o.id)??0,previewPercent:Lc(o.previewPercent)})}const a=Array.from(r.values()).map(o=>({...o,chapters:Array.from(o.chapters.values())})),i=new Map;for(let o=0;o{const u=i.get(o.id),h=i.get(c.id);return u!==void 0&&h!==void 0&&u!==h?u-h:u!==void 0&&h===void 0?-1:u===void 0&&h!==void 0?1:o.id.localeCompare(c.id)})}function sV(){var tl,nl,ai;const t=Ua(),[e,n]=y.useState([]),[r,a]=y.useState(!0),[i,o]=y.useState([]),[c,u]=y.useState(null),[h,f]=y.useState(!1),[m,g]=y.useState(!1),[b,N]=y.useState(!1),[j,v]=y.useState(""),[k,T]=y.useState([]),[C,P]=y.useState(!1),[L,U]=y.useState({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),[_,H]=y.useState(null),[R,Z]=y.useState(!1),[re,$]=y.useState(!1),[ie,ce]=y.useState(null),[me,I]=y.useState(!1),[J,z]=y.useState([]),[ge,X]=y.useState(!1),[F,W]=y.useState(""),[fe,he]=y.useState(""),[oe,D]=y.useState(!1),[q,O]=y.useState(""),[Q,se]=y.useState(!1),[ve,ze]=y.useState(null),[Ue,jt]=y.useState(!1),[Nn,pt]=y.useState(!1),[It,un]=y.useState({readWeight:.5,recencyWeight:.3,payWeight:.2}),[Bn,hn]=y.useState(!1),[Wt,xn]=y.useState(!1),[En,Vn]=y.useState(1),[Zn,Rt]=y.useState([]),[yn,we]=y.useState(!1),[Te,We]=y.useState([]),[at,Lt]=y.useState(!1),[Ct,$e]=y.useState(20),[V,Qe]=y.useState(!1),[vt,Dt]=y.useState(!1),[xt,yt]=y.useState([]),[Pt,Jt]=y.useState([]),[wn,Os]=y.useState([]),[hr,qa]=y.useState(!1),[Gr,Jr]=y.useState(1),[ba,Tr]=y.useState(20),[Mr,Qr]=y.useState(0),[Ga,fr]=y.useState(1),[Ws,pr]=y.useState(""),[Ks,Ds]=y.useState(!1),[le,Ne]=y.useState(null),[Xe,Nt]=y.useState({tagId:"",label:"",aliases:"",url:"",type:"url",appId:"",appSecret:"",pagePath:""}),[Zt,qs]=y.useState(!1),[Ho,Yr]=y.useState(!1),[Li,Ja]=y.useState(null),[hs,Ar]=y.useState(null),[en,Qa]=y.useState({}),[Oi,Xr]=y.useState(!1),[va,Uo]=y.useState(""),[Di,Gs]=y.useState(""),[_s,Wo]=y.useState([]),[qn,Ko]=y.useState(0),[Zr,fs]=y.useState(1),[mr,$s]=y.useState(!1),[ea,Na]=y.useState(""),Xl=y.useRef(null),Ya=y.useCallback(async(E,B)=>{var mt;const ue=new FormData;ue.append("file",E),ue.append("folder",B);const Ke=await(await fetch(Rl("/api/upload"),{method:"POST",body:ue,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((mt=Ke==null?void 0:Ke.data)==null?void 0:mt.url)||(Ke==null?void 0:Ke.url)||""},[]),_i=y.useCallback(E=>Ya(E,"book-images"),[Ya]),Xa=y.useCallback(E=>{const B=E.type.startsWith("video/")?"book-videos":"book-attachments";return Ya(E,B)},[Ya]),[$i,ta]=y.useState({}),wa=E=>String(E||"").trim().slice(0,8),qo=y.useMemo(()=>{const E=new Map;return Zn.forEach((B,ue)=>{E.set(B.id,ue+1)}),E},[Zn]),lt=nV(e,qo,$i),zi=e.length,Za=10,ei=Math.max(1,Math.ceil(Zn.length/Za)),Go=Zn.slice((En-1)*Za,En*Za),es=async()=>{a(!0);try{const E=await Oe("/api/db/book?action=list",{cache:"no-store"});n(Array.isArray(E==null?void 0:E.sections)?E.sections:[])}catch(E){console.error(E),n([])}finally{a(!1)}},Jo=async()=>{try{const E=await Oe("/api/db/config?key=book_part_badges",{cache:"no-store"});let B={};if(E&&Array.isArray(E.data)){const je=E.data.find(Ke=>Ke&&Ke.configKey==="book_part_badges");je&&je.configValue&&typeof je.configValue=="object"&&!Array.isArray(je.configValue)&&(B=je.configValue)}else E&&E.data&&typeof E.data=="object"&&!Array.isArray(E.data)&&(B=E.data);const ue={};Object.keys(B).forEach(je=>{const Ke=wa(B[je]);Ke&&(ue[je]=Ke)}),ta(ue)}catch(E){console.error(E),ta({})}},gr=async()=>{we(!0);try{const E=await Oe("/api/db/book?action=ranking",{cache:"no-store"}),B=Array.isArray(E==null?void 0:E.sections)?E.sections:[];Rt(B);const ue=B.filter(je=>je.isPinned).map(je=>je.id);We(ue)}catch(E){console.error(E),Rt([])}finally{we(!1)}};y.useEffect(()=>{es(),gr(),Jo()},[]);const Fi=E=>{o(B=>B.includes(E)?B.filter(ue=>ue!==E):[...B,E])},xr=y.useCallback(E=>{const B=e,ue=E.flatMap(je=>{const Ke=B.find(mt=>mt.id===je.id);return Ke?[{...Ke,partId:je.partId,partTitle:je.partTitle,chapterId:je.chapterId,chapterTitle:je.chapterTitle}]:[]});return n(ue),Yt("/api/db/book",{action:"reorder",items:E}).then(je=>{je&&je.success===!1&&(n(B),Y.error("排序失败: "+(je&&typeof je=="object"&&"error"in je?je.error:"未知错误")))}).catch(je=>{n(B),console.error("排序失败:",je),Y.error("排序失败: "+(je instanceof Error?je.message:"网络或服务异常"))}),Promise.resolve()},[e]),Js=async E=>{if(confirm(`确定要删除章节「${E.title}」吗?此操作不可恢复。`))try{const B=await ki(`/api/db/book?id=${encodeURIComponent(E.id)}`);B&&B.success!==!1?(Y.success("已删除"),es(),gr()):Y.error("删除失败: "+(B&&typeof B=="object"&&"error"in B?B.error:"未知错误"))}catch(B){console.error(B),Y.error("删除失败")}},zs=y.useCallback(async()=>{hn(!0);try{const E=await Oe("/api/db/config/full?key=article_ranking_weights",{cache:"no-store"}),B=E&&E.data;B&&typeof B.readWeight=="number"&&typeof B.recencyWeight=="number"&&typeof B.payWeight=="number"&&un({readWeight:Math.max(0,Math.min(1,B.readWeight)),recencyWeight:Math.max(0,Math.min(1,B.recencyWeight)),payWeight:Math.max(0,Math.min(1,B.payWeight))})}catch{}finally{hn(!1)}},[]);y.useEffect(()=>{Nn&&zs()},[Nn,zs]);const Qs=async()=>{const{readWeight:E,recencyWeight:B,payWeight:ue}=It,je=E+B+ue;if(Math.abs(je-1)>.001){Y.error("三个权重之和必须等于 1");return}xn(!0);try{const Ke=await kt("/api/db/config",{key:"article_ranking_weights",value:{readWeight:E,recencyWeight:B,payWeight:ue},description:"文章排名算法权重"});Ke&&Ke.success!==!1?(Y.success("排名权重已保存"),pt(!1),es(),gr()):Y.error("保存失败: "+(Ke&&typeof Ke=="object"&&"error"in Ke?Ke.error:""))}catch(Ke){console.error(Ke),Y.error("保存失败")}finally{xn(!1)}},ja=y.useCallback(async()=>{Lt(!0);try{const E=await Oe("/api/db/config/full?key=pinned_section_ids",{cache:"no-store"}),B=E&&E.data;Array.isArray(B)&&We(B)}catch{}finally{Lt(!1)}},[]),On=y.useCallback(async()=>{try{const E=await Oe("/api/db/persons");E!=null&&E.success&&E.persons&&yt(E.persons.map(B=>{const ue=B.deviceGroups,je=Array.isArray(ue)?ue.join(","):ue??"";return{id:B.token??B.personId??"",personId:B.personId,name:B.name,personSource:B.personSource??"",userId:B.userId,aliases:B.aliases??"",label:B.label??"",ckbApiKey:B.ckbApiKey??"",ckbPlanId:B.ckbPlanId,remarkType:B.remarkType,remarkFormat:B.remarkFormat,addFriendInterval:B.addFriendInterval,startTime:B.startTime,endTime:B.endTime,deviceGroups:je,isPinned:!!B.isPinned}}))}catch{}},[]),Zl=y.useCallback(async(E,B)=>{const ue=(E.personId||E.id||"").trim();if(!ue){Y.error("缺少 personId");return}B&&!(E.userId||"").trim()&&Y.info("未绑定会员时,小程序仍显示 @ 名称,头像可能为默认图");try{const je=await Yt("/api/db/persons/pin",{personId:ue,isPinned:B});if(!(je!=null&&je.success)){Y.error((je==null?void 0:je.error)||"置顶失败");return}Y.success(B?"已设为小程序首页置顶(全局仅一条)":"已取消置顶"),await On()}catch(je){Y.error(je instanceof Error?je.message:"操作失败")}},[On]),Ir=y.useCallback(async()=>{try{const E=await Oe("/api/db/link-tags");E!=null&&E.success&&E.linkTags&&Jt(E.linkTags.map(B=>({id:B.tagId,label:B.label,url:B.url,type:B.type||"url",appId:B.appId||"",pagePath:B.pagePath||"",hasAppSecret:!!B.hasAppSecret})))}catch{}},[]),ka=y.useCallback(async()=>{try{const E=await Oe("/api/db/config/full?key=ckb_lead_webhook_url",{cache:"no-store"});E!=null&&E.success&&typeof E.data=="string"&&Na(E.data)}catch{}},[]),ec=y.useCallback(async()=>{try{const E=await Oe("/api/db/ckb-person-leads");if(E!=null&&E.success&&E.byPerson){const B={};for(const ue of E.byPerson)B[ue.token]=ue.total;Qa(B)}}catch{}},[]),Sa=y.useCallback(async(E,B,ue=1)=>{Uo(E),Gs(B),Xr(!0),fs(ue),$s(!0);try{const je=await Oe(`/api/db/ckb-person-leads?token=${encodeURIComponent(E)}&page=${ue}&pageSize=20`);je!=null&&je.success?(Wo(je.records||[]),Ko(je.total||0)):Y.error((je==null?void 0:je.error)||"加载获客详情失败")}catch(je){Y.error(je instanceof Error?je.message:"加载获客详情失败")}finally{$s(!1)}},[]),yr=y.useCallback(async()=>{qa(!0);try{const E=new URLSearchParams({page:String(Gr),pageSize:String(ba)}),B=Ws.trim();B&&E.set("search",B);const ue=await Oe(`/api/db/link-tags?${E.toString()}`);if(ue!=null&&ue.success){const je=Array.isArray(ue.linkTags)?ue.linkTags:[];Os(je.map(Ke=>({id:Ke.tagId,label:Ke.label,aliases:Ke.aliases||"",url:Ke.url,type:Ke.type||"url",appId:Ke.appId||"",pagePath:Ke.pagePath||"",hasAppSecret:!!Ke.hasAppSecret}))),Qr(typeof ue.total=="number"?ue.total:0),fr(typeof ue.totalPages=="number"&&ue.totalPages>0?ue.totalPages:1)}}catch(E){console.error(E),Y.error("加载链接标签失败")}finally{qa(!1)}},[Gr,ba,Ws]),[Ys,dd]=y.useState([]),[br,Xs]=y.useState(""),[ts,Zs]=y.useState(!1),Bi=y.useRef(null),Ca=y.useCallback(async()=>{try{const E=await Oe("/api/admin/linked-miniprograms");E!=null&&E.success&&Array.isArray(E.data)&&dd(E.data.map(B=>({...B,key:B.key})))}catch{}},[]),Ea=Ys.filter(E=>!br.trim()||E.name.toLowerCase().includes(br.toLowerCase())||E.key&&E.key.toLowerCase().includes(br.toLowerCase())||E.appId.toLowerCase().includes(br.toLowerCase())),Pr=async E=>{const B=Te.includes(E)?Te.filter(ue=>ue!==E):[...Te,E];We(B);try{await kt("/api/db/config",{key:"pinned_section_ids",value:B,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"}),gr()}catch{We(Te)}},Ta=y.useCallback(async()=>{Qe(!0);try{const E=await Oe("/api/db/config/full?key=unpaid_preview_percent",{cache:"no-store"}),B=E&&E.data;typeof B=="number"&&B>0&&B<=100&&$e(B)}catch{}finally{Qe(!1)}},[]),Qo=async()=>{if(Ct<1||Ct>100){Y.error("预览比例需在 1~100 之间");return}Dt(!0);try{const E=await kt("/api/db/config",{key:"unpaid_preview_percent",value:Ct,description:"小程序未付费内容默认预览比例(%)"});E&&E.success!==!1?Y.success("预览比例已保存"):Y.error("保存失败: "+(E.error||""))}catch{Y.error("保存失败")}finally{Dt(!1)}};y.useEffect(()=>{ja(),Ta(),On(),Ir(),ec(),Ca(),ka()},[ja,Ta,On,Ir,ec,Ca,ka]),y.useEffect(()=>{yr()},[yr]);const er=async E=>{ze({section:E,orders:[]}),jt(!0);try{const B=await Oe(`/api/db/book?action=section-orders&id=${encodeURIComponent(E.id)}`),ue=B!=null&&B.success&&Array.isArray(B.orders)?B.orders:[];ze(je=>je?{...je,orders:ue}:null)}catch(B){console.error(B),ze(ue=>ue?{...ue,orders:[]}:null)}finally{jt(!1)}},ti=async E=>{g(!0);try{const B=E.mid!=null&&E.mid>0?`/api/db/book?action=read&mid=${E.mid}`:`/api/db/book?action=read&id=${encodeURIComponent(E.id)}`,ue=await Oe(B);if(ue!=null&&ue.success&&ue.section){const je=ue.section,Ke=je.editionPremium===!0,mt=Lc(je.previewPercent)??Lc(je.preview_percent),wt=Lc(E.previewPercent);u({id:E.id,originalId:E.id,title:ue.section.title??E.title,price:ue.section.price??E.price,content:ue.section.content??"",filePath:E.filePath,isFree:E.isFree||E.price===0,isNew:je.isNew??E.isNew,isPinned:Te.includes(E.id),hotScore:E.hotScore??0,previewPercent:mt??wt??void 0,editionStandard:Ke?!1:je.editionStandard??!0,editionPremium:Ke})}else u({id:E.id,originalId:E.id,title:E.title,price:E.price,content:"",filePath:E.filePath,isFree:E.isFree,isNew:E.isNew,isPinned:Te.includes(E.id),hotScore:E.hotScore??0,previewPercent:Lc(E.previewPercent),editionStandard:!0,editionPremium:!1}),ue&&!ue.success&&Y.error("无法读取文件内容: "+(ue.error||"未知错误"))}catch(B){console.error(B),u({id:E.id,title:E.title,price:E.price,content:"",filePath:E.filePath,isFree:E.isFree,previewPercent:Lc(E.previewPercent)})}finally{g(!1)}},na=async()=>{var E;if(c){N(!0);try{let B=c.content||"";const ue=[new RegExp(`^#+\\s*${c.id.replace(".","\\.")}\\s+.*$`,"gm"),new RegExp(`^#+\\s*${c.id.replace(".","\\.")}[::].*$`,"gm"),new RegExp(`^#\\s+.*${(E=c.title)==null?void 0:E.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const ss of ue)B=B.replace(ss,"");B=B.replace(/^\s*\n+/,"").trim();const je=c.originalId||c.id,Ke=c.id!==je,mt={id:je,...Ke?{newId:c.id}:{},title:c.title,price:c.isFree?0:c.price,content:B,isFree:c.isFree||c.price===0,isNew:c.isNew,hotScore:c.hotScore,editionStandard:c.editionPremium?!1:c.editionStandard??!0,editionPremium:c.editionPremium??!1,saveToFile:!0};c.previewPercent===null?mt.previewPercent=null:typeof c.previewPercent=="number"&&Number.isFinite(c.previewPercent)&&(mt.previewPercent=c.previewPercent);const wt=await Yt("/api/db/book",mt,{timeout:A1}),Tn=Ke?c.id:je;c.isPinned!==Te.includes(Tn)&&await Pr(Tn),wt&&wt.success!==!1?(Y.success(`已保存:${c.title}`),u(null),es(),On(),Ir()):Y.error("保存失败: "+(wt&&typeof wt=="object"&&"error"in wt?wt.error:"未知错误"))}catch(B){console.error(B);const ue=B instanceof Error&&B.name==="AbortError"?"保存超时,请检查网络或稍后重试":"保存失败";Y.error(ue)}finally{N(!1)}}},Ma=async()=>{if(!L.id||!L.title){Y.error("请填写章节ID和标题");return}N(!0);try{const E=lt.find(je=>je.id===L.partId),B=E==null?void 0:E.chapters.find(je=>je.id===L.chapterId),ue=await Yt("/api/db/book",{id:L.id,title:L.title,price:L.isFree?0:L.price,content:L.content||"",partId:L.partId,partTitle:(E==null?void 0:E.title)??"",chapterId:L.chapterId,chapterTitle:(B==null?void 0:B.title)??"",isFree:L.isFree,isNew:L.isNew,editionStandard:L.editionPremium?!1:L.editionStandard??!0,editionPremium:L.editionPremium??!1,hotScore:L.hotScore??0,saveToFile:!1},{timeout:A1});if(ue&&ue.success!==!1){if(L.isPinned){const je=[...Te,L.id];We(je);try{await kt("/api/db/config",{key:"pinned_section_ids",value:je,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"})}catch{}}Y.success(`章节创建成功:${L.title}`),f(!1),U({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),es(),On(),Ir()}else Y.error("创建失败: "+(ue&&typeof ue=="object"&&"error"in ue?ue.error:"未知错误"))}catch(E){console.error(E),Y.error("创建失败")}finally{N(!1)}},Aa=E=>{U(B=>{var ue;return{...B,partId:E.id,chapterId:((ue=E.chapters[0])==null?void 0:ue.id)??"chapter-1"}}),f(!0)},ni=E=>{H({id:E.id,title:E.title,badgeText:wa(E.badgeText)})},Yo=async()=>{var E;if((E=_==null?void 0:_.title)!=null&&E.trim()){Z(!0);try{const B=e.map(je=>({id:je.id,partId:je.partId||"part-1",partTitle:je.partId===_.id?_.title.trim():je.partTitle||"",chapterId:je.chapterId||"chapter-1",chapterTitle:je.chapterTitle||""})),ue=await Yt("/api/db/book",{action:"reorder",items:B});if(ue&&ue.success!==!1){const je=_.title.trim(),Ke={...$i},mt=wa(_.badgeText);mt?Ke[_.id]=mt:delete Ke[_.id];const wt=await kt("/api/db/config",{key:"book_part_badges",value:Ke,description:"目录篇名角标(key=part_id, value=角标文案)"});if(wt&&wt.success===!1){Y.error("更新篇名角标失败: "+(wt.error||"未知错误"));return}ta(Ke),n(Tn=>Tn.map(ss=>ss.partId===_.id?{...ss,partTitle:je}:ss)),H(null),es()}else Y.error("更新篇名失败: "+(ue&&typeof ue=="object"&&"error"in ue?ue.error:"未知错误"))}catch(B){console.error(B),Y.error("更新篇名失败")}finally{Z(!1)}}},ns=E=>{const B=E.chapters.length+1,ue=`chapter-${E.id}-${B}-${Date.now()}`;U({id:`${B}.1`,title:"新章节",price:1,partId:E.id,chapterId:ue,content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),f(!0)},sa=(E,B)=>{const ue=B.sections;let je=1,Ke=!1,mt=!1;if(ue.length>0){const wt=typeof ue[0].price=="number"?ue[0].price:Number(ue[0].price)||1,Tn=!!(ue[0].isFree||wt===0);mt=ue.some(ss=>{const jn=typeof ss.price=="number"?ss.price:Number(ss.price)||1,ps=!!(ss.isFree||jn===0);return jn!==wt||ps!==Tn}),je=Tn?0:wt,Ke=Tn}ce({part:E,chapter:B,title:B.title,price:je,isFree:Ke,priceMixed:mt,initialTitle:B.title,initialPrice:je,initialIsFree:Ke})},Xo=async()=>{var Ke;if(!((Ke=ie==null?void 0:ie.title)!=null&&Ke.trim()))return;const E=ie,B=E.title.trim(),ue=B!==E.initialTitle,je=E.isFree!==E.initialIsFree||!E.isFree&&Number(E.price)!==Number(E.initialPrice);if(!ue&&!je){Y.info("未修改任何内容"),ce(null);return}if(E.priceMixed&&je){const mt=E.chapter.sections.length,wt=E.isFree?"全部设为免费":`全部设为 ¥${E.price}`;if(!confirm(`本章 ${mt} 节当前定价不一致,保存后将${wt},确定?`))return}I(!0);try{if(ue){const mt=e.map(jn=>({id:jn.id,partId:jn.partId||E.part.id,partTitle:jn.partId===E.part.id?E.part.title:jn.partTitle||"",chapterId:jn.chapterId||E.chapter.id,chapterTitle:jn.partId===E.part.id&&jn.chapterId===E.chapter.id?B:jn.chapterTitle||""})),wt=await Yt("/api/db/book",{action:"reorder",items:mt});if(wt&&wt.success===!1){Y.error("保存章节名失败: "+(wt&&typeof wt=="object"&&"error"in wt?wt.error:"未知错误"));return}const Tn=E.part.id,ss=E.chapter.id;n(jn=>jn.map(ps=>ps.partId===Tn&&ps.chapterId===ss?{...ps,chapterTitle:B}:ps))}if(je){const mt=await Yt("/api/db/book",{action:"update-chapter-pricing",partId:E.part.id,chapterId:E.chapter.id,price:E.isFree?0:Number(E.price)||0,isFree:E.isFree});if(mt&&mt.success===!1){Y.error("保存定价失败: "+(mt&&typeof mt=="object"&&"error"in mt?mt.error:"未知错误")),ue&&es();return}}ce(null),es(),Y.success("已保存")}catch(mt){console.error(mt),Y.error("保存失败")}finally{I(!1)}},si=async(E,B)=>{const ue=B.sections.map(je=>je.id);if(ue.length===0){Y.info("该章下无小节,无需删除");return}if(confirm(`确定要删除「第${E.chapters.indexOf(B)+1}章 | ${B.title}」吗?将删除共 ${ue.length} 节,此操作不可恢复。`))try{for(const je of ue)await ki(`/api/db/book?id=${encodeURIComponent(je)}`);es()}catch(je){console.error(je),Y.error("删除失败")}},ud=async()=>{if(!q.trim()){Y.error("请输入篇名");return}se(!0);try{const E=`part-new-${Date.now()}`,B="chapter-1",ue=`part-placeholder-${Date.now()}`,je=await Yt("/api/db/book",{id:ue,title:"占位节(可编辑)",price:0,content:"",partId:E,partTitle:q.trim(),chapterId:B,chapterTitle:"第1章 | 待编辑",saveToFile:!1});je&&je.success!==!1?(Y.success(`篇「${q}」创建成功`),$(!1),O(""),es()):Y.error("创建失败: "+(je&&typeof je=="object"&&"error"in je?je.error:"未知错误"))}catch(E){console.error(E),Y.error("创建失败")}finally{se(!1)}},Zo=async()=>{if(J.length===0){Y.error("请先勾选要移动的章节");return}const E=lt.find(ue=>ue.id===F),B=E==null?void 0:E.chapters.find(ue=>ue.id===fe);if(!E||!B||!F||!fe){Y.error("请选择目标篇和章");return}D(!0);try{const ue=()=>{const wt=new Set(J),Tn=e.map(Dn=>({id:Dn.id,partId:Dn.partId||"",partTitle:Dn.partTitle||"",chapterId:Dn.chapterId||"",chapterTitle:Dn.chapterTitle||""})),ss=Tn.filter(Dn=>wt.has(Dn.id)).map(Dn=>({...Dn,partId:F,partTitle:E.title||F,chapterId:fe,chapterTitle:B.title||fe})),jn=Tn.filter(Dn=>!wt.has(Dn.id));let ps=jn.length;for(let Dn=jn.length-1;Dn>=0;Dn-=1){const tc=jn[Dn];if(tc.partId===F&&tc.chapterId===fe){ps=Dn+1;break}}return[...jn.slice(0,ps),...ss,...jn.slice(ps)]},je=async()=>{const wt=ue(),Tn=await Yt("/api/db/book",{action:"reorder",items:wt});return Tn&&Tn.success!==!1?(Y.success(`已移动 ${J.length} 节到「${E.title}」-「${B.title}」`),X(!1),z([]),await es(),!0):!1},Ke={action:"move-sections",sectionIds:J,targetPartId:F,targetChapterId:fe,targetPartTitle:E.title||F,targetChapterTitle:B.title||fe},mt=await Yt("/api/db/book",Ke);if(mt&&mt.success!==!1)Y.success(`已移动 ${mt.count??J.length} 节到「${E.title}」-「${B.title}」`),X(!1),z([]),await es();else{const wt=mt&&typeof mt=="object"&&"error"in mt?mt.error||"":"未知错误";if((wt.includes("缺少 id")||wt.includes("无效的 action"))&&await je())return;Y.error("移动失败: "+wt)}}catch(ue){console.error(ue),Y.error("移动失败: "+(ue instanceof Error?ue.message:"网络或服务异常"))}finally{D(!1)}},el=E=>{z(B=>B.includes(E)?B.filter(ue=>ue!==E):[...B,E])},ri=async E=>{const B=e.filter(ue=>ue.partId===E.id).map(ue=>ue.id);if(B.length===0){Y.info("该篇下暂无小节可删除");return}if(confirm(`确定要删除「${E.title}」整篇吗?将删除共 ${B.length} 节内容,此操作不可恢复。`))try{for(const ue of B)await ki(`/api/db/book?id=${encodeURIComponent(ue)}`);es()}catch(ue){console.error(ue),Y.error("删除失败")}},Rr=async()=>{var E;if(j.trim()){P(!0);try{const B=await Oe(`/api/search?q=${encodeURIComponent(j)}`);B!=null&&B.success&&((E=B.data)!=null&&E.results)?T(B.data.results):(T([]),B&&!B.success&&Y.error("搜索失败: "+B.error))}catch(B){console.error(B),T([]),Y.error("搜索失败")}finally{P(!1)}}},Lr=lt.find(E=>E.id===L.partId),Vi=(Lr==null?void 0:Lr.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:["共 ",lt.length," 篇 · ",zi," 节内容"]})]}),s.jsx("div",{className:"flex gap-2",children:s.jsxs(G,{onClick:()=>pt(!0),variant:"outline",className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:[s.jsx(_h,{className:"w-4 h-4 mr-2"}),"排名算法"]})})]}),s.jsx(Bt,{open:h,onOpenChange:f,children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white inset-0 translate-x-0 translate-y-0 w-screen h-screen max-w-none max-h-none rounded-none flex flex-col p-0 gap-0",showCloseButton:!0,children:[s.jsx(Vt,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx($n,{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(ne,{className:"text-gray-300",children:"章节ID *"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 9.15",value:L.id,onChange:E=>U({...L,id:E.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"价格 (元)"}),s.jsx(de,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:L.isFree?0:L.price,onChange:E=>U({...L,price:Number(E.target.value),isFree:Number(E.target.value)===0}),disabled:L.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{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:L.isFree,onChange:E=>U({...L,isFree:E.target.checked,price:E.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(ne,{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:L.isNew,onChange:E=>U({...L,isNew:E.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(ne,{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:L.isPinned,onChange:E=>U({...L,isPinned:E.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(ne,{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:L.editionPremium!==!0,onChange:()=>U({...L,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:L.editionPremium===!0,onChange:()=>U({...L,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(ne,{className:"text-gray-300",children:"热度分"}),s.jsx(de,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:L.hotScore??0,onChange:E=>U({...L,hotScore:Math.max(0,parseFloat(E.target.value)||0)})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"章节标题 *"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入章节标题",value:L.title,onChange:E=>U({...L,title:E.target.value})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"所属篇"}),s.jsxs(Pc,{value:L.partId,onValueChange:E=>{var ue;const B=lt.find(je=>je.id===E);U({...L,partId:E,chapterId:((ue=B==null?void 0:B.chapters[0])==null?void 0:ue.id)??"chapter-1"})},children:[s.jsx(yl,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(Rc,{})}),s.jsxs(bl,{className:"bg-[#0f2137] border-gray-700",children:[lt.map(E=>s.jsx(or,{value:E.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:E.title},E.id)),lt.length===0&&s.jsx(or,{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(ne,{className:"text-gray-300",children:"所属章"}),s.jsxs(Pc,{value:L.chapterId,onValueChange:E=>U({...L,chapterId:E}),children:[s.jsx(yl,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(Rc,{})}),s.jsxs(bl,{className:"bg-[#0f2137] border-gray-700",children:[Vi.map(E=>s.jsx(or,{value:E.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:E.title},E.id)),Vi.length===0&&s.jsx(or,{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(ne,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),s.jsx(M0,{content:L.content||"",onChange:E=>U({...L,content:E}),onImageUpload:_i,onMediaUpload:Xa,persons:xt,linkTags:Pt,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(gn,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[s.jsx(G,{variant:"outline",onClick:()=>f(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(G,{onClick:Ma,disabled:b||!L.id||!L.title,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:b?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx($n,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),s.jsx(Bt,{open:!!_,onOpenChange:E=>!E&&H(null),children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(tn,{className:"w-5 h-5 text-[#38bdac]"}),"编辑篇名"]})}),_&&s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"篇名"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",value:_.title,onChange:E=>H({..._,title:E.target.value}),placeholder:"输入篇名"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"左侧图标文字(可选)"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",value:_.badgeText||"",onChange:E=>H({..._,badgeText:wa(E.target.value)}),placeholder:"例如:派 / 新 / 热",maxLength:8}),s.jsx("p",{className:"text-xs text-gray-500",children:"保存后会同步到目录左侧图标文字(小程序与管理端目录树)。"})]})]}),s.jsxs(gn,{children:[s.jsx(G,{variant:"outline",onClick:()=>H(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(G,{onClick:Yo,disabled:R||!((tl=_==null?void 0:_.title)!=null&&tl.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:R?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Bt,{open:!!ie,onOpenChange:E=>!E&&ce(null),children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsxs(Vt,{children:[s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(tn,{className:"w-5 h-5 text-[#38bdac]"}),"章节设置"]}),s.jsx("p",{className:"text-gray-400 text-sm font-normal pt-1",children:"修改本章显示名称,或为本章下全部节设置统一金额(仍可在单节编辑里单独改某一节)。"})]}),ie&&s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"章节名称(如:第8章|底层结构)"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",value:ie.title,onChange:E=>ce({...ie,title:E.target.value}),placeholder:"输入章节名称"})]}),s.jsxs("div",{className:"space-y-2 border-t border-gray-700/60 pt-4",children:[s.jsxs(ne,{className:"text-gray-300",children:["本章统一定价(应用于本章全部 ",ie.chapter.sections.length," 节)"]}),ie.priceMixed&&s.jsx("p",{className:"text-amber-400/90 text-xs",children:"当前各节定价不一致,保存后将按下方设置全部统一。"}),s.jsxs("div",{className:"flex flex-wrap items-end gap-4",children:[s.jsxs("div",{className:"space-y-1 flex-1 min-w-[120px]",children:[s.jsx("span",{className:"text-gray-500 text-xs",children:"价格 (元)"}),s.jsx(de,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:ie.isFree?0:ie.price,onChange:E=>ce({...ie,price:Number(E.target.value),isFree:Number(E.target.value)===0}),disabled:ie.isFree,min:0,step:.01})]}),s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer pb-2",children:[s.jsx("input",{type:"checkbox",checked:ie.isFree||ie.price===0,onChange:E=>ce({...ie,isFree:E.target.checked,price:E.target.checked?0:ie.initialPrice>0?ie.initialPrice:1}),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac]"}),s.jsx("span",{className:"text-gray-400 text-sm",children:"本章全部免费"})]})]})]})]}),s.jsxs(gn,{children:[s.jsx(G,{variant:"outline",onClick:()=>ce(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(G,{onClick:Xo,disabled:me||!((nl=ie==null?void 0:ie.title)!=null&&nl.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:me?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Bt,{open:ge,onOpenChange:E=>{var B;if(X(E),E&<.length>0){const ue=lt[0];W(ue.id),he(((B=ue.chapters[0])==null?void 0:B.id)??"")}},children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Vt,{children:s.jsx(Ht,{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:J.length})," 节,请选择目标篇与章。"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"目标篇"}),s.jsxs(Pc,{value:F,onValueChange:E=>{var ue;W(E);const B=lt.find(je=>je.id===E);he(((ue=B==null?void 0:B.chapters[0])==null?void 0:ue.id)??"")},children:[s.jsx(yl,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(Rc,{placeholder:"选择篇"})}),s.jsx(bl,{className:"bg-[#0f2137] border-gray-700",children:lt.map(E=>s.jsx(or,{value:E.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:E.title},E.id))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"目标章"}),s.jsxs(Pc,{value:fe,onValueChange:he,children:[s.jsx(yl,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(Rc,{placeholder:"选择章"})}),s.jsx(bl,{className:"bg-[#0f2137] border-gray-700",children:(((ai=lt.find(E=>E.id===F))==null?void 0:ai.chapters)??[]).map(E=>s.jsx(or,{value:E.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:E.title},E.id))})]})]})]}),s.jsxs(gn,{children:[s.jsx(G,{variant:"outline",onClick:()=>X(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(G,{onClick:Zo,disabled:oe||J.length===0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:oe?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"移动中..."]}):"确认移动"})]})]})}),s.jsx(Bt,{open:!!ve,onOpenChange:E=>!E&&ze(null),children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",showCloseButton:!0,children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white",children:["付款记录 — ",(ve==null?void 0:ve.section.title)??""]})}),s.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:Ue?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):ve&&ve.orders.length===0?s.jsx("p",{className:"text-gray-500 text-center py-6",children:"暂无付款记录"}):ve?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:ve.orders.map(E=>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:`查看订单 ${E.orderSn}`,onClick:()=>window.open(`/orders?search=${E.orderSn??E.id??""}`,"_blank"),children:E.orderSn?E.orderSn.length>16?E.orderSn.slice(0,8)+"..."+E.orderSn.slice(-6):E.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:`查看用户 ${E.userId??E.openId??""}`,onClick:()=>window.open(`/users?search=${E.userId??E.openId??""}`,"_blank"),children:(()=>{const B=E.userId??E.openId??"-";return B.length>12?B.slice(0,6)+"..."+B.slice(-4):B})()})}),s.jsxs("td",{className:"py-2 pr-2 text-gray-300",children:["¥",E.amount??0]}),s.jsx("td",{className:"py-2 pr-2 text-gray-300",children:E.status??"-"}),s.jsx("td",{className:"py-2 pr-2 text-gray-500",children:E.payTime??E.createdAt??"-"})]},E.id??E.orderSn??""))})]}):null})]})}),s.jsx(Bt,{open:Nn,onOpenChange:pt,children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(_h,{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:"热度积分 = 阅读权重×阅读排名分 + 新度权重×新度排名分 + 付款权重×付款排名分(三权重之和须为 1)"}),Bn?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(ne,{className:"text-gray-400 text-xs",children:"阅读权重"}),s.jsx(de,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:It.readWeight,onChange:E=>un(B=>({...B,readWeight:Math.max(0,Math.min(1,parseFloat(E.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"新度权重"}),s.jsx(de,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:It.recencyWeight,onChange:E=>un(B=>({...B,recencyWeight:Math.max(0,Math.min(1,parseFloat(E.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"付款权重"}),s.jsx(de,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:It.payWeight,onChange:E=>un(B=>({...B,payWeight:Math.max(0,Math.min(1,parseFloat(E.target.value)||0))}))})]})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["当前之和: ",(It.readWeight+It.recencyWeight+It.payWeight).toFixed(1)]}),s.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs text-gray-400",children:[s.jsx("li",{children:"阅读量前 20 名:第1名=20分、第2名=19分...第20名=1分"}),s.jsx("li",{children:"最近更新前 30 篇:第1名=30分、第2名=29分...第30名=1分"}),s.jsx("li",{children:"付款数前 20 名:第1名=20分、第2名=19分...第20名=1分"}),s.jsx("li",{children:"热度分可在编辑章节中手动覆盖"})]}),s.jsx(G,{onClick:Qs,disabled:Wt||Math.abs(It.readWeight+It.recencyWeight+It.payWeight-1)>.001,className:"w-full bg-amber-500 hover:bg-amber-600 text-white",children:Wt?"保存中...":"保存权重"})]})]})]})}),s.jsx(Bt,{open:re,onOpenChange:$,children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx($n,{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(ne,{className:"text-gray-300",children:"篇名(如:第六篇|真实的社会)"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",value:q,onChange:E=>O(E.target.value),placeholder:"输入篇名"})]})}),s.jsxs(gn,{children:[s.jsx(G,{variant:"outline",onClick:()=>{$(!1),O("")},className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(G,{onClick:ud,disabled:Q||!q.trim(),className:"bg-amber-500 hover:bg-amber-600 text-white",children:Q?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx($n,{className:"w-4 h-4 mr-2"}),"创建篇"]})})]})]})}),s.jsx(Bt,{open:!!c,onOpenChange:()=>u(null),children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white inset-0 translate-x-0 translate-y-0 w-screen h-screen max-w-none max-h-none rounded-none flex flex-col p-0 gap-0",showCloseButton:!0,children:[s.jsx(Vt,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(tn,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节"]})}),c&&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(ne,{className:"text-gray-300",children:"章节ID"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",value:c.id,onChange:E=>u({...c,id:E.target.value}),placeholder:"如: 9.15"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"价格 (元)"}),s.jsx(de,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:c.isFree?0:c.price,onChange:E=>u({...c,price:Number(E.target.value),isFree:Number(E.target.value)===0}),disabled:c.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{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:c.isFree||c.price===0,onChange:E=>u({...c,isFree:E.target.checked,price:E.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(ne,{className:"text-gray-300",children:"预览%"}),s.jsx(de,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",placeholder:`全局 ${Ct}%`,value:c.previewPercent!=null?String(c.previewPercent):"",onChange:E=>{const B=E.target.value.trim();if(B===""){u({...c,previewPercent:null});return}const ue=Number(B);Number.isFinite(ue)&&u({...c,previewPercent:Math.min(100,Math.max(1,Math.round(ue)))})}})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{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:c.isNew??!1,onChange:E=>u({...c,isNew:E.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(ne,{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:c.isPinned??!1,onChange:E=>u({...c,isPinned:E.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(ne,{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:c.editionPremium!==!0,onChange:()=>u({...c,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:c.editionPremium===!0,onChange:()=>u({...c,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(ne,{className:"text-gray-300",children:"热度分"}),s.jsx(de,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:c.hotScore??0,onChange:E=>u({...c,hotScore:Math.max(0,parseFloat(E.target.value)||0)})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"章节标题"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",value:c.title,onChange:E=>u({...c,title:E.target.value})})]}),c.filePath&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"文件路径"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-gray-400 text-sm",value:c.filePath,disabled:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),m?s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700 rounded-md min-h-[400px] flex items-center justify-center",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(M0,{ref:Xl,content:c.content||"",onChange:E=>u({...c,content:E}),onImageUpload:_i,onMediaUpload:Xa,persons:xt,linkTags:Pt,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(gn,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[c&&s.jsxs(G,{variant:"outline",onClick:()=>er({id:c.id,title:c.title,price:c.price}),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent mr-auto",children:[s.jsx(dr,{className:"w-4 h-4 mr-2"}),"付款记录"]}),s.jsxs(G,{variant:"outline",onClick:()=>u(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsx(G,{onClick:na,disabled:b,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:b?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),s.jsxs(Wc,{defaultValue:"chapters",className:"space-y-6",children:[s.jsxs(Dl,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(nn,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(dr,{className:"w-4 h-4 mr-2"}),"章节管理"]}),s.jsxs(nn,{value:"ranking",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx($x,{className:"w-4 h-4 mr-2"}),"内容排行榜"]}),s.jsxs(nn,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(za,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),s.jsxs(nn,{value:"link-person",className:"data-[state=active]:bg-purple-500/20 data-[state=active]:text-purple-400 text-gray-400",children:[s.jsx(Si,{className:"w-4 h-4 mr-2"}),"@列表"]}),s.jsxs(nn,{value:"link-tag",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(S1,{className:"w-4 h-4 mr-2"}),"链接标签"]})]}),s.jsxs(sn,{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(dr,{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:zi}),s.jsx("span",{className:"text-xs text-gray-500",children:"章节"})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(G,{onClick:()=>f(!0),className:"flex-1 min-w-[120px] bg-[#38bdac]/10 hover:bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/30",children:[s.jsx($n,{className:"w-4 h-4 mr-2"}),"新建章节"]}),s.jsxs(G,{onClick:()=>$(!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($n,{className:"w-4 h-4 mr-2"}),"新建篇"]}),s.jsxs(G,{variant:"outline",onClick:()=>X(!0),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:["批量移动(已选 ",J.length," 节)"]})]}),r?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(q9,{parts:lt,expandedParts:i,onTogglePart:Fi,onReorder:xr,onReadSection:ti,onDeleteSection:Js,onAddSectionInPart:Aa,onAddChapterInPart:ns,onDeleteChapter:si,onEditPart:ni,onDeletePart:ri,onEditChapter:sa,selectedSectionIds:J,onToggleSectionSelect:el,onShowSectionOrders:er,pinnedSectionIds:Te})]}),s.jsx(sn,{value:"search",className:"space-y-4",children:s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(ut,{children:s.jsx(ht,{className:"text-white",children:"内容搜索"})}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",placeholder:"搜索标题或内容...",value:j,onChange:E=>v(E.target.value),onKeyDown:E=>E.key==="Enter"&&Rr()}),s.jsx(G,{onClick:Rr,disabled:C||!j.trim(),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:C?s.jsx(He,{className:"w-4 h-4 animate-spin"}):s.jsx(za,{className:"w-4 h-4"})})]}),k.length>0&&s.jsxs("div",{className:"space-y-2 mt-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["找到 ",k.length," 个结果"]}),k.map(E=>s.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors",onClick:()=>{const B=e.find(ue=>ue.id===E.id);ti({id:E.id,mid:E.mid,title:E.title,price:E.price??1,filePath:"",previewPercent:B==null?void 0:B.previewPercent})},children:[s.jsxs("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:E.id}),s.jsx("span",{className:"text-white",children:E.title}),Te.includes(E.id)&&s.jsx(Dc,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})]}),s.jsx(Be,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:E.matchType==="title"?"标题匹配":"内容匹配"})]}),E.snippet&&s.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:E.snippet}),(E.partTitle||E.chapterTitle)&&s.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[E.partTitle," · ",E.chapterTitle]})]},E.id))]})]})]})}),s.jsxs(sn,{value:"ranking",className:"space-y-4",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs(ht,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(_h,{className:"w-4 h-4 text-[#38bdac]"}),"内容显示规则"]})}),s.jsx(_e,{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(ne,{className:"text-gray-400 text-sm whitespace-nowrap",children:"未付费预览比例"}),s.jsx(de,{type:"number",min:"1",max:"100",className:"bg-[#0a1628] border-gray-700 text-white w-20",value:Ct,onChange:E=>$e(Math.max(1,Math.min(100,Number(E.target.value)||20))),disabled:V}),s.jsx("span",{className:"text-gray-500 text-sm",children:"%"})]}),s.jsx(G,{size:"sm",onClick:Qo,disabled:vt,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:vt?"保存中...":"保存"}),s.jsxs("span",{className:"text-xs text-gray-500",children:["小程序未付费用户默认显示文章前 ",Ct,"% 内容"]})]})})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs(ht,{className:"text-white text-base flex items-center gap-2",children:[s.jsx($x,{className:"w-4 h-4 text-amber-400"}),"内容排行榜",s.jsxs("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["按热度排行 · 共 ",Zn.length," 节"]})]}),s.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[s.jsx(G,{variant:"ghost",size:"sm",onClick:()=>gr(),disabled:yn,className:"text-gray-400 hover:text-white h-7 w-7 p-0",title:"刷新排行榜",children:s.jsx(He,{className:`w-4 h-4 ${yn?"animate-spin":""}`})}),s.jsx(G,{variant:"ghost",size:"sm",disabled:En<=1||yn,onClick:()=>Vn(E=>Math.max(1,E-1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(u5,{className:"w-4 h-4"})}),s.jsxs("span",{className:"text-gray-400 min-w-[60px] text-center",children:[En," / ",ei]}),s.jsx(G,{variant:"ghost",size:"sm",disabled:En>=ei||yn,onClick:()=>Vn(E=>Math.min(ei,E+1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(vl,{className:"w-4 h-4"})})]})]})}),s.jsx(_e,{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:"编辑"})]}),Go.map((E,B)=>{const ue=(En-1)*Za+B+1,je=E.isPinned??Te.includes(E.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 ${je?"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(G,{variant:"ghost",size:"sm",className:`h-6 w-6 p-0 ${je?"text-amber-400":"text-gray-600 hover:text-amber-400"}`,onClick:()=>Pr(E.id),disabled:at,title:je?"取消置顶":"强制置顶(精选推荐/首页最新更新)",children:je?s.jsx(Dc,{className:"w-3.5 h-3.5 fill-current"}):s.jsx(T1,{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:E.title}),s.jsxs("span",{className:"text-gray-600 text-xs",children:[E.partTitle," · ",E.chapterTitle]})]}),s.jsx("span",{className:"text-right text-sm text-blue-400 font-mono",children:E.clickCount??0}),s.jsx("span",{className:"text-right text-sm text-green-400 font-mono",children:E.payCount??0}),s.jsx("span",{className:"text-right text-sm text-amber-400 font-mono",children:(E.hotScore??0).toFixed(1)}),s.jsx("div",{className:"text-right",children:s.jsx(G,{variant:"ghost",size:"sm",className:"text-gray-500 hover:text-[#38bdac] h-6 px-1",onClick:()=>ti({id:E.id,mid:E.mid,title:E.title,price:E.price,filePath:"",previewPercent:E.previewPercent}),title:"编辑文章",children:s.jsx(tn,{className:"w-3 h-3"})})})]},E.id)}),Go.length===0&&s.jsx("div",{className:"py-8 text-center text-gray-500",children:"暂无数据"})]})})]})]}),s.jsxs(sn,{value:"link-person",className:"space-y-4",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"pb-3",children:[s.jsxs(ht,{className:"text-white text-base flex items-center gap-2",children:[s.jsx("span",{className:"text-[#38bdac] text-lg font-bold",children:"@"}),"AI列表 — @列表(编辑器内输入 @ 可链接)"]}),s.jsxs("div",{className:"text-xs text-gray-500 mt-1 space-y-1",children:[s.jsxs("p",{children:["文章 @ 存 ",s.jsx("span",{className:"text-gray-400",children:"token"}),";小程序点 @ 用 token 换存客宝密钥后加好友/拉群。"]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-purple-300",children:"超级个体"}),":开通且昵称合法会自动进本列表可 @;共用「超级个体拉群」统一获客计划(话术由技术侧在系统里配置,本页不填 plan/apiKey,避免误操作)。"]}),s.jsx("p",{children:"点「添加」新建的人物:每人单独一条存客宝计划(SOUL链接人与事-名称)。"})]})]}),s.jsxs(_e,{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:"本页只管理可 @ 的人物列表"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(G,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 hover:bg-gray-700/50",onClick:()=>{On()},title:"刷新",children:s.jsx(He,{className:"w-4 h-4"})}),s.jsxs(G,{size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",onClick:()=>{Ja(null),Yr(!0)},children:[s.jsx($n,{className:"w-4 h-4 mr-2"}),"添加"]})]})]}),s.jsx("div",{className:"max-h-[400px] overflow-y-auto",children:xt.length>0?s.jsxs("table",{className:"w-full text-sm border-collapse",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"text-xs text-gray-500 border-b border-gray-700/50",children:[s.jsx("th",{className:"text-left py-1.5 px-3 w-[280px] font-normal",children:"token"}),s.jsx("th",{className:"text-left py-1.5 px-3 w-24 font-normal",children:"@的人"}),s.jsx("th",{className:"text-left py-1.5 px-3 w-[72px] font-normal text-xs",children:"来源"}),s.jsx("th",{className:"text-left py-1.5 px-3 w-[100px] font-normal text-xs",children:"会员"}),s.jsx("th",{className:"py-1.5 px-3 w-16 font-normal text-center",children:"获客数"}),s.jsx("th",{className:"text-left py-1.5 px-3 font-normal",children:"获客计划"}),s.jsx("th",{className:"text-center py-1.5 px-2 w-14 font-normal text-xs",children:"置顶"}),s.jsx("th",{className:"text-left py-1.5 px-3 w-16 font-normal",children:"状态"}),s.jsx("th",{className:"text-left py-1.5 px-2 w-24 font-normal",children:"操作"})]})}),s.jsx("tbody",{children:xt.map(E=>s.jsxs("tr",{className:"border-b border-gray-700/30 hover:bg-[#0a1628]/80",children:[s.jsx("td",{className:"py-2 px-3 text-gray-400 text-xs font-mono",title:"32位token",children:E.id}),s.jsx("td",{className:"py-2 px-3 truncate max-w-[96px]",children:s.jsx("button",{type:"button",className:"text-amber-400 hover:text-amber-300 hover:underline text-left",onClick:()=>{en[E.id]&&Sa(E.id,E.name)},title:en[E.id]?"点击查看获客详情":E.name,children:E.name})}),s.jsx("td",{className:"py-2 px-3",children:E.personSource==="vip_sync"?s.jsx("span",{className:"text-[10px] text-purple-300 bg-purple-500/15 px-1.5 py-0.5 rounded whitespace-nowrap",children:"超级个体"}):s.jsx("span",{className:"text-[10px] text-gray-500 bg-gray-500/10 px-1.5 py-0.5 rounded whitespace-nowrap",children:"手工"})}),s.jsx("td",{className:"py-2 px-3 text-xs",children:E.userId?s.jsxs("div",{className:"flex flex-col gap-0.5 items-start max-w-[100px]",children:[E.personSource==="vip_sync"&&s.jsx("span",{className:"text-[10px] text-purple-300/90 leading-tight",children:"已绑定超级个体"}),s.jsx("button",{type:"button",className:"text-[#38bdac] hover:underline truncate max-w-[96px] block text-left",title:`用户ID: ${E.userId}`,onClick:()=>t(`/users?search=${encodeURIComponent(E.userId||"")}`),children:E.name})]}):s.jsx("span",{className:"text-gray-600",children:"—"})}),(()=>{const B=en[E.id]||0;return s.jsx("td",{className:`py-2 px-3 shrink-0 w-16 text-center text-xs font-bold cursor-pointer ${B>0?"text-green-400 hover:text-green-300 hover:underline":"text-gray-600"}`,title:B>0?"点击查看获客详情":"暂无获客",onClick:()=>{B>0&&Sa(E.id,E.name)},children:B})})(),s.jsx("td",{className:"py-2 px-3 text-white truncate max-w-[220px]",title:`planId: ${E.ckbPlanId??"-"}`,children:s.jsx("div",{className:"flex items-center gap-1.5",children:s.jsx("span",{className:"truncate",children:E.ckbPlanId?E.personSource==="vip_sync"?"超级个体拉群(统一计划)":`SOUL链接人与事-${E.name}`:"—"})})}),s.jsx("td",{className:"py-2 px-2 text-center",children:s.jsx(G,{type:"button",variant:"ghost",size:"sm",className:E.isPinned?"text-amber-400 hover:text-amber-300 h-7 px-2":"text-gray-500 hover:text-amber-400/90 h-7 px-2",title:E.isPinned?"取消小程序首页置顶":"设为小程序首页置顶(全局唯一)",onClick:()=>void Zl(E,!E.isPinned),children:s.jsx(T1,{className:`w-3.5 h-3.5 ${E.isPinned?"fill-amber-400":""}`})})}),s.jsx("td",{className:"py-2 px-3 text-center",children:E.ckbPlanId?s.jsx("span",{className:"text-[10px] text-green-400 bg-green-400/10 px-1.5 py-0.5 rounded",children:"启用"}):s.jsx("span",{className:"text-[10px] text-gray-500 bg-gray-500/10 px-1.5 py-0.5 rounded",children:"未配置"})}),s.jsx("td",{className:"py-2 px-2",children:s.jsxs("div",{className:"flex items-center gap-0",children:[s.jsx(G,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-[#38bdac] h-6 px-2",title:"编辑",onClick:async()=>{try{const B=await J9(E.personId||"");if(B!=null&&B.success&&B.person){const ue=B.person;Ja({id:ue.token??ue.personId,personId:ue.personId,name:ue.name,personSource:ue.personSource??"",userId:ue.userId??"",label:ue.label??"",ckbApiKey:ue.ckbApiKey??"",remarkType:ue.remarkType,remarkFormat:ue.remarkFormat,addFriendInterval:ue.addFriendInterval,startTime:ue.startTime,endTime:ue.endTime,deviceGroups:ue.deviceGroups})}else Ja(E),B!=null&&B.error&&Y.error(B.error)}catch(B){console.error(B),Ja(E),Y.error(B instanceof Error?B.message:"加载人物详情失败")}Yr(!0)},children:s.jsx(C1,{className:"w-3 h-3"})}),s.jsx(G,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-green-400 h-6 px-2",title:"查看新客户",onClick:()=>Sa(E.id,E.name),children:s.jsx(Un,{className:"w-3 h-3"})}),s.jsx(G,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",title:E.personSource==="vip_sync"?"删除本地 @人物(不删统一获客计划)":"删除(同时删除存客宝对应获客计划)",onClick:()=>Ar(E),children:s.jsx(Yn,{className:"w-3 h-3"})})]})})]},E.id))})]}):s.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无AI人物,添加后可在编辑器中 @链接"})})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"pb-3",children:[s.jsxs(ht,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(YM,{className:"w-4 h-4 text-[#38bdac]"}),"存客宝绑定"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"配置存客宝 API 后,文章中 @人物 或 #标签 点击可自动进入存客宝流量池"})]}),s.jsxs(_e,{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(ne,{className:"text-gray-400 text-xs",children:"存客宝 API 地址"}),s.jsx(de,{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(ne,{className:"text-gray-400 text-xs",children:"绑定计划"}),s.jsx(de,{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.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"pb-3",children:[s.jsxs(ht,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(_h,{className:"w-4 h-4 text-blue-400"}),"获客 Webhook 通知"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"配置后新获客线索将自动推送到群聊(支持企业微信/飞书 Webhook)"})]}),s.jsxs(_e,{className:"space-y-3",children:[s.jsxs("div",{className:"flex gap-3 items-end",children:[s.jsxs("div",{className:"flex-1 space-y-1",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"Webhook URL"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm font-mono",placeholder:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=...",value:ea,onChange:E=>Na(E.target.value)})]}),s.jsxs(G,{size:"sm",className:"bg-blue-500 hover:bg-blue-600 text-white h-8",onClick:async()=>{const E=ea.trim();try{const B=await kt("/api/db/config",{key:"ckb_lead_webhook_url",value:E,description:"获客线索 Webhook 通知 URL(企微/飞书)"});B!=null&&B.success?Y.success(E?"Webhook 已保存":"Webhook 已清除"):Y.error((B==null?void 0:B.error)??"保存失败")}catch{Y.error("保存失败")}},children:[s.jsx(Cn,{className:"w-3.5 h-3.5 mr-1"}),"保存"]})]}),s.jsx("p",{className:"text-xs text-gray-500",children:"配置企业微信或飞书群机器人 Webhook URL,获客成功后自动推送通知"})]})]})]}),s.jsxs(sn,{value:"link-tag",className:"space-y-4",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"pb-3",children:[s.jsxs(ht,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(S1,{className:"w-4 h-4 text-amber-400"}),"链接标签 — 链接事与物(编辑器内 #标签 可跳转链接/小程序/存客宝)"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"小程序端点击 #标签 可直接跳转对应链接,进入流量池"})]}),s.jsxs(_e,{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-end justify-between gap-3 flex-wrap",children:[s.jsxs("div",{className:"flex items-end gap-2 flex-wrap",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"搜索"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-48",placeholder:"按标签ID/显示文字搜索",value:Ws,onChange:E=>{pr(E.target.value),Jr(1)}})]}),s.jsx(G,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 hover:bg-gray-700/50 h-8",onClick:()=>{Ir(),yr()},title:"刷新",children:s.jsx(He,{className:"w-4 h-4"})})]}),s.jsxs(G,{size:"sm",className:"bg-amber-500 hover:bg-amber-600 text-white h-8",onClick:()=>{Ne(null),Nt({tagId:"",label:"",aliases:"",url:"",type:"url",appId:"",appSecret:"",pagePath:""}),Xs(""),Zs(!1),Ds(!0)},children:[s.jsx($n,{className:"w-4 h-4 mr-2"}),"添加标签"]})]}),s.jsxs("div",{className:"rounded-md border border-gray-700/50 overflow-hidden",children:[s.jsx("div",{className:"max-h-[420px] overflow-y-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{className:"bg-[#0a1628] border-b border-gray-700/50",children:s.jsxs("tr",{children:[s.jsx("th",{className:"text-left px-3 py-2 text-gray-400 w-32",children:"标签"}),s.jsx("th",{className:"text-left px-3 py-2 text-gray-400 w-28",children:"别名"}),s.jsx("th",{className:"text-left px-3 py-2 text-gray-400 w-20",children:"类型"}),s.jsx("th",{className:"text-left px-3 py-2 text-gray-400",children:"目标 / AppID"}),s.jsx("th",{className:"text-right px-3 py-2 text-gray-400 w-28",children:"操作"})]})}),s.jsx("tbody",{children:hr?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:"加载中..."})}):wn.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:"暂无链接标签,添加后可在编辑器中使用 #标签 跳转"})}):wn.map(E=>s.jsxs("tr",{className:"border-b border-gray-700/30 hover:bg-white/5",children:[s.jsx("td",{className:"px-3 py-2",children:s.jsxs("button",{type:"button",className:"text-amber-400 font-semibold hover:text-amber-300 hover:underline text-left",onClick:()=>{Ne(E),Nt({tagId:E.id,label:E.label,aliases:E.aliases??"",url:E.url,type:E.type,appId:E.appId??"",appSecret:"",pagePath:E.pagePath??""}),Xs(E.appId??""),Zs(!1),Ds(!0)},title:"点击编辑标签",children:["#",E.label]})}),s.jsx("td",{className:"px-3 py-2 text-gray-500 text-xs truncate max-w-[120px]",title:E.aliases||"",children:E.aliases||"—"}),s.jsx("td",{className:"px-3 py-2",children:s.jsx(Be,{variant:"secondary",className:`text-[10px] ${E.type==="ckb"?"bg-green-500/20 text-green-300 border-green-500/30":E.type==="miniprogram"||E.type==="wxlink"?"bg-[#38bdac]/20 text-[#38bdac] border-[#38bdac]/30":"bg-gray-700 text-gray-300"}`,children:E.type==="url"?"网页":E.type==="ckb"?"存客宝":E.type==="wxlink"?"小程序链接":"小程序"})}),s.jsx("td",{className:"px-3 py-2 text-gray-300",children:E.type==="miniprogram"?s.jsxs("div",{className:"space-y-0.5",children:[(()=>{const B=Ys.find(ue=>ue.key===E.appId);return s.jsxs(s.Fragment,{children:[B&&s.jsx("div",{className:"text-xs text-white",children:B.name}),s.jsxs("div",{className:"text-xs font-mono text-[#38bdac]",children:["AppID: ",(B==null?void 0:B.appId)||E.appId||"—"]})]})})(),E.pagePath&&s.jsx("div",{className:"text-xs text-gray-500 font-mono",children:E.pagePath}),s.jsxs("div",{className:`text-xs ${E.hasAppSecret?"text-emerald-400/90":"text-amber-500/80"}`,children:["AppSecret:",E.hasAppSecret?"已保存(仅服务端)":"未配置"]})]}):E.type==="wxlink"?s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("div",{className:"text-xs text-[#38bdac] truncate max-w-[420px] font-mono",title:E.url,children:E.url||"—"}),s.jsx("div",{className:"text-[11px] text-gray-500",children:"小程序内点击 → web-view 打开 → 自动唤起目标小程序"})]}):E.url?s.jsxs("a",{href:E.url,target:"_blank",rel:"noreferrer",className:"text-blue-400 text-xs truncate max-w-[420px] hover:underline inline-flex items-center gap-1",children:[E.url," ",s.jsx(To,{className:"w-3 h-3 shrink-0"})]}):s.jsx("span",{className:"text-gray-500 text-xs",children:"—"})}),s.jsx("td",{className:"px-3 py-2",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(G,{variant:"ghost",size:"sm",className:"text-gray-300 hover:text-white h-7 px-2",onClick:()=>{Ne(E),Nt({tagId:E.id,label:E.label,aliases:E.aliases??"",url:E.url,type:E.type,appId:E.appId??"",appSecret:"",pagePath:E.pagePath??""}),Xs(E.appId??""),Zs(!1),Ds(!0)},title:"编辑",children:s.jsx(C1,{className:"w-3 h-3"})}),s.jsx(G,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-7 px-2",onClick:async()=>{if(confirm(`确定要删除「#${E.label}」吗?`))try{const B=await ki(`/api/db/link-tags?tagId=${encodeURIComponent(E.id)}`);B!=null&&B.success?(Y.success("已删除"),Ir(),yr()):Y.error((B==null?void 0:B.error)??"删除失败")}catch(B){console.error(B),Y.error("删除失败")}},title:"删除",children:s.jsx(Yn,{className:"w-3 h-3"})})]})})]},E.id))})]})}),s.jsx(cr,{page:Gr,pageSize:ba,total:Mr,totalPages:Ga,onPageChange:E=>Jr(E),onPageSizeChange:E=>{Tr(E),Jr(1)}})]})]})]}),s.jsx(Bt,{open:Ks,onOpenChange:Ds,children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg p-4 gap-3",children:[s.jsxs(Vt,{className:"gap-1",children:[s.jsx(Ht,{className:"text-base",children:le?"编辑链接标签":"添加链接标签"}),s.jsx(Ef,{className:"text-gray-400 text-xs",children:"配置后可在富文本编辑器中通过 #标签 插入,并在小程序端点击跳转。小程序类型需填 mpKey 或微信 AppID;AppSecret 仅存服务端(不下发小程序),供后续开放接口与台账使用。"})]}),s.jsxs("div",{className:"space-y-3 py-2",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-300 text-sm",children:"标签ID"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm font-mono",placeholder:"留空自动生成;或自定义短 ID(如 kr),最长 50 字符",value:Xe.tagId,disabled:!!le,onChange:E=>Nt(B=>({...B,tagId:E.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-300 text-sm",children:"显示文字"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"如 神仙团队",value:Xe.label,onChange:E=>Nt(B=>({...B,label:E.target.value}))})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-300 text-sm",children:"别名(多个用逗号分隔,同指向一个目标)"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"如 团队招募, 团队合伙人",value:Xe.aliases,onChange:E=>Nt(B=>({...B,aliases:E.target.value}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 items-end",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-300 text-sm",children:"类型"}),s.jsxs(Pc,{value:Xe.type,onValueChange:E=>Nt(B=>({...B,type:E})),children:[s.jsx(yl,{className:"bg-[#0a1628] border-gray-700 text-white h-8",children:s.jsx(Rc,{})}),s.jsxs(bl,{className:"bg-[#0f2137] border-gray-700 text-white",children:[s.jsx(or,{value:"url",children:"网页链接"}),s.jsx(or,{value:"miniprogram",children:"小程序(API跳转)"}),s.jsx(or,{value:"wxlink",children:"小程序链接(右上角复制)"}),s.jsx(or,{value:"ckb",children:"存客宝"})]})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-300 text-sm",children:Xe.type==="url"?"URL地址":Xe.type==="ckb"?"存客宝计划URL":Xe.type==="wxlink"?"小程序链接":"小程序 mpKey / 微信 AppID"}),Xe.type==="wxlink"?s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"粘贴小程序右上角 ... → 复制链接 得到的 URL",value:Xe.url,onChange:E=>Nt(B=>({...B,url:E.target.value}))}):Xe.type==="miniprogram"&&Ys.length>0?s.jsxs("div",{ref:Bi,className:"relative",children:[s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"搜索名称或密钥",value:ts?br:Xe.appId,onChange:E=>{const B=E.target.value;Xs(B),Zs(!0),Ys.some(ue=>ue.key===B)||Nt(ue=>({...ue,appId:B}))},onFocus:()=>{Xs(Xe.appId),Zs(!0)},onBlur:()=>setTimeout(()=>Zs(!1),150)}),ts&&s.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 max-h-48 overflow-y-auto rounded-md border border-gray-700 bg-[#0a1628] shadow-lg z-50",children:Ea.length===0?s.jsx("div",{className:"px-3 py-2 text-gray-500 text-xs",children:"无匹配,可手动输入密钥"}):Ea.map(E=>s.jsxs("button",{type:"button",className:"w-full px-3 py-2 text-left text-sm text-white hover:bg-[#38bdac]/20 flex flex-col gap-0.5",onMouseDown:B=>{B.preventDefault(),Nt(ue=>({...ue,appId:E.key,pagePath:E.path||""})),Xs(""),Zs(!1)},children:[s.jsx("span",{children:E.name}),s.jsx("span",{className:"text-xs text-gray-400 font-mono",children:E.key})]},E.key))})]}):s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:Xe.type==="url"?"https://...":Xe.type==="ckb"?"https://ckbapi.quwanzhi.com/...":"关联配置的 key,或直接填 wx 开头的 AppID",value:Xe.type==="url"||Xe.type==="ckb"?Xe.url:Xe.appId,onChange:E=>{Xe.type==="url"||Xe.type==="ckb"?Nt(B=>({...B,url:E.target.value})):Nt(B=>({...B,appId:E.target.value}))}})]})]}),Xe.type==="wxlink"&&s.jsx("p",{className:"text-[11px] text-amber-400/80 leading-snug px-0.5",children:"操作:打开目标小程序 → 右上角「...」→「复制链接」→ 粘贴到上面。小程序内点击此标签会在 web-view 中打开,微信自动唤起目标小程序,无需修改小程序版本。"}),Xe.type==="miniprogram"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-300 text-sm",children:"页面路径(可选)"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm font-mono",placeholder:"pages/index/index",value:Xe.pagePath,onChange:E=>Nt(B=>({...B,pagePath:E.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-300 text-sm",children:"AppSecret(微信公众平台 · 仅服务端存储)"}),s.jsx(de,{type:"password",autoComplete:"new-password",className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm font-mono",placeholder:le!=null&&le.hasAppSecret?"已保存密钥,留空不改;填写则覆盖":"粘贴目标小程序 AppSecret",value:Xe.appSecret,onChange:E=>Nt(B=>({...B,appSecret:E.target.value}))}),s.jsx("p",{className:"text-[11px] text-gray-500 leading-snug",children:"与 AppID 成对落库;接口响应与小程序配置中均不会返回此字段。"})]})]})]}),s.jsxs(gn,{className:"gap-2 pt-1",children:[s.jsx(G,{variant:"outline",onClick:()=>Ds(!1),className:"border-gray-600",children:"取消"}),s.jsx(G,{onClick:async()=>{const E={tagId:Xe.tagId.trim(),label:Xe.label.trim(),aliases:Xe.aliases.trim(),url:Xe.url.trim(),type:Xe.type,appId:Xe.appId.trim(),appSecret:Xe.appSecret.trim(),pagePath:Xe.pagePath.trim()};if(E.tagId){const B=E.tagId;if([...B].length>50){Y.error("标签ID 最长 50 个字符");return}if(/[#,\n\r\t]/.test(B)){Y.error("标签ID 不能含 #、逗号或换行");return}}if(!E.label){Y.error("显示文字必填");return}E.type==="miniprogram"&&(E.url=""),E.type==="wxlink"&&(E.appId="",E.pagePath=""),qs(!0);try{const B=await kt("/api/db/link-tags",E);B!=null&&B.success?(Y.success(le?"已更新":"已添加"),Ds(!1),Ir(),yr()):Y.error((B==null?void 0:B.error)??"保存失败")}catch(B){console.error(B),Y.error("保存失败")}finally{qs(!1)}},disabled:Zt,className:"bg-amber-500 hover:bg-amber-600 text-white",children:Zt?"保存中...":"保存"})]})]})})]})]}),s.jsx(tV,{open:Ho,onOpenChange:Yr,editingPerson:Li,onSubmit:async E=>{var je;const B={personId:E.personId||E.name.toLowerCase().replace(/\s+/g,"_")+"_"+Date.now().toString(36),name:E.name,userId:E.boundUserId,aliases:E.aliases||void 0,label:E.label,ckbApiKey:E.ckbApiKey||void 0,greeting:E.greeting||void 0,tips:E.tips||void 0,remarkType:E.remarkType||void 0,remarkFormat:E.remarkFormat||void 0,addFriendInterval:E.addFriendInterval,startTime:E.startTime||void 0,endTime:E.endTime||void 0,deviceGroups:(je=E.deviceGroups)!=null&&je.trim()?E.deviceGroups.split(",").map(Ke=>parseInt(Ke.trim(),10)).filter(Ke=>!Number.isNaN(Ke)):void 0},ue=await kt("/api/db/persons",B);if(ue&&ue.success===!1){const Ke=ue;Ke.ckbResponse&&console.log("存客宝返回",Ke.ckbResponse);const mt=Ke.error||"操作失败";throw new Error(mt)}if(On(),Y.success(Li?"已保存":"已添加"),ue!=null&&ue.ckbCreateResult&&Object.keys(ue.ckbCreateResult).length>0){const Ke=ue.ckbCreateResult;console.log("存客宝创建结果",Ke);const mt=Ke.planId??Ke.id,wt=mt!=null?[`planId: ${mt}`]:[];Ke.apiKey!=null&&wt.push("apiKey: ***"),Y.info(wt.length?`存客宝创建结果:${wt.join(",")}`:"存客宝创建结果见控制台")}}}),s.jsx(Bt,{open:!!hs,onOpenChange:E=>{E||Ar(null)},children:s.jsxs($t,{showCloseButton:!0,className:"bg-[#0f2137] border-gray-700 text-white max-w-md p-4 gap-3",children:[s.jsxs(Vt,{className:"gap-1",children:[s.jsx(Ht,{className:"text-white text-base",children:"确认删除"}),s.jsx(Ef,{className:"text-gray-400 text-sm leading-relaxed wrap-break-word",children:hs&&s.jsxs(s.Fragment,{children:[hs.personSource==="vip_sync"?s.jsxs(s.Fragment,{children:[s.jsxs("p",{children:["确定删除超级个体「",hs.name,"」对应的 @人物?"]}),s.jsxs("p",{className:"mt-1.5 text-amber-200/90",children:["仅删除本系统的 Person 与独立 token,",s.jsx("strong",{children:"不会"}),"删除存客宝里的「超级个体统一获客计划」(其他超级个体仍在使用该计划)。"]})]}):s.jsx(s.Fragment,{children:s.jsxs("p",{children:["确定删除「SOUL链接人与事-",hs.name,"」?将同时删除存客宝对应获客计划。"]})}),s.jsxs("p",{className:"mt-1.5",children:["二次确认:删除后无法恢复,文章中的 @",hs.name," 将无法正常跳转。"]})]})})]}),s.jsxs(gn,{className:"gap-2 sm:gap-2 pt-1",children:[s.jsx(G,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-300",onClick:()=>Ar(null),children:"取消"}),s.jsx(G,{variant:"destructive",size:"sm",className:"bg-red-600 hover:bg-red-700",onClick:async()=>{hs&&(await ki(`/api/db/persons?personId=${hs.personId}`),Ar(null),On(),Y.success("已删除"))},children:"确定删除"})]})]})}),s.jsx(Bt,{open:Oi,onOpenChange:Xr,children:s.jsxs($t,{className:"max-w-2xl bg-[#0f2137] border-gray-700",children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Un,{className:"w-5 h-5 text-green-400"}),Di," — 获客详情(共 ",qn," 条)"]})}),s.jsx("div",{className:"max-h-[450px] overflow-y-auto space-y-2",children:mr?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(He,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):_s.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-[40px_1fr_90px_90px_70px_60px_110px] 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:"状态"}),s.jsx("span",{children:"时间"})]}),_s.map((E,B)=>s.jsxs("div",{className:"grid grid-cols-[40px_1fr_90px_90px_70px_60px_110px] gap-2 px-3 py-2 bg-[#0a1628] rounded text-sm",children:[s.jsx("span",{className:"text-gray-500 text-xs",children:(Zr-1)*20+B+1}),s.jsx("span",{className:"text-white truncate",children:E.nickname||E.name||E.userId||"-"}),s.jsx("span",{className:"text-gray-300 text-xs",children:E.phone||"-"}),s.jsx("span",{className:"text-gray-300 text-xs truncate",children:E.wechatId||"-"}),s.jsx("span",{className:"text-xs",children:E.source==="article_mention"?s.jsx("span",{className:"text-purple-400",children:"文章@"}):E.source==="index_lead"?s.jsx("span",{className:"text-blue-400",children:"首页"}):s.jsx("span",{className:"text-gray-500",children:E.source||"-"})}),s.jsx("span",{className:"text-[10px]",children:s.jsx("span",{className:"text-green-400 bg-green-400/10 px-1 py-0.5 rounded",children:"已添加"})}),s.jsx("span",{className:"text-gray-500 text-xs",children:E.createdAt?new Date(E.createdAt).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"-"})]},E.id))]})}),qn>20&&s.jsxs("div",{className:"flex items-center justify-center gap-2 pt-2",children:[s.jsx(G,{size:"sm",variant:"outline",disabled:Zr<=1,onClick:()=>Sa(va,Di,Zr-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:[Zr," / ",Math.ceil(qn/20)]}),s.jsx(G,{size:"sm",variant:"outline",disabled:Zr>=Math.ceil(qn/20),onClick:()=>Sa(va,Di,Zr+1),className:"border-gray-600 text-gray-300 bg-transparent h-7 px-3",children:"下一页"})]})]})})]})}const wi={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 pj(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):wi.stats}function mj(t){return Array.isArray(t)?t.map(e=>typeof e=="string"?e:String(e??"")).filter(Boolean):wi.highlights}function rV(){const[t,e]=y.useState(wi),[n,r]=y.useState(!0),[a,i]=y.useState(!1),[o,c]=y.useState(!1),u=y.useRef(null);y.useEffect(()=>{Oe("/api/admin/author-settings").then(k=>{const T=k==null?void 0:k.data;T&&typeof T=="object"&&e({name:String(T.name??wi.name),avatar:String(T.avatar??wi.avatar),avatarImg:String(T.avatarImg??""),title:String(T.title??wi.title),bio:String(T.bio??wi.bio),stats:pj(T.stats).length?pj(T.stats):wi.stats,highlights:mj(T.highlights).length?mj(T.highlights):wi.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(P=>P.label||P.value),highlights:t.highlights.filter(Boolean)},T=await kt("/api/admin/author-settings",k);if(!T||T.success===!1){Y.error("保存失败: "+(T&&typeof T=="object"&&"error"in T?T.error:""));return}i(!1);const C=document.createElement("div");C.className="fixed top-4 right-4 z-50 px-4 py-2 rounded-lg bg-[#38bdac] text-white text-sm shadow-lg",C.textContent="作者设置已保存",document.body.appendChild(C),setTimeout(()=>C.remove(),2e3)}catch(k){console.error(k),Y.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{i(!1)}},f=async k=>{var C;const T=(C=k.target.files)==null?void 0:C[0];if(T){c(!0);try{const P=new FormData;P.append("file",T),P.append("folder","avatars");const L=Pu(),U={};L&&(U.Authorization=`Bearer ${L}`);const H=await(await fetch(Rl("/api/upload"),{method:"POST",body:P,credentials:"include",headers:U})).json();H!=null&&H.success&&(H!=null&&H.url)?e(R=>({...R,avatarImg:H.url})):Y.error("上传失败: "+((H==null?void 0:H.error)||"未知错误"))}catch(P){console.error(P),Y.error("上传失败")}finally{c(!1),u.current&&(u.current.value="")}}},m=()=>e(k=>({...k,stats:[...k.stats,{label:"",value:""}]})),g=k=>e(T=>({...T,stats:T.stats.filter((C,P)=>P!==k)})),b=(k,T,C)=>e(P=>({...P,stats:P.stats.map((L,U)=>U===k?{...L,[T]:C}:L)})),N=()=>e(k=>({...k,highlights:[...k.highlights,""]})),j=k=>e(T=>({...T,highlights:T.highlights.filter((C,P)=>P!==k)})),v=(k,T)=>e(C=>({...C,highlights:C.highlights.map((P,L)=>L===k?T:P)}));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(ji,{className:"w-5 h-5 text-[#38bdac]"}),"作者详情"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置小程序「关于作者」页展示的作者信息,包括头像、简介、统计数据与亮点标签。"})]}),s.jsxs(G,{onClick:h,disabled:a||n,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"flex items-center gap-2 text-white",children:[s.jsx(ji,{className:"w-4 h-4 text-[#38bdac]"}),"基本信息"]}),s.jsx(Xt,{className:"text-gray-400",children:"作者姓名、头像、头衔与个人简介,将展示在「关于作者」页顶部。"})]}),s.jsxs(_e,{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(ne,{className:"text-gray-300",children:"姓名"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.name,onChange:k=>e(T=>({...T,name:k.target.value})),placeholder:"卡若"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"首字母占位(无头像时显示)"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white w-20",value:t.avatar,onChange:k=>e(T=>({...T,avatar:k.target.value.slice(0,1)||"K"})),placeholder:"K"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Wj,{className:"w-3 h-3 text-[#38bdac]"}),"头像图片"]}),s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(de,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:t.avatarImg,onChange:k=>e(T=>({...T,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(G,{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(jf,{className:"w-4 h-4 mr-2"}),o?"上传中...":"上传"]})]}),t.avatarImg&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:pa(t.avatarImg.startsWith("http")?t.avatarImg:Rl(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(ne,{className:"text-gray-300",children:"头衔"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.title,onChange:k=>e(T=>({...T,title:k.target.value})),placeholder:"Soul派对房主理人 · 私域运营专家"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"个人简介"}),s.jsx($l,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[120px]",value:t.bio,onChange:k=>e(T=>({...T,bio:k.target.value})),placeholder:"每天早上6点到9点..."})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsx(ht,{className:"text-white",children:"统计数据"}),s.jsx(Xt,{className:"text-gray-400",children:"展示在作者卡片中的数字指标,如「商业案例 62」「连续直播 365天」。第一个「商业案例」的值可由书籍统计自动更新。"})]}),s.jsxs(_e,{className:"space-y-3",children:[t.stats.map((k,T)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(de,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.label,onChange:C=>b(T,"label",C.target.value),placeholder:"标签"}),s.jsx(de,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.value,onChange:C=>b(T,"value",C.target.value),placeholder:"数值"}),s.jsx(G,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>g(T),children:s.jsx(Yn,{className:"w-4 h-4"})})]},T)),s.jsxs(G,{variant:"outline",size:"sm",onClick:m,className:"border-gray-600 text-gray-400",children:[s.jsx($n,{className:"w-4 h-4 mr-2"}),"添加统计项"]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsx(ht,{className:"text-white",children:"亮点标签"}),s.jsx(Xt,{className:"text-gray-400",children:"作者优势或成就的简短描述,以标签形式展示。"})]}),s.jsxs(_e,{className:"space-y-3",children:[t.highlights.map((k,T)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(de,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k,onChange:C=>v(T,C.target.value),placeholder:"5年私域运营经验"}),s.jsx(G,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>j(T),children:s.jsx(Yn,{className:"w-4 h-4"})})]},T)),s.jsxs(G,{variant:"outline",size:"sm",onClick:N,className:"border-gray-600 text-gray-400",children:[s.jsx($n,{className:"w-4 h-4 mr-2"}),"添加亮点"]})]})]})]})]})}function aV(t){return confirm(`确定删除该${t}?此操作不可恢复。`)?window.prompt(`请输入「删除」以确认删除${t}`)==="删除":!1}function iV(){const[t,e]=y.useState([]),[n,r]=y.useState(0),[a,i]=y.useState(1),[o]=y.useState(10),[c,u]=y.useState(0),[h,f]=y.useState(""),m=_l(h,300),[g,b]=y.useState(!0),[N,j]=y.useState(null),[v,k]=y.useState(!1),[T,C]=y.useState(null),[P,L]=y.useState(""),[U,_]=y.useState(""),[H,R]=y.useState(""),[Z,re]=y.useState("admin"),[$,ie]=y.useState("active"),[ce,me]=y.useState(!1);async function I(){var W;b(!0),j(null);try{const fe=new URLSearchParams({page:String(a),pageSize:String(o)});m.trim()&&fe.set("search",m.trim());const he=await Oe(`/api/admin/users?${fe}`);he!=null&&he.success?(e(he.records||[]),r(he.total??0),u(he.totalPages??0)):j(he.error||"加载失败")}catch(fe){const he=fe;j(he.status===403?"无权限访问":((W=he==null?void 0:he.data)==null?void 0:W.error)||"加载失败"),e([])}finally{b(!1)}}y.useEffect(()=>{I()},[a,o,m]);const J=()=>{C(null),L(""),_(""),R(""),re("admin"),ie("active"),k(!0)},z=W=>{C(W),L(W.username),_(""),R(W.name||""),re(W.role==="super_admin"?"super_admin":"admin"),ie(W.status==="disabled"?"disabled":"active"),k(!0)},ge=async()=>{var W;if(!P.trim()){j("用户名不能为空");return}if(!T&&!U){j("新建时密码必填,至少 6 位");return}if(U&&U.length<6){j("密码至少 6 位");return}j(null),me(!0);try{if(T){const fe=await Yt("/api/admin/users",{id:T.id,password:U||void 0,name:H.trim(),role:Z,status:$});fe!=null&&fe.success?(k(!1),I()):j((fe==null?void 0:fe.error)||"保存失败")}else{const fe=await kt("/api/admin/users",{username:P.trim(),password:U,name:H.trim(),role:Z});fe!=null&&fe.success?(k(!1),I()):j((fe==null?void 0:fe.error)||"保存失败")}}catch(fe){const he=fe;j(((W=he==null?void 0:he.data)==null?void 0:W.error)||"保存失败")}finally{me(!1)}},X=async W=>{var fe;if(!aV("管理员")){j("已取消删除");return}try{const he=await ki(`/api/admin/users?id=${W}`);he!=null&&he.success?I():j((he==null?void 0:he.error)||"删除失败")}catch(he){const oe=he;j(((fe=oe==null?void 0:oe.data)==null?void 0:fe.error)||"删除失败")}},F=W=>{if(!W)return"-";try{const fe=new Date(W);return isNaN(fe.getTime())?W:fe.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(Oc,{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(de,{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(G,{variant:"outline",size:"sm",onClick:I,disabled:g,className:"border-gray-600 text-gray-300",children:s.jsx(He,{className:`w-4 h-4 ${g?"animate-spin":""}`})}),s.jsxs(G,{onClick:J,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx($n,{className:"w-4 h-4 mr-2"}),"新增管理员"]})]})]}),N&&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:N}),s.jsx("button",{type:"button",onClick:()=>j(null),className:"text-red-400 hover:text-red-300",children:"×"})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-0",children:g?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(s.Fragment,{children:[s.jsxs(vs,{children:[s.jsx(Ns,{children:s.jsxs(bt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Se,{className:"text-gray-400",children:"ID"}),s.jsx(Se,{className:"text-gray-400",children:"用户名"}),s.jsx(Se,{className:"text-gray-400",children:"昵称"}),s.jsx(Se,{className:"text-gray-400",children:"角色"}),s.jsx(Se,{className:"text-gray-400",children:"状态"}),s.jsx(Se,{className:"text-gray-400",children:"创建时间"}),s.jsx(Se,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(ws,{children:[t.map(W=>s.jsxs(bt,{className:"border-gray-700/50",children:[s.jsx(ke,{className:"text-gray-300",children:W.id}),s.jsx(ke,{className:"text-white font-medium",children:W.username}),s.jsx(ke,{className:"text-gray-400",children:W.name||"-"}),s.jsx(ke,{children:s.jsx(Be,{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(ke,{children:s.jsx(Be,{variant:"outline",className:W.status==="active"?"border-[#38bdac]/50 text-[#38bdac]":"border-gray-500 text-gray-500",children:W.status==="active"?"正常":"已禁用"})}),s.jsx(ke,{className:"text-gray-500 text-sm",children:F(W.createdAt)}),s.jsxs(ke,{className:"text-right",children:[s.jsx(G,{variant:"ghost",size:"sm",onClick:()=>z(W),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(tn,{className:"w-4 h-4"})}),s.jsx(G,{variant:"ghost",size:"sm",onClick:()=>X(W.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(ls,{className:"w-4 h-4"})})]})]},W.id)),t.length===0&&!g&&s.jsx(bt,{children:s.jsx(ke,{colSpan:7,className:"text-center py-12 text-gray-500",children:N==="无权限访问"?"仅超级管理员可查看":"暂无管理员"})})]})]}),c>1&&s.jsx("div",{className:"p-4 border-t border-gray-700/50",children:s.jsx(cr,{page:a,pageSize:o,total:n,totalPages:c,onPageChange:i})})]})})}),s.jsx(Bt,{open:v,onOpenChange:k,children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(Vt,{children:s.jsx(Ht,{className:"text-white",children:T?"编辑管理员":"新增管理员"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"用户名"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"登录用户名",value:P,onChange:W=>L(W.target.value),disabled:!!T}),T&&s.jsx("p",{className:"text-xs text-gray-500",children:"用户名不可修改"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:T?"新密码(留空不改)":"密码"}),s.jsx(de,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:T?"留空表示不修改":"至少 6 位",value:U,onChange:W=>_(W.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"昵称"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"显示名称",value:H,onChange:W=>R(W.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"角色"}),s.jsxs("select",{value:Z,onChange:W=>re(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:"超级管理员"})]})]}),T&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"状态"}),s.jsxs("select",{value:$,onChange:W=>ie(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(gn,{children:[s.jsxs(G,{variant:"outline",onClick:()=>k(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(G,{onClick:ge,disabled:ce,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),ce?"保存中...":"保存"]})]})]})})]})}function In({method:t,url:e,desc:n,headers:r,bodyTitle:a,body:i,response:o}){const c=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 ${c}`,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(` +`)})]}),i&&s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:a??"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:i})]}),o&&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:o})]})]})}function R4(){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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Dx,{className:"w-5 h-5 text-[#38bdac]"}),"1. Authentication"]})}),s.jsx(_e,{className:"space-y-4",children:s.jsx(In,{method:"POST",url:"/api/admin",desc:"登录,返回 JWT token",headers:["Content-Type: application/json"],body:`{ + "username": "admin", + "password": "your_password" +}`,response:`{ + "success": true, + "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", + "expires_at": "2026-03-16T12:00:00Z" +}`})})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(dr,{className:"w-5 h-5 text-[#38bdac]"}),"2. 章节管理 (Chapters)"]})}),s.jsxs(_e,{className:"space-y-4",children:[s.jsx(In,{method:"GET",url:"/api/db/book?action=chapters",desc:"获取章节树",headers:t,response:`{ + "success": true, + "data": [ + { "id": "part-1", "title": "第一篇", "children": [...] }, + { "id": "section-1", "title": "第1节", "price": 1.0, "isFree": false } + ] +}`}),s.jsx(In,{method:"GET",url:"/api/db/book?action=section&id={id}",desc:"获取单篇内容",headers:t,response:`{ + "success": true, + "data": { + "id": "section-1", + "title": "标题", + "content": "正文...", + "price": 1.0, + "isFree": false, + "partId": "part-1", + "chapterId": "ch-1" + } +}`}),s.jsx(In,{method:"POST",url:"/api/db/book",desc:"新建章节 (action=create-section)",headers:t,body:`{ + "action": "create-section", + "title": "新章节标题", + "content": "正文内容", + "price": 0, + "isFree": true, + "partId": "part-1", + "chapterId": "ch-1", + "partTitle": "第一篇", + "chapterTitle": "第1章" +}`,response:`{ + "success": true, + "data": { "id": "section-new-id", "title": "新章节标题", ... } +}`}),s.jsx(In,{method:"POST",url:"/api/db/book",desc:"更新章节内容 (action=update-section)",headers:t,body:`{ + "action": "update-section", + "id": "section-1", + "title": "更新后的标题", + "content": "更新后的正文", + "price": 1.0, + "isFree": false +}`,response:`{ + "success": true, + "data": { "id": "section-1", "title": "更新后的标题", ... } +}`}),s.jsx(In,{method:"POST",url:"/api/db/book",desc:"删除章节 (action=delete-section)",headers:t,body:`{ + "action": "delete-section", + "id": "section-1" +}`,response:`{ + "success": true, + "message": "已删除" +}`}),s.jsxs("div",{className:"rounded-lg border border-[#38bdac]/30 bg-[#0a1628]/40 p-4 space-y-2",children:[s.jsx("p",{className:"text-[#38bdac] text-sm font-medium",children:"富文本流程说明(编辑器 ⇄ 接口)"}),s.jsxs("ol",{className:"text-gray-400 text-xs space-y-2 list-decimal list-inside leading-relaxed",children:[s.jsxs("li",{children:["先 ",s.jsx("code",{className:"text-[#38bdac]",children:"POST /api/upload"})," 上传素材,得到"," ",s.jsx("code",{className:"text-amber-200/90",children:"url"}),"(可为相对路径 ",s.jsx("code",{className:"text-amber-200/90",children:"/uploads/..."})," 或 OSS 完整 URL)。"]}),s.jsxs("li",{children:["将返回的 ",s.jsx("code",{className:"text-amber-200/90",children:"url"})," 填入正文 HTML:图片用"," ",s.jsx("code",{className:"text-green-400/90",children:''}),";视频用"," ",s.jsx("code",{className:"text-green-400/90",children:'
    '}),";附件用带链接的段落或"," ",s.jsx("code",{className:"text-green-400/90",children:'文件名'}),"。"]}),s.jsxs("li",{children:["最后把完整 HTML 字符串写入"," ",s.jsx("code",{className:"text-[#38bdac]",children:"create-section"})," /"," ",s.jsx("code",{className:"text-[#38bdac]",children:"update-section"})," 的 ",s.jsx("code",{className:"text-amber-200/90",children:"content"})," 字段。"]})]}),s.jsxs("p",{className:"text-gray-500 text-xs",children:["管理后台编辑器内图片/视频仅作小预览(CSS 类 ",s.jsx("code",{className:"text-gray-400",children:".rich-editor-content"}),"),不影响已保存 HTML;C 端按小程序/Web 自己的样式渲染全尺寸。"]})]}),s.jsx(In,{method:"POST",url:"/api/upload",desc:"上传章节富文本素材:图片 / 视频 / 附件(multipart,与后台「内容管理」编辑器一致)。按 form 字段 folder 区分类型与大小上限。",headers:["Authorization: Bearer {token}(建议携带,与后台一致)","Content-Type: multipart/form-data(由浏览器自动带 boundary,不要手写为 application/json)"],bodyTitle:"Request (multipart/form-data)",body:`字段: + file — 二进制文件(必填) + folder — 存储子目录(必填约定): + • book-images 图片,≤5MB,image/* + • book-videos 视频,≤100MB,video/*(如 mp4、mov、webm) + • book-attachments 附件,≤30MB,pdf/zip/Office/txt 等 + +成功时 data.url 与根字段 url 均为可访问地址。`,response:`{ + "success": true, + "url": "/uploads/book-images/1730000000000_abc123.jpg", + "data": { + "url": "/uploads/book-images/1730000000000_abc123.jpg", + "fileName": "1730000000000_abc123.jpg", + "size": 102400, + "type": "image/jpeg" + } +}`}),s.jsx(In,{method:"DELETE",url:"/api/upload?path={encodeURIComponent(文件URL)}",desc:"按 URL 删除已上传文件(本地或 OSS,需与上传返回的 url 一致)",headers:["Authorization: Bearer {token}(建议携带)"],response:`{ + "success": true, + "message": "删除成功" +}`})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(ji,{className:"w-5 h-5 text-[#38bdac]"}),"3. 人物管理 (@Mentions)"]})}),s.jsxs(_e,{className:"space-y-4",children:[s.jsx(In,{method:"GET",url:"/api/db/persons",desc:"人物列表",headers:t,response:`{ + "success": true, + "data": [ + { "personId": "p1", "label": "张三", "aliases": ["老张"], ... } + ] +}`}),s.jsx(In,{method:"GET",url:"/api/db/person?personId={id}",desc:"人物详情",headers:t,response:`{ + "success": true, + "data": { + "personId": "p1", + "label": "张三", + "aliases": ["老张"], + "description": "..." + } +}`}),s.jsx(In,{method:"POST",url:"/api/db/persons",desc:"新增/更新人物(含 aliases 字段)",headers:t,body:`{ + "personId": "p1", + "label": "张三", + "aliases": ["老张", "张三丰"], + "description": "可选描述" +}`,response:`{ + "success": true, + "data": { "personId": "p1", "label": "张三", ... } +}`}),s.jsx(In,{method:"DELETE",url:"/api/db/persons?personId={id}",desc:"删除人物",headers:t,response:`{ + "success": true, + "message": "已删除" +}`})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(su,{className:"w-5 h-5 text-[#38bdac]"}),"4. 链接标签 (#LinkTags)"]})}),s.jsxs(_e,{className:"space-y-4",children:[s.jsx(In,{method:"GET",url:"/api/db/link-tags",desc:"标签列表",headers:t,response:`{ + "success": true, + "data": [ + { "tagId": "t1", "label": "官网", "aliases": [], "type": "url", "url": "https://..." } + ] +}`}),s.jsx(In,{method:"POST",url:"/api/db/link-tags",desc:"新增/更新标签(含 aliases, type: url/miniprogram/ckb)",headers:t,body:`{ + "tagId": "t1", + "label": "官网", + "aliases": ["官方网站"], + "type": "url", + "url": "https://example.com" +} + +// type 可选: url | miniprogram | ckb`,response:`{ + "success": true, + "data": { "tagId": "t1", "label": "官网", "type": "url", ... } +}`}),s.jsx(In,{method:"DELETE",url:"/api/db/link-tags?tagId={id}",desc:"删除标签",headers:t,response:`{ + "success": true, + "message": "已删除" +}`})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(za,{className:"w-5 h-5 text-[#38bdac]"}),"5. 内容搜索"]})}),s.jsx(_e,{className:"space-y-4",children:s.jsx(In,{method:"GET",url:"/api/search?q={keyword}",desc:"搜索(标题优先 3 条 + 内容匹配)",headers:t,response:`{ + "success": true, + "data": { + "titleMatches": [{ "id": "s1", "title": "...", "snippet": "..." }], + "contentMatches": [{ "id": "s2", "title": "...", "snippet": "..." }] + } +}`})})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx($x,{className:"w-5 h-5 text-[#38bdac]"}),"6. 内容排行"]})}),s.jsx(_e,{className:"space-y-4",children:s.jsx(In,{method:"GET",url:"/api/db/book?action=ranking",desc:"排行榜数据",headers:t,response:`{ + "success": true, + "data": [ + { "id": "s1", "title": "...", "clickCount": 100, "payCount": 50, "hotScore": 120, "hotRank": 1 } + ] +}`})})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Pl,{className:"w-5 h-5 text-[#38bdac]"}),"7. 小程序接口"]})}),s.jsxs(_e,{className:"space-y-4",children:[s.jsx(In,{method:"GET",url:"/api/miniprogram/config/read-extras",desc:"阅读页懒加载:linkTags、linkedMiniprograms、mentionPersons(@ 自动解析:name/label/aliases + token,与 persons 表一致;inPool 表示已绑定会员即超级个体侧流量池人物)",headers:["Content-Type: application/json"],response:`{ + "linkTags": [], + "linkedMiniprograms": [], + "mentionPersons": [ + { "personId": "xxx", "token": "32位...", "name": "陈周", "aliases": "", "label": "", "inPool": true } + ] +}`}),s.jsx(In,{method:"GET",url:"/api/miniprogram/book/all-chapters",desc:"全部章节(小程序用)",headers:["Content-Type: application/json"],response:`{ + "success": true, + "data": [ { "id": "s1", "title": "...", "price": 1.0, "isFree": false }, ... ] +}`}),s.jsx(In,{method:"GET",url:"/api/miniprogram/balance?userId={id}",desc:"查余额",headers:["Content-Type: application/json"],response:`{ + "success": true, + "data": { "balance": 100.50, "userId": "xxx" } +}`}),s.jsx(In,{method:"POST",url:"/api/miniprogram/balance/gift",desc:"代付",headers:["Content-Type: application/json"],body:`{ + "userId": "xxx", + "amount": 10.00, + "remark": "可选备注" +}`,response:`{ + "success": true, + "data": { "balance": 110.50 } +}`}),s.jsx(In,{method:"POST",url:"/api/miniprogram/balance/gift/redeem",desc:"领取代付",headers:["Content-Type: application/json"],body:`{ + "code": "GIFT_XXXX" +}`,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/upload(与后台编辑器一致)。小程序使用 /api/miniprogram/*。完整实现见 soul-api 源码。"})]})}const oV={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},lV={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},cV={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...lV},ckbLeadApiKey:""},dV={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0},uV={tabBar:{home:"首页",chapters:"目录",match:"找伙伴",my:"我的"},chaptersPage:{bookTitle:"一场SOUL的创业实验场",bookSubtitle:"来自Soul派对房的真实商业故事",newBadgeText:"NEW"},homePage:{logoTitle:"卡若创业派对",logoSubtitle:"来自派对房的真实故事",linkKaruoText:"点击链接卡若",linkKaruoAvatar:"",pinnedTitlePrefix:"派对会员",pinnedMainTitleTemplate:"",searchPlaceholder:"搜索章节标题或内容...",bannerTag:"推荐",bannerReadMoreText:"点击阅读",superSectionTitle:"超级个体",superSectionLinkText:"获客入口",superSectionLinkPath:"/pages/match/match",pickSectionTitle:"精选推荐",latestSectionTitle:"最新新增"},myPage:{cardLabel:"名片",vipLabelVip:"会员中心",vipLabelGuest:"成为会员",cardPath:"",vipPath:"/pages/vip/vip",readStatLabel:"已读章节",recentReadTitle:"最近阅读",readStatPath:"/pages/reading-records/reading-records?focus=all",recentReadPath:"/pages/reading-records/reading-records?focus=recent"},memberDetailPage:{unlockIntroTitle:"解锁与链接说明",unlockIntroBody:"「链接」用于提交留资,由对方通过获客计划跟进;「解锁」用于复制手机/微信号后自行添加好友。请先阅读说明,确认后再登录。"},readPage:{beforeLoginHint:"试读进度与下方百分比以后台配置为准;登录后可购买解锁全文。",singlePageTitle:"解锁全文",singlePagePaywallHint:"当前为朋友圈单页预览,无法在此登录或付款。请点击底部「前往小程序」进入完整版后再解锁本章。"}},hV=["system","author","admin","api-docs"],gj=["basic","mp","oss","features"];function fV(){const[t,e]=H0(),n=t.get("tab")??"system",r=hV.includes(n)?n:"system",a=t.get("section")??"basic",i=gj.includes(a)?a:"basic",[o,c]=y.useState(cV),[u,h]=y.useState(dV),[f,m]=y.useState(oV),[g,b]=y.useState("{}"),[N,j]=y.useState("NEW"),[v,k]=y.useState({}),[T,C]=y.useState(!1),[P,L]=y.useState(!0),[U,_]=y.useState(!1),[H,R]=y.useState(""),[Z,re]=y.useState(""),[$,ie]=y.useState(!1),[ce,me]=y.useState(!1),I=(oe,D,q=!1)=>{R(oe),re(D),ie(q),_(!0)};y.useEffect(()=>{(async()=>{try{const D=await Oe("/api/admin/settings");if(!D||D.success===!1)return;if(D.featureConfig&&Object.keys(D.featureConfig).length&&h(q=>({...q,...D.featureConfig})),D.mpConfig&&typeof D.mpConfig=="object"){const q={...D.mpConfig};m(ze=>({...ze,...q}));const O=q.mpUi,Q=O!=null&&typeof O=="object"&&!Array.isArray(O)?O:{},se=Q.chaptersPage&&typeof Q.chaptersPage=="object"&&!Array.isArray(Q.chaptersPage)?Q.chaptersPage:{},ve=se.newBadgeText??se.sectionNewBadgeText;j(typeof ve=="string"&&ve.trim()?ve.trim():"NEW"),b(JSON.stringify(Q,null,2))}if(D.ossConfig&&typeof D.ossConfig=="object"&&k(q=>({...q,...D.ossConfig})),D.siteSettings&&typeof D.siteSettings=="object"){const q=D.siteSettings;c(O=>({...O,...typeof q.sectionPrice=="number"&&{sectionPrice:q.sectionPrice},...typeof q.baseBookPrice=="number"&&{baseBookPrice:q.baseBookPrice},...typeof q.distributorShare=="number"&&{distributorShare:q.distributorShare},...q.authorInfo&&typeof q.authorInfo=="object"&&{authorInfo:{...O.authorInfo,...q.authorInfo}},...typeof q.ckbLeadApiKey=="string"&&{ckbLeadApiKey:q.ckbLeadApiKey}}))}}catch(D){console.error("Load settings error:",D)}finally{L(!1)}})()},[]);const J=async(oe,D)=>{me(!0);try{const q=await kt("/api/admin/settings",{featureConfig:oe});if(!q||q.success===!1){D(),I("保存失败",(q==null?void 0:q.error)??"未知错误",!0);return}I("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(q){console.error("Save feature config error:",q),D(),I("保存失败",q instanceof Error?q.message:String(q),!0)}finally{me(!1)}},z=(oe,D)=>{const q=u,O={...q,[oe]:D};h(O),J(O,()=>h(q))},[ge,X]=y.useState(!1),F=async oe=>{const D=f,q={...D,auditMode:oe};m(q),X(!0);try{const O=await kt("/api/admin/settings",{mpConfig:q});if(!O||O.success===!1){m(D),I("保存失败",(O==null?void 0:O.error)??"未知错误",!0);return}I("已保存",oe?"审核模式已开启,小程序将隐藏所有支付入口。":"审核模式已关闭,支付功能已恢复。")}catch(O){m(D),I("保存失败",O instanceof Error?O.message:String(O),!0)}finally{X(!1)}},W=async()=>{C(!0);try{let oe={};try{const se=g.trim();if(se){const ve=JSON.parse(se);if(ve&&typeof ve=="object"&&!Array.isArray(ve))oe=ve;else{I("保存失败","小程序文案 mpUi 须为 JSON 对象(非数组)",!0),C(!1);return}}}catch{I("保存失败","小程序文案 mpUi 不是合法 JSON",!0),C(!1);return}const D=oe.chaptersPage,q=D&&typeof D=="object"&&!Array.isArray(D)?{...D}:{},O=N.trim();O?q.newBadgeText=O:delete q.newBadgeText,delete q.sectionNewBadgeText,oe.chaptersPage=q;const Q=await kt("/api/admin/settings",{featureConfig:u,siteSettings:{sectionPrice:o.sectionPrice,baseBookPrice:o.baseBookPrice,distributorShare:o.distributorShare,authorInfo:o.authorInfo,ckbLeadApiKey:o.ckbLeadApiKey||void 0},mpConfig:{...f,appId:f.appId||"",withdrawSubscribeTmplId:f.withdrawSubscribeTmplId||"",mchId:f.mchId||"",minWithdraw:typeof f.minWithdraw=="number"?f.minWithdraw:10,auditMode:f.auditMode??!1,mpUi:oe},ossConfig:Object.keys(v).length?{endpoint:v.endpoint??"",bucket:v.bucket??"",region:v.region??"",accessKeyId:v.accessKeyId??"",accessKeySecret:v.accessKeySecret??""}:void 0});if(!Q||Q.success===!1){I("保存失败",(Q==null?void 0:Q.error)??"未知错误",!0);return}I("已保存","设置已保存成功。")}catch(oe){console.error("Save settings error:",oe),I("保存失败",oe instanceof Error?oe.message:String(oe),!0)}finally{C(!1)}},fe=oe=>{if(oe==="system"){const D=new URLSearchParams(t);D.delete("tab"),gj.includes(D.get("section")||"basic")||D.set("section","basic"),e(D);return}e({tab:oe})},he=oe=>{const D=new URLSearchParams(t);D.delete("tab"),D.set("section",oe),e(D)};return P?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(G,{onClick:W,disabled:T,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),T?"保存中...":"保存设置"]})]}),s.jsxs(Wc,{value:r,onValueChange:fe,className:"w-full",children:[s.jsxs(Dl,{className:"mb-6 bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(nn,{value:"system",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(yo,{className:"w-4 h-4 mr-2"}),"系统设置"]}),s.jsxs(nn,{value:"author",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(Oh,{className:"w-4 h-4 mr-2"}),"作者详情"]}),s.jsxs(nn,{value:"admin",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(Oc,{className:"w-4 h-4 mr-2"}),"管理员"]}),s.jsxs(nn,{value:"api-docs",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",onClick:oe=>{oe.preventDefault(),window.open("/api-docs","_blank")},children:[s.jsx(Hj,{className:"w-4 h-4 mr-2"}),"API 文档 ↗"]})]}),s.jsxs(sn,{value:"system",className:"mt-0",children:[s.jsxs("p",{className:"text-xs text-gray-500 mb-3",children:["MBTI 默认头像已迁至"," ",s.jsx(Al,{to:"/users",className:"text-[#38bdac] underline",children:"用户管理(用户列表点头像打开)"})]}),s.jsxs(Wc,{value:i,onValueChange:he,className:"w-full",children:[s.jsxs(Dl,{className:"mb-4 bg-[#0a1628] border border-gray-700/50 p-1 flex-wrap h-auto gap-1",children:[s.jsxs(nn,{value:"basic",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(lM,{className:"w-3.5 h-3.5 mr-1"}),"基础与价格"]}),s.jsxs(nn,{value:"mp",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(Pl,{className:"w-3.5 h-3.5 mr-1"}),"小程序与审核"]}),s.jsxs(nn,{value:"oss",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(j1,{className:"w-3.5 h-3.5 mr-1"}),"OSS"]}),s.jsxs(nn,{value:"features",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(yo,{className:"w-3.5 h-3.5 mr-1"}),"功能开关"]})]}),s.jsxs(sn,{value:"basic",className:"space-y-6 mt-0",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Oh,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),s.jsx(Xt,{className:"text-gray-400",children:'配置作者信息,将在"关于作者"页面显示'})]}),s.jsxs(_e,{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(ne,{htmlFor:"author-name",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Oh,{className:"w-3 h-3"}),"主理人名称"]}),s.jsx(de,{id:"author-name",className:"bg-[#0a1628] border-gray-700 text-white",value:o.authorInfo.name??"",onChange:oe=>c(D=>({...D,authorInfo:{...D.authorInfo,name:oe.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{htmlFor:"start-date",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Ix,{className:"w-3 h-3"}),"开播日期"]}),s.jsx(de,{id:"start-date",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 2025年10月15日",value:o.authorInfo.startDate??"",onChange:oe=>c(D=>({...D,authorInfo:{...D.authorInfo,startDate:oe.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{htmlFor:"live-time",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Ix,{className:"w-3 h-3"}),"直播时间"]}),s.jsx(de,{id:"live-time",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 06:00-09:00",value:o.authorInfo.liveTime??"",onChange:oe=>c(D=>({...D,authorInfo:{...D.authorInfo,liveTime:oe.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{htmlFor:"platform",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Kj,{className:"w-3 h-3"}),"直播平台"]}),s.jsx(de,{id:"platform",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: Soul派对房",value:o.authorInfo.platform??"",onChange:oe=>c(D=>({...D,authorInfo:{...D.authorInfo,platform:oe.target.value}}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{htmlFor:"description",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(dr,{className:"w-3 h-3"}),"简介描述"]}),s.jsx(de,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:o.authorInfo.description??"",onChange:oe=>c(D=>({...D,authorInfo:{...D.authorInfo,description:oe.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),s.jsx($l,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:o.authorInfo.bio??"",onChange:oe=>c(D=>({...D,authorInfo:{...D.authorInfo,bio:oe.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{htmlFor:"ckb-lead-api-key",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Si,{className:"w-3 h-3"}),"链接卡若存客宝密钥"]}),s.jsx(de,{id:"ckb-lead-api-key",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 xxxxx-xxxxx-xxxxx-xxxxx(留空则用 .env 默认)",value:o.ckbLeadApiKey??"",onChange:oe=>c(D=>({...D,ckbLeadApiKey:oe.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-linear-to-br from-[#00CED1] to-[#20B2AA] flex items-center justify-center text-xl font-bold text-white",children:(o.authorInfo.name??"K").charAt(0)}),s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-semibold",children:o.authorInfo.name}),s.jsx("p",{className:"text-gray-400 text-xs",children:o.authorInfo.description}),s.jsxs("p",{className:"text-[#38bdac] text-xs mt-1",children:["每日 ",o.authorInfo.liveTime," · ",o.authorInfo.platform]})]})]})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(vf,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),s.jsx(Xt,{className:"text-gray-400",children:"配置书籍和章节的定价"})]}),s.jsx(_e,{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(ne,{className:"text-gray-300",children:"单节价格 (元)"}),s.jsx(de,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.sectionPrice,onChange:oe=>c(D=>({...D,sectionPrice:Number.parseFloat(oe.target.value)||1}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"整本价格 (元)"}),s.jsx(de,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.baseBookPrice,onChange:oe=>c(D=>({...D,baseBookPrice:Number.parseFloat(oe.target.value)||9.9}))})]})]})})]})]}),s.jsxs(sn,{value:"mp",className:"space-y-6 mt-0",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Pl,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),s.jsx(Xt,{className:"text-gray-400",children:"订阅消息模板、支付商户号等,小程序从 /api/miniprogram/config 读取(API 地址由 app.js baseUrl 控制)"})]}),s.jsxs(_e,{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(ne,{className:"text-gray-300",children:"小程序 AppID"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:f.appId??"",onChange:oe=>m(D=>({...D,appId:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"提现订阅模板 ID"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"用户申请提现时需授权",value:f.withdrawSubscribeTmplId??"",onChange:oe=>m(D=>({...D,withdrawSubscribeTmplId:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"微信支付商户号"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"1318592501",value:f.mchId??"",onChange:oe=>m(D=>({...D,mchId:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"最低提现金额 (元)"}),s.jsx(de,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:f.minWithdraw??10,onChange:oe=>m(D=>({...D,minWithdraw:Number.parseFloat(oe.target.value)||10}))})]})]}),s.jsxs("div",{className:"space-y-2 pt-2 border-t border-gray-700/50",children:[s.jsx("div",{className:"grid grid-cols-2 gap-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"目录 NEW 角标文案"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如:NEW / 最新 / 刚更新",value:N,maxLength:8,onChange:oe=>j(oe.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"用于小程序目录页章节角标,保存后约 5 分钟内生效(可与下方 mpUi JSON 同步保存)。"})]})}),s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsx(ne,{className:"text-gray-300",children:"小程序界面文案 mpUi(JSON)"}),s.jsx(G,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-200",onClick:()=>b(JSON.stringify(uV,null,2)),children:"填入默认模板"})]}),s.jsx("p",{className:"text-xs text-gray-500",children:"覆盖 Tab 文案、首页/目录标题、我的页名片与阅读记录路径等;仅填需要改的字段也可(与后端默认值深合并)。保存后小程序约 5 分钟内通过 config 缓存刷新。"}),s.jsx($l,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm min-h-[280px]",spellCheck:!1,value:g,onChange:oe=>b(oe.target.value)})]})]})]}),s.jsxs(De,{className:`bg-[#0f2137] shadow-xl ${f.auditMode?"border-amber-500/50 border-2":"border-gray-700/50"}`,children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Oc,{className:"w-5 h-5 text-amber-400"}),"小程序审核模式"]}),s.jsx(Xt,{className:"text-gray-400",children:"提交微信审核前开启,审核通过后关闭即可恢复支付功能"})]}),s.jsx(_e,{children:s.jsxs("div",{className:`flex items-center justify-between p-4 rounded-lg border ${f.auditMode?"bg-amber-500/10 border-amber-500/30":"bg-[#0a1628] 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(Oc,{className:`w-4 h-4 ${f.auditMode?"text-amber-400":"text-gray-400"}`}),s.jsx(ne,{htmlFor:"audit-mode",className:"text-white font-medium cursor-pointer",children:f.auditMode?"审核模式(已开启)":"审核模式(已关闭)"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:f.auditMode?"当前已隐藏所有支付、VIP、充值、收益等入口,审核员看不到任何付费内容":"关闭状态,小程序正常显示所有功能(含支付、VIP 等)"})]}),s.jsx(Ut,{id:"audit-mode",checked:f.auditMode??!1,disabled:ge,onCheckedChange:F})]})})]})]}),s.jsx(sn,{value:"oss",className:"space-y-6 mt-0",children:s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(j1,{className:"w-5 h-5 text-[#38bdac]"}),"OSS 配置(阿里云对象存储)"]}),s.jsx(Xt,{className:"text-gray-400",children:"endpoint、bucket、accessKey 等,用于图片/文件上传"})]}),s.jsx(_e,{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(ne,{className:"text-gray-300",children:"Endpoint"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"oss-cn-hangzhou.aliyuncs.com",value:v.endpoint??"",onChange:oe=>k(D=>({...D,endpoint:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"Bucket"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"bucket 名称",value:v.bucket??"",onChange:oe=>k(D=>({...D,bucket:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"Region"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"oss-cn-hangzhou",value:v.region??"",onChange:oe=>k(D=>({...D,region:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"AccessKey ID"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"AccessKey ID",value:v.accessKeyId??"",onChange:oe=>k(D=>({...D,accessKeyId:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"AccessKey Secret"}),s.jsx(de,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"AccessKey Secret",value:v.accessKeySecret??"",onChange:oe=>k(D=>({...D,accessKeySecret:oe.target.value}))})]})]})})]})}),s.jsxs(sn,{value:"features",className:"space-y-6 mt-0",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(yo,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),s.jsx(Xt,{className:"text-gray-400",children:"控制各个功能模块的显示/隐藏"})]}),s.jsxs(_e,{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(Un,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(ne,{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(Ut,{id:"match-enabled",checked:u.matchEnabled,disabled:ce,onCheckedChange:oe=>z("matchEnabled",oe)})]}),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(Lx,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(ne,{htmlFor:"referral-enabled",className:"text-white font-medium cursor-pointer",children:"推广功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制推广中心的显示(我的页面入口)"}),s.jsxs("p",{className:"text-xs text-amber-400/80 ml-6 mt-1",children:["佣金比例、绑定期、提现规则等与",s.jsx(Al,{to:"/distribution?tab=settings",className:"underline mx-1 text-[#38bdac]",children:"推广中心 → 推广设置"}),"为同一套接口,在此仅控制是否展示入口。"]})]}),s.jsx(Ut,{id:"referral-enabled",checked:u.referralEnabled,disabled:ce,onCheckedChange:oe=>z("referralEnabled",oe)})]}),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(dr,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(ne,{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(Ut,{id:"search-enabled",checked:u.searchEnabled,disabled:ce,onCheckedChange:oe=>z("searchEnabled",oe)})]}),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(yo,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(ne,{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(Ut,{id:"about-enabled",checked:u.aboutEnabled,disabled:ce,onCheckedChange:oe=>z("aboutEnabled",oe)})]})]}),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.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Nf,{className:"w-5 h-5 text-[#38bdac]"}),"小程序模块显隐说明"]}),s.jsx(Xt,{className:"text-gray-400",children:"以下模块受上方开关和审核模式共同控制"})]}),s.jsx(_e,{children:s.jsx("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[{mod:"找伙伴",ctrl:"找伙伴功能开关",icon:s.jsx(Un,{className:"w-3 h-3"})},{mod:"推广中心 / 推荐好友",ctrl:"推广功能开关",icon:s.jsx(Lx,{className:"w-3 h-3"})},{mod:"搜索",ctrl:"搜索功能开关",icon:s.jsx(dr,{className:"w-3 h-3"})},{mod:"关于页面",ctrl:"关于页面开关",icon:s.jsx(Oh,{className:"w-3 h-3"})},{mod:"支付 / VIP / 充值 / 收益",ctrl:"审核模式",icon:s.jsx(Oc,{className:"w-3 h-3"})},{mod:"超级个体名片",ctrl:"审核模式",icon:s.jsx(rA,{className:"w-3 h-3"})},{mod:"首页获客入口",ctrl:"已移除",icon:s.jsx(P5,{className:"w-3 h-3"})}].map(oe=>s.jsxs("div",{className:"flex items-center gap-2 p-2 rounded bg-[#0a1628] border border-gray-700/30",children:[oe.icon,s.jsxs("div",{children:[s.jsx("span",{className:"text-white",children:oe.mod}),s.jsxs("span",{className:"text-gray-500 ml-1",children:["← ",oe.ctrl]})]})]},oe.mod))})})]})]})]})]}),s.jsx(sn,{value:"author",className:"mt-0",children:s.jsx(rV,{})}),s.jsx(sn,{value:"admin",className:"mt-0",children:s.jsx(iV,{})}),s.jsx(sn,{value:"api-docs",className:"mt-0",children:s.jsx(R4,{})})]}),s.jsx(Bt,{open:U,onOpenChange:_,children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsxs(Vt,{children:[s.jsx(Ht,{className:$?"text-red-400":"text-[#38bdac]",children:H}),s.jsx(Ef,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:Z})]}),s.jsx(gn,{className:"mt-4",children:s.jsx(G,{onClick:()=>_(!1),className:$?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const xj={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 pV(){const[t,e]=y.useState(!1),[n,r]=y.useState(xj),[a,i]=y.useState(""),o=async()=>{e(!0);try{const k=await Oe("/api/config");k!=null&&k.paymentMethods&&r({...xj,...k.paymentMethods})}catch(k){console.error(k)}finally{e(!1)}};y.useEffect(()=>{o()},[]);const c=async()=>{e(!0);try{await kt("/api/db/config",{key:"payment_methods",value:n,description:"支付方式配置"}),Y.success("配置已保存!")}catch(k){console.error("保存失败:",k),Y.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{e(!1)}},u=(k,T)=>{navigator.clipboard.writeText(k),i(T),setTimeout(()=>i(""),2e3)},h=(k,T)=>{r(C=>({...C,wechat:{...C.wechat,[k]:T}}))},f=(k,T)=>{r(C=>({...C,alipay:{...C.alipay,[k]:T}}))},m=(k,T)=>{r(C=>({...C,usdt:{...C.usdt,[k]:T}}))},g=(k,T)=>{r(C=>({...C,paypal:{...C.paypal,[k]:T}}))},b=n.wechat,N=n.alipay,j=n.usdt,v=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(G,{variant:"outline",onClick:o,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${t?"animate-spin":""}`}),"同步配置"]}),s.jsxs(G,{onClick:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{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(Fj,{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(Wc,{defaultValue:"wechat",className:"space-y-6",children:[s.jsxs(Dl,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[s.jsxs(nn,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[s.jsx(Pl,{className:"w-4 h-4 mr-2"}),"微信"]}),s.jsxs(nn,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[s.jsx(k1,{className:"w-4 h-4 mr-2"}),"支付宝"]}),s.jsxs(nn,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[s.jsx(w1,{className:"w-4 h-4 mr-2"}),"USDT"]}),s.jsxs(nn,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[s.jsx(Ox,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),s.jsx(sn,{value:"wechat",className:"space-y-4",children:s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(ht,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(Pl,{className:"w-5 h-5"}),"微信支付配置"]}),s.jsx(Xt,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),s.jsx(Ut,{checked:!!b.enabled,onCheckedChange:k=>h("enabled",k)})]}),s.jsxs(_e,{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(ne,{className:"text-gray-300",children:"网站AppID"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(b.websiteAppId??""),onChange:k=>h("websiteAppId",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"商户号"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(b.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(To,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置(核心功能)"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"微信收款码/支付链接"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://收款码图片URL 或 weixin://支付链接",value:String(b.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(ne,{className:"text-[#07C160] font-medium",children:"微信群跳转链接(支付成功后跳转)"}),s.jsx(de,{className:"bg-[#0a1628] border-[#07C160]/30 text-white placeholder:text-gray-500",placeholder:"https://weixin.qq.com/g/... 或微信群二维码图片URL",value:String(b.groupQrCode??""),onChange:k=>h("groupQrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-[#07C160]/70",children:"用户支付成功后将自动跳转到此链接,进入指定微信群"})]})]})]})]})}),s.jsx(sn,{value:"alipay",className:"space-y-4",children:s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(ht,{className:"text-[#1677FF] flex items-center gap-2",children:[s.jsx(k1,{className:"w-5 h-5"}),"支付宝配置"]}),s.jsx(Xt,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),s.jsx(Ut,{checked:!!N.enabled,onCheckedChange:k=>f("enabled",k)})]}),s.jsxs(_e,{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(ne,{className:"text-gray-300",children:"合作者身份 (PID)"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(N.partnerId??""),onChange:k=>f("partnerId",k.target.value)}),s.jsx(G,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>u(String(N.partnerId??""),"pid"),children:a==="pid"?s.jsx(Sp,{className:"w-4 h-4 text-green-500"}):s.jsx(Vj,{className:"w-4 h-4 text-gray-400"})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"安全校验码 (Key)"}),s.jsx(de,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(N.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(To,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"支付宝收款码/跳转链接"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://qr.alipay.com/... 或收款码图片URL",value:String(N.qrCode??""),onChange:k=>f("qrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户点击支付宝支付后显示的二维码"})]})]})]})]})}),s.jsx(sn,{value:"usdt",className:"space-y-4",children:s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(ht,{className:"text-[#26A17B] flex items-center gap-2",children:[s.jsx(w1,{className:"w-5 h-5"}),"USDT配置"]}),s.jsx(Xt,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),s.jsx(Ut,{checked:!!j.enabled,onCheckedChange:k=>m("enabled",k)})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{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(j.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(ne,{className:"text-gray-300",children:"收款地址"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",placeholder:"T... (TRC20地址)",value:String(j.address??""),onChange:k=>m("address",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(de,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(j.exchangeRate)??7.2,onChange:k=>m("exchangeRate",Number.parseFloat(k.target.value)||7.2)})]})]})]})}),s.jsx(sn,{value:"paypal",className:"space-y-4",children:s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(ht,{className:"text-[#169BD7] flex items-center gap-2",children:[s.jsx(Ox,{className:"w-5 h-5"}),"PayPal配置"]}),s.jsx(Xt,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),s.jsx(Ut,{checked:!!v.enabled,onCheckedChange:k=>g("enabled",k)})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"PayPal邮箱"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"your@email.com",value:String(v.email??""),onChange:k=>g("email",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(de,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(v.exchangeRate)??7.2,onChange:k=>g("exchangeRate",Number(k.target.value)||7.2)})]})]})]})})]})]})}const mV={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},gV={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},xV={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function yV(){const[t,e]=y.useState({siteConfig:{...mV},menuConfig:{...gV},pageConfig:{...xV}}),[n,r]=y.useState(!1),[a,i]=y.useState(!1);y.useEffect(()=>{Oe("/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 kt("/api/db/config",{key:"site_config",value:t.siteConfig,description:"网站基础配置"}),await kt("/api/db/config",{key:"menu_config",value:t.menuConfig,description:"底部菜单配置"}),await kt("/api/db/config",{key:"page_config",value:t.pageConfig,description:"页面标题配置"}),r(!0),setTimeout(()=>r(!1),2e3),Y.success("配置已保存")}catch(f){console.error(f),Y.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(G,{onClick:o,disabled:a,className:`${n?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),a?"保存中...":n?"已保存":"保存设置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Ox,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),s.jsx(Xt,{className:"text-gray-400",children:"配置网站名称、标题和描述"})]}),s.jsxs(_e,{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(ne,{htmlFor:"site-name",className:"text-gray-300",children:"网站名称"}),s.jsx(de,{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(ne,{htmlFor:"site-title",className:"text-gray-300",children:"网站标题"}),s.jsx(de,{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(ne,{htmlFor:"site-desc",className:"text-gray-300",children:"网站描述"}),s.jsx(de,{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(ne,{htmlFor:"logo",className:"text-gray-300",children:"Logo地址"}),s.jsx(de,{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(ne,{htmlFor:"favicon",className:"text-gray-300",children:"Favicon地址"}),s.jsx(de,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(TM,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),s.jsx(Xt,{className:"text-gray-400",children:"配置网站主题色"})]}),s.jsx(_e,{children:s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("div",{className:"space-y-2 flex-1",children:[s.jsx(ne,{htmlFor:"primary-color",className:"text-gray-300",children:"主色调"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(de,{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(de,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(NM,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),s.jsx(Xt,{className:"text-gray-400",children:"控制底部导航栏菜单的显示和名称"})]}),s.jsx(_e,{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(Ut,{checked:(m==null?void 0:m.enabled)??!0,onCheckedChange:g=>e(b=>({...b,menuConfig:{...b.menuConfig,[f]:{...m,enabled:g}}}))}),s.jsx("span",{className:"text-gray-300 w-16 capitalize",children:f}),s.jsx(de,{className:"bg-[#0f2137] border-gray-700 text-white max-w-[200px]",value:(m==null?void 0:m.label)??"",onChange:g=>e(b=>({...b,menuConfig:{...b.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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Hj,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),s.jsx(Xt,{className:"text-gray-400",children:"配置各个页面的标题和副标题"})]}),s.jsxs(_e,{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(ne,{className:"text-gray-300",children:"首页标题"}),s.jsx(de,{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(ne,{className:"text-gray-300",children:"首页副标题"}),s.jsx(de,{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(ne,{className:"text-gray-300",children:"目录页标题"}),s.jsx(de,{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(ne,{className:"text-gray-300",children:"匹配页标题"}),s.jsx(de,{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(ne,{className:"text-gray-300",children:"我的页标题"}),s.jsx(de,{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(ne,{className:"text-gray-300",children:"关于作者标题"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.aboutTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,aboutTitle:f.target.value}}))})]})]})]})]})]})]})}function bV(){const[t,e]=y.useState(""),[n,r]=y.useState(""),[a,i]=y.useState(""),[o,c]=y.useState({}),u=async()=>{var b,N,j,v;try{const k=await Oe("/api/config"),T=(N=(b=k==null?void 0:k.liveQRCodes)==null?void 0:b[0])==null?void 0:N.urls;Array.isArray(T)&&e(T.join(` +`));const C=(v=(j=k==null?void 0:k.paymentMethods)==null?void 0:j.wechat)==null?void 0:v.groupQrCode;C&&r(C),c({paymentMethods:k==null?void 0:k.paymentMethods,liveQRCodes:k==null?void 0:k.liveQRCodes})}catch(k){console.error(k)}};y.useEffect(()=>{u()},[]);const h=(b,N)=>{navigator.clipboard.writeText(b),i(N),setTimeout(()=>i(""),2e3)},f=async()=>{try{const b=t.split(` +`).map(j=>j.trim()).filter(Boolean),N=[...o.liveQRCodes||[]];N[0]?N[0].urls=b:N.push({id:"live-1",name:"微信群活码",urls:b,clickCount:0}),await kt("/api/db/config",{key:"live_qr_codes",value:N,description:"群活码配置"}),Y.success("群活码配置已保存!"),await u()}catch(b){console.error(b),Y.error("保存失败: "+(b instanceof Error?b.message:String(b)))}},m=async()=>{var b;try{await kt("/api/db/config",{key:"payment_methods",value:{...o.paymentMethods||{},wechat:{...((b=o.paymentMethods)==null?void 0:b.wechat)||{},groupQrCode:n}},description:"支付方式配置"}),Y.success("微信群链接已保存!用户支付成功后将自动跳转"),await u()}catch(N){console.error(N),Y.error("保存失败: "+(N instanceof Error?N.message:String(N)))}},g=()=>{n?window.open(n,"_blank"):Y.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(Fj,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(M1,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),s.jsx(Xt,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(_x,{className:"w-4 h-4"}),"微信群链接 / 活码链接"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(de,{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:b=>r(b.target.value)}),s.jsx(G,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>h(n,"group"),children:a==="group"?s.jsx(Sp,{className:"w-4 h-4 text-green-500"}):s.jsx(Vj,{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(To,{className:"w-3 h-3"}),"支持格式:草料短链、微信群链接(https://weixin.qq.com/g/...)、企业微信链接等"]})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(G,{onClick:m,className:"flex-1 bg-[#07C160] hover:bg-[#06AD51] text-white",children:[s.jsx(jf,{className:"w-4 h-4 mr-2"}),"保存配置"]}),s.jsxs(G,{onClick:g,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[s.jsx(To,{className:"w-4 h-4 mr-2"}),"测试跳转"]})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(M1,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),s.jsx(Xt,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ne,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(_x,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),s.jsx($l,{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:b=>e(b.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(G,{onClick:f,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(jf,{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 yj={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}},vV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function NV(){const[t,e]=y.useState(yj),[n,r]=y.useState(!0),[a,i]=y.useState(!1),[o,c]=y.useState(!1),[u,h]=y.useState(null),[f,m]=y.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),g=async()=>{r(!0);try{const C=await Oe("/api/db/config/full?key=match_config"),P=(C==null?void 0:C.data)??(C==null?void 0:C.config);P&&e({...yj,...P})}catch(C){console.error("加载匹配配置失败:",C)}finally{r(!1)}};y.useEffect(()=>{g()},[]);const b=async()=>{i(!0);try{const C=await kt("/api/db/config",{key:"match_config",value:t,description:"匹配功能配置"});C&&C.success!==!1?Y.success("配置保存成功!"):Y.error("保存失败: "+(C&&typeof C=="object"&&"error"in C?C.error:"未知错误"))}catch(C){console.error("保存配置失败:",C),Y.error("保存失败")}finally{i(!1)}},N=C=>{h(C),m({id:C.id,label:C.label,matchLabel:C.matchLabel,icon:C.icon,matchFromDB:C.matchFromDB,showJoinAfterMatch:C.showJoinAfterMatch,price:C.price,enabled:C.enabled}),c(!0)},j=()=>{h(null),m({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),c(!0)},v=()=>{if(!f.id||!f.label){Y.error("请填写类型ID和名称");return}const C=[...t.matchTypes];if(u){const P=C.findIndex(L=>L.id===u.id);P!==-1&&(C[P]={...f})}else{if(C.some(P=>P.id===f.id)){Y.error("类型ID已存在");return}C.push({...f})}e({...t,matchTypes:C}),c(!1)},k=C=>{confirm("确定要删除这个匹配类型吗?")&&e({...t,matchTypes:t.matchTypes.filter(P=>P.id!==C)})},T=C=>{e({...t,matchTypes:t.matchTypes.map(P=>P.id===C?{...P,enabled:!P.enabled}:P)})};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(yo,{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(G,{variant:"outline",onClick:g,disabled:n,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]}),s.jsxs(G,{onClick:b,disabled:a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存配置"]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Mo,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),s.jsx(Xt,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),s.jsxs(_e,{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(ne,{className:"text-gray-300",children:"每日免费匹配次数"}),s.jsx(de,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.freeMatchLimit,onChange:C=>e({...t,freeMatchLimit:parseInt(C.target.value,10)||0})}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户每天可免费匹配的次数"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"付费匹配价格(元)"}),s.jsx(de,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:t.matchPrice,onChange:C=>e({...t,matchPrice:parseFloat(C.target.value)||1})}),s.jsx("p",{className:"text-xs text-gray-500",children:"免费次数用完后的单次匹配价格"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"每日最大匹配次数"}),s.jsx(de,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:t.settings.maxMatchesPerDay,onChange:C=>e({...t,settings:{...t.settings,maxMatchesPerDay:parseInt(C.target.value,10)||10}})}),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(Ut,{checked:t.settings.enableFreeMatches,onCheckedChange:C=>e({...t,settings:{...t.settings,enableFreeMatches:C}})}),s.jsx(ne,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:t.settings.enablePaidMatches,onCheckedChange:C=>e({...t,settings:{...t.settings,enablePaidMatches:C}})}),s.jsx(ne,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Un,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),s.jsx(Xt,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(G,{onClick:j,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx($n,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),s.jsx(_e,{children:s.jsxs(vs,{children:[s.jsx(Ns,{children:s.jsxs(bt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Se,{className:"text-gray-400",children:"图标"}),s.jsx(Se,{className:"text-gray-400",children:"类型ID"}),s.jsx(Se,{className:"text-gray-400",children:"显示名称"}),s.jsx(Se,{className:"text-gray-400",children:"匹配标签"}),s.jsx(Se,{className:"text-gray-400",children:"价格"}),s.jsx(Se,{className:"text-gray-400",children:"数据库匹配"}),s.jsx(Se,{className:"text-gray-400",children:"状态"}),s.jsx(Se,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsx(ws,{children:t.matchTypes.map(C=>s.jsxs(bt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ke,{children:s.jsx("span",{className:"text-2xl",children:C.icon})}),s.jsx(ke,{className:"font-mono text-gray-300",children:C.id}),s.jsx(ke,{className:"text-white font-medium",children:C.label}),s.jsx(ke,{className:"text-gray-300",children:C.matchLabel}),s.jsx(ke,{children:s.jsxs(Be,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",C.price]})}),s.jsx(ke,{children:C.matchFromDB?s.jsx(Be,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):s.jsx(Be,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),s.jsx(ke,{children:s.jsx(Ut,{checked:C.enabled,onCheckedChange:()=>T(C.id)})}),s.jsx(ke,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(G,{variant:"ghost",size:"sm",onClick:()=>N(C),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(tn,{className:"w-4 h-4"})}),s.jsx(G,{variant:"ghost",size:"sm",onClick:()=>k(C.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(ls,{className:"w-4 h-4"})})]})})]},C.id))})]})})]}),s.jsx(Bt,{open:o,onOpenChange:c,children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[u?s.jsx(tn,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx($n,{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(ne,{className:"text-gray-300",children:"类型ID(英文)"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:f.id,onChange:C=>m({...f,id:C.target.value}),disabled:!!u})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:vV.map(C=>s.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${f.icon===C?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>m({...f,icon:C}),children:C},C))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"显示名称"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业合伙",value:f.label,onChange:C=>m({...f,label:C.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"匹配标签"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 创业伙伴",value:f.matchLabel,onChange:C=>m({...f,matchLabel:C.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"单次匹配价格(元)"}),s.jsx(de,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:f.price,onChange:C=>m({...f,price:parseFloat(C.target.value)||1})})]}),s.jsxs("div",{className:"flex gap-6 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:f.matchFromDB,onCheckedChange:C=>m({...f,matchFromDB:C})}),s.jsx(ne,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:f.showJoinAfterMatch,onCheckedChange:C=>m({...f,showJoinAfterMatch:C})}),s.jsx(ne,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:f.enabled,onCheckedChange:C=>m({...f,enabled:C})}),s.jsx(ne,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(gn,{children:[s.jsx(G,{variant:"outline",onClick:()=>c(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsxs(G,{onClick:v,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const bj={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function wV(){const[t,e]=y.useState([]),[n,r]=y.useState(0),[a,i]=y.useState(1),[o,c]=y.useState(10),[u,h]=y.useState(""),[f,m]=y.useState(!0),[g,b]=y.useState(null);async function N(){m(!0),b(null);try{const v=new URLSearchParams({page:String(a),pageSize:String(o)});u&&v.set("matchType",u);const k=await Oe(`/api/db/match-records?${v}`);k!=null&&k.success?(e(k.records||[]),r(k.total??0)):b("加载匹配记录失败")}catch(v){console.error("加载匹配记录失败",v),b("加载失败,请检查网络后重试")}finally{m(!1)}}y.useEffect(()=>{N()},[a,u]);const j=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:()=>b(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:v=>{h(v.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(bj).map(([v,k])=>s.jsx("option",{value:v,children:k},v))]}),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(He,{className:`w-4 h-4 ${f?"animate-spin":""}`}),"刷新"]})]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(He,{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(vs,{children:[s.jsx(Ns,{children:s.jsxs(bt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Se,{className:"text-gray-400",children:"发起人"}),s.jsx(Se,{className:"text-gray-400",children:"匹配到"}),s.jsx(Se,{className:"text-gray-400",children:"类型"}),s.jsx(Se,{className:"text-gray-400",children:"联系方式"}),s.jsx(Se,{className:"text-gray-400",children:"匹配时间"})]})}),s.jsxs(ws,{children:[t.map(v=>s.jsxs(bt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ke,{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:[v.userAvatar?s.jsx("img",{src:pa(v.userAvatar),alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const T=k.currentTarget.nextElementSibling;T&&T.classList.remove("hidden")}}):null,s.jsx("span",{className:v.userAvatar?"hidden":"",children:(v.userNickname||v.userId||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white",children:v.userNickname||v.userId}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[v.userId.slice(0,16),"..."]})]})]})}),s.jsx(ke,{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:[v.matchedUserAvatar?s.jsx("img",{src:pa(v.matchedUserAvatar),alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const T=k.currentTarget.nextElementSibling;T&&T.classList.remove("hidden")}}):null,s.jsx("span",{className:v.matchedUserAvatar?"hidden":"",children:(v.matchedNickname||v.matchedUserId||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white",children:v.matchedNickname||v.matchedUserId}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[v.matchedUserId.slice(0,16),"..."]})]})]})}),s.jsx(ke,{children:s.jsx(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:bj[v.matchType]||v.matchType})}),s.jsxs(ke,{className:"text-gray-400 text-sm",children:[v.phone&&s.jsxs("div",{children:["📱 ",v.phone]}),v.wechatId&&s.jsxs("div",{children:["💬 ",v.wechatId]}),!v.phone&&!v.wechatId&&"-"]}),s.jsx(ke,{className:"text-gray-400",children:v.createdAt?new Date(v.createdAt).toLocaleString():"-"})]},v.id)),t.length===0&&s.jsx(bt,{children:s.jsx(ke,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(cr,{page:a,totalPages:j,total:n,pageSize:o,onPageChange:i,onPageSizeChange:v=>{c(v),i(1)}})]})})})]})}function jV(){const[t,e]=y.useState([]),[n,r]=y.useState(!0);async function a(){r(!0);try{const i=await Oe("/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),Y.error("加载 VIP 成员失败")}finally{r(!1)}}return y.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(zc,{className:"w-5 h-5 text-amber-400"}),"用户管理 / 超级个体列表"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"这里展示所有有效超级个体用户,仅用于查看其基本信息与排序值。"})]})}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(vs,{children:[s.jsx(Ns,{children:s.jsxs(bt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Se,{className:"text-gray-400 w-20",children:"序号"}),s.jsx(Se,{className:"text-gray-400",children:"成员"}),s.jsx(Se,{className:"text-gray-400 w-40",children:"超级个体"}),s.jsx(Se,{className:"text-gray-400 w-28",children:"排序值"})]})}),s.jsxs(ws,{children:[t.map((i,o)=>{var c;return s.jsxs(bt,{className:"border-gray-700/50",children:[s.jsx(ke,{className:"text-gray-300",children:o+1}),s.jsx(ke,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[i.avatar?s.jsx("img",{src:pa(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(ke,{className:"text-gray-300",children:i.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置超级个体)"})}),s.jsx(ke,{className:"text-gray-300",children:i.vipSort??o+1})]},i.id)}),t.length===0&&s.jsx(bt,{children:s.jsx(ke,{colSpan:5,className:"text-center py-12 text-gray-500",children:"当前没有有效的超级个体用户。"})})]})]})})})]})}function L4(t){const e=Ua(),[n,r]=y.useState([]),[a,i]=y.useState(!0),[o,c]=y.useState(!1),[u,h]=y.useState(null),[f,m]=y.useState({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:0,enabled:!0,userId:""}),[g,b]=y.useState(!1),[N,j]=y.useState(!1),v=y.useRef(null),k=async R=>{var re;const Z=(re=R.target.files)==null?void 0:re[0];if(Z){j(!0);try{const $=new FormData;$.append("file",Z),$.append("folder","mentors");const ie=Pu(),ce={};ie&&(ce.Authorization=`Bearer ${ie}`);const I=await(await fetch(Rl("/api/upload"),{method:"POST",body:$,credentials:"include",headers:ce})).json();I!=null&&I.success&&(I!=null&&I.url)?m(J=>({...J,avatar:I.url})):Y.error("上传失败: "+((I==null?void 0:I.error)||"未知错误"))}catch($){console.error($),Y.error("上传失败")}finally{j(!1),v.current&&(v.current.value="")}}};async function T(){i(!0);try{const R=await Oe("/api/db/mentors");R!=null&&R.success&&R.data&&r(R.data)}catch(R){console.error("Load mentors error:",R)}finally{i(!1)}}y.useEffect(()=>{T()},[]);const C=()=>{m({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:n.length>0?Math.max(...n.map(R=>R.sort))+1:0,enabled:!0,userId:""})},P=()=>{h(null),C(),c(!0)},L=R=>{h(R),m({name:R.name,avatar:R.avatar||"",intro:R.intro||"",tags:R.tags||"",priceSingle:R.priceSingle!=null?String(R.priceSingle):"",priceHalfYear:R.priceHalfYear!=null?String(R.priceHalfYear):"",priceYear:R.priceYear!=null?String(R.priceYear):"",quote:R.quote||"",whyFind:R.whyFind||"",offering:R.offering||"",judgmentStyle:R.judgmentStyle||"",sort:R.sort,enabled:R.enabled??!0,userId:R.userId||""}),c(!0)},U=async()=>{if(!f.name.trim()){Y.error("导师姓名不能为空");return}b(!0);try{const R=$=>$===""?void 0:parseFloat($),Z=f.userId.trim(),re={name:f.name.trim(),avatar:f.avatar.trim()||void 0,intro:f.intro.trim()||void 0,tags:f.tags.trim()||void 0,priceSingle:R(f.priceSingle),priceHalfYear:R(f.priceHalfYear),priceYear:R(f.priceYear),quote:f.quote.trim()||void 0,whyFind:f.whyFind.trim()||void 0,offering:f.offering.trim()||void 0,judgmentStyle:f.judgmentStyle.trim()||void 0,sort:f.sort,enabled:f.enabled};if(u){const $=await Yt("/api/db/mentors",{id:u.id,...re,userId:Z});$!=null&&$.success?(c(!1),T()):Y.error("更新失败: "+($==null?void 0:$.error))}else{const $=await kt("/api/db/mentors",{...re,userId:Z||void 0});$!=null&&$.success?(c(!1),T()):Y.error("新增失败: "+($==null?void 0:$.error))}}catch(R){console.error("Save error:",R),Y.error("保存失败")}finally{b(!1)}},_=async R=>{if(confirm("确定删除该导师?"))try{const Z=await ki(`/api/db/mentors?id=${R}`);Z!=null&&Z.success?T():Y.error("删除失败: "+(Z==null?void 0:Z.error))}catch(Z){console.error("Delete error:",Z),Y.error("删除失败")}},H=R=>R!=null?`¥${R}`:"-";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(Un,{className:"w-5 h-5 text-[#38bdac]"}),"导师管理"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师列表;填写「绑定用户 ID」后,小程序导师详情可跳转「派对会员名片」(与超级个体同页)"})]}),s.jsxs(G,{onClick:P,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx($n,{className:"w-4 h-4 mr-2"}),"新增导师"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-0",children:a?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(vs,{children:[s.jsx(Ns,{children:s.jsxs(bt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Se,{className:"text-gray-400",children:"ID"}),s.jsx(Se,{className:"text-gray-400",children:"姓名"}),s.jsx(Se,{className:"text-gray-400",children:"简介"}),s.jsx(Se,{className:"text-gray-400",children:"单次"}),s.jsx(Se,{className:"text-gray-400",children:"半年"}),s.jsx(Se,{className:"text-gray-400",children:"年度"}),s.jsx(Se,{className:"text-gray-400",children:"绑定用户"}),s.jsx(Se,{className:"text-gray-400",children:"排序"}),s.jsx(Se,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(ws,{children:[n.map(R=>s.jsxs(bt,{className:"border-gray-700/50",children:[s.jsx(ke,{className:"text-gray-300",children:R.id}),s.jsx(ke,{children:s.jsxs("button",{type:"button",onClick:()=>e(`/users?search=${encodeURIComponent(R.name)}`),className:"text-[#38bdac] hover:text-[#2da396] hover:underline flex items-center gap-1",title:"在用户管理中查看",children:[R.name,s.jsx(To,{className:"w-3 h-3"})]})}),s.jsx(ke,{className:"text-gray-400 max-w-[200px] truncate",children:R.intro||"-"}),s.jsx(ke,{className:"text-gray-400",children:H(R.priceSingle)}),s.jsx(ke,{className:"text-gray-400",children:H(R.priceHalfYear)}),s.jsx(ke,{className:"text-gray-400",children:H(R.priceYear)}),s.jsx(ke,{className:"text-gray-400 font-mono text-xs max-w-[120px] truncate",title:R.userId||"",children:R.userId?s.jsx("button",{type:"button",onClick:()=>e(`/users?search=${encodeURIComponent(R.userId||"")}`),className:"text-[#38bdac] hover:underline truncate max-w-[120px] inline-block align-bottom",children:R.userId}):"—"}),s.jsx(ke,{className:"text-gray-400",children:R.sort}),s.jsxs(ke,{className:"text-right",children:[s.jsx(G,{variant:"ghost",size:"sm",onClick:()=>L(R),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(tn,{className:"w-4 h-4"})}),s.jsx(G,{variant:"ghost",size:"sm",onClick:()=>_(R.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(ls,{className:"w-4 h-4"})})]})]},R.id)),n.length===0&&s.jsx(bt,{children:s.jsx(ke,{colSpan:9,className:"text-center py-12 text-gray-500",children:"暂无导师,点击「新增导师」添加"})})]})]})})}),s.jsx(Bt,{open:o,onOpenChange:c,children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg max-h-[90vh] overflow-y-auto",children:[s.jsx(Vt,{children:s.jsx(Ht,{className:"text-white",children: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(ne,{className:"text-gray-300",children:"姓名 *"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:卡若",value:f.name,onChange:R=>m(Z=>({...Z,name:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"排序"}),s.jsx(de,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:f.sort,onChange:R=>m(Z=>({...Z,sort:parseInt(R.target.value,10)||0}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"头像"}),s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(de,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:f.avatar,onChange:R=>m(Z=>({...Z,avatar:R.target.value})),placeholder:"点击上传或粘贴图片地址"}),s.jsx("input",{ref:v,type:"file",accept:"image/*",className:"hidden",onChange:k}),s.jsxs(G,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:N,onClick:()=>{var R;return(R=v.current)==null?void 0:R.click()},children:[s.jsx(jf,{className:"w-4 h-4 mr-2"}),N?"上传中...":"上传"]})]}),f.avatar&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:pa(f.avatar.startsWith("http")?f.avatar:Rl(f.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(ne,{className:"text-gray-300",children:"绑定用户 ID(可选,与名片页一致)"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",placeholder:"小程序用户 id,填后导师详情显示「查看派对会员名片」",value:f.userId,onChange:R=>m(Z=>({...Z,userId:R.target.value}))}),s.jsx("p",{className:"text-xs text-gray-500",children:"留空则仅展示导师资料;填写后 C 端可跳转 member-detail 与超级个体同款名片。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"简介"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:结构判断型咨询 · Decision > Execution",value:f.intro,onChange:R=>m(Z=>({...Z,intro:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"技能标签(逗号分隔)"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:项目结构判断、风险止损、人×项目匹配",value:f.tags,onChange:R=>m(Z=>({...Z,tags:R.target.value}))})]}),s.jsxs("div",{className:"border-t border-gray-700 pt-4",children:[s.jsx(ne,{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(ne,{className:"text-gray-500 text-xs",children:"单次咨询 ¥"}),s.jsx(de,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"980",value:f.priceSingle,onChange:R=>m(Z=>({...Z,priceSingle:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-500 text-xs",children:"半年咨询 ¥"}),s.jsx(de,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"19800",value:f.priceHalfYear,onChange:R=>m(Z=>({...Z,priceHalfYear:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-500 text-xs",children:"年度咨询 ¥"}),s.jsx(de,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"29800",value:f.priceYear,onChange:R=>m(Z=>({...Z,priceYear:R.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"引言"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:大多数人失败,不是因为不努力...",value:f.quote,onChange:R=>m(Z=>({...Z,quote:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"为什么找(文本)"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:f.whyFind,onChange:R=>m(Z=>({...Z,whyFind:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"提供什么(文本)"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:f.offering,onChange:R=>m(Z=>({...Z,offering:R.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"判断风格(逗号分隔)"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:冷静、克制、偏风险视角",value:f.judgmentStyle,onChange:R=>m(Z=>({...Z,judgmentStyle:R.target.value}))})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",id:"enabled",checked:f.enabled,onChange:R=>m(Z=>({...Z,enabled:R.target.checked})),className:"rounded border-gray-600 bg-[#0a1628]"}),s.jsx(ne,{htmlFor:"enabled",className:"text-gray-300 cursor-pointer",children:"上架(小程序可见)"})]})]}),s.jsxs(gn,{children:[s.jsxs(G,{variant:"outline",onClick:()=>c(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(Yn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(G,{onClick:U,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),g?"保存中...":"保存"]})]})]})})]})}function kV(){const[t,e]=y.useState([]),[n,r]=y.useState(!0),[a,i]=y.useState("");async function o(){r(!0);try{const h=a?`/api/db/mentor-consultations?status=${a}`:"/api/db/mentor-consultations",f=await Oe(h);f!=null&&f.success&&f.data&&e(f.data)}catch(h){console.error("Load consultations error:",h)}finally{r(!1)}}y.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(Ix,{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(G,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]})]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(vs,{children:[s.jsx(Ns,{children:s.jsxs(bt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Se,{className:"text-gray-400",children:"ID"}),s.jsx(Se,{className:"text-gray-400",children:"用户ID"}),s.jsx(Se,{className:"text-gray-400",children:"导师ID"}),s.jsx(Se,{className:"text-gray-400",children:"类型"}),s.jsx(Se,{className:"text-gray-400",children:"金额"}),s.jsx(Se,{className:"text-gray-400",children:"状态"}),s.jsx(Se,{className:"text-gray-400",children:"创建时间"})]})}),s.jsxs(ws,{children:[t.map(h=>s.jsxs(bt,{className:"border-gray-700/50",children:[s.jsx(ke,{className:"text-gray-300",children:h.id}),s.jsx(ke,{className:"text-gray-400",children:h.userId}),s.jsx(ke,{className:"text-gray-400",children:h.mentorId}),s.jsx(ke,{className:"text-gray-400",children:u[h.consultationType]||h.consultationType}),s.jsxs(ke,{className:"text-white",children:["¥",h.amount]}),s.jsx(ke,{className:"text-gray-400",children:c[h.status]||h.status}),s.jsx(ke,{className:"text-gray-500 text-sm",children:h.createdAt})]},h.id)),t.length===0&&s.jsx(bt,{children:s.jsx(ke,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}const tu={poolSource:["vip"],requirePhone:!0,requireNickname:!0,requireAvatar:!1,requireBusiness:!1},vj={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:tu},SV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function CV(){const t=Ua(),[e,n]=y.useState(vj),[r,a]=y.useState(!0),[i,o]=y.useState(!1),[c,u]=y.useState(!1),[h,f]=y.useState(null),[m,g]=y.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),[b,N]=y.useState(null),[j,v]=y.useState(!1),k=async()=>{v(!0);try{const R=await Oe("/api/db/match-pool-counts");R!=null&&R.success&&R.data&&N(R.data)}catch(R){console.error("加载池子人数失败:",R)}finally{v(!1)}},T=async()=>{a(!0);try{const R=await Oe("/api/db/config/full?key=match_config"),Z=(R==null?void 0:R.data)??(R==null?void 0:R.config);if(Z){let re=Z.poolSettings??tu;re.poolSource&&!Array.isArray(re.poolSource)&&(re={...re,poolSource:[re.poolSource]}),n({...vj,...Z,poolSettings:re})}}catch(R){console.error("加载匹配配置失败:",R)}finally{a(!1)}};y.useEffect(()=>{T(),k()},[]);const C=async()=>{o(!0);try{const R=await kt("/api/db/config",{key:"match_config",value:e,description:"匹配功能配置"});Y.error((R==null?void 0:R.success)!==!1?"配置保存成功!":"保存失败: "+((R==null?void 0:R.error)||"未知错误"))}catch(R){console.error(R),Y.error("保存失败")}finally{o(!1)}},P=R=>{f(R),g({...R}),u(!0)},L=()=>{f(null),g({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),u(!0)},U=()=>{if(!m.id||!m.label){Y.error("请填写类型ID和名称");return}const R=[...e.matchTypes];if(h){const Z=R.findIndex(re=>re.id===h.id);Z!==-1&&(R[Z]={...m})}else{if(R.some(Z=>Z.id===m.id)){Y.error("类型ID已存在");return}R.push({...m})}n({...e,matchTypes:R}),u(!1)},_=R=>{confirm("确定要删除这个匹配类型吗?")&&n({...e,matchTypes:e.matchTypes.filter(Z=>Z.id!==R)})},H=R=>{n({...e,matchTypes:e.matchTypes.map(Z=>Z.id===R?{...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(G,{variant:"outline",onClick:T,disabled:r,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${r?"animate-spin":""}`})," 刷新"]}),s.jsxs(G,{onClick:C,disabled:i,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"})," ",i?"保存中...":"保存配置"]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Uj,{className:"w-5 h-5 text-blue-400"})," 匹配池选择"]}),s.jsx(Xt,{className:"text-gray-400",children:"选择匹配的用户池和完善程度要求,只有满足条件的用户才可被匹配到"})]}),s.jsxs(_e,{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx(ne,{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(R=>{const Z=e.poolSettings??tu,$=(Array.isArray(Z.poolSource)?Z.poolSource:[Z.poolSource]).includes(R.value),ie=b==null?void 0:b[R.countKey],ce=()=>{const me=Array.isArray(Z.poolSource)?[...Z.poolSource]:[Z.poolSource],I=$?me.filter(J=>J!==R.value):[...me,R.value];I.length===0&&I.push(R.value),n({...e,poolSettings:{...Z,poolSource:I}})};return s.jsxs("button",{type:"button",onClick:ce,className:`p-4 rounded-lg border text-left transition-all ${$?"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 ${$?"border-[#38bdac] bg-[#38bdac] text-white":"border-gray-600"}`,children:$&&"✓"}),s.jsx("span",{className:"text-xl",children:R.icon}),s.jsx("span",{className:`text-sm font-medium ${$?"text-[#38bdac]":"text-gray-300"}`,children:R.label})]}),s.jsxs("span",{className:"text-lg font-bold text-white",children:[j?"...":ie??"-",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:R.desc}),s.jsx("span",{role:"link",tabIndex:0,onClick:me=>{me.stopPropagation(),t(`/users?pool=${R.value}`)},onKeyDown:me=>{me.key==="Enter"&&(me.stopPropagation(),t(`/users?pool=${R.value}`))},className:"text-[#38bdac] text-xs mt-2 inline-block hover:underline cursor-pointer",children:"查看用户列表 →"})]},R.value)})})]}),s.jsxs("div",{className:"space-y-3 pt-4 border-t border-gray-700/50",children:[s.jsx(ne,{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(R=>{const re=(e.poolSettings??tu)[R.key];return s.jsxs("div",{className:"flex items-center gap-3 bg-[#0a1628] rounded-lg p-3",children:[s.jsx(Ut,{checked:re,onCheckedChange:$=>n({...e,poolSettings:{...e.poolSettings??tu,[R.key]:$}})}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{children:R.icon}),s.jsx(ne,{className:"text-gray-300 text-sm",children:R.label})]})]},R.key)})})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Mo,{className:"w-5 h-5 text-yellow-400"})," 基础设置"]}),s.jsx(Xt,{className:"text-gray-400",children:"配置免费匹配次数和付费规则"})]}),s.jsxs(_e,{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(ne,{className:"text-gray-300",children:"每日免费匹配次数"}),s.jsx(de,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.freeMatchLimit,onChange:R=>n({...e,freeMatchLimit:parseInt(R.target.value,10)||0})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"付费匹配价格(元)"}),s.jsx(de,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:e.matchPrice,onChange:R=>n({...e,matchPrice:parseFloat(R.target.value)||1})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"每日最大匹配次数"}),s.jsx(de,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.settings.maxMatchesPerDay,onChange:R=>n({...e,settings:{...e.settings,maxMatchesPerDay:parseInt(R.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(Ut,{checked:e.settings.enableFreeMatches,onCheckedChange:R=>n({...e,settings:{...e.settings,enableFreeMatches:R}})}),s.jsx(ne,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:e.settings.enablePaidMatches,onCheckedChange:R=>n({...e,settings:{...e.settings,enablePaidMatches:R}})}),s.jsx(ne,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Un,{className:"w-5 h-5 text-[#38bdac]"})," 匹配类型管理"]}),s.jsx(Xt,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(G,{onClick:L,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx($n,{className:"w-4 h-4 mr-1"})," 添加类型"]})]}),s.jsx(_e,{children:s.jsxs(vs,{children:[s.jsx(Ns,{children:s.jsxs(bt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Se,{className:"text-gray-400",children:"图标"}),s.jsx(Se,{className:"text-gray-400",children:"类型ID"}),s.jsx(Se,{className:"text-gray-400",children:"显示名称"}),s.jsx(Se,{className:"text-gray-400",children:"匹配标签"}),s.jsx(Se,{className:"text-gray-400",children:"价格"}),s.jsx(Se,{className:"text-gray-400",children:"数据库匹配"}),s.jsx(Se,{className:"text-gray-400",children:"状态"}),s.jsx(Se,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsx(ws,{children:e.matchTypes.map(R=>s.jsxs(bt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ke,{children:s.jsx("span",{className:"text-2xl",children:R.icon})}),s.jsx(ke,{className:"font-mono text-gray-300",children:R.id}),s.jsx(ke,{className:"text-white font-medium",children:R.label}),s.jsx(ke,{className:"text-gray-300",children:R.matchLabel}),s.jsx(ke,{children:s.jsxs(Be,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",R.price]})}),s.jsx(ke,{children:R.matchFromDB?s.jsx(Be,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):s.jsx(Be,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),s.jsx(ke,{children:s.jsx(Ut,{checked:R.enabled,onCheckedChange:()=>H(R.id)})}),s.jsx(ke,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(G,{variant:"ghost",size:"sm",onClick:()=>P(R),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(tn,{className:"w-4 h-4"})}),s.jsx(G,{variant:"ghost",size:"sm",onClick:()=>_(R.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(ls,{className:"w-4 h-4"})})]})})]},R.id))})]})})]}),s.jsx(Bt,{open:c,onOpenChange:u,children:s.jsxs($t,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[h?s.jsx(tn,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx($n,{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(ne,{className:"text-gray-300",children:"类型ID(英文)"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:m.id,onChange:R=>g({...m,id:R.target.value}),disabled:!!h})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:SV.map(R=>s.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${m.icon===R?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>g({...m,icon:R}),children:R},R))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"显示名称"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.label,onChange:R=>g({...m,label:R.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"匹配标签"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.matchLabel,onChange:R=>g({...m,matchLabel:R.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"单次匹配价格(元)"}),s.jsx(de,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:m.price,onChange:R=>g({...m,price:parseFloat(R.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(Ut,{checked:m.matchFromDB,onCheckedChange:R=>g({...m,matchFromDB:R})}),s.jsx(ne,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:m.showJoinAfterMatch,onCheckedChange:R=>g({...m,showJoinAfterMatch:R})}),s.jsx(ne,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:m.enabled,onCheckedChange:R=>g({...m,enabled:R})}),s.jsx(ne,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(gn,{children:[s.jsx(G,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsxs(G,{onClick:U,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"})," 保存"]})]})]})})]})}const Nj={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function EV(){const[t,e]=y.useState([]),[n,r]=y.useState(0),[a,i]=y.useState(1),[o,c]=y.useState(10),[u,h]=y.useState(""),[f,m]=y.useState(!0),[g,b]=y.useState(null),[N,j]=y.useState(null);async function v(){m(!0),b(null);try{const C=new URLSearchParams({page:String(a),pageSize:String(o)});u&&C.set("matchType",u);const P=await Oe(`/api/db/match-records?${C}`);P!=null&&P.success?(e(P.records||[]),r(P.total??0)):b("加载匹配记录失败")}catch{b("加载失败,请检查网络后重试")}finally{m(!1)}}y.useEffect(()=>{v()},[a,u]);const k=Math.ceil(n/o)||1,T=({userId:C,nickname:P,avatar:L})=>s.jsxs("div",{className:"flex items-center gap-3 cursor-pointer group",onClick:()=>j(C),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:[L?s.jsx("img",{src:pa(L),alt:"",className:"w-full h-full object-cover",onError:U=>{U.currentTarget.style.display="none"}}):null,s.jsx("span",{className:L?"hidden":"",children:(P||C||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white group-hover:text-[#38bdac] transition-colors",children:P||C}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[C==null?void 0:C.slice(0,16),(C==null?void 0:C.length)>16?"...":""]})]})]});return 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:()=>b(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:C=>{h(C.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(Nj).map(([C,P])=>s.jsx("option",{value:C,children:P},C))]}),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(He,{className:`w-4 h-4 ${f?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(He,{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(vs,{children:[s.jsx(Ns,{children:s.jsxs(bt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Se,{className:"text-gray-400",children:"发起人"}),s.jsx(Se,{className:"text-gray-400",children:"匹配到"}),s.jsx(Se,{className:"text-gray-400",children:"类型"}),s.jsx(Se,{className:"text-gray-400",children:"联系方式"}),s.jsx(Se,{className:"text-gray-400",children:"匹配时间"})]})}),s.jsxs(ws,{children:[t.map(C=>s.jsxs(bt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ke,{children:s.jsx(T,{userId:C.userId,nickname:C.userNickname,avatar:C.userAvatar})}),s.jsx(ke,{children:C.matchedUserId?s.jsx(T,{userId:C.matchedUserId,nickname:C.matchedNickname,avatar:C.matchedUserAvatar}):s.jsx("span",{className:"text-gray-500",children:"—"})}),s.jsx(ke,{children:s.jsx(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Nj[C.matchType]||C.matchType})}),s.jsxs(ke,{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(ke,{className:"text-gray-400",children:C.createdAt?new Date(C.createdAt).toLocaleString():"-"})]},C.id)),t.length===0&&s.jsx(bt,{children:s.jsx(ke,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(cr,{page:a,totalPages:k,total:n,pageSize:o,onPageChange:i,onPageSizeChange:C=>{c(C),i(1)}})]})})}),s.jsx(ry,{open:!!N,onClose:()=>j(null),userId:N,onUserUpdated:v})]})}function TV(){const[t,e]=y.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(EV,{}),t==="pool"&&s.jsx(CV,{})]})}const wj={investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function MV(){const[t,e]=y.useState([]),[n,r]=y.useState(0),[a,i]=y.useState(1),[o,c]=y.useState(10),[u,h]=y.useState(!0),[f,m]=y.useState("investor"),[g,b]=y.useState(null);async function N(){h(!0);try{const T=new URLSearchParams({page:String(a),pageSize:String(o),matchType:f}),C=await Oe(`/api/db/match-records?${T}`);C!=null&&C.success&&(e(C.records||[]),r(C.total??0))}catch(T){console.error(T)}finally{h(!1)}}y.useEffect(()=>{N()},[a,f]);const j=async T=>{if(!T.phone&&!T.wechatId){Y.info("该记录无联系方式,无法推送到存客宝");return}b(T.id);try{const C=await kt("/api/ckb/join",{type:T.matchType||"investor",phone:T.phone||"",wechat:T.wechatId||"",userId:T.userId,name:T.userNickname||""});Y.error((C==null?void 0:C.message)||(C!=null&&C.success?"推送成功":"推送失败"))}catch(C){Y.error("推送失败: "+(C instanceof Error?C.message:"网络错误"))}finally{b(null)}},v=Math.ceil(n/o)||1,k=T=>!!(T.phone||T.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:T=>{m(T.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:Object.entries(wj).map(([T,C])=>s.jsx("option",{value:T,children:C},T))}),s.jsxs(G,{onClick:N,disabled:u,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${u?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(He,{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(vs,{children:[s.jsx(Ns,{children:s.jsxs(bt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Se,{className:"text-gray-400",children:"发起人"}),s.jsx(Se,{className:"text-gray-400",children:"匹配到"}),s.jsx(Se,{className:"text-gray-400",children:"类型"}),s.jsx(Se,{className:"text-gray-400",children:"联系方式"}),s.jsx(Se,{className:"text-gray-400",children:"时间"}),s.jsx(Se,{className:"text-gray-400 text-right",children:"操作"})]})}),s.jsxs(ws,{children:[t.map(T=>{var C,P;return s.jsxs(bt,{className:`border-gray-700/50 ${k(T)?"hover:bg-[#0a1628]":"opacity-60"}`,children:[s.jsx(ke,{className:"text-white",children:T.userNickname||((C=T.userId)==null?void 0:C.slice(0,12))}),s.jsx(ke,{className:"text-white",children:T.matchedNickname||((P=T.matchedUserId)==null?void 0:P.slice(0,12))}),s.jsx(ke,{children:s.jsx(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:wj[T.matchType]||T.matchType})}),s.jsxs(ke,{className:"text-sm",children:[T.phone&&s.jsxs("div",{className:"text-green-400",children:["📱 ",T.phone]}),T.wechatId&&s.jsxs("div",{className:"text-blue-400",children:["💬 ",T.wechatId]}),!T.phone&&!T.wechatId&&s.jsx("span",{className:"text-gray-600",children:"无联系方式"})]}),s.jsx(ke,{className:"text-gray-400 text-sm",children:T.createdAt?new Date(T.createdAt).toLocaleString():"-"}),s.jsx(ke,{className:"text-right",children:k(T)?s.jsxs(G,{size:"sm",onClick:()=>j(T),disabled:g===T.id,className:"bg-[#38bdac] hover:bg-[#2da396] text-white text-xs h-7 px-3",children:[s.jsx(qM,{className:"w-3 h-3 mr-1"}),g===T.id?"推送中...":"推送CKB"]}):s.jsx("span",{className:"text-gray-600 text-xs",children:"—"})})]},T.id)}),t.length===0&&s.jsx(bt,{children:s.jsx(ke,{colSpan:6,className:"text-center py-12 text-gray-500",children:"暂无记录"})})]})]}),s.jsx(cr,{page:a,totalPages:v,total:n,pageSize:o,onPageChange:i,onPageSizeChange:T=>{c(T),i(1)}})]})})})]})}const jj={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},AV={single:"单次",half_year:"半年",year:"年度"};function IV(){const[t,e]=y.useState([]),[n,r]=y.useState(!0),[a,i]=y.useState("");async function o(){r(!0);try{const c=a?`/api/db/mentor-consultations?status=${a}`:"/api/db/mentor-consultations",u=await Oe(c);u!=null&&u.success&&u.data&&e(u.data)}catch(c){console.error(c)}finally{r(!1)}}return y.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(jj).map(([c,u])=>s.jsx("option",{value:c,children:u},c))]}),s.jsxs(G,{onClick:o,disabled:n,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(vs,{children:[s.jsx(Ns,{children:s.jsxs(bt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Se,{className:"text-gray-400",children:"ID"}),s.jsx(Se,{className:"text-gray-400",children:"用户ID"}),s.jsx(Se,{className:"text-gray-400",children:"导师ID"}),s.jsx(Se,{className:"text-gray-400",children:"类型"}),s.jsx(Se,{className:"text-gray-400",children:"金额"}),s.jsx(Se,{className:"text-gray-400",children:"状态"}),s.jsx(Se,{className:"text-gray-400",children:"创建时间"})]})}),s.jsxs(ws,{children:[t.map(c=>s.jsxs(bt,{className:"border-gray-700/50",children:[s.jsx(ke,{className:"text-gray-300",children:c.id}),s.jsx(ke,{className:"text-gray-400",children:c.userId}),s.jsx(ke,{className:"text-gray-400",children:c.mentorId}),s.jsx(ke,{className:"text-gray-400",children:AV[c.consultationType]||c.consultationType}),s.jsxs(ke,{className:"text-white",children:["¥",c.amount]}),s.jsx(ke,{className:"text-gray-400",children:jj[c.status]||c.status}),s.jsx(ke,{className:"text-gray-500 text-sm",children:c.createdAt?new Date(c.createdAt).toLocaleString():"-"})]},c.id)),t.length===0&&s.jsx(bt,{children:s.jsx(ke,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}function PV(){const[t,e]=y.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(IV,{}),t==="manage"&&s.jsx("div",{className:"-mx-8",children:s.jsx(L4,{embedded:!0})})]})}function RV(){const[t,e]=y.useState([]),[n,r]=y.useState(0),[a,i]=y.useState(1),[o,c]=y.useState(10),[u,h]=y.useState(!0);async function f(){h(!0);try{const g=new URLSearchParams({page:String(a),pageSize:String(o),matchType:"team"}),b=await Oe(`/api/db/match-records?${g}`);b!=null&&b.success&&(e(b.records||[]),r(b.total??0))}catch(g){console.error(g)}finally{h(!1)}}y.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(He,{className:`w-4 h-4 ${u?"animate-spin":""}`})," 刷新"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(He,{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(vs,{children:[s.jsx(Ns,{children:s.jsxs(bt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Se,{className:"text-gray-400",children:"发起人"}),s.jsx(Se,{className:"text-gray-400",children:"匹配到"}),s.jsx(Se,{className:"text-gray-400",children:"联系方式"}),s.jsx(Se,{className:"text-gray-400",children:"时间"})]})}),s.jsxs(ws,{children:[t.map(g=>s.jsxs(bt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ke,{className:"text-white",children:g.userNickname||g.userId}),s.jsx(ke,{className:"text-white",children:g.matchedNickname||g.matchedUserId}),s.jsxs(ke,{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(ke,{className:"text-gray-400",children:g.createdAt?new Date(g.createdAt).toLocaleString():"-"})]},g.id)),t.length===0&&s.jsx(bt,{children:s.jsx(ke,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无团队招募记录"})})]})]}),s.jsx(cr,{page:a,totalPages:m,total:n,pageSize:o,onPageChange:i,onPageSizeChange:g=>{c(g),i(1)}})]})})})]})}const LV=["partner","investor","mentor","team"],Cx=[{key:"join_partner",label:"找伙伴场景"},{key:"join_investor",label:"资源对接场景"},{key:"join_mentor",label:"导师顾问场景"},{key:"join_team",label:"团队招募场景"},{key:"match",label:"匹配上报"},{key:"lead",label:"链接卡若"}],kj=`# 场景获客接口摘要 +- 地址:POST /v1/api/scenarios +- 必填:apiKey、sign、timestamp +- 主标识:phone 或 wechatId 至少一项 +- 可选:name、source、remark、tags、siteTags、portrait +- 签名:排除 sign/apiKey/portrait,键名升序拼接值后双重 MD5 +- 成功:code=200,message=新增成功 或 已存在`;function OV({initialTab:t="overview"}){const[e,n]=y.useState(t),[r,a]=y.useState("13800000000"),[i,o]=y.useState(""),[c,u]=y.useState(""),[h,f]=y.useState(kj),[m,g]=y.useState(!1),[b,N]=y.useState(!1),[j,v]=y.useState([]),[k,T]=y.useState([]),[C,P]=y.useState({}),[L,U]=y.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"}]),_=y.useMemo(()=>{const I={};return Cx.forEach(J=>{I[J.key]=C[J.key]||{apiUrl:"https://ckbapi.quwanzhi.com/v1/api/scenarios",apiKey:"fyngh-ecy9h-qkdae-epwd5-rz6kd",source:"",tags:"",siteTags:"创业实验APP",notes:""}}),I},[C]),H=I=>{const J=r.trim(),z=i.trim();return I<=3?{type:LV[I],phone:J||void 0,wechat:z||void 0,userId:"admin_test",name:"后台测试"}:I===4?{matchType:"partner",phone:J||void 0,wechat:z||void 0,userId:"admin_test",nickname:"后台测试",matchedUser:{id:"test",nickname:"测试",matchScore:88}}:I===5?{phone:J||void 0,wechatId:z||void 0,userId:"admin_test",name:"后台测试"}:{}};async function R(){N(!0);try{const[I,J,z]=await Promise.all([Oe("/api/db/config/full?key=ckb_config"),Oe("/api/db/ckb-leads?mode=submitted&page=1&pageSize=50"),Oe("/api/db/ckb-leads?mode=contact&page=1&pageSize=50")]),ge=I==null?void 0:I.data;ge!=null&&ge.routes&&P(ge.routes),ge!=null&&ge.docNotes&&u(ge.docNotes),ge!=null&&ge.docContent&&f(ge.docContent),J!=null&&J.success&&v(J.records||[]),z!=null&&z.success&&T(z.records||[])}finally{N(!1)}}y.useEffect(()=>{n(t)},[t]),y.useEffect(()=>{R()},[]);const Z=y.useMemo(()=>{const I=F=>(F||"").replace(/\D/g,"")||"",J=F=>{const W=I(F.phone);if(W)return`phone:${W}`;const fe=(F.userId||"").trim();if(fe)return`user:${fe}`;const he=(F.wechatId||"").trim();return he?`wechat:${he}`:`row:${F.id}`},z=[...k].sort((F,W)=>{const fe=F.createdAt?new Date(F.createdAt).getTime():0;return(W.createdAt?new Date(W.createdAt).getTime():0)-fe}),ge=new Set,X=[];for(const F of z){const W=J(F);ge.has(W)||(ge.add(W),X.push(F))}return X},[k]);async function re(){g(!0);try{const I=await kt("/api/db/config",{key:"ckb_config",value:{routes:_,docNotes:c,docContent:h},description:"存客宝接口配置"});Y.error((I==null?void 0:I.success)!==!1?"存客宝配置已保存":`保存失败: ${(I==null?void 0:I.error)||"未知错误"}`)}catch(I){Y.error(`保存失败: ${I instanceof Error?I.message:"网络错误"}`)}finally{g(!1)}}const $=(I,J)=>{P(z=>({...z,[I]:{..._[I],...J}}))},ie=async I=>{const J=L[I];if(J.method==="POST"&&!r.trim()&&!i.trim()){Y.error("请填写测试手机号");return}const z=[...L];z[I]={...J,status:"testing",message:void 0,responseTime:void 0},U(z);const ge=performance.now();try{const X=J.method==="GET"?await Oe(J.endpoint):await kt(J.endpoint,H(I)),F=Math.round(performance.now()-ge),W=(X==null?void 0:X.message)||"",fe=(X==null?void 0:X.success)===!0||W.includes("已存在")||W.includes("已加入")||W.includes("已提交"),he=[...L];he[I]={...J,status:fe?"success":"error",message:W||(fe?"正常":"异常"),responseTime:F},U(he),await R()}catch(X){const F=Math.round(performance.now()-ge),W=[...L];W[I]={...J,status:"error",message:X instanceof Error?X.message:"失败",responseTime:F},U(W)}},ce=async()=>{if(!r.trim()&&!i.trim()){Y.error("请填写测试手机号");return}for(let I=0;Is.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:I.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"p-0 align-top",children:s.jsxs("div",{className:"py-14 px-6 text-center bg-[#0a1628]/40 border-t border-gray-700/30",children:[s.jsx(Pl,{className:"w-12 h-12 text-orange-400/25 mx-auto mb-3","aria-hidden":!0}),s.jsx("p",{className:"text-gray-300 font-medium",children:J}),z?s.jsx("p",{className:"text-gray-500 text-sm mt-2 max-w-md mx-auto leading-relaxed",children:z}):null]})})}):I.map(ge=>s.jsxs("tr",{className:"border-t border-gray-700/30",children:[s.jsx("td",{className:"px-4 py-3 text-white",children:ge.userNickname||ge.userId}),s.jsx("td",{className:"px-4 py-3 text-gray-300",children:ge.matchType}),s.jsx("td",{className:"px-4 py-3 text-green-400",children:ge.phone||"—"}),s.jsx("td",{className:"px-4 py-3 text-blue-400",children:ge.wechatId||"—"}),s.jsx("td",{className:"px-4 py-3 text-gray-400",children:ge.createdAt?new Date(ge.createdAt).toLocaleString():"—"})]},String(ge.id)))})]})});return s.jsx(De,{className:"bg-[#0f2137] border-orange-500/30 mb-6",children:s.jsxs(_e,{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(Be,{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(To,{className:"w-3 h-3"})," API 文档"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(G,{onClick:()=>R(),variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-3.5 h-3.5 mr-1 ${b?"animate-spin":""}`})," 刷新"]}),s.jsxs(G,{onClick:re,disabled:m,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{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(([I,J])=>s.jsx("button",{type:"button",onClick:()=>n(I),className:`px-4 py-2 rounded-lg text-sm transition-colors ${e===I?"bg-orange-500 text-white":"bg-[#0a1628] text-gray-400 hover:text-white"}`,children:J},I))}),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:j.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:Z.length}),k.length!==Z.length&&s.jsxs("p",{className:"text-[10px] text-gray-500 mt-1",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:Cx.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(j,"暂无加入/匹配提交记录","用户在找伙伴发起加入或匹配后会出现在这里。"),e==="contact"&&s.jsxs("div",{className:"space-y-2",children:[k.length>Z.length&&s.jsxs("p",{className:"text-xs text-gray-500",children:["已合并 ",k.length-Z.length," 条重复(同手机号或同用户 ID 仅保留最近一条)"]}),me(Z,"暂无有联系方式线索","存客宝留资同步后显示;完整列表与筛选请前往「用户管理 → 获客列表」。")]}),e==="config"&&s.jsx("div",{className:"space-y-4",children:Cx.map(I=>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:I.label}),s.jsx(Be,{className:"bg-orange-500/20 text-orange-300 border-0 text-xs",children:I.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(ne,{className:"text-gray-500 text-xs",children:"API 地址"}),s.jsx(de,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[I.key].apiUrl,onChange:J=>$(I.key,{apiUrl:J.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-500 text-xs",children:"API Key"}),s.jsx(de,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[I.key].apiKey,onChange:J=>$(I.key,{apiKey:J.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-500 text-xs",children:"Source"}),s.jsx(de,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[I.key].source,onChange:J=>$(I.key,{source:J.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-500 text-xs",children:"Tags"}),s.jsx(de,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[I.key].tags,onChange:J=>$(I.key,{tags:J.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-500 text-xs",children:"SiteTags"}),s.jsx(de,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[I.key].siteTags,onChange:J=>$(I.key,{siteTags:J.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-500 text-xs",children:"说明备注"}),s.jsx(de,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[I.key].notes,onChange:J=>$(I.key,{notes:J.target.value})})]})]})]},I.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(Pl,{className:"w-4 h-4 text-gray-500 shrink-0"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(ne,{className:"text-gray-500 text-xs",children:"测试手机号"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:r,onChange:I=>a(I.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(ne,{className:"text-gray-500 text-xs",children:"微信号(可选)"}),s.jsx(de,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:i,onChange:I=>o(I.target.value)})]})]}),s.jsx("div",{className:"flex items-end",children:s.jsxs(G,{onClick:ce,className:"bg-orange-500 hover:bg-orange-600 text-white",children:[s.jsx(Mo,{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:L.map((I,J)=>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:[I.status==="idle"&&s.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-600 shrink-0"}),I.status==="testing"&&s.jsx(He,{className:"w-3 h-3 text-yellow-400 animate-spin shrink-0"}),I.status==="success"&&s.jsx(zj,{className:"w-3 h-3 text-green-400 shrink-0"}),I.status==="error"&&s.jsx(Bj,{className:"w-3 h-3 text-red-400 shrink-0"}),s.jsx("span",{className:"text-white text-xs truncate",children:I.label})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[I.responseTime!==void 0&&s.jsxs("span",{className:"text-gray-600 text-[10px]",children:[I.responseTime,"ms"]}),s.jsx("button",{type:"button",onClick:()=>ie(J),disabled:I.status==="testing",className:"text-orange-400/60 hover:text-orange-400 text-[10px] disabled:opacity-50",children:"测试"})]})]},`${I.endpoint}-${J}`))})]}),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(To,{className:"w-3 h-3"})," 打开外链"]})]}),s.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-400 leading-6",children:h||kj})]}),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:I=>u(I.target.value),placeholder:"记录 Token、入口差异、回复率统计规则、对接约定等。"})]})]})]})})}const DV=[{id:"partner",label:"找伙伴",icon:Un,desc:"匹配池与记录"},{id:"resource",label:"资源对接",icon:U5,desc:"人脉资源"},{id:"mentor",label:"导师预约",icon:B5,desc:"预约与管理"},{id:"team",label:"团队招募",icon:_c,desc:"团队协作"}];function _V(){const[t,e]=y.useState("partner"),[n,r]=y.useState(!1);return s.jsxs("div",{className:"p-8 w-full max-w-7xl mx-auto",children:[s.jsxs("div",{className:"mb-8 flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-xl font-semibold text-white flex items-center gap-2",children:[s.jsx(Un,{className:"w-5 h-5 text-[#38bdac]"}),"找伙伴"]}),s.jsx("p",{className:"text-gray-500 text-sm mt-0.5",children:"匹配、获客、导师与团队管理 · 汇总数据见「仪表盘」与「推广中心」"})]}),s.jsxs(G,{type:"button",variant:"outline",size:"sm",onClick:()=>r(a=>!a),className:`border-orange-500/30 text-orange-300 hover:bg-orange-500/10 bg-transparent text-xs ${n?"bg-orange-500/10":""}`,children:[s.jsx(Si,{className:"w-3.5 h-3.5 mr-1.5"}),"存客宝",s.jsx(vl,{className:`w-3 h-3 ml-1 transition-transform ${n?"rotate-90":""}`})]})]}),n&&s.jsx(OV,{initialTab:"overview"}),s.jsx("div",{className:"flex gap-1 mb-6 bg-[#0a1628] rounded-lg p-1 border border-gray-700/40",children:DV.map(a=>{const i=t===a.id;return s.jsxs("button",{type:"button",onClick:()=>e(a.id),className:`flex-1 flex items-center justify-center gap-1.5 px-3 py-2 rounded-md text-sm transition-all ${i?"bg-[#38bdac] text-white shadow-md":"text-gray-400 hover:text-white hover:bg-gray-700/40"}`,children:[s.jsx(a.icon,{className:"w-3.5 h-3.5"}),a.label]},a.id)})}),t==="partner"&&s.jsx(TV,{}),t==="resource"&&s.jsx(MV,{}),t==="mentor"&&s.jsx(PV,{}),t==="team"&&s.jsx(RV,{})]})}function $V(){const t=Do();return s.jsx("div",{className:"min-h-screen bg-[#0a1628] flex items-center justify-center p-8",children:s.jsxs("div",{className:"text-center max-w-md",children:[s.jsx("div",{className:"inline-flex items-center justify-center w-20 h-20 rounded-full bg-red-500/20 text-red-400 mb-6",children:s.jsx($j,{className:"w-10 h-10"})}),s.jsx("h1",{className:"text-4xl font-bold text-white mb-2",children:"404"}),s.jsx("p",{className:"text-gray-400 mb-1",children:"页面不存在"}),s.jsx("p",{className:"text-sm text-gray-500 font-mono mb-8 break-all",children:t.pathname}),s.jsx(G,{asChild:!0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:s.jsxs(Al,{to:"/",children:[s.jsx(Z5,{className:"w-4 h-4 mr-2"}),"返回首页"]})})]})})}function zV(){return s.jsxs(DT,{children:[s.jsx(ln,{path:"/login",element:s.jsx(II,{})}),s.jsxs(ln,{path:"/",element:s.jsx(LA,{}),children:[s.jsx(ln,{index:!0,element:s.jsx(Lh,{to:"/dashboard",replace:!0})}),s.jsx(ln,{path:"dashboard",element:s.jsx(UR,{})}),s.jsx(ln,{path:"orders",element:s.jsx(WR,{})}),s.jsx(ln,{path:"users",element:s.jsx(e8,{})}),s.jsx(ln,{path:"distribution",element:s.jsx(w8,{})}),s.jsx(ln,{path:"withdrawals",element:s.jsx(j8,{})}),s.jsx(ln,{path:"content",element:s.jsx(sV,{})}),s.jsx(ln,{path:"referral-settings",element:s.jsx(A2,{})}),s.jsx(ln,{path:"author-settings",element:s.jsx(Lh,{to:"/settings?tab=author",replace:!0})}),s.jsx(ln,{path:"vip-roles",element:s.jsx(jV,{})}),s.jsx(ln,{path:"mentors",element:s.jsx(L4,{})}),s.jsx(ln,{path:"mentor-consultations",element:s.jsx(kV,{})}),s.jsx(ln,{path:"admin-users",element:s.jsx(Lh,{to:"/settings?tab=admin",replace:!0})}),s.jsx(ln,{path:"settings",element:s.jsx(fV,{})}),s.jsx(ln,{path:"payment",element:s.jsx(pV,{})}),s.jsx(ln,{path:"site",element:s.jsx(yV,{})}),s.jsx(ln,{path:"qrcodes",element:s.jsx(bV,{})}),s.jsx(ln,{path:"find-partner",element:s.jsx(_V,{})}),s.jsx(ln,{path:"match",element:s.jsx(NV,{})}),s.jsx(ln,{path:"match-records",element:s.jsx(wV,{})}),s.jsx(ln,{path:"api-doc",element:s.jsx(Lh,{to:"/api-docs",replace:!0})}),s.jsx(ln,{path:"api-docs",element:s.jsx(R4,{})})]}),s.jsx(ln,{path:"*",element:s.jsx($V,{})})]})}BE.createRoot(document.getElementById("root")).render(s.jsx(y.StrictMode,{children:s.jsx(UT,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:s.jsx(zV,{})})})); diff --git a/soul-admin/dist/index.html b/soul-admin/dist/index.html index 65f5eca5..44ceede9 100644 --- a/soul-admin/dist/index.html +++ b/soul-admin/dist/index.html @@ -4,8 +4,8 @@ 管理后台 - Soul创业派对 - - + +
    diff --git a/soul-admin/src/layouts/AdminLayout.tsx b/soul-admin/src/layouts/AdminLayout.tsx index 253baa4e..0a110423 100644 --- a/soul-admin/src/layouts/AdminLayout.tsx +++ b/soul-admin/src/layouts/AdminLayout.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect } from 'react' +import { useState, useEffect, useRef } from 'react' import { Outlet, Link, useLocation, useNavigate } from 'react-router-dom' import { LayoutDashboard, @@ -24,6 +24,8 @@ const primaryMenuItems = [ export function AdminLayout() { const location = useLocation() + const pathnameRef = useRef(location.pathname) + pathnameRef.current = location.pathname const navigate = useNavigate() const [mounted, setMounted] = useState(false) const [authChecked, setAuthChecked] = useState(false) @@ -32,11 +34,10 @@ export function AdminLayout() { setMounted(true) }, []) + // 仅在布局首次就绪时校验一次;路由切换不再重置 authChecked,避免侧栏点菜单时全屏「加载中」 useEffect(() => { if (!mounted) return - setAuthChecked(false) let cancelled = false - // 鉴权优化:先检查 token,无 token 直接跳登录,避免无效请求 if (!getAdminToken()) { navigate('/login', { replace: true }) return @@ -48,19 +49,19 @@ export function AdminLayout() { setAuthChecked(true) } else { clearAdminToken() - navigate('/login', { replace: true, state: { from: location.pathname } }) + navigate('/login', { replace: true, state: { from: pathnameRef.current } }) } }) .catch(() => { if (!cancelled) { clearAdminToken() - navigate('/login', { replace: true, state: { from: location.pathname } }) + navigate('/login', { replace: true, state: { from: pathnameRef.current } }) } }) return () => { cancelled = true } - }, [location.pathname, mounted, navigate]) + }, [mounted, navigate]) const handleLogout = async () => { clearAdminToken() @@ -138,7 +139,7 @@ export function AdminLayout() {
    -
    +
    diff --git a/soul-admin/src/pages/dashboard/DashboardPage.tsx b/soul-admin/src/pages/dashboard/DashboardPage.tsx index 94810b03..381318f1 100644 --- a/soul-admin/src/pages/dashboard/DashboardPage.tsx +++ b/soul-admin/src/pages/dashboard/DashboardPage.tsx @@ -603,11 +603,11 @@ export function DashboardPage() {
    )} -
    +
    {stats.map((stat, index) => ( stat.link && navigate(stat.link)} > diff --git a/soul-admin/src/pages/distribution/DistributionPage.tsx b/soul-admin/src/pages/distribution/DistributionPage.tsx index ba14348f..40701dc7 100644 --- a/soul-admin/src/pages/distribution/DistributionPage.tsx +++ b/soul-admin/src/pages/distribution/DistributionPage.tsx @@ -1,7 +1,6 @@ import toast from '@/utils/toast' -import { useState, useEffect, useCallback, useRef } from 'react' -import { useSearchParams } from 'react-router-dom' -import { useDebounce } from '@/hooks/useDebounce' +import { useState, useEffect } from 'react' +import { useSearchParams, useNavigate, Link } from 'react-router-dom' import { Users, TrendingUp, @@ -18,8 +17,6 @@ import { Undo2, Settings, Zap, - UserPlus, - Trash2, } from 'lucide-react' import { ReferralSettingsPage } from '@/pages/referral-settings/ReferralSettingsPage' import { Pagination } from '@/components/ui/Pagination' @@ -35,7 +32,7 @@ import { DialogFooter, DialogTitle, } from '@/components/ui/dialog' -import { get, post, put } from '@/api/client' +import { get, put } from '@/api/client' interface TodayClicksByPageItem { page: string @@ -131,8 +128,9 @@ interface Order { export function DistributionPage() { const [searchParams] = useSearchParams() + const navigate = useNavigate() const [activeTab, setActiveTab] = useState< - 'overview' | 'orders' | 'bindings' | 'withdrawals' | 'settings' | 'leads' + 'overview' | 'orders' | 'bindings' | 'withdrawals' | 'settings' >('overview') /** 订单 Tab 内:普通订单 / 代付请求 */ const [orderSubView, setOrderSubView] = useState<'orders' | 'giftpay'>('orders') @@ -179,234 +177,12 @@ export function DistributionPage() { const [giftPayTotal, setGiftPayTotal] = useState(0) const [giftPayStatusFilter, setGiftPayStatusFilter] = useState('') - /** 推广中心 · 获客情况(ckb_lead_records + 存客宝推送回执) */ - type CkbContactLeadRow = { - id: number - userId?: string - userNickname?: string - userAvatar?: string - phone?: string - wechatId?: string - name?: string - source?: string - personName?: string - ckbPlanId?: number - pushStatus?: string - retryCount?: number - ckbError?: string - lastPushAt?: string - nextRetryAt?: string - createdAt?: string - } - const [ckbLeadRecords, setCkbLeadRecords] = useState([]) - const [ckbLeadTotal, setCkbLeadTotal] = useState(0) - const [ckbLeadPage, setCkbLeadPage] = useState(1) - const [ckbLeadPageSize, setCkbLeadPageSize] = useState(10) - const [ckbLeadLoading, setCkbLeadLoading] = useState(false) - const [ckbLeadError, setCkbLeadError] = useState(null) - const [ckbLeadSearchTerm, setCkbLeadSearchTerm] = useState('') - const debouncedCkbLeadSearch = useDebounce(ckbLeadSearchTerm, 300) - const [ckbLeadSourceFilter, setCkbLeadSourceFilter] = useState('') - const [ckbLeadPushFilter, setCkbLeadPushFilter] = useState('') - const [ckbLeadStats, setCkbLeadStats] = useState<{ - uniqueUsers?: number - sourceStats?: { source: string; cnt: number }[] - }>({}) - const [ckbRetryingLeadId, setCkbRetryingLeadId] = useState(null) - const [ckbDeletingLeadId, setCkbDeletingLeadId] = useState(null) - const [ckbLeadSelectedIds, setCkbLeadSelectedIds] = useState([]) - const [ckbBatchDeleting, setCkbBatchDeleting] = useState(false) - const ckbLeadHeaderCheckboxRef = useRef(null) - - const loadCkbLeads = useCallback(async () => { - setCkbLeadLoading(true) - setCkbLeadError(null) - try { - const params = new URLSearchParams({ - mode: 'contact', - page: String(ckbLeadPage), - pageSize: String(ckbLeadPageSize), - }) - if (debouncedCkbLeadSearch.trim()) params.set('search', debouncedCkbLeadSearch.trim()) - if (ckbLeadSourceFilter) params.set('source', ckbLeadSourceFilter) - if (ckbLeadPushFilter) params.set('pushStatus', ckbLeadPushFilter) - const data = await get<{ - success?: boolean - records?: CkbContactLeadRow[] - total?: number - stats?: { uniqueUsers?: number; sourceStats?: { source: string; cnt: number }[] } - error?: string - }>(`/api/db/ckb-leads?${params}`) - if (data?.success) { - setCkbLeadRecords(data.records || []) - setCkbLeadTotal(data.total ?? 0) - if (data.stats) setCkbLeadStats(data.stats) - } else { - const msg = data?.error || '加载获客情况失败' - setCkbLeadError(msg) - toast.error(msg) - setCkbLeadRecords([]) - setCkbLeadTotal(0) - } - } catch (e) { - const msg = e instanceof Error ? e.message : '网络错误' - setCkbLeadError(msg) - toast.error('加载获客情况失败: ' + msg) - setCkbLeadRecords([]) - setCkbLeadTotal(0) - } finally { - setCkbLeadLoading(false) - } - }, [ - ckbLeadPage, - ckbLeadPageSize, - debouncedCkbLeadSearch, - ckbLeadSourceFilter, - ckbLeadPushFilter, - ]) - + /** 旧链接「推广中心 → 获客情况」已合并至用户管理 → 获客列表 */ useEffect(() => { - setCkbLeadSelectedIds([]) - }, [debouncedCkbLeadSearch, ckbLeadSourceFilter, ckbLeadPushFilter]) - - useEffect(() => { - const pageIds = ckbLeadRecords.map((r) => r.id) - const n = pageIds.filter((id) => ckbLeadSelectedIds.includes(id)).length - const el = ckbLeadHeaderCheckboxRef.current - if (el) { - el.indeterminate = n > 0 && n < pageIds.length + if (searchParams.get('tab') === 'leads') { + navigate('/users?tab=leads', { replace: true }) } - }, [ckbLeadRecords, ckbLeadSelectedIds]) - - function toggleCkbLeadSelectAllOnPage() { - const pageIds = ckbLeadRecords.map((r) => r.id) - const allOn = pageIds.length > 0 && pageIds.every((id) => ckbLeadSelectedIds.includes(id)) - if (allOn) { - setCkbLeadSelectedIds((prev) => prev.filter((id) => !pageIds.includes(id))) - } else { - setCkbLeadSelectedIds((prev) => [...new Set([...prev, ...pageIds])]) - } - } - - function toggleCkbLeadOne(id: number) { - setCkbLeadSelectedIds((prev) => (prev.includes(id) ? prev.filter((x) => x !== id) : [...prev, id])) - } - - async function batchDeleteCkbLeads() { - if (ckbLeadSelectedIds.length === 0) { - toast.info('请先勾选要删除的记录') - return - } - const n = ckbLeadSelectedIds.length - if (!confirm(`确定批量删除选中的 ${n} 条获客记录?删除后不可恢复。`)) return - const CHUNK = 500 - setCkbBatchDeleting(true) - try { - let totalDeleted = 0 - for (let i = 0; i < ckbLeadSelectedIds.length; i += CHUNK) { - const slice = ckbLeadSelectedIds.slice(i, i + CHUNK) - const data = await post<{ success?: boolean; deleted?: number; error?: string }>( - '/api/db/ckb-leads/delete-batch', - { ids: slice }, - ) - if (!data?.success) { - toast.error(data?.error || '批量删除失败') - return - } - totalDeleted += Number(data.deleted) || 0 - } - toast.success(`已删除 ${totalDeleted} 条`) - setCkbLeadSelectedIds([]) - } catch (e) { - toast.error(e instanceof Error ? e.message : '批量删除请求失败') - } finally { - setCkbBatchDeleting(false) - void loadCkbLeads() - } - } - - function mergeCkbLeadRowAfterRetry( - row: CkbContactLeadRow, - rec: { - pushStatus?: string - retryCount?: number - ckbError?: string - lastPushAt?: string | null - nextRetryAt?: string | null - }, - ): CkbContactLeadRow { - return { - ...row, - ...(rec.pushStatus !== undefined ? { pushStatus: rec.pushStatus } : {}), - ...(typeof rec.retryCount === 'number' ? { retryCount: rec.retryCount } : {}), - ...(rec.ckbError !== undefined ? { ckbError: rec.ckbError } : {}), - ...(rec.lastPushAt !== undefined ? { lastPushAt: rec.lastPushAt ?? undefined } : {}), - ...(rec.nextRetryAt !== undefined ? { nextRetryAt: rec.nextRetryAt ?? undefined } : {}), - } - } - - async function retryCkbLeadPush(recordId: number) { - if (!recordId) return - setCkbRetryingLeadId(recordId) - try { - const data = await post<{ - success?: boolean - pushed?: boolean - error?: string - record?: { - pushStatus?: string - retryCount?: number - ckbError?: string - lastPushAt?: string | null - nextRetryAt?: string | null - } - }>('/api/db/ckb-leads/retry', { - id: recordId, - }) - if (data?.success) { - toast.success(data.pushed ? '重推成功' : '已发起重推,请刷新查看状态') - if (data.record) { - setCkbLeadRecords((prev) => - prev.map((row) => - row.id === recordId ? mergeCkbLeadRowAfterRetry(row, data.record!) : row, - ), - ) - } - } else { - toast.error(data?.error || '重推失败') - } - } catch (e) { - toast.error(e instanceof Error ? e.message : '重推请求失败') - } finally { - setCkbRetryingLeadId(null) - } - } - - async function deleteCkbLeadRecord(recordId: number) { - if (!recordId) return - if (!confirm('确定删除该条获客记录?删除后不可恢复,用户可再次提交留资。')) return - setCkbDeletingLeadId(recordId) - try { - const data = await post<{ success?: boolean; error?: string }>('/api/db/ckb-leads/delete', { id: recordId }) - if (data?.success) { - toast.success('已删除') - } else { - toast.error(data?.error || '删除失败') - } - } catch (e) { - toast.error(e instanceof Error ? e.message : '删除请求失败') - } finally { - setCkbDeletingLeadId(null) - void loadCkbLeads() - } - } - - function pushStatusBadge(status?: string) { - if (status === 'success') - return 成功 - if (status === 'failed') return 失败 - return 待推送 - } + }, [searchParams, navigate]) useEffect(() => { loadInitialData() @@ -419,8 +195,7 @@ export function DistributionPage() { t === 'orders' || t === 'bindings' || t === 'withdrawals' || - t === 'settings' || - t === 'leads' + t === 'settings' ) { setActiveTab(t) } @@ -431,10 +206,6 @@ export function DistributionPage() { }, [activeTab, statusFilter]) useEffect(() => { - if (activeTab === 'leads') { - setLoading(false) - return - } loadTabData(activeTab) }, [activeTab]) @@ -446,9 +217,6 @@ export function DistributionPage() { if (['orders', 'bindings', 'withdrawals'].includes(activeTab)) { void loadTabData(activeTab, true) } - if (activeTab === 'leads') { - void loadCkbLeads() - } }, [ page, pageSize, @@ -458,9 +226,6 @@ export function DistributionPage() { orderSubView, giftPayPage, giftPayStatusFilter, - ckbLeadPage, - ckbLeadPageSize, - loadCkbLeads, ]) useEffect(() => { @@ -612,8 +377,6 @@ export function DistributionPage() { } break } - case 'leads': - break } setLoadedTabs((prev) => new Set(prev).add(tab)) } catch (e) { @@ -625,10 +388,6 @@ export function DistributionPage() { async function refreshCurrentTab() { setError(null) - if (activeTab === 'leads') { - await loadCkbLeads() - return - } setLoadedTabs((prev) => { const next = new Set(prev) next.delete(activeTab) @@ -791,7 +550,6 @@ export function DistributionPage() { } const totalPages = Math.ceil(total / pageSize) || 1 - const ckbLeadTotalPages = Math.ceil(ckbLeadTotal / ckbLeadPageSize) || 1 const displayOrders = orders const displayBindings = bindings.filter((b) => { if (!searchTerm) return true @@ -828,14 +586,12 @@ export function DistributionPage() {
    @@ -847,7 +603,6 @@ export function DistributionPage() { { key: 'bindings', label: '绑定管理', icon: Link2 }, { key: 'withdrawals', label: '提现审核', icon: Wallet }, { key: 'settings', label: '推广设置', icon: Settings }, - { key: 'leads', label: '获客情况', icon: UserPlus }, ].map((tab) => ( + + + +
    @@ -1591,305 +1364,6 @@ export function DistributionPage() {
    )} - {activeTab === 'leads' && ( -
    -

    - 展示用户通过文章 @、首页等入口留下的线索,以及转发存客宝接口的推送状态与失败原因(数据来自{' '} - ckb_lead_records)。 -

    - {ckbLeadError && ( -
    - {ckbLeadError} - -
    - )} -
    -
    -

    总留资条数

    -

    {ckbLeadTotal}

    -
    -
    -

    去重用户数

    -

    {ckbLeadStats.uniqueUsers ?? 0}

    -
    - {(ckbLeadStats.sourceStats || []).slice(0, 2).map((s) => ( -
    -

    来源:{s.source}

    -

    {s.cnt}

    -
    - ))} -
    -
    -
    - - { - setCkbLeadSearchTerm(e.target.value) - setCkbLeadPage(1) - }} - placeholder="搜索昵称 / 手机 / 微信 / 姓名…" - className="pl-10 bg-[#0f2137] border-gray-700 text-white" - /> -
    - {ckbLeadStats.sourceStats && ckbLeadStats.sourceStats.length > 0 && ( - - )} - - -
    - {ckbLeadRecords.length > 0 && ( -
    - - 已选 {ckbLeadSelectedIds.length} 条(可翻页继续勾选;改搜索或来源/状态筛选会清空) - - - {ckbLeadSelectedIds.length > 0 && ( - - )} -
    - )} - - - {ckbLeadRecords.length === 0 && !ckbLeadLoading ? ( -
    - -

    暂无记录,或当前筛选无匹配

    -
    - ) : ckbLeadRecords.length === 0 && ckbLeadLoading ? ( -
    - - 加载获客情况… -
    - ) : ( -
    -
    -
    - - - - - - - - - - - - - - - - {ckbLeadRecords.map((r) => ( - - - - - - - - - - - - ))} - -
    - 0 && - ckbLeadRecords.every((r) => ckbLeadSelectedIds.includes(r.id)) - } - onChange={toggleCkbLeadSelectAllOnPage} - disabled={ckbLeadLoading} - className="w-4 h-4 rounded border-gray-600 bg-[#0f2137] accent-[#38bdac] cursor-pointer" - title="全选本页" - /> - 点击用户@ 目标人物联系方式来源存客宝推送最后推送创建时间操作
    - toggleCkbLeadOne(r.id)} - disabled={ckbBatchDeleting || ckbLeadLoading} - className="w-4 h-4 rounded border-gray-600 bg-[#0f2137] accent-[#38bdac] cursor-pointer" - /> - -
    - {r.userAvatar ? ( - - ) : ( -
    - {(r.userNickname || r.name || '?').slice(0, 1)} -
    - )} -
    -

    {r.userNickname || r.name || '-'}

    - {r.userId && ( -

    - {r.userId} -

    - )} -
    -
    -
    {r.personName || '-'} -
    -

    {r.phone || '-'}

    -

    {r.wechatId || '-'}

    -
    -
    - - {r.source || '未知'} - - -
    - {pushStatusBadge(r.pushStatus)} - {r.ckbError ? ( -

    - {r.ckbError} -

    - ) : ( -

    - )} -

    - 重试 {typeof r.retryCount === 'number' ? r.retryCount : 0} 次 -

    -
    -
    - {r.lastPushAt ? new Date(r.lastPushAt).toLocaleString('zh-CN') : '-'} - - {r.createdAt ? new Date(r.createdAt).toLocaleString('zh-CN') : '-'} - -
    - - -
    -
    -
    - { - setCkbLeadPageSize(n) - setCkbLeadPage(1) - }} - /> -
    - {ckbLeadLoading && ( -
    - - 加载中… -
    - )} -
    - )} -
    -
    -
    - )} )} diff --git a/soul-admin/src/pages/find-partner/FindPartnerPage.tsx b/soul-admin/src/pages/find-partner/FindPartnerPage.tsx index cd18c01f..9b74491a 100644 --- a/soul-admin/src/pages/find-partner/FindPartnerPage.tsx +++ b/soul-admin/src/pages/find-partner/FindPartnerPage.tsx @@ -1,15 +1,13 @@ import { useState } from 'react' import { Button } from '@/components/ui/button' -import { Users, Handshake, GraduationCap, UserPlus, BarChart3, Link2, ChevronRight } from 'lucide-react' +import { Users, Handshake, GraduationCap, UserPlus, Link2, ChevronRight } from 'lucide-react' import { FindPartnerTab } from './tabs/FindPartnerTab' import { ResourceDockingTab } from './tabs/ResourceDockingTab' import { MentorTab } from './tabs/MentorTab' import { TeamRecruitTab } from './tabs/TeamRecruitTab' -import { CKBStatsTab } from './tabs/CKBStatsTab' import { CKBConfigPanel } from './tabs/CKBConfigPanel' const TABS = [ - { id: 'stats', label: '数据统计', icon: BarChart3, desc: '匹配与获客概览' }, { id: 'partner', label: '找伙伴', icon: Users, desc: '匹配池与记录' }, { id: 'resource', label: '资源对接', icon: Handshake, desc: '人脉资源' }, { id: 'mentor', label: '导师预约', icon: GraduationCap, desc: '预约与管理' }, @@ -19,9 +17,8 @@ const TABS = [ type TabId = (typeof TABS)[number]['id'] export function FindPartnerPage() { - const [activeTab, setActiveTab] = useState('stats') + const [activeTab, setActiveTab] = useState('partner') const [showCKBPanel, setShowCKBPanel] = useState(false) - const [ckbPanelTab, setCkbPanelTab] = useState<'overview' | 'submitted' | 'contact' | 'config' | 'test' | 'doc'>('overview') return (
    @@ -31,7 +28,9 @@ export function FindPartnerPage() { 找伙伴 -

    匹配、获客、导师与团队管理

    +

    + 匹配、获客、导师与团队管理 · 汇总数据见「仪表盘」与「推广中心」 +

    + ) : ( + '—' + )} + {m.sort} + + ) +} + +function prettyJson(raw: string): string { + const s = (raw || '').trim() + if (!s) return '' + try { + return JSON.stringify(JSON.parse(s), null, 2) + } catch { + return s + } +} + export function UsersPage() { const [searchParams, setSearchParams] = useSearchParams() const poolParam = searchParams.get('pool') // 'vip' | 'complete' | 'all' | null const rawTabParam = searchParams.get('tab') || 'users' const tabParam = ['users', 'journey', 'rules', 'vip-roles', 'leads'].includes(rawTabParam) ? rawTabParam : 'users' + const leadActionParam = (searchParams.get('leadAction') || '').trim() // ===== 用户列表 state ===== const [users, setUsers] = useState([]) @@ -257,14 +320,19 @@ export function UsersPage() { id: number userId?: string userNickname?: string + /** 与会员资料一致,来自 users.avatar(接口已 resolve) */ + userAvatar?: string phone?: string wechatId?: string name?: string source?: string + planApiKey?: string personName?: string - ckbPlanId?: number pushStatus?: 'pending' | 'success' | 'failed' | string retryCount?: number + ckbCode?: number + ckbMessage?: string + ckbData?: string ckbError?: string lastPushAt?: string nextRetryAt?: string @@ -272,13 +340,15 @@ export function UsersPage() { }[]>([]) const [leadsTotal, setLeadsTotal] = useState(0) const [leadsPage, setLeadsPage] = useState(1) - const [leadsPageSize] = useState(20) + const [leadsPageSize] = useState(10) const [leadsLoading, setLeadsLoading] = useState(false) const [leadsError, setLeadsError] = useState(null) const [leadsSearchTerm, setLeadsSearchTerm] = useState('') const debouncedLeadsSearch = useDebounce(leadsSearchTerm, 300) const [leadsSourceFilter, setLeadsSourceFilter] = useState('') + const [leadsActionFilter, setLeadsActionFilter] = useState('') const [leadsPushStatusFilter, setLeadsPushStatusFilter] = useState('') + const [leadsDedupEnabled, setLeadsDedupEnabled] = useState(false) const [leadsStats, setLeadsStats] = useState<{ uniqueUsers?: number; sourceStats?: { source: string; cnt: number }[] }>({}) const [retryingLeadId, setRetryingLeadId] = useState(null) const [deletingLeadId, setDeletingLeadId] = useState(null) @@ -286,6 +356,9 @@ export function UsersPage() { const [batchDeletingLeads, setBatchDeletingLeads] = useState(false) const leadsHeaderCheckboxRef = useRef(null) const [batchRetrying, setBatchRetrying] = useState(false) + const [showCkbDataDialog, setShowCkbDataDialog] = useState(false) + const [ckbDataDialogTitle, setCkbDataDialogTitle] = useState('存客宝返回 data') + const [ckbDataDialogContent, setCkbDataDialogContent] = useState('') const loadLeads = useCallback(async (searchVal?: string, sourceVal?: string) => { setLeadsLoading(true) setLeadsError(null) @@ -299,6 +372,7 @@ export function UsersPage() { if (s) params.set('search', s) const src = sourceVal ?? leadsSourceFilter if (src) params.set('source', src) + if (leadsActionFilter) params.set('action', leadsActionFilter) if (leadsPushStatusFilter) params.set('pushStatus', leadsPushStatusFilter) const data = await get<{ success?: boolean; records?: unknown[]; total?: number; @@ -325,15 +399,24 @@ export function UsersPage() { } finally { setLeadsLoading(false) } - }, [leadsPage, leadsPageSize, debouncedLeadsSearch, leadsSourceFilter, leadsPushStatusFilter]) + }, [leadsPage, leadsPageSize, debouncedLeadsSearch, leadsSourceFilter, leadsActionFilter, leadsPushStatusFilter]) useEffect(() => { setLeadSelectedIds([]) - }, [debouncedLeadsSearch, leadsSourceFilter, leadsPushStatusFilter]) + }, [debouncedLeadsSearch, leadsSourceFilter, leadsActionFilter, leadsPushStatusFilter]) + + // URL 同步:只在获客列表 Tab 时读取 leadAction,默认空=全部类型 + useEffect(() => { + if (tabParam !== 'leads') return + setLeadsActionFilter(leadActionParam) + }, [tabParam, leadActionParam]) type LeadRetryRecordPatch = { pushStatus?: string retryCount?: number + ckbCode?: number + ckbMessage?: string + ckbData?: string ckbError?: string lastPushAt?: string | null nextRetryAt?: string | null @@ -344,6 +427,9 @@ export function UsersPage() { ...row, ...(rec.pushStatus !== undefined ? { pushStatus: rec.pushStatus } : {}), ...(typeof rec.retryCount === 'number' ? { retryCount: rec.retryCount } : {}), + ...(typeof rec.ckbCode === 'number' ? { ckbCode: rec.ckbCode } : {}), + ...(rec.ckbMessage !== undefined ? { ckbMessage: rec.ckbMessage } : {}), + ...(rec.ckbData !== undefined ? { ckbData: rec.ckbData } : {}), ...(rec.ckbError !== undefined ? { ckbError: rec.ckbError } : {}), ...(rec.lastPushAt !== undefined ? { lastPushAt: rec.lastPushAt ?? undefined } : {}), ...(rec.nextRetryAt !== undefined ? { nextRetryAt: rec.nextRetryAt ?? undefined } : {}), @@ -436,7 +522,7 @@ export function UsersPage() { return } const esc = (v: unknown) => `"${String(v ?? '').replace(/"/g, '""')}"` - const headers = ['ID', '昵称', '手机号', '微信号', '对应@人', '来源', '推送状态', '重试次数', '失败原因', '下次重试时间', '创建时间'] + const headers = ['ID', '昵称', '手机号', '微信号', '对应@人', '计划Key', '来源', '推送状态', '重试次数', '失败原因', '下次重试时间', '创建时间'] const lines = [headers.join(',')] for (const r of failedRows) { lines.push([ @@ -445,6 +531,7 @@ export function UsersPage() { esc(r.phone || ''), esc(r.wechatId || ''), esc(r.personName || ''), + esc(r.planApiKey || ''), esc(r.source || ''), esc(r.pushStatus || ''), esc(typeof r.retryCount === 'number' ? r.retryCount : ''), @@ -968,7 +1055,7 @@ export function UsersPage() { return Math.round((filled / fields.length) * 100) } - /** 本页内去重:优先手机号,其次 userId(与小程序用户一致,常等同微信侧标识),再微信号;同键保留最新一条 */ + /** 展示列表:默认不去重(按原始记录展示);可选开启去重用于运营查看「按人合并」 */ const { leadsRows, leadsRawCount, leadsDeduped } = useMemo(() => { const normalizePhone = (p?: string | null) => (p || '').replace(/\D/g, '') || '' const dedupKey = (r: (typeof leadsRecords)[0]) => { @@ -984,7 +1071,7 @@ export function UsersPage() { let rows = leadsRecords if (q) { rows = leadsRecords.filter((r) => { - const blob = [r.userNickname, r.name, r.phone, r.wechatId, r.personName, r.source, String(r.ckbPlanId ?? '')] + const blob = [r.userNickname, r.name, r.phone, r.wechatId, r.personName, r.source, r.planApiKey] .filter(Boolean) .join(' ') .toLowerCase() @@ -996,6 +1083,9 @@ export function UsersPage() { const tb = b.createdAt ? new Date(b.createdAt).getTime() : 0 return tb - ta }) + if (!leadsDedupEnabled) { + return { leadsRows: sorted, leadsRawCount: rows.length, leadsDeduped: 0 } + } const seen = new Set() const out: typeof leadsRecords = [] for (const r of sorted) { @@ -1005,7 +1095,7 @@ export function UsersPage() { out.push(r) } return { leadsRows: out, leadsRawCount: rows.length, leadsDeduped: rows.length - out.length } - }, [leadsRecords, debouncedLeadsSearch]) + }, [leadsRecords, debouncedLeadsSearch, leadsDedupEnabled]) useEffect(() => { const pageIds = leadsRows.map((r) => r.id) @@ -1064,8 +1154,21 @@ export function UsersPage() { } const pushStatusBadge = (status?: string) => { - if (status === 'success') return 成功 - if (status === 'failed') return 失败 + const s = status || '' + if (s === 'success') + return 已推送(存客宝已接收) + if (s === 'pending_verify') + return 待通过 / 处理中 + if (s === 'expired') return 已过期 + if (s === 'failed') return 失败 + if (s === 'pending') + return 待推送 + if (s) + return ( + + {s} + + ) return 待推送 } @@ -1459,7 +1562,7 @@ export function UsersPage() { {!leadsLoading && (
    -

    总留资条数

    +

    线索总条数(含留资/加入/匹配)

    {leadsTotal}

    @@ -1509,7 +1612,7 @@ export function UsersPage() {
    setLeadsSearchTerm(e.target.value)} className="pl-9 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500" @@ -1527,6 +1630,37 @@ export function UsersPage() { ))} )} + + + ) + })()}
    {pushStatusBadge(r.pushStatus)} + {(typeof r.ckbCode === 'number' || (r.ckbMessage || '').trim()) && ( +

    + {[ + typeof r.ckbCode === 'number' ? `code=${r.ckbCode}` : '', + (r.ckbMessage || '').trim() ? String(r.ckbMessage).trim() : '', + ] + .filter(Boolean) + .join(' · ')} +

    + )} + {!!(r.ckbData || '').trim() && ( + + )} {!!r.ckbError && (

    {r.ckbError} @@ -1660,41 +1859,45 @@ export function UsersPage() { )}

    - -
    -

    {typeof r.retryCount === 'number' ? `第 ${r.retryCount} 次` : '-'}

    - - + {r.createdAt ? new Date(r.createdAt).toLocaleString() : '-'} + +
    +

    + {typeof r.retryCount === 'number' ? `第 ${r.retryCount} 次` : '-'} +

    +
    + + +
    - {r.createdAt ? new Date(r.createdAt).toLocaleString() : '-'} ))} {leadsRows.length === 0 && ( - +

    暂无获客线索

    @@ -1817,20 +2020,27 @@ export function UsersPage() {
    ) : Object.keys(journeyStats).length > 0 ? (
    - {JOURNEY_STAGES.map((stage) => { - const count = journeyStats[stage.id] || 0 - const maxCount = Math.max(...JOURNEY_STAGES.map(s => journeyStats[s.id] || 0), 1) - const pct = Math.round((count / maxCount) * 100) - return ( -
    - {stage.icon} {stage.label} -
    -
    + {(() => { + const totalAll = JOURNEY_STAGES.reduce((s, st) => s + (journeyStats[st.id] || 0), 0) + return JOURNEY_STAGES.map((stage) => { + const count = journeyStats[stage.id] || 0 + const pct = totalAll > 0 ? Math.round((count / totalAll) * 100) : 0 + const barW = count > 0 ? Math.max(pct, 6) : 0 + return ( +
    + {stage.icon} {stage.label} +
    +
    +
    + {count} + {totalAll > 0 ? `${pct}%` : '—'}
    - {count} -
    - ) - })} + ) + }) + })()}
    ) : (
    @@ -2408,6 +2618,43 @@ export function UsersPage() { setShowDetailModal(false)} userId={selectedUserIdForDetail} onUserUpdated={loadUsers} /> + + + + {ckbDataDialogTitle} + +
    +
    +              {ckbDataDialogContent || '—'}
    +            
    +
    + + + + +
    +
    ) } diff --git a/soul-api/internal/database/database.go b/soul-api/internal/database/database.go index e5b9fbde..ca1d933f 100644 --- a/soul-api/internal/database/database.go +++ b/soul-api/internal/database/database.go @@ -86,9 +86,6 @@ func Init(dsn string) error { if err := db.AutoMigrate(&model.AdminUser{}); err != nil { log.Printf("database: admin_users migrate warning: %v", err) } - if err := db.AutoMigrate(&model.CkbSubmitRecord{}); err != nil { - log.Printf("database: ckb_submit_records migrate warning: %v", err) - } if err := db.AutoMigrate(&model.CkbLeadRecord{}); err != nil { log.Printf("database: ckb_lead_records migrate warning: %v", err) } @@ -158,6 +155,36 @@ func ensureCkbLeadSchema(db *gorm.DB) { log.Printf("database: ckb_lead_records schema ensure warning: %v; action=add push_status", err) } } + if !m.HasColumn(&model.CkbLeadRecord{}, "action") { + if err := db.Exec("ALTER TABLE ckb_lead_records ADD COLUMN action VARCHAR(20) NOT NULL DEFAULT 'lead' COMMENT '记录类型: lead/join/match'").Error; err != nil { + log.Printf("database: ckb_lead_records schema ensure warning: %v; action=add action", err) + } + } + if !m.HasColumn(&model.CkbLeadRecord{}, "plan_api_key") { + if err := db.Exec("ALTER TABLE ckb_lead_records ADD COLUMN plan_api_key VARCHAR(100) NOT NULL DEFAULT '' COMMENT '本次命中的获客计划 apiKey 快照'").Error; err != nil { + log.Printf("database: ckb_lead_records schema ensure warning: %v; action=add plan_api_key", err) + } + } + if !m.HasIndex(&model.CkbLeadRecord{}, "idx_ckb_lead_action") { + if err := db.Exec("CREATE INDEX idx_ckb_lead_action ON ckb_lead_records(action)").Error; err != nil { + log.Printf("database: ckb_lead_records schema ensure warning: %v; action=create idx_ckb_lead_action", err) + } + } + if !m.HasColumn(&model.CkbLeadRecord{}, "ckb_code") { + if err := db.Exec("ALTER TABLE ckb_lead_records ADD COLUMN ckb_code INT NOT NULL DEFAULT 0 COMMENT '存客宝响应 code(快照)'").Error; err != nil { + log.Printf("database: ckb_lead_records schema ensure warning: %v; action=add ckb_code", err) + } + } + if !m.HasColumn(&model.CkbLeadRecord{}, "ckb_message") { + if err := db.Exec("ALTER TABLE ckb_lead_records ADD COLUMN ckb_message VARCHAR(500) NOT NULL DEFAULT '' COMMENT '存客宝响应 message(快照)'").Error; err != nil { + log.Printf("database: ckb_lead_records schema ensure warning: %v; action=add ckb_message", err) + } + } + if !m.HasColumn(&model.CkbLeadRecord{}, "ckb_data") { + if err := db.Exec("ALTER TABLE ckb_lead_records ADD COLUMN ckb_data TEXT NULL COMMENT '存客宝响应 data(快照 JSON)'").Error; err != nil { + log.Printf("database: ckb_lead_records schema ensure warning: %v; action=add ckb_data", err) + } + } if !m.HasColumn(&model.CkbLeadRecord{}, "retry_count") { if err := db.Exec("ALTER TABLE ckb_lead_records ADD COLUMN retry_count INT NOT NULL DEFAULT 0 COMMENT '重试次数'").Error; err != nil { log.Printf("database: ckb_lead_records schema ensure warning: %v; action=add retry_count", err) @@ -178,4 +205,8 @@ func ensureCkbLeadSchema(db *gorm.DB) { log.Printf("database: ckb_lead_records schema ensure warning: %v; action=create idx_ckb_lead_push_status", err) } } + // 放宽 push_status 长度以容纳存客宝细粒度状态(pending_verify、expired 等) + if err := db.Exec("ALTER TABLE ckb_lead_records MODIFY COLUMN push_status VARCHAR(64) NOT NULL DEFAULT 'pending' COMMENT '推送状态'").Error; err != nil { + log.Printf("database: ckb_lead_records schema ensure warning: %v; action=widen push_status", err) + } } diff --git a/soul-api/internal/handler/admin_dashboard.go b/soul-api/internal/handler/admin_dashboard.go index 49bf43c9..b6487dc8 100644 --- a/soul-api/internal/handler/admin_dashboard.go +++ b/soul-api/internal/handler/admin_dashboard.go @@ -398,11 +398,12 @@ func AdminDashboardLeads(c *gin.Context) { db := database.DB() var contactTotal, submitTotal, uniqueContactUsers int64 db.Model(&model.CkbLeadRecord{}).Count(&contactTotal) - db.Model(&model.CkbSubmitRecord{}).Count(&submitTotal) + // 统一到 ckb_lead_records:join/match 也在同表,用 action!=lead 视作“已提交线索” + db.Model(&model.CkbLeadRecord{}).Where("action IN ?", []string{"join", "match"}).Count(&submitTotal) db.Raw(`SELECT COUNT(DISTINCT user_id) FROM ckb_lead_records WHERE user_id IS NOT NULL AND user_id != ''`).Scan(&uniqueContactUsers) var todayContact, todaySubmit int64 db.Raw(`SELECT COUNT(*) FROM ckb_lead_records WHERE DATE(created_at) = CURDATE()`).Scan(&todayContact) - db.Raw(`SELECT COUNT(*) FROM ckb_submit_records WHERE DATE(created_at) = CURDATE()`).Scan(&todaySubmit) + db.Raw(`SELECT COUNT(*) FROM ckb_lead_records WHERE action IN ('join','match') AND DATE(created_at) = CURDATE()`).Scan(&todaySubmit) c.JSON(http.StatusOK, gin.H{ "success": true, "data": gin.H{ diff --git a/soul-api/internal/handler/ckb.go b/soul-api/internal/handler/ckb.go index 849d9835..e8c1db9c 100644 --- a/soul-api/internal/handler/ckb.go +++ b/soul-api/internal/handler/ckb.go @@ -34,15 +34,25 @@ const ckbAPIURL = "https://ckbapi.quwanzhi.com/v1/api/scenarios" var ckbSourceMap = map[string]string{"team": "团队招募", "investor": "资源对接", "mentor": "导师顾问", "partner": "创业合伙"} var ckbTagsMap = map[string]string{"team": "切片团队,团队招募", "investor": "资源对接,资源群", "mentor": "导师顾问,咨询服务", "partner": "创业合伙,创业伙伴"} -// ckbSubmitSave 加好友/留资类接口统一落库:记录 action、userId、昵称、用户提交的传参,写入 ckb_submit_records -func ckbSubmitSave(action, userID, nickname string, params interface{}) { +// ckbLeadSaveUnified 将 join/match 等也落到 ckb_lead_records(与 lead 同表),用于后台统一查看推送状态与存客宝响应快照 +func ckbLeadSaveUnified(action, userID, nickname, phone, wechatId, source, planAPIKey string, params interface{}) int64 { paramsJSON, _ := json.Marshal(params) - _ = database.DB().Create(&model.CkbSubmitRecord{ - Action: action, - UserID: userID, - Nickname: nickname, - Params: string(paramsJSON), - }).Error + rec := model.CkbLeadRecord{ + Action: strings.TrimSpace(action), + UserID: strings.TrimSpace(userID), + Nickname: strings.TrimSpace(nickname), + Phone: strings.TrimSpace(phone), + WechatID: strings.TrimSpace(wechatId), + Source: strings.TrimSpace(source), + PlanAPIKey: strings.TrimSpace(planAPIKey), + Params: string(paramsJSON), + PushStatus: "pending", + } + if rec.Action == "" { + rec.Action = "lead" + } + _ = database.DB().Create(&rec).Error + return rec.ID } // ckbSign 与 next-project app/api/ckb/join 一致:排除 sign/apiKey/portrait,空值跳过,按键升序拼接值,MD5(拼接串) 再 MD5(结果+apiKey) @@ -114,17 +124,114 @@ func getCkbLeadApiKey() string { return ckbAPIKey } -func markLeadPushSuccess(db *gorm.DB, recordID int64) { +// inferCkbLeadPushStatusFromText 根据存客宝返回文案推断细粒度状态(与后台「获客列表」展示对齐) +func inferCkbLeadPushStatusFromText(msg string) string { + m := strings.TrimSpace(msg) + if m == "" { + return "" + } + ml := strings.ToLower(m) + if strings.Contains(m, "过期") || strings.Contains(ml, "expired") { + return "expired" + } + if (strings.Contains(m, "待") && (strings.Contains(m, "通过") || strings.Contains(m, "验证") || strings.Contains(m, "审核"))) || + strings.Contains(ml, "pending") || strings.Contains(ml, "queue") { + return "pending_verify" + } + return "" +} + +func normalizeCkbDataPushStatus(v string) string { + s := strings.TrimSpace(strings.ToLower(v)) + switch s { + case "success", "ok", "done", "sent": + return "success" + case "pending", "waiting", "processing", "queued": + return "pending_verify" + case "expired", "invalid": + return "expired" + case "failed", "fail": + return "failed" + default: + return "" + } +} + +// applyCkbLeadPushOutcome 根据存客宝 HTTP 返回更新推送状态(success / pending_verify / expired / failed 等) +func applyCkbLeadPushOutcome(db *gorm.DB, recordID int64, code int, message string, data interface{}) { if db == nil || recordID <= 0 { return } + msg := strings.TrimSpace(message) + dataJSON := "" + if data != nil { + if b, err := json.Marshal(data); err == nil { + dataJSON = strings.TrimSpace(string(b)) + } + } + if code == 200 { + status := "success" + if dm, ok := data.(map[string]interface{}); ok { + for _, key := range []string{"pushStatus", "push_status", "status", "leadStatus", "state"} { + if raw, ok := dm[key].(string); ok { + if n := normalizeCkbDataPushStatus(raw); n != "" { + status = n + break + } + } + } + } + if status == "success" { + if t := inferCkbLeadPushStatusFromText(msg); t != "" { + status = t + } + } + now := time.Now() + _ = db.Model(&model.CkbLeadRecord{}).Where("id = ?", recordID).Updates(map[string]interface{}{ + "push_status": status, + "ckb_code": code, + "ckb_message": msg, + "ckb_data": dataJSON, + "ckb_error": "", + "last_push_at": now, + "next_retry_at": nil, + }).Error + return + } + if code == 201 || code == 202 { + st := "pending_verify" + if t := inferCkbLeadPushStatusFromText(msg); t != "" { + st = t + } + now := time.Now() + _ = db.Model(&model.CkbLeadRecord{}).Where("id = ?", recordID).Updates(map[string]interface{}{ + "push_status": st, + "ckb_code": code, + "ckb_message": msg, + "ckb_data": dataJSON, + "ckb_error": msg, + "last_push_at": now, + "next_retry_at": nil, + }).Error + return + } + errMsg := msg + if errMsg == "" { + errMsg = fmt.Sprintf("存客宝返回 code=%d", code) + } + // code!=200:落库响应快照 + 标记失败 now := time.Now() - _ = db.Model(&model.CkbLeadRecord{}).Where("id = ?", recordID).Updates(map[string]interface{}{ - "push_status": "success", - "ckb_error": "", + updates := map[string]interface{}{ + "push_status": "failed", + "ckb_code": code, + "ckb_message": msg, + "ckb_data": dataJSON, + "ckb_error": strings.TrimSpace(errMsg), "last_push_at": now, - "next_retry_at": nil, - }).Error + "next_retry_at": now.Add(5 * time.Minute), + "retry_count": gorm.Expr("retry_count + 1"), + } + _ = db.Model(&model.CkbLeadRecord{}).Where("id = ?", recordID).Updates(updates).Error } func markLeadPushFailed(db *gorm.DB, recordID int64, errMsg string, incRetry bool) { @@ -134,6 +241,9 @@ func markLeadPushFailed(db *gorm.DB, recordID int64, errMsg string, incRetry boo now := time.Now() updates := map[string]interface{}{ "push_status": "failed", + "ckb_code": 0, + "ckb_message": "", + "ckb_data": "", "ckb_error": strings.TrimSpace(errMsg), "last_push_at": now, "next_retry_at": now.Add(5 * time.Minute), @@ -216,6 +326,38 @@ func resolvePersonForLead(db *gorm.DB, targetUserID string) (model.Person, bool) return model.Person{}, false } +// existsUnifiedLeadRecent join/match 幂等去重:同用户+动作+来源+联系方式在窗口期内仅保留一条,避免重复点击刷数据 +func existsUnifiedLeadRecent(db *gorm.DB, action, userID, source, phone, wechatID string, within time.Duration) bool { + if db == nil { + return false + } + action = strings.TrimSpace(action) + userID = strings.TrimSpace(userID) + source = strings.TrimSpace(source) + phone = strings.TrimSpace(phone) + wechatID = strings.TrimSpace(wechatID) + if action == "" || userID == "" { + return false + } + if phone == "" && wechatID == "" { + return false + } + q := db.Model(&model.CkbLeadRecord{}). + Where("action = ? AND user_id = ? AND source = ?", action, userID, source) + if phone != "" { + q = q.Where("phone = ?", phone) + } + if wechatID != "" { + q = q.Where("wechat_id = ?", wechatID) + } + if within > 0 { + q = q.Where("created_at >= ?", time.Now().Add(-within)) + } + var n int64 + q.Count(&n) + return n > 0 +} + func retryOneLeadRecord(ctx context.Context, db *gorm.DB, r model.CkbLeadRecord) bool { select { case <-ctx.Done(): @@ -248,7 +390,10 @@ func retryOneLeadRecord(ctx context.Context, db *gorm.DB, r model.CkbLeadRecord) wechatId = strings.TrimSpace(v) } } - leadKey := getCkbLeadApiKey() + leadKey := strings.TrimSpace(r.PlanAPIKey) + if leadKey == "" { + leadKey = getCkbLeadApiKey() + } targetName := "" targetMemberID := "" targetMemberName := "" @@ -282,7 +427,7 @@ func retryOneLeadRecord(ctx context.Context, db *gorm.DB, r model.CkbLeadRecord) return false } if res.Code == 200 { - markLeadPushSuccess(db, r.ID) + applyCkbLeadPushOutcome(db, r.ID, res.Code, res.Message, nil) go sendLeadWebhook(db, leadWebhookPayload{ LeadName: name, Phone: phone, @@ -366,10 +511,10 @@ func CKBJoin(c *gin.Context) { } if body.Type == "investor" && body.UserID != "" { if !userHasContentPurchase(database.DB(), body.UserID) { + // 交互原则:用户侧友好提示(不暴露存客宝/规则细节);后台可通过规则引导再完善 c.JSON(http.StatusOK, gin.H{ - "success": false, - "message": "请先购买章节或解锁全书后再使用资源对接", - "errorCode": "ERR_REQUIRE_PURCHASE", + "success": true, + "message": "提交成功,我们会尽快联系您", }) return } @@ -384,10 +529,18 @@ func CKBJoin(c *gin.Context) { if nickname == "" { nickname = "-" } - ckbSubmitSave("join", body.UserID, nickname, map[string]interface{}{ + submitParams := map[string]interface{}{ "type": body.Type, "phone": body.Phone, "wechat": body.Wechat, "name": body.Name, "userId": body.UserID, "remark": body.Remark, "canHelp": body.CanHelp, "needHelp": body.NeedHelp, - }) + } + joinSource := "join_" + body.Type + // 幂等:同用户在短时间内重复点击同类加入,不再重复落库 + if existsUnifiedLeadRecent(database.DB(), "join", body.UserID, joinSource, body.Phone, body.Wechat, 10*time.Minute) { + c.JSON(http.StatusOK, gin.H{"success": true, "message": "提交成功,我们会尽快联系您", "data": gin.H{"repeatedSubmit": true}}) + return + } + // 同步写入统一线索表(便于后台统一推送状态/响应快照) + leadID := ckbLeadSaveUnified("join", body.UserID, nickname, body.Phone, body.Wechat, joinSource, ckbAPIKey, submitParams) ts := time.Now().Unix() params := map[string]interface{}{ "timestamp": ts, @@ -435,7 +588,9 @@ func CKBJoin(c *gin.Context) { raw, _ := json.Marshal(params) resp, err := http.Post(ckbAPIURL, "application/json", bytes.NewReader(raw)) if err != nil { - c.JSON(http.StatusInternalServerError, gin.H{"success": false, "message": "服务器错误,请稍后重试"}) + // 用户侧保持友好:无论存客宝是否响应,都提示提交成功;后台用 push_status/ckb_error 追踪 + markLeadPushFailed(database.DB(), leadID, err.Error(), true) + c.JSON(http.StatusOK, gin.H{"success": true, "message": "提交成功,我们会尽快联系您"}) return } defer resp.Body.Close() @@ -447,6 +602,7 @@ func CKBJoin(c *gin.Context) { } _ = json.Unmarshal(b, &result) if result.Code == 200 { + applyCkbLeadPushOutcome(database.DB(), leadID, result.Code, result.Message, result.Data) // 资源对接:同步更新用户资料中的 help_offer、help_need、phone、wechat_id if body.Type == "investor" && body.UserID != "" { updates := map[string]interface{}{} @@ -477,10 +633,12 @@ func CKBJoin(c *gin.Context) { if errMsg == "" { errMsg = "加入失败,请稍后重试" } + applyCkbLeadPushOutcome(database.DB(), leadID, result.Code, result.Message, result.Data) // 打印 CKB 原始响应便于排查 fmt.Printf("[CKBJoin] 失败 type=%s wechat=%s code=%d message=%s raw=%s\n", body.Type, body.Wechat, result.Code, result.Message, string(b)) - c.JSON(http.StatusOK, gin.H{"success": false, "message": errMsg}) + // 用户侧仍提示提交成功 + c.JSON(http.StatusOK, gin.H{"success": true, "message": "提交成功,我们会尽快联系您"}) } // CKBMatch POST /api/ckb/match @@ -502,10 +660,16 @@ func CKBMatch(c *gin.Context) { if nickname == "" { nickname = "-" } - ckbSubmitSave("match", body.UserID, nickname, map[string]interface{}{ + submitParams := map[string]interface{}{ "matchType": body.MatchType, "phone": body.Phone, "wechat": body.Wechat, "userId": body.UserID, "nickname": body.Nickname, "matchedUser": body.MatchedUser, - }) + } + matchSource := "match_" + body.MatchType + if existsUnifiedLeadRecent(database.DB(), "match", body.UserID, matchSource, body.Phone, body.Wechat, 5*time.Minute) { + c.JSON(http.StatusOK, gin.H{"success": true, "message": "提交成功", "data": gin.H{"repeatedSubmit": true}}) + return + } + leadID := ckbLeadSaveUnified("match", body.UserID, nickname, body.Phone, body.Wechat, matchSource, ckbAPIKey, submitParams) ts := time.Now().Unix() label := ckbSourceMap[body.MatchType] if label == "" { @@ -542,7 +706,8 @@ func CKBMatch(c *gin.Context) { resp, err := http.Post(ckbAPIURL, "application/json", bytes.NewReader(raw)) if err != nil { fmt.Printf("[CKBMatch] 请求存客宝失败: %v\n", err) - c.JSON(http.StatusOK, gin.H{"success": false, "message": "网络异常,请稍后重试"}) + markLeadPushFailed(database.DB(), leadID, err.Error(), true) + c.JSON(http.StatusOK, gin.H{"success": true, "message": "提交成功"}) return } defer resp.Body.Close() @@ -553,11 +718,13 @@ func CKBMatch(c *gin.Context) { } _ = json.Unmarshal(b, &result) if result.Code == 200 { - c.JSON(http.StatusOK, gin.H{"success": true, "message": "匹配记录已上报", "data": nil}) + applyCkbLeadPushOutcome(database.DB(), leadID, result.Code, result.Message, nil) + c.JSON(http.StatusOK, gin.H{"success": true, "message": "提交成功", "data": nil}) return } + applyCkbLeadPushOutcome(database.DB(), leadID, result.Code, result.Message, nil) fmt.Printf("[CKBMatch] 存客宝返回异常 code=%d message=%s\n", result.Code, result.Message) - c.JSON(http.StatusOK, gin.H{"success": true, "message": "匹配成功"}) + c.JSON(http.StatusOK, gin.H{"success": true, "message": "提交成功"}) } // CKBSync GET/POST /api/ckb/sync @@ -616,15 +783,22 @@ func CKBIndexLead(c *gin.Context) { "source": source, }) rec := model.CkbLeadRecord{ + Action: "lead", UserID: body.UserID, Nickname: name, Phone: phone, WechatID: wechatId, Name: strings.TrimSpace(body.Name), Source: source, + PlanAPIKey: leadKey, Params: string(paramsJSON), PushStatus: "pending", } + // 与全局 leadKey 绑定的 Person(首页「链接卡若」),写入 target_person_id 便于后台「对应 @人」展示 + var bindPerson model.Person + if db.Where("ckb_api_key = ? AND ckb_api_key != ''", leadKey).First(&bindPerson).Error == nil && strings.TrimSpace(bindPerson.PersonID) != "" { + rec.TargetPersonID = bindPerson.PersonID + } _ = db.Create(&rec).Error ts := time.Now().Unix() @@ -659,7 +833,7 @@ func CKBIndexLead(c *gin.Context) { } _ = json.Unmarshal(b, &result) if result.Code == 200 { - markLeadPushSuccess(db, rec.ID) + applyCkbLeadPushOutcome(db, rec.ID, result.Code, result.Message, result.Data) var msg string var defaultPerson model.Person if db.Where("ckb_api_key = ? AND ckb_api_key != ''", leadKey).First(&defaultPerson).Error == nil && strings.TrimSpace(defaultPerson.Tips) != "" { @@ -805,6 +979,7 @@ func CKBLead(c *gin.Context) { "targetMemberName": strings.TrimSpace(body.TargetMemberName), "source": source, }) rec := model.CkbLeadRecord{ + Action: "lead", UserID: body.UserID, Nickname: name, Phone: phone, @@ -812,6 +987,7 @@ func CKBLead(c *gin.Context) { Name: strings.TrimSpace(body.Name), TargetPersonID: body.TargetUserID, Source: source, + PlanAPIKey: leadKey, Params: string(paramsJSON), PushStatus: "pending", } @@ -860,7 +1036,7 @@ func CKBLead(c *gin.Context) { } _ = json.Unmarshal(b, &result) if result.Code == 200 { - markLeadPushSuccess(db, rec.ID) + applyCkbLeadPushOutcome(db, rec.ID, result.Code, result.Message, result.Data) who := targetName if who == "" { who = "对方" @@ -941,6 +1117,8 @@ func CKBLead(c *gin.Context) { } _ = json.Unmarshal(rb, &rr) if rr.Code == 200 { + _ = db.Model(&model.CkbLeadRecord{}).Where("id = ?", rec.ID).Update("plan_api_key", globalKey).Error + applyCkbLeadPushOutcome(db, rec.ID, rr.Code, rr.Message, rr.Data) who := targetName if who == "" { who = "对方" @@ -962,7 +1140,6 @@ func CKBLead(c *gin.Context) { Repeated: false, LeadUserID: body.UserID, }) - markLeadPushSuccess(db, rec.ID) c.JSON(http.StatusOK, gin.H{"success": true, "message": msg}) return } diff --git a/soul-api/internal/handler/db.go b/soul-api/internal/handler/db.go index 46cebd3c..6c102118 100644 --- a/soul-api/internal/handler/db.go +++ b/soul-api/internal/handler/db.go @@ -147,6 +147,8 @@ func defaultMpUi() gin.H { "homePage": gin.H{ "logoTitle": "卡若创业派对", "logoSubtitle": "来自派对房的真实故事", "linkKaruoText": "点击链接卡若", "linkKaruoAvatar": "", + "pinnedTitlePrefix": "派对会员", + "pinnedMainTitleTemplate": "", "searchPlaceholder": "搜索章节标题或内容...", "bannerTag": "推荐", "bannerReadMoreText": "点击阅读", "superSectionTitle": "超级个体", "superSectionLinkText": "获客入口", @@ -161,6 +163,15 @@ func defaultMpUi() gin.H { "readStatPath": "/pages/reading-records/reading-records?focus=all", "recentReadPath": "/pages/reading-records/reading-records?focus=recent", }, + "memberDetailPage": gin.H{ + "unlockIntroTitle": "解锁与链接说明", + "unlockIntroBody": "「链接」用于提交留资,由对方通过获客计划跟进;「解锁」用于复制手机/微信号后自行添加好友。请先阅读说明,确认后再登录。", + }, + "readPage": gin.H{ + "beforeLoginHint": "试读进度与下方百分比以后台配置为准;登录后可购买解锁全文。", + "singlePageTitle": "解锁全文", + "singlePagePaywallHint": "当前为朋友圈单页预览,无法在此登录或付款。请点击底部「前往小程序」进入完整版后再解锁本章。", + }, } } diff --git a/soul-api/internal/handler/db_ckb_leads.go b/soul-api/internal/handler/db_ckb_leads.go index c9ac9900..e673cd27 100644 --- a/soul-api/internal/handler/db_ckb_leads.go +++ b/soul-api/internal/handler/db_ckb_leads.go @@ -13,7 +13,7 @@ import ( ) // DBCKBLeadList GET /api/db/ckb-leads 管理端-CKB线索明细 -// mode=submitted: ckb_submit_records(join/match 提交) +// mode=submitted: ckb_lead_records(action=join/match,兼容旧面板命名) // mode=contact: ckb_lead_records(链接卡若留资,有 phone/wechat) func DBCKBLeadList(c *gin.Context) { db := database.DB() @@ -31,6 +31,7 @@ func DBCKBLeadList(c *gin.Context) { if mode == "contact" { search := c.Query("search") source := c.Query("source") + action := strings.TrimSpace(c.Query("action")) pushStatus := strings.TrimSpace(c.Query("pushStatus")) q := db.Model(&model.CkbLeadRecord{}) if search != "" { @@ -40,6 +41,9 @@ func DBCKBLeadList(c *gin.Context) { if source != "" { q = q.Where("source = ?", source) } + if action != "" { + q = q.Where("action = ?", action) + } if pushStatus != "" { q = q.Where("push_status = ?", pushStatus) } @@ -85,13 +89,34 @@ func DBCKBLeadList(c *gin.Context) { userMap[urows[i].ID] = &urows[i] } } + // 首页 index_link_button 历史数据可能未写 target_person_id:用全局 leadKey 对应 Person 回退展示 + var indexLinkFallback *model.Person + leadKey := getCkbLeadApiKey() + if leadKey != "" { + var fp model.Person + if db.Where("ckb_api_key = ? AND ckb_api_key != ''", leadKey).First(&fp).Error == nil { + indexLinkFallback = &fp + } + } out := make([]gin.H, 0, len(records)) for _, r := range records { + // 兜底:历史数据 plan_api_key 可能为空(已迁移但仍有漏网),按 action 回填展示,不改库 + planKey := strings.TrimSpace(r.PlanAPIKey) + if planKey == "" { + if strings.TrimSpace(r.Action) == "join" || strings.TrimSpace(r.Action) == "match" { + planKey = ckbAPIKey + } else if strings.TrimSpace(r.Action) == "lead" && r.Source == "index_link_button" { + planKey = getCkbLeadApiKey() + } + } personName := "" ckbPlanId := int64(0) if p := personMap[r.TargetPersonID]; p != nil { personName = p.Name ckbPlanId = p.CkbPlanID + } else if strings.TrimSpace(r.TargetPersonID) == "" && r.Source == "index_link_button" && indexLinkFallback != nil { + personName = indexLinkFallback.Name + ckbPlanId = indexLinkFallback.CkbPlanID } displayNick := r.Nickname userAvatar := "" @@ -103,6 +128,7 @@ func DBCKBLeadList(c *gin.Context) { } out = append(out, gin.H{ "id": r.ID, + "action": r.Action, "userId": r.UserID, "userNickname": displayNick, "userAvatar": userAvatar, @@ -111,11 +137,15 @@ func DBCKBLeadList(c *gin.Context) { "wechatId": r.WechatID, "name": r.Name, "source": r.Source, + "planApiKey": planKey, "targetPersonId": r.TargetPersonID, "personName": personName, "ckbPlanId": ckbPlanId, "pushStatus": r.PushStatus, "retryCount": r.RetryCount, + "ckbCode": r.CkbCode, + "ckbMessage": r.CkbMessage, + "ckbData": r.CkbData, "ckbError": r.CkbError, "lastPushAt": r.LastPushAt, "nextRetryAt": r.NextRetryAt, @@ -142,18 +172,16 @@ func DBCKBLeadList(c *gin.Context) { return } - // mode=submitted: ckb_submit_records - q := db.Model(&model.CkbSubmitRecord{}) + // mode=submitted: 兼容旧面板,统一从 ckb_lead_records 中读取 join/match + q := db.Model(&model.CkbLeadRecord{}).Where("action IN ?", []string{"join", "match"}) if matchType != "" { - // matchType 对应 action: join 时 type 在 params 中,match 时 matchType 在 params 中 - // 简化:仅按 action 过滤,join 时 params 含 type if matchType == "join" || matchType == "match" { q = q.Where("action = ?", matchType) } } var total int64 q.Count(&total) - var records []model.CkbSubmitRecord + var records []model.CkbLeadRecord if err := q.Order("created_at DESC").Offset((page - 1) * pageSize).Limit(pageSize).Find(&records).Error; err != nil { c.JSON(http.StatusOK, gin.H{"success": false, "error": err.Error()}) return @@ -228,6 +256,9 @@ func DBCKBLeadRetry(c *gin.Context) { "id": r.ID, "pushStatus": r.PushStatus, "retryCount": r.RetryCount, + "ckbCode": r.CkbCode, + "ckbMessage": r.CkbMessage, + "ckbData": r.CkbData, "ckbError": r.CkbError, "lastPushAt": r.LastPushAt, "nextRetryAt": r.NextRetryAt, @@ -301,7 +332,7 @@ func DBCKBLeadDeleteBatch(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"success": true, "deleted": res.RowsAffected}) } -// CKBPlanStats GET /api/db/ckb-plan-stats 存客宝获客计划统计(基于 ckb_submit_records + ckb_lead_records) +// CKBPlanStats GET /api/db/ckb-plan-stats 存客宝获客计划统计(统一基于 ckb_lead_records) func CKBPlanStats(c *gin.Context) { db := database.DB() type TypeStat struct { @@ -309,12 +340,12 @@ func CKBPlanStats(c *gin.Context) { Total int64 `gorm:"column:total" json:"total"` } var submitStats []TypeStat - db.Raw("SELECT action, COUNT(*) as total FROM ckb_submit_records GROUP BY action").Scan(&submitStats) + db.Raw("SELECT action, COUNT(*) as total FROM ckb_lead_records WHERE action IN ('join','match') GROUP BY action").Scan(&submitStats) var submitTotal int64 - db.Model(&model.CkbSubmitRecord{}).Count(&submitTotal) + db.Model(&model.CkbLeadRecord{}).Where("action IN ?", []string{"join", "match"}).Count(&submitTotal) var leadTotal int64 - db.Model(&model.CkbLeadRecord{}).Count(&leadTotal) - withContact := leadTotal // ckb_lead_records 均有 phone 或 wechat + db.Model(&model.CkbLeadRecord{}).Where("action = ?", "lead").Count(&leadTotal) + withContact := leadTotal // lead 记录均有 phone 或 wechat c.JSON(http.StatusOK, gin.H{ "success": true, "data": gin.H{ diff --git a/soul-api/internal/handler/mentor.go b/soul-api/internal/handler/mentor.go index 8eb7e1b9..bbe2939f 100644 --- a/soul-api/internal/handler/mentor.go +++ b/soul-api/internal/handler/mentor.go @@ -76,24 +76,25 @@ func MiniprogramMentorsDetail(c *gin.Context) { } } } - c.JSON(http.StatusOK, gin.H{ - "success": true, - "data": gin.H{ - "id": m.ID, - "avatar": resolveAvatarURL(m.Avatar), - "name": m.Name, - "intro": m.Intro, - "tags": m.Tags, - "tagsArr": tagsArr, - "priceSingle": m.PriceSingle, - "priceHalfYear": m.PriceHalfYear, - "priceYear": m.PriceYear, - "quote": m.Quote, - "whyFind": m.WhyFind, - "offering": m.Offering, - "judgmentStyle": m.JudgmentStyle, - }, - }) + out := gin.H{ + "id": m.ID, + "avatar": resolveAvatarURL(m.Avatar), + "name": m.Name, + "intro": m.Intro, + "tags": m.Tags, + "tagsArr": tagsArr, + "priceSingle": m.PriceSingle, + "priceHalfYear": m.PriceHalfYear, + "priceYear": m.PriceYear, + "quote": m.Quote, + "whyFind": m.WhyFind, + "offering": m.Offering, + "judgmentStyle": m.JudgmentStyle, + } + if m.UserID != nil && strings.TrimSpace(*m.UserID) != "" { + out["userId"] = strings.TrimSpace(*m.UserID) + } + c.JSON(http.StatusOK, gin.H{"success": true, "data": out}) } // MiniprogramMentorsBook POST /api/miniprogram/mentors/:id/book 创建预约(选择咨询类型后创建,后续走支付) @@ -200,6 +201,7 @@ func DBMentorsAction(c *gin.Context) { JudgmentStyle string `json:"judgmentStyle"` Sort int `json:"sort"` Enabled *bool `json:"enabled"` + UserID string `json:"userId"` } if err := c.ShouldBindJSON(&body); err != nil { c.JSON(http.StatusOK, gin.H{"success": false, "error": "name 不能为空"}) @@ -220,6 +222,9 @@ func DBMentorsAction(c *gin.Context) { Sort: body.Sort, Enabled: body.Enabled, } + if uid := strings.TrimSpace(body.UserID); uid != "" { + m.UserID = &uid + } if m.Enabled == nil { trueVal := true m.Enabled = &trueVal @@ -248,6 +253,7 @@ func DBMentorsAction(c *gin.Context) { JudgmentStyle *string `json:"judgmentStyle"` Sort *int `json:"sort"` Enabled *bool `json:"enabled"` + UserID *string `json:"userId"` } if err := c.ShouldBindJSON(&body); err != nil { c.JSON(http.StatusOK, gin.H{"success": false, "error": "id 不能为空"}) @@ -293,6 +299,14 @@ func DBMentorsAction(c *gin.Context) { if body.Enabled != nil { updates["enabled"] = *body.Enabled } + if body.UserID != nil { + uid := strings.TrimSpace(*body.UserID) + if uid == "" { + updates["user_id"] = nil + } else { + updates["user_id"] = uid + } + } if len(updates) == 0 { c.JSON(http.StatusOK, gin.H{"success": true, "message": "无更新"}) return diff --git a/soul-api/internal/model/ckb_lead.go b/soul-api/internal/model/ckb_lead.go index ef2b9355..2f606adf 100644 --- a/soul-api/internal/model/ckb_lead.go +++ b/soul-api/internal/model/ckb_lead.go @@ -5,18 +5,24 @@ import "time" // CkbLeadRecord 链接卡若留资记录(独立表,便于后续链接其他用户等扩展) type CkbLeadRecord struct { ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"` + Action string `gorm:"column:action;size:20;not null;default:'lead';index" json:"action"` // lead | join | match UserID string `gorm:"column:user_id;size:50;index" json:"userId"` Nickname string `gorm:"column:nickname;size:100" json:"nickname"` Phone string `gorm:"column:phone;size:20" json:"phone"` WechatID string `gorm:"column:wechat_id;size:100" json:"wechatId"` Name string `gorm:"column:name;size:100" json:"name"` // 用户填的姓名/昵称 TargetPersonID string `gorm:"column:target_person_id;size:100" json:"targetPersonId"` // 被@的人物 personId - Source string `gorm:"column:source;size:50" json:"source"` // 来源:index_lead / article_mention + Source string `gorm:"column:source;size:50" json:"source"` // 来源:index_link_button / article_mention / join_team / match_partner ... + PlanAPIKey string `gorm:"column:plan_api_key;size:100;default:''" json:"planApiKey"` // 本次命中的获客计划 apiKey 快照 Params string `gorm:"column:params;type:json" json:"params"` // 完整传参 JSON - PushStatus string `gorm:"column:push_status;size:20;default:'pending';index" json:"pushStatus"` // pending/success/failed + PushStatus string `gorm:"column:push_status;size:64;default:'pending';index" json:"pushStatus"` // pending/success/failed/pending_verify/expired 等 RetryCount int `gorm:"column:retry_count;default:0" json:"retryCount"` LastPushAt *time.Time `gorm:"column:last_push_at" json:"lastPushAt,omitempty"` NextRetryAt *time.Time `gorm:"column:next_retry_at" json:"nextRetryAt,omitempty"` + // 存客宝响应快照:用于后台展示排障(不依赖「推断状态」) + CkbCode int `gorm:"column:ckb_code;default:0" json:"ckbCode"` + CkbMessage string `gorm:"column:ckb_message;size:500;default:''" json:"ckbMessage"` + CkbData string `gorm:"column:ckb_data;type:text" json:"ckbData"` CkbError string `gorm:"column:ckb_error;size:500" json:"ckbError"` // 存客宝请求失败时写入错误信息,便于运营排查 CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"` } diff --git a/soul-api/internal/model/mentor.go b/soul-api/internal/model/mentor.go index c85f3db0..ac3c4a93 100644 --- a/soul-api/internal/model/mentor.go +++ b/soul-api/internal/model/mentor.go @@ -18,6 +18,8 @@ type Mentor struct { JudgmentStyle string `gorm:"column:judgment_style;size:500" json:"judgmentStyle"` // 判断风格,逗号分隔 Sort int `gorm:"column:sort;default:0" json:"sort"` Enabled *bool `gorm:"column:enabled;default:1" json:"enabled"` + // UserID 绑定小程序用户 id,与超级个体名片同一路径(member-detail?id=) + UserID *string `gorm:"column:user_id;size:36;index" json:"userId,omitempty"` CreatedAt time.Time `gorm:"column:created_at" json:"createdAt"` UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"` }