diff --git a/miniprogram/app.js b/miniprogram/app.js index 6fcdd7dc..aa854e05 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -118,7 +118,7 @@ App({ const pages = getCurrentPages() const cur = pages[pages.length - 1] const route = (cur && cur.route) || '' - const needPrivacyPages = ['avatar-nickname', 'profile-edit', 'read', 'my', 'gift-pay/detail', 'index', 'settings'] + const needPrivacyPages = ['avatar-nickname', 'profile-edit', 'read', 'my', 'gift-pay/detail', 'settings'] const needShow = needPrivacyPages.some(p => route.includes(p)) if (cur && typeof cur.setData === 'function' && needShow) { cur.setData({ showPrivacyModal: true }) diff --git a/miniprogram/pages/index/index.js b/miniprogram/pages/index/index.js index 1dc4723e..02d8d3dd 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -9,9 +9,10 @@ const { trackClick } = require('../../utils/trackClick') const { cleanSingleLineField } = require('../../utils/contentParser') const { navigateMpPath } = require('../../utils/mpNavigate.js') const { isSafeImageSrc } = require('../../utils/imageUrl.js') +const { submitCkbLead } = require('../../utils/soulBridge') +/** 置顶人物无头像时的占位图 */ const DEFAULT_KARUO_LINK_AVATAR = '/assets/images/karuo-link-avatar.png' -const KARUO_USER_ID = 'ogpTW5Wbbo9DfSyB3-xCWN6EGc-g' /** 与首页固定「卡若」获客位重复时从横滑列表剔除(含历史误写「卡路」) */ function isKaruoHostDuplicateName(displayName) { @@ -72,11 +73,6 @@ Page({ // 加载状态 loading: true, - // 链接卡若 - 留资弹窗 - showLeadModal: false, - leadPhone: '', - showPrivacyModal: false, - // 展开状态(首页精选/最新) featuredExpanded: false, latestExpanded: false, @@ -91,15 +87,18 @@ Page({ // mp_config.mpUi.homePage(后台系统设置 mpUi) mpUiLogoTitle: '卡若创业派对', mpUiLogoSubtitle: '来自派对房的真实故事', - mpUiLinkKaruoText: '点击链接卡若', - /** 最终展示:后台 linkKaruoAvatar 或本包默认卡若照片 */ + /** 仅当有置顶 @人物时展示,文案与头像由 _applyHomeMpUi 写入 */ + mpUiLinkKaruoText: '', mpUiLinkKaruoDisplay: DEFAULT_KARUO_LINK_AVATAR, mpUiSearchPlaceholder: '搜索章节标题或内容...', mpUiBannerTag: '推荐', mpUiBannerReadMore: '点击阅读', mpUiSuperTitle: '超级个体', mpUiPickTitle: '精选推荐', - mpUiLatestTitle: '最新新增' + mpUiLatestTitle: '最新新增', + + /** 后台 @列表置顶人物:有则右上角展示绑定用户头像 + @名称,点击走 ckb/lead */ + homePinnedPerson: null, }, onLoad(options) { @@ -125,7 +124,7 @@ Page({ onShow() { console.log('[Index] onShow 触发') this.setData({ auditMode: app.globalData.auditMode || false }) - this._applyHomeMpUi() + void this.loadHomePinnedPerson() // 设置TabBar选中状态 if (typeof this.getTabBar === 'function' && this.getTabBar()) { @@ -322,31 +321,52 @@ Page({ _applyHomeMpUi() { const h = app.globalData.configCache?.mpConfig?.mpUi?.homePage || {} - let linkKaruoAvatar = String(h.linkKaruoAvatar || h.linkKaruoImage || '').trim() - if (linkKaruoAvatar && !isSafeImageSrc(linkKaruoAvatar)) linkKaruoAvatar = '' - this.setData({ + const patch = { mpUiLogoTitle: String(h.logoTitle || '卡若创业派对').trim() || '卡若创业派对', mpUiLogoSubtitle: String(h.logoSubtitle || '来自派对房的真实故事').trim() || '来自派对房的真实故事', - mpUiLinkKaruoText: String(h.linkKaruoText || '点击链接卡若').trim() || '点击链接卡若', - mpUiLinkKaruoDisplay: linkKaruoAvatar || DEFAULT_KARUO_LINK_AVATAR, mpUiSearchPlaceholder: String(h.searchPlaceholder || '搜索章节标题或内容...').trim() || '搜索章节标题或内容...', mpUiBannerTag: String(h.bannerTag || '推荐').trim() || '推荐', mpUiBannerReadMore: String(h.bannerReadMoreText || '点击阅读').trim() || '点击阅读', mpUiSuperTitle: String(h.superSectionTitle || '超级个体').trim() || '超级个体', mpUiPickTitle: String(h.pickSectionTitle || '精选推荐').trim() || '精选推荐', - mpUiLatestTitle: String(h.latestSectionTitle || '最新新增').trim() || '最新新增' - }) - if (!linkKaruoAvatar) this._loadKaruoAvatarLazy() + mpUiLatestTitle: String(h.latestSectionTitle || '最新新增').trim() || '最新新增', + } + const pinned = this.data.homePinnedPerson + if (pinned && pinned.token) { + const displayAv = + pinned.avatar && isSafeImageSrc(pinned.avatar) ? pinned.avatar : DEFAULT_KARUO_LINK_AVATAR + patch.mpUiLinkKaruoText = `点击链接${pinned.name || '好友'}` + patch.mpUiLinkKaruoDisplay = displayAv + } else { + patch.mpUiLinkKaruoText = '' + patch.mpUiLinkKaruoDisplay = DEFAULT_KARUO_LINK_AVATAR + } + this.setData(patch) }, - _loadKaruoAvatarLazy() { - app.request({ url: `/api/miniprogram/user/profile?userId=${KARUO_USER_ID}`, silent: true, timeout: 3000 }) - .then(res => { - if (res?.success && res.data?.avatar && isSafeImageSrc(res.data.avatar)) { - this.setData({ mpUiLinkKaruoDisplay: res.data.avatar }) - } - }) - .catch(() => {}) + /** 拉取后台置顶 @人物,合并到首页右上角「链接」区 */ + async loadHomePinnedPerson() { + try { + const res = await app.request({ url: '/api/miniprogram/ckb/pinned-person', silent: true }) + if (res && res.success && res.data && res.data.token) { + const name = cleanSingleLineField(res.data.name) || '好友' + let av = String(res.data.avatar || '').trim() + if (!isSafeImageSrc(av)) av = '' + this.setData({ + homePinnedPerson: { + token: String(res.data.token).trim(), + name, + avatar: av, + }, + }) + } else { + this.setData({ homePinnedPerson: null }) + } + } catch (e) { + console.log('[Index] pinned-person:', e) + this.setData({ homePinnedPerson: null }) + } + this._applyHomeMpUi() }, async loadFeatureConfig() { @@ -380,6 +400,7 @@ Page({ }) this._applyHomeMpUi() } + await this.loadHomePinnedPerson() }, // 跳转到搜索页 @@ -409,187 +430,14 @@ Page({ }, async onLinkKaruo() { - trackClick('home', 'btn_click', '链接卡若') - const app = getApp() - if (!app.globalData.isLoggedIn || !app.globalData.userInfo) { - wx.showModal({ - title: '提示', - content: '请先登录后再链接卡若', - confirmText: '去登录', - cancelText: '取消', - success: (res) => { - if (res.confirm) wx.switchTab({ url: '/pages/my/my' }) - } - }) - return - } - const userId = app.globalData.userInfo.id - let phone = (app.globalData.userInfo.phone || '').trim() - let wechatId = (app.globalData.userInfo.wechatId || app.globalData.userInfo.wechat_id || '').trim() - if (!phone && !wechatId) { - try { - const profileRes = await app.request({ url: `/api/miniprogram/user/profile?userId=${userId}`, silent: true }) - if (profileRes?.success && profileRes.data) { - phone = (profileRes.data.phone || '').trim() - wechatId = (profileRes.data.wechatId || profileRes.data.wechat_id || '').trim() - } - } catch (e) {} - } - if (phone || wechatId) { - wx.showLoading({ title: '提交中...', mask: true }) - try { - const res = await app.request({ - url: '/api/miniprogram/ckb/index-lead', - method: 'POST', - data: { - userId, - phone: phone || undefined, - wechatId: wechatId || undefined, - name: (app.globalData.userInfo.nickname || '').trim() || undefined - } - }) - wx.hideLoading() - if (res && res.success) { - wx.setStorageSync('lead_last_submit_ts', Date.now()) - wx.showToast({ title: res.message || '提交成功', icon: 'success' }) - } else { - wx.showToast({ title: (res && res.message) || '提交失败', icon: 'none' }) - } - } catch (e) { - wx.hideLoading() - wx.showToast({ title: e.message || '提交失败', icon: 'none' }) - } - return - } - this.setData({ showLeadModal: true, leadPhone: '' }) - }, - - closeLeadModal() { - this.setData({ showLeadModal: false, leadPhone: '', showPrivacyModal: false }) - }, - - // 阻止弹窗内部点击事件冒泡到遮罩层 - stopPropagation() {}, - - preventMove() {}, - - onLeadPrivacyAuthorize() { - this.onAgreePrivacyForLead() - }, - - onDisagreePrivacyForLead() { - if (app._privacyResolve) { - try { - app._privacyResolve({ event: 'disagree' }) - } catch (_) {} - app._privacyResolve = null - } - this.setData({ showPrivacyModal: false }) - }, - - onLeadPhoneInput(e) { - this.setData({ leadPhone: (e.detail.value || '').trim() }) - }, - - // 微信隐私协议同意(getPhoneNumber 需先同意) - onAgreePrivacyForLead() { - if (app._privacyResolve) { - app._privacyResolve({ buttonId: 'agree-privacy-btn', event: 'agree' }) - app._privacyResolve = null - } - this.setData({ showPrivacyModal: false }) - }, - - // 一键获取手机号(微信能力),成功后直接提交链接卡若 - async onGetPhoneNumberForLead(e) { - if (e.detail.errMsg !== 'getPhoneNumber:ok') { - wx.showToast({ title: '未获取到手机号,请手动输入', icon: 'none' }) - return - } - const code = e.detail.code - if (!code) { - wx.showToast({ title: '获取失败,请手动输入', icon: 'none' }) - return - } - const app = getApp() - const userId = app.globalData.userInfo?.id - wx.showLoading({ title: '获取中...', mask: true }) - try { - const res = await app.request({ - url: '/api/miniprogram/phone', - method: 'POST', - data: { code, userId } - }) - wx.hideLoading() - if (res && res.success && res.phoneNumber) { - await this._submitLeadWithPhone(res.phoneNumber) - } else { - wx.showToast({ title: '获取失败,请手动输入', icon: 'none' }) - } - } catch (err) { - wx.hideLoading() - wx.showToast({ title: err.message || '获取失败,请手动输入', icon: 'none' }) - } - }, - - // 内部:用手机号提交链接卡若(一键获取与手动输入共用) - async _submitLeadWithPhone(phone) { - const p = (phone || '').trim().replace(/\s/g, '') - if (!p || p.length < 11) { - wx.showToast({ title: '请输入正确的手机号', icon: 'none' }) - return - } - const app = getApp() - const userId = app.globalData.userInfo?.id - wx.showLoading({ title: '提交中...', mask: true }) - try { - const res = await app.request({ - url: '/api/miniprogram/ckb/index-lead', - method: 'POST', - data: { - userId, - phone: p, - name: (app.globalData.userInfo?.nickname || '').trim() || undefined, - }, - }) - wx.hideLoading() - this.setData({ showLeadModal: false, leadPhone: '' }) - if (res && res.success) { - wx.setStorageSync('lead_last_submit_ts', Date.now()) - // 同步手机号到用户资料 - try { - if (userId) { - await app.request({ - url: '/api/miniprogram/user/profile', - method: 'POST', - data: { userId, phone: p }, - }) - if (app.globalData.userInfo) { - app.globalData.userInfo.phone = p - wx.setStorageSync('userInfo', app.globalData.userInfo) - } - wx.setStorageSync('user_phone', p) - } - } catch (e) { - console.log('[Index] 同步手机号到用户资料失败:', e && e.message) - } - wx.showToast({ title: res.message || '提交成功,卡若会尽快联系您', icon: 'success' }) - } else { - wx.showToast({ title: (res && res.message) || '提交失败', icon: 'none' }) - } - } catch (e) { - wx.hideLoading() - wx.showToast({ title: e.message || '提交失败', icon: 'none' }) - } - }, - - async submitLead() { - const phone = (this.data.leadPhone || '').trim().replace(/\s/g, '') - if (!phone) { - wx.showToast({ title: '请输入手机号', icon: 'none' }) - return - } - await this._submitLeadWithPhone(phone) + const pinned = this.data.homePinnedPerson + if (!pinned || !pinned.token) return + trackClick('home', 'btn_click', '置顶@人物留资') + await submitCkbLead(getApp(), { + targetUserId: pinned.token, + targetNickname: pinned.name, + source: 'home_pinned_person', + }) }, goToSuperList() { diff --git a/miniprogram/pages/index/index.wxml b/miniprogram/pages/index/index.wxml index 05222397..7b594ce7 100644 --- a/miniprogram/pages/index/index.wxml +++ b/miniprogram/pages/index/index.wxml @@ -4,7 +4,7 @@ - + @@ -16,7 +16,7 @@ {{mpUiLogoSubtitle}} - + {{mpUiLinkKaruoText}} @@ -163,31 +163,4 @@ - - - - - 温馨提示 - 使用手机号能力前,请先同意《用户隐私保护指引》 - - 拒绝 - - - - - - - 留下联系方式 - 方便卡若与您联系 - - 或手动输入 - - - - - - - - - diff --git a/miniprogram/pages/index/index.wxss b/miniprogram/pages/index/index.wxss index 7fc9b66f..9278596c 100644 --- a/miniprogram/pages/index/index.wxss +++ b/miniprogram/pages/index/index.wxss @@ -966,159 +966,3 @@ .bottom-space { height: 40rpx; } - -/* ===== 隐私授权(与 avatar-nickname 对齐) ===== */ -.privacy-mask { - position: fixed; - inset: 0; - background: rgba(0, 0, 0, 0.6); - z-index: 2000; - display: flex; - align-items: center; - justify-content: center; - padding: 48rpx; - box-sizing: border-box; -} -.privacy-modal { - width: 100%; - max-width: 560rpx; - background: #17212F; - border-radius: 24rpx; - padding: 48rpx; - display: flex; - flex-direction: column; - align-items: center; - box-sizing: border-box; -} -.privacy-title { - font-size: 36rpx; - font-weight: 700; - color: #fff; - margin-bottom: 24rpx; -} -.privacy-desc { - font-size: 28rpx; - color: #94A3B8; - text-align: center; - line-height: 1.5; - margin-bottom: 40rpx; -} -.privacy-btn { - width: 100%; - height: 88rpx; - line-height: 88rpx; - text-align: center; - background: #5EEAD4; - color: #000; - font-size: 30rpx; - font-weight: 600; - border-radius: 16rpx; - border: none; -} -.privacy-btn::after { border: none; } -.privacy-cancel { - margin-top: 24rpx; - font-size: 28rpx; - color: #64748B; -} - -/* ===== 链接卡若 - 留资弹窗 ===== */ -.lead-mask { - position: fixed; - left: 0; - right: 0; - top: 0; - bottom: 0; - background: rgba(0, 0, 0, 0.6); - z-index: 2100; - display: flex; - align-items: center; - justify-content: center; - padding: 48rpx; - box-sizing: border-box; -} -.lead-box { - width: 100%; - max-width: 560rpx; - background: #1C1C1E; - border-radius: 24rpx; - padding: 48rpx 40rpx; - border: 2rpx solid rgba(56, 189, 172, 0.3); -} -.lead-title { - display: block; - font-size: 34rpx; - font-weight: 600; - color: #ffffff; - margin-bottom: 12rpx; -} -.lead-desc { - display: block; - font-size: 26rpx; - color: #A0AEC0; - margin-bottom: 24rpx; -} -.lead-get-phone-btn { - width: 100%; - height: 88rpx; - background: rgba(56, 189, 172, 0.2); - border: 2rpx solid rgba(56, 189, 172, 0.5); - border-radius: 16rpx; - font-size: 30rpx; - color: #38bdac; - display: flex; - align-items: center; - justify-content: center; - margin-bottom: 24rpx; - line-height: normal; -} -.lead-get-phone-btn::after { border: none; } -.privacy-wechat-row { margin: 24rpx 0; padding: 24rpx; background: rgba(0,206,209,0.1); border-radius: 16rpx; } -.privacy-wechat-desc { display: block; font-size: 26rpx; color: rgba(255,255,255,0.8); margin-bottom: 16rpx; } -.privacy-agree-btn { width: 100%; padding: 20rpx; background: #07C160; color: #fff; font-size: 28rpx; border-radius: 16rpx; border: none; } -.privacy-agree-btn::after { border: none; } -.lead-divider { - display: block; - font-size: 24rpx; - color: #6B7280; - text-align: center; - margin-bottom: 16rpx; -} -.lead-input-wrap { - padding: 16rpx 24rpx; - background: #0a1628; - border: 2rpx solid rgba(255, 255, 255, 0.1); - border-radius: 16rpx; - margin-bottom: 32rpx; -} -.lead-input { - width: 100%; - font-size: 30rpx; - color: #ffffff; - background: transparent; -} -.lead-actions { - display: flex; - gap: 24rpx; -} -.lead-btn { - flex: 1; - height: 80rpx; - /* 使用 flex 垂直居中文本,避免小程序默认 padding 导致按钮文字下沉 */ - display: flex; - align-items: center; - justify-content: center; - padding: 0; - border-radius: 16rpx; - font-size: 30rpx; - font-weight: 500; - border: none; -} -.lead-btn-cancel { - background: rgba(255, 255, 255, 0.1); - color: #A0AEC0; -} -.lead-btn-submit { - background: #38bdac; - color: #ffffff; -} diff --git a/miniprogram/utils/soulBridge.js b/miniprogram/utils/soulBridge.js index 4022b35d..a780f6e1 100644 --- a/miniprogram/utils/soulBridge.js +++ b/miniprogram/utils/soulBridge.js @@ -137,10 +137,17 @@ async function submitCkbLead(app, opts) { }) wx.hideLoading() if (res && res.success) { - try { - wx.setStorageSync('lead_last_submit_ts', Date.now()) - } catch (e) {} - wx.showToast({ title: res.message || '提交成功,对方会尽快联系您', icon: 'success' }) + const data = res.data && typeof res.data === 'object' ? res.data : {} + const skipped = !!(data.skipped || data.alreadySubmitted) + if (!skipped) { + try { + wx.setStorageSync('lead_last_submit_ts', Date.now()) + } catch (e) {} + } + wx.showToast({ + title: res.message || (skipped ? '无需重复提交' : '提交成功,对方会尽快联系您'), + icon: skipped ? 'none' : 'success', + }) return true } wx.showToast({ title: (res && res.message) || '提交失败', icon: 'none' }) diff --git a/soul-admin/dist/assets/index-D2vksFq_.css b/soul-admin/dist/assets/index-D2vksFq_.css deleted file mode 100644 index f5292a36..00000000 --- a/soul-admin/dist/assets/index-D2vksFq_.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;--tw-ease: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-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;--ease-out:cubic-bezier(0,0,.2,1);--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-50{z-index:50}.col-span-2{grid-column:span 2/span 2}.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)}.mt-8{margin-top:calc(var(--spacing)*8)}.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-96{height:calc(var(--spacing)*96)}.h-\[75vh\]{height:75vh}.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-\[250px\]{max-height:250px}.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-\[32px\]{min-height:32px}.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-\[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-\[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-48{min-width:calc(var(--spacing)*48)}.min-w-\[8rem\]{min-width:8rem}.min-w-\[60px\]{min-width:60px}.min-w-\[120px\]{min-width:120px}.min-w-\[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}.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-pointer{cursor:pointer}.touch-pinch-zoom{--tw-pinch-zoom:pinch-zoom;touch-action:var(--tw-pan-x,)var(--tw-pan-y,)var(--tw-pinch-zoom,)}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.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}.grid-cols-\[60px_1fr_100px_100px_80px_120px\]{grid-template-columns:60px 1fr 100px 100px 80px 120px}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-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}.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-5{gap:calc(var(--spacing)*5)}.gap-6{gap:calc(var(--spacing)*6)}.gap-8{gap:calc(var(--spacing)*8)}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*0)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*0)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-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-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-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\/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\/20{border-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/20{border-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.border-purple-500\/30{border-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/30{border-color:color-mix(in oklab,var(--color-purple-500)30%,transparent)}}.border-purple-500\/40{border-color:#ac4bff66}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/40{border-color:color-mix(in oklab,var(--color-purple-500)40%,transparent)}}.border-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\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.border-red-500\/50{border-color:#fb2c3680}@supports (color:color-mix(in lab,red,red)){.border-red-500\/50{border-color:color-mix(in oklab,var(--color-red-500)50%,transparent)}}.border-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\]\/80{background-color:#0f2137cc}.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-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-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-\[\#0f2137\]{--tw-gradient-from:#0f2137;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#00CED1\]{--tw-gradient-from:#00ced1;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#38bdac\]\/10{--tw-gradient-from:oklab(72.378% -.11483 -.0053193/.1);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-blue-500\/20{--tw-gradient-from:#3080ff33}@supports (color:color-mix(in lab,red,red)){.from-blue-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.from-blue-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-cyan-500\/20{--tw-gradient-from:#00b7d733}@supports (color:color-mix(in lab,red,red)){.from-cyan-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.from-cyan-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-green-500\/20{--tw-gradient-from:#00c75833}@supports (color:color-mix(in lab,red,red)){.from-green-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.from-green-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-purple-500\/20{--tw-gradient-from:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.from-purple-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.from-purple-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-yellow-500\/20{--tw-gradient-from:#edb20033}@supports (color:color-mix(in lab,red,red)){.from-yellow-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.from-yellow-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.via-\[\#38bdac\]\/30{--tw-gradient-via:oklab(72.378% -.11483 -.0053193/.3);--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-\[\#0f2137\]{--tw-gradient-to:#0f2137;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-\[\#20B2AA\]{--tw-gradient-to:#20b2aa;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-\[\#162d4a\]{--tw-gradient-to:#162d4a;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-amber-500\/20{--tw-gradient-to:#f99c0033}@supports (color:color-mix(in lab,red,red)){.to-amber-500\/20{--tw-gradient-to:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.to-amber-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-cyan-500\/5{--tw-gradient-to:#00b7d70d}@supports (color:color-mix(in lab,red,red)){.to-cyan-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-cyan-500)5%,transparent)}}.to-cyan-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-green-500\/5{--tw-gradient-to:#00c7580d}@supports (color:color-mix(in lab,red,red)){.to-green-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-green-500)5%,transparent)}}.to-green-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-purple-500\/5{--tw-gradient-to:#ac4bff0d}@supports (color:color-mix(in lab,red,red)){.to-purple-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-purple-500)5%,transparent)}}.to-purple-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-yellow-500\/5{--tw-gradient-to:#edb2000d}@supports (color:color-mix(in lab,red,red)){.to-yellow-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-yellow-500)5%,transparent)}}.to-yellow-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.bg-repeat{background-repeat:repeat}.mask-no-clip{-webkit-mask-clip:no-clip;mask-clip:no-clip}.mask-repeat{-webkit-mask-repeat:repeat;mask-repeat:repeat}.fill-amber-400{fill:var(--color-amber-400)}.fill-current{fill:currentColor}.object-cover{object-fit:cover}.p-0{padding:calc(var(--spacing)*0)}.p-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-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-3{padding-right:calc(var(--spacing)*3)}.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}.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-gray-700{color:var(--color-gray-700)}.text-green-300{color:var(--color-green-300)}.text-green-400{color:var(--color-green-400)}.text-green-400\/90{color:#05df72e6}@supports (color:color-mix(in lab,red,red)){.text-green-400\/90{color:color-mix(in oklab,var(--color-green-400)90%,transparent)}}.text-green-500{color:var(--color-green-500)}.text-orange-300{color:var(--color-orange-300)}.text-orange-300\/60{color:#ffb96d99}@supports (color:color-mix(in lab,red,red)){.text-orange-300\/60{color:color-mix(in oklab,var(--color-orange-300)60%,transparent)}}.text-orange-400{color:var(--color-orange-400)}.text-orange-400\/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)}}.text-yellow-500\/70{color:#edb200b3}@supports (color:color-mix(in lab,red,red)){.text-yellow-500\/70{color:color-mix(in oklab,var(--color-yellow-500)70%,transparent)}}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.italic\!{font-style:italic!important}.not-italic{font-style:normal}.diagonal-fractions{--tw-numeric-fraction:diagonal-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.stacked-fractions{--tw-numeric-fraction:stacked-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.normal-nums{font-variant-numeric:normal}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.overline{text-decoration-line:overline}.underline{text-decoration-line:underline}.underline\!{text-decoration-line:underline!important}.underline-offset-4{text-underline-offset:4px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.subpixel-antialiased{-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto}.accent-\[\#38bdac\]{accent-color:#38bdac}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-55{opacity:.55}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-0{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.inset-ring{--tw-inset-ring-shadow:inset 0 0 0 1px var(--tw-inset-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[\#38bdac\]\/20{--tw-shadow-color:#38bdac33}@supports (color:color-mix(in lab,red,red)){.shadow-\[\#38bdac\]\/20{--tw-shadow-color:color-mix(in oklab,oklab(72.378% -.11483 -.0053193/.2) var(--tw-shadow-alpha),transparent)}}.shadow-\[\#38bdac\]\/30{--tw-shadow-color:#38bdac4d}@supports (color:color-mix(in lab,red,red)){.shadow-\[\#38bdac\]\/30{--tw-shadow-color:color-mix(in oklab,oklab(72.378% -.11483 -.0053193/.3) var(--tw-shadow-alpha),transparent)}}.ring-\[\#38bdac\]{--tw-ring-color:#38bdac}.ring-\[\#38bdac\]\/40{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.4)}.ring-\[\#38bdac\]\/50{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.5)}.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-\[grid-template-rows\]{transition-property:grid-template-rows;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.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}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}:where(.divide-x-reverse>:not(:last-child)){--tw-divide-x-reverse:1}.ring-inset{--tw-ring-inset:inset}.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\]\/50:hover{border-color:#38bdac80}.hover\:border-\[\#38bdac\]\/60:hover{border-color:#38bdac99}.hover\:border-\[\#38bdac\]\/70:hover{border-color:#38bdacb3}.hover\:border-blue-500\/60:hover{border-color:#3080ff99}@supports (color:color-mix(in lab,red,red)){.hover\:border-blue-500\/60:hover{border-color:color-mix(in oklab,var(--color-blue-500)60%,transparent)}}.hover\:border-gray-500:hover{border-color:var(--color-gray-500)}.hover\:border-gray-600:hover{border-color:var(--color-gray-600)}.hover\:border-orange-500\/50:hover{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.hover\:border-orange-500\/50:hover{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.hover\:border-yellow-500\/60:hover{border-color:#edb20099}@supports (color:color-mix(in lab,red,red)){.hover\:border-yellow-500\/60:hover{border-color:color-mix(in oklab,var(--color-yellow-500)60%,transparent)}}.hover\:bg-\[\#0a1628\]:hover{background-color:#0a1628}.hover\:bg-\[\#0a1628\]\/80:hover{background-color:#0a1628cc}.hover\:bg-\[\#1a3050\]:hover{background-color:#1a3050}.hover\:bg-\[\#2da396\]:hover{background-color:#2da396}.hover\:bg-\[\#06AD51\]:hover{background-color:#06ad51}.hover\:bg-\[\#07C160\]\/10:hover{background-color:#07c1601a}.hover\:bg-\[\#20B2AA\]:hover{background-color:#20b2aa}.hover\:bg-\[\#38bdac\]\/10:hover{background-color:#38bdac1a}.hover\:bg-\[\#38bdac\]\/20:hover{background-color:#38bdac33}.hover\:bg-\[\#162840\]:hover{background-color:#162840}.hover\:bg-\[\#162840\]\/30:hover{background-color:#1628404d}.hover\:bg-\[\#162840\]\/50:hover{background-color:#16284080}.hover\:bg-amber-500\/10:hover{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/10:hover{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.hover\:bg-amber-500\/20:hover{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/20:hover{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.hover\:bg-amber-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-purple-500\/30:hover{background-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/30:hover{background-color:color-mix(in oklab,var(--color-purple-500)30%,transparent)}}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.hover\:bg-red-500\/20:hover{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/20:hover{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.hover\:bg-red-700:hover{background-color:var(--color-red-700)}.hover\:bg-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-blue-300:hover{color:var(--color-blue-300)}.hover\:text-blue-400:hover{color:var(--color-blue-400)}.hover\:text-gray-300:hover{color:var(--color-gray-300)}.hover\:text-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-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}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}} diff --git a/soul-admin/dist/assets/index-IPC9MvjH.css b/soul-admin/dist/assets/index-IPC9MvjH.css new file mode 100644 index 00000000..bfb3a9c5 --- /dev/null +++ b/soul-admin/dist/assets/index-IPC9MvjH.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-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;--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-\[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-\[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-\[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-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-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-\[\#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\]\/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}.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-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\/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-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)}} diff --git a/soul-admin/dist/assets/index-Z-J7LogK.js b/soul-admin/dist/assets/index-Z-J7LogK.js new file mode 100644 index 00000000..6b0f7911 --- /dev/null +++ b/soul-admin/dist/assets/index-Z-J7LogK.js @@ -0,0 +1,1010 @@ +function LT(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 vj(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var cx={exports:{}},Md={},dx={exports:{}},Et={};/** + * @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 Qv;function OT(){if(Qv)return Et;Qv=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,fe){this.props=F,this.context=U,this.refs=w,this.updater=fe||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 E(F,U,fe){this.props=F,this.context=U,this.refs=w,this.updater=fe||b}var C=E.prototype=new k;C.constructor=E,v(C,N.prototype),C.isPureReactComponent=!0;var R=Array.isArray,L=Object.prototype.hasOwnProperty,q={current:null},_={key:!0,ref:!0,__self:!0,__source:!0};function H(F,U,fe){var he,oe={},O=null,K=null;if(U!=null)for(he in U.ref!==void 0&&(K=U.ref),U.key!==void 0&&(O=""+U.key),U)L.call(U,he)&&!_.hasOwnProperty(he)&&(oe[he]=U[he]);var D=arguments.length-2;if(D===1)oe.children=fe;else if(1>>1,U=z[F];if(0>>1;Fa(oe,X))Oa(K,oe)?(z[F]=K,z[O]=X,F=O):(z[F]=oe,z[he]=X,F=he);else if(Oa(K,X))z[F]=K,z[O]=X,F=O;else break e}}return me}function a(z,me){var X=z.sortIndex-me.sortIndex;return X!==0?X:z.id-me.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,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(z){for(var me=n(h);me!==null;){if(me.callback===null)r(h);else if(me.startTime<=z)r(h),me.sortIndex=me.expirationTime,e(u,me);else break;me=n(h)}}function R(z){if(w=!1,C(z),!v)if(n(u)!==null)v=!0,I(L);else{var me=n(h);me!==null&&G(R,me.startTime-z)}}function L(z,me){v=!1,w&&(w=!1,k(H),H=-1),b=!0;var X=x;try{for(C(me),m=n(u);m!==null&&(!(m.expirationTime>me)||z&&!Y());){var F=m.callback;if(typeof F=="function"){m.callback=null,x=m.priorityLevel;var U=F(m.expirationTime<=me);me=t.unstable_now(),typeof U=="function"?m.callback=U:m===n(u)&&r(u),C(me)}else r(u);m=n(u)}if(m!==null)var fe=!0;else{var he=n(h);he!==null&&G(R,he.startTime-me),fe=!1}return fe}finally{m=null,x=X,b=!1}}var q=!1,_=null,H=-1,P=5,se=-1;function Y(){return!(t.unstable_now()-sez||125F?(z.sortIndex=X,e(h,z),n(u)===null&&z===n(h)&&(w?(k(H),H=-1):w=!0,G(R,X-F))):(z.sortIndex=U,e(u,z),v||b||(v=!0,I(L))),z},t.unstable_shouldYield=Y,t.unstable_wrapCallback=function(z){var me=x;return function(){var X=x;x=me;try{return z.apply(this,arguments)}finally{x=X}}}})(fx)),fx}var t1;function zT(){return t1||(t1=1,hx.exports=$T()),hx.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 n1;function FT(){if(n1)return Js;n1=1;var t=gu(),e=zT();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 E(l){return l[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(l){var d=l.replace(k,E);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,E);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,E);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{fe=!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=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 O(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 q:return"Portal";case P:return"Profiler";case H:return"StrictMode";case ae:return"Suspense";case le:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case Y: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 de:return d=l.displayName||null,d!==null?d:O(l.type)||"Memo";case I:d=l._payload,l=l._init;try{return O(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 O(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 D(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function J(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function te(l){var d=J(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 be(l){l._valueTracker||(l._valueTracker=te(l))}function ze(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var p=d.getValue(),g="";return l&&(g=J(l)?l.checked?"true":"false":l.value),l=g,l!==p?(d.setValue(l),!0):!1}function Ke(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 Nt(l,d){var p=d.checked;return X({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??l._wrapperState.initialChecked})}function yt(l,d){var p=d.defaultValue==null?"":d.defaultValue,g=d.checked!=null?d.checked:d.defaultChecked;p=D(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 Dt(l,d){d=d.checked,d!=null&&C(l,"checked",d,!1)}function Rt(l,d){Dt(l,d);var p=D(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")?vn(l,d.type,p):d.hasOwnProperty("defaultValue")&&vn(l,d.type,D(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(l.defaultChecked=!!d.defaultChecked)}function Pn(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 vn(l,d,p){(d!=="number"||Ke(l.ownerDocument)!==l)&&(p==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+p&&(l.defaultValue=""+p))}var Ut=Array.isArray;function Zt(l,d,p,g){if(l=l.options,d){d={};for(var j=0;j"+d.valueOf().toString()+"",d=we.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 rt={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},Mt=["Webkit","ms","Moz","O"];Object.keys(rt).forEach(function(l){Mt.forEach(function(d){d=d+l.charAt(0).toUpperCase()+l.substring(1),rt[d]=rt[l]})});function kt(l,d,p){return d==null||typeof d=="boolean"||d===""?"":p||typeof d!="number"||d===0||rt.hasOwnProperty(l)&&rt[l]?(""+d).trim():d+"px"}function $(l,d){l=l.style;for(var p in d)if(d.hasOwnProperty(p)){var g=p.indexOf("--")===0,j=kt(p,d[p],g);p==="float"&&(p="cssFloat"),g?l.setProperty(p,j):l[p]=j}}var Ie=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 vt(l,d){if(d){if(Ie[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 Pt(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 bt=null;function ot(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var _t=null,Jt=null,an=null;function rs(l){if(l=pd(l)){if(typeof _t!="function")throw Error(n(280));var d=l.stateNode;d&&(d=Pu(d),_t(l.stateNode,l.type,d))}}function tr(l){Jt?an?an.push(l):an=[l]:Jt=l}function wi(){if(Jt){var l=Jt,d=an;if(an=Jt=null,rs(l),d)for(l=0;l>>=0,l===0?32:31-(td(l)/Br|0)|0}var ki=64,ha=4194304;function vr(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 Vr(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=vr(W):(S&=A,S!==0&&(g=vr(S)))}else A=p&~j,A!==0?g=vr(A):S!==0&&(g=vr(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 Hr(l,d,p){l.pendingLanes|=d,d!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,d=31-Yn(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=ad),Hy=" ",Uy=!1;function Wy(l,d){switch(l){case"keyup":return rd.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ky(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var Wl=!1;function I4(l,d){switch(l){case"compositionend":return Ky(d);case"keypress":return d.which!==32?null:(Uy=!0,Hy);case"textInput":return l=d.data,l===Hy&&Uy?null:l;default:return null}}function R4(l,d){if(Wl)return l==="compositionend"||!Hp&&Wy(l,d)?(l=Bl(),Ai=xa=Hs=null,Wl=!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=Zy(p)}}function tb(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?tb(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function nb(){for(var l=window,d=Ke();d instanceof l.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)l=d.contentWindow;else break;d=Ke(l.document)}return d}function Kp(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 B4(l){var d=nb(),p=l.focusedElem,g=l.selectionRange;if(d!==p&&p&&p.ownerDocument&&tb(p.ownerDocument.documentElement,p)){if(g!==null&&Kp(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=eb(p,S);var A=eb(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,Kl=null,qp=null,cd=null,Gp=!1;function sb(l,d,p){var g=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;Gp||Kl==null||Kl!==Ke(g)||(g=Kl,"selectionStart"in g&&Kp(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}),cd&&ld(cd,g)||(cd=g,g=Au(qp,"onSelect"),0Yl||(l.current=im[Yl],im[Yl]=null,Yl--)}function ln(l,d){Yl++,im[Yl]=l.current,l.current=d}var Fi={},gs=zi(Fi),Us=zi(!1),Wo=Fi;function Xl(l,d){var p=l.type.contextTypes;if(!p)return Fi;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 Ws(l){return l=l.childContextTypes,l!=null}function Lu(){pn(Us),pn(gs)}function yb(l,d,p){if(gs.current!==Fi)throw Error(n(168));ln(gs,d),ln(Us,p)}function bb(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 X({},p,g)}function Ou(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||Fi,Wo=gs.current,ln(gs,l),ln(Us,Us.current),!0}function vb(l,d,p){var g=l.stateNode;if(!g)throw Error(n(169));p?(l=bb(l,d,Wo),g.__reactInternalMemoizedMergedChildContext=l,pn(Us),pn(gs),ln(gs,l)):pn(Us),ln(Us,p)}var Ga=null,Du=!1,om=!1;function Nb(l){Ga===null?Ga=[l]:Ga.push(l)}function Z4(l){Du=!0,Nb(l)}function Bi(){if(!om&&Ga!==null){om=!0;var l=0,d=xt;try{var p=Ga;for(xt=1;l>=A,j-=A,Ja=1<<32-Yn(d)+j|p<mt?(es=ct,ct=null):es=ct.sibling;var $t=Ee(pe,ct,xe[mt],De);if($t===null){ct===null&&(ct=es);break}l&&ct&&$t.alternate===null&&d(pe,ct),re=S($t,re,mt),lt===null?nt=$t:lt.sibling=$t,lt=$t,ct=es}if(mt===xe.length)return p(pe,ct),gn&&qo(pe,mt),nt;if(ct===null){for(;mtmt?(es=ct,ct=null):es=ct.sibling;var Qi=Ee(pe,ct,$t.value,De);if(Qi===null){ct===null&&(ct=es);break}l&&ct&&Qi.alternate===null&&d(pe,ct),re=S(Qi,re,mt),lt===null?nt=Qi:lt.sibling=Qi,lt=Qi,ct=es}if($t.done)return p(pe,ct),gn&&qo(pe,mt),nt;if(ct===null){for(;!$t.done;mt++,$t=xe.next())$t=Re(pe,$t.value,De),$t!==null&&(re=S($t,re,mt),lt===null?nt=$t:lt.sibling=$t,lt=$t);return gn&&qo(pe,mt),nt}for(ct=g(pe,ct);!$t.done;mt++,$t=xe.next())$t=qe(ct,pe,mt,$t.value,De),$t!==null&&(l&&$t.alternate!==null&&ct.delete($t.key===null?mt:$t.key),re=S($t,re,mt),lt===null?nt=$t:lt.sibling=$t,lt=$t);return l&&ct.forEach(function(PT){return d(pe,PT)}),gn&&qo(pe,mt),nt}function Ln(pe,re,xe,De){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 nt=xe.key,lt=re;lt!==null;){if(lt.key===nt){if(nt=xe.type,nt===_){if(lt.tag===7){p(pe,lt.sibling),re=j(lt,xe.props.children),re.return=pe,pe=re;break e}}else if(lt.elementType===nt||typeof nt=="object"&&nt!==null&&nt.$$typeof===I&&Tb(nt)===lt.type){p(pe,lt.sibling),re=j(lt,xe.props),re.ref=md(pe,lt,xe),re.return=pe,pe=re;break e}p(pe,lt);break}else d(pe,lt);lt=lt.sibling}xe.type===_?(re=tl(xe.props.children,pe.mode,De,xe.key),re.return=pe,pe=re):(De=dh(xe.type,xe.key,xe.props,null,pe.mode,De),De.ref=md(pe,re,xe),De.return=pe,pe=De)}return A(pe);case q:e:{for(lt=xe.key;re!==null;){if(re.key===lt)if(re.tag===4&&re.stateNode.containerInfo===xe.containerInfo&&re.stateNode.implementation===xe.implementation){p(pe,re.sibling),re=j(re,xe.children||[]),re.return=pe,pe=re;break e}else{p(pe,re);break}else d(pe,re);re=re.sibling}re=rx(xe,pe.mode,De),re.return=pe,pe=re}return A(pe);case I:return lt=xe._init,Ln(pe,re,lt(xe._payload),De)}if(Ut(xe))return Ye(pe,re,xe,De);if(me(xe))return et(pe,re,xe,De);Fu(pe,xe)}return typeof xe=="string"&&xe!==""||typeof xe=="number"?(xe=""+xe,re!==null&&re.tag===6?(p(pe,re.sibling),re=j(re,xe),re.return=pe,pe=re):(p(pe,re),re=sx(xe,pe.mode,De),re.return=pe,pe=re),A(pe)):p(pe,re)}return Ln}var nc=Eb(!0),Mb=Eb(!1),Bu=zi(null),Vu=null,sc=null,fm=null;function pm(){fm=sc=Vu=null}function mm(l){var d=Bu.current;pn(Bu),l._currentValue=d}function xm(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 rc(l,d){Vu=l,fm=sc=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(Ks=!0),l.firstContext=null)}function Er(l){var d=l._currentValue;if(fm!==l)if(l={context:l,memoizedValue:d,next:null},sc===null){if(Vu===null)throw Error(n(308));sc=l,Vu.dependencies={lanes:0,firstContext:l}}else sc=sc.next=l;return d}var Go=null;function gm(l){Go===null?Go=[l]:Go.push(l)}function Ab(l,d,p,g){var j=d.interleaved;return j===null?(p.next=p,gm(d)):(p.next=j.next,j.next=p),d.interleaved=p,Ya(l,g)}function Ya(l,d){l.lanes|=d;var p=l.alternate;for(p!==null&&(p.lanes|=d),p=l,l=l.return;l!==null;)l.childLanes|=d,p=l.alternate,p!==null&&(p.childLanes|=d),p=l,l=l.return;return p.tag===3?p.stateNode:null}var Vi=!1;function ym(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ib(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 Xa(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function Hi(l,d,p){var g=l.updateQueue;if(g===null)return null;if(g=g.shared,(Ot&2)!==0){var j=g.pending;return j===null?d.next=d:(d.next=j.next,j.next=d),g.pending=d,Ya(l,p)}return j=g.interleaved,j===null?(d.next=d,gm(g)):(d.next=j.next,j.next=d),g.interleaved=d,Ya(l,p)}function Hu(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,Do(l,p)}}function Rb(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 Uu(l,d,p,g){var j=l.updateQueue;Vi=!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 Me=l.alternate;Me!==null&&(Me=Me.updateQueue,W=Me.lastBaseUpdate,W!==A&&(W===null?Me.firstBaseUpdate=ye:W.next=ye,Me.lastBaseUpdate=ee))}if(S!==null){var Re=j.baseState;A=0,Me=ye=ee=null,W=S;do{var Ee=W.lane,qe=W.eventTime;if((g&Ee)===Ee){Me!==null&&(Me=Me.next={eventTime:qe,lane:0,tag:W.tag,payload:W.payload,callback:W.callback,next:null});e:{var Ye=l,et=W;switch(Ee=d,qe=p,et.tag){case 1:if(Ye=et.payload,typeof Ye=="function"){Re=Ye.call(qe,Re,Ee);break e}Re=Ye;break e;case 3:Ye.flags=Ye.flags&-65537|128;case 0:if(Ye=et.payload,Ee=typeof Ye=="function"?Ye.call(qe,Re,Ee):Ye,Ee==null)break e;Re=X({},Re,Ee);break e;case 2:Vi=!0}}W.callback!==null&&W.lane!==0&&(l.flags|=64,Ee=j.effects,Ee===null?j.effects=[W]:Ee.push(W))}else qe={eventTime:qe,lane:Ee,tag:W.tag,payload:W.payload,callback:W.callback,next:null},Me===null?(ye=Me=qe,ee=Re):Me=Me.next=qe,A|=Ee;if(W=W.next,W===null){if(W=j.shared.pending,W===null)break;Ee=W,W=Ee.next,Ee.next=null,j.lastBaseUpdate=Ee,j.shared.pending=null}}while(!0);if(Me===null&&(ee=Re),j.baseState=ee,j.firstBaseUpdate=ye,j.lastBaseUpdate=Me,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);Yo|=A,l.lanes=A,l.memoizedState=Re}}function Pb(l,d,p){if(l=d.effects,d.effects=null,l!==null)for(d=0;dp?p:4,l(!0);var g=jm.transition;jm.transition={};try{l(!1),d()}finally{xt=p,jm.transition=g}}function Xb(){return Mr().memoizedState}function sT(l,d,p){var g=qi(l);if(p={lane:g,action:p,hasEagerState:!1,eagerState:null,next:null},Zb(l))ev(d,p);else if(p=Ab(l,d,p,g),p!==null){var j=Ls();ea(p,l,g,j),tv(p,d,g)}}function rT(l,d,p){var g=qi(l),j={lane:g,action:p,hasEagerState:!1,eagerState:null,next:null};if(Zb(l))ev(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,Jr(W,A)){var ee=d.interleaved;ee===null?(j.next=j,gm(d)):(j.next=ee.next,ee.next=j),d.interleaved=j;return}}catch{}finally{}p=Ab(l,d,j,g),p!==null&&(j=Ls(),ea(p,l,g,j),tv(p,d,g))}}function Zb(l){var d=l.alternate;return l===kn||d!==null&&d===kn}function ev(l,d){bd=qu=!0;var p=l.pending;p===null?d.next=d:(d.next=p.next,p.next=d),l.pending=d}function tv(l,d,p){if((p&4194240)!==0){var g=d.lanes;g&=l.pendingLanes,p|=g,d.lanes=p,Do(l,p)}}var Qu={readContext:Er,useCallback:ys,useContext:ys,useEffect:ys,useImperativeHandle:ys,useInsertionEffect:ys,useLayoutEffect:ys,useMemo:ys,useReducer:ys,useRef:ys,useState:ys,useDebugValue:ys,useDeferredValue:ys,useTransition:ys,useMutableSource:ys,useSyncExternalStore:ys,useId:ys,unstable_isNewReconciler:!1},aT={readContext:Er,useCallback:function(l,d){return ba().memoizedState=[l,d===void 0?null:d],l},useContext:Er,useEffect:Ub,useImperativeHandle:function(l,d,p){return p=p!=null?p.concat([l]):null,Gu(4194308,4,qb.bind(null,d,l),p)},useLayoutEffect:function(l,d){return Gu(4194308,4,l,d)},useInsertionEffect:function(l,d){return Gu(4,2,l,d)},useMemo:function(l,d){var p=ba();return d=d===void 0?null:d,l=l(),p.memoizedState=[l,d],l},useReducer:function(l,d,p){var g=ba();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=sT.bind(null,kn,l),[g.memoizedState,l]},useRef:function(l){var d=ba();return l={current:l},d.memoizedState=l},useState:Vb,useDebugValue:Am,useDeferredValue:function(l){return ba().memoizedState=l},useTransition:function(){var l=Vb(!1),d=l[0];return l=nT.bind(null,l[1]),ba().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,p){var g=kn,j=ba();if(gn){if(p===void 0)throw Error(n(407));p=p()}else{if(p=d(),Zn===null)throw Error(n(349));(Qo&30)!==0||_b(g,d,p)}j.memoizedState=p;var S={value:p,getSnapshot:d};return j.queue=S,Ub(zb.bind(null,g,S,l),[l]),g.flags|=2048,wd(9,$b.bind(null,g,S,p,d),void 0,null),p},useId:function(){var l=ba(),d=Zn.identifierPrefix;if(gn){var p=Qa,g=Ja;p=(g&~(1<<32-Yn(g)-1)).toString(32)+p,d=":"+d+"R"+p,p=vd++,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[ga]=d,l[fd]=g,Nv(l,d,!1,!1),d.stateNode=l;e:{switch(A=Pt(p,g),p){case"dialog":fn("cancel",l),fn("close",l),j=g;break;case"iframe":case"object":case"embed":fn("load",l),j=g;break;case"video":case"audio":for(j=0;jcc&&(d.flags|=128,g=!0,jd(S,!1),d.lanes=4194304)}else{if(!g)if(l=Wu(A),l!==null){if(d.flags|=128,g=!0,p=l.updateQueue,p!==null&&(d.updateQueue=p,d.flags|=4),jd(S,!0),S.tail===null&&S.tailMode==="hidden"&&!A.alternate&&!gn)return bs(d),null}else 2*Wt()-S.renderingStartTime>cc&&p!==1073741824&&(d.flags|=128,g=!0,jd(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=Wt(),d.sibling=null,p=jn.current,ln(jn,g?p&1|2:p&1),d):(bs(d),null);case 22:case 23:return ex(),g=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==g&&(d.flags|=8192),g&&(d.mode&1)!==0?(ur&1073741824)!==0&&(bs(d),d.subtreeFlags&6&&(d.flags|=8192)):bs(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function fT(l,d){switch(cm(d),d.tag){case 1:return Ws(d.type)&&Lu(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return ac(),pn(Us),pn(gs),wm(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return vm(d),null;case 13:if(pn(jn),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));tc()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return pn(jn),null;case 4:return ac(),null;case 10:return mm(d.type._context),null;case 22:case 23:return ex(),null;case 24:return null;default:return null}}var eh=!1,vs=!1,pT=typeof WeakSet=="function"?WeakSet:Set,Je=null;function oc(l,d){var p=l.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(g){Tn(l,d,g)}else p.current=null}function Vm(l,d,p){try{p()}catch(g){Tn(l,d,g)}}var kv=!1;function mT(l,d){if(em=Vs,l=nb(),Kp(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,Me=0,Re=l,Ee=null;t:for(;;){for(var qe;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),(qe=Re.firstChild)!==null;)Ee=Re,Re=qe;for(;;){if(Re===l)break t;if(Ee===p&&++ye===j&&(W=A),Ee===S&&++Me===g&&(ee=A),(qe=Re.nextSibling)!==null)break;Re=Ee,Ee=Re.parentNode}Re=qe}p=W===-1||ee===-1?null:{start:W,end:ee}}else p=null}p=p||{start:0,end:0}}else p=null;for(tm={focusedElem:l,selectionRange:p},Vs=!1,Je=d;Je!==null;)if(d=Je,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,Je=l;else for(;Je!==null;){d=Je;try{var Ye=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(Ye!==null){var et=Ye.memoizedProps,Ln=Ye.memoizedState,pe=d.stateNode,re=pe.getSnapshotBeforeUpdate(d.elementType===d.type?et:Yr(d.type,et),Ln);pe.__reactInternalSnapshotBeforeUpdate=re}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(De){Tn(d,d.return,De)}if(l=d.sibling,l!==null){l.return=d.return,Je=l;break}Je=d.return}return Ye=kv,kv=!1,Ye}function kd(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&&Vm(d,p,S)}j=j.next}while(j!==g)}}function th(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 Hm(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 Sv(l){var d=l.alternate;d!==null&&(l.alternate=null,Sv(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[ga],delete d[fd],delete d[am],delete d[Y4],delete d[X4])),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 Cv(l){return l.tag===5||l.tag===3||l.tag===4}function Tv(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||Cv(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 Um(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=Ru));else if(g!==4&&(l=l.child,l!==null))for(Um(l,d,p),l=l.sibling;l!==null;)Um(l,d,p),l=l.sibling}function Wm(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(Wm(l,d,p),l=l.sibling;l!==null;)Wm(l,d,p),l=l.sibling}var is=null,Xr=!1;function Ui(l,d,p){for(p=p.child;p!==null;)Ev(l,d,p),p=p.sibling}function Ev(l,d,p){if(wn&&typeof wn.onCommitFiberUnmount=="function")try{wn.onCommitFiberUnmount(za,p)}catch{}switch(p.tag){case 5:vs||oc(p,d);case 6:var g=is,j=Xr;is=null,Ui(l,d,p),is=g,Xr=j,is!==null&&(Xr?(l=is,p=p.stateNode,l.nodeType===8?l.parentNode.removeChild(p):l.removeChild(p)):is.removeChild(p.stateNode));break;case 18:is!==null&&(Xr?(l=is,p=p.stateNode,l.nodeType===8?rm(l.parentNode,p):l.nodeType===1&&rm(l,p),Bs(l)):rm(is,p.stateNode));break;case 4:g=is,j=Xr,is=p.stateNode.containerInfo,Xr=!0,Ui(l,d,p),is=g,Xr=j;break;case 0:case 11:case 14:case 15:if(!vs&&(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)&&Vm(p,d,A),j=j.next}while(j!==g)}Ui(l,d,p);break;case 1:if(!vs&&(oc(p,d),g=p.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=p.memoizedProps,g.state=p.memoizedState,g.componentWillUnmount()}catch(W){Tn(p,d,W)}Ui(l,d,p);break;case 21:Ui(l,d,p);break;case 22:p.mode&1?(vs=(g=vs)||p.memoizedState!==null,Ui(l,d,p),vs=g):Ui(l,d,p);break;default:Ui(l,d,p)}}function Mv(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var p=l.stateNode;p===null&&(p=l.stateNode=new pT),d.forEach(function(g){var j=kT.bind(null,l,g);p.has(g)||(p.add(g),g.then(j,j))})}}function Zr(l,d){var p=d.deletions;if(p!==null)for(var g=0;gj&&(j=A),g&=~S}if(g=j,g=Wt()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*gT(g/1960))-g,10l?16:l,Ki===null)var g=!1;else{if(l=Ki,Ki=null,ih=0,(Ot&6)!==0)throw Error(n(331));var j=Ot;for(Ot|=4,Je=l.current;Je!==null;){var S=Je,A=S.child;if((Je.flags&16)!==0){var W=S.deletions;if(W!==null){for(var ee=0;eeWt()-Gm?Zo(l,0):qm|=p),Gs(l,d)}function Vv(l,d){d===0&&((l.mode&1)===0?d=1:(d=ha,ha<<=1,(ha&130023424)===0&&(ha=4194304)));var p=Ls();l=Ya(l,d),l!==null&&(Hr(l,d,p),Gs(l,p))}function jT(l){var d=l.memoizedState,p=0;d!==null&&(p=d.retryLane),Vv(l,p)}function kT(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),Vv(l,p)}var Hv;Hv=function(l,d,p){if(l!==null)if(l.memoizedProps!==d.pendingProps||Us.current)Ks=!0;else{if((l.lanes&p)===0&&(d.flags&128)===0)return Ks=!1,uT(l,d,p);Ks=(l.flags&131072)!==0}else Ks=!1,gn&&(d.flags&1048576)!==0&&wb(d,$u,d.index);switch(d.lanes=0,d.tag){case 2:var g=d.type;Zu(l,d),l=d.pendingProps;var j=Xl(d,gs.current);rc(d,p),j=Sm(null,d,g,l,j,p);var S=Cm();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,Ws(g)?(S=!0,Ou(d)):S=!1,d.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,ym(d),j.updater=Yu,d.stateNode=j,j._reactInternals=d,Rm(d,g,l,p),d=Dm(null,d,g,!0,S,p)):(d.tag=0,gn&&S&&lm(d),Ps(null,d,j,p),d=d.child),d;case 16:g=d.elementType;e:{switch(Zu(l,d),l=d.pendingProps,j=g._init,g=j(g._payload),d.type=g,j=d.tag=CT(g),l=Yr(g,l),j){case 0:d=Om(null,d,g,l,p);break e;case 1:d=mv(null,d,g,l,p);break e;case 11:d=dv(null,d,g,l,p);break e;case 14:d=uv(null,d,g,Yr(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:Yr(g,j),Om(l,d,g,j,p);case 1:return g=d.type,j=d.pendingProps,j=d.elementType===g?j:Yr(g,j),mv(l,d,g,j,p);case 3:e:{if(xv(d),l===null)throw Error(n(387));g=d.pendingProps,S=d.memoizedState,j=S.element,Ib(l,d),Uu(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=ic(Error(n(423)),d),d=gv(l,d,g,p,j);break e}else if(g!==j){j=ic(Error(n(424)),d),d=gv(l,d,g,p,j);break e}else for(dr=$i(d.stateNode.containerInfo.firstChild),cr=d,gn=!0,Qr=null,p=Mb(d,null,g,p),d.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(tc(),g===j){d=Za(l,d,p);break e}Ps(l,d,g,p)}d=d.child}return d;case 5:return Lb(d),l===null&&um(d),g=d.type,j=d.pendingProps,S=l!==null?l.memoizedProps:null,A=j.children,nm(g,j)?A=null:S!==null&&nm(g,S)&&(d.flags|=32),pv(l,d),Ps(l,d,A,p),d.child;case 6:return l===null&&um(d),null;case 13:return yv(l,d,p);case 4:return bm(d,d.stateNode.containerInfo),g=d.pendingProps,l===null?d.child=nc(d,null,g,p):Ps(l,d,g,p),d.child;case 11:return g=d.type,j=d.pendingProps,j=d.elementType===g?j:Yr(g,j),dv(l,d,g,j,p);case 7:return Ps(l,d,d.pendingProps,p),d.child;case 8:return Ps(l,d,d.pendingProps.children,p),d.child;case 12:return Ps(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,ln(Bu,g._currentValue),g._currentValue=A,S!==null)if(Jr(S.value,A)){if(S.children===j.children&&!Us.current){d=Za(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=Xa(-1,p&-p),ee.tag=2;var ye=S.updateQueue;if(ye!==null){ye=ye.shared;var Me=ye.pending;Me===null?ee.next=ee:(ee.next=Me.next,Me.next=ee),ye.pending=ee}}S.lanes|=p,ee=S.alternate,ee!==null&&(ee.lanes|=p),xm(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),xm(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}Ps(l,d,j.children,p),d=d.child}return d;case 9:return j=d.type,g=d.pendingProps.children,rc(d,p),j=Er(j),g=g(j),d.flags|=1,Ps(l,d,g,p),d.child;case 14:return g=d.type,j=Yr(g,d.pendingProps),j=Yr(g.type,j),uv(l,d,g,j,p);case 15:return hv(l,d,d.type,d.pendingProps,p);case 17:return g=d.type,j=d.pendingProps,j=d.elementType===g?j:Yr(g,j),Zu(l,d),d.tag=1,Ws(g)?(l=!0,Ou(d)):l=!1,rc(d,p),sv(d,g,j),Rm(d,g,j,p),Dm(null,d,g,!0,l,p);case 19:return vv(l,d,p);case 22:return fv(l,d,p)}throw Error(n(156,d.tag))};function Uv(l,d){return Po(l,d)}function ST(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 Ir(l,d,p,g){return new ST(l,d,p,g)}function nx(l){return l=l.prototype,!(!l||!l.isReactComponent)}function CT(l){if(typeof l=="function")return nx(l)?1:0;if(l!=null){if(l=l.$$typeof,l===V)return 11;if(l===de)return 14}return 2}function Ji(l,d){var p=l.alternate;return p===null?(p=Ir(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 dh(l,d,p,g,j,S){var A=2;if(g=l,typeof l=="function")nx(l)&&(A=1);else if(typeof l=="string")A=5;else e:switch(l){case _:return tl(p.children,j,S,d);case H:A=8,j|=8;break;case P:return l=Ir(12,p,d,j|2),l.elementType=P,l.lanes=S,l;case ae:return l=Ir(13,p,d,j),l.elementType=ae,l.lanes=S,l;case le:return l=Ir(19,p,d,j),l.elementType=le,l.lanes=S,l;case G:return uh(p,j,S,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case se:A=10;break e;case Y:A=9;break e;case V:A=11;break e;case de:A=14;break e;case I:A=16,g=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=Ir(A,p,d,j),d.elementType=l,d.type=g,d.lanes=S,d}function tl(l,d,p,g){return l=Ir(7,l,g,d),l.lanes=p,l}function uh(l,d,p,g){return l=Ir(22,l,g,d),l.elementType=G,l.lanes=p,l.stateNode={isHidden:!1},l}function sx(l,d,p){return l=Ir(6,l,null,d),l.lanes=p,l}function rx(l,d,p){return d=Ir(4,l.children!==null?l.children:[],l.key,d),d.lanes=p,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function TT(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=Ti(0),this.expirationTimes=Ti(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ti(0),this.identifierPrefix=g,this.onRecoverableError=j,this.mutableSourceEagerHydrationData=null}function ax(l,d,p,g,j,S,A,W,ee){return l=new TT(l,d,p,W,ee),d===1?(d=1,S===!0&&(d|=8)):d=0,S=Ir(3,null,null,d),l.current=S,S.stateNode=l,S.memoizedState={element:g,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},ym(S),l}function ET(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(),ux.exports=FT(),ux.exports}var r1;function BT(){if(r1)return yh;r1=1;var t=Nj();return yh.createRoot=t.createRoot,yh.hydrateRoot=t.hydrateRoot,yh}var VT=BT(),Uc=Nj();const wj=vj(Uc);/** + * @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 tu(){return tu=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function w0(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function UT(){return Math.random().toString(36).substr(2,8)}function i1(t,e){return{usr:t.state,key:t.key,idx:e}}function ug(t,e,n,r){return n===void 0&&(n=null),tu({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Wc(e):e,{state:n,key:e&&e.key||r||UT()})}function sf(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 Wc(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 WT(t,e,n,r){r===void 0&&(r={});let{window:a=document.defaultView,v5Compat:i=!1}=r,o=a.history,c=lo.Pop,u=null,h=f();h==null&&(h=0,o.replaceState(tu({},o.state,{idx:h}),""));function f(){return(o.state||{idx:null}).idx}function m(){c=lo.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=lo.Push;let E=ug(w.location,N,k);h=f()+1;let C=i1(E,h),R=w.createHref(E);try{o.pushState(C,"",R)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;a.location.assign(R)}i&&u&&u({action:c,location:w.location,delta:1})}function b(N,k){c=lo.Replace;let E=ug(w.location,N,k);h=f();let C=i1(E,h),R=w.createHref(E);o.replaceState(C,"",R),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,E=typeof N=="string"?N:sf(N);return E=E.replace(/ $/,"%20"),_n(k,"No window.location.(origin|href) available to create URL for href: "+E),new URL(E,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(a1,m),u=N,()=>{a.removeEventListener(a1,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 o1;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(o1||(o1={}));function KT(t,e,n){return n===void 0&&(n="/"),qT(t,e,n)}function qT(t,e,n,r){let a=typeof e=="string"?Wc(e):e,i=j0(a.pathname||"/",n);if(i==null)return null;let o=jj(t);GT(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("/")&&(_n(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=po([r,u.relativePath]),f=n.concat(u);i.children&&i.children.length>0&&(_n(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+h+'".')),jj(i.children,e,f,h)),!(i.path==null&&!i.index)&&e.push({path:h,score:tE(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 kj(i.path))a(i,o,u)}),e}function kj(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=kj(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 GT(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:nE(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const JT=/^:[\w-]+$/,QT=3,YT=2,XT=1,ZT=10,eE=-2,l1=t=>t==="*";function tE(t,e){let n=t.split("/"),r=n.length;return n.some(l1)&&(r+=eE),e&&(r+=YT),n.filter(a=>!l1(a)).reduce((a,i)=>a+(JT.test(i)?QT:i===""?XT:ZT),r)}function nE(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 sE(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 aE(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),w0(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 iE(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return w0(!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 j0(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 oE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,lE=t=>oE.test(t);function cE(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:a=""}=typeof t=="string"?Wc(t):t,i;if(n)if(lE(n))i=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),w0(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=c1(n.substring(1),"/"):i=c1(n,e)}else i=e;return{pathname:i,search:hE(r),hash:fE(a)}}function c1(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 px(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 dE(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function k0(t,e){let n=dE(t);return e?n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function S0(t,e,n,r){r===void 0&&(r=!1);let a;typeof t=="string"?a=Wc(t):(a=tu({},t),_n(!a.pathname||!a.pathname.includes("?"),px("?","pathname","search",a)),_n(!a.pathname||!a.pathname.includes("#"),px("#","pathname","hash",a)),_n(!a.search||!a.search.includes("#"),px("#","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=cE(a,c),h=o&&o!=="/"&&o.endsWith("/"),f=(i||o===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(h||f)&&(u.pathname+="/"),u}const po=t=>t.join("/").replace(/\/\/+/g,"/"),uE=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),hE=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,fE=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function pE(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Sj=["post","put","patch","delete"];new Set(Sj);const mE=["get",...Sj];new Set(mE);/** + * 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 nu(){return nu=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=S0(h,JSON.parse(o),i,f.relative==="path");t==null&&e!=="/"&&(m.pathname=m.pathname==="/"?e:po([e,m.pathname])),(f.replace?r.replace:r.push)(m,f.state,f)},[e,r,o,i,t])}const bE=y.createContext(null);function vE(t){let e=y.useContext(vi).outlet;return e&&y.createElement(bE.Provider,{value:t},e)}function Ej(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=y.useContext(So),{matches:a}=y.useContext(vi),{pathname:i}=Co(),o=JSON.stringify(k0(a,r.v7_relativeSplatPath));return y.useMemo(()=>S0(t,JSON.parse(o),i,n==="path"),[t,o,i,n])}function NE(t,e){return wE(t,e)}function wE(t,e,n,r){Kc()||_n(!1);let{navigator:a}=y.useContext(So),{matches:i}=y.useContext(vi),o=i[i.length-1],c=o?o.params:{};o&&o.pathname;let u=o?o.pathnameBase:"/";o&&o.route;let h=Co(),f;if(e){var m;let N=typeof e=="string"?Wc(e):e;u==="/"||(m=N.pathname)!=null&&m.startsWith(u)||_n(!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=KT(t,{pathname:b}),w=TE(v&&v.map(N=>Object.assign({},N,{params:Object.assign({},c,N.params),pathname:po([u,a.encodeLocation?a.encodeLocation(N.pathname).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?u:po([u,a.encodeLocation?a.encodeLocation(N.pathnameBase).pathname:N.pathnameBase])})),i,n,r);return e&&w?y.createElement(cp.Provider,{value:{location:nu({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:lo.Pop}},w):w}function jE(){let t=IE(),e=pE(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 kE=y.createElement(jE,null);class SE 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(vi.Provider,{value:this.props.routeContext},y.createElement(Cj.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function CE(t){let{routeContext:e,match:n,children:r}=t,a=y.useContext(C0);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),y.createElement(vi.Provider,{value:e},r)}function TE(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||_n(!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||kE,u&&(h<0&&x===0?(PE("route-fallback"),v=!0,N=null):h===x&&(v=!0,N=m.route.hydrateFallbackElement||null)));let k=e.concat(o.slice(0,x+1)),E=()=>{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(CE,{match:m,routeContext:{outlet:f,matches:k,isDataRoute:n!=null},children:C})};return n&&(m.route.ErrorBoundary||m.route.errorElement||x===0)?y.createElement(SE,{location:n.location,revalidation:n.revalidation,component:w,error:b,children:E(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):E()},null)}var Mj=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(Mj||{}),Aj=(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})(Aj||{});function EE(t){let e=y.useContext(C0);return e||_n(!1),e}function ME(t){let e=y.useContext(xE);return e||_n(!1),e}function AE(t){let e=y.useContext(vi);return e||_n(!1),e}function Ij(t){let e=AE(),n=e.matches[e.matches.length-1];return n.route.id||_n(!1),n.route.id}function IE(){var t;let e=y.useContext(Cj),n=ME(),r=Ij();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function RE(){let{router:t}=EE(Mj.UseNavigateStable),e=Ij(Aj.UseNavigateStable),n=y.useRef(!1);return Tj(()=>{n.current=!0}),y.useCallback(function(a,i){i===void 0&&(i={}),n.current&&(typeof a=="number"?t.navigate(a):t.navigate(a,nu({fromRouteId:e},i)))},[t,e])}const d1={};function PE(t,e,n){d1[t]||(d1[t]=!0)}function LE(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function bh(t){let{to:e,replace:n,state:r,relative:a}=t;Kc()||_n(!1);let{future:i,static:o}=y.useContext(So),{matches:c}=y.useContext(vi),{pathname:u}=Co(),h=Ra(),f=S0(e,k0(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 OE(t){return vE(t.context)}function cn(t){_n(!1)}function DE(t){let{basename:e="/",children:n=null,location:r,navigationType:a=lo.Pop,navigator:i,static:o=!1,future:c}=t;Kc()&&_n(!1);let u=e.replace(/^\/*/,"/"),h=y.useMemo(()=>({basename:u,navigator:i,static:o,future:nu({v7_relativeSplatPath:!1},c)}),[u,c,i,o]);typeof r=="string"&&(r=Wc(r));let{pathname:f="/",search:m="",hash:x="",state:b=null,key:v="default"}=r,w=y.useMemo(()=>{let N=j0(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(So.Provider,{value:h},y.createElement(cp.Provider,{children:n,value:w}))}function _E(t){let{children:e,location:n}=t;return NE(hg(e),n)}new Promise(()=>{});function hg(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,hg(r.props.children,i));return}r.type!==cn&&_n(!1),!r.props.index||!r.props.children||_n(!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=hg(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 fg(){return fg=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[a]=t[a]);return n}function zE(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function FE(t,e){return t.button===0&&(!e||e==="_self")&&!zE(t)}function pg(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 BE(t,e){let n=pg(t);return e&&e.forEach((r,a)=>{n.has(a)||e.getAll(a).forEach(i=>{n.append(a,i)})}),n}const VE=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],HE="6";try{window.__reactRouterVersion=HE}catch{}const UE="startTransition",u1=lp[UE];function WE(t){let{basename:e,children:n,future:r,window:a}=t,i=y.useRef();i.current==null&&(i.current=HT({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&&u1?u1(()=>u(m)):u(m)},[u,h]);return y.useLayoutEffect(()=>o.listen(f),[o,f]),y.useEffect(()=>LE(r),[r]),y.createElement(DE,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:o,future:r})}const KE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",qE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Pc=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=$E(e,VE),{basename:b}=y.useContext(So),v,w=!1;if(typeof h=="string"&&qE.test(h)&&(v=h,KE))try{let C=new URL(window.location.href),R=h.startsWith("//")?new URL(C.protocol+h):new URL(h),L=j0(R.pathname,b);R.origin===C.origin&&L!=null?h=L+R.search+R.hash:w=!0}catch{}let N=gE(h,{relative:a}),k=GE(h,{replace:o,state:c,target:u,preventScrollReset:f,relative:a,viewTransition:m});function E(C){r&&r(C),C.defaultPrevented||k(C)}return y.createElement("a",fg({},x,{href:v||N,onClick:w||i?r:E,ref:n,target:u}))});var h1;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(h1||(h1={}));var f1;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(f1||(f1={}));function GE(t,e){let{target:n,replace:r,state:a,preventScrollReset:i,relative:o,viewTransition:c}=e===void 0?{}:e,u=Ra(),h=Co(),f=Ej(t,{relative:o});return y.useCallback(m=>{if(FE(m,n)){m.preventDefault();let x=r!==void 0?r:sf(h)===sf(f);u(t,{replace:x,state:a,preventScrollReset:i,relative:o,viewTransition:c})}},[h,u,f,r,a,n,t,i,o,c])}function T0(t){let e=y.useRef(pg(t)),n=y.useRef(!1),r=Co(),a=y.useMemo(()=>BE(r.search,n.current?null:e.current),[r.search]),i=Ra(),o=y.useCallback((c,u)=>{const h=pg(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 JE=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),QE=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),p1=t=>{const e=QE(t);return e.charAt(0).toUpperCase()+e.slice(1)},Rj=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),YE=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 XE={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 ZE=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,...XE,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:Rj("lucide",a),...!i&&!YE(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 Ae=(t,e)=>{const n=y.forwardRef(({className:r,...a},i)=>y.createElement(ZE,{ref:i,iconNode:e,className:Rj(`lucide-${JE(p1(t))}`,`lucide-${t}`,r),...a}));return n.displayName=p1(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 e5=[["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"}]],mx=Ae("arrow-up-down",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=[["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"}]],n5=Ae("at-sign",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 s5=[["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"}]],m1=Ae("bitcoin",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 r5=[["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"}]],a5=Ae("bold",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 i5=[["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"}]],Zs=Ae("book-open",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:"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"}]],mg=Ae("calendar",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:"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"}]],yc=Ae("chart-column",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:"M20 6 9 17l-5-5",key:"1gmf2c"}]],dp=Ae("check",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:"m6 9 6 6 6-6",key:"qrunsl"}]],gl=Ae("chevron-down",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:"m15 18-6-6 6-6",key:"1wnfg3"}]],h5=Ae("chevron-left",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 f5=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ol=Ae("chevron-right",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=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],xg=Ae("chevron-up",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=[["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"}]],Pj=Ae("circle-alert",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=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],xx=Ae("circle-check-big",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=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Lj=Ae("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 y5=[["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"}]],Oj=Ae("circle-question-mark",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"}],["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"}]],vh=Ae("circle-user",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"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Dj=Ae("circle-x",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:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],gg=Ae("clock",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:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],x1=Ae("cloud",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:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],k5=Ae("code",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 S5=[["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"}]],_j=Ae("copy",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=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],g1=Ae("credit-card",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 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"}]],Ec=Ae("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 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"}]],rf=Ae("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 M5=[["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"}]],A5=Ae("download",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 I5=[["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"}]],xi=Ae("external-link",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:"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=Ae("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 L5=[["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"}]],af=Ae("eye",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:"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"}]],$j=Ae("file-text",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:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],zj=Ae("funnel",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=[["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"}]],yg=Ae("gift",_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 $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"}]],z5=Ae("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 F5=[["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"}]],bg=Ae("globe",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 B5=[["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"}]],V5=Ae("graduation-cap",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 H5=[["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"}]],ti=Ae("grip-vertical",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 U5=[["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"}]],W5=Ae("handshake",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 K5=[["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"}]],y1=Ae("hash",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 q5=[["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"}]],G5=Ae("heading-1",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 J5=[["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"}]],Q5=Ae("heading-2",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 Y5=[["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"}]],X5=Ae("heading-3",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 Z5=[["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"}]],eM=Ae("house",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 tM=[["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"}]],Fj=Ae("image",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=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Nh=Ae("info",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=[["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"}]],rM=Ae("italic",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 aM=[["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"}]],vg=Ae("key",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 iM=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],oM=Ae("layout-dashboard",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 lM=[["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"}]],cM=Ae("layout-grid",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 dM=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],ka=Ae("link-2",dM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const uM=[["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"}]],Ng=Ae("link",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:"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"}]],fM=Ae("list-ordered",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 pM=[["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"}]],mM=Ae("list",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 xM=[["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=Ae("lock",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 yM=[["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"}]],bM=Ae("log-out",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 vM=[["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"}]],Bj=Ae("map-pin",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 NM=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],wM=Ae("menu",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 jM=[["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"}]],kM=Ae("message-circle",jM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const SM=[["path",{d:"M5 12h14",key:"1ays0h"}]],CM=Ae("minus",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 TM=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],na=Ae("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 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"}]],MM=Ae("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 AM=[["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"}]],IM=Ae("paperclip",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 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"}]],en=Ae("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 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"}]],b1=Ae("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 LM=[["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"}]],OM=Ae("percent",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 DM=[["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"}]],v1=Ae("phone",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:"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"}]],N1=Ae("pin",_M);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $M=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],On=Ae("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 zM=[["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"}]],w1=Ae("qr-code",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 FM=[["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"}]],BM=Ae("quote",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 VM=[["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"}]],HM=Ae("redo",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 UM=[["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=Ae("refresh-cw",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:"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"}]],Sn=Ae("save",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:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ca=Ae("search",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:"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"}]],GM=Ae("send",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 JM=[["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"}]],co=Ae("settings",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=[["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"}]],wh=Ae("settings-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 YM=[["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"}]],XM=Ae("share-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 ZM=[["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"}]],kc=Ae("shield-check",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=[["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"}]],Vd=Ae("shopping-bag",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=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],yl=Ae("smartphone",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=[["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"}]],sA=Ae("smile",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 rA=[["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"}]],aA=Ae("sparkles",rA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const iA=[["path",{d:"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"}]],Sc=Ae("star",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 oA=[["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"}]],lA=Ae("strikethrough",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 cA=[["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"}]],dA=Ae("table",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 uA=[["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"}]],Hd=Ae("tag",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:"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"}]],Ns=Ae("trash-2",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:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],of=Ae("trending-up",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:"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"}]],wg=Ae("trophy",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:"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"}]],Vj=Ae("undo-2",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:"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=Ae("undo",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:"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"}]],lf=Ae("upload",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:"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"}]],Cc=Ae("user-plus",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:"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"}]],di=Ae("user",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 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"}]],Dn=Ae("users",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 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"}]],jA=Ae("video",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 kA=[["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"}]],Lc=Ae("wallet",kA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const SA=[["path",{d:"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"}]],CA=Ae("wand-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 TA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Jn=Ae("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 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"}]],gi=Ae("zap",EA),E0="admin_token";function yu(){try{return localStorage.getItem(E0)}catch{return null}}function MA(t){try{localStorage.setItem(E0,t)}catch{}}function gx(){try{localStorage.removeItem(E0)}catch{}}const AA="https://soulapi.quwanzhi.com",IA=15e3,j1=6e4,RA=()=>AA;function bl(t){const e=RA(),n=t.startsWith("/")?t:`/${t}`;return e?`${e}${n}`:n}async function up(t,e={}){const{data:n,...r}=e,a=bl(t),i=new Headers(r.headers),o=yu();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??IA,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 up(t,{...e,method:"GET"})}function Ct(t,e,n){return up(t,{...n,method:"POST",data:e})}function Yt(t,e,n){return up(t,{...n,method:"PUT",data:e})}function ui(t,e){return up(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(Pj,{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(Jn,{className:"w-4 h-4"})})]}):null}const LA=[{icon:oM,label:"数据概览",href:"/dashboard"},{icon:Zs,label:"内容管理",href:"/content"},{icon:Dn,label:"用户管理",href:"/users"},{icon:z5,label:"找伙伴",href:"/find-partner"},{icon:Lc,label:"推广中心",href:"/distribution"}];function OA(){const t=Co(),e=Ra(),[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(!yu()){e("/login",{replace:!0});return}return Oe("/api/admin").then(u=>{c||(u&&u.success!==!1?i(!0):(gx(),e("/login",{replace:!0,state:{from:t.pathname}})))}).catch(()=>{c||(gx(),e("/login",{replace:!0,state:{from:t.pathname}}))}),()=>{c=!0}},[t.pathname,n,e]);const o=async()=>{gx();try{await Ct("/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:[LA.map(c=>{const u=t.pathname===c.href;return s.jsxs(Pc,{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(Pc,{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(co,{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(bM,{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-[1024px] min-h-full flex-1",children:s.jsx(OE,{})})]})]})}function k1(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function M0(...t){return e=>{let n=!1;const r=t.map(a=>{const i=k1(a,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a{let{children:i,...o}=r;Hj(i)&&typeof cf=="function"&&(i=cf(i._payload));const c=y.Children.toArray(i),u=c.find(FA);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 Wj=Uj("Slot");function $A(t){const e=y.forwardRef((n,r)=>{let{children:a,...i}=n;if(Hj(a)&&typeof cf=="function"&&(a=cf(a._payload)),y.isValidElement(a)){const o=VA(a),c=BA(i,a.props);return a.type!==y.Fragment&&(c.ref=r?M0(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 zA=Symbol("radix.slottable");function FA(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===zA}function BA(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 VA(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 Kj(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,C1=qj,Gj=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return C1(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=S1(f)||S1(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 C1(t,o,u,n==null?void 0:n.class,n==null?void 0:n.className)},HA=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),Jj=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),df="-",T1=[],WA="arbitrary..",KA=t=>{const e=GA(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return qA(o);const c=o.split(df),u=c[0]===""&&c.length>1?1:0;return Qj(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=r[o],h=n[o];return u?h?HA(h,u):u:h||T1}return n[o]||T1}}},Qj=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const a=t[e],i=n.nextPart.get(a);if(i){const h=Qj(t,e+1,i);if(h)return h}const o=n.validators;if(o===null)return;const c=e===0?t.join(df):t.slice(e).join(df),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?WA+r:void 0})(),GA=t=>{const{theme:e,classGroups:n}=t;return JA(n,e)},JA=(t,e)=>{const n=Jj();for(const r in t){const a=t[r];A0(a,n,r,e)}return n},A0=(t,e,n,r)=>{const a=t.length;for(let i=0;i{if(typeof t=="string"){YA(t,e,n);return}if(typeof t=="function"){XA(t,e,n,r);return}ZA(t,e,n,r)},YA=(t,e,n)=>{const r=t===""?e:Yj(e,t);r.classGroupId=n},XA=(t,e,n,r)=>{if(eI(t)){A0(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(UA(n,t))},ZA=(t,e,n,r)=>{const a=Object.entries(t),i=a.length;for(let o=0;o{let n=t;const r=e.split(df),a=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,tI=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)}}},jg="!",E1=":",nI=[],M1=(t,e,n,r,a)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),sI=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 M1(i,b,x,v)};if(e){const a=e+E1,i=r;r=o=>o.startsWith(a)?i(o.slice(a.length)):M1(nI,!1,o,void 0,!0)}if(n){const a=r;r=i=>n({className:i,parseClassName:a})}return r},rI=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}},aI=t=>({cache:tI(t.cacheSize),parseClassName:sI(t),sortModifiers:rI(t),...KA(t)}),iI=/\s+/,oI=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:i}=e,o=[],c=t.trim().split(iI);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 E=x.length===0?"":x.length===1?x[0]:i(x).join(":"),C=b?E+jg:E,R=C+k;if(o.indexOf(R)>-1)continue;o.push(R);const L=a(k,N);for(let q=0;q0?" "+u:u)}return u},lI=(...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=aI(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=oI(u,n);return a(u,f),f};return i=o,(...u)=>i(lI(...u))},dI=[],Gn=t=>{const e=n=>n[t]||dI;return e.isThemeGetter=!0,e},Zj=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ek=/^\((?:(\w[\w-]*):)?(.+)\)$/i,uI=/^\d+\/\d+$/,hI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,fI=/\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$/,pI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,mI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,xI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,uc=t=>uI.test(t),St=t=>!!t&&!Number.isNaN(Number(t)),Yi=t=>!!t&&Number.isInteger(Number(t)),yx=t=>t.endsWith("%")&&St(t.slice(0,-1)),ni=t=>hI.test(t),gI=()=>!0,yI=t=>fI.test(t)&&!pI.test(t),tk=()=>!1,bI=t=>mI.test(t),vI=t=>xI.test(t),NI=t=>!Xe(t)&&!Ze(t),wI=t=>qc(t,rk,tk),Xe=t=>Zj.test(t),nl=t=>qc(t,ak,yI),bx=t=>qc(t,TI,St),A1=t=>qc(t,nk,tk),jI=t=>qc(t,sk,vI),jh=t=>qc(t,ik,bI),Ze=t=>ek.test(t),Ad=t=>Gc(t,ak),kI=t=>Gc(t,EI),I1=t=>Gc(t,nk),SI=t=>Gc(t,rk),CI=t=>Gc(t,sk),kh=t=>Gc(t,ik,!0),qc=(t,e,n)=>{const r=Zj.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Gc=(t,e,n=!1)=>{const r=ek.exec(t);return r?r[1]?e(r[1]):n:!1},nk=t=>t==="position"||t==="percentage",sk=t=>t==="image"||t==="url",rk=t=>t==="length"||t==="size"||t==="bg-size",ak=t=>t==="length",TI=t=>t==="number",EI=t=>t==="family-name",ik=t=>t==="shadow",MI=()=>{const t=Gn("color"),e=Gn("font"),n=Gn("text"),r=Gn("font-weight"),a=Gn("tracking"),i=Gn("leading"),o=Gn("breakpoint"),c=Gn("container"),u=Gn("spacing"),h=Gn("radius"),f=Gn("shadow"),m=Gn("inset-shadow"),x=Gn("text-shadow"),b=Gn("drop-shadow"),v=Gn("blur"),w=Gn("perspective"),N=Gn("aspect"),k=Gn("ease"),E=Gn("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],R=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...R(),Ze,Xe],q=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],H=()=>[Ze,Xe,u],P=()=>[uc,"full","auto",...H()],se=()=>[Yi,"none","subgrid",Ze,Xe],Y=()=>["auto",{span:["full",Yi,Ze,Xe]},Yi,Ze,Xe],V=()=>[Yi,"auto",Ze,Xe],ae=()=>["auto","min","max","fr",Ze,Xe],le=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],de=()=>["start","end","center","stretch","center-safe","end-safe"],I=()=>["auto",...H()],G=()=>[uc,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...H()],z=()=>[t,Ze,Xe],me=()=>[...R(),I1,A1,{position:[Ze,Xe]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],F=()=>["auto","cover","contain",SI,wI,{size:[Ze,Xe]}],U=()=>[yx,Ad,nl],fe=()=>["","none","full",h,Ze,Xe],he=()=>["",St,Ad,nl],oe=()=>["solid","dashed","dotted","double"],O=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>[St,yx,I1,A1],D=()=>["","none",v,Ze,Xe],J=()=>["none",St,Ze,Xe],te=()=>["none",St,Ze,Xe],be=()=>[St,Ze,Xe],ze=()=>[uc,"full",...H()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ni],breakpoint:[ni],color:[gI],container:[ni],"drop-shadow":[ni],ease:["in","out","in-out"],font:[NI],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ni],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ni],shadow:[ni],spacing:["px",St],text:[ni],"text-shadow":[ni],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",uc,Xe,Ze,N]}],container:["container"],columns:[{columns:[St,Xe,Ze,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:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:P()}],"inset-x":[{"inset-x":P()}],"inset-y":[{"inset-y":P()}],start:[{start:P()}],end:[{end:P()}],top:[{top:P()}],right:[{right:P()}],bottom:[{bottom:P()}],left:[{left:P()}],visibility:["visible","invisible","collapse"],z:[{z:[Yi,"auto",Ze,Xe]}],basis:[{basis:[uc,"full","auto",c,...H()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[St,uc,"auto","initial","none",Xe]}],grow:[{grow:["",St,Ze,Xe]}],shrink:[{shrink:["",St,Ze,Xe]}],order:[{order:[Yi,"first","last","none",Ze,Xe]}],"grid-cols":[{"grid-cols":se()}],"col-start-end":[{col:Y()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":se()}],"row-start-end":[{row:Y()}],"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":ae()}],"auto-rows":[{"auto-rows":ae()}],gap:[{gap:H()}],"gap-x":[{"gap-x":H()}],"gap-y":[{"gap-y":H()}],"justify-content":[{justify:[...le(),"normal"]}],"justify-items":[{"justify-items":[...de(),"normal"]}],"justify-self":[{"justify-self":["auto",...de()]}],"align-content":[{content:["normal",...le()]}],"align-items":[{items:[...de(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...de(),{baseline:["","last"]}]}],"place-content":[{"place-content":le()}],"place-items":[{"place-items":[...de(),"baseline"]}],"place-self":[{"place-self":["auto",...de()]}],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:G()}],w:[{w:[c,"screen",...G()]}],"min-w":[{"min-w":[c,"screen","none",...G()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...G()]}],h:[{h:["screen","lh",...G()]}],"min-h":[{"min-h":["screen","lh","none",...G()]}],"max-h":[{"max-h":["screen","lh",...G()]}],"font-size":[{text:["base",n,Ad,nl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Ze,bx]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",yx,Xe]}],"font-family":[{font:[kI,Xe,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,Ze,Xe]}],"line-clamp":[{"line-clamp":[St,"none",Ze,bx]}],leading:[{leading:[i,...H()]}],"list-image":[{"list-image":["none",Ze,Xe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ze,Xe]}],"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:[St,"from-font","auto",Ze,nl]}],"text-decoration-color":[{decoration:z()}],"underline-offset":[{"underline-offset":[St,"auto",Ze,Xe]}],"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",Ze,Xe]}],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",Ze,Xe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:me()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:F()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Yi,Ze,Xe],radial:["",Ze,Xe],conic:[Yi,Ze,Xe]},CI,jI]}],"bg-color":[{bg:z()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"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":[St,Ze,Xe]}],"outline-w":[{outline:["",St,Ad,nl]}],"outline-color":[{outline:z()}],shadow:[{shadow:["","none",f,kh,jh]}],"shadow-color":[{shadow:z()}],"inset-shadow":[{"inset-shadow":["none",m,kh,jh]}],"inset-shadow-color":[{"inset-shadow":z()}],"ring-w":[{ring:he()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:z()}],"ring-offset-w":[{"ring-offset":[St,nl]}],"ring-offset-color":[{"ring-offset":z()}],"inset-ring-w":[{"inset-ring":he()}],"inset-ring-color":[{"inset-ring":z()}],"text-shadow":[{"text-shadow":["none",x,kh,jh]}],"text-shadow-color":[{"text-shadow":z()}],opacity:[{opacity:[St,Ze,Xe]}],"mix-blend":[{"mix-blend":[...O(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":O()}],"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":[St]}],"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":z()}],"mask-image-linear-to-color":[{"mask-linear-to":z()}],"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":z()}],"mask-image-t-to-color":[{"mask-t-to":z()}],"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":z()}],"mask-image-r-to-color":[{"mask-r-to":z()}],"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":z()}],"mask-image-b-to-color":[{"mask-b-to":z()}],"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":z()}],"mask-image-l-to-color":[{"mask-l-to":z()}],"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":z()}],"mask-image-x-to-color":[{"mask-x-to":z()}],"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":z()}],"mask-image-y-to-color":[{"mask-y-to":z()}],"mask-image-radial":[{"mask-radial":[Ze,Xe]}],"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":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":R()}],"mask-image-conic-pos":[{"mask-conic":[St]}],"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":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:me()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:F()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ze,Xe]}],filter:[{filter:["","none",Ze,Xe]}],blur:[{blur:D()}],brightness:[{brightness:[St,Ze,Xe]}],contrast:[{contrast:[St,Ze,Xe]}],"drop-shadow":[{"drop-shadow":["","none",b,kh,jh]}],"drop-shadow-color":[{"drop-shadow":z()}],grayscale:[{grayscale:["",St,Ze,Xe]}],"hue-rotate":[{"hue-rotate":[St,Ze,Xe]}],invert:[{invert:["",St,Ze,Xe]}],saturate:[{saturate:[St,Ze,Xe]}],sepia:[{sepia:["",St,Ze,Xe]}],"backdrop-filter":[{"backdrop-filter":["","none",Ze,Xe]}],"backdrop-blur":[{"backdrop-blur":D()}],"backdrop-brightness":[{"backdrop-brightness":[St,Ze,Xe]}],"backdrop-contrast":[{"backdrop-contrast":[St,Ze,Xe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",St,Ze,Xe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[St,Ze,Xe]}],"backdrop-invert":[{"backdrop-invert":["",St,Ze,Xe]}],"backdrop-opacity":[{"backdrop-opacity":[St,Ze,Xe]}],"backdrop-saturate":[{"backdrop-saturate":[St,Ze,Xe]}],"backdrop-sepia":[{"backdrop-sepia":["",St,Ze,Xe]}],"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",Ze,Xe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[St,"initial",Ze,Xe]}],ease:[{ease:["linear","initial",k,Ze,Xe]}],delay:[{delay:[St,Ze,Xe]}],animate:[{animate:["none",E,Ze,Xe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,Ze,Xe]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:J()}],"rotate-x":[{"rotate-x":J()}],"rotate-y":[{"rotate-y":J()}],"rotate-z":[{"rotate-z":J()}],scale:[{scale:te()}],"scale-x":[{"scale-x":te()}],"scale-y":[{"scale-y":te()}],"scale-z":[{"scale-z":te()}],"scale-3d":["scale-3d"],skew:[{skew:be()}],"skew-x":[{"skew-x":be()}],"skew-y":[{"skew-y":be()}],transform:[{transform:[Ze,Xe,"","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",Ze,Xe]}],"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",Ze,Xe]}],fill:[{fill:["none",...z()]}],"stroke-w":[{stroke:[St,Ad,nl,bx]}],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"]}},AI=cI(MI);function Lt(...t){return AI(qj(t))}function Ea(t){if(!t)return"";let e=t.trim();return e?(e=e.replace(/^(https?)\/\//,"$1://"),e):""}const II=Gj("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 Q({className:t,variant:e,size:n,asChild:r=!1,...a}){const i=r?Wj:"button";return s.jsx(i,{"data-slot":"button",className:Lt(II({variant:e,size:n,className:t})),...a})}function ce({className:t,type:e,...n}){return s.jsx("input",{type:e,"data-slot":"input",className:Lt("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=Ra(),[e,n]=y.useState(""),[r,a]=y.useState(""),[i,o]=y.useState(""),[c,u]=y.useState(!1);y.useEffect(()=>{yu()&&t("/dashboard",{replace:!0})},[t]);const h=async()=>{o(""),u(!0);try{const f=await Ct("/api/admin",{username:e.trim(),password:r});if((f==null?void 0:f.success)!==!1&&(f!=null&&f.token)){MA(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(kc,{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(di,{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(gM,{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(Q,{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:Lt("rounded-xl border bg-card text-card-foreground shadow",t),...e}));_e.displayName="Card";const dt=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Lt("flex flex-col space-y-1.5 p-6",t),...e}));dt.displayName="CardHeader";const ut=y.forwardRef(({className:t,...e},n)=>s.jsx("h3",{ref:n,className:Lt("font-semibold leading-none tracking-tight",t),...e}));ut.displayName="CardTitle";const Xt=y.forwardRef(({className:t,...e},n)=>s.jsx("p",{ref:n,className:Lt("text-sm text-muted-foreground",t),...e}));Xt.displayName="CardDescription";const $e=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Lt("p-6 pt-0",t),...e}));$e.displayName="CardContent";const PI=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Lt("flex items-center p-6 pt-0",t),...e}));PI.displayName="CardFooter";const LI={success:{bg:"#f0fdf4",border:"#22c55e",icon:"✓"},error:{bg:"#fef2f2",border:"#ef4444",icon:"✕"},info:{bg:"#eff6ff",border:"#3b82f6",icon:"ℹ"}};function vx(t,e="info",n=3e3){const r=`toast-${Date.now()}`,a=LI[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 Z={success:(t,e)=>vx(t,"success",e),error:(t,e)=>vx(t,"error",e),info:(t,e)=>vx(t,"info",e)};function wt(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 OI(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 To(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,DI(a,...e)]}function DI(...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 js=globalThis!=null&&globalThis.document?y.useLayoutEffect:()=>{},_I=lp[" useId ".trim().toString()]||(()=>{}),$I=0;function mo(t){const[e,n]=y.useState(_I());return js(()=>{n(r=>r??String($I++))},[t]),e?`radix-${e}`:""}var zI=lp[" useInsertionEffect ".trim().toString()]||js;function vl({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[a,i,o]=FI({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=BI(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 FI({defaultProp:t,onChange:e}){const[n,r]=y.useState(t),a=y.useRef(n),i=y.useRef(e);return zI(()=>{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 BI(t){return typeof t=="function"}function su(t){const e=VI(t),n=y.forwardRef((r,a)=>{const{children:i,...o}=r,c=y.Children.toArray(i),u=c.find(UI);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 VI(t){const e=y.forwardRef((n,r)=>{const{children:a,...i}=n;if(y.isValidElement(a)){const o=KI(a),c=WI(i,a.props);return a.type!==y.Fragment&&(c.ref=r?M0(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 HI=Symbol("radix.slottable");function UI(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===HI}function WI(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 KI(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 qI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Tt=qI.reduce((t,e)=>{const n=su(`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 GI(t,e){t&&Uc.flushSync(()=>t.dispatchEvent(e))}function vo(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 JI(t,e=globalThis==null?void 0:globalThis.document){const n=vo(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 QI="DismissableLayer",kg="dismissableLayer.update",YI="dismissableLayer.pointerDownOutside",XI="dismissableLayer.focusOutside",R1,ok=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),I0=y.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,onDismiss:c,...u}=t,h=y.useContext(ok),[f,m]=y.useState(null),x=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=y.useState({}),v=Gt(e,_=>m(_)),w=Array.from(h.layers),[N]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),k=w.indexOf(N),E=f?w.indexOf(f):-1,C=h.layersWithOutsidePointerEventsDisabled.size>0,R=E>=k,L=tR(_=>{const H=_.target,P=[...h.branches].some(se=>se.contains(H));!R||P||(a==null||a(_),o==null||o(_),_.defaultPrevented||c==null||c())},x),q=nR(_=>{const H=_.target;[...h.branches].some(se=>se.contains(H))||(i==null||i(_),o==null||o(_),_.defaultPrevented||c==null||c())},x);return JI(_=>{E===h.layers.size-1&&(r==null||r(_),!_.defaultPrevented&&c&&(_.preventDefault(),c()))},x),y.useEffect(()=>{if(f)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(R1=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),P1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=R1)}},[f,x,n,h]),y.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),P1())},[f,h]),y.useEffect(()=>{const _=()=>b({});return document.addEventListener(kg,_),()=>document.removeEventListener(kg,_)},[]),s.jsx(Tt.div,{...u,ref:v,style:{pointerEvents:C?R?"auto":"none":void 0,...t.style},onFocusCapture:wt(t.onFocusCapture,q.onFocusCapture),onBlurCapture:wt(t.onBlurCapture,q.onBlurCapture),onPointerDownCapture:wt(t.onPointerDownCapture,L.onPointerDownCapture)})});I0.displayName=QI;var ZI="DismissableLayerBranch",eR=y.forwardRef((t,e)=>{const n=y.useContext(ok),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(Tt.div,{...t,ref:a})});eR.displayName=ZI;function tR(t,e=globalThis==null?void 0:globalThis.document){const n=vo(t),r=y.useRef(!1),a=y.useRef(()=>{});return y.useEffect(()=>{const i=c=>{if(c.target&&!r.current){let u=function(){lk(YI,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 nR(t,e=globalThis==null?void 0:globalThis.document){const n=vo(t),r=y.useRef(!1);return y.useEffect(()=>{const a=i=>{i.target&&!r.current&&lk(XI,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 P1(){const t=new CustomEvent(kg);document.dispatchEvent(t)}function lk(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?GI(a,i):a.dispatchEvent(i)}var Nx="focusScope.autoFocusOnMount",wx="focusScope.autoFocusOnUnmount",L1={bubbles:!1,cancelable:!0},sR="FocusScope",R0=y.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=t,[c,u]=y.useState(null),h=vo(a),f=vo(i),m=y.useRef(null),x=Gt(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 R=C.target;c.contains(R)?m.current=R:eo(m.current,{select:!0})},N=function(C){if(b.paused||!c)return;const R=C.relatedTarget;R!==null&&(c.contains(R)||eo(m.current,{select:!0}))},k=function(C){if(document.activeElement===document.body)for(const L of C)L.removedNodes.length>0&&eo(c)};document.addEventListener("focusin",w),document.addEventListener("focusout",N);const E=new MutationObserver(k);return c&&E.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",N),E.disconnect()}}},[r,c,b.paused]),y.useEffect(()=>{if(c){D1.add(b);const w=document.activeElement;if(!c.contains(w)){const k=new CustomEvent(Nx,L1);c.addEventListener(Nx,h),c.dispatchEvent(k),k.defaultPrevented||(rR(cR(ck(c)),{select:!0}),document.activeElement===w&&eo(c))}return()=>{c.removeEventListener(Nx,h),setTimeout(()=>{const k=new CustomEvent(wx,L1);c.addEventListener(wx,f),c.dispatchEvent(k),k.defaultPrevented||eo(w??document.body,{select:!0}),c.removeEventListener(wx,f),D1.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 E=w.currentTarget,[C,R]=aR(E);C&&R?!w.shiftKey&&k===R?(w.preventDefault(),n&&eo(C,{select:!0})):w.shiftKey&&k===C&&(w.preventDefault(),n&&eo(R,{select:!0})):k===E&&w.preventDefault()}},[n,r,b.paused]);return s.jsx(Tt.div,{tabIndex:-1,...o,ref:x,onKeyDown:v})});R0.displayName=sR;function rR(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(eo(r,{select:e}),document.activeElement!==n)return}function aR(t){const e=ck(t),n=O1(e,t),r=O1(e.reverse(),t);return[n,r]}function ck(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 O1(t,e){for(const n of t)if(!iR(n,{upTo:e}))return n}function iR(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 oR(t){return t instanceof HTMLInputElement&&"select"in t}function eo(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&oR(t)&&e&&t.select()}}var D1=lR();function lR(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=_1(t,e),t.unshift(e)},remove(e){var n;t=_1(t,e),(n=t[0])==null||n.resume()}}}function _1(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function cR(t){return t.filter(e=>e.tagName!=="A")}var dR="Portal",P0=y.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[a,i]=y.useState(!1);js(()=>i(!0),[]);const o=n||a&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return o?wj.createPortal(s.jsx(Tt.div,{...r,ref:e}),o):null});P0.displayName=dR;function uR(t,e){return y.useReducer((n,r)=>e[n][r]??n,t)}var bu=t=>{const{present:e,children:n}=t,r=hR(e),a=typeof n=="function"?n({present:r.isPresent}):y.Children.only(n),i=Gt(r.ref,fR(a));return typeof n=="function"||r.isPresent?y.cloneElement(a,{ref:i}):null};bu.displayName="Presence";function hR(t){const[e,n]=y.useState(),r=y.useRef(null),a=y.useRef(t),i=y.useRef("none"),o=t?"mounted":"unmounted",[c,u]=uR(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const h=Sh(r.current);i.current=c==="mounted"?h:"none"},[c]),js(()=>{const h=r.current,f=a.current;if(f!==t){const x=i.current,b=Sh(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]),js(()=>{if(e){let h;const f=e.ownerDocument.defaultView??window,m=b=>{const w=Sh(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=Sh(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 Sh(t){return(t==null?void 0:t.animationName)||"none"}function fR(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 jx=0;function dk(){y.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??$1()),document.body.insertAdjacentElement("beforeend",t[1]??$1()),jx++,()=>{jx===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),jx--}},[])}function $1(){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 ja=function(){return ja=Object.assign||function(e){for(var n,r=1,a=arguments.length;r"u")return AR;var e=IR(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])}},PR=pk(),Mc="data-scroll-locked",LR=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(mR,` { + overflow: hidden `).concat(r,`; + padding-right: `).concat(c,"px ").concat(r,`; + } + body[`).concat(Mc,`] { + 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(qh,` { + right: `).concat(c,"px ").concat(r,`; + } + + .`).concat(Gh,` { + margin-right: `).concat(c,"px ").concat(r,`; + } + + .`).concat(qh," .").concat(qh,` { + right: 0 `).concat(r,`; + } + + .`).concat(Gh," .").concat(Gh,` { + margin-right: 0 `).concat(r,`; + } + + body[`).concat(Mc,`] { + `).concat(xR,": ").concat(c,`px; + } +`)},F1=function(){var t=parseInt(document.body.getAttribute(Mc)||"0",10);return isFinite(t)?t:0},OR=function(){y.useEffect(function(){return document.body.setAttribute(Mc,(F1()+1).toString()),function(){var t=F1()-1;t<=0?document.body.removeAttribute(Mc):document.body.setAttribute(Mc,t.toString())}},[])},DR=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,a=r===void 0?"margin":r;OR();var i=y.useMemo(function(){return RR(a)},[a]);return y.createElement(PR,{styles:LR(i,!e,a,n?"":"!important")})},Sg=!1;if(typeof window<"u")try{var Ch=Object.defineProperty({},"passive",{get:function(){return Sg=!0,!0}});window.addEventListener("test",Ch,Ch),window.removeEventListener("test",Ch,Ch)}catch{Sg=!1}var hc=Sg?{passive:!1}:!1,_R=function(t){return t.tagName==="TEXTAREA"},mk=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!_R(t)&&n[e]==="visible")},$R=function(t){return mk(t,"overflowY")},zR=function(t){return mk(t,"overflowX")},B1=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=xk(t,r);if(a){var i=gk(t,r),o=i[1],c=i[2];if(o>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},FR=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},BR=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},xk=function(t,e){return t==="v"?$R(e):zR(e)},gk=function(t,e){return t==="v"?FR(e):BR(e)},VR=function(t,e){return t==="h"&&e==="rtl"?-1:1},HR=function(t,e,n,r,a){var i=VR(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=gk(t,c),v=b[0],w=b[1],N=b[2],k=w-N-i*v;(v||k)&&xk(t,c)&&(m+=k,x+=v);var E=c.parentNode;c=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!u&&c!==document.body||u&&(e.contains(c)||e===c));return(f&&Math.abs(m)<1||!f&&Math.abs(x)<1)&&(h=!0),h},Th=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},V1=function(t){return[t.deltaX,t.deltaY]},H1=function(t){return t&&"current"in t?t.current:t},UR=function(t,e){return t[0]===e[0]&&t[1]===e[1]},WR=function(t){return` + .block-interactivity-`.concat(t,` {pointer-events: none;} + .allow-interactivity-`).concat(t,` {pointer-events: all;} +`)},KR=0,fc=[];function qR(t){var e=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),a=y.useState(KR++)[0],i=y.useState(pk)[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=pR([t.lockRef.current],(t.shards||[]).map(H1),!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=Th(w),E=n.current,C="deltaX"in w?w.deltaX:E[0]-k[0],R="deltaY"in w?w.deltaY:E[1]-k[1],L,q=w.target,_=Math.abs(C)>Math.abs(R)?"h":"v";if("touches"in w&&_==="h"&&q.type==="range")return!1;var H=window.getSelection(),P=H&&H.anchorNode,se=P?P===q||P.contains(q):!1;if(se)return!1;var Y=B1(_,q);if(!Y)return!0;if(Y?L=_:(L=_==="v"?"h":"v",Y=B1(_,q)),!Y)return!1;if(!r.current&&"changedTouches"in w&&(C||R)&&(r.current=L),!L)return!0;var V=r.current||L;return HR(V,N,w,V==="h"?C:R)},[]),u=y.useCallback(function(w){var N=w;if(!(!fc.length||fc[fc.length-1]!==i)){var k="deltaY"in N?V1(N):Th(N),E=e.current.filter(function(L){return L.name===N.type&&(L.target===N.target||N.target===L.shadowParent)&&UR(L.delta,k)})[0];if(E&&E.should){N.cancelable&&N.preventDefault();return}if(!E){var C=(o.current.shards||[]).map(H1).filter(Boolean).filter(function(L){return L.contains(N.target)}),R=C.length>0?c(N,C[0]):!o.current.noIsolation;R&&N.cancelable&&N.preventDefault()}}},[]),h=y.useCallback(function(w,N,k,E){var C={name:w,delta:N,target:k,should:E,shadowParent:GR(k)};e.current.push(C),setTimeout(function(){e.current=e.current.filter(function(R){return R!==C})},1)},[]),f=y.useCallback(function(w){n.current=Th(w),r.current=void 0},[]),m=y.useCallback(function(w){h(w.type,V1(w),w.target,c(w,t.lockRef.current))},[]),x=y.useCallback(function(w){h(w.type,Th(w),w.target,c(w,t.lockRef.current))},[]);y.useEffect(function(){return fc.push(i),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:x}),document.addEventListener("wheel",u,hc),document.addEventListener("touchmove",u,hc),document.addEventListener("touchstart",f,hc),function(){fc=fc.filter(function(w){return w!==i}),document.removeEventListener("wheel",u,hc),document.removeEventListener("touchmove",u,hc),document.removeEventListener("touchstart",f,hc)}},[]);var b=t.removeScrollBar,v=t.inert;return y.createElement(y.Fragment,null,v?y.createElement(i,{styles:WR(a)}):null,b?y.createElement(DR,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function GR(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const JR=jR(fk,qR);var L0=y.forwardRef(function(t,e){return y.createElement(hp,ja({},t,{ref:e,sideCar:JR}))});L0.classNames=hp.classNames;var QR=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},pc=new WeakMap,Eh=new WeakMap,Mh={},Tx=0,yk=function(t){return t&&(t.host||yk(t.parentNode))},YR=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=yk(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})},XR=function(t,e,n,r){var a=YR(e,Array.isArray(t)?t:[t]);Mh[n]||(Mh[n]=new WeakMap);var i=Mh[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=(pc.get(x)||0)+1,N=(i.get(x)||0)+1;pc.set(x,w),i.set(x,N),o.push(x),w===1&&v&&Eh.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(),Tx++,function(){o.forEach(function(m){var x=pc.get(m)-1,b=i.get(m)-1;pc.set(m,x),i.set(m,b),x||(Eh.has(m)||m.removeAttribute(r),Eh.delete(m)),b||m.removeAttribute(n)}),Tx--,Tx||(pc=new WeakMap,pc=new WeakMap,Eh=new WeakMap,Mh={})}},bk=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),a=QR(t);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),XR(r,a,n,"aria-hidden")):function(){return null}},fp="Dialog",[vk]=To(fp),[ZR,oa]=vk(fp),Nk=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]=vl({prop:r,defaultProp:a??!1,onChange:i,caller:fp});return s.jsx(ZR,{scope:e,triggerRef:c,contentRef:u,contentId:mo(),titleId:mo(),descriptionId:mo(),open:h,onOpenChange:f,onOpenToggle:y.useCallback(()=>f(m=>!m),[f]),modal:o,children:n})};Nk.displayName=fp;var wk="DialogTrigger",eP=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=oa(wk,n),i=Gt(e,a.triggerRef);return s.jsx(Tt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":_0(a.open),...r,ref:i,onClick:wt(t.onClick,a.onOpenToggle)})});eP.displayName=wk;var O0="DialogPortal",[tP,jk]=vk(O0,{forceMount:void 0}),kk=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:a}=t,i=oa(O0,e);return s.jsx(tP,{scope:e,forceMount:n,children:y.Children.map(r,o=>s.jsx(bu,{present:n||i.open,children:s.jsx(P0,{asChild:!0,container:a,children:o})}))})};kk.displayName=O0;var uf="DialogOverlay",Sk=y.forwardRef((t,e)=>{const n=jk(uf,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=oa(uf,t.__scopeDialog);return i.modal?s.jsx(bu,{present:r||i.open,children:s.jsx(sP,{...a,ref:e})}):null});Sk.displayName=uf;var nP=su("DialogOverlay.RemoveScroll"),sP=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=oa(uf,n);return s.jsx(L0,{as:nP,allowPinchZoom:!0,shards:[a.contentRef],children:s.jsx(Tt.div,{"data-state":_0(a.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Nl="DialogContent",Ck=y.forwardRef((t,e)=>{const n=jk(Nl,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=oa(Nl,t.__scopeDialog);return s.jsx(bu,{present:r||i.open,children:i.modal?s.jsx(rP,{...a,ref:e}):s.jsx(aP,{...a,ref:e})})});Ck.displayName=Nl;var rP=y.forwardRef((t,e)=>{const n=oa(Nl,t.__scopeDialog),r=y.useRef(null),a=Gt(e,n.contentRef,r);return y.useEffect(()=>{const i=r.current;if(i)return bk(i)},[]),s.jsx(Tk,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:wt(t.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:wt(t.onPointerDownOutside,i=>{const o=i.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0;(o.button===2||c)&&i.preventDefault()}),onFocusOutside:wt(t.onFocusOutside,i=>i.preventDefault())})}),aP=y.forwardRef((t,e)=>{const n=oa(Nl,t.__scopeDialog),r=y.useRef(!1),a=y.useRef(!1);return s.jsx(Tk,{...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()}})}),Tk=y.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,...o}=t,c=oa(Nl,n),u=y.useRef(null),h=Gt(e,u);return dk(),s.jsxs(s.Fragment,{children:[s.jsx(R0,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:s.jsx(I0,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":_0(c.open),...o,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(iP,{titleId:c.titleId}),s.jsx(lP,{contentRef:u,descriptionId:c.descriptionId})]})]})}),D0="DialogTitle",Ek=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=oa(D0,n);return s.jsx(Tt.h2,{id:a.titleId,...r,ref:e})});Ek.displayName=D0;var Mk="DialogDescription",Ak=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=oa(Mk,n);return s.jsx(Tt.p,{id:a.descriptionId,...r,ref:e})});Ak.displayName=Mk;var Ik="DialogClose",Rk=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=oa(Ik,n);return s.jsx(Tt.button,{type:"button",...r,ref:e,onClick:wt(t.onClick,()=>a.onOpenChange(!1))})});Rk.displayName=Ik;function _0(t){return t?"open":"closed"}var Pk="DialogTitleWarning",[FV,Lk]=OI(Pk,{contentName:Nl,titleName:D0,docsSlug:"dialog"}),iP=({titleId:t})=>{const e=Lk(Pk),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},oP="DialogDescriptionWarning",lP=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Lk(oP).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},cP=Nk,dP=kk,uP=Sk,hP=Ck,fP=Ek,pP=Ak,mP=Rk;function Ft(t){return s.jsx(cP,{"data-slot":"dialog",...t})}function xP(t){return s.jsx(dP,{...t})}const Ok=y.forwardRef(({className:t,...e},n)=>s.jsx(uP,{ref:n,className:Lt("fixed inset-0 z-50 bg-black/50",t),...e}));Ok.displayName="DialogOverlay";const zt=y.forwardRef(({className:t,children:e,showCloseButton:n=!0,...r},a)=>s.jsxs(xP,{children:[s.jsx(Ok,{}),s.jsxs(hP,{ref:a,"aria-describedby":void 0,className:Lt("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(mP,{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(Jn,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));zt.displayName="DialogContent";function Bt({className:t,...e}){return s.jsx("div",{className:Lt("flex flex-col gap-2 text-center sm:text-left",t),...e})}function yn({className:t,...e}){return s.jsx("div",{className:Lt("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function Vt(t){return s.jsx(fP,{className:"text-lg font-semibold leading-none",...t})}function hf(t){return s.jsx(pP,{className:"text-sm text-muted-foreground",...t})}const gP=Gj("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?Wj:"span";return s.jsx(a,{className:Lt(gP({variant:e}),t),...r})}var yP=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],bP=yP.reduce((t,e)=>{const n=Uj(`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}},{}),vP="Label",Dk=y.forwardRef((t,e)=>s.jsx(bP.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())}}));Dk.displayName=vP;var _k=Dk;const ne=y.forwardRef(({className:t,...e},n)=>s.jsx(_k,{ref:n,className:Lt("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));ne.displayName=_k.displayName;function $0(t){const e=t+"CollectionProvider",[n,r]=To(e),[a,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=w=>{const{scope:N,children:k}=w,E=Os.useRef(null),C=Os.useRef(new Map).current;return s.jsx(a,{scope:N,itemMap:C,collectionRef:E,children:k})};o.displayName=e;const c=t+"CollectionSlot",u=su(c),h=Os.forwardRef((w,N)=>{const{scope:k,children:E}=w,C=i(c,k),R=Gt(N,C.collectionRef);return s.jsx(u,{ref:R,children:E})});h.displayName=c;const f=t+"CollectionItemSlot",m="data-radix-collection-item",x=su(f),b=Os.forwardRef((w,N)=>{const{scope:k,children:E,...C}=w,R=Os.useRef(null),L=Gt(N,R),q=i(f,k);return Os.useEffect(()=>(q.itemMap.set(R,{ref:R,...C}),()=>void q.itemMap.delete(R))),s.jsx(x,{[m]:"",ref:L,children:E})});b.displayName=f;function v(w){const N=i(t+"CollectionConsumer",w);return Os.useCallback(()=>{const E=N.collectionRef.current;if(!E)return[];const C=Array.from(E.querySelectorAll(`[${m}]`));return Array.from(N.itemMap.values()).sort((q,_)=>C.indexOf(q.ref.current)-C.indexOf(_.ref.current))},[N.collectionRef,N.itemMap])}return[{Provider:o,Slot:h,ItemSlot:b},v,r]}var NP=y.createContext(void 0);function pp(t){const e=y.useContext(NP);return t||e||"ltr"}var Ex="rovingFocusGroup.onEntryFocus",wP={bubbles:!1,cancelable:!0},vu="RovingFocusGroup",[Cg,$k,jP]=$0(vu),[kP,zk]=To(vu,[jP]),[SP,CP]=kP(vu),Fk=y.forwardRef((t,e)=>s.jsx(Cg.Provider,{scope:t.__scopeRovingFocusGroup,children:s.jsx(Cg.Slot,{scope:t.__scopeRovingFocusGroup,children:s.jsx(TP,{...t,ref:e})})}));Fk.displayName=vu;var TP=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=Gt(e,x),v=pp(i),[w,N]=vl({prop:o,defaultProp:c??null,onChange:u,caller:vu}),[k,E]=y.useState(!1),C=vo(h),R=$k(n),L=y.useRef(!1),[q,_]=y.useState(0);return y.useEffect(()=>{const H=x.current;if(H)return H.addEventListener(Ex,C),()=>H.removeEventListener(Ex,C)},[C]),s.jsx(SP,{scope:n,orientation:r,dir:v,loop:a,currentTabStopId:w,onItemFocus:y.useCallback(H=>N(H),[N]),onItemShiftTab:y.useCallback(()=>E(!0),[]),onFocusableItemAdd:y.useCallback(()=>_(H=>H+1),[]),onFocusableItemRemove:y.useCallback(()=>_(H=>H-1),[]),children:s.jsx(Tt.div,{tabIndex:k||q===0?-1:0,"data-orientation":r,...m,ref:b,style:{outline:"none",...t.style},onMouseDown:wt(t.onMouseDown,()=>{L.current=!0}),onFocus:wt(t.onFocus,H=>{const P=!L.current;if(H.target===H.currentTarget&&P&&!k){const se=new CustomEvent(Ex,wP);if(H.currentTarget.dispatchEvent(se),!se.defaultPrevented){const Y=R().filter(I=>I.focusable),V=Y.find(I=>I.active),ae=Y.find(I=>I.id===w),de=[V,ae,...Y].filter(Boolean).map(I=>I.ref.current);Hk(de,f)}}L.current=!1}),onBlur:wt(t.onBlur,()=>E(!1))})})}),Bk="RovingFocusGroupItem",Vk=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:i,children:o,...c}=t,u=mo(),h=i||u,f=CP(Bk,n),m=f.currentTabStopId===h,x=$k(n),{onFocusableItemAdd:b,onFocusableItemRemove:v,currentTabStopId:w}=f;return y.useEffect(()=>{if(r)return b(),()=>v()},[r,b,v]),s.jsx(Cg.ItemSlot,{scope:n,id:h,focusable:r,active:a,children:s.jsx(Tt.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:wt(t.onMouseDown,N=>{r?f.onItemFocus(h):N.preventDefault()}),onFocus:wt(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:wt(t.onKeyDown,N=>{if(N.key==="Tab"&&N.shiftKey){f.onItemShiftTab();return}if(N.target!==N.currentTarget)return;const k=AP(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(R=>R.focusable).map(R=>R.ref.current);if(k==="last")C.reverse();else if(k==="prev"||k==="next"){k==="prev"&&C.reverse();const R=C.indexOf(N.currentTarget);C=f.loop?IP(C,R+1):C.slice(R+1)}setTimeout(()=>Hk(C))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:w!=null}):o})})});Vk.displayName=Bk;var EP={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function MP(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function AP(t,e,n){const r=MP(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return EP[r]}function Hk(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function IP(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var RP=Fk,PP=Vk,mp="Tabs",[LP]=To(mp,[zk]),Uk=zk(),[OP,z0]=LP(mp),Wk=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:i,orientation:o="horizontal",dir:c,activationMode:u="automatic",...h}=t,f=pp(c),[m,x]=vl({prop:r,onChange:a,defaultProp:i??"",caller:mp});return s.jsx(OP,{scope:n,baseId:mo(),value:m,onValueChange:x,orientation:o,dir:f,activationMode:u,children:s.jsx(Tt.div,{dir:f,"data-orientation":o,...h,ref:e})})});Wk.displayName=mp;var Kk="TabsList",qk=y.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...a}=t,i=z0(Kk,n),o=Uk(n);return s.jsx(RP,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:s.jsx(Tt.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:e})})});qk.displayName=Kk;var Gk="TabsTrigger",Jk=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...i}=t,o=z0(Gk,n),c=Uk(n),u=Xk(o.baseId,r),h=Zk(o.baseId,r),f=r===o.value;return s.jsx(PP,{asChild:!0,...c,focusable:!a,active:f,children:s.jsx(Tt.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:wt(t.onMouseDown,m=>{!a&&m.button===0&&m.ctrlKey===!1?o.onValueChange(r):m.preventDefault()}),onKeyDown:wt(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&o.onValueChange(r)}),onFocus:wt(t.onFocus,()=>{const m=o.activationMode!=="manual";!f&&!a&&m&&o.onValueChange(r)})})})});Jk.displayName=Gk;var Qk="TabsContent",Yk=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:a,children:i,...o}=t,c=z0(Qk,n),u=Xk(c.baseId,r),h=Zk(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(bu,{present:a||f,children:({present:x})=>s.jsx(Tt.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})})});Yk.displayName=Qk;function Xk(t,e){return`${t}-trigger-${e}`}function Zk(t,e){return`${t}-content-${e}`}var DP=Wk,e2=qk,t2=Jk,n2=Yk;const Oc=DP,wl=y.forwardRef(({className:t,...e},n)=>s.jsx(e2,{ref:n,className:Lt("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));wl.displayName=e2.displayName;const tn=y.forwardRef(({className:t,...e},n)=>s.jsx(t2,{ref:n,className:Lt("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...e}));tn.displayName=t2.displayName;const nn=y.forwardRef(({className:t,...e},n)=>s.jsx(n2,{ref:n,className:Lt("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));nn.displayName=n2.displayName;function F0(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 B0(t){const[e,n]=y.useState(void 0);return js(()=>{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 xp="Switch",[_P]=To(xp),[$P,zP]=_P(xp),s2=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=Gt(e,C=>b(C)),w=y.useRef(!1),N=x?f||!!x.closest("form"):!0,[k,E]=vl({prop:a,defaultProp:i??!1,onChange:h,caller:xp});return s.jsxs($P,{scope:n,checked:k,disabled:c,children:[s.jsx(Tt.button,{type:"button",role:"switch","aria-checked":k,"aria-required":o,"data-state":o2(k),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:v,onClick:wt(t.onClick,C=>{E(R=>!R),N&&(w.current=C.isPropagationStopped(),w.current||C.stopPropagation())})}),N&&s.jsx(i2,{control:x,bubbles:!w.current,name:r,value:u,checked:k,required:o,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});s2.displayName=xp;var r2="SwitchThumb",a2=y.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,a=zP(r2,n);return s.jsx(Tt.span,{"data-state":o2(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:e})});a2.displayName=r2;var FP="SwitchBubbleInput",i2=y.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...a},i)=>{const o=y.useRef(null),c=Gt(o,i),u=F0(n),h=B0(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}})});i2.displayName=FP;function o2(t){return t?"checked":"unchecked"}var l2=s2,BP=a2;const Ht=y.forwardRef(({className:t,...e},n)=>s.jsx(l2,{className:Lt("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(BP,{className:Lt("pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Ht.displayName=l2.displayName;const VP={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 HP(t){return VP[t]||t||"行为"}function UP(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 V0({open:t,onClose:e,userId:n,onUserUpdated:r}){var Oa,nr,Ts,sr,br,Es;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),[E,C]=y.useState(!1),[R,L]=y.useState(!1),[q,_]=y.useState("info"),[H,P]=y.useState(""),[se,Y]=y.useState(""),[V,ae]=y.useState(""),[le,de]=y.useState([]),[I,G]=y.useState(""),[z,me]=y.useState(""),[X,F]=y.useState(""),[U,fe]=y.useState(!1),[he,oe]=y.useState({isVip:!1,vipExpireDate:"",vipRole:"",vipName:"",vipProject:"",vipContact:"",vipBio:""}),[O,K]=y.useState([]),[D,J]=y.useState(!1),[te,be]=y.useState(""),[ze,Ke]=y.useState(""),[Nt,yt]=y.useState(!1),[Dt,Rt]=y.useState(!1),[Pn,vn]=y.useState(null),[Ut,Zt]=y.useState(null),[Cn,zn]=y.useState(""),[Un,It]=y.useState(""),[xn,Nn]=y.useState(""),[we,Te]=y.useState(!1),[Ue,rt]=y.useState(null),[Mt,kt]=y.useState(!1),[$,Ie]=y.useState({}),[vt,Pt]=y.useState([]);y.useEffect(()=>{t&&n&&(kt(!1),_("info"),vn(null),Zt(null),rt(null),me(""),F(""),ot(),Oe("/api/db/vip-roles").then(ie=>{ie!=null&&ie.success&&ie.data&&K(ie.data)}).catch(()=>{}))},[t,n]),y.useEffect(()=>{t&&Oe("/api/admin/mbti-avatars").then(ie=>{ie!=null&&ie.avatars&&typeof ie.avatars=="object"?Ie(ie.avatars):Ie({})}).catch(()=>Ie({}))},[t]);const bt=(ie,ve)=>{const Qe=(ie||"").trim();if(Qe)return Ea(Qe);const pt=(ve||"").trim().toUpperCase();return/^[EI][NS][FT][JP]$/.test(pt)?($[pt]||"").trim():""};async function ot(){if(n){k(!0);try{const ie=await Oe(`/api/db/users?id=${encodeURIComponent(n)}`);if(ie!=null&&ie.success&&ie.user){const ve=ie.user;i(ve),P(ve.phone||""),Y(ve.wechatId||""),ae(ve.nickname||""),zn(ve.phone||""),It(ve.wechatId||""),Nn(ve.openId||"");try{de(typeof ve.tags=="string"?JSON.parse(ve.tags||"[]"):[])}catch{de([])}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 Qe=ve.tracks||[];c(Qe.map(pt=>({...pt,actionLabel:pt.actionLabel||pt.action,timeAgo:pt.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?Pt(ve.orders):Pt([])}catch{Pt([])}}catch(ie){console.error("Load user detail error:",ie)}finally{k(!1)}}}async function _t(){if(!(a!=null&&a.phone)){Z.info("用户未绑定手机号,无法同步");return}C(!0);try{const ie=await Ct("/api/ckb/sync",{action:"full_sync",phone:a.phone,userId:a.id});ie!=null&&ie.success?(Z.success("同步成功"),ot()):Z.error("同步失败: "+(ie==null?void 0:ie.error))}catch(ie){console.error("Sync CKB error:",ie),Z.error("同步失败")}finally{C(!1)}}async function Jt(){if(a){if(he.isVip&&!he.vipExpireDate.trim()){Z.error("开启 VIP 请填写有效到期日");return}L(!0);try{const ie={id:a.id,phone:H.trim()||void 0,wechatId:se.trim(),nickname:V||void 0,tags:JSON.stringify(le),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},ve=await Yt("/api/db/users",ie);ve!=null&&ve.success?(Z.success("保存成功"),ot(),r==null||r()):Z.error("保存失败: "+(ve==null?void 0:ve.error))}catch(ie){console.error("Save user error:",ie),Z.error("保存失败")}finally{L(!1)}}}const an=()=>{I&&!le.includes(I)&&(de([...le,I]),G(""))},rs=ie=>de(le.filter(ve=>ve!==ie));async function tr(){if(a){if(!z){Z.error("请输入新密码");return}if(z!==X){Z.error("两次密码不一致");return}if(z.length<6){Z.error("密码至少 6 位");return}fe(!0);try{const ie=await Yt("/api/db/users",{id:a.id,password:z});ie!=null&&ie.success?(Z.success("修改成功"),me(""),F("")):Z.error("修改失败: "+((ie==null?void 0:ie.error)||""))}catch{Z.error("修改失败")}finally{fe(!1)}}}async function wi(){if(!a)return;const ie=parseFloat(te);if(Number.isNaN(ie)||ie===0){Z.error("请输入有效金额(正数增加、负数扣减)");return}yt(!0);try{const ve=await Ct(`/api/admin/users/${a.id}/balance/adjust`,{amount:ie,remark:ze||void 0});ve!=null&&ve.success?(Z.success("余额已调整"),J(!1),be(""),Ke(""),ot(),r==null||r()):Z.error("调整失败: "+((ve==null?void 0:ve.error)||""))}catch{Z.error("调整失败")}finally{yt(!1)}}async function ca(){if(!Cn&&!xn&&!Un){Zt("请至少输入手机号、微信号或 OpenID 中的一项");return}Rt(!0),Zt(null),vn(null);try{const ie=new URLSearchParams;Cn&&ie.set("phone",Cn),xn&&ie.set("openId",xn),Un&&ie.set("wechatId",Un);const ve=await Oe(`/api/admin/shensheshou/query?${ie}`);ve!=null&&ve.success&&ve.data?(vn(ve.data),a&&await da(ve.data)):Zt((ve==null?void 0:ve.error)||"未查询到数据,该用户可能未在神射手收录")}catch(ie){console.error("SSS query error:",ie),Zt("请求失败,请检查神射手接口配置")}finally{Rt(!1)}}async function da(ie){if(a)try{await Ct("/api/admin/shensheshou/enrich",{userId:a.id,phone:Cn||a.phone||"",openId:xn||a.openId||"",wechatId:Un||a.wechatId||""}),ot()}catch(ve){console.error("SSS enrich error:",ve)}}async function $r(){if(a){Te(!0),rt(null);try{const ie=Array.from(new Set(o.filter($s=>$s.action==="view_chapter"||$s.action==="purchase"||$s.action==="first_pay").map($s=>($s.chapterTitle||$s.target||"").trim()).filter(Boolean))).slice(0,12),ve={viewChapter:u.view_chapter||0,purchase:u.purchase||0,firstPay:u.first_pay||0},Qe=ie.length>0?`意向章节:${ie.join("、")}`:"",pt={users:[{phone:a.phone||"",name:a.nickname||"",openId:a.openId||"",tags:le,purchaseIntent:ve,purchaseIntentChapters:ie,remark:Qe}]},Wn=await Ct("/api/admin/shensheshou/ingest",pt);Wn!=null&&Wn.success&&Wn.data?rt(Wn.data):rt({error:(Wn==null?void 0:Wn.error)||"推送失败"})}catch(ie){console.error("SSS ingest error:",ie),rt({error:"请求失败"})}finally{Te(!1)}}}const zr=ie=>{const Qe={view_chapter:Zs,purchase:Vd,match:Dn,login:di,register:di,share:ka,bind_phone:v1,bind_wechat:kM,fill_profile:Hd,fill_avatar:di,visit_page:na,first_pay:Vd,vip_activate:Ec,click_super:Dn,lead_submit:v1,withdraw:vg,referral_bind:ka,card_click:di,btn_click:gi,tab_click:na,nav_click:na,page_view:na,search:na}[ie]||gg;return s.jsx(Qe,{className:"w-4 h-4"})};function Fr(ie){const ve=String(ie||"").trim();return ve.length>22&&/^[a-zA-Z0-9_-]+$/.test(ve)}const gr=y.useMemo(()=>UP(u,a),[u,a]);function yr(){const ie=[...le];for(const ve of gr)ie.includes(ve)||ie.push(ve);de(ie),Z.success("已将旅程推断标签合并到已选")}return t?s.jsxs(s.Fragment,{children:[s.jsx(Ft,{open:t,onOpenChange:()=>e(),children:s.jsxs(zt,{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(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(di,{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:bt(a.avatar,a.mbti)&&!Mt?s.jsx("img",{src:bt(a.avatar,a.mbti),className:"w-full h-full rounded-full object-cover",alt:"",onError:()=>kt(!0)}):((Oa=a.nickname)==null?void 0:Oa.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(Q,{type:"button",size:"sm",variant:"ghost",className:"h-5 px-1 text-[9px] text-[#38bdac] hover:bg-[#38bdac]/10",onClick:()=>{be(""),Ke(""),J(!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(Oc,{value:q,onValueChange:_,className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[s.jsxs(wl,{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(tn,{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(tn,{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(na,{className:"w-3 h-3 mr-0.5"}),"旅程与轨迹"]}),s.jsx(tn,{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(tn,{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(nn,{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:ie=>ae(ie.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:ie=>P(ie.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:ie=>Y(ie.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(Bj,{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(Ec,{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(Ht,{className:"scale-90",checked:he.isVip,onCheckedChange:ie=>oe(ve=>({...ve,isVip:ie}))})]}),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(ce,{type:"date",className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",value:he.vipExpireDate,onChange:ie=>oe(ve=>({...ve,vipExpireDate:ie.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:ie=>oe(ve=>({...ve,vipRole:ie.target.value})),children:[s.jsx("option",{value:"",children:"请选择"}),O.map(ie=>s.jsx("option",{value:ie.name,children:ie.name},ie.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:he.vipName,onChange:ie=>oe(ve=>({...ve,vipName:ie.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:he.vipProject,onChange:ie=>oe(ve=>({...ve,vipProject:ie.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:he.vipContact,onChange:ie=>oe(ve=>({...ve,vipContact:ie.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:he.vipBio,onChange:ie=>oe(ve=>({...ve,vipBio:ie.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(gi,{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:Cn,onChange:ie=>zn(ie.target.value)}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:微信号",value:Un,onChange:ie=>It(ie.target.value)}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:OpenID",value:xn,onChange:ie=>Nn(ie.target.value)})]}),s.jsxs("div",{className:"flex flex-wrap gap-1",children:[s.jsxs(Q,{size:"sm",className:"h-7 text-[11px] px-2 bg-[#38bdac] hover:bg-[#2da396]",onClick:ca,disabled:Dt,children:[Dt?s.jsx(Ve,{className:"w-3 h-3 animate-spin"}):s.jsx(Ca,{className:"w-3 h-3 mr-0.5"}),"查询回填"]}),s.jsx(Q,{size:"sm",variant:"outline",className:"h-7 text-[11px] px-2 border-purple-500/40 text-purple-300",onClick:$r,disabled:we||!a.phone,children:we?"推送…":"推神射手"}),s.jsx(Q,{size:"sm",variant:"outline",className:"h-7 text-[11px] px-2",onClick:_t,disabled:E||!a.phone,children:E?"同步…":"存客宝同步"})]}),a.ckbSyncedAt&&s.jsxs("p",{className:"text-[10px] text-gray-500 mt-1",children:["最近存客宝同步:",new Date(a.ckbSyncedAt).toLocaleString()]}),Ut&&s.jsx("p",{className:"mt-1 text-red-400 text-[11px]",children:Ut}),Pn&&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:Pn.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:Pn.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(vg,{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:z,onChange:ie=>me(ie.target.value)}),s.jsx(ce,{type:"password",className:"bg-[#162840] border-gray-700 text-white h-7 text-xs flex-1",placeholder:"确认密码",value:X,onChange:ie=>F(ie.target.value)}),s.jsx(Q,{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:tr,disabled:U||!z||!X,children:U?"保存中":"确认修改"})]})]})]}),s.jsxs(nn,{value:"journey",className:"flex-1 min-h-0 overflow-y-auto space-y-2 pr-0.5",children:[vt.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(Vd,{className:"w-3.5 h-3.5 text-amber-400"}),s.jsxs("span",{className:"text-white text-xs font-medium",children:["购买清单(",vt.length," 笔)"]})]}),s.jsx("div",{className:"space-y-1 max-h-[120px] overflow-y-auto",children:vt.map((ie,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:ie.productType==="fullbook"||ie.productType==="vip"?"全书/VIP":`章节 ${ie.productId||""}`}),s.jsxs("span",{className:"text-gray-500 ml-2",children:["¥",Number(ie.amount||0).toFixed(2)]})]}),s.jsx("span",{className:"text-gray-500 text-[10px] shrink-0",children:ie.createdAt?new Date(ie.createdAt).toLocaleString("zh-CN"):""})]},ie.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(na,{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((ie,ve)=>ve[1]-ie[1]).map(([ie,ve])=>s.jsxs(He,{variant:"outline",className:"text-[10px] border-gray-600 text-gray-300 bg-[#162840] py-0 h-5",children:[HP(ie)," ×",ve]},ie))})]}),s.jsx("div",{className:"space-y-1.5",children:o.length>0?o.map((ie,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:zr(ie.action)}),ve0?((x==null?void 0:x.visits)||[]).map((ie,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:["第 ",ie.seq||ve+1," 次 · ",ie.referrerNickname||"微信用户",ie.referrerId?`(${ie.referrerId})`:""]}),ie.page?s.jsx("p",{className:"text-gray-500 text-[10px] truncate",children:ie.page}):null]}),s.jsx("span",{className:"text-gray-500 text-[10px] shrink-0",children:ie.visitedAt?new Date(ie.visitedAt).toLocaleString():""})]},`${ie.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(ka,{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((ie,ve)=>{var pt;const Qe=ie;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:((pt=Qe.nickname)==null?void 0:pt.charAt(0))||"?"}),s.jsx("span",{className:"text-white truncate",children:Qe.nickname})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[Qe.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:Qe.createdAt?new Date(Qe.createdAt).toLocaleDateString():""})]})]},Qe.id||ve)}):s.jsx("p",{className:"text-gray-500 text-sm text-center py-3",children:"暂无推荐用户"})})]})]}),s.jsxs(nn,{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(Hd,{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(Lj,{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(Q,{type:"button",size:"sm",variant:"outline",className:"h-7 text-[11px] border-cyan-500/40 text-cyan-200 hover:bg-cyan-500/10",disabled:gr.length===0,onClick:yr,children:"合并到已选"})]}),gr.length>0?s.jsx("div",{className:"flex flex-wrap gap-1",children:gr.map(ie=>s.jsxs(He,{variant:"outline",className:`text-[10px] py-0 h-5 border-cyan-500/30 ${le.includes(ie)?"bg-cyan-500/15 text-cyan-200":"text-gray-300"}`,children:[le.includes(ie)?"✓ ":"",ie]},ie))}):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(ie=>s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-[11px] mb-1",children:ie.category}),s.jsx("div",{className:"flex flex-wrap gap-1",children:ie.tags.map(ve=>s.jsxs("button",{type:"button",onClick:()=>{le.includes(ve)?rs(ve):de([...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))})]},ie.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((ie,ve)=>s.jsxs(He,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1 text-[11px] py-0",children:[ie,s.jsx("button",{type:"button",onClick:()=>rs(ie),className:"ml-1 hover:text-red-400",children:s.jsx(Jn,{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:ie=>G(ie.target.value),onKeyDown:ie=>ie.key==="Enter"&&an()}),s.jsx(Q,{onClick:an,className:"bg-[#38bdac] hover:bg-[#2da396] h-8 text-xs px-3",children:"添加"})]})]})]}),(()=>{const ie=a.tags||a.ckbTags||"";let ve=[];try{const pt=typeof ie=="string"?JSON.parse(ie||"[]"):[];ve=Array.isArray(pt)?pt:typeof ie=="string"?ie.split(","):[]}catch{ve=typeof ie=="string"?ie.split(","):[]}const Qe=ve.map(pt=>String(pt).trim()).filter(Boolean);return Qe.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(Hd,{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:Qe.map((pt,Wn)=>s.jsx(He,{className:"bg-purple-500/20 text-purple-400 border-0 text-[11px] py-0",children:pt},Wn))})]})})()]})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-gray-700 mt-3 shrink-0",children:[s.jsxs(Q,{variant:"outline",onClick:e,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Jn,{className:"w-4 h-4 mr-2"}),"关闭"]}),s.jsxs(Q,{onClick:Jt,disabled:R,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),R?"保存中...":"保存修改"]})]})]}):s.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}),s.jsx(Ft,{open:D,onOpenChange:J,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsx(Bt,{children:s.jsx(Vt,{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:ie=>be(ie.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:ze,onChange:ie=>Ke(ie.target.value)})]})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(Q,{variant:"outline",onClick:()=>J(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(Q,{onClick:wi,disabled:Nt,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:Nt?"提交中...":"确认调整"})]})]})})]}):null}function WP(){const t=Ra(),[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,E]=y.useState(0),[C,R]=y.useState(null),[L,q]=y.useState(null),[_,H]=y.useState(!1),[P,se]=y.useState(0),[Y,V]=y.useState(!1),[ae,le]=y.useState(null),[de,I]=y.useState("overview"),[G,z]=y.useState([]),[me,X]=y.useState(!1),[F,U]=y.useState("today"),[fe,he]=y.useState(null),[oe,O]=y.useState(!1),[K,D]=y.useState(!0),[J,te]=y.useState(null),[be,ze]=y.useState(null),[Ke,Nt]=y.useState([]),yt=we=>{const Te=we;if((Te==null?void 0:Te.status)===401)R("登录已过期,请重新登录");else{if((Te==null?void 0:Te.name)==="AbortError")return;R("加载失败,请检查网络或联系管理员")}};async function Dt(we){var Mt,kt;const Te=we?{signal:we}:void 0;n(!0),R(null);try{const $=await Oe("/api/admin/dashboard/stats",Te);$!=null&&$.success&&(x($.totalUsers??0),v($.paidOrderCount??0),N($.totalRevenue??0),E($.conversionRate??0))}catch($){if(($==null?void 0:$.name)!=="AbortError"){console.error("stats 失败,尝试 overview 降级",$);try{const Ie=await Oe("/api/admin/dashboard/overview",Te);Ie!=null&&Ie.success&&(x(Ie.totalUsers??0),v(Ie.paidOrderCount??0),N(Ie.totalRevenue??0),E(Ie.conversionRate??0))}catch(Ie){yt(Ie)}}}finally{n(!1)}try{const $=await Oe("/api/admin/balance/summary",Te);$!=null&&$.success&&$.data&&se($.data.totalGifted??0)}catch{}try{const $=await Oe("/api/db/ckb-plan-stats",Te);$!=null&&$.success&&$.data?le({ckbTotal:$.data.ckbTotal??0,withContact:$.data.withContact??0}):le(null)}catch{le(null)}D(!0);try{const[$,Ie]=await Promise.allSettled([Oe("/api/db/match-records?stats=true",Te),Oe("/api/admin/distribution/overview",Te)]);$.status==="fulfilled"&&((Mt=$.value)!=null&&Mt.success)&&$.value.data?te({totalMatches:$.value.data.totalMatches??0,todayMatches:$.value.data.todayMatches??0,uniqueUsers:$.value.data.uniqueUsers??0,paidMatchCount:$.value.data.paidMatchCount??0}):te(null),Ie.status==="fulfilled"&&((kt=Ie.value)!=null&&kt.success)&&Ie.value.overview?ze({todayClicks:Ie.value.overview.todayClicks??0,todayBindings:Ie.value.overview.todayBindings??0,todayConversions:Ie.value.overview.todayConversions??0,monthClicks:Ie.value.overview.monthClicks??0,monthBindings:Ie.value.overview.monthBindings??0,monthConversions:Ie.value.overview.monthConversions??0,totalClicks:Ie.value.overview.totalClicks??0,totalBindings:Ie.value.overview.totalBindings??0,totalConversions:Ie.value.overview.totalConversions??0,conversionRate:Ie.value.overview.conversionRate}):ze(null)}catch{te(null),ze(null)}finally{D(!1)}try{const $=await Oe("/api/db/vip-members?limit=500",Te);$!=null&&$.success&&Array.isArray($.data)?Nt($.data):Nt([])}catch{Nt([])}a(!0),o(!0);const Ue=async()=>{try{const $=await Oe("/api/admin/dashboard/recent-orders?limit=10",Te);if($!=null&&$.success&&$.recentOrders)f($.recentOrders);else throw new Error("no data")}catch($){if(($==null?void 0:$.name)!=="AbortError")try{const Ie=await Oe("/api/admin/orders?page=1&pageSize=20&status=paid",Te),Pt=((Ie==null?void 0:Ie.orders)??[]).filter(bt=>["paid","completed","success"].includes(bt.status||""));f(Pt.slice(0,5))}catch{f([])}}finally{a(!1)}},rt=async()=>{try{const $=await Oe("/api/admin/dashboard/new-users",Te);if($!=null&&$.success&&$.newUsers)u($.newUsers);else throw new Error("no data")}catch($){if(($==null?void 0:$.name)!=="AbortError")try{const Ie=await Oe("/api/db/users?page=1&pageSize=10",Te);u((Ie==null?void 0:Ie.users)??[])}catch{u([])}}finally{o(!1)}};await Promise.all([Ue(),rt()])}async function Rt(we){const Te=we||F;O(!0);try{const Ue=await Oe(`/api/admin/track/stats?period=${Te}`);Ue!=null&&Ue.success&&he({total:Ue.total??0,byModule:Ue.byModule??{}})}catch{he(null)}finally{O(!1)}}const Pn={home:"首页",chapters:"目录",read:"阅读页",my:"我的",vip:"超级个体",wallet:"钱包",match:"找伙伴",referral:"推广中心",search:"搜索",settings:"设置",about:"关于",member_detail:"成员详情",other:"其他"},vn={btn_click:"按钮点击",nav_click:"导航点击",card_click:"卡片点击",tab_click:"标签切换",page_view:"页面浏览",share:"分享",purchase:"购买",register:"注册",rule_trigger:"规则触发",view_chapter:"浏览章节",link_click:"链接点击"},Ut=we=>we?we.replace(/^part-/,"").replace(/^soulvip_/,"").replace(/^super_?/,"").replace(/^user_/,"").replace(/[_-]+/g," ").trim():"",Zt=we=>{if(!we)return"";const Te=we.trim().toLowerCase();if(!Te)return"";const Ue=Ke.find(Mt=>{const kt=String(Mt.id||"").toLowerCase();return kt===Te||kt.includes(Te)||Te.includes(kt)});if(Ue)return Ue.name||Ue.nickname||"";const rt=Ke.find(Mt=>{const kt=String(Mt.token||"").toLowerCase();return kt&&(kt===Te||kt.includes(Te)||Te.includes(kt))});return rt&&(rt.name||rt.nickname)||""},Cn=we=>{if(!we)return"未命名点击";const Te=we.trim(),Ue=Te.toLowerCase();if(/^链接头像[_-]/.test(Te)){const Mt=Ut(Te.replace(/^链接头像[_-]/,""));return Mt?`头像:${Mt}`:"头像点击"}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`章节:${Ut(Te)}`;if(Ue.includes("soulvip")||Ue.includes("super")){const Mt=Te.replace(/^超级个体[::]?/i,"").replace(/^super[_-]?/i,"").replace(/^soulvip[_-]?/i,"").replace(/^user[_-]?/i,"").trim(),kt=Zt(Mt)||Zt(Ut(Mt));return kt?`超级个体:${kt}`:`超级个体:${Ut(Mt)}`}if(Ue.includes("qgdtw")||Ue.includes("token")||Ue.includes("0000"))return`对象:${Ut(Te)}`;const rt={开始匹配:"开始匹配",mentor:"导师顾问",team:"团队招募",investor:"资源对接",充值:"充值",退款:"退款",wallet:"钱包",设置:"设置",VIP:"VIP会员",推广:"推广中心",目录:"目录",搜索:"搜索",匹配:"找伙伴",settings:"设置",expired:"已过期",active:"活跃",converted:"已转化",fill_profile:"完善资料",register:"注册",purchase:"购买",链接卡若:"链接卡若",更多分享:"更多分享",分享朋友圈文案:"分享朋友圈",选择金额10:"选择金额10元",member_detail:"成员详情",giftPay:"代付入口"};return rt[Te]?rt[Te]:/^[a-z0-9_-]+$/i.test(Te)&&Ut(Te)||Te},zn=we=>{const Te=Pn[we.module]||Pn[we.page]||we.module||we.page||"其他",Ue=vn[we.action]||we.action||"点击",rt=Cn(we.target);return`${Te} · ${Ue} · ${rt}`};async function Un(){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 Dt(we.signal),Rt(),Un(),()=>{we.abort()}},[]);const It=m,xn=we=>{const Te=we.productType||"",Ue=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 rt=typeof we.amount=="number"?we.amount.toFixed(2):parseFloat(String(we.amount||"0")).toFixed(2);return{title:Ue||`代付分享 ¥${rt}`,subtitle:"代付分享"}}if(Te==="section"&&Ue.includes("代付领取"))return{title:Ue.replace("代付领取 - ",""),subtitle:"代付领取"};if(Ue){if(Te==="section"&&Ue.includes("章节")){if(Ue.includes("-")){const rt=Ue.split("-");if(rt.length>=3)return{title:`第${rt[1]}章 第${rt[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:`章节 ${we.productId||""}`,subtitle:"单章购买"}:Te==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:Te==="vip"?{title:"超级个体开通费用",subtitle:"超级个体"}:Te==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:Te||"其他"}},Nn=[{title:"总用户数",value:e?null:It,sub:null,icon:Dn,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:e?null:`¥${(w??0).toFixed(2)}`,sub:P>0?`含代付 ¥${P.toFixed(2)}`:null,icon:of,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:e?null:b,sub:null,icon:Vd,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:Zs,color:"text-orange-400",bg:"bg-orange-500/20",link:"/distribution"},{title:"存客宝获客",value:ae?ae.ckbTotal??0:null,sub:(ae==null?void 0:ae.withContact)!=null?`含联系方式 ${ae.withContact} 人`:null,icon:Cc,color:"text-cyan-400",bg:"bg-cyan-500/20",link:"/users?tab=leads"},{title:"伙伴&推广协同",value:K?null:((J==null?void 0:J.totalMatches)??0)+((be==null?void 0:be.totalClicks)??0),sub:K?null:`找伙伴 ${(J==null?void 0:J.totalMatches)??0} / 推广 ${(be==null?void 0:be.totalClicks)??0}`,icon:yc,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:()=>Dt(),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:Nn.map((we,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:()=>we.link&&t(we.link),children:[s.jsxs(dt,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsx(ut,{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(Ve,{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(ol,{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 ${de==="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 ${de==="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 ${de==="super"?"bg-[#38bdac] text-white":"bg-[#0f2137] text-gray-400 hover:text-white hover:bg-gray-700/50 border border-gray-700/50"}`,children:"超级个体统计"})]}),de==="overview"&&s.jsxs("div",{className:"space-y-8",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{className:"flex flex-row items-center justify-between",children:[s.jsx(ut,{className:"text-white",children:"找伙伴 × 推广中心(共统计)"}),s.jsxs("button",{type:"button",onClick:()=>Dt(),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($e,{children:[K&&!J&&!be?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:(J==null?void 0:J.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:(J==null?void 0:J.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:(J==null?void 0:J.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:(be==null?void 0:be.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:(be==null?void 0:be.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:(be==null?void 0:be.totalConversions)??0})]})]}),(be==null?void 0:be.conversionRate)&&s.jsxs("p",{className:"text-xs text-gray-500 mt-3",children:["推广转化率:",be.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(dt,{className:"flex flex-row items-center justify-between",children:[s.jsx(ut,{className:"text-white",children:"最近订单"}),s.jsxs("button",{type:"button",onClick:()=>Dt(),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($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(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,Y?10:4).map(we=>{var kt;const Te=we.referrerId?c.find($=>$.id===we.referrerId):void 0,Ue=we.referralCode||(Te==null?void 0:Te.referralCode)||(Te==null?void 0:Te.nickname)||(we.referrerId?String(we.referrerId).slice(0,8):""),rt=xn(we),Mt=we.userNickname||((kt=c.find($=>$.id===we.userId))==null?void 0:kt.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:Mt,className:"w-9 h-9 rounded-full object-cover shrink-0 mt-0.5",onError:$=>{$.currentTarget.style.display="none";const Ie=$.currentTarget.nextElementSibling;Ie&&Ie.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:Mt.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&&(q(we.userId),H(!0))},className:"text-sm text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:Mt}),s.jsx("span",{className:"text-gray-600",children:"·"}),s.jsx("span",{className:"text-sm font-medium text-white truncate",title:rt.title,children:rt.title})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[rt.subtitle&&rt.subtitle!=="章节购买"&&s.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:rt.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"})})]}),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(we.amount).toFixed(2)]}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:we.paymentMethod||"微信"})]})]},we.id)}),h.length>4&&!Y&&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(Vd,{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(dt,{children:s.jsx(ut,{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(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(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:()=>{q(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:"暂无用户数据"})]})})})]})]})]}),de==="tags"&&s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{className:"flex flex-row items-center justify-between",children:[s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(yc,{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:()=>{U(we),Rt(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(Ve,{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((Ue,rt)=>Ue+rt.count,0)-we[1].reduce((Ue,rt)=>Ue+rt.count,0)).slice(0,5).map(([we,Te])=>{const Ue=Te.reduce((rt,Mt)=>rt+Mt.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:Pn[we]||we}),s.jsxs("span",{className:"text-xs text-gray-500",children:[Ue," 次"]})]}),s.jsx("div",{className:"space-y-2",children:Te.sort((rt,Mt)=>Mt.count-rt.count).slice(0,8).map((rt,Mt)=>{const kt=zn(rt);return s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-gray-300 truncate mr-2",title:kt,children:kt}),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?rt.count/Ue*100:0}%`}})}),s.jsx("span",{className:"text-gray-400 w-8 text-right",children:rt.count})]})]},Mt)})})]},we)})})]}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(yc,{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:"小程序端接入埋点后,数据将在此实时展示"})]})})]}),de==="super"&&s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{className:"flex flex-row items-center justify-between",children:[s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(yc,{className:"w-5 h-5 text-amber-400"}),"超级个体点击统计"]}),s.jsxs(Q,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-300 h-8",onClick:Un,disabled:me,children:[s.jsx(Ve,{className:`w-3.5 h-3.5 mr-1 ${me?"animate-spin":""}`}),"刷新"]})]}),s.jsx($e,{children:me&&G.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:"加载中..."})]}):G.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:G.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(yc,{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(V0,{open:_,onClose:()=>{H(!1),q(null)},userId:L,onUserUpdated:()=>Dt()})]})}const hs=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{className:"relative w-full overflow-auto",children:s.jsx("table",{ref:n,className:Lt("w-full caption-bottom text-sm",t),...e})}));hs.displayName="Table";const fs=y.forwardRef(({className:t,...e},n)=>s.jsx("thead",{ref:n,className:Lt("[&_tr]:border-b",t),...e}));fs.displayName="TableHeader";const ps=y.forwardRef(({className:t,...e},n)=>s.jsx("tbody",{ref:n,className:Lt("[&_tr:last-child]:border-0",t),...e}));ps.displayName="TableBody";const gt=y.forwardRef(({className:t,...e},n)=>s.jsx("tr",{ref:n,className:Lt("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));gt.displayName="TableRow";const Ce=y.forwardRef(({className:t,...e},n)=>s.jsx("th",{ref:n,className:Lt("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:Lt("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));ke.displayName="TableCell";function jl(t,e){const[n,r]=y.useState(t);return y.useEffect(()=>{const a=setTimeout(()=>r(t),e);return()=>clearTimeout(a)},[t,e]),n}function Xs({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 KP(){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=jl(v,300),[k,E]=y.useState("all"),[C,R]=y.useState(!0),[L,q]=y.useState(null),[_,H]=y.useState(null),[P,se]=y.useState(""),[Y,V]=y.useState(!1);async function ae(){R(!0),q(null);try{const X=k==="all"?"":k==="completed"?"completed":k,F=new URLSearchParams({page:String(f),pageSize:String(x),...X&&{status:X},...N&&{search:N}}),[U,fe]=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)),fe!=null&&fe.success&&fe.users&&r(fe.users)}catch(X){console.error("加载订单失败",X),q("加载订单失败,请检查网络后重试")}finally{R(!1)}}y.useEffect(()=>{m(1)},[N,k]),y.useEffect(()=>{ae()},[f,x,N,k]);const le=X=>{var F;return X.userNickname||((F=n.find(U=>U.id===X.userId))==null?void 0:F.nickname)||"匿名用户"},de=X=>{var F;return((F=n.find(U=>U.id===X))==null?void 0:F.phone)||"-"},I=X=>{const F=X.productType||X.type||"",U=X.description||"";if(F==="balance_recharge")return{name:`余额充值 ¥${Number(X.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 fe=U.split("-");if(fe.length>=3)return{name:`第${fe[1]}章 第${fe[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:`章节 ${X.productId||X.sectionId||""}`,type:"单章"}:F==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:F==="vip"?{name:"超级个体开通费用",type:"超级个体"}:F==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:F||"其他"}},G=Math.ceil(a/x)||1;async function z(){var X;if(!(!(_!=null&&_.orderSn)&&!(_!=null&&_.id))){V(!0),q(null);try{const F=await Yt("/api/admin/orders/refund",{orderSn:_.orderSn||_.id,reason:P||void 0});F!=null&&F.success?(H(null),se(""),ae()):q((F==null?void 0:F.error)||"退款失败")}catch(F){const U=F;q(((X=U==null?void 0:U.data)==null?void 0:X.error)||"退款失败,请检查网络后重试")}finally{V(!1)}}}function me(){if(t.length===0){Z.info("暂无数据可导出");return}const X=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],F=t.map(O=>{const K=I(O);return[O.orderSn||O.id||"",le(O),de(O.userId),K.name,Number(O.amount||0).toFixed(2),O.paymentMethod==="wechat"?"微信支付":O.paymentMethod==="balance"?"余额支付":O.paymentMethod==="alipay"?"支付宝":O.paymentMethod||"微信支付",O.status==="refunded"?"已退款":O.status==="paid"||O.status==="completed"?"已完成":O.status==="pending"||O.status==="created"?"待支付":"已失败",O.status==="refunded"&&O.refundReason?O.refundReason:"-",O.referrerEarnings?Number(O.referrerEarnings).toFixed(2):"-",O.createdAt?new Date(O.createdAt).toLocaleString("zh-CN"):""].join(",")}),U="\uFEFF"+[X.join(","),...F].join(` +`),fe=new Blob([U],{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:()=>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(Q,{variant:"outline",onClick:ae,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(Ca,{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:X=>w(X.target.value)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(zj,{className:"w-4 h-4 text-gray-400"}),s.jsxs("select",{value:k,onChange:X=>E(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(Q,{variant:"outline",onClick:me,disabled:t.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(A5,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),s.jsx(_e,{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(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(hs,{children:[s.jsx(fs,{children:s.jsxs(gt,{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(ps,{children:[t.map(X=>{const F=I(X);return s.jsxs(gt,{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:[le(X),X.paymentMethod==="gift_pay"&&s.jsx(He,{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(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:de(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(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(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(He,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):X.status==="paid"||X.status==="completed"?s.jsx(He,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):X.status==="pending"||X.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:"已失败"}),(X.status==="paid"||X.status==="completed")&&(X.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: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(Q,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{H(X),se("")},children:[s.jsx(Vj,{className:"w-3 h-3 mr-1"}),"退款"]})})]},X.id)}),t.length===0&&s.jsx(gt,{children:s.jsx(ke,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),s.jsx(Xs,{page:f,totalPages:G,total:a,pageSize:x,onPageChange:m,onPageSizeChange:X=>{b(X),m(1)}})]})})}),s.jsx(Ft,{open:!!_,onOpenChange:X=>!X&&H(null),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Bt,{children:s.jsx(Vt,{className:"text-white",children:"订单退款"})}),_&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",_.orderSn||_.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(_.amount||0).toFixed(2)]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),s.jsx("div",{className:"form-input",children:s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:P,onChange:X=>se(X.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(yn,{children:[s.jsx(Q,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>H(null),disabled:Y,children:"取消"}),s.jsx(Q,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:z,disabled:Y,children:Y?"退款中...":"确认退款"})]})]})})]})}const kl=y.forwardRef(({className:t,...e},n)=>s.jsx("textarea",{className:Lt("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}));kl.displayName="Textarea";const U1=["INTJ","INTP","ENTJ","ENTP","INFJ","INFP","ENFJ","ENFP","ISTJ","ISFJ","ESTJ","ESFJ","ISTP","ISFP","ESTP","ESFP"],c2={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 qP(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 GP(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 JP(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 W1(t){const e=c2[t],n=qP(e.group),r=GP(e.mood),a=JP(e.mood),i=` + + + + + + + + + + + + + + + + + + + + + + + + + +`;return`data:image/svg+xml;utf8,${encodeURIComponent(i)}`}function QP(){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{Z.error("加载 MBTI 头像配置失败")}finally{r(!1)}},[]);y.useEffect(()=>{u()},[u]);const h=async()=>{i(!0);try{const x=await Ct("/api/admin/mbti-avatars",{avatars:t});if(!x||x.success===!1){Z.error((x==null?void 0:x.error)||"保存失败");return}Z.success("已保存,后台与小程序默认头像同步生效"),u()}catch{Z.error("保存失败")}finally{i(!1)}},f=x=>{const b=W1(x);e(v=>({...v,[x]:b})),Z.success(`${x} 已生成`)},m=()=>{c(!0);try{const x={...t};U1.forEach(b=>{x[b]=W1(b)}),e(x),Z.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(dt,{className:"pb-2",children:[s.jsxs(ut,{className:"text-white flex items-center gap-2 text-lg",children:[s.jsx(sA,{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(Q,{type:"button",size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396]",onClick:m,disabled:o,children:[s.jsx(CA,{className:"w-3.5 h-3.5 mr-1"}),o?"生成中…":"一键生成16头像"]}),s.jsxs(Q,{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(Q,{type:"button",size:"sm",className:"bg-emerald-600 hover:bg-emerald-500",onClick:h,disabled:a,children:[s.jsx(Sn,{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:U1.map(x=>{const b=t[x]??"",v=c2[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(Q,{type:"button",size:"sm",variant:"outline",className:"h-7 text-[11px] border-[#38bdac]/40 text-[#38bdac]",onClick:()=>f(x),children:"生成这张"}),s.jsx(Q,{type:"button",size:"sm",variant:"ghost",className:"h-7 text-[11px] text-gray-400",onClick:()=>e(w=>({...w,[x]:""})),children:"清空"})]})]},x)})})]})}const K1=[{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:"用户状态"}],q1=[{value:"popup",label:"弹窗提示",desc:"在小程序内弹窗引导用户完成下一步"},{value:"navigate",label:"跳转页面",desc:"引导用户跳转到指定页面"},{value:"webhook",label:"推送飞书群",desc:"触发后推送消息到飞书群Webhook"},{value:"tag",label:"自动打标签",desc:"触发后自动给用户打上指定标签"}];function d2(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 YP(t){return{...t,triggerConditions:d2(t.triggerConditions)}}const XP=[{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:"待激活"}],mc=[{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 G1(t){return confirm(`确定删除该${t}?此操作不可恢复。`)?window.prompt(`请输入「删除」以确认删除${t}`)==="删除":!1}function ZP(){var T,B,ue,je,We,ht,At;const[t,e]=T0(),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=jl(b,300),N=n==="vip"?"vip":n==="complete"?"complete":"all",[k,E]=y.useState(N),[C,R]=y.useState(!0),[L,q]=y.useState(!1),[_,H]=y.useState(null),[P,se]=y.useState(!1),[Y,V]=y.useState(!1),[ae,le]=y.useState("desc");y.useEffect(()=>{n==="vip"?E("vip"):n==="complete"?E("complete"):n==="all"&&E("all")},[n]);const[de,I]=y.useState(!1),[G,z]=y.useState(null),[me,X]=y.useState(!1),[F,U]=y.useState(!1),[fe,he]=y.useState({referrals:[],stats:{}}),[oe,O]=y.useState(!1),[K,D]=y.useState(null),[J,te]=y.useState(!1),[be,ze]=y.useState(null),[Ke,Nt]=y.useState(!1),[yt,Dt]=y.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),[Rt,Pn]=y.useState([]),[vn,Ut]=y.useState(!1),[Zt,Cn]=y.useState(!1),[zn,Un]=y.useState(null),[It,xn]=y.useState({title:"",description:"",trigger:"",triggerConditions:[],actionType:"popup",sort:0,enabled:!0}),[Nn,we]=y.useState([]),[Te,Ue]=y.useState(!1),[rt,Mt]=y.useState(null),[kt,$]=y.useState(null),[Ie,vt]=y.useState({}),[Pt,bt]=y.useState(!1),[ot,_t]=y.useState(null),[Jt,an]=y.useState([]),[rs,tr]=y.useState(!1),[wi,ca]=y.useState(null),[da,$r]=y.useState(""),[zr,Fr]=y.useState([]),[gr,yr]=y.useState(!1),[Oa,nr]=y.useState({}),[Ts,sr]=y.useState([]),[br,Es]=y.useState(0),[ie,ve]=y.useState(1),[Qe]=y.useState(20),[pt,Wn]=y.useState(!1),[$s,Da]=y.useState(null),[_a,Po]=y.useState(""),rr=jl(_a,300),[Ms,ji]=y.useState(""),[Wt,$l]=y.useState(""),[ar,Lo]=y.useState({}),[ua,zl]=y.useState(null),[$a,za]=y.useState(!1),wn=y.useCallback(async(M,ge)=>{Wn(!0),Da(null);try{const Ne=new URLSearchParams({mode:"contact",page:String(ie),pageSize:String(Qe)}),Le=M??rr;Le&&Ne.set("search",Le);const Be=ge??Ms;Be&&Ne.set("source",Be),Wt&&Ne.set("pushStatus",Wt);const tt=await Oe(`/api/db/ckb-leads?${Ne}`);if(tt!=null&&tt.success)sr(tt.records||[]),Es(tt.total??0),tt.stats&&Lo(tt.stats);else{const on=(tt==null?void 0:tt.error)||"加载获客列表失败";Da(on),Z.error(on),sr([]),Es(0)}}catch(Ne){const Le=Ne instanceof Error?Ne.message:"网络错误";Da(Le),Z.error("加载获客列表失败: "+Le),sr([]),Es(0)}finally{Wn(!1)}},[ie,Qe,rr,Ms,Wt]);async function ed(M){if(M){zl(M);try{const ge=await Ct("/api/db/ckb-leads/retry",{id:M});ge!=null&&ge.success?Z.success(ge.pushed?"重推成功":"已发起重推,请刷新查看状态"):Z.error((ge==null?void 0:ge.error)||"重推失败")}catch(ge){Z.error(ge instanceof Error?ge.message:"重推请求失败")}finally{zl(null),wn()}}}async function Yn(){const M=Rs.filter(Le=>Le.pushStatus==="failed");if(M.length===0){Z.info("当前页无失败记录");return}za(!0);let ge=0;for(const Le of M)try{const Be=await Ct("/api/db/ckb-leads/retry",{id:Le.id});Be!=null&&Be.success&&Be.pushed&&ge++}catch{}za(!1);const Ne=M.length;Z.success(`批量重推完成:成功 ${ge} / ${Ne}`),wn()}function td(){const M=Rs.filter(Ge=>Ge.pushStatus==="failed");if(M.length===0){Z.info("当前筛选下无失败记录可导出");return}const ge=Ge=>`"${String(Ge??"").replace(/"/g,'""')}"`,Le=[["ID","昵称","手机号","微信号","对应@人","来源","推送状态","重试次数","失败原因","下次重试时间","创建时间"].join(",")];for(const Ge of M)Le.push([ge(Ge.id),ge(Ge.userNickname||Ge.name||""),ge(Ge.phone||""),ge(Ge.wechatId||""),ge(Ge.personName||""),ge(Ge.source||""),ge(Ge.pushStatus||""),ge(typeof Ge.retryCount=="number"?Ge.retryCount:""),ge(Ge.ckbError||""),ge(Ge.nextRetryAt?new Date(Ge.nextRetryAt).toLocaleString():""),ge(Ge.createdAt?new Date(Ge.createdAt).toLocaleString():"")].join(","));const Be=new Blob(["\uFEFF"+Le.join(` +`)],{type:"text/csv;charset=utf-8;"}),tt=URL.createObjectURL(Be),on=document.createElement("a");on.href=tt,on.download=`获客失败清单-${new Date().toISOString().slice(0,19).replace(/[:T]/g,"-")}.csv`,document.body.appendChild(on),on.click(),document.body.removeChild(on),URL.revokeObjectURL(tt),Z.success(`已导出失败清单(${M.length} 条)`)}const Br=y.useCallback(async()=>{try{const M=await Oe("/api/admin/mbti-avatars"),ge=M!=null&&M.avatars&&typeof M.avatars=="object"?M.avatars:{};nr(ge)}catch{nr({})}},[]);y.useEffect(()=>{t.get("tab")==="leads"&&wn()},[t.get("tab"),ie,wn]),y.useEffect(()=>{if(a!=="leads")return;const M=window.setInterval(()=>{wn()},3e4);return()=>window.clearInterval(M)},[a,wn]),y.useEffect(()=>{Br()},[Br]);const Oo=y.useCallback((M,ge)=>{const Ne=(M||"").trim();if(Ne)return Ne;const Le=(ge||"").trim().toUpperCase();return/^[EI][NS][FT][JP]$/.test(Le)?(Oa[Le]||"").trim():""},[Oa]),ki=y.useCallback(M=>{const ge=!!M.hasFullBook,Ne=Number(M.purchasedSectionCount||0);return ge?{tone:"vip",main:"已购全书",sub:Ne>0?`另购单章 ${Ne} 章`:"购买项:VIP / 全书"}:Ne>0?{tone:"paid",main:`已购 ${Ne} 章`,sub:"购买项:章节"}:{tone:"free",main:"未购买",sub:""}},[]),[ha,vr]=y.useState(null),Vr=y.useCallback(async()=>{try{const M=await Oe("/api/admin/users/online-stats");M!=null&&M.success&&typeof M.onlineCount=="number"?vr(M.onlineCount):vr(0)}catch{vr(null)}},[]);y.useEffect(()=>{Vr();const M=setInterval(Vr,1e4);return()=>clearInterval(M)},[Vr]);async function fa(M=!1){var ge;R(!0),M&&q(!0),H(null);try{if(P){const Ne=new URLSearchParams({search:w,limit:String(m*5)}),Le=await Oe(`/api/db/users/rfm?${Ne}`);if(Le!=null&&Le.success){let Be=Le.users||[];ae==="asc"&&(Be=[...Be].reverse());const tt=(h-1)*m;o(Be.slice(tt,tt+m)),u(((ge=Le.users)==null?void 0:ge.length)??0),Be.length===0&&(se(!1),H("暂无订单数据,RFM 排序需要用户有购买记录后才能生效"))}else se(!1),H((Le==null?void 0:Le.error)||"RFM 加载失败,已切回普通模式")}else{const Ne=new URLSearchParams({page:String(h),pageSize:String(m),search:w,...k==="vip"&&{vip:"true"},...k==="complete"&&{pool:"complete"}}),Le=await Oe(`/api/db/users?${Ne}`);Le!=null&&Le.success?(o(Le.users||[]),u(Le.total??0)):H((Le==null?void 0:Le.error)||"加载失败")}}catch(Ne){console.error("Load users error:",Ne),H("网络错误")}finally{R(!1),M&&q(!1)}}y.useEffect(()=>{f(1)},[w,k,P]),y.useEffect(()=>{fa()},[h,m,w,k,P,ae]);const Si=Math.ceil(c/m)||1,Fa=()=>{P?ae==="desc"?le("asc"):(se(!1),le("desc")):(se(!0),le("desc"))},Ci=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 Ti(M){var ge;if(!G1("用户")){Z.info("已取消删除");return}try{const Ne=await ui(`/api/db/users?id=${encodeURIComponent(M)}`);Ne!=null&&Ne.success?(Z.success("已删除"),fa()):Z.error("删除失败: "+((Ne==null?void 0:Ne.error)||"未知错误"))}catch(Ne){const Le=Ne,Be=((ge=Le==null?void 0:Le.data)==null?void 0:ge.error)||(Le==null?void 0:Le.message)||"网络错误";Z.error("删除失败: "+Be)}}const Hr=M=>{z(M),Dt({phone:M.phone||"",nickname:M.nickname||"",password:"",isAdmin:!!(M.isAdmin??!1),hasFullBook:!!(M.hasFullBook??!1)}),I(!0)},Ei=()=>{z(null),Dt({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),I(!0)};async function Do(){if(!yt.phone||!yt.nickname){Z.error("请填写手机号和昵称");return}X(!0);try{if(G){const M=await Yt("/api/db/users",{id:G.id,phone:yt.phone||void 0,nickname:yt.nickname,isAdmin:yt.isAdmin,hasFullBook:yt.hasFullBook,...yt.password&&{password:yt.password}});if(!(M!=null&&M.success)){Z.error("更新失败: "+((M==null?void 0:M.error)||""));return}}else{const M=await Ct("/api/db/users",{phone:yt.phone,nickname:yt.nickname,password:yt.password,isAdmin:yt.isAdmin});if(!(M!=null&&M.success)){Z.error("创建失败: "+((M==null?void 0:M.error)||""));return}}I(!1),fa()}catch{Z.error("保存失败")}finally{X(!1)}}async function xt(M){D(M),U(!0),O(!0);try{const ge=await Oe(`/api/db/users/referrals?userId=${encodeURIComponent(M.id)}`);ge!=null&&ge.success?he({referrals:ge.referrals||[],stats:ge.stats||{}}):he({referrals:[],stats:{}})}catch{he({referrals:[],stats:{}})}finally{O(!1)}}const Nr=y.useCallback(async()=>{Ut(!0);try{const M=await Oe("/api/db/user-rules");M!=null&&M.success&&Pn((M.rules||[]).map(ge=>YP(ge)))}catch{}finally{Ut(!1)}},[]);async function Ba(){if(!It.title){Z.error("请填写规则标题");return}X(!0);try{if(zn){const M=await Yt("/api/db/user-rules",{id:zn.id,...It});if(!(M!=null&&M.success)){Z.error("更新失败: "+((M==null?void 0:M.error)||""));return}}else{const M=await Ct("/api/db/user-rules",It);if(!(M!=null&&M.success)){Z.error("创建失败: "+((M==null?void 0:M.error)||""));return}}Cn(!1),Nr()}catch{Z.error("保存失败")}finally{X(!1)}}async function Va(M){if(!G1("规则")){Z.info("已取消删除");return}try{const ge=await ui(`/api/db/user-rules?id=${M}`);ge!=null&&ge.success&&Nr()}catch{}}async function _o(M){try{await Yt("/api/db/user-rules",{id:M.id,enabled:!M.enabled}),Nr()}catch{}}const hn=y.useCallback(async()=>{Ue(!0);try{const M=await Oe("/api/db/vip-members?limit=500");if(M!=null&&M.success&&M.data){const ge=[...M.data].map((Ne,Le)=>({...Ne,vipSort:typeof Ne.vipSort=="number"?Ne.vipSort:Le+1}));ge.sort((Ne,Le)=>(Ne.vipSort??999999)-(Le.vipSort??999999)),we(ge)}else M&&M.error&&Z.error(M.error)}catch{Z.error("加载超级个体列表失败")}finally{Ue(!1)}},[]),[Fl,zs]=y.useState(!1),[wr,Fs]=y.useState(null),[As,Is]=y.useState(""),[pa,Ur]=y.useState(!1),[Fn,Mi]=y.useState(!1),[xs,jr]=y.useState(null),[$o,Wr]=y.useState(""),[ir,ma]=y.useState(!1),nd=["创业者","资源整合者","技术达人","投资人","产品经理","流量操盘手"],or=M=>{Fs(M),Is(M.vipRole||""),zs(!0)},Bs=M=>{jr(M),Wr((M.webhookUrl||"").trim()),Mi(!0)},Kr=async M=>{const ge=M.trim();if(wr){if(!ge){Z.error("请选择或输入标签");return}Ur(!0);try{const Ne=await Yt("/api/db/users",{id:wr.id,vipRole:ge});if(!(Ne!=null&&Ne.success)){Z.error((Ne==null?void 0:Ne.error)||"更新超级个体标签失败");return}Z.success("已更新超级个体标签"),zs(!1),Fs(null),await hn()}catch{Z.error("更新超级个体标签失败")}finally{Ur(!1)}}},Vs=async()=>{if(!xs)return;const M=$o.trim();if(M&&!/^https?:\/\//i.test(M)){Z.error("Webhook 地址需以 http/https 开头");return}ma(!0);try{const ge=await Yt("/api/db/vip-members/webhook",{userId:xs.id,webhookUrl:M});if(!(ge!=null&&ge.success)){Z.error((ge==null?void 0:ge.error)||"保存飞书群 Webhook 失败");return}Z.success(M?"已保存该超级个体的飞书群 Webhook":"已清空该超级个体的飞书群 Webhook"),Mi(!1),jr(null),await hn()}catch{Z.error("保存飞书群 Webhook 失败")}finally{ma(!1)}},[sd,Ha]=y.useState(!1),[kr,qr]=y.useState(null),[Ua,zo]=y.useState(""),[Hs,xa]=y.useState(!1),Ai=M=>{qr(M),zo(M.vipSort!=null?String(M.vipSort):""),Ha(!0)},Bl=async()=>{if(!kr)return;const M=Number(Ua);if(!Number.isFinite(M)){Z.error("请输入有效的数字序号");return}xa(!0);try{const ge=await Yt("/api/db/users",{id:kr.id,vipSort:M});if(!(ge!=null&&ge.success)){Z.error((ge==null?void 0:ge.error)||"更新排序序号失败");return}Z.success("已更新排序序号"),Ha(!1),qr(null),await hn()}catch{Z.error("更新排序序号失败")}finally{xa(!1)}},Ii=(M,ge)=>{M.dataTransfer.effectAllowed="move",M.dataTransfer.setData("text/plain",ge),Mt(ge)},Ri=(M,ge)=>{M.preventDefault(),kt!==ge&&$(ge)},Vl=()=>{Mt(null),$(null)},as=async(M,ge)=>{M.preventDefault();const Ne=M.dataTransfer.getData("text/plain")||rt;if(Mt(null),$(null),!Ne||Ne===ge)return;const Le=Nn.find(Ge=>Ge.id===Ne),Be=Nn.find(Ge=>Ge.id===ge);if(!Le||!Be)return;const tt=Le.vipSort??Nn.findIndex(Ge=>Ge.id===Ne)+1,on=Be.vipSort??Nn.findIndex(Ge=>Ge.id===ge)+1;we(Ge=>{const Qt=[...Ge],lr=Qt.findIndex(rd=>rd.id===Ne),Sr=Qt.findIndex(rd=>rd.id===ge);if(lr===-1||Sr===-1)return Ge;const Ho=[...Qt],[Bp,Vp]=[Ho[lr],Ho[Sr]];return Ho[lr]={...Vp,vipSort:tt},Ho[Sr]={...Bp,vipSort:on},Ho});try{const[Ge,Qt]=await Promise.all([Yt("/api/db/users",{id:Ne,vipSort:on}),Yt("/api/db/users",{id:ge,vipSort:tt})]);if(!(Ge!=null&&Ge.success)||!(Qt!=null&&Qt.success)){Z.error((Ge==null?void 0:Ge.error)||(Qt==null?void 0:Qt.error)||"更新排序失败"),await hn();return}Z.success("已更新排序"),await hn()}catch{Z.error("更新排序失败"),await hn()}},Gr=y.useCallback(async()=>{bt(!0);try{const M=await Oe("/api/db/users/journey-stats");M!=null&&M.success&&M.stats&&vt(M.stats)}catch{}finally{bt(!1)}},[]),Fo=y.useCallback(async M=>{_t(M),tr(!0);try{const ge=await Oe(`/api/db/users/journey-users?stage=${M}&limit=50`);ge!=null&&ge.success&&ge.users&&an(ge.users)}catch{}finally{tr(!1)}},[]),Wa=y.useCallback(async(M,ge)=>{ca(M),$r(ge),yr(!0);try{const Ne=await Oe(`/api/db/users/tracks?userId=${M}&limit=50`);Ne!=null&&Ne.success&&Ne.tracks&&Fr(Ne.tracks)}catch{}finally{yr(!1)}},[]),[Hl,Pi]=y.useState(!1),Bo=async()=>{Pi(!0);try{const M=await Ct("/api/admin/shensheshou/batch-enrich",{limit:20});M!=null&&M.success?(Z.success(`批量补全完成:${M.enriched} 人已补全,${M.skipped} 人跳过`),fa()):Z.error((M==null?void 0:M.error)||"批量补全失败")}catch{Z.error("批量补全请求失败")}finally{Pi(!1)}},Ka=M=>{const ge=[M.phone,M.nickname,M.avatar,M.wechatId,M.mbti,M.industry,M.region,M.position],Ne=ge.filter(Le=>Le!=null&&Le!=="").length;return Math.round(Ne/ge.length*100)},{leadsRows:Rs,leadsRawCount:Li,leadsDeduped:Vo}=y.useMemo(()=>{const M=Ge=>(Ge||"").replace(/\D/g,"")||"",ge=Ge=>{const Qt=M(Ge.phone);if(Qt)return`phone:${Qt}`;const lr=(Ge.userId||"").trim();if(lr)return`user:${lr}`;const Sr=(Ge.wechatId||"").trim();return Sr?`wechat:${Sr}`:`row:${Ge.id}`},Ne=rr.trim().toLowerCase();let Le=Ts;Ne&&(Le=Ts.filter(Ge=>[Ge.userNickname,Ge.name,Ge.phone,Ge.wechatId,Ge.personName,Ge.source,String(Ge.ckbPlanId??"")].filter(Boolean).join(" ").toLowerCase().includes(Ne)));const Be=[...Le].sort((Ge,Qt)=>{const lr=Ge.createdAt?new Date(Ge.createdAt).getTime():0;return(Qt.createdAt?new Date(Qt.createdAt).getTime():0)-lr}),tt=new Set,on=[];for(const Ge of Be){const Qt=ge(Ge);tt.has(Qt)||(tt.add(Qt),on.push(Ge))}return{leadsRows:on,leadsRawCount:Le.length,leadsDeduped:Le.length-on.length}},[Ts,rr]),Ul=M=>M==="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:"待推送"}),Oi=y.useMemo(()=>{const M=new Map;for(const ge of Rs){if(ge.pushStatus!=="failed")continue;const Ne=(ge.ckbError||"未知错误").trim()||"未知错误";M.set(Ne,(M.get(Ne)||0)+1)}return Array.from(M.entries()).map(([ge,Ne])=>({reason:ge,count:Ne})).sort((ge,Ne)=>Ne.count-ge.count)},[Rs]);async function Di(){const M=Rs.filter(tt=>tt.pushStatus==="failed");if(M.length===0){Z.info("当前页无失败记录");return}const ge=Oi.slice(0,8).map(tt=>`- ${tt.reason}:${tt.count} 条`).join(` +`),Ne=M.slice(0,30).map(tt=>tt.id).join(", "),Le=M.slice(0,20).map(tt=>`#${tt.id} | ${tt.userNickname||tt.name||"-"} | 手机:${tt.phone||"-"} | 来源:${tt.source||"-"} | 重试:${tt.retryCount??0} | 错误:${tt.ckbError||"-"}`).join(` +`),Be=["【获客失败排障信息】",`时间:${new Date().toLocaleString()}`,`当前页失败总数:${M.length}`,"主要失败原因:",ge||"- 无",`最近失败记录ID(最多30条):${Ne||"无"}`,"","失败记录明细(最多20条):",Le||"无"].join(` +`);try{await navigator.clipboard.writeText(Be),Z.success("已复制排障信息")}catch{Z.error("复制失败,请检查浏览器剪贴板权限")}}return s.jsxs("div",{className:"p-8 w-full",children:[_&&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:_}),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," 位注册用户",ha!==null&&s.jsxs("span",{className:"text-[#38bdac] ml-1",children:["· 在线 ",ha," 人"]}),P&&" · RFM 排序中"]})]}),s.jsx(_e,{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:()=>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":Y,children:[s.jsx(of,{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:Y?"RFM · Are you good(用户价值分层)":"RFM · 点击展开说明"})]}),Y?s.jsx(xg,{className:"w-4 h-4 text-gray-400 shrink-0"}):s.jsx(gl,{className:"w-4 h-4 text-gray-400 shrink-0"})]}),s.jsx(Q,{type:"button",variant:"outline",size:"sm",onClick:Fa,className:"border-[#38bdac]/50 text-[#38bdac] hover:bg-[#38bdac]/10 bg-transparent shrink-0",children:P?ae==="desc"?"RFM 降序":"RFM 升序":"按 RFM 排序"})]}),Y&&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:XP.map(({level:M,range:ge,label:Ne})=>s.jsxs(He,{variant:"outline",className:`text-[10px] border-0 ${Ci(M)}`,children:[M," ",ge," · ",Ne]},M))})]})]})})]}),s.jsxs(Oc,{value:a,onValueChange:M=>{const ge=new URLSearchParams(t);M==="users"?ge.delete("tab"):ge.set("tab",M),e(ge)},className:"w-full",children:[s.jsxs(wl,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-6 flex-wrap h-auto gap-1",children:[s.jsxs(tn,{value:"users",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",children:[s.jsx(Dn,{className:"w-4 h-4"})," 用户列表"]}),s.jsxs(tn,{value:"leads",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:()=>wn(),children:[s.jsx(Cc,{className:"w-4 h-4"})," 获客列表"]}),s.jsxs(tn,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Gr,children:[s.jsx(na,{className:"w-4 h-4"})," 用户旅程总览"]}),s.jsxs(tn,{value:"rules",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Nr,children:[s.jsx(co,{className:"w-4 h-4"})," 规则配置"]}),s.jsxs(tn,{value:"vip-roles",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:hn,children:[s.jsx(Ec,{className:"w-4 h-4"})," 超级个体列表"]})]}),s.jsxs(nn,{value:"users",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4 justify-end flex-wrap",children:[s.jsxs(Q,{variant:"outline",onClick:Bo,disabled:Hl,className:"border-purple-500/50 text-purple-400 hover:bg-purple-500/10 bg-transparent",title:"批量调用神射手补全有手机号用户的资料",children:[Hl?s.jsx(Ve,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(gi,{className:"w-4 h-4 mr-2"}),"批量补全"]}),s.jsxs(Q,{variant:"outline",onClick:()=>fa(!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 ge=M.target.value;E(ge),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:P,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(Ca,{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(Q,{onClick:Ei,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cc,{className:"w-4 h-4 mr-2"})," 添加用户"]})]}),s.jsx(_e,{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(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(hs,{children:[s.jsx(fs,{children:s.jsxs(gt,{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:Fa,children:[s.jsxs("div",{className:"flex items-center gap-1 group",children:[s.jsx(of,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"RFM分值"}),P?ae==="desc"?s.jsx(gl,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(xg,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(mx,{className:"w-3.5 h-3.5 text-gray-600 group-hover:text-gray-400"})]}),P&&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(ps,{children:[i.map(M=>{var ge,Ne,Le;return s.jsxs(gt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ke,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[(()=>{var on;const Be=Oo(M.avatar,M.mbti),tt=((on=M.nickname)==null?void 0:on.charAt(0))||"?";return s.jsx("button",{type:"button",title:"点击管理 MBTI 默认头像库",onClick:()=>Nt(!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:Be?s.jsx("img",{src:Be,className:"w-full h-full rounded-full object-cover",alt:"",onError:Ge=>{var Sr;const Qt=Ge.target;if(Qt.style.display="none",Qt.nextElementSibling)return;const lr=document.createElement("span");lr.textContent=tt,(Sr=Qt.parentElement)==null||Sr.appendChild(lr)}}):tt})})(),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:()=>{ze(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&&!((ge=M.id)!=null&&ge.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:[(Ne=M.id)==null?void 0:Ne.slice(0,16),(((Le=M.id)==null?void 0:Le.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 Be=ki(M);return Be.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:Be.main}),Be.sub&&s.jsx("p",{className:"text-[11px] text-amber-300/80",children:Be.sub})]}):Be.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:Be.main}),Be.sub&&s.jsx("p",{className:"text-[11px] text-blue-300/80",children:Be.sub})]}):s.jsx(He,{variant:"outline",className:"text-gray-500 border-gray-600",children:Be.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:()=>xt(M),role:"button",tabIndex:0,onKeyDown:Be=>Be.key==="Enter"&&xt(M),children:[s.jsx(Dn,{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 ${Ci(M.rfmLevel)}`,children:M.rfmLevel})]}):s.jsx("span",{className:"text-gray-600 text-xs",children:"无订单"})}),s.jsx(ke,{children:(()=>{const Be=Ka(M),tt=Be>=75?"text-green-400":Be>=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 ${Be>=75?"bg-green-500":Be>=50?"bg-yellow-500":"bg-gray-500"}`,style:{width:`${Be}%`}})}),s.jsxs("span",{className:`text-xs ${tt}`,children:[Be,"%"]})]})})()}),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(Q,{variant:"ghost",size:"sm",onClick:()=>{ze(M.id),te(!0)},className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"用户详情",children:s.jsx(af,{className:"w-4 h-4"})}),s.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>Hr(M),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑用户",children:s.jsx(en,{className:"w-4 h-4"})}),s.jsx(Q,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>Ti(M.id),title:"删除",children:s.jsx(Ns,{className:"w-4 h-4"})})]})})]},M.id)}),i.length===0&&s.jsx(gt,{children:s.jsx(ke,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),s.jsx(Xs,{page:h,totalPages:Si,total:c,pageSize:m,onPageChange:f,onPageSizeChange:M=>{x(M),f(1)}})]})})})]}),s.jsxs(nn,{value:"leads",children:[$s&&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:$s}),s.jsx("button",{type:"button",className:"shrink-0 ml-2",onClick:()=>Da(null),"aria-label":"关闭",children:"×"})]}),!pt&&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:br})]}),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:ar.uniqueUsers??0})]}),(ar.sourceStats&&ar.sourceStats.length>0?ar.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))]}),!pt&&Oi.length>0&&s.jsx(_e,{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(Q,{type:"button",variant:"outline",onClick:Di,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:Oi.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(Ca,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(ce,{placeholder:"搜索昵称/手机/微信/@人/来源…",value:_a,onChange:M=>Po(M.target.value),className:"pl-9 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"})]}),ar.sourceStats&&ar.sourceStats.length>0&&s.jsxs("select",{value:Ms,onChange:M=>{ji(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:"全部来源"}),ar.sourceStats.map(M=>s.jsxs("option",{value:M.source,children:[M.source,"(",M.cnt,")"]},M.source))]}),s.jsxs("select",{value:Wt,onChange:M=>{$l(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(Q,{type:"button",variant:"outline",onClick:()=>{$l("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:["本页 ",Li," 条",Vo>0?` · 已合并 ${Vo} 条重复`:""]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx(Q,{variant:"outline",onClick:td,disabled:pt,className:"border-cyan-600/60 text-cyan-300 hover:bg-cyan-500/10 bg-transparent",children:"导出失败清单"}),s.jsxs(Q,{variant:"outline",onClick:Yn,disabled:$a||pt,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 ${$a?"animate-spin":""}`}),"重推本页失败项"]}),s.jsxs(Q,{variant:"outline",onClick:()=>wn(),disabled:pt,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 ${pt?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx($e,{className:"p-0",children:pt?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(hs,{children:[s.jsx(fs,{children:s.jsxs(gt,{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.jsxs(ps,{children:[Rs.map(M=>s.jsxs(gt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[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:[Ul(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(Q,{size:"sm",variant:"outline",disabled:ua===M.id,onClick:()=>ed(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 ${ua===M.id?"animate-spin":""}`}),"重推"]})]})}),s.jsx(ke,{className:"text-gray-400",children:M.createdAt?new Date(M.createdAt).toLocaleString():"-"})]},M.id)),Rs.length===0&&s.jsx(gt,{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(Cc,{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:rr.trim()||Ms?"当前搜索或来源筛选下没有匹配记录,可清空条件后重试。":"存客宝场景产生的手机号 / 微信留资会出现在此列表。请确认获客计划已开启,并有用户完成留资。"}),s.jsxs(Q,{type:"button",variant:"outline",onClick:()=>wn(),disabled:pt,className:"border-[#38bdac]/40 text-[#38bdac] hover:bg-[#38bdac]/10 bg-transparent",children:[s.jsx(Ve,{className:`w-4 h-4 mr-2 ${pt?"animate-spin":""}`}),"重新加载"]})]})})})]})]}),s.jsx(Xs,{page:ie,totalPages:Math.ceil(br/Qe)||1,total:br,pageSize:Qe,onPageChange:ve,onPageSizeChange:()=>{}})]})})})]}),s.jsxs(nn,{value:"journey",children:[s.jsxs("div",{className:"flex items-center justify-between mb-5",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"用户从注册到 VIP 的完整行动路径,点击各阶段查看用户动态"}),s.jsxs(Q,{variant:"outline",onClick:Gr,disabled:Pt,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 ${Pt?"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:mc.map((M,ge)=>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 ${ot===M.id?"ring-2 ring-[#38bdac]":""}`,onClick:()=>Fo(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(Ne=>Ne.startsWith("text-"))}`,children:M.label}),Ie[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:Ie[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:ge+1})]}),ges.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(Zs,{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:"实时更新"})]}),Pt?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(Ie).length>0?s.jsx("div",{className:"space-y-2",children:mc.map(M=>{const ge=Ie[M.id]||0,Ne=Math.max(...mc.map(Be=>Ie[Be.id]||0),1),Le=Math.round(ge/Ne*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:`${Le}%`}})}),s.jsx("span",{className:"text-gray-400 text-xs w-10 text-right",children:ge})]},M.id)})}):s.jsx("div",{className:"text-center py-8",children:s.jsx("p",{className:"text-gray-500 text-sm",children:"点击「刷新数据」加载统计"})})]})]}),ot&&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(Dn,{className:"w-4 h-4 text-[#38bdac]"}),s.jsxs("span",{className:"text-white font-medium",children:[(T=mc.find(M=>M.id===ot))==null?void 0:T.icon," ",(B=mc.find(M=>M.id===ot))==null?void 0:B.label," 阶段用户"]}),s.jsxs(He,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-xs",children:[Jt.length," 人"]})]}),s.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>_t(null),className:"text-gray-400 hover:text-white",children:s.jsx(Jn,{className:"w-4 h-4"})})]}),rs?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(Ve,{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(hs,{children:[s.jsx(fs,{children:s.jsxs(gt,{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(ps,{children:Jt.map(M=>s.jsxs(gt,{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(Q,{variant:"ghost",size:"sm",className:"text-[#38bdac] hover:bg-[#38bdac]/10",onClick:()=>Wa(M.id,M.nickname||"微信用户"),children:[s.jsx(af,{className:"w-4 h-4 mr-1"})," 行为轨迹"]})})]},M.id))})]})]}),s.jsx(Ft,{open:!!wi,onOpenChange:M=>{M||ca(null)},children:s.jsxs(zt,{className:"sm:max-w-[600px] bg-[#0f2137] border-gray-700 text-white max-h-[80vh] overflow-y-auto",children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(na,{className:"w-5 h-5 text-[#38bdac]"}),da," 的行为轨迹"]})}),gr?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Ve,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):zr.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"}),zr.map((M,ge)=>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||ge))]})]})})]}),s.jsxs(nn,{value:"rules",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"用户旅程触达规则:各行为节点的触发条件与展示文案(偏利他说明,少用命令式)"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(Q,{variant:"outline",onClick:Nr,disabled:vn,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 ${vn?"animate-spin":""}`})," 刷新"]}),s.jsxs(Q,{onClick:()=>{Un(null),xn({title:"",description:"",trigger:"",triggerConditions:[],actionType:"popup",sort:0,enabled:!0}),Cn(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(On,{className:"w-4 h-4 mr-2"})," 添加规则"]})]})]}),vn?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Ve,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):Rt.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(Zs,{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(Q,{onClick:Nr,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:Rt.map(M=>{var Ne;const ge=d2(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(en,{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}),ge.length>0&&s.jsxs("div",{className:"flex flex-wrap gap-0.5 ml-1",children:[ge.slice(0,3).map(Le=>{const Be=K1.find(tt=>tt.value===Le);return s.jsx(He,{className:"bg-purple-500/10 text-purple-400 border border-purple-500/30 text-[9px]",children:(Be==null?void 0:Be.label)||Le},Le)}),ge.length>3&&s.jsxs("span",{className:"text-gray-500 text-[9px]",children:["+",ge.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:((Ne=q1.find(Le=>Le.value===M.actionType))==null?void 0:Ne.label)||M.actionType})]}),s.jsxs("div",{className:"flex items-center gap-1.5 ml-3 shrink-0",children:[s.jsx(Ht,{checked:M.enabled,onCheckedChange:()=>_o(M)}),s.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>{Un(M),xn({title:M.title,description:M.description,trigger:M.trigger,triggerConditions:ge,actionType:M.actionType||"popup",sort:M.sort,enabled:M.enabled}),Cn(!0)},className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10 h-7 w-7 p-0",children:s.jsx(en,{className:"w-3.5 h-3.5"})}),s.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>Va(M.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10 h-7 w-7 p-0",children:s.jsx(Ns,{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(nn,{value:"vip-roles",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"展示当前所有有效的超级个体(VIP 用户),用于检查会员信息与排序值。"}),s.jsx("p",{className:"text-xs text-[#38bdac]",children:"提示:按住任意一行即可拖拽排序,释放后将同步更新小程序展示顺序。"})]}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs(Q,{variant:"outline",onClick:hn,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:"加载中..."})]}):Nn.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(Ec,{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($e,{className:"p-0",children:s.jsxs(hs,{children:[s.jsx(fs,{children:s.jsxs(gt,{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(ps,{children:Nn.map((M,ge)=>{var Be;const Ne=rt===M.id,Le=kt===M.id;return s.jsxs(gt,{draggable:!0,onDragStart:tt=>Ii(tt,M.id),onDragOver:tt=>Ri(tt,M.id),onDrop:tt=>as(tt,M.id),onDragEnd:Vl,className:`border-gray-700/50 cursor-grab active:cursor-grabbing select-none ${Ne?"opacity-60":""} ${Le?"bg-[#38bdac]/10":""}`,children:[s.jsx(ke,{className:"text-gray-300",children:ge+1}),s.jsx(ke,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[Oo(M.avatar,M.mbti)?s.jsx("img",{src:Oo(M.avatar,M.mbti),className:"w-8 h-8 rounded-full object-cover border border-amber-400/60",alt:"",onError:tt=>{var Ge,Qt;tt.target.style.display="none";const on=document.createElement("div");on.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",on.textContent=((Ge=M.name)==null?void 0:Ge[0])||"创",(Qt=tt.target.parentElement)==null||Qt.appendChild(on)}}):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:((Be=M.name)==null?void 0:Be[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??ge+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(Q,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-amber-300 hover:text-amber-200",onClick:()=>or(M),title:"设置超级个体标签",children:s.jsx(Hd,{className:"w-3.5 h-3.5"})}),s.jsx(Q,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-[#38bdac] hover:text-[#5fe0cd]",onClick:()=>Bs(M),title:"编辑飞书群Webhook",children:s.jsx(en,{className:"w-3.5 h-3.5"})}),s.jsx(Q,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-sky-300 hover:text-sky-200",onClick:()=>Ai(M),title:"设置排序序号",children:s.jsx(mx,{className:"w-3.5 h-3.5"})})]})})]},M.id)})})]})})})]})]}),s.jsx(Ft,{open:Ke,onOpenChange:Nt,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-6xl",children:[s.jsx(Bt,{children:s.jsx(Vt,{className:"text-white",children:"MBTI 默认头像库"})}),s.jsx(QP,{})]})}),s.jsx(Ft,{open:sd,onOpenChange:M=>{Ha(M),M||qr(null)},children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(mx,{className:"w-5 h-5 text-[#38bdac]"}),"设置排序 — ",kr==null?void 0:kr.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:Ua,onChange:M=>zo(M.target.value)})]}),s.jsxs(yn,{children:[s.jsxs(Q,{variant:"outline",onClick:()=>Ha(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Jn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(Q,{onClick:Bl,disabled:Hs,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),Hs?"保存中...":"保存"]})]})]})}),s.jsx(Ft,{open:Fl,onOpenChange:M=>{zs(M),M||Fs(null)},children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(Ec,{className:"w-5 h-5 text-amber-400"}),"设置超级个体标签 — ",wr==null?void 0:wr.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:nd.map(M=>s.jsx(Q,{variant:As===M?"default":"outline",size:"sm",className:As===M?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50",onClick:()=>Is(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:As,onChange:M=>Is(M.target.value)})]})]}),s.jsxs(yn,{children:[s.jsxs(Q,{variant:"outline",onClick:()=>zs(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Jn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(Q,{onClick:()=>Kr(As),disabled:pa,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),pa?"保存中...":"保存"]})]})]})}),s.jsx(Ft,{open:Fn,onOpenChange:M=>{Mi(M),M||jr(null)},children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-xl",children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(en,{className:"w-5 h-5 text-[#38bdac]"}),"设置飞书群 Webhook — ",xs==null?void 0:xs.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:$o,onChange:M=>Wr(M.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"当用户点击该超级个体头像并提交链接时,线索将优先推送到这里配置的飞书群。"})]}),s.jsxs(yn,{children:[s.jsxs(Q,{variant:"outline",onClick:()=>Mi(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Jn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(Q,{onClick:Vs,disabled:ir,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),ir?"保存中...":"保存"]})]})]})}),s.jsx(Ft,{open:de,onOpenChange:I,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[G?s.jsx(en,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(Cc,{className:"w-5 h-5 text-[#38bdac]"}),G?"编辑用户":"添加用户"]})}),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:yt.phone,onChange:M=>Dt({...yt,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:yt.nickname,onChange:M=>Dt({...yt,nickname:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:G?"新密码 (留空则不修改)":"密码"}),s.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:G?"留空则不修改":"请输入密码",value:yt.password,onChange:M=>Dt({...yt,password:M.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(ne,{className:"text-gray-300",children:"管理员权限"}),s.jsx(Ht,{checked:yt.isAdmin,onCheckedChange:M=>Dt({...yt,isAdmin:M})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(ne,{className:"text-gray-300",children:"已购全书"}),s.jsx(Ht,{checked:yt.hasFullBook,onCheckedChange:M=>Dt({...yt,hasFullBook:M})})]})]}),s.jsxs(yn,{children:[s.jsxs(Q,{variant:"outline",onClick:()=>I(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Jn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(Q,{onClick:Do,disabled:me,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),me?"保存中...":"保存"]})]})]})}),s.jsx(Ft,{open:Zt,onOpenChange:Cn,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[90vh] overflow-y-auto",children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(en,{className:"w-5 h-5 text-[#38bdac]"}),zn?"编辑规则":"添加规则"]})}),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:It.title,onChange:M=>xn({...It,title:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"规则描述"}),s.jsx(kl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[60px] resize-none",placeholder:"弹窗内容/推送文案...",value:It.description,onChange:M=>xn({...It,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 ge=K1.filter(Ne=>Ne.group===M);return ge.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:ge.map(Ne=>{const Le=(It.triggerConditions||[]).includes(Ne.value);return s.jsx("button",{type:"button",className:`px-2.5 py-1 rounded-md text-xs border transition-colors ${Le?"bg-[#38bdac]/20 border-[#38bdac]/50 text-[#38bdac]":"bg-[#0a1628] border-gray-700 text-gray-400 hover:border-gray-500"}`,onClick:()=>{const Be=It.triggerConditions||[],tt=Le?Be.filter(on=>on!==Ne.value):[...Be,Ne.value];xn({...It,triggerConditions:tt})},children:Ne.label},Ne.value)})})]},M)})}),(It.triggerConditions||[]).length>0&&s.jsxs("p",{className:"text-[10px] text-[#38bdac]",children:["已选 ",(It.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:It.trigger,onChange:M=>xn({...It,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:q1.map(M=>s.jsxs("button",{type:"button",className:`p-2 rounded-lg border text-left transition-colors ${It.actionType===M.value?"bg-[#38bdac]/15 border-[#38bdac]/50":"bg-[#0a1628] border-gray-700 hover:border-gray-500"}`,onClick:()=>xn({...It,actionType:M.value}),children:[s.jsx("span",{className:`text-xs font-medium ${It.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(Ht,{checked:It.enabled,onCheckedChange:M=>xn({...It,enabled:M})})]})]}),s.jsxs(yn,{children:[s.jsxs(Q,{variant:"outline",onClick:()=>Cn(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Jn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(Q,{onClick:Ba,disabled:me,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),me?"保存中...":"保存"]})]})]})}),s.jsx(Ft,{open:F,onOpenChange:U,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(Dn,{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:((ue=fe.stats)==null?void 0:ue.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:((je=fe.stats)==null?void 0:je.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:["¥",(((We=fe.stats)==null?void 0:We.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:["¥",(((ht=fe.stats)==null?void 0:ht.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:"加载中..."})]}):(((At=fe.referrals)==null?void 0:At.length)??0)>0?s.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(fe.referrals??[]).map((M,ge)=>{var Le;const Ne=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:((Le=Ne.nickname)==null?void 0:Le.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white text-sm",children:Ne.nickname}),s.jsx("div",{className:"text-xs text-gray-500",children:Ne.phone||(Ne.hasOpenId?"微信用户":"未绑定")})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[Ne.status==="vip"&&s.jsx(He,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),Ne.status==="paid"&&s.jsxs(He,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",Ne.purchasedSections,"章"]}),Ne.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:Ne.createdAt?new Date(Ne.createdAt).toLocaleDateString():""})]})]},Ne.id||ge)})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),s.jsx(yn,{children:s.jsx(Q,{variant:"outline",onClick:()=>U(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),s.jsx(V0,{open:J,onClose:()=>te(!1),userId:be,onUserUpdated:fa})]})}function ff(t,[e,n]){return Math.min(n,Math.max(e,t))}var u2=["PageUp","PageDown"],h2=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],f2={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Jc="Slider",[Tg,e8,t8]=$0(Jc),[p2]=To(Jc,[t8]),[n8,gp]=p2(Jc),m2=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"?s8:r8,[R=[],L]=vl({prop:f,defaultProp:h,onChange:Y=>{var ae;(ae=[...N.current][k.current])==null||ae.focus(),m(Y)}}),q=y.useRef(R);function _(Y){const V=c8(R,Y);se(Y,V)}function H(Y){se(Y,k.current)}function P(){const Y=q.current[k.current];R[k.current]!==Y&&x(R)}function se(Y,V,{commit:ae}={commit:!1}){const le=f8(i),de=p8(Math.round((Y-r)/i)*i+r,le),I=ff(de,[r,a]);L((G=[])=>{const z=o8(G,I,V);if(h8(z,u*i)){k.current=z.indexOf(I);const me=String(z)!==String(G);return me&&ae&&x(z),me?z:G}else return G})}return s.jsx(n8,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:a,valueIndexToChangeRef:k,thumbs:N.current,values:R,orientation:o,form:v,children:s.jsx(Tg.Provider,{scope:t.__scopeSlider,children:s.jsx(Tg.Slot,{scope:t.__scopeSlider,children:s.jsx(C,{"aria-disabled":c,"data-disabled":c?"":void 0,...w,ref:e,onPointerDown:wt(w.onPointerDown,()=>{c||(q.current=R)}),min:r,max:a,inverted:b,onSlideStart:c?void 0:_,onSlideMove:c?void 0:H,onSlideEnd:c?void 0:P,onHomeKeyDown:()=>!c&&se(r,0,{commit:!0}),onEndKeyDown:()=>!c&&se(a,R.length-1,{commit:!0}),onStepKeyDown:({event:Y,direction:V})=>{if(!c){const de=u2.includes(Y.key)||Y.shiftKey&&h2.includes(Y.key)?10:1,I=k.current,G=R[I],z=i*de*V;se(G+z,I,{commit:!0})}}})})})})});m2.displayName=Jc;var[x2,g2]=p2(Jc,{startEdge:"left",endEdge:"right",size:"width",direction:1}),s8=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=Gt(e,C=>x(C)),v=y.useRef(void 0),w=pp(a),N=w==="ltr",k=N&&!i||!N&&i;function E(C){const R=v.current||m.getBoundingClientRect(),L=[0,R.width],_=H0(L,k?[n,r]:[r,n]);return v.current=R,_(C-R.left)}return s.jsx(x2,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:s.jsx(y2,{dir:w,"data-orientation":"horizontal",...f,ref:b,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:C=>{const R=E(C.clientX);o==null||o(R)},onSlideMove:C=>{const R=E(C.clientX);c==null||c(R)},onSlideEnd:()=>{v.current=void 0,u==null||u()},onStepKeyDown:C=>{const L=f2[k?"from-left":"from-right"].includes(C.key);h==null||h({event:C,direction:L?-1:1})}})})}),r8=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),x=y.useRef(void 0),b=!a;function v(w){const N=x.current||f.current.getBoundingClientRect(),k=[0,N.height],C=H0(k,b?[r,n]:[n,r]);return x.current=N,C(w-N.top)}return s.jsx(x2,{scope:t.__scopeSlider,startEdge:b?"bottom":"top",endEdge:b?"top":"bottom",size:"height",direction:b?1:-1,children:s.jsx(y2,{"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=f2[b?"from-bottom":"from-top"].includes(w.key);u==null||u({event:w,direction:k?-1:1})}})})}),y2=y.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:a,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:c,onStepKeyDown:u,...h}=t,f=gp(Jc,n);return s.jsx(Tt.span,{...h,ref:e,onKeyDown:wt(t.onKeyDown,m=>{m.key==="Home"?(o(m),m.preventDefault()):m.key==="End"?(c(m),m.preventDefault()):u2.concat(h2).includes(m.key)&&(u(m),m.preventDefault())}),onPointerDown:wt(t.onPointerDown,m=>{const x=m.target;x.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(x)?x.focus():r(m)}),onPointerMove:wt(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&a(m)}),onPointerUp:wt(t.onPointerUp,m=>{const x=m.target;x.hasPointerCapture(m.pointerId)&&(x.releasePointerCapture(m.pointerId),i(m))})})}),b2="SliderTrack",v2=y.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=gp(b2,n);return s.jsx(Tt.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...r,ref:e})});v2.displayName=b2;var Eg="SliderRange",N2=y.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=gp(Eg,n),i=g2(Eg,n),o=y.useRef(null),c=Gt(e,o),u=a.values.length,h=a.values.map(x=>k2(x,a.min,a.max)),f=u>1?Math.min(...h):0,m=100-Math.max(...h);return s.jsx(Tt.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...r,ref:c,style:{...t.style,[i.startEdge]:f+"%",[i.endEdge]:m+"%"}})});N2.displayName=Eg;var Mg="SliderThumb",w2=y.forwardRef((t,e)=>{const n=e8(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(a8,{...t,ref:i,index:o})}),a8=y.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:a,...i}=t,o=gp(Mg,n),c=g2(Mg,n),[u,h]=y.useState(null),f=Gt(e,E=>h(E)),m=u?o.form||!!u.closest("form"):!0,x=B0(u),b=o.values[r],v=b===void 0?0:k2(b,o.min,o.max),w=l8(r,o.values.length),N=x==null?void 0:x[c.size],k=N?d8(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(Tg.ItemSlot,{scope:t.__scopeSlider,children:s.jsx(Tt.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:wt(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),m&&s.jsx(j2,{name:a??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:b},r)]})});w2.displayName=Mg;var i8="RadioBubbleInput",j2=y.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const a=y.useRef(null),i=Gt(a,r),o=F0(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(Tt.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});j2.displayName=i8;function o8(t=[],e,n){const r=[...t];return r[n]=e,r.sort((a,i)=>a-i)}function k2(t,e,n){const i=100/(n-e)*(t-e);return ff(i,[0,100])}function l8(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function c8(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 d8(t,e,n){const r=t/2,i=H0([0,50],[0,r]);return(r-i(e)*n)*n}function u8(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function h8(t,e){if(e>0){const n=u8(t);return Math.min(...n)>=e}return!0}function H0(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 f8(t){return(String(t).split(".")[1]||"").length}function p8(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var m8=m2,x8=v2,g8=N2,y8=w2;function b8({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(m8,{defaultValue:e,value:n,min:r,max:a,className:Lt("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(g8,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:o.length},(c,u)=>s.jsx(y8,{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 v8={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,withdrawFee:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function S2(t){const e=!!(t!=null&&t.embedded),[n,r]=y.useState(v8),[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 Ct("/api/admin/referral-settings",f);if(!m||m.success===!1){Z.error("保存失败: "+(m&&typeof m=="object"&&"error"in m?m.error:""));return}Z.success(`✅ 分销配置已保存成功! + +• 小程序与网站的推广规则会一起生效 +• 绑定关系会使用新的天数配置 +• 佣金比例会立即应用到新订单 + +如有缓存,请刷新前台/小程序页面。`)}catch(f){console.error(f),Z.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(Lc,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置(与系统设置中的「推广功能」开关配合:开关在"," ",s.jsx(Pc,{to:"/settings",className:"text-[#38bdac] underline hover:text-[#5ee0d1]",children:"系统设置 → 功能开关"}),")。"]})]}),s.jsxs(Q,{onClick:u,disabled:o||a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{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(dt,{children:[s.jsxs(ut,{className:"flex items-center gap-2 text-white",children:[s.jsx(OM,{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(Nh,{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(Dn,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(b8,{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(Nh,{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(Nh,{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(Dn,{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(dt,{children:[s.jsxs(ut,{className:"flex items-center gap-2 text-white",children:[s.jsx(Lc,{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(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(Ht,{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(dt,{children:s.jsxs(ut,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[s.jsx(Nh,{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 N8(){const[t]=T0(),[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,E]=y.useState(null),[C,R]=y.useState(""),[L,q]=y.useState("all"),[_,H]=y.useState(1),[P,se]=y.useState(10),[Y,V]=y.useState(0),[ae,le]=y.useState(new Set),[de,I]=y.useState(null),[G,z]=y.useState(""),[me,X]=y.useState(!1),[F,U]=y.useState(null),[fe,he]=y.useState(""),[oe,O]=y.useState(!1),[K,D]=y.useState(!1),[J,te]=y.useState(!1),[be,ze]=y.useState([]),[Ke,Nt]=y.useState(1),[yt,Dt]=y.useState(0),[Rt,Pn]=y.useState("");y.useEffect(()=>{vn()},[]),y.useEffect(()=>{const $=t.get("tab");($==="overview"||$==="orders"||$==="bindings"||$==="withdrawals"||$==="settings")&&n($)},[t]),y.useEffect(()=>{H(1)},[e,L]),y.useEffect(()=>{Ut(e)},[e]),y.useEffect(()=>{if(e==="orders"&&r==="giftpay"){Ut("giftPay",!0);return}["orders","bindings","withdrawals"].includes(e)&&Ut(e,!0)},[_,P,L,C,e,r,Ke,Rt]),y.useEffect(()=>{e==="withdrawals"&&It()},[e]);async function vn(){E(null);try{const $=await Oe("/api/admin/distribution/overview");$!=null&&$.success&&$.overview&&u($.overview)}catch($){console.error("[Admin] 概览接口异常:",$),E("加载概览失败")}try{const $=await Oe("/api/db/users");v(($==null?void 0:$.users)||[])}catch($){console.error("[Admin] 用户数据加载失败:",$)}}async function Ut($,Ie=!1){var vt;if(!(!Ie&&ae.has($))){N(!0);try{const Pt=b;switch($){case"overview":break;case"orders":{try{const bt=new URLSearchParams({page:String(_),pageSize:String(P),...L!=="all"&&{status:L},...C&&{search:C}}),ot=await Oe(`/api/admin/orders?${bt}`);if(ot!=null&&ot.success&&ot.orders){const _t=ot.orders.map(Jt=>{const an=Pt.find(tr=>tr.id===Jt.userId),rs=Jt.referrerId?Pt.find(tr=>tr.id===Jt.referrerId):null;return{...Jt,amount:parseFloat(String(Jt.amount))||0,userNickname:(an==null?void 0:an.nickname)||Jt.userNickname||"未知用户",userPhone:(an==null?void 0:an.phone)||Jt.userPhone||"-",referrerNickname:(rs==null?void 0:rs.nickname)||null,referrerCode:(rs==null?void 0:rs.referralCode)??null,type:Jt.productType||Jt.type}});o(_t),V(ot.total??_t.length)}else o([]),V(0)}catch(bt){console.error(bt),E("加载订单失败"),o([])}break}case"bindings":{try{const bt=new URLSearchParams({page:String(_),pageSize:String(P),...L!=="all"&&{status:L}}),ot=await Oe(`/api/db/distribution?${bt}`);f((ot==null?void 0:ot.bindings)||[]),V((ot==null?void 0:ot.total)??((vt=ot==null?void 0:ot.bindings)==null?void 0:vt.length)??0)}catch(bt){console.error(bt),E("加载绑定数据失败"),f([])}break}case"withdrawals":{try{const bt=L==="completed"?"success":L==="rejected"?"failed":L,ot=new URLSearchParams({...bt&&bt!=="all"&&{status:bt},page:String(_),pageSize:String(P)}),_t=await Oe(`/api/admin/withdrawals?${ot}`);if(_t!=null&&_t.success&&_t.withdrawals){const Jt=_t.withdrawals.map(an=>({...an,account:an.account??"未绑定微信号",status:an.status==="success"?"completed":an.status==="failed"?"rejected":an.status}));x(Jt),V((_t==null?void 0:_t.total)??Jt.length)}else _t!=null&&_t.success||E(`获取提现记录失败: ${(_t==null?void 0:_t.error)||"未知错误"}`),x([])}catch(bt){console.error(bt),E("加载提现数据失败"),x([])}break}case"giftPay":{try{const bt=new URLSearchParams({page:String(Ke),pageSize:"20",...Rt&&{status:Rt}}),ot=await Oe(`/api/admin/gift-pay-requests?${bt}`);ot!=null&&ot.success&&ot.data?(ze(ot.data),Dt(ot.total??ot.data.length)):(ze([]),Dt(0))}catch(bt){console.error(bt),E("加载代付请求失败"),ze([])}break}}le(bt=>new Set(bt).add($))}catch(Pt){console.error(Pt)}finally{N(!1)}}}async function Zt(){E(null),le($=>{const Ie=new Set($);return Ie.delete(e),e==="orders"&&r==="giftpay"&&Ie.delete("giftPay"),Ie}),e==="overview"&&vn(),e==="orders"&&r==="giftpay"?await Ut("giftPay",!0):await Ut(e,!0)}async function Cn($){if(confirm("确认审核通过并打款?"))try{const Ie=await Yt("/api/admin/withdrawals",{id:$,action:"approve"});if(!(Ie!=null&&Ie.success)){const vt=(Ie==null?void 0:Ie.message)||(Ie==null?void 0:Ie.error)||"操作失败";Z.error(vt);return}await Zt()}catch(Ie){console.error(Ie),Z.error("操作失败")}}function zn($){U($),he("")}async function Un(){const $=F;if(!$)return;const Ie=fe.trim();if(!Ie){Z.error("请填写拒绝原因");return}O(!0);try{const vt=await Yt("/api/admin/withdrawals",{id:$,action:"reject",errorMessage:Ie});if(!(vt!=null&&vt.success)){Z.error((vt==null?void 0:vt.error)||"操作失败");return}Z.success("已拒绝该提现申请"),U(null),he(""),await Zt()}catch(vt){console.error(vt),Z.error("操作失败")}finally{O(!1)}}async function It(){try{const $=await Oe("/api/admin/withdrawals/auto-approve");$!=null&&$.success&&typeof $.enableAutoApprove=="boolean"&&D($.enableAutoApprove)}catch{}}async function xn($){te(!0);try{const Ie=await Yt("/api/admin/withdrawals/auto-approve",{enableAutoApprove:$});Ie!=null&&Ie.success?(D($),Z.success($?"已开启自动审批,新提现将自动打款":"已关闭自动审批")):Z.error("更新失败: "+((Ie==null?void 0:Ie.error)??""))}catch{Z.error("更新失败")}finally{te(!1)}}function Nn(){F&&Z.info("已取消操作"),U(null),he("")}async function we(){var $;if(!(!(de!=null&&de.orderSn)&&!(de!=null&&de.id))){X(!0),E(null);try{const Ie=await Yt("/api/admin/orders/refund",{orderSn:de.orderSn||de.id,reason:G||void 0});Ie!=null&&Ie.success?(I(null),z(""),await Ut("orders",!0)):E((Ie==null?void 0:Ie.error)||"退款失败")}catch(Ie){const vt=Ie;E((($=vt==null?void 0:vt.data)==null?void 0:$.error)||"退款失败,请检查网络后重试")}finally{X(!1)}}}function Te($){const Ie={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(He,{className:`${Ie[$]||"bg-gray-500/20 text-gray-400"} border-0`,children:vt[$]||$})}const Ue=Math.ceil(Y/P)||1,rt=i,Mt=h.filter($=>{var vt,Pt,bt,ot;if(!C)return!0;const Ie=C.toLowerCase();return((vt=$.refereeNickname)==null?void 0:vt.toLowerCase().includes(Ie))||((Pt=$.refereePhone)==null?void 0:Pt.includes(Ie))||((bt=$.referrerName)==null?void 0:bt.toLowerCase().includes(Ie))||((ot=$.referrerCode)==null?void 0:ot.toLowerCase().includes(Ie))}),kt=m.filter($=>{var vt;if(!C)return!0;const Ie=C.toLowerCase();return((vt=$.userName)==null?void 0:vt.toLowerCase().includes(Ie))||$.account&&$.account.toLowerCase().includes(Ie)});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:()=>E(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(Q,{onClick:Zt,disabled:w,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?"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:of},{key:"orders",label:"订单与代付",icon:rf},{key:"bindings",label:"绑定管理",icon:ka},{key:"withdrawals",label:"提现审核",icon:Lc},{key:"settings",label:"推广设置",icon:co}].map($=>s.jsxs("button",{type:"button",onClick:()=>{n($.key),q("all"),R(""),$.key!=="orders"&&a("orders")},className:`flex-1 flex items-center justify-center gap-1.5 px-3 py-2 rounded-md text-sm transition-all ${e===$.key?"bg-[#38bdac] text-white shadow-md":"text-gray-400 hover:text-white hover:bg-gray-700/40"}`,children:[s.jsx($.icon,{className:"w-3.5 h-3.5"}),$.label]},$.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($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(gi,{className:"w-4 h-4 text-amber-400"}),"推广转化漏斗"]}),s.jsx(Q,{type:"button",size:"sm",variant:"ghost",onClick:()=>void Zt(),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(af,{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(ka,{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(xx,{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(rf,{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($e,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(gg,{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($e,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Lc,{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(Q,{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($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(Dn,{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(xx,{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"),Ut("giftPay",!0)},children:[s.jsx(yg,{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(Ca,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ce,{value:C,onChange:$=>R($.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:L,onChange:$=>q($.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(Q,{type:"button",variant:"outline",onClick:()=>void Zt(),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($e,{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:rt.map($=>{var Ie,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:[(Ie=$.id)==null?void 0:Ie.slice(0,12),"..."]}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:$.userNickname}),s.jsx("p",{className:"text-gray-500 text-xs",children:$.userPhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:(()=>{const Pt=$.productType||$.type,bt=$.description||"",ot=String($.productId||$.sectionId||""),_t=Pt==="vip"||bt.includes("VIP")||bt.toLowerCase().includes("vip")||ot.toLowerCase().includes("vip");return Pt==="balance_recharge"?`余额充值 ¥${typeof $.amount=="number"?$.amount.toFixed(2):parseFloat(String($.amount||"0")).toFixed(2)}`:_t?"超级个体开通费用":Pt==="fullbook"?`${$.bookName||"《底层逻辑》"} - 全本`:Pt==="match"?"匹配次数购买":`${$.bookName||"《底层逻辑》"} - ${$.sectionTitle||$.chapterTitle||`章节${$.productId||$.sectionId||""}`}`})()}),s.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const Pt=$.productType||$.type,bt=$.description||"",ot=String($.productId||$.sectionId||""),_t=Pt==="vip"||bt.includes("VIP")||bt.toLowerCase().includes("vip")||ot.toLowerCase().includes("vip");return Pt==="balance_recharge"?"余额充值":_t?"超级个体":Pt==="fullbook"?"全书解锁":Pt==="match"?"功能权益":$.chapterTitle||"单章购买"})()})]})}),s.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof $.amount=="number"?$.amount.toFixed(2):parseFloat(String($.amount||"0")).toFixed(2)]}),s.jsx("td",{className:"p-4 text-gray-300",children:$.paymentMethod==="wechat"?"微信支付":$.paymentMethod==="balance"?"余额支付":$.paymentMethod==="alipay"?"支付宝":$.paymentMethod||"微信支付"}),s.jsx("td",{className:"p-4",children:$.status==="refunded"?s.jsx(He,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):$.status==="completed"||$.status==="paid"?s.jsx(He,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):$.status==="pending"||$.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:$.refundReason,children:$.status==="refunded"&&$.refundReason?$.refundReason:"-"}),s.jsx("td",{className:"p-4 text-gray-300 text-sm",children:$.referrerId||$.referralCode?s.jsxs("span",{title:$.referralCode||$.referrerCode||$.referrerId||"",children:[$.referrerNickname||$.referralCode||$.referrerCode||((vt=$.referrerId)==null?void 0:vt.slice(0,8)),($.referralCode||$.referrerCode)&&` (${$.referralCode||$.referrerCode})`]}):"-"}),s.jsx("td",{className:"p-4 text-[#FFD700]",children:$.referrerEarnings?`¥${(typeof $.referrerEarnings=="number"?$.referrerEarnings:parseFloat(String($.referrerEarnings))).toFixed(2)}`:"-"}),s.jsx("td",{className:"p-4 text-gray-400 text-sm",children:$.createdAt?new Date($.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:($.status==="paid"||$.status==="completed")&&s.jsxs(Q,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{I($),z("")},children:[s.jsx(Vj,{className:"w-3 h-3 mr-1"}),"退款"]})})]},$.id)})})]})}),e==="orders"&&s.jsx(Xs,{page:_,totalPages:Ue,total:Y,pageSize:P,onPageChange:H,onPageSizeChange:$=>{se($),H(1)}})]})})]}),r==="giftpay"&&s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(dt,{children:s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[s.jsx(ut,{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:Rt,onChange:$=>{Pn($.target.value),Nt(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(Q,{size:"sm",variant:"outline",onClick:()=>void Ut("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($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:be.map($=>s.jsxs("tr",{className:"hover:bg-[#0a1628]",children:[s.jsx("td",{className:"p-3 font-mono text-xs text-gray-400",children:$.requestSn}),s.jsx("td",{className:"p-3 text-white text-sm",children:$.initiatorNick||$.initiatorUserId}),s.jsxs("td",{className:"p-3",children:[s.jsxs("p",{className:"text-white",children:[$.productType," · ¥",$.amount.toFixed(2)]}),$.description&&s.jsx("p",{className:"text-gray-500 text-xs",children:$.description})]}),s.jsx("td",{className:"p-3 text-gray-400",children:($.quantity??1)>1?`${$.quantity}份 / 已领${$.redeemedCount??0}`:"-"}),s.jsx("td",{className:"p-3 text-gray-400",children:$.payerNick||($.payerUserId?$.payerUserId:"-")}),s.jsx("td",{className:"p-3",children:s.jsx(He,{className:$.status==="paid"?"bg-green-500/20 text-green-400 border-0":$.status==="pending"||$.status==="pending_pay"?"bg-amber-500/20 text-amber-400 border-0":$.status==="refunded"?"bg-red-500/20 text-red-400 border-0":"bg-gray-500/20 text-gray-400 border-0",children:$.status==="paid"?"已支付":$.status==="pending"||$.status==="pending_pay"?"待支付":$.status==="refunded"?"已退款":$.status==="cancelled"?"已取消":"已过期"})}),s.jsx("td",{className:"p-3 text-gray-400 text-xs",children:$.createdAt?new Date($.createdAt).toLocaleString("zh-CN"):"-"})]},$.id))})]})}),be.length===0&&!w&&s.jsx("p",{className:"text-center py-8 text-gray-500",children:"暂无代付请求"}),yt>20&&s.jsx("div",{className:"mt-4 flex justify-center",children:s.jsx(Xs,{page:Ke,totalPages:Math.ceil(yt/20),total:yt,pageSize:20,onPageChange:Nt,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(Ca,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ce,{value:C,onChange:$=>R($.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:L,onChange:$=>q($.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(Q,{type:"button",variant:"outline",onClick:()=>void Zt(),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($e,{className:"p-0",children:[Mt.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:Mt.map($=>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:$.refereeNickname||"匿名用户"}),s.jsx("p",{className:"text-gray-500 text-xs",children:$.refereePhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white",children:$.referrerName||"-"}),s.jsx("p",{className:"text-gray-500 text-xs font-mono",children:$.referrerCode})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:$.boundAt?new Date($.boundAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:$.expiresAt?new Date($.expiresAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:Te($.status)}),s.jsx("td",{className:"p-4",children:$.commission?s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",$.commission.toFixed(2)]}):s.jsx("span",{className:"text-gray-500",children:"-"})})]},$.id))})]})}),e==="bindings"&&s.jsx(Xs,{page:_,totalPages:Ue,total:Y,pageSize:P,onPageChange:H,onPageSizeChange:$=>{se($),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(Ca,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ce,{value:C,onChange:$=>R($.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:L,onChange:$=>q($.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(gi,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-sm text-gray-300",children:"自动审批"}),s.jsx(Ht,{checked:K,onCheckedChange:xn,disabled:J,className:"data-[state=checked]:bg-[#38bdac]"})]}),s.jsxs(Q,{type:"button",variant:"outline",onClick:()=>void Zt(),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($e,{className:"p-0",children:[kt.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:kt.map($=>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:[$.userAvatar?s.jsx("img",{src:$.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:($.userName||$.name||"?").slice(0,1)}),s.jsx("p",{className:"text-white font-medium",children:$.userName||$.name})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",$.amount.toFixed(2)]})}),s.jsx("td",{className:"p-4",children:s.jsx(He,{className:$.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:$.method==="wechat"?"微信":"支付宝"})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-mono text-xs",children:$.account}),s.jsx("p",{className:"text-gray-500 text-xs",children:$.name})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:$.createdAt?new Date($.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:Te($.status)}),s.jsx("td",{className:"p-4 max-w-[160px]",children:s.jsx("span",{className:`text-xs ${$.status==="rejected"||$.status==="failed"?"text-red-400":"text-gray-400"}`,title:$.remark,children:$.remark||"-"})}),s.jsx("td",{className:"p-4 text-right",children:$.status==="pending"&&s.jsxs("div",{className:"flex gap-2 justify-end",children:[s.jsxs(Q,{size:"sm",onClick:()=>Cn($.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(xx,{className:"w-4 h-4 mr-1"}),"通过"]}),s.jsxs(Q,{size:"sm",variant:"outline",onClick:()=>zn($.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[s.jsx(Dj,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},$.id))})]})}),e==="withdrawals"&&s.jsx(Xs,{page:_,totalPages:Ue,total:Y,pageSize:P,onPageChange:H,onPageSizeChange:$=>{se($),H(1)}})]})})]})]}),s.jsx(Ft,{open:!!de,onOpenChange:$=>!$&&I(null),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Bt,{children:s.jsx(Vt,{className:"text-white",children:"订单退款"})}),de&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",de.orderSn||de.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof de.amount=="number"?de.amount.toFixed(2):parseFloat(String(de.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:G,onChange:$=>z($.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(yn,{children:[s.jsx(Q,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>I(null),disabled:me,children:"取消"}),s.jsx(Q,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:we,disabled:me,children:me?"退款中...":"确认退款"})]})]})}),s.jsx(Ft,{open:!!F,onOpenChange:$=>!$&&Nn(),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Bt,{children:s.jsx(Vt,{className:"text-white",children:"拒绝提现"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"拒绝后该笔提现金额将返还用户余额。"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"拒绝原因(必填)"}),s.jsx("div",{className:"form-input",children:s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:fe,onChange:$=>he($.target.value)})})]})]}),s.jsxs(yn,{children:[s.jsx(Q,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:Nn,disabled:oe,children:"取消"}),s.jsx(Q,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:Un,disabled:oe||!fe.trim(),children:oe?"提交中...":"确认拒绝"})]})]})}),e==="settings"&&s.jsx("div",{className:"-mx-8 -mt-6",children:s.jsx(S2,{embedded:!0})})]})}function w8(){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),[E,C]=y.useState(null),[R,L]=y.useState(""),[q,_]=y.useState(!1);async function H(){var I,G,z,me,X,F,U;i(!0),c(null);try{const fe=new URLSearchParams({status:u,page:String(f),pageSize:String(x)}),he=await Oe(`/api/admin/withdrawals?${fe}`);if(he!=null&&he.success){const oe=he.withdrawals||[];e(oe),w(he.total??((I=he.stats)==null?void 0:I.total)??oe.length),r({total:((G=he.stats)==null?void 0:G.total)??he.total??oe.length,pendingCount:((z=he.stats)==null?void 0:z.pendingCount)??0,pendingAmount:((me=he.stats)==null?void 0:me.pendingAmount)??0,successCount:((X=he.stats)==null?void 0:X.successCount)??0,successAmount:((F=he.stats)==null?void 0:F.successAmount)??0,failedCount:((U=he.stats)==null?void 0:U.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,x]);const P=Math.ceil(v/x)||1;async function se(I){const G=t.find(z=>z.id===I);if(G!=null&&G.userCommissionInfo&&G.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${G.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():Z.error("操作失败: "+((z==null?void 0:z.error)??""))}catch{Z.error("操作失败")}finally{k(null)}}async function Y(I){if(confirm("确认撤回该笔打款?仅在用户未确认收款前可撤回。")){k(I);try{const G=await Ct("/api/admin/withdrawals/cancel",{id:I});G!=null&&G.success?(Z.success("已撤回打款"),H()):Z.error("撤回失败: "+((G==null?void 0:G.error)??"未知错误"))}catch{Z.error("撤回失败")}finally{k(null)}}}function V(I){C(I),L("")}async function ae(){const I=E;if(!I)return;const G=R.trim();if(!G){Z.error("请填写拒绝原因");return}_(!0);try{const z=await Yt("/api/admin/withdrawals",{id:I,action:"reject",errorMessage:G});z!=null&&z.success?(Z.success("已拒绝该提现申请"),C(null),L(""),H()):Z.error("操作失败: "+((z==null?void 0:z.error)??""))}catch{Z.error("操作失败")}finally{_(!1)}}function le(){E&&Z.info("已取消操作"),C(null),L("")}function de(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(Q,{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($e,{className:"p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(rf,{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($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(_e,{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(_e,{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(_e,{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(Q,{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($e,{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(Lc,{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:Ea(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:de(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(Q,{size:"sm",onClick:()=>se(I.id),disabled:N===I.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[s.jsx(dp,{className:"w-4 h-4 mr-1"}),"批准"]}),s.jsxs(Q,{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(Jn,{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(Q,{size:"sm",variant:"outline",onClick:()=>Y(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(Xs,{page:f,totalPages:P,total:v,pageSize:x,onPageChange:m,onPageSizeChange:I=>{b(I),m(1)}})]})})}),s.jsx(Ft,{open:!!E,onOpenChange:I=>!I&&le(),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Bt,{children:s.jsx(Vt,{className:"text-white",children:"拒绝提现"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"拒绝后该笔提现金额将返还用户余额。"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"拒绝原因(必填)"}),s.jsx("div",{className:"form-input",children:s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:R,onChange:I=>L(I.target.value)})})]})]}),s.jsxs(yn,{children:[s.jsx(Q,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:le,disabled:q,children:"取消"}),s.jsx(Q,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:ae,disabled:q||!R.trim(),children:q?"提交中...":"确认拒绝"})]})]})})]})}var Mx={exports:{}},Ax={};/** + * @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 J1;function j8(){if(J1)return Ax;J1=1;var t=gu();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 Ax.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,Ax}var Q1;function C2(){return Q1||(Q1=1,Mx.exports=j8()),Mx.exports}var T2=C2();function cs(t){this.content=t}cs.prototype={constructor:cs,find:function(t){for(var e=0;e>1}};cs.from=function(t){if(t instanceof cs)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new cs(e)};function E2(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=E2(a.content,i.content,n+1);if(o!=null)return o}n+=a.nodeSize}}function M2(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 Se(r,a)}cutByIndex(e,n){return e==n?Se.empty:e==0&&n==this.content.length?this:new Se(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 Se(a,i)}addToStart(e){return new Se([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Se(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?Ah(n+1,i):Ah(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 Se.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Se(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Se.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}};rn.none=[];class mf 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=I2(this.content,e+this.openStart,n);return r&&new Fe(r,this.openStart,this.openEnd)}removeBetween(e,n){return new Fe(A2(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(Se.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(Se.empty,0,0);function A2(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(A2(i.content,e-a-1,n-a-1)))}function I2(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=I2(o.content,e-i-1,n,o);return c&&t.replaceChild(a,o.copy(c))}function k8(t,e,n){if(n.openStart>t.depth)throw new mf("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new mf("Inconsistent open depths");return R2(t,e,n,0)}function R2(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 Ud(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&&(hl(t.nodeAfter,r),i++));for(let c=i;ca&&Ig(t,e,a+1),o=r.depth>a&&Ig(n,r,a+1),c=[];return Ud(null,t,a,c),i&&o&&e.index(a)==n.index(a)?(P2(i,o),hl(fl(i,L2(t,e,n,r,a+1)),c)):(i&&hl(fl(i,xf(t,e,a+1)),c),Ud(e,n,a,c),o&&hl(fl(o,xf(n,r,a+1)),c)),Ud(r,null,a,c),new Se(c)}function xf(t,e,n){let r=[];if(Ud(null,t,n,r),t.depth>n){let a=Ig(t,e,n+1);hl(fl(a,xf(t,e,n+1)),r)}return Ud(e,null,n,r),new Se(r)}function S8(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(Se.from(a));return{start:a.resolveNoCache(t.openStart+n),end:a.resolveNoCache(a.content.size-t.openEnd-n)}}class ru{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 gf(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 ru(n,r,i)}static resolveCached(e,n){let r=Y1.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()+")"),O2(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=Se.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=Se.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,a,r);return i.type.checkAttrs(i.attrs),i}};fi.prototype.text=void 0;class yf extends fi{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):O2(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 yf(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new yf(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 O2(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Sl{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new M8(e,n);if(r.next==null)return Sl.empty;let a=D2(r);r.next&&r.err("Unexpected trailing text");let i=D8(O8(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(` +`)}}Sl.empty=new Sl(!0);class M8{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 D2(t){let e=[];do e.push(A8(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function A8(t){let e=[];do e.push(I8(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function I8(t){let e=L8(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 X1(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=X1(t),r=n;return t.eat(",")&&(t.next!="}"?r=X1(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function P8(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 L8(t){if(t.eat("(")){let e=D2(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=P8(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 O8(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 Sl(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:z2(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new fi(this,this.computeAttrs(e),Se.from(n),rn.setFrom(r))}createChecked(e=null,n,r){return n=Se.from(n),this.checkContent(n),new fi(this,this.computeAttrs(e),n,rn.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=Se.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(Se.empty,!0);return i?new fi(this,e,n.append(i),rn.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 V2(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 z8{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 yp{constructor(e,n,r,a){this.name=e,this.rank=n,this.schema=r,this.spec=a,this.attrs=B2(e,a.attrs),this.excluded=null;let i=$2(this.attrs);this.instance=i?new rn(this,i):null}create(e=null){return!e&&this.instance?this.instance:new rn(this,z2(this.attrs,e))}static compile(e,n){let r=Object.create(null),a=0;return e.forEach((i,o)=>r[i]=new yp(i,a++,n,o)),r}removeFromSet(e){for(var n=0;n-1}}class H2{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=cs.from(e.nodes),n.marks=cs.from(e.marks||{}),this.nodes=eN.compile(this.spec.nodes,this),this.marks=yp.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]=Sl.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?tN(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==""?[]:tN(this,o.split(" "))}this.nodeFromJSON=a=>fi.fromJSON(this,a),this.markFromJSON=a=>rn.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 eN){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 yf(r,r.defaultAttrs,e,rn.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 tN(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 F8(t){return t.tag!=null}function B8(t){return t.style!=null}class xo{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(a=>{if(F8(a))this.tags.push(a);else if(B8(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 sN(this,n,!1);return r.addAll(e,rn.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new sN(this,n,!0);return r.addAll(e,rn.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=rN(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=rN(o)),o.node||o.ignore||o.mark||(o.node=a)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new xo(e,xo.schemaRules(e)))}}const U2={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},V8={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},W2={ol:!0,ul:!0},au=1,Pg=2,Wd=4;function nN(t,e,n){return e!=null?(e?au:0)|(e==="full"?Pg:0):t&&t.whitespace=="pre"?au|Pg:n&~Wd}class Ih{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=rn.none,this.match=i||(o&Wd?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Se.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&au)){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=Se.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(Se.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&&!U2.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class sN{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=nN(null,n.preserveWhitespace,0)|(r?Wd:0);a?i=new Ih(a.type,a.attrs,rn.none,!0,n.topMatch||a.type.contentMatch,o):r?i=new Ih(null,null,rn.none,!0,null,o):i=new Ih(e.schema.topNodeType,null,rn.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&Pg?"full":this.localPreserveWS||(a.options&au)>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):aN(h.type,e))?(u=h.addToSet(u),!1):!0),this.nodes.push(new Ih(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|=au)}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 H8(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&W2.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function U8(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function rN(t){let e={};for(let n in t)e[n]=t[n];return e}function aN(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&&Jh(Rx(r),a(e,n),null,e.attrs)}static renderSpec(e,n,r=null,a){return Jh(e,n,r,a)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ol(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=iN(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return iN(e.marks)}}function iN(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Rx(t){return t.document||window.document}const oN=new WeakMap;function W8(t){let e=oN.get(t);return e===void 0&&oN.set(t,e=K8(t)),e}function K8(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}=Jh(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 K2=65535,q2=Math.pow(2,16);function q8(t,e){return t+e*q2}function lN(t){return t&K2}function G8(t){return(t-(t&K2))/q2}const G2=1,J2=2,Qh=4,Q2=8;class Lg{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Q2)>0}get deletedBefore(){return(this.delInfo&(G2|Qh))>0}get deletedAfter(){return(this.delInfo&(J2|Qh))>0}get deletedAcross(){return(this.delInfo&Qh)>0}}class fr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&fr.empty)return fr.empty}recover(e){let n=0,r=lN(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:q8(c/3,e-u),w=e==u?J2:e==m?G2:Qh;return(n<0?e!=u:e!=m)&&(w|=Q2),new Lg(b,w,v)}a+=f-h}return r?e+a:new Lg(e+a,0,null)}touches(e,n){let r=0,a=lN(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 iu;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;ri&&u!o.isAtom||!c.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),a),n.openStart,n.openEnd);return Vn.fromReplace(e,this.from,this.to,i)}invert(){return new ra(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 uo(n.pos,r.pos,this.mark)}merge(e){return e instanceof uo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new uo(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 uo(n.from,n.to,e.markFromJSON(n.mark))}}Cs.jsonID("addMark",uo);class ra extends Cs{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(U0(n.content,a=>a.mark(this.mark.removeFromSet(a.marks)),e),n.openStart,n.openEnd);return Vn.fromReplace(e,this.from,this.to,r)}invert(){return new uo(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 ra(n.pos,r.pos,this.mark)}merge(e){return e instanceof ra&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ra(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 ra(n.from,n.to,e.markFromJSON(n.mark))}}Cs.jsonID("removeMark",ra);class ho extends Cs{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Vn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Vn.fromReplace(e,this.pos,this.pos+1,new Fe(Se.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 ns(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 ns(n.from,n.to,n.gapFrom,n.gapTo,Fe.fromJSON(e,n.slice),n.insert,!!n.structure)}}Cs.jsonID("replaceAround",ns);function Og(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 J8(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 Q8(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 yp){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 ra(o.from,o.to,o.style)))}function W0(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 Y8(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Qc(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=Se.from(r.node(v).copy(f)),m++):u--;let x=Se.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=Se.from(n[o].type.create(n[o].attrs,r))}let a=e.start,i=e.end;t.step(new ns(a,i,a,i,new Fe(r,0,0),n.length,!0))}function nL(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)&&sL(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&&X2(t,o,c,i),W0(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 ns(m,x,m+1,x-1,new Fe(Se.from(r.create(u,null,o.marks)),0,0),1,!0)),h===!0&&Y2(t,o,c,i),!1}})}function Y2(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 X2(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 sL(t,e,n){let r=t.resolve(e),a=r.index();return r.parent.canReplaceWith(a,a+1,n)}function rL(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 ns(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new Fe(Se.from(o),0,0),1,!0))}function pi(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 aL(t,e,n=1,r){let a=t.doc.resolve(e),i=Se.empty,o=Se.empty;for(let c=a.depth,u=a.depth-n,h=n-1;c>u;c--,h--){i=Se.from(a.node(c).copy(i));let f=r&&r[h];o=Se.from(f?f.type.create(f.attrs,o):a.node(c).copy(o))}t.step(new ts(e,e,new Fe(i.append(o),n,n),!0))}function Eo(t,e){let n=t.resolve(e),r=n.index();return Z2(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function iL(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&&Z2(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 oL(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);X2(t,f.node(),f.before(),c)}o.inlineContent&&W0(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 ts(h,u.map(e+n,-1),Fe.empty,!0)),r===!0){let f=t.doc.resolve(h);Y2(t,f.node(),f.before(),t.steps.length)}return t}function lL(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 vp(t,e,n=e,r=Fe.empty){if(e==n&&!r.size)return null;let a=t.resolve(e),i=t.resolve(n);return tS(a,i,r)?new ts(e,n,r):new cL(a,i,r).fit()}function tS(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class cL{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=Se.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=Se.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 ns(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new ts(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=Lx(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(Se.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=Lx(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=Lx(e,n);if(a.childCount<=1&&n>0){let i=e.size-n<=n+a.size;this.unplaced=new Fe(Od(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new Fe(Od(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(nS(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=Dd(this.placed,n,Se.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=Ox(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=Dd(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=Dd(this.placed,this.depth,Se.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(Se.empty,!0);n.childCount&&(this.placed=Dd(this.placed,this.frontier.length,n))}}function Od(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Od(t.firstChild.content,e-1,n)))}function Dd(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Dd(t.lastChild.content,e-1,n)))}function Lx(t,e){for(let n=0;n1&&(r=r.replaceChild(0,nS(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(Se.empty,!0)))),t.copy(r)}function Ox(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&&!dL(n,i.content,o)?c:null}function dL(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=uL(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 sS(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(Se.empty,!0))}return t}function fL(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let a=lL(t.doc,e,r.type);a!=null&&(e=n=a)}t.replaceRange(e,n,new Fe(Se.from(r),0,0))}function pL(t,e,n){let r=t.doc.resolve(e),a=t.doc.resolve(n),i=rS(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 rS(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 Ac extends Cs{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Vn.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let a=n.type.create(r,null,n.marks);return Vn.fromReplace(e,this.pos,this.pos+1,new Fe(Se.from(a),0,n.isLeaf?0:1))}getMap(){return fr.empty}invert(e){return new Ac(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 Ac(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 Ac(n.pos,n.attr,n.value)}}Cs.jsonID("attr",Ac);class ou extends Cs{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let a in e.attrs)n[a]=e.attrs[a];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Vn.ok(r)}getMap(){return fr.empty}invert(e){return new ou(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 ou(n.attr,n.value)}}Cs.jsonID("docAttr",ou);let Dc=class extends Error{};Dc=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Dc.prototype=Object.create(Error.prototype);Dc.prototype.constructor=Dc;Dc.prototype.name="TransformError";class q0{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new iu}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Dc(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=vp(this.doc,e,n,r);return a&&this.step(a),this}replaceWith(e,n,r){return this.replace(e,n,new Fe(Se.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 hL(this,e,n,r),this}replaceRangeWith(e,n,r){return fL(this,e,n,r),this}deleteRange(e,n){return pL(this,e,n),this}lift(e,n){return X8(this,e,n),this}join(e,n=1){return oL(this,e,n),this}wrap(e,n){return tL(this,e,n),this}setBlockType(e,n=e,r,a=null){return nL(this,e,n,r,a),this}setNodeMarkup(e,n,r=null,a){return rL(this,e,n,r,a),this}setNodeAttribute(e,n,r){return this.step(new Ac(e,n,r)),this}setDocAttribute(e,n){return this.step(new ou(e,n)),this}addNodeMark(e,n){return this.step(new ho(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 rn)n.isInSet(r.marks)&&this.step(new Cl(e,n));else{let a=r.marks,i,o=[];for(;i=n.isInSet(a);)o.push(new Cl(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 aL(this,e,n,r),this}addMark(e,n,r){return J8(this,e,n,r),this}removeMark(e,n,r){return Q8(this,e,n,r),this}clearIncompatible(e,n,r){return W0(this,e,n,r),this}}const Dx=Object.create(null);class ft{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new aS(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?bc(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):bc(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 mr(e.node(0))}static atStart(e){return bc(e,e,0,0,1)||new mr(e)}static atEnd(e){return bc(e,e,e.content.size,e.childCount,-1)||new mr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Dx[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 Dx)throw new RangeError("Duplicate use of selection JSON ID "+e);return Dx[e]=n,n.prototype.jsonID=e,n}getBookmark(){return it.between(this.$anchor,this.$head).getBookmark()}}ft.prototype.visible=!0;class aS{constructor(e,n){this.$from=e,this.$to=n}}let dN=!1;function uN(t){!dN&&!t.parent.inlineContent&&(dN=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class it extends ft{constructor(e,n=e){uN(e),uN(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 it(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 it&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Np(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 it(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&&at.isSelectable(c))return at.create(t,n-(a<0?c.nodeSize:0))}else{let u=bc(t,c,n+a,a<0?c.childCount:0,a,i);if(u)return u}n+=c.nodeSize*a}return null}function hN(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 fN=1,Rh=2,pN=4;class xL extends q0{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|=Rh,this}ensureMarks(e){return rn.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&Rh)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Rh,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)||rn.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|=pN,this}get scrolledIntoView(){return(this.updated&pN)>0}}function mN(t,e){return!e||!t?t:t.bind(e)}class _d{constructor(e,n,r){this.name=e,this.init=mN(n.init,r),this.apply=mN(n.apply,r)}}const gL=[new _d("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new _d("selection",{init(t,e){return t.selection||ft.atStart(e.doc)},apply(t){return t.selection}}),new _d("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new _d("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class _x{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=gL.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 _d(r.key,r.spec.state,r))})}}class Tc{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 _x(e.schema,e.plugins),i=new Tc(a);return a.fields.forEach(o=>{if(o.name=="doc")i.doc=fi.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 iS(t,e,n){for(let r in t){let a=t[r];a instanceof Function?a=a.bind(e):r=="handleDOMEvents"&&(a=iS(a,e,{})),n[r]=a}return n}class un{constructor(e){this.spec=e,this.props={},e.props&&iS(e.props,this,this.props),this.key=e.key?e.key.key:oS("plugin")}getState(e){return e[this.key]}}const $x=Object.create(null);function oS(t){return t in $x?t+"$"+ ++$x[t]:($x[t]=0,t+"$")}class bn{constructor(e="key"){this.key=oS(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const J0=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function lS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const cS=(t,e,n)=>{let r=lS(t,n);if(!r)return!1;let a=Q0(r);if(!a){let o=r.blockRange(),c=o&&Qc(o);return c==null?!1:(e&&e(t.tr.lift(o,c).scrollIntoView()),!0)}let i=a.nodeBefore;if(yS(t,a,e,-1))return!0;if(r.parent.content.size==0&&(_c(i,"end")||at.isSelectable(i)))for(let o=r.depth;;o--){let c=vp(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},yL=(t,e,n)=>{let r=lS(t,n);if(!r)return!1;let a=Q0(r);return a?dS(t,a,e):!1},bL=(t,e,n)=>{let r=hS(t,n);if(!r)return!1;let a=Y0(r);return a?dS(t,a,e):!1};function dS(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=vp(t.doc,i,u,Fe.empty);if(!h||h.from!=i||h instanceof ts&&h.slice.size>=u-i)return!1;if(n){let f=t.tr.step(h);f.setSelection(it.create(f.doc,i)),n(f.scrollIntoView())}return!0}function _c(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 uS=(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=Q0(r)}let o=i&&i.nodeBefore;return!o||!at.isSelectable(o)?!1:(e&&e(t.tr.setSelection(at.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function Q0(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 hS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=hS(t,n);if(!r)return!1;let a=Y0(r);if(!a)return!1;let i=a.nodeAfter;if(yS(t,a,e,1))return!0;if(r.parent.content.size==0&&(_c(i,"start")||at.isSelectable(i))){let o=vp(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 at,a;if(r){if(n.node.isTextblock||!Eo(t.doc,n.from))return!1;a=n.from}else if(a=bp(t.doc,n.from,-1),a==null)return!1;if(e){let i=t.tr.join(a);r&&i.setSelection(at.create(i.doc,a-t.doc.resolve(a).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},NL=(t,e)=>{let n=t.selection,r;if(n instanceof at){if(n.node.isTextblock||!Eo(t.doc,n.to))return!1;r=n.to}else if(r=bp(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},wL=(t,e)=>{let{$from:n,$to:r}=t.selection,a=n.blockRange(r),i=a&&Qc(a);return i==null?!1:(e&&e(t.tr.lift(a,i).scrollIntoView()),!0)},mS=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(` +`).scrollIntoView()),!0)};function X0(t){for(let e=0;e{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let a=n.node(-1),i=n.indexAfter(-1),o=X0(a.contentMatchAt(i));if(!o||!a.canReplaceWith(i,i,o))return!1;if(e){let c=n.after(),u=t.tr.replaceWith(c,c,o.createAndFill());u.setSelection(ft.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},xS=(t,e)=>{let n=t.selection,{$from:r,$to:a}=n;if(n instanceof mr||r.parent.inlineContent||a.parent.inlineContent)return!1;let i=X0(a.parent.contentMatchAt(a.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&a.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(pi(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),a=r&&Qc(r);return a==null?!1:(e&&e(t.tr.lift(r,a).scrollIntoView()),!0)};function kL(t){return(e,n)=>{let{$from:r,$to:a}=e.selection;if(e.selection instanceof at&&e.selection.node.isBlock)return!r.parentOffset||!pi(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=X0(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 it||e.selection instanceof mr)&&f.deleteSelection();let m=f.mapping.map(r.pos),x=pi(f.doc,m,i.length,i);if(x||(i[0]=c?{type:c}:null,x=pi(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 SL=kL(),CL=(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(at.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||Eo(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function yS(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=Se.empty;for(let k=o.length-1;k>=0;k--)v=Se.from(o[k].create(null,v));v=Se.from(a.copy(v));let w=t.tr.step(new ns(e.pos-1,b,e.pos,b,new Fe(v,1,0),o.length,!0)),N=w.doc.resolve(b+2*o.length);N.nodeAfter&&N.nodeAfter.type==a.type&&Eo(w.doc,N.pos)&&w.join(N.pos),n(w.scrollIntoView())}return!0}let f=i.type.spec.isolating||r>0&&u?null:ft.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),x=m&&Qc(m);if(x!=null&&x>=e.depth)return n&&n(t.tr.lift(m,x).scrollIntoView()),!0;if(h&&_c(i,"start",!0)&&_c(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=Se.empty;for(let C=v.length-1;C>=0;C--)k=Se.from(v[C].copy(k));let E=t.tr.step(new ns(e.pos-v.length,e.pos+i.nodeSize,e.pos+N,e.pos+i.nodeSize-N,new Fe(k,v.length,0),0,!0));n(E.scrollIntoView())}return!0}}return!1}function bS(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(it.create(e.doc,t<0?a.start(i):a.end(i)))),!0):!1}}const EL=bS(-1),ML=bS(1);function AL(t,e=null){return function(n,r){let{$from:a,$to:i}=n.selection,o=a.blockRange(i),c=o&&K0(o,t,e);return c?(r&&r(n.tr.wrap(o,c).scrollIntoView()),!0):!1}}function xN(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 gf(u,u,e.depth),e.endIndex=0;f--)i=Se.from(n[f].type.create(n[f].attrs,i));t.step(new ns(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?OL(e,n,t,i):DL(e,n,i):!0:!1}}function OL(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?Se.empty:Se.from(a))))return!1;let m=i.pos,x=m+o.nodeSize;return r.step(new ns(m-(c?1:0),x+(u?1:0),m+1,x-1,new Fe((c?Se.empty:Se.from(a.copy(Se.empty))).append(u?Se.empty:Se.from(a.copy(Se.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=Se.from(h?t.create():null),m=new Fe(Se.from(t.create(null,Se.from(c.type.create(null,f)))),h?3:1,0),x=i.start,b=i.end;n(e.tr.step(new ns(x-(h?3:1),b,x,b,m,1,!0)).scrollIntoView())}return!0}}const ds=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},$c=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Dg=null;const li=function(t,e,n){let r=Dg||(Dg=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},$L=function(){Dg=null},Tl=function(t,e,n,r){return n&&(gN(t,e,n,r,-1)||gN(t,e,n,r,1))},zL=/^(img|br|input|textarea|hr)$/i;function gN(t,e,n,r,a){for(var i;;){if(t==n&&e==r)return!0;if(e==(a<0?0:Or(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Nu(t)||zL.test(t.nodeName)||t.contentEditable=="false")return!1;e=ds(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?Or(t):0}else return!1}}function Or(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function FL(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=Or(t)}else if(t.parentNode&&!Nu(t))e=ds(t),t=t.parentNode;else return null}}function BL(t,e){for(;;){if(t.nodeType==3&&e2),Lr=zc||(Ma?/Mac/.test(Ma.platform):!1),wS=Ma?/Win/.test(Ma.platform):!1,hi=/Android \d/.test(Mo),wu=!!yN&&"webkitFontSmoothing"in yN.documentElement.style,WL=wu?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function KL(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 si(t,e){return typeof t=="number"?t:t[e]}function qL(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 bN(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=$c(o);continue}let c=o,u=c==i.body,h=u?KL(i):qL(c),f=0,m=0;if(e.toph.bottom-si(r,"bottom")&&(m=e.bottom-e.top>h.bottom-h.top?e.top+si(a,"top")-h.top:e.bottom-h.bottom+si(a,"bottom")),e.lefth.right-si(r,"right")&&(f=e.right-h.right+si(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:$c(o)}}function GL(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:jS(t.dom)}}function jS(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=$c(r));return e}function JL({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;kS(n,r==0?0:r-e)}function kS(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?YL(n,a):!n||r&&n.nodeType==1?{node:t,offset:i}:SS(n,a)}function YL(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 ey(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function XL(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 e6(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 CS(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&a++}let h;wu&&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=e6(t,r,a,e))}c==null&&(c=ZL(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function vN(t){return t.top=0&&a==r.nodeValue.length?(u--,f=1):n<0?u--:h++,Id(to(li(r,u,h),f),f<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&a&&(n<0||a==Or(r))){let u=r.childNodes[a-1];if(u.nodeType==1)return zx(u.getBoundingClientRect(),!1)}if(i==null&&a=0)}if(i==null&&a&&(n<0||a==Or(r))){let u=r.childNodes[a-1],h=u.nodeType==3?li(u,Or(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(h)return Id(to(h,1),!1)}if(i==null&&a=0)}function Id(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 zx(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 ES(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 s6(t,e,n){let r=e.selection,a=n=="up"?r.$from:r.$to;return ES(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=TS(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=li(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 r6=/[\u0590-\u08ac]/;function a6(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?!r6.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?i:o:ES(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 NN=null,wN=null,jN=!1;function i6(t,e,n){return NN==e&&wN==n?jN:(NN=e,wN=n,jN=n=="up"||n=="down"?s6(t,e,n):a6(t,e,n))}const _r=0,kN=1,ll=2,Aa=3;class ju{constructor(e,n,r,a){this.parent=e,this.children=n,this.dom=r,this.contentDOM=a,this.dirty=_r,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;nds(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 AS){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 MS&&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?ds(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=ds(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?ll:kN,e==c&&n==u&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Aa:i.markDirty(e-c,n-c);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?ll:Aa}r=o}this.dirty=ll}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?ll:kN;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==_r&&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 o6 extends ju{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 El extends ju{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=Ol.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new El(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Aa||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Aa&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=_r){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(i=Bg(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}=Ol.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=PS(f,r,n),h?u=new l6(e,n,r,a,f,m||null,x,h,i,o+1):n.isText?new jp(e,n,r,a,f,x,i):new yo(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=()=>Se.empty)}return e}matchesNode(e,n,r){return this.dirty==_r&&e.eq(this.node)&&bf(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 d6(this,o&&o.node,e);f6(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?rn.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==ll)&&(o&&this.protectLocalComposition(e,o),IS(this.contentDOM,this.children,e),zc&&p6(this.dom))}localCompositionInfo(e,n){let{from:r,to:a}=e.state.selection;if(!(e.state.selection instanceof it)||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=m6(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 o6(this,i,n,a);e.input.compositionNodes.push(o),this.children=Bg(this.children,r,r+a.length,e,o)}update(e,n,r,a){return this.dirty==Aa||!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=_r}updateOuterDeco(e){if(bf(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=RS(this.dom,this.nodeDOM,Fg(this.outerDeco,this.node,n),Fg(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 SN(t,e,n,r,a){PS(r,e,t);let i=new yo(void 0,t,e,n,r,r,r,a,0);return i.contentDOM&&i.updateChildren(a,0),i}class jp extends yo{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==Aa||this.dirty!=_r&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=_r||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=_r,!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 jp(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=Aa)}get domAtom(){return!1}isText(e){return this.node.text==e}}class AS extends ju{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==_r&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class l6 extends yo{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==Aa)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 IS(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=El.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 El)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 h6(t,e){return t.type.side-e.type.side}function f6(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 p6(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 m6(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 Bg(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 ty(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(wp(n)){for(u=o;a&&!a.node;)a=a.parent;let m=a.node;if(a&&m.isAtom&&at.isSelectable(m)&&a.parent&&!(m.isInline&&VL(n.focusNode,n.focusOffset,a.dom))){let x=a.posBefore;h=new at(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(()=>{(!LS(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function g6(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,ds(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&er&&go<=11&&(n.disabled=!0,n.disabled=!1)}function OS(t,e){if(e instanceof at){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(AN(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else AN(t)}function AN(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function ny(t,e,n,r){return t.someProp("createSelectionBetween",a=>a(t,e,n))||it.between(e,n,r)}function IN(t){return t.editable&&!t.hasFocus()?!1:DS(t)}function DS(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 y6(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Tl(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Vg(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 no(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function RN(t,e,n){let r=t.state.selection;if(r instanceof it)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 no(t,new it(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let a=Vg(t.state,e);return a&&a instanceof at?no(t,a):!1}else if(!(Lr&&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?at.isSelectable(i)?no(t,new at(e<0?t.state.doc.resolve(a.pos-i.nodeSize):a)):wu?no(t,new it(t.state.doc.resolve(e<0?c:c+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof at&&r.node.isInline)return no(t,new it(e>0?r.$to:r.$from));{let a=Vg(t.state,e);return a?no(t,a):!1}}}function vf(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function qd(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function gc(t,e){return e<0?b6(t):v6(t)}function b6(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a,i,o=!1;for(Dr&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(qd(c,-1))a=n,i=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(_S(n))break;{let c=n.previousSibling;for(;c&&qd(c,-1);)a=n.parentNode,i=ds(c),c=c.previousSibling;if(c)n=c,r=vf(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Hg(t,n,r):a&&Hg(t,a,i)}function v6(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a=vf(n),i,o;for(;;)if(r{t.state==a&&mi(t)},50)}function PN(t,e){let n=t.state.doc.resolve(e);if(!(ms||wS)&&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 LN(t,e,n){let r=t.state.selection;if(r instanceof it&&!r.empty||n.indexOf("s")>-1||Lr&&n.indexOf("m")>-1)return!1;let{$from:a,$to:i}=r;if(!a.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Vg(t.state,e);if(o&&o instanceof at)return no(t,o)}if(!a.parent.inlineContent){let o=e<0?a:i,c=r instanceof mr?ft.near(o,e):ft.findFrom(o,e);return c?no(t,c):!1}return!1}function ON(t,e){if(!(t.state.selection instanceof it))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 DN(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function j6(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;DN(t,r,"true"),setTimeout(()=>DN(t,r,"false"),20)}return!1}function k6(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function S6(t,e){let n=e.keyCode,r=k6(e);if(n==8||Lr&&n==72&&r=="c")return ON(t,-1)||gc(t,-1);if(n==46&&!e.shiftKey||Lr&&n==68&&r=="c")return ON(t,1)||gc(t,1);if(n==13||n==27)return!0;if(n==37||Lr&&n==66&&r=="c"){let a=n==37?PN(t,t.state.selection.from)=="ltr"?-1:1:-1;return RN(t,a,r)||gc(t,a)}else if(n==39||Lr&&n==70&&r=="c"){let a=n==39?PN(t,t.state.selection.from)=="ltr"?1:-1:1;return RN(t,a,r)||gc(t,a)}else{if(n==38||Lr&&n==80&&r=="c")return LN(t,-1,r)||gc(t,-1);if(n==40||Lr&&n==78&&r=="c")return j6(t)||LN(t,1,r)||gc(t,1);if(r==(Lr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function sy(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")||Ol.fromSchema(t.state.schema),c=HS(),u=c.createElement("div");u.appendChild(o.serializeFragment(r,{document:c}));let h=u.firstChild,f,m=0;for(;h&&h.nodeType==1&&(f=VS[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 $S(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 Fe(Se.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=Ol.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=M6(n),wu&&A6(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")||xo.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||f),context:a,ruleFromNode(x){return x.nodeName=="BR"&&!x.nextSibling&&x.parentNode&&!C6.test(x.parentNode.nodeName)?{ignore:!0}:null}})),f)c=I6(_N(c,+f[1],+f[2]),f[4]);else if(c=Fe.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 C6=/^(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&&FS(u,i,c,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=BS(o[o.length-1],i.length));let f=zS(c,u);o.push(f),a=a.matchType(f.type),i=u}}),o)return Se.from(o)}return t}function zS(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,Se.from(t));return t}function FS(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(Se.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(c))}function _N(t,e,n){return en})),Bx.createHTML(t)):t}function M6(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=HS().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),a;if((a=r&&VS[r[1].toLowerCase()])&&(t=a.map(i=>"<"+i+">").join("")+t+a.map(i=>"").reverse().join("")),n.innerHTML=E6(t),a)for(let i=0;i=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;a=Se.from(u.create(r[c+1],a)),i++,o++}return new Fe(a,i,o)}const Ds={},_s={},R6={touchstart:!0,touchmove:!0};class P6{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 L6(t){for(let e in Ds){let n=Ds[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{D6(t,r)&&!ry(t,r)&&(t.editable||!(r.type in _s))&&n(t,r)},R6[e]?{passive:!0}:void 0)}ks&&t.dom.addEventListener("input",()=>null),Wg(t)}function fo(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function O6(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 Wg(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>ry(t,r))})}function ry(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function D6(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 _6(t,e){!ry(t,e)&&Ds[e.type]&&(t.editable||!(e.type in _s))&&Ds[e.type](t,e)}_s.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!WS(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(hi&&ms&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),zc&&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,rl(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||S6(t,n)?n.preventDefault():fo(t,"key")};_s.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};_s.keypress=(t,e)=>{let n=e;if(WS(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Lr&&n.metaKey)return;if(t.someProp("handleKeyPress",a=>a(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof it)||!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 kp(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 ay(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 Ic(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 z6(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&at.isSelectable(r)?(Ic(t,new at(n)),!0):!1}function F6(t,e){if(e==-1)return!1;let n=t.state.selection,r,a;n instanceof at&&(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(at.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?(Ic(t,at.create(t.state.doc,a)),!0):!1}function B6(t,e,n,r,a){return ay(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(a?F6(t,n):z6(t,n))}function V6(t,e,n,r){return ay(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",a=>a(t,e,r))}function H6(t,e,n,r){return ay(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",a=>a(t,e,r))||U6(t,n,r)}function U6(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Ic(t,it.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)Ic(t,it.create(r,c+1,c+1+o.content.size));else if(at.isSelectable(o))Ic(t,at.create(r,c));else continue;return!0}}function iy(t){return Nf(t)}const US=Lr?"metaKey":"ctrlKey";Ds.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=iy(t),a=Date.now(),i="singleClick";a-t.input.lastClick.time<500&&$6(n,t.input.lastClick)&&!n[US]&&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(kp(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new W6(t,o,n,!!r)):(i=="doubleClick"?V6:H6)(t,o.pos,o.inside,n)?n.preventDefault():fo(t,"pointer"))};class W6{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[US],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 at&&h.from<=o&&h.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Dr&&!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)),fo(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(kp(e))),this.updateAllowDefault(e),this.allowDefault||!n?fo(this.view,"pointer"):B6(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ks&&this.mightDrag&&!this.mightDrag.node.isAtom||ms&&!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)?(Ic(this.view,ft.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):fo(this.view,"pointer")}move(e){this.updateAllowDefault(e),fo(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)}}Ds.touchstart=t=>{t.input.lastTouch=Date.now(),iy(t),fo(t,"pointer")};Ds.touchmove=t=>{t.input.lastTouch=Date.now(),fo(t,"pointer")};Ds.contextmenu=t=>iy(t);function WS(t,e){return t.composing?!0:ks&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const K6=hi?5e3:-1;_s.compositionstart=_s.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof it&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||ms&&wS&&q6(t)))t.markCursor=t.state.storedMarks||n.marks(),Nf(t,!0),t.markCursor=null;else if(Nf(t,!e.selection.empty),Dr&&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}KS(t,K6)};function q6(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"}_s.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++,KS(t,20))};function KS(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Nf(t),e))}function qS(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=J6());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function G6(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=FL(e.focusNode,e.focusOffset),r=BL(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 J6(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Nf(t,e=!1){if(!(hi&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),qS(t),e||t.docView&&t.docView.dirty){let n=ty(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 Q6(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 lu=er&&go<15||zc&&WL<604;Ds.copy=_s.cut=(t,e)=>{let n=e,r=t.state.selection,a=n.type=="cut";if(r.empty)return;let i=lu?null:n.clipboardData,o=r.content(),{dom:c,text:u}=sy(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",c.innerHTML),i.setData("text/plain",u)):Q6(t,c),a&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Y6(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function X6(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?cu(t,r.value,null,a,e):cu(t,r.textContent,r.innerHTML,a,e)},50)}function cu(t,e,n,r,a){let i=$S(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=Y6(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 GS(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," "):""}_s.paste=(t,e)=>{let n=e;if(t.composing&&!hi)return;let r=lu?null:n.clipboardData,a=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&cu(t,GS(r),r.getData("text/html"),a,n)?n.preventDefault():X6(t,n)};class JS{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const Z6=Lr?"altKey":"ctrlKey";function QS(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[Z6]}Ds.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(kp(n)),o;if(!(i&&i.pos>=a.from&&i.pos<=(a instanceof at?a.to-1:a.to))){if(r&&r.mightDrag)o=at.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=at.create(t.state.doc,m.posBefore))}}let c=(o||t.state.selection).content(),{dom:u,text:h,slice:f}=sy(t,c);(!n.dataTransfer.files.length||!ms||NS>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(lu?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",lu||n.dataTransfer.setData("text/plain",h),t.dragging=new JS(f,QS(t,n),o)};Ds.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};_s.dragover=_s.dragenter=(t,e)=>e.preventDefault();_s.drop=(t,e)=>{try{eO(t,e,t.dragging)}finally{t.dragging=null}};function eO(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(kp(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=$S(t,GS(e.dataTransfer),lu?null:e.dataTransfer.getData("text/html"),!1,a);let o=!!(n&&QS(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?eS(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&&at.isSelectable(i.content.firstChild)&&x.nodeAfter&&x.nodeAfter.sameMarkup(i.content.firstChild))u.setSelection(new at(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(ny(t,x,u.doc.resolve(b)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}Ds.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))};Ds.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)};Ds.beforeinput=(t,e)=>{if(ms&&hi&&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,rl(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 _s)Ds[t]=_s[t];function du(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 wf{constructor(e,n){this.toDOM=e,this.spec=n||pl,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 Qn(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof wf&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&du(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class bo{constructor(e,n){this.attrs=e,this.spec=n||pl}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 Qn(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==ws||e.maps.length==0?this:this.mapInner(e,n,0,0,r||pl)}mapInner(e,n,r,a,i){let o;for(let c=0;c{let h=u+r,f;if(f=XS(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 bo){let h=Math.max(i,u.from)-i,f=Math.min(o,u.to)-i;ha.map(e,n,pl));return ao.from(r)}forChild(e,n){if(n.isLeaf)return sn.empty;let r=[];for(let a=0;an instanceof sn)?e:e.reduce((n,r)=>n.concat(r instanceof sn?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let N=w-v-(b-x);for(let k=0;kE+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!=ws?(c[h]=m,c[h+1]=b,c[h+2]=k):(c[h+1]=-2,u=!0)}else u=!0}if(u){let h=nO(c,t,e,n,a,i,o),f=jf(h,r,0,o);e=f.local;for(let m=0;mn&&o.to{let h=XS(t,c,u+n);if(h){i=!0;let f=jf(h,c,n+u+1,r);f!=ws&&a.push(u,u+c.nodeSize,f)}});let o=YS(i?ZS(t):t,-n).sort(ml);for(let c=0;c0;)e++;t.splice(e,0,n)}function Vx(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=ws&&e.push(r)}),t.cursorWrapper&&e.push(sn.create(t.state.doc,[t.cursorWrapper.deco])),ao.from(e)}const sO={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},rO=er&&go<=11;class aO{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 iO{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new aO,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()}),rO&&(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,sO)),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(IN(this.view)){if(this.suppressingSelectionUpdates)return mi(this.view);if(er&&go<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Tl(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=$c(i))n.add(i);for(let i=e.anchorNode;i;i=$c(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)&&IN(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(Dr&&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||cO(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),oO(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,dO(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;N--){let k=r.childNodes[N-1],E=k.pmViewDesc;if(k.nodeName=="BR"&&!E){i=N;break}if(!E||E.size)break}let m=t.state.doc,x=t.someProp("domParser")||xo.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:hO,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 hO(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 fO=/^(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 pO(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=ty(t,_);if(H&&!t.state.selection.eq(H)){if(ms&&hi&&t.input.lastKeyCode===13&&Date.now()-100se(t,rl(13,"Enter"))))return;let P=t.state.tr.setSelection(H);_=="pointer"?P.setMeta("pointer",!0):_=="key"&&P.scrollIntoView(),i&&P.setMeta("composition",i),t.dispatch(P)}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=uO(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||hi)&&a.some(_=>_.nodeType==1&&!fO.test(_.nodeName))&&(!v||v.endA>=v.endB)&&t.someProp("handleKeyDown",_=>_(t,rl(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!v)if(r&&u instanceof it&&!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 _=HN(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&&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)),er&&go<=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),E=w.sameParent(N)&&w.parent.inlineContent&&k.end()>=v.endA;if((zc&&t.input.lastIOSEnter>Date.now()-225&&(!E||a.some(_=>_.nodeName=="DIV"||_.nodeName=="P"))||!E&&w.pos_(t,rl(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>v.start&&xO(f,v.start,v.endA,w,N)&&t.someProp("handleKeyDown",_=>_(t,rl(8,"Backspace")))){hi&&ms&&t.domObserver.suppressSelectionUpdates();return}ms&&v.endB==v.start&&(t.input.lastChromeDelete=Date.now()),hi&&!E&&w.start()!=N.start()&&N.parentOffset==0&&w.depth==N.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==v.endA&&(v.endB-=2,N=h.doc.resolveNoCache(v.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function(_){return _(t,rl(13,"Enter"))})},20));let C=v.start,R=v.endA,L=_=>{let H=_||t.state.tr.replace(C,R,h.doc.slice(v.start-h.from,v.endB-h.from));if(h.sel){let P=HN(t,H.doc,h.sel);P&&!(ms&&t.composing&&P.empty&&(v.start!=v.endB||t.input.lastChromeDeletemi(t),20));let _=L(t.state.tr.delete(C,R)),H=f.resolve(v.start).marksAcross(f.resolve(v.endA));H&&_.ensureMarks(H),t.dispatch(_)}else if(v.endA==v.endB&&(q=mO(w.parent.content.cut(w.parentOffset,N.parentOffset),k.parent.content.cut(k.parentOffset,v.endA-k.start())))){let _=L(t.state.tr);q.type=="add"?_.addMark(C,R,q.mark):_.removeMark(C,R,q.mark),t.dispatch(_)}else if(w.parent.child(w.index()).isText&&w.index()==N.index()-(N.textOffset?0:1)){let _=w.parent.textBetween(w.parentOffset,N.parentOffset),H=()=>L(t.state.tr.insertText(_,C,R));t.someProp("handleTextInput",P=>P(t,C,R,_,H))||t.dispatch(H())}else t.dispatch(L());else t.dispatch(L())}function HN(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:ny(t,e.resolve(n.anchor),e.resolve(n.head))}function mO(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||Hx(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 gO(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 eC{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 P6,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(JN),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=qN(this),KN(this),this.nodeViews=GN(this),this.docView=SN(this.state.doc,WN(this),Vx(this),this.dom,this),this.domObserver=new iO(this,(r,a,i,o)=>pO(this,r,a,i,o)),this.domObserver.start(),L6(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&&Wg(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(JN),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&&(qS(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=GN(this);bO(b,this.nodeViews)&&(this.nodeViews=b,i=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&Wg(this),this.editable=qN(this),KN(this);let u=Vx(this),h=WN(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&&GL(this);if(o){this.domObserver.stop();let b=m&&(er||ms)&&!this.composing&&!a.selection.empty&&!e.selection.empty&&yO(a.selection,e.selection);if(m){let v=ms?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=G6(this)),(i||!this.docView.update(e.doc,h,u,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=SN(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())&&y6(this))?mi(this,b):(OS(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&&JL(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 at){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&bN(this,n.getBoundingClientRect(),e)}else bN(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 JS(e.slice,e.move,a<0?void 0:at.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 t6(this,e)}coordsAtPos(e,n=1){return TS(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 i6(this,n||this.state,e)}pasteHTML(e,n){return cu(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return cu(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return sy(this,e)}destroy(){this.docView&&(O6(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Vx(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 _6(this,e)}domSelectionRange(){let e=this.domSelection();return e?ks&&this.root.nodeType===11&&HL(this.dom.ownerDocument)==this.dom&&lO(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}eC.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function WN(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"),[Qn.node(0,t.state.doc.content.size,e)]}function KN(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:Qn.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function qN(t){return!t.someProp("editable",e=>e(t.state)===!1)}function yO(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 GN(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 bO(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 JN(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 No={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:"'"},kf={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},vO=typeof navigator<"u"&&/Mac/.test(navigator.platform),NO=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var us=0;us<10;us++)No[48+us]=No[96+us]=String(us);for(var us=1;us<=24;us++)No[us+111]="F"+us;for(var us=65;us<=90;us++)No[us]=String.fromCharCode(us+32),kf[us]=String.fromCharCode(us);for(var Ux in No)kf.hasOwnProperty(Ux)||(kf[Ux]=No[Ux]);function wO(t){var e=vO&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||NO&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?kf:No)[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 jO=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),kO=typeof navigator<"u"&&/Win/.test(navigator.platform);function SO(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)EO(t,n,{get:e[n],enumerable:!0})};function Sp(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 Cp=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:Sp({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}},tC={};dy(tC,{blur:()=>MO,clearContent:()=>AO,clearNodes:()=>IO,command:()=>RO,createParagraphNear:()=>PO,cut:()=>LO,deleteCurrentNode:()=>OO,deleteNode:()=>DO,deleteRange:()=>_O,deleteSelection:()=>$O,enter:()=>zO,exitCode:()=>FO,extendMarkRange:()=>BO,first:()=>VO,focus:()=>UO,forEach:()=>WO,insertContent:()=>KO,insertContentAt:()=>JO,joinBackward:()=>XO,joinDown:()=>YO,joinForward:()=>ZO,joinItemBackward:()=>eD,joinItemForward:()=>tD,joinTextblockBackward:()=>nD,joinTextblockForward:()=>sD,joinUp:()=>QO,keyboardShortcut:()=>aD,lift:()=>iD,liftEmptyBlock:()=>oD,liftListItem:()=>lD,newlineInCode:()=>cD,resetAttributes:()=>dD,scrollIntoView:()=>uD,selectAll:()=>hD,selectNodeBackward:()=>fD,selectNodeForward:()=>pD,selectParentNode:()=>mD,selectTextblockEnd:()=>xD,selectTextblockStart:()=>gD,setContent:()=>yD,setMark:()=>$D,setMeta:()=>zD,setNode:()=>FD,setNodeSelection:()=>BD,setTextDirection:()=>VD,setTextSelection:()=>HD,sinkListItem:()=>UD,splitBlock:()=>WD,splitListItem:()=>KD,toggleList:()=>qD,toggleMark:()=>GD,toggleNode:()=>JD,toggleWrap:()=>QD,undoInputRule:()=>YD,unsetAllMarks:()=>XD,unsetMark:()=>ZD,unsetTextDirection:()=>e_,updateAttributes:()=>t_,wrapIn:()=>n_,wrapInList:()=>s_});var MO=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),AO=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),IO=()=>({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=Qc(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),PO=()=>({state:t,dispatch:e})=>xS(t,e),LO=(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 it(r.doc.resolve(Math.max(o-1,0)))),!0},OO=()=>({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 Hn(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 DO=t=>({tr:e,state:n,dispatch:r})=>{const a=Hn(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},_O=t=>({tr:e,dispatch:n})=>{const{from:r,to:a}=t;return n&&e.delete(r,a),!0},$O=()=>({state:t,dispatch:e})=>J0(t,e),zO=()=>({commands:t})=>t.keyboardShortcut("Enter"),FO=()=>({state:t,dispatch:e})=>jL(t,e);function uy(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Sf(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(a=>n.strict?e[a]===t[a]:uy(e[a])?e[a].test(t[a]):e[a]===t[a]):!0}function nC(t,e,n={}){return t.find(r=>r.type===e&&Sf(Object.fromEntries(Object.keys(n).map(a=>[a,r.attrs[a]])),n))}function QN(t,e,n={}){return!!nC(t,e,n)}function hy(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),!nC([...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&&QN([...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=Ni(t,r.schema),{doc:o,selection:c}=n,{$from:u,from:h,to:f}=c;if(a){const m=hy(u,i,e);if(m&&m.from<=h&&m.to>=f){const x=it.create(o,m.from,m.to);n.setSelection(x)}}return!0},VO=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=()=>{(Cf()||YN())&&r.dom.focus(),HO()&&!Cf()&&!YN()&&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&&!sC(n.state.selection))return o(),!0;const c=rC(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},WO=(t,e)=>n=>t.every((r,a)=>e(r,{...n,index:a})),KO=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),aC=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&&aC(r)}return t};function Ph(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 aC(n)}function uu(t,e,n){if(t instanceof fi||t instanceof Se)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 Se.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),uu("",e,n)}if(a){if(n.errorOnInvalidContent){let o=!1,c="";const u=new H2({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?xo.fromSchema(u).parseSlice(Ph(t),n.parseOptions):xo.fromSchema(u).parse(Ph(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const i=xo.fromSchema(e);return n.slice?i.parseSlice(Ph(t),n.parseOptions).content:i.parse(Ph(t),n.parseOptions)}return uu("",e,n)}function qO(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 GO=t=>!("type"in t),JO=(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{uu(e,i.schema,{parseOptions:h,errorOnInvalidContent:!0})}catch(N){u(N)}try{c=uu(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((GO(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 Se){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(),E=N.parentOffset===0,C=k.isText||k.isTextblock,R=k.content.size>0;E&&C&&R&&(f=Math.max(0,f-1)),r.replaceWith(f,m,w)}n.updateSelection&&qO(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},QO=()=>({state:t,dispatch:e})=>vL(t,e),YO=()=>({state:t,dispatch:e})=>NL(t,e),XO=()=>({state:t,dispatch:e})=>cS(t,e),ZO=()=>({state:t,dispatch:e})=>fS(t,e),eD=()=>({state:t,dispatch:e,tr:n})=>{try{const r=bp(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},tD=()=>({state:t,dispatch:e,tr:n})=>{try{const r=bp(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})=>yL(t,e),sD=()=>({state:t,dispatch:e})=>bL(t,e);function iC(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function rD(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=rD(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 wo(t,e,n={}){const{from:r,to:a,empty:i}=t.selection,o=e?Hn(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=>Sf(m.node.attrs,n,{strict:!1}));return i?!!h.length:h.reduce((m,x)=>m+x.to-x.from,0)>=u}var iD=(t,e={})=>({state:n,dispatch:r})=>{const a=Hn(t,n.schema);return wo(n,a,e)?wL(n,r):!1},oD=()=>({state:t,dispatch:e})=>gS(t,e),lD=t=>({state:e,dispatch:n})=>{const r=Hn(t,e.schema);return LL(r)(e,n)},cD=()=>({state:t,dispatch:e})=>mS(t,e);function Tp(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function XN(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 dD=(t,e)=>({tr:n,state:r,dispatch:a})=>{let i=null,o=null;const c=Tp(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(i=Hn(t,r.schema)),c==="mark"&&(o=Ni(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{r.doc.nodesBetween(h.$from.pos,h.$to.pos,(f,m)=>{i&&i===f.type&&(u=!0,a&&n.setNodeMarkup(m,void 0,XN(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(XN(x.attrs,e))))})})}),u},uD=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),hD=()=>({tr:t,dispatch:e})=>{if(e){const n=new mr(t.doc);t.setSelection(n)}return!0},fD=()=>({state:t,dispatch:e})=>uS(t,e),pD=()=>({state:t,dispatch:e})=>pS(t,e),mD=()=>({state:t,dispatch:e})=>CL(t,e),xD=()=>({state:t,dispatch:e})=>ML(t,e),gD=()=>({state:t,dispatch:e})=>EL(t,e);function Kg(t,e,n={},r={}){return uu(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var yD=(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=Kg(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 oC(t,e){const n=Ni(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 lC(t,e){const n=new q0(t);return e.forEach(r=>{r.steps.forEach(a=>{n.step(a)})}),n}function bD(t){for(let e=0;e{n(a)&&r.push({node:a,pos:i})}),r}function cC(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 Ep(t){return e=>cC(e.$from,t)}function st(t,e,n){return t.config[e]===void 0&&t.parent?st(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?st(t.parent,e,n):null}):t.config[e]}function fy(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=st(e,"addExtensions",n);return r?[e,...fy(r())]:e}).flat(10)}function py(t,e){const n=Ol.fromSchema(e).serializeFragment(t),a=document.implementation.createHTMLDocument().createElement("div");return a.appendChild(n),a.innerHTML}function dC(t){return typeof t=="function"}function Kt(t,e=void 0,...n){return dC(t)?e?t.bind(e)(...n):t(...n):t}function ND(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Fc(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 uC(t){const e=[],{nodeExtensions:n,markExtensions:r}=Fc(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=st(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=st(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 wD(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 ZN(t){const e=[],n=wD(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([...ZN(r[a]),...ZN(i)]);r[a]=Array.from(c.entries()).map(([u,h])=>`${u}: ${h}`).join("; ")}else r[a]=i}),r},{})}function hu(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 jD(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function ew(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):jD(n.getAttribute(o.name));return c==null?i:{...i,[o.name]:c}},{});return{...r,...a}}}}function tw(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&ND(n)?!1:n!=null))}function nw(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 kD(t,e){var n;const r=uC(t),{nodeExtensions:a,markExtensions:i}=Fc(t),o=(n=a.find(h=>st(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,E)=>{const C=st(E,"extendNodeSchema",m);return{...k,...C?C(h):{}}},{}),b=tw({...x,content:Kt(st(h,"content",m)),marks:Kt(st(h,"marks",m)),group:Kt(st(h,"group",m)),inline:Kt(st(h,"inline",m)),atom:Kt(st(h,"atom",m)),selectable:Kt(st(h,"selectable",m)),draggable:Kt(st(h,"draggable",m)),code:Kt(st(h,"code",m)),whitespace:Kt(st(h,"whitespace",m)),linebreakReplacement:Kt(st(h,"linebreakReplacement",m)),defining:Kt(st(h,"defining",m)),isolating:Kt(st(h,"isolating",m)),attrs:Object.fromEntries(f.map(nw))}),v=Kt(st(h,"parseHTML",m));v&&(b.parseDOM=v.map(k=>ew(k,f)));const w=st(h,"renderHTML",m);w&&(b.toDOM=k=>w({node:k,HTMLAttributes:hu(k,f)}));const N=st(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 E=st(k,"extendMarkSchema",m);return{...N,...E?E(h):{}}},{}),b=tw({...x,inclusive:Kt(st(h,"inclusive",m)),excludes:Kt(st(h,"excludes",m)),group:Kt(st(h,"group",m)),spanning:Kt(st(h,"spanning",m)),code:Kt(st(h,"code",m)),attrs:Object.fromEntries(f.map(nw))}),v=Kt(st(h,"parseHTML",m));v&&(b.parseDOM=v.map(N=>ew(N,f)));const w=st(h,"renderHTML",m);return w&&(b.toDOM=N=>w({mark:N,HTMLAttributes:hu(N,f)})),[h.name,b]}));return new H2({topNode:o,nodes:c,marks:u})}function SD(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Gd(t){return t.sort((n,r)=>{const a=st(n,"priority")||100,i=st(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 fC(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 CD(t,e){const n={from:0,to:t.content.size};return fC(t,n,e)}function pC(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=Hn(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 mC(t,e){const n=Tp(typeof e=="string"?e:e.name,t.schema);return n==="node"?TD(t,e):n==="mark"?oC(t,e):{}}function ED(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 MD(t){const e=ED(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 xC(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}})})}),MD(r)}function my(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(a=>{const i=n.resolve(t),o=hy(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 AD=(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 Rd(t,e){return e.nodes[t]||e.marks[t]||null}function Yh(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 ID=(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 qg(t,e,n={}){const{empty:r,ranges:a}=t.selection,i=e?Ni(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>i?i.name===m.type.name:!0).find(m=>Sf(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),E=Math.min(v,N+w.nodeSize),C=E-k;o+=C,c.push(...w.marks.map(R=>({mark:R,from:k,to:E})))})}),o===0)return!1;const u=c.filter(m=>i?i.name===m.mark.type.name:!0).filter(m=>Sf(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 wo(t,null,n)||qg(t,null,n);const r=Tp(e,t.schema);return r==="node"?wo(t,e,n):r==="mark"?qg(t,e,n):!1}var PD=(t,e)=>{const{$from:n,$to:r,$anchor:a}=t.selection;if(e){const i=Ep(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 sw(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function rw(t,e){const{nodeExtensions:n}=Fc(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(st(r,"group",a));return typeof i!="string"?!1:i.split(" ").includes("list")}function Mp(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&&(Mp(i,{ignoreWhitespace:n,checkChildren:e})||(a=!1))}),a}return!1}function gC(t){return t instanceof at}var yC=class bC{constructor(e){this.position=e}static fromJSON(e){return new bC(e.position)}toJSON(){return{position:this.position}}};function OD(t,e){const n=e.mapping.mapResult(t.position);return{position:new yC(n.pos),mapResult:n}}function DD(t){return new yC(t)}function _D(t,e,n){var r;const{selection:a}=e;let i=null;if(sC(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=Ni(t,r.schema);if(a)if(o){const h=oC(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 _D(r,n,u)},zD=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),FD=(t,e={})=>({state:n,dispatch:r,chain:a})=>{const i=Hn(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})=>xN(i,{...o,...e})(n)?!0:c.clearNodes()).command(({state:c})=>xN(i,{...o,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},BD=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,a=dl(t,0,r.content.size),i=at.create(r,a);e.setSelection(i)}return!0},VD=(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},HD=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:a,to:i}=typeof t=="number"?{from:t,to:t}:t,o=it.atStart(r).from,c=it.atEnd(r).to,u=dl(a,o,c),h=dl(i,o,c),f=it.create(r,u,h);e.setSelection(f)}return!0},UD=t=>({state:e,dispatch:n})=>{const r=Hn(t,e.schema);return _L(r)(e,n)};function aw(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 WD=({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=Yh(h,c.node().type.name,c.node().attrs);if(i instanceof at&&i.node.isBlock)return!c.parentOffset||!pi(o,c.pos)?!1:(r&&(t&&aw(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:bD(c.node(-1).contentMatchAt(c.indexAfter(-1)));let b=m&&x?[{type:x,attrs:f}]:void 0,v=pi(e.doc,e.mapping.map(c.pos),1,b);if(!b&&!v&&pi(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 it&&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&&aw(n,a.extensionManager.splittableMarks),e.scrollIntoView()}return v},KD=(t,e={})=>({tr:n,state:r,dispatch:a,editor:i})=>{var o;const c=Hn(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=Se.empty;const E=u.index(-1)?1:u.index(-2)?2:3;for(let H=u.depth-E;H>=u.depth-3;H-=1)k=Se.from(u.node(H).copy(k));const C=u.indexAfter(-1){if(_>-1)return!1;H.isTextblock&&H.content.size===0&&(_=P+1)}),_>-1&&n.setSelection(it.near(n.doc.resolve(_))),n.scrollIntoView()}return!0}const b=h.pos===u.end()?m.contentMatchAt(0).defaultType:null,v={...Yh(x,m.type.name,m.attrs),...e},w={...Yh(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(!pi(n.doc,u.pos,2))return!1;if(a){const{selection:k,storedMarks:E}=r,{splittableMarks:C}=i.extensionManager,R=E||k.$to.parentOffset&&k.$from.marks();if(n.split(u.pos,2,N).scrollIntoView(),!R||!a)return!0;const L=R.filter(q=>C.includes(q.type.name));n.ensureMarks(L)}return!0},Kx=(t,e)=>{const n=Ep(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)&&Eo(t.doc,n.pos)&&t.join(n.pos),!0},qx=(t,e)=>{const n=Ep(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)&&Eo(t.doc,r)&&t.join(r),!0},qD=(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=Hn(t,o.schema),v=Hn(e,o.schema),{selection:w,storedMarks:N}=o,{$from:k,$to:E}=w,C=k.blockRange(E),R=N||w.$to.parentOffset&&w.$from.marks();if(!C)return!1;const L=Ep(q=>rw(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(rw(L.node.type.name,m)&&b.validContent(L.node.content)&&c)return u().command(()=>(i.setNodeMarkup(L.pos,b),!0)).command(()=>Kx(i,b)).command(()=>qx(i,b)).run()}return!n||!R||!c?u().command(()=>f().wrapInList(b,r)?!0:h.clearNodes()).wrapInList(b,r).command(()=>Kx(i,b)).command(()=>qx(i,b)).run():u().command(()=>{const q=f().wrapInList(b,r),_=R.filter(H=>x.includes(H.type.name));return i.ensureMarks(_),q?!0:h.clearNodes()}).wrapInList(b,r).command(()=>Kx(i,b)).command(()=>qx(i,b)).run()},GD=(t,e={},n={})=>({state:r,commands:a})=>{const{extendEmptyMarkRange:i=!1}=n,o=Ni(t,r.schema);return qg(r,o,e)?a.unsetMark(o,{extendEmptyMarkRange:i}):a.setMark(o,e)},JD=(t,e,n={})=>({state:r,commands:a})=>{const i=Hn(t,r.schema),o=Hn(e,r.schema),c=wo(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})},QD=(t,e={})=>({state:n,commands:r})=>{const a=Hn(t,n.schema);return wo(n,a,e)?r.lift(a):r.wrapIn(a,e)},YD=()=>({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},XD=()=>({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},ZD=(t,e={})=>({tr:n,state:r,dispatch:a})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:c}=n,u=Ni(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=hy(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},e_=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},t_=(t,e={})=>({tr:n,state:r,dispatch:a})=>{let i=null,o=null;const c=Tp(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(i=Hn(t,r.schema)),c==="mark"&&(o=Ni(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;let 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(E=>{if(o===E.type&&(u=!0,a)){const C=Math.max(k,f),R=Math.min(k+N.nodeSize,m);n.addMark(C,R,o.create({...E.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},n_=(t,e={})=>({state:n,dispatch:r})=>{const a=Hn(t,n.schema);return AL(a,e)(n,r)},s_=(t,e={})=>({state:n,dispatch:r})=>{const a=Hn(t,n.schema);return IL(a,e)(n,r)},r_=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={}}},Ap=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},a_=(t,e)=>{if(uy(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 Lh(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=ID(h)+i;return o.forEach(x=>{if(f)return;const b=a_(m,x.find);if(!b)return;const v=u.state.tr,w=Sp({state:u.state,transaction:v}),N={from:r-(b[0].length-i.length),to:a},{commands:k,chain:E,can:C}=new Cp({editor:n,state:w});x.handler({state:w,range:N,match:b,commands:k,chain:E,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 i_(t){const{editor:e,rules:n}=t,r=new un({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=py(Se.from(f),o.schema);const{from:m}=u,x=m+f.length;Lh({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 Lh({editor:e,from:i,to:o,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:a=>(setTimeout(()=>{const{$cursor:i}=a.state.selection;i&&Lh({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?Lh({editor:e,from:o.pos,to:o.pos,text:` +`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function o_(t){return Object.prototype.toString.call(t).slice(8,-1)}function Oh(t){return o_(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function vC(t,e){const n={...t};return Oh(t)&&Oh(e)&&Object.keys(e).forEach(r=>{Oh(e[r])&&Oh(t[r])?n[r]=vC(t[r],e[r]):n[r]=e[r]}),n}var xy=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(st(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Kt(st(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>vC(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}},Dl=class NC extends xy{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new NC(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 l_(t){return typeof t=="number"}var c_=class{constructor(t){this.find=t.find,this.handler=t.handler}},d_=(t,e,n)=>{if(uy(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 u_(t){const{editor:e,state:n,from:r,to:a,rule:i,pasteEvent:o,dropEvent:c}=t,{commands:u,chain:h,can:f}=new Cp({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,a,(b,v)=>{var w,N,k,E,C;if((N=(w=b.type)==null?void 0:w.spec)!=null&&N.code||!(b.isText||b.isTextblock||b.isInline))return;const R=(C=(E=(k=b.content)==null?void 0:k.size)!=null?E:b.nodeSize)!=null?C:0,L=Math.max(r,v),q=Math.min(a,v+R);if(L>=q)return;const _=b.isText?b.text||"":b.textBetween(L-v,q-v,void 0,"");d_(_,i.find,o).forEach(P=>{if(P.index===void 0)return;const se=L+P.index+1,Y=se+P[0].length,V={from:n.tr.mapping.map(se),to:n.tr.mapping.map(Y)},ae=i.handler({state:n,range:V,match:P,commands:u,chain:h,can:f,pasteEvent:o,dropEvent:c});m.push(ae)})}),m.every(b=>b!==null)}var Dh=null,h_=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function f_(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=Sp({state:f,transaction:w});if(!(!u_({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 un({view(m){const x=v=>{var w;r=(w=m.dom.parentElement)!=null&&w.contains(v.target)?m.dom.parentElement:null,r&&(Dh=e)},b=()=>{Dh&&(Dh=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=Dh;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"),E=!!k;if(!w&&!N&&!E)return;if(E){let{text:L}=k;typeof L=="string"?L=L:L=py(Se.from(L),b.schema);const{from:q}=k,_=q+L.length,H=h_(L);return u({rule:f,state:b,from:q,to:{b:_},pasteEvt:H})}const C=x.doc.content.findDiffStart(b.doc.content),R=x.doc.content.findDiffEnd(b.doc.content);if(!(!l_(C)||!R||C===R.b))return u({rule:f,state:b,from:C,to:R,pasteEvt:o})}}))}var Ip=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=hC(t),this.schema=kD(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:Rd(e.name,this.schema)},r=st(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return Gd([...this.extensions].reverse()).flatMap(r=>{const a={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Rd(r.name,this.schema)},i=[],o=st(r,"addKeyboardShortcuts",a);let c={};if(r.type==="mark"&&st(r,"exitable",a)&&(c.ArrowRight=()=>Dl.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=st(r,"addInputRules",a);if(sw(r,t.options.enableInputRules)&&h){const x=h();if(x&&x.length){const b=i_({editor:t,rules:x}),v=Array.isArray(b)?b:[b];i.push(...v)}}const f=st(r,"addPasteRules",a);if(sw(r,t.options.enablePasteRules)&&f){const x=f();if(x&&x.length){const b=f_({editor:t,rules:x});i.push(...b)}}const m=st(r,"addProseMirrorPlugins",a);if(m){const x=m();i.push(...x)}return i})}get attributes(){return uC(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Fc(this.extensions);return Object.fromEntries(e.filter(n=>!!st(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:Hn(n.name,this.schema)},i=st(n,"addNodeView",a);if(!i)return[];const o=i();if(!o)return[];const c=(u,h,f,m,x)=>{const b=hu(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 Gd([...this.extensions].reverse()).reduceRight((r,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:Rd(a.name,this.schema)},o=st(a,"dispatchTransaction",i);return o?c=>{o.call(i,{transaction:c,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return Gd([...this.extensions]).reduce((r,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:Rd(a.name,this.schema)},o=st(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}=Fc(this.extensions);return Object.fromEntries(e.filter(n=>!!st(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:Ni(n.name,this.schema)},i=st(n,"addMarkView",a);if(!i)return[];const o=(c,u,h)=>{const f=hu(c,r);return i()({mark:c,view:u,inline:h,editor:t,extension:n,HTMLAttributes:f,updateAttributes:m=>{E_(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:Rd(e.name,this.schema)};e.type==="mark"&&((n=Kt(st(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const a=st(e,"onBeforeCreate",r),i=st(e,"onCreate",r),o=st(e,"onUpdate",r),c=st(e,"onSelectionUpdate",r),u=st(e,"onTransaction",r),h=st(e,"onFocus",r),f=st(e,"onBlur",r),m=st(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)})}};Ip.resolve=hC;Ip.sort=Gd;Ip.flatten=fy;var p_={};dy(p_,{ClipboardTextSerializer:()=>jC,Commands:()=>kC,Delete:()=>SC,Drop:()=>CC,Editable:()=>TC,FocusEvents:()=>MC,Keymap:()=>AC,Paste:()=>IC,Tabindex:()=>RC,TextDirection:()=>PC,focusEventsPluginKey:()=>EC});var Rn=class wC extends xy{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new wC(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},jC=Rn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new un({key:new bn("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=pC(n);return fC(r,{from:o,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),kC=Rn.create({name:"commands",addCommands(){return{...tC}}}),SC=Rn.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=lC(t.before,[t,...e]);xC(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 ra){const k=x.slice(v).map(b.from,-1),E=x.slice(v).map(b.to),C=x.invert().map(k,-1),R=x.invert().map(E),L=(w=f.doc.nodeAt(k-1))==null?void 0:w.marks.some(_=>_.eq(b.mark)),q=(N=f.doc.nodeAt(E))==null?void 0:N.marks.some(_=>_.eq(b.mark));this.editor.emit("delete",{type:"mark",mark:b.mark,from:b.from,to:b.to,deletedRange:{from:C,to:R},newRange:{from:k,to:E},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()}}),CC=Rn.create({name:"drop",addProseMirrorPlugins(){return[new un({key:new bn("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),TC=Rn.create({name:"editable",addProseMirrorPlugins(){return[new un({key:new bn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),EC=new bn("focusEvents"),MC=Rn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new un({key:EC,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}}}})]}}),AC=Rn.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:ft.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 Cf()||iC()?i:a},addProseMirrorPlugins(){return[new un({key:new bn("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=ft.atStart(e.doc).from,h=ft.atEnd(e.doc).to;if(i||!(o===u&&c===h)||!Mp(n.doc))return;const x=n.tr,b=Sp({state:n,transaction:x}),{commands:v}=new Cp({editor:this.editor,state:b});if(v.clearNodes(),!!x.steps.length)return x}})]}}),IC=Rn.create({name:"paste",addProseMirrorPlugins(){return[new un({key:new bn("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),RC=Rn.create({name:"tabindex",addProseMirrorPlugins(){return[new un({key:new bn("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),PC=Rn.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Fc(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 un({key:new bn("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),m_=class $d{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 $d(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 $d(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 $d(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 $d(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 g_(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 y_=class extends r_{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:OD,createMappablePosition:DD},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=rC(e,this.options.autofocus);this.editorState=Tc.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=g_(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=dC(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?[TC,jC.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),kC,MC,AC,RC,CC,IC,SC,PC.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 Ip(r,this)}createCommandManager(){this.commandManager=new Cp({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Kg(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=Kg(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 eC(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 mC(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 py(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=` + +`,textSerializers:n={}}=t||{};return CD(this.state.doc,{blockSeparator:e,textSerializers:{...pC(this.schema),...n}})}get isEmpty(){return Mp(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 m_(e,this)}get $doc(){return this.$pos(0)}};function Bc(t){return new Ap({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(my(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 LC(t){return new Ap({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 Gg(t){return new Ap({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 Vc(t){return new Ap({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&&K0(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&&Eo(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,f))&&o.join(n.from-1)},undoable:t.undoable})}var b_=t=>"touches"in t,v_=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,b_(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 N_(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof at){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 w_(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var j_={};dy(j_,{createAtomBlockMarkdownSpec:()=>k_,createBlockMarkdownSpec:()=>S_,createInlineMarkdownSpec:()=>OC,parseAttributes:()=>gy,parseIndentedBlocks:()=>Jg,renderNestedMarkdownContent:()=>by,serializeAttributes:()=>yy});function gy(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 yy(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 k_(t){const{nodeName:e,name:n,parseAttributes:r=gy,serializeAttributes:a=yy,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(E=>!(E 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 S_(t){const{nodeName:e,name:n,getContent:r,parseAttributes:a=gy,serializeAttributes:i=yy,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,E=""]=N,C=a(E);let R=1;const L=k.length;let q="";const _=/^:::([\w-]*)(\s.*)?/gm,H=m.slice(L);for(_.lastIndex=0;;){const P=_.exec(H);if(P===null)break;const se=P.index,Y=P[1];if(!((v=P[2])!=null&&v.endsWith(":::"))){if(Y)R+=1;else if(R-=1,R===0){const V=H.slice(0,se);q=V.trim();const ae=m.slice(0,L+se+P[0].length);let le=[];if(q)if(c==="block")for(le=b.blockTokens(V),le.forEach(de=>{de.text&&(!de.tokens||de.tokens.length===0)&&(de.tokens=b.inlineTokens(de.text))});le.length>0;){const de=le[le.length-1];if(de.type==="paragraph"&&(!de.text||de.text.trim()===""))le.pop();else break}else le=b.inlineTokens(q);return{type:e,raw:ae,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 C_(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 OC(t){const{nodeName:e,name:n,getContent:r,parseAttributes:a=C_,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="",E="";if(c){const[,R]=N;E=R}else{const[,R,L]=N;E=R,k=L||""}const C=a(E.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 Jg(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(_===-1)break;if((((a=(r=c[f+1+_].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 E;const C=k.slice(1);if(C.length>0){const L=C.map(q=>q.slice(w+m)).join(` +`);L.trim()&&(e.customNestedParser?E=e.customNestedParser(L):E=n.blockTokens(L))}const R=e.createToken(v,E);u.push(R)}if(u.length!==0)return{items:u,raw:h}}function by(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 E_(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 $n=class DC extends xy{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new DC(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Ml(t){return new c_({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),x=m+c.length;if(my(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:M_,getOwnPropertySymbols:A_}=Object,{hasOwnProperty:I_}=Object.prototype;function Gx(t,e){return function(r,a,i){return t(r,a,i)&&e(r,a,i)}}function _h(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 iw(t){return M_(t).concat(A_(t))}const P_=Object.hasOwn||((t,e)=>I_.call(t,e));function _l(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const L_="__v",O_="__o",D_="_owner",{getOwnPropertyDescriptor:ow,keys:lw}=Object;function __(t,e){return t.byteLength===e.byteLength&&Tf(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 z_(t,e){return t.byteLength===e.byteLength&&Tf(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function F_(t,e){return _l(t.getTime(),e.getTime())}function B_(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function V_(t,e){return t===e}function cw(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 H_=_l;function U_(t,e,n){const r=lw(t);let a=r.length;if(lw(e).length!==a)return!1;for(;a-- >0;)if(!_C(t,e,n,r[a]))return!1;return!0}function Pd(t,e,n){const r=iw(t);let a=r.length;if(iw(e).length!==a)return!1;let i,o,c;for(;a-- >0;)if(i=r[a],!_C(t,e,n,i)||(o=ow(t,i),c=ow(e,i),(o||c)&&(!o||!c||o.configurable!==c.configurable||o.enumerable!==c.enumerable||o.writable!==c.writable)))return!1;return!0}function W_(t,e){return _l(t.valueOf(),e.valueOf())}function K_(t,e){return t.source===e.source&&t.flags===e.flags}function dw(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 Tf(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 q_(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 _C(t,e,n,r){return(r===D_||r===O_||r===L_)&&(t.$$typeof||e.$$typeof)?!0:P_(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const G_="[object ArrayBuffer]",J_="[object Arguments]",Q_="[object Boolean]",Y_="[object DataView]",X_="[object Date]",Z_="[object Error]",e7="[object Map]",t7="[object Number]",n7="[object Object]",s7="[object RegExp]",r7="[object Set]",a7="[object String]",i7={"[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},o7="[object URL]",l7=Object.prototype.toString;function c7({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,E){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,E):C==="function"?i(N,k,E):!1;const R=N.constructor;if(R!==k.constructor)return!1;if(R===Object)return u(N,k,E);if(Array.isArray(N))return e(N,k,E);if(R===Date)return r(N,k,E);if(R===RegExp)return f(N,k,E);if(R===Map)return o(N,k,E);if(R===Set)return m(N,k,E);const L=l7.call(N);if(L===X_)return r(N,k,E);if(L===s7)return f(N,k,E);if(L===e7)return o(N,k,E);if(L===r7)return m(N,k,E);if(L===n7)return typeof N.then!="function"&&typeof k.then!="function"&&u(N,k,E);if(L===o7)return b(N,k,E);if(L===Z_)return a(N,k,E);if(L===J_)return u(N,k,E);if(i7[L])return x(N,k,E);if(L===G_)return t(N,k,E);if(L===Y_)return n(N,k,E);if(L===Q_||L===t7||L===a7)return h(N,k,E);if(v){let q=v[L];if(!q){const _=R_(N);_&&(q=v[_])}if(q)return q(N,k,E)}return!1}}function d7({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:__,areArraysEqual:n?Pd:$_,areDataViewsEqual:z_,areDatesEqual:F_,areErrorsEqual:B_,areFunctionsEqual:V_,areMapsEqual:n?Gx(cw,Pd):cw,areNumbersEqual:H_,areObjectsEqual:n?Pd:U_,arePrimitiveWrappersEqual:W_,areRegExpsEqual:K_,areSetsEqual:n?Gx(dw,Pd):dw,areTypedArraysEqual:n?Gx(Tf,Pd):Tf,areUrlsEqual:q_,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const a=_h(r.areArraysEqual),i=_h(r.areMapsEqual),o=_h(r.areObjectsEqual),c=_h(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:a,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:c})}return r}function u7(t){return function(e,n,r,a,i,o,c){return t(e,n,c)}}function h7({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 f7=Ao();Ao({strict:!0});Ao({circular:!0});Ao({circular:!0,strict:!0});Ao({createInternalComparator:()=>_l});Ao({strict:!0,createInternalComparator:()=>_l});Ao({circular:!0,createInternalComparator:()=>_l});Ao({circular:!0,createInternalComparator:()=>_l,strict:!0});function Ao(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:a=!1}=t,i=d7(t),o=c7(i),c=n?n(o):u7(o);return h7({circular:e,comparator:o,createState:r,equals:c,strict:a})}var Jx={exports:{}},Qx={};/** + * @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 uw;function p7(){if(uw)return Qx;uw=1;var t=gu(),e=C2();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 Qx.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(!E){if(E=!0,C=q,q=x(q),b!==void 0&&w.hasValue){var _=w.value;if(b(_,q))return R=_}return R=q}if(_=R,r(C,q))return _;var H=x(q);return b!==void 0&&b(_,H)?(C=q,_):(C=q,R=H)}var E=!1,C,R,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},Qx}var hw;function m7(){return hw||(hw=1,Jx.exports=p7()),Jx.exports}var x7=m7(),g7=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},y7=({contentComponent:t})=>{const e=T2.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return s.jsx(s.Fragment,{children:Object.values(e)})};function b7(){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]:wj.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 v7=class extends Os.Component{constructor(t){var e;super(t),this.editorContentRef=Os.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=b7(),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:g7(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&s.jsx(y7,{contentComponent:t.contentComponent})]})}},N7=y.forwardRef((t,e)=>{const n=Os.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Os.createElement(v7,{key:n,innerRef:e,...t})}),$C=Os.memo(N7),w7=typeof window<"u"?y.useLayoutEffect:y.useEffect,j7=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 k7(t){var e;const[n]=y.useState(()=>new j7(t.editor)),r=x7.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:f7);return w7(()=>n.watch(t.editor),[t.editor,n]),y.useDebugValue(r),r}var S7=!1,Qg=typeof window>"u",C7=Qg||!!(typeof window<"u"&&window.next),T7=class zC{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?Qg||C7?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 y_(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?zC.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 E7(t={},e=[]){const n=y.useRef(t);n.current=t;const[r]=y.useState(()=>new T7(n)),a=T2.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return y.useDebugValue(a),y.useEffect(r.onRender(e)),k7({editor:a,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),a}var FC=y.createContext({editor:null});FC.Consumer;var M7=y.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),A7=()=>y.useContext(M7);Os.forwardRef((t,e)=>{const{onDragStart:n}=A7(),r=t.as||"div";return s.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});Os.createContext({markViewContentRef:()=>{}});var vy=y.createContext({get editor(){throw new Error("useTiptap must be used within a provider")}});vy.displayName="TiptapContext";var I7=()=>y.useContext(vy);function BC({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(FC.Provider,{value:i,children:s.jsx(vy.Provider,{value:a,children:n})})}BC.displayName="Tiptap";function VC({...t}){const{editor:e}=I7();return s.jsx($C,{editor:e,...t})}VC.displayName="Tiptap.Content";Object.assign(BC,{Content:VC});var Ef=(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$/,P7=$n.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Ef("blockquote",{...qt(this.options.HTMLAttributes,t),children:Ef("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[Vc({find:R7,type:this.type})]}}),L7=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,O7=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,D7=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,_7=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,$7=Dl.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 Ef("strong",{...qt(this.options.HTMLAttributes,t),children:Ef("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[Bc({find:L7,type:this.type}),Bc({find:D7,type:this.type})]},addPasteRules(){return[Ml({find:O7,type:this.type}),Ml({find:_7,type:this.type})]}}),z7=/(^|[^`])`([^`]+)`(?!`)$/,F7=/(^|[^`])`([^`]+)`(?!`)/g,B7=Dl.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[Bc({find:z7,type:this.type})]},addPasteRules(){return[Ml({find:F7,type:this.type})]}}),Yx=4,V7=/^```([a-z]+)?[\s\n]$/,H7=/^~~~([a-z]+)?[\s\n]$/,U7=$n.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Yx,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:Yx,{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:Yx,{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 E=((u=b[v].match(/^ */))==null?void 0:u[0])||"",C=Math.min(E.length,n);if(C===0)return!0;let R=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(ft.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[Gg({find:V7,type:this.type,getAttributes:t=>({language:t[1]})}),Gg({find:H7,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new un({key:new bn("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(it.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),W7=$n.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` + +`):""}),K7=$n.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(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()}}}),q7=$n.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=>Gg({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),G7=$n.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(!N_(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,a=t();return gC(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(it.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(at.create(o.doc,u.pos)):o.setSelection(it.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(it.create(o.doc,h+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[LC({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),J7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Q7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Y7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,X7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Z7=Dl.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[Bc({find:J7,type:this.type}),Bc({find:Y7,type:this.type})]},addPasteRules(){return[Ml({find:Q7,type:this.type}),Ml({find:X7,type:this.type})]}});const e$="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",t$="ελ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",Yg="numeric",Xg="ascii",Zg="alpha",Jd="asciinumeric",zd="alphanumeric",e0="domain",HC="emoji",n$="scheme",s$="slashscheme",Xx="whitespace";function r$(t,e){return t in e||(e[t]=[]),e[t]}function ul(t,e,n){e[Yg]&&(e[Jd]=!0,e[zd]=!0),e[Xg]&&(e[Jd]=!0,e[Zg]=!0),e[Jd]&&(e[zd]=!0),e[Zg]&&(e[zd]=!0),e[zd]&&(e[e0]=!0),e[HC]&&(e[e0]=!0);for(const r in e){const a=r$(r,n);a.indexOf(t)<0&&a.push(t)}}function a$(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Ys(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Ys.groups={};Ys.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),En=(t,e,n,r,a)=>t.tr(e,n,r,a),fw=(t,e,n,r,a)=>t.ts(e,n,r,a),Pe=(t,e,n,r,a)=>t.tt(e,n,r,a),ii="WORD",t0="UWORD",UC="ASCIINUMERICAL",WC="ALPHANUMERICAL",fu="LOCALHOST",n0="TLD",s0="UTLD",Xh="SCHEME",Nc="SLASH_SCHEME",Ny="NUM",r0="WS",wy="NL",Qd="OPENBRACE",Yd="CLOSEBRACE",Mf="OPENBRACKET",Af="CLOSEBRACKET",If="OPENPAREN",Rf="CLOSEPAREN",Pf="OPENANGLEBRACKET",Lf="CLOSEANGLEBRACKET",Of="FULLWIDTHLEFTPAREN",Df="FULLWIDTHRIGHTPAREN",_f="LEFTCORNERBRACKET",$f="RIGHTCORNERBRACKET",zf="LEFTWHITECORNERBRACKET",Ff="RIGHTWHITECORNERBRACKET",Bf="FULLWIDTHLESSTHAN",Vf="FULLWIDTHGREATERTHAN",Hf="AMPERSAND",Uf="APOSTROPHE",Wf="ASTERISK",so="AT",Kf="BACKSLASH",qf="BACKTICK",Gf="CARET",io="COLON",jy="COMMA",Jf="DOLLAR",Na="DOT",Qf="EQUALS",ky="EXCLAMATION",Pr="HYPHEN",Xd="PERCENT",Yf="PIPE",Xf="PLUS",Zf="POUND",Zd="QUERY",Sy="QUOTE",KC="FULLWIDTHMIDDLEDOT",Cy="SEMI",wa="SLASH",eu="TILDE",ep="UNDERSCORE",qC="EMOJI",tp="SYM";var GC=Object.freeze({__proto__:null,ALPHANUMERICAL:WC,AMPERSAND:Hf,APOSTROPHE:Uf,ASCIINUMERICAL:UC,ASTERISK:Wf,AT:so,BACKSLASH:Kf,BACKTICK:qf,CARET:Gf,CLOSEANGLEBRACKET:Lf,CLOSEBRACE:Yd,CLOSEBRACKET:Af,CLOSEPAREN:Rf,COLON:io,COMMA:jy,DOLLAR:Jf,DOT:Na,EMOJI:qC,EQUALS:Qf,EXCLAMATION:ky,FULLWIDTHGREATERTHAN:Vf,FULLWIDTHLEFTPAREN:Of,FULLWIDTHLESSTHAN:Bf,FULLWIDTHMIDDLEDOT:KC,FULLWIDTHRIGHTPAREN:Df,HYPHEN:Pr,LEFTCORNERBRACKET:_f,LEFTWHITECORNERBRACKET:zf,LOCALHOST:fu,NL:wy,NUM:Ny,OPENANGLEBRACKET:Pf,OPENBRACE:Qd,OPENBRACKET:Mf,OPENPAREN:If,PERCENT:Xd,PIPE:Yf,PLUS:Xf,POUND:Zf,QUERY:Zd,QUOTE:Sy,RIGHTCORNERBRACKET:$f,RIGHTWHITECORNERBRACKET:Ff,SCHEME:Xh,SEMI:Cy,SLASH:wa,SLASH_SCHEME:Nc,SYM:tp,TILDE:eu,TLD:n0,UNDERSCORE:ep,UTLD:s0,UWORD:t0,WORD:ii,WS:r0});const ri=/[a-z]/,Ld=new RegExp("\\p{L}","u"),Zx=new RegExp("\\p{Emoji}","u"),ai=/\d/,eg=/\s/,pw="\r",tg=` +`,i$="️",o$="‍",ng="";let $h=null,zh=null;function l$(t=[]){const e={};Ys.groups=e;const n=new Ys;$h==null&&($h=mw(e$)),zh==null&&(zh=mw(t$)),Pe(n,"'",Uf),Pe(n,"{",Qd),Pe(n,"}",Yd),Pe(n,"[",Mf),Pe(n,"]",Af),Pe(n,"(",If),Pe(n,")",Rf),Pe(n,"<",Pf),Pe(n,">",Lf),Pe(n,"(",Of),Pe(n,")",Df),Pe(n,"「",_f),Pe(n,"」",$f),Pe(n,"『",zf),Pe(n,"』",Ff),Pe(n,"<",Bf),Pe(n,">",Vf),Pe(n,"&",Hf),Pe(n,"*",Wf),Pe(n,"@",so),Pe(n,"`",qf),Pe(n,"^",Gf),Pe(n,":",io),Pe(n,",",jy),Pe(n,"$",Jf),Pe(n,".",Na),Pe(n,"=",Qf),Pe(n,"!",ky),Pe(n,"-",Pr),Pe(n,"%",Xd),Pe(n,"|",Yf),Pe(n,"+",Xf),Pe(n,"#",Zf),Pe(n,"?",Zd),Pe(n,'"',Sy),Pe(n,"/",wa),Pe(n,";",Cy),Pe(n,"~",eu),Pe(n,"_",ep),Pe(n,"\\",Kf),Pe(n,"・",KC);const r=En(n,ai,Ny,{[Yg]:!0});En(r,ai,r);const a=En(r,ri,UC,{[Jd]:!0}),i=En(r,Ld,WC,{[zd]:!0}),o=En(n,ri,ii,{[Xg]:!0});En(o,ai,a),En(o,ri,o),En(a,ai,a),En(a,ri,a);const c=En(n,Ld,t0,{[Zg]:!0});En(c,ri),En(c,ai,i),En(c,Ld,c),En(i,ai,i),En(i,ri),En(i,Ld,i);const u=Pe(n,tg,wy,{[Xx]:!0}),h=Pe(n,pw,r0,{[Xx]:!0}),f=En(n,eg,r0,{[Xx]:!0});Pe(n,ng,f),Pe(h,tg,u),Pe(h,ng,f),En(h,eg,f),Pe(f,pw),Pe(f,tg),En(f,eg,f),Pe(f,ng,f);const m=En(n,Zx,qC,{[HC]:!0});Pe(m,"#"),En(m,Zx,m),Pe(m,i$,m);const x=Pe(m,o$);Pe(x,"#"),En(x,Zx,m);const b=[[ri,o],[ai,a]],v=[[ri,null],[Ld,c],[ai,i]];for(let w=0;w<$h.length;w++)Xi(n,$h[w],n0,ii,b);for(let w=0;ww[0]>N[0]?1:-1);for(let w=0;w=0?E[e0]=!0:ri.test(N)?ai.test(N)?E[Jd]=!0:E[Xg]=!0:E[Yg]=!0,fw(n,N,N,E)}return fw(n,"localhost",fu,{ascii:!0}),n.jd=new Ys(tp),{start:n,tokens:Object.assign({groups:e},GC)}}function JC(t,e){const n=c$(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 c$(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 Xi(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 pu={defaultProtocol:"http",events:null,format:xw,formatHref:xw,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Ty(t,e=null){let n=Object.assign({},pu);t&&(n=Object.assign(n,t instanceof Ty?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=pu.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 Rp(t,e){class n extends QC{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 gw=Rp("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),yw=Rp("text"),d$=Rp("nl"),Fh=Rp("url",{isLink:!0,toHref(t=pu.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==fu&&t[1].t===io}}),Rr=t=>new Ys(t);function u$({groups:t}){const e=t.domain.concat([Hf,Wf,so,Kf,qf,Gf,Jf,Qf,Pr,Ny,Xd,Yf,Xf,Zf,wa,tp,eu,ep]),n=[Uf,io,jy,Na,ky,Xd,Zd,Sy,Cy,Pf,Lf,Qd,Yd,Af,Mf,If,Rf,Of,Df,_f,$f,zf,Ff,Bf,Vf],r=[Hf,Uf,Wf,Kf,qf,Gf,Jf,Qf,Pr,Qd,Yd,Xd,Yf,Xf,Zf,Zd,wa,tp,eu,ep],a=Rr(),i=Pe(a,eu);jt(i,r,i),jt(i,t.domain,i);const o=Rr(),c=Rr(),u=Rr();jt(a,t.domain,o),jt(a,t.scheme,c),jt(a,t.slashscheme,u),jt(o,r,i),jt(o,t.domain,o);const h=Pe(o,so);Pe(i,so,h),Pe(c,so,h),Pe(u,so,h);const f=Pe(i,Na);jt(f,r,i),jt(f,t.domain,i);const m=Rr();jt(h,t.domain,m),jt(m,t.domain,m);const x=Pe(m,Na);jt(x,t.domain,m);const b=Rr(gw);jt(x,t.tld,b),jt(x,t.utld,b),Pe(h,fu,b);const v=Pe(m,Pr);Pe(v,Pr,v),jt(v,t.domain,m),jt(b,t.domain,m),Pe(b,Na,x),Pe(b,Pr,v);const w=Pe(b,io);jt(w,t.numeric,gw);const N=Pe(o,Pr),k=Pe(o,Na);Pe(N,Pr,N),jt(N,t.domain,o),jt(k,r,i),jt(k,t.domain,o);const E=Rr(Fh);jt(k,t.tld,E),jt(k,t.utld,E),jt(E,t.domain,o),jt(E,r,i),Pe(E,Na,k),Pe(E,Pr,N),Pe(E,so,h);const C=Pe(E,io),R=Rr(Fh);jt(C,t.numeric,R);const L=Rr(Fh),q=Rr();jt(L,e,L),jt(L,n,q),jt(q,e,L),jt(q,n,q),Pe(E,wa,L),Pe(R,wa,L);const _=Pe(c,io),H=Pe(u,io),P=Pe(H,wa),se=Pe(P,wa);jt(c,t.domain,o),Pe(c,Na,k),Pe(c,Pr,N),jt(u,t.domain,o),Pe(u,Na,k),Pe(u,Pr,N),jt(_,t.domain,L),Pe(_,wa,L),Pe(_,Zd,L),jt(se,t.domain,L),jt(se,e,L),Pe(se,wa,L);const Y=[[Qd,Yd],[Mf,Af],[If,Rf],[Pf,Lf],[Of,Df],[_f,$f],[zf,Ff],[Bf,Vf]];for(let V=0;V=0&&x++,a++,f++;if(x<0)a-=f,a0&&(i.push(sg(yw,e,o)),o=[]),a-=x,f-=x;const b=m.t,v=n.slice(a-f,a);i.push(sg(b,e,v))}}return o.length>0&&i.push(sg(yw,e,o)),i}function sg(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 f$=typeof console<"u"&&console&&console.warn||(()=>{}),p$="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 m$(){return Ys.groups={},mn.scanner=null,mn.parser=null,mn.tokenQueue=[],mn.pluginQueue=[],mn.customSchemes=[],mn.initialized=!1,mn}function bw(t,e=!1){if(mn.initialized&&f$(`linkifyjs: already initialized - will not register custom scheme "${t}" ${p$}`),!/^[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=l$(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=lC(n.doc,[...e]);if(xC(c).forEach(({newRange:h})=>{const f=vD(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(!y$.test(b))return;m=f[0],x=r.doc.textBetween(m.pos,h.to,void 0," ")}if(m&&x){const b=x.split(g$).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=Ey(v).map(k=>k.toObject(t.defaultProtocol));if(!v$(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=>{my(k.from,k.to,r.doc).some(E=>E.mark.type===t.type)||o.addMark(k.from,k.to,t.type.create({href:k.href}))})}}),!!o.steps.length)return o}})}function w$(t){return new un({key:new bn("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=mC(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 j$(t){return new un({key:new bn("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=YC(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 sl(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(b$,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var k$=Dl.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"){bw(t);return}bw(t.scheme,t.optionalSlashes)})},onDestroy(){m$()},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)=>!!sl(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=>!!sl(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=>!!sl(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=>!!sl(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=>!!sl(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[Ml({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,a=YC(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!sl(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(N$({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:a=>!!sl(a,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(w$({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(j$({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),S$=Object.defineProperty,C$=(t,e)=>{for(var n in e)S$(t,n,{get:e[n],enumerable:!0})},T$="listItem",vw="textStyle",Nw=/^\s*([-+*])\s$/,XC=$n.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(vw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Vc({find:Nw,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Vc({find:Nw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(vw),editor:this.editor})),[t]}}),ZC=$n.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)=>by(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)}}}),E$={};C$(E$,{findListItemPos:()=>ku,getNextListDepth:()=>Ay,handleBackspace:()=>a0,handleDelete:()=>i0,hasListBefore:()=>e3,hasListItemAfter:()=>M$,hasListItemBefore:()=>t3,listItemHasSubList:()=>n3,nextListIsDeeper:()=>s3,nextListIsHigher:()=>r3});var ku=(t,e)=>{const{$from:n}=e.selection,r=Hn(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}},Ay=(t,e)=>{const n=ku(t,e);if(!n)return!1;const[,r]=AD(e,t,n.$pos.pos+4);return r},e3=(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))},t3=(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)},n3=(t,e,n)=>{if(!n)return!1;const r=Hn(t,e.schema);let a=!1;return n.descendants(i=>{i.type===r&&(a=!0)}),a},a0=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!wo(t.state,e)&&e3(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(!wo(t.state,e)||!LD(t.state))return!1;const r=ku(e,t.state);if(!r)return!1;const i=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=n3(e,t.state,i);return t3(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},s3=(t,e)=>{const n=Ay(t,e),r=ku(t,e);return!r||!n?!1:n>r.depth},r3=(t,e)=>{const n=Ay(t,e),r=ku(t,e);return!r||!n?!1:n{if(!wo(t.state,e)||!PD(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:a}=n;return!n.empty&&r.sameParent(a)?!1:s3(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():r3(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},M$=(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)},a3=Rn.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&&i0(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&&i0(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&&a0(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&&a0(t,n,r)&&(e=!0)}),e}}}}),ww=/^(\s*)(\d+)\.\s+(.*)$/,A$=/^\s/;function I$(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=i3(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 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 P$="listItem",jw="textStyle",kw=/^(\d+)\.\s$/,o3=$n.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]=I$(a);if(i.length===0)return;const c=i3(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(P$,this.editor.getAttributes(jw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Vc({find:kw,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=Vc({find:kw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(jw)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),L$=/^\s*(\[([( |x])?\])\s$/,O$=$n.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 by(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=hu(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[Vc({find:L$,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),D$=$n.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=Jg(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=Jg(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()}}});Rn.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(XC.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(ZC.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(a3.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(o3.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(O$.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(D$.configure(this.options.taskList)),t}});var Sw=" ",_$=" ",$$=$n.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===Sw||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?Sw:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),z$=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,F$=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,B$=Dl.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[Bc({find:z$,type:this.type})]},addPasteRules(){return[Ml({find:F$,type:this.type})]}}),V$=$n.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),H$=Dl.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 U$(t={}){return new un({view(e){return new W$(e,t)}})}class W${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=eS(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 An extends ft{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return An.valid(r)?new An(r):ft.near(r)}content(){return Fe.empty}eq(e){return e instanceof An&&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 An(e.resolve(n.pos))}getBookmark(){return new Iy(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!K$(e)||!q$(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&&An.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(An.valid(u))return u}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!at.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(An.valid(c))return c}return null}}}An.prototype.visible=!1;An.findFrom=An.findGapCursorFrom;ft.jsonID("gapcursor",An);class Iy{constructor(e){this.pos=e}map(e){return new Iy(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return An.valid(n)?new An(n):ft.near(n)}}function l3(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function K$(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||l3(a.type))return!0;if(a.inlineContent)return!1}}return!0}function q$(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||l3(a.type))return!0;if(a.inlineContent)return!1}}return!0}function G$(){return new un({props:{decorations:X$,createSelectionBetween(t,e,n){return e.pos==n.pos&&An.valid(n)?new An(n):null},handleClick:Q$,handleKeyDown:J$,handleDOMEvents:{beforeinput:Y$}}})}const J$=cy({ArrowLeft:Bh("horiz",-1),ArrowRight:Bh("horiz",1),ArrowUp:Bh("vert",-1),ArrowDown:Bh("vert",1)});function Bh(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 it){if(!i.endOfTextblock(n)||c.depth==0)return!1;u=!1,c=r.doc.resolve(e>0?c.after():c.before())}let h=An.findGapCursorFrom(c,e,u);return h?(a&&a(r.tr.setSelection(new An(h))),!0):!1}}function Q$(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!An.valid(r))return!1;let a=t.posAtCoords({left:n.clientX,top:n.clientY});return a&&a.inside>-1&&at.isSelectable(t.state.doc.nodeAt(a.inside))?!1:(t.dispatch(t.state.tr.setSelection(new An(r))),!0)}function Y$(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof An))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=Se.empty;for(let o=r.length-1;o>=0;o--)a=Se.from(r[o].createAndFill(null,a));let i=t.state.tr.replace(n.pos,n.pos,new Fe(a,0,0));return i.setSelection(it.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function X$(t){if(!(t.selection instanceof An))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",sn.create(t.doc,[Qn.widget(t.selection.head,e,{key:"gapcursor"})])}var np=200,ss=function(){};ss.prototype.append=function(e){return e.length?(e=ss.from(e),!this.length&&e||e.length=n?ss.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};ss.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ss.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)};ss.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};ss.from=function(e){return e instanceof ss?e:e&&e.length?new c3(e):ss.empty};var c3=(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<=np)return new e(this.values.concat(a.flatten()))},e.prototype.leafPrepend=function(a){if(this.length+a.length<=np)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})(ss);ss.empty=new c3([]);var Z$=(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})(ss);const ez=500;class sa{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 Zi(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 Zi(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 sa(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;fnz&&(c=tz(c,h),o-=h),new sa(c.append(i),o)}remapping(e,n){let r=new iu;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 sa(this.items.append(e.map(n=>new Zi(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 Zi(v,w,N))}else r.push(new Zi(v))},a);let h=[];for(let x=n;xez&&(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 Zi(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 sa(ss.from(a.reverse()),i)}}sa.empty=new sa(ss.empty,0);function tz(t,e){let n;return t.forEach((r,a)=>{if(r.selection&&e--==0)return n=a,!1}),t.slice(n)}let Zi=class d3{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 d3(n.getMap().invert(),n,this.selection)}}};class ro{constructor(e,n,r,a,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=a,this.prevComposition=i}}const nz=20;function sz(t,e,n,r){let a=n.getMeta(xl),i;if(a)return a.historyState;n.getMeta(iz)&&(t=new ro(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(xl))return o.getMeta(xl).redo?new ro(t.done.addTransform(n,void 0,r,Zh(e)),t.undone,Cw(n.mapping.maps),t.prevTime,t.prevComposition):new ro(t.done,t.undone.addTransform(n,void 0,r,Zh(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||!rz(n,t.prevRanges)),h=o?rg(t.prevRanges,n.mapping):Cw(n.mapping.maps);return new ro(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,Zh(e)),sa.empty,h,n.time,c??t.prevComposition)}else return(i=n.getMeta("rebased"))?new ro(t.done.rebased(n,i),t.undone.rebased(n,i),rg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new ro(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),rg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function rz(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 Cw(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 rg(t,e){if(!t)return null;let n=[];for(let r=0;r{let a=xl.getState(n);if(!a||(t?a.undone:a.done).eventCount==0)return!1;if(r){let i=az(a,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const h3=u3(!1,!0),f3=u3(!0,!0);Rn.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 un({key:new bn("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 lz=Rn.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[U$(this.options)]}});Rn.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new un({key:new bn("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:a}=e,i=[];if(!n||!r)return sn.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(Qn.node(h,h+u.nodeSize,{class:this.options.className}))}),sn.create(t,i)}}})]}});var cz=Rn.create({name:"gapCursor",addProseMirrorPlugins(){return[G$()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Kt(st(t,"allowGapCursor",n)))!=null?e:null}}}),Ew="placeholder";function dz(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var uz=Rn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Ew,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${dz(this.options.dataAttribute)}`:`data-${Ew}`;return[new un({key:new bn("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&&Mp(c);if((h||!this.options.showOnlyCurrent)&&f){const m=[this.options.emptyNodeClass];o&&m.push(this.options.emptyEditorClass);const x=Qn.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}),sn.create(e,i)}}})]}});Rn.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new un({key:new bn("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||gC(n.selection)||t.view.dragging?null:sn.create(n.doc,[Qn.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Mw({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var hz=Rn.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new bn(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 un({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!Mw({node:o,types:r})},apply:(a,i)=>{if(!a.docChanged||a.getMeta("__uniqueIDTransaction"))return i;const o=a.doc.lastChild;return!Mw({node:o,types:r})}}})]}}),fz=Rn.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>h3(t,e),redo:()=>({state:t,dispatch:e})=>f3(t,e)}},addProseMirrorPlugins(){return[oz(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()}}}),pz=Rn.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(P7.configure(this.options.blockquote)),this.options.bulletList!==!1&&a.push(XC.configure(this.options.bulletList)),this.options.code!==!1&&a.push(B7.configure(this.options.code)),this.options.codeBlock!==!1&&a.push(U7.configure(this.options.codeBlock)),this.options.document!==!1&&a.push(W7.configure(this.options.document)),this.options.dropcursor!==!1&&a.push(lz.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&a.push(cz.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&a.push(K7.configure(this.options.hardBreak)),this.options.heading!==!1&&a.push(q7.configure(this.options.heading)),this.options.undoRedo!==!1&&a.push(fz.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&a.push(G7.configure(this.options.horizontalRule)),this.options.italic!==!1&&a.push(Z7.configure(this.options.italic)),this.options.listItem!==!1&&a.push(ZC.configure(this.options.listItem)),this.options.listKeymap!==!1&&a.push(a3.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&a.push(k$.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&a.push(o3.configure(this.options.orderedList)),this.options.paragraph!==!1&&a.push($$.configure(this.options.paragraph)),this.options.strike!==!1&&a.push(B$.configure(this.options.strike)),this.options.text!==!1&&a.push(V$.configure(this.options.text)),this.options.underline!==!1&&a.push(H$.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&a.push(hz.configure((r=this.options)==null?void 0:r.trailingNode)),a}}),mz=pz,xz=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,gz=$n.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,x])=>{if(x!=null)switch(m){case"width":case"height":break;default:u.setAttribute(m,x);break}}),u.src=o.src;const h=new v_({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[LC({find:xz,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),yz=gz;function bz(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:o,$position:c}=t,u=r&&!a,h=w_(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),E=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(k);if(i!==null&&!E)return null;const C=w+N.index;let R=C+N[0].length;return u&&f.test(v.slice(R-1,R+1))&&(N[0]+=" ",R+=1),C=c.pos?{range:{from:C,to:R},query:N[0].slice(n.length),text:N[0]}:null}var vz=new bn("suggestion");function Nz({pluginKey:t=vz,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=bz,shouldShow:N}){let k;const E=b==null?void 0:b(),C=()=>{const _=e.state.selection.$anchor.pos,H=e.view.coordsAtPos(_),{top:P,right:se,bottom:Y,left:V}=H;try{return new DOMRect(V,P,se-V,Y-P)}catch{return null}},R=(_,H)=>H?()=>{const P=t.getState(e.state),se=P==null?void 0:P.decorationId,Y=_.dom.querySelector(`[data-decoration-id="${se}"]`);return(Y==null?void 0:Y.getBoundingClientRect())||null}:C;function L(_,H){var P;try{const Y=t.getState(_.state),V=Y!=null&&Y.decorationId?_.dom.querySelector(`[data-decoration-id="${Y.decorationId}"]`):null,ae={editor:e,range:(Y==null?void 0:Y.range)||{from:0,to:0},query:(Y==null?void 0:Y.query)||null,text:(Y==null?void 0:Y.text)||null,items:[],command:le=>m({editor:e,range:(Y==null?void 0:Y.range)||{from:0,to:0},props:le}),decorationNode:V,clientRect:R(_,V)};(P=E==null?void 0:E.onExit)==null||P.call(E,ae)}catch{}const se=_.state.tr.setMeta(H,{exit:!0});_.dispatch(se)}const q=new un({key:t,view(){return{update:async(_,H)=>{var P,se,Y,V,ae,le,de;const I=(P=this.key)==null?void 0:P.getState(H),G=(se=this.key)==null?void 0:se.getState(_.state),z=I.active&&G.active&&I.range.from!==G.range.from,me=!I.active&&G.active,X=I.active&&!G.active,F=!me&&!X&&I.query!==G.query,U=me||z&&F,fe=F||z,he=X||z&&F;if(!U&&!fe&&!he)return;const oe=he&&!U?I:G,O=_.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:O,clientRect:R(_,O)},U&&((Y=E==null?void 0:E.onBeforeStart)==null||Y.call(E,k)),fe&&((V=E==null?void 0:E.onBeforeUpdate)==null||V.call(E,k)),(fe||U)&&(k.items=await x({editor:e,query:oe.query})),he&&((ae=E==null?void 0:E.onExit)==null||ae.call(E,k)),fe&&((le=E==null?void 0:E.onUpdate)==null||le.call(E,k)),U&&((de=E==null?void 0:E.onStart)==null||de.call(E,k))},destroy:()=>{var _;k&&((_=E==null?void 0:E.onExit)==null||_.call(E,k))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(_,H,P,se){const{isEditable:Y}=e,{composing:V}=e.view,{selection:ae}=_,{empty:le,from:de}=ae,I={...H},G=_.getMeta(t);if(G&&G.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,Y&&(le||e.view.composing)){(deH.range.to)&&!V&&!H.composing&&(I.active=!1);const z=w({char:n,allowSpaces:r,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:o,$position:ae.$from}),me=`id_${Math.floor(Math.random()*4294967295)}`;z&&v({editor:e,state:se,range:z.range,isActive:H.active})&&(!N||N({editor:e,range:z.range,query:z.query,text:z.text,transaction:_}))?(I.active=!0,I.decorationId=H.decorationId?H.decorationId:me,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 P,se,Y,V;const{active:ae,range:le}=q.getState(_.state);if(!ae)return!1;if(H.key==="Escape"||H.key==="Esc"){const I=q.getState(_.state),G=(P=k==null?void 0:k.decorationNode)!=null?P:null,z=G??(I!=null&&I.decorationId?_.dom.querySelector(`[data-decoration-id="${I.decorationId}"]`):null);if(((se=E==null?void 0:E.onKeyDown)==null?void 0:se.call(E,{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(Y=E==null?void 0:E.onExit)==null||Y.call(E,X),L(_,t),!0}return((V=E==null?void 0:E.onKeyDown)==null?void 0:V.call(E,{view:_,event:H,range:le}))||!1},decorations(_){const{active:H,range:P,decorationId:se,query:Y}=q.getState(_);if(!H)return null;const V=!(Y!=null&&Y.length),ae=[u];return V&&ae.push(f),sn.create(_.doc,[Qn.inline(P.from,P.to,{nodeName:c,class:ae.join(" "),"data-decoration-id":se,"data-decoration-content":h})])}}});return q}function wz({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const a=new bn;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 p3(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>wz({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function Aw(t,e){const n=p3(t),r=n.find(a=>a.char===e);return r||(n.length?n[0]:null)}var jz=$n.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=Aw(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},...OC({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:Aw(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 fi,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 p3(this).map(Nz)}}),kz=jz,Sz=uz;let o0,l0;if(typeof WeakMap<"u"){let t=new WeakMap;o0=e=>t.get(e),l0=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;o0=r=>{for(let a=0;a(n==10&&(n=0),t[n++]=r,t[n++]=a)}var In=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 R=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 Ez(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 Az(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 la(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 Pp(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=Al(e.$head)||Iz(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Iz(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 c0(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function Rz(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Ry(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function m3(t,e,n){const r=t.node(-1),a=In.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 Il(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 x3(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 aS(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(c0(r)&&c0(a)&&Ry(r,a)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?oi.rowSelection(r,a):i&&this.isColSelection()?oi.colSelection(r,a):new oi(r,a)}return it.between(r,a)}content(){const e=this.$anchorCell.node(-1),n=In.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=Il(k,0,w)),N>0&&(k=Il(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=In.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 oi&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),a=In.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(Qn.node(r,r+n.nodeSize,{class:"selectedCell"}))}),sn.create(t.doc,e)}function Dz({$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 $z(t,e,n){const r=(e||t).selection,a=(e||t).doc;let i,o;if(r instanceof at&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")i=dn.create(a,r.from);else if(o=="row"){const c=a.resolve(r.from+1);i=dn.rowSelection(c,c)}else if(!n){const c=In.get(r.node),u=r.from+1,h=u+c.map[c.width*c.height-1];i=dn.create(a,u+1,h)}}else r instanceof it&&Dz(r)?i=it.create(a,r.from):r instanceof it&&_z(r)&&(i=it.create(a,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}const zz=new bn("fix-tables");function y3(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=Fz(t,a,i,n))};return e?e.doc!=t.doc&&y3(e.doc,t.doc,0,r):t.doc.descendants(r),n}function Fz(t,e,n,r){const a=In.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;Pz(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;Wz(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=Iw(h)?u+1:f;i.replaceWith(m+r.tableStart,f+r.tableStart,c)}i.setSelection(new dn(i.doc.resolve(u+r.tableStart))),e(i)}return!0}function Pw(t,e){const n=Ss(t.schema);return Yz(({node:r})=>n[r.type.spec.tableRole])(t,e)}function Yz(t){return(e,n)=>{const r=e.selection;let a,i;if(r instanceof dn){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;a=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{var o;if(a=Az(r.$from),!a)return!1;i=(o=Al(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=Pa(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 Zz(t){return function(e,n){if(!la(e))return!1;if(n){const r=Ss(e.schema),a=Pa(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}}mu("row",{useDeprecatedLogic:!0});mu("column",{useDeprecatedLogic:!0});const eF=mu("cell",{useDeprecatedLogic:!0});function tF(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 Vh(t,e){const n=t.selection;if(!(n instanceof dn))return!1;if(e){const r=t.tr,a=Ss(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 sF(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(Se.empty),n[a]r&&(x=x.type.createChecked(Il(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(Se.from(u))}n=i,e=a}return{width:t,height:e,rows:n}}function iF(t,e,n,r,a,i,o){const c=t.doc.type.schema,u=Ss(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,Se.from(m)),b=[];for(let v=e.height;v{if(!a)return!1;const i=n.selection;if(i instanceof dn)return ef(n,r,ft.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const o=w3(a,t,e);if(o==null)return!1;if(t=="horiz")return ef(n,r,ft.near(n.doc.resolve(i.head+e),e));{const c=n.doc.resolve(o),u=m3(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),ef(n,r,h)}}}function Uh(t,e){return(n,r,a)=>{if(!a)return!1;const i=n.selection;let o;if(i instanceof dn)o=i;else{const u=w3(a,t,e);if(u==null)return!1;o=new dn(n.doc.resolve(u))}const c=m3(o.$headCell,t,e);return c?ef(n,r,new dn(o.$anchorCell,c)):!1}}function lF(t,e){const n=t.state.doc,r=Al(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new dn(r))),!0):!1}function cF(t,e,n){if(!la(t.state))return!1;let r=sF(n);const a=t.state.selection;if(a instanceof dn){r||(r={width:1,height:1,rows:[Se.from(d0(Ss(t.state.schema).cell,n))]});const i=a.$anchorCell.node(-1),o=a.$anchorCell.start(-1),c=In.get(i).rectBetween(a.$anchorCell.pos-o,a.$headCell.pos-o);return r=aF(r,c.right-c.left,c.bottom-c.top),$w(t.state,t.dispatch,o,c,r),!0}else if(r){const i=Pp(t.state),o=i.start(-1);return $w(t.state,t.dispatch,o,In.get(i.node(-1)).findCell(i.pos-o),r),!0}else return!1}function dF(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=zw(t,e.target);let a;if(e.shiftKey&&t.state.selection instanceof dn)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(a=Al(t.state.selection.$anchor))!=null&&((n=ig(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=ig(t,h);const m=oo.getState(t.state)==null;if(!f||!Ry(u,f))if(m)f=u;else return;const x=new dn(u,f);if(m||!t.state.selection.eq(x)){const b=t.state.tr.setSelection(x);m&&b.setMeta(oo,u.pos),t.dispatch(b)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",c),oo.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(oo,-1))}function c(u){const h=u,f=oo.getState(t.state);let m;if(f!=null)m=t.state.doc.resolve(f);else if(zw(t,h.target)!=r&&(m=ig(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 w3(t,e,n){if(!(t.state.selection instanceof it))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 zw(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function ig(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&&Al(t.state.doc.resolve(r))||Al(t.state.doc.resolve(a))}var uF=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")),u0(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,u0(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function u0(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 fF(-1,!1)},apply(o,c){return c.apply(o)}},props:{attributes:o=>{const c=pr.getState(o);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,c)=>{pF(o,c,t,a)},mouseleave:o=>{mF(o)},mousedown:(o,c)=>{xF(o,c,e,n)}},decorations:o=>{const c=pr.getState(o);if(c&&c.activeHandle>-1)return NF(o,c.activeHandle)},nodeViews:{}}});return i}var fF=class tf{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(pr);if(r&&r.setHandle!=null)return new tf(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new tf(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let a=e.mapping.map(n.activeHandle,-1);return c0(e.doc.resolve(a))||(a=-1),new tf(a,n.dragging)}return n}};function pF(t,e,n,r){if(!t.editable)return;const a=pr.getState(t.state);if(a&&!a.dragging){const i=yF(e.target);let o=-1;if(i){const{left:c,right:u}=i.getBoundingClientRect();e.clientX-c<=n?o=Fw(t,e,"left",n):u-e.clientX<=n&&(o=Fw(t,e,"right",n))}if(o!=a.activeHandle){if(!r&&o!==-1){const c=t.state.doc.resolve(o),u=c.node(-1),h=In.get(u),f=c.start(-1);if(h.colCount(c.pos-f)+c.nodeAfter.attrs.colspan-1==h.width-1)return}j3(t,o)}}}function mF(t){if(!t.editable)return;const e=pr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&j3(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=pr.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const c=t.state.doc.nodeAt(o.activeHandle),u=gF(t,o.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta(pr,{setDragging:{startX:e.clientX,startWidth:u}}));function h(m){i.removeEventListener("mouseup",h),i.removeEventListener("mousemove",f);const x=pr.getState(t.state);x!=null&&x.dragging&&(bF(t,x.activeHandle,Bw(x.dragging,m,n)),t.dispatch(t.state.tr.setMeta(pr,{setDragging:null})))}function f(m){if(!m.which)return h(m);const x=pr.getState(t.state);if(x&&x.dragging){const b=Bw(x.dragging,m,n);Vw(t,x.activeHandle,b,r)}}return Vw(t,o.activeHandle,u,r),i.addEventListener("mouseup",h),i.addEventListener("mousemove",f),e.preventDefault(),!0}function gF(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]}}),S3=$n.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]}}),C3=$n.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 h0(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Hw(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 CF(t,e,n,r,a){const i=SF(t),o=[],c=[];for(let h=0;h{const{selection:e}=t.state;if(!TF(e))return!1;let n=0;const r=cC(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},EF="";function MF(t){return(t||"").replace(/\s+/g," ").trim()}function AF(t,e,n={}){var r;const a=(r=n.cellLineSeparator)!=null?r:EF;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 E=MF(k),C=N.type==="tableHeader";w.push({text:E,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]=E),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 IF=AF,T3=$n.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:jF,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}=kF(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)=>IF(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:a,editor:i})=>{const o=CF(i.schema,t,e,n);if(a){const c=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(it.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>Bz(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>Vz(t,e),deleteColumn:()=>({state:t,dispatch:e})=>Uz(t,e),addRowBefore:()=>({state:t,dispatch:e})=>Kz(t,e),addRowAfter:()=>({state:t,dispatch:e})=>qz(t,e),deleteRow:()=>({state:t,dispatch:e})=>Jz(t,e),deleteTable:()=>({state:t,dispatch:e})=>nF(t,e),mergeCells:()=>({state:t,dispatch:e})=>Rw(t,e),splitCell:()=>({state:t,dispatch:e})=>Pw(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})=>eF(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Rw(t,e)?!0:Pw(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>Xz(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Ow(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Ow(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&b3(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=dn.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:Wh,"Mod-Backspace":Wh,Delete:Wh,"Mod-Delete":Wh}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[hF({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],wF({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:Kt(st(t,"tableRole",e))}}});Rn.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(T3.configure(this.options.table)),this.options.tableCell!==!1&&t.push(k3.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(S3.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(C3.configure(this.options.tableRow)),t}});function RF(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function PF(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}function LF(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 Ww(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 OF=$n.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 端全宽播放)"]]}}),DF=$n.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 Kw(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)=>`
    + @${Kw(o.name)} + ${Kw(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(Ww(t)),E=y.useCallback((Y,V)=>{var I;const ae=x.current;if(!ae||!n)return!1;const le=$F(V);if(le.length>0)return V.preventDefault(),(async()=>{for(const G of le)try{const z=await n(G);z&&ae.chain().focus().setImage({src:z}).run()}catch(z){console.error("粘贴图片上传失败",z)}})(),!0;const de=(I=V.clipboardData)==null?void 0:I.getData("text/html");if(de&&/data:image\/[^;"']+;base64,/i.test(de)){V.preventDefault();const{from:G,to:z}=ae.state.selection;return(async()=>{try{const me=await BF(de,n);ae.chain().focus().insertContentAt({from:G,to:z},me).run()}catch(me){console.error("粘贴 HTML 内 base64 转换失败",me)}})(),!0}return!1},[n]),C=E7({extensions:[mz.configure({link:{openOnClick:!1,HTMLAttributes:{class:"rich-link"}}}),yz.configure({inline:!0,allowBase64:!0,HTMLAttributes:{class:"rich-editor-img-thumb"}}),OF,kz.configure({HTMLAttributes:{class:"mention-tag"},suggestion:_F(a)}),DF,Sz.configure({placeholder:o}),T3.configure({resizable:!0}),C3,k3,S3],content:k.current,onUpdate:({editor:Y})=>{e(Y.getHTML())},editorProps:{attributes:{class:"rich-editor-content"},handlePaste:E}});y.useEffect(()=>{x.current=C??null},[C]),y.useImperativeHandle(u,()=>({getHTML:()=>(C==null?void 0:C.getHTML())||"",getMarkdown:()=>LF((C==null?void 0:C.getHTML())||"")})),y.useEffect(()=>{if(C&&t!==C.getHTML()){const Y=Ww(t);Y!==C.getHTML()&&C.commands.setContent(Y)}},[t]);const R=y.useCallback(async Y=>{if(r)return r(Y);if(n)return n(Y);throw new Error("未配置上传")},[n,r]),L=y.useCallback(async Y=>{var ae;const V=(ae=Y.target.files)==null?void 0:ae[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)}Y.target.value=""}},[C,n]),q=y.useCallback(async Y=>{var ae;const V=(ae=Y.target.files)==null?void 0:ae[0];if(!(!V||!C)){try{const le=await R(V);le&&C.chain().focus().insertContent({type:"videoEmbed",attrs:{src:le}}).run()}catch(le){console.error(le)}Y.target.value=""}},[C,R]),_=y.useCallback(async Y=>{var ae;const V=(ae=Y.target.files)==null?void 0:ae[0];if(!(!V||!C)){try{const le=await R(V);if(!le)return;const de=V.name||"附件";C.chain().focus().insertContent(`

    附件 ${RF(de)}

    `).run()}catch(le){console.error(le)}Y.target.value=""}},[C,R]),H=y.useCallback(()=>{C&&C.chain().focus().insertContent("@").run()},[C]),P=y.useCallback(Y=>{C&&C.chain().focus().insertContent([{type:"linkTag",attrs:{label:Y.label,url:Y.url||"",tagType:Y.type||"url",tagId:Y.id||"",pagePath:Y.pagePath||"",appId:Y.appId||"",mpKey:Y.type==="miniprogram"&&Y.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(a5,{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(rM,{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(lA,{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(k5,{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(G5,{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(Q5,{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(X5,{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(mM,{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(fM,{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(BM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().setHorizontalRule().run(),type:"button",children:s.jsx(CM,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("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:_,className:"hidden"}),s.jsx("button",{onClick:()=>{var Y;return(Y=h.current)==null?void 0:Y.click()},type:"button",title:"上传图片",children:s.jsx(Fj,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>{var Y;return(Y=f.current)==null?void 0:Y.click()},type:"button",title:"上传视频",disabled:!r&&!n,children:s.jsx(jA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>{var Y;return(Y=m.current)==null?void 0:Y.click()},type:"button",title:"上传附件(生成下载链接)",disabled:!r&&!n,children:s.jsx(IM,{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(n5,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>N(!w),className:C.isActive("link")?"is-active":"",type:"button",title:"链接",children:s.jsx(Ng,{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(dA,{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(HM,{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:Y=>{const V=i.find(ae=>ae.id===Y.target.value);V&&P(V),Y.target.value=""},defaultValue:"",children:[s.jsx("option",{value:"",disabled:!0,children:"# 插入链接标签"}),i.map(Y=>s.jsx("option",{value:Y.id,children:Y.label},Y.id))]})})]})]}),w&&s.jsxs("div",{className:"link-input-bar",children:[s.jsx("input",{type:"url",placeholder:"输入链接地址...",value:b,onChange:Y=>v(Y.target.value),onKeyDown:Y=>Y.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($C,{editor:C})]}):null});f0.displayName="RichEditor";const VF=["top","right","bottom","left"],jo=Math.min,hr=Math.max,sp=Math.round,Kh=Math.floor,Ta=t=>({x:t,y:t}),HF={left:"right",right:"left",bottom:"top",top:"bottom"},UF={start:"end",end:"start"};function p0(t,e,n){return hr(t,jo(e,n))}function yi(t,e){return typeof t=="function"?t(e):t}function bi(t){return t.split("-")[0]}function Yc(t){return t.split("-")[1]}function Py(t){return t==="x"?"y":"x"}function Ly(t){return t==="y"?"height":"width"}const WF=new Set(["top","bottom"]);function Sa(t){return WF.has(bi(t))?"y":"x"}function Oy(t){return Py(Sa(t))}function KF(t,e,n){n===void 0&&(n=!1);const r=Yc(t),a=Oy(t),i=Ly(a);let o=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=rp(o)),[o,rp(o)]}function qF(t){const e=rp(t);return[m0(t),e,m0(e)]}function m0(t){return t.replace(/start|end/g,e=>UF[e])}const qw=["left","right"],Gw=["right","left"],GF=["top","bottom"],JF=["bottom","top"];function QF(t,e,n){switch(t){case"top":case"bottom":return n?e?Gw:qw:e?qw:Gw;case"left":case"right":return e?GF:JF;default:return[]}}function YF(t,e,n,r){const a=Yc(t);let i=QF(bi(t),n==="start",r);return a&&(i=i.map(o=>o+"-"+a),e&&(i=i.concat(i.map(m0)))),i}function rp(t){return t.replace(/left|right|bottom|top/g,e=>HF[e])}function XF(t){return{top:0,right:0,bottom:0,left:0,...t}}function E3(t){return typeof t!="number"?XF(t):{top:t,right:t,bottom:t,left:t}}function ap(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 Jw(t,e,n){let{reference:r,floating:a}=t;const i=Sa(e),o=Oy(e),c=Ly(o),u=bi(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(Yc(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 ZF(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}=yi(e,t),v=E3(b),N=c[x?m==="floating"?"reference":"floating":m],k=ap(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})),E=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)),R=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=ap(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:E,offsetParent:C,strategy:u}):E);return{top:(k.top-L.top+v.top)/R.y,bottom:(L.bottom-k.bottom+v.bottom)/R.y,left:(k.left-L.left+v.left)/R.x,right:(L.right-k.right+v.right)/R.x}}const eB=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}=Jw(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}=yi(t,e)||{};if(h==null)return{};const m=E3(f),x={x:n,y:r},b=Oy(a),v=Ly(b),w=await o.getDimensions(h),N=b==="y",k=N?"top":"left",E=N?"bottom":"right",C=N?"clientHeight":"clientWidth",R=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 _=q?q[C]:0;(!_||!await(o.isElement==null?void 0:o.isElement(q)))&&(_=c.floating[C]||i.floating[v]);const H=R/2-L/2,P=_/2-w[v]/2-1,se=jo(m[k],P),Y=jo(m[E],P),V=se,ae=_-w[v]-Y,le=_/2-w[v]/2+H,de=p0(V,le,ae),I=!u.arrow&&Yc(a)!=null&&le!==de&&i.reference[v]/2-(lele<=0)){var Y,V;const le=(((Y=i.flip)==null?void 0:Y.index)||0)+1,de=_[le];if(de&&(!(m==="alignment"?E!==Sa(de):!1)||se.every(z=>Sa(z.placement)===E?z.overflows[0]>0:!0)))return{data:{index:le,overflows:se},reset:{placement:de}};let I=(V=se.filter(G=>G.overflows[0]<=0).sort((G,z)=>G.overflows[1]-z.overflows[1])[0])==null?void 0:V.placement;if(!I)switch(b){case"bestFit":{var ae;const G=(ae=se.filter(z=>{if(q){const me=Sa(z.placement);return me===E||me==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(me=>me>0).reduce((me,X)=>me+X,0)]).sort((z,me)=>z[1]-me[1])[0])==null?void 0:ae[0];G&&(I=G);break}case"initialPlacement":I=c;break}if(a!==I)return{reset:{placement:I}}}return{}}}};function Qw(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Yw(t){return VF.some(e=>t[e]>=0)}const sB=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:a="referenceHidden",...i}=yi(t,e);switch(a){case"referenceHidden":{const o=await r.detectOverflow(e,{...i,elementContext:"reference"}),c=Qw(o,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Yw(c)}}}case"escaped":{const o=await r.detectOverflow(e,{...i,altBoundary:!0}),c=Qw(o,n.floating);return{data:{escapedOffsets:c,escaped:Yw(c)}}}default:return{}}}}},M3=new Set(["left","top"]);async function rB(t,e){const{placement:n,platform:r,elements:a}=t,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),o=bi(n),c=Yc(n),u=Sa(n)==="y",h=M3.has(o)?-1:1,f=i&&u?-1:1,m=yi(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 aB=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 rB(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}}}}},iB=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:E,y:C}=k;return{x:E,y:C}}},...h}=yi(t,e),f={x:n,y:r},m=await i.detectOverflow(e,h),x=Sa(bi(a)),b=Py(x);let v=f[b],w=f[x];if(o){const k=b==="y"?"top":"left",E=b==="y"?"bottom":"right",C=v+m[k],R=v-m[E];v=p0(C,v,R)}if(c){const k=x==="y"?"top":"left",E=x==="y"?"bottom":"right",C=w+m[k],R=w-m[E];w=p0(C,w,R)}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}}}}}},oB=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}=yi(t,e),f={x:n,y:r},m=Sa(a),x=Py(m);let b=f[x],v=f[m];const w=yi(c,e),N=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(u){const C=x==="y"?"height":"width",R=i.reference[x]-i.floating[C]+N.mainAxis,L=i.reference[x]+i.reference[C]-N.mainAxis;bL&&(b=L)}if(h){var k,E;const C=x==="y"?"width":"height",R=M3.has(bi(a)),L=i.reference[m]-i.floating[C]+(R&&((k=o.offset)==null?void 0:k[m])||0)+(R?0:N.crossAxis),q=i.reference[m]+i.reference[C]+(R?0:((E=o.offset)==null?void 0:E[m])||0)-(R?N.crossAxis:0);vq&&(v=q)}return{[x]:b,[m]:v}}}},lB=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}=yi(t,e),f=await o.detectOverflow(e,h),m=bi(a),x=Yc(a),b=Sa(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 E=w-f.top-f.bottom,C=v-f.left-f.right,R=jo(w-f[N],E),L=jo(v-f[k],C),q=!e.middlewareData.shift;let _=R,H=L;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(H=C),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(_=E),q&&!x){const se=hr(f.left,0),Y=hr(f.right,0),V=hr(f.top,0),ae=hr(f.bottom,0);b?H=v-2*(se!==0||Y!==0?se+Y:hr(f.left,f.right)):_=w-2*(V!==0||ae!==0?V+ae:hr(f.top,f.bottom))}await u({...e,availableWidth:H,availableHeight:_});const P=await o.getDimensions(c.floating);return v!==P.width||w!==P.height?{reset:{rects:!0}}:{}}}};function Lp(){return typeof window<"u"}function Xc(t){return A3(t)?(t.nodeName||"").toLowerCase():"#document"}function xr(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function La(t){var e;return(e=(A3(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function A3(t){return Lp()?t instanceof Node||t instanceof xr(t).Node:!1}function aa(t){return Lp()?t instanceof Element||t instanceof xr(t).Element:!1}function Ia(t){return Lp()?t instanceof HTMLElement||t instanceof xr(t).HTMLElement:!1}function Xw(t){return!Lp()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof xr(t).ShadowRoot}const cB=new Set(["inline","contents"]);function Su(t){const{overflow:e,overflowX:n,overflowY:r,display:a}=ia(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!cB.has(a)}const dB=new Set(["table","td","th"]);function uB(t){return dB.has(Xc(t))}const hB=[":popover-open",":modal"];function Op(t){return hB.some(e=>{try{return t.matches(e)}catch{return!1}})}const fB=["transform","translate","scale","rotate","perspective"],pB=["transform","translate","scale","rotate","perspective","filter"],mB=["paint","layout","strict","content"];function Dy(t){const e=_y(),n=aa(t)?ia(t):t;return fB.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)||pB.some(r=>(n.willChange||"").includes(r))||mB.some(r=>(n.contain||"").includes(r))}function xB(t){let e=ko(t);for(;Ia(e)&&!Hc(e);){if(Dy(e))return e;if(Op(e))return null;e=ko(e)}return null}function _y(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const gB=new Set(["html","body","#document"]);function Hc(t){return gB.has(Xc(t))}function ia(t){return xr(t).getComputedStyle(t)}function Dp(t){return aa(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function ko(t){if(Xc(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Xw(t)&&t.host||La(t);return Xw(e)?e.host:e}function I3(t){const e=ko(t);return Hc(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ia(e)&&Su(e)?e:I3(e)}function xu(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const a=I3(t),i=a===((r=t.ownerDocument)==null?void 0:r.body),o=xr(a);if(i){const c=x0(o);return e.concat(o,o.visualViewport||[],Su(a)?a:[],c&&n?xu(c):[])}return e.concat(a,xu(a,[],n))}function x0(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function R3(t){const e=ia(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const a=Ia(t),i=a?t.offsetWidth:n,o=a?t.offsetHeight:r,c=sp(n)!==i||sp(r)!==o;return c&&(n=i,r=o),{width:n,height:r,$:c}}function $y(t){return aa(t)?t:t.contextElement}function Rc(t){const e=$y(t);if(!Ia(e))return Ta(1);const n=e.getBoundingClientRect(),{width:r,height:a,$:i}=R3(e);let o=(i?sp(n.width):n.width)/r,c=(i?sp(n.height):n.height)/a;return(!o||!Number.isFinite(o))&&(o=1),(!c||!Number.isFinite(c))&&(c=1),{x:o,y:c}}const yB=Ta(0);function P3(t){const e=xr(t);return!_y()||!e.visualViewport?yB:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function bB(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==xr(t)?!1:e}function Rl(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const a=t.getBoundingClientRect(),i=$y(t);let o=Ta(1);e&&(r?aa(r)&&(o=Rc(r)):o=Rc(t));const c=bB(i,n,r)?P3(i):Ta(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=xr(i),b=r&&aa(r)?xr(r):r;let v=x,w=x0(v);for(;w&&r&&b!==v;){const N=Rc(w),k=w.getBoundingClientRect(),E=ia(w),C=k.left+(w.clientLeft+parseFloat(E.paddingLeft))*N.x,R=k.top+(w.clientTop+parseFloat(E.paddingTop))*N.y;u*=N.x,h*=N.y,f*=N.x,m*=N.y,u+=C,h+=R,v=xr(w),w=x0(v)}}return ap({width:f,height:m,x:u,y:h})}function _p(t,e){const n=Dp(t).scrollLeft;return e?e.left+n:Rl(La(t)).left+n}function L3(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-_p(t,n),a=n.top+e.scrollTop;return{x:r,y:a}}function vB(t){let{elements:e,rect:n,offsetParent:r,strategy:a}=t;const i=a==="fixed",o=La(r),c=e?Op(e.floating):!1;if(r===o||c&&i)return n;let u={scrollLeft:0,scrollTop:0},h=Ta(1);const f=Ta(0),m=Ia(r);if((m||!m&&!i)&&((Xc(r)!=="body"||Su(o))&&(u=Dp(r)),Ia(r))){const b=Rl(r);h=Rc(r),f.x=b.x+r.clientLeft,f.y=b.y+r.clientTop}const x=o&&!m&&!i?L3(o,u):Ta(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 NB(t){return Array.from(t.getClientRects())}function wB(t){const e=La(t),n=Dp(t),r=t.ownerDocument.body,a=hr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=hr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+_p(t);const c=-n.scrollTop;return ia(r).direction==="rtl"&&(o+=hr(e.clientWidth,r.clientWidth)-a),{width:a,height:i,x:o,y:c}}const Zw=25;function jB(t,e){const n=xr(t),r=La(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=_y();(!f||f&&e==="fixed")&&(c=a.offsetLeft,u=a.offsetTop)}const h=_p(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<=Zw&&(i-=v)}else h<=Zw&&(i+=h);return{width:i,height:o,x:c,y:u}}const kB=new Set(["absolute","fixed"]);function SB(t,e){const n=Rl(t,!0,e==="fixed"),r=n.top+t.clientTop,a=n.left+t.clientLeft,i=Ia(t)?Rc(t):Ta(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 ej(t,e,n){let r;if(e==="viewport")r=jB(t,n);else if(e==="document")r=wB(La(t));else if(aa(e))r=SB(e,n);else{const a=P3(t);r={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return ap(r)}function O3(t,e){const n=ko(t);return n===e||!aa(n)||Hc(n)?!1:ia(n).position==="fixed"||O3(n,e)}function CB(t,e){const n=e.get(t);if(n)return n;let r=xu(t,[],!1).filter(c=>aa(c)&&Xc(c)!=="body"),a=null;const i=ia(t).position==="fixed";let o=i?ko(t):t;for(;aa(o)&&!Hc(o);){const c=ia(o),u=Dy(o);!u&&c.position==="fixed"&&(a=null),(i?!u&&!a:!u&&c.position==="static"&&!!a&&kB.has(a.position)||Su(o)&&!u&&O3(t,o))?r=r.filter(f=>f!==o):a=c,o=ko(o)}return e.set(t,r),r}function TB(t){let{element:e,boundary:n,rootBoundary:r,strategy:a}=t;const o=[...n==="clippingAncestors"?Op(e)?[]:CB(e,this._c):[].concat(n),r],c=o[0],u=o.reduce((h,f)=>{const m=ej(e,f,a);return h.top=hr(m.top,h.top),h.right=jo(m.right,h.right),h.bottom=jo(m.bottom,h.bottom),h.left=hr(m.left,h.left),h},ej(e,c,a));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function EB(t){const{width:e,height:n}=R3(t);return{width:e,height:n}}function MB(t,e,n){const r=Ia(e),a=La(e),i=n==="fixed",o=Rl(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const u=Ta(0);function h(){u.x=_p(a)}if(r||!r&&!i)if((Xc(e)!=="body"||Su(a))&&(c=Dp(e)),r){const b=Rl(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?L3(a,c):Ta(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 og(t){return ia(t).position==="static"}function tj(t,e){if(!Ia(t)||ia(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return La(t)===n&&(n=n.ownerDocument.body),n}function D3(t,e){const n=xr(t);if(Op(t))return n;if(!Ia(t)){let a=ko(t);for(;a&&!Hc(a);){if(aa(a)&&!og(a))return a;a=ko(a)}return n}let r=tj(t,e);for(;r&&uB(r)&&og(r);)r=tj(r,e);return r&&Hc(r)&&og(r)&&!Dy(r)?n:r||xB(t)||n}const AB=async function(t){const e=this.getOffsetParent||D3,n=this.getDimensions,r=await n(t.floating);return{reference:MB(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function IB(t){return ia(t).direction==="rtl"}const RB={convertOffsetParentRelativeRectToViewportRelativeRect:vB,getDocumentElement:La,getClippingRect:TB,getOffsetParent:D3,getElementRects:AB,getClientRects:NB,getDimensions:EB,getScale:Rc,isElement:aa,isRTL:IB};function _3(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function PB(t,e){let n=null,r;const a=La(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=Kh(m),w=Kh(a.clientWidth-(f+x)),N=Kh(a.clientHeight-(m+b)),k=Kh(f),C={rootMargin:-v+"px "+-w+"px "+-N+"px "+-k+"px",threshold:hr(0,jo(1,u))||1};let R=!0;function L(q){const _=q[0].intersectionRatio;if(_!==u){if(!R)return o();_?o(!1,_):r=setTimeout(()=>{o(!1,1e-7)},1e3)}_===1&&!_3(h,t.getBoundingClientRect())&&o(),R=!1}try{n=new IntersectionObserver(L,{...C,root:a.ownerDocument})}catch{n=new IntersectionObserver(L,C)}n.observe(t)}return o(!0),i}function LB(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=$y(t),f=a||i?[...h?xu(h):[],...xu(e)]:[];f.forEach(k=>{a&&k.addEventListener("scroll",n,{passive:!0}),i&&k.addEventListener("resize",n)});const m=h&&c?PB(h,n):null;let x=-1,b=null;o&&(b=new ResizeObserver(k=>{let[E]=k;E&&E.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?Rl(t):null;u&&N();function N(){const k=Rl(t);w&&!_3(w,k)&&n(),w=k,v=requestAnimationFrame(N)}return n(),()=>{var k;f.forEach(E=>{a&&E.removeEventListener("scroll",n),i&&E.removeEventListener("resize",n)}),m==null||m(),(k=b)==null||k.disconnect(),b=null,u&&cancelAnimationFrame(v)}}const OB=aB,DB=iB,_B=nB,$B=lB,zB=sB,nj=tB,FB=oB,BB=(t,e,n)=>{const r=new Map,a={platform:RB,...n},i={...a.platform,_c:r};return eB(t,e,{...a,platform:i})};var VB=typeof document<"u",HB=function(){},nf=VB?y.useLayoutEffect:HB;function ip(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(!ip(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)&&!ip(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function $3(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function sj(t,e){const n=$3(t);return Math.round(e*n)/n}function lg(t){const e=y.useRef(t);return nf(()=>{e.current=t}),e}function UB(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);ip(x,r)||b(r);const[v,w]=y.useState(null),[N,k]=y.useState(null),E=y.useCallback(z=>{z!==q.current&&(q.current=z,w(z))},[]),C=y.useCallback(z=>{z!==_.current&&(_.current=z,k(z))},[]),R=i||v,L=o||N,q=y.useRef(null),_=y.useRef(null),H=y.useRef(f),P=u!=null,se=lg(u),Y=lg(a),V=lg(h),ae=y.useCallback(()=>{if(!q.current||!_.current)return;const z={placement:e,strategy:n,middleware:x};Y.current&&(z.platform=Y.current),BB(q.current,_.current,z).then(me=>{const X={...me,isPositioned:V.current!==!1};le.current&&!ip(H.current,X)&&(H.current=X,Uc.flushSync(()=>{m(X)}))})},[x,e,n,Y,V]);nf(()=>{h===!1&&H.current.isPositioned&&(H.current.isPositioned=!1,m(z=>({...z,isPositioned:!1})))},[h]);const le=y.useRef(!1);nf(()=>(le.current=!0,()=>{le.current=!1}),[]),nf(()=>{if(R&&(q.current=R),L&&(_.current=L),R&&L){if(se.current)return se.current(R,L,ae);ae()}},[R,L,ae,se,P]);const de=y.useMemo(()=>({reference:q,floating:_,setReference:E,setFloating:C}),[E,C]),I=y.useMemo(()=>({reference:R,floating:L}),[R,L]),G=y.useMemo(()=>{const z={position:n,left:0,top:0};if(!I.floating)return z;const me=sj(I.floating,f.x),X=sj(I.floating,f.y);return c?{...z,transform:"translate("+me+"px, "+X+"px)",...$3(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:me,top:X}},[n,c,I.floating,f.x,f.y]);return y.useMemo(()=>({...f,update:ae,refs:de,elements:I,floatingStyles:G}),[f,ae,de,I,G])}const WB=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?nj({element:r.current,padding:a}).fn(n):{}:r?nj({element:r,padding:a}).fn(n):{}}}},KB=(t,e)=>({...OB(t),options:[t,e]}),qB=(t,e)=>({...DB(t),options:[t,e]}),GB=(t,e)=>({...FB(t),options:[t,e]}),JB=(t,e)=>({..._B(t),options:[t,e]}),QB=(t,e)=>({...$B(t),options:[t,e]}),YB=(t,e)=>({...zB(t),options:[t,e]}),XB=(t,e)=>({...WB(t),options:[t,e]});var ZB="Arrow",z3=y.forwardRef((t,e)=>{const{children:n,width:r=10,height:a=5,...i}=t;return s.jsx(Tt.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"})})});z3.displayName=ZB;var e9=z3,zy="Popper",[F3,B3]=To(zy),[t9,V3]=F3(zy),H3=t=>{const{__scopePopper:e,children:n}=t,[r,a]=y.useState(null);return s.jsx(t9,{scope:e,anchor:r,onAnchorChange:a,children:n})};H3.displayName=zy;var U3="PopperAnchor",W3=y.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...a}=t,i=V3(U3,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(Tt.div,{...a,ref:c})});W3.displayName=U3;var Fy="PopperContent",[n9,s9]=F3(Fy),K3=y.forwardRef((t,e)=>{var K,D,J,te,be,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:x=!1,updatePositionStrategy:b="optimized",onPlaced:v,...w}=t,N=V3(Fy,n),[k,E]=y.useState(null),C=Gt(e,Ke=>E(Ke)),[R,L]=y.useState(null),q=B0(R),_=(q==null?void 0:q.width)??0,H=(q==null?void 0:q.height)??0,P=r+(i!=="center"?"-"+i:""),se=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},Y=Array.isArray(h)?h:[h],V=Y.length>0,ae={padding:se,boundary:Y.filter(a9),altBoundary:V},{refs:le,floatingStyles:de,placement:I,isPositioned:G,middlewareData:z}=UB({strategy:"fixed",placement:P,whileElementsMounted:(...Ke)=>LB(...Ke,{animationFrame:b==="always"}),elements:{reference:N.anchor},middleware:[KB({mainAxis:a+H,alignmentAxis:o}),u&&qB({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?GB():void 0,...ae}),u&&JB({...ae}),QB({...ae,apply:({elements:Ke,rects:Nt,availableWidth:yt,availableHeight:Dt})=>{const{width:Rt,height:Pn}=Nt.reference,vn=Ke.floating.style;vn.setProperty("--radix-popper-available-width",`${yt}px`),vn.setProperty("--radix-popper-available-height",`${Dt}px`),vn.setProperty("--radix-popper-anchor-width",`${Rt}px`),vn.setProperty("--radix-popper-anchor-height",`${Pn}px`)}}),R&&XB({element:R,padding:c}),i9({arrowWidth:_,arrowHeight:H}),x&&YB({strategy:"referenceHidden",...ae})]}),[me,X]=J3(I),F=vo(v);js(()=>{G&&(F==null||F())},[G,F]);const U=(K=z.arrow)==null?void 0:K.x,fe=(D=z.arrow)==null?void 0:D.y,he=((J=z.arrow)==null?void 0:J.centerOffset)!==0,[oe,O]=y.useState();return js(()=>{k&&O(window.getComputedStyle(k).zIndex)},[k]),s.jsx("div",{ref:le.setFloating,"data-radix-popper-content-wrapper":"",style:{...de,transform:G?de.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:oe,"--radix-popper-transform-origin":[(te=z.transformOrigin)==null?void 0:te.x,(be=z.transformOrigin)==null?void 0:be.y].join(" "),...((ze=z.hide)==null?void 0:ze.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:s.jsx(n9,{scope:n,placedSide:me,onArrowChange:L,arrowX:U,arrowY:fe,shouldHideArrow:he,children:s.jsx(Tt.div,{"data-side":me,"data-align":X,...w,ref:C,style:{...w.style,animation:G?void 0:"none"}})})})});K3.displayName=Fy;var q3="PopperArrow",r9={top:"bottom",right:"left",bottom:"top",left:"right"},G3=y.forwardRef(function(e,n){const{__scopePopper:r,...a}=e,i=s9(q3,r),o=r9[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(e9,{...a,ref:n,style:{...a.style,display:"block"}})})});G3.displayName=q3;function a9(t){return t!==null}var i9=t=>({name:"transformOrigin",options:t,fn(e){var N,k,E;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]=J3(n),m={start:"0%",center:"50%",end:"100%"}[f],x=(((k=a.arrow)==null?void 0:k.x)??0)+c/2,b=(((E=a.arrow)==null?void 0:E.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 J3(t){const[e,n="center"]=t.split("-");return[e,n]}var o9=H3,l9=W3,c9=K3,d9=G3,Q3=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"}),u9="VisuallyHidden",h9=y.forwardRef((t,e)=>s.jsx(Tt.span,{...t,ref:e,style:{...Q3,...t.style}}));h9.displayName=u9;var f9=[" ","Enter","ArrowUp","ArrowDown"],p9=[" ","Enter"],Pl="Select",[$p,zp,m9]=$0(Pl),[Zc]=To(Pl,[m9,B3]),Fp=B3(),[x9,Io]=Zc(Pl),[g9,y9]=Zc(Pl),Y3=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=Fp(e),[N,k]=y.useState(null),[E,C]=y.useState(null),[R,L]=y.useState(!1),q=pp(h),[_,H]=vl({prop:r,defaultProp:a??!1,onChange:i,caller:Pl}),[P,se]=vl({prop:o,defaultProp:c,onChange:u,caller:Pl}),Y=y.useRef(null),V=N?v||!!N.closest("form"):!0,[ae,le]=y.useState(new Set),de=Array.from(ae).map(I=>I.props.value).join(";");return s.jsx(o9,{...w,children:s.jsxs(x9,{required:b,scope:e,trigger:N,onTriggerChange:k,valueNode:E,onValueNodeChange:C,valueNodeHasChildren:R,onValueNodeHasChildrenChange:L,contentId:mo(),value:P,onValueChange:se,open:_,onOpenChange:H,dir:q,triggerPointerDownPosRef:Y,disabled:x,children:[s.jsx($p.Provider,{scope:e,children:s.jsx(g9,{scope:t.__scopeSelect,onNativeOptionAdd:y.useCallback(I=>{le(G=>new Set(G).add(I))},[]),onNativeOptionRemove:y.useCallback(I=>{le(G=>{const z=new Set(G);return z.delete(I),z})},[]),children:n})}),V?s.jsxs(b4,{"aria-hidden":!0,required:b,tabIndex:-1,name:f,autoComplete:m,value:P,onChange:I=>se(I.target.value),disabled:x,form:v,children:[P===void 0?s.jsx("option",{value:""}):null,Array.from(ae)]},de):null]})})};Y3.displayName=Pl;var X3="SelectTrigger",Z3=y.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...a}=t,i=Fp(n),o=Io(X3,n),c=o.disabled||r,u=Gt(e,o.onTriggerChange),h=zp(n),f=y.useRef("touch"),[m,x,b]=N4(w=>{const N=h().filter(C=>!C.disabled),k=N.find(C=>C.value===o.value),E=w4(N,w,k);E!==void 0&&o.onValueChange(E.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(l9,{asChild:!0,...i,children:s.jsx(Tt.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":v4(o.value)?"":void 0,...a,ref:u,onClick:wt(a.onClick,w=>{w.currentTarget.focus(),f.current!=="mouse"&&v(w)}),onPointerDown:wt(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:wt(a.onKeyDown,w=>{const N=m.current!=="";!(w.ctrlKey||w.altKey||w.metaKey)&&w.key.length===1&&x(w.key),!(N&&w.key===" ")&&f9.includes(w.key)&&(v(),w.preventDefault())})})})});Z3.displayName=X3;var e4="SelectValue",t4=y.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,children:i,placeholder:o="",...c}=t,u=Io(e4,n),{onValueNodeHasChildrenChange:h}=u,f=i!==void 0,m=Gt(e,u.onValueNodeChange);return js(()=>{h(f)},[h,f]),s.jsx(Tt.span,{...c,ref:m,style:{pointerEvents:"none"},children:v4(u.value)?s.jsx(s.Fragment,{children:o}):i})});t4.displayName=e4;var b9="SelectIcon",n4=y.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...a}=t;return s.jsx(Tt.span,{"aria-hidden":!0,...a,ref:e,children:r||"▼"})});n4.displayName=b9;var v9="SelectPortal",s4=t=>s.jsx(P0,{asChild:!0,...t});s4.displayName=v9;var Ll="SelectContent",r4=y.forwardRef((t,e)=>{const n=Io(Ll,t.__scopeSelect),[r,a]=y.useState();if(js(()=>{a(new DocumentFragment)},[]),!n.open){const i=r;return i?Uc.createPortal(s.jsx(a4,{scope:t.__scopeSelect,children:s.jsx($p.Slot,{scope:t.__scopeSelect,children:s.jsx("div",{children:t.children})})}),i):null}return s.jsx(i4,{...t,ref:e})});r4.displayName=Ll;var ta=10,[a4,Ro]=Zc(Ll),N9="SelectContentImpl",w9=su("SelectContent.RemoveScroll"),i4=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,E=Io(Ll,n),[C,R]=y.useState(null),[L,q]=y.useState(null),_=Gt(e,K=>R(K)),[H,P]=y.useState(null),[se,Y]=y.useState(null),V=zp(n),[ae,le]=y.useState(!1),de=y.useRef(!1);y.useEffect(()=>{if(C)return bk(C)},[C]),dk();const I=y.useCallback(K=>{const[D,...J]=V().map(ze=>ze.ref.current),[te]=J.slice(-1),be=document.activeElement;for(const ze of K)if(ze===be||(ze==null||ze.scrollIntoView({block:"nearest"}),ze===D&&L&&(L.scrollTop=0),ze===te&&L&&(L.scrollTop=L.scrollHeight),ze==null||ze.focus(),document.activeElement!==be))return},[V,L]),G=y.useCallback(()=>I([H,C]),[I,H,C]);y.useEffect(()=>{ae&&G()},[ae,G]);const{onOpenChange:z,triggerPointerDownPosRef:me}=E;y.useEffect(()=>{if(C){let K={x:0,y:0};const D=te=>{var be,ze;K={x:Math.abs(Math.round(te.pageX)-(((be=me.current)==null?void 0:be.x)??0)),y:Math.abs(Math.round(te.pageY)-(((ze=me.current)==null?void 0:ze.y)??0))}},J=te=>{K.x<=10&&K.y<=10?te.preventDefault():C.contains(te.target)||z(!1),document.removeEventListener("pointermove",D),me.current=null};return me.current!==null&&(document.addEventListener("pointermove",D),document.addEventListener("pointerup",J,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",D),document.removeEventListener("pointerup",J,{capture:!0})}}},[C,z,me]),y.useEffect(()=>{const K=()=>z(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[z]);const[X,F]=N4(K=>{const D=V().filter(be=>!be.disabled),J=D.find(be=>be.ref.current===document.activeElement),te=w4(D,K,J);te&&setTimeout(()=>te.ref.current.focus())}),U=y.useCallback((K,D,J)=>{const te=!de.current&&!J;(E.value!==void 0&&E.value===D||te)&&(P(K),te&&(de.current=!0))},[E.value]),fe=y.useCallback(()=>C==null?void 0:C.focus(),[C]),he=y.useCallback((K,D,J)=>{const te=!de.current&&!J;(E.value!==void 0&&E.value===D||te)&&Y(K)},[E.value]),oe=r==="popper"?g0:o4,O=oe===g0?{side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:x,collisionPadding:b,sticky:v,hideWhenDetached:w,avoidCollisions:N}:{};return s.jsx(a4,{scope:n,content:C,viewport:L,onViewportChange:q,itemRefCallback:U,selectedItem:H,onItemLeave:fe,itemTextRefCallback:he,focusSelectedItem:G,selectedItemText:se,position:r,isPositioned:ae,searchRef:X,children:s.jsx(L0,{as:w9,allowPinchZoom:!0,children:s.jsx(R0,{asChild:!0,trapped:E.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:wt(a,K=>{var D;(D=E.trigger)==null||D.focus({preventScroll:!0}),K.preventDefault()}),children:s.jsx(I0,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>E.onOpenChange(!1),children:s.jsx(oe,{role:"listbox",id:E.contentId,"data-state":E.open?"open":"closed",dir:E.dir,onContextMenu:K=>K.preventDefault(),...k,...O,onPlaced:()=>le(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:wt(k.onKeyDown,K=>{const D=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!D&&K.key.length===1&&F(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let te=V().filter(be=>!be.disabled).map(be=>be.ref.current);if(["ArrowUp","End"].includes(K.key)&&(te=te.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const be=K.target,ze=te.indexOf(be);te=te.slice(ze+1)}setTimeout(()=>I(te)),K.preventDefault()}})})})})})})});i4.displayName=N9;var j9="SelectItemAlignedPosition",o4=y.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...a}=t,i=Io(Ll,n),o=Ro(Ll,n),[c,u]=y.useState(null),[h,f]=y.useState(null),m=Gt(e,_=>f(_)),x=zp(n),b=y.useRef(!1),v=y.useRef(!0),{viewport:w,selectedItem:N,selectedItemText:k,focusSelectedItem:E}=o,C=y.useCallback(()=>{if(i.trigger&&i.valueNode&&c&&h&&w&&N&&k){const _=i.trigger.getBoundingClientRect(),H=h.getBoundingClientRect(),P=i.valueNode.getBoundingClientRect(),se=k.getBoundingClientRect();if(i.dir!=="rtl"){const be=se.left-H.left,ze=P.left-be,Ke=_.left-ze,Nt=_.width+Ke,yt=Math.max(Nt,H.width),Dt=window.innerWidth-ta,Rt=ff(ze,[ta,Math.max(ta,Dt-yt)]);c.style.minWidth=Nt+"px",c.style.left=Rt+"px"}else{const be=H.right-se.right,ze=window.innerWidth-P.right-be,Ke=window.innerWidth-_.right-ze,Nt=_.width+Ke,yt=Math.max(Nt,H.width),Dt=window.innerWidth-ta,Rt=ff(ze,[ta,Math.max(ta,Dt-yt)]);c.style.minWidth=Nt+"px",c.style.right=Rt+"px"}const Y=x(),V=window.innerHeight-ta*2,ae=w.scrollHeight,le=window.getComputedStyle(h),de=parseInt(le.borderTopWidth,10),I=parseInt(le.paddingTop,10),G=parseInt(le.borderBottomWidth,10),z=parseInt(le.paddingBottom,10),me=de+I+ae+z+G,X=Math.min(N.offsetHeight*5,me),F=window.getComputedStyle(w),U=parseInt(F.paddingTop,10),fe=parseInt(F.paddingBottom,10),he=_.top+_.height/2-ta,oe=V-he,O=N.offsetHeight/2,K=N.offsetTop+O,D=de+I+K,J=me-D;if(D<=he){const be=Y.length>0&&N===Y[Y.length-1].ref.current;c.style.bottom="0px";const ze=h.clientHeight-w.offsetTop-w.offsetHeight,Ke=Math.max(oe,O+(be?fe:0)+ze+G),Nt=D+Ke;c.style.height=Nt+"px"}else{const be=Y.length>0&&N===Y[0].ref.current;c.style.top="0px";const Ke=Math.max(he,de+w.offsetTop+(be?U:0)+O)+J;c.style.height=Ke+"px",w.scrollTop=D-he+w.offsetTop}c.style.margin=`${ta}px 0`,c.style.minHeight=X+"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]);js(()=>C(),[C]);const[R,L]=y.useState();js(()=>{h&&L(window.getComputedStyle(h).zIndex)},[h]);const q=y.useCallback(_=>{_&&v.current===!0&&(C(),E==null||E(),v.current=!1)},[C,E]);return s.jsx(S9,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:b,onScrollButtonChange:q,children:s.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:R},children:s.jsx(Tt.div,{...a,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});o4.displayName=j9;var k9="SelectPopperPosition",g0=y.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=ta,...i}=t,o=Fp(n);return s.jsx(c9,{...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)"}})});g0.displayName=k9;var[S9,By]=Zc(Ll,{}),y0="SelectViewport",l4=y.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...a}=t,i=Ro(y0,n),o=By(y0,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($p.Slot,{scope:n,children:s.jsx(Tt.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:wt(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-ta*2,w=parseFloat(m.style.minHeight),N=parseFloat(m.style.height),k=Math.max(w,N);if(k0?R:0,m.style.justifyContent="flex-end")}}}u.current=f.scrollTop})})})]})});l4.displayName=y0;var c4="SelectGroup",[C9,T9]=Zc(c4),E9=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=mo();return s.jsx(C9,{scope:n,id:a,children:s.jsx(Tt.div,{role:"group","aria-labelledby":a,...r,ref:e})})});E9.displayName=c4;var d4="SelectLabel",M9=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=T9(d4,n);return s.jsx(Tt.div,{id:a.id,...r,ref:e})});M9.displayName=d4;var op="SelectItem",[A9,u4]=Zc(op),h4=y.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:i,...o}=t,c=Io(op,n),u=Ro(op,n),h=c.value===r,[f,m]=y.useState(i??""),[x,b]=y.useState(!1),v=Gt(e,E=>{var C;return(C=u.itemRefCallback)==null?void 0:C.call(u,E,r,a)}),w=mo(),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(A9,{scope:n,value:r,disabled:a,textId:w,isSelected:h,onItemTextChange:y.useCallback(E=>{m(C=>C||((E==null?void 0:E.textContent)??"").trim())},[]),children:s.jsx($p.ItemSlot,{scope:n,value:r,disabled:a,textValue:f,children:s.jsx(Tt.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:wt(o.onFocus,()=>b(!0)),onBlur:wt(o.onBlur,()=>b(!1)),onClick:wt(o.onClick,()=>{N.current!=="mouse"&&k()}),onPointerUp:wt(o.onPointerUp,()=>{N.current==="mouse"&&k()}),onPointerDown:wt(o.onPointerDown,E=>{N.current=E.pointerType}),onPointerMove:wt(o.onPointerMove,E=>{var C;N.current=E.pointerType,a?(C=u.onItemLeave)==null||C.call(u):N.current==="mouse"&&E.currentTarget.focus({preventScroll:!0})}),onPointerLeave:wt(o.onPointerLeave,E=>{var C;E.currentTarget===document.activeElement&&((C=u.onItemLeave)==null||C.call(u))}),onKeyDown:wt(o.onKeyDown,E=>{var R;((R=u.searchRef)==null?void 0:R.current)!==""&&E.key===" "||(p9.includes(E.key)&&k(),E.key===" "&&E.preventDefault())})})})})});h4.displayName=op;var Fd="SelectItemText",f4=y.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,...i}=t,o=Io(Fd,n),c=Ro(Fd,n),u=u4(Fd,n),h=y9(Fd,n),[f,m]=y.useState(null),x=Gt(e,k=>m(k),u.onItemTextChange,k=>{var E;return(E=c.itemTextRefCallback)==null?void 0:E.call(c,k,u.value,u.disabled)}),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 js(()=>(w(v),()=>N(v)),[w,N,v]),s.jsxs(s.Fragment,{children:[s.jsx(Tt.span,{id:u.textId,...i,ref:x}),u.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Uc.createPortal(i.children,o.valueNode):null]})});f4.displayName=Fd;var p4="SelectItemIndicator",m4=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return u4(p4,n).isSelected?s.jsx(Tt.span,{"aria-hidden":!0,...r,ref:e}):null});m4.displayName=p4;var b0="SelectScrollUpButton",x4=y.forwardRef((t,e)=>{const n=Ro(b0,t.__scopeSelect),r=By(b0,t.__scopeSelect),[a,i]=y.useState(!1),o=Gt(e,r.onScrollButtonChange);return js(()=>{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(y4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});x4.displayName=b0;var v0="SelectScrollDownButton",g4=y.forwardRef((t,e)=>{const n=Ro(v0,t.__scopeSelect),r=By(v0,t.__scopeSelect),[a,i]=y.useState(!1),o=Gt(e,r.onScrollButtonChange);return js(()=>{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(y4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});g4.displayName=v0;var y4=y.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=t,i=Ro("SelectScrollButton",n),o=y.useRef(null),c=zp(n),u=y.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return y.useEffect(()=>()=>u(),[u]),js(()=>{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(Tt.div,{"aria-hidden":!0,...a,ref:e,style:{flexShrink:0,...a.style},onPointerDown:wt(a.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:wt(a.onPointerMove,()=>{var h;(h=i.onItemLeave)==null||h.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:wt(a.onPointerLeave,()=>{u()})})}),I9="SelectSeparator",R9=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return s.jsx(Tt.div,{"aria-hidden":!0,...r,ref:e})});R9.displayName=I9;var N0="SelectArrow",P9=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=Fp(n),i=Io(N0,n),o=Ro(N0,n);return i.open&&o.position==="popper"?s.jsx(d9,{...a,...r,ref:e}):null});P9.displayName=N0;var L9="SelectBubbleInput",b4=y.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const a=y.useRef(null),i=Gt(r,a),o=F0(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(Tt.select,{...n,style:{...Q3,...n.style},ref:i,defaultValue:e})});b4.displayName=L9;function v4(t){return t===""||t===void 0}function N4(t){const e=vo(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 w4(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=O9(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 O9(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var D9=Y3,j4=Z3,_9=t4,$9=n4,z9=s4,k4=r4,F9=l4,S4=h4,B9=f4,V9=m4,H9=x4,U9=g4;const wc=D9,jc=_9,al=y.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(j4,{ref:r,className:Lt("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(gl,{className:"h-4 w-4 opacity-50"})})]}));al.displayName=j4.displayName;const il=y.forwardRef(({className:t,children:e,position:n="popper",...r},a)=>s.jsx(z9,{children:s.jsxs(k4,{ref:a,className:Lt("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(H9,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(xg,{className:"h-4 w-4"})}),s.jsx(F9,{className:"p-1",children:e}),s.jsx(U9,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(gl,{className:"h-4 w-4"})})]})}));il.displayName=k4.displayName;const Qs=y.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(S4,{ref:r,className:Lt("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(V9,{children:s.jsx(dp,{className:"h-4 w-4"})})}),s.jsx(B9,{children:e})]}));Qs.displayName=S4.displayName;const rj=["📖","📕","📗","📘","📙","📓","📔","📒","📚","📖"];function W9(t){return t.title==="序言"||t.title.includes("序言")}function aj(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 cg(t){return t.startsWith("part:")?{type:"part",id:t.slice(5)}:t.startsWith("chapter:")?{type:"chapter",id:t.slice(8)}:t.startsWith("section:")?{type:"section",id:t.slice(8)}:null}function K9({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),[E,C]=y.useState(null),R=(V,ae)=>(N==null?void 0:N.type)===V&&(N==null?void 0:N.id)===ae,L=(V,ae)=>(E==null?void 0:E.type)===V&&(E==null?void 0:E.id)===ae,q=y.useCallback(()=>{const V=[];for(const ae of t)for(const le of ae.chapters)for(const de of le.sections)V.push({id:de.id,partId:ae.id,partTitle:ae.title,chapterId:le.id,chapterTitle:le.title});return V},[t]),_=y.useCallback(async(V,ae,le,de)=>{var X;V.preventDefault(),V.stopPropagation();const I=V.dataTransfer.getData("text/plain"),G=cg(I);if(!G||G.type===ae&&G.id===le)return;const z=q(),me=new Map(z.map(F=>[F.id,F]));if(G.type==="part"&&ae==="part"){const F=t.map(O=>O.id),U=F.indexOf(G.id),fe=F.indexOf(le);if(U===-1||fe===-1)return;const he=[...F];he.splice(U,1),he.splice(UD.id===O);if(K)for(const D of K.chapters)for(const J of D.sections){const te=me.get(J.id);te&&oe.push(te)}}await r(oe);return}if(G.type==="chapter"&&(ae==="chapter"||ae==="section"||ae==="part")){const F=t.find(te=>te.chapters.some(be=>be.id===G.id)),U=F==null?void 0:F.chapters.find(te=>te.id===G.id);if(!F||!U)return;let fe,he,oe=null;if(ae==="section"){const te=me.get(le);if(!te)return;fe=te.partId,he=te.partTitle,oe=le}else if(ae==="chapter"){const te=t.find(Ke=>Ke.chapters.some(Nt=>Nt.id===le)),be=te==null?void 0:te.chapters.find(Ke=>Ke.id===le);if(!te||!be)return;fe=te.id,he=te.title;const ze=z.filter(Ke=>Ke.chapterId===le).pop();oe=(ze==null?void 0:ze.id)??null}else{const te=t.find(be=>be.id===le);if(!te)return;if(fe=te.id,he=te.title,te.chapters[0]){const be=z.filter(ze=>ze.partId===te.id&&ze.chapterId===te.chapters[0].id);oe=((X=be[be.length-1])==null?void 0:X.id)??null}}const O=U.sections.map(te=>te.id),K=z.filter(te=>!O.includes(te.id));let D=K.length;if(oe){const te=K.findIndex(be=>be.id===oe);te>=0&&(D=te+1)}const J=O.map(te=>({...me.get(te),partId:fe,partTitle:he,chapterId:U.id,chapterTitle:U.title}));await r([...K.slice(0,D),...J,...K.slice(D)]);return}if(G.type==="section"&&(ae==="section"||ae==="chapter"||ae==="part")){if(!de)return;const{partId:F,partTitle:U,chapterId:fe,chapterTitle:he}=de,oe=z.findIndex(te=>te.id===G.id);if(oe===-1)return;const O=z.filter(te=>te.id!==G.id);let K;if(ae==="section"){const te=O.findIndex(be=>be.id===le);K=te>=0?te+1:O.length}else if(ae==="chapter"){const te=O.filter(be=>be.chapterId===le).pop();K=te?O.findIndex(be=>be.id===te.id)+1:O.length}else{const te=t.find(be=>be.id===le);if(te!=null&&te.chapters[0]){const be=O.filter(Ke=>Ke.partId===te.id&&Ke.chapterId===te.chapters[0].id),ze=be[be.length-1];K=ze?O.findIndex(Ke=>Ke.id===ze.id)+1:O.length}else K=O.length}const J={...z[oe],partId:F,partTitle:U,chapterId:fe,chapterTitle:he};O.splice(K,0,J),await r(O)}},[t,q,r]),H=(V,ae,le)=>({onDragEnter:de=>{de.preventDefault(),de.stopPropagation(),de.dataTransfer.dropEffect="move",C({type:V,id:ae})},onDragOver:de=>{de.preventDefault(),de.stopPropagation(),de.dataTransfer.dropEffect="move",C({type:V,id:ae})},onDragLeave:()=>C(null),onDrop:de=>{C(null);const I=cg(de.dataTransfer.getData("text/plain"));I&&(V==="section"&&I.type==="section"&&I.id===ae||(V==="part"?I.type==="part"?_(de,"part",ae):le&&_(de,"part",ae,le):V==="chapter"&&le?(I.type==="section"||I.type==="chapter")&&_(de,"chapter",ae,le):V==="section"&&le&&_(de,"section",ae,le)))}}),P=V=>rj[V%rj.length],se=V=>t.slice(0,V).filter(ae=>!W9(ae)).length,Y=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,ae)=>{var U,fe,he,oe;const le=V.title==="序言"||V.title.includes("序言"),de=V.title==="尾声"||V.title.includes("尾声"),I=V.title==="附录"||V.title.includes("附录"),G=L("part",V.id),z=e.includes(V.id),me=V.chapters.length,X=V.chapters.reduce((O,K)=>O+K.sections.length,0);if(le&&V.chapters.length===1&&V.chapters[0].sections.length===1){const O=V.chapters[0].sections[0],K=L("section",O.id),D={partId:V.id,partTitle:V.title,chapterId:V.chapters[0].id,chapterTitle:V.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:J=>{J.stopPropagation(),J.dataTransfer.setData("text/plain","section:"+O.id),J.dataTransfer.effectAllowed="move",k({type:"section",id:O.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":""} ${R("section",O.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...H("section",O.id,D),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(ti,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:J=>J.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:x.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("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:s.jsx(Zs,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[V.chapters[0].title," | ",O.title]}),w.includes(O.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(Sc,{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:J=>J.stopPropagation(),onClick:J=>J.stopPropagation(),children:[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",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:"-","名"]}),v&&s.jsx(Q,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(O),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(Q,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(O),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(en,{className:"w-3.5 h-3.5"})}),s.jsx(Q,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(O),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Ns,{className:"w-3.5 h-3.5"})})]})]})]},V.id)}if(V.title==="2026每日派对干货"||V.title.includes("2026每日派对干货")){const O=L("part",V.id);return s.jsxs("div",{className:`rounded-xl border overflow-hidden transition-all duration-200 ${O?"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:((fe=V.chapters[0])==null?void 0:fe.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 ${R("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(ti,{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:aj(V)})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:K=>K.stopPropagation(),onClick:K=>K.stopPropagation(),children:[o&&s.jsx(Q,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(V),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx(On,{className:"w-3.5 h-3.5"})}),h&&s.jsx(Q,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(V),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx(en,{className:"w-3.5 h-3.5"})}),f&&s.jsx(Q,{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(Ns,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",title:"本篇章数与节数",children:[me," 章 · ",X," 节"]}),s.jsx("button",{type:"button",draggable:!1,className:"p-1 rounded-md hover:bg-white/10 text-gray-500",title:z?"收起":"展开",onMouseDown:K=>K.stopPropagation(),onClick:K=>{K.stopPropagation(),n(V.id)},children:z?s.jsx(gl,{className:"w-5 h-5"}):s.jsx(ol,{className:"w-5 h-5"})})]})]}),z&&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:D=>D.stopPropagation(),children:[m&&s.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>m(V,K),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(en,{className:"w-3.5 h-3.5"})}),c&&s.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>c(V),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx(On,{className:"w-3.5 h-3.5"})}),u&&s.jsx(Q,{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(Ns,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:K.sections.map(D=>{const J=L("section",D.id);return s.jsxs("div",{draggable:!0,onDragStart:te=>{te.stopPropagation(),te.dataTransfer.setData("text/plain","section:"+D.id),te.dataTransfer.effectAllowed="move",k({type:"section",id:D.id})},onDragEnd:()=>{k(null),C(null)},onClick:()=>a(D),className:`flex items-center justify-between py-2 px-3 rounded-lg min-h-[40px] cursor-pointer select-none transition-all duration-200 ${J?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${R("section",D.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...H("section",D.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(ti,{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(D.id),onChange:()=>b(D.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:Y(D)}),w.includes(D.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(Sc,{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:["点击 ",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(Q,{variant:"ghost",size:"sm",onClick:()=>v(D),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsx(Q,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(D),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(en,{className:"w-3.5 h-3.5"})}),s.jsx(Q,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(D),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Ns,{className:"w-3.5 h-3.5"})})]})]},D.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((O,K)=>O.sections.length>0?O.sections.map(D=>{const J=L("section",D.id);return s.jsxs("div",{draggable:!0,onDragStart:te=>{te.stopPropagation(),te.dataTransfer.setData("text/plain","section:"+D.id),te.dataTransfer.effectAllowed="move",k({type:"section",id:D.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 ${J?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${R("section",D.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...H("section",D.id,{partId:V.id,partTitle:V.title,chapterId:O.id,chapterTitle:O.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(ti,{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(D.id),onChange:()=>b(D.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," | ",O.title," | ",D.title]}),w.includes(D.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(Sc,{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:["点击 ",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(Q,{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 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>a(D),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(en,{className:"w-3.5 h-3.5"})}),s.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>i(D),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Ns,{className:"w-3.5 h-3.5"})})]})]}),s.jsx(ol,{className:"w-4 h-4 text-gray-500 shrink-0"})]},D.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," | ",O.title,"(空)"]}),s.jsx(ol,{className:"w-4 h-4 text-gray-500 shrink-0"})]},O.id))})]},V.id);if(de&&V.chapters.length===1&&V.chapters[0].sections.length===1){const O=V.chapters[0].sections[0],K=L("section",O.id),D={partId:V.id,partTitle:V.title,chapterId:V.chapters[0].id,chapterTitle:V.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:J=>{J.stopPropagation(),J.dataTransfer.setData("text/plain","section:"+O.id),J.dataTransfer.effectAllowed="move",k({type:"section",id:O.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":""} ${R("section",O.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...H("section",O.id,D),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(ti,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:J=>J.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:x.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("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:s.jsx(Zs,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[V.chapters[0].title," | ",O.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:J=>J.stopPropagation(),onClick:J=>J.stopPropagation(),children:[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",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:"-","名"]}),v&&s.jsx(Q,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(O),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(Q,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(O),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(en,{className:"w-3.5 h-3.5"})}),s.jsx(Q,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(O),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Ns,{className:"w-3.5 h-3.5"})})]})]})]},V.id)}return de?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(O=>O.sections.map(K=>{const D=L("section",K.id);return s.jsxs("div",{draggable:!0,onDragStart:J=>{J.stopPropagation(),J.dataTransfer.setData("text/plain","section:"+K.id),J.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 ${D?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${R("section",K.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...H("section",K.id,{partId:V.id,partTitle:V.title,chapterId:O.id,chapterTitle:O.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(ti,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:J=>J.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:[O.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(Q,{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(Q,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(K),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(en,{className:"w-3.5 h-3.5"})}),s.jsx(Q,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(K),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Ns,{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 ${G?"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:((he=V.chapters[0])==null?void 0:he.id)??"",chapterTitle:((oe=V.chapters[0])==null?void 0:oe.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:O=>{O.stopPropagation(),O.dataTransfer.setData("text/plain","part:"+V.id),O.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 ${R("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(ti,{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||P(se(ae))}),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:aj(V)})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:O=>O.stopPropagation(),onClick:O=>O.stopPropagation(),children:[o&&s.jsx(Q,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(V),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx(On,{className:"w-3.5 h-3.5"})}),h&&s.jsx(Q,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(V),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx(en,{className:"w-3.5 h-3.5"})}),f&&s.jsx(Q,{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(Ns,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",title:"本篇章数与节数",children:[me," 章 · ",X," 节"]}),s.jsx("button",{type:"button",draggable:!1,className:"p-1 rounded-md hover:bg-white/10 text-gray-500",title:z?"收起":"展开",onMouseDown:O=>O.stopPropagation(),onClick:O=>{O.stopPropagation(),n(V.id)},children:z?s.jsx(gl,{className:"w-5 h-5"}):s.jsx(ol,{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:V.chapters.map(O=>{const K=L("chapter",O.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:D=>{D.stopPropagation(),D.dataTransfer.setData("text/plain","chapter:"+O.id),D.dataTransfer.effectAllowed="move",k({type:"chapter",id:O.id})},onDragEnd:()=>{k(null),C(null)},onDragEnter:D=>{D.preventDefault(),D.stopPropagation(),D.dataTransfer.dropEffect="move",C({type:"chapter",id:O.id})},onDragOver:D=>{D.preventDefault(),D.stopPropagation(),D.dataTransfer.dropEffect="move",C({type:"chapter",id:O.id})},onDragLeave:()=>C(null),onDrop:D=>{C(null);const J=cg(D.dataTransfer.getData("text/plain"));if(!J)return;const te={partId:V.id,partTitle:V.title,chapterId:O.id,chapterTitle:O.title};(J.type==="section"||J.type==="chapter")&&_(D,"chapter",O.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":""} ${R("chapter",O.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/30"}`,children:[s.jsx(ti,{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:O.title})]}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:D=>D.stopPropagation(),children:[m&&s.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>m(V,O),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(en,{className:"w-3.5 h-3.5"})}),c&&s.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>c(V),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx(On,{className:"w-3.5 h-3.5"})}),u&&s.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>u(V,O),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(Ns,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:O.sections.map(D=>{const J=L("section",D.id);return s.jsxs("div",{draggable:!0,onDragStart:te=>{te.stopPropagation(),te.dataTransfer.setData("text/plain","section:"+D.id),te.dataTransfer.effectAllowed="move",k({type:"section",id:D.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 ${J?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${R("section",D.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] shadow-lg":"hover:bg-[#162840]/50"}`,...H("section",D.id,{partId:V.id,partTitle:V.title,chapterId:O.id,chapterTitle:O.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(D.id),onChange:()=>b(D.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx(ti,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),s.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${D.price===0||D.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:Y(D)}),w.includes(D.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(Sc,{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:[D.isNew&&s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"NEW"}),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",title:"点击次数 · 付款笔数",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(Q,{variant:"ghost",size:"sm",onClick:()=>v(D),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(Q,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(D),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(en,{className:"w-3.5 h-3.5"})}),s.jsx(Q,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(D),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Ns,{className:"w-3.5 h-3.5"})})]})]})]},D.id)})})]},O.id)})})]},V.id)})})}function q9(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 G9(t){return Oe(`/api/db/person?personId=${encodeURIComponent(t)}`)}function J9(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 Q9=10;function C4(t){const e=(t??"").trim();if(!e)return"";if(/^https?:\/\//i.test(e))return Ea(e);const n=e.startsWith("/")?e:`/${e}`;return Ea(bl(n))}function Y9(t){const{nickname:e,avatar:n}=t,r=C4(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 X9(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 Z9({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=jl(w,300),[E,C]=y.useState([]),[R,L]=y.useState(!1),[q,_]=y.useState(!1),[H,P]=y.useState(0),se=y.useRef(1),Y=y.useRef(!1),V=y.useRef(!1),ae=y.useRef(null),le=y.useRef(null),[de,I]=y.useState({top:0,left:0,width:320,maxH:360}),G=y.useCallback(()=>{const O=le.current;if(!O||typeof window>"u")return;const K=O.getBoundingClientRect(),D=Math.min(400,Math.max(200,window.innerHeight-K.bottom-16)),J=x==null?void 0:x.current;if(J){const te=J.getBoundingClientRect();I({top:K.bottom-te.top+6,left:K.left-te.left,width:Math.max(K.width,300),maxH:D})}else I({top:K.bottom+6,left:K.left,width:Math.max(K.width,300),maxH:D})},[x]);y.useEffect(()=>{c||(v(!1),N(""))},[c]),y.useLayoutEffect(()=>{if(b)return G(),window.addEventListener("scroll",G,!0),window.addEventListener("resize",G),()=>{window.removeEventListener("scroll",G,!0),window.removeEventListener("resize",G)}},[b,G]);const z=y.useCallback(async(O,K,D)=>{if(!Y.current){Y.current=!0,D?_(!0):L(!0);try{const J=new URLSearchParams({page:String(O),pageSize:String(Q9),search:K.trim()}),te=await Oe(`/api/db/users?${J}`);if(te!=null&&te.success&&Array.isArray(te.users)){const be=te.users,ze=typeof te.total=="number"?te.total:0;P(ze),D?be.length===0?V.current=!0:C(Ke=>{const Nt=X9(Ke,be);return Nt.length===Ke.length?V.current=!0:se.current=O,Nt}):(C(be),se.current=O)}else te!=null&&te.error&&Z.error(te.error)}catch(J){Z.error(J instanceof Error?J.message:"加载用户列表失败")}finally{Y.current=!1,L(!1),_(!1)}}},[]);y.useEffect(()=>{b&&(se.current=1,V.current=!1,z(1,k,!1))},[b,k,z]);const me=y.useCallback(()=>{R||q||Y.current||V.current||H>0&&E.length>=H||z(se.current+1,k,!0)},[k,z,R,q,H,E.length]);y.useLayoutEffect(()=>{if(!b||R||q||V.current||H>0&&E.length>=H||E.length===0)return;const O=ae.current;O&&(O.scrollHeight>O.clientHeight+12||me())},[b,E.length,R,q,H,me]);const X=O=>{(O.id||"").trim()&&(i(O),v(!1),N(""))},F=O=>{O.preventDefault(),O.stopPropagation(),!(u||a)&&o()},U=!!n.trim(),fe=H>0,he=typeof document>"u"?null:(m==null?void 0:m.current)??document.body,oe=b&&he&&Uc.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:O=>{O.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:de.top,left:de.left,width:de.width,height:de.maxH,maxHeight:de.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(ce,{className:"bg-[#050c18] border-gray-700 text-white h-9 text-sm",placeholder:"搜索昵称、手机号、用户 id…",value:w,onChange:O=>N(O.target.value),onMouseDown:O=>O.stopPropagation(),autoFocus:!0})}),fe?s.jsxs("p",{className:"text-[11px] text-gray-500 px-3 pt-1.5 min-h-0 leading-snug",children:["已加载 ",E.length," / ",H," 条",E.length{const K=O.currentTarget;R||q||V.current||H>0&&E.length>=H||K.scrollHeight-K.scrollTop-K.clientHeight<100&&me()},children:R&&E.length===0?s.jsx("div",{className:"flex h-40 items-center justify-center text-gray-400 text-sm",children:"正在加载…"}):E.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:[E.map(O=>{const K=O.id||"",D=n===K,J=C4(O.avatar),te=O.nickname&&String(O.nickname).trim()||"(无昵称)";return s.jsxs("button",{type:"button",role:"option","aria-selected":D,className:Lt("flex w-full items-center gap-2 rounded-md border px-2.5 py-2 text-left text-sm transition-colors",D?"border-[#38bdac] bg-[#38bdac]/15 text-white":"border-transparent bg-[#050c18] hover:border-[#38bdac]/40 hover:bg-[#0a1628]"),onMouseDown:be=>be.preventDefault(),onClick:()=>X(O),children:[s.jsx("span",{className:"h-9 w-9 shrink-0 overflow-hidden rounded-full bg-gray-800",children:J?s.jsx("img",{src:J,alt:"",className:"h-full w-full object-cover",onError:be=>{be.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:[O.phone?`${O.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(Q,{type:"button",variant:"ghost",size:"sm",className:"text-gray-400 h-8 text-xs",onMouseDown:O=>O.preventDefault(),onClick:()=>{o(),v(!1)},children:"清除绑定"})})]})]}),he);return s.jsxs("div",{className:Lt("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:Lt("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(""),G()),v(O=>!O))},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(Y9,{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(gl,{className:Lt("h-4 w-4 shrink-0 text-gray-400 transition-transform",b&&"rotate-180")})]}),U&&s.jsx(Q,{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(Jn,{className:"h-4 w-4"})})]}),h&&s.jsx("div",{className:"text-[11px] text-gray-500",children:h}),oe]})}const T4=11,ij={personId:"",name:"",boundUserId:"",aliases:"",label:"",sceneId:T4,ckbApiKey:"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:"phone",remarkFormat:"",addFriendInterval:1,startTime:"06:00",endTime:"22:00",deviceGroups:""};function eV({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(ij),[h,f]=y.useState(!1),[m,x]=y.useState(!1),[b,v]=y.useState([]),[w,N]=y.useState(!1),[k,E]=y.useState(""),[C,R]=y.useState([]),[L,q]=y.useState(!1),[_,H]=y.useState(""),[P,se]=y.useState(!1),[Y,V]=y.useState(null),[ae,le]=y.useState(!1),[de,I]=y.useState({}),[G,z]=y.useState({loading:!1,messages:[]}),me=jl(c.name,400),X=jl(c.aliases,400);y.useEffect(()=>{if(!t){z({loading:!1,messages:[]});return}const D=me.trim(),J=X.trim();if(!D&&!J){z({loading:!1,messages:[]});return}let te=!1;z(Ke=>({...Ke,loading:!0}));const be=a?((n==null?void 0:n.personId)??"").trim():"",ze=new URLSearchParams;return D&&ze.set("name",me.trim()),ze.set("aliases",X),be&&ze.set("excludePersonId",be),Oe(`/api/db/persons/check-unique?${ze.toString()}`).then(Ke=>{if(!te){if((Ke==null?void 0:Ke.success)===!1&&(Ke!=null&&Ke.error)){z({loading:!1,messages:[Ke.error]});return}if((Ke==null?void 0:Ke.ok)===!1&&Array.isArray(Ke.messages)&&Ke.messages.length>0){z({loading:!1,messages:Ke.messages});return}z({loading:!1,messages:[]})}}).catch(()=>{te||z({loading:!1,messages:[]})}),()=>{te=!0}},[t,me,X,a,n==null?void 0:n.personId]),y.useEffect(()=>{if(t){if(E(""),V(null),le(!1),n){u({personId:n.personId??n.name??"",name:n.name??"",boundUserId:n.userId??"",aliases:n.aliases??"",label:n.label??"",sceneId:T4,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 D=(n.userId??"").trim();D&&(le(!0),Oe(`/api/db/users?id=${encodeURIComponent(D)}`).then(J=>{const te=J==null?void 0:J.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:D,nickname:D,phone:void 0,avatar:void 0})}).catch(()=>{V({id:D,nickname:D,phone:void 0,avatar:void 0})}).finally(()=>le(!1)))}else u({...ij});I({}),b.length===0&&F(""),C.length===0&&U("")}},[t,n]);const F=async D=>{N(!0);try{const J=await q9({page:1,limit:50,keyword:D});J!=null&&J.success&&Array.isArray(J.devices)?v(J.devices):J!=null&&J.error&&Z.error(J.error)}catch(J){Z.error(J instanceof Error?J.message:"加载设备列表失败")}finally{N(!1)}},U=async D=>{q(!0);try{const J=await J9({page:1,limit:100,keyword:D});J!=null&&J.success&&Array.isArray(J.plans)?R(J.plans):J!=null&&J.error&&Z.error(J.error)}catch{Z.error("加载计划列表失败")}finally{q(!1)}},fe=()=>{u(D=>{const J=(D.boundUserId||"").trim(),te={...D,boundUserId:""};return!a&&J&&(D.personId||"").trim()===J&&(te.personId=""),te}),V(null)},he=D=>{const J=Array.isArray(D.deviceGroups)?D.deviceGroups.map(String).join(","):"";u(te=>({...te,ckbApiKey:D.apiKey||"",greeting:D.greeting||te.greeting,tips:D.tips||te.tips,remarkType:D.remarkType||te.remarkType,remarkFormat:D.remarkFormat||te.remarkFormat,addFriendInterval:D.addInterval||te.addFriendInterval,startTime:D.startTime||te.startTime,endTime:D.endTime||te.endTime,deviceGroups:J||te.deviceGroups})),se(!1),Z.success(`已选择计划「${D.name}」,参数已覆盖`)},oe=_.trim()?C.filter(D=>(D.name||"").includes(_.trim())||String(D.id).includes(_.trim())):C,O=async()=>{var be;const D={};(!c.name||!String(c.name).trim())&&(D.name="请填写名称");const J=c.addFriendInterval;if((typeof J!="number"||J<1)&&(D.addFriendInterval="添加间隔至少为 1 分钟"),(((be=c.deviceGroups)==null?void 0:be.split(",").map(ze=>ze.trim()).filter(Boolean))??[]).length===0&&(D.deviceGroups="请至少选择 1 台设备"),I(D),Object.keys(D).length>0){Z.error(D.name||D.addFriendInterval||D.deviceGroups||"请完善必填项");return}if(G.messages.length>0){Z.error(G.messages[0]??"名称或别名与他人重复");return}f(!0);try{await r(c),e(!1)}catch(ze){Z.error(ze instanceof Error?ze.message:"保存失败")}finally{f(!1)}};return s.jsx(Ft,{open:t,onOpenChange:e,children:s.jsxs(zt,{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(Bt,{children:[s.jsx(Vt,{className:"text-[#38bdac]",children:a?"编辑人物":"添加人物 — 存客宝 API 获客"}),s.jsx(hf,{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 ${de.name?"border-red-500 focus-visible:ring-red-500":G.messages.length>0?"border-amber-600 focus-visible:ring-amber-600/50":"border-gray-700"}`,placeholder:"如 卡若",value:c.name,onChange:D=>{u(J=>({...J,name:D.target.value})),de.name&&I(J=>({...J,name:void 0}))}}),de.name&&s.jsx("p",{className:"text-xs text-red-400",children:de.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:D=>u(J=>({...J,personId:D.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:D=>u(J=>({...J,label:D.target.value}))})]}),s.jsx(Z9,{className:"col-span-3",id:"person-bound-member-user",label:"绑定会员用户(可选,与「用户管理」中用户一致)",containerOpen:t,portalMountRef:o,positionContainerRef:i,value:c.boundUserId,preview:Y,previewLoading:ae,onSelect:D=>{const J=(D.id||"").trim();J&&(u(te=>({...te,boundUserId:J,...a?{}:{personId:J}})),V({id:J,nickname:D.nickname&&String(D.nickname).trim()||J,phone:D.phone,avatar:D.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(ce,{className:`bg-[#0a1628] text-white ${G.messages.length>0?"border-amber-600 focus-visible:ring-amber-600/50":"border-gray-700"}`,placeholder:"如 卡卡, 若若",value:c.aliases,onChange:D=>u(J=>({...J,aliases:D.target.value}))})]}),s.jsx("div",{className:"col-span-3 space-y-1",children:G.loading?s.jsx("p",{className:"text-xs text-gray-500",children:"正在检测名称与别名是否与他人重复…"}):G.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:G.messages.map((D,J)=>s.jsx("p",{children:D},`${J}-${D.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(!P),children:c.ckbApiKey?s.jsx("span",{className:"text-white truncate",children:((K=C.find(D=>D.apiKey===c.ckbApiKey))==null?void 0:K.name)||`获客计划 (${c.ckbApiKey.slice(0,8)}…)`}):s.jsx("span",{className:"text-gray-500",children:"点击选择已有计划 / 新建时自动创建"})}),s.jsx(Q,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-200 shrink-0",onClick:()=>{U(_),se(!0)},disabled:L,children:L?"加载...":"刷新"})]}),P&&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:_,onChange:D=>H(D.target.value),onKeyDown:D=>{D.key==="Enter"&&U(_)},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(D=>s.jsxs("div",{className:`px-3 py-2 cursor-pointer hover:bg-[#38bdac]/10 text-sm flex items-center justify-between ${c.ckbApiKey===D.apiKey?"bg-[#38bdac]/20 text-[#38bdac]":"text-white"}`,onClick:()=>he(D),children:[s.jsxs("div",{className:"truncate",children:[s.jsx("span",{className:"font-medium",children:D.name}),s.jsxs("span",{className:"text-xs text-gray-500 ml-2",children:["ID:",String(D.id)]})]}),D.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(D.id)))}),s.jsx("div",{className:"p-2 border-t border-gray-700/60 flex justify-end",children:s.jsx(Q,{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 ${de.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(Q,{type:"button",variant:"outline",className:"border-0 border-l border-inherit rounded-r-md text-gray-200",onClick:()=>x(!0),children:"选择"})]}),de.deviceGroups?s.jsx("p",{className:"text-xs text-red-400",children:de.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(wc,{value:c.remarkType,onValueChange:D=>u(J=>({...J,remarkType:D})),children:[s.jsx(al,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(jc,{placeholder:"选择备注类型"})}),s.jsxs(il,{children:[s.jsx(Qs,{value:"phone",children:"手机号"}),s.jsx(Qs,{value:"nickname",children:"昵称"}),s.jsx(Qs,{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:D=>u(J=>({...J,remarkFormat:D.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:D=>u(J=>({...J,greeting:D.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 ${de.addFriendInterval?"border-red-500 focus-visible:ring-red-500":"border-gray-700"}`,value:c.addFriendInterval,onChange:D=>{u(J=>({...J,addFriendInterval:Number(D.target.value)||1})),de.addFriendInterval&&I(J=>({...J,addFriendInterval:void 0}))}}),de.addFriendInterval&&s.jsx("p",{className:"text-xs text-red-400",children:de.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:D=>u(J=>({...J,startTime:D.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:D=>u(J=>({...J,endTime:D.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ne,{className:"text-gray-400 text-xs",children:"获客成功提示"}),s.jsx(kl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[72px] resize-none",placeholder:"请注意消息,稍后加你微信",value:c.tips,onChange:D=>u(J=>({...J,tips:D.target.value}))})]})]})]})]})]})]}),s.jsxs(yn,{className:"gap-3 border-t border-gray-700/40 px-6 py-4 shrink-0",children:[s.jsx(Q,{variant:"outline",onClick:()=>e(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(Q,{onClick:O,disabled:h||G.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(Q,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-200 h-8",onClick:()=>{const D=b.map(be=>String(be.id??"")),J=c.deviceGroups?c.deviceGroups.split(",").map(be=>be.trim()).filter(Boolean):[],te=D.length>0&&D.every(be=>J.includes(be));u(be=>({...be,deviceGroups:te?"":D.join(",")})),!te&&D.length>0&&I(be=>({...be,deviceGroups:void 0}))},children:(()=>{const D=b.map(te=>String(te.id??"")),J=c.deviceGroups?c.deviceGroups.split(",").map(te=>te.trim()).filter(Boolean):[];return D.length>0&&D.every(te=>J.includes(te))?"取消全选":"全选"})()}),s.jsx(ce,{className:"bg-[#050c18] border-gray-700 text-white h-8 w-52",placeholder:"搜索备注/微信号/IMEI",value:k,onChange:D=>E(D.target.value),onKeyDown:D=>{D.key==="Enter"&&F(k)}}),s.jsx(Q,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-200 h-8",onClick:()=>F(k),disabled:w,children:"刷新"}),s.jsx(Q,{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(D=>{const J=String(D.id??""),te=c.deviceGroups?c.deviceGroups.split(",").map(Ke=>Ke.trim()).filter(Boolean):[],be=te.includes(J),ze=()=>{let Ke;be?Ke=te.filter(Nt=>Nt!==J):Ke=[...te,J],u(Nt=>({...Nt,deviceGroups:Ke.join(",")})),Ke.length>0&&I(Nt=>({...Nt,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:be,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:D.memo||D.wechatId||`设备 ${J}`}),D.status==="online"&&s.jsx("span",{className:"rounded-full bg-emerald-500/20 text-emerald-400 text-[11px] px-2 py-0.5",children:"在线"}),D.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: ",J]}),D.wechatId&&s.jsxs("span",{className:"mr-3",children:["微信号: ",D.wechatId]}),typeof D.totalFriend=="number"&&s.jsxs("span",{children:["好友数: ",D.totalFriend]})]})]})]},J)})})}),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(Q,{type:"button",variant:"outline",className:"border-gray-600 text-gray-200 h-8 px-4",onClick:()=>x(!1),children:"取消"}),s.jsx(Q,{type:"button",className:"bg-[#38bdac] hover:bg-[#2da396] text-white h-8 px-4",onClick:()=>x(!1),children:"确定"})]})]})]})})]})})}function tV(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})}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 nV(){var Ul,Oi,Di;const t=Ra(),[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,E]=y.useState([]),[C,R]=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}),[_,H]=y.useState(null),[P,se]=y.useState(!1),[Y,V]=y.useState(!1),[ae,le]=y.useState(null),[de,I]=y.useState(!1),[G,z]=y.useState([]),[me,X]=y.useState(!1),[F,U]=y.useState(""),[fe,he]=y.useState(""),[oe,O]=y.useState(!1),[K,D]=y.useState(""),[J,te]=y.useState(!1),[be,ze]=y.useState(null),[Ke,Nt]=y.useState(!1),[yt,Dt]=y.useState(!1),[Rt,Pn]=y.useState({readWeight:.5,recencyWeight:.3,payWeight:.2}),[vn,Ut]=y.useState(!1),[Zt,Cn]=y.useState(!1),[zn,Un]=y.useState(1),[It,xn]=y.useState([]),[Nn,we]=y.useState(!1),[Te,Ue]=y.useState([]),[rt,Mt]=y.useState(!1),[kt,$]=y.useState(20),[Ie,vt]=y.useState(!1),[Pt,bt]=y.useState(!1),[ot,_t]=y.useState([]),[Jt,an]=y.useState([]),[rs,tr]=y.useState([]),[wi,ca]=y.useState(!1),[da,$r]=y.useState(1),[zr,Fr]=y.useState(20),[gr,yr]=y.useState(0),[Oa,nr]=y.useState(1),[Ts,sr]=y.useState(""),[br,Es]=y.useState(!1),[ie,ve]=y.useState(null),[Qe,pt]=y.useState({tagId:"",label:"",aliases:"",url:"",type:"url",appId:"",appSecret:"",pagePath:""}),[Wn,$s]=y.useState(!1),[Da,_a]=y.useState(!1),[Po,rr]=y.useState(null),[Ms,ji]=y.useState(null),[Wt,$l]=y.useState({}),[ar,Lo]=y.useState(!1),[ua,zl]=y.useState(""),[$a,za]=y.useState(""),[wn,ed]=y.useState([]),[Yn,td]=y.useState(0),[Br,Oo]=y.useState(1),[ki,ha]=y.useState(!1),[vr,Vr]=y.useState(""),fa=y.useRef(null),Si=y.useCallback(async(T,B)=>{var ht;const ue=new FormData;ue.append("file",T),ue.append("folder",B);const We=await(await fetch(bl("/api/upload"),{method:"POST",body:ue,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((ht=We==null?void 0:We.data)==null?void 0:ht.url)||(We==null?void 0:We.url)||""},[]),Fa=y.useCallback(T=>Si(T,"book-images"),[Si]),Ci=y.useCallback(T=>{const B=T.type.startsWith("video/")?"book-videos":"book-attachments";return Si(T,B)},[Si]),[Ti,Hr]=y.useState({}),Ei=T=>String(T||"").trim().slice(0,8),Do=y.useMemo(()=>{const T=new Map;return It.forEach((B,ue)=>{T.set(B.id,ue+1)}),T},[It]),xt=tV(e,Do,Ti),Nr=e.length,Ba=10,Va=Math.max(1,Math.ceil(It.length/Ba)),_o=It.slice((zn-1)*Ba,zn*Ba),hn=async()=>{a(!0);try{const T=await Oe("/api/db/book?action=list",{cache:"no-store"});n(Array.isArray(T==null?void 0:T.sections)?T.sections:[])}catch(T){console.error(T),n([])}finally{a(!1)}},Fl=async()=>{try{const T=await Oe("/api/db/config?key=book_part_badges",{cache:"no-store"});let B={};if(T&&Array.isArray(T.data)){const je=T.data.find(We=>We&&We.configKey==="book_part_badges");je&&je.configValue&&typeof je.configValue=="object"&&!Array.isArray(je.configValue)&&(B=je.configValue)}else T&&T.data&&typeof T.data=="object"&&!Array.isArray(T.data)&&(B=T.data);const ue={};Object.keys(B).forEach(je=>{const We=Ei(B[je]);We&&(ue[je]=We)}),Hr(ue)}catch(T){console.error(T),Hr({})}},zs=async()=>{we(!0);try{const T=await Oe("/api/db/book?action=ranking",{cache:"no-store"}),B=Array.isArray(T==null?void 0:T.sections)?T.sections:[];xn(B);const ue=B.filter(je=>je.isPinned).map(je=>je.id);Ue(ue)}catch(T){console.error(T),xn([])}finally{we(!1)}};y.useEffect(()=>{hn(),zs(),Fl()},[]);const wr=T=>{o(B=>B.includes(T)?B.filter(ue=>ue!==T):[...B,T])},Fs=y.useCallback(T=>{const B=e,ue=T.flatMap(je=>{const We=B.find(ht=>ht.id===je.id);return We?[{...We,partId:je.partId,partTitle:je.partTitle,chapterId:je.chapterId,chapterTitle:je.chapterTitle}]:[]});return n(ue),Yt("/api/db/book",{action:"reorder",items:T}).then(je=>{je&&je.success===!1&&(n(B),Z.error("排序失败: "+(je&&typeof je=="object"&&"error"in je?je.error:"未知错误")))}).catch(je=>{n(B),console.error("排序失败:",je),Z.error("排序失败: "+(je instanceof Error?je.message:"网络或服务异常"))}),Promise.resolve()},[e]),As=async T=>{if(confirm(`确定要删除章节「${T.title}」吗?此操作不可恢复。`))try{const B=await ui(`/api/db/book?id=${encodeURIComponent(T.id)}`);B&&B.success!==!1?(Z.success("已删除"),hn(),zs()):Z.error("删除失败: "+(B&&typeof B=="object"&&"error"in B?B.error:"未知错误"))}catch(B){console.error(B),Z.error("删除失败")}},Is=y.useCallback(async()=>{Ut(!0);try{const T=await Oe("/api/db/config/full?key=article_ranking_weights",{cache:"no-store"}),B=T&&T.data;B&&typeof B.readWeight=="number"&&typeof B.recencyWeight=="number"&&typeof B.payWeight=="number"&&Pn({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{Ut(!1)}},[]);y.useEffect(()=>{yt&&Is()},[yt,Is]);const pa=async()=>{const{readWeight:T,recencyWeight:B,payWeight:ue}=Rt,je=T+B+ue;if(Math.abs(je-1)>.001){Z.error("三个权重之和必须等于 1");return}Cn(!0);try{const We=await Ct("/api/db/config",{key:"article_ranking_weights",value:{readWeight:T,recencyWeight:B,payWeight:ue},description:"文章排名算法权重"});We&&We.success!==!1?(Z.success("排名权重已保存"),Dt(!1),hn(),zs()):Z.error("保存失败: "+(We&&typeof We=="object"&&"error"in We?We.error:""))}catch(We){console.error(We),Z.error("保存失败")}finally{Cn(!1)}},Ur=y.useCallback(async()=>{Mt(!0);try{const T=await Oe("/api/db/config/full?key=pinned_section_ids",{cache:"no-store"}),B=T&&T.data;Array.isArray(B)&&Ue(B)}catch{}finally{Mt(!1)}},[]),Fn=y.useCallback(async()=>{try{const T=await Oe("/api/db/persons");T!=null&&T.success&&T.persons&&_t(T.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{}},[]),Mi=y.useCallback(async(T,B)=>{const ue=(T.personId||T.id||"").trim();if(!ue){Z.error("缺少 personId");return}B&&!(T.userId||"").trim()&&Z.info("未绑定会员时,小程序仍显示 @ 名称,头像可能为默认图");try{const je=await Yt("/api/db/persons/pin",{personId:ue,isPinned:B});if(!(je!=null&&je.success)){Z.error((je==null?void 0:je.error)||"置顶失败");return}Z.success(B?"已设为小程序首页置顶(全局仅一条)":"已取消置顶"),await Fn()}catch(je){Z.error(je instanceof Error?je.message:"操作失败")}},[Fn]),xs=y.useCallback(async()=>{try{const T=await Oe("/api/db/link-tags");T!=null&&T.success&&T.linkTags&&an(T.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{}},[]),jr=y.useCallback(async()=>{try{const T=await Oe("/api/db/config/full?key=ckb_lead_webhook_url",{cache:"no-store"});T!=null&&T.success&&typeof T.data=="string"&&Vr(T.data)}catch{}},[]),$o=y.useCallback(async()=>{try{const T=await Oe("/api/db/ckb-person-leads");if(T!=null&&T.success&&T.byPerson){const B={};for(const ue of T.byPerson)B[ue.token]=ue.total;$l(B)}}catch{}},[]),Wr=y.useCallback(async(T,B,ue=1)=>{zl(T),za(B),Lo(!0),Oo(ue),ha(!0);try{const je=await Oe(`/api/db/ckb-person-leads?token=${encodeURIComponent(T)}&page=${ue}&pageSize=20`);je!=null&&je.success?(ed(je.records||[]),td(je.total||0)):Z.error((je==null?void 0:je.error)||"加载获客详情失败")}catch(je){Z.error(je instanceof Error?je.message:"加载获客详情失败")}finally{ha(!1)}},[]),ir=y.useCallback(async()=>{ca(!0);try{const T=new URLSearchParams({page:String(da),pageSize:String(zr)}),B=Ts.trim();B&&T.set("search",B);const ue=await Oe(`/api/db/link-tags?${T.toString()}`);if(ue!=null&&ue.success){const je=Array.isArray(ue.linkTags)?ue.linkTags:[];tr(je.map(We=>({id:We.tagId,label:We.label,aliases:We.aliases||"",url:We.url,type:We.type||"url",appId:We.appId||"",pagePath:We.pagePath||"",hasAppSecret:!!We.hasAppSecret}))),yr(typeof ue.total=="number"?ue.total:0),nr(typeof ue.totalPages=="number"&&ue.totalPages>0?ue.totalPages:1)}}catch(T){console.error(T),Z.error("加载链接标签失败")}finally{ca(!1)}},[da,zr,Ts]),[ma,nd]=y.useState([]),[or,Bs]=y.useState(""),[Kr,Vs]=y.useState(!1),sd=y.useRef(null),Ha=y.useCallback(async()=>{try{const T=await Oe("/api/admin/linked-miniprograms");T!=null&&T.success&&Array.isArray(T.data)&&nd(T.data.map(B=>({...B,key:B.key})))}catch{}},[]),kr=ma.filter(T=>!or.trim()||T.name.toLowerCase().includes(or.toLowerCase())||T.key&&T.key.toLowerCase().includes(or.toLowerCase())||T.appId.toLowerCase().includes(or.toLowerCase())),qr=async T=>{const B=Te.includes(T)?Te.filter(ue=>ue!==T):[...Te,T];Ue(B);try{await Ct("/api/db/config",{key:"pinned_section_ids",value:B,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"}),zs()}catch{Ue(Te)}},Ua=y.useCallback(async()=>{vt(!0);try{const T=await Oe("/api/db/config/full?key=unpaid_preview_percent",{cache:"no-store"}),B=T&&T.data;typeof B=="number"&&B>0&&B<=100&&$(B)}catch{}finally{vt(!1)}},[]),zo=async()=>{if(kt<1||kt>100){Z.error("预览比例需在 1~100 之间");return}bt(!0);try{const T=await Ct("/api/db/config",{key:"unpaid_preview_percent",value:kt,description:"小程序未付费内容默认预览比例(%)"});T&&T.success!==!1?Z.success("预览比例已保存"):Z.error("保存失败: "+(T.error||""))}catch{Z.error("保存失败")}finally{bt(!1)}};y.useEffect(()=>{Ur(),Ua(),Fn(),xs(),$o(),Ha(),jr()},[Ur,Ua,Fn,xs,$o,Ha,jr]),y.useEffect(()=>{ir()},[ir]);const Hs=async T=>{ze({section:T,orders:[]}),Nt(!0);try{const B=await Oe(`/api/db/book?action=section-orders&id=${encodeURIComponent(T.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{Nt(!1)}},xa=async T=>{x(!0);try{const B=T.mid!=null&&T.mid>0?`/api/db/book?action=read&mid=${T.mid}`:`/api/db/book?action=read&id=${encodeURIComponent(T.id)}`,ue=await Oe(B);if(ue!=null&&ue.success&&ue.section){const je=ue.section,We=je.editionPremium===!0;u({id:T.id,originalId:T.id,title:ue.section.title??T.title,price:ue.section.price??T.price,content:ue.section.content??"",filePath:T.filePath,isFree:T.isFree||T.price===0,isNew:je.isNew??T.isNew,isPinned:Te.includes(T.id),hotScore:T.hotScore??0,editionStandard:We?!1:je.editionStandard??!0,editionPremium:We})}else u({id:T.id,originalId:T.id,title:T.title,price:T.price,content:"",filePath:T.filePath,isFree:T.isFree,isNew:T.isNew,isPinned:Te.includes(T.id),hotScore:T.hotScore??0,editionStandard:!0,editionPremium:!1}),ue&&!ue.success&&Z.error("无法读取文件内容: "+(ue.error||"未知错误"))}catch(B){console.error(B),u({id:T.id,title:T.title,price:T.price,content:"",filePath:T.filePath,isFree:T.isFree})}finally{x(!1)}},Ai=async()=>{var T;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+.*${(T=c.title)==null?void 0:T.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const M of ue)B=B.replace(M,"");B=B.replace(/^\s*\n+/,"").trim();const je=c.originalId||c.id,We=c.id!==je,ht=await Yt("/api/db/book",{id:je,...We?{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,previewPercent:c.previewPercent??null,editionStandard:c.editionPremium?!1:c.editionStandard??!0,editionPremium:c.editionPremium??!1,saveToFile:!0},{timeout:j1}),At=We?c.id:je;c.isPinned!==Te.includes(At)&&await qr(At),ht&&ht.success!==!1?(Z.success(`已保存:${c.title}`),u(null),hn(),Fn(),xs()):Z.error("保存失败: "+(ht&&typeof ht=="object"&&"error"in ht?ht.error:"未知错误"))}catch(B){console.error(B);const ue=B instanceof Error&&B.name==="AbortError"?"保存超时,请检查网络或稍后重试":"保存失败";Z.error(ue)}finally{v(!1)}}},Bl=async()=>{if(!L.id||!L.title){Z.error("请填写章节ID和标题");return}v(!0);try{const T=xt.find(je=>je.id===L.partId),B=T==null?void 0:T.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:(T==null?void 0:T.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:j1});if(ue&&ue.success!==!1){if(L.isPinned){const je=[...Te,L.id];Ue(je);try{await Ct("/api/db/config",{key:"pinned_section_ids",value:je,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"})}catch{}}Z.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}),hn(),Fn(),xs()}else Z.error("创建失败: "+(ue&&typeof ue=="object"&&"error"in ue?ue.error:"未知错误"))}catch(T){console.error(T),Z.error("创建失败")}finally{v(!1)}},Ii=T=>{q(B=>{var ue;return{...B,partId:T.id,chapterId:((ue=T.chapters[0])==null?void 0:ue.id)??"chapter-1"}}),f(!0)},Ri=T=>{H({id:T.id,title:T.title,badgeText:Ei(T.badgeText)})},Vl=async()=>{var T;if((T=_==null?void 0:_.title)!=null&&T.trim()){se(!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(),We={...Ti},ht=Ei(_.badgeText);ht?We[_.id]=ht:delete We[_.id];const At=await Ct("/api/db/config",{key:"book_part_badges",value:We,description:"目录篇名角标(key=part_id, value=角标文案)"});if(At&&At.success===!1){Z.error("更新篇名角标失败: "+(At.error||"未知错误"));return}Hr(We),n(M=>M.map(ge=>ge.partId===_.id?{...ge,partTitle:je}:ge)),H(null),hn()}else Z.error("更新篇名失败: "+(ue&&typeof ue=="object"&&"error"in ue?ue.error:"未知错误"))}catch(B){console.error(B),Z.error("更新篇名失败")}finally{se(!1)}}},as=T=>{const B=T.chapters.length+1,ue=`chapter-${T.id}-${B}-${Date.now()}`;q({id:`${B}.1`,title:"新章节",price:1,partId:T.id,chapterId:ue,content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),f(!0)},Gr=(T,B)=>{const ue=B.sections;let je=1,We=!1,ht=!1;if(ue.length>0){const At=typeof ue[0].price=="number"?ue[0].price:Number(ue[0].price)||1,M=!!(ue[0].isFree||At===0);ht=ue.some(ge=>{const Ne=typeof ge.price=="number"?ge.price:Number(ge.price)||1,Le=!!(ge.isFree||Ne===0);return Ne!==At||Le!==M}),je=M?0:At,We=M}le({part:T,chapter:B,title:B.title,price:je,isFree:We,priceMixed:ht,initialTitle:B.title,initialPrice:je,initialIsFree:We})},Fo=async()=>{var We;if(!((We=ae==null?void 0:ae.title)!=null&&We.trim()))return;const T=ae,B=T.title.trim(),ue=B!==T.initialTitle,je=T.isFree!==T.initialIsFree||!T.isFree&&Number(T.price)!==Number(T.initialPrice);if(!ue&&!je){Z.info("未修改任何内容"),le(null);return}if(T.priceMixed&&je){const ht=T.chapter.sections.length,At=T.isFree?"全部设为免费":`全部设为 ¥${T.price}`;if(!confirm(`本章 ${ht} 节当前定价不一致,保存后将${At},确定?`))return}I(!0);try{if(ue){const ht=e.map(Ne=>({id:Ne.id,partId:Ne.partId||T.part.id,partTitle:Ne.partId===T.part.id?T.part.title:Ne.partTitle||"",chapterId:Ne.chapterId||T.chapter.id,chapterTitle:Ne.partId===T.part.id&&Ne.chapterId===T.chapter.id?B:Ne.chapterTitle||""})),At=await Yt("/api/db/book",{action:"reorder",items:ht});if(At&&At.success===!1){Z.error("保存章节名失败: "+(At&&typeof At=="object"&&"error"in At?At.error:"未知错误"));return}const M=T.part.id,ge=T.chapter.id;n(Ne=>Ne.map(Le=>Le.partId===M&&Le.chapterId===ge?{...Le,chapterTitle:B}:Le))}if(je){const ht=await Yt("/api/db/book",{action:"update-chapter-pricing",partId:T.part.id,chapterId:T.chapter.id,price:T.isFree?0:Number(T.price)||0,isFree:T.isFree});if(ht&&ht.success===!1){Z.error("保存定价失败: "+(ht&&typeof ht=="object"&&"error"in ht?ht.error:"未知错误")),ue&&hn();return}}le(null),hn(),Z.success("已保存")}catch(ht){console.error(ht),Z.error("保存失败")}finally{I(!1)}},Wa=async(T,B)=>{const ue=B.sections.map(je=>je.id);if(ue.length===0){Z.info("该章下无小节,无需删除");return}if(confirm(`确定要删除「第${T.chapters.indexOf(B)+1}章 | ${B.title}」吗?将删除共 ${ue.length} 节,此操作不可恢复。`))try{for(const je of ue)await ui(`/api/db/book?id=${encodeURIComponent(je)}`);hn()}catch(je){console.error(je),Z.error("删除失败")}},Hl=async()=>{if(!K.trim()){Z.error("请输入篇名");return}te(!0);try{const T=`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:T,partTitle:K.trim(),chapterId:B,chapterTitle:"第1章 | 待编辑",saveToFile:!1});je&&je.success!==!1?(Z.success(`篇「${K}」创建成功`),V(!1),D(""),hn()):Z.error("创建失败: "+(je&&typeof je=="object"&&"error"in je?je.error:"未知错误"))}catch(T){console.error(T),Z.error("创建失败")}finally{te(!1)}},Pi=async()=>{if(G.length===0){Z.error("请先勾选要移动的章节");return}const T=xt.find(ue=>ue.id===F),B=T==null?void 0:T.chapters.find(ue=>ue.id===fe);if(!T||!B||!F||!fe){Z.error("请选择目标篇和章");return}O(!0);try{const ue=()=>{const At=new Set(G),M=e.map(Be=>({id:Be.id,partId:Be.partId||"",partTitle:Be.partTitle||"",chapterId:Be.chapterId||"",chapterTitle:Be.chapterTitle||""})),ge=M.filter(Be=>At.has(Be.id)).map(Be=>({...Be,partId:F,partTitle:T.title||F,chapterId:fe,chapterTitle:B.title||fe})),Ne=M.filter(Be=>!At.has(Be.id));let Le=Ne.length;for(let Be=Ne.length-1;Be>=0;Be-=1){const tt=Ne[Be];if(tt.partId===F&&tt.chapterId===fe){Le=Be+1;break}}return[...Ne.slice(0,Le),...ge,...Ne.slice(Le)]},je=async()=>{const At=ue(),M=await Yt("/api/db/book",{action:"reorder",items:At});return M&&M.success!==!1?(Z.success(`已移动 ${G.length} 节到「${T.title}」-「${B.title}」`),X(!1),z([]),await hn(),!0):!1},We={action:"move-sections",sectionIds:G,targetPartId:F,targetChapterId:fe,targetPartTitle:T.title||F,targetChapterTitle:B.title||fe},ht=await Yt("/api/db/book",We);if(ht&&ht.success!==!1)Z.success(`已移动 ${ht.count??G.length} 节到「${T.title}」-「${B.title}」`),X(!1),z([]),await hn();else{const At=ht&&typeof ht=="object"&&"error"in ht?ht.error||"":"未知错误";if((At.includes("缺少 id")||At.includes("无效的 action"))&&await je())return;Z.error("移动失败: "+At)}}catch(ue){console.error(ue),Z.error("移动失败: "+(ue instanceof Error?ue.message:"网络或服务异常"))}finally{O(!1)}},Bo=T=>{z(B=>B.includes(T)?B.filter(ue=>ue!==T):[...B,T])},Ka=async T=>{const B=e.filter(ue=>ue.partId===T.id).map(ue=>ue.id);if(B.length===0){Z.info("该篇下暂无小节可删除");return}if(confirm(`确定要删除「${T.title}」整篇吗?将删除共 ${B.length} 节内容,此操作不可恢复。`))try{for(const ue of B)await ui(`/api/db/book?id=${encodeURIComponent(ue)}`);hn()}catch(ue){console.error(ue),Z.error("删除失败")}},Rs=async()=>{var T;if(w.trim()){R(!0);try{const B=await Oe(`/api/search?q=${encodeURIComponent(w)}`);B!=null&&B.success&&((T=B.data)!=null&&T.results)?E(B.data.results):(E([]),B&&!B.success&&Z.error("搜索失败: "+B.error))}catch(B){console.error(B),E([]),Z.error("搜索失败")}finally{R(!1)}}},Li=xt.find(T=>T.id===L.partId),Vo=(Li==null?void 0:Li.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:["共 ",xt.length," 篇 · ",Nr," 节内容"]})]}),s.jsx("div",{className:"flex gap-2",children:s.jsxs(Q,{onClick:()=>Dt(!0),variant:"outline",className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:[s.jsx(wh,{className:"w-4 h-4 mr-2"}),"排名算法"]})})]}),s.jsx(Ft,{open:h,onOpenChange:f,children:s.jsxs(zt,{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(Bt,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(On,{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:T=>q({...L,id:T.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:T=>q({...L,price:Number(T.target.value),isFree:Number(T.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:T=>q({...L,isFree:T.target.checked,price:T.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(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:T=>q({...L,isNew:T.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(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:T=>q({...L,isPinned:T.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(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:T=>q({...L,hotScore:Math.max(0,parseFloat(T.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:T=>q({...L,title:T.target.value})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"所属篇"}),s.jsxs(wc,{value:L.partId,onValueChange:T=>{var ue;const B=xt.find(je=>je.id===T);q({...L,partId:T,chapterId:((ue=B==null?void 0:B.chapters[0])==null?void 0:ue.id)??"chapter-1"})},children:[s.jsx(al,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(jc,{})}),s.jsxs(il,{className:"bg-[#0f2137] border-gray-700",children:[xt.map(T=>s.jsx(Qs,{value:T.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:T.title},T.id)),xt.length===0&&s.jsx(Qs,{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(wc,{value:L.chapterId,onValueChange:T=>q({...L,chapterId:T}),children:[s.jsx(al,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(jc,{})}),s.jsxs(il,{className:"bg-[#0f2137] border-gray-700",children:[Vo.map(T=>s.jsx(Qs,{value:T.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:T.title},T.id)),Vo.length===0&&s.jsx(Qs,{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(f0,{content:L.content||"",onChange:T=>q({...L,content:T}),onImageUpload:Fa,onMediaUpload:Ci,persons:ot,linkTags:Jt,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(yn,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[s.jsx(Q,{variant:"outline",onClick:()=>f(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(Q,{onClick:Bl,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(On,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),s.jsx(Ft,{open:!!_,onOpenChange:T=>!T&&H(null),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(en,{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(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:_.title,onChange:T=>H({..._,title:T.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:_.badgeText||"",onChange:T=>H({..._,badgeText:Ei(T.target.value)}),placeholder:"例如:派 / 新 / 热",maxLength:8}),s.jsx("p",{className:"text-xs text-gray-500",children:"保存后会同步到目录左侧图标文字(小程序与管理端目录树)。"})]})]}),s.jsxs(yn,{children:[s.jsx(Q,{variant:"outline",onClick:()=>H(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(Q,{onClick:Vl,disabled:P||!((Ul=_==null?void 0:_.title)!=null&&Ul.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:P?s.jsxs(s.Fragment,{children:[s.jsx(Ve,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Ft,{open:!!ae,onOpenChange:T=>!T&&le(null),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsxs(Bt,{children:[s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(en,{className:"w-5 h-5 text-[#38bdac]"}),"章节设置"]}),s.jsx("p",{className:"text-gray-400 text-sm font-normal pt-1",children:"修改本章显示名称,或为本章下全部节设置统一金额(仍可在单节编辑里单独改某一节)。"})]}),ae&&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:ae.title,onChange:T=>le({...ae,title:T.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:["本章统一定价(应用于本章全部 ",ae.chapter.sections.length," 节)"]}),ae.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:ae.isFree?0:ae.price,onChange:T=>le({...ae,price:Number(T.target.value),isFree:Number(T.target.value)===0}),disabled:ae.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:ae.isFree||ae.price===0,onChange:T=>le({...ae,isFree:T.target.checked,price:T.target.checked?0:ae.initialPrice>0?ae.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(yn,{children:[s.jsx(Q,{variant:"outline",onClick:()=>le(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(Q,{onClick:Fo,disabled:de||!((Oi=ae==null?void 0:ae.title)!=null&&Oi.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:de?s.jsxs(s.Fragment,{children:[s.jsx(Ve,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Ft,{open:me,onOpenChange:T=>{var B;if(X(T),T&&xt.length>0){const ue=xt[0];U(ue.id),he(((B=ue.chapters[0])==null?void 0:B.id)??"")}},children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Bt,{children:s.jsx(Vt,{className:"text-white",children:"批量移动至指定目录"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["已选 ",s.jsx("span",{className:"text-[#38bdac] font-medium",children:G.length})," 节,请选择目标篇与章。"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"目标篇"}),s.jsxs(wc,{value:F,onValueChange:T=>{var ue;U(T);const B=xt.find(je=>je.id===T);he(((ue=B==null?void 0:B.chapters[0])==null?void 0:ue.id)??"")},children:[s.jsx(al,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(jc,{placeholder:"选择篇"})}),s.jsx(il,{className:"bg-[#0f2137] border-gray-700",children:xt.map(T=>s.jsx(Qs,{value:T.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:T.title},T.id))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"目标章"}),s.jsxs(wc,{value:fe,onValueChange:he,children:[s.jsx(al,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(jc,{placeholder:"选择章"})}),s.jsx(il,{className:"bg-[#0f2137] border-gray-700",children:(((Di=xt.find(T=>T.id===F))==null?void 0:Di.chapters)??[]).map(T=>s.jsx(Qs,{value:T.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:T.title},T.id))})]})]})]}),s.jsxs(yn,{children:[s.jsx(Q,{variant:"outline",onClick:()=>X(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(Q,{onClick:Pi,disabled:oe||G.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(Ft,{open:!!be,onOpenChange:T=>!T&&ze(null),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",showCloseButton:!0,children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white",children:["付款记录 — ",(be==null?void 0:be.section.title)??""]})}),s.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:Ke?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:"加载中..."})]}):be&&be.orders.length===0?s.jsx("p",{className:"text-gray-500 text-center py-6",children:"暂无付款记录"}):be?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:be.orders.map(T=>s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("td",{className:"py-2 pr-2",children:s.jsx("button",{className:"text-blue-400 hover:text-blue-300 hover:underline text-left truncate max-w-[180px] block",title:`查看订单 ${T.orderSn}`,onClick:()=>window.open(`/orders?search=${T.orderSn??T.id??""}`,"_blank"),children:T.orderSn?T.orderSn.length>16?T.orderSn.slice(0,8)+"..."+T.orderSn.slice(-6):T.orderSn:"-"})}),s.jsx("td",{className:"py-2 pr-2",children:s.jsx("button",{className:"text-[#38bdac] hover:text-[#2da396] hover:underline text-left truncate max-w-[140px] block",title:`查看用户 ${T.userId??T.openId??""}`,onClick:()=>window.open(`/users?search=${T.userId??T.openId??""}`,"_blank"),children:(()=>{const B=T.userId??T.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:["¥",T.amount??0]}),s.jsx("td",{className:"py-2 pr-2 text-gray-300",children:T.status??"-"}),s.jsx("td",{className:"py-2 pr-2 text-gray-500",children:T.payTime??T.createdAt??"-"})]},T.id??T.orderSn??""))})]}):null})]})}),s.jsx(Ft,{open:yt,onOpenChange:Dt,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(wh,{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)"}),vn?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:Rt.readWeight,onChange:T=>Pn(B=>({...B,readWeight:Math.max(0,Math.min(1,parseFloat(T.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:Rt.recencyWeight,onChange:T=>Pn(B=>({...B,recencyWeight:Math.max(0,Math.min(1,parseFloat(T.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:Rt.payWeight,onChange:T=>Pn(B=>({...B,payWeight:Math.max(0,Math.min(1,parseFloat(T.target.value)||0))}))})]})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["当前之和: ",(Rt.readWeight+Rt.recencyWeight+Rt.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(Q,{onClick:pa,disabled:Zt||Math.abs(Rt.readWeight+Rt.recencyWeight+Rt.payWeight-1)>.001,className:"w-full bg-amber-500 hover:bg-amber-600 text-white",children:Zt?"保存中...":"保存权重"})]})]})]})}),s.jsx(Ft,{open:Y,onOpenChange:V,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(On,{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:T=>D(T.target.value),placeholder:"输入篇名"})]})}),s.jsxs(yn,{children:[s.jsx(Q,{variant:"outline",onClick:()=>{V(!1),D("")},className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(Q,{onClick:Hl,disabled:J||!K.trim(),className:"bg-amber-500 hover:bg-amber-600 text-white",children:J?s.jsxs(s.Fragment,{children:[s.jsx(Ve,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(On,{className:"w-4 h-4 mr-2"}),"创建篇"]})})]})]})}),s.jsx(Ft,{open:!!c,onOpenChange:()=>u(null),children:s.jsxs(zt,{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(Bt,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(en,{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:T=>u({...c,id:T.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:T=>u({...c,price:Number(T.target.value),isFree:Number(T.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:T=>u({...c,isFree:T.target.checked,price:T.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"预览%"}),s.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",placeholder:`全局 ${kt}%`,value:c.previewPercent??"",onChange:T=>{const B=T.target.value===""?void 0:Math.min(100,Math.max(0,Number(T.target.value)));u({...c,previewPercent:B})}})]}),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:T=>u({...c,isNew:T.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(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:T=>u({...c,isPinned:T.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(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:T=>u({...c,hotScore:Math.max(0,parseFloat(T.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:T=>u({...c,title:T.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(f0,{ref:fa,content:c.content||"",onChange:T=>u({...c,content:T}),onImageUpload:Fa,onMediaUpload:Ci,persons:ot,linkTags:Jt,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(yn,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[c&&s.jsxs(Q,{variant:"outline",onClick:()=>Hs({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(Zs,{className:"w-4 h-4 mr-2"}),"付款记录"]}),s.jsxs(Q,{variant:"outline",onClick:()=>u(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Jn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsx(Q,{onClick:Ai,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(Sn,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),s.jsxs(Oc,{defaultValue:"chapters",className:"space-y-6",children:[s.jsxs(wl,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(tn,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(Zs,{className:"w-4 h-4 mr-2"}),"章节管理"]}),s.jsxs(tn,{value:"ranking",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(wg,{className:"w-4 h-4 mr-2"}),"内容排行榜"]}),s.jsxs(tn,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(Ca,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),s.jsxs(tn,{value:"link-person",className:"data-[state=active]:bg-purple-500/20 data-[state=active]:text-purple-400 text-gray-400",children:[s.jsx(ka,{className:"w-4 h-4 mr-2"}),"@列表"]}),s.jsxs(tn,{value:"link-tag",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(y1,{className:"w-4 h-4 mr-2"}),"链接标签"]})]}),s.jsxs(nn,{value:"chapters",className:"space-y-4",children:[s.jsxs("div",{className:"rounded-2xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between shadow-sm",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac] flex items-center justify-center text-white shadow-lg shadow-[#38bdac]/20 shrink-0",children:s.jsx(Zs,{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:Nr}),s.jsx("span",{className:"text-xs text-gray-500",children:"章节"})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(Q,{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(On,{className:"w-4 h-4 mr-2"}),"新建章节"]}),s.jsxs(Q,{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(On,{className:"w-4 h-4 mr-2"}),"新建篇"]}),s.jsxs(Q,{variant:"outline",onClick:()=>X(!0),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:["批量移动(已选 ",G.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(K9,{parts:xt,expandedParts:i,onTogglePart:wr,onReorder:Fs,onReadSection:xa,onDeleteSection:As,onAddSectionInPart:Ii,onAddChapterInPart:as,onDeleteChapter:Wa,onEditPart:Ri,onDeletePart:Ka,onEditChapter:Gr,selectedSectionIds:G,onToggleSectionSelect:Bo,onShowSectionOrders:Hs,pinnedSectionIds:Te})]}),s.jsx(nn,{value:"search",className:"space-y-4",children:s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(dt,{children:s.jsx(ut,{className:"text-white",children:"内容搜索"})}),s.jsxs($e,{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:T=>N(T.target.value),onKeyDown:T=>T.key==="Enter"&&Rs()}),s.jsx(Q,{onClick:Rs,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(Ca,{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(T=>s.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors",onClick:()=>xa({id:T.id,mid:T.mid,title:T.title,price:T.price??1,filePath:""}),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:T.id}),s.jsx("span",{className:"text-white",children:T.title}),Te.includes(T.id)&&s.jsx(Sc,{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:T.matchType==="title"?"标题匹配":"内容匹配"})]}),T.snippet&&s.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:T.snippet}),(T.partTitle||T.chapterTitle)&&s.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[T.partTitle," · ",T.chapterTitle]})]},T.id))]})]})]})}),s.jsxs(nn,{value:"ranking",className:"space-y-4",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(dt,{className:"pb-3",children:s.jsxs(ut,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(wh,{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(ce,{type:"number",min:"1",max:"100",className:"bg-[#0a1628] border-gray-700 text-white w-20",value:kt,onChange:T=>$(Math.max(1,Math.min(100,Number(T.target.value)||20))),disabled:Ie}),s.jsx("span",{className:"text-gray-500 text-sm",children:"%"})]}),s.jsx(Q,{size:"sm",onClick:zo,disabled:Pt,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:Pt?"保存中...":"保存"}),s.jsxs("span",{className:"text-xs text-gray-500",children:["小程序未付费用户默认显示文章前 ",kt,"% 内容"]})]})})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(dt,{className:"pb-3",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs(ut,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(wg,{className:"w-4 h-4 text-amber-400"}),"内容排行榜",s.jsxs("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["按热度排行 · 共 ",It.length," 节"]})]}),s.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[s.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>zs(),disabled:Nn,className:"text-gray-400 hover:text-white h-7 w-7 p-0",title:"刷新排行榜",children:s.jsx(Ve,{className:`w-4 h-4 ${Nn?"animate-spin":""}`})}),s.jsx(Q,{variant:"ghost",size:"sm",disabled:zn<=1||Nn,onClick:()=>Un(T=>Math.max(1,T-1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(h5,{className:"w-4 h-4"})}),s.jsxs("span",{className:"text-gray-400 min-w-[60px] text-center",children:[zn," / ",Va]}),s.jsx(Q,{variant:"ghost",size:"sm",disabled:zn>=Va||Nn,onClick:()=>Un(T=>Math.min(Va,T+1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(ol,{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:"编辑"})]}),_o.map((T,B)=>{const ue=(zn-1)*Ba+B+1,je=T.isPinned??Te.includes(T.id);return s.jsxs("div",{className:`grid grid-cols-[40px_40px_1fr_80px_80px_80px_60px] gap-2 px-3 py-2.5 items-center border-b border-gray-700/30 hover:bg-[#162840] transition-colors ${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(Q,{variant:"ghost",size:"sm",className:`h-6 w-6 p-0 ${je?"text-amber-400":"text-gray-600 hover:text-amber-400"}`,onClick:()=>qr(T.id),disabled:rt,title:je?"取消置顶":"强制置顶(精选推荐/首页最新更新)",children:je?s.jsx(Sc,{className:"w-3.5 h-3.5 fill-current"}):s.jsx(N1,{className:"w-3.5 h-3.5"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"text-white text-sm truncate block",children:T.title}),s.jsxs("span",{className:"text-gray-600 text-xs",children:[T.partTitle," · ",T.chapterTitle]})]}),s.jsx("span",{className:"text-right text-sm text-blue-400 font-mono",children:T.clickCount??0}),s.jsx("span",{className:"text-right text-sm text-green-400 font-mono",children:T.payCount??0}),s.jsx("span",{className:"text-right text-sm text-amber-400 font-mono",children:(T.hotScore??0).toFixed(1)}),s.jsx("div",{className:"text-right",children:s.jsx(Q,{variant:"ghost",size:"sm",className:"text-gray-500 hover:text-[#38bdac] h-6 px-1",onClick:()=>xa({id:T.id,mid:T.mid,title:T.title,price:T.price,filePath:""}),title:"编辑文章",children:s.jsx(en,{className:"w-3 h-3"})})})]},T.id)}),_o.length===0&&s.jsx("div",{className:"py-8 text-center text-gray-500",children:"暂无数据"})]})})]})]}),s.jsxs(nn,{value:"link-person",className:"space-y-4",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{className:"pb-3",children:[s.jsxs(ut,{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(Q,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 hover:bg-gray-700/50",onClick:()=>{Fn()},title:"刷新",children:s.jsx(Ve,{className:"w-4 h-4"})}),s.jsxs(Q,{size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",onClick:()=>{rr(null),_a(!0)},children:[s.jsx(On,{className:"w-4 h-4 mr-2"}),"添加"]})]})]}),s.jsx("div",{className:"max-h-[400px] overflow-y-auto",children:ot.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:ot.map(T=>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:T.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:()=>{Wt[T.id]&&Wr(T.id,T.name)},title:Wt[T.id]?"点击查看获客详情":T.name,children:T.name})}),s.jsx("td",{className:"py-2 px-3",children:T.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:T.userId?s.jsxs("div",{className:"flex flex-col gap-0.5 items-start max-w-[100px]",children:[T.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: ${T.userId}`,onClick:()=>t(`/users?search=${encodeURIComponent(T.userId||"")}`),children:T.name})]}):s.jsx("span",{className:"text-gray-600",children:"—"})}),(()=>{const B=Wt[T.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&&Wr(T.id,T.name)},children:B})})(),s.jsx("td",{className:"py-2 px-3 text-white truncate max-w-[220px]",title:`planId: ${T.ckbPlanId??"-"}`,children:s.jsx("div",{className:"flex items-center gap-1.5",children:s.jsx("span",{className:"truncate",children:T.ckbPlanId?T.personSource==="vip_sync"?"超级个体拉群(统一计划)":`SOUL链接人与事-${T.name}`:"—"})})}),s.jsx("td",{className:"py-2 px-2 text-center",children:s.jsx(Q,{type:"button",variant:"ghost",size:"sm",className:T.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:T.isPinned?"取消小程序首页置顶":"设为小程序首页置顶(全局唯一)",onClick:()=>void Mi(T,!T.isPinned),children:s.jsx(N1,{className:`w-3.5 h-3.5 ${T.isPinned?"fill-amber-400":""}`})})}),s.jsx("td",{className:"py-2 px-3 text-center",children:T.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(Q,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-[#38bdac] h-6 px-2",title:"编辑",onClick:async()=>{try{const B=await G9(T.personId||"");if(B!=null&&B.success&&B.person){const ue=B.person;rr({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 rr(T),B!=null&&B.error&&Z.error(B.error)}catch(B){console.error(B),rr(T),Z.error(B instanceof Error?B.message:"加载人物详情失败")}_a(!0)},children:s.jsx(b1,{className:"w-3 h-3"})}),s.jsx(Q,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-green-400 h-6 px-2",title:"查看新客户",onClick:()=>Wr(T.id,T.name),children:s.jsx(Dn,{className:"w-3 h-3"})}),s.jsx(Q,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",title:T.personSource==="vip_sync"?"删除本地 @人物(不删统一获客计划)":"删除(同时删除存客宝对应获客计划)",onClick:()=>ji(T),children:s.jsx(Jn,{className:"w-3 h-3"})})]})})]},T.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(dt,{className:"pb-3",children:[s.jsxs(ut,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(XM,{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(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(dt,{className:"pb-3",children:[s.jsxs(ut,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(wh,{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(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:vr,onChange:T=>Vr(T.target.value)})]}),s.jsxs(Q,{size:"sm",className:"bg-blue-500 hover:bg-blue-600 text-white h-8",onClick:async()=>{const T=vr.trim();try{const B=await Ct("/api/db/config",{key:"ckb_lead_webhook_url",value:T,description:"获客线索 Webhook 通知 URL(企微/飞书)"});B!=null&&B.success?Z.success(T?"Webhook 已保存":"Webhook 已清除"):Z.error((B==null?void 0:B.error)??"保存失败")}catch{Z.error("保存失败")}},children:[s.jsx(Sn,{className:"w-3.5 h-3.5 mr-1"}),"保存"]})]}),s.jsx("p",{className:"text-xs text-gray-500",children:"配置企业微信或飞书群机器人 Webhook URL,获客成功后自动推送通知"})]})]})]}),s.jsxs(nn,{value:"link-tag",className:"space-y-4",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{className:"pb-3",children:[s.jsxs(ut,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(y1,{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(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-48",placeholder:"按标签ID/显示文字搜索",value:Ts,onChange:T=>{sr(T.target.value),$r(1)}})]}),s.jsx(Q,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 hover:bg-gray-700/50 h-8",onClick:()=>{xs(),ir()},title:"刷新",children:s.jsx(Ve,{className:"w-4 h-4"})})]}),s.jsxs(Q,{size:"sm",className:"bg-amber-500 hover:bg-amber-600 text-white h-8",onClick:()=>{ve(null),pt({tagId:"",label:"",aliases:"",url:"",type:"url",appId:"",appSecret:"",pagePath:""}),Bs(""),Vs(!1),Es(!0)},children:[s.jsx(On,{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:wi?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:"加载中..."})}):rs.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:"暂无链接标签,添加后可在编辑器中使用 #标签 跳转"})}):rs.map(T=>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(T),pt({tagId:T.id,label:T.label,aliases:T.aliases??"",url:T.url,type:T.type,appId:T.appId??"",appSecret:"",pagePath:T.pagePath??""}),Bs(T.appId??""),Vs(!1),Es(!0)},title:"点击编辑标签",children:["#",T.label]})}),s.jsx("td",{className:"px-3 py-2 text-gray-500 text-xs truncate max-w-[120px]",title:T.aliases||"",children:T.aliases||"—"}),s.jsx("td",{className:"px-3 py-2",children:s.jsx(He,{variant:"secondary",className:`text-[10px] ${T.type==="ckb"?"bg-green-500/20 text-green-300 border-green-500/30":T.type==="miniprogram"||T.type==="wxlink"?"bg-[#38bdac]/20 text-[#38bdac] border-[#38bdac]/30":"bg-gray-700 text-gray-300"}`,children:T.type==="url"?"网页":T.type==="ckb"?"存客宝":T.type==="wxlink"?"小程序链接":"小程序"})}),s.jsx("td",{className:"px-3 py-2 text-gray-300",children:T.type==="miniprogram"?s.jsxs("div",{className:"space-y-0.5",children:[(()=>{const B=ma.find(ue=>ue.key===T.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)||T.appId||"—"]})]})})(),T.pagePath&&s.jsx("div",{className:"text-xs text-gray-500 font-mono",children:T.pagePath}),s.jsxs("div",{className:`text-xs ${T.hasAppSecret?"text-emerald-400/90":"text-amber-500/80"}`,children:["AppSecret:",T.hasAppSecret?"已保存(仅服务端)":"未配置"]})]}):T.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:T.url,children:T.url||"—"}),s.jsx("div",{className:"text-[11px] text-gray-500",children:"小程序内点击 → web-view 打开 → 自动唤起目标小程序"})]}):T.url?s.jsxs("a",{href:T.url,target:"_blank",rel:"noreferrer",className:"text-blue-400 text-xs truncate max-w-[420px] hover:underline inline-flex items-center gap-1",children:[T.url," ",s.jsx(xi,{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(Q,{variant:"ghost",size:"sm",className:"text-gray-300 hover:text-white h-7 px-2",onClick:()=>{ve(T),pt({tagId:T.id,label:T.label,aliases:T.aliases??"",url:T.url,type:T.type,appId:T.appId??"",appSecret:"",pagePath:T.pagePath??""}),Bs(T.appId??""),Vs(!1),Es(!0)},title:"编辑",children:s.jsx(b1,{className:"w-3 h-3"})}),s.jsx(Q,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-7 px-2",onClick:async()=>{if(confirm(`确定要删除「#${T.label}」吗?`))try{const B=await ui(`/api/db/link-tags?tagId=${encodeURIComponent(T.id)}`);B!=null&&B.success?(Z.success("已删除"),xs(),ir()):Z.error((B==null?void 0:B.error)??"删除失败")}catch(B){console.error(B),Z.error("删除失败")}},title:"删除",children:s.jsx(Jn,{className:"w-3 h-3"})})]})})]},T.id))})]})}),s.jsx(Xs,{page:da,pageSize:zr,total:gr,totalPages:Oa,onPageChange:T=>$r(T),onPageSizeChange:T=>{Fr(T),$r(1)}})]})]})]}),s.jsx(Ft,{open:br,onOpenChange:Es,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg p-4 gap-3",children:[s.jsxs(Bt,{className:"gap-1",children:[s.jsx(Vt,{className:"text-base",children:ie?"编辑链接标签":"添加链接标签"}),s.jsx(hf,{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:Qe.tagId,disabled:!!ie,onChange:T=>pt(B=>({...B,tagId:T.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:Qe.label,onChange:T=>pt(B=>({...B,label:T.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:Qe.aliases,onChange:T=>pt(B=>({...B,aliases:T.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(wc,{value:Qe.type,onValueChange:T=>pt(B=>({...B,type:T})),children:[s.jsx(al,{className:"bg-[#0a1628] border-gray-700 text-white h-8",children:s.jsx(jc,{})}),s.jsxs(il,{className:"bg-[#0f2137] border-gray-700 text-white",children:[s.jsx(Qs,{value:"url",children:"网页链接"}),s.jsx(Qs,{value:"miniprogram",children:"小程序(API跳转)"}),s.jsx(Qs,{value:"wxlink",children:"小程序链接(右上角复制)"}),s.jsx(Qs,{value:"ckb",children:"存客宝"})]})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ne,{className:"text-gray-300 text-sm",children:Qe.type==="url"?"URL地址":Qe.type==="ckb"?"存客宝计划URL":Qe.type==="wxlink"?"小程序链接":"小程序 mpKey / 微信 AppID"}),Qe.type==="wxlink"?s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"粘贴小程序右上角 ... → 复制链接 得到的 URL",value:Qe.url,onChange:T=>pt(B=>({...B,url:T.target.value}))}):Qe.type==="miniprogram"&&ma.length>0?s.jsxs("div",{ref:sd,className:"relative",children:[s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"搜索名称或密钥",value:Kr?or:Qe.appId,onChange:T=>{const B=T.target.value;Bs(B),Vs(!0),ma.some(ue=>ue.key===B)||pt(ue=>({...ue,appId:B}))},onFocus:()=>{Bs(Qe.appId),Vs(!0)},onBlur:()=>setTimeout(()=>Vs(!1),150)}),Kr&&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:kr.length===0?s.jsx("div",{className:"px-3 py-2 text-gray-500 text-xs",children:"无匹配,可手动输入密钥"}):kr.map(T=>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(),pt(ue=>({...ue,appId:T.key,pagePath:T.path||""})),Bs(""),Vs(!1)},children:[s.jsx("span",{children:T.name}),s.jsx("span",{className:"text-xs text-gray-400 font-mono",children:T.key})]},T.key))})]}):s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:Qe.type==="url"?"https://...":Qe.type==="ckb"?"https://ckbapi.quwanzhi.com/...":"关联配置的 key,或直接填 wx 开头的 AppID",value:Qe.type==="url"||Qe.type==="ckb"?Qe.url:Qe.appId,onChange:T=>{Qe.type==="url"||Qe.type==="ckb"?pt(B=>({...B,url:T.target.value})):pt(B=>({...B,appId:T.target.value}))}})]})]}),Qe.type==="wxlink"&&s.jsx("p",{className:"text-[11px] text-amber-400/80 leading-snug px-0.5",children:"操作:打开目标小程序 → 右上角「...」→「复制链接」→ 粘贴到上面。小程序内点击此标签会在 web-view 中打开,微信自动唤起目标小程序,无需修改小程序版本。"}),Qe.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:Qe.pagePath,onChange:T=>pt(B=>({...B,pagePath:T.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:ie!=null&&ie.hasAppSecret?"已保存密钥,留空不改;填写则覆盖":"粘贴目标小程序 AppSecret",value:Qe.appSecret,onChange:T=>pt(B=>({...B,appSecret:T.target.value}))}),s.jsx("p",{className:"text-[11px] text-gray-500 leading-snug",children:"与 AppID 成对落库;接口响应与小程序配置中均不会返回此字段。"})]})]})]}),s.jsxs(yn,{className:"gap-2 pt-1",children:[s.jsx(Q,{variant:"outline",onClick:()=>Es(!1),className:"border-gray-600",children:"取消"}),s.jsx(Q,{onClick:async()=>{const T={tagId:Qe.tagId.trim(),label:Qe.label.trim(),aliases:Qe.aliases.trim(),url:Qe.url.trim(),type:Qe.type,appId:Qe.appId.trim(),appSecret:Qe.appSecret.trim(),pagePath:Qe.pagePath.trim()};if(T.tagId){const B=T.tagId;if([...B].length>50){Z.error("标签ID 最长 50 个字符");return}if(/[#,\n\r\t]/.test(B)){Z.error("标签ID 不能含 #、逗号或换行");return}}if(!T.label){Z.error("显示文字必填");return}T.type==="miniprogram"&&(T.url=""),T.type==="wxlink"&&(T.appId="",T.pagePath=""),$s(!0);try{const B=await Ct("/api/db/link-tags",T);B!=null&&B.success?(Z.success(ie?"已更新":"已添加"),Es(!1),xs(),ir()):Z.error((B==null?void 0:B.error)??"保存失败")}catch(B){console.error(B),Z.error("保存失败")}finally{$s(!1)}},disabled:Wn,className:"bg-amber-500 hover:bg-amber-600 text-white",children:Wn?"保存中...":"保存"})]})]})})]})]}),s.jsx(eV,{open:Da,onOpenChange:_a,editingPerson:Po,onSubmit:async T=>{var je;const B={personId:T.personId||T.name.toLowerCase().replace(/\s+/g,"_")+"_"+Date.now().toString(36),name:T.name,userId:T.boundUserId,aliases:T.aliases||void 0,label:T.label,ckbApiKey:T.ckbApiKey||void 0,greeting:T.greeting||void 0,tips:T.tips||void 0,remarkType:T.remarkType||void 0,remarkFormat:T.remarkFormat||void 0,addFriendInterval:T.addFriendInterval,startTime:T.startTime||void 0,endTime:T.endTime||void 0,deviceGroups:(je=T.deviceGroups)!=null&&je.trim()?T.deviceGroups.split(",").map(We=>parseInt(We.trim(),10)).filter(We=>!Number.isNaN(We)):void 0},ue=await Ct("/api/db/persons",B);if(ue&&ue.success===!1){const We=ue;We.ckbResponse&&console.log("存客宝返回",We.ckbResponse);const ht=We.error||"操作失败";throw new Error(ht)}if(Fn(),Z.success(Po?"已保存":"已添加"),ue!=null&&ue.ckbCreateResult&&Object.keys(ue.ckbCreateResult).length>0){const We=ue.ckbCreateResult;console.log("存客宝创建结果",We);const ht=We.planId??We.id,At=ht!=null?[`planId: ${ht}`]:[];We.apiKey!=null&&At.push("apiKey: ***"),Z.info(At.length?`存客宝创建结果:${At.join(",")}`:"存客宝创建结果见控制台")}}}),s.jsx(Ft,{open:!!Ms,onOpenChange:T=>{T||ji(null)},children:s.jsxs(zt,{showCloseButton:!0,className:"bg-[#0f2137] border-gray-700 text-white max-w-md p-4 gap-3",children:[s.jsxs(Bt,{className:"gap-1",children:[s.jsx(Vt,{className:"text-white text-base",children:"确认删除"}),s.jsx(hf,{className:"text-gray-400 text-sm leading-relaxed wrap-break-word",children:Ms&&s.jsxs(s.Fragment,{children:[Ms.personSource==="vip_sync"?s.jsxs(s.Fragment,{children:[s.jsxs("p",{children:["确定删除超级个体「",Ms.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链接人与事-",Ms.name,"」?将同时删除存客宝对应获客计划。"]})}),s.jsxs("p",{className:"mt-1.5",children:["二次确认:删除后无法恢复,文章中的 @",Ms.name," 将无法正常跳转。"]})]})})]}),s.jsxs(yn,{className:"gap-2 sm:gap-2 pt-1",children:[s.jsx(Q,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-300",onClick:()=>ji(null),children:"取消"}),s.jsx(Q,{variant:"destructive",size:"sm",className:"bg-red-600 hover:bg-red-700",onClick:async()=>{Ms&&(await ui(`/api/db/persons?personId=${Ms.personId}`),ji(null),Fn(),Z.success("已删除"))},children:"确定删除"})]})]})}),s.jsx(Ft,{open:ar,onOpenChange:Lo,children:s.jsxs(zt,{className:"max-w-2xl bg-[#0f2137] border-gray-700",children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[s.jsx(Dn,{className:"w-5 h-5 text-green-400"}),$a," — 获客详情(共 ",Yn," 条)"]})}),s.jsx("div",{className:"max-h-[450px] overflow-y-auto space-y-2",children:ki?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:"加载中..."})]}):wn.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:"时间"})]}),wn.map((T,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:(Br-1)*20+B+1}),s.jsx("span",{className:"text-white truncate",children:T.nickname||T.name||T.userId||"-"}),s.jsx("span",{className:"text-gray-300 text-xs",children:T.phone||"-"}),s.jsx("span",{className:"text-gray-300 text-xs truncate",children:T.wechatId||"-"}),s.jsx("span",{className:"text-xs",children:T.source==="article_mention"?s.jsx("span",{className:"text-purple-400",children:"文章@"}):T.source==="index_lead"?s.jsx("span",{className:"text-blue-400",children:"首页"}):s.jsx("span",{className:"text-gray-500",children:T.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:T.createdAt?new Date(T.createdAt).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"-"})]},T.id))]})}),Yn>20&&s.jsxs("div",{className:"flex items-center justify-center gap-2 pt-2",children:[s.jsx(Q,{size:"sm",variant:"outline",disabled:Br<=1,onClick:()=>Wr(ua,$a,Br-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:[Br," / ",Math.ceil(Yn/20)]}),s.jsx(Q,{size:"sm",variant:"outline",disabled:Br>=Math.ceil(Yn/20),onClick:()=>Wr(ua,$a,Br+1),className:"border-gray-600 text-gray-300 bg-transparent h-7 px-3",children:"下一页"})]})]})})]})}const ci={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 oj(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):ci.stats}function lj(t){return Array.isArray(t)?t.map(e=>typeof e=="string"?e:String(e??"")).filter(Boolean):ci.highlights}function sV(){const[t,e]=y.useState(ci),[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 E=k==null?void 0:k.data;E&&typeof E=="object"&&e({name:String(E.name??ci.name),avatar:String(E.avatar??ci.avatar),avatarImg:String(E.avatarImg??""),title:String(E.title??ci.title),bio:String(E.bio??ci.bio),stats:oj(E.stats).length?oj(E.stats):ci.stats,highlights:lj(E.highlights).length?lj(E.highlights):ci.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(R=>R.label||R.value),highlights:t.highlights.filter(Boolean)},E=await Ct("/api/admin/author-settings",k);if(!E||E.success===!1){Z.error("保存失败: "+(E&&typeof E=="object"&&"error"in E?E.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),Z.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{i(!1)}},f=async k=>{var C;const E=(C=k.target.files)==null?void 0:C[0];if(E){c(!0);try{const R=new FormData;R.append("file",E),R.append("folder","avatars");const L=yu(),q={};L&&(q.Authorization=`Bearer ${L}`);const H=await(await fetch(bl("/api/upload"),{method:"POST",body:R,credentials:"include",headers:q})).json();H!=null&&H.success&&(H!=null&&H.url)?e(P=>({...P,avatarImg:H.url})):Z.error("上传失败: "+((H==null?void 0:H.error)||"未知错误"))}catch(R){console.error(R),Z.error("上传失败")}finally{c(!1),u.current&&(u.current.value="")}}},m=()=>e(k=>({...k,stats:[...k.stats,{label:"",value:""}]})),x=k=>e(E=>({...E,stats:E.stats.filter((C,R)=>R!==k)})),b=(k,E,C)=>e(R=>({...R,stats:R.stats.map((L,q)=>q===k?{...L,[E]:C}:L)})),v=()=>e(k=>({...k,highlights:[...k.highlights,""]})),w=k=>e(E=>({...E,highlights:E.highlights.filter((C,R)=>R!==k)})),N=(k,E)=>e(C=>({...C,highlights:C.highlights.map((R,L)=>L===k?E:R)}));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(di,{className:"w-5 h-5 text-[#38bdac]"}),"作者详情"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置小程序「关于作者」页展示的作者信息,包括头像、简介、统计数据与亮点标签。"})]}),s.jsxs(Q,{onClick:h,disabled:a||n,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{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(dt,{children:[s.jsxs(ut,{className:"flex items-center gap-2 text-white",children:[s.jsx(di,{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(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.name,onChange:k=>e(E=>({...E,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(E=>({...E,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(Fj,{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(E=>({...E,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(Q,{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(lf,{className:"w-4 h-4 mr-2"}),o?"上传中...":"上传"]})]}),t.avatarImg&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:Ea(t.avatarImg.startsWith("http")?t.avatarImg:bl(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(E=>({...E,title:k.target.value})),placeholder:"Soul派对房主理人 · 私域运营专家"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"个人简介"}),s.jsx(kl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[120px]",value:t.bio,onChange:k=>e(E=>({...E,bio:k.target.value})),placeholder:"每天早上6点到9点..."})]})]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{children:[s.jsx(ut,{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,E)=>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(E,"label",C.target.value),placeholder:"标签"}),s.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.value,onChange:C=>b(E,"value",C.target.value),placeholder:"数值"}),s.jsx(Q,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>x(E),children:s.jsx(Jn,{className:"w-4 h-4"})})]},E)),s.jsxs(Q,{variant:"outline",size:"sm",onClick:m,className:"border-gray-600 text-gray-400",children:[s.jsx(On,{className:"w-4 h-4 mr-2"}),"添加统计项"]})]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{children:[s.jsx(ut,{className:"text-white",children:"亮点标签"}),s.jsx(Xt,{className:"text-gray-400",children:"作者优势或成就的简短描述,以标签形式展示。"})]}),s.jsxs($e,{className:"space-y-3",children:[t.highlights.map((k,E)=>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(E,C.target.value),placeholder:"5年私域运营经验"}),s.jsx(Q,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>w(E),children:s.jsx(Jn,{className:"w-4 h-4"})})]},E)),s.jsxs(Q,{variant:"outline",size:"sm",onClick:v,className:"border-gray-600 text-gray-400",children:[s.jsx(On,{className:"w-4 h-4 mr-2"}),"添加亮点"]})]})]})]})]})}function rV(t){return confirm(`确定删除该${t}?此操作不可恢复。`)?window.prompt(`请输入「删除」以确认删除${t}`)==="删除":!1}function aV(){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=jl(h,300),[x,b]=y.useState(!0),[v,w]=y.useState(null),[N,k]=y.useState(!1),[E,C]=y.useState(null),[R,L]=y.useState(""),[q,_]=y.useState(""),[H,P]=y.useState(""),[se,Y]=y.useState("admin"),[V,ae]=y.useState("active"),[le,de]=y.useState(!1);async function I(){var U;b(!0),w(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)):w(he.error||"加载失败")}catch(fe){const he=fe;w(he.status===403?"无权限访问":((U=he==null?void 0:he.data)==null?void 0:U.error)||"加载失败"),e([])}finally{b(!1)}}y.useEffect(()=>{I()},[a,o,m]);const G=()=>{C(null),L(""),_(""),P(""),Y("admin"),ae("active"),k(!0)},z=U=>{C(U),L(U.username),_(""),P(U.name||""),Y(U.role==="super_admin"?"super_admin":"admin"),ae(U.status==="disabled"?"disabled":"active"),k(!0)},me=async()=>{var U;if(!R.trim()){w("用户名不能为空");return}if(!E&&!q){w("新建时密码必填,至少 6 位");return}if(q&&q.length<6){w("密码至少 6 位");return}w(null),de(!0);try{if(E){const fe=await Yt("/api/admin/users",{id:E.id,password:q||void 0,name:H.trim(),role:se,status:V});fe!=null&&fe.success?(k(!1),I()):w((fe==null?void 0:fe.error)||"保存失败")}else{const fe=await Ct("/api/admin/users",{username:R.trim(),password:q,name:H.trim(),role:se});fe!=null&&fe.success?(k(!1),I()):w((fe==null?void 0:fe.error)||"保存失败")}}catch(fe){const he=fe;w(((U=he==null?void 0:he.data)==null?void 0:U.error)||"保存失败")}finally{de(!1)}},X=async U=>{var fe;if(!rV("管理员")){w("已取消删除");return}try{const he=await ui(`/api/admin/users?id=${U}`);he!=null&&he.success?I():w((he==null?void 0:he.error)||"删除失败")}catch(he){const oe=he;w(((fe=oe==null?void 0:oe.data)==null?void 0:fe.error)||"删除失败")}},F=U=>{if(!U)return"-";try{const fe=new Date(U);return isNaN(fe.getTime())?U:fe.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(kc,{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(Q,{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(Q,{onClick:G,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(On,{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($e,{className:"p-0",children:x?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(s.Fragment,{children:[s.jsxs(hs,{children:[s.jsx(fs,{children:s.jsxs(gt,{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(ps,{children:[t.map(U=>s.jsxs(gt,{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(Q,{variant:"ghost",size:"sm",onClick:()=>z(U),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(en,{className:"w-4 h-4"})}),s.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>X(U.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(Ns,{className:"w-4 h-4"})})]})]},U.id)),t.length===0&&!x&&s.jsx(gt,{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(Xs,{page:a,pageSize:o,total:n,totalPages:c,onPageChange:i})})]})})}),s.jsx(Ft,{open:N,onOpenChange:k,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(Bt,{children:s.jsx(Vt,{className:"text-white",children:E?"编辑管理员":"新增管理员"})}),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:R,onChange:U=>L(U.target.value),disabled:!!E}),E&&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:E?"新密码(留空不改)":"密码"}),s.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:E?"留空表示不修改":"至少 6 位",value:q,onChange:U=>_(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=>P(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=>Y(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:"超级管理员"})]})]}),E&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(ne,{className:"text-gray-300",children:"状态"}),s.jsxs("select",{value:V,onChange:U=>ae(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(yn,{children:[s.jsxs(Q,{variant:"outline",onClick:()=>k(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(Jn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(Q,{onClick:me,disabled:le,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),le?"保存中...":"保存"]})]})]})})]})}function Mn({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 E4(){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(dt,{className:"pb-3",children:s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(vg,{className:"w-5 h-5 text-[#38bdac]"}),"1. Authentication"]})}),s.jsx($e,{className:"space-y-4",children:s.jsx(Mn,{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(dt,{className:"pb-3",children:s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(Zs,{className:"w-5 h-5 text-[#38bdac]"}),"2. 章节管理 (Chapters)"]})}),s.jsxs($e,{className:"space-y-4",children:[s.jsx(Mn,{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(Mn,{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(Mn,{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(Mn,{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(Mn,{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(Mn,{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(Mn,{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(dt,{className:"pb-3",children:s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(di,{className:"w-5 h-5 text-[#38bdac]"}),"3. 人物管理 (@Mentions)"]})}),s.jsxs($e,{className:"space-y-4",children:[s.jsx(Mn,{method:"GET",url:"/api/db/persons",desc:"人物列表",headers:t,response:`{ + "success": true, + "data": [ + { "personId": "p1", "label": "张三", "aliases": ["老张"], ... } + ] +}`}),s.jsx(Mn,{method:"GET",url:"/api/db/person?personId={id}",desc:"人物详情",headers:t,response:`{ + "success": true, + "data": { + "personId": "p1", + "label": "张三", + "aliases": ["老张"], + "description": "..." + } +}`}),s.jsx(Mn,{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(Mn,{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(dt,{className:"pb-3",children:s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(Hd,{className:"w-5 h-5 text-[#38bdac]"}),"4. 链接标签 (#LinkTags)"]})}),s.jsxs($e,{className:"space-y-4",children:[s.jsx(Mn,{method:"GET",url:"/api/db/link-tags",desc:"标签列表",headers:t,response:`{ + "success": true, + "data": [ + { "tagId": "t1", "label": "官网", "aliases": [], "type": "url", "url": "https://..." } + ] +}`}),s.jsx(Mn,{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(Mn,{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(dt,{className:"pb-3",children:s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(Ca,{className:"w-5 h-5 text-[#38bdac]"}),"5. 内容搜索"]})}),s.jsx($e,{className:"space-y-4",children:s.jsx(Mn,{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(dt,{className:"pb-3",children:s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(wg,{className:"w-5 h-5 text-[#38bdac]"}),"6. 内容排行"]})}),s.jsx($e,{className:"space-y-4",children:s.jsx(Mn,{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(dt,{className:"pb-3",children:s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(yl,{className:"w-5 h-5 text-[#38bdac]"}),"7. 小程序接口"]})}),s.jsxs($e,{className:"space-y-4",children:[s.jsx(Mn,{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(Mn,{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(Mn,{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(Mn,{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(Mn,{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 iV={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},oV={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},lV={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...oV},ckbLeadApiKey:""},cV={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0},dV={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"}},uV=["system","author","admin","api-docs"],cj=["basic","mp","oss","features"];function hV(){const[t,e]=T0(),n=t.get("tab")??"system",r=uV.includes(n)?n:"system",a=t.get("section")??"basic",i=cj.includes(a)?a:"basic",[o,c]=y.useState(lV),[u,h]=y.useState(cV),[f,m]=y.useState(iV),[x,b]=y.useState("{}"),[v,w]=y.useState("NEW"),[N,k]=y.useState({}),[E,C]=y.useState(!1),[R,L]=y.useState(!0),[q,_]=y.useState(!1),[H,P]=y.useState(""),[se,Y]=y.useState(""),[V,ae]=y.useState(!1),[le,de]=y.useState(!1),I=(oe,O,K=!1)=>{P(oe),Y(O),ae(K),_(!0)};y.useEffect(()=>{(async()=>{try{const O=await Oe("/api/admin/settings");if(!O||O.success===!1)return;if(O.featureConfig&&Object.keys(O.featureConfig).length&&h(K=>({...K,...O.featureConfig})),O.mpConfig&&typeof O.mpConfig=="object"){const K={...O.mpConfig};m(ze=>({...ze,...K}));const D=K.mpUi,J=D!=null&&typeof D=="object"&&!Array.isArray(D)?D:{},te=J.chaptersPage&&typeof J.chaptersPage=="object"&&!Array.isArray(J.chaptersPage)?J.chaptersPage:{},be=te.newBadgeText??te.sectionNewBadgeText;w(typeof be=="string"&&be.trim()?be.trim():"NEW"),b(JSON.stringify(J,null,2))}if(O.ossConfig&&typeof O.ossConfig=="object"&&k(K=>({...K,...O.ossConfig})),O.siteSettings&&typeof O.siteSettings=="object"){const K=O.siteSettings;c(D=>({...D,...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:{...D.authorInfo,...K.authorInfo}},...typeof K.ckbLeadApiKey=="string"&&{ckbLeadApiKey:K.ckbLeadApiKey}}))}}catch(O){console.error("Load settings error:",O)}finally{L(!1)}})()},[]);const G=async(oe,O)=>{de(!0);try{const K=await Ct("/api/admin/settings",{featureConfig:oe});if(!K||K.success===!1){O(),I("保存失败",(K==null?void 0:K.error)??"未知错误",!0);return}I("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(K){console.error("Save feature config error:",K),O(),I("保存失败",K instanceof Error?K.message:String(K),!0)}finally{de(!1)}},z=(oe,O)=>{const K=u,D={...K,[oe]:O};h(D),G(D,()=>h(K))},[me,X]=y.useState(!1),F=async oe=>{const O=f,K={...O,auditMode:oe};m(K),X(!0);try{const D=await Ct("/api/admin/settings",{mpConfig:K});if(!D||D.success===!1){m(O),I("保存失败",(D==null?void 0:D.error)??"未知错误",!0);return}I("已保存",oe?"审核模式已开启,小程序将隐藏所有支付入口。":"审核模式已关闭,支付功能已恢复。")}catch(D){m(O),I("保存失败",D instanceof Error?D.message:String(D),!0)}finally{X(!1)}},U=async()=>{C(!0);try{let oe={};try{const te=x.trim();if(te){const be=JSON.parse(te);if(be&&typeof be=="object"&&!Array.isArray(be))oe=be;else{I("保存失败","小程序文案 mpUi 须为 JSON 对象(非数组)",!0),C(!1);return}}}catch{I("保存失败","小程序文案 mpUi 不是合法 JSON",!0),C(!1);return}const O=oe.chaptersPage,K=O&&typeof O=="object"&&!Array.isArray(O)?{...O}:{},D=v.trim();D?K.newBadgeText=D:delete K.newBadgeText,delete K.sectionNewBadgeText,oe.chaptersPage=K;const J=await Ct("/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(!J||J.success===!1){I("保存失败",(J==null?void 0:J.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 O=new URLSearchParams(t);O.delete("tab"),cj.includes(O.get("section")||"basic")||O.set("section","basic"),e(O);return}e({tab:oe})},he=oe=>{const O=new URLSearchParams(t);O.delete("tab"),O.set("section",oe),e(O)};return R?s.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-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(Q,{onClick:U,disabled:E,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),E?"保存中...":"保存设置"]})]}),s.jsxs(Oc,{value:r,onValueChange:fe,className:"w-full",children:[s.jsxs(wl,{className:"mb-6 bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(tn,{value:"system",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(co,{className:"w-4 h-4 mr-2"}),"系统设置"]}),s.jsxs(tn,{value:"author",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(vh,{className:"w-4 h-4 mr-2"}),"作者详情"]}),s.jsxs(tn,{value:"admin",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(kc,{className:"w-4 h-4 mr-2"}),"管理员"]}),s.jsxs(tn,{value:"api-docs",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",onClick:oe=>{oe.preventDefault(),window.open("/api-docs","_blank")},children:[s.jsx($j,{className:"w-4 h-4 mr-2"}),"API 文档 ↗"]})]}),s.jsxs(nn,{value:"system",className:"mt-0",children:[s.jsxs("p",{className:"text-xs text-gray-500 mb-3",children:["MBTI 默认头像已迁至"," ",s.jsx(Pc,{to:"/users",className:"text-[#38bdac] underline",children:"用户管理(用户列表点头像打开)"})]}),s.jsxs(Oc,{value:i,onValueChange:he,className:"w-full",children:[s.jsxs(wl,{className:"mb-4 bg-[#0a1628] border border-gray-700/50 p-1 flex-wrap h-auto gap-1",children:[s.jsxs(tn,{value:"basic",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(cM,{className:"w-3.5 h-3.5 mr-1"}),"基础与价格"]}),s.jsxs(tn,{value:"mp",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(yl,{className:"w-3.5 h-3.5 mr-1"}),"小程序与审核"]}),s.jsxs(tn,{value:"oss",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(x1,{className:"w-3.5 h-3.5 mr-1"}),"OSS"]}),s.jsxs(tn,{value:"features",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(co,{className:"w-3.5 h-3.5 mr-1"}),"功能开关"]})]}),s.jsxs(nn,{value:"basic",className:"space-y-6 mt-0",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{children:[s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(vh,{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(vh,{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(O=>({...O,authorInfo:{...O.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(mg,{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(O=>({...O,authorInfo:{...O.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(mg,{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(O=>({...O,authorInfo:{...O.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(Bj,{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(O=>({...O,authorInfo:{...O.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(Zs,{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(O=>({...O,authorInfo:{...O.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(kl,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:o.authorInfo.bio??"",onChange:oe=>c(O=>({...O,authorInfo:{...O.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(ka,{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(O=>({...O,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(dt,{children:[s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(rf,{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(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.sectionPrice,onChange:oe=>c(O=>({...O,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(O=>({...O,baseBookPrice:Number.parseFloat(oe.target.value)||9.9}))})]})]})})]})]}),s.jsxs(nn,{value:"mp",className:"space-y-6 mt-0",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{children:[s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(yl,{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(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:f.appId??"",onChange:oe=>m(O=>({...O,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(O=>({...O,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(O=>({...O,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(O=>({...O,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(Q,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-200",onClick:()=>b(JSON.stringify(dV,null,2)),children:"填入默认模板"})]}),s.jsx("p",{className:"text-xs text-gray-500",children:"覆盖 Tab 文案、首页/目录标题、我的页名片与阅读记录路径等;仅填需要改的字段也可(与后端默认值深合并)。保存后小程序约 5 分钟内通过 config 缓存刷新。"}),s.jsx(kl,{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(dt,{children:[s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(kc,{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(kc,{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(Ht,{id:"audit-mode",checked:f.auditMode??!1,disabled:me,onCheckedChange:F})]})})]})]}),s.jsx(nn,{value:"oss",className:"space-y-6 mt-0",children:s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{children:[s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(x1,{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(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"oss-cn-hangzhou.aliyuncs.com",value:N.endpoint??"",onChange:oe=>k(O=>({...O,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(O=>({...O,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(O=>({...O,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(O=>({...O,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(O=>({...O,accessKeySecret:oe.target.value}))})]})]})})]})}),s.jsxs(nn,{value:"features",className:"space-y-6 mt-0",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{children:[s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(co,{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(Dn,{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(Ht,{id:"match-enabled",checked:u.matchEnabled,disabled:le,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(yg,{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(Pc,{to:"/distribution?tab=settings",className:"underline mx-1 text-[#38bdac]",children:"推广中心 → 推广设置"}),"为同一套接口,在此仅控制是否展示入口。"]})]}),s.jsx(Ht,{id:"referral-enabled",checked:u.referralEnabled,disabled:le,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(Zs,{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(Ht,{id:"search-enabled",checked:u.searchEnabled,disabled:le,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(co,{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(Ht,{id:"about-enabled",checked:u.aboutEnabled,disabled:le,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(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{children:[s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(af,{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(Dn,{className:"w-3 h-3"})},{mod:"推广中心 / 推荐好友",ctrl:"推广功能开关",icon:s.jsx(yg,{className:"w-3 h-3"})},{mod:"搜索",ctrl:"搜索功能开关",icon:s.jsx(Zs,{className:"w-3 h-3"})},{mod:"关于页面",ctrl:"关于页面开关",icon:s.jsx(vh,{className:"w-3 h-3"})},{mod:"支付 / VIP / 充值 / 收益",ctrl:"审核模式",icon:s.jsx(kc,{className:"w-3 h-3"})},{mod:"超级个体名片",ctrl:"审核模式",icon:s.jsx(aA,{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(nn,{value:"author",className:"mt-0",children:s.jsx(sV,{})}),s.jsx(nn,{value:"admin",className:"mt-0",children:s.jsx(aV,{})}),s.jsx(nn,{value:"api-docs",className:"mt-0",children:s.jsx(E4,{})})]}),s.jsx(Ft,{open:q,onOpenChange:_,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsxs(Bt,{children:[s.jsx(Vt,{className:V?"text-red-400":"text-[#38bdac]",children:H}),s.jsx(hf,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:se})]}),s.jsx(yn,{className:"mt-4",children:s.jsx(Q,{onClick:()=>_(!1),className:V?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const dj={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 fV(){const[t,e]=y.useState(!1),[n,r]=y.useState(dj),[a,i]=y.useState(""),o=async()=>{e(!0);try{const k=await Oe("/api/config");k!=null&&k.paymentMethods&&r({...dj,...k.paymentMethods})}catch(k){console.error(k)}finally{e(!1)}};y.useEffect(()=>{o()},[]);const c=async()=>{e(!0);try{await Ct("/api/db/config",{key:"payment_methods",value:n,description:"支付方式配置"}),Z.success("配置已保存!")}catch(k){console.error("保存失败:",k),Z.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{e(!1)}},u=(k,E)=>{navigator.clipboard.writeText(k),i(E),setTimeout(()=>i(""),2e3)},h=(k,E)=>{r(C=>({...C,wechat:{...C.wechat,[k]:E}}))},f=(k,E)=>{r(C=>({...C,alipay:{...C.alipay,[k]:E}}))},m=(k,E)=>{r(C=>({...C,usdt:{...C.usdt,[k]:E}}))},x=(k,E)=>{r(C=>({...C,paypal:{...C.paypal,[k]:E}}))},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(Q,{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(Q,{onClick:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{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(Oj,{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(Oc,{defaultValue:"wechat",className:"space-y-6",children:[s.jsxs(wl,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[s.jsxs(tn,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[s.jsx(yl,{className:"w-4 h-4 mr-2"}),"微信"]}),s.jsxs(tn,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[s.jsx(g1,{className:"w-4 h-4 mr-2"}),"支付宝"]}),s.jsxs(tn,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[s.jsx(m1,{className:"w-4 h-4 mr-2"}),"USDT"]}),s.jsxs(tn,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[s.jsx(bg,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),s.jsx(nn,{value:"wechat",className:"space-y-4",children:s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(ut,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(yl,{className:"w-5 h-5"}),"微信支付配置"]}),s.jsx(Xt,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),s.jsx(Ht,{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(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(xi,{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(nn,{value:"alipay",className:"space-y-4",children:s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(ut,{className:"text-[#1677FF] flex items-center gap-2",children:[s.jsx(g1,{className:"w-5 h-5"}),"支付宝配置"]}),s.jsx(Xt,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),s.jsx(Ht,{checked:!!v.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(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(Q,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>u(String(v.partnerId??""),"pid"),children:a==="pid"?s.jsx(dp,{className:"w-4 h-4 text-green-500"}):s.jsx(_j,{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(xi,{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(nn,{value:"usdt",className:"space-y-4",children:s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(ut,{className:"text-[#26A17B] flex items-center gap-2",children:[s.jsx(m1,{className:"w-5 h-5"}),"USDT配置"]}),s.jsx(Xt,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),s.jsx(Ht,{checked:!!w.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(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(nn,{value:"paypal",className:"space-y-4",children:s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(ut,{className:"text-[#169BD7] flex items-center gap-2",children:[s.jsx(bg,{className:"w-5 h-5"}),"PayPal配置"]}),s.jsx(Xt,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),s.jsx(Ht,{checked:!!N.enabled,onCheckedChange:k=>x("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(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 pV={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},mV={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 gV(){const[t,e]=y.useState({siteConfig:{...pV},menuConfig:{...mV},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 Ct("/api/db/config",{key:"site_config",value:t.siteConfig,description:"网站基础配置"}),await Ct("/api/db/config",{key:"menu_config",value:t.menuConfig,description:"底部菜单配置"}),await Ct("/api/db/config",{key:"page_config",value:t.pageConfig,description:"页面标题配置"}),r(!0),setTimeout(()=>r(!1),2e3),Z.success("配置已保存")}catch(f){console.error(f),Z.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(Q,{onClick:o,disabled:a,className:`${n?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[s.jsx(Sn,{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(dt,{children:[s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(bg,{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(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(dt,{children:[s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(MM,{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(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(dt,{children:[s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(wM,{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(Ht,{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(dt,{children:[s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx($j,{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(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 yV(){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"),E=(v=(b=k==null?void 0:k.liveQRCodes)==null?void 0:b[0])==null?void 0:v.urls;Array.isArray(E)&&e(E.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 Ct("/api/db/config",{key:"live_qr_codes",value:v,description:"群活码配置"}),Z.success("群活码配置已保存!"),await u()}catch(b){console.error(b),Z.error("保存失败: "+(b instanceof Error?b.message:String(b)))}},m=async()=>{var b;try{await Ct("/api/db/config",{key:"payment_methods",value:{...o.paymentMethods||{},wechat:{...((b=o.paymentMethods)==null?void 0:b.wechat)||{},groupQrCode:n}},description:"支付方式配置"}),Z.success("微信群链接已保存!用户支付成功后将自动跳转"),await u()}catch(v){console.error(v),Z.error("保存失败: "+(v instanceof Error?v.message:String(v)))}},x=()=>{n?window.open(n,"_blank"):Z.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(Oj,{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(dt,{children:[s.jsxs(ut,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(w1,{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(Ng,{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(Q,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>h(n,"group"),children:a==="group"?s.jsx(dp,{className:"w-4 h-4 text-green-500"}):s.jsx(_j,{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(xi,{className:"w-3 h-3"}),"支持格式:草料短链、微信群链接(https://weixin.qq.com/g/...)、企业微信链接等"]})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(Q,{onClick:m,className:"flex-1 bg-[#07C160] hover:bg-[#06AD51] text-white",children:[s.jsx(lf,{className:"w-4 h-4 mr-2"}),"保存配置"]}),s.jsxs(Q,{onClick:x,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[s.jsx(xi,{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(dt,{children:[s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(w1,{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(Ng,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),s.jsx(kl,{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(Q,{onClick:f,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(lf,{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 uj={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}},bV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function vV(){const[t,e]=y.useState(uj),[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"),R=(C==null?void 0:C.data)??(C==null?void 0:C.config);R&&e({...uj,...R})}catch(C){console.error("加载匹配配置失败:",C)}finally{r(!1)}};y.useEffect(()=>{x()},[]);const b=async()=>{i(!0);try{const C=await Ct("/api/db/config",{key:"match_config",value:t,description:"匹配功能配置"});C&&C.success!==!1?Z.success("配置保存成功!"):Z.error("保存失败: "+(C&&typeof C=="object"&&"error"in C?C.error:"未知错误"))}catch(C){console.error("保存配置失败:",C),Z.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){Z.error("请填写类型ID和名称");return}const C=[...t.matchTypes];if(u){const R=C.findIndex(L=>L.id===u.id);R!==-1&&(C[R]={...f})}else{if(C.some(R=>R.id===f.id)){Z.error("类型ID已存在");return}C.push({...f})}e({...t,matchTypes:C}),c(!1)},k=C=>{confirm("确定要删除这个匹配类型吗?")&&e({...t,matchTypes:t.matchTypes.filter(R=>R.id!==C)})},E=C=>{e({...t,matchTypes:t.matchTypes.map(R=>R.id===C?{...R,enabled:!R.enabled}:R)})};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(co,{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(Q,{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(Q,{onClick:b,disabled:a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存配置"]})]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(dt,{children:[s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(gi,{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(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(Ht,{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(Ht,{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(dt,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(Dn,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),s.jsx(Xt,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(Q,{onClick:w,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(On,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),s.jsx($e,{children:s.jsxs(hs,{children:[s.jsx(fs,{children:s.jsxs(gt,{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(ps,{children:t.matchTypes.map(C=>s.jsxs(gt,{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(Ht,{checked:C.enabled,onCheckedChange:()=>E(C.id)})}),s.jsx(ke,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>v(C),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(en,{className:"w-4 h-4"})}),s.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>k(C.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(Ns,{className:"w-4 h-4"})})]})})]},C.id))})]})})]}),s.jsx(Ft,{open:o,onOpenChange:c,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[u?s.jsx(en,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(On,{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:bV.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(Ht,{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(Ht,{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(Ht,{checked:f.enabled,onCheckedChange:C=>m({...f,enabled:C})}),s.jsx(ne,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(yn,{children:[s.jsx(Q,{variant:"outline",onClick:()=>c(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsxs(Q,{onClick:N,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const hj={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function NV(){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(hj).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($e,{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(hs,{children:[s.jsx(fs,{children:s.jsxs(gt,{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(ps,{children:[t.map(N=>s.jsxs(gt,{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:Ea(N.userAvatar),alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const E=k.currentTarget.nextElementSibling;E&&E.classList.remove("hidden")}}):null,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:Ea(N.matchedUserAvatar),alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const E=k.currentTarget.nextElementSibling;E&&E.classList.remove("hidden")}}):null,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:hj[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(gt,{children:s.jsx(ke,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(Xs,{page:a,totalPages:w,total:n,pageSize:o,onPageChange:i,onPageSizeChange:N=>{c(N),i(1)}})]})})})]})}function wV(){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),Z.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(Ec,{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($e,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(hs,{children:[s.jsx(fs,{children:s.jsxs(gt,{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(ps,{children:[t.map((i,o)=>{var c;return s.jsxs(gt,{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:Ea(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(gt,{children:s.jsx(ke,{colSpan:5,className:"text-center py-12 text-gray-500",children:"当前没有有效的超级个体用户。"})})]})]})})})]})}function M4(t){const e=Ra(),[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 P=>{var Y;const se=(Y=P.target.files)==null?void 0:Y[0];if(se){w(!0);try{const V=new FormData;V.append("file",se),V.append("folder","mentors");const ae=yu(),le={};ae&&(le.Authorization=`Bearer ${ae}`);const I=await(await fetch(bl("/api/upload"),{method:"POST",body:V,credentials:"include",headers:le})).json();I!=null&&I.success&&(I!=null&&I.url)?m(G=>({...G,avatar:I.url})):Z.error("上传失败: "+((I==null?void 0:I.error)||"未知错误"))}catch(V){console.error(V),Z.error("上传失败")}finally{w(!1),N.current&&(N.current.value="")}}};async function E(){i(!0);try{const P=await Oe("/api/db/mentors");P!=null&&P.success&&P.data&&r(P.data)}catch(P){console.error("Load mentors error:",P)}finally{i(!1)}}y.useEffect(()=>{E()},[]);const C=()=>{m({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:n.length>0?Math.max(...n.map(P=>P.sort))+1:0,enabled:!0})},R=()=>{h(null),C(),c(!0)},L=P=>{h(P),m({name:P.name,avatar:P.avatar||"",intro:P.intro||"",tags:P.tags||"",priceSingle:P.priceSingle!=null?String(P.priceSingle):"",priceHalfYear:P.priceHalfYear!=null?String(P.priceHalfYear):"",priceYear:P.priceYear!=null?String(P.priceYear):"",quote:P.quote||"",whyFind:P.whyFind||"",offering:P.offering||"",judgmentStyle:P.judgmentStyle||"",sort:P.sort,enabled:P.enabled??!0}),c(!0)},q=async()=>{if(!f.name.trim()){Z.error("导师姓名不能为空");return}b(!0);try{const P=Y=>Y===""?void 0:parseFloat(Y),se={name:f.name.trim(),avatar:f.avatar.trim()||void 0,intro:f.intro.trim()||void 0,tags:f.tags.trim()||void 0,priceSingle:P(f.priceSingle),priceHalfYear:P(f.priceHalfYear),priceYear:P(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 Y=await Yt("/api/db/mentors",{id:u.id,...se});Y!=null&&Y.success?(c(!1),E()):Z.error("更新失败: "+(Y==null?void 0:Y.error))}else{const Y=await Ct("/api/db/mentors",se);Y!=null&&Y.success?(c(!1),E()):Z.error("新增失败: "+(Y==null?void 0:Y.error))}}catch(P){console.error("Save error:",P),Z.error("保存失败")}finally{b(!1)}},_=async P=>{if(confirm("确定删除该导师?"))try{const se=await ui(`/api/db/mentors?id=${P}`);se!=null&&se.success?E():Z.error("删除失败: "+(se==null?void 0:se.error))}catch(se){console.error("Delete error:",se),Z.error("删除失败")}},H=P=>P!=null?`¥${P}`:"-";return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Dn,{className:"w-5 h-5 text-[#38bdac]"}),"导师管理"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师列表,支持每个导师独立配置单次/半年/年度价格"})]}),s.jsxs(Q,{onClick:R,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(On,{className:"w-4 h-4 mr-2"}),"新增导师"]})]}),s.jsx(_e,{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(hs,{children:[s.jsx(fs,{children:s.jsxs(gt,{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(ps,{children:[n.map(P=>s.jsxs(gt,{className:"border-gray-700/50",children:[s.jsx(ke,{className:"text-gray-300",children:P.id}),s.jsx(ke,{children:s.jsxs("button",{type:"button",onClick:()=>e(`/users?search=${encodeURIComponent(P.name)}`),className:"text-[#38bdac] hover:text-[#2da396] hover:underline flex items-center gap-1",title:"在用户管理中查看",children:[P.name,s.jsx(xi,{className:"w-3 h-3"})]})}),s.jsx(ke,{className:"text-gray-400 max-w-[200px] truncate",children:P.intro||"-"}),s.jsx(ke,{className:"text-gray-400",children:H(P.priceSingle)}),s.jsx(ke,{className:"text-gray-400",children:H(P.priceHalfYear)}),s.jsx(ke,{className:"text-gray-400",children:H(P.priceYear)}),s.jsx(ke,{className:"text-gray-400",children:P.sort}),s.jsxs(ke,{className:"text-right",children:[s.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>L(P),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(en,{className:"w-4 h-4"})}),s.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>_(P.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(Ns,{className:"w-4 h-4"})})]})]},P.id)),n.length===0&&s.jsx(gt,{children:s.jsx(ke,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无导师,点击「新增导师」添加"})})]})]})})}),s.jsx(Ft,{open:o,onOpenChange:c,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg max-h-[90vh] overflow-y-auto",children:[s.jsx(Bt,{children:s.jsx(Vt,{className:"text-white",children: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:P=>m(se=>({...se,name:P.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:P=>m(se=>({...se,sort:parseInt(P.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:P=>m(se=>({...se,avatar:P.target.value})),placeholder:"点击上传或粘贴图片地址"}),s.jsx("input",{ref:N,type:"file",accept:"image/*",className:"hidden",onChange:k}),s.jsxs(Q,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:v,onClick:()=>{var P;return(P=N.current)==null?void 0:P.click()},children:[s.jsx(lf,{className:"w-4 h-4 mr-2"}),v?"上传中...":"上传"]})]}),f.avatar&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:Ea(f.avatar.startsWith("http")?f.avatar:bl(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:P=>m(se=>({...se,intro:P.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:P=>m(se=>({...se,tags:P.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:P=>m(se=>({...se,priceSingle:P.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:P=>m(se=>({...se,priceHalfYear:P.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:P=>m(se=>({...se,priceYear:P.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:P=>m(se=>({...se,quote:P.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:P=>m(se=>({...se,whyFind:P.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:P=>m(se=>({...se,offering:P.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:P=>m(se=>({...se,judgmentStyle:P.target.value}))})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",id:"enabled",checked:f.enabled,onChange:P=>m(se=>({...se,enabled:P.target.checked})),className:"rounded border-gray-600 bg-[#0a1628]"}),s.jsx(ne,{htmlFor:"enabled",className:"text-gray-300 cursor-pointer",children:"上架(小程序可见)"})]})]}),s.jsxs(yn,{children:[s.jsxs(Q,{variant:"outline",onClick:()=>c(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(Jn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(Q,{onClick:q,disabled:x,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),x?"保存中...":"保存"]})]})]})})]})}function jV(){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(mg,{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(Q,{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($e,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(hs,{children:[s.jsx(fs,{children:s.jsxs(gt,{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(ps,{children:[t.map(h=>s.jsxs(gt,{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(gt,{children:s.jsx(ke,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}const Bd={poolSource:["vip"],requirePhone:!0,requireNickname:!0,requireAvatar:!1,requireBusiness:!1},fj={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:Bd},kV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function SV(){const t=Ra(),[e,n]=y.useState(fj),[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 P=await Oe("/api/db/match-pool-counts");P!=null&&P.success&&P.data&&v(P.data)}catch(P){console.error("加载池子人数失败:",P)}finally{N(!1)}},E=async()=>{a(!0);try{const P=await Oe("/api/db/config/full?key=match_config"),se=(P==null?void 0:P.data)??(P==null?void 0:P.config);if(se){let Y=se.poolSettings??Bd;Y.poolSource&&!Array.isArray(Y.poolSource)&&(Y={...Y,poolSource:[Y.poolSource]}),n({...fj,...se,poolSettings:Y})}}catch(P){console.error("加载匹配配置失败:",P)}finally{a(!1)}};y.useEffect(()=>{E(),k()},[]);const C=async()=>{o(!0);try{const P=await Ct("/api/db/config",{key:"match_config",value:e,description:"匹配功能配置"});Z.error((P==null?void 0:P.success)!==!1?"配置保存成功!":"保存失败: "+((P==null?void 0:P.error)||"未知错误"))}catch(P){console.error(P),Z.error("保存失败")}finally{o(!1)}},R=P=>{f(P),x({...P}),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){Z.error("请填写类型ID和名称");return}const P=[...e.matchTypes];if(h){const se=P.findIndex(Y=>Y.id===h.id);se!==-1&&(P[se]={...m})}else{if(P.some(se=>se.id===m.id)){Z.error("类型ID已存在");return}P.push({...m})}n({...e,matchTypes:P}),u(!1)},_=P=>{confirm("确定要删除这个匹配类型吗?")&&n({...e,matchTypes:e.matchTypes.filter(se=>se.id!==P)})},H=P=>{n({...e,matchTypes:e.matchTypes.map(se=>se.id===P?{...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(Q,{variant:"outline",onClick:E,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(Q,{onClick:C,disabled:i,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"})," ",i?"保存中...":"保存配置"]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(dt,{children:[s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(zj,{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(P=>{const se=e.poolSettings??Bd,V=(Array.isArray(se.poolSource)?se.poolSource:[se.poolSource]).includes(P.value),ae=b==null?void 0:b[P.countKey],le=()=>{const de=Array.isArray(se.poolSource)?[...se.poolSource]:[se.poolSource],I=V?de.filter(G=>G!==P.value):[...de,P.value];I.length===0&&I.push(P.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:P.icon}),s.jsx("span",{className:`text-sm font-medium ${V?"text-[#38bdac]":"text-gray-300"}`,children:P.label})]}),s.jsxs("span",{className:"text-lg font-bold text-white",children:[w?"...":ae??"-",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:P.desc}),s.jsx("span",{role:"link",tabIndex:0,onClick:de=>{de.stopPropagation(),t(`/users?pool=${P.value}`)},onKeyDown:de=>{de.key==="Enter"&&(de.stopPropagation(),t(`/users?pool=${P.value}`))},className:"text-[#38bdac] text-xs mt-2 inline-block hover:underline cursor-pointer",children:"查看用户列表 →"})]},P.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(P=>{const Y=(e.poolSettings??Bd)[P.key];return s.jsxs("div",{className:"flex items-center gap-3 bg-[#0a1628] rounded-lg p-3",children:[s.jsx(Ht,{checked:Y,onCheckedChange:V=>n({...e,poolSettings:{...e.poolSettings??Bd,[P.key]:V}})}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{children:P.icon}),s.jsx(ne,{className:"text-gray-300 text-sm",children:P.label})]})]},P.key)})})]})]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(dt,{children:[s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(gi,{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(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.freeMatchLimit,onChange:P=>n({...e,freeMatchLimit:parseInt(P.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:P=>n({...e,matchPrice:parseFloat(P.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:P=>n({...e,settings:{...e.settings,maxMatchesPerDay:parseInt(P.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(Ht,{checked:e.settings.enableFreeMatches,onCheckedChange:P=>n({...e,settings:{...e.settings,enableFreeMatches:P}})}),s.jsx(ne,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ht,{checked:e.settings.enablePaidMatches,onCheckedChange:P=>n({...e,settings:{...e.settings,enablePaidMatches:P}})}),s.jsx(ne,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(dt,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(Dn,{className:"w-5 h-5 text-[#38bdac]"})," 匹配类型管理"]}),s.jsx(Xt,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(Q,{onClick:L,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(On,{className:"w-4 h-4 mr-1"})," 添加类型"]})]}),s.jsx($e,{children:s.jsxs(hs,{children:[s.jsx(fs,{children:s.jsxs(gt,{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(ps,{children:e.matchTypes.map(P=>s.jsxs(gt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ke,{children:s.jsx("span",{className:"text-2xl",children:P.icon})}),s.jsx(ke,{className:"font-mono text-gray-300",children:P.id}),s.jsx(ke,{className:"text-white font-medium",children:P.label}),s.jsx(ke,{className:"text-gray-300",children:P.matchLabel}),s.jsx(ke,{children:s.jsxs(He,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",P.price]})}),s.jsx(ke,{children:P.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(Ht,{checked:P.enabled,onCheckedChange:()=>H(P.id)})}),s.jsx(ke,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>R(P),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(en,{className:"w-4 h-4"})}),s.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>_(P.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(Ns,{className:"w-4 h-4"})})]})})]},P.id))})]})})]}),s.jsx(Ft,{open:c,onOpenChange:u,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(Bt,{children:s.jsxs(Vt,{className:"text-white flex items-center gap-2",children:[h?s.jsx(en,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(On,{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:P=>x({...m,id:P.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:kV.map(P=>s.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${m.icon===P?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>x({...m,icon:P}),children:P},P))})]})]}),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:P=>x({...m,label:P.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:P=>x({...m,matchLabel:P.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:P=>x({...m,price:parseFloat(P.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(Ht,{checked:m.matchFromDB,onCheckedChange:P=>x({...m,matchFromDB:P})}),s.jsx(ne,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ht,{checked:m.showJoinAfterMatch,onCheckedChange:P=>x({...m,showJoinAfterMatch:P})}),s.jsx(ne,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ht,{checked:m.enabled,onCheckedChange:P=>x({...m,enabled:P})}),s.jsx(ne,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(yn,{children:[s.jsx(Q,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsxs(Q,{onClick:q,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"})," 保存"]})]})]})})]})}const pj={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function CV(){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 R=await Oe(`/api/db/match-records?${C}`);R!=null&&R.success?(e(R.records||[]),r(R.total??0)):b("加载匹配记录失败")}catch{b("加载失败,请检查网络后重试")}finally{m(!1)}}y.useEffect(()=>{N()},[a,u]);const k=Math.ceil(n/o)||1,E=({userId:C,nickname:R,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:Ea(L),alt:"",className:"w-full h-full object-cover",onError:q=>{q.currentTarget.style.display="none"}}):null,s.jsx("span",{className:L?"hidden":"",children:(R||C||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white group-hover:text-[#38bdac] transition-colors",children:R||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(pj).map(([C,R])=>s.jsx("option",{value:C,children:R},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($e,{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(hs,{children:[s.jsx(fs,{children:s.jsxs(gt,{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(ps,{children:[t.map(C=>s.jsxs(gt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(ke,{children:s.jsx(E,{userId:C.userId,nickname:C.userNickname,avatar:C.userAvatar})}),s.jsx(ke,{children:C.matchedUserId?s.jsx(E,{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:pj[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(gt,{children:s.jsx(ke,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(Xs,{page:a,totalPages:k,total:n,pageSize:o,onPageChange:i,onPageSizeChange:C=>{c(C),i(1)}})]})})}),s.jsx(V0,{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(CV,{}),t==="pool"&&s.jsx(SV,{})]})}const mj={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(!0),[f,m]=y.useState("investor"),[x,b]=y.useState(null);async function v(){h(!0);try{const E=new URLSearchParams({page:String(a),pageSize:String(o),matchType:f}),C=await Oe(`/api/db/match-records?${E}`);C!=null&&C.success&&(e(C.records||[]),r(C.total??0))}catch(E){console.error(E)}finally{h(!1)}}y.useEffect(()=>{v()},[a,f]);const w=async E=>{if(!E.phone&&!E.wechatId){Z.info("该记录无联系方式,无法推送到存客宝");return}b(E.id);try{const C=await Ct("/api/ckb/join",{type:E.matchType||"investor",phone:E.phone||"",wechat:E.wechatId||"",userId:E.userId,name:E.userNickname||""});Z.error((C==null?void 0:C.message)||(C!=null&&C.success?"推送成功":"推送失败"))}catch(C){Z.error("推送失败: "+(C instanceof Error?C.message:"网络错误"))}finally{b(null)}},N=Math.ceil(n/o)||1,k=E=>!!(E.phone||E.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:E=>{m(E.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:Object.entries(mj).map(([E,C])=>s.jsx("option",{value:E,children:C},E))}),s.jsxs(Q,{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($e,{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(hs,{children:[s.jsx(fs,{children:s.jsxs(gt,{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(ps,{children:[t.map(E=>{var C,R;return s.jsxs(gt,{className:`border-gray-700/50 ${k(E)?"hover:bg-[#0a1628]":"opacity-60"}`,children:[s.jsx(ke,{className:"text-white",children:E.userNickname||((C=E.userId)==null?void 0:C.slice(0,12))}),s.jsx(ke,{className:"text-white",children:E.matchedNickname||((R=E.matchedUserId)==null?void 0:R.slice(0,12))}),s.jsx(ke,{children:s.jsx(He,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:mj[E.matchType]||E.matchType})}),s.jsxs(ke,{className:"text-sm",children:[E.phone&&s.jsxs("div",{className:"text-green-400",children:["📱 ",E.phone]}),E.wechatId&&s.jsxs("div",{className:"text-blue-400",children:["💬 ",E.wechatId]}),!E.phone&&!E.wechatId&&s.jsx("span",{className:"text-gray-600",children:"无联系方式"})]}),s.jsx(ke,{className:"text-gray-400 text-sm",children:E.createdAt?new Date(E.createdAt).toLocaleString():"-"}),s.jsx(ke,{className:"text-right",children:k(E)?s.jsxs(Q,{size:"sm",onClick:()=>w(E),disabled:x===E.id,className:"bg-[#38bdac] hover:bg-[#2da396] text-white text-xs h-7 px-3",children:[s.jsx(GM,{className:"w-3 h-3 mr-1"}),x===E.id?"推送中...":"推送CKB"]}):s.jsx("span",{className:"text-gray-600 text-xs",children:"—"})})]},E.id)}),t.length===0&&s.jsx(gt,{children:s.jsx(ke,{colSpan:6,className:"text-center py-12 text-gray-500",children:"暂无记录"})})]})]}),s.jsx(Xs,{page:a,totalPages:N,total:n,pageSize:o,onPageChange:i,onPageSizeChange:E=>{c(E),i(1)}})]})})})]})}const xj={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},MV={single:"单次",half_year:"半年",year:"年度"};function AV(){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(xj).map(([c,u])=>s.jsx("option",{value:c,children:u},c))]}),s.jsxs(Q,{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($e,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(hs,{children:[s.jsx(fs,{children:s.jsxs(gt,{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(ps,{children:[t.map(c=>s.jsxs(gt,{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:MV[c.consultationType]||c.consultationType}),s.jsxs(ke,{className:"text-white",children:["¥",c.amount]}),s.jsx(ke,{className:"text-gray-400",children:xj[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(gt,{children:s.jsx(ke,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}function IV(){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(AV,{}),t==="manage"&&s.jsx("div",{className:"-mx-8",children:s.jsx(M4,{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($e,{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(hs,{children:[s.jsx(fs,{children:s.jsxs(gt,{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(ps,{children:[t.map(x=>s.jsxs(gt,{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(gt,{children:s.jsx(ke,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无团队招募记录"})})]})]}),s.jsx(Xs,{page:a,totalPages:m,total:n,pageSize:o,onPageChange:i,onPageSizeChange:x=>{c(x),i(1)}})]})})})]})}const gj={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募",join:"加入",match:"匹配"},yj={partner:"⭐",investor:"👥",mentor:"❤️",team:"🎮",join:"📋",match:"🔗"};function PV({onSwitchTab:t,onOpenCKB:e}={}){const n=Ra(),[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 E=new Set(k.records.map(C=>C.userId).filter(Boolean));N={...N,uniqueUsers:E.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($e,{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(xi,{className:"w-2.5 h-2.5"})," 查看记录"]})]})}),s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/40",children:s.jsxs($e,{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(gi,{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($e,{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(Dn,{className:"w-2.5 h-2.5"})," 查看用户"]})]})}),s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/40",children:s.jsxs($e,{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($e,{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($e,{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:yj[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:gj[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($e,{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(ka,{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:yj[x.matchType]||"📋"}),s.jsx("span",{className:"text-gray-400",children:gj[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 LV=["partner","investor","mentor","team"],dg=[{key:"join_partner",label:"找伙伴场景"},{key:"join_investor",label:"资源对接场景"},{key:"join_mentor",label:"导师顾问场景"},{key:"join_team",label:"团队招募场景"},{key:"match",label:"匹配上报"},{key:"lead",label:"链接卡若"}],bj=`# 场景获客接口摘要 +- 地址: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(bj),[m,x]=y.useState(!1),[b,v]=y.useState(!1),[w,N]=y.useState([]),[k,E]=y.useState([]),[C,R]=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"}]),_=y.useMemo(()=>{const I={};return dg.forEach(G=>{I[G.key]=C[G.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 G=r.trim(),z=i.trim();return I<=3?{type:LV[I],phone:G||void 0,wechat:z||void 0,userId:"admin_test",name:"后台测试"}:I===4?{matchType:"partner",phone:G||void 0,wechat:z||void 0,userId:"admin_test",nickname:"后台测试",matchedUser:{id:"test",nickname:"测试",matchScore:88}}:I===5?{phone:G||void 0,wechatId:z||void 0,userId:"admin_test",name:"后台测试"}:{}};async function P(){v(!0);try{const[I,G,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")]),me=I==null?void 0:I.data;me!=null&&me.routes&&R(me.routes),me!=null&&me.docNotes&&u(me.docNotes),me!=null&&me.docContent&&f(me.docContent),G!=null&&G.success&&N(G.records||[]),z!=null&&z.success&&E(z.records||[])}finally{v(!1)}}y.useEffect(()=>{n(t)},[t]),y.useEffect(()=>{P()},[]);const se=y.useMemo(()=>{const I=F=>(F||"").replace(/\D/g,"")||"",G=F=>{const U=I(F.phone);if(U)return`phone:${U}`;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,U)=>{const fe=F.createdAt?new Date(F.createdAt).getTime():0;return(U.createdAt?new Date(U.createdAt).getTime():0)-fe}),me=new Set,X=[];for(const F of z){const U=G(F);me.has(U)||(me.add(U),X.push(F))}return X},[k]);async function Y(){x(!0);try{const I=await Ct("/api/db/config",{key:"ckb_config",value:{routes:_,docNotes:c,docContent:h},description:"存客宝接口配置"});Z.error((I==null?void 0:I.success)!==!1?"存客宝配置已保存":`保存失败: ${(I==null?void 0:I.error)||"未知错误"}`)}catch(I){Z.error(`保存失败: ${I instanceof Error?I.message:"网络错误"}`)}finally{x(!1)}}const V=(I,G)=>{R(z=>({...z,[I]:{..._[I],...G}}))},ae=async I=>{const G=L[I];if(G.method==="POST"&&!r.trim()&&!i.trim()){Z.error("请填写测试手机号");return}const z=[...L];z[I]={...G,status:"testing",message:void 0,responseTime:void 0},q(z);const me=performance.now();try{const X=G.method==="GET"?await Oe(G.endpoint):await Ct(G.endpoint,H(I)),F=Math.round(performance.now()-me),U=(X==null?void 0:X.message)||"",fe=(X==null?void 0:X.success)===!0||U.includes("已存在")||U.includes("已加入")||U.includes("已提交"),he=[...L];he[I]={...G,status:fe?"success":"error",message:U||(fe?"正常":"异常"),responseTime:F},q(he),await P()}catch(X){const F=Math.round(performance.now()-me),U=[...L];U[I]={...G,status:"error",message:X instanceof Error?X.message:"失败",responseTime:F},q(U)}},le=async()=>{if(!r.trim()&&!i.trim()){Z.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(yl,{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:G}),z?s.jsx("p",{className:"text-gray-500 text-sm mt-2 max-w-md mx-auto leading-relaxed",children:z}):null]})})}):I.map(me=>s.jsxs("tr",{className:"border-t border-gray-700/30",children:[s.jsx("td",{className:"px-4 py-3 text-white",children:me.userNickname||me.userId}),s.jsx("td",{className:"px-4 py-3 text-gray-300",children:me.matchType}),s.jsx("td",{className:"px-4 py-3 text-green-400",children:me.phone||"—"}),s.jsx("td",{className:"px-4 py-3 text-blue-400",children:me.wechatId||"—"}),s.jsx("td",{className:"px-4 py-3 text-gray-400",children:me.createdAt?new Date(me.createdAt).toLocaleString():"—"})]},String(me.id)))})]})});return s.jsx(_e,{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(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(xi,{className:"w-3 h-3"})," API 文档"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(Q,{onClick:()=>P(),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(Q,{onClick:Y,disabled:m,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{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,G])=>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:G},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:dg.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"&&de(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 仅保留最近一条)"]}),de(se,"暂无有联系方式线索","存客宝留资同步后显示;完整列表与筛选请前往「用户管理 → 获客列表」。")]}),e==="config"&&s.jsx("div",{className:"space-y-4",children:dg.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:_[I.key].apiUrl,onChange:G=>V(I.key,{apiUrl:G.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:_[I.key].apiKey,onChange:G=>V(I.key,{apiKey:G.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:_[I.key].source,onChange:G=>V(I.key,{source:G.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:_[I.key].tags,onChange:G=>V(I.key,{tags:G.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:_[I.key].siteTags,onChange:G=>V(I.key,{siteTags:G.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:_[I.key].notes,onChange:G=>V(I.key,{notes:G.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(yl,{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(Q,{onClick:le,className:"bg-orange-500 hover:bg-orange-600 text-white",children:[s.jsx(gi,{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,G)=>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(Lj,{className:"w-3 h-3 text-green-400 shrink-0"}),I.status==="error"&&s.jsx(Dj,{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:()=>ae(G),disabled:I.status==="testing",className:"text-orange-400/60 hover:text-orange-400 text-[10px] disabled:opacity-50",children:"测试"})]})]},`${I.endpoint}-${G}`))})]}),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(xi,{className:"w-3 h-3"})," 打开外链"]})]}),s.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-400 leading-6",children:h||bj})]}),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:"stats",label:"数据统计",icon:yc,desc:"匹配与获客概览"},{id:"partner",label:"找伙伴",icon:Dn,desc:"匹配池与记录"},{id:"resource",label:"资源对接",icon:W5,desc:"人脉资源"},{id:"mentor",label:"导师预约",icon:V5,desc:"预约与管理"},{id:"team",label:"团队招募",icon:Cc,desc:"团队协作"}];function _V(){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(Dn,{className:"w-5 h-5 text-[#38bdac]"}),"找伙伴"]}),s.jsx("p",{className:"text-gray-500 text-sm mt-0.5",children:"匹配、获客、导师与团队管理"})]}),s.jsxs(Q,{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(ka,{className:"w-3.5 h-3.5 mr-1.5"}),"存客宝",s.jsx(ol,{className:`w-3 h-3 ml-1 transition-transform ${n?"rotate-90":""}`})]})]}),n&&s.jsx(OV,{initialTab:a}),s.jsx("div",{className:"flex gap-1 mb-6 bg-[#0a1628] rounded-lg p-1 border border-gray-700/40",children:DV.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(PV,{onSwitchTab:o=>e(o),onOpenCKB:o=>{i(o||"overview"),r(!0)}}),t==="partner"&&s.jsx(TV,{}),t==="resource"&&s.jsx(EV,{}),t==="mentor"&&s.jsx(IV,{}),t==="team"&&s.jsx(RV,{})]})}function $V(){const t=Co();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(Pj,{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(Q,{asChild:!0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:s.jsxs(Pc,{to:"/",children:[s.jsx(eM,{className:"w-4 h-4 mr-2"}),"返回首页"]})})]})})}function zV(){return s.jsxs(_E,{children:[s.jsx(cn,{path:"/login",element:s.jsx(RI,{})}),s.jsxs(cn,{path:"/",element:s.jsx(OA,{}),children:[s.jsx(cn,{index:!0,element:s.jsx(bh,{to:"/dashboard",replace:!0})}),s.jsx(cn,{path:"dashboard",element:s.jsx(WP,{})}),s.jsx(cn,{path:"orders",element:s.jsx(KP,{})}),s.jsx(cn,{path:"users",element:s.jsx(ZP,{})}),s.jsx(cn,{path:"distribution",element:s.jsx(N8,{})}),s.jsx(cn,{path:"withdrawals",element:s.jsx(w8,{})}),s.jsx(cn,{path:"content",element:s.jsx(nV,{})}),s.jsx(cn,{path:"referral-settings",element:s.jsx(S2,{})}),s.jsx(cn,{path:"author-settings",element:s.jsx(bh,{to:"/settings?tab=author",replace:!0})}),s.jsx(cn,{path:"vip-roles",element:s.jsx(wV,{})}),s.jsx(cn,{path:"mentors",element:s.jsx(M4,{})}),s.jsx(cn,{path:"mentor-consultations",element:s.jsx(jV,{})}),s.jsx(cn,{path:"admin-users",element:s.jsx(bh,{to:"/settings?tab=admin",replace:!0})}),s.jsx(cn,{path:"settings",element:s.jsx(hV,{})}),s.jsx(cn,{path:"payment",element:s.jsx(fV,{})}),s.jsx(cn,{path:"site",element:s.jsx(gV,{})}),s.jsx(cn,{path:"qrcodes",element:s.jsx(yV,{})}),s.jsx(cn,{path:"find-partner",element:s.jsx(_V,{})}),s.jsx(cn,{path:"match",element:s.jsx(vV,{})}),s.jsx(cn,{path:"match-records",element:s.jsx(NV,{})}),s.jsx(cn,{path:"api-doc",element:s.jsx(bh,{to:"/api-docs",replace:!0})}),s.jsx(cn,{path:"api-docs",element:s.jsx(E4,{})})]}),s.jsx(cn,{path:"*",element:s.jsx($V,{})})]})}VT.createRoot(document.getElementById("root")).render(s.jsx(y.StrictMode,{children:s.jsx(WE,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:s.jsx(zV,{})})})); diff --git a/soul-admin/dist/assets/index-l3L5iIYa.js b/soul-admin/dist/assets/index-l3L5iIYa.js deleted file mode 100644 index 180dcaca..00000000 --- a/soul-admin/dist/assets/index-l3L5iIYa.js +++ /dev/null @@ -1,1010 +0,0 @@ -function RT(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 bj(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var cx={exports:{}},Td={},dx={exports:{}},Et={};/** - * @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 Qv;function PT(){if(Qv)return Et;Qv=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($){return $===null||typeof $!="object"?null:($=m&&$[m]||$["@@iterator"],typeof $=="function"?$:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,w={};function N($,U,ce){this.props=$,this.context=U,this.refs=w,this.updater=ce||y}N.prototype.isReactComponent={},N.prototype.setState=function($,U){if(typeof $!="object"&&typeof $!="function"&&$!=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,$,U,"setState")},N.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function k(){}k.prototype=N.prototype;function E($,U,ce){this.props=$,this.context=U,this.refs=w,this.updater=ce||y}var C=E.prototype=new k;C.constructor=E,v(C,N.prototype),C.isPureReactComponent=!0;var L=Array.isArray,O=Object.prototype.hasOwnProperty,K={current:null},_={key:!0,ref:!0,__self:!0,__source:!0};function H($,U,ce){var ue,oe={},F=null,G=null;if(U!=null)for(ue in U.ref!==void 0&&(G=U.ref),U.key!==void 0&&(F=""+U.key),U)O.call(U,ue)&&!_.hasOwnProperty(ue)&&(oe[ue]=U[ue]);var te=arguments.length-2;if(te===1)oe.children=ce;else if(1>>1,U=R[$];if(0>>1;$a(oe,q))Fa(G,oe)?(R[$]=G,R[F]=q,$=F):(R[$]=oe,R[ue]=q,$=ue);else if(Fa(G,q))R[$]=G,R[F]=q,$=F;else break e}}return ie}function a(R,ie){var q=R.sortIndex-ie.sortIndex;return q!==0?q:R.id-ie.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,y=!1,v=!1,w=!1,N=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(R){for(var ie=n(h);ie!==null;){if(ie.callback===null)r(h);else if(ie.startTime<=R)r(h),ie.sortIndex=ie.expirationTime,e(u,ie);else break;ie=n(h)}}function L(R){if(w=!1,C(R),!v)if(n(u)!==null)v=!0,I(O);else{var ie=n(h);ie!==null&&z(L,ie.startTime-R)}}function O(R,ie){v=!1,w&&(w=!1,k(H),H=-1),y=!0;var q=x;try{for(C(ie),m=n(u);m!==null&&(!(m.expirationTime>ie)||R&&!Q());){var $=m.callback;if(typeof $=="function"){m.callback=null,x=m.priorityLevel;var U=$(m.expirationTime<=ie);ie=t.unstable_now(),typeof U=="function"?m.callback=U:m===n(u)&&r(u),C(ie)}else r(u);m=n(u)}if(m!==null)var ce=!0;else{var ue=n(h);ue!==null&&z(L,ue.startTime-ie),ce=!1}return ce}finally{m=null,x=q,y=!1}}var K=!1,_=null,H=-1,P=5,ee=-1;function Q(){return!(t.unstable_now()-eeR||125$?(R.sortIndex=q,e(h,R),n(u)===null&&R===n(h)&&(w?(k(H),H=-1):w=!0,z(L,q-$))):(R.sortIndex=U,e(u,R),v||y||(v=!0,I(O))),R},t.unstable_shouldYield=Q,t.unstable_wrapCallback=function(R){var ie=x;return function(){var q=x;x=ie;try{return R.apply(this,arguments)}finally{x=q}}}})(fx)),fx}var t1;function _T(){return t1||(t1=1,hx.exports=DT()),hx.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 n1;function zT(){if(n1)return Qs;n1=1;var t=mu(),e=_T();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 y(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"||y(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 E(l){return l[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(l){var d=l.replace(k,E);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,E);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,E);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 Y=` -`+j[A].replace(" at new "," at ");return l.displayName&&Y.includes("")&&(Y=Y.replace("",l.displayName)),Y}while(1<=A&&0<=W);break}}}finally{ce=!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=ue(l.type,!1),l;case 11:return l=ue(l.type.render,!1),l;case 1:return l=ue(l.type,!0),l;default:return""}}function F(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 K:return"Portal";case P:return"Profiler";case H:return"StrictMode";case re:return"Suspense";case ae:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case Q:return(l.displayName||"Context")+".Consumer";case ee: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 pe:return d=l.displayName||null,d!==null?d:F(l.type)||"Memo";case I:d=l._payload,l=l._init;try{return F(l(d))}catch{}}return null}function G(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 F(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 te(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function be(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function ge(l){var d=be(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 Ce(l){l._valueTracker||(l._valueTracker=ge(l))}function We(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var p=d.getValue(),g="";return l&&(g=be(l)?l.checked?"true":"false":l.value),l=g,l!==p?(d.setValue(l),!0):!1}function gt(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}function Lt(l,d){var p=d.checked;return q({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??l._wrapperState.initialChecked})}function yt(l,d){var p=d.defaultValue==null?"":d.defaultValue,g=d.checked!=null?d.checked:d.defaultChecked;p=te(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 Ot(l,d){d=d.checked,d!=null&&C(l,"checked",d,!1)}function It(l,d){Ot(l,d);var p=te(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")?vn(l,d.type,p):d.hasOwnProperty("defaultValue")&&vn(l,d.type,te(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(l.defaultChecked=!!d.defaultChecked)}function Pn(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 vn(l,d,p){(d!=="number"||gt(l.ownerDocument)!==l)&&(p==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+p&&(l.defaultValue=""+p))}var Ht=Array.isArray;function Xt(l,d,p,g){if(l=l.options,d){d={};for(var j=0;j"+d.valueOf().toString()+"",d=ve.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;d.firstChild;)l.appendChild(d.firstChild)}});function Ve(l,d){if(d){var p=l.firstChild;if(p&&p===l.lastChild&&p.nodeType===3){p.nodeValue=d;return}}l.textContent=d}var st={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},Mt=["Webkit","ms","Moz","O"];Object.keys(st).forEach(function(l){Mt.forEach(function(d){d=d+l.charAt(0).toUpperCase()+l.substring(1),st[d]=st[l]})});function jt(l,d,p){return d==null||typeof d=="boolean"||d===""?"":p||typeof d!="number"||d===0||st.hasOwnProperty(l)&&st[l]?(""+d).trim():d+"px"}function D(l,d){l=l.style;for(var p in d)if(d.hasOwnProperty(p)){var g=p.indexOf("--")===0,j=jt(p,d[p],g);p==="float"&&(p="cssFloat"),g?l.setProperty(p,j):l[p]=j}}var Ie=q({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 vt(l,d){if(d){if(Ie[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 Rt(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 bt=null;function it(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var Dt=null,Jt=null,an=null;function as(l){if(l=hd(l)){if(typeof Dt!="function")throw Error(n(280));var d=l.stateNode;d&&(d=Ru(d),Dt(l.stateNode,l.type,d))}}function nr(l){Jt?an?an.push(l):an=[l]:Jt=l}function Ni(){if(Jt){var l=Jt,d=an;if(an=Jt=null,as(l),d)for(l=0;l>>=0,l===0?32:31-(td(l)/Br|0)|0}var ji=64,ha=4194304;function br(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 Vr(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=br(W):(S&=A,S!==0&&(g=br(S)))}else A=p&~j,A!==0?g=br(A):S!==0&&(g=br(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 Hr(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 Ti(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=sd),Hy=" ",Uy=!1;function Wy(l,d){switch(l){case"keyup":return nd.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ky(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var Ul=!1;function M4(l,d){switch(l){case"compositionend":return Ky(d);case"keypress":return d.which!==32?null:(Uy=!0,Hy);case"textInput":return l=d.data,l===Hy&&Uy?null:l;default:return null}}function A4(l,d){if(Ul)return l==="compositionend"||!Hp&&Wy(l,d)?(l=Fl(),Ri=Ii=Ls=null,Ul=!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=Zy(p)}}function tb(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?tb(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function nb(){for(var l=window,d=gt();d instanceof l.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)l=d.contentWindow;else break;d=gt(l.document)}return d}function Kp(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 $4(l){var d=nb(),p=l.focusedElem,g=l.selectionRange;if(d!==p&&p&&p.ownerDocument&&tb(p.ownerDocument.documentElement,p)){if(g!==null&&Kp(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=eb(p,S);var A=eb(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,Wl=null,qp=null,od=null,Gp=!1;function sb(l,d,p){var g=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;Gp||Wl==null||Wl!==gt(g)||(g=Wl,"selectionStart"in g&&Kp(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}),od&&id(od,g)||(od=g,g=Mu(qp,"onSelect"),0Ql||(l.current=im[Ql],im[Ql]=null,Ql--)}function ln(l,d){Ql++,im[Ql]=l.current,l.current=d}var Fi={},bs=$i(Fi),Ws=$i(!1),Ko=Fi;function Yl(l,d){var p=l.type.contextTypes;if(!p)return Fi;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 Ks(l){return l=l.childContextTypes,l!=null}function Pu(){pn(Ws),pn(bs)}function yb(l,d,p){if(bs.current!==Fi)throw Error(n(168));ln(bs,d),ln(Ws,p)}function bb(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,G(l)||"Unknown",j));return q({},p,g)}function Lu(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||Fi,Ko=bs.current,ln(bs,l),ln(Ws,Ws.current),!0}function vb(l,d,p){var g=l.stateNode;if(!g)throw Error(n(169));p?(l=bb(l,d,Ko),g.__reactInternalMemoizedMergedChildContext=l,pn(Ws),pn(bs),ln(bs,l)):pn(Ws),ln(Ws,p)}var qa=null,Ou=!1,om=!1;function Nb(l){qa===null?qa=[l]:qa.push(l)}function Y4(l){Ou=!0,Nb(l)}function Bi(){if(!om&&qa!==null){om=!0;var l=0,d=mt;try{var p=qa;for(mt=1;l>=A,j-=A,Ga=1<<32-Qn(d)+j|p<pt?(es=lt,lt=null):es=lt.sibling;var _t=Ee(he,lt,me[pt],Oe);if(_t===null){lt===null&&(lt=es);break}l&<&&_t.alternate===null&&d(he,lt),ne=S(_t,ne,pt),ot===null?et=_t:ot.sibling=_t,ot=_t,lt=es}if(pt===me.length)return p(he,lt),gn&&Go(he,pt),et;if(lt===null){for(;ptpt?(es=lt,lt=null):es=lt.sibling;var Qi=Ee(he,lt,_t.value,Oe);if(Qi===null){lt===null&&(lt=es);break}l&<&&Qi.alternate===null&&d(he,lt),ne=S(Qi,ne,pt),ot===null?et=Qi:ot.sibling=Qi,ot=Qi,lt=es}if(_t.done)return p(he,lt),gn&&Go(he,pt),et;if(lt===null){for(;!_t.done;pt++,_t=me.next())_t=Pe(he,_t.value,Oe),_t!==null&&(ne=S(_t,ne,pt),ot===null?et=_t:ot.sibling=_t,ot=_t);return gn&&Go(he,pt),et}for(lt=g(he,lt);!_t.done;pt++,_t=me.next())_t=Ue(lt,he,pt,_t.value,Oe),_t!==null&&(l&&_t.alternate!==null&<.delete(_t.key===null?pt:_t.key),ne=S(_t,ne,pt),ot===null?et=_t:ot.sibling=_t,ot=_t);return l&<.forEach(function(IT){return d(he,IT)}),gn&&Go(he,pt),et}function On(he,ne,me,Oe){if(typeof me=="object"&&me!==null&&me.type===_&&me.key===null&&(me=me.props.children),typeof me=="object"&&me!==null){switch(me.$$typeof){case O:e:{for(var et=me.key,ot=ne;ot!==null;){if(ot.key===et){if(et=me.type,et===_){if(ot.tag===7){p(he,ot.sibling),ne=j(ot,me.props.children),ne.return=he,he=ne;break e}}else if(ot.elementType===et||typeof et=="object"&&et!==null&&et.$$typeof===I&&Tb(et)===ot.type){p(he,ot.sibling),ne=j(ot,me.props),ne.ref=fd(he,ot,me),ne.return=he,he=ne;break e}p(he,ot);break}else d(he,ot);ot=ot.sibling}me.type===_?(ne=nl(me.props.children,he.mode,Oe,me.key),ne.return=he,he=ne):(Oe=ch(me.type,me.key,me.props,null,he.mode,Oe),Oe.ref=fd(he,ne,me),Oe.return=he,he=Oe)}return A(he);case K:e:{for(ot=me.key;ne!==null;){if(ne.key===ot)if(ne.tag===4&&ne.stateNode.containerInfo===me.containerInfo&&ne.stateNode.implementation===me.implementation){p(he,ne.sibling),ne=j(ne,me.children||[]),ne.return=he,he=ne;break e}else{p(he,ne);break}else d(he,ne);ne=ne.sibling}ne=rx(me,he.mode,Oe),ne.return=he,he=ne}return A(he);case I:return ot=me._init,On(he,ne,ot(me._payload),Oe)}if(Ht(me))return Je(he,ne,me,Oe);if(ie(me))return Ze(he,ne,me,Oe);$u(he,me)}return typeof me=="string"&&me!==""||typeof me=="number"?(me=""+me,ne!==null&&ne.tag===6?(p(he,ne.sibling),ne=j(ne,me),ne.return=he,he=ne):(p(he,ne),ne=sx(me,he.mode,Oe),ne.return=he,he=ne),A(he)):p(he,ne)}return On}var tc=Eb(!0),Mb=Eb(!1),Fu=$i(null),Bu=null,nc=null,fm=null;function pm(){fm=nc=Bu=null}function mm(l){var d=Fu.current;pn(Fu),l._currentValue=d}function xm(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 sc(l,d){Bu=l,fm=nc=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(qs=!0),l.firstContext=null)}function Er(l){var d=l._currentValue;if(fm!==l)if(l={context:l,memoizedValue:d,next:null},nc===null){if(Bu===null)throw Error(n(308));nc=l,Bu.dependencies={lanes:0,firstContext:l}}else nc=nc.next=l;return d}var Jo=null;function gm(l){Jo===null?Jo=[l]:Jo.push(l)}function Ab(l,d,p,g){var j=d.interleaved;return j===null?(p.next=p,gm(d)):(p.next=j.next,j.next=p),d.interleaved=p,Qa(l,g)}function Qa(l,d){l.lanes|=d;var p=l.alternate;for(p!==null&&(p.lanes|=d),p=l,l=l.return;l!==null;)l.childLanes|=d,p=l.alternate,p!==null&&(p.childLanes|=d),p=l,l=l.return;return p.tag===3?p.stateNode:null}var Vi=!1;function ym(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ib(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 Ya(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function Hi(l,d,p){var g=l.updateQueue;if(g===null)return null;if(g=g.shared,(Pt&2)!==0){var j=g.pending;return j===null?d.next=d:(d.next=j.next,j.next=d),g.pending=d,Qa(l,p)}return j=g.interleaved,j===null?(d.next=d,gm(g)):(d.next=j.next,j.next=d),g.interleaved=d,Qa(l,p)}function Vu(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,_o(l,p)}}function Rb(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 Hu(l,d,p,g){var j=l.updateQueue;Vi=!1;var S=j.firstBaseUpdate,A=j.lastBaseUpdate,W=j.shared.pending;if(W!==null){j.shared.pending=null;var Y=W,xe=Y.next;Y.next=null,A===null?S=xe:A.next=xe,A=Y;var Me=l.alternate;Me!==null&&(Me=Me.updateQueue,W=Me.lastBaseUpdate,W!==A&&(W===null?Me.firstBaseUpdate=xe:W.next=xe,Me.lastBaseUpdate=Y))}if(S!==null){var Pe=j.baseState;A=0,Me=xe=Y=null,W=S;do{var Ee=W.lane,Ue=W.eventTime;if((g&Ee)===Ee){Me!==null&&(Me=Me.next={eventTime:Ue,lane:0,tag:W.tag,payload:W.payload,callback:W.callback,next:null});e:{var Je=l,Ze=W;switch(Ee=d,Ue=p,Ze.tag){case 1:if(Je=Ze.payload,typeof Je=="function"){Pe=Je.call(Ue,Pe,Ee);break e}Pe=Je;break e;case 3:Je.flags=Je.flags&-65537|128;case 0:if(Je=Ze.payload,Ee=typeof Je=="function"?Je.call(Ue,Pe,Ee):Je,Ee==null)break e;Pe=q({},Pe,Ee);break e;case 2:Vi=!0}}W.callback!==null&&W.lane!==0&&(l.flags|=64,Ee=j.effects,Ee===null?j.effects=[W]:Ee.push(W))}else Ue={eventTime:Ue,lane:Ee,tag:W.tag,payload:W.payload,callback:W.callback,next:null},Me===null?(xe=Me=Ue,Y=Pe):Me=Me.next=Ue,A|=Ee;if(W=W.next,W===null){if(W=j.shared.pending,W===null)break;Ee=W,W=Ee.next,Ee.next=null,j.lastBaseUpdate=Ee,j.shared.pending=null}}while(!0);if(Me===null&&(Y=Pe),j.baseState=Y,j.firstBaseUpdate=xe,j.lastBaseUpdate=Me,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);Xo|=A,l.lanes=A,l.memoizedState=Pe}}function Pb(l,d,p){if(l=d.effects,d.effects=null,l!==null)for(d=0;dp?p:4,l(!0);var g=jm.transition;jm.transition={};try{l(!1),d()}finally{mt=p,jm.transition=g}}function Xb(){return Mr().memoizedState}function tT(l,d,p){var g=qi(l);if(p={lane:g,action:p,hasEagerState:!1,eagerState:null,next:null},Zb(l))ev(d,p);else if(p=Ab(l,d,p,g),p!==null){var j=Ds();ea(p,l,g,j),tv(p,d,g)}}function nT(l,d,p){var g=qi(l),j={lane:g,action:p,hasEagerState:!1,eagerState:null,next:null};if(Zb(l))ev(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,Jr(W,A)){var Y=d.interleaved;Y===null?(j.next=j,gm(d)):(j.next=Y.next,Y.next=j),d.interleaved=j;return}}catch{}finally{}p=Ab(l,d,j,g),p!==null&&(j=Ds(),ea(p,l,g,j),tv(p,d,g))}}function Zb(l){var d=l.alternate;return l===kn||d!==null&&d===kn}function ev(l,d){gd=Ku=!0;var p=l.pending;p===null?d.next=d:(d.next=p.next,p.next=d),l.pending=d}function tv(l,d,p){if((p&4194240)!==0){var g=d.lanes;g&=l.pendingLanes,p|=g,d.lanes=p,_o(l,p)}}var Ju={readContext:Er,useCallback:vs,useContext:vs,useEffect:vs,useImperativeHandle:vs,useInsertionEffect:vs,useLayoutEffect:vs,useMemo:vs,useReducer:vs,useRef:vs,useState:vs,useDebugValue:vs,useDeferredValue:vs,useTransition:vs,useMutableSource:vs,useSyncExternalStore:vs,useId:vs,unstable_isNewReconciler:!1},sT={readContext:Er,useCallback:function(l,d){return va().memoizedState=[l,d===void 0?null:d],l},useContext:Er,useEffect:Ub,useImperativeHandle:function(l,d,p){return p=p!=null?p.concat([l]):null,qu(4194308,4,qb.bind(null,d,l),p)},useLayoutEffect:function(l,d){return qu(4194308,4,l,d)},useInsertionEffect:function(l,d){return qu(4,2,l,d)},useMemo:function(l,d){var p=va();return d=d===void 0?null:d,l=l(),p.memoizedState=[l,d],l},useReducer:function(l,d,p){var g=va();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=tT.bind(null,kn,l),[g.memoizedState,l]},useRef:function(l){var d=va();return l={current:l},d.memoizedState=l},useState:Vb,useDebugValue:Am,useDeferredValue:function(l){return va().memoizedState=l},useTransition:function(){var l=Vb(!1),d=l[0];return l=eT.bind(null,l[1]),va().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,p){var g=kn,j=va();if(gn){if(p===void 0)throw Error(n(407));p=p()}else{if(p=d(),Zn===null)throw Error(n(349));(Yo&30)!==0||_b(g,d,p)}j.memoizedState=p;var S={value:p,getSnapshot:d};return j.queue=S,Ub($b.bind(null,g,S,l),[l]),g.flags|=2048,vd(9,zb.bind(null,g,S,p,d),void 0,null),p},useId:function(){var l=va(),d=Zn.identifierPrefix;if(gn){var p=Ja,g=Ga;p=(g&~(1<<32-Qn(g)-1)).toString(32)+p,d=":"+d+"R"+p,p=yd++,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[ya]=d,l[ud]=g,Nv(l,d,!1,!1),d.stateNode=l;e:{switch(A=Rt(p,g),p){case"dialog":fn("cancel",l),fn("close",l),j=g;break;case"iframe":case"object":case"embed":fn("load",l),j=g;break;case"video":case"audio":for(j=0;jlc&&(d.flags|=128,g=!0,Nd(S,!1),d.lanes=4194304)}else{if(!g)if(l=Uu(A),l!==null){if(d.flags|=128,g=!0,p=l.updateQueue,p!==null&&(d.updateQueue=p,d.flags|=4),Nd(S,!0),S.tail===null&&S.tailMode==="hidden"&&!A.alternate&&!gn)return Ns(d),null}else 2*Ut()-S.renderingStartTime>lc&&p!==1073741824&&(d.flags|=128,g=!0,Nd(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=Ut(),d.sibling=null,p=jn.current,ln(jn,g?p&1|2:p&1),d):(Ns(d),null);case 22:case 23:return ex(),g=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==g&&(d.flags|=8192),g&&(d.mode&1)!==0?(dr&1073741824)!==0&&(Ns(d),d.subtreeFlags&6&&(d.flags|=8192)):Ns(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function uT(l,d){switch(cm(d),d.tag){case 1:return Ks(d.type)&&Pu(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return rc(),pn(Ws),pn(bs),wm(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return vm(d),null;case 13:if(pn(jn),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));ec()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return pn(jn),null;case 4:return rc(),null;case 10:return mm(d.type._context),null;case 22:case 23:return ex(),null;case 24:return null;default:return null}}var Zu=!1,ws=!1,hT=typeof WeakSet=="function"?WeakSet:Set,qe=null;function ic(l,d){var p=l.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(g){Tn(l,d,g)}else p.current=null}function Vm(l,d,p){try{p()}catch(g){Tn(l,d,g)}}var kv=!1;function fT(l,d){if(em=Ei,l=nb(),Kp(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,Y=-1,xe=0,Me=0,Pe=l,Ee=null;t:for(;;){for(var Ue;Pe!==p||j!==0&&Pe.nodeType!==3||(W=A+j),Pe!==S||g!==0&&Pe.nodeType!==3||(Y=A+g),Pe.nodeType===3&&(A+=Pe.nodeValue.length),(Ue=Pe.firstChild)!==null;)Ee=Pe,Pe=Ue;for(;;){if(Pe===l)break t;if(Ee===p&&++xe===j&&(W=A),Ee===S&&++Me===g&&(Y=A),(Ue=Pe.nextSibling)!==null)break;Pe=Ee,Ee=Pe.parentNode}Pe=Ue}p=W===-1||Y===-1?null:{start:W,end:Y}}else p=null}p=p||{start:0,end:0}}else p=null;for(tm={focusedElem:l,selectionRange:p},Ei=!1,qe=d;qe!==null;)if(d=qe,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,qe=l;else for(;qe!==null;){d=qe;try{var Je=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(Je!==null){var Ze=Je.memoizedProps,On=Je.memoizedState,he=d.stateNode,ne=he.getSnapshotBeforeUpdate(d.elementType===d.type?Ze:Yr(d.type,Ze),On);he.__reactInternalSnapshotBeforeUpdate=ne}break;case 3:var me=d.stateNode.containerInfo;me.nodeType===1?me.textContent="":me.nodeType===9&&me.documentElement&&me.removeChild(me.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Oe){Tn(d,d.return,Oe)}if(l=d.sibling,l!==null){l.return=d.return,qe=l;break}qe=d.return}return Je=kv,kv=!1,Je}function wd(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&&Vm(d,p,S)}j=j.next}while(j!==g)}}function eh(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 Hm(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 Sv(l){var d=l.alternate;d!==null&&(l.alternate=null,Sv(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[ya],delete d[ud],delete d[am],delete d[J4],delete d[Q4])),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 Cv(l){return l.tag===5||l.tag===3||l.tag===4}function Tv(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||Cv(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 Um(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=Iu));else if(g!==4&&(l=l.child,l!==null))for(Um(l,d,p),l=l.sibling;l!==null;)Um(l,d,p),l=l.sibling}function Wm(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(Wm(l,d,p),l=l.sibling;l!==null;)Wm(l,d,p),l=l.sibling}var ls=null,Xr=!1;function Ui(l,d,p){for(p=p.child;p!==null;)Ev(l,d,p),p=p.sibling}function Ev(l,d,p){if(wn&&typeof wn.onCommitFiberUnmount=="function")try{wn.onCommitFiberUnmount($a,p)}catch{}switch(p.tag){case 5:ws||ic(p,d);case 6:var g=ls,j=Xr;ls=null,Ui(l,d,p),ls=g,Xr=j,ls!==null&&(Xr?(l=ls,p=p.stateNode,l.nodeType===8?l.parentNode.removeChild(p):l.removeChild(p)):ls.removeChild(p.stateNode));break;case 18:ls!==null&&(Xr?(l=ls,p=p.stateNode,l.nodeType===8?rm(l.parentNode,p):l.nodeType===1&&rm(l,p),xa(l)):rm(ls,p.stateNode));break;case 4:g=ls,j=Xr,ls=p.stateNode.containerInfo,Xr=!0,Ui(l,d,p),ls=g,Xr=j;break;case 0:case 11:case 14:case 15:if(!ws&&(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)&&Vm(p,d,A),j=j.next}while(j!==g)}Ui(l,d,p);break;case 1:if(!ws&&(ic(p,d),g=p.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=p.memoizedProps,g.state=p.memoizedState,g.componentWillUnmount()}catch(W){Tn(p,d,W)}Ui(l,d,p);break;case 21:Ui(l,d,p);break;case 22:p.mode&1?(ws=(g=ws)||p.memoizedState!==null,Ui(l,d,p),ws=g):Ui(l,d,p);break;default:Ui(l,d,p)}}function Mv(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var p=l.stateNode;p===null&&(p=l.stateNode=new hT),d.forEach(function(g){var j=wT.bind(null,l,g);p.has(g)||(p.add(g),g.then(j,j))})}}function Zr(l,d){var p=d.deletions;if(p!==null)for(var g=0;gj&&(j=A),g&=~S}if(g=j,g=Ut()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*mT(g/1960))-g,10l?16:l,Ki===null)var g=!1;else{if(l=Ki,Ki=null,ah=0,(Pt&6)!==0)throw Error(n(331));var j=Pt;for(Pt|=4,qe=l.current;qe!==null;){var S=qe,A=S.child;if((qe.flags&16)!==0){var W=S.deletions;if(W!==null){for(var Y=0;YUt()-Gm?el(l,0):qm|=p),Js(l,d)}function Vv(l,d){d===0&&((l.mode&1)===0?d=1:(d=ha,ha<<=1,(ha&130023424)===0&&(ha=4194304)));var p=Ds();l=Qa(l,d),l!==null&&(Hr(l,d,p),Js(l,p))}function NT(l){var d=l.memoizedState,p=0;d!==null&&(p=d.retryLane),Vv(l,p)}function wT(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),Vv(l,p)}var Hv;Hv=function(l,d,p){if(l!==null)if(l.memoizedProps!==d.pendingProps||Ws.current)qs=!0;else{if((l.lanes&p)===0&&(d.flags&128)===0)return qs=!1,cT(l,d,p);qs=(l.flags&131072)!==0}else qs=!1,gn&&(d.flags&1048576)!==0&&wb(d,_u,d.index);switch(d.lanes=0,d.tag){case 2:var g=d.type;Xu(l,d),l=d.pendingProps;var j=Yl(d,bs.current);sc(d,p),j=Sm(null,d,g,l,j,p);var S=Cm();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,Ks(g)?(S=!0,Lu(d)):S=!1,d.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,ym(d),j.updater=Qu,d.stateNode=j,j._reactInternals=d,Rm(d,g,l,p),d=Dm(null,d,g,!0,S,p)):(d.tag=0,gn&&S&&lm(d),Os(null,d,j,p),d=d.child),d;case 16:g=d.elementType;e:{switch(Xu(l,d),l=d.pendingProps,j=g._init,g=j(g._payload),d.type=g,j=d.tag=kT(g),l=Yr(g,l),j){case 0:d=Om(null,d,g,l,p);break e;case 1:d=mv(null,d,g,l,p);break e;case 11:d=dv(null,d,g,l,p);break e;case 14:d=uv(null,d,g,Yr(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:Yr(g,j),Om(l,d,g,j,p);case 1:return g=d.type,j=d.pendingProps,j=d.elementType===g?j:Yr(g,j),mv(l,d,g,j,p);case 3:e:{if(xv(d),l===null)throw Error(n(387));g=d.pendingProps,S=d.memoizedState,j=S.element,Ib(l,d),Hu(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=ac(Error(n(423)),d),d=gv(l,d,g,p,j);break e}else if(g!==j){j=ac(Error(n(424)),d),d=gv(l,d,g,p,j);break e}else for(cr=zi(d.stateNode.containerInfo.firstChild),lr=d,gn=!0,Qr=null,p=Mb(d,null,g,p),d.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(ec(),g===j){d=Xa(l,d,p);break e}Os(l,d,g,p)}d=d.child}return d;case 5:return Lb(d),l===null&&um(d),g=d.type,j=d.pendingProps,S=l!==null?l.memoizedProps:null,A=j.children,nm(g,j)?A=null:S!==null&&nm(g,S)&&(d.flags|=32),pv(l,d),Os(l,d,A,p),d.child;case 6:return l===null&&um(d),null;case 13:return yv(l,d,p);case 4:return bm(d,d.stateNode.containerInfo),g=d.pendingProps,l===null?d.child=tc(d,null,g,p):Os(l,d,g,p),d.child;case 11:return g=d.type,j=d.pendingProps,j=d.elementType===g?j:Yr(g,j),dv(l,d,g,j,p);case 7:return Os(l,d,d.pendingProps,p),d.child;case 8:return Os(l,d,d.pendingProps.children,p),d.child;case 12:return Os(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,ln(Fu,g._currentValue),g._currentValue=A,S!==null)if(Jr(S.value,A)){if(S.children===j.children&&!Ws.current){d=Xa(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 Y=W.firstContext;Y!==null;){if(Y.context===g){if(S.tag===1){Y=Ya(-1,p&-p),Y.tag=2;var xe=S.updateQueue;if(xe!==null){xe=xe.shared;var Me=xe.pending;Me===null?Y.next=Y:(Y.next=Me.next,Me.next=Y),xe.pending=Y}}S.lanes|=p,Y=S.alternate,Y!==null&&(Y.lanes|=p),xm(S.return,p,d),W.lanes|=p;break}Y=Y.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),xm(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}Os(l,d,j.children,p),d=d.child}return d;case 9:return j=d.type,g=d.pendingProps.children,sc(d,p),j=Er(j),g=g(j),d.flags|=1,Os(l,d,g,p),d.child;case 14:return g=d.type,j=Yr(g,d.pendingProps),j=Yr(g.type,j),uv(l,d,g,j,p);case 15:return hv(l,d,d.type,d.pendingProps,p);case 17:return g=d.type,j=d.pendingProps,j=d.elementType===g?j:Yr(g,j),Xu(l,d),d.tag=1,Ks(g)?(l=!0,Lu(d)):l=!1,sc(d,p),sv(d,g,j),Rm(d,g,j,p),Dm(null,d,g,!0,l,p);case 19:return vv(l,d,p);case 22:return fv(l,d,p)}throw Error(n(156,d.tag))};function Uv(l,d){return Lo(l,d)}function jT(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 Ir(l,d,p,g){return new jT(l,d,p,g)}function nx(l){return l=l.prototype,!(!l||!l.isReactComponent)}function kT(l){if(typeof l=="function")return nx(l)?1:0;if(l!=null){if(l=l.$$typeof,l===V)return 11;if(l===pe)return 14}return 2}function Ji(l,d){var p=l.alternate;return p===null?(p=Ir(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 ch(l,d,p,g,j,S){var A=2;if(g=l,typeof l=="function")nx(l)&&(A=1);else if(typeof l=="string")A=5;else e:switch(l){case _:return nl(p.children,j,S,d);case H:A=8,j|=8;break;case P:return l=Ir(12,p,d,j|2),l.elementType=P,l.lanes=S,l;case re:return l=Ir(13,p,d,j),l.elementType=re,l.lanes=S,l;case ae:return l=Ir(19,p,d,j),l.elementType=ae,l.lanes=S,l;case z:return dh(p,j,S,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case ee:A=10;break e;case Q:A=9;break e;case V:A=11;break e;case pe:A=14;break e;case I:A=16,g=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=Ir(A,p,d,j),d.elementType=l,d.type=g,d.lanes=S,d}function nl(l,d,p,g){return l=Ir(7,l,g,d),l.lanes=p,l}function dh(l,d,p,g){return l=Ir(22,l,g,d),l.elementType=z,l.lanes=p,l.stateNode={isHidden:!1},l}function sx(l,d,p){return l=Ir(6,l,null,d),l.lanes=p,l}function rx(l,d,p){return d=Ir(4,l.children!==null?l.children:[],l.key,d),d.lanes=p,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function ST(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=Ci(0),this.expirationTimes=Ci(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ci(0),this.identifierPrefix=g,this.onRecoverableError=j,this.mutableSourceEagerHydrationData=null}function ax(l,d,p,g,j,S,A,W,Y){return l=new ST(l,d,p,W,Y),d===1?(d=1,S===!0&&(d|=8)):d=0,S=Ir(3,null,null,d),l.current=S,S.stateNode=l,S.memoizedState={element:g,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},ym(S),l}function CT(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(),ux.exports=zT(),ux.exports}var r1;function $T(){if(r1)return gh;r1=1;var t=vj();return gh.createRoot=t.createRoot,gh.hydrateRoot=t.hydrateRoot,gh}var FT=$T(),xu=vj();const Nj=bj(xu);/** - * @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 Zd(){return Zd=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function w0(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function VT(){return Math.random().toString(36).substr(2,8)}function i1(t,e){return{usr:t.state,key:t.key,idx:e}}function ug(t,e,n,r){return n===void 0&&(n=null),Zd({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Wc(e):e,{state:n,key:e&&e.key||r||VT()})}function nf(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 Wc(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 HT(t,e,n,r){r===void 0&&(r={});let{window:a=document.defaultView,v5Compat:i=!1}=r,o=a.history,c=lo.Pop,u=null,h=f();h==null&&(h=0,o.replaceState(Zd({},o.state,{idx:h}),""));function f(){return(o.state||{idx:null}).idx}function m(){c=lo.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=lo.Push;let E=ug(w.location,N,k);h=f()+1;let C=i1(E,h),L=w.createHref(E);try{o.pushState(C,"",L)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;a.location.assign(L)}i&&u&&u({action:c,location:w.location,delta:1})}function y(N,k){c=lo.Replace;let E=ug(w.location,N,k);h=f();let C=i1(E,h),L=w.createHref(E);o.replaceState(C,"",L),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,E=typeof N=="string"?N:nf(N);return E=E.replace(/ $/,"%20"),zn(k,"No window.location.(origin|href) available to create URL for href: "+E),new URL(E,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(a1,m),u=N,()=>{a.removeEventListener(a1,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:y,go(N){return o.go(N)}};return w}var o1;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(o1||(o1={}));function UT(t,e,n){return n===void 0&&(n="/"),WT(t,e,n)}function WT(t,e,n,r){let a=typeof e=="string"?Wc(e):e,i=j0(a.pathname||"/",n);if(i==null)return null;let o=wj(t);KT(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=po([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+'".')),wj(i.children,e,f,h)),!(i.path==null&&!i.index)&&e.push({path:h,score:ZT(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 jj(i.path))a(i,o,u)}),e}function jj(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=jj(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 KT(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:eE(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const qT=/^:[\w-]+$/,GT=3,JT=2,QT=1,YT=10,XT=-2,l1=t=>t==="*";function ZT(t,e){let n=t.split("/"),r=n.length;return n.some(l1)&&(r+=XT),e&&(r+=JT),n.filter(a=>!l1(a)).reduce((a,i)=>a+(qT.test(i)?GT:i===""?QT:YT),r)}function eE(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 tE(t,e,n){let{routesMeta:r}=t,a={},i="/",o=[];for(let c=0;c{let{paramName:x,isOptional:y}=f;if(x==="*"){let w=c[m]||"";o=i.slice(0,i.length-w.length).replace(/(.)\/+$/,"$1")}const v=c[m];return y&&!v?h[x]=void 0:h[x]=(v||"").replace(/%2F/g,"/"),h},{}),pathname:i,pathnameBase:o,pattern:t}}function sE(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),w0(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 rE(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return w0(!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 j0(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 aE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,iE=t=>aE.test(t);function oE(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:a=""}=typeof t=="string"?Wc(t):t,i;if(n)if(iE(n))i=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),w0(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=c1(n.substring(1),"/"):i=c1(n,e)}else i=e;return{pathname:i,search:dE(r),hash:uE(a)}}function c1(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 px(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 lE(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function k0(t,e){let n=lE(t);return e?n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function S0(t,e,n,r){r===void 0&&(r=!1);let a;typeof t=="string"?a=Wc(t):(a=Zd({},t),zn(!a.pathname||!a.pathname.includes("?"),px("?","pathname","search",a)),zn(!a.pathname||!a.pathname.includes("#"),px("#","pathname","hash",a)),zn(!a.search||!a.search.includes("#"),px("#","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=oE(a,c),h=o&&o!=="/"&&o.endsWith("/"),f=(i||o===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(h||f)&&(u.pathname+="/"),u}const po=t=>t.join("/").replace(/\/\/+/g,"/"),cE=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),dE=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,uE=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function hE(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const kj=["post","put","patch","delete"];new Set(kj);const fE=["get",...kj];new Set(fE);/** - * 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 eu(){return eu=Object.assign?Object.assign.bind():function(t){for(var e=1;e{c.current=!0}),b.useCallback(function(h,f){if(f===void 0&&(f={}),!c.current)return;if(typeof h=="number"){r.go(h);return}let m=S0(h,JSON.parse(o),i,f.relative==="path");t==null&&e!=="/"&&(m.pathname=m.pathname==="/"?e:po([e,m.pathname])),(f.replace?r.replace:r.push)(m,f.state,f)},[e,r,o,i,t])}const gE=b.createContext(null);function yE(t){let e=b.useContext(bi).outlet;return e&&b.createElement(gE.Provider,{value:t},e)}function Tj(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=b.useContext(Co),{matches:a}=b.useContext(bi),{pathname:i}=To(),o=JSON.stringify(k0(a,r.v7_relativeSplatPath));return b.useMemo(()=>S0(t,JSON.parse(o),i,n==="path"),[t,o,i,n])}function bE(t,e){return vE(t,e)}function vE(t,e,n,r){Kc()||zn(!1);let{navigator:a}=b.useContext(Co),{matches:i}=b.useContext(bi),o=i[i.length-1],c=o?o.params:{};o&&o.pathname;let u=o?o.pathnameBase:"/";o&&o.route;let h=To(),f;if(e){var m;let N=typeof e=="string"?Wc(e):e;u==="/"||(m=N.pathname)!=null&&m.startsWith(u)||zn(!1),f=N}else f=h;let x=f.pathname||"/",y=x;if(u!=="/"){let N=u.replace(/^\//,"").split("/");y="/"+x.replace(/^\//,"").split("/").slice(N.length).join("/")}let v=UT(t,{pathname:y}),w=SE(v&&v.map(N=>Object.assign({},N,{params:Object.assign({},c,N.params),pathname:po([u,a.encodeLocation?a.encodeLocation(N.pathname).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?u:po([u,a.encodeLocation?a.encodeLocation(N.pathnameBase).pathname:N.pathnameBase])})),i,n,r);return e&&w?b.createElement(cp.Provider,{value:{location:eu({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:lo.Pop}},w):w}function NE(){let t=ME(),e=hE(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 b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},e),n?b.createElement("pre",{style:a},n):null,null)}const wE=b.createElement(NE,null);class jE extends b.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?b.createElement(bi.Provider,{value:this.props.routeContext},b.createElement(Sj.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function kE(t){let{routeContext:e,match:n,children:r}=t,a=b.useContext(C0);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),b.createElement(bi.Provider,{value:e},r)}function SE(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,x)=>{let y,v=!1,w=null,N=null;n&&(y=c&&m.route.id?c[m.route.id]:void 0,w=m.route.errorElement||wE,u&&(h<0&&x===0?(IE("route-fallback"),v=!0,N=null):h===x&&(v=!0,N=m.route.hydrateFallbackElement||null)));let k=e.concat(o.slice(0,x+1)),E=()=>{let C;return y?C=w:v?C=N:m.route.Component?C=b.createElement(m.route.Component,null):m.route.element?C=m.route.element:C=f,b.createElement(kE,{match:m,routeContext:{outlet:f,matches:k,isDataRoute:n!=null},children:C})};return n&&(m.route.ErrorBoundary||m.route.errorElement||x===0)?b.createElement(jE,{location:n.location,revalidation:n.revalidation,component:w,error:y,children:E(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):E()},null)}var Ej=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(Ej||{}),Mj=(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})(Mj||{});function CE(t){let e=b.useContext(C0);return e||zn(!1),e}function TE(t){let e=b.useContext(pE);return e||zn(!1),e}function EE(t){let e=b.useContext(bi);return e||zn(!1),e}function Aj(t){let e=EE(),n=e.matches[e.matches.length-1];return n.route.id||zn(!1),n.route.id}function ME(){var t;let e=b.useContext(Sj),n=TE(),r=Aj();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function AE(){let{router:t}=CE(Ej.UseNavigateStable),e=Aj(Mj.UseNavigateStable),n=b.useRef(!1);return Cj(()=>{n.current=!0}),b.useCallback(function(a,i){i===void 0&&(i={}),n.current&&(typeof a=="number"?t.navigate(a):t.navigate(a,eu({fromRouteId:e},i)))},[t,e])}const d1={};function IE(t,e,n){d1[t]||(d1[t]=!0)}function RE(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function yh(t){let{to:e,replace:n,state:r,relative:a}=t;Kc()||zn(!1);let{future:i,static:o}=b.useContext(Co),{matches:c}=b.useContext(bi),{pathname:u}=To(),h=Ra(),f=S0(e,k0(c,i.v7_relativeSplatPath),u,a==="path"),m=JSON.stringify(f);return b.useEffect(()=>h(JSON.parse(m),{replace:n,state:r,relative:a}),[h,m,a,n,r]),null}function PE(t){return yE(t.context)}function cn(t){zn(!1)}function LE(t){let{basename:e="/",children:n=null,location:r,navigationType:a=lo.Pop,navigator:i,static:o=!1,future:c}=t;Kc()&&zn(!1);let u=e.replace(/^\/*/,"/"),h=b.useMemo(()=>({basename:u,navigator:i,static:o,future:eu({v7_relativeSplatPath:!1},c)}),[u,c,i,o]);typeof r=="string"&&(r=Wc(r));let{pathname:f="/",search:m="",hash:x="",state:y=null,key:v="default"}=r,w=b.useMemo(()=>{let N=j0(f,u);return N==null?null:{location:{pathname:N,search:m,hash:x,state:y,key:v},navigationType:a}},[u,f,m,x,y,v,a]);return w==null?null:b.createElement(Co.Provider,{value:h},b.createElement(cp.Provider,{children:n,value:w}))}function OE(t){let{children:e,location:n}=t;return bE(hg(e),n)}new Promise(()=>{});function hg(t,e){e===void 0&&(e=[]);let n=[];return b.Children.forEach(t,(r,a)=>{if(!b.isValidElement(r))return;let i=[...e,a];if(r.type===b.Fragment){n.push.apply(n,hg(r.props.children,i));return}r.type!==cn&&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=hg(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 fg(){return fg=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[a]=t[a]);return n}function _E(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function zE(t,e){return t.button===0&&(!e||e==="_self")&&!_E(t)}function pg(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 $E(t,e){let n=pg(t);return e&&e.forEach((r,a)=>{n.has(a)||e.getAll(a).forEach(i=>{n.append(a,i)})}),n}const FE=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],BE="6";try{window.__reactRouterVersion=BE}catch{}const VE="startTransition",u1=lp[VE];function HE(t){let{basename:e,children:n,future:r,window:a}=t,i=b.useRef();i.current==null&&(i.current=BT({window:a,v5Compat:!0}));let o=i.current,[c,u]=b.useState({action:o.action,location:o.location}),{v7_startTransition:h}=r||{},f=b.useCallback(m=>{h&&u1?u1(()=>u(m)):u(m)},[u,h]);return b.useLayoutEffect(()=>o.listen(f),[o,f]),b.useEffect(()=>RE(r),[r]),b.createElement(LE,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:o,future:r})}const UE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",WE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Rc=b.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=DE(e,FE),{basename:y}=b.useContext(Co),v,w=!1;if(typeof h=="string"&&WE.test(h)&&(v=h,UE))try{let C=new URL(window.location.href),L=h.startsWith("//")?new URL(C.protocol+h):new URL(h),O=j0(L.pathname,y);L.origin===C.origin&&O!=null?h=O+L.search+L.hash:w=!0}catch{}let N=mE(h,{relative:a}),k=KE(h,{replace:o,state:c,target:u,preventScrollReset:f,relative:a,viewTransition:m});function E(C){r&&r(C),C.defaultPrevented||k(C)}return b.createElement("a",fg({},x,{href:v||N,onClick:w||i?r:E,ref:n,target:u}))});var h1;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(h1||(h1={}));var f1;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(f1||(f1={}));function KE(t,e){let{target:n,replace:r,state:a,preventScrollReset:i,relative:o,viewTransition:c}=e===void 0?{}:e,u=Ra(),h=To(),f=Tj(t,{relative:o});return b.useCallback(m=>{if(zE(m,n)){m.preventDefault();let x=r!==void 0?r:nf(h)===nf(f);u(t,{replace:x,state:a,preventScrollReset:i,relative:o,viewTransition:c})}},[h,u,f,r,a,n,t,i,o,c])}function T0(t){let e=b.useRef(pg(t)),n=b.useRef(!1),r=To(),a=b.useMemo(()=>$E(r.search,n.current?null:e.current),[r.search]),i=Ra(),o=b.useCallback((c,u)=>{const h=pg(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 qE=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),GE=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),p1=t=>{const e=GE(t);return e.charAt(0).toUpperCase()+e.slice(1)},Ij=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),JE=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 QE={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 YE=b.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:i,iconNode:o,...c},u)=>b.createElement("svg",{ref:u,...QE,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:Ij("lucide",a),...!i&&!JE(c)&&{"aria-hidden":"true"},...c},[...o.map(([h,f])=>b.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 Ae=(t,e)=>{const n=b.forwardRef(({className:r,...a},i)=>b.createElement(YE,{ref:i,iconNode:e,className:Ij(`lucide-${qE(p1(t))}`,`lucide-${t}`,r),...a}));return n.displayName=p1(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 XE=[["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"}]],mx=Ae("arrow-up-down",XE);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ZE=[["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"}]],e5=Ae("at-sign",ZE);/** - * @license lucide-react v0.562.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.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"}]],m1=Ae("bitcoin",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=[["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"}]],s5=Ae("bold",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:"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"}]],er=Ae("book-open",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:"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"}]],mg=Ae("calendar",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:"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"}]],gc=Ae("chart-column",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:"M20 6 9 17l-5-5",key:"1gmf2c"}]],dp=Ae("check",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:"m6 9 6 6 6-6",key:"qrunsl"}]],Pc=Ae("chevron-down",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:"m15 18-6-6 6-6",key:"1wnfg3"}]],d5=Ae("chevron-left",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 u5=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ll=Ae("chevron-right",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:"m18 15-6-6-6 6",key:"153udz"}]],xg=Ae("chevron-up",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=[["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"}]],Rj=Ae("circle-alert",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=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],xx=Ae("circle-check-big",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=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Pj=Ae("circle-check",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"}],["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"}]],Lj=Ae("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 g5=[["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"}]],bh=Ae("circle-user",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:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Oj=Ae("circle-x",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=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],gg=Ae("clock",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:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],x1=Ae("cloud",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:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],w5=Ae("code",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 j5=[["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"}]],Dj=Ae("copy",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=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],g1=Ae("credit-card",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=[["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"}]],Tc=Ae("crown",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=[["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"}]],sf=Ae("dollar-sign",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 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"}]],E5=Ae("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 M5=[["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"}]],mi=Ae("external-link",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:"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"}]],I5=Ae("eye-off",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 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"}]],rf=Ae("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 P5=[["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"}]],_j=Ae("file-text",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 L5=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],zj=Ae("funnel",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=[["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"}]],yg=Ae("gift",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=[["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=Ae("git-merge",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 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"}]],bg=Ae("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 $5=[["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"}]],F5=Ae("graduation-cap",$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:"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"}]],ei=Ae("grip-vertical",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:"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"}]],H5=Ae("handshake",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=[["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"}]],y1=Ae("hash",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:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],K5=Ae("heading-1",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=[["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"}]],G5=Ae("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 J5=[["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"}]],Q5=Ae("heading-3",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 Y5=[["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"}]],X5=Ae("house",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 Z5=[["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"}]],$j=Ae("image",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 eM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],vh=Ae("info",eM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const tM=[["line",{x1:"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"}]],nM=Ae("italic",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 sM=[["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"}]],vg=Ae("key",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=[["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"}]],aM=Ae("layout-dashboard",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=[["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"}]],oM=Ae("layout-grid",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 lM=[["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"}]],Sa=Ae("link-2",lM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cM=[["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"}]],Ng=Ae("link",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:"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"}]],uM=Ae("list-ordered",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 hM=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],fM=Ae("list",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 pM=[["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"}]],mM=Ae("lock",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 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"}]],gM=Ae("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 yM=[["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"}]],Fj=Ae("map-pin",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 bM=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],vM=Ae("menu",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:"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"}]],wM=Ae("message-circle",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 jM=[["path",{d:"M5 12h14",key:"1ays0h"}]],kM=Ae("minus",jM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const SM=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],na=Ae("navigation",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 CM=[["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=Ae("palette",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:"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"}]],MM=Ae("paperclip",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 AM=[["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"}]],en=Ae("pen-line",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 IM=[["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"}]],b1=Ae("pencil",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=[["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"}]],PM=Ae("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 LM=[["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"}]],v1=Ae("phone",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=[["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"}]],DM=Ae("pin",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:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Dn=Ae("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 zM=[["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"}]],N1=Ae("qr-code",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:"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=Ae("quote",$M);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const BM=[["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=Ae("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"}]],Fe=Ae("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"}]],Sn=Ae("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"}]],Ta=Ae("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=Ae("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"}]],co=Ae("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"}]],Nh=Ae("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=Ae("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"}]],jc=Ae("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"}]],Fd=Ae("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"}]],yl=Ae("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=Ae("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=Ae("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"}]],kc=Ae("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=Ae("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=Ae("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"}]],Bd=Ae("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"}]],js=Ae("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"}]],af=Ae("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"}]],wg=Ae("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"}]],Bj=Ae("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"}]],xA=Ae("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 gA=[["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"}]],of=Ae("upload",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 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"}]],Sc=Ae("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"}]],ci=Ae("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"}]],_n=Ae("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=Ae("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"}]],Lc=Ae("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=Ae("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"}]],ts=Ae("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 TA=[["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"}]],xi=Ae("zap",TA),E0="admin_token";function gu(){try{return localStorage.getItem(E0)}catch{return null}}function EA(t){try{localStorage.setItem(E0,t)}catch{}}function gx(){try{localStorage.removeItem(E0)}catch{}}const MA="https://soulapi.quwanzhi.com",AA=15e3,w1=6e4,IA=()=>MA;function Oc(t){const e=IA(),n=t.startsWith("/")?t:`/${t}`;return e?`${e}${n}`:n}async function up(t,e={}){const{data:n,...r}=e,a=Oc(t),i=new Headers(r.headers),o=gu();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)),x=m.headers.get("Content-Type")||"";let y;if(x.includes("application/json"))try{y=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(y);const w=new Error((y==null?void 0:y.error)||`HTTP ${m.status}`);throw w.status=m.status,w.data=y,w}return v(y),y}function De(t,e){return up(t,{...e,method:"GET"})}function St(t,e,n){return up(t,{...n,method:"POST",data:e})}function Zt(t,e,n){return up(t,{...n,method:"PUT",data:e})}function di(t,e){return up(t,{...e,method:"DELETE"})}function RA(){const[t,e]=b.useState(!1),[n,r]=b.useState("");return b.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(Rj,{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(ts,{className:"w-4 h-4"})})]}):null}const PA=[{icon:aM,label:"数据概览",href:"/dashboard"},{icon:er,label:"内容管理",href:"/content"},{icon:_n,label:"用户管理",href:"/users"},{icon:_5,label:"找伙伴",href:"/find-partner"},{icon:Lc,label:"推广中心",href:"/distribution"}];function LA(){const t=To(),e=Ra(),[n,r]=b.useState(!1),[a,i]=b.useState(!1);b.useEffect(()=>{r(!0)},[]),b.useEffect(()=>{if(!n)return;i(!1);let c=!1;if(!gu()){e("/login",{replace:!0});return}return De("/api/admin").then(u=>{c||(u&&u.success!==!1?i(!0):(gx(),e("/login",{replace:!0,state:{from:t.pathname}})))}).catch(()=>{c||(gx(),e("/login",{replace:!0,state:{from:t.pathname}}))}),()=>{c=!0}},[t.pathname,n,e]);const o=async()=>{gx();try{await St("/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:[PA.map(c=>{const u=t.pathname===c.href;return s.jsxs(Rc,{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(Rc,{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(co,{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(gM,{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(RA,{}),s.jsx("div",{className:"w-full min-w-[1024px] min-h-full flex-1",children:s.jsx(PE,{})})]})]})}function j1(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function M0(...t){return e=>{let n=!1;const r=t.map(a=>{const i=j1(a,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a{let{children:i,...o}=r;Vj(i)&&typeof lf=="function"&&(i=lf(i._payload));const c=b.Children.toArray(i),u=c.find($A);if(u){const h=u.props.children,f=c.map(m=>m===u?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:a,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:a,children:i})});return n.displayName=`${t}.Slot`,n}var Uj=Hj("Slot");function _A(t){const e=b.forwardRef((n,r)=>{let{children:a,...i}=n;if(Vj(a)&&typeof lf=="function"&&(a=lf(a._payload)),b.isValidElement(a)){const o=BA(a),c=FA(i,a.props);return a.type!==b.Fragment&&(c.ref=r?M0(r,o):o),b.cloneElement(a,c)}return b.Children.count(a)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var zA=Symbol("radix.slottable");function $A(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===zA}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 Wj(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,S1=Kj,qj=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return S1(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=k1(f)||k1(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,...y}=f;return Object.entries(y).every(v=>{let[w,N]=v;return Array.isArray(N)?N.includes({...i,...c}[w]):{...i,...c}[w]===N})?[...h,m,x]:h},[]);return S1(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}),Gj=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),cf="-",C1=[],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(cf),u=c[0]===""&&c.length>1?1:0;return Jj(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=r[o],h=n[o];return u?h?VA(h,u):u:h||C1}return n[o]||C1}}},Jj=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const a=t[e],i=n.nextPart.get(a);if(i){const h=Jj(t,e+1,i);if(h)return h}const o=n.validators;if(o===null)return;const c=e===0?t.join(cf):t.slice(e).join(cf),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=Gj();for(const r in t){const a=t[r];A0(a,n,r,e)}return n},A0=(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:Qj(e,t);r.classGroupId=n},YA=(t,e,n,r)=>{if(ZA(t)){A0(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(cf),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)}}},jg="!",T1=":",tI=[],E1=(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 w=0;wu?h-u:void 0;return E1(i,y,x,v)};if(e){const a=e+T1,i=r;r=o=>o.startsWith(a)?i(o.slice(a.length)):E1(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:x,hasImportantModifier:y,baseClassName:v,maybePostfixModifierPosition:w}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let N=!!w,k=r(N?v.substring(0,w):v);if(!k){if(!N){u=f+(u.length>0?" "+u:u);continue}if(k=r(v),!k){u=f+(u.length>0?" "+u:u);continue}N=!1}const E=x.length===0?"":x.length===1?x[0]:i(x).join(":"),C=y?E+jg:E,L=C+k;if(o.indexOf(L)>-1)continue;o.push(L);const O=a(k,N);for(let K=0;K0?" "+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=[],Gn=t=>{const e=n=>n[t]||cI;return e.isThemeGetter=!0,e},Xj=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Zj=/^\((?:(\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)\(.+\)$/,dc=t=>dI.test(t),kt=t=>!!t&&!Number.isNaN(Number(t)),Yi=t=>!!t&&Number.isInteger(Number(t)),yx=t=>t.endsWith("%")&&kt(t.slice(0,-1)),ti=t=>uI.test(t),xI=()=>!0,gI=t=>hI.test(t)&&!fI.test(t),ek=()=>!1,yI=t=>pI.test(t),bI=t=>mI.test(t),vI=t=>!Qe(t)&&!Ye(t),NI=t=>qc(t,sk,ek),Qe=t=>Xj.test(t),sl=t=>qc(t,rk,gI),bx=t=>qc(t,CI,kt),M1=t=>qc(t,tk,ek),wI=t=>qc(t,nk,bI),wh=t=>qc(t,ak,yI),Ye=t=>Zj.test(t),Ed=t=>Gc(t,rk),jI=t=>Gc(t,TI),A1=t=>Gc(t,tk),kI=t=>Gc(t,sk),SI=t=>Gc(t,nk),jh=t=>Gc(t,ak,!0),qc=(t,e,n)=>{const r=Xj.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Gc=(t,e,n=!1)=>{const r=Zj.exec(t);return r?r[1]?e(r[1]):n:!1},tk=t=>t==="position"||t==="percentage",nk=t=>t==="image"||t==="url",sk=t=>t==="length"||t==="size"||t==="bg-size",rk=t=>t==="length",CI=t=>t==="number",TI=t=>t==="family-name",ak=t=>t==="shadow",EI=()=>{const t=Gn("color"),e=Gn("font"),n=Gn("text"),r=Gn("font-weight"),a=Gn("tracking"),i=Gn("leading"),o=Gn("breakpoint"),c=Gn("container"),u=Gn("spacing"),h=Gn("radius"),f=Gn("shadow"),m=Gn("inset-shadow"),x=Gn("text-shadow"),y=Gn("drop-shadow"),v=Gn("blur"),w=Gn("perspective"),N=Gn("aspect"),k=Gn("ease"),E=Gn("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],L=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],O=()=>[...L(),Ye,Qe],K=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],H=()=>[Ye,Qe,u],P=()=>[dc,"full","auto",...H()],ee=()=>[Yi,"none","subgrid",Ye,Qe],Q=()=>["auto",{span:["full",Yi,Ye,Qe]},Yi,Ye,Qe],V=()=>[Yi,"auto",Ye,Qe],re=()=>["auto","min","max","fr",Ye,Qe],ae=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],pe=()=>["start","end","center","stretch","center-safe","end-safe"],I=()=>["auto",...H()],z=()=>[dc,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...H()],R=()=>[t,Ye,Qe],ie=()=>[...L(),A1,M1,{position:[Ye,Qe]}],q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],$=()=>["auto","cover","contain",kI,NI,{size:[Ye,Qe]}],U=()=>[yx,Ed,sl],ce=()=>["","none","full",h,Ye,Qe],ue=()=>["",kt,Ed,sl],oe=()=>["solid","dashed","dotted","double"],F=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],G=()=>[kt,yx,A1,M1],te=()=>["","none",v,Ye,Qe],be=()=>["none",kt,Ye,Qe],ge=()=>["none",kt,Ye,Qe],Ce=()=>[kt,Ye,Qe],We=()=>[dc,"full",...H()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ti],breakpoint:[ti],color:[xI],container:[ti],"drop-shadow":[ti],ease:["in","out","in-out"],font:[vI],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ti],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ti],shadow:[ti],spacing:["px",kt],text:[ti],"text-shadow":[ti],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",dc,Qe,Ye,N]}],container:["container"],columns:[{columns:[kt,Qe,Ye,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:O()}],overflow:[{overflow:K()}],"overflow-x":[{"overflow-x":K()}],"overflow-y":[{"overflow-y":K()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:P()}],"inset-x":[{"inset-x":P()}],"inset-y":[{"inset-y":P()}],start:[{start:P()}],end:[{end:P()}],top:[{top:P()}],right:[{right:P()}],bottom:[{bottom:P()}],left:[{left:P()}],visibility:["visible","invisible","collapse"],z:[{z:[Yi,"auto",Ye,Qe]}],basis:[{basis:[dc,"full","auto",c,...H()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[kt,dc,"auto","initial","none",Qe]}],grow:[{grow:["",kt,Ye,Qe]}],shrink:[{shrink:["",kt,Ye,Qe]}],order:[{order:[Yi,"first","last","none",Ye,Qe]}],"grid-cols":[{"grid-cols":ee()}],"col-start-end":[{col:Q()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":ee()}],"row-start-end":[{row:Q()}],"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":re()}],"auto-rows":[{"auto-rows":re()}],gap:[{gap:H()}],"gap-x":[{"gap-x":H()}],"gap-y":[{"gap-y":H()}],"justify-content":[{justify:[...ae(),"normal"]}],"justify-items":[{"justify-items":[...pe(),"normal"]}],"justify-self":[{"justify-self":["auto",...pe()]}],"align-content":[{content:["normal",...ae()]}],"align-items":[{items:[...pe(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...pe(),{baseline:["","last"]}]}],"place-content":[{"place-content":ae()}],"place-items":[{"place-items":[...pe(),"baseline"]}],"place-self":[{"place-self":["auto",...pe()]}],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:z()}],w:[{w:[c,"screen",...z()]}],"min-w":[{"min-w":[c,"screen","none",...z()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...z()]}],h:[{h:["screen","lh",...z()]}],"min-h":[{"min-h":["screen","lh","none",...z()]}],"max-h":[{"max-h":["screen","lh",...z()]}],"font-size":[{text:["base",n,Ed,sl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Ye,bx]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",yx,Qe]}],"font-family":[{font:[jI,Qe,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,Ye,Qe]}],"line-clamp":[{"line-clamp":[kt,"none",Ye,bx]}],leading:[{leading:[i,...H()]}],"list-image":[{"list-image":["none",Ye,Qe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ye,Qe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:R()}],"text-color":[{text:R()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:[kt,"from-font","auto",Ye,sl]}],"text-decoration-color":[{decoration:R()}],"underline-offset":[{"underline-offset":[kt,"auto",Ye,Qe]}],"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",Ye,Qe]}],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",Ye,Qe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ie()}],"bg-repeat":[{bg:q()}],"bg-size":[{bg:$()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Yi,Ye,Qe],radial:["",Ye,Qe],conic:[Yi,Ye,Qe]},SI,wI]}],"bg-color":[{bg:R()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:R()}],"gradient-via":[{via:R()}],"gradient-to":[{to:R()}],rounded:[{rounded:ce()}],"rounded-s":[{"rounded-s":ce()}],"rounded-e":[{"rounded-e":ce()}],"rounded-t":[{"rounded-t":ce()}],"rounded-r":[{"rounded-r":ce()}],"rounded-b":[{"rounded-b":ce()}],"rounded-l":[{"rounded-l":ce()}],"rounded-ss":[{"rounded-ss":ce()}],"rounded-se":[{"rounded-se":ce()}],"rounded-ee":[{"rounded-ee":ce()}],"rounded-es":[{"rounded-es":ce()}],"rounded-tl":[{"rounded-tl":ce()}],"rounded-tr":[{"rounded-tr":ce()}],"rounded-br":[{"rounded-br":ce()}],"rounded-bl":[{"rounded-bl":ce()}],"border-w":[{border:ue()}],"border-w-x":[{"border-x":ue()}],"border-w-y":[{"border-y":ue()}],"border-w-s":[{"border-s":ue()}],"border-w-e":[{"border-e":ue()}],"border-w-t":[{"border-t":ue()}],"border-w-r":[{"border-r":ue()}],"border-w-b":[{"border-b":ue()}],"border-w-l":[{"border-l":ue()}],"divide-x":[{"divide-x":ue()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ue()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...oe(),"hidden","none"]}],"divide-style":[{divide:[...oe(),"hidden","none"]}],"border-color":[{border:R()}],"border-color-x":[{"border-x":R()}],"border-color-y":[{"border-y":R()}],"border-color-s":[{"border-s":R()}],"border-color-e":[{"border-e":R()}],"border-color-t":[{"border-t":R()}],"border-color-r":[{"border-r":R()}],"border-color-b":[{"border-b":R()}],"border-color-l":[{"border-l":R()}],"divide-color":[{divide:R()}],"outline-style":[{outline:[...oe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[kt,Ye,Qe]}],"outline-w":[{outline:["",kt,Ed,sl]}],"outline-color":[{outline:R()}],shadow:[{shadow:["","none",f,jh,wh]}],"shadow-color":[{shadow:R()}],"inset-shadow":[{"inset-shadow":["none",m,jh,wh]}],"inset-shadow-color":[{"inset-shadow":R()}],"ring-w":[{ring:ue()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:R()}],"ring-offset-w":[{"ring-offset":[kt,sl]}],"ring-offset-color":[{"ring-offset":R()}],"inset-ring-w":[{"inset-ring":ue()}],"inset-ring-color":[{"inset-ring":R()}],"text-shadow":[{"text-shadow":["none",x,jh,wh]}],"text-shadow-color":[{"text-shadow":R()}],opacity:[{opacity:[kt,Ye,Qe]}],"mix-blend":[{"mix-blend":[...F(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":F()}],"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":[kt]}],"mask-image-linear-from-pos":[{"mask-linear-from":G()}],"mask-image-linear-to-pos":[{"mask-linear-to":G()}],"mask-image-linear-from-color":[{"mask-linear-from":R()}],"mask-image-linear-to-color":[{"mask-linear-to":R()}],"mask-image-t-from-pos":[{"mask-t-from":G()}],"mask-image-t-to-pos":[{"mask-t-to":G()}],"mask-image-t-from-color":[{"mask-t-from":R()}],"mask-image-t-to-color":[{"mask-t-to":R()}],"mask-image-r-from-pos":[{"mask-r-from":G()}],"mask-image-r-to-pos":[{"mask-r-to":G()}],"mask-image-r-from-color":[{"mask-r-from":R()}],"mask-image-r-to-color":[{"mask-r-to":R()}],"mask-image-b-from-pos":[{"mask-b-from":G()}],"mask-image-b-to-pos":[{"mask-b-to":G()}],"mask-image-b-from-color":[{"mask-b-from":R()}],"mask-image-b-to-color":[{"mask-b-to":R()}],"mask-image-l-from-pos":[{"mask-l-from":G()}],"mask-image-l-to-pos":[{"mask-l-to":G()}],"mask-image-l-from-color":[{"mask-l-from":R()}],"mask-image-l-to-color":[{"mask-l-to":R()}],"mask-image-x-from-pos":[{"mask-x-from":G()}],"mask-image-x-to-pos":[{"mask-x-to":G()}],"mask-image-x-from-color":[{"mask-x-from":R()}],"mask-image-x-to-color":[{"mask-x-to":R()}],"mask-image-y-from-pos":[{"mask-y-from":G()}],"mask-image-y-to-pos":[{"mask-y-to":G()}],"mask-image-y-from-color":[{"mask-y-from":R()}],"mask-image-y-to-color":[{"mask-y-to":R()}],"mask-image-radial":[{"mask-radial":[Ye,Qe]}],"mask-image-radial-from-pos":[{"mask-radial-from":G()}],"mask-image-radial-to-pos":[{"mask-radial-to":G()}],"mask-image-radial-from-color":[{"mask-radial-from":R()}],"mask-image-radial-to-color":[{"mask-radial-to":R()}],"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":L()}],"mask-image-conic-pos":[{"mask-conic":[kt]}],"mask-image-conic-from-pos":[{"mask-conic-from":G()}],"mask-image-conic-to-pos":[{"mask-conic-to":G()}],"mask-image-conic-from-color":[{"mask-conic-from":R()}],"mask-image-conic-to-color":[{"mask-conic-to":R()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ie()}],"mask-repeat":[{mask:q()}],"mask-size":[{mask:$()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ye,Qe]}],filter:[{filter:["","none",Ye,Qe]}],blur:[{blur:te()}],brightness:[{brightness:[kt,Ye,Qe]}],contrast:[{contrast:[kt,Ye,Qe]}],"drop-shadow":[{"drop-shadow":["","none",y,jh,wh]}],"drop-shadow-color":[{"drop-shadow":R()}],grayscale:[{grayscale:["",kt,Ye,Qe]}],"hue-rotate":[{"hue-rotate":[kt,Ye,Qe]}],invert:[{invert:["",kt,Ye,Qe]}],saturate:[{saturate:[kt,Ye,Qe]}],sepia:[{sepia:["",kt,Ye,Qe]}],"backdrop-filter":[{"backdrop-filter":["","none",Ye,Qe]}],"backdrop-blur":[{"backdrop-blur":te()}],"backdrop-brightness":[{"backdrop-brightness":[kt,Ye,Qe]}],"backdrop-contrast":[{"backdrop-contrast":[kt,Ye,Qe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",kt,Ye,Qe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[kt,Ye,Qe]}],"backdrop-invert":[{"backdrop-invert":["",kt,Ye,Qe]}],"backdrop-opacity":[{"backdrop-opacity":[kt,Ye,Qe]}],"backdrop-saturate":[{"backdrop-saturate":[kt,Ye,Qe]}],"backdrop-sepia":[{"backdrop-sepia":["",kt,Ye,Qe]}],"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",Ye,Qe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[kt,"initial",Ye,Qe]}],ease:[{ease:["linear","initial",k,Ye,Qe]}],delay:[{delay:[kt,Ye,Qe]}],animate:[{animate:["none",E,Ye,Qe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,Ye,Qe]}],"perspective-origin":[{"perspective-origin":O()}],rotate:[{rotate:be()}],"rotate-x":[{"rotate-x":be()}],"rotate-y":[{"rotate-y":be()}],"rotate-z":[{"rotate-z":be()}],scale:[{scale:ge()}],"scale-x":[{"scale-x":ge()}],"scale-y":[{"scale-y":ge()}],"scale-z":[{"scale-z":ge()}],"scale-3d":["scale-3d"],skew:[{skew:Ce()}],"skew-x":[{"skew-x":Ce()}],"skew-y":[{"skew-y":Ce()}],transform:[{transform:[Ye,Qe,"","none","gpu","cpu"]}],"transform-origin":[{origin:O()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:We()}],"translate-x":[{"translate-x":We()}],"translate-y":[{"translate-y":We()}],"translate-z":[{"translate-z":We()}],"translate-none":["translate-none"],accent:[{accent:R()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:R()}],"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",Ye,Qe]}],"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",Ye,Qe]}],fill:[{fill:["none",...R()]}],"stroke-w":[{stroke:[kt,Ed,sl,bx]}],stroke:[{stroke:["none",...R()]}],"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(EI);function Gt(...t){return MI(Kj(t))}function vo(t){if(!t)return"";let e=t.trim();return e?(e=e.replace(/^(https?)\/\//,"$1://"),e):""}const AI=qj("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?Uj:"button";return s.jsx(i,{"data-slot":"button",className:Gt(AI({variant:e,size:n,className:t})),...a})}function le({className:t,type:e,...n}){return s.jsx("input",{type:e,"data-slot":"input",className:Gt("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=Ra(),[e,n]=b.useState(""),[r,a]=b.useState(""),[i,o]=b.useState(""),[c,u]=b.useState(!1);b.useEffect(()=>{gu()&&t("/dashboard",{replace:!0})},[t]);const h=async()=>{o(""),u(!0);try{const f=await St("/api/admin",{username:e.trim(),password:r});if((f==null?void 0:f.success)!==!1&&(f!=null&&f.token)){EA(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(jc,{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(le,{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(mM,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(le,{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=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Gt("rounded-xl border bg-card text-card-foreground shadow",t),...e}));_e.displayName="Card";const ct=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Gt("flex flex-col space-y-1.5 p-6",t),...e}));ct.displayName="CardHeader";const dt=b.forwardRef(({className:t,...e},n)=>s.jsx("h3",{ref:n,className:Gt("font-semibold leading-none tracking-tight",t),...e}));dt.displayName="CardTitle";const Yt=b.forwardRef(({className:t,...e},n)=>s.jsx("p",{ref:n,className:Gt("text-sm text-muted-foreground",t),...e}));Yt.displayName="CardDescription";const ze=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Gt("p-6 pt-0",t),...e}));ze.displayName="CardContent";const RI=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Gt("flex items-center p-6 pt-0",t),...e}));RI.displayName="CardFooter";const PI={success:{bg:"#f0fdf4",border:"#22c55e",icon:"✓"},error:{bg:"#fef2f2",border:"#ef4444",icon:"✕"},info:{bg:"#eff6ff",border:"#3b82f6",icon:"ℹ"}};function vx(t,e="info",n=3e3){const r=`toast-${Date.now()}`,a=PI[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 X={success:(t,e)=>vx(t,"success",e),error:(t,e)=>vx(t,"error",e),info:(t,e)=>vx(t,"info",e)};function Nt(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=b.createContext(e),r=i=>{const{children:o,...c}=i,u=b.useMemo(()=>c,Object.values(c));return s.jsx(n.Provider,{value:u,children:o})};r.displayName=t+"Provider";function a(i){const o=b.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${i}\` must be used within \`${t}\``)}return[r,a]}function Eo(t,e=[]){let n=[];function r(i,o){const c=b.createContext(o),u=n.length;n=[...n,o];const h=m=>{var k;const{scope:x,children:y,...v}=m,w=((k=x==null?void 0:x[t])==null?void 0:k[u])||c,N=b.useMemo(()=>v,Object.values(v));return s.jsx(w.Provider,{value:N,children:y})};h.displayName=i+"Provider";function f(m,x){var w;const y=((w=x==null?void 0:x[t])==null?void 0:w[u])||c,v=b.useContext(y);if(v)return v;if(o!==void 0)return o;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[h,f]}const a=()=>{const i=n.map(o=>b.createContext(o));return function(c){const u=(c==null?void 0:c[t])||i;return b.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])}};return a.scopeName=t,[r,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 b.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var Ss=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},DI=lp[" useId ".trim().toString()]||(()=>{}),_I=0;function mo(t){const[e,n]=b.useState(DI());return Ss(()=>{n(r=>r??String(_I++))},[t]),e?`radix-${e}`:""}var zI=lp[" useInsertionEffect ".trim().toString()]||Ss;function bl({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[a,i,o]=$I({defaultProp:e,onChange:n}),c=t!==void 0,u=c?t:a;{const f=b.useRef(t!==void 0);b.useEffect(()=>{const m=f.current;m!==c&&console.warn(`${r} is changing from ${m?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=c},[c,r])}const h=b.useCallback(f=>{var m;if(c){const x=FI(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 $I({defaultProp:t,onChange:e}){const[n,r]=b.useState(t),a=b.useRef(n),i=b.useRef(e);return zI(()=>{i.current=e},[e]),b.useEffect(()=>{var o;a.current!==n&&((o=i.current)==null||o.call(i,n),a.current=n)},[n,a]),[n,r,i]}function FI(t){return typeof t=="function"}function tu(t){const e=BI(t),n=b.forwardRef((r,a)=>{const{children:i,...o}=r,c=b.Children.toArray(i),u=c.find(HI);if(u){const h=u.props.children,f=c.map(m=>m===u?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return s.jsx(e,{...o,ref:a,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return s.jsx(e,{...o,ref:a,children:i})});return n.displayName=`${t}.Slot`,n}function BI(t){const e=b.forwardRef((n,r)=>{const{children:a,...i}=n;if(b.isValidElement(a)){const o=WI(a),c=UI(i,a.props);return a.type!==b.Fragment&&(c.ref=r?M0(r,o):o),b.cloneElement(a,c)}return b.Children.count(a)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var VI=Symbol("radix.slottable");function HI(t){return b.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"],Ct=KI.reduce((t,e)=>{const n=tu(`Primitive.${e}`),r=b.forwardRef((a,i)=>{const{asChild:o,...c}=a,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function qI(t,e){t&&xu.flushSync(()=>t.dispatchEvent(e))}function No(t){const e=b.useRef(t);return b.useEffect(()=>{e.current=t}),b.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function GI(t,e=globalThis==null?void 0:globalThis.document){const n=No(t);b.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var JI="DismissableLayer",kg="dismissableLayer.update",QI="dismissableLayer.pointerDownOutside",YI="dismissableLayer.focusOutside",I1,ik=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),I0=b.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,onDismiss:c,...u}=t,h=b.useContext(ik),[f,m]=b.useState(null),x=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=b.useState({}),v=qt(e,_=>m(_)),w=Array.from(h.layers),[N]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),k=w.indexOf(N),E=f?w.indexOf(f):-1,C=h.layersWithOutsidePointerEventsDisabled.size>0,L=E>=k,O=eR(_=>{const H=_.target,P=[...h.branches].some(ee=>ee.contains(H));!L||P||(a==null||a(_),o==null||o(_),_.defaultPrevented||c==null||c())},x),K=tR(_=>{const H=_.target;[...h.branches].some(ee=>ee.contains(H))||(i==null||i(_),o==null||o(_),_.defaultPrevented||c==null||c())},x);return GI(_=>{E===h.layers.size-1&&(r==null||r(_),!_.defaultPrevented&&c&&(_.preventDefault(),c()))},x),b.useEffect(()=>{if(f)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(I1=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),R1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=I1)}},[f,x,n,h]),b.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),R1())},[f,h]),b.useEffect(()=>{const _=()=>y({});return document.addEventListener(kg,_),()=>document.removeEventListener(kg,_)},[]),s.jsx(Ct.div,{...u,ref:v,style:{pointerEvents:C?L?"auto":"none":void 0,...t.style},onFocusCapture:Nt(t.onFocusCapture,K.onFocusCapture),onBlurCapture:Nt(t.onBlurCapture,K.onBlurCapture),onPointerDownCapture:Nt(t.onPointerDownCapture,O.onPointerDownCapture)})});I0.displayName=JI;var XI="DismissableLayerBranch",ZI=b.forwardRef((t,e)=>{const n=b.useContext(ik),r=b.useRef(null),a=qt(e,r);return b.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),s.jsx(Ct.div,{...t,ref:a})});ZI.displayName=XI;function eR(t,e=globalThis==null?void 0:globalThis.document){const n=No(t),r=b.useRef(!1),a=b.useRef(()=>{});return b.useEffect(()=>{const i=c=>{if(c.target&&!r.current){let u=function(){ok(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 tR(t,e=globalThis==null?void 0:globalThis.document){const n=No(t),r=b.useRef(!1);return b.useEffect(()=>{const a=i=>{i.target&&!r.current&&ok(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 R1(){const t=new CustomEvent(kg);document.dispatchEvent(t)}function ok(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 Nx="focusScope.autoFocusOnMount",wx="focusScope.autoFocusOnUnmount",P1={bubbles:!1,cancelable:!0},nR="FocusScope",R0=b.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=t,[c,u]=b.useState(null),h=No(a),f=No(i),m=b.useRef(null),x=qt(e,w=>u(w)),y=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(r){let w=function(C){if(y.paused||!c)return;const L=C.target;c.contains(L)?m.current=L:eo(m.current,{select:!0})},N=function(C){if(y.paused||!c)return;const L=C.relatedTarget;L!==null&&(c.contains(L)||eo(m.current,{select:!0}))},k=function(C){if(document.activeElement===document.body)for(const O of C)O.removedNodes.length>0&&eo(c)};document.addEventListener("focusin",w),document.addEventListener("focusout",N);const E=new MutationObserver(k);return c&&E.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",N),E.disconnect()}}},[r,c,y.paused]),b.useEffect(()=>{if(c){O1.add(y);const w=document.activeElement;if(!c.contains(w)){const k=new CustomEvent(Nx,P1);c.addEventListener(Nx,h),c.dispatchEvent(k),k.defaultPrevented||(sR(lR(lk(c)),{select:!0}),document.activeElement===w&&eo(c))}return()=>{c.removeEventListener(Nx,h),setTimeout(()=>{const k=new CustomEvent(wx,P1);c.addEventListener(wx,f),c.dispatchEvent(k),k.defaultPrevented||eo(w??document.body,{select:!0}),c.removeEventListener(wx,f),O1.remove(y)},0)}}},[c,h,f,y]);const v=b.useCallback(w=>{if(!n&&!r||y.paused)return;const N=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,k=document.activeElement;if(N&&k){const E=w.currentTarget,[C,L]=rR(E);C&&L?!w.shiftKey&&k===L?(w.preventDefault(),n&&eo(C,{select:!0})):w.shiftKey&&k===C&&(w.preventDefault(),n&&eo(L,{select:!0})):k===E&&w.preventDefault()}},[n,r,y.paused]);return s.jsx(Ct.div,{tabIndex:-1,...o,ref:x,onKeyDown:v})});R0.displayName=nR;function sR(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(eo(r,{select:e}),document.activeElement!==n)return}function rR(t){const e=lk(t),n=L1(e,t),r=L1(e.reverse(),t);return[n,r]}function lk(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 L1(t,e){for(const n of t)if(!aR(n,{upTo:e}))return n}function aR(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 iR(t){return t instanceof HTMLInputElement&&"select"in t}function eo(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&iR(t)&&e&&t.select()}}var O1=oR();function oR(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=D1(t,e),t.unshift(e)},remove(e){var n;t=D1(t,e),(n=t[0])==null||n.resume()}}}function D1(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function lR(t){return t.filter(e=>e.tagName!=="A")}var cR="Portal",P0=b.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[a,i]=b.useState(!1);Ss(()=>i(!0),[]);const o=n||a&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return o?Nj.createPortal(s.jsx(Ct.div,{...r,ref:e}),o):null});P0.displayName=cR;function dR(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}var yu=t=>{const{present:e,children:n}=t,r=uR(e),a=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),i=qt(r.ref,hR(a));return typeof n=="function"||r.isPresent?b.cloneElement(a,{ref:i}):null};yu.displayName="Presence";function uR(t){const[e,n]=b.useState(),r=b.useRef(null),a=b.useRef(t),i=b.useRef("none"),o=t?"mounted":"unmounted",[c,u]=dR(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const h=kh(r.current);i.current=c==="mounted"?h:"none"},[c]),Ss(()=>{const h=r.current,f=a.current;if(f!==t){const x=i.current,y=kh(h);t?u("MOUNT"):y==="none"||(h==null?void 0:h.display)==="none"?u("UNMOUNT"):u(f&&x!==y?"ANIMATION_OUT":"UNMOUNT"),a.current=t}},[t,u]),Ss(()=>{if(e){let h;const f=e.ownerDocument.defaultView??window,m=y=>{const w=kh(r.current).includes(CSS.escape(y.animationName));if(y.target===e&&w&&(u("ANIMATION_END"),!a.current)){const N=e.style.animationFillMode;e.style.animationFillMode="forwards",h=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=N)})}},x=y=>{y.target===e&&(i.current=kh(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:b.useCallback(h=>{r.current=h?getComputedStyle(h):null,n(h)},[])}}function kh(t){return(t==null?void 0:t.animationName)||"none"}function hR(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 jx=0;function ck(){b.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??_1()),document.body.insertAdjacentElement("beforeend",t[1]??_1()),jx++,()=>{jx===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),jx--}},[])}function _1(){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 ka=function(){return ka=Object.assign||function(e){for(var n,r=1,a=arguments.length;r"u")return MR;var e=AR(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])}},RR=fk(),Ec="data-scroll-locked",PR=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(pR,` { - overflow: hidden `).concat(r,`; - padding-right: `).concat(c,"px ").concat(r,`; - } - body[`).concat(Ec,`] { - 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(Kh,` { - right: `).concat(c,"px ").concat(r,`; - } - - .`).concat(qh,` { - margin-right: `).concat(c,"px ").concat(r,`; - } - - .`).concat(Kh," .").concat(Kh,` { - right: 0 `).concat(r,`; - } - - .`).concat(qh," .").concat(qh,` { - margin-right: 0 `).concat(r,`; - } - - body[`).concat(Ec,`] { - `).concat(mR,": ").concat(c,`px; - } -`)},$1=function(){var t=parseInt(document.body.getAttribute(Ec)||"0",10);return isFinite(t)?t:0},LR=function(){b.useEffect(function(){return document.body.setAttribute(Ec,($1()+1).toString()),function(){var t=$1()-1;t<=0?document.body.removeAttribute(Ec):document.body.setAttribute(Ec,t.toString())}},[])},OR=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,a=r===void 0?"margin":r;LR();var i=b.useMemo(function(){return IR(a)},[a]);return b.createElement(RR,{styles:PR(i,!e,a,n?"":"!important")})},Sg=!1;if(typeof window<"u")try{var Sh=Object.defineProperty({},"passive",{get:function(){return Sg=!0,!0}});window.addEventListener("test",Sh,Sh),window.removeEventListener("test",Sh,Sh)}catch{Sg=!1}var uc=Sg?{passive:!1}:!1,DR=function(t){return t.tagName==="TEXTAREA"},pk=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!DR(t)&&n[e]==="visible")},_R=function(t){return pk(t,"overflowY")},zR=function(t){return pk(t,"overflowX")},F1=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=mk(t,r);if(a){var i=xk(t,r),o=i[1],c=i[2];if(o>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},$R=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},FR=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},mk=function(t,e){return t==="v"?_R(e):zR(e)},xk=function(t,e){return t==="v"?$R(e):FR(e)},BR=function(t,e){return t==="h"&&e==="rtl"?-1:1},VR=function(t,e,n,r,a){var i=BR(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 y=xk(t,c),v=y[0],w=y[1],N=y[2],k=w-N-i*v;(v||k)&&mk(t,c)&&(m+=k,x+=v);var E=c.parentNode;c=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!u&&c!==document.body||u&&(e.contains(c)||e===c));return(f&&Math.abs(m)<1||!f&&Math.abs(x)<1)&&(h=!0),h},Ch=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},B1=function(t){return[t.deltaX,t.deltaY]},V1=function(t){return t&&"current"in t?t.current:t},HR=function(t,e){return t[0]===e[0]&&t[1]===e[1]},UR=function(t){return` - .block-interactivity-`.concat(t,` {pointer-events: none;} - .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},WR=0,hc=[];function KR(t){var e=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),a=b.useState(WR++)[0],i=b.useState(fk)[0],o=b.useRef(t);b.useEffect(function(){o.current=t},[t]),b.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(a));var w=fR([t.lockRef.current],(t.shards||[]).map(V1),!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=b.useCallback(function(w,N){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!o.current.allowPinchZoom;var k=Ch(w),E=n.current,C="deltaX"in w?w.deltaX:E[0]-k[0],L="deltaY"in w?w.deltaY:E[1]-k[1],O,K=w.target,_=Math.abs(C)>Math.abs(L)?"h":"v";if("touches"in w&&_==="h"&&K.type==="range")return!1;var H=window.getSelection(),P=H&&H.anchorNode,ee=P?P===K||P.contains(K):!1;if(ee)return!1;var Q=F1(_,K);if(!Q)return!0;if(Q?O=_:(O=_==="v"?"h":"v",Q=F1(_,K)),!Q)return!1;if(!r.current&&"changedTouches"in w&&(C||L)&&(r.current=O),!O)return!0;var V=r.current||O;return VR(V,N,w,V==="h"?C:L)},[]),u=b.useCallback(function(w){var N=w;if(!(!hc.length||hc[hc.length-1]!==i)){var k="deltaY"in N?B1(N):Ch(N),E=e.current.filter(function(O){return O.name===N.type&&(O.target===N.target||N.target===O.shadowParent)&&HR(O.delta,k)})[0];if(E&&E.should){N.cancelable&&N.preventDefault();return}if(!E){var C=(o.current.shards||[]).map(V1).filter(Boolean).filter(function(O){return O.contains(N.target)}),L=C.length>0?c(N,C[0]):!o.current.noIsolation;L&&N.cancelable&&N.preventDefault()}}},[]),h=b.useCallback(function(w,N,k,E){var C={name:w,delta:N,target:k,should:E,shadowParent:qR(k)};e.current.push(C),setTimeout(function(){e.current=e.current.filter(function(L){return L!==C})},1)},[]),f=b.useCallback(function(w){n.current=Ch(w),r.current=void 0},[]),m=b.useCallback(function(w){h(w.type,B1(w),w.target,c(w,t.lockRef.current))},[]),x=b.useCallback(function(w){h(w.type,Ch(w),w.target,c(w,t.lockRef.current))},[]);b.useEffect(function(){return hc.push(i),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:x}),document.addEventListener("wheel",u,uc),document.addEventListener("touchmove",u,uc),document.addEventListener("touchstart",f,uc),function(){hc=hc.filter(function(w){return w!==i}),document.removeEventListener("wheel",u,uc),document.removeEventListener("touchmove",u,uc),document.removeEventListener("touchstart",f,uc)}},[]);var y=t.removeScrollBar,v=t.inert;return b.createElement(b.Fragment,null,v?b.createElement(i,{styles:UR(a)}):null,y?b.createElement(OR,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function qR(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const GR=wR(hk,KR);var L0=b.forwardRef(function(t,e){return b.createElement(hp,ka({},t,{ref:e,sideCar:GR}))});L0.classNames=hp.classNames;var JR=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},fc=new WeakMap,Th=new WeakMap,Eh={},Tx=0,gk=function(t){return t&&(t.host||gk(t.parentNode))},QR=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=gk(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})},YR=function(t,e,n,r){var a=QR(e,Array.isArray(t)?t:[t]);Eh[n]||(Eh[n]=new WeakMap);var i=Eh[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 y=x.getAttribute(r),v=y!==null&&y!=="false",w=(fc.get(x)||0)+1,N=(i.get(x)||0)+1;fc.set(x,w),i.set(x,N),o.push(x),w===1&&v&&Th.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(),Tx++,function(){o.forEach(function(m){var x=fc.get(m)-1,y=i.get(m)-1;fc.set(m,x),i.set(m,y),x||(Th.has(m)||m.removeAttribute(r),Th.delete(m)),y||m.removeAttribute(n)}),Tx--,Tx||(fc=new WeakMap,fc=new WeakMap,Th=new WeakMap,Eh={})}},yk=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),a=JR(t);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),YR(r,a,n,"aria-hidden")):function(){return null}},fp="Dialog",[bk]=Eo(fp),[XR,oa]=bk(fp),vk=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:a,onOpenChange:i,modal:o=!0}=t,c=b.useRef(null),u=b.useRef(null),[h,f]=bl({prop:r,defaultProp:a??!1,onChange:i,caller:fp});return s.jsx(XR,{scope:e,triggerRef:c,contentRef:u,contentId:mo(),titleId:mo(),descriptionId:mo(),open:h,onOpenChange:f,onOpenToggle:b.useCallback(()=>f(m=>!m),[f]),modal:o,children:n})};vk.displayName=fp;var Nk="DialogTrigger",ZR=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=oa(Nk,n),i=qt(e,a.triggerRef);return s.jsx(Ct.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":_0(a.open),...r,ref:i,onClick:Nt(t.onClick,a.onOpenToggle)})});ZR.displayName=Nk;var O0="DialogPortal",[eP,wk]=bk(O0,{forceMount:void 0}),jk=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:a}=t,i=oa(O0,e);return s.jsx(eP,{scope:e,forceMount:n,children:b.Children.map(r,o=>s.jsx(yu,{present:n||i.open,children:s.jsx(P0,{asChild:!0,container:a,children:o})}))})};jk.displayName=O0;var df="DialogOverlay",kk=b.forwardRef((t,e)=>{const n=wk(df,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=oa(df,t.__scopeDialog);return i.modal?s.jsx(yu,{present:r||i.open,children:s.jsx(nP,{...a,ref:e})}):null});kk.displayName=df;var tP=tu("DialogOverlay.RemoveScroll"),nP=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=oa(df,n);return s.jsx(L0,{as:tP,allowPinchZoom:!0,shards:[a.contentRef],children:s.jsx(Ct.div,{"data-state":_0(a.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),vl="DialogContent",Sk=b.forwardRef((t,e)=>{const n=wk(vl,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=oa(vl,t.__scopeDialog);return s.jsx(yu,{present:r||i.open,children:i.modal?s.jsx(sP,{...a,ref:e}):s.jsx(rP,{...a,ref:e})})});Sk.displayName=vl;var sP=b.forwardRef((t,e)=>{const n=oa(vl,t.__scopeDialog),r=b.useRef(null),a=qt(e,n.contentRef,r);return b.useEffect(()=>{const i=r.current;if(i)return yk(i)},[]),s.jsx(Ck,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Nt(t.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Nt(t.onPointerDownOutside,i=>{const o=i.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0;(o.button===2||c)&&i.preventDefault()}),onFocusOutside:Nt(t.onFocusOutside,i=>i.preventDefault())})}),rP=b.forwardRef((t,e)=>{const n=oa(vl,t.__scopeDialog),r=b.useRef(!1),a=b.useRef(!1);return s.jsx(Ck,{...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()}})}),Ck=b.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,...o}=t,c=oa(vl,n),u=b.useRef(null),h=qt(e,u);return ck(),s.jsxs(s.Fragment,{children:[s.jsx(R0,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:s.jsx(I0,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":_0(c.open),...o,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(aP,{titleId:c.titleId}),s.jsx(oP,{contentRef:u,descriptionId:c.descriptionId})]})]})}),D0="DialogTitle",Tk=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=oa(D0,n);return s.jsx(Ct.h2,{id:a.titleId,...r,ref:e})});Tk.displayName=D0;var Ek="DialogDescription",Mk=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=oa(Ek,n);return s.jsx(Ct.p,{id:a.descriptionId,...r,ref:e})});Mk.displayName=Ek;var Ak="DialogClose",Ik=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=oa(Ak,n);return s.jsx(Ct.button,{type:"button",...r,ref:e,onClick:Nt(t.onClick,()=>a.onOpenChange(!1))})});Ik.displayName=Ak;function _0(t){return t?"open":"closed"}var Rk="DialogTitleWarning",[OV,Pk]=LI(Rk,{contentName:vl,titleName:D0,docsSlug:"dialog"}),aP=({titleId:t})=>{const e=Pk(Rk),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return b.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},iP="DialogDescriptionWarning",oP=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Pk(iP).contentName}}.`;return b.useEffect(()=>{var i;const a=(i=t.current)==null?void 0:i.getAttribute("aria-describedby");e&&a&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},lP=vk,cP=jk,dP=kk,uP=Sk,hP=Tk,fP=Mk,pP=Ik;function $t(t){return s.jsx(lP,{"data-slot":"dialog",...t})}function mP(t){return s.jsx(cP,{...t})}const Lk=b.forwardRef(({className:t,...e},n)=>s.jsx(dP,{ref:n,className:Gt("fixed inset-0 z-50 bg-black/50",t),...e}));Lk.displayName="DialogOverlay";const zt=b.forwardRef(({className:t,children:e,showCloseButton:n=!0,...r},a)=>s.jsxs(mP,{children:[s.jsx(Lk,{}),s.jsxs(uP,{ref:a,"aria-describedby":void 0,className:Gt("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(pP,{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(ts,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));zt.displayName="DialogContent";function Ft({className:t,...e}){return s.jsx("div",{className:Gt("flex flex-col gap-2 text-center sm:text-left",t),...e})}function yn({className:t,...e}){return s.jsx("div",{className:Gt("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function Bt(t){return s.jsx(hP,{className:"text-lg font-semibold leading-none",...t})}function uf(t){return s.jsx(fP,{className:"text-sm text-muted-foreground",...t})}const xP=qj("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?Uj:"span";return s.jsx(a,{className:Gt(xP({variant:e}),t),...r})}var gP=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],yP=gP.reduce((t,e)=>{const n=Hj(`Primitive.${e}`),r=b.forwardRef((a,i)=>{const{asChild:o,...c}=a,u=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...c,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),bP="Label",Ok=b.forwardRef((t,e)=>s.jsx(yP.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())}}));Ok.displayName=bP;var Dk=Ok;const Z=b.forwardRef(({className:t,...e},n)=>s.jsx(Dk,{ref:n,className:Gt("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));Z.displayName=Dk.displayName;function z0(t){const e=t+"CollectionProvider",[n,r]=Eo(e),[a,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=w=>{const{scope:N,children:k}=w,E=_s.useRef(null),C=_s.useRef(new Map).current;return s.jsx(a,{scope:N,itemMap:C,collectionRef:E,children:k})};o.displayName=e;const c=t+"CollectionSlot",u=tu(c),h=_s.forwardRef((w,N)=>{const{scope:k,children:E}=w,C=i(c,k),L=qt(N,C.collectionRef);return s.jsx(u,{ref:L,children:E})});h.displayName=c;const f=t+"CollectionItemSlot",m="data-radix-collection-item",x=tu(f),y=_s.forwardRef((w,N)=>{const{scope:k,children:E,...C}=w,L=_s.useRef(null),O=qt(N,L),K=i(f,k);return _s.useEffect(()=>(K.itemMap.set(L,{ref:L,...C}),()=>void K.itemMap.delete(L))),s.jsx(x,{[m]:"",ref:O,children:E})});y.displayName=f;function v(w){const N=i(t+"CollectionConsumer",w);return _s.useCallback(()=>{const E=N.collectionRef.current;if(!E)return[];const C=Array.from(E.querySelectorAll(`[${m}]`));return Array.from(N.itemMap.values()).sort((K,_)=>C.indexOf(K.ref.current)-C.indexOf(_.ref.current))},[N.collectionRef,N.itemMap])}return[{Provider:o,Slot:h,ItemSlot:y},v,r]}var vP=b.createContext(void 0);function pp(t){const e=b.useContext(vP);return t||e||"ltr"}var Ex="rovingFocusGroup.onEntryFocus",NP={bubbles:!1,cancelable:!0},bu="RovingFocusGroup",[Cg,_k,wP]=z0(bu),[jP,zk]=Eo(bu,[wP]),[kP,SP]=jP(bu),$k=b.forwardRef((t,e)=>s.jsx(Cg.Provider,{scope:t.__scopeRovingFocusGroup,children:s.jsx(Cg.Slot,{scope:t.__scopeRovingFocusGroup,children:s.jsx(CP,{...t,ref:e})})}));$k.displayName=bu;var CP=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,x=b.useRef(null),y=qt(e,x),v=pp(i),[w,N]=bl({prop:o,defaultProp:c??null,onChange:u,caller:bu}),[k,E]=b.useState(!1),C=No(h),L=_k(n),O=b.useRef(!1),[K,_]=b.useState(0);return b.useEffect(()=>{const H=x.current;if(H)return H.addEventListener(Ex,C),()=>H.removeEventListener(Ex,C)},[C]),s.jsx(kP,{scope:n,orientation:r,dir:v,loop:a,currentTabStopId:w,onItemFocus:b.useCallback(H=>N(H),[N]),onItemShiftTab:b.useCallback(()=>E(!0),[]),onFocusableItemAdd:b.useCallback(()=>_(H=>H+1),[]),onFocusableItemRemove:b.useCallback(()=>_(H=>H-1),[]),children:s.jsx(Ct.div,{tabIndex:k||K===0?-1:0,"data-orientation":r,...m,ref:y,style:{outline:"none",...t.style},onMouseDown:Nt(t.onMouseDown,()=>{O.current=!0}),onFocus:Nt(t.onFocus,H=>{const P=!O.current;if(H.target===H.currentTarget&&P&&!k){const ee=new CustomEvent(Ex,NP);if(H.currentTarget.dispatchEvent(ee),!ee.defaultPrevented){const Q=L().filter(I=>I.focusable),V=Q.find(I=>I.active),re=Q.find(I=>I.id===w),pe=[V,re,...Q].filter(Boolean).map(I=>I.ref.current);Vk(pe,f)}}O.current=!1}),onBlur:Nt(t.onBlur,()=>E(!1))})})}),Fk="RovingFocusGroupItem",Bk=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:i,children:o,...c}=t,u=mo(),h=i||u,f=SP(Fk,n),m=f.currentTabStopId===h,x=_k(n),{onFocusableItemAdd:y,onFocusableItemRemove:v,currentTabStopId:w}=f;return b.useEffect(()=>{if(r)return y(),()=>v()},[r,y,v]),s.jsx(Cg.ItemSlot,{scope:n,id:h,focusable:r,active:a,children:s.jsx(Ct.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:Nt(t.onMouseDown,N=>{r?f.onItemFocus(h):N.preventDefault()}),onFocus:Nt(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:Nt(t.onKeyDown,N=>{if(N.key==="Tab"&&N.shiftKey){f.onItemShiftTab();return}if(N.target!==N.currentTarget)return;const k=MP(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(L=>L.focusable).map(L=>L.ref.current);if(k==="last")C.reverse();else if(k==="prev"||k==="next"){k==="prev"&&C.reverse();const L=C.indexOf(N.currentTarget);C=f.loop?AP(C,L+1):C.slice(L+1)}setTimeout(()=>Vk(C))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:w!=null}):o})})});Bk.displayName=Fk;var TP={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function EP(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function MP(t,e,n){const r=EP(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return TP[r]}function Vk(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function AP(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var IP=$k,RP=Bk,mp="Tabs",[PP]=Eo(mp,[zk]),Hk=zk(),[LP,$0]=PP(mp),Uk=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:i,orientation:o="horizontal",dir:c,activationMode:u="automatic",...h}=t,f=pp(c),[m,x]=bl({prop:r,onChange:a,defaultProp:i??"",caller:mp});return s.jsx(LP,{scope:n,baseId:mo(),value:m,onValueChange:x,orientation:o,dir:f,activationMode:u,children:s.jsx(Ct.div,{dir:f,"data-orientation":o,...h,ref:e})})});Uk.displayName=mp;var Wk="TabsList",Kk=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...a}=t,i=$0(Wk,n),o=Hk(n);return s.jsx(IP,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:s.jsx(Ct.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:e})})});Kk.displayName=Wk;var qk="TabsTrigger",Gk=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...i}=t,o=$0(qk,n),c=Hk(n),u=Yk(o.baseId,r),h=Xk(o.baseId,r),f=r===o.value;return s.jsx(RP,{asChild:!0,...c,focusable:!a,active:f,children:s.jsx(Ct.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:Nt(t.onMouseDown,m=>{!a&&m.button===0&&m.ctrlKey===!1?o.onValueChange(r):m.preventDefault()}),onKeyDown:Nt(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&o.onValueChange(r)}),onFocus:Nt(t.onFocus,()=>{const m=o.activationMode!=="manual";!f&&!a&&m&&o.onValueChange(r)})})})});Gk.displayName=qk;var Jk="TabsContent",Qk=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:a,children:i,...o}=t,c=$0(Jk,n),u=Yk(c.baseId,r),h=Xk(c.baseId,r),f=r===c.value,m=b.useRef(f);return b.useEffect(()=>{const x=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(x)},[]),s.jsx(yu,{present:a||f,children:({present:x})=>s.jsx(Ct.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})})});Qk.displayName=Jk;function Yk(t,e){return`${t}-trigger-${e}`}function Xk(t,e){return`${t}-content-${e}`}var OP=Uk,Zk=Kk,e2=Gk,t2=Qk;const Dc=OP,Nl=b.forwardRef(({className:t,...e},n)=>s.jsx(Zk,{ref:n,className:Gt("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));Nl.displayName=Zk.displayName;const tn=b.forwardRef(({className:t,...e},n)=>s.jsx(e2,{ref:n,className:Gt("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...e}));tn.displayName=e2.displayName;const nn=b.forwardRef(({className:t,...e},n)=>s.jsx(t2,{ref:n,className:Gt("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));nn.displayName=t2.displayName;function F0(t){const e=b.useRef({value:t,previous:t});return b.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function B0(t){const[e,n]=b.useState(void 0);return Ss(()=>{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 xp="Switch",[DP]=Eo(xp),[_P,zP]=DP(xp),n2=b.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:i,required:o,disabled:c,value:u="on",onCheckedChange:h,form:f,...m}=t,[x,y]=b.useState(null),v=qt(e,C=>y(C)),w=b.useRef(!1),N=x?f||!!x.closest("form"):!0,[k,E]=bl({prop:a,defaultProp:i??!1,onChange:h,caller:xp});return s.jsxs(_P,{scope:n,checked:k,disabled:c,children:[s.jsx(Ct.button,{type:"button",role:"switch","aria-checked":k,"aria-required":o,"data-state":i2(k),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:v,onClick:Nt(t.onClick,C=>{E(L=>!L),N&&(w.current=C.isPropagationStopped(),w.current||C.stopPropagation())})}),N&&s.jsx(a2,{control:x,bubbles:!w.current,name:r,value:u,checked:k,required:o,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});n2.displayName=xp;var s2="SwitchThumb",r2=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,a=zP(s2,n);return s.jsx(Ct.span,{"data-state":i2(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:e})});r2.displayName=s2;var $P="SwitchBubbleInput",a2=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...a},i)=>{const o=b.useRef(null),c=qt(o,i),u=F0(n),h=B0(e);return b.useEffect(()=>{const f=o.current;if(!f)return;const m=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&y){const v=new Event("click",{bubbles:r});y.call(f,n),f.dispatchEvent(v)}},[u,n,r]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:c,style:{...a.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});a2.displayName=$P;function i2(t){return t?"checked":"unchecked"}var o2=n2,FP=r2;const Vt=b.forwardRef(({className:t,...e},n)=>s.jsx(o2,{className:Gt("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(FP,{className:Gt("pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Vt.displayName=o2.displayName;const BP={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 VP(t){return BP[t]||t||"行为"}function HP(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 V0({open:t,onClose:e,userId:n,onUserUpdated:r}){var Oa,sr,Ms,rr,yr,As;const[a,i]=b.useState(null),[o,c]=b.useState([]),[u,h]=b.useState({}),[f,m]=b.useState([]),[x,y]=b.useState(null),[v,w]=b.useState(null),[N,k]=b.useState(!1),[E,C]=b.useState(!1),[L,O]=b.useState(!1),[K,_]=b.useState("info"),[H,P]=b.useState(""),[ee,Q]=b.useState(""),[V,re]=b.useState(""),[ae,pe]=b.useState([]),[I,z]=b.useState(""),[R,ie]=b.useState(""),[q,$]=b.useState(""),[U,ce]=b.useState(!1),[ue,oe]=b.useState({isVip:!1,vipExpireDate:"",vipRole:"",vipName:"",vipProject:"",vipContact:"",vipBio:""}),[F,G]=b.useState([]),[te,be]=b.useState(!1),[ge,Ce]=b.useState(""),[We,gt]=b.useState(""),[Lt,yt]=b.useState(!1),[Ot,It]=b.useState(!1),[Pn,vn]=b.useState(null),[Ht,Xt]=b.useState(null),[Cn,Fn]=b.useState(""),[Un,At]=b.useState(""),[xn,Nn]=b.useState(""),[ve,Te]=b.useState(!1),[Ve,st]=b.useState(null),[Mt,jt]=b.useState(!1),[D,Ie]=b.useState({}),[vt,Rt]=b.useState([]);b.useEffect(()=>{t&&n&&(jt(!1),_("info"),vn(null),Xt(null),st(null),ie(""),$(""),it(),De("/api/db/vip-roles").then(se=>{se!=null&&se.success&&se.data&&G(se.data)}).catch(()=>{}))},[t,n]),b.useEffect(()=>{t&&De("/api/admin/mbti-avatars").then(se=>{se!=null&&se.avatars&&typeof se.avatars=="object"?Ie(se.avatars):Ie({})}).catch(()=>Ie({}))},[t]);const bt=(se,ye)=>{const Ge=(se||"").trim();if(Ge)return vo(Ge);const ft=(ye||"").trim().toUpperCase();return/^[EI][NS][FT][JP]$/.test(ft)?(D[ft]||"").trim():""};async function it(){if(n){k(!0);try{const se=await De(`/api/db/users?id=${encodeURIComponent(n)}`);if(se!=null&&se.success&&se.user){const ye=se.user;i(ye),P(ye.phone||""),Q(ye.wechatId||""),re(ye.nickname||""),Fn(ye.phone||""),At(ye.wechatId||""),Nn(ye.openId||"");try{pe(typeof ye.tags=="string"?JSON.parse(ye.tags||"[]"):[])}catch{pe([])}oe({isVip:!!(ye.isVip??!1),vipExpireDate:ye.vipExpireDate?String(ye.vipExpireDate).slice(0,10):"",vipRole:String(ye.vipRole??""),vipName:String(ye.vipName??""),vipProject:String(ye.vipProject??""),vipContact:String(ye.vipContact??""),vipBio:String(ye.vipBio??"")})}try{const ye=await De(`/api/admin/user/track?userId=${encodeURIComponent(n)}&limit=100`);if(ye!=null&&ye.success){h(ye.stats&&typeof ye.stats=="object"?ye.stats:{});const Ge=ye.tracks||[];c(Ge.map(ft=>({...ft,actionLabel:ft.actionLabel||ft.action,timeAgo:ft.timeAgo||""})))}else h({}),c([])}catch{h({}),c([])}try{const ye=await De(`/api/db/users/referrals?userId=${encodeURIComponent(n)}`);ye!=null&&ye.success?(m(ye.referrals||[]),y(ye.inboundSource||null)):(m([]),y(null))}catch{m([]),y(null)}try{const ye=await De(`/api/admin/users/${encodeURIComponent(n)}/balance`);ye!=null&&ye.success&&ye.data?w(ye.data):w(null)}catch{w(null)}try{const ye=await De(`/api/orders?userId=${encodeURIComponent(n)}&status=paid&pageSize=50`);ye!=null&&ye.success&&ye.orders?Rt(ye.orders):Rt([])}catch{Rt([])}}catch(se){console.error("Load user detail error:",se)}finally{k(!1)}}}async function Dt(){if(!(a!=null&&a.phone)){X.info("用户未绑定手机号,无法同步");return}C(!0);try{const se=await St("/api/ckb/sync",{action:"full_sync",phone:a.phone,userId:a.id});se!=null&&se.success?(X.success("同步成功"),it()):X.error("同步失败: "+(se==null?void 0:se.error))}catch(se){console.error("Sync CKB error:",se),X.error("同步失败")}finally{C(!1)}}async function Jt(){if(a){if(ue.isVip&&!ue.vipExpireDate.trim()){X.error("开启 VIP 请填写有效到期日");return}O(!0);try{const se={id:a.id,phone:H.trim()||void 0,wechatId:ee.trim(),nickname:V||void 0,tags:JSON.stringify(ae),isVip:ue.isVip,vipExpireDate:ue.isVip?ue.vipExpireDate:void 0,vipRole:ue.vipRole||void 0,vipName:ue.vipName||void 0,vipProject:ue.vipProject||void 0,vipContact:ue.vipContact||void 0,vipBio:ue.vipBio||void 0},ye=await Zt("/api/db/users",se);ye!=null&&ye.success?(X.success("保存成功"),it(),r==null||r()):X.error("保存失败: "+(ye==null?void 0:ye.error))}catch(se){console.error("Save user error:",se),X.error("保存失败")}finally{O(!1)}}}const an=()=>{I&&!ae.includes(I)&&(pe([...ae,I]),z(""))},as=se=>pe(ae.filter(ye=>ye!==se));async function nr(){if(a){if(!R){X.error("请输入新密码");return}if(R!==q){X.error("两次密码不一致");return}if(R.length<6){X.error("密码至少 6 位");return}ce(!0);try{const se=await Zt("/api/db/users",{id:a.id,password:R});se!=null&&se.success?(X.success("修改成功"),ie(""),$("")):X.error("修改失败: "+((se==null?void 0:se.error)||""))}catch{X.error("修改失败")}finally{ce(!1)}}}async function Ni(){if(!a)return;const se=parseFloat(ge);if(Number.isNaN(se)||se===0){X.error("请输入有效金额(正数增加、负数扣减)");return}yt(!0);try{const ye=await St(`/api/admin/users/${a.id}/balance/adjust`,{amount:se,remark:We||void 0});ye!=null&&ye.success?(X.success("余额已调整"),be(!1),Ce(""),gt(""),it(),r==null||r()):X.error("调整失败: "+((ye==null?void 0:ye.error)||""))}catch{X.error("调整失败")}finally{yt(!1)}}async function ca(){if(!Cn&&!xn&&!Un){Xt("请至少输入手机号、微信号或 OpenID 中的一项");return}It(!0),Xt(null),vn(null);try{const se=new URLSearchParams;Cn&&se.set("phone",Cn),xn&&se.set("openId",xn),Un&&se.set("wechatId",Un);const ye=await De(`/api/admin/shensheshou/query?${se}`);ye!=null&&ye.success&&ye.data?(vn(ye.data),a&&await da(ye.data)):Xt((ye==null?void 0:ye.error)||"未查询到数据,该用户可能未在神射手收录")}catch(se){console.error("SSS query error:",se),Xt("请求失败,请检查神射手接口配置")}finally{It(!1)}}async function da(se){if(a)try{await St("/api/admin/shensheshou/enrich",{userId:a.id,phone:Cn||a.phone||"",openId:xn||a.openId||"",wechatId:Un||a.wechatId||""}),it()}catch(ye){console.error("SSS enrich error:",ye)}}async function zr(){if(a){Te(!0),st(null);try{const se=Array.from(new Set(o.filter(Fs=>Fs.action==="view_chapter"||Fs.action==="purchase"||Fs.action==="first_pay").map(Fs=>(Fs.chapterTitle||Fs.target||"").trim()).filter(Boolean))).slice(0,12),ye={viewChapter:u.view_chapter||0,purchase:u.purchase||0,firstPay:u.first_pay||0},Ge=se.length>0?`意向章节:${se.join("、")}`:"",ft={users:[{phone:a.phone||"",name:a.nickname||"",openId:a.openId||"",tags:ae,purchaseIntent:ye,purchaseIntentChapters:se,remark:Ge}]},Wn=await St("/api/admin/shensheshou/ingest",ft);Wn!=null&&Wn.success&&Wn.data?st(Wn.data):st({error:(Wn==null?void 0:Wn.error)||"推送失败"})}catch(se){console.error("SSS ingest error:",se),st({error:"请求失败"})}finally{Te(!1)}}}const $r=se=>{const Ge={view_chapter:er,purchase:Fd,match:_n,login:ci,register:ci,share:Sa,bind_phone:v1,bind_wechat:wM,fill_profile:Bd,fill_avatar:ci,visit_page:na,first_pay:Fd,vip_activate:Tc,click_super:_n,lead_submit:v1,withdraw:vg,referral_bind:Sa,card_click:ci,btn_click:xi,tab_click:na,nav_click:na,page_view:na,search:na}[se]||gg;return s.jsx(Ge,{className:"w-4 h-4"})};function Fr(se){const ye=String(se||"").trim();return ye.length>22&&/^[a-zA-Z0-9_-]+$/.test(ye)}const xr=b.useMemo(()=>HP(u,a),[u,a]);function gr(){const se=[...ae];for(const ye of xr)se.includes(ye)||se.push(ye);pe(se),X.success("已将旅程推断标签合并到已选")}return t?s.jsxs(s.Fragment,{children:[s.jsx($t,{open:t,onOpenChange:()=>e(),children:s.jsxs(zt,{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(Ft,{children:s.jsxs(Bt,{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(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"})]})}),N?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(Fe,{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:bt(a.avatar,a.mbti)&&!Mt?s.jsx("img",{src:bt(a.avatar,a.mbti),className:"w-full h-full rounded-full object-cover",alt:"",onError:()=>jt(!0)}):((Oa=a.nickname)==null?void 0:Oa.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: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:ee||"—"})]}),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:()=>{Ce(""),gt(""),be(!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(Dc,{value:K,onValueChange:_,className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[s.jsxs(Nl,{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(tn,{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(tn,{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(na,{className:"w-3 h-3 mr-0.5"}),"旅程与轨迹"]}),s.jsx(tn,{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(tn,{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(nn,{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(Z,{className:"text-gray-400 text-[11px]",children:"昵称"}),s.jsx(le,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"昵称",value:V,onChange:se=>re(se.target.value)})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-400 text-[11px]",children:"手机号(可改,点底部保存生效)"}),s.jsx(le,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"11 位手机号",value:H,onChange:se=>P(se.target.value)})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-400 text-[11px]",children:"微信标识(微信号/wxid,非 OpenID)"}),s.jsx(le,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"如 wxid_xxx 或自定义微信号",value:ee,onChange:se=>Q(se.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(Fj,{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(Tc,{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(Vt,{className:"scale-90",checked:ue.isVip,onCheckedChange:se=>oe(ye=>({...ye,isVip:se}))})]}),ue.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(Z,{className:"text-gray-500 text-[10px]",children:"到期日"}),s.jsx(le,{type:"date",className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",value:ue.vipExpireDate,onChange:se=>oe(ye=>({...ye,vipExpireDate:se.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(Z,{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:ue.vipRole,onChange:se=>oe(ye=>({...ye,vipRole:se.target.value})),children:[s.jsx("option",{value:"",children:"请选择"}),F.map(se=>s.jsx("option",{value:se.name,children:se.name},se.id))]})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(Z,{className:"text-gray-500 text-[10px]",children:"展示名"}),s.jsx(le,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"展示名",value:ue.vipName,onChange:se=>oe(ye=>({...ye,vipName:se.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(Z,{className:"text-gray-500 text-[10px]",children:"项目"}),s.jsx(le,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"项目",value:ue.vipProject,onChange:se=>oe(ye=>({...ye,vipProject:se.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(Z,{className:"text-gray-500 text-[10px]",children:"联系方式"}),s.jsx(le,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"微信/手机",value:ue.vipContact,onChange:se=>oe(ye=>({...ye,vipContact:se.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5 sm:col-span-2",children:[s.jsx(Z,{className:"text-gray-500 text-[10px]",children:"简介"}),s.jsx(le,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"简短介绍",value:ue.vipBio,onChange:se=>oe(ye=>({...ye,vipBio:se.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(xi,{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(le,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:手机",value:Cn,onChange:se=>Fn(se.target.value)}),s.jsx(le,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:微信号",value:Un,onChange:se=>At(se.target.value)}),s.jsx(le,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:OpenID",value:xn,onChange:se=>Nn(se.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:ca,disabled:Ot,children:[Ot?s.jsx(Fe,{className:"w-3 h-3 animate-spin"}):s.jsx(Ta,{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:zr,disabled:ve||!a.phone,children:ve?"推送…":"推神射手"}),s.jsx(J,{size:"sm",variant:"outline",className:"h-7 text-[11px] px-2",onClick:Dt,disabled:E||!a.phone,children:E?"同步…":"存客宝同步"})]}),a.ckbSyncedAt&&s.jsxs("p",{className:"text-[10px] text-gray-500 mt-1",children:["最近存客宝同步:",new Date(a.ckbSyncedAt).toLocaleString()]}),Ht&&s.jsx("p",{className:"mt-1 text-red-400 text-[11px]",children:Ht}),Pn&&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:Pn.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:Pn.user_level??"—"})]})]}),Ve&&s.jsx("p",{className:"mt-1 text-[11px]",children:Ve.error?s.jsx("span",{className:"text-red-400",children:String(Ve.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(vg,{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(le,{type:"password",className:"bg-[#162840] border-gray-700 text-white h-7 text-xs flex-1",placeholder:"新密码 ≥6 位",value:R,onChange:se=>ie(se.target.value)}),s.jsx(le,{type:"password",className:"bg-[#162840] border-gray-700 text-white h-7 text-xs flex-1",placeholder:"确认密码",value:q,onChange:se=>$(se.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:nr,disabled:U||!R||!q,children:U?"保存中":"确认修改"})]})]})]}),s.jsxs(nn,{value:"journey",className:"flex-1 min-h-0 overflow-y-auto space-y-2 pr-0.5",children:[vt.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(Fd,{className:"w-3.5 h-3.5 text-amber-400"}),s.jsxs("span",{className:"text-white text-xs font-medium",children:["购买清单(",vt.length," 笔)"]})]}),s.jsx("div",{className:"space-y-1 max-h-[120px] overflow-y-auto",children:vt.map((se,ye)=>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:se.productType==="fullbook"||se.productType==="vip"?"全书/VIP":`章节 ${se.productId||""}`}),s.jsxs("span",{className:"text-gray-500 ml-2",children:["¥",Number(se.amount||0).toFixed(2)]})]}),s.jsx("span",{className:"text-gray-500 text-[10px] shrink-0",children:se.createdAt?new Date(se.createdAt).toLocaleString("zh-CN"):""})]},se.orderSn||ye))})]}),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(na,{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((se,ye)=>ye[1]-se[1]).map(([se,ye])=>s.jsxs(Be,{variant:"outline",className:"text-[10px] border-gray-600 text-gray-300 bg-[#162840] py-0 h-5",children:[VP(se)," ×",ye]},se))})]}),s.jsx("div",{className:"space-y-1.5",children:o.length>0?o.map((se,ye)=>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:$r(se.action)}),ye0?((x==null?void 0:x.visits)||[]).map((se,ye)=>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:["第 ",se.seq||ye+1," 次 · ",se.referrerNickname||"微信用户",se.referrerId?`(${se.referrerId})`:""]}),se.page?s.jsx("p",{className:"text-gray-500 text-[10px] truncate",children:se.page}):null]}),s.jsx("span",{className:"text-gray-500 text-[10px] shrink-0",children:se.visitedAt?new Date(se.visitedAt).toLocaleString():""})]},`${se.referrerId||"unknown"}_${ye}`)):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(Sa,{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((se,ye)=>{var ft;const Ge=se;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:((ft=Ge.nickname)==null?void 0:ft.charAt(0))||"?"}),s.jsx("span",{className:"text-white truncate",children:Ge.nickname})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[Ge.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:Ge.createdAt?new Date(Ge.createdAt).toLocaleDateString():""})]})]},Ge.id||ye)}):s.jsx("p",{className:"text-gray-500 text-sm text-center py-3",children:"暂无推荐用户"})})]})]}),s.jsxs(nn,{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(Bd,{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(Pj,{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:xr.length===0,onClick:gr,children:"合并到已选"})]}),xr.length>0?s.jsx("div",{className:"flex flex-wrap gap-1",children:xr.map(se=>s.jsxs(Be,{variant:"outline",className:`text-[10px] py-0 h-5 border-cyan-500/30 ${ae.includes(se)?"bg-cyan-500/15 text-cyan-200":"text-gray-300"}`,children:[ae.includes(se)?"✓ ":"",se]},se))}):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(se=>s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-[11px] mb-1",children:se.category}),s.jsx("div",{className:"flex flex-wrap gap-1",children:se.tags.map(ye=>s.jsxs("button",{type:"button",onClick:()=>{ae.includes(ye)?as(ye):pe([...ae,ye])},className:`px-1.5 py-0.5 rounded text-[11px] border transition-all ${ae.includes(ye)?"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:[ae.includes(ye)?"✓ ":"",ye]},ye))})]},se.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:[ae.map((se,ye)=>s.jsxs(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1 text-[11px] py-0",children:[se,s.jsx("button",{type:"button",onClick:()=>as(se),className:"ml-1 hover:text-red-400",children:s.jsx(ts,{className:"w-3 h-3"})})]},ye)),ae.length===0&&s.jsx("span",{className:"text-gray-600 text-xs",children:"暂未选择"})]}),s.jsxs("div",{className:"flex gap-1.5",children:[s.jsx(le,{className:"bg-[#162840] border-gray-700 text-white flex-1 h-8 text-xs",placeholder:"自定义标签,回车添加",value:I,onChange:se=>z(se.target.value),onKeyDown:se=>se.key==="Enter"&&an()}),s.jsx(J,{onClick:an,className:"bg-[#38bdac] hover:bg-[#2da396] h-8 text-xs px-3",children:"添加"})]})]})]}),(()=>{const se=a.tags||a.ckbTags||"";let ye=[];try{const ft=typeof se=="string"?JSON.parse(se||"[]"):[];ye=Array.isArray(ft)?ft:typeof se=="string"?se.split(","):[]}catch{ye=typeof se=="string"?se.split(","):[]}const Ge=ye.map(ft=>String(ft).trim()).filter(Boolean);return Ge.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(Bd,{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:Ge.map((ft,Wn)=>s.jsx(Be,{className:"bg-purple-500/20 text-purple-400 border-0 text-[11px] py-0",children:ft},Wn))})]})})()]})]}),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(ts,{className:"w-4 h-4 mr-2"}),"关闭"]}),s.jsxs(J,{onClick:Jt,disabled:L,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),L?"保存中...":"保存修改"]})]})]}):s.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}),s.jsx($t,{open:te,onOpenChange:be,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsx(Ft,{children:s.jsx(Bt,{children:"调整余额"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"调整金额(元)"}),s.jsx(le,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"正数增加,负数扣减,如 10 或 -5",value:ge,onChange:se=>Ce(se.target.value)})]}),s.jsxs("div",{children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"备注(可选)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"如:活动补偿",value:We,onChange:se=>gt(se.target.value)})]})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(J,{variant:"outline",onClick:()=>be(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(J,{onClick:Ni,disabled:Lt,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:Lt?"提交中...":"确认调整"})]})]})})]}):null}function UP(){const t=Ra(),[e,n]=b.useState(!0),[r,a]=b.useState(!0),[i,o]=b.useState(!0),[c,u]=b.useState([]),[h,f]=b.useState([]),[m,x]=b.useState(0),[y,v]=b.useState(0),[w,N]=b.useState(0),[k,E]=b.useState(0),[C,L]=b.useState(null),[O,K]=b.useState(null),[_,H]=b.useState(!1),[P,ee]=b.useState(0),[Q,V]=b.useState(!1),[re,ae]=b.useState(null),[pe,I]=b.useState("overview"),[z,R]=b.useState([]),[ie,q]=b.useState(!1),[$,U]=b.useState("today"),[ce,ue]=b.useState(null),[oe,F]=b.useState(!1),[G,te]=b.useState(!0),[be,ge]=b.useState(null),[Ce,We]=b.useState(null),[gt,Lt]=b.useState([]),yt=ve=>{const Te=ve;if((Te==null?void 0:Te.status)===401)L("登录已过期,请重新登录");else{if((Te==null?void 0:Te.name)==="AbortError")return;L("加载失败,请检查网络或联系管理员")}};async function Ot(ve){var Mt,jt;const Te=ve?{signal:ve}:void 0;n(!0),L(null);try{const D=await De("/api/admin/dashboard/stats",Te);D!=null&&D.success&&(x(D.totalUsers??0),v(D.paidOrderCount??0),N(D.totalRevenue??0),E(D.conversionRate??0))}catch(D){if((D==null?void 0:D.name)!=="AbortError"){console.error("stats 失败,尝试 overview 降级",D);try{const Ie=await De("/api/admin/dashboard/overview",Te);Ie!=null&&Ie.success&&(x(Ie.totalUsers??0),v(Ie.paidOrderCount??0),N(Ie.totalRevenue??0),E(Ie.conversionRate??0))}catch(Ie){yt(Ie)}}}finally{n(!1)}try{const D=await De("/api/admin/balance/summary",Te);D!=null&&D.success&&D.data&&ee(D.data.totalGifted??0)}catch{}try{const D=await De("/api/db/ckb-plan-stats",Te);D!=null&&D.success&&D.data?ae({ckbTotal:D.data.ckbTotal??0,withContact:D.data.withContact??0}):ae(null)}catch{ae(null)}te(!0);try{const[D,Ie]=await Promise.allSettled([De("/api/db/match-records?stats=true",Te),De("/api/admin/distribution/overview",Te)]);D.status==="fulfilled"&&((Mt=D.value)!=null&&Mt.success)&&D.value.data?ge({totalMatches:D.value.data.totalMatches??0,todayMatches:D.value.data.todayMatches??0,uniqueUsers:D.value.data.uniqueUsers??0,paidMatchCount:D.value.data.paidMatchCount??0}):ge(null),Ie.status==="fulfilled"&&((jt=Ie.value)!=null&&jt.success)&&Ie.value.overview?We({todayClicks:Ie.value.overview.todayClicks??0,todayBindings:Ie.value.overview.todayBindings??0,todayConversions:Ie.value.overview.todayConversions??0,monthClicks:Ie.value.overview.monthClicks??0,monthBindings:Ie.value.overview.monthBindings??0,monthConversions:Ie.value.overview.monthConversions??0,totalClicks:Ie.value.overview.totalClicks??0,totalBindings:Ie.value.overview.totalBindings??0,totalConversions:Ie.value.overview.totalConversions??0,conversionRate:Ie.value.overview.conversionRate}):We(null)}catch{ge(null),We(null)}finally{te(!1)}try{const D=await De("/api/db/vip-members?limit=500",Te);D!=null&&D.success&&Array.isArray(D.data)?Lt(D.data):Lt([])}catch{Lt([])}a(!0),o(!0);const Ve=async()=>{try{const D=await De("/api/admin/dashboard/recent-orders?limit=10",Te);if(D!=null&&D.success&&D.recentOrders)f(D.recentOrders);else throw new Error("no data")}catch(D){if((D==null?void 0:D.name)!=="AbortError")try{const Ie=await De("/api/admin/orders?page=1&pageSize=20&status=paid",Te),Rt=((Ie==null?void 0:Ie.orders)??[]).filter(bt=>["paid","completed","success"].includes(bt.status||""));f(Rt.slice(0,5))}catch{f([])}}finally{a(!1)}},st=async()=>{try{const D=await De("/api/admin/dashboard/new-users",Te);if(D!=null&&D.success&&D.newUsers)u(D.newUsers);else throw new Error("no data")}catch(D){if((D==null?void 0:D.name)!=="AbortError")try{const Ie=await De("/api/db/users?page=1&pageSize=10",Te);u((Ie==null?void 0:Ie.users)??[])}catch{u([])}}finally{o(!1)}};await Promise.all([Ve(),st()])}async function It(ve){const Te=ve||$;F(!0);try{const Ve=await De(`/api/admin/track/stats?period=${Te}`);Ve!=null&&Ve.success&&ue({total:Ve.total??0,byModule:Ve.byModule??{}})}catch{ue(null)}finally{F(!1)}}const Pn={home:"首页",chapters:"目录",read:"阅读页",my:"我的",vip:"超级个体",wallet:"钱包",match:"找伙伴",referral:"推广中心",search:"搜索",settings:"设置",about:"关于",member_detail:"成员详情",other:"其他"},vn={btn_click:"按钮点击",nav_click:"导航点击",card_click:"卡片点击",tab_click:"标签切换",page_view:"页面浏览",share:"分享",purchase:"购买",register:"注册",rule_trigger:"规则触发",view_chapter:"浏览章节",link_click:"链接点击"},Ht=ve=>ve?ve.replace(/^part-/,"").replace(/^soulvip_/,"").replace(/^super_?/,"").replace(/^user_/,"").replace(/[_-]+/g," ").trim():"",Xt=ve=>{if(!ve)return"";const Te=ve.trim().toLowerCase();if(!Te)return"";const Ve=gt.find(Mt=>{const jt=String(Mt.id||"").toLowerCase();return jt===Te||jt.includes(Te)||Te.includes(jt)});if(Ve)return Ve.name||Ve.nickname||"";const st=gt.find(Mt=>{const jt=String(Mt.token||"").toLowerCase();return jt&&(jt===Te||jt.includes(Te)||Te.includes(jt))});return st&&(st.name||st.nickname)||""},Cn=ve=>{if(!ve)return"未命名点击";const Te=ve.trim(),Ve=Te.toLowerCase();if(/^链接头像[_-]/.test(Te)){const Mt=Ht(Te.replace(/^链接头像[_-]/,""));return Mt?`头像:${Mt}`:"头像点击"}if(/^member[_-]?detail$/i.test(Ve)||Ve.includes("member detail"))return"成员详情";if(/^giftpay$/i.test(Ve)||Ve.includes("gift pay"))return"代付入口";if(/^part[-_]/i.test(Ve))return`章节:${Ht(Te)}`;if(Ve.includes("soulvip")||Ve.includes("super")){const Mt=Te.replace(/^超级个体[::]?/i,"").replace(/^super[_-]?/i,"").replace(/^soulvip[_-]?/i,"").replace(/^user[_-]?/i,"").trim(),jt=Xt(Mt)||Xt(Ht(Mt));return jt?`超级个体:${jt}`:`超级个体:${Ht(Mt)}`}if(Ve.includes("qgdtw")||Ve.includes("token")||Ve.includes("0000"))return`对象:${Ht(Te)}`;const st={开始匹配:"开始匹配",mentor:"导师顾问",team:"团队招募",investor:"资源对接",充值:"充值",退款:"退款",wallet:"钱包",设置:"设置",VIP:"VIP会员",推广:"推广中心",目录:"目录",搜索:"搜索",匹配:"找伙伴",settings:"设置",expired:"已过期",active:"活跃",converted:"已转化",fill_profile:"完善资料",register:"注册",purchase:"购买",链接卡若:"链接卡若",更多分享:"更多分享",分享朋友圈文案:"分享朋友圈",选择金额10:"选择金额10元",member_detail:"成员详情",giftPay:"代付入口"};return st[Te]?st[Te]:/^[a-z0-9_-]+$/i.test(Te)&&Ht(Te)||Te},Fn=ve=>{const Te=Pn[ve.module]||Pn[ve.page]||ve.module||ve.page||"其他",Ve=vn[ve.action]||ve.action||"点击",st=Cn(ve.target);return`${Te} · ${Ve} · ${st}`};async function Un(){q(!0);try{const ve=await De("/api/admin/super-individual/stats");ve!=null&&ve.success&&Array.isArray(ve.data)&&R(ve.data)}catch{}finally{q(!1)}}b.useEffect(()=>{const ve=new AbortController;return Ot(ve.signal),It(),Un(),()=>{ve.abort()}},[]);const At=m,xn=ve=>{const Te=ve.productType||"",Ve=ve.description||"";if(Te==="balance_recharge")return{title:`余额充值 ¥${typeof ve.amount=="number"?ve.amount.toFixed(2):parseFloat(String(ve.amount||"0")).toFixed(2)}`,subtitle:"余额充值"};if(Te==="gift_pay")return{title:`代付 ¥${typeof ve.amount=="number"?ve.amount.toFixed(2):parseFloat(String(ve.amount||"0")).toFixed(2)}`,subtitle:"好友代付"};if(Te==="gift_pay_batch"){const st=typeof ve.amount=="number"?ve.amount.toFixed(2):parseFloat(String(ve.amount||"0")).toFixed(2);return{title:Ve||`代付分享 ¥${st}`,subtitle:"代付分享"}}if(Te==="section"&&Ve.includes("代付领取"))return{title:Ve.replace("代付领取 - ",""),subtitle:"代付领取"};if(Ve){if(Te==="section"&&Ve.includes("章节")){if(Ve.includes("-")){const st=Ve.split("-");if(st.length>=3)return{title:`第${st[1]}章 第${st[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:Ve,subtitle:"章节购买"}}return Te==="fullbook"||Ve.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:Te==="vip"||Ve.includes("VIP")?{title:"超级个体开通费用",subtitle:"超级个体"}:Te==="match"||Ve.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:Ve,subtitle:Te==="section"?"单章":Te==="fullbook"?"全书":"其他"}}return Te==="section"?{title:`章节 ${ve.productId||""}`,subtitle:"单章购买"}:Te==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:Te==="vip"?{title:"超级个体开通费用",subtitle:"超级个体"}:Te==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:Te||"其他"}},Nn=[{title:"总用户数",value:e?null:At,sub:null,icon:_n,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:e?null:`¥${(w??0).toFixed(2)}`,sub:P>0?`含代付 ¥${P.toFixed(2)}`:null,icon:af,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:e?null:y,sub:null,icon:Fd,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:er,color:"text-orange-400",bg:"bg-orange-500/20",link:"/distribution"},{title:"存客宝获客",value:re?re.ckbTotal??0:null,sub:(re==null?void 0:re.withContact)!=null?`含联系方式 ${re.withContact} 人`:null,icon:Sc,color:"text-cyan-400",bg:"bg-cyan-500/20",link:"/users?tab=leads"},{title:"伙伴&推广协同",value:G?null:((be==null?void 0:be.totalMatches)??0)+((Ce==null?void 0:Ce.totalClicks)??0),sub:G?null:`找伙伴 ${(be==null?void 0:be.totalMatches)??0} / 推广 ${(Ce==null?void 0:Ce.totalClicks)??0}`,icon:gc,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:()=>Ot(),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:Nn.map((ve,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:()=>ve.link&&t(ve.link),children:[s.jsxs(ct,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsx(dt,{className:"text-sm font-medium text-gray-400",children:ve.title}),s.jsx("div",{className:`p-2 rounded-lg ${ve.bg}`,children:s.jsx(ve.icon,{className:`w-4 h-4 ${ve.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:ve.value!=null?ve.value:s.jsxs("span",{className:"inline-flex items-center gap-2 text-gray-500",children:[s.jsx(Fe,{className:"w-4 h-4 animate-spin"}),"加载中"]})}),ve.sub&&s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:ve.sub})]}),s.jsx(ll,{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 ${pe==="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 ${pe==="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 ${pe==="super"?"bg-[#38bdac] text-white":"bg-[#0f2137] text-gray-400 hover:text-white hover:bg-gray-700/50 border border-gray-700/50"}`,children:"超级个体统计"})]}),pe==="overview"&&s.jsxs("div",{className:"space-y-8",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ct,{className:"flex flex-row items-center justify-between",children:[s.jsx(dt,{className:"text-white",children:"找伙伴 × 推广中心(共统计)"}),s.jsxs("button",{type:"button",onClick:()=>Ot(),disabled:G,className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1 disabled:opacity-50",title:"刷新共统计",children:[s.jsx(Fe,{className:`w-3.5 h-3.5 ${G?"animate-spin":""}`}),"刷新"]})]}),s.jsxs(ze,{children:[G&&!be&&!Ce?s.jsxs("div",{className:"flex items-center justify-center py-10 text-gray-500",children:[s.jsx(Fe,{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:(be==null?void 0:be.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:(be==null?void 0:be.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:(be==null?void 0:be.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:(Ce==null?void 0:Ce.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:(Ce==null?void 0:Ce.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:(Ce==null?void 0:Ce.totalConversions)??0})]})]}),(Ce==null?void 0:Ce.conversionRate)&&s.jsxs("p",{className:"text-xs text-gray-500 mt-3",children:["推广转化率:",Ce.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(ct,{className:"flex flex-row items-center justify-between",children:[s.jsx(dt,{className:"text-white",children:"最近订单"}),s.jsxs("button",{type:"button",onClick:()=>Ot(),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(Fe,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(Fe,{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(Fe,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[h.slice(0,Q?10:4).map(ve=>{var jt;const Te=ve.referrerId?c.find(D=>D.id===ve.referrerId):void 0,Ve=ve.referralCode||(Te==null?void 0:Te.referralCode)||(Te==null?void 0:Te.nickname)||(ve.referrerId?String(ve.referrerId).slice(0,8):""),st=xn(ve),Mt=ve.userNickname||((jt=c.find(D=>D.id===ve.userId))==null?void 0:jt.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:[ve.userAvatar?s.jsx("img",{src:ve.userAvatar,alt:Mt,className:"w-9 h-9 rounded-full object-cover shrink-0 mt-0.5",onError:D=>{D.currentTarget.style.display="none";const Ie=D.currentTarget.nextElementSibling;Ie&&Ie.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 ${ve.userAvatar?"hidden":""}`,children:Mt.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:()=>{ve.userId&&(K(ve.userId),H(!0))},className:"text-sm text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:Mt}),s.jsx("span",{className:"text-gray-600",children:"·"}),s.jsx("span",{className:"text-sm font-medium text-white truncate",title:st.title,children:st.title})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[st.subtitle&&st.subtitle!=="章节购买"&&s.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:st.subtitle}),s.jsx("span",{children:new Date(ve.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),Ve&&s.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",Ve]})]})]}),s.jsxs("div",{className:"text-right ml-4 shrink-0",children:[s.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(ve.amount).toFixed(2)]}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:ve.paymentMethod||"微信"})]})]},ve.id)}),h.length>4&&!Q&&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(Fd,{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(ct,{children:s.jsx(dt,{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(Fe,{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(ve=>{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=ve.nickname)==null?void 0:Te.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("button",{type:"button",onClick:()=>{K(ve.id),H(!0)},className:"text-sm font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:ve.nickname||"匿名用户"}),s.jsx("p",{className:"text-xs text-gray-500",children:ve.phone||"未绑定手机"})]})]}),s.jsx("p",{className:"text-xs text-gray-400",children:ve.createdAt?new Date(ve.createdAt).toLocaleDateString():"-"})]},ve.id)}),c.length===0&&!i&&s.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})})]})]})]}),pe==="tags"&&s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ct,{className:"flex flex-row items-center justify-between",children:[s.jsxs(dt,{className:"text-white flex items-center gap-2",children:[s.jsx(gc,{className:"w-5 h-5 text-[#38bdac]"}),"分类标签点击统计"]}),s.jsx("div",{className:"flex items-center gap-2",children:["today","week","month","all"].map(ve=>s.jsx("button",{type:"button",onClick:()=>{U(ve),It(ve)},className:`px-3 py-1 text-xs rounded-full transition-colors ${$===ve?"bg-[#38bdac] text-white":"bg-gray-700/50 text-gray-400 hover:bg-gray-700"}`,children:{today:"今日",week:"本周",month:"本月",all:"全部"}[ve]},ve))})]}),s.jsx(ze,{children:oe&&!ce?s.jsxs("div",{className:"flex items-center justify-center py-12 text-gray-500",children:[s.jsx(Fe,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):ce&&Object.keys(ce.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:ce.total})," 次"]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Object.entries(ce.byModule).sort((ve,Te)=>Te[1].reduce((Ve,st)=>Ve+st.count,0)-ve[1].reduce((Ve,st)=>Ve+st.count,0)).slice(0,5).map(([ve,Te])=>{const Ve=Te.reduce((st,Mt)=>st+Mt.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:Pn[ve]||ve}),s.jsxs("span",{className:"text-xs text-gray-500",children:[Ve," 次"]})]}),s.jsx("div",{className:"space-y-2",children:Te.sort((st,Mt)=>Mt.count-st.count).slice(0,8).map((st,Mt)=>{const jt=Fn(st);return s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-gray-300 truncate mr-2",title:jt,children:jt}),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:`${Ve>0?st.count/Ve*100:0}%`}})}),s.jsx("span",{className:"text-gray-400 w-8 text-right",children:st.count})]})]},Mt)})})]},ve)})})]}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(gc,{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:"小程序端接入埋点后,数据将在此实时展示"})]})})]}),pe==="super"&&s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ct,{className:"flex flex-row items-center justify-between",children:[s.jsxs(dt,{className:"text-white flex items-center gap-2",children:[s.jsx(gc,{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:Un,disabled:ie,children:[s.jsx(Fe,{className:`w-3.5 h-3.5 mr-1 ${ie?"animate-spin":""}`}),"刷新"]})]}),s.jsx(ze,{children:ie&&z.length===0?s.jsxs("div",{className:"flex items-center justify-center py-12 text-gray-500",children:[s.jsx(Fe,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):z.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:z.map((ve,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:[ve.avatar?s.jsx("img",{src:ve.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(ve.nickname||ve.userId)}`),title:"点击跳转用户管理",children:ve.nickname||ve.userId})]})}),s.jsx("td",{className:"py-2 px-3 text-center text-white font-bold",children:ve.clicks}),s.jsx("td",{className:"py-2 px-3 text-center text-[#38bdac]",children:ve.uniqueClicks}),s.jsx("td",{className:"py-2 px-3 text-center text-gray-400",children:ve.uniqueClicks>0?(ve.clicks/ve.uniqueClicks).toFixed(1):"-"}),s.jsx("td",{className:"py-2 px-3 text-center text-green-400 text-xs font-medium",children:typeof ve.leadCount=="number"?ve.leadCount:0}),s.jsx("td",{className:"py-2 px-3 text-gray-400 text-xs",children:ve.phone||"-"})]},ve.userId))})]})}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(gc,{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(V0,{open:_,onClose:()=>{H(!1),K(null)},userId:O,onUserUpdated:()=>Ot()})]})}const fs=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{className:"relative w-full overflow-auto",children:s.jsx("table",{ref:n,className:Gt("w-full caption-bottom text-sm",t),...e})}));fs.displayName="Table";const ps=b.forwardRef(({className:t,...e},n)=>s.jsx("thead",{ref:n,className:Gt("[&_tr]:border-b",t),...e}));ps.displayName="TableHeader";const ms=b.forwardRef(({className:t,...e},n)=>s.jsx("tbody",{ref:n,className:Gt("[&_tr:last-child]:border-0",t),...e}));ms.displayName="TableBody";const xt=b.forwardRef(({className:t,...e},n)=>s.jsx("tr",{ref:n,className:Gt("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));xt.displayName="TableRow";const Se=b.forwardRef(({className:t,...e},n)=>s.jsx("th",{ref:n,className:Gt("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));Se.displayName="TableHead";const Ne=b.forwardRef(({className:t,...e},n)=>s.jsx("td",{ref:n,className:Gt("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));Ne.displayName="TableCell";function hf(t,e){const[n,r]=b.useState(t);return b.useEffect(()=>{const a=setTimeout(()=>r(t),e);return()=>clearTimeout(a)},[t,e]),n}function Zs({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 WP(){const[t,e]=b.useState([]),[n,r]=b.useState([]),[a,i]=b.useState(0),[o,c]=b.useState(0),[u,h]=b.useState(0),[f,m]=b.useState(1),[x,y]=b.useState(10),[v,w]=b.useState(""),N=hf(v,300),[k,E]=b.useState("all"),[C,L]=b.useState(!0),[O,K]=b.useState(null),[_,H]=b.useState(null),[P,ee]=b.useState(""),[Q,V]=b.useState(!1);async function re(){L(!0),K(null);try{const q=k==="all"?"":k==="completed"?"completed":k,$=new URLSearchParams({page:String(f),pageSize:String(x),...q&&{status:q},...N&&{search:N}}),[U,ce]=await Promise.all([De(`/api/admin/orders?${$}`),De("/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)),ce!=null&&ce.success&&ce.users&&r(ce.users)}catch(q){console.error("加载订单失败",q),K("加载订单失败,请检查网络后重试")}finally{L(!1)}}b.useEffect(()=>{m(1)},[N,k]),b.useEffect(()=>{re()},[f,x,N,k]);const ae=q=>{var $;return q.userNickname||(($=n.find(U=>U.id===q.userId))==null?void 0:$.nickname)||"匿名用户"},pe=q=>{var $;return(($=n.find(U=>U.id===q))==null?void 0:$.phone)||"-"},I=q=>{const $=q.productType||q.type||"",U=q.description||"";if($==="balance_recharge")return{name:`余额充值 ¥${Number(q.amount||0).toFixed(2)}`,type:"余额充值"};if(U){if($==="section"&&(U.includes("章节")||U.includes("代付领取"))){if(U.includes("代付领取"))return{name:U.replace("代付领取 - ",""),type:"代付领取"};if(U.includes("-")){const ce=U.split("-");if(ce.length>=3)return{name:`第${ce[1]}章 第${ce[2]}节`,type:"《一场Soul的创业实验》"}}return{name:U,type:"章节购买"}}return $==="fullbook"||U.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:$==="vip"||U.includes("VIP")?{name:"超级个体开通费用",type:"超级个体"}:$==="match"||U.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:U,type:"其他"}}return $==="section"?{name:`章节 ${q.productId||q.sectionId||""}`,type:"单章"}:$==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:$==="vip"?{name:"超级个体开通费用",type:"超级个体"}:$==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:$||"其他"}},z=Math.ceil(a/x)||1;async function R(){var q;if(!(!(_!=null&&_.orderSn)&&!(_!=null&&_.id))){V(!0),K(null);try{const $=await Zt("/api/admin/orders/refund",{orderSn:_.orderSn||_.id,reason:P||void 0});$!=null&&$.success?(H(null),ee(""),re()):K(($==null?void 0:$.error)||"退款失败")}catch($){const U=$;K(((q=U==null?void 0:U.data)==null?void 0:q.error)||"退款失败,请检查网络后重试")}finally{V(!1)}}}function ie(){if(t.length===0){X.info("暂无数据可导出");return}const q=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],$=t.map(F=>{const G=I(F);return[F.orderSn||F.id||"",ae(F),pe(F.userId),G.name,Number(F.amount||0).toFixed(2),F.paymentMethod==="wechat"?"微信支付":F.paymentMethod==="balance"?"余额支付":F.paymentMethod==="alipay"?"支付宝":F.paymentMethod||"微信支付",F.status==="refunded"?"已退款":F.status==="paid"||F.status==="completed"?"已完成":F.status==="pending"||F.status==="created"?"待支付":"已失败",F.status==="refunded"&&F.refundReason?F.refundReason:"-",F.referrerEarnings?Number(F.referrerEarnings).toFixed(2):"-",F.createdAt?new Date(F.createdAt).toLocaleString("zh-CN"):""].join(",")}),U="\uFEFF"+[q.join(","),...$].join(` -`),ce=new Blob([U],{type:"text/csv;charset=utf-8"}),ue=URL.createObjectURL(ce),oe=document.createElement("a");oe.href=ue,oe.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,oe.click(),URL.revokeObjectURL(ue)}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:()=>K(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:re,disabled:C,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Fe,{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(Ta,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(le,{type:"text",placeholder:"搜索订单号/用户/章节...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500",value:v,onChange:q=>w(q.target.value)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(zj,{className:"w-4 h-4 text-gray-400"}),s.jsxs("select",{value:k,onChange:q=>E(q.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:ie,disabled:t.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(E5,{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(Fe,{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(fs,{children:[s.jsx(ps,{children:s.jsxs(xt,{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(ms,{children:[t.map(q=>{const $=I(q);return s.jsxs(xt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsxs(Ne,{className:"font-mono text-xs text-gray-400",children:[(q.orderSn||q.id||"").slice(0,12),"..."]}),s.jsx(Ne,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[ae(q),q.paymentMethod==="gift_pay"&&s.jsx(Be,{className:"bg-emerald-500/20 text-emerald-400 hover:bg-emerald-500/20 border-0 text-xs",children:"代付领取"}),q.payerUserId&&q.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:pe(q.userId)}),q.payerUserId&&q.payerNickname&&s.jsxs("p",{className:"text-amber-400/80 text-xs mt-0.5",children:[q.paymentMethod==="gift_pay"?"赠送人:":"代付人:",q.payerNickname]})]})}),s.jsx(Ne,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[$.name,(q.productType||q.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:$.type})]})}),s.jsxs(Ne,{className:"text-[#38bdac] font-bold",children:["¥",Number(q.amount||0).toFixed(2)]}),s.jsx(Ne,{className:"text-gray-300",children:q.paymentMethod==="wechat"?"微信支付":q.paymentMethod==="balance"?"余额支付":q.paymentMethod==="alipay"?"支付宝":q.paymentMethod||"微信支付"}),s.jsx(Ne,{children:s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[q.status==="refunded"?s.jsx(Be,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):q.status==="paid"||q.status==="completed"?s.jsx(Be,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):q.status==="pending"||q.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:"已失败"}),(q.status==="paid"||q.status==="completed")&&(q.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(Ne,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:q.refundReason,children:q.status==="refunded"&&q.refundReason?q.refundReason:"-"}),s.jsx(Ne,{className:"text-[#FFD700]",children:q.referrerEarnings?`¥${Number(q.referrerEarnings).toFixed(2)}`:"-"}),s.jsx(Ne,{className:"text-gray-400 text-sm",children:new Date(q.createdAt).toLocaleString("zh-CN")}),s.jsx(Ne,{children:(q.status==="paid"||q.status==="completed")&&q.paymentMethod!=="balance"&&s.jsxs(J,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{H(q),ee("")},children:[s.jsx(Bj,{className:"w-3 h-3 mr-1"}),"退款"]})})]},q.id)}),t.length===0&&s.jsx(xt,{children:s.jsx(Ne,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),s.jsx(Zs,{page:f,totalPages:z,total:a,pageSize:x,onPageChange:m,onPageSizeChange:q=>{y(q),m(1)}})]})})}),s.jsx($t,{open:!!_,onOpenChange:q=>!q&&H(null),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Ft,{children:s.jsx(Bt,{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(le,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:P,onChange:q=>ee(q.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(yn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>H(null),disabled:Q,children:"取消"}),s.jsx(J,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:R,disabled:Q,children:Q?"退款中...":"确认退款"})]})]})})]})}const wl=b.forwardRef(({className:t,...e},n)=>s.jsx("textarea",{className:Gt("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}));wl.displayName="Textarea";const H1=["INTJ","INTP","ENTJ","ENTP","INFJ","INFP","ENFJ","ENFP","ISTJ","ISFJ","ESTJ","ESFJ","ISTP","ISFP","ESTP","ESFP"],l2={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 KP(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 qP(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 GP(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 U1(t){const e=l2[t],n=KP(e.group),r=qP(e.mood),a=GP(e.mood),i=` - - - - - - - - - - - - - - - - - - - - - - - - - -`;return`data:image/svg+xml;utf8,${encodeURIComponent(i)}`}function JP(){const[t,e]=b.useState({}),[n,r]=b.useState(!0),[a,i]=b.useState(!1),[o,c]=b.useState(!1),u=b.useCallback(async()=>{r(!0);try{const x=await De("/api/admin/mbti-avatars");x!=null&&x.avatars?e(x.avatars):e({})}catch{X.error("加载 MBTI 头像配置失败")}finally{r(!1)}},[]);b.useEffect(()=>{u()},[u]);const h=async()=>{i(!0);try{const x=await St("/api/admin/mbti-avatars",{avatars:t});if(!x||x.success===!1){X.error((x==null?void 0:x.error)||"保存失败");return}X.success("已保存,后台与小程序默认头像同步生效"),u()}catch{X.error("保存失败")}finally{i(!1)}},f=x=>{const y=U1(x);e(v=>({...v,[x]:y})),X.success(`${x} 已生成`)},m=()=>{c(!0);try{const x={...t};H1.forEach(y=>{x[y]=U1(y)}),e(x),X.success("16 型头像已生成(仅人物)")}finally{c(!1)}};return n?s.jsxs("div",{className:"flex items-center justify-center py-16 text-gray-400",children:[s.jsx(Fe,{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(ct,{className:"pb-2",children:[s.jsxs(dt,{className:"text-white flex items-center gap-2 text-lg",children:[s.jsx(nA,{className:"w-5 h-5 text-[#38bdac]"}),"MBTI 头像库"]}),s.jsx(Yt,{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(SA,{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(Fe,{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(Sn,{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:H1.map(x=>{const y=t[x]??"",v=l2[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(Be,{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:y?s.jsx("img",{src:y,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(le,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"https://... 或 data:image/...",value:y,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 W1=[{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:"用户状态"}],K1=[{value:"popup",label:"弹窗提示",desc:"在小程序内弹窗引导用户完成下一步"},{value:"navigate",label:"跳转页面",desc:"引导用户跳转到指定页面"},{value:"webhook",label:"推送飞书群",desc:"触发后推送消息到飞书群Webhook"},{value:"tag",label:"自动打标签",desc:"触发后自动给用户打上指定标签"}];function c2(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 QP(t){return{...t,triggerConditions:c2(t.triggerConditions)}}const YP=[{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:"待激活"}],pc=[{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 q1(t){return confirm(`确定删除该${t}?此操作不可恢复。`)?window.prompt(`请输入「删除」以确认删除${t}`)==="删除":!1}function XP(){var B,de,je,He,ht,Tt,Ln;const[t,e]=T0(),n=t.get("pool"),r=t.get("tab")||"users",a=["users","journey","rules","vip-roles","leads"].includes(r)?r:"users",[i,o]=b.useState([]),[c,u]=b.useState(0),[h,f]=b.useState(1),[m,x]=b.useState(10),[y,v]=b.useState(""),w=hf(y,300),N=n==="vip"?"vip":n==="complete"?"complete":"all",[k,E]=b.useState(N),[C,L]=b.useState(!0),[O,K]=b.useState(!1),[_,H]=b.useState(null),[P,ee]=b.useState(!1),[Q,V]=b.useState(!1),[re,ae]=b.useState("desc");b.useEffect(()=>{n==="vip"?E("vip"):n==="complete"?E("complete"):n==="all"&&E("all")},[n]);const[pe,I]=b.useState(!1),[z,R]=b.useState(null),[ie,q]=b.useState(!1),[$,U]=b.useState(!1),[ce,ue]=b.useState({referrals:[],stats:{}}),[oe,F]=b.useState(!1),[G,te]=b.useState(null),[be,ge]=b.useState(!1),[Ce,We]=b.useState(null),[gt,Lt]=b.useState(!1),[yt,Ot]=b.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),[It,Pn]=b.useState([]),[vn,Ht]=b.useState(!1),[Xt,Cn]=b.useState(!1),[Fn,Un]=b.useState(null),[At,xn]=b.useState({title:"",description:"",trigger:"",triggerConditions:[],actionType:"popup",sort:0,enabled:!0}),[Nn,ve]=b.useState([]),[Te,Ve]=b.useState(!1),[st,Mt]=b.useState(null),[jt,D]=b.useState(null),[Ie,vt]=b.useState({}),[Rt,bt]=b.useState(!1),[it,Dt]=b.useState(null),[Jt,an]=b.useState([]),[as,nr]=b.useState(!1),[Ni,ca]=b.useState(null),[da,zr]=b.useState(""),[$r,Fr]=b.useState([]),[xr,gr]=b.useState(!1),[Oa,sr]=b.useState({}),[Ms,rr]=b.useState([]),[yr,As]=b.useState(0),[se,ye]=b.useState(1),[Ge]=b.useState(20),[ft,Wn]=b.useState(!1),[Fs,Da]=b.useState(null),[_a,Lo]=b.useState(""),ar=hf(_a,300),[Is,wi]=b.useState(""),[Ut,Dl]=b.useState(""),[ir,Oo]=b.useState({}),[ua,_l]=b.useState(null),[za,$a]=b.useState(!1),wn=b.useCallback(async(M,fe)=>{Wn(!0),Da(null);try{const we=new URLSearchParams({mode:"contact",page:String(se),pageSize:String(Ge)}),Re=M??ar;Re&&we.set("search",Re);const Xe=fe??Is;Xe&&we.set("source",Xe),Ut&&we.set("pushStatus",Ut);const nt=await De(`/api/db/ckb-leads?${we}`);if(nt!=null&&nt.success)rr(nt.records||[]),As(nt.total??0),nt.stats&&Oo(nt.stats);else{const on=(nt==null?void 0:nt.error)||"加载获客列表失败";Da(on),X.error(on),rr([]),As(0)}}catch(we){const Re=we instanceof Error?we.message:"网络错误";Da(Re),X.error("加载获客列表失败: "+Re),rr([]),As(0)}finally{Wn(!1)}},[se,Ge,ar,Is,Ut]);async function ed(M){if(M){_l(M);try{const fe=await St("/api/db/ckb-leads/retry",{id:M});fe!=null&&fe.success?X.success(fe.pushed?"重推成功":"已发起重推,请刷新查看状态"):X.error((fe==null?void 0:fe.error)||"重推失败")}catch(fe){X.error(fe instanceof Error?fe.message:"重推请求失败")}finally{_l(null),wn()}}}async function Qn(){const M=ys.filter(Re=>Re.pushStatus==="failed");if(M.length===0){X.info("当前页无失败记录");return}$a(!0);let fe=0;for(const Re of M)try{const Xe=await St("/api/db/ckb-leads/retry",{id:Re.id});Xe!=null&&Xe.success&&Xe.pushed&&fe++}catch{}$a(!1);const we=M.length;X.success(`批量重推完成:成功 ${fe} / ${we}`),wn()}function td(){const M=ys.filter(Ke=>Ke.pushStatus==="failed");if(M.length===0){X.info("当前筛选下无失败记录可导出");return}const fe=Ke=>`"${String(Ke??"").replace(/"/g,'""')}"`,Re=[["ID","昵称","手机号","微信号","对应@人","来源","推送状态","重试次数","失败原因","下次重试时间","创建时间"].join(",")];for(const Ke of M)Re.push([fe(Ke.id),fe(Ke.userNickname||Ke.name||""),fe(Ke.phone||""),fe(Ke.wechatId||""),fe(Ke.personName||""),fe(Ke.source||""),fe(Ke.pushStatus||""),fe(typeof Ke.retryCount=="number"?Ke.retryCount:""),fe(Ke.ckbError||""),fe(Ke.nextRetryAt?new Date(Ke.nextRetryAt).toLocaleString():""),fe(Ke.createdAt?new Date(Ke.createdAt).toLocaleString():"")].join(","));const Xe=new Blob(["\uFEFF"+Re.join(` -`)],{type:"text/csv;charset=utf-8;"}),nt=URL.createObjectURL(Xe),on=document.createElement("a");on.href=nt,on.download=`获客失败清单-${new Date().toISOString().slice(0,19).replace(/[:T]/g,"-")}.csv`,document.body.appendChild(on),on.click(),document.body.removeChild(on),URL.revokeObjectURL(nt),X.success(`已导出失败清单(${M.length} 条)`)}const Br=b.useCallback(async()=>{try{const M=await De("/api/admin/mbti-avatars"),fe=M!=null&&M.avatars&&typeof M.avatars=="object"?M.avatars:{};sr(fe)}catch{sr({})}},[]);b.useEffect(()=>{t.get("tab")==="leads"&&wn()},[t.get("tab"),se,wn]),b.useEffect(()=>{if(a!=="leads")return;const M=window.setInterval(()=>{wn()},3e4);return()=>window.clearInterval(M)},[a,wn]),b.useEffect(()=>{Br()},[Br]);const Do=b.useCallback((M,fe)=>{const we=(M||"").trim();if(we)return we;const Re=(fe||"").trim().toUpperCase();return/^[EI][NS][FT][JP]$/.test(Re)?(Oa[Re]||"").trim():""},[Oa]),ji=b.useCallback(M=>{const fe=!!M.hasFullBook,we=Number(M.purchasedSectionCount||0);return fe?{tone:"vip",main:"已购全书",sub:we>0?`另购单章 ${we} 章`:"购买项:VIP / 全书"}:we>0?{tone:"paid",main:`已购 ${we} 章`,sub:"购买项:章节"}:{tone:"free",main:"未购买",sub:""}},[]),[ha,br]=b.useState(null),Vr=b.useCallback(async()=>{try{const M=await De("/api/admin/users/online-stats");M!=null&&M.success&&typeof M.onlineCount=="number"?br(M.onlineCount):br(0)}catch{br(null)}},[]);b.useEffect(()=>{Vr();const M=setInterval(Vr,1e4);return()=>clearInterval(M)},[Vr]);async function fa(M=!1){var fe;L(!0),M&&K(!0),H(null);try{if(P){const we=new URLSearchParams({search:w,limit:String(m*5)}),Re=await De(`/api/db/users/rfm?${we}`);if(Re!=null&&Re.success){let Xe=Re.users||[];re==="asc"&&(Xe=[...Xe].reverse());const nt=(h-1)*m;o(Xe.slice(nt,nt+m)),u(((fe=Re.users)==null?void 0:fe.length)??0),Xe.length===0&&(ee(!1),H("暂无订单数据,RFM 排序需要用户有购买记录后才能生效"))}else ee(!1),H((Re==null?void 0:Re.error)||"RFM 加载失败,已切回普通模式")}else{const we=new URLSearchParams({page:String(h),pageSize:String(m),search:w,...k==="vip"&&{vip:"true"},...k==="complete"&&{pool:"complete"}}),Re=await De(`/api/db/users?${we}`);Re!=null&&Re.success?(o(Re.users||[]),u(Re.total??0)):H((Re==null?void 0:Re.error)||"加载失败")}}catch(we){console.error("Load users error:",we),H("网络错误")}finally{L(!1),M&&K(!1)}}b.useEffect(()=>{f(1)},[w,k,P]),b.useEffect(()=>{fa()},[h,m,w,k,P,re]);const ki=Math.ceil(c/m)||1,Fa=()=>{P?re==="desc"?ae("asc"):(ee(!1),ae("desc")):(ee(!0),ae("desc"))},Si=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 Ci(M){var fe;if(!q1("用户")){X.info("已取消删除");return}try{const we=await di(`/api/db/users?id=${encodeURIComponent(M)}`);we!=null&&we.success?(X.success("已删除"),fa()):X.error("删除失败: "+((we==null?void 0:we.error)||"未知错误"))}catch(we){const Re=we,Xe=((fe=Re==null?void 0:Re.data)==null?void 0:fe.error)||(Re==null?void 0:Re.message)||"网络错误";X.error("删除失败: "+Xe)}}const Hr=M=>{R(M),Ot({phone:M.phone||"",nickname:M.nickname||"",password:"",isAdmin:!!(M.isAdmin??!1),hasFullBook:!!(M.hasFullBook??!1)}),I(!0)},Ti=()=>{R(null),Ot({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),I(!0)};async function _o(){if(!yt.phone||!yt.nickname){X.error("请填写手机号和昵称");return}q(!0);try{if(z){const M=await Zt("/api/db/users",{id:z.id,phone:yt.phone||void 0,nickname:yt.nickname,isAdmin:yt.isAdmin,hasFullBook:yt.hasFullBook,...yt.password&&{password:yt.password}});if(!(M!=null&&M.success)){X.error("更新失败: "+((M==null?void 0:M.error)||""));return}}else{const M=await St("/api/db/users",{phone:yt.phone,nickname:yt.nickname,password:yt.password,isAdmin:yt.isAdmin});if(!(M!=null&&M.success)){X.error("创建失败: "+((M==null?void 0:M.error)||""));return}}I(!1),fa()}catch{X.error("保存失败")}finally{q(!1)}}async function mt(M){te(M),U(!0),F(!0);try{const fe=await De(`/api/db/users/referrals?userId=${encodeURIComponent(M.id)}`);fe!=null&&fe.success?ue({referrals:fe.referrals||[],stats:fe.stats||{}}):ue({referrals:[],stats:{}})}catch{ue({referrals:[],stats:{}})}finally{F(!1)}}const vr=b.useCallback(async()=>{Ht(!0);try{const M=await De("/api/db/user-rules");M!=null&&M.success&&Pn((M.rules||[]).map(fe=>QP(fe)))}catch{}finally{Ht(!1)}},[]);async function Ba(){if(!At.title){X.error("请填写规则标题");return}q(!0);try{if(Fn){const M=await Zt("/api/db/user-rules",{id:Fn.id,...At});if(!(M!=null&&M.success)){X.error("更新失败: "+((M==null?void 0:M.error)||""));return}}else{const M=await St("/api/db/user-rules",At);if(!(M!=null&&M.success)){X.error("创建失败: "+((M==null?void 0:M.error)||""));return}}Cn(!1),vr()}catch{X.error("保存失败")}finally{q(!1)}}async function Va(M){if(!q1("规则")){X.info("已取消删除");return}try{const fe=await di(`/api/db/user-rules?id=${M}`);fe!=null&&fe.success&&vr()}catch{}}async function zo(M){try{await Zt("/api/db/user-rules",{id:M.id,enabled:!M.enabled}),vr()}catch{}}const hn=b.useCallback(async()=>{Ve(!0);try{const M=await De("/api/db/vip-members?limit=500");if(M!=null&&M.success&&M.data){const fe=[...M.data].map((we,Re)=>({...we,vipSort:typeof we.vipSort=="number"?we.vipSort:Re+1}));fe.sort((we,Re)=>(we.vipSort??999999)-(Re.vipSort??999999)),ve(fe)}else M&&M.error&&X.error(M.error)}catch{X.error("加载超级个体列表失败")}finally{Ve(!1)}},[]),[zl,Bs]=b.useState(!1),[Nr,Vs]=b.useState(null),[Rs,Ps]=b.useState(""),[pa,Ur]=b.useState(!1),[Yn,Hs]=b.useState(!1),[Wr,wr]=b.useState(null),[ma,Kr]=b.useState(""),[jr,$o]=b.useState(!1),Ha=["创业者","资源整合者","技术达人","投资人","产品经理","流量操盘手"],Us=M=>{Vs(M),Ps(M.vipRole||""),Bs(!0)},xa=M=>{wr(M),Kr((M.webhookUrl||"").trim()),Hs(!0)},gs=async M=>{const fe=M.trim();if(Nr){if(!fe){X.error("请选择或输入标签");return}Ur(!0);try{const we=await Zt("/api/db/users",{id:Nr.id,vipRole:fe});if(!(we!=null&&we.success)){X.error((we==null?void 0:we.error)||"更新超级个体标签失败");return}X.success("已更新超级个体标签"),Bs(!1),Vs(null),await hn()}catch{X.error("更新超级个体标签失败")}finally{Ur(!1)}}},Ei=async()=>{if(!Wr)return;const M=ma.trim();if(M&&!/^https?:\/\//i.test(M)){X.error("Webhook 地址需以 http/https 开头");return}$o(!0);try{const fe=await Zt("/api/db/vip-members/webhook",{userId:Wr.id,webhookUrl:M});if(!(fe!=null&&fe.success)){X.error((fe==null?void 0:fe.error)||"保存飞书群 Webhook 失败");return}X.success(M?"已保存该超级个体的飞书群 Webhook":"已清空该超级个体的飞书群 Webhook"),Hs(!1),wr(null),await hn()}catch{X.error("保存飞书群 Webhook 失败")}finally{$o(!1)}},[$l,Ua]=b.useState(!1),[kr,qr]=b.useState(null),[Mi,Ai]=b.useState(""),[Ls,Ii]=b.useState(!1),Ri=M=>{qr(M),Ai(M.vipSort!=null?String(M.vipSort):""),Ua(!0)},Fl=async()=>{if(!kr)return;const M=Number(Mi);if(!Number.isFinite(M)){X.error("请输入有效的数字序号");return}Ii(!0);try{const fe=await Zt("/api/db/users",{id:kr.id,vipSort:M});if(!(fe!=null&&fe.success)){X.error((fe==null?void 0:fe.error)||"更新排序序号失败");return}X.success("已更新排序序号"),Ua(!1),qr(null),await hn()}catch{X.error("更新排序序号失败")}finally{Ii(!1)}},Pi=(M,fe)=>{M.dataTransfer.effectAllowed="move",M.dataTransfer.setData("text/plain",fe),Mt(fe)},Li=(M,fe)=>{M.preventDefault(),jt!==fe&&D(fe)},Bl=()=>{Mt(null),D(null)},is=async(M,fe)=>{M.preventDefault();const we=M.dataTransfer.getData("text/plain")||st;if(Mt(null),D(null),!we||we===fe)return;const Re=Nn.find(Ke=>Ke.id===we),Xe=Nn.find(Ke=>Ke.id===fe);if(!Re||!Xe)return;const nt=Re.vipSort??Nn.findIndex(Ke=>Ke.id===we)+1,on=Xe.vipSort??Nn.findIndex(Ke=>Ke.id===fe)+1;ve(Ke=>{const Qt=[...Ke],or=Qt.findIndex(nd=>nd.id===we),Sr=Qt.findIndex(nd=>nd.id===fe);if(or===-1||Sr===-1)return Ke;const Uo=[...Qt],[Bp,Vp]=[Uo[or],Uo[Sr]];return Uo[or]={...Vp,vipSort:nt},Uo[Sr]={...Bp,vipSort:on},Uo});try{const[Ke,Qt]=await Promise.all([Zt("/api/db/users",{id:we,vipSort:on}),Zt("/api/db/users",{id:fe,vipSort:nt})]);if(!(Ke!=null&&Ke.success)||!(Qt!=null&&Qt.success)){X.error((Ke==null?void 0:Ke.error)||(Qt==null?void 0:Qt.error)||"更新排序失败"),await hn();return}X.success("已更新排序"),await hn()}catch{X.error("更新排序失败"),await hn()}},Gr=b.useCallback(async()=>{bt(!0);try{const M=await De("/api/db/users/journey-stats");M!=null&&M.success&&M.stats&&vt(M.stats)}catch{}finally{bt(!1)}},[]),Fo=b.useCallback(async M=>{Dt(M),nr(!0);try{const fe=await De(`/api/db/users/journey-users?stage=${M}&limit=50`);fe!=null&&fe.success&&fe.users&&an(fe.users)}catch{}finally{nr(!1)}},[]),Wa=b.useCallback(async(M,fe)=>{ca(M),zr(fe),gr(!0);try{const we=await De(`/api/db/users/tracks?userId=${M}&limit=50`);we!=null&&we.success&&we.tracks&&Fr(we.tracks)}catch{}finally{gr(!1)}},[]),[Vl,Oi]=b.useState(!1),Bo=async()=>{Oi(!0);try{const M=await St("/api/admin/shensheshou/batch-enrich",{limit:20});M!=null&&M.success?(X.success(`批量补全完成:${M.enriched} 人已补全,${M.skipped} 人跳过`),fa()):X.error((M==null?void 0:M.error)||"批量补全失败")}catch{X.error("批量补全请求失败")}finally{Oi(!1)}},ga=M=>{const fe=[M.phone,M.nickname,M.avatar,M.wechatId,M.mbti,M.industry,M.region,M.position],we=fe.filter(Re=>Re!=null&&Re!=="").length;return Math.round(we/fe.length*100)},{leadsRows:ys,leadsRawCount:Vo,leadsDeduped:Ho}=b.useMemo(()=>{const M=Ke=>(Ke||"").replace(/\D/g,"")||"",fe=Ke=>{const Qt=M(Ke.phone);if(Qt)return`phone:${Qt}`;const or=(Ke.userId||"").trim();if(or)return`user:${or}`;const Sr=(Ke.wechatId||"").trim();return Sr?`wechat:${Sr}`:`row:${Ke.id}`},we=ar.trim().toLowerCase();let Re=Ms;we&&(Re=Ms.filter(Ke=>[Ke.userNickname,Ke.name,Ke.phone,Ke.wechatId,Ke.personName,Ke.source,String(Ke.ckbPlanId??"")].filter(Boolean).join(" ").toLowerCase().includes(we)));const Xe=[...Re].sort((Ke,Qt)=>{const or=Ke.createdAt?new Date(Ke.createdAt).getTime():0;return(Qt.createdAt?new Date(Qt.createdAt).getTime():0)-or}),nt=new Set,on=[];for(const Ke of Xe){const Qt=fe(Ke);nt.has(Qt)||(nt.add(Qt),on.push(Ke))}return{leadsRows:on,leadsRawCount:Re.length,leadsDeduped:Re.length-on.length}},[Ms,ar]),Hl=M=>M==="success"?s.jsx(Be,{className:"bg-emerald-500/20 text-emerald-300 border-0 text-xs",children:"成功"}):M==="failed"?s.jsx(Be,{className:"bg-red-500/20 text-red-300 border-0 text-xs",children:"失败"}):s.jsx(Be,{className:"bg-amber-500/20 text-amber-300 border-0 text-xs",children:"待推送"}),Di=b.useMemo(()=>{const M=new Map;for(const fe of ys){if(fe.pushStatus!=="failed")continue;const we=(fe.ckbError||"未知错误").trim()||"未知错误";M.set(we,(M.get(we)||0)+1)}return Array.from(M.entries()).map(([fe,we])=>({reason:fe,count:we})).sort((fe,we)=>we.count-fe.count)},[ys]);async function T(){const M=ys.filter(nt=>nt.pushStatus==="failed");if(M.length===0){X.info("当前页无失败记录");return}const fe=Di.slice(0,8).map(nt=>`- ${nt.reason}:${nt.count} 条`).join(` -`),we=M.slice(0,30).map(nt=>nt.id).join(", "),Re=M.slice(0,20).map(nt=>`#${nt.id} | ${nt.userNickname||nt.name||"-"} | 手机:${nt.phone||"-"} | 来源:${nt.source||"-"} | 重试:${nt.retryCount??0} | 错误:${nt.ckbError||"-"}`).join(` -`),Xe=["【获客失败排障信息】",`时间:${new Date().toLocaleString()}`,`当前页失败总数:${M.length}`,"主要失败原因:",fe||"- 无",`最近失败记录ID(最多30条):${we||"无"}`,"","失败记录明细(最多20条):",Re||"无"].join(` -`);try{await navigator.clipboard.writeText(Xe),X.success("已复制排障信息")}catch{X.error("复制失败,请检查浏览器剪贴板权限")}}return s.jsxs("div",{className:"p-8 w-full",children:[_&&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:_}),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," 位注册用户",ha!==null&&s.jsxs("span",{className:"text-[#38bdac] ml-1",children:["· 在线 ",ha," 人"]}),P&&" · 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":Q,children:[s.jsx(af,{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:Q?"RFM · Are you good(用户价值分层)":"RFM · 点击展开说明"})]}),Q?s.jsx(xg,{className:"w-4 h-4 text-gray-400 shrink-0"}):s.jsx(Pc,{className:"w-4 h-4 text-gray-400 shrink-0"})]}),s.jsx(J,{type:"button",variant:"outline",size:"sm",onClick:Fa,className:"border-[#38bdac]/50 text-[#38bdac] hover:bg-[#38bdac]/10 bg-transparent shrink-0",children:P?re==="desc"?"RFM 降序":"RFM 升序":"按 RFM 排序"})]}),Q&&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:YP.map(({level:M,range:fe,label:we})=>s.jsxs(Be,{variant:"outline",className:`text-[10px] border-0 ${Si(M)}`,children:[M," ",fe," · ",we]},M))})]})]})})]}),s.jsxs(Dc,{value:a,onValueChange:M=>{const fe=new URLSearchParams(t);M==="users"?fe.delete("tab"):fe.set("tab",M),e(fe)},className:"w-full",children:[s.jsxs(Nl,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-6 flex-wrap h-auto gap-1",children:[s.jsxs(tn,{value:"users",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",children:[s.jsx(_n,{className:"w-4 h-4"})," 用户列表"]}),s.jsxs(tn,{value:"leads",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:()=>wn(),children:[s.jsx(Sc,{className:"w-4 h-4"})," 获客列表"]}),s.jsxs(tn,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Gr,children:[s.jsx(na,{className:"w-4 h-4"})," 用户旅程总览"]}),s.jsxs(tn,{value:"rules",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:vr,children:[s.jsx(co,{className:"w-4 h-4"})," 规则配置"]}),s.jsxs(tn,{value:"vip-roles",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:hn,children:[s.jsx(Tc,{className:"w-4 h-4"})," 超级个体列表"]})]}),s.jsxs(nn,{value:"users",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4 justify-end flex-wrap",children:[s.jsxs(J,{variant:"outline",onClick:Bo,disabled:Vl,className:"border-purple-500/50 text-purple-400 hover:bg-purple-500/10 bg-transparent",title:"批量调用神射手补全有手机号用户的资料",children:[Vl?s.jsx(Fe,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(xi,{className:"w-4 h-4 mr-2"}),"批量补全"]}),s.jsxs(J,{variant:"outline",onClick:()=>fa(!0),disabled:O,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${O?"animate-spin":""}`})," 刷新"]}),s.jsxs("select",{value:k,onChange:M=>{const fe=M.target.value;E(fe),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:P,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(Ta,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(le,{type:"text",placeholder:"搜索用户...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500 w-56",value:y,onChange:M=>v(M.target.value)})]}),s.jsxs(J,{onClick:Ti,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sc,{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(Fe,{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(fs,{children:[s.jsx(ps,{children:s.jsxs(xt,{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:Fa,children:[s.jsxs("div",{className:"flex items-center gap-1 group",children:[s.jsx(af,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"RFM分值"}),P?re==="desc"?s.jsx(Pc,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(xg,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(mx,{className:"w-3.5 h-3.5 text-gray-600 group-hover:text-gray-400"})]}),P&&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(ms,{children:[i.map(M=>{var fe,we,Re;return s.jsxs(xt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(Ne,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[(()=>{var on;const Xe=Do(M.avatar,M.mbti),nt=((on=M.nickname)==null?void 0:on.charAt(0))||"?";return s.jsx("button",{type:"button",title:"点击管理 MBTI 默认头像库",onClick:()=>Lt(!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:Xe?s.jsx("img",{src:Xe,className:"w-full h-full rounded-full object-cover",alt:"",onError:Ke=>{var Sr;const Qt=Ke.target;if(Qt.style.display="none",Qt.nextElementSibling)return;const or=document.createElement("span");or.textContent=nt,(Sr=Qt.parentElement)==null||Sr.appendChild(or)}}):nt})})(),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:()=>{We(M.id),ge(!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&&!((fe=M.id)!=null&&fe.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:[(we=M.id)==null?void 0:we.slice(0,16),(((Re=M.id)==null?void 0:Re.length)??0)>16?"…":""]})]})]})}),s.jsx(Ne,{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(Ne,{children:(()=>{const Xe=ji(M);return Xe.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:Xe.main}),Xe.sub&&s.jsx("p",{className:"text-[11px] text-amber-300/80",children:Xe.sub})]}):Xe.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:Xe.main}),Xe.sub&&s.jsx("p",{className:"text-[11px] text-blue-300/80",children:Xe.sub})]}):s.jsx(Be,{variant:"outline",className:"text-gray-500 border-gray-600",children:Xe.main})})()}),s.jsx(Ne,{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:()=>mt(M),role:"button",tabIndex:0,onKeyDown:Xe=>Xe.key==="Enter"&&mt(M),children:[s.jsx(_n,{className:"w-3 h-3"})," 绑定",M.referralCount||0,"人"]})]})}),s.jsx(Ne,{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 ${Si(M.rfmLevel)}`,children:M.rfmLevel})]}):s.jsx("span",{className:"text-gray-600 text-xs",children:"无订单"})}),s.jsx(Ne,{children:(()=>{const Xe=ga(M),nt=Xe>=75?"text-green-400":Xe>=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 ${Xe>=75?"bg-green-500":Xe>=50?"bg-yellow-500":"bg-gray-500"}`,style:{width:`${Xe}%`}})}),s.jsxs("span",{className:`text-xs ${nt}`,children:[Xe,"%"]})]})})()}),s.jsx(Ne,{className:"text-gray-400",children:M.createdAt?new Date(M.createdAt).toLocaleDateString():"-"}),s.jsx(Ne,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>{We(M.id),ge(!0)},className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"用户详情",children:s.jsx(rf,{className:"w-4 h-4"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>Hr(M),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑用户",children:s.jsx(en,{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:()=>Ci(M.id),title:"删除",children:s.jsx(js,{className:"w-4 h-4"})})]})})]},M.id)}),i.length===0&&s.jsx(xt,{children:s.jsx(Ne,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),s.jsx(Zs,{page:h,totalPages:ki,total:c,pageSize:m,onPageChange:f,onPageSizeChange:M=>{x(M),f(1)}})]})})})]}),s.jsxs(nn,{value:"leads",children:[Fs&&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:Fs}),s.jsx("button",{type:"button",className:"shrink-0 ml-2",onClick:()=>Da(null),"aria-label":"关闭",children:"×"})]}),!ft&&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:yr})]}),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:ir.uniqueUsers??0})]}),(ir.sourceStats&&ir.sourceStats.length>0?ir.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))]}),!ft&&Di.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:T,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:Di.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(Ta,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(le,{placeholder:"搜索昵称/手机/微信/@人/来源…",value:_a,onChange:M=>Lo(M.target.value),className:"pl-9 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"})]}),ir.sourceStats&&ir.sourceStats.length>0&&s.jsxs("select",{value:Is,onChange:M=>{wi(M.target.value),ye(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部来源"}),ir.sourceStats.map(M=>s.jsxs("option",{value:M.source,children:[M.source,"(",M.cnt,")"]},M.source))]}),s.jsxs("select",{value:Ut,onChange:M=>{Dl(M.target.value),ye(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:()=>{Dl("failed"),ye(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:["本页 ",Vo," 条",Ho>0?` · 已合并 ${Ho} 条重复`:""]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx(J,{variant:"outline",onClick:td,disabled:ft,className:"border-cyan-600/60 text-cyan-300 hover:bg-cyan-500/10 bg-transparent",children:"导出失败清单"}),s.jsxs(J,{variant:"outline",onClick:Qn,disabled:za||ft,className:"border-amber-600/60 text-amber-300 hover:bg-amber-500/10 bg-transparent",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${za?"animate-spin":""}`}),"重推本页失败项"]}),s.jsxs(J,{variant:"outline",onClick:()=>wn(),disabled:ft,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${ft?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(ze,{className:"p-0",children:ft?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Fe,{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(fs,{children:[s.jsx(ps,{children:s.jsxs(xt,{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.jsxs(ms,{children:[ys.map(M=>s.jsxs(xt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(Ne,{className:"text-gray-300",children:M.userNickname||M.name||"-"}),s.jsx(Ne,{className:"text-gray-300",children:M.phone||"-"}),s.jsx(Ne,{className:"text-gray-300",children:M.wechatId||"-"}),s.jsx(Ne,{className:"text-[#38bdac]",children:M.personName||"-"}),s.jsx(Ne,{className:"text-gray-400",children:M.ckbPlanId?`#${M.ckbPlanId}`:"-"}),s.jsx(Ne,{children:s.jsx(Be,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:M.source||"未知"})}),s.jsx(Ne,{children:s.jsxs("div",{className:"space-y-1",children:[Hl(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(Ne,{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:ua===M.id,onClick:()=>ed(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(Fe,{className:`w-3 h-3 mr-1 ${ua===M.id?"animate-spin":""}`}),"重推"]})]})}),s.jsx(Ne,{className:"text-gray-400",children:M.createdAt?new Date(M.createdAt).toLocaleString():"-"})]},M.id)),ys.length===0&&s.jsx(xt,{children:s.jsx(Ne,{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(Sc,{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:ar.trim()||Is?"当前搜索或来源筛选下没有匹配记录,可清空条件后重试。":"存客宝场景产生的手机号 / 微信留资会出现在此列表。请确认获客计划已开启,并有用户完成留资。"}),s.jsxs(J,{type:"button",variant:"outline",onClick:()=>wn(),disabled:ft,className:"border-[#38bdac]/40 text-[#38bdac] hover:bg-[#38bdac]/10 bg-transparent",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${ft?"animate-spin":""}`}),"重新加载"]})]})})})]})]}),s.jsx(Zs,{page:se,totalPages:Math.ceil(yr/Ge)||1,total:yr,pageSize:Ge,onPageChange:ye,onPageSizeChange:()=>{}})]})})})]}),s.jsxs(nn,{value:"journey",children:[s.jsxs("div",{className:"flex items-center justify-between mb-5",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"用户从注册到 VIP 的完整行动路径,点击各阶段查看用户动态"}),s.jsxs(J,{variant:"outline",onClick:Gr,disabled:Rt,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${Rt?"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:pc.map((M,fe)=>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 ${it===M.id?"ring-2 ring-[#38bdac]":""}`,onClick:()=>Fo(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}),Ie[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:Ie[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:fe+1})]}),fes.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(er,{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:"实时更新"})]}),Rt?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(Fe,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Object.keys(Ie).length>0?s.jsx("div",{className:"space-y-2",children:pc.map(M=>{const fe=Ie[M.id]||0,we=Math.max(...pc.map(Xe=>Ie[Xe.id]||0),1),Re=Math.round(fe/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:`${Re}%`}})}),s.jsx("span",{className:"text-gray-400 text-xs w-10 text-right",children:fe})]},M.id)})}):s.jsx("div",{className:"text-center py-8",children:s.jsx("p",{className:"text-gray-500 text-sm",children:"点击「刷新数据」加载统计"})})]})]}),it&&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(_n,{className:"w-4 h-4 text-[#38bdac]"}),s.jsxs("span",{className:"text-white font-medium",children:[(B=pc.find(M=>M.id===it))==null?void 0:B.icon," ",(de=pc.find(M=>M.id===it))==null?void 0:de.label," 阶段用户"]}),s.jsxs(Be,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-xs",children:[Jt.length," 人"]})]}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>Dt(null),className:"text-gray-400 hover:text-white",children:s.jsx(ts,{className:"w-4 h-4"})})]}),as?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(Fe,{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(fs,{children:[s.jsx(ps,{children:s.jsxs(xt,{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(ms,{children:Jt.map(M=>s.jsxs(xt,{className:"border-gray-700/50 hover:bg-[#0a1628]",children:[s.jsx(Ne,{className:"text-white",children:M.nickname||"微信用户"}),s.jsx(Ne,{className:"text-gray-300",children:M.phone||"-"}),s.jsx(Ne,{className:"text-gray-400 text-xs",children:M.createdAt?new Date(M.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx(Ne,{className:"text-right",children:s.jsxs(J,{variant:"ghost",size:"sm",className:"text-[#38bdac] hover:bg-[#38bdac]/10",onClick:()=>Wa(M.id,M.nickname||"微信用户"),children:[s.jsx(rf,{className:"w-4 h-4 mr-1"})," 行为轨迹"]})})]},M.id))})]})]}),s.jsx($t,{open:!!Ni,onOpenChange:M=>{M||ca(null)},children:s.jsxs(zt,{className:"sm:max-w-[600px] bg-[#0f2137] border-gray-700 text-white max-h-[80vh] overflow-y-auto",children:[s.jsx(Ft,{children:s.jsxs(Bt,{className:"text-white flex items-center gap-2",children:[s.jsx(na,{className:"w-5 h-5 text-[#38bdac]"}),da," 的行为轨迹"]})}),xr?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Fe,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):$r.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"}),$r.map((M,fe)=>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||fe))]})]})})]}),s.jsxs(nn,{value:"rules",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"用户旅程触达规则:各行为节点的触发条件与展示文案(偏利他说明,少用命令式)"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(J,{variant:"outline",onClick:vr,disabled:vn,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Fe,{className:`w-4 h-4 mr-2 ${vn?"animate-spin":""}`})," 刷新"]}),s.jsxs(J,{onClick:()=>{Un(null),xn({title:"",description:"",trigger:"",triggerConditions:[],actionType:"popup",sort:0,enabled:!0}),Cn(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Dn,{className:"w-4 h-4 mr-2"})," 添加规则"]})]})]}),vn?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Fe,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):It.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(er,{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:vr,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Fe,{className:"w-4 h-4 mr-2"})," 重新加载"]})]}):s.jsx("div",{className:"space-y-2",children:It.map(M=>{var we;const fe=c2(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(en,{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}),fe.length>0&&s.jsxs("div",{className:"flex flex-wrap gap-0.5 ml-1",children:[fe.slice(0,3).map(Re=>{const Xe=W1.find(nt=>nt.value===Re);return s.jsx(Be,{className:"bg-purple-500/10 text-purple-400 border border-purple-500/30 text-[9px]",children:(Xe==null?void 0:Xe.label)||Re},Re)}),fe.length>3&&s.jsxs("span",{className:"text-gray-500 text-[9px]",children:["+",fe.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:((we=K1.find(Re=>Re.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(Vt,{checked:M.enabled,onCheckedChange:()=>zo(M)}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>{Un(M),xn({title:M.title,description:M.description,trigger:M.trigger,triggerConditions:fe,actionType:M.actionType||"popup",sort:M.sort,enabled:M.enabled}),Cn(!0)},className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10 h-7 w-7 p-0",children:s.jsx(en,{className:"w-3.5 h-3.5"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>Va(M.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10 h-7 w-7 p-0",children:s.jsx(js,{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(nn,{value:"vip-roles",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"展示当前所有有效的超级个体(VIP 用户),用于检查会员信息与排序值。"}),s.jsx("p",{className:"text-xs text-[#38bdac]",children:"提示:按住任意一行即可拖拽排序,释放后将同步更新小程序展示顺序。"})]}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs(J,{variant:"outline",onClick:hn,disabled:Te,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Fe,{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(Fe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):Nn.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(Tc,{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(fs,{children:[s.jsx(ps,{children:s.jsxs(xt,{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(ms,{children:Nn.map((M,fe)=>{var Xe;const we=st===M.id,Re=jt===M.id;return s.jsxs(xt,{draggable:!0,onDragStart:nt=>Pi(nt,M.id),onDragOver:nt=>Li(nt,M.id),onDrop:nt=>is(nt,M.id),onDragEnd:Bl,className:`border-gray-700/50 cursor-grab active:cursor-grabbing select-none ${we?"opacity-60":""} ${Re?"bg-[#38bdac]/10":""}`,children:[s.jsx(Ne,{className:"text-gray-300",children:fe+1}),s.jsx(Ne,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[Do(M.avatar,M.mbti)?s.jsx("img",{src:Do(M.avatar,M.mbti),className:"w-8 h-8 rounded-full object-cover border border-amber-400/60",alt:"",onError:nt=>{var Ke,Qt;nt.target.style.display="none";const on=document.createElement("div");on.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",on.textContent=((Ke=M.name)==null?void 0:Ke[0])||"创",(Qt=nt.target.parentElement)==null||Qt.appendChild(on)}}):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:((Xe=M.name)==null?void 0:Xe[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:M.name})})]})}),s.jsx(Ne,{className:"text-gray-300 whitespace-nowrap",children:M.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置)"})}),s.jsx(Ne,{className:"text-center text-blue-400 text-xs font-mono",children:M.clickCount!=null?String(M.clickCount):"-"}),s.jsx(Ne,{className:"text-center text-green-400 text-xs font-mono",children:M.leadCount!=null?String(M.leadCount):"-"}),s.jsx(Ne,{className:"text-gray-300",children:M.vipSort??fe+1}),s.jsx(Ne,{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(Ne,{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:()=>Us(M),title:"设置超级个体标签",children:s.jsx(Bd,{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:()=>xa(M),title:"编辑飞书群Webhook",children:s.jsx(en,{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:()=>Ri(M),title:"设置排序序号",children:s.jsx(mx,{className:"w-3.5 h-3.5"})})]})})]},M.id)})})]})})})]})]}),s.jsx($t,{open:gt,onOpenChange:Lt,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-6xl",children:[s.jsx(Ft,{children:s.jsx(Bt,{className:"text-white",children:"MBTI 默认头像库"})}),s.jsx(JP,{})]})}),s.jsx($t,{open:$l,onOpenChange:M=>{Ua(M),M||qr(null)},children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(Ft,{children:s.jsxs(Bt,{className:"text-white flex items-center gap-2",children:[s.jsx(mx,{className:"w-5 h-5 text-[#38bdac]"}),"设置排序 — ",kr==null?void 0:kr.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"排序序号(数字越小越靠前)"}),s.jsx(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:1",value:Mi,onChange:M=>Ai(M.target.value)})]}),s.jsxs(yn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>Ua(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(ts,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:Fl,disabled:Ls,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),Ls?"保存中...":"保存"]})]})]})}),s.jsx($t,{open:zl,onOpenChange:M=>{Bs(M),M||Vs(null)},children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Ft,{children:s.jsxs(Bt,{className:"text-white flex items-center gap-2",children:[s.jsx(Tc,{className:"w-5 h-5 text-amber-400"}),"设置超级个体标签 — ",Nr==null?void 0:Nr.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"选择或输入标签"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:Ha.map(M=>s.jsx(J,{variant:Rs===M?"default":"outline",size:"sm",className:Rs===M?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50",onClick:()=>Ps(M),children:M},M))}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"或手动输入"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创业者、资源整合者等",value:Rs,onChange:M=>Ps(M.target.value)})]})]}),s.jsxs(yn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>Bs(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(ts,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:()=>gs(Rs),disabled:pa,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),pa?"保存中...":"保存"]})]})]})}),s.jsx($t,{open:Yn,onOpenChange:M=>{Hs(M),M||wr(null)},children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-xl",children:[s.jsx(Ft,{children:s.jsxs(Bt,{className:"text-white flex items-center gap-2",children:[s.jsx(en,{className:"w-5 h-5 text-[#38bdac]"}),"设置飞书群 Webhook — ",Wr==null?void 0:Wr.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"VOX Webhook 地址(留空即清空)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",value:ma,onChange:M=>Kr(M.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"当用户点击该超级个体头像并提交链接时,线索将优先推送到这里配置的飞书群。"})]}),s.jsxs(yn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>Hs(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(ts,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:Ei,disabled:jr,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),jr?"保存中...":"保存"]})]})]})}),s.jsx($t,{open:pe,onOpenChange:I,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(Ft,{children:s.jsxs(Bt,{className:"text-white flex items-center gap-2",children:[z?s.jsx(en,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(Sc,{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(Z,{className:"text-gray-300",children:"手机号"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:yt.phone,onChange:M=>Ot({...yt,phone:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"昵称"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:yt.nickname,onChange:M=>Ot({...yt,nickname:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:z?"新密码 (留空则不修改)":"密码"}),s.jsx(le,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:z?"留空则不修改":"请输入密码",value:yt.password,onChange:M=>Ot({...yt,password:M.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Z,{className:"text-gray-300",children:"管理员权限"}),s.jsx(Vt,{checked:yt.isAdmin,onCheckedChange:M=>Ot({...yt,isAdmin:M})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(Z,{className:"text-gray-300",children:"已购全书"}),s.jsx(Vt,{checked:yt.hasFullBook,onCheckedChange:M=>Ot({...yt,hasFullBook:M})})]})]}),s.jsxs(yn,{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(ts,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:_o,disabled:ie,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),ie?"保存中...":"保存"]})]})]})}),s.jsx($t,{open:Xt,onOpenChange:Cn,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[90vh] overflow-y-auto",children:[s.jsx(Ft,{children:s.jsxs(Bt,{className:"text-white flex items-center gap-2",children:[s.jsx(en,{className:"w-5 h-5 text-[#38bdac]"}),Fn?"编辑规则":"添加规则"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"规则标题 *"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:匹配后填写头像、付款1980需填写信息",value:At.title,onChange:M=>xn({...At,title:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"规则描述"}),s.jsx(wl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[60px] resize-none",placeholder:"弹窗内容/推送文案...",value:At.description,onChange:M=>xn({...At,description:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"触发条件(可多选)"}),s.jsx("div",{className:"space-y-2",children:["用户状态","阅读行为","付费行为","社交行为","分销行为"].map(M=>{const fe=W1.filter(we=>we.group===M);return fe.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:fe.map(we=>{const Re=(At.triggerConditions||[]).includes(we.value);return s.jsx("button",{type:"button",className:`px-2.5 py-1 rounded-md text-xs border transition-colors ${Re?"bg-[#38bdac]/20 border-[#38bdac]/50 text-[#38bdac]":"bg-[#0a1628] border-gray-700 text-gray-400 hover:border-gray-500"}`,onClick:()=>{const Xe=At.triggerConditions||[],nt=Re?Xe.filter(on=>on!==we.value):[...Xe,we.value];xn({...At,triggerConditions:nt})},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(Z,{className:"text-gray-300",children:"兼容触发标识(旧版)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white text-xs h-8",placeholder:"与小程序一致:注册、完成付款、update_avatar、update_nickname 等",value:At.trigger,onChange:M=>xn({...At,trigger:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"推送动作"}),s.jsx("div",{className:"grid grid-cols-2 gap-2",children:K1.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:()=>xn({...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(Z,{className:"text-gray-300",children:"启用状态"})}),s.jsx(Vt,{checked:At.enabled,onCheckedChange:M=>xn({...At,enabled:M})})]})]}),s.jsxs(yn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>Cn(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(ts,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:Ba,disabled:ie,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),ie?"保存中...":"保存"]})]})]})}),s.jsx($t,{open:$,onOpenChange:U,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[s.jsx(Ft,{children:s.jsxs(Bt,{className:"text-white flex items-center gap-2",children:[s.jsx(_n,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系 - ",G==null?void 0:G.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:((je=ce.stats)==null?void 0:je.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:((He=ce.stats)==null?void 0:He.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:["¥",(((ht=ce.stats)==null?void 0:ht.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:["¥",(((Tt=ce.stats)==null?void 0:Tt.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(Fe,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((Ln=ce.referrals)==null?void 0:Ln.length)??0)>0?s.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(ce.referrals??[]).map((M,fe)=>{var Re;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:((Re=we.nickname)==null?void 0:Re.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(Be,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),we.status==="paid"&&s.jsxs(Be,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",we.purchasedSections,"章"]}),we.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:we.createdAt?new Date(we.createdAt).toLocaleDateString():""})]})]},we.id||fe)})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),s.jsx(yn,{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(V0,{open:be,onClose:()=>ge(!1),userId:Ce,onUserUpdated:fa})]})}function ff(t,[e,n]){return Math.min(n,Math.max(e,t))}var d2=["PageUp","PageDown"],u2=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],h2={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Jc="Slider",[Tg,ZP,e8]=z0(Jc),[f2]=Eo(Jc,[e8]),[t8,gp]=f2(Jc),p2=b.forwardRef((t,e)=>{const{name:n,min:r=0,max:a=100,step:i=1,orientation:o="horizontal",disabled:c=!1,minStepsBetweenThumbs:u=0,defaultValue:h=[r],value:f,onValueChange:m=()=>{},onValueCommit:x=()=>{},inverted:y=!1,form:v,...w}=t,N=b.useRef(new Set),k=b.useRef(0),C=o==="horizontal"?n8:s8,[L=[],O]=bl({prop:f,defaultProp:h,onChange:Q=>{var re;(re=[...N.current][k.current])==null||re.focus(),m(Q)}}),K=b.useRef(L);function _(Q){const V=l8(L,Q);ee(Q,V)}function H(Q){ee(Q,k.current)}function P(){const Q=K.current[k.current];L[k.current]!==Q&&x(L)}function ee(Q,V,{commit:re}={commit:!1}){const ae=h8(i),pe=f8(Math.round((Q-r)/i)*i+r,ae),I=ff(pe,[r,a]);O((z=[])=>{const R=i8(z,I,V);if(u8(R,u*i)){k.current=R.indexOf(I);const ie=String(R)!==String(z);return ie&&re&&x(R),ie?R:z}else return z})}return s.jsx(t8,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:a,valueIndexToChangeRef:k,thumbs:N.current,values:L,orientation:o,form:v,children:s.jsx(Tg.Provider,{scope:t.__scopeSlider,children:s.jsx(Tg.Slot,{scope:t.__scopeSlider,children:s.jsx(C,{"aria-disabled":c,"data-disabled":c?"":void 0,...w,ref:e,onPointerDown:Nt(w.onPointerDown,()=>{c||(K.current=L)}),min:r,max:a,inverted:y,onSlideStart:c?void 0:_,onSlideMove:c?void 0:H,onSlideEnd:c?void 0:P,onHomeKeyDown:()=>!c&&ee(r,0,{commit:!0}),onEndKeyDown:()=>!c&&ee(a,L.length-1,{commit:!0}),onStepKeyDown:({event:Q,direction:V})=>{if(!c){const pe=d2.includes(Q.key)||Q.shiftKey&&u2.includes(Q.key)?10:1,I=k.current,z=L[I],R=i*pe*V;ee(z+R,I,{commit:!0})}}})})})})});p2.displayName=Jc;var[m2,x2]=f2(Jc,{startEdge:"left",endEdge:"right",size:"width",direction:1}),n8=b.forwardRef((t,e)=>{const{min:n,max:r,dir:a,inverted:i,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onStepKeyDown:h,...f}=t,[m,x]=b.useState(null),y=qt(e,C=>x(C)),v=b.useRef(void 0),w=pp(a),N=w==="ltr",k=N&&!i||!N&&i;function E(C){const L=v.current||m.getBoundingClientRect(),O=[0,L.width],_=H0(O,k?[n,r]:[r,n]);return v.current=L,_(C-L.left)}return s.jsx(m2,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:s.jsx(g2,{dir:w,"data-orientation":"horizontal",...f,ref:y,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:C=>{const L=E(C.clientX);o==null||o(L)},onSlideMove:C=>{const L=E(C.clientX);c==null||c(L)},onSlideEnd:()=>{v.current=void 0,u==null||u()},onStepKeyDown:C=>{const O=h2[k?"from-left":"from-right"].includes(C.key);h==null||h({event:C,direction:O?-1:1})}})})}),s8=b.forwardRef((t,e)=>{const{min:n,max:r,inverted:a,onSlideStart:i,onSlideMove:o,onSlideEnd:c,onStepKeyDown:u,...h}=t,f=b.useRef(null),m=qt(e,f),x=b.useRef(void 0),y=!a;function v(w){const N=x.current||f.current.getBoundingClientRect(),k=[0,N.height],C=H0(k,y?[r,n]:[n,r]);return x.current=N,C(w-N.top)}return s.jsx(m2,{scope:t.__scopeSlider,startEdge:y?"bottom":"top",endEdge:y?"top":"bottom",size:"height",direction:y?1:-1,children:s.jsx(g2,{"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=h2[y?"from-bottom":"from-top"].includes(w.key);u==null||u({event:w,direction:k?-1:1})}})})}),g2=b.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:a,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:c,onStepKeyDown:u,...h}=t,f=gp(Jc,n);return s.jsx(Ct.span,{...h,ref:e,onKeyDown:Nt(t.onKeyDown,m=>{m.key==="Home"?(o(m),m.preventDefault()):m.key==="End"?(c(m),m.preventDefault()):d2.concat(u2).includes(m.key)&&(u(m),m.preventDefault())}),onPointerDown:Nt(t.onPointerDown,m=>{const x=m.target;x.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(x)?x.focus():r(m)}),onPointerMove:Nt(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&a(m)}),onPointerUp:Nt(t.onPointerUp,m=>{const x=m.target;x.hasPointerCapture(m.pointerId)&&(x.releasePointerCapture(m.pointerId),i(m))})})}),y2="SliderTrack",b2=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=gp(y2,n);return s.jsx(Ct.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...r,ref:e})});b2.displayName=y2;var Eg="SliderRange",v2=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=gp(Eg,n),i=x2(Eg,n),o=b.useRef(null),c=qt(e,o),u=a.values.length,h=a.values.map(x=>j2(x,a.min,a.max)),f=u>1?Math.min(...h):0,m=100-Math.max(...h);return s.jsx(Ct.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...r,ref:c,style:{...t.style,[i.startEdge]:f+"%",[i.endEdge]:m+"%"}})});v2.displayName=Eg;var Mg="SliderThumb",N2=b.forwardRef((t,e)=>{const n=ZP(t.__scopeSlider),[r,a]=b.useState(null),i=qt(e,c=>a(c)),o=b.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return s.jsx(r8,{...t,ref:i,index:o})}),r8=b.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:a,...i}=t,o=gp(Mg,n),c=x2(Mg,n),[u,h]=b.useState(null),f=qt(e,E=>h(E)),m=u?o.form||!!u.closest("form"):!0,x=B0(u),y=o.values[r],v=y===void 0?0:j2(y,o.min,o.max),w=o8(r,o.values.length),N=x==null?void 0:x[c.size],k=N?c8(N,v,c.direction):0;return b.useEffect(()=>{if(u)return o.thumbs.add(u),()=>{o.thumbs.delete(u)}},[u,o.thumbs]),s.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${v}% + ${k}px)`},children:[s.jsx(Tg.ItemSlot,{scope:t.__scopeSlider,children:s.jsx(Ct.span,{role:"slider","aria-label":t["aria-label"]||w,"aria-valuemin":o.min,"aria-valuenow":y,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...i,ref:f,style:y===void 0?{display:"none"}:t.style,onFocus:Nt(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),m&&s.jsx(w2,{name:a??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:y},r)]})});N2.displayName=Mg;var a8="RadioBubbleInput",w2=b.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const a=b.useRef(null),i=qt(a,r),o=F0(e);return b.useEffect(()=>{const c=a.current;if(!c)return;const u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(o!==e&&f){const m=new Event("input",{bubbles:!0});f.call(c,e),c.dispatchEvent(m)}},[o,e]),s.jsx(Ct.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});w2.displayName=a8;function i8(t=[],e,n){const r=[...t];return r[n]=e,r.sort((a,i)=>a-i)}function j2(t,e,n){const i=100/(n-e)*(t-e);return ff(i,[0,100])}function o8(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function l8(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 c8(t,e,n){const r=t/2,i=H0([0,50],[0,r]);return(r-i(e)*n)*n}function d8(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function u8(t,e){if(e>0){const n=d8(t);return Math.min(...n)>=e}return!0}function H0(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 h8(t){return(String(t).split(".")[1]||"").length}function f8(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var p8=p2,m8=b2,x8=v2,g8=N2;function y8({className:t,defaultValue:e,value:n,min:r=0,max:a=100,...i}){const o=b.useMemo(()=>Array.isArray(n)?n:Array.isArray(e)?e:[r,a],[n,e,r,a]);return s.jsxs(p8,{defaultValue:e,value:n,min:r,max:a,className:Gt("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",t),...i,children:[s.jsx(m8,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:s.jsx(x8,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:o.length},(c,u)=>s.jsx(g8,{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 b8={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,withdrawFee:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function k2(t){const e=!!(t!=null&&t.embedded),[n,r]=b.useState(b8),[a,i]=b.useState(!0),[o,c]=b.useState(!1);b.useEffect(()=>{De("/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 St("/api/admin/referral-settings",f);if(!m||m.success===!1){X.error("保存失败: "+(m&&typeof m=="object"&&"error"in m?m.error:""));return}X.success(`✅ 分销配置已保存成功! - -• 小程序与网站的推广规则会一起生效 -• 绑定关系会使用新的天数配置 -• 佣金比例会立即应用到新订单 - -如有缓存,请刷新前台/小程序页面。`)}catch(f){console.error(f),X.error("保存失败: "+(f instanceof Error?f.message:String(f)))}finally{c(!1)}},h=f=>m=>{const x=parseFloat(m.target.value||"0");r(y=>({...y,[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(Lc,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置(与系统设置中的「推广功能」开关配合:开关在"," ",s.jsx(Rc,{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(Sn,{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(ct,{children:[s.jsxs(dt,{className:"flex items-center gap-2 text-white",children:[s.jsx(PM,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),s.jsx(Yt,{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(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(vh,{className:"w-3 h-3 text-[#38bdac]"}),"好友优惠(%)"]}),s.jsx(le,{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(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(_n,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(y8,{className:"flex-1",min:10,max:100,step:1,value:[n.distributorShare],onValueChange:([f])=>r(m=>({...m,distributorShare:f}))}),s.jsx(le,{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(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(vh,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者是会员 %)"]}),s.jsx(le,{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(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(vh,{className:"w-3 h-3 text-[#38bdac]"}),"会员订单分润(推广者非会员 %)"]}),s.jsx(le,{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(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(_n,{className:"w-3 h-3 text-[#38bdac]"}),"绑定有效期(天)"]}),s.jsx(le,{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(ct,{children:[s.jsxs(dt,{className:"flex items-center gap-2 text-white",children:[s.jsx(Lc,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),s.jsx(Yt,{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(Z,{className:"text-gray-300",children:"最低提现金额(元)"}),s.jsx(le,{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(Z,{className:"text-gray-300",children:"提现手续费(%)"}),s.jsx(le,{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(Z,{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(Vt,{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(ct,{children:s.jsxs(dt,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[s.jsx(vh,{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 v8(){const[t]=T0(),[e,n]=b.useState("overview"),[r,a]=b.useState("orders"),[i,o]=b.useState([]),[c,u]=b.useState(null),[h,f]=b.useState([]),[m,x]=b.useState([]),[y,v]=b.useState([]),[w,N]=b.useState(!0),[k,E]=b.useState(null),[C,L]=b.useState(""),[O,K]=b.useState("all"),[_,H]=b.useState(1),[P,ee]=b.useState(10),[Q,V]=b.useState(0),[re,ae]=b.useState(new Set),[pe,I]=b.useState(null),[z,R]=b.useState(""),[ie,q]=b.useState(!1),[$,U]=b.useState(null),[ce,ue]=b.useState(""),[oe,F]=b.useState(!1),[G,te]=b.useState(!1),[be,ge]=b.useState(!1),[Ce,We]=b.useState([]),[gt,Lt]=b.useState(1),[yt,Ot]=b.useState(0),[It,Pn]=b.useState("");b.useEffect(()=>{vn()},[]),b.useEffect(()=>{const D=t.get("tab");(D==="overview"||D==="orders"||D==="bindings"||D==="withdrawals"||D==="settings")&&n(D)},[t]),b.useEffect(()=>{H(1)},[e,O]),b.useEffect(()=>{Ht(e)},[e]),b.useEffect(()=>{if(e==="orders"&&r==="giftpay"){Ht("giftPay",!0);return}["orders","bindings","withdrawals"].includes(e)&&Ht(e,!0)},[_,P,O,C,e,r,gt,It]),b.useEffect(()=>{e==="withdrawals"&&At()},[e]);async function vn(){E(null);try{const D=await De("/api/admin/distribution/overview");D!=null&&D.success&&D.overview&&u(D.overview)}catch(D){console.error("[Admin] 概览接口异常:",D),E("加载概览失败")}try{const D=await De("/api/db/users");v((D==null?void 0:D.users)||[])}catch(D){console.error("[Admin] 用户数据加载失败:",D)}}async function Ht(D,Ie=!1){var vt;if(!(!Ie&&re.has(D))){N(!0);try{const Rt=y;switch(D){case"overview":break;case"orders":{try{const bt=new URLSearchParams({page:String(_),pageSize:String(P),...O!=="all"&&{status:O},...C&&{search:C}}),it=await De(`/api/admin/orders?${bt}`);if(it!=null&&it.success&&it.orders){const Dt=it.orders.map(Jt=>{const an=Rt.find(nr=>nr.id===Jt.userId),as=Jt.referrerId?Rt.find(nr=>nr.id===Jt.referrerId):null;return{...Jt,amount:parseFloat(String(Jt.amount))||0,userNickname:(an==null?void 0:an.nickname)||Jt.userNickname||"未知用户",userPhone:(an==null?void 0:an.phone)||Jt.userPhone||"-",referrerNickname:(as==null?void 0:as.nickname)||null,referrerCode:(as==null?void 0:as.referralCode)??null,type:Jt.productType||Jt.type}});o(Dt),V(it.total??Dt.length)}else o([]),V(0)}catch(bt){console.error(bt),E("加载订单失败"),o([])}break}case"bindings":{try{const bt=new URLSearchParams({page:String(_),pageSize:String(P),...O!=="all"&&{status:O}}),it=await De(`/api/db/distribution?${bt}`);f((it==null?void 0:it.bindings)||[]),V((it==null?void 0:it.total)??((vt=it==null?void 0:it.bindings)==null?void 0:vt.length)??0)}catch(bt){console.error(bt),E("加载绑定数据失败"),f([])}break}case"withdrawals":{try{const bt=O==="completed"?"success":O==="rejected"?"failed":O,it=new URLSearchParams({...bt&&bt!=="all"&&{status:bt},page:String(_),pageSize:String(P)}),Dt=await De(`/api/admin/withdrawals?${it}`);if(Dt!=null&&Dt.success&&Dt.withdrawals){const Jt=Dt.withdrawals.map(an=>({...an,account:an.account??"未绑定微信号",status:an.status==="success"?"completed":an.status==="failed"?"rejected":an.status}));x(Jt),V((Dt==null?void 0:Dt.total)??Jt.length)}else Dt!=null&&Dt.success||E(`获取提现记录失败: ${(Dt==null?void 0:Dt.error)||"未知错误"}`),x([])}catch(bt){console.error(bt),E("加载提现数据失败"),x([])}break}case"giftPay":{try{const bt=new URLSearchParams({page:String(gt),pageSize:"20",...It&&{status:It}}),it=await De(`/api/admin/gift-pay-requests?${bt}`);it!=null&&it.success&&it.data?(We(it.data),Ot(it.total??it.data.length)):(We([]),Ot(0))}catch(bt){console.error(bt),E("加载代付请求失败"),We([])}break}}ae(bt=>new Set(bt).add(D))}catch(Rt){console.error(Rt)}finally{N(!1)}}}async function Xt(){E(null),ae(D=>{const Ie=new Set(D);return Ie.delete(e),e==="orders"&&r==="giftpay"&&Ie.delete("giftPay"),Ie}),e==="overview"&&vn(),e==="orders"&&r==="giftpay"?await Ht("giftPay",!0):await Ht(e,!0)}async function Cn(D){if(confirm("确认审核通过并打款?"))try{const Ie=await Zt("/api/admin/withdrawals",{id:D,action:"approve"});if(!(Ie!=null&&Ie.success)){const vt=(Ie==null?void 0:Ie.message)||(Ie==null?void 0:Ie.error)||"操作失败";X.error(vt);return}await Xt()}catch(Ie){console.error(Ie),X.error("操作失败")}}function Fn(D){U(D),ue("")}async function Un(){const D=$;if(!D)return;const Ie=ce.trim();if(!Ie){X.error("请填写拒绝原因");return}F(!0);try{const vt=await Zt("/api/admin/withdrawals",{id:D,action:"reject",errorMessage:Ie});if(!(vt!=null&&vt.success)){X.error((vt==null?void 0:vt.error)||"操作失败");return}X.success("已拒绝该提现申请"),U(null),ue(""),await Xt()}catch(vt){console.error(vt),X.error("操作失败")}finally{F(!1)}}async function At(){try{const D=await De("/api/admin/withdrawals/auto-approve");D!=null&&D.success&&typeof D.enableAutoApprove=="boolean"&&te(D.enableAutoApprove)}catch{}}async function xn(D){ge(!0);try{const Ie=await Zt("/api/admin/withdrawals/auto-approve",{enableAutoApprove:D});Ie!=null&&Ie.success?(te(D),X.success(D?"已开启自动审批,新提现将自动打款":"已关闭自动审批")):X.error("更新失败: "+((Ie==null?void 0:Ie.error)??""))}catch{X.error("更新失败")}finally{ge(!1)}}function Nn(){$&&X.info("已取消操作"),U(null),ue("")}async function ve(){var D;if(!(!(pe!=null&&pe.orderSn)&&!(pe!=null&&pe.id))){q(!0),E(null);try{const Ie=await Zt("/api/admin/orders/refund",{orderSn:pe.orderSn||pe.id,reason:z||void 0});Ie!=null&&Ie.success?(I(null),R(""),await Ht("orders",!0)):E((Ie==null?void 0:Ie.error)||"退款失败")}catch(Ie){const vt=Ie;E(((D=vt==null?void 0:vt.data)==null?void 0:D.error)||"退款失败,请检查网络后重试")}finally{q(!1)}}}function Te(D){const Ie={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:`${Ie[D]||"bg-gray-500/20 text-gray-400"} border-0`,children:vt[D]||D})}const Ve=Math.ceil(Q/P)||1,st=i,Mt=h.filter(D=>{var vt,Rt,bt,it;if(!C)return!0;const Ie=C.toLowerCase();return((vt=D.refereeNickname)==null?void 0:vt.toLowerCase().includes(Ie))||((Rt=D.refereePhone)==null?void 0:Rt.includes(Ie))||((bt=D.referrerName)==null?void 0:bt.toLowerCase().includes(Ie))||((it=D.referrerCode)==null?void 0:it.toLowerCase().includes(Ie))}),jt=m.filter(D=>{var vt;if(!C)return!0;const Ie=C.toLowerCase();return((vt=D.userName)==null?void 0:vt.toLowerCase().includes(Ie))||D.account&&D.account.toLowerCase().includes(Ie)});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:()=>E(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:Xt,disabled:w,variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[s.jsx(Fe,{className:`w-3.5 h-3.5 mr-1.5 ${w?"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:af},{key:"orders",label:"订单与代付",icon:sf},{key:"bindings",label:"绑定管理",icon:Sa},{key:"withdrawals",label:"提现审核",icon:Lc},{key:"settings",label:"推广设置",icon:co}].map(D=>s.jsxs("button",{type:"button",onClick:()=>{n(D.key),K("all"),L(""),D.key!=="orders"&&a("orders")},className:`flex-1 flex items-center justify-center gap-1.5 px-3 py-2 rounded-md text-sm transition-all ${e===D.key?"bg-[#38bdac] text-white shadow-md":"text-gray-400 hover:text-white hover:bg-gray-700/40"}`,children:[s.jsx(D.icon,{className:"w-3.5 h-3.5"}),D.label]},D.key))}),w?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(Fe,{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(xi,{className:"w-4 h-4 text-amber-400"}),"推广转化漏斗"]}),s.jsx(J,{type:"button",size:"sm",variant:"ghost",onClick:()=>void Xt(),disabled:w,className:"text-gray-400 h-7",children:s.jsx(Fe,{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(rf,{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(Sa,{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(xx,{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(sf,{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(gg,{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(Lc,{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(_n,{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(xx,{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"),Ht("giftPay",!0)},children:[s.jsx(yg,{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(Ta,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(le,{value:C,onChange:D=>L(D.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:O,onChange:D=>K(D.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 Xt(),disabled:w,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(Fe,{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:st.map(D=>{var Ie,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:[(Ie=D.id)==null?void 0:Ie.slice(0,12),"..."]}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:D.userNickname}),s.jsx("p",{className:"text-gray-500 text-xs",children:D.userPhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:(()=>{const Rt=D.productType||D.type,bt=D.description||"",it=String(D.productId||D.sectionId||""),Dt=Rt==="vip"||bt.includes("VIP")||bt.toLowerCase().includes("vip")||it.toLowerCase().includes("vip");return Rt==="balance_recharge"?`余额充值 ¥${typeof D.amount=="number"?D.amount.toFixed(2):parseFloat(String(D.amount||"0")).toFixed(2)}`:Dt?"超级个体开通费用":Rt==="fullbook"?`${D.bookName||"《底层逻辑》"} - 全本`:Rt==="match"?"匹配次数购买":`${D.bookName||"《底层逻辑》"} - ${D.sectionTitle||D.chapterTitle||`章节${D.productId||D.sectionId||""}`}`})()}),s.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const Rt=D.productType||D.type,bt=D.description||"",it=String(D.productId||D.sectionId||""),Dt=Rt==="vip"||bt.includes("VIP")||bt.toLowerCase().includes("vip")||it.toLowerCase().includes("vip");return Rt==="balance_recharge"?"余额充值":Dt?"超级个体":Rt==="fullbook"?"全书解锁":Rt==="match"?"功能权益":D.chapterTitle||"单章购买"})()})]})}),s.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof D.amount=="number"?D.amount.toFixed(2):parseFloat(String(D.amount||"0")).toFixed(2)]}),s.jsx("td",{className:"p-4 text-gray-300",children:D.paymentMethod==="wechat"?"微信支付":D.paymentMethod==="balance"?"余额支付":D.paymentMethod==="alipay"?"支付宝":D.paymentMethod||"微信支付"}),s.jsx("td",{className:"p-4",children:D.status==="refunded"?s.jsx(Be,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):D.status==="completed"||D.status==="paid"?s.jsx(Be,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):D.status==="pending"||D.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:D.refundReason,children:D.status==="refunded"&&D.refundReason?D.refundReason:"-"}),s.jsx("td",{className:"p-4 text-gray-300 text-sm",children:D.referrerId||D.referralCode?s.jsxs("span",{title:D.referralCode||D.referrerCode||D.referrerId||"",children:[D.referrerNickname||D.referralCode||D.referrerCode||((vt=D.referrerId)==null?void 0:vt.slice(0,8)),(D.referralCode||D.referrerCode)&&` (${D.referralCode||D.referrerCode})`]}):"-"}),s.jsx("td",{className:"p-4 text-[#FFD700]",children:D.referrerEarnings?`¥${(typeof D.referrerEarnings=="number"?D.referrerEarnings:parseFloat(String(D.referrerEarnings))).toFixed(2)}`:"-"}),s.jsx("td",{className:"p-4 text-gray-400 text-sm",children:D.createdAt?new Date(D.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:(D.status==="paid"||D.status==="completed")&&s.jsxs(J,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{I(D),R("")},children:[s.jsx(Bj,{className:"w-3 h-3 mr-1"}),"退款"]})})]},D.id)})})]})}),e==="orders"&&s.jsx(Zs,{page:_,totalPages:Ve,total:Q,pageSize:P,onPageChange:H,onPageSizeChange:D=>{ee(D),H(1)}})]})})]}),r==="giftpay"&&s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(ct,{children:s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[s.jsx(dt,{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:It,onChange:D=>{Pn(D.target.value),Lt(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 Ht("giftPay",!0),disabled:w,className:"border-gray-600 text-gray-300",children:[s.jsx(Fe,{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:Ce.map(D=>s.jsxs("tr",{className:"hover:bg-[#0a1628]",children:[s.jsx("td",{className:"p-3 font-mono text-xs text-gray-400",children:D.requestSn}),s.jsx("td",{className:"p-3 text-white text-sm",children:D.initiatorNick||D.initiatorUserId}),s.jsxs("td",{className:"p-3",children:[s.jsxs("p",{className:"text-white",children:[D.productType," · ¥",D.amount.toFixed(2)]}),D.description&&s.jsx("p",{className:"text-gray-500 text-xs",children:D.description})]}),s.jsx("td",{className:"p-3 text-gray-400",children:(D.quantity??1)>1?`${D.quantity}份 / 已领${D.redeemedCount??0}`:"-"}),s.jsx("td",{className:"p-3 text-gray-400",children:D.payerNick||(D.payerUserId?D.payerUserId:"-")}),s.jsx("td",{className:"p-3",children:s.jsx(Be,{className:D.status==="paid"?"bg-green-500/20 text-green-400 border-0":D.status==="pending"||D.status==="pending_pay"?"bg-amber-500/20 text-amber-400 border-0":D.status==="refunded"?"bg-red-500/20 text-red-400 border-0":"bg-gray-500/20 text-gray-400 border-0",children:D.status==="paid"?"已支付":D.status==="pending"||D.status==="pending_pay"?"待支付":D.status==="refunded"?"已退款":D.status==="cancelled"?"已取消":"已过期"})}),s.jsx("td",{className:"p-3 text-gray-400 text-xs",children:D.createdAt?new Date(D.createdAt).toLocaleString("zh-CN"):"-"})]},D.id))})]})}),Ce.length===0&&!w&&s.jsx("p",{className:"text-center py-8 text-gray-500",children:"暂无代付请求"}),yt>20&&s.jsx("div",{className:"mt-4 flex justify-center",children:s.jsx(Zs,{page:gt,totalPages:Math.ceil(yt/20),total:yt,pageSize:20,onPageChange:Lt,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(Ta,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(le,{value:C,onChange:D=>L(D.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:O,onChange:D=>K(D.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 Xt(),disabled:w,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(Fe,{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:[Mt.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:Mt.map(D=>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:D.refereeNickname||"匿名用户"}),s.jsx("p",{className:"text-gray-500 text-xs",children:D.refereePhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white",children:D.referrerName||"-"}),s.jsx("p",{className:"text-gray-500 text-xs font-mono",children:D.referrerCode})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:D.boundAt?new Date(D.boundAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:D.expiresAt?new Date(D.expiresAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:Te(D.status)}),s.jsx("td",{className:"p-4",children:D.commission?s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",D.commission.toFixed(2)]}):s.jsx("span",{className:"text-gray-500",children:"-"})})]},D.id))})]})}),e==="bindings"&&s.jsx(Zs,{page:_,totalPages:Ve,total:Q,pageSize:P,onPageChange:H,onPageSizeChange:D=>{ee(D),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(Ta,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(le,{value:C,onChange:D=>L(D.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:O,onChange:D=>K(D.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(xi,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-sm text-gray-300",children:"自动审批"}),s.jsx(Vt,{checked:G,onCheckedChange:xn,disabled:be,className:"data-[state=checked]:bg-[#38bdac]"})]}),s.jsxs(J,{type:"button",variant:"outline",onClick:()=>void Xt(),disabled:w,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(Fe,{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:[jt.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:jt.map(D=>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:[D.userAvatar?s.jsx("img",{src:D.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:(D.userName||D.name||"?").slice(0,1)}),s.jsx("p",{className:"text-white font-medium",children:D.userName||D.name})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",D.amount.toFixed(2)]})}),s.jsx("td",{className:"p-4",children:s.jsx(Be,{className:D.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:D.method==="wechat"?"微信":"支付宝"})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-mono text-xs",children:D.account}),s.jsx("p",{className:"text-gray-500 text-xs",children:D.name})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:D.createdAt?new Date(D.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:Te(D.status)}),s.jsx("td",{className:"p-4 max-w-[160px]",children:s.jsx("span",{className:`text-xs ${D.status==="rejected"||D.status==="failed"?"text-red-400":"text-gray-400"}`,title:D.remark,children:D.remark||"-"})}),s.jsx("td",{className:"p-4 text-right",children:D.status==="pending"&&s.jsxs("div",{className:"flex gap-2 justify-end",children:[s.jsxs(J,{size:"sm",onClick:()=>Cn(D.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(xx,{className:"w-4 h-4 mr-1"}),"通过"]}),s.jsxs(J,{size:"sm",variant:"outline",onClick:()=>Fn(D.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[s.jsx(Oj,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},D.id))})]})}),e==="withdrawals"&&s.jsx(Zs,{page:_,totalPages:Ve,total:Q,pageSize:P,onPageChange:H,onPageSizeChange:D=>{ee(D),H(1)}})]})})]})]}),s.jsx($t,{open:!!pe,onOpenChange:D=>!D&&I(null),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Ft,{children:s.jsx(Bt,{className:"text-white",children:"订单退款"})}),pe&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",pe.orderSn||pe.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof pe.amount=="number"?pe.amount.toFixed(2):parseFloat(String(pe.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(le,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:z,onChange:D=>R(D.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(yn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>I(null),disabled:ie,children:"取消"}),s.jsx(J,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:ve,disabled:ie,children:ie?"退款中...":"确认退款"})]})]})}),s.jsx($t,{open:!!$,onOpenChange:D=>!D&&Nn(),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Ft,{children:s.jsx(Bt,{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(le,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:ce,onChange:D=>ue(D.target.value)})})]})]}),s.jsxs(yn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:Nn,disabled:oe,children:"取消"}),s.jsx(J,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:Un,disabled:oe||!ce.trim(),children:oe?"提交中...":"确认拒绝"})]})]})}),e==="settings"&&s.jsx("div",{className:"-mx-8 -mt-6",children:s.jsx(k2,{embedded:!0})})]})}function N8(){const[t,e]=b.useState([]),[n,r]=b.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[a,i]=b.useState(!0),[o,c]=b.useState(null),[u,h]=b.useState("all"),[f,m]=b.useState(1),[x,y]=b.useState(10),[v,w]=b.useState(0),[N,k]=b.useState(null),[E,C]=b.useState(null),[L,O]=b.useState(""),[K,_]=b.useState(!1);async function H(){var I,z,R,ie,q,$,U;i(!0),c(null);try{const ce=new URLSearchParams({status:u,page:String(f),pageSize:String(x)}),ue=await De(`/api/admin/withdrawals?${ce}`);if(ue!=null&&ue.success){const oe=ue.withdrawals||[];e(oe),w(ue.total??((I=ue.stats)==null?void 0:I.total)??oe.length),r({total:((z=ue.stats)==null?void 0:z.total)??ue.total??oe.length,pendingCount:((R=ue.stats)==null?void 0:R.pendingCount)??0,pendingAmount:((ie=ue.stats)==null?void 0:ie.pendingAmount)??0,successCount:((q=ue.stats)==null?void 0:q.successCount)??0,successAmount:(($=ue.stats)==null?void 0:$.successAmount)??0,failedCount:((U=ue.stats)==null?void 0:U.failedCount)??0})}else c("加载提现记录失败")}catch(ce){console.error("Load withdrawals error:",ce),c("加载失败,请检查网络后重试")}finally{i(!1)}}b.useEffect(()=>{m(1)},[u]),b.useEffect(()=>{H()},[u,f,x]);const P=Math.ceil(v/x)||1;async function ee(I){const z=t.find(R=>R.id===I);if(z!=null&&z.userCommissionInfo&&z.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${z.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。 - -确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;k(I);try{const R=await Zt("/api/admin/withdrawals",{id:I,action:"approve"});R!=null&&R.success?H():X.error("操作失败: "+((R==null?void 0:R.error)??""))}catch{X.error("操作失败")}finally{k(null)}}async function Q(I){if(confirm("确认撤回该笔打款?仅在用户未确认收款前可撤回。")){k(I);try{const z=await St("/api/admin/withdrawals/cancel",{id:I});z!=null&&z.success?(X.success("已撤回打款"),H()):X.error("撤回失败: "+((z==null?void 0:z.error)??"未知错误"))}catch{X.error("撤回失败")}finally{k(null)}}}function V(I){C(I),O("")}async function re(){const I=E;if(!I)return;const z=L.trim();if(!z){X.error("请填写拒绝原因");return}_(!0);try{const R=await Zt("/api/admin/withdrawals",{id:I,action:"reject",errorMessage:z});R!=null&&R.success?(X.success("已拒绝该提现申请"),C(null),O(""),H()):X.error("操作失败: "+((R==null?void 0:R.error)??""))}catch{X.error("操作失败")}finally{_(!1)}}function ae(){E&&X.info("已取消操作"),C(null),O("")}function pe(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(J,{variant:"outline",onClick:H,disabled:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Fe,{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(sf,{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(Fe,{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(Lc,{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:vo(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:pe(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:()=>ee(I.id),disabled:N===I.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[s.jsx(dp,{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(ts,{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:()=>Q(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(Zs,{page:f,totalPages:P,total:v,pageSize:x,onPageChange:m,onPageSizeChange:I=>{y(I),m(1)}})]})})}),s.jsx($t,{open:!!E,onOpenChange:I=>!I&&ae(),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Ft,{children:s.jsx(Bt,{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(le,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:L,onChange:I=>O(I.target.value)})})]})]}),s.jsxs(yn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:ae,disabled:K,children:"取消"}),s.jsx(J,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:re,disabled:K||!L.trim(),children:K?"提交中...":"确认拒绝"})]})]})})]})}var Mx={exports:{}},Ax={};/** - * @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 G1;function w8(){if(G1)return Ax;G1=1;var t=mu();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 y=x(),v=r({inst:{value:y,getSnapshot:x}}),w=v[0].inst,N=v[1];return i(function(){w.value=y,w.getSnapshot=x,u(w)&&N({inst:w})},[m,y,x]),a(function(){return u(w)&&N({inst:w}),m(function(){u(w)&&N({inst:w})})},[m]),o(y),y}function u(m){var x=m.getSnapshot;m=m.value;try{var y=x();return!n(m,y)}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 Ax.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,Ax}var J1;function S2(){return J1||(J1=1,Mx.exports=w8()),Mx.exports}var C2=S2();function ds(t){this.content=t}ds.prototype={constructor:ds,find:function(t){for(var e=0;e>1}};ds.from=function(t){if(t instanceof ds)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new ds(e)};function T2(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=T2(a.content,i.content,n+1);if(o!=null)return o}n+=a.nodeSize}}function E2(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 ke(r,a)}cutByIndex(e,n){return e==n?ke.empty:e==0&&n==this.content.length?this:new ke(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 ke(a,i)}addToStart(e){return new ke([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ke(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?Mh(n+1,i):Mh(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 ke.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new ke(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ke.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}};rn.none=[];class mf extends Error{}class $e{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=A2(this.content,e+this.openStart,n);return r&&new $e(r,this.openStart,this.openEnd)}removeBetween(e,n){return new $e(M2(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 $e.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 $e(ke.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 $e(e,r,a)}}$e.empty=new $e(ke.empty,0,0);function M2(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(M2(i.content,e-a-1,n-a-1)))}function A2(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=A2(o.content,e-i-1,n,o);return c&&t.replaceChild(a,o.copy(c))}function j8(t,e,n){if(n.openStart>t.depth)throw new mf("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new mf("Inconsistent open depths");return I2(t,e,n,0)}function I2(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 Vd(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&&(fl(t.nodeAfter,r),i++));for(let c=i;ca&&Ig(t,e,a+1),o=r.depth>a&&Ig(n,r,a+1),c=[];return Vd(null,t,a,c),i&&o&&e.index(a)==n.index(a)?(R2(i,o),fl(pl(i,P2(t,e,n,r,a+1)),c)):(i&&fl(pl(i,xf(t,e,a+1)),c),Vd(e,n,a,c),o&&fl(pl(o,xf(n,r,a+1)),c)),Vd(r,null,a,c),new ke(c)}function xf(t,e,n){let r=[];if(Vd(null,t,n,r),t.depth>n){let a=Ig(t,e,n+1);fl(pl(a,xf(t,e,n+1)),r)}return Vd(e,null,n,r),new ke(r)}function k8(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(ke.from(a));return{start:a.resolveNoCache(t.openStart+n),end:a.resolveNoCache(a.content.size-t.openEnd-n)}}class nu{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 gf(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 nu(n,r,i)}static resolveCached(e,n){let r=Q1.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()+")"),L2(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=ke.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=ke.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,a,r);return i.type.checkAttrs(i.attrs),i}};hi.prototype.text=void 0;class yf extends hi{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):L2(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 yf(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new yf(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 L2(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class jl{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new E8(e,n);if(r.next==null)return jl.empty;let a=O2(r);r.next&&r.err("Unexpected trailing text");let i=O8(L8(a));return D8(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(` -`)}}jl.empty=new jl(!0);class E8{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 O2(t){let e=[];do e.push(M8(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function M8(t){let e=[];do e.push(A8(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function A8(t){let e=P8(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=I8(t,e);else break;return e}function Y1(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function I8(t,e){let n=Y1(t),r=n;return t.eat(",")&&(t.next!="}"?r=Y1(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function R8(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 P8(t){if(t.eat("(")){let e=O2(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=R8(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 L8(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 jl(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:z2(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new hi(this,this.computeAttrs(e),ke.from(n),rn.setFrom(r))}createChecked(e=null,n,r){return n=ke.from(n),this.checkContent(n),new hi(this,this.computeAttrs(e),n,rn.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=ke.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(ke.empty,!0);return i?new hi(this,e,n.append(i),rn.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 B2(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 z8{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 yp{constructor(e,n,r,a){this.name=e,this.rank=n,this.schema=r,this.spec=a,this.attrs=F2(e,a.attrs),this.excluded=null;let i=_2(this.attrs);this.instance=i?new rn(this,i):null}create(e=null){return!e&&this.instance?this.instance:new rn(this,z2(this.attrs,e))}static compile(e,n){let r=Object.create(null),a=0;return e.forEach((i,o)=>r[i]=new yp(i,a++,n,o)),r}removeFromSet(e){for(var n=0;n-1}}class V2{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=ds.from(e.nodes),n.marks=ds.from(e.marks||{}),this.nodes=Z1.compile(this.spec.nodes,this),this.marks=yp.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]=jl.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?eN(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==""?[]:eN(this,o.split(" "))}this.nodeFromJSON=a=>hi.fromJSON(this,a),this.markFromJSON=a=>rn.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 Z1){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 yf(r,r.defaultAttrs,e,rn.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 eN(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 $8(t){return t.tag!=null}function F8(t){return t.style!=null}class xo{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(a=>{if($8(a))this.tags.push(a);else if(F8(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 nN(this,n,!1);return r.addAll(e,rn.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new nN(this,n,!0);return r.addAll(e,rn.none,n.from,n.to),$e.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=sN(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=sN(o)),o.node||o.ignore||o.mark||(o.node=a)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new xo(e,xo.schemaRules(e)))}}const H2={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},B8={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},U2={ol:!0,ul:!0},su=1,Pg=2,Hd=4;function tN(t,e,n){return e!=null?(e?su:0)|(e==="full"?Pg:0):t&&t.whitespace=="pre"?su|Pg:n&~Hd}class Ah{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=rn.none,this.match=i||(o&Hd?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ke.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&su)){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=ke.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(ke.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&&!H2.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class nN{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=tN(null,n.preserveWhitespace,0)|(r?Hd:0);a?i=new Ah(a.type,a.attrs,rn.none,!0,n.topMatch||a.type.contentMatch,o):r?i=new Ah(null,null,rn.none,!0,null,o):i=new Ah(e.schema.topNodeType,null,rn.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&Pg?"full":this.localPreserveWS||(a.options&su)>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):rN(h.type,e))?(u=h.addToSet(u),!1):!0),this.nodes.push(new Ah(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|=su)}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 V8(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&U2.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function H8(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function sN(t){let e={};for(let n in t)e[n]=t[n];return e}function rN(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&&Gh(Rx(r),a(e,n),null,e.attrs)}static renderSpec(e,n,r=null,a){return Gh(e,n,r,a)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Pl(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=aN(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return aN(e.marks)}}function aN(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Rx(t){return t.document||window.document}const iN=new WeakMap;function U8(t){let e=iN.get(t);return e===void 0&&iN.set(t,e=W8(t)),e}function W8(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:y,contentDOM:v}=Gh(t,x,n,r);if(u.appendChild(y),v){if(c)throw new RangeError("Multiple content holes");c=v}}}return{dom:u,contentDOM:c}}const W2=65535,K2=Math.pow(2,16);function K8(t,e){return t+e*K2}function oN(t){return t&W2}function q8(t){return(t-(t&W2))/K2}const q2=1,G2=2,Jh=4,J2=8;class Lg{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&J2)>0}get deletedBefore(){return(this.delInfo&(q2|Jh))>0}get deletedAfter(){return(this.delInfo&(G2|Jh))>0}get deletedAcross(){return(this.delInfo&Jh)>0}}class hr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&hr.empty)return hr.empty}recover(e){let n=0,r=oN(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,y=u+a+(x<0?0:f);if(r)return y;let v=e==(n<0?u:m)?null:K8(c/3,e-u),w=e==u?G2:e==m?q2:Jh;return(n<0?e!=u:e!=m)&&(w|=J2),new Lg(y,w,v)}a+=f-h}return r?e+a:new Lg(e+a,0,null)}touches(e,n){let r=0,a=oN(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 ru;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;ri&&u!o.isAtom||!c.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),a),n.openStart,n.openEnd);return Vn.fromReplace(e,this.from,this.to,i)}invert(){return new ra(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 uo(n.pos,r.pos,this.mark)}merge(e){return e instanceof uo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new uo(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 uo(n.from,n.to,e.markFromJSON(n.mark))}}Es.jsonID("addMark",uo);class ra extends Es{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 $e(U0(n.content,a=>a.mark(this.mark.removeFromSet(a.marks)),e),n.openStart,n.openEnd);return Vn.fromReplace(e,this.from,this.to,r)}invert(){return new uo(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 ra(n.pos,r.pos,this.mark)}merge(e){return e instanceof ra&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ra(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 ra(n.from,n.to,e.markFromJSON(n.mark))}}Es.jsonID("removeMark",ra);class ho extends Es{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Vn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Vn.fromReplace(e,this.pos,this.pos+1,new $e(ke.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 ss(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 ss(n.from,n.to,n.gapFrom,n.gapTo,$e.fromJSON(e,n.slice),n.insert,!!n.structure)}}Es.jsonID("replaceAround",ss);function Og(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 G8(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),y=Math.min(h+u.nodeSize,n),v=r.addToSet(m);for(let w=0;wt.step(u)),i.forEach(u=>t.step(u))}function J8(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 yp){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 ra(o.from,o.to,o.style)))}function W0(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 Q8(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Qc(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=ke.from(r.node(v).copy(f)),m++):u--;let x=ke.empty,y=0;for(let v=i,w=!1;v>n;v--)w||a.after(v+1)=0;o--){if(r.size){let c=n[o].type.contentMatch.matchFragment(r);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=ke.from(n[o].type.create(n[o].attrs,r))}let a=e.start,i=e.end;t.step(new ss(a,i,a,i,new $e(r,0,0),n.length,!0))}function tL(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)&&nL(t.doc,t.mapping.slice(i).map(c),r)){let h=null;if(r.schema.linebreakReplacement){let y=r.whitespace=="pre",v=!!r.contentMatch.matchType(r.schema.linebreakReplacement);y&&!v?h=!1:!y&&v&&(h=!0)}h===!1&&Y2(t,o,c,i),W0(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 ss(m,x,m+1,x-1,new $e(ke.from(r.create(u,null,o.marks)),0,0),1,!0)),h===!0&&Q2(t,o,c,i),!1}})}function Q2(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 Y2(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 nL(t,e,n){let r=t.resolve(e),a=r.index();return r.parent.canReplaceWith(a,a+1,n)}function sL(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 ss(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new $e(ke.from(o),0,0),1,!0))}function fi(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 y=m.content.cutByIndex(x,m.childCount),v=r&&r[f+1];v&&(y=y.replaceChild(0,v.type.create(v.attrs)));let w=r&&r[f]||m;if(!m.canReplace(x+1,m.childCount)||!w.type.validContent(y))return!1}let c=a.indexAfter(i),u=r&&r[0];return a.node(i).canReplaceWith(c,c,u?u.type:a.node(i+1).type)}function rL(t,e,n=1,r){let a=t.doc.resolve(e),i=ke.empty,o=ke.empty;for(let c=a.depth,u=a.depth-n,h=n-1;c>u;c--,h--){i=ke.from(a.node(c).copy(i));let f=r&&r[h];o=ke.from(f?f.type.create(f.attrs,o):a.node(c).copy(o))}t.step(new ns(e,e,new $e(i.append(o),n,n),!0))}function Mo(t,e){let n=t.resolve(e),r=n.index();return X2(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function aL(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&&X2(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 iL(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);Y2(t,f.node(),f.before(),c)}o.inlineContent&&W0(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 ns(h,u.map(e+n,-1),$e.empty,!0)),r===!0){let f=t.doc.resolve(h);Q2(t,f.node(),f.before(),t.steps.length)}return t}function oL(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 vp(t,e,n=e,r=$e.empty){if(e==n&&!r.size)return null;let a=t.resolve(e),i=t.resolve(n);return eS(a,i,r)?new ns(e,n,r):new lL(a,i,r).fit()}function eS(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class lL{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=ke.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=ke.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 $e(i,o,c);return e>-1?new ss(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new ns(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=Lx(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(ke.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=Lx(e,n);return!a.childCount||a.firstChild.isLeaf?!1:(this.unplaced=new $e(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=Lx(e,n);if(a.childCount<=1&&n>0){let i=e.size-n<=n+a.size;this.unplaced=new $e(Pd(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new $e(Pd(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(tS(w.mark(x.allowedMarks(w.marks)),h==1?u:0,h==c.childCount?y:-1)))}let v=h==c.childCount;v||(y=-1),this.placed=Ld(this.placed,n,ke.from(f)),this.frontier[n].match=m,v&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let w=0,N=c;w1&&a==this.$to.end(--r);)++a;return a}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:a}=this.frontier[n],i=n=0;c--){let{match:u,type:h}=this.frontier[c],f=Ox(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=Ld(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=Ld(this.placed,this.depth,ke.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(ke.empty,!0);n.childCount&&(this.placed=Ld(this.placed,this.frontier.length,n))}}function Pd(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Pd(t.firstChild.content,e-1,n)))}function Ld(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Ld(t.lastChild.content,e-1,n)))}function Lx(t,e){for(let n=0;n1&&(r=r.replaceChild(0,tS(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(ke.empty,!0)))),t.copy(r)}function Ox(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&&!cL(n,i.content,o)?c:null}function cL(t,e,n){for(let r=n;r0;x--,y--){let v=a.node(x).type.spec;if(v.defining||v.definingAsContext||v.isolating)break;o.indexOf(x)>-1?c=x:a.before(x)==y&&o.splice(1,0,-x)}let u=o.indexOf(c),h=[],f=r.openStart;for(let x=r.content,y=0;;y++){let v=x.firstChild;if(h.push(v),y==r.openStart)break;x=v.content}for(let x=f-1;x>=0;x--){let y=h[x],v=dL(y.type);if(v&&!y.sameMarkup(a.node(Math.abs(c)-1)))f=x;else if(v||!y.type.isTextblock)break}for(let x=r.openStart;x>=0;x--){let y=(x+f+1)%(r.openStart+1),v=h[y];if(v)for(let w=0;w=0&&(t.replace(e,n,r),!(t.steps.length>m));x--){let y=o[x];y<0||(e=a.before(y),n=i.after(y))}}function nS(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(ke.empty,!0))}return t}function hL(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let a=oL(t.doc,e,r.type);a!=null&&(e=n=a)}t.replaceRange(e,n,new $e(ke.from(r),0,0))}function fL(t,e,n){let r=t.doc.resolve(e),a=t.doc.resolve(n),i=sS(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 sS(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 Mc extends Es{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Vn.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let a=n.type.create(r,null,n.marks);return Vn.fromReplace(e,this.pos,this.pos+1,new $e(ke.from(a),0,n.isLeaf?0:1))}getMap(){return hr.empty}invert(e){return new Mc(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 Mc(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 Mc(n.pos,n.attr,n.value)}}Es.jsonID("attr",Mc);class au extends Es{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let a in e.attrs)n[a]=e.attrs[a];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Vn.ok(r)}getMap(){return hr.empty}invert(e){return new au(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 au(n.attr,n.value)}}Es.jsonID("docAttr",au);let _c=class extends Error{};_c=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};_c.prototype=Object.create(Error.prototype);_c.prototype.constructor=_c;_c.prototype.name="TransformError";class q0{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ru}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new _c(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=$e.empty){let a=vp(this.doc,e,n,r);return a&&this.step(a),this}replaceWith(e,n,r){return this.replace(e,n,new $e(ke.from(r),0,0))}delete(e,n){return this.replace(e,n,$e.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return uL(this,e,n,r),this}replaceRangeWith(e,n,r){return hL(this,e,n,r),this}deleteRange(e,n){return fL(this,e,n),this}lift(e,n){return Y8(this,e,n),this}join(e,n=1){return iL(this,e,n),this}wrap(e,n){return eL(this,e,n),this}setBlockType(e,n=e,r,a=null){return tL(this,e,n,r,a),this}setNodeMarkup(e,n,r=null,a){return sL(this,e,n,r,a),this}setNodeAttribute(e,n,r){return this.step(new Mc(e,n,r)),this}setDocAttribute(e,n){return this.step(new au(e,n)),this}addNodeMark(e,n){return this.step(new ho(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 rn)n.isInSet(r.marks)&&this.step(new kl(e,n));else{let a=r.marks,i,o=[];for(;i=n.isInSet(a);)o.push(new kl(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 rL(this,e,n,r),this}addMark(e,n,r){return G8(this,e,n,r),this}removeMark(e,n,r){return J8(this,e,n,r),this}clearIncompatible(e,n,r){return W0(this,e,n,r),this}}const Dx=Object.create(null);class ut{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new rS(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?yc(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):yc(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 pr(e.node(0))}static atStart(e){return yc(e,e,0,0,1)||new pr(e)}static atEnd(e){return yc(e,e,e.content.size,e.childCount,-1)||new pr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Dx[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 Dx)throw new RangeError("Duplicate use of selection JSON ID "+e);return Dx[e]=n,n.prototype.jsonID=e,n}getBookmark(){return at.between(this.$anchor,this.$head).getBookmark()}}ut.prototype.visible=!0;class rS{constructor(e,n){this.$from=e,this.$to=n}}let cN=!1;function dN(t){!cN&&!t.parent.inlineContent&&(cN=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class at extends ut{constructor(e,n=e){dN(e),dN(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 ut.near(r);let a=e.resolve(n.map(this.anchor));return new at(a.parent.inlineContent?a:r,r)}replace(e,n=$e.empty){if(super.replace(e,n),n==$e.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof at&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Np(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 at(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=ut.findFrom(n,r,!0)||ut.findFrom(n,-r,!0);if(i)n=i.$head;else return ut.near(n,r)}return e.parent.inlineContent||(a==0?e=n:(e=(ut.findFrom(e,-r,!0)||ut.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&&rt.isSelectable(c))return rt.create(t,n-(a<0?c.nodeSize:0))}else{let u=yc(t,c,n+a,a<0?c.childCount:0,a,i);if(u)return u}n+=c.nodeSize*a}return null}function uN(t,e,n){let r=t.steps.length-1;if(r{o==null&&(o=f)}),t.setSelection(ut.near(t.doc.resolve(o),n))}const hN=1,Ih=2,fN=4;class mL extends q0{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|=Ih,this}ensureMarks(e){return rn.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&Ih)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Ih,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)||rn.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(ut.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|=fN,this}get scrolledIntoView(){return(this.updated&fN)>0}}function pN(t,e){return!e||!t?t:t.bind(e)}class Od{constructor(e,n,r){this.name=e,this.init=pN(n.init,r),this.apply=pN(n.apply,r)}}const xL=[new Od("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Od("selection",{init(t,e){return t.selection||ut.atStart(e.doc)},apply(t){return t.selection}}),new Od("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Od("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class _x{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=xL.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 Od(r.key,r.spec.state,r))})}}class Cc{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 _x(e.schema,e.plugins),i=new Cc(a);return a.fields.forEach(o=>{if(o.name=="doc")i.doc=hi.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=ut.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 aS(t,e,n){for(let r in t){let a=t[r];a instanceof Function?a=a.bind(e):r=="handleDOMEvents"&&(a=aS(a,e,{})),n[r]=a}return n}class un{constructor(e){this.spec=e,this.props={},e.props&&aS(e.props,this,this.props),this.key=e.key?e.key.key:iS("plugin")}getState(e){return e[this.key]}}const zx=Object.create(null);function iS(t){return t in zx?t+"$"+ ++zx[t]:(zx[t]=0,t+"$")}class bn{constructor(e="key"){this.key=iS(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const J0=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function oS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const lS=(t,e,n)=>{let r=oS(t,n);if(!r)return!1;let a=Q0(r);if(!a){let o=r.blockRange(),c=o&&Qc(o);return c==null?!1:(e&&e(t.tr.lift(o,c).scrollIntoView()),!0)}let i=a.nodeBefore;if(gS(t,a,e,-1))return!0;if(r.parent.content.size==0&&(zc(i,"end")||rt.isSelectable(i)))for(let o=r.depth;;o--){let c=vp(t.doc,r.before(o),r.after(o),$e.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},gL=(t,e,n)=>{let r=oS(t,n);if(!r)return!1;let a=Q0(r);return a?cS(t,a,e):!1},yL=(t,e,n)=>{let r=uS(t,n);if(!r)return!1;let a=Y0(r);return a?cS(t,a,e):!1};function cS(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=vp(t.doc,i,u,$e.empty);if(!h||h.from!=i||h instanceof ns&&h.slice.size>=u-i)return!1;if(n){let f=t.tr.step(h);f.setSelection(at.create(f.doc,i)),n(f.scrollIntoView())}return!0}function zc(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 dS=(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=Q0(r)}let o=i&&i.nodeBefore;return!o||!rt.isSelectable(o)?!1:(e&&e(t.tr.setSelection(rt.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function Q0(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 uS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=uS(t,n);if(!r)return!1;let a=Y0(r);if(!a)return!1;let i=a.nodeAfter;if(gS(t,a,e,1))return!0;if(r.parent.content.size==0&&(zc(i,"start")||rt.isSelectable(i))){let o=vp(t.doc,r.before(),r.after(),$e.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 rt,a;if(r){if(n.node.isTextblock||!Mo(t.doc,n.from))return!1;a=n.from}else if(a=bp(t.doc,n.from,-1),a==null)return!1;if(e){let i=t.tr.join(a);r&&i.setSelection(rt.create(i.doc,a-t.doc.resolve(a).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},vL=(t,e)=>{let n=t.selection,r;if(n instanceof rt){if(n.node.isTextblock||!Mo(t.doc,n.to))return!1;r=n.to}else if(r=bp(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},NL=(t,e)=>{let{$from:n,$to:r}=t.selection,a=n.blockRange(r),i=a&&Qc(a);return i==null?!1:(e&&e(t.tr.lift(a,i).scrollIntoView()),!0)},pS=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(` -`).scrollIntoView()),!0)};function X0(t){for(let e=0;e{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let a=n.node(-1),i=n.indexAfter(-1),o=X0(a.contentMatchAt(i));if(!o||!a.canReplaceWith(i,i,o))return!1;if(e){let c=n.after(),u=t.tr.replaceWith(c,c,o.createAndFill());u.setSelection(ut.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},mS=(t,e)=>{let n=t.selection,{$from:r,$to:a}=n;if(n instanceof pr||r.parent.inlineContent||a.parent.inlineContent)return!1;let i=X0(a.parent.contentMatchAt(a.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&a.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(fi(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),a=r&&Qc(r);return a==null?!1:(e&&e(t.tr.lift(r,a).scrollIntoView()),!0)};function jL(t){return(e,n)=>{let{$from:r,$to:a}=e.selection;if(e.selection instanceof rt&&e.selection.node.isBlock)return!r.parentOffset||!fi(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],o,c,u=!1,h=!1;for(let y=r.depth;;y--)if(r.node(y).isBlock){u=r.end(y)==r.pos+(r.depth-y),h=r.start(y)==r.pos-(r.depth-y),c=X0(r.node(y-1).contentMatchAt(r.indexAfter(y-1))),i.unshift(u&&c?{type:c}:null),o=y;break}else{if(y==1)return!1;i.unshift(null)}let f=e.tr;(e.selection instanceof at||e.selection instanceof pr)&&f.deleteSelection();let m=f.mapping.map(r.pos),x=fi(f.doc,m,i.length,i);if(x||(i[0]=c?{type:c}:null,x=fi(f.doc,m,i.length,i)),!x)return!1;if(f.split(m,i.length,i),!u&&h&&r.node(o).type!=c){let y=f.mapping.map(r.before(o)),v=f.doc.resolve(y);c&&r.node(o-1).canReplaceWith(v.index(),v.index()+1,c)&&f.setNodeMarkup(f.mapping.map(r.before(o)),c)}return n&&n(f.scrollIntoView()),!0}}const kL=jL(),SL=(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(rt.create(t.doc,a))),!0)};function CL(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||Mo(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function gS(t,e,n,r){let a=e.nodeBefore,i=e.nodeAfter,o,c,u=a.type.spec.isolating||i.type.spec.isolating;if(!u&&CL(t,e,n))return!0;let h=!u&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(o=(c=a.contentMatchAt(a.childCount)).findWrapping(i.type))&&c.matchType(o[0]||i.type).validEnd){if(n){let y=e.pos+i.nodeSize,v=ke.empty;for(let k=o.length-1;k>=0;k--)v=ke.from(o[k].create(null,v));v=ke.from(a.copy(v));let w=t.tr.step(new ss(e.pos-1,y,e.pos,y,new $e(v,1,0),o.length,!0)),N=w.doc.resolve(y+2*o.length);N.nodeAfter&&N.nodeAfter.type==a.type&&Mo(w.doc,N.pos)&&w.join(N.pos),n(w.scrollIntoView())}return!0}let f=i.type.spec.isolating||r>0&&u?null:ut.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),x=m&&Qc(m);if(x!=null&&x>=e.depth)return n&&n(t.tr.lift(m,x).scrollIntoView()),!0;if(h&&zc(i,"start",!0)&&zc(a,"end")){let y=a,v=[];for(;v.push(y),!y.isTextblock;)y=y.lastChild;let w=i,N=1;for(;!w.isTextblock;w=w.firstChild)N++;if(y.canReplace(y.childCount,y.childCount,w.content)){if(n){let k=ke.empty;for(let C=v.length-1;C>=0;C--)k=ke.from(v[C].copy(k));let E=t.tr.step(new ss(e.pos-v.length,e.pos+i.nodeSize,e.pos+N,e.pos+i.nodeSize-N,new $e(k,v.length,0),0,!0));n(E.scrollIntoView())}return!0}}return!1}function yS(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(at.create(e.doc,t<0?a.start(i):a.end(i)))),!0):!1}}const TL=yS(-1),EL=yS(1);function ML(t,e=null){return function(n,r){let{$from:a,$to:i}=n.selection,o=a.blockRange(i),c=o&&K0(o,t,e);return c?(r&&r(n.tr.wrap(o,c).scrollIntoView()),!0):!1}}function mN(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 gf(u,u,e.depth),e.endIndex=0;f--)i=ke.from(n[f].type.create(n[f].attrs,i));t.step(new ss(e.start-(r?2:0),e.end,e.start,e.end,new $e(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?LL(e,n,t,i):OL(e,n,i):!0:!1}}function LL(t,e,n,r){let a=t.tr,i=r.end,o=r.$to.end(r.depth);iw;v--)y-=a.child(v).nodeSize,r.delete(y-1,y+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,u=n.endIndex==a.childCount,h=i.node(-1),f=i.index(-1);if(!h.canReplace(f+(c?0:1),f+1,o.content.append(u?ke.empty:ke.from(a))))return!1;let m=i.pos,x=m+o.nodeSize;return r.step(new ss(m-(c?1:0),x+(u?1:0),m+1,x-1,new $e((c?ke.empty:ke.from(a.copy(ke.empty))).append(u?ke.empty:ke.from(a.copy(ke.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function DL(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=ke.from(h?t.create():null),m=new $e(ke.from(t.create(null,ke.from(c.type.create(null,f)))),h?3:1,0),x=i.start,y=i.end;n(e.tr.step(new ss(x-(h?3:1),y,x,y,m,1,!0)).scrollIntoView())}return!0}}const us=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},$c=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Dg=null;const oi=function(t,e,n){let r=Dg||(Dg=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},_L=function(){Dg=null},Sl=function(t,e,n,r){return n&&(xN(t,e,n,r,-1)||xN(t,e,n,r,1))},zL=/^(img|br|input|textarea|hr)$/i;function xN(t,e,n,r,a){for(var i;;){if(t==n&&e==r)return!0;if(e==(a<0?0:Or(t))){let o=t.parentNode;if(!o||o.nodeType!=1||vu(t)||zL.test(t.nodeName)||t.contentEditable=="false")return!1;e=us(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?Or(t):0}else return!1}}function Or(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function $L(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=Or(t)}else if(t.parentNode&&!vu(t))e=us(t),t=t.parentNode;else return null}}function FL(t,e){for(;;){if(t.nodeType==3&&e2),Lr=Fc||(Ma?/Mac/.test(Ma.platform):!1),NS=Ma?/Win/.test(Ma.platform):!1,ui=/Android \d/.test(Ao),Nu=!!gN&&"webkitFontSmoothing"in gN.documentElement.style,UL=Nu?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function WL(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 ni(t,e){return typeof t=="number"?t:t[e]}function KL(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 yN(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=$c(o);continue}let c=o,u=c==i.body,h=u?WL(i):KL(c),f=0,m=0;if(e.toph.bottom-ni(r,"bottom")&&(m=e.bottom-e.top>h.bottom-h.top?e.top+ni(a,"top")-h.top:e.bottom-h.bottom+ni(a,"bottom")),e.lefth.right-ni(r,"right")&&(f=e.right-h.right+ni(a,"right")),f||m)if(u)i.defaultView.scrollBy(f,m);else{let y=c.scrollLeft,v=c.scrollTop;m&&(c.scrollTop+=m),f&&(c.scrollLeft+=f);let w=c.scrollLeft-y,N=c.scrollTop-v;e={left:e.left-w,top:e.top-N,right:e.right-w,bottom:e.bottom-N}}let x=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(x))break;o=x=="absolute"?o.offsetParent:$c(o)}}function qL(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:wS(t.dom)}}function wS(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=$c(r));return e}function GL({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;jS(n,r==0?0:r-e)}function jS(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?QL(n,a):!n||r&&n.nodeType==1?{node:t,offset:i}:kS(n,a)}function QL(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 ey(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function YL(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 ZL(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 SS(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&a++}let h;Nu&&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=ZL(t,r,a,e))}c==null&&(c=XL(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function bN(t){return t.top=0&&a==r.nodeValue.length?(u--,f=1):n<0?u--:h++,Md(to(oi(r,u,h),f),f<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&a&&(n<0||a==Or(r))){let u=r.childNodes[a-1];if(u.nodeType==1)return $x(u.getBoundingClientRect(),!1)}if(i==null&&a=0)}if(i==null&&a&&(n<0||a==Or(r))){let u=r.childNodes[a-1],h=u.nodeType==3?oi(u,Or(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(h)return Md(to(h,1),!1)}if(i==null&&a=0)}function Md(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 $x(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 TS(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 nO(t,e,n){let r=e.selection,a=n=="up"?r.$from:r.$to;return TS(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=CS(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=oi(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 sO=/[\u0590-\u08ac]/;function rO(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?!sO.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?i:o:TS(t,e,()=>{let{focusNode:u,focusOffset:h,anchorNode:f,anchorOffset:m}=t.domSelectionRange(),x=c.caretBidiLevel;c.modify("move",n,"character");let y=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:v,focusOffset:w}=t.domSelectionRange(),N=v&&!y.contains(v.nodeType==1?v:v.parentNode)||u==v&&h==w;try{c.collapse(f,m),u&&(u!=f||h!=m)&&c.extend&&c.extend(u,h)}catch{}return x!=null&&(c.caretBidiLevel=x),N}):r.pos==r.start()||r.pos==r.end()}let vN=null,NN=null,wN=!1;function aO(t,e,n){return vN==e&&NN==n?wN:(vN=e,NN=n,wN=n=="up"||n=="down"?nO(t,e,n):rO(t,e,n))}const _r=0,jN=1,cl=2,Aa=3;class wu{constructor(e,n,r,a){this.parent=e,this.children=n,this.dom=r,this.contentDOM=a,this.dirty=_r,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;nus(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 MS){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 ES&&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?us(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=us(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 y=document.createRange();y.setEnd(u.node,u.offset),y.setStart(c.node,c.offset),h.removeAllRanges(),h.addRange(y)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,a=0;a=r:er){let c=r+i.border,u=o-i.border;if(e>=c&&n<=u){this.dirty=e==r||n==o?cl:jN,e==c&&n==u&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Aa:i.markDirty(e-c,n-c);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?cl:Aa}r=o}this.dirty=cl}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?cl:jN;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==_r&&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 iO extends wu{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 Cl extends wu{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=Pl.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Cl(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Aa||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Aa&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=_r){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(i=Bg(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}=Pl.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=RS(f,r,n),h?u=new oO(e,n,r,a,f,m||null,x,h,i,o+1):n.isText?new jp(e,n,r,a,f,x,i):new yo(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=()=>ke.empty)}return e}matchesNode(e,n,r){return this.dirty==_r&&e.eq(this.node)&&bf(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 cO(this,o&&o.node,e);hO(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?rn.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 y;u.findNodeMatch(h,f,m,x)||c&&e.state.selection.from>a&&e.state.selection.to-1&&u.updateNodeAt(h,f,m,y,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==cl)&&(o&&this.protectLocalComposition(e,o),AS(this.contentDOM,this.children,e),Fc&&fO(this.dom))}localCompositionInfo(e,n){let{from:r,to:a}=e.state.selection;if(!(e.state.selection instanceof at)||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=pO(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 iO(this,i,n,a);e.input.compositionNodes.push(o),this.children=Bg(this.children,r,r+a.length,e,o)}update(e,n,r,a){return this.dirty==Aa||!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=_r}updateOuterDeco(e){if(bf(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=IS(this.dom,this.nodeDOM,Fg(this.outerDeco,this.node,n),Fg(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 kN(t,e,n,r,a){RS(r,e,t);let i=new yo(void 0,t,e,n,r,r,r,a,0);return i.contentDOM&&i.updateChildren(a,0),i}class jp extends yo{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==Aa||this.dirty!=_r&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=_r||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=_r,!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 jp(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=Aa)}get domAtom(){return!1}isText(e){return this.node.text==e}}class MS extends wu{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==_r&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class oO extends yo{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==Aa)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 AS(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=Cl.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 Cl)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 uO(t,e){return t.type.side-e.type.side}function hO(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),y),i=v}}function fO(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 pO(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 Bg(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 ty(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(wp(n)){for(u=o;a&&!a.node;)a=a.parent;let m=a.node;if(a&&m.isAtom&&rt.isSelectable(m)&&a.parent&&!(m.isInline&&BL(n.focusNode,n.focusOffset,a.dom))){let x=a.posBefore;h=new rt(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 y=0;y{(n.anchorNode!=r||n.anchorOffset!=a)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!PS(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function xO(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,us(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&tr&&go<=11&&(n.disabled=!0,n.disabled=!1)}function LS(t,e){if(e instanceof rt){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(MN(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else MN(t)}function MN(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function ny(t,e,n,r){return t.someProp("createSelectionBetween",a=>a(t,e,n))||at.between(e,n,r)}function AN(t){return t.editable&&!t.hasFocus()?!1:OS(t)}function OS(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 gO(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Sl(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Vg(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&&ut.findFrom(i,e)}function no(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function IN(t,e,n){let r=t.state.selection;if(r instanceof at)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 no(t,new at(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let a=Vg(t.state,e);return a&&a instanceof rt?no(t,a):!1}else if(!(Lr&&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?rt.isSelectable(i)?no(t,new rt(e<0?t.state.doc.resolve(a.pos-i.nodeSize):a)):Nu?no(t,new at(t.state.doc.resolve(e<0?c:c+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof rt&&r.node.isInline)return no(t,new at(e>0?r.$to:r.$from));{let a=Vg(t.state,e);return a?no(t,a):!1}}}function vf(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Wd(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function xc(t,e){return e<0?yO(t):bO(t)}function yO(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a,i,o=!1;for(Dr&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(Wd(c,-1))a=n,i=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(DS(n))break;{let c=n.previousSibling;for(;c&&Wd(c,-1);)a=n.parentNode,i=us(c),c=c.previousSibling;if(c)n=c,r=vf(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Hg(t,n,r):a&&Hg(t,a,i)}function bO(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a=vf(n),i,o;for(;;)if(r{t.state==a&&pi(t)},50)}function RN(t,e){let n=t.state.doc.resolve(e);if(!(xs||NS)&&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 PN(t,e,n){let r=t.state.selection;if(r instanceof at&&!r.empty||n.indexOf("s")>-1||Lr&&n.indexOf("m")>-1)return!1;let{$from:a,$to:i}=r;if(!a.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Vg(t.state,e);if(o&&o instanceof rt)return no(t,o)}if(!a.parent.inlineContent){let o=e<0?a:i,c=r instanceof pr?ut.near(o,e):ut.findFrom(o,e);return c?no(t,c):!1}return!1}function LN(t,e){if(!(t.state.selection instanceof at))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 ON(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function wO(t){if(!Cs||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;ON(t,r,"true"),setTimeout(()=>ON(t,r,"false"),20)}return!1}function jO(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function kO(t,e){let n=e.keyCode,r=jO(e);if(n==8||Lr&&n==72&&r=="c")return LN(t,-1)||xc(t,-1);if(n==46&&!e.shiftKey||Lr&&n==68&&r=="c")return LN(t,1)||xc(t,1);if(n==13||n==27)return!0;if(n==37||Lr&&n==66&&r=="c"){let a=n==37?RN(t,t.state.selection.from)=="ltr"?-1:1:-1;return IN(t,a,r)||xc(t,a)}else if(n==39||Lr&&n==70&&r=="c"){let a=n==39?RN(t,t.state.selection.from)=="ltr"?1:-1:1;return IN(t,a,r)||xc(t,a)}else{if(n==38||Lr&&n==80&&r=="c")return PN(t,-1,r)||xc(t,-1);if(n==40||Lr&&n==78&&r=="c")return wO(t)||PN(t,1,r)||xc(t,1);if(r==(Lr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function sy(t,e){t.someProp("transformCopied",y=>{e=y(e,t)});let n=[],{content:r,openStart:a,openEnd:i}=e;for(;a>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){a--,i--;let y=r.firstChild;n.push(y.type.name,y.attrs!=y.type.defaultAttrs?y.attrs:null),r=y.content}let o=t.someProp("clipboardSerializer")||Pl.fromSchema(t.state.schema),c=VS(),u=c.createElement("div");u.appendChild(o.serializeFragment(r,{document:c}));let h=u.firstChild,f,m=0;for(;h&&h.nodeType==1&&(f=BS[h.nodeName.toLowerCase()]);){for(let y=f.length-1;y>=0;y--){let v=c.createElement(f[y]);for(;u.firstChild;)v.appendChild(u.firstChild);u.appendChild(v),m++}h=u.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${a} ${i}${m?` -${m}`:""} ${JSON.stringify(n)}`);let x=t.someProp("clipboardTextSerializer",y=>y(e,t))||e.content.textBetween(0,e.content.size,` - -`);return{dom:u,text:x,slice:e}}function _S(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 $e(ke.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:y}=t.state,v=Pl.fromSchema(y);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(w=>{let N=o.appendChild(document.createElement("p"));w&&N.appendChild(v.serializeNode(y.text(w,x)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),o=EO(n),Nu&&MO(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")||xo.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||f),context:a,ruleFromNode(x){return x.nodeName=="BR"&&!x.nextSibling&&x.parentNode&&!SO.test(x.parentNode.nodeName)?{ignore:!0}:null}})),f)c=AO(DN(c,+f[1],+f[2]),f[4]);else if(c=$e.maxOpen(CO(c.content,a),!0),c.openStart||c.openEnd){let m=0,x=0;for(let y=c.content.firstChild;m{c=m(c,t,u)}),c}const SO=/^(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 CO(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&&$S(u,i,c,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=FS(o[o.length-1],i.length));let f=zS(c,u);o.push(f),a=a.matchType(f.type),i=u}}),o)return ke.from(o)}return t}function zS(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,ke.from(t));return t}function $S(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(ke.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(c))}function DN(t,e,n){return en})),Bx.createHTML(t)):t}function EO(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=VS().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),a;if((a=r&&BS[r[1].toLowerCase()])&&(t=a.map(i=>"<"+i+">").join("")+t+a.map(i=>"").reverse().join("")),n.innerHTML=TO(t),a)for(let i=0;i=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;a=ke.from(u.create(r[c+1],a)),i++,o++}return new $e(a,i,o)}const zs={},$s={},IO={touchstart:!0,touchmove:!0};class RO{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 PO(t){for(let e in zs){let n=zs[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{OO(t,r)&&!ry(t,r)&&(t.editable||!(r.type in $s))&&n(t,r)},IO[e]?{passive:!0}:void 0)}Cs&&t.dom.addEventListener("input",()=>null),Wg(t)}function fo(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function LO(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 Wg(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>ry(t,r))})}function ry(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function OO(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 DO(t,e){!ry(t,e)&&zs[e.type]&&(t.editable||!(e.type in $s))&&zs[e.type](t,e)}$s.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!US(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(ui&&xs&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Fc&&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,al(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||kO(t,n)?n.preventDefault():fo(t,"key")};$s.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};$s.keypress=(t,e)=>{let n=e;if(US(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Lr&&n.metaKey)return;if(t.someProp("handleKeyPress",a=>a(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof at)||!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 kp(t){return{left:t.clientX,top:t.clientY}}function _O(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function ay(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 Ac(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 zO(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&rt.isSelectable(r)?(Ac(t,new rt(n)),!0):!1}function $O(t,e){if(e==-1)return!1;let n=t.state.selection,r,a;n instanceof rt&&(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(rt.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?(Ac(t,rt.create(t.state.doc,a)),!0):!1}function FO(t,e,n,r,a){return ay(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(a?$O(t,n):zO(t,n))}function BO(t,e,n,r){return ay(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",a=>a(t,e,r))}function VO(t,e,n,r){return ay(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",a=>a(t,e,r))||HO(t,n,r)}function HO(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Ac(t,at.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)Ac(t,at.create(r,c+1,c+1+o.content.size));else if(rt.isSelectable(o))Ac(t,rt.create(r,c));else continue;return!0}}function iy(t){return Nf(t)}const HS=Lr?"metaKey":"ctrlKey";zs.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=iy(t),a=Date.now(),i="singleClick";a-t.input.lastClick.time<500&&_O(n,t.input.lastClick)&&!n[HS]&&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(kp(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new UO(t,o,n,!!r)):(i=="doubleClick"?BO:VO)(t,o.pos,o.inside,n)?n.preventDefault():fo(t,"pointer"))};class UO{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[HS],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 rt&&h.from<=o&&h.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Dr&&!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)),fo(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(()=>pi(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(kp(e))),this.updateAllowDefault(e),this.allowDefault||!n?fo(this.view,"pointer"):FO(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Cs&&this.mightDrag&&!this.mightDrag.node.isAtom||xs&&!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)?(Ac(this.view,ut.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):fo(this.view,"pointer")}move(e){this.updateAllowDefault(e),fo(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)}}zs.touchstart=t=>{t.input.lastTouch=Date.now(),iy(t),fo(t,"pointer")};zs.touchmove=t=>{t.input.lastTouch=Date.now(),fo(t,"pointer")};zs.contextmenu=t=>iy(t);function US(t,e){return t.composing?!0:Cs&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const WO=ui?5e3:-1;$s.compositionstart=$s.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof at&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||xs&&NS&&KO(t)))t.markCursor=t.state.storedMarks||n.marks(),Nf(t,!0),t.markCursor=null;else if(Nf(t,!e.selection.empty),Dr&&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}WS(t,WO)};function KO(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"}$s.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++,WS(t,20))};function WS(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Nf(t),e))}function KS(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=GO());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function qO(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=$L(e.focusNode,e.focusOffset),r=FL(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 GO(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Nf(t,e=!1){if(!(ui&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),KS(t),e||t.docView&&t.docView.dirty){let n=ty(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 JO(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 iu=tr&&go<15||Fc&&UL<604;zs.copy=$s.cut=(t,e)=>{let n=e,r=t.state.selection,a=n.type=="cut";if(r.empty)return;let i=iu?null:n.clipboardData,o=r.content(),{dom:c,text:u}=sy(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",c.innerHTML),i.setData("text/plain",u)):JO(t,c),a&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function QO(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function YO(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?ou(t,r.value,null,a,e):ou(t,r.textContent,r.innerHTML,a,e)},50)}function ou(t,e,n,r,a){let i=_S(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,a,i||$e.empty)))return!0;if(!i)return!1;let o=QO(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 qS(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," "):""}$s.paste=(t,e)=>{let n=e;if(t.composing&&!ui)return;let r=iu?null:n.clipboardData,a=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&ou(t,qS(r),r.getData("text/html"),a,n)?n.preventDefault():YO(t,n)};class GS{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const XO=Lr?"altKey":"ctrlKey";function JS(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[XO]}zs.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(kp(n)),o;if(!(i&&i.pos>=a.from&&i.pos<=(a instanceof rt?a.to-1:a.to))){if(r&&r.mightDrag)o=rt.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=rt.create(t.state.doc,m.posBefore))}}let c=(o||t.state.selection).content(),{dom:u,text:h,slice:f}=sy(t,c);(!n.dataTransfer.files.length||!xs||vS>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(iu?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",iu||n.dataTransfer.setData("text/plain",h),t.dragging=new GS(f,JS(t,n),o)};zs.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};$s.dragover=$s.dragenter=(t,e)=>e.preventDefault();$s.drop=(t,e)=>{try{ZO(t,e,t.dragging)}finally{t.dragging=null}};function ZO(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(kp(e));if(!r)return;let a=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",y=>{i=y(i,t,!1)}):i=_S(t,qS(e.dataTransfer),iu?null:e.dataTransfer.getData("text/html"),!1,a);let o=!!(n&&JS(t,e));if(t.someProp("handleDrop",y=>y(t,e,i||$e.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let c=i?Z2(t.state.doc,a.pos,i):a.pos;c==null&&(c=a.pos);let u=t.state.tr;if(o){let{node:y}=n;y?y.replace(u):u.deleteSelection()}let h=u.mapping.map(c),f=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,m=u.doc;if(f?u.replaceRangeWith(h,h,i.content.firstChild):u.replaceRange(h,h,i),u.doc.eq(m))return;let x=u.doc.resolve(h);if(f&&rt.isSelectable(i.content.firstChild)&&x.nodeAfter&&x.nodeAfter.sameMarkup(i.content.firstChild))u.setSelection(new rt(x));else{let y=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((v,w,N,k)=>y=k),u.setSelection(ny(t,x,u.doc.resolve(y)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}zs.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())&&pi(t)},20))};zs.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)};zs.beforeinput=(t,e)=>{if(xs&&ui&&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,al(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 $s)zs[t]=$s[t];function lu(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 wf{constructor(e,n){this.toDOM=e,this.spec=n||ml,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 Jn(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof wf&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&lu(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class bo{constructor(e,n){this.attrs=e,this.spec=n||ml}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 Jn(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==ks||e.maps.length==0?this:this.mapInner(e,n,0,0,r||ml)}mapInner(e,n,r,a,i){let o;for(let c=0;c{let h=u+r,f;if(f=YS(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 bo){let h=Math.max(i,u.from)-i,f=Math.min(o,u.to)-i;ha.map(e,n,ml));return ao.from(r)}forChild(e,n){if(n.isLeaf)return sn.empty;let r=[];for(let a=0;an instanceof sn)?e:e.reduce((n,r)=>n.concat(r instanceof sn?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let N=w-v-(y-x);for(let k=0;kE+f-m)continue;let C=c[k]+f-m;y>=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),y=x-a,{index:v,offset:w}=r.content.findIndex(m),N=r.maybeChild(v);if(N&&w==m&&w+N.nodeSize==y){let k=c[h+2].mapInner(n,N,f+1,t[h]+i+1,o);k!=ks?(c[h]=m,c[h+1]=y,c[h+2]=k):(c[h+1]=-2,u=!0)}else u=!0}if(u){let h=t6(c,t,e,n,a,i,o),f=jf(h,r,0,o);e=f.local;for(let m=0;mn&&o.to{let h=YS(t,c,u+n);if(h){i=!0;let f=jf(h,c,n+u+1,r);f!=ks&&a.push(u,u+c.nodeSize,f)}});let o=QS(i?XS(t):t,-n).sort(xl);for(let c=0;c0;)e++;t.splice(e,0,n)}function Vx(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=ks&&e.push(r)}),t.cursorWrapper&&e.push(sn.create(t.state.doc,[t.cursorWrapper.deco])),ao.from(e)}const n6={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},s6=tr&&go<=11;class r6{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 a6{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new r6,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():Cs&&e.composing&&r.some(a=>a.type=="childList"&&a.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),s6&&(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,n6)),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(AN(this.view)){if(this.suppressingSelectionUpdates)return pi(this.view);if(tr&&go<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Sl(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=$c(i))n.add(i);for(let i=e.anchorNode;i;i=$c(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)&&AN(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(Dr&&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 y=x.parentNode;y&&y.nodeName=="LI"&&(!m||l6(e,m)!=y)&&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),i6(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,c6(e,u)),this.handleDOMChange(i,o,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||pi(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],E=k.pmViewDesc;if(k.nodeName=="BR"&&!E){i=N;break}if(!E||E.size)break}let m=t.state.doc,x=t.someProp("domParser")||xo.fromSchema(t.state.schema),y=m.resolve(o),v=null,w=x.parse(r,{topNode:y.parent,topMatch:y.parent.contentMatchAt(y.index()),topOpen:!0,from:a,to:i,preserveWhitespace:y.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:u6,context:y});if(h&&h[0].pos!=null){let N=h[0].pos,k=h[1]&&h[1].pos;k==null&&(k=N),v={anchor:N+o,head:k+o}}return{doc:w,sel:v,from:o,to:c}}function u6(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Cs&&/^(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||Cs&&/^(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 h6=/^(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 f6(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=ty(t,_);if(H&&!t.state.selection.eq(H)){if(xs&&ui&&t.input.lastKeyCode===13&&Date.now()-100ee(t,al(13,"Enter"))))return;let P=t.state.tr.setSelection(H);_=="pointer"?P.setMeta("pointer",!0):_=="key"&&P.scrollIntoView(),i&&P.setMeta("composition",i),t.dispatch(P)}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=d6(t,e,n),f=t.state.doc,m=f.slice(h.from,h.to),x,y;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||ui)&&a.some(_=>_.nodeType==1&&!h6.test(_.nodeName))&&(!v||v.endA>=v.endB)&&t.someProp("handleKeyDown",_=>_(t,al(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!v)if(r&&u instanceof at&&!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 _=VN(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&&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)),tr&&go<=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),E=w.sameParent(N)&&w.parent.inlineContent&&k.end()>=v.endA;if((Fc&&t.input.lastIOSEnter>Date.now()-225&&(!E||a.some(_=>_.nodeName=="DIV"||_.nodeName=="P"))||!E&&w.pos_(t,al(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>v.start&&m6(f,v.start,v.endA,w,N)&&t.someProp("handleKeyDown",_=>_(t,al(8,"Backspace")))){ui&&xs&&t.domObserver.suppressSelectionUpdates();return}xs&&v.endB==v.start&&(t.input.lastChromeDelete=Date.now()),ui&&!E&&w.start()!=N.start()&&N.parentOffset==0&&w.depth==N.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==v.endA&&(v.endB-=2,N=h.doc.resolveNoCache(v.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function(_){return _(t,al(13,"Enter"))})},20));let C=v.start,L=v.endA,O=_=>{let H=_||t.state.tr.replace(C,L,h.doc.slice(v.start-h.from,v.endB-h.from));if(h.sel){let P=VN(t,H.doc,h.sel);P&&!(xs&&t.composing&&P.empty&&(v.start!=v.endB||t.input.lastChromeDeletepi(t),20));let _=O(t.state.tr.delete(C,L)),H=f.resolve(v.start).marksAcross(f.resolve(v.endA));H&&_.ensureMarks(H),t.dispatch(_)}else if(v.endA==v.endB&&(K=p6(w.parent.content.cut(w.parentOffset,N.parentOffset),k.parent.content.cut(k.parentOffset,v.endA-k.start())))){let _=O(t.state.tr);K.type=="add"?_.addMark(C,L,K.mark):_.removeMark(C,L,K.mark),t.dispatch(_)}else if(w.parent.child(w.index()).isText&&w.index()==N.index()-(N.textOffset?0:1)){let _=w.parent.textBetween(w.parentOffset,N.parentOffset),H=()=>O(t.state.tr.insertText(_,C,L));t.someProp("handleTextInput",P=>P(t,C,L,_,H))||t.dispatch(H())}else t.dispatch(O());else t.dispatch(O())}function VN(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:ny(t,e.resolve(n.anchor),e.resolve(n.head))}function p6(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||Hx(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 x6(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 ZS{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 RO,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(GN),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=KN(this),WN(this),this.nodeViews=qN(this),this.docView=kN(this.state.doc,UN(this),Vx(this),this.dom,this),this.domObserver=new a6(this,(r,a,i,o)=>f6(this,r,a,i,o)),this.domObserver.start(),PO(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&&Wg(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(GN),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&&(KS(this),o=!0),this.state=e;let c=a.plugins!=e.plugins||this._props.plugins!=n.plugins;if(c||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let y=qN(this);y6(y,this.nodeViews)&&(this.nodeViews=y,i=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&Wg(this),this.editable=KN(this),WN(this);let u=Vx(this),h=UN(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&&qL(this);if(o){this.domObserver.stop();let y=m&&(tr||xs)&&!this.composing&&!a.selection.empty&&!e.selection.empty&&g6(a.selection,e.selection);if(m){let v=xs?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=qO(this)),(i||!this.docView.update(e.doc,h,u,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=kN(e.doc,h,u,this.dom,this)),v&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(y=!0)}y||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&gO(this))?pi(this,y):(LS(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&&GL(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 rt){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&yN(this,n.getBoundingClientRect(),e)}else yN(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 GS(e.slice,e.move,a<0?void 0:rt.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 eO(this,e)}coordsAtPos(e,n=1){return CS(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 aO(this,n||this.state,e)}pasteHTML(e,n){return ou(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ou(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return sy(this,e)}destroy(){this.docView&&(LO(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Vx(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 DO(this,e)}domSelectionRange(){let e=this.domSelection();return e?Cs&&this.root.nodeType===11&&VL(this.dom.ownerDocument)==this.dom&&o6(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}ZS.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function UN(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"),[Jn.node(0,t.state.doc.content.size,e)]}function WN(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:Jn.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function KN(t){return!t.someProp("editable",e=>e(t.state)===!1)}function g6(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 qN(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 y6(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 GN(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 wo={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:"'"},kf={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},b6=typeof navigator<"u"&&/Mac/.test(navigator.platform),v6=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var hs=0;hs<10;hs++)wo[48+hs]=wo[96+hs]=String(hs);for(var hs=1;hs<=24;hs++)wo[hs+111]="F"+hs;for(var hs=65;hs<=90;hs++)wo[hs]=String.fromCharCode(hs+32),kf[hs]=String.fromCharCode(hs);for(var Ux in wo)kf.hasOwnProperty(Ux)||(kf[Ux]=wo[Ux]);function N6(t){var e=b6&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||v6&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?kf:wo)[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 w6=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),j6=typeof navigator<"u"&&/Win/.test(navigator.platform);function k6(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)T6(t,n,{get:e[n],enumerable:!0})};function Sp(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 Cp=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:Sp({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}},eC={};dy(eC,{blur:()=>E6,clearContent:()=>M6,clearNodes:()=>A6,command:()=>I6,createParagraphNear:()=>R6,cut:()=>P6,deleteCurrentNode:()=>L6,deleteNode:()=>O6,deleteRange:()=>D6,deleteSelection:()=>_6,enter:()=>z6,exitCode:()=>$6,extendMarkRange:()=>F6,first:()=>B6,focus:()=>H6,forEach:()=>U6,insertContent:()=>W6,insertContentAt:()=>G6,joinBackward:()=>Y6,joinDown:()=>Q6,joinForward:()=>X6,joinItemBackward:()=>Z6,joinItemForward:()=>eD,joinTextblockBackward:()=>tD,joinTextblockForward:()=>nD,joinUp:()=>J6,keyboardShortcut:()=>rD,lift:()=>aD,liftEmptyBlock:()=>iD,liftListItem:()=>oD,newlineInCode:()=>lD,resetAttributes:()=>cD,scrollIntoView:()=>dD,selectAll:()=>uD,selectNodeBackward:()=>hD,selectNodeForward:()=>fD,selectParentNode:()=>pD,selectTextblockEnd:()=>mD,selectTextblockStart:()=>xD,setContent:()=>gD,setMark:()=>_D,setMeta:()=>zD,setNode:()=>$D,setNodeSelection:()=>FD,setTextDirection:()=>BD,setTextSelection:()=>VD,sinkListItem:()=>HD,splitBlock:()=>UD,splitListItem:()=>WD,toggleList:()=>KD,toggleMark:()=>qD,toggleNode:()=>GD,toggleWrap:()=>JD,undoInputRule:()=>QD,unsetAllMarks:()=>YD,unsetMark:()=>XD,unsetTextDirection:()=>ZD,updateAttributes:()=>e_,wrapIn:()=>t_,wrapInList:()=>n_});var E6=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),M6=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),A6=()=>({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)),y=m.blockRange(x);if(!y)return;const v=Qc(y);if(c.type.isTextblock){const{defaultType:w}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(y.start,w)}(v||v===0)&&e.lift(y,v)})}),!0},I6=t=>e=>t(e),R6=()=>({state:t,dispatch:e})=>mS(t,e),P6=(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 at(r.doc.resolve(Math.max(o-1,0)))),!0},L6=()=>({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 Hn(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 O6=t=>({tr:e,state:n,dispatch:r})=>{const a=Hn(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},D6=t=>({tr:e,dispatch:n})=>{const{from:r,to:a}=t;return n&&e.delete(r,a),!0},_6=()=>({state:t,dispatch:e})=>J0(t,e),z6=()=>({commands:t})=>t.keyboardShortcut("Enter"),$6=()=>({state:t,dispatch:e})=>wL(t,e);function uy(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Sf(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(a=>n.strict?e[a]===t[a]:uy(e[a])?e[a].test(t[a]):e[a]===t[a]):!0}function tC(t,e,n={}){return t.find(r=>r.type===e&&Sf(Object.fromEntries(Object.keys(n).map(a=>[a,r.attrs[a]])),n))}function JN(t,e,n={}){return!!tC(t,e,n)}function hy(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),!tC([...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&&JN([...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=vi(t,r.schema),{doc:o,selection:c}=n,{$from:u,from:h,to:f}=c;if(a){const m=hy(u,i,e);if(m&&m.from<=h&&m.to>=f){const x=at.create(o,m.from,m.to);n.setSelection(x)}}return!0},B6=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=()=>{(Cf()||QN())&&r.dom.focus(),V6()&&!Cf()&&!QN()&&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&&!nC(n.state.selection))return o(),!0;const c=sC(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},U6=(t,e)=>n=>t.every((r,a)=>e(r,{...n,index:a})),W6=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),rC=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&&rC(r)}return t};function Rh(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 rC(n)}function cu(t,e,n){if(t instanceof hi||t instanceof ke)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 ke.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),cu("",e,n)}if(a){if(n.errorOnInvalidContent){let o=!1,c="";const u=new V2({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?xo.fromSchema(u).parseSlice(Rh(t),n.parseOptions):xo.fromSchema(u).parse(Rh(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const i=xo.fromSchema(e);return n.slice?i.parseSlice(Rh(t),n.parseOptions).content:i.parse(Rh(t),n.parseOptions)}return cu("",e,n)}function K6(t,e,n){const r=t.steps.length-1;if(r{o===0&&(o=f)}),t.setSelection(ut.near(t.doc.resolve(o),n))}var q6=t=>!("type"in t),G6=(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{cu(e,i.schema,{parseOptions:h,errorOnInvalidContent:!0})}catch(N){u(N)}try{c=cu(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,y=!0;if((q6(c)?c:[c]).forEach(N=>{N.check(),x=x?N.isText&&N.marks.length===0:!1,y=y?N.isBlock:!1}),f===m&&y){const{parent:N}=r.doc.resolve(f);N.isTextblock&&!N.type.spec.code&&!N.childCount&&(f-=1,m+=1)}let w;if(x){if(Array.isArray(e))w=e.map(N=>N.text||"").join("");else if(e instanceof ke){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(),E=N.parentOffset===0,C=k.isText||k.isTextblock,L=k.content.size>0;E&&C&&L&&(f=Math.max(0,f-1)),r.replaceWith(f,m,w)}n.updateSelection&&K6(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},J6=()=>({state:t,dispatch:e})=>bL(t,e),Q6=()=>({state:t,dispatch:e})=>vL(t,e),Y6=()=>({state:t,dispatch:e})=>lS(t,e),X6=()=>({state:t,dispatch:e})=>hS(t,e),Z6=()=>({state:t,dispatch:e,tr:n})=>{try{const r=bp(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},eD=()=>({state:t,dispatch:e,tr:n})=>{try{const r=bp(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},tD=()=>({state:t,dispatch:e})=>gL(t,e),nD=()=>({state:t,dispatch:e})=>yL(t,e);function aC(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function sD(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=sD(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 jo(t,e,n={}){const{from:r,to:a,empty:i}=t.selection,o=e?Hn(e,t.schema):null,c=[];t.doc.nodesBetween(r,a,(m,x)=>{if(m.isText)return;const y=Math.max(r,x),v=Math.min(a,x+m.nodeSize);c.push({node:m,from:y,to:v})});const u=a-r,h=c.filter(m=>o?o.name===m.node.type.name:!0).filter(m=>Sf(m.node.attrs,n,{strict:!1}));return i?!!h.length:h.reduce((m,x)=>m+x.to-x.from,0)>=u}var aD=(t,e={})=>({state:n,dispatch:r})=>{const a=Hn(t,n.schema);return jo(n,a,e)?NL(n,r):!1},iD=()=>({state:t,dispatch:e})=>xS(t,e),oD=t=>({state:e,dispatch:n})=>{const r=Hn(t,e.schema);return PL(r)(e,n)},lD=()=>({state:t,dispatch:e})=>pS(t,e);function Tp(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function YN(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 cD=(t,e)=>({tr:n,state:r,dispatch:a})=>{let i=null,o=null;const c=Tp(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(i=Hn(t,r.schema)),c==="mark"&&(o=vi(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,YN(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(YN(x.attrs,e))))})})}),u},dD=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),uD=()=>({tr:t,dispatch:e})=>{if(e){const n=new pr(t.doc);t.setSelection(n)}return!0},hD=()=>({state:t,dispatch:e})=>dS(t,e),fD=()=>({state:t,dispatch:e})=>fS(t,e),pD=()=>({state:t,dispatch:e})=>SL(t,e),mD=()=>({state:t,dispatch:e})=>EL(t,e),xD=()=>({state:t,dispatch:e})=>TL(t,e);function Kg(t,e,n={},r={}){return cu(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var gD=(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=Kg(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 iC(t,e){const n=vi(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 oC(t,e){const n=new q0(t);return e.forEach(r=>{r.steps.forEach(a=>{n.step(a)})}),n}function yD(t){for(let e=0;e{n(a)&&r.push({node:a,pos:i})}),r}function lC(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 Ep(t){return e=>lC(e.$from,t)}function tt(t,e,n){return t.config[e]===void 0&&t.parent?tt(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?tt(t.parent,e,n):null}):t.config[e]}function fy(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=tt(e,"addExtensions",n);return r?[e,...fy(r())]:e}).flat(10)}function py(t,e){const n=Pl.fromSchema(e).serializeFragment(t),a=document.implementation.createHTMLDocument().createElement("div");return a.appendChild(n),a.innerHTML}function cC(t){return typeof t=="function"}function Wt(t,e=void 0,...n){return cC(t)?e?t.bind(e)(...n):t(...n):t}function vD(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Bc(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 dC(t){const e=[],{nodeExtensions:n,markExtensions:r}=Bc(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=tt(h,"addGlobalAttributes",f);if(!m)return;m().forEach(y=>{let v;Array.isArray(y.types)?v=y.types:y.types==="*"?v=u:y.types==="nodes"?v=o:y.types==="marks"?v=c:v=[],v.forEach(w=>{Object.entries(y.attributes).forEach(([N,k])=>{e.push({type:w,name:N,attribute:{...i,...k}})})})})}),a.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage},m=tt(h,"addAttributes",f);if(!m)return;const x=m();Object.entries(x).forEach(([y,v])=>{const w={...i,...v};typeof(w==null?void 0:w.default)=="function"&&(w.default=w.default()),w!=null&&w.isRequired&&(w==null?void 0:w.default)===void 0&&delete w.default,e.push({type:h.name,name:y,attribute:w})})}),e}function ND(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 XN(t){const e=[],n=ND(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([...XN(r[a]),...XN(i)]);r[a]=Array.from(c.entries()).map(([u,h])=>`${u}: ${h}`).join("; ")}else r[a]=i}),r},{})}function du(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Kt(n,r),{})}function wD(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function ZN(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):wD(n.getAttribute(o.name));return c==null?i:{...i,[o.name]:c}},{});return{...r,...a}}}}function ew(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&vD(n)?!1:n!=null))}function tw(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 jD(t,e){var n;const r=dC(t),{nodeExtensions:a,markExtensions:i}=Bc(t),o=(n=a.find(h=>tt(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,E)=>{const C=tt(E,"extendNodeSchema",m);return{...k,...C?C(h):{}}},{}),y=ew({...x,content:Wt(tt(h,"content",m)),marks:Wt(tt(h,"marks",m)),group:Wt(tt(h,"group",m)),inline:Wt(tt(h,"inline",m)),atom:Wt(tt(h,"atom",m)),selectable:Wt(tt(h,"selectable",m)),draggable:Wt(tt(h,"draggable",m)),code:Wt(tt(h,"code",m)),whitespace:Wt(tt(h,"whitespace",m)),linebreakReplacement:Wt(tt(h,"linebreakReplacement",m)),defining:Wt(tt(h,"defining",m)),isolating:Wt(tt(h,"isolating",m)),attrs:Object.fromEntries(f.map(tw))}),v=Wt(tt(h,"parseHTML",m));v&&(y.parseDOM=v.map(k=>ZN(k,f)));const w=tt(h,"renderHTML",m);w&&(y.toDOM=k=>w({node:k,HTMLAttributes:du(k,f)}));const N=tt(h,"renderText",m);return N&&(y.toText=N),[h.name,y]})),u=Object.fromEntries(i.map(h=>{const f=r.filter(N=>N.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},x=t.reduce((N,k)=>{const E=tt(k,"extendMarkSchema",m);return{...N,...E?E(h):{}}},{}),y=ew({...x,inclusive:Wt(tt(h,"inclusive",m)),excludes:Wt(tt(h,"excludes",m)),group:Wt(tt(h,"group",m)),spanning:Wt(tt(h,"spanning",m)),code:Wt(tt(h,"code",m)),attrs:Object.fromEntries(f.map(tw))}),v=Wt(tt(h,"parseHTML",m));v&&(y.parseDOM=v.map(N=>ZN(N,f)));const w=tt(h,"renderHTML",m);return w&&(y.toDOM=N=>w({mark:N,HTMLAttributes:du(N,f)})),[h.name,y]}));return new V2({topNode:o,nodes:c,marks:u})}function kD(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Kd(t){return t.sort((n,r)=>{const a=tt(n,"priority")||100,i=tt(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 hC(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 y=o==null?void 0:o[u.type.name];if(y)return f&&(c+=y({node:u,pos:h,parent:f,index:m,range:e})),!1;u.isText&&(c+=(x=u==null?void 0:u.text)==null?void 0:x.slice(Math.max(r,h)-h,a-h))}),c}function SD(t,e){const n={from:0,to:t.content.size};return hC(t,n,e)}function fC(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function CD(t,e){const n=Hn(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 pC(t,e){const n=Tp(typeof e=="string"?e:e.name,t.schema);return n==="node"?CD(t,e):n==="mark"?iC(t,e):{}}function TD(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 ED(t){const e=TD(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 mC(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}})})}),ED(r)}function my(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(a=>{const i=n.resolve(t),o=hy(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 MD=(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 Ad(t,e){return e.nodes[t]||e.marks[t]||null}function Qh(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 AD=(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 qg(t,e,n={}){const{empty:r,ranges:a}=t.selection,i=e?vi(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>i?i.name===m.type.name:!0).find(m=>Sf(m.attrs,n,{strict:!1}));let o=0;const c=[];if(a.forEach(({$from:m,$to:x})=>{const y=m.pos,v=x.pos;t.doc.nodesBetween(y,v,(w,N)=>{if(i&&w.inlineContent&&!w.type.allowsMarkType(i))return!1;if(!w.isText&&!w.marks.length)return;const k=Math.max(y,N),E=Math.min(v,N+w.nodeSize),C=E-k;o+=C,c.push(...w.marks.map(L=>({mark:L,from:k,to:E})))})}),o===0)return!1;const u=c.filter(m=>i?i.name===m.mark.type.name:!0).filter(m=>Sf(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 ID(t,e,n={}){if(!e)return jo(t,null,n)||qg(t,null,n);const r=Tp(e,t.schema);return r==="node"?jo(t,e,n):r==="mark"?qg(t,e,n):!1}var RD=(t,e)=>{const{$from:n,$to:r,$anchor:a}=t.selection;if(e){const i=Ep(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 nw(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function sw(t,e){const{nodeExtensions:n}=Bc(e),r=n.find(o=>o.name===t);if(!r)return!1;const a={name:r.name,options:r.options,storage:r.storage},i=Wt(tt(r,"group",a));return typeof i!="string"?!1:i.split(" ").includes("list")}function Mp(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&&(Mp(i,{ignoreWhitespace:n,checkChildren:e})||(a=!1))}),a}return!1}function xC(t){return t instanceof rt}var gC=class yC{constructor(e){this.position=e}static fromJSON(e){return new yC(e.position)}toJSON(){return{position:this.position}}};function LD(t,e){const n=e.mapping.mapResult(t.position);return{position:new gC(n.pos),mapResult:n}}function OD(t){return new gC(t)}function DD(t,e,n){var r;const{selection:a}=e;let i=null;if(nC(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 y=!x||x.type.allowsMarkType(n),v=!!n.isInSet(f.marks)||!f.marks.some(w=>w.type.excludes(n));h=y&&v}return!h}),h})}var _D=(t,e={})=>({tr:n,state:r,dispatch:a})=>{const{selection:i}=n,{empty:o,ranges:c}=i,u=vi(t,r.schema);if(a)if(o){const h=iC(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,y)=>{const v=Math.max(y,f),w=Math.min(y+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 DD(r,n,u)},zD=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),$D=(t,e={})=>({state:n,dispatch:r,chain:a})=>{const i=Hn(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})=>mN(i,{...o,...e})(n)?!0:c.clearNodes()).command(({state:c})=>mN(i,{...o,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},FD=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,a=ul(t,0,r.content.size),i=rt.create(r,a);e.setSelection(i)}return!0},BD=(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},VD=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:a,to:i}=typeof t=="number"?{from:t,to:t}:t,o=at.atStart(r).from,c=at.atEnd(r).to,u=ul(a,o,c),h=ul(i,o,c),f=at.create(r,u,h);e.setSelection(f)}return!0},HD=t=>({state:e,dispatch:n})=>{const r=Hn(t,e.schema);return DL(r)(e,n)};function rw(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 UD=({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=Qh(h,c.node().type.name,c.node().attrs);if(i instanceof rt&&i.node.isBlock)return!c.parentOffset||!fi(o,c.pos)?!1:(r&&(t&&rw(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:yD(c.node(-1).contentMatchAt(c.indexAfter(-1)));let y=m&&x?[{type:x,attrs:f}]:void 0,v=fi(e.doc,e.mapping.map(c.pos),1,y);if(!y&&!v&&fi(e.doc,e.mapping.map(c.pos),1,x?[{type:x}]:void 0)&&(v=!0,y=x?[{type:x,attrs:f}]:void 0),r){if(v&&(i instanceof at&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,y),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&&rw(n,a.extensionManager.splittableMarks),e.scrollIntoView()}return v},WD=(t,e={})=>({tr:n,state:r,dispatch:a,editor:i})=>{var o;const c=Hn(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=ke.empty;const E=u.index(-1)?1:u.index(-2)?2:3;for(let H=u.depth-E;H>=u.depth-3;H-=1)k=ke.from(u.node(H).copy(k));const C=u.indexAfter(-1){if(_>-1)return!1;H.isTextblock&&H.content.size===0&&(_=P+1)}),_>-1&&n.setSelection(at.near(n.doc.resolve(_))),n.scrollIntoView()}return!0}const y=h.pos===u.end()?m.contentMatchAt(0).defaultType:null,v={...Qh(x,m.type.name,m.attrs),...e},w={...Qh(x,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,h.pos);const N=y?[{type:c,attrs:v},{type:y,attrs:w}]:[{type:c,attrs:v}];if(!fi(n.doc,u.pos,2))return!1;if(a){const{selection:k,storedMarks:E}=r,{splittableMarks:C}=i.extensionManager,L=E||k.$to.parentOffset&&k.$from.marks();if(n.split(u.pos,2,N).scrollIntoView(),!L||!a)return!0;const O=L.filter(K=>C.includes(K.type.name));n.ensureMarks(O)}return!0},Kx=(t,e)=>{const n=Ep(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)&&Mo(t.doc,n.pos)&&t.join(n.pos),!0},qx=(t,e)=>{const n=Ep(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)&&Mo(t.doc,r)&&t.join(r),!0},KD=(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,y=Hn(t,o.schema),v=Hn(e,o.schema),{selection:w,storedMarks:N}=o,{$from:k,$to:E}=w,C=k.blockRange(E),L=N||w.$to.parentOffset&&w.$from.marks();if(!C)return!1;const O=Ep(K=>sw(K.type.name,m))(w);if(C.depth>=1&&O&&C.depth-O.depth<=1){if(O.node.type===y)return h.liftListItem(v);if(sw(O.node.type.name,m)&&y.validContent(O.node.content)&&c)return u().command(()=>(i.setNodeMarkup(O.pos,y),!0)).command(()=>Kx(i,y)).command(()=>qx(i,y)).run()}return!n||!L||!c?u().command(()=>f().wrapInList(y,r)?!0:h.clearNodes()).wrapInList(y,r).command(()=>Kx(i,y)).command(()=>qx(i,y)).run():u().command(()=>{const K=f().wrapInList(y,r),_=L.filter(H=>x.includes(H.type.name));return i.ensureMarks(_),K?!0:h.clearNodes()}).wrapInList(y,r).command(()=>Kx(i,y)).command(()=>qx(i,y)).run()},qD=(t,e={},n={})=>({state:r,commands:a})=>{const{extendEmptyMarkRange:i=!1}=n,o=vi(t,r.schema);return qg(r,o,e)?a.unsetMark(o,{extendEmptyMarkRange:i}):a.setMark(o,e)},GD=(t,e,n={})=>({state:r,commands:a})=>{const i=Hn(t,r.schema),o=Hn(e,r.schema),c=jo(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})},JD=(t,e={})=>({state:n,commands:r})=>{const a=Hn(t,n.schema);return jo(n,a,e)?r.lift(a):r.wrapIn(a,e)},QD=()=>({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},YD=()=>({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},XD=(t,e={})=>({tr:n,state:r,dispatch:a})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:c}=n,u=vi(t,r.schema),{$from:h,empty:f,ranges:m}=c;if(!a)return!0;if(f&&o){let{from:x,to:y}=c;const v=(i=h.marks().find(N=>N.type===u))==null?void 0:i.attrs,w=hy(h,u,v);w&&(x=w.from,y=w.to),n.removeMark(x,y,u)}else m.forEach(x=>{n.removeMark(x.$from.pos,x.$to.pos,u)});return n.removeStoredMark(u),!0},ZD=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},e_=(t,e={})=>({tr:n,state:r,dispatch:a})=>{let i=null,o=null;const c=Tp(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(i=Hn(t,r.schema)),c==="mark"&&(o=vi(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;let x,y,v,w;n.selection.empty?r.doc.nodesBetween(f,m,(N,k)=>{i&&i===N.type&&(u=!0,v=Math.max(k,f),w=Math.min(k+N.nodeSize,m),x=k,y=N)}):r.doc.nodesBetween(f,m,(N,k)=>{k=f&&k<=m&&(i&&i===N.type&&(u=!0,a&&n.setNodeMarkup(k,void 0,{...N.attrs,...e})),o&&N.marks.length&&N.marks.forEach(E=>{if(o===E.type&&(u=!0,a)){const C=Math.max(k,f),L=Math.min(k+N.nodeSize,m);n.addMark(C,L,o.create({...E.attrs,...e}))}}))}),y&&(x!==void 0&&a&&n.setNodeMarkup(x,void 0,{...y.attrs,...e}),o&&y.marks.length&&y.marks.forEach(N=>{o===N.type&&a&&n.addMark(v,w,o.create({...N.attrs,...e}))}))}),u},t_=(t,e={})=>({state:n,dispatch:r})=>{const a=Hn(t,n.schema);return ML(a,e)(n,r)},n_=(t,e={})=>({state:n,dispatch:r})=>{const a=Hn(t,n.schema);return AL(a,e)(n,r)},s_=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={}}},Ap=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},r_=(t,e)=>{if(uy(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 Ph(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=AD(h)+i;return o.forEach(x=>{if(f)return;const y=r_(m,x.find);if(!y)return;const v=u.state.tr,w=Sp({state:u.state,transaction:v}),N={from:r-(y[0].length-i.length),to:a},{commands:k,chain:E,can:C}=new Cp({editor:n,state:w});x.handler({state:w,range:N,match:y,commands:k,chain:E,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 a_(t){const{editor:e,rules:n}=t,r=new un({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=py(ke.from(f),o.schema);const{from:m}=u,x=m+f.length;Ph({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 Ph({editor:e,from:i,to:o,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:a=>(setTimeout(()=>{const{$cursor:i}=a.state.selection;i&&Ph({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?Ph({editor:e,from:o.pos,to:o.pos,text:` -`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function i_(t){return Object.prototype.toString.call(t).slice(8,-1)}function Lh(t){return i_(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function bC(t,e){const n={...t};return Lh(t)&&Lh(e)&&Object.keys(e).forEach(r=>{Lh(e[r])&&Lh(t[r])?n[r]=bC(t[r],e[r]):n[r]=e[r]}),n}var xy=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{...Wt(tt(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Wt(tt(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>bC(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}},Ll=class vC extends xy{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new vC(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 o_(t){return typeof t=="number"}var l_=class{constructor(t){this.find=t.find,this.handler=t.handler}},c_=(t,e,n)=>{if(uy(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 d_(t){const{editor:e,state:n,from:r,to:a,rule:i,pasteEvent:o,dropEvent:c}=t,{commands:u,chain:h,can:f}=new Cp({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,a,(y,v)=>{var w,N,k,E,C;if((N=(w=y.type)==null?void 0:w.spec)!=null&&N.code||!(y.isText||y.isTextblock||y.isInline))return;const L=(C=(E=(k=y.content)==null?void 0:k.size)!=null?E:y.nodeSize)!=null?C:0,O=Math.max(r,v),K=Math.min(a,v+L);if(O>=K)return;const _=y.isText?y.text||"":y.textBetween(O-v,K-v,void 0,"");c_(_,i.find,o).forEach(P=>{if(P.index===void 0)return;const ee=O+P.index+1,Q=ee+P[0].length,V={from:n.tr.mapping.map(ee),to:n.tr.mapping.map(Q)},re=i.handler({state:n,range:V,match:P,commands:u,chain:h,can:f,pasteEvent:o,dropEvent:c});m.push(re)})}),m.every(y=>y!==null)}var Oh=null,u_=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function h_(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:y,pasteEvt:v})=>{const w=f.tr,N=Sp({state:f,transaction:w});if(!(!d_({editor:e,state:N,from:Math.max(m-1,0),to:x.b-1,rule:y,pasteEvent:v,dropEvent:c})||!w.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,w}};return n.map(f=>new un({view(m){const x=v=>{var w;r=(w=m.dom.parentElement)!=null&&w.contains(v.target)?m.dom.parentElement:null,r&&(Oh=e)},y=()=>{Oh&&(Oh=null)};return window.addEventListener("dragstart",x),window.addEventListener("dragend",y),{destroy(){window.removeEventListener("dragstart",x),window.removeEventListener("dragend",y)}}},props:{handleDOMEvents:{drop:(m,x)=>{if(i=r===m.dom.parentElement,c=x,!i){const y=Oh;y!=null&&y.isEditable&&setTimeout(()=>{const v=y.state.selection;v&&y.commands.deleteRange({from:v.from,to:v.to})},10)}return!1},paste:(m,x)=>{var y;const v=(y=x.clipboardData)==null?void 0:y.getData("text/html");return o=x,a=!!(v!=null&&v.includes("data-pm-slice")),!1}}},appendTransaction:(m,x,y)=>{const v=m[0],w=v.getMeta("uiEvent")==="paste"&&!a,N=v.getMeta("uiEvent")==="drop"&&!i,k=v.getMeta("applyPasteRules"),E=!!k;if(!w&&!N&&!E)return;if(E){let{text:O}=k;typeof O=="string"?O=O:O=py(ke.from(O),y.schema);const{from:K}=k,_=K+O.length,H=u_(O);return u({rule:f,state:y,from:K,to:{b:_},pasteEvt:H})}const C=x.doc.content.findDiffStart(y.doc.content),L=x.doc.content.findDiffEnd(y.doc.content);if(!(!o_(C)||!L||C===L.b))return u({rule:f,state:y,from:C,to:L,pasteEvt:o})}}))}var Ip=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=uC(t),this.schema=jD(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:Ad(e.name,this.schema)},r=tt(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return Kd([...this.extensions].reverse()).flatMap(r=>{const a={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Ad(r.name,this.schema)},i=[],o=tt(r,"addKeyboardShortcuts",a);let c={};if(r.type==="mark"&&tt(r,"exitable",a)&&(c.ArrowRight=()=>Ll.handleExit({editor:t,mark:r})),o){const x=Object.fromEntries(Object.entries(o()).map(([y,v])=>[y,()=>v({editor:t})]));c={...c,...x}}const u=C6(c);i.push(u);const h=tt(r,"addInputRules",a);if(nw(r,t.options.enableInputRules)&&h){const x=h();if(x&&x.length){const y=a_({editor:t,rules:x}),v=Array.isArray(y)?y:[y];i.push(...v)}}const f=tt(r,"addPasteRules",a);if(nw(r,t.options.enablePasteRules)&&f){const x=f();if(x&&x.length){const y=h_({editor:t,rules:x});i.push(...y)}}const m=tt(r,"addProseMirrorPlugins",a);if(m){const x=m();i.push(...x)}return i})}get attributes(){return dC(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Bc(this.extensions);return Object.fromEntries(e.filter(n=>!!tt(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:Hn(n.name,this.schema)},i=tt(n,"addNodeView",a);if(!i)return[];const o=i();if(!o)return[];const c=(u,h,f,m,x)=>{const y=du(u,r);return o({node:u,view:h,getPos:f,decorations:m,innerDecorations:x,editor:t,extension:n,HTMLAttributes:y})};return[n.name,c]}))}dispatchTransaction(t){const{editor:e}=this;return Kd([...this.extensions].reverse()).reduceRight((r,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:Ad(a.name,this.schema)},o=tt(a,"dispatchTransaction",i);return o?c=>{o.call(i,{transaction:c,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return Kd([...this.extensions]).reduce((r,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:Ad(a.name,this.schema)},o=tt(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}=Bc(this.extensions);return Object.fromEntries(e.filter(n=>!!tt(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:vi(n.name,this.schema)},i=tt(n,"addMarkView",a);if(!i)return[];const o=(c,u,h)=>{const f=du(c,r);return i()({mark:c,view:u,inline:h,editor:t,extension:n,HTMLAttributes:f,updateAttributes:m=>{T_(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:Ad(e.name,this.schema)};e.type==="mark"&&((n=Wt(tt(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const a=tt(e,"onBeforeCreate",r),i=tt(e,"onCreate",r),o=tt(e,"onUpdate",r),c=tt(e,"onSelectionUpdate",r),u=tt(e,"onTransaction",r),h=tt(e,"onFocus",r),f=tt(e,"onBlur",r),m=tt(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)})}};Ip.resolve=uC;Ip.sort=Kd;Ip.flatten=fy;var f_={};dy(f_,{ClipboardTextSerializer:()=>wC,Commands:()=>jC,Delete:()=>kC,Drop:()=>SC,Editable:()=>CC,FocusEvents:()=>EC,Keymap:()=>MC,Paste:()=>AC,Tabindex:()=>IC,TextDirection:()=>RC,focusEventsPluginKey:()=>TC});var Rn=class NC extends xy{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new NC(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},wC=Rn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new un({key:new bn("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=fC(n);return hC(r,{from:o,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),jC=Rn.create({name:"commands",addCommands(){return{...eC}}}),kC=Rn.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=oC(t.before,[t,...e]);mC(f).forEach(y=>{f.mapping.mapResult(y.oldRange.from).deletedAfter&&f.mapping.mapResult(y.oldRange.to).deletedBefore&&f.before.nodesBetween(y.oldRange.from,y.oldRange.to,(v,w)=>{const N=w+v.nodeSize-2,k=y.oldRange.from<=w&&N<=y.oldRange.to;this.editor.emit("delete",{type:"node",node:v,from:w,to:N,newFrom:f.mapping.map(w),newTo:f.mapping.map(N),deletedRange:y.oldRange,newRange:y.newRange,partial:!k,editor:this.editor,transaction:t,combinedTransform:f})})});const x=f.mapping;f.steps.forEach((y,v)=>{var w,N;if(y instanceof ra){const k=x.slice(v).map(y.from,-1),E=x.slice(v).map(y.to),C=x.invert().map(k,-1),L=x.invert().map(E),O=(w=f.doc.nodeAt(k-1))==null?void 0:w.marks.some(_=>_.eq(y.mark)),K=(N=f.doc.nodeAt(E))==null?void 0:N.marks.some(_=>_.eq(y.mark));this.editor.emit("delete",{type:"mark",mark:y.mark,from:y.from,to:y.to,deletedRange:{from:C,to:L},newRange:{from:k,to:E},partial:!!(K||O),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()}}),SC=Rn.create({name:"drop",addProseMirrorPlugins(){return[new un({key:new bn("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),CC=Rn.create({name:"editable",addProseMirrorPlugins(){return[new un({key:new bn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),TC=new bn("focusEvents"),EC=Rn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new un({key:TC,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}}}})]}}),MC=Rn.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:y}=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:ut.atStart(h).from===x;return!f||!y.type.isTextblock||y.textContent.length||!k||k&&m.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},a={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Cf()||aC()?i:a},addProseMirrorPlugins(){return[new un({key:new bn("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=ut.atStart(e.doc).from,h=ut.atEnd(e.doc).to;if(i||!(o===u&&c===h)||!Mp(n.doc))return;const x=n.tr,y=Sp({state:n,transaction:x}),{commands:v}=new Cp({editor:this.editor,state:y});if(v.clearNodes(),!!x.steps.length)return x}})]}}),AC=Rn.create({name:"paste",addProseMirrorPlugins(){return[new un({key:new bn("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),IC=Rn.create({name:"tabindex",addProseMirrorPlugins(){return[new un({key:new bn("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),RC=Rn.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Bc(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 un({key:new bn("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),p_=class Dd{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 Dd(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 Dd(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 Dd(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 Dd(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)}},m_=`.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 x_(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 g_=class extends s_{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:LD,createMappablePosition:OD},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=sC(e,this.options.autofocus);this.editorState=Cc.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=x_(m_,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=cC(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?[CC,wC.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),jC,EC,MC,IC,SC,AC,kC,RC.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 Ip(r,this)}createCommandManager(){this.commandManager=new Cp({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Kg(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=Kg(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 ZS(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 pC(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return ID(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return py(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=` - -`,textSerializers:n={}}=t||{};return SD(this.state.doc,{blockSeparator:e,textSerializers:{...fC(this.schema),...n}})}get isEmpty(){return Mp(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 p_(e,this)}get $doc(){return this.$pos(0)}};function Vc(t){return new Ap({find:t.find,handler:({state:e,range:n,match:r})=>{const a=Wt(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(my(n.from,n.to,e.doc).filter(y=>y.mark.type.excluded.find(w=>w===t.type&&w!==y.mark.type)).filter(y=>y.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 PC(t){return new Ap({find:t.find,handler:({state:e,range:n,match:r})=>{const a=Wt(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 Gg(t){return new Ap({find:t.find,handler:({state:e,range:n,match:r})=>{const a=e.doc.resolve(n.from),i=Wt(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 Hc(t){return new Ap({find:t.find,handler:({state:e,range:n,match:r,chain:a})=>{const i=Wt(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),u=o.doc.resolve(n.from).blockRange(),h=u&&K0(u,t.type,i);if(!h)return null;if(o.wrap(u,h),t.keepMarks&&t.editor){const{selection:m,storedMarks:x}=e,{splittableMarks:y}=t.editor.extensionManager,v=x||m.$to.parentOffset&&m.$from.marks();if(v){const w=v.filter(N=>y.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&&Mo(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,f))&&o.join(n.from-1)},undoable:t.undoable})}var y_=t=>"touches"in t,b_=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,y_(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 v_(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof rt){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 N_(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var w_={};dy(w_,{createAtomBlockMarkdownSpec:()=>j_,createBlockMarkdownSpec:()=>k_,createInlineMarkdownSpec:()=>LC,parseAttributes:()=>gy,parseIndentedBlocks:()=>Jg,renderNestedMarkdownContent:()=>by,serializeAttributes:()=>yy});function gy(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),y=n[x];y&&(e[h]=y.slice(1,-1))});const u=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return u&&u.split(/\s+/).filter(Boolean).forEach(f=>{f.match(/^[a-zA-Z][\w-]*$/)&&(e[f]=!0)}),e}function yy(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 j_(t){const{nodeName:e,name:n,parseAttributes:r=gy,serializeAttributes:a=yy,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"),y=(m=f.match(x))==null?void 0:m.index;return y!==void 0?y:-1},tokenize(f,m,x){const y=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),v=f.match(y);if(!v)return;const w=v[1]||"",N=r(w);if(!o.find(E=>!(E in N)))return{type:e,raw:v[0],attributes:N}}},renderMarkdown:f=>{const m=h(f.attrs||{}),x=a(m),y=x?` {${x}}`:"";return`:::${u}${y} :::`}}}function k_(t){const{nodeName:e,name:n,getContent:r,parseAttributes:a=gy,serializeAttributes:i=yy,defaultAttributes:o={},content:c="block",allowedAttributes:u}=t,h=n||e,f=m=>{if(!u)return m;const x={};return u.forEach(y=>{y in m&&(x[y]=m[y])}),x};return{parseMarkdown:(m,x)=>{let y;if(r){const w=r(m);y=typeof w=="string"?[{type:"text",text:w}]:w}else c==="block"?y=x.parseChildren(m.tokens||[]):y=x.parseInline(m.tokens||[]);const v={...o,...m.attributes};return x.createNode(e,v,y)},markdownTokenizer:{name:e,level:"block",start(m){var x;const y=new RegExp(`^:::${h}`,"m"),v=(x=m.match(y))==null?void 0:x.index;return v!==void 0?v:-1},tokenize(m,x,y){var v;const w=new RegExp(`^:::${h}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),N=m.match(w);if(!N)return;const[k,E=""]=N,C=a(E);let L=1;const O=k.length;let K="";const _=/^:::([\w-]*)(\s.*)?/gm,H=m.slice(O);for(_.lastIndex=0;;){const P=_.exec(H);if(P===null)break;const ee=P.index,Q=P[1];if(!((v=P[2])!=null&&v.endsWith(":::"))){if(Q)L+=1;else if(L-=1,L===0){const V=H.slice(0,ee);K=V.trim();const re=m.slice(0,O+ee+P[0].length);let ae=[];if(K)if(c==="block")for(ae=y.blockTokens(V),ae.forEach(pe=>{pe.text&&(!pe.tokens||pe.tokens.length===0)&&(pe.tokens=y.inlineTokens(pe.text))});ae.length>0;){const pe=ae[ae.length-1];if(pe.type==="paragraph"&&(!pe.text||pe.text.trim()===""))ae.pop();else break}else ae=y.inlineTokens(K);return{type:e,raw:re,attributes:C,content:K,tokens:ae}}}}}},renderMarkdown:(m,x)=>{const y=f(m.attrs||{}),v=i(y),w=v?` {${v}}`:"",N=x.renderChildren(m.content||[],` - -`);return`:::${h}${w} - -${N} - -:::`}}}function S_(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 C_(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function LC(t){const{nodeName:e,name:n,getContent:r,parseAttributes:a=S_,serializeAttributes:i=C_,defaultAttributes:o={},selfClosing:c=!1,allowedAttributes:u}=t,h=n||e,f=x=>{if(!u)return x;const y={};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;y[w]=k}}),y},m=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(x,y)=>{const v={...o,...x.attributes};if(c)return y.createNode(e,v);const w=r?r(x):x.content||"";return w?y.createNode(e,v,[y.createTextNode(w)]):y.createNode(e,v,[])},markdownTokenizer:{name:e,level:"inline",start(x){const y=c?new RegExp(`\\[${m}\\s*[^\\]]*\\]`):new RegExp(`\\[${m}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${m}\\]`),v=x.match(y),w=v==null?void 0:v.index;return w!==void 0?w:-1},tokenize(x,y,v){const w=c?new RegExp(`^\\[${m}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${m}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${m}\\]`),N=x.match(w);if(!N)return;let k="",E="";if(c){const[,L]=N;E=L}else{const[,L,O]=N;E=L,k=O||""}const C=a(E.trim());return{type:e,raw:N[0],content:k.trim(),attributes:C}}},renderMarkdown:x=>{let y="";r?y=r(x):x.content&&x.content.length>0&&(y=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}]${y}[/${h}]`}}}function Jg(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(y),{indentLevel:w,mainContent:N}=v;h=`${h}${x} -`;const k=[N];for(f+=1;fee.trim()!=="");if(_===-1)break;if((((a=(r=c[f+1+_].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:a.length)||0)>w){k.push(O),h=`${h}${O} -`,f+=1;continue}else break}if((((o=(i=O.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:o.length)||0)>w)k.push(O),h=`${h}${O} -`,f+=1;else break}let E;const C=k.slice(1);if(C.length>0){const O=C.map(K=>K.slice(w+m)).join(` -`);O.trim()&&(e.customNestedParser?E=e.customNestedParser(O):E=n.blockTokens(O))}const L=e.createToken(v,E);u.push(L)}if(u.length!==0)return{items:u,raw:h}}function by(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 T_(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(y=>{if(y!==o)return!1;m=y}),!m)return;let x=!1;if(Object.keys(n).forEach(y=>{n[y]!==m.attrs[y]&&(x=!0)}),x){const y=t.type.create({...t.attrs,...n});i.removeMark(h,f,t.type),i.addMark(h,f,y)}}),i.docChanged&&e.view.dispatch(i)}var $n=class OC extends xy{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new OC(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Tl(t){return new l_({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:a})=>{const i=Wt(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(my(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:E_,getOwnPropertySymbols:M_}=Object,{hasOwnProperty:A_}=Object.prototype;function Gx(t,e){return function(r,a,i){return t(r,a,i)&&e(r,a,i)}}function Dh(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 I_(t){return t!=null?t[Symbol.toStringTag]:void 0}function aw(t){return E_(t).concat(M_(t))}const R_=Object.hasOwn||((t,e)=>A_.call(t,e));function Ol(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const P_="__v",L_="__o",O_="_owner",{getOwnPropertyDescriptor:iw,keys:ow}=Object;function D_(t,e){return t.byteLength===e.byteLength&&Tf(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 z_(t,e){return t.byteLength===e.byteLength&&Tf(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function $_(t,e){return Ol(t.getTime(),e.getTime())}function F_(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function B_(t,e){return t===e}function lw(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,y=c.value;if(n.equals(x[0],y[0],u,m,t,e,n)&&n.equals(x[1],y[1],x[0],y[0],t,e,n)){f=a[m]=!0;break}m++}if(!f)return!1;u++}return!0}const V_=Ol;function H_(t,e,n){const r=ow(t);let a=r.length;if(ow(e).length!==a)return!1;for(;a-- >0;)if(!DC(t,e,n,r[a]))return!1;return!0}function Id(t,e,n){const r=aw(t);let a=r.length;if(aw(e).length!==a)return!1;let i,o,c;for(;a-- >0;)if(i=r[a],!DC(t,e,n,i)||(o=iw(t,i),c=iw(e,i),(o||c)&&(!o||!c||o.configurable!==c.configurable||o.enumerable!==c.enumerable||o.writable!==c.writable)))return!1;return!0}function U_(t,e){return Ol(t.valueOf(),e.valueOf())}function W_(t,e){return t.source===e.source&&t.flags===e.flags}function cw(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 Tf(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 K_(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 DC(t,e,n,r){return(r===O_||r===L_||r===P_)&&(t.$$typeof||e.$$typeof)?!0:R_(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const q_="[object ArrayBuffer]",G_="[object Arguments]",J_="[object Boolean]",Q_="[object DataView]",Y_="[object Date]",X_="[object Error]",Z_="[object Map]",e7="[object Number]",t7="[object Object]",n7="[object RegExp]",s7="[object Set]",r7="[object String]",a7={"[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},i7="[object URL]",o7=Object.prototype.toString;function l7({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:y,unknownTagComparators:v}){return function(N,k,E){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,E):C==="function"?i(N,k,E):!1;const L=N.constructor;if(L!==k.constructor)return!1;if(L===Object)return u(N,k,E);if(Array.isArray(N))return e(N,k,E);if(L===Date)return r(N,k,E);if(L===RegExp)return f(N,k,E);if(L===Map)return o(N,k,E);if(L===Set)return m(N,k,E);const O=o7.call(N);if(O===Y_)return r(N,k,E);if(O===n7)return f(N,k,E);if(O===Z_)return o(N,k,E);if(O===s7)return m(N,k,E);if(O===t7)return typeof N.then!="function"&&typeof k.then!="function"&&u(N,k,E);if(O===i7)return y(N,k,E);if(O===X_)return a(N,k,E);if(O===G_)return u(N,k,E);if(a7[O])return x(N,k,E);if(O===q_)return t(N,k,E);if(O===Q_)return n(N,k,E);if(O===J_||O===e7||O===r7)return h(N,k,E);if(v){let K=v[O];if(!K){const _=I_(N);_&&(K=v[_])}if(K)return K(N,k,E)}return!1}}function c7({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:D_,areArraysEqual:n?Id:__,areDataViewsEqual:z_,areDatesEqual:$_,areErrorsEqual:F_,areFunctionsEqual:B_,areMapsEqual:n?Gx(lw,Id):lw,areNumbersEqual:V_,areObjectsEqual:n?Id:H_,arePrimitiveWrappersEqual:U_,areRegExpsEqual:W_,areSetsEqual:n?Gx(cw,Id):cw,areTypedArraysEqual:n?Gx(Tf,Id):Tf,areUrlsEqual:K_,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const a=Dh(r.areArraysEqual),i=Dh(r.areMapsEqual),o=Dh(r.areObjectsEqual),c=Dh(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:a,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:c})}return r}function d7(t){return function(e,n,r,a,i,o,c){return t(e,n,c)}}function u7({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 h7=Io();Io({strict:!0});Io({circular:!0});Io({circular:!0,strict:!0});Io({createInternalComparator:()=>Ol});Io({strict:!0,createInternalComparator:()=>Ol});Io({circular:!0,createInternalComparator:()=>Ol});Io({circular:!0,createInternalComparator:()=>Ol,strict:!0});function Io(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:a=!1}=t,i=c7(t),o=l7(i),c=n?n(o):d7(o);return u7({circular:e,comparator:o,createState:r,equals:c,strict:a})}var Jx={exports:{}},Qx={};/** - * @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 dw;function f7(){if(dw)return Qx;dw=1;var t=mu(),e=S2();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 Qx.useSyncExternalStoreWithSelector=function(h,f,m,x,y){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(K){if(!E){if(E=!0,C=K,K=x(K),y!==void 0&&w.hasValue){var _=w.value;if(y(_,K))return L=_}return L=K}if(_=L,r(C,K))return _;var H=x(K);return y!==void 0&&y(_,H)?(C=K,_):(C=K,L=H)}var E=!1,C,L,O=m===void 0?null:m;return[function(){return k(f())},O===null?void 0:function(){return k(O())}]},[f,m,x,y]);var N=a(h,v[0],v[1]);return o(function(){w.hasValue=!0,w.value=N},[N]),u(N),N},Qx}var uw;function p7(){return uw||(uw=1,Jx.exports=f7()),Jx.exports}var m7=p7(),x7=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},g7=({contentComponent:t})=>{const e=C2.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return s.jsx(s.Fragment,{children:Object.values(e)})};function y7(){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]:Nj.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 b7=class extends _s.Component{constructor(t){var e;super(t),this.editorContentRef=_s.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=y7(),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:x7(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&s.jsx(g7,{contentComponent:t.contentComponent})]})}},v7=b.forwardRef((t,e)=>{const n=_s.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return _s.createElement(b7,{key:n,innerRef:e,...t})}),_C=_s.memo(v7),N7=typeof window<"u"?b.useLayoutEffect:b.useEffect,w7=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 j7(t){var e;const[n]=b.useState(()=>new w7(t.editor)),r=m7.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:h7);return N7(()=>n.watch(t.editor),[t.editor,n]),b.useDebugValue(r),r}var k7=!1,Qg=typeof window>"u",S7=Qg||!!(typeof window<"u"&&window.next),C7=class zC{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?Qg||S7?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 g_(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?zC.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 T7(t={},e=[]){const n=b.useRef(t);n.current=t;const[r]=b.useState(()=>new C7(n)),a=C2.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return b.useDebugValue(a),b.useEffect(r.onRender(e)),j7({editor:a,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),a}var $C=b.createContext({editor:null});$C.Consumer;var E7=b.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),M7=()=>b.useContext(E7);_s.forwardRef((t,e)=>{const{onDragStart:n}=M7(),r=t.as||"div";return s.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});_s.createContext({markViewContentRef:()=>{}});var vy=b.createContext({get editor(){throw new Error("useTiptap must be used within a provider")}});vy.displayName="TiptapContext";var A7=()=>b.useContext(vy);function FC({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=b.useMemo(()=>({editor:r}),[r]),i=b.useMemo(()=>({editor:r}),[r]);return s.jsx($C.Provider,{value:i,children:s.jsx(vy.Provider,{value:a,children:n})})}FC.displayName="Tiptap";function BC({...t}){const{editor:e}=A7();return s.jsx(_C,{editor:e,...t})}BC.displayName="Tiptap.Content";Object.assign(FC,{Content:BC});var Ef=(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]},I7=/^\s*>\s$/,R7=$n.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Ef("blockquote",{...Kt(this.options.HTMLAttributes,t),children:Ef("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[Hc({find:I7,type:this.type})]}}),P7=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,L7=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,O7=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,D7=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,_7=Ll.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 Ef("strong",{...Kt(this.options.HTMLAttributes,t),children:Ef("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[Vc({find:P7,type:this.type}),Vc({find:O7,type:this.type})]},addPasteRules(){return[Tl({find:L7,type:this.type}),Tl({find:D7,type:this.type})]}}),z7=/(^|[^`])`([^`]+)`(?!`)$/,$7=/(^|[^`])`([^`]+)`(?!`)/g,F7=Ll.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Kt(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[Vc({find:z7,type:this.type})]},addPasteRules(){return[Tl({find:$7,type:this.type})]}}),Yx=4,B7=/^```([a-z]+)?[\s\n]$/,V7=/^~~~([a-z]+)?[\s\n]$/,H7=$n.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Yx,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",Kt(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:Yx,{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,y=r.doc.textBetween(h,f,` -`,` -`).split(` -`).map(v=>c+v).join(` -`);return u.replaceWith(h,f,r.schema.text(y)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Yx,{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(),y=r.doc.textBetween(f,m,` -`,` -`).split(` -`);let v=0,w=0;const N=h-f;for(let K=0;K=N){v=K;break}w+=y[K].length+1}const E=((u=y[v].match(/^ */))==null?void 0:u[0])||"",C=Math.min(E.length,n);if(C===0)return!0;let L=f;for(let K=0;K{const{from:u,to:h}=a,x=r.doc.textBetween(u,h,` -`,` -`).split(` -`).map(y=>{var v;const w=((v=y.match(/^ */))==null?void 0:v[0])||"",N=Math.min(w.length,n);return y.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(ut.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[Gg({find:B7,type:this.type,getAttributes:t=>({language:t[1]})}),Gg({find:V7,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new un({key:new bn("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(at.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),U7=$n.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` - -`):""}),W7=$n.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Kt(this.options.HTMLAttributes,t)]},renderText(){return` -`},renderMarkdown:()=>` -`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:a,storedMarks:i}=n;if(a.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:c}=r.extensionManager,u=i||a.$to.parentOffset&&a.$from.marks();return e().insertContent({type:this.name}).command(({tr:h,dispatch:f})=>{if(f&&u&&o){const m=u.filter(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()}}}),K7=$n.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Kt(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,a="#".repeat(r);return t.content?`${a} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Gg({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),q7=$n.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Kt(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!v_(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,a=t();return xC(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(at.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(rt.create(o.doc,u.pos)):o.setSelection(at.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(at.create(o.doc,h+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[PC({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),G7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,J7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Q7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Y7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,X7=Ll.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Kt(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Vc({find:G7,type:this.type}),Vc({find:Q7,type:this.type})]},addPasteRules(){return[Tl({find:J7,type:this.type}),Tl({find:Y7,type:this.type})]}});const Z7="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",ez="ελ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",Yg="numeric",Xg="ascii",Zg="alpha",qd="asciinumeric",_d="alphanumeric",e0="domain",VC="emoji",tz="scheme",nz="slashscheme",Xx="whitespace";function sz(t,e){return t in e||(e[t]=[]),e[t]}function hl(t,e,n){e[Yg]&&(e[qd]=!0,e[_d]=!0),e[Xg]&&(e[qd]=!0,e[Zg]=!0),e[qd]&&(e[_d]=!0),e[Zg]&&(e[_d]=!0),e[_d]&&(e[e0]=!0),e[VC]&&(e[e0]=!0);for(const r in e){const a=sz(r,n);a.indexOf(t)<0&&a.push(t)}}function rz(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Xs(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Xs.groups={};Xs.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),En=(t,e,n,r,a)=>t.tr(e,n,r,a),hw=(t,e,n,r,a)=>t.ts(e,n,r,a),Le=(t,e,n,r,a)=>t.tt(e,n,r,a),ai="WORD",t0="UWORD",HC="ASCIINUMERICAL",UC="ALPHANUMERICAL",uu="LOCALHOST",n0="TLD",s0="UTLD",Yh="SCHEME",vc="SLASH_SCHEME",Ny="NUM",r0="WS",wy="NL",Gd="OPENBRACE",Jd="CLOSEBRACE",Mf="OPENBRACKET",Af="CLOSEBRACKET",If="OPENPAREN",Rf="CLOSEPAREN",Pf="OPENANGLEBRACKET",Lf="CLOSEANGLEBRACKET",Of="FULLWIDTHLEFTPAREN",Df="FULLWIDTHRIGHTPAREN",_f="LEFTCORNERBRACKET",zf="RIGHTCORNERBRACKET",$f="LEFTWHITECORNERBRACKET",Ff="RIGHTWHITECORNERBRACKET",Bf="FULLWIDTHLESSTHAN",Vf="FULLWIDTHGREATERTHAN",Hf="AMPERSAND",Uf="APOSTROPHE",Wf="ASTERISK",so="AT",Kf="BACKSLASH",qf="BACKTICK",Gf="CARET",io="COLON",jy="COMMA",Jf="DOLLAR",wa="DOT",Qf="EQUALS",ky="EXCLAMATION",Pr="HYPHEN",Qd="PERCENT",Yf="PIPE",Xf="PLUS",Zf="POUND",Yd="QUERY",Sy="QUOTE",WC="FULLWIDTHMIDDLEDOT",Cy="SEMI",ja="SLASH",Xd="TILDE",ep="UNDERSCORE",KC="EMOJI",tp="SYM";var qC=Object.freeze({__proto__:null,ALPHANUMERICAL:UC,AMPERSAND:Hf,APOSTROPHE:Uf,ASCIINUMERICAL:HC,ASTERISK:Wf,AT:so,BACKSLASH:Kf,BACKTICK:qf,CARET:Gf,CLOSEANGLEBRACKET:Lf,CLOSEBRACE:Jd,CLOSEBRACKET:Af,CLOSEPAREN:Rf,COLON:io,COMMA:jy,DOLLAR:Jf,DOT:wa,EMOJI:KC,EQUALS:Qf,EXCLAMATION:ky,FULLWIDTHGREATERTHAN:Vf,FULLWIDTHLEFTPAREN:Of,FULLWIDTHLESSTHAN:Bf,FULLWIDTHMIDDLEDOT:WC,FULLWIDTHRIGHTPAREN:Df,HYPHEN:Pr,LEFTCORNERBRACKET:_f,LEFTWHITECORNERBRACKET:$f,LOCALHOST:uu,NL:wy,NUM:Ny,OPENANGLEBRACKET:Pf,OPENBRACE:Gd,OPENBRACKET:Mf,OPENPAREN:If,PERCENT:Qd,PIPE:Yf,PLUS:Xf,POUND:Zf,QUERY:Yd,QUOTE:Sy,RIGHTCORNERBRACKET:zf,RIGHTWHITECORNERBRACKET:Ff,SCHEME:Yh,SEMI:Cy,SLASH:ja,SLASH_SCHEME:vc,SYM:tp,TILDE:Xd,TLD:n0,UNDERSCORE:ep,UTLD:s0,UWORD:t0,WORD:ai,WS:r0});const si=/[a-z]/,Rd=new RegExp("\\p{L}","u"),Zx=new RegExp("\\p{Emoji}","u"),ri=/\d/,eg=/\s/,fw="\r",tg=` -`,az="️",iz="‍",ng="";let _h=null,zh=null;function oz(t=[]){const e={};Xs.groups=e;const n=new Xs;_h==null&&(_h=pw(Z7)),zh==null&&(zh=pw(ez)),Le(n,"'",Uf),Le(n,"{",Gd),Le(n,"}",Jd),Le(n,"[",Mf),Le(n,"]",Af),Le(n,"(",If),Le(n,")",Rf),Le(n,"<",Pf),Le(n,">",Lf),Le(n,"(",Of),Le(n,")",Df),Le(n,"「",_f),Le(n,"」",zf),Le(n,"『",$f),Le(n,"』",Ff),Le(n,"<",Bf),Le(n,">",Vf),Le(n,"&",Hf),Le(n,"*",Wf),Le(n,"@",so),Le(n,"`",qf),Le(n,"^",Gf),Le(n,":",io),Le(n,",",jy),Le(n,"$",Jf),Le(n,".",wa),Le(n,"=",Qf),Le(n,"!",ky),Le(n,"-",Pr),Le(n,"%",Qd),Le(n,"|",Yf),Le(n,"+",Xf),Le(n,"#",Zf),Le(n,"?",Yd),Le(n,'"',Sy),Le(n,"/",ja),Le(n,";",Cy),Le(n,"~",Xd),Le(n,"_",ep),Le(n,"\\",Kf),Le(n,"・",WC);const r=En(n,ri,Ny,{[Yg]:!0});En(r,ri,r);const a=En(r,si,HC,{[qd]:!0}),i=En(r,Rd,UC,{[_d]:!0}),o=En(n,si,ai,{[Xg]:!0});En(o,ri,a),En(o,si,o),En(a,ri,a),En(a,si,a);const c=En(n,Rd,t0,{[Zg]:!0});En(c,si),En(c,ri,i),En(c,Rd,c),En(i,ri,i),En(i,si),En(i,Rd,i);const u=Le(n,tg,wy,{[Xx]:!0}),h=Le(n,fw,r0,{[Xx]:!0}),f=En(n,eg,r0,{[Xx]:!0});Le(n,ng,f),Le(h,tg,u),Le(h,ng,f),En(h,eg,f),Le(f,fw),Le(f,tg),En(f,eg,f),Le(f,ng,f);const m=En(n,Zx,KC,{[VC]:!0});Le(m,"#"),En(m,Zx,m),Le(m,az,m);const x=Le(m,iz);Le(x,"#"),En(x,Zx,m);const y=[[si,o],[ri,a]],v=[[si,null],[Rd,c],[ri,i]];for(let w=0;w<_h.length;w++)Xi(n,_h[w],n0,ai,y);for(let w=0;ww[0]>N[0]?1:-1);for(let w=0;w=0?E[e0]=!0:si.test(N)?ri.test(N)?E[qd]=!0:E[Xg]=!0:E[Yg]=!0,hw(n,N,N,E)}return hw(n,"localhost",uu,{ascii:!0}),n.jd=new Xs(tp),{start:n,tokens:Object.assign({groups:e},qC)}}function GC(t,e){const n=lz(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 lz(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 Xi(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 hu={defaultProtocol:"http",events:null,format:mw,formatHref:mw,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Ty(t,e=null){let n=Object.assign({},hu);t&&(n=Object.assign(n,t instanceof Ty?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=hu.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 Rp(t,e){class n extends JC{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 xw=Rp("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),gw=Rp("text"),cz=Rp("nl"),$h=Rp("url",{isLink:!0,toHref(t=hu.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==uu&&t[1].t===io}}),Rr=t=>new Xs(t);function dz({groups:t}){const e=t.domain.concat([Hf,Wf,so,Kf,qf,Gf,Jf,Qf,Pr,Ny,Qd,Yf,Xf,Zf,ja,tp,Xd,ep]),n=[Uf,io,jy,wa,ky,Qd,Yd,Sy,Cy,Pf,Lf,Gd,Jd,Af,Mf,If,Rf,Of,Df,_f,zf,$f,Ff,Bf,Vf],r=[Hf,Uf,Wf,Kf,qf,Gf,Jf,Qf,Pr,Gd,Jd,Qd,Yf,Xf,Zf,Yd,ja,tp,Xd,ep],a=Rr(),i=Le(a,Xd);wt(i,r,i),wt(i,t.domain,i);const o=Rr(),c=Rr(),u=Rr();wt(a,t.domain,o),wt(a,t.scheme,c),wt(a,t.slashscheme,u),wt(o,r,i),wt(o,t.domain,o);const h=Le(o,so);Le(i,so,h),Le(c,so,h),Le(u,so,h);const f=Le(i,wa);wt(f,r,i),wt(f,t.domain,i);const m=Rr();wt(h,t.domain,m),wt(m,t.domain,m);const x=Le(m,wa);wt(x,t.domain,m);const y=Rr(xw);wt(x,t.tld,y),wt(x,t.utld,y),Le(h,uu,y);const v=Le(m,Pr);Le(v,Pr,v),wt(v,t.domain,m),wt(y,t.domain,m),Le(y,wa,x),Le(y,Pr,v);const w=Le(y,io);wt(w,t.numeric,xw);const N=Le(o,Pr),k=Le(o,wa);Le(N,Pr,N),wt(N,t.domain,o),wt(k,r,i),wt(k,t.domain,o);const E=Rr($h);wt(k,t.tld,E),wt(k,t.utld,E),wt(E,t.domain,o),wt(E,r,i),Le(E,wa,k),Le(E,Pr,N),Le(E,so,h);const C=Le(E,io),L=Rr($h);wt(C,t.numeric,L);const O=Rr($h),K=Rr();wt(O,e,O),wt(O,n,K),wt(K,e,O),wt(K,n,K),Le(E,ja,O),Le(L,ja,O);const _=Le(c,io),H=Le(u,io),P=Le(H,ja),ee=Le(P,ja);wt(c,t.domain,o),Le(c,wa,k),Le(c,Pr,N),wt(u,t.domain,o),Le(u,wa,k),Le(u,Pr,N),wt(_,t.domain,O),Le(_,ja,O),Le(_,Yd,O),wt(ee,t.domain,O),wt(ee,e,O),Le(ee,ja,O);const Q=[[Gd,Jd],[Mf,Af],[If,Rf],[Pf,Lf],[Of,Df],[_f,zf],[$f,Ff],[Bf,Vf]];for(let V=0;V=0&&x++,a++,f++;if(x<0)a-=f,a0&&(i.push(sg(gw,e,o)),o=[]),a-=x,f-=x;const y=m.t,v=n.slice(a-f,a);i.push(sg(y,e,v))}}return o.length>0&&i.push(sg(gw,e,o)),i}function sg(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 hz=typeof console<"u"&&console&&console.warn||(()=>{}),fz="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 pz(){return Xs.groups={},mn.scanner=null,mn.parser=null,mn.tokenQueue=[],mn.pluginQueue=[],mn.customSchemes=[],mn.initialized=!1,mn}function yw(t,e=!1){if(mn.initialized&&hz(`linkifyjs: already initialized - will not register custom scheme "${t}" ${fz}`),!/^[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 mz(){mn.scanner=oz(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=oC(n.doc,[...e]);if(mC(c).forEach(({newRange:h})=>{const f=bD(r.doc,h,y=>y.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 y=r.doc.textBetween(h.from,h.to," "," ");if(!gz.test(y))return;m=f[0],x=r.doc.textBetween(m.pos,h.to,void 0," ")}if(m&&x){const y=x.split(xz).filter(Boolean);if(y.length<=0)return!1;const v=y[y.length-1],w=m.pos+x.lastIndexOf(v);if(!v)return!1;const N=Ey(v).map(k=>k.toObject(t.defaultProtocol));if(!bz(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=>{my(k.from,k.to,r.doc).some(E=>E.mark.type===t.type)||o.addMark(k.from,k.to,t.type.create({href:k.href}))})}}),!!o.steps.length)return o}})}function Nz(t){return new un({key:new bn("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=pC(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 wz(t){return new un({key:new bn("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=QC(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 rl(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(yz,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var jz=Ll.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"){yw(t);return}yw(t.scheme,t.optionalSlashes)})},onDestroy(){pz()},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)=>!!rl(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=>!!rl(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=>!!rl(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Kt(this.options.HTMLAttributes,t),0]:["a",Kt(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,a,i;const o=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",c=(i=(a=t.attrs)==null?void 0:a.title)!=null?i:"",u=e.renderChildren(t);return c?`[${u}](${o} "${c}")`:`[${u}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!rl(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=>!!rl(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[Tl({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,a=QC(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!rl(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(vz({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:a=>!!rl(a,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(Nz({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(wz({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),kz=Object.defineProperty,Sz=(t,e)=>{for(var n in e)kz(t,n,{get:e[n],enumerable:!0})},Cz="listItem",bw="textStyle",vw=/^\s*([-+*])\s$/,YC=$n.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Kt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` -`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Cz,this.editor.getAttributes(bw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Hc({find:vw,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Hc({find:vw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(bw),editor:this.editor})),[t]}}),XC=$n.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Kt(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)=>by(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)}}}),Tz={};Sz(Tz,{findListItemPos:()=>ju,getNextListDepth:()=>Ay,handleBackspace:()=>a0,handleDelete:()=>i0,hasListBefore:()=>ZC,hasListItemAfter:()=>Ez,hasListItemBefore:()=>e3,listItemHasSubList:()=>t3,nextListIsDeeper:()=>n3,nextListIsHigher:()=>s3});var ju=(t,e)=>{const{$from:n}=e.selection,r=Hn(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}},Ay=(t,e)=>{const n=ju(t,e);if(!n)return!1;const[,r]=MD(e,t,n.$pos.pos+4);return r},ZC=(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))},e3=(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)},t3=(t,e,n)=>{if(!n)return!1;const r=Hn(t,e.schema);let a=!1;return n.descendants(i=>{i.type===r&&(a=!0)}),a},a0=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!jo(t.state,e)&&ZC(t.state,e,n)){const{$anchor:c}=t.state.selection,u=t.state.doc.resolve(c.before()-1),h=[];u.node().descendants((x,y)=>{x.type.name===e&&h.push({node:x,pos:y})});const f=h.at(-1);if(!f)return!1;const m=t.state.doc.resolve(u.start()+f.pos+1);return t.chain().cut({from:c.start()-1,to:c.end()+1},m.end()).joinForward().run()}if(!jo(t.state,e)||!PD(t.state))return!1;const r=ju(e,t.state);if(!r)return!1;const i=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=t3(e,t.state,i);return e3(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},n3=(t,e)=>{const n=Ay(t,e),r=ju(t,e);return!r||!n?!1:n>r.depth},s3=(t,e)=>{const n=Ay(t,e),r=ju(t,e);return!r||!n?!1:n{if(!jo(t.state,e)||!RD(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:a}=n;return!n.empty&&r.sameParent(a)?!1:n3(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():s3(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},Ez=(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)},r3=Rn.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&&i0(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&&i0(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&&a0(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&&a0(t,n,r)&&(e=!0)}),e}}}}),Nw=/^(\s*)(\d+)\.\s+(.*)$/,Mz=/^\s/;function Az(t){const e=[];let n=0,r=0;for(;ne;)x.push(t[m]),m+=1;if(x.length>0){const y=Math.min(...x.map(w=>w.indent)),v=a3(x,y,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 Iz(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 Rz="listItem",ww="textStyle",jw=/^(\d+)\.\s$/,i3=$n.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",Kt(this.options.HTMLAttributes,n),0]:["ol",Kt(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?Iz(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]=Az(a);if(i.length===0)return;const c=a3(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(Rz,this.editor.getAttributes(ww)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Hc({find:jw,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=Hc({find:jw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(ww)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),Pz=/^\s*(\[([( |x])?\])\s$/,Lz=$n.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",Kt(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 by(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,y;c.ariaLabel=((y=(x=this.options.a11y)==null?void 0:x.checkboxLabel)==null?void 0:y.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:y})=>{const v=n();if(typeof v!="number")return!1;const w=y.doc.nodeAt(v);return y.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,y=du(m,x),v=new Set(Object.keys(y)),w=this.options.HTMLAttributes;return f.forEach(N=>{v.has(N)||(N in w?a.setAttribute(N,w[N]):a.removeAttribute(N))}),Object.entries(y).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[Hc({find:Pz,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Oz=$n.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",Kt(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=Jg(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=Jg(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()}}});Rn.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(YC.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(XC.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(r3.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(i3.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Lz.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Oz.configure(this.options.taskList)),t}});var kw=" ",Dz=" ",_z=$n.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Kt(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===kw||r[0].text===Dz)?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?kw:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),zz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,$z=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Fz=Ll.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",Kt(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[Vc({find:zz,type:this.type})]},addPasteRules(){return[Tl({find:$z,type:this.type})]}}),Bz=$n.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),Vz=Ll.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",Kt(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 Hz(t={}){return new un({view(e){return new Uz(e,t)}})}class Uz{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 y=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(y){let v=y.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,y=m.height/u.offsetHeight;h=m.left-u.scrollLeft*x,f=m.top-u.scrollTop*y}this.element.style.left=(r.left-h)/o+"px",this.element.style.top=(r.top-f)/c+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/c+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),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=Z2(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 An extends ut{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return An.valid(r)?new An(r):ut.near(r)}content(){return $e.empty}eq(e){return e instanceof An&&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 An(e.resolve(n.pos))}getBookmark(){return new Iy(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!Wz(e)||!Kz(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&&An.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(An.valid(u))return u}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!rt.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(An.valid(c))return c}return null}}}An.prototype.visible=!1;An.findFrom=An.findGapCursorFrom;ut.jsonID("gapcursor",An);class Iy{constructor(e){this.pos=e}map(e){return new Iy(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return An.valid(n)?new An(n):ut.near(n)}}function o3(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function Wz(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||o3(a.type))return!0;if(a.inlineContent)return!1}}return!0}function Kz(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||o3(a.type))return!0;if(a.inlineContent)return!1}}return!0}function qz(){return new un({props:{decorations:Yz,createSelectionBetween(t,e,n){return e.pos==n.pos&&An.valid(n)?new An(n):null},handleClick:Jz,handleKeyDown:Gz,handleDOMEvents:{beforeinput:Qz}}})}const Gz=cy({ArrowLeft:Fh("horiz",-1),ArrowRight:Fh("horiz",1),ArrowUp:Fh("vert",-1),ArrowDown:Fh("vert",1)});function Fh(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 at){if(!i.endOfTextblock(n)||c.depth==0)return!1;u=!1,c=r.doc.resolve(e>0?c.after():c.before())}let h=An.findGapCursorFrom(c,e,u);return h?(a&&a(r.tr.setSelection(new An(h))),!0):!1}}function Jz(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!An.valid(r))return!1;let a=t.posAtCoords({left:n.clientX,top:n.clientY});return a&&a.inside>-1&&rt.isSelectable(t.state.doc.nodeAt(a.inside))?!1:(t.dispatch(t.state.tr.setSelection(new An(r))),!0)}function Qz(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof An))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=ke.empty;for(let o=r.length-1;o>=0;o--)a=ke.from(r[o].createAndFill(null,a));let i=t.state.tr.replace(n.pos,n.pos,new $e(a,0,0));return i.setSelection(at.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function Yz(t){if(!(t.selection instanceof An))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",sn.create(t.doc,[Jn.widget(t.selection.head,e,{key:"gapcursor"})])}var np=200,rs=function(){};rs.prototype.append=function(e){return e.length?(e=rs.from(e),!this.length&&e||e.length=n?rs.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};rs.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};rs.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)};rs.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};rs.from=function(e){return e instanceof rs?e:e&&e.length?new l3(e):rs.empty};var l3=(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<=np)return new e(this.values.concat(a.flatten()))},e.prototype.leafPrepend=function(a){if(this.length+a.length<=np)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})(rs);rs.empty=new l3([]);var Xz=(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})(rs);const Zz=500;class sa{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 Zi(m.map));let y=m.step.map(a.slice(i)),v;y&&o.maybeStep(y).doc&&(v=o.mapping.maps[o.mapping.maps.length-1],h.push(new Zi(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 sa(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;ft$&&(c=e$(c,h),o-=h),new sa(c.append(i),o)}remapping(e,n){let r=new ru;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 sa(this.items.append(e.map(n=>new Zi(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 y=i.getMirror(--u);if(y==null)return;o=Math.min(o,y);let v=i.maps[y];if(x.step){let w=e.steps[y].invert(e.docs[y]),N=x.selection&&x.selection.map(i.slice(u+1,y));N&&c++,r.push(new Zi(v,w,N))}else r.push(new Zi(v))},a);let h=[];for(let x=n;xZz&&(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 Zi(h.invert(),u,f),x,y=a.length-1;(x=a.length&&a[y].merge(m))?a[y]=x:a.push(m)}}else o.map&&r--},this.items.length,0),new sa(rs.from(a.reverse()),i)}}sa.empty=new sa(rs.empty,0);function e$(t,e){let n;return t.forEach((r,a)=>{if(r.selection&&e--==0)return n=a,!1}),t.slice(n)}let Zi=class c3{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 c3(n.getMap().invert(),n,this.selection)}}};class ro{constructor(e,n,r,a,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=a,this.prevComposition=i}}const t$=20;function n$(t,e,n,r){let a=n.getMeta(gl),i;if(a)return a.historyState;n.getMeta(a$)&&(t=new ro(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(gl))return o.getMeta(gl).redo?new ro(t.done.addTransform(n,void 0,r,Xh(e)),t.undone,Sw(n.mapping.maps),t.prevTime,t.prevComposition):new ro(t.done,t.undone.addTransform(n,void 0,r,Xh(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||!s$(n,t.prevRanges)),h=o?rg(t.prevRanges,n.mapping):Sw(n.mapping.maps);return new ro(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,Xh(e)),sa.empty,h,n.time,c??t.prevComposition)}else return(i=n.getMeta("rebased"))?new ro(t.done.rebased(n,i),t.undone.rebased(n,i),rg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new ro(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),rg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function s$(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 Sw(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 rg(t,e){if(!t)return null;let n=[];for(let r=0;r{let a=gl.getState(n);if(!a||(t?a.undone:a.done).eventCount==0)return!1;if(r){let i=r$(a,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const u3=d3(!1,!0),h3=d3(!0,!0);Rn.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 un({key:new bn("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 o$=Rn.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Hz(this.options)]}});Rn.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new un({key:new bn("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:a}=e,i=[];if(!n||!r)return sn.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(Jn.node(h,h+u.nodeSize,{class:this.options.className}))}),sn.create(t,i)}}})]}});var l$=Rn.create({name:"gapCursor",addProseMirrorPlugins(){return[qz()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Wt(tt(t,"allowGapCursor",n)))!=null?e:null}}}),Tw="placeholder";function c$(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var d$=Rn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Tw,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${c$(this.options.dataAttribute)}`:`data-${Tw}`;return[new un({key:new bn("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&&Mp(c);if((h||!this.options.showOnlyCurrent)&&f){const m=[this.options.emptyNodeClass];o&&m.push(this.options.emptyEditorClass);const x=Jn.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}),sn.create(e,i)}}})]}});Rn.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new un({key:new bn("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||xC(n.selection)||t.view.dragging?null:sn.create(n.doc,[Jn.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Ew({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var u$=Rn.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new bn(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 un({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!Ew({node:o,types:r})},apply:(a,i)=>{if(!a.docChanged||a.getMeta("__uniqueIDTransaction"))return i;const o=a.doc.lastChild;return!Ew({node:o,types:r})}}})]}}),h$=Rn.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>u3(t,e),redo:()=>({state:t,dispatch:e})=>h3(t,e)}},addProseMirrorPlugins(){return[i$(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()}}}),f$=Rn.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(R7.configure(this.options.blockquote)),this.options.bulletList!==!1&&a.push(YC.configure(this.options.bulletList)),this.options.code!==!1&&a.push(F7.configure(this.options.code)),this.options.codeBlock!==!1&&a.push(H7.configure(this.options.codeBlock)),this.options.document!==!1&&a.push(U7.configure(this.options.document)),this.options.dropcursor!==!1&&a.push(o$.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&a.push(l$.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&a.push(W7.configure(this.options.hardBreak)),this.options.heading!==!1&&a.push(K7.configure(this.options.heading)),this.options.undoRedo!==!1&&a.push(h$.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&a.push(q7.configure(this.options.horizontalRule)),this.options.italic!==!1&&a.push(X7.configure(this.options.italic)),this.options.listItem!==!1&&a.push(XC.configure(this.options.listItem)),this.options.listKeymap!==!1&&a.push(r3.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&a.push(jz.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&a.push(i3.configure(this.options.orderedList)),this.options.paragraph!==!1&&a.push(_z.configure(this.options.paragraph)),this.options.strike!==!1&&a.push(Fz.configure(this.options.strike)),this.options.text!==!1&&a.push(Bz.configure(this.options.text)),this.options.underline!==!1&&a.push(Vz.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&a.push(u$.configure((r=this.options)==null?void 0:r.trailingNode)),a}}),p$=f$,m$=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,x$=$n.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",Kt(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 b_({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 y=i();y!==void 0&&this.editor.chain().setNodeSelection(y).updateAttributes(this.name,{width:m,height:x}).run()},onUpdate:(m,x,y)=>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[PC({find:m$,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),g$=x$;function y$(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:o,$position:c}=t,u=r&&!a,h=N_(n),f=new RegExp(`\\s${h}$`),m=o?"^":"",x=a?"":h,y=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(y)).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),E=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(k);if(i!==null&&!E)return null;const C=w+N.index;let L=C+N[0].length;return u&&f.test(v.slice(L-1,L+1))&&(N[0]+=" ",L+=1),C=c.pos?{range:{from:C,to:L},query:N[0].slice(n.length),text:N[0]}:null}var b$=new bn("suggestion");function v$({pluginKey:t=b$,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:y=()=>({}),allow:v=()=>!0,findSuggestionMatch:w=y$,shouldShow:N}){let k;const E=y==null?void 0:y(),C=()=>{const _=e.state.selection.$anchor.pos,H=e.view.coordsAtPos(_),{top:P,right:ee,bottom:Q,left:V}=H;try{return new DOMRect(V,P,ee-V,Q-P)}catch{return null}},L=(_,H)=>H?()=>{const P=t.getState(e.state),ee=P==null?void 0:P.decorationId,Q=_.dom.querySelector(`[data-decoration-id="${ee}"]`);return(Q==null?void 0:Q.getBoundingClientRect())||null}:C;function O(_,H){var P;try{const Q=t.getState(_.state),V=Q!=null&&Q.decorationId?_.dom.querySelector(`[data-decoration-id="${Q.decorationId}"]`):null,re={editor:e,range:(Q==null?void 0:Q.range)||{from:0,to:0},query:(Q==null?void 0:Q.query)||null,text:(Q==null?void 0:Q.text)||null,items:[],command:ae=>m({editor:e,range:(Q==null?void 0:Q.range)||{from:0,to:0},props:ae}),decorationNode:V,clientRect:L(_,V)};(P=E==null?void 0:E.onExit)==null||P.call(E,re)}catch{}const ee=_.state.tr.setMeta(H,{exit:!0});_.dispatch(ee)}const K=new un({key:t,view(){return{update:async(_,H)=>{var P,ee,Q,V,re,ae,pe;const I=(P=this.key)==null?void 0:P.getState(H),z=(ee=this.key)==null?void 0:ee.getState(_.state),R=I.active&&z.active&&I.range.from!==z.range.from,ie=!I.active&&z.active,q=I.active&&!z.active,$=!ie&&!q&&I.query!==z.query,U=ie||R&&$,ce=$||R,ue=q||R&&$;if(!U&&!ce&&!ue)return;const oe=ue&&!U?I:z,F=_.dom.querySelector(`[data-decoration-id="${oe.decorationId}"]`);k={editor:e,range:oe.range,query:oe.query,text:oe.text,items:[],command:G=>m({editor:e,range:oe.range,props:G}),decorationNode:F,clientRect:L(_,F)},U&&((Q=E==null?void 0:E.onBeforeStart)==null||Q.call(E,k)),ce&&((V=E==null?void 0:E.onBeforeUpdate)==null||V.call(E,k)),(ce||U)&&(k.items=await x({editor:e,query:oe.query})),ue&&((re=E==null?void 0:E.onExit)==null||re.call(E,k)),ce&&((ae=E==null?void 0:E.onUpdate)==null||ae.call(E,k)),U&&((pe=E==null?void 0:E.onStart)==null||pe.call(E,k))},destroy:()=>{var _;k&&((_=E==null?void 0:E.onExit)==null||_.call(E,k))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(_,H,P,ee){const{isEditable:Q}=e,{composing:V}=e.view,{selection:re}=_,{empty:ae,from:pe}=re,I={...H},z=_.getMeta(t);if(z&&z.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,Q&&(ae||e.view.composing)){(peH.range.to)&&!V&&!H.composing&&(I.active=!1);const R=w({char:n,allowSpaces:r,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:o,$position:re.$from}),ie=`id_${Math.floor(Math.random()*4294967295)}`;R&&v({editor:e,state:ee,range:R.range,isActive:H.active})&&(!N||N({editor:e,range:R.range,query:R.query,text:R.text,transaction:_}))?(I.active=!0,I.decorationId=H.decorationId?H.decorationId:ie,I.range=R.range,I.query=R.query,I.text=R.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 P,ee,Q,V;const{active:re,range:ae}=K.getState(_.state);if(!re)return!1;if(H.key==="Escape"||H.key==="Esc"){const I=K.getState(_.state),z=(P=k==null?void 0:k.decorationNode)!=null?P:null,R=z??(I!=null&&I.decorationId?_.dom.querySelector(`[data-decoration-id="${I.decorationId}"]`):null);if(((ee=E==null?void 0:E.onKeyDown)==null?void 0:ee.call(E,{view:_,event:H,range:I.range}))||!1)return!0;const q={editor:e,range:I.range,query:I.query,text:I.text,items:[],command:$=>m({editor:e,range:I.range,props:$}),decorationNode:R,clientRect:R?()=>R.getBoundingClientRect()||null:null};return(Q=E==null?void 0:E.onExit)==null||Q.call(E,q),O(_,t),!0}return((V=E==null?void 0:E.onKeyDown)==null?void 0:V.call(E,{view:_,event:H,range:ae}))||!1},decorations(_){const{active:H,range:P,decorationId:ee,query:Q}=K.getState(_);if(!H)return null;const V=!(Q!=null&&Q.length),re=[u];return V&&re.push(f),sn.create(_.doc,[Jn.inline(P.from,P.to,{nodeName:c,class:re.join(" "),"data-decoration-id":ee,"data-decoration-content":h})])}}});return K}function N$({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const a=new bn;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 f3(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>N$({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function Mw(t,e){const n=f3(t),r=n.find(a=>a.char===e);return r||(n.length?n[0]:null)}var w$=$n.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",Kt(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=Mw(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Kt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=Kt({"data-type":this.name},this.options.HTMLAttributes,e);const a=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof a=="string"?["span",Kt({"data-type":this.name},this.options.HTMLAttributes,e),a]:a},...LC({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:Mw(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 hi,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 f3(this).map(v$)}}),j$=w$,k$=d$;let o0,l0;if(typeof WeakMap<"u"){let t=new WeakMap;o0=e=>t.get(e),l0=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;o0=r=>{for(let a=0;a(n==10&&(n=0),t[n++]=r,t[n++]=a)}var In=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 L=a+C*e;for(let O=0;Or&&(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 T$(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 M$(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 la(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 Pp(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=El(e.$head)||A$(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function A$(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 c0(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function I$(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Ry(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function p3(t,e,n){const r=t.node(-1),a=In.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 Ml(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 m3(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 rS(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(c0(r)&&c0(a)&&Ry(r,a)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?ii.rowSelection(r,a):i&&this.isColSelection()?ii.colSelection(r,a):new ii(r,a)}return at.between(r,a)}content(){const e=this.$anchorCell.node(-1),n=In.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=Ml(k,0,w)),N>0&&(k=Ml(k,k.colspan-N,N)),y.lefta.bottom){const k={...v.attrs,rowspan:Math.min(y.bottom,a.bottom)-Math.max(y.top,a.top)};y.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=In.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 ii&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),a=In.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(Jn.node(r,r+n.nodeSize,{class:"selectedCell"}))}),sn.create(t.doc,e)}function O$({$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 D$({$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 rt&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")i=dn.create(a,r.from);else if(o=="row"){const c=a.resolve(r.from+1);i=dn.rowSelection(c,c)}else if(!n){const c=In.get(r.node),u=r.from+1,h=u+c.map[c.width*c.height-1];i=dn.create(a,u+1,h)}}else r instanceof at&&O$(r)?i=at.create(a,r.from):r instanceof at&&D$(r)&&(i=at.create(a,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}const z$=new bn("fix-tables");function g3(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=$$(t,a,i,n))};return e?e.doc!=t.doc&&g3(e.doc,t.doc,0,r):t.doc.descendants(r),n}function $$(t,e,n,r){const a=In.get(e);if(!a.problems)return r;r||(r=t.tr);const i=[];for(let u=0;u0){let y="cell";f.firstChild&&(y=f.firstChild.type.spec.tableRole);const v=[];for(let N=0;N0?-1:0;R$(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;U$(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=Aw(h)?u+1:f;i.replaceWith(m+r.tableStart,f+r.tableStart,c)}i.setSelection(new dn(i.doc.resolve(u+r.tableStart))),e(i)}return!0}function Rw(t,e){const n=Ts(t.schema);return Q$(({node:r})=>n[r.type.spec.tableRole])(t,e)}function Q$(t){return(e,n)=>{const r=e.selection;let a,i;if(r instanceof dn){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;a=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{var o;if(a=M$(r.$from),!a)return!1;i=(o=El(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=Pa(e),m=e.tr;for(let y=0;y{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 X$(t){return function(e,n){if(!la(e))return!1;if(n){const r=Ts(e.schema),a=Pa(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 y=x+i.tableStart,v=o.doc.nodeAt(y);v&&o.setNodeMarkup(y,m,v.attrs)}),r(o)}return!0}}fu("row",{useDeprecatedLogic:!0});fu("column",{useDeprecatedLogic:!0});const Z$=fu("cell",{useDeprecatedLogic:!0});function eF(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 Bh(t,e){const n=t.selection;if(!(n instanceof dn))return!1;if(e){const r=t.tr,a=Ts(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 $e(a,0,0))}),r.docChanged&&e(r)}return!0}function nF(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(ke.empty),n[a]r&&(x=x.type.createChecked(Ml(x.attrs,x.attrs.colspan,f+x.attrs.colspan-r),x.content)),h.push(x),f+=x.attrs.colspan;for(let y=1;ya&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,a-m.attrs.rowspan)},m.content)),u.push(m)}i.push(ke.from(u))}n=i,e=a}return{width:t,height:e,rows:n}}function aF(t,e,n,r,a,i,o){const c=t.doc.type.schema,u=Ts(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,ke.from(m)),y=[];for(let v=e.height;v{if(!a)return!1;const i=n.selection;if(i instanceof dn)return Zh(n,r,ut.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const o=N3(a,t,e);if(o==null)return!1;if(t=="horiz")return Zh(n,r,ut.near(n.doc.resolve(i.head+e),e));{const c=n.doc.resolve(o),u=p3(c,t,e);let h;return u?h=ut.near(u,1):e<0?h=ut.near(n.doc.resolve(c.before(-1)),-1):h=ut.near(n.doc.resolve(c.after(-1)),1),Zh(n,r,h)}}}function Hh(t,e){return(n,r,a)=>{if(!a)return!1;const i=n.selection;let o;if(i instanceof dn)o=i;else{const u=N3(a,t,e);if(u==null)return!1;o=new dn(n.doc.resolve(u))}const c=p3(o.$headCell,t,e);return c?Zh(n,r,new dn(o.$anchorCell,c)):!1}}function oF(t,e){const n=t.state.doc,r=El(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new dn(r))),!0):!1}function lF(t,e,n){if(!la(t.state))return!1;let r=nF(n);const a=t.state.selection;if(a instanceof dn){r||(r={width:1,height:1,rows:[ke.from(d0(Ts(t.state.schema).cell,n))]});const i=a.$anchorCell.node(-1),o=a.$anchorCell.start(-1),c=In.get(i).rectBetween(a.$anchorCell.pos-o,a.$headCell.pos-o);return r=rF(r,c.right-c.left,c.bottom-c.top),_w(t.state,t.dispatch,o,c,r),!0}else if(r){const i=Pp(t.state),o=i.start(-1);return _w(t.state,t.dispatch,o,In.get(i.node(-1)).findCell(i.pos-o),r),!0}else return!1}function cF(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=zw(t,e.target);let a;if(e.shiftKey&&t.state.selection instanceof dn)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(a=El(t.state.selection.$anchor))!=null&&((n=ig(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=ig(t,h);const m=oo.getState(t.state)==null;if(!f||!Ry(u,f))if(m)f=u;else return;const x=new dn(u,f);if(m||!t.state.selection.eq(x)){const y=t.state.tr.setSelection(x);m&&y.setMeta(oo,u.pos),t.dispatch(y)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",c),oo.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(oo,-1))}function c(u){const h=u,f=oo.getState(t.state);let m;if(f!=null)m=t.state.doc.resolve(f);else if(zw(t,h.target)!=r&&(m=ig(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 N3(t,e,n){if(!(t.state.selection instanceof at))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 zw(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function ig(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&&El(t.state.doc.resolve(r))||El(t.state.doc.resolve(a))}var dF=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")),u0(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,u0(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function u0(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 hF(-1,!1)},apply(o,c){return c.apply(o)}},props:{attributes:o=>{const c=fr.getState(o);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,c)=>{fF(o,c,t,a)},mouseleave:o=>{pF(o)},mousedown:(o,c)=>{mF(o,c,e,n)}},decorations:o=>{const c=fr.getState(o);if(c&&c.activeHandle>-1)return vF(o,c.activeHandle)},nodeViews:{}}});return i}var hF=class ef{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(fr);if(r&&r.setHandle!=null)return new ef(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new ef(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let a=e.mapping.map(n.activeHandle,-1);return c0(e.doc.resolve(a))||(a=-1),new ef(a,n.dragging)}return n}};function fF(t,e,n,r){if(!t.editable)return;const a=fr.getState(t.state);if(a&&!a.dragging){const i=gF(e.target);let o=-1;if(i){const{left:c,right:u}=i.getBoundingClientRect();e.clientX-c<=n?o=$w(t,e,"left",n):u-e.clientX<=n&&(o=$w(t,e,"right",n))}if(o!=a.activeHandle){if(!r&&o!==-1){const c=t.state.doc.resolve(o),u=c.node(-1),h=In.get(u),f=c.start(-1);if(h.colCount(c.pos-f)+c.nodeAfter.attrs.colspan-1==h.width-1)return}w3(t,o)}}}function pF(t){if(!t.editable)return;const e=fr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&w3(t,-1)}function mF(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=fr.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const c=t.state.doc.nodeAt(o.activeHandle),u=xF(t,o.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta(fr,{setDragging:{startX:e.clientX,startWidth:u}}));function h(m){i.removeEventListener("mouseup",h),i.removeEventListener("mousemove",f);const x=fr.getState(t.state);x!=null&&x.dragging&&(yF(t,x.activeHandle,Fw(x.dragging,m,n)),t.dispatch(t.state.tr.setMeta(fr,{setDragging:null})))}function f(m){if(!m.which)return h(m);const x=fr.getState(t.state);if(x&&x.dragging){const y=Fw(x.dragging,m,n);Bw(t,x.activeHandle,y,r)}}return Bw(t,o.activeHandle,u,r),i.addEventListener("mouseup",h),i.addEventListener("mousemove",f),e.preventDefault(),!0}function xF(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",Kt(this.options.HTMLAttributes,t),0]}}),k3=$n.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",Kt(this.options.HTMLAttributes,t),0]}}),S3=$n.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Kt(this.options.HTMLAttributes,t),0]}});function h0(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Vw(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,y=0;x{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function SF(t,e,n,r,a){const i=kF(t),o=[],c=[];for(let h=0;h{const{selection:e}=t.state;if(!CF(e))return!1;let n=0;const r=lC(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},TF="";function EF(t){return(t||"").replace(/\s+/g," ").trim()}function MF(t,e,n={}){var r;const a=(r=n.cellLineSeparator)!=null?r:TF;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(O=>e.renderChildren(O)).join(a):k=N.content?e.renderChildren(N.content):"";const E=EF(k),C=N.type==="tableHeader";w.push({text:E,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]=E),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 AF=MF,C3=$n.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:wF,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}=jF(t,this.options.cellMinWidth),i=e.style;function o(){return i||(r?`width: ${r}`:`min-width: ${a}`)}const c=["table",Kt(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)=>AF(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:a,editor:i})=>{const o=SF(i.schema,t,e,n);if(a){const c=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(at.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>F$(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>B$(t,e),deleteColumn:()=>({state:t,dispatch:e})=>H$(t,e),addRowBefore:()=>({state:t,dispatch:e})=>W$(t,e),addRowAfter:()=>({state:t,dispatch:e})=>K$(t,e),deleteRow:()=>({state:t,dispatch:e})=>G$(t,e),deleteTable:()=>({state:t,dispatch:e})=>tF(t,e),mergeCells:()=>({state:t,dispatch:e})=>Iw(t,e),splitCell:()=>({state:t,dispatch:e})=>Rw(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>fu("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>fu("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>Z$(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Iw(t,e)?!0:Rw(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>Y$(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Lw(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Lw(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&y3(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=dn.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:Uh,"Mod-Backspace":Uh,Delete:Uh,"Mod-Delete":Uh}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[uF({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],NF({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:Wt(tt(t,"tableRole",e))}}});Rn.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(C3.configure(this.options.table)),this.options.tableCell!==!1&&t.push(j3.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(k3.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(S3.configure(this.options.tableRow)),t}});function IF(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function RF(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}function PF(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 Uw(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 LF=$n.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 端全宽播放)"]]}}),OF=$n.create({name:"linkTag",group:"inline",inline:!0,selectable:!0,atom:!0,addAttributes(){return{label:{default:""},url:{default:""},tagType:{default:"url",parseHTML:t=>t.getAttribute("data-tag-type")||"url"},tagId:{default:"",parseHTML:t=>t.getAttribute("data-tag-id")||""},pagePath:{default:"",parseHTML:t=>t.getAttribute("data-page-path")||""},appId:{default:"",parseHTML:t=>t.getAttribute("data-app-id")||""},mpKey:{default:"",parseHTML:t=>t.getAttribute("data-mp-key")||""}}},parseHTML(){return[{tag:'span[data-type="linkTag"]',getAttrs:t=>{var e;return{label:((e=t.textContent)==null?void 0:e.replace(/^#/,"").trim())||"",url:t.getAttribute("data-url")||"",tagType:t.getAttribute("data-tag-type")||"url",tagId:t.getAttribute("data-tag-id")||"",pagePath:t.getAttribute("data-page-path")||"",appId:t.getAttribute("data-app-id")||"",mpKey:t.getAttribute("data-mp-key")||""}}}]},renderHTML({node:t,HTMLAttributes:e}){return["span",Kt(e,{"data-type":"linkTag","data-url":t.attrs.url,"data-tag-type":t.attrs.tagType,"data-tag-id":t.attrs.tagId,"data-page-path":t.attrs.pagePath,"data-app-id":t.attrs.appId||"","data-mp-key":t.attrs.mpKey||t.attrs.appId||"",class:"link-tag-node"}),`#${t.attrs.label}`]}});function Ww(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}const DF=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)=>`
    - @${Ww(o.name)} - ${Ww(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=b.useRef(null),f=b.useRef(null),m=b.useRef(null),x=b.useRef(null),[y,v]=b.useState(""),[w,N]=b.useState(!1),k=b.useRef(Uw(t)),E=b.useCallback((Q,V)=>{var I;const re=x.current;if(!re||!n)return!1;const ae=_F(V);if(ae.length>0)return V.preventDefault(),(async()=>{for(const z of ae)try{const R=await n(z);R&&re.chain().focus().setImage({src:R}).run()}catch(R){console.error("粘贴图片上传失败",R)}})(),!0;const pe=(I=V.clipboardData)==null?void 0:I.getData("text/html");if(pe&&/data:image\/[^;"']+;base64,/i.test(pe)){V.preventDefault();const{from:z,to:R}=re.state.selection;return(async()=>{try{const ie=await FF(pe,n);re.chain().focus().insertContentAt({from:z,to:R},ie).run()}catch(ie){console.error("粘贴 HTML 内 base64 转换失败",ie)}})(),!0}return!1},[n]),C=T7({extensions:[p$.configure({link:{openOnClick:!1,HTMLAttributes:{class:"rich-link"}}}),g$.configure({inline:!0,allowBase64:!0,HTMLAttributes:{class:"rich-editor-img-thumb"}}),LF,j$.configure({HTMLAttributes:{class:"mention-tag"},suggestion:DF(a)}),OF,k$.configure({placeholder:o}),C3.configure({resizable:!0}),S3,j3,k3],content:k.current,onUpdate:({editor:Q})=>{e(Q.getHTML())},editorProps:{attributes:{class:"rich-editor-content"},handlePaste:E}});b.useEffect(()=>{x.current=C??null},[C]),b.useImperativeHandle(u,()=>({getHTML:()=>(C==null?void 0:C.getHTML())||"",getMarkdown:()=>PF((C==null?void 0:C.getHTML())||"")})),b.useEffect(()=>{if(C&&t!==C.getHTML()){const Q=Uw(t);Q!==C.getHTML()&&C.commands.setContent(Q)}},[t]);const L=b.useCallback(async Q=>{if(r)return r(Q);if(n)return n(Q);throw new Error("未配置上传")},[n,r]),O=b.useCallback(async Q=>{var re;const V=(re=Q.target.files)==null?void 0:re[0];if(!(!V||!C)){if(n){const ae=await n(V);ae&&C.chain().focus().setImage({src:ae}).run()}else{const ae=new FileReader;ae.onload=()=>{typeof ae.result=="string"&&C.chain().focus().setImage({src:ae.result}).run()},ae.readAsDataURL(V)}Q.target.value=""}},[C,n]),K=b.useCallback(async Q=>{var re;const V=(re=Q.target.files)==null?void 0:re[0];if(!(!V||!C)){try{const ae=await L(V);ae&&C.chain().focus().insertContent({type:"videoEmbed",attrs:{src:ae}}).run()}catch(ae){console.error(ae)}Q.target.value=""}},[C,L]),_=b.useCallback(async Q=>{var re;const V=(re=Q.target.files)==null?void 0:re[0];if(!(!V||!C)){try{const ae=await L(V);if(!ae)return;const pe=V.name||"附件";C.chain().focus().insertContent(`

    附件 ${IF(pe)}

    `).run()}catch(ae){console.error(ae)}Q.target.value=""}},[C,L]),H=b.useCallback(()=>{C&&C.chain().focus().insertContent("@").run()},[C]),P=b.useCallback(Q=>{C&&C.chain().focus().insertContent([{type:"linkTag",attrs:{label:Q.label,url:Q.url||"",tagType:Q.type||"url",tagId:Q.id||"",pagePath:Q.pagePath||"",appId:Q.appId||"",mpKey:Q.type==="miniprogram"&&Q.appId||""}},{type:"text",text:" "}]).run()},[C]),ee=b.useCallback(()=>{!C||!y||(C.chain().focus().setLink({href:y}).run(),v(""),N(!1))},[C,y]);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(s5,{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(nM,{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(w5,{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(K5,{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(G5,{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(Q5,{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(fM,{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(uM,{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(kM,{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:O,className:"hidden"}),s.jsx("input",{ref:f,type:"file",accept:"video/*",onChange:K,className:"hidden"}),s.jsx("input",{ref:m,type:"file",onChange:_,className:"hidden"}),s.jsx("button",{onClick:()=>{var Q;return(Q=h.current)==null?void 0:Q.click()},type:"button",title:"上传图片",children:s.jsx($j,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>{var Q;return(Q=f.current)==null?void 0:Q.click()},type:"button",title:"上传视频",disabled:!r&&!n,children:s.jsx(wA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>{var Q;return(Q=m.current)==null?void 0:Q.click()},type:"button",title:"上传附件(生成下载链接)",disabled:!r&&!n,children:s.jsx(MM,{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(e5,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>N(!w),className:C.isActive("link")?"is-active":"",type:"button",title:"链接",children:s.jsx(Ng,{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(xA,{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:Q=>{const V=i.find(re=>re.id===Q.target.value);V&&P(V),Q.target.value=""},defaultValue:"",children:[s.jsx("option",{value:"",disabled:!0,children:"# 插入链接标签"}),i.map(Q=>s.jsx("option",{value:Q.id,children:Q.label},Q.id))]})})]})]}),w&&s.jsxs("div",{className:"link-input-bar",children:[s.jsx("input",{type:"url",placeholder:"输入链接地址...",value:y,onChange:Q=>v(Q.target.value),onKeyDown:Q=>Q.key==="Enter"&&ee(),className:"link-input"}),s.jsx("button",{onClick:ee,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(_C,{editor:C})]}):null});f0.displayName="RichEditor";const BF=["top","right","bottom","left"],ko=Math.min,ur=Math.max,sp=Math.round,Wh=Math.floor,Ea=t=>({x:t,y:t}),VF={left:"right",right:"left",bottom:"top",top:"bottom"},HF={start:"end",end:"start"};function p0(t,e,n){return ur(t,ko(e,n))}function gi(t,e){return typeof t=="function"?t(e):t}function yi(t){return t.split("-")[0]}function Yc(t){return t.split("-")[1]}function Py(t){return t==="x"?"y":"x"}function Ly(t){return t==="y"?"height":"width"}const UF=new Set(["top","bottom"]);function Ca(t){return UF.has(yi(t))?"y":"x"}function Oy(t){return Py(Ca(t))}function WF(t,e,n){n===void 0&&(n=!1);const r=Yc(t),a=Oy(t),i=Ly(a);let o=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=rp(o)),[o,rp(o)]}function KF(t){const e=rp(t);return[m0(t),e,m0(e)]}function m0(t){return t.replace(/start|end/g,e=>HF[e])}const Kw=["left","right"],qw=["right","left"],qF=["top","bottom"],GF=["bottom","top"];function JF(t,e,n){switch(t){case"top":case"bottom":return n?e?qw:Kw:e?Kw:qw;case"left":case"right":return e?qF:GF;default:return[]}}function QF(t,e,n,r){const a=Yc(t);let i=JF(yi(t),n==="start",r);return a&&(i=i.map(o=>o+"-"+a),e&&(i=i.concat(i.map(m0)))),i}function rp(t){return t.replace(/left|right|bottom|top/g,e=>VF[e])}function YF(t){return{top:0,right:0,bottom:0,left:0,...t}}function T3(t){return typeof t!="number"?YF(t):{top:t,right:t,bottom:t,left:t}}function ap(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 Gw(t,e,n){let{reference:r,floating:a}=t;const i=Ca(e),o=Oy(e),c=Ly(o),u=yi(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 y;switch(u){case"top":y={x:f,y:r.y-a.height};break;case"bottom":y={x:f,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:m};break;case"left":y={x:r.x-a.width,y:m};break;default:y={x:r.x,y:r.y}}switch(Yc(e)){case"start":y[o]-=x*(n&&h?-1:1);break;case"end":y[o]+=x*(n&&h?-1:1);break}return y}async function XF(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:y=0}=gi(e,t),v=T3(y),N=c[x?m==="floating"?"reference":"floating":m],k=ap(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})),E=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)),L=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},O=ap(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:E,offsetParent:C,strategy:u}):E);return{top:(k.top-O.top+v.top)/L.y,bottom:(O.bottom-k.bottom+v.bottom)/L.y,left:(k.left-O.left+v.left)/L.x,right:(O.right-k.right+v.right)/L.x}}const ZF=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}=Gw(h,r,u),x=r,y={},v=0;for(let N=0;N({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:a,rects:i,platform:o,elements:c,middlewareData:u}=e,{element:h,padding:f=0}=gi(t,e)||{};if(h==null)return{};const m=T3(f),x={x:n,y:r},y=Oy(a),v=Ly(y),w=await o.getDimensions(h),N=y==="y",k=N?"top":"left",E=N?"bottom":"right",C=N?"clientHeight":"clientWidth",L=i.reference[v]+i.reference[y]-x[y]-i.floating[v],O=x[y]-i.reference[y],K=await(o.getOffsetParent==null?void 0:o.getOffsetParent(h));let _=K?K[C]:0;(!_||!await(o.isElement==null?void 0:o.isElement(K)))&&(_=c.floating[C]||i.floating[v]);const H=L/2-O/2,P=_/2-w[v]/2-1,ee=ko(m[k],P),Q=ko(m[E],P),V=ee,re=_-w[v]-Q,ae=_/2-w[v]/2+H,pe=p0(V,ae,re),I=!u.arrow&&Yc(a)!=null&&ae!==pe&&i.reference[v]/2-(aeae<=0)){var Q,V;const ae=(((Q=i.flip)==null?void 0:Q.index)||0)+1,pe=_[ae];if(pe&&(!(m==="alignment"?E!==Ca(pe):!1)||ee.every(R=>Ca(R.placement)===E?R.overflows[0]>0:!0)))return{data:{index:ae,overflows:ee},reset:{placement:pe}};let I=(V=ee.filter(z=>z.overflows[0]<=0).sort((z,R)=>z.overflows[1]-R.overflows[1])[0])==null?void 0:V.placement;if(!I)switch(y){case"bestFit":{var re;const z=(re=ee.filter(R=>{if(K){const ie=Ca(R.placement);return ie===E||ie==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(ie=>ie>0).reduce((ie,q)=>ie+q,0)]).sort((R,ie)=>R[1]-ie[1])[0])==null?void 0:re[0];z&&(I=z);break}case"initialPlacement":I=c;break}if(a!==I)return{reset:{placement:I}}}return{}}}};function Jw(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Qw(t){return BF.some(e=>t[e]>=0)}const nB=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:a="referenceHidden",...i}=gi(t,e);switch(a){case"referenceHidden":{const o=await r.detectOverflow(e,{...i,elementContext:"reference"}),c=Jw(o,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Qw(c)}}}case"escaped":{const o=await r.detectOverflow(e,{...i,altBoundary:!0}),c=Jw(o,n.floating);return{data:{escapedOffsets:c,escaped:Qw(c)}}}default:return{}}}}},E3=new Set(["left","top"]);async function sB(t,e){const{placement:n,platform:r,elements:a}=t,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),o=yi(n),c=Yc(n),u=Ca(n)==="y",h=E3.has(o)?-1:1,f=i&&u?-1:1,m=gi(e,t);let{mainAxis:x,crossAxis:y,alignmentAxis:v}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof v=="number"&&(y=c==="end"?v*-1:v),u?{x:y*f,y:x*h}:{x:x*h,y:y*f}}const rB=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 sB(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}}}}},aB=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:E,y:C}=k;return{x:E,y:C}}},...h}=gi(t,e),f={x:n,y:r},m=await i.detectOverflow(e,h),x=Ca(yi(a)),y=Py(x);let v=f[y],w=f[x];if(o){const k=y==="y"?"top":"left",E=y==="y"?"bottom":"right",C=v+m[k],L=v-m[E];v=p0(C,v,L)}if(c){const k=x==="y"?"top":"left",E=x==="y"?"bottom":"right",C=w+m[k],L=w-m[E];w=p0(C,w,L)}const N=u.fn({...e,[y]:v,[x]:w});return{...N,data:{x:N.x-n,y:N.y-r,enabled:{[y]:o,[x]:c}}}}}},iB=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}=gi(t,e),f={x:n,y:r},m=Ca(a),x=Py(m);let y=f[x],v=f[m];const w=gi(c,e),N=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(u){const C=x==="y"?"height":"width",L=i.reference[x]-i.floating[C]+N.mainAxis,O=i.reference[x]+i.reference[C]-N.mainAxis;yO&&(y=O)}if(h){var k,E;const C=x==="y"?"width":"height",L=E3.has(yi(a)),O=i.reference[m]-i.floating[C]+(L&&((k=o.offset)==null?void 0:k[m])||0)+(L?0:N.crossAxis),K=i.reference[m]+i.reference[C]+(L?0:((E=o.offset)==null?void 0:E[m])||0)-(L?N.crossAxis:0);vK&&(v=K)}return{[x]:y,[m]:v}}}},oB=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}=gi(t,e),f=await o.detectOverflow(e,h),m=yi(a),x=Yc(a),y=Ca(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 E=w-f.top-f.bottom,C=v-f.left-f.right,L=ko(w-f[N],E),O=ko(v-f[k],C),K=!e.middlewareData.shift;let _=L,H=O;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(H=C),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(_=E),K&&!x){const ee=ur(f.left,0),Q=ur(f.right,0),V=ur(f.top,0),re=ur(f.bottom,0);y?H=v-2*(ee!==0||Q!==0?ee+Q:ur(f.left,f.right)):_=w-2*(V!==0||re!==0?V+re:ur(f.top,f.bottom))}await u({...e,availableWidth:H,availableHeight:_});const P=await o.getDimensions(c.floating);return v!==P.width||w!==P.height?{reset:{rects:!0}}:{}}}};function Lp(){return typeof window<"u"}function Xc(t){return M3(t)?(t.nodeName||"").toLowerCase():"#document"}function mr(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function La(t){var e;return(e=(M3(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function M3(t){return Lp()?t instanceof Node||t instanceof mr(t).Node:!1}function aa(t){return Lp()?t instanceof Element||t instanceof mr(t).Element:!1}function Ia(t){return Lp()?t instanceof HTMLElement||t instanceof mr(t).HTMLElement:!1}function Yw(t){return!Lp()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof mr(t).ShadowRoot}const lB=new Set(["inline","contents"]);function ku(t){const{overflow:e,overflowX:n,overflowY:r,display:a}=ia(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!lB.has(a)}const cB=new Set(["table","td","th"]);function dB(t){return cB.has(Xc(t))}const uB=[":popover-open",":modal"];function Op(t){return uB.some(e=>{try{return t.matches(e)}catch{return!1}})}const hB=["transform","translate","scale","rotate","perspective"],fB=["transform","translate","scale","rotate","perspective","filter"],pB=["paint","layout","strict","content"];function Dy(t){const e=_y(),n=aa(t)?ia(t):t;return hB.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)||fB.some(r=>(n.willChange||"").includes(r))||pB.some(r=>(n.contain||"").includes(r))}function mB(t){let e=So(t);for(;Ia(e)&&!Uc(e);){if(Dy(e))return e;if(Op(e))return null;e=So(e)}return null}function _y(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const xB=new Set(["html","body","#document"]);function Uc(t){return xB.has(Xc(t))}function ia(t){return mr(t).getComputedStyle(t)}function Dp(t){return aa(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function So(t){if(Xc(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Yw(t)&&t.host||La(t);return Yw(e)?e.host:e}function A3(t){const e=So(t);return Uc(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ia(e)&&ku(e)?e:A3(e)}function pu(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const a=A3(t),i=a===((r=t.ownerDocument)==null?void 0:r.body),o=mr(a);if(i){const c=x0(o);return e.concat(o,o.visualViewport||[],ku(a)?a:[],c&&n?pu(c):[])}return e.concat(a,pu(a,[],n))}function x0(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function I3(t){const e=ia(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const a=Ia(t),i=a?t.offsetWidth:n,o=a?t.offsetHeight:r,c=sp(n)!==i||sp(r)!==o;return c&&(n=i,r=o),{width:n,height:r,$:c}}function zy(t){return aa(t)?t:t.contextElement}function Ic(t){const e=zy(t);if(!Ia(e))return Ea(1);const n=e.getBoundingClientRect(),{width:r,height:a,$:i}=I3(e);let o=(i?sp(n.width):n.width)/r,c=(i?sp(n.height):n.height)/a;return(!o||!Number.isFinite(o))&&(o=1),(!c||!Number.isFinite(c))&&(c=1),{x:o,y:c}}const gB=Ea(0);function R3(t){const e=mr(t);return!_y()||!e.visualViewport?gB:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function yB(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==mr(t)?!1:e}function Al(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const a=t.getBoundingClientRect(),i=zy(t);let o=Ea(1);e&&(r?aa(r)&&(o=Ic(r)):o=Ic(t));const c=yB(i,n,r)?R3(i):Ea(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=mr(i),y=r&&aa(r)?mr(r):r;let v=x,w=x0(v);for(;w&&r&&y!==v;){const N=Ic(w),k=w.getBoundingClientRect(),E=ia(w),C=k.left+(w.clientLeft+parseFloat(E.paddingLeft))*N.x,L=k.top+(w.clientTop+parseFloat(E.paddingTop))*N.y;u*=N.x,h*=N.y,f*=N.x,m*=N.y,u+=C,h+=L,v=mr(w),w=x0(v)}}return ap({width:f,height:m,x:u,y:h})}function _p(t,e){const n=Dp(t).scrollLeft;return e?e.left+n:Al(La(t)).left+n}function P3(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-_p(t,n),a=n.top+e.scrollTop;return{x:r,y:a}}function bB(t){let{elements:e,rect:n,offsetParent:r,strategy:a}=t;const i=a==="fixed",o=La(r),c=e?Op(e.floating):!1;if(r===o||c&&i)return n;let u={scrollLeft:0,scrollTop:0},h=Ea(1);const f=Ea(0),m=Ia(r);if((m||!m&&!i)&&((Xc(r)!=="body"||ku(o))&&(u=Dp(r)),Ia(r))){const y=Al(r);h=Ic(r),f.x=y.x+r.clientLeft,f.y=y.y+r.clientTop}const x=o&&!m&&!i?P3(o,u):Ea(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 vB(t){return Array.from(t.getClientRects())}function NB(t){const e=La(t),n=Dp(t),r=t.ownerDocument.body,a=ur(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=ur(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+_p(t);const c=-n.scrollTop;return ia(r).direction==="rtl"&&(o+=ur(e.clientWidth,r.clientWidth)-a),{width:a,height:i,x:o,y:c}}const Xw=25;function wB(t,e){const n=mr(t),r=La(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=_y();(!f||f&&e==="fixed")&&(c=a.offsetLeft,u=a.offsetTop)}const h=_p(r);if(h<=0){const f=r.ownerDocument,m=f.body,x=getComputedStyle(m),y=f.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,v=Math.abs(r.clientWidth-m.clientWidth-y);v<=Xw&&(i-=v)}else h<=Xw&&(i+=h);return{width:i,height:o,x:c,y:u}}const jB=new Set(["absolute","fixed"]);function kB(t,e){const n=Al(t,!0,e==="fixed"),r=n.top+t.clientTop,a=n.left+t.clientLeft,i=Ia(t)?Ic(t):Ea(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 Zw(t,e,n){let r;if(e==="viewport")r=wB(t,n);else if(e==="document")r=NB(La(t));else if(aa(e))r=kB(e,n);else{const a=R3(t);r={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return ap(r)}function L3(t,e){const n=So(t);return n===e||!aa(n)||Uc(n)?!1:ia(n).position==="fixed"||L3(n,e)}function SB(t,e){const n=e.get(t);if(n)return n;let r=pu(t,[],!1).filter(c=>aa(c)&&Xc(c)!=="body"),a=null;const i=ia(t).position==="fixed";let o=i?So(t):t;for(;aa(o)&&!Uc(o);){const c=ia(o),u=Dy(o);!u&&c.position==="fixed"&&(a=null),(i?!u&&!a:!u&&c.position==="static"&&!!a&&jB.has(a.position)||ku(o)&&!u&&L3(t,o))?r=r.filter(f=>f!==o):a=c,o=So(o)}return e.set(t,r),r}function CB(t){let{element:e,boundary:n,rootBoundary:r,strategy:a}=t;const o=[...n==="clippingAncestors"?Op(e)?[]:SB(e,this._c):[].concat(n),r],c=o[0],u=o.reduce((h,f)=>{const m=Zw(e,f,a);return h.top=ur(m.top,h.top),h.right=ko(m.right,h.right),h.bottom=ko(m.bottom,h.bottom),h.left=ur(m.left,h.left),h},Zw(e,c,a));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function TB(t){const{width:e,height:n}=I3(t);return{width:e,height:n}}function EB(t,e,n){const r=Ia(e),a=La(e),i=n==="fixed",o=Al(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const u=Ea(0);function h(){u.x=_p(a)}if(r||!r&&!i)if((Xc(e)!=="body"||ku(a))&&(c=Dp(e)),r){const y=Al(e,!0,i,e);u.x=y.x+e.clientLeft,u.y=y.y+e.clientTop}else a&&h();i&&!r&&a&&h();const f=a&&!r&&!i?P3(a,c):Ea(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 og(t){return ia(t).position==="static"}function ej(t,e){if(!Ia(t)||ia(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return La(t)===n&&(n=n.ownerDocument.body),n}function O3(t,e){const n=mr(t);if(Op(t))return n;if(!Ia(t)){let a=So(t);for(;a&&!Uc(a);){if(aa(a)&&!og(a))return a;a=So(a)}return n}let r=ej(t,e);for(;r&&dB(r)&&og(r);)r=ej(r,e);return r&&Uc(r)&&og(r)&&!Dy(r)?n:r||mB(t)||n}const MB=async function(t){const e=this.getOffsetParent||O3,n=this.getDimensions,r=await n(t.floating);return{reference:EB(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function AB(t){return ia(t).direction==="rtl"}const IB={convertOffsetParentRelativeRectToViewportRelativeRect:bB,getDocumentElement:La,getClippingRect:CB,getOffsetParent:O3,getElementRects:MB,getClientRects:vB,getDimensions:TB,getScale:Ic,isElement:aa,isRTL:AB};function D3(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function RB(t,e){let n=null,r;const a=La(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:y}=h;if(c||e(),!x||!y)return;const v=Wh(m),w=Wh(a.clientWidth-(f+x)),N=Wh(a.clientHeight-(m+y)),k=Wh(f),C={rootMargin:-v+"px "+-w+"px "+-N+"px "+-k+"px",threshold:ur(0,ko(1,u))||1};let L=!0;function O(K){const _=K[0].intersectionRatio;if(_!==u){if(!L)return o();_?o(!1,_):r=setTimeout(()=>{o(!1,1e-7)},1e3)}_===1&&!D3(h,t.getBoundingClientRect())&&o(),L=!1}try{n=new IntersectionObserver(O,{...C,root:a.ownerDocument})}catch{n=new IntersectionObserver(O,C)}n.observe(t)}return o(!0),i}function PB(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=zy(t),f=a||i?[...h?pu(h):[],...pu(e)]:[];f.forEach(k=>{a&&k.addEventListener("scroll",n,{passive:!0}),i&&k.addEventListener("resize",n)});const m=h&&c?RB(h,n):null;let x=-1,y=null;o&&(y=new ResizeObserver(k=>{let[E]=k;E&&E.target===h&&y&&(y.unobserve(e),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var C;(C=y)==null||C.observe(e)})),n()}),h&&!u&&y.observe(h),y.observe(e));let v,w=u?Al(t):null;u&&N();function N(){const k=Al(t);w&&!D3(w,k)&&n(),w=k,v=requestAnimationFrame(N)}return n(),()=>{var k;f.forEach(E=>{a&&E.removeEventListener("scroll",n),i&&E.removeEventListener("resize",n)}),m==null||m(),(k=y)==null||k.disconnect(),y=null,u&&cancelAnimationFrame(v)}}const LB=rB,OB=aB,DB=tB,_B=oB,zB=nB,tj=eB,$B=iB,FB=(t,e,n)=>{const r=new Map,a={platform:IB,...n},i={...a.platform,_c:r};return ZF(t,e,{...a,platform:i})};var BB=typeof document<"u",VB=function(){},tf=BB?b.useLayoutEffect:VB;function ip(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(!ip(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)&&!ip(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function _3(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function nj(t,e){const n=_3(t);return Math.round(e*n)/n}function lg(t){const e=b.useRef(t);return tf(()=>{e.current=t}),e}function HB(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:i,floating:o}={},transform:c=!0,whileElementsMounted:u,open:h}=t,[f,m]=b.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[x,y]=b.useState(r);ip(x,r)||y(r);const[v,w]=b.useState(null),[N,k]=b.useState(null),E=b.useCallback(R=>{R!==K.current&&(K.current=R,w(R))},[]),C=b.useCallback(R=>{R!==_.current&&(_.current=R,k(R))},[]),L=i||v,O=o||N,K=b.useRef(null),_=b.useRef(null),H=b.useRef(f),P=u!=null,ee=lg(u),Q=lg(a),V=lg(h),re=b.useCallback(()=>{if(!K.current||!_.current)return;const R={placement:e,strategy:n,middleware:x};Q.current&&(R.platform=Q.current),FB(K.current,_.current,R).then(ie=>{const q={...ie,isPositioned:V.current!==!1};ae.current&&!ip(H.current,q)&&(H.current=q,xu.flushSync(()=>{m(q)}))})},[x,e,n,Q,V]);tf(()=>{h===!1&&H.current.isPositioned&&(H.current.isPositioned=!1,m(R=>({...R,isPositioned:!1})))},[h]);const ae=b.useRef(!1);tf(()=>(ae.current=!0,()=>{ae.current=!1}),[]),tf(()=>{if(L&&(K.current=L),O&&(_.current=O),L&&O){if(ee.current)return ee.current(L,O,re);re()}},[L,O,re,ee,P]);const pe=b.useMemo(()=>({reference:K,floating:_,setReference:E,setFloating:C}),[E,C]),I=b.useMemo(()=>({reference:L,floating:O}),[L,O]),z=b.useMemo(()=>{const R={position:n,left:0,top:0};if(!I.floating)return R;const ie=nj(I.floating,f.x),q=nj(I.floating,f.y);return c?{...R,transform:"translate("+ie+"px, "+q+"px)",..._3(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ie,top:q}},[n,c,I.floating,f.x,f.y]);return b.useMemo(()=>({...f,update:re,refs:pe,elements:I,floatingStyles:z}),[f,re,pe,I,z])}const UB=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?tj({element:r.current,padding:a}).fn(n):{}:r?tj({element:r,padding:a}).fn(n):{}}}},WB=(t,e)=>({...LB(t),options:[t,e]}),KB=(t,e)=>({...OB(t),options:[t,e]}),qB=(t,e)=>({...$B(t),options:[t,e]}),GB=(t,e)=>({...DB(t),options:[t,e]}),JB=(t,e)=>({..._B(t),options:[t,e]}),QB=(t,e)=>({...zB(t),options:[t,e]}),YB=(t,e)=>({...UB(t),options:[t,e]});var XB="Arrow",z3=b.forwardRef((t,e)=>{const{children:n,width:r=10,height:a=5,...i}=t;return s.jsx(Ct.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"})})});z3.displayName=XB;var ZB=z3,$y="Popper",[$3,F3]=Eo($y),[e9,B3]=$3($y),V3=t=>{const{__scopePopper:e,children:n}=t,[r,a]=b.useState(null);return s.jsx(e9,{scope:e,anchor:r,onAnchorChange:a,children:n})};V3.displayName=$y;var H3="PopperAnchor",U3=b.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...a}=t,i=B3(H3,n),o=b.useRef(null),c=qt(e,o),u=b.useRef(null);return b.useEffect(()=>{const h=u.current;u.current=(r==null?void 0:r.current)||o.current,h!==u.current&&i.onAnchorChange(u.current)}),r?null:s.jsx(Ct.div,{...a,ref:c})});U3.displayName=H3;var Fy="PopperContent",[t9,n9]=$3(Fy),W3=b.forwardRef((t,e)=>{var G,te,be,ge,Ce,We;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:y="optimized",onPlaced:v,...w}=t,N=B3(Fy,n),[k,E]=b.useState(null),C=qt(e,gt=>E(gt)),[L,O]=b.useState(null),K=B0(L),_=(K==null?void 0:K.width)??0,H=(K==null?void 0:K.height)??0,P=r+(i!=="center"?"-"+i:""),ee=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},Q=Array.isArray(h)?h:[h],V=Q.length>0,re={padding:ee,boundary:Q.filter(r9),altBoundary:V},{refs:ae,floatingStyles:pe,placement:I,isPositioned:z,middlewareData:R}=HB({strategy:"fixed",placement:P,whileElementsMounted:(...gt)=>PB(...gt,{animationFrame:y==="always"}),elements:{reference:N.anchor},middleware:[WB({mainAxis:a+H,alignmentAxis:o}),u&&KB({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?qB():void 0,...re}),u&&GB({...re}),JB({...re,apply:({elements:gt,rects:Lt,availableWidth:yt,availableHeight:Ot})=>{const{width:It,height:Pn}=Lt.reference,vn=gt.floating.style;vn.setProperty("--radix-popper-available-width",`${yt}px`),vn.setProperty("--radix-popper-available-height",`${Ot}px`),vn.setProperty("--radix-popper-anchor-width",`${It}px`),vn.setProperty("--radix-popper-anchor-height",`${Pn}px`)}}),L&&YB({element:L,padding:c}),a9({arrowWidth:_,arrowHeight:H}),x&&QB({strategy:"referenceHidden",...re})]}),[ie,q]=G3(I),$=No(v);Ss(()=>{z&&($==null||$())},[z,$]);const U=(G=R.arrow)==null?void 0:G.x,ce=(te=R.arrow)==null?void 0:te.y,ue=((be=R.arrow)==null?void 0:be.centerOffset)!==0,[oe,F]=b.useState();return Ss(()=>{k&&F(window.getComputedStyle(k).zIndex)},[k]),s.jsx("div",{ref:ae.setFloating,"data-radix-popper-content-wrapper":"",style:{...pe,transform:z?pe.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:oe,"--radix-popper-transform-origin":[(ge=R.transformOrigin)==null?void 0:ge.x,(Ce=R.transformOrigin)==null?void 0:Ce.y].join(" "),...((We=R.hide)==null?void 0:We.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:s.jsx(t9,{scope:n,placedSide:ie,onArrowChange:O,arrowX:U,arrowY:ce,shouldHideArrow:ue,children:s.jsx(Ct.div,{"data-side":ie,"data-align":q,...w,ref:C,style:{...w.style,animation:z?void 0:"none"}})})})});W3.displayName=Fy;var K3="PopperArrow",s9={top:"bottom",right:"left",bottom:"top",left:"right"},q3=b.forwardRef(function(e,n){const{__scopePopper:r,...a}=e,i=n9(K3,r),o=s9[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(ZB,{...a,ref:n,style:{...a.style,display:"block"}})})});q3.displayName=K3;function r9(t){return t!==null}var a9=t=>({name:"transformOrigin",options:t,fn(e){var N,k,E;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]=G3(n),m={start:"0%",center:"50%",end:"100%"}[f],x=(((k=a.arrow)==null?void 0:k.x)??0)+c/2,y=(((E=a.arrow)==null?void 0:E.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:`${y}px`):h==="left"&&(v=`${r.floating.width+u}px`,w=o?m:`${y}px`),{data:{x:v,y:w}}}});function G3(t){const[e,n="center"]=t.split("-");return[e,n]}var i9=V3,o9=U3,l9=W3,c9=q3,J3=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"}),d9="VisuallyHidden",u9=b.forwardRef((t,e)=>s.jsx(Ct.span,{...t,ref:e,style:{...J3,...t.style}}));u9.displayName=d9;var h9=[" ","Enter","ArrowUp","ArrowDown"],f9=[" ","Enter"],Il="Select",[zp,$p,p9]=z0(Il),[Zc]=Eo(Il,[p9,F3]),Fp=F3(),[m9,Ro]=Zc(Il),[x9,g9]=Zc(Il),Q3=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:y,form:v}=t,w=Fp(e),[N,k]=b.useState(null),[E,C]=b.useState(null),[L,O]=b.useState(!1),K=pp(h),[_,H]=bl({prop:r,defaultProp:a??!1,onChange:i,caller:Il}),[P,ee]=bl({prop:o,defaultProp:c,onChange:u,caller:Il}),Q=b.useRef(null),V=N?v||!!N.closest("form"):!0,[re,ae]=b.useState(new Set),pe=Array.from(re).map(I=>I.props.value).join(";");return s.jsx(i9,{...w,children:s.jsxs(m9,{required:y,scope:e,trigger:N,onTriggerChange:k,valueNode:E,onValueNodeChange:C,valueNodeHasChildren:L,onValueNodeHasChildrenChange:O,contentId:mo(),value:P,onValueChange:ee,open:_,onOpenChange:H,dir:K,triggerPointerDownPosRef:Q,disabled:x,children:[s.jsx(zp.Provider,{scope:e,children:s.jsx(x9,{scope:t.__scopeSelect,onNativeOptionAdd:b.useCallback(I=>{ae(z=>new Set(z).add(I))},[]),onNativeOptionRemove:b.useCallback(I=>{ae(z=>{const R=new Set(z);return R.delete(I),R})},[]),children:n})}),V?s.jsxs(y4,{"aria-hidden":!0,required:y,tabIndex:-1,name:f,autoComplete:m,value:P,onChange:I=>ee(I.target.value),disabled:x,form:v,children:[P===void 0?s.jsx("option",{value:""}):null,Array.from(re)]},pe):null]})})};Q3.displayName=Il;var Y3="SelectTrigger",X3=b.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...a}=t,i=Fp(n),o=Ro(Y3,n),c=o.disabled||r,u=qt(e,o.onTriggerChange),h=$p(n),f=b.useRef("touch"),[m,x,y]=v4(w=>{const N=h().filter(C=>!C.disabled),k=N.find(C=>C.value===o.value),E=N4(N,w,k);E!==void 0&&o.onValueChange(E.value)}),v=w=>{c||(o.onOpenChange(!0),y()),w&&(o.triggerPointerDownPosRef.current={x:Math.round(w.pageX),y:Math.round(w.pageY)})};return s.jsx(o9,{asChild:!0,...i,children:s.jsx(Ct.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":b4(o.value)?"":void 0,...a,ref:u,onClick:Nt(a.onClick,w=>{w.currentTarget.focus(),f.current!=="mouse"&&v(w)}),onPointerDown:Nt(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:Nt(a.onKeyDown,w=>{const N=m.current!=="";!(w.ctrlKey||w.altKey||w.metaKey)&&w.key.length===1&&x(w.key),!(N&&w.key===" ")&&h9.includes(w.key)&&(v(),w.preventDefault())})})})});X3.displayName=Y3;var Z3="SelectValue",e4=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,children:i,placeholder:o="",...c}=t,u=Ro(Z3,n),{onValueNodeHasChildrenChange:h}=u,f=i!==void 0,m=qt(e,u.onValueNodeChange);return Ss(()=>{h(f)},[h,f]),s.jsx(Ct.span,{...c,ref:m,style:{pointerEvents:"none"},children:b4(u.value)?s.jsx(s.Fragment,{children:o}):i})});e4.displayName=Z3;var y9="SelectIcon",t4=b.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...a}=t;return s.jsx(Ct.span,{"aria-hidden":!0,...a,ref:e,children:r||"▼"})});t4.displayName=y9;var b9="SelectPortal",n4=t=>s.jsx(P0,{asChild:!0,...t});n4.displayName=b9;var Rl="SelectContent",s4=b.forwardRef((t,e)=>{const n=Ro(Rl,t.__scopeSelect),[r,a]=b.useState();if(Ss(()=>{a(new DocumentFragment)},[]),!n.open){const i=r;return i?xu.createPortal(s.jsx(r4,{scope:t.__scopeSelect,children:s.jsx(zp.Slot,{scope:t.__scopeSelect,children:s.jsx("div",{children:t.children})})}),i):null}return s.jsx(a4,{...t,ref:e})});s4.displayName=Rl;var ta=10,[r4,Po]=Zc(Rl),v9="SelectContentImpl",N9=tu("SelectContent.RemoveScroll"),a4=b.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:o,side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:x,collisionPadding:y,sticky:v,hideWhenDetached:w,avoidCollisions:N,...k}=t,E=Ro(Rl,n),[C,L]=b.useState(null),[O,K]=b.useState(null),_=qt(e,G=>L(G)),[H,P]=b.useState(null),[ee,Q]=b.useState(null),V=$p(n),[re,ae]=b.useState(!1),pe=b.useRef(!1);b.useEffect(()=>{if(C)return yk(C)},[C]),ck();const I=b.useCallback(G=>{const[te,...be]=V().map(We=>We.ref.current),[ge]=be.slice(-1),Ce=document.activeElement;for(const We of G)if(We===Ce||(We==null||We.scrollIntoView({block:"nearest"}),We===te&&O&&(O.scrollTop=0),We===ge&&O&&(O.scrollTop=O.scrollHeight),We==null||We.focus(),document.activeElement!==Ce))return},[V,O]),z=b.useCallback(()=>I([H,C]),[I,H,C]);b.useEffect(()=>{re&&z()},[re,z]);const{onOpenChange:R,triggerPointerDownPosRef:ie}=E;b.useEffect(()=>{if(C){let G={x:0,y:0};const te=ge=>{var Ce,We;G={x:Math.abs(Math.round(ge.pageX)-(((Ce=ie.current)==null?void 0:Ce.x)??0)),y:Math.abs(Math.round(ge.pageY)-(((We=ie.current)==null?void 0:We.y)??0))}},be=ge=>{G.x<=10&&G.y<=10?ge.preventDefault():C.contains(ge.target)||R(!1),document.removeEventListener("pointermove",te),ie.current=null};return ie.current!==null&&(document.addEventListener("pointermove",te),document.addEventListener("pointerup",be,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",te),document.removeEventListener("pointerup",be,{capture:!0})}}},[C,R,ie]),b.useEffect(()=>{const G=()=>R(!1);return window.addEventListener("blur",G),window.addEventListener("resize",G),()=>{window.removeEventListener("blur",G),window.removeEventListener("resize",G)}},[R]);const[q,$]=v4(G=>{const te=V().filter(Ce=>!Ce.disabled),be=te.find(Ce=>Ce.ref.current===document.activeElement),ge=N4(te,G,be);ge&&setTimeout(()=>ge.ref.current.focus())}),U=b.useCallback((G,te,be)=>{const ge=!pe.current&&!be;(E.value!==void 0&&E.value===te||ge)&&(P(G),ge&&(pe.current=!0))},[E.value]),ce=b.useCallback(()=>C==null?void 0:C.focus(),[C]),ue=b.useCallback((G,te,be)=>{const ge=!pe.current&&!be;(E.value!==void 0&&E.value===te||ge)&&Q(G)},[E.value]),oe=r==="popper"?g0:i4,F=oe===g0?{side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:x,collisionPadding:y,sticky:v,hideWhenDetached:w,avoidCollisions:N}:{};return s.jsx(r4,{scope:n,content:C,viewport:O,onViewportChange:K,itemRefCallback:U,selectedItem:H,onItemLeave:ce,itemTextRefCallback:ue,focusSelectedItem:z,selectedItemText:ee,position:r,isPositioned:re,searchRef:q,children:s.jsx(L0,{as:N9,allowPinchZoom:!0,children:s.jsx(R0,{asChild:!0,trapped:E.open,onMountAutoFocus:G=>{G.preventDefault()},onUnmountAutoFocus:Nt(a,G=>{var te;(te=E.trigger)==null||te.focus({preventScroll:!0}),G.preventDefault()}),children:s.jsx(I0,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:G=>G.preventDefault(),onDismiss:()=>E.onOpenChange(!1),children:s.jsx(oe,{role:"listbox",id:E.contentId,"data-state":E.open?"open":"closed",dir:E.dir,onContextMenu:G=>G.preventDefault(),...k,...F,onPlaced:()=>ae(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:Nt(k.onKeyDown,G=>{const te=G.ctrlKey||G.altKey||G.metaKey;if(G.key==="Tab"&&G.preventDefault(),!te&&G.key.length===1&&$(G.key),["ArrowUp","ArrowDown","Home","End"].includes(G.key)){let ge=V().filter(Ce=>!Ce.disabled).map(Ce=>Ce.ref.current);if(["ArrowUp","End"].includes(G.key)&&(ge=ge.slice().reverse()),["ArrowUp","ArrowDown"].includes(G.key)){const Ce=G.target,We=ge.indexOf(Ce);ge=ge.slice(We+1)}setTimeout(()=>I(ge)),G.preventDefault()}})})})})})})});a4.displayName=v9;var w9="SelectItemAlignedPosition",i4=b.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...a}=t,i=Ro(Rl,n),o=Po(Rl,n),[c,u]=b.useState(null),[h,f]=b.useState(null),m=qt(e,_=>f(_)),x=$p(n),y=b.useRef(!1),v=b.useRef(!0),{viewport:w,selectedItem:N,selectedItemText:k,focusSelectedItem:E}=o,C=b.useCallback(()=>{if(i.trigger&&i.valueNode&&c&&h&&w&&N&&k){const _=i.trigger.getBoundingClientRect(),H=h.getBoundingClientRect(),P=i.valueNode.getBoundingClientRect(),ee=k.getBoundingClientRect();if(i.dir!=="rtl"){const Ce=ee.left-H.left,We=P.left-Ce,gt=_.left-We,Lt=_.width+gt,yt=Math.max(Lt,H.width),Ot=window.innerWidth-ta,It=ff(We,[ta,Math.max(ta,Ot-yt)]);c.style.minWidth=Lt+"px",c.style.left=It+"px"}else{const Ce=H.right-ee.right,We=window.innerWidth-P.right-Ce,gt=window.innerWidth-_.right-We,Lt=_.width+gt,yt=Math.max(Lt,H.width),Ot=window.innerWidth-ta,It=ff(We,[ta,Math.max(ta,Ot-yt)]);c.style.minWidth=Lt+"px",c.style.right=It+"px"}const Q=x(),V=window.innerHeight-ta*2,re=w.scrollHeight,ae=window.getComputedStyle(h),pe=parseInt(ae.borderTopWidth,10),I=parseInt(ae.paddingTop,10),z=parseInt(ae.borderBottomWidth,10),R=parseInt(ae.paddingBottom,10),ie=pe+I+re+R+z,q=Math.min(N.offsetHeight*5,ie),$=window.getComputedStyle(w),U=parseInt($.paddingTop,10),ce=parseInt($.paddingBottom,10),ue=_.top+_.height/2-ta,oe=V-ue,F=N.offsetHeight/2,G=N.offsetTop+F,te=pe+I+G,be=ie-te;if(te<=ue){const Ce=Q.length>0&&N===Q[Q.length-1].ref.current;c.style.bottom="0px";const We=h.clientHeight-w.offsetTop-w.offsetHeight,gt=Math.max(oe,F+(Ce?ce:0)+We+z),Lt=te+gt;c.style.height=Lt+"px"}else{const Ce=Q.length>0&&N===Q[0].ref.current;c.style.top="0px";const gt=Math.max(ue,pe+w.offsetTop+(Ce?U:0)+F)+be;c.style.height=gt+"px",w.scrollTop=te-ue+w.offsetTop}c.style.margin=`${ta}px 0`,c.style.minHeight=q+"px",c.style.maxHeight=V+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[x,i.trigger,i.valueNode,c,h,w,N,k,i.dir,r]);Ss(()=>C(),[C]);const[L,O]=b.useState();Ss(()=>{h&&O(window.getComputedStyle(h).zIndex)},[h]);const K=b.useCallback(_=>{_&&v.current===!0&&(C(),E==null||E(),v.current=!1)},[C,E]);return s.jsx(k9,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:y,onScrollButtonChange:K,children:s.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:L},children:s.jsx(Ct.div,{...a,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});i4.displayName=w9;var j9="SelectPopperPosition",g0=b.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=ta,...i}=t,o=Fp(n);return s.jsx(l9,{...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)"}})});g0.displayName=j9;var[k9,By]=Zc(Rl,{}),y0="SelectViewport",o4=b.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...a}=t,i=Po(y0,n),o=By(y0,n),c=qt(e,i.onViewportChange),u=b.useRef(0);return s.jsxs(s.Fragment,{children:[s.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),s.jsx(zp.Slot,{scope:n,children:s.jsx(Ct.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Nt(a.onScroll,h=>{const f=h.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:x}=o;if(x!=null&&x.current&&m){const y=Math.abs(u.current-f.scrollTop);if(y>0){const v=window.innerHeight-ta*2,w=parseFloat(m.style.minHeight),N=parseFloat(m.style.height),k=Math.max(w,N);if(k0?L:0,m.style.justifyContent="flex-end")}}}u.current=f.scrollTop})})})]})});o4.displayName=y0;var l4="SelectGroup",[S9,C9]=Zc(l4),T9=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=mo();return s.jsx(S9,{scope:n,id:a,children:s.jsx(Ct.div,{role:"group","aria-labelledby":a,...r,ref:e})})});T9.displayName=l4;var c4="SelectLabel",E9=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=C9(c4,n);return s.jsx(Ct.div,{id:a.id,...r,ref:e})});E9.displayName=c4;var op="SelectItem",[M9,d4]=Zc(op),u4=b.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:i,...o}=t,c=Ro(op,n),u=Po(op,n),h=c.value===r,[f,m]=b.useState(i??""),[x,y]=b.useState(!1),v=qt(e,E=>{var C;return(C=u.itemRefCallback)==null?void 0:C.call(u,E,r,a)}),w=mo(),N=b.useRef("touch"),k=()=>{a||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return s.jsx(M9,{scope:n,value:r,disabled:a,textId:w,isSelected:h,onItemTextChange:b.useCallback(E=>{m(C=>C||((E==null?void 0:E.textContent)??"").trim())},[]),children:s.jsx(zp.ItemSlot,{scope:n,value:r,disabled:a,textValue:f,children:s.jsx(Ct.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:Nt(o.onFocus,()=>y(!0)),onBlur:Nt(o.onBlur,()=>y(!1)),onClick:Nt(o.onClick,()=>{N.current!=="mouse"&&k()}),onPointerUp:Nt(o.onPointerUp,()=>{N.current==="mouse"&&k()}),onPointerDown:Nt(o.onPointerDown,E=>{N.current=E.pointerType}),onPointerMove:Nt(o.onPointerMove,E=>{var C;N.current=E.pointerType,a?(C=u.onItemLeave)==null||C.call(u):N.current==="mouse"&&E.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Nt(o.onPointerLeave,E=>{var C;E.currentTarget===document.activeElement&&((C=u.onItemLeave)==null||C.call(u))}),onKeyDown:Nt(o.onKeyDown,E=>{var L;((L=u.searchRef)==null?void 0:L.current)!==""&&E.key===" "||(f9.includes(E.key)&&k(),E.key===" "&&E.preventDefault())})})})})});u4.displayName=op;var zd="SelectItemText",h4=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,...i}=t,o=Ro(zd,n),c=Po(zd,n),u=d4(zd,n),h=g9(zd,n),[f,m]=b.useState(null),x=qt(e,k=>m(k),u.onItemTextChange,k=>{var E;return(E=c.itemTextRefCallback)==null?void 0:E.call(c,k,u.value,u.disabled)}),y=f==null?void 0:f.textContent,v=b.useMemo(()=>s.jsx("option",{value:u.value,disabled:u.disabled,children:y},u.value),[u.disabled,u.value,y]),{onNativeOptionAdd:w,onNativeOptionRemove:N}=h;return Ss(()=>(w(v),()=>N(v)),[w,N,v]),s.jsxs(s.Fragment,{children:[s.jsx(Ct.span,{id:u.textId,...i,ref:x}),u.isSelected&&o.valueNode&&!o.valueNodeHasChildren?xu.createPortal(i.children,o.valueNode):null]})});h4.displayName=zd;var f4="SelectItemIndicator",p4=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return d4(f4,n).isSelected?s.jsx(Ct.span,{"aria-hidden":!0,...r,ref:e}):null});p4.displayName=f4;var b0="SelectScrollUpButton",m4=b.forwardRef((t,e)=>{const n=Po(b0,t.__scopeSelect),r=By(b0,t.__scopeSelect),[a,i]=b.useState(!1),o=qt(e,r.onScrollButtonChange);return Ss(()=>{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(g4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});m4.displayName=b0;var v0="SelectScrollDownButton",x4=b.forwardRef((t,e)=>{const n=Po(v0,t.__scopeSelect),r=By(v0,t.__scopeSelect),[a,i]=b.useState(!1),o=qt(e,r.onScrollButtonChange);return Ss(()=>{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(g4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});x4.displayName=v0;var g4=b.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=t,i=Po("SelectScrollButton",n),o=b.useRef(null),c=$p(n),u=b.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return b.useEffect(()=>()=>u(),[u]),Ss(()=>{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(Ct.div,{"aria-hidden":!0,...a,ref:e,style:{flexShrink:0,...a.style},onPointerDown:Nt(a.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Nt(a.onPointerMove,()=>{var h;(h=i.onItemLeave)==null||h.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Nt(a.onPointerLeave,()=>{u()})})}),A9="SelectSeparator",I9=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return s.jsx(Ct.div,{"aria-hidden":!0,...r,ref:e})});I9.displayName=A9;var N0="SelectArrow",R9=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=Fp(n),i=Ro(N0,n),o=Po(N0,n);return i.open&&o.position==="popper"?s.jsx(c9,{...a,...r,ref:e}):null});R9.displayName=N0;var P9="SelectBubbleInput",y4=b.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const a=b.useRef(null),i=qt(r,a),o=F0(e);return b.useEffect(()=>{const c=a.current;if(!c)return;const u=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(o!==e&&f){const m=new Event("change",{bubbles:!0});f.call(c,e),c.dispatchEvent(m)}},[o,e]),s.jsx(Ct.select,{...n,style:{...J3,...n.style},ref:i,defaultValue:e})});y4.displayName=P9;function b4(t){return t===""||t===void 0}function v4(t){const e=No(t),n=b.useRef(""),r=b.useRef(0),a=b.useCallback(o=>{const c=n.current+o;e(c),(function u(h){n.current=h,window.clearTimeout(r.current),h!==""&&(r.current=window.setTimeout(()=>u(""),1e3))})(c)},[e]),i=b.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,i]}function N4(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=L9(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 L9(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var O9=Q3,w4=X3,D9=e4,_9=t4,z9=n4,j4=s4,$9=o4,k4=u4,F9=h4,B9=p4,V9=m4,H9=x4;const Nc=O9,wc=D9,il=b.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(w4,{ref:r,className:Gt("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(Pc,{className:"h-4 w-4 opacity-50"})})]}));il.displayName=w4.displayName;const ol=b.forwardRef(({className:t,children:e,position:n="popper",...r},a)=>s.jsx(z9,{children:s.jsxs(j4,{ref:a,className:Gt("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(V9,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(xg,{className:"h-4 w-4"})}),s.jsx($9,{className:"p-1",children:e}),s.jsx(H9,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(Pc,{className:"h-4 w-4"})})]})}));ol.displayName=j4.displayName;const Ys=b.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(k4,{ref:r,className:Gt("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(B9,{children:s.jsx(dp,{className:"h-4 w-4"})})}),s.jsx(F9,{children:e})]}));Ys.displayName=k4.displayName;const sj=["📖","📕","📗","📘","📙","📓","📔","📒","📚","📖"];function U9(t){return t.title==="序言"||t.title.includes("序言")}function rj(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 cg(t){return t.startsWith("part:")?{type:"part",id:t.slice(5)}:t.startsWith("chapter:")?{type:"chapter",id:t.slice(8)}:t.startsWith("section:")?{type:"section",id:t.slice(8)}:null}function W9({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:y,onShowSectionOrders:v,pinnedSectionIds:w=[]}){const[N,k]=b.useState(null),[E,C]=b.useState(null),L=(V,re)=>(N==null?void 0:N.type)===V&&(N==null?void 0:N.id)===re,O=(V,re)=>(E==null?void 0:E.type)===V&&(E==null?void 0:E.id)===re,K=b.useCallback(()=>{const V=[];for(const re of t)for(const ae of re.chapters)for(const pe of ae.sections)V.push({id:pe.id,partId:re.id,partTitle:re.title,chapterId:ae.id,chapterTitle:ae.title});return V},[t]),_=b.useCallback(async(V,re,ae,pe)=>{var q;V.preventDefault(),V.stopPropagation();const I=V.dataTransfer.getData("text/plain"),z=cg(I);if(!z||z.type===re&&z.id===ae)return;const R=K(),ie=new Map(R.map($=>[$.id,$]));if(z.type==="part"&&re==="part"){const $=t.map(F=>F.id),U=$.indexOf(z.id),ce=$.indexOf(ae);if(U===-1||ce===-1)return;const ue=[...$];ue.splice(U,1),ue.splice(Ute.id===F);if(G)for(const te of G.chapters)for(const be of te.sections){const ge=ie.get(be.id);ge&&oe.push(ge)}}await r(oe);return}if(z.type==="chapter"&&(re==="chapter"||re==="section"||re==="part")){const $=t.find(ge=>ge.chapters.some(Ce=>Ce.id===z.id)),U=$==null?void 0:$.chapters.find(ge=>ge.id===z.id);if(!$||!U)return;let ce,ue,oe=null;if(re==="section"){const ge=ie.get(ae);if(!ge)return;ce=ge.partId,ue=ge.partTitle,oe=ae}else if(re==="chapter"){const ge=t.find(gt=>gt.chapters.some(Lt=>Lt.id===ae)),Ce=ge==null?void 0:ge.chapters.find(gt=>gt.id===ae);if(!ge||!Ce)return;ce=ge.id,ue=ge.title;const We=R.filter(gt=>gt.chapterId===ae).pop();oe=(We==null?void 0:We.id)??null}else{const ge=t.find(Ce=>Ce.id===ae);if(!ge)return;if(ce=ge.id,ue=ge.title,ge.chapters[0]){const Ce=R.filter(We=>We.partId===ge.id&&We.chapterId===ge.chapters[0].id);oe=((q=Ce[Ce.length-1])==null?void 0:q.id)??null}}const F=U.sections.map(ge=>ge.id),G=R.filter(ge=>!F.includes(ge.id));let te=G.length;if(oe){const ge=G.findIndex(Ce=>Ce.id===oe);ge>=0&&(te=ge+1)}const be=F.map(ge=>({...ie.get(ge),partId:ce,partTitle:ue,chapterId:U.id,chapterTitle:U.title}));await r([...G.slice(0,te),...be,...G.slice(te)]);return}if(z.type==="section"&&(re==="section"||re==="chapter"||re==="part")){if(!pe)return;const{partId:$,partTitle:U,chapterId:ce,chapterTitle:ue}=pe,oe=R.findIndex(ge=>ge.id===z.id);if(oe===-1)return;const F=R.filter(ge=>ge.id!==z.id);let G;if(re==="section"){const ge=F.findIndex(Ce=>Ce.id===ae);G=ge>=0?ge+1:F.length}else if(re==="chapter"){const ge=F.filter(Ce=>Ce.chapterId===ae).pop();G=ge?F.findIndex(Ce=>Ce.id===ge.id)+1:F.length}else{const ge=t.find(Ce=>Ce.id===ae);if(ge!=null&&ge.chapters[0]){const Ce=F.filter(gt=>gt.partId===ge.id&>.chapterId===ge.chapters[0].id),We=Ce[Ce.length-1];G=We?F.findIndex(gt=>gt.id===We.id)+1:F.length}else G=F.length}const be={...R[oe],partId:$,partTitle:U,chapterId:ce,chapterTitle:ue};F.splice(G,0,be),await r(F)}},[t,K,r]),H=(V,re,ae)=>({onDragEnter:pe=>{pe.preventDefault(),pe.stopPropagation(),pe.dataTransfer.dropEffect="move",C({type:V,id:re})},onDragOver:pe=>{pe.preventDefault(),pe.stopPropagation(),pe.dataTransfer.dropEffect="move",C({type:V,id:re})},onDragLeave:()=>C(null),onDrop:pe=>{C(null);const I=cg(pe.dataTransfer.getData("text/plain"));I&&(V==="section"&&I.type==="section"&&I.id===re||(V==="part"?I.type==="part"?_(pe,"part",re):ae&&_(pe,"part",re,ae):V==="chapter"&&ae?(I.type==="section"||I.type==="chapter")&&_(pe,"chapter",re,ae):V==="section"&&ae&&_(pe,"section",re,ae)))}}),P=V=>sj[V%sj.length],ee=V=>t.slice(0,V).filter(re=>!U9(re)).length,Q=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,re)=>{var U,ce,ue,oe;const ae=V.title==="序言"||V.title.includes("序言"),pe=V.title==="尾声"||V.title.includes("尾声"),I=V.title==="附录"||V.title.includes("附录"),z=O("part",V.id),R=e.includes(V.id),ie=V.chapters.length,q=V.chapters.reduce((F,G)=>F+G.sections.length,0);if(ae&&V.chapters.length===1&&V.chapters[0].sections.length===1){const F=V.chapters[0].sections[0],G=O("section",F.id),te={partId:V.id,partTitle:V.title,chapterId:V.chapters[0].id,chapterTitle:V.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:be=>{be.stopPropagation(),be.dataTransfer.setData("text/plain","section:"+F.id),be.dataTransfer.effectAllowed="move",k({type:"section",id:F.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] ${G?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${L("section",F.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...H("section",F.id,te),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(ei,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:be=>be.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:x.includes(F.id),onChange:()=>y(F.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(er,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[V.chapters[0].title," | ",F.title]}),w.includes(F.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(kc,{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:be=>be.stopPropagation(),onClick:be=>be.stopPropagation(),children:[F.price===0||F.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:["¥",F.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",F.clickCount??0," · 付款 ",F.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(F.hotScore??0).toFixed(1)," · 第",F.hotRank&&F.hotRank>0?F.hotRank:"-","名"]}),v&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(F),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(F),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(en,{className:"w-3.5 h-3.5"})}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(F),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(js,{className:"w-3.5 h-3.5"})})]})]})]},V.id)}if(V.title==="2026每日派对干货"||V.title.includes("2026每日派对干货")){const F=O("part",V.id);return s.jsxs("div",{className:`rounded-xl border overflow-hidden transition-all duration-200 ${F?"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:((ce=V.chapters[0])==null?void 0:ce.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:G=>{G.stopPropagation(),G.dataTransfer.setData("text/plain","part:"+V.id),G.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 ${L("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(ei,{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:rj(V)})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:G=>G.stopPropagation(),onClick:G=>G.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(Dn,{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(en,{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(js,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",title:"本篇章数与节数",children:[ie," 章 · ",q," 节"]}),s.jsx("button",{type:"button",draggable:!1,className:"p-1 rounded-md hover:bg-white/10 text-gray-500",title:R?"收起":"展开",onMouseDown:G=>G.stopPropagation(),onClick:G=>{G.stopPropagation(),n(V.id)},children:R?s.jsx(Pc,{className:"w-5 h-5"}):s.jsx(ll,{className:"w-5 h-5"})})]})]}),R&&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(G=>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:G.title}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:te=>te.stopPropagation(),children:[m&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>m(V,G),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(en,{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(Dn,{className:"w-3.5 h-3.5"})}),u&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>u(V,G),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(js,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:G.sections.map(te=>{const be=O("section",te.id);return s.jsxs("div",{draggable:!0,onDragStart:ge=>{ge.stopPropagation(),ge.dataTransfer.setData("text/plain","section:"+te.id),ge.dataTransfer.effectAllowed="move",k({type:"section",id:te.id})},onDragEnd:()=>{k(null),C(null)},onClick:()=>a(te),className:`flex items-center justify-between py-2 px-3 rounded-lg min-h-[40px] cursor-pointer select-none transition-all duration-200 ${be?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${L("section",te.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...H("section",te.id,{partId:V.id,partTitle:V.title,chapterId:G.id,chapterTitle:G.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(ei,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:ge=>ge.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:x.includes(te.id),onChange:()=>y(te.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:Q(te)}),w.includes(te.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(kc,{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:ge=>ge.stopPropagation(),children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",te.clickCount??0," · 付款 ",te.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(te.hotScore??0).toFixed(1)," · 第",te.hotRank&&te.hotRank>0?te.hotRank:"-","名"]}),v&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>v(te),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(te),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(en,{className:"w-3.5 h-3.5"})}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(te),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(js,{className:"w-3.5 h-3.5"})})]})]},te.id)})})]},G.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((F,G)=>F.sections.length>0?F.sections.map(te=>{const be=O("section",te.id);return s.jsxs("div",{draggable:!0,onDragStart:ge=>{ge.stopPropagation(),ge.dataTransfer.setData("text/plain","section:"+te.id),ge.dataTransfer.effectAllowed="move",k({type:"section",id:te.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 ${be?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${L("section",te.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...H("section",te.id,{partId:V.id,partTitle:V.title,chapterId:F.id,chapterTitle:F.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(ei,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:ge=>ge.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:x.includes(te.id),onChange:()=>y(te.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:["附录",G+1," | ",F.title," | ",te.title]}),w.includes(te.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(kc,{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:["点击 ",te.clickCount??0," · 付款 ",te.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(te.hotScore??0).toFixed(1)," · 第",te.hotRank&&te.hotRank>0?te.hotRank:"-","名"]}),v&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>v(te),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(te),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(en,{className:"w-3.5 h-3.5"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>i(te),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(js,{className:"w-3.5 h-3.5"})})]})]}),s.jsx(ll,{className:"w-4 h-4 text-gray-500 shrink-0"})]},te.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:["附录",G+1," | ",F.title,"(空)"]}),s.jsx(ll,{className:"w-4 h-4 text-gray-500 shrink-0"})]},F.id))})]},V.id);if(pe&&V.chapters.length===1&&V.chapters[0].sections.length===1){const F=V.chapters[0].sections[0],G=O("section",F.id),te={partId:V.id,partTitle:V.title,chapterId:V.chapters[0].id,chapterTitle:V.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:be=>{be.stopPropagation(),be.dataTransfer.setData("text/plain","section:"+F.id),be.dataTransfer.effectAllowed="move",k({type:"section",id:F.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] ${G?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${L("section",F.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...H("section",F.id,te),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(ei,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:be=>be.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:x.includes(F.id),onChange:()=>y(F.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(er,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[V.chapters[0].title," | ",F.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:be=>be.stopPropagation(),onClick:be=>be.stopPropagation(),children:[F.price===0||F.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:["¥",F.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",F.clickCount??0," · 付款 ",F.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(F.hotScore??0).toFixed(1)," · 第",F.hotRank&&F.hotRank>0?F.hotRank:"-","名"]}),v&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(F),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(F),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(en,{className:"w-3.5 h-3.5"})}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(F),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(js,{className:"w-3.5 h-3.5"})})]})]})]},V.id)}return pe?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(F=>F.sections.map(G=>{const te=O("section",G.id);return s.jsxs("div",{draggable:!0,onDragStart:be=>{be.stopPropagation(),be.dataTransfer.setData("text/plain","section:"+G.id),be.dataTransfer.effectAllowed="move",k({type:"section",id:G.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 ${te?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${L("section",G.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...H("section",G.id,{partId:V.id,partTitle:V.title,chapterId:F.id,chapterTitle:F.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(ei,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:be=>be.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:x.includes(G.id),onChange:()=>y(G.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-300",children:[F.title," | ",G.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",G.clickCount??0," · 付款 ",G.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(G.hotScore??0).toFixed(1)," · 第",G.hotRank&&G.hotRank>0?G.hotRank:"-","名"]}),v&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(G),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(G),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(en,{className:"w-3.5 h-3.5"})}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(G),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(js,{className:"w-3.5 h-3.5"})})]})]})]},G.id)}))})]},V.id):s.jsxs("div",{className:`rounded-xl border bg-[#1C1C1E] overflow-hidden transition-all duration-200 ${z?"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:((ue=V.chapters[0])==null?void 0:ue.id)??"",chapterTitle:((oe=V.chapters[0])==null?void 0:oe.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:F=>{F.stopPropagation(),F.dataTransfer.setData("text/plain","part:"+V.id),F.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 ${L("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(ei,{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||P(ee(re))}),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:rj(V)})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:F=>F.stopPropagation(),onClick:F=>F.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(Dn,{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(en,{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(js,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",title:"本篇章数与节数",children:[ie," 章 · ",q," 节"]}),s.jsx("button",{type:"button",draggable:!1,className:"p-1 rounded-md hover:bg-white/10 text-gray-500",title:R?"收起":"展开",onMouseDown:F=>F.stopPropagation(),onClick:F=>{F.stopPropagation(),n(V.id)},children:R?s.jsx(Pc,{className:"w-5 h-5"}):s.jsx(ll,{className:"w-5 h-5"})})]})]}),R&&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(F=>{const G=O("chapter",F.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:te=>{te.stopPropagation(),te.dataTransfer.setData("text/plain","chapter:"+F.id),te.dataTransfer.effectAllowed="move",k({type:"chapter",id:F.id})},onDragEnd:()=>{k(null),C(null)},onDragEnter:te=>{te.preventDefault(),te.stopPropagation(),te.dataTransfer.dropEffect="move",C({type:"chapter",id:F.id})},onDragOver:te=>{te.preventDefault(),te.stopPropagation(),te.dataTransfer.dropEffect="move",C({type:"chapter",id:F.id})},onDragLeave:()=>C(null),onDrop:te=>{C(null);const be=cg(te.dataTransfer.getData("text/plain"));if(!be)return;const ge={partId:V.id,partTitle:V.title,chapterId:F.id,chapterTitle:F.title};(be.type==="section"||be.type==="chapter")&&_(te,"chapter",F.id,ge)},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 ${G?"bg-[#38bdac]/15 ring-1 ring-[#38bdac]/50":""} ${L("chapter",F.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/30"}`,children:[s.jsx(ei,{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:F.title})]}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:te=>te.stopPropagation(),children:[m&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>m(V,F),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(en,{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(Dn,{className:"w-3.5 h-3.5"})}),u&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>u(V,F),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(js,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:F.sections.map(te=>{const be=O("section",te.id);return s.jsxs("div",{draggable:!0,onDragStart:ge=>{ge.stopPropagation(),ge.dataTransfer.setData("text/plain","section:"+te.id),ge.dataTransfer.effectAllowed="move",k({type:"section",id:te.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 ${be?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${L("section",te.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] shadow-lg":"hover:bg-[#162840]/50"}`,...H("section",te.id,{partId:V.id,partTitle:V.title,chapterId:F.id,chapterTitle:F.title}),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:ge=>ge.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:x.includes(te.id),onChange:()=>y(te.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx(ei,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),s.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${te.price===0||te.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:Q(te)}),w.includes(te.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(kc,{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:ge=>ge.stopPropagation(),onClick:ge=>ge.stopPropagation(),children:[te.isNew&&s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"NEW"}),te.price===0||te.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:["¥",te.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",title:"点击次数 · 付款笔数",children:["点击 ",te.clickCount??0," · 付款 ",te.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(te.hotScore??0).toFixed(1)," · 第",te.hotRank&&te.hotRank>0?te.hotRank:"-","名"]}),v&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>v(te),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(te),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(en,{className:"w-3.5 h-3.5"})}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(te),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(js,{className:"w-3.5 h-3.5"})})]})]})]},te.id)})})]},F.id)})})]},V.id)})})}function K9(t){var a;const e=new URLSearchParams;e.set("page",String(t.page)),e.set("limit",String(t.limit)),(a=t==null?void 0:t.keyword)!=null&&a.trim()&&e.set("keyword",t.keyword.trim());const n=e.toString(),r=n?`/api/admin/ckb/devices?${n}`:"/api/admin/ckb/devices";return De(r)}function q9(t){return De(`/api/db/person?personId=${encodeURIComponent(t)}`)}function G9(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 De(n?`/api/admin/ckb/plans?${n}`:"/api/admin/ckb/plans")}const S4=11,aj={personId:"",name:"",boundUserId:"",aliases:"",label:"",sceneId:S4,ckbApiKey:"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:"phone",remarkFormat:"",addFriendInterval:1,startTime:"06:00",endTime:"22:00",deviceGroups:""};function J9({open:t,onOpenChange:e,editingPerson:n,onSubmit:r}){var I;const a=!!n,[i,o]=b.useState(aj),[c,u]=b.useState(!1),[h,f]=b.useState(!1),[m,x]=b.useState([]),[y,v]=b.useState(!1),[w,N]=b.useState(""),[k,E]=b.useState([]),[C,L]=b.useState(!1),[O,K]=b.useState(""),[_,H]=b.useState(!1),[P,ee]=b.useState({});b.useEffect(()=>{t&&(N(""),o(n?{personId:n.personId??n.name??"",name:n.name??"",boundUserId:n.userId??"",aliases:n.aliases??"",label:n.label??"",sceneId:S4,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??""}:{...aj}),ee({}),m.length===0&&Q(""),k.length===0&&V(""))},[t,n]);const Q=async z=>{v(!0);try{const R=await K9({page:1,limit:50,keyword:z});R!=null&&R.success&&Array.isArray(R.devices)?x(R.devices):R!=null&&R.error&&X.error(R.error)}catch(R){X.error(R instanceof Error?R.message:"加载设备列表失败")}finally{v(!1)}},V=async z=>{L(!0);try{const R=await G9({page:1,limit:100,keyword:z});R!=null&&R.success&&Array.isArray(R.plans)?E(R.plans):R!=null&&R.error&&X.error(R.error)}catch{X.error("加载计划列表失败")}finally{L(!1)}},re=z=>{const R=Array.isArray(z.deviceGroups)?z.deviceGroups.map(String).join(","):"";o(ie=>({...ie,ckbApiKey:z.apiKey||"",greeting:z.greeting||ie.greeting,tips:z.tips||ie.tips,remarkType:z.remarkType||ie.remarkType,remarkFormat:z.remarkFormat||ie.remarkFormat,addFriendInterval:z.addInterval||ie.addFriendInterval,startTime:z.startTime||ie.startTime,endTime:z.endTime||ie.endTime,deviceGroups:R||ie.deviceGroups})),H(!1),X.success(`已选择计划「${z.name}」,参数已覆盖`)},ae=O.trim()?k.filter(z=>(z.name||"").includes(O.trim())||String(z.id).includes(O.trim())):k,pe=async()=>{var q;const z={};(!i.name||!String(i.name).trim())&&(z.name="请填写名称");const R=i.addFriendInterval;if((typeof R!="number"||R<1)&&(z.addFriendInterval="添加间隔至少为 1 分钟"),(((q=i.deviceGroups)==null?void 0:q.split(",").map($=>$.trim()).filter(Boolean))??[]).length===0&&(z.deviceGroups="请至少选择 1 台设备"),ee(z),Object.keys(z).length>0){X.error(z.name||z.addFriendInterval||z.deviceGroups||"请完善必填项");return}u(!0);try{await r(i),e(!1)}catch($){X.error($ instanceof Error?$.message:"保存失败")}finally{u(!1)}};return s.jsx($t,{open:t,onOpenChange:e,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-4xl max-h-[90vh] overflow-y-auto",children:[s.jsxs(Ft,{children:[s.jsx(Bt,{className:"text-[#38bdac]",children:a?"编辑人物":"添加人物 — 存客宝 API 获客"}),s.jsx(uf,{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(Z,{className:"text-gray-400 text-xs",children:["名称 ",s.jsx("span",{className:"text-red-400",children:"*"})]}),s.jsx(le,{className:`bg-[#0a1628] text-white ${P.name?"border-red-500 focus-visible:ring-red-500":"border-gray-700"}`,placeholder:"如 卡若",value:i.name,onChange:z=>{o(R=>({...R,name:z.target.value})),P.name&&ee(R=>({...R,name:void 0}))}}),P.name&&s.jsx("p",{className:"text-xs text-red-400",children:P.name})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"人物ID(可选)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"自动生成",value:i.personId,onChange:z=>o(R=>({...R,personId:z.target.value})),disabled:a})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"标签(身份/角色)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 超级个体",value:i.label,onChange:z=>o(R=>({...R,label:z.target.value}))})]}),s.jsxs("div",{className:"space-y-1.5 col-span-3",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"绑定会员用户 ID(可选,与「用户管理」中用户 id 一致)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-xs",placeholder:"留空则不绑定;填写后获客统计可与超级个体对齐",value:i.boundUserId,onChange:z=>o(R=>({...R,boundUserId:z.target.value.trim()}))}),s.jsx("p",{className:"text-[11px] text-gray-500",children:"保存前请在用户管理中核对 id;同一会员只能绑定一个 @人物。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"别名(逗号分隔,@ 可匹配)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 卡卡, 若若",value:i.aliases,onChange:z=>o(R=>({...R,aliases:z.target.value}))})]})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-5",children:[s.jsx("p",{className:"text-xs font-medium text-gray-400 uppercase tracking-wider mb-4",children:"存客宝 API 获客配置"}),s.jsxs("div",{className:"grid grid-cols-2 gap-x-8 gap-y-4",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5 relative",children:[s.jsx(Z,{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:()=>H(!_),children:i.ckbApiKey?s.jsx("span",{className:"text-white truncate",children:((I=k.find(z=>z.apiKey===i.ckbApiKey))==null?void 0:I.name)||`获客计划 (${i.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:()=>{V(O),H(!0)},disabled:C,children:C?"加载...":"刷新"})]}),_&&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(le,{className:"bg-[#050c18] border-gray-700 text-white h-8 text-xs",placeholder:"搜索计划名称...",value:O,onChange:z=>K(z.target.value),onKeyDown:z=>{z.key==="Enter"&&V(O)},autoFocus:!0})}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:ae.length===0?s.jsx("div",{className:"text-center py-4 text-gray-500 text-xs",children:C?"加载中...":"暂无计划"}):ae.map(z=>s.jsxs("div",{className:`px-3 py-2 cursor-pointer hover:bg-[#38bdac]/10 text-sm flex items-center justify-between ${i.ckbApiKey===z.apiKey?"bg-[#38bdac]/20 text-[#38bdac]":"text-white"}`,onClick:()=>re(z),children:[s.jsxs("div",{className:"truncate",children:[s.jsx("span",{className:"font-medium",children:z.name}),s.jsxs("span",{className:"text-xs text-gray-500 ml-2",children:["ID:",String(z.id)]})]}),z.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(z.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:()=>H(!1),children:"关闭"})})]}),s.jsx("p",{className:"text-xs text-gray-500",children:"选择计划后自动覆盖下方参数。新建人物时若不选择则自动创建新计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(Z,{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 ${P.deviceGroups?"border-red-500":"border-gray-700"}`,children:[s.jsx(le,{className:"bg-[#0a1628] border-0 text-white focus-visible:ring-0 focus-visible:ring-offset-0",placeholder:"未选择设备",readOnly:!0,value:i.deviceGroups?`已选择 ${i.deviceGroups.split(",").filter(Boolean).length} 个设备`:"",onClick:()=>f(!0)}),s.jsx(J,{type:"button",variant:"outline",className:"border-0 border-l border-inherit rounded-r-md text-gray-200",onClick:()=>f(!0),children:"选择"})]}),P.deviceGroups?s.jsx("p",{className:"text-xs text-red-400",children:P.deviceGroups}):s.jsx("p",{className:"text-xs text-gray-500",children:"从存客宝设备列表中选择,至少选择 1 台设备参与获客计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"好友备注"}),s.jsxs(Nc,{value:i.remarkType,onValueChange:z=>o(R=>({...R,remarkType:z})),children:[s.jsx(il,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(wc,{placeholder:"选择备注类型"})}),s.jsxs(ol,{children:[s.jsx(Ys,{value:"phone",children:"手机号"}),s.jsx(Ys,{value:"nickname",children:"昵称"}),s.jsx(Ys,{value:"source",children:"来源"})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"备注格式(手机号+标签,标签不超过6字)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 {手机号}-{来源标签},总长不超过10字",value:i.remarkFormat,onChange:z=>o(R=>({...R,remarkFormat:z.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(Z,{className:"text-gray-400 text-xs",children:"打招呼语"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"你好,请通过",value:i.greeting,onChange:z=>o(R=>({...R,greeting:z.target.value}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"添加间隔(分钟)"}),s.jsx(le,{type:"number",min:1,className:`bg-[#0a1628] text-white ${P.addFriendInterval?"border-red-500 focus-visible:ring-red-500":"border-gray-700"}`,value:i.addFriendInterval,onChange:z=>{o(R=>({...R,addFriendInterval:Number(z.target.value)||1})),P.addFriendInterval&&ee(R=>({...R,addFriendInterval:void 0}))}}),P.addFriendInterval&&s.jsx("p",{className:"text-xs text-red-400",children:P.addFriendInterval})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"允许加人时间段"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(le,{type:"time",className:"bg-[#0a1628] border-gray-700 text-white w-24",value:i.startTime,onChange:z=>o(R=>({...R,startTime:z.target.value}))}),s.jsx("span",{className:"text-gray-500 text-sm shrink-0",children:"至"}),s.jsx(le,{type:"time",className:"bg-[#0a1628] border-gray-700 text-white w-24",value:i.endTime,onChange:z=>o(R=>({...R,endTime:z.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"获客成功提示"}),s.jsx(wl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[72px] resize-none",placeholder:"请注意消息,稍后加你微信",value:i.tips,onChange:z=>o(R=>({...R,tips:z.target.value}))})]})]})]})]})]}),s.jsxs(yn,{className:"gap-3 pt-2",children:[s.jsx(J,{variant:"outline",onClick:()=>e(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(J,{onClick:pe,disabled:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:c?"保存中...":a?"保存":"添加"})]}),h&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",children:s.jsxs("div",{className:"w-full max-w-3xl max-h-[80vh] bg-[#0b1828] border border-gray-700 rounded-xl shadow-xl flex flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-gray-700/60",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-medium text-white",children:"选择设备"}),s.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"勾选需要参与本计划的设备,可多选"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(J,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-200 h-8",onClick:()=>{const z=m.map(q=>String(q.id??"")),R=i.deviceGroups?i.deviceGroups.split(",").map(q=>q.trim()).filter(Boolean):[],ie=z.length>0&&z.every(q=>R.includes(q));o(q=>({...q,deviceGroups:ie?"":z.join(",")})),!ie&&z.length>0&&ee(q=>({...q,deviceGroups:void 0}))},children:(()=>{const z=m.map(ie=>String(ie.id??"")),R=i.deviceGroups?i.deviceGroups.split(",").map(ie=>ie.trim()).filter(Boolean):[];return z.length>0&&z.every(ie=>R.includes(ie))?"取消全选":"全选"})()}),s.jsx(le,{className:"bg-[#050c18] border-gray-700 text-white h-8 w-52",placeholder:"搜索备注/微信号/IMEI",value:w,onChange:z=>N(z.target.value),onKeyDown:z=>{z.key==="Enter"&&Q(w)}}),s.jsx(J,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-200 h-8",onClick:()=>Q(w),disabled:y,children:"刷新"}),s.jsx(J,{type:"button",size:"icon",variant:"outline",className:"border-gray-600 text-gray-300 h-8 w-8",onClick:()=>f(!1),children:"✕"})]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:y?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-400 text-sm",children:"正在加载设备列表…"}):m.length===0?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-500 text-sm",children:"暂无设备数据,请检查存客宝账号与开放 API 配置"}):s.jsx("div",{className:"p-4 space-y-2",children:m.map(z=>{const R=String(z.id??""),ie=i.deviceGroups?i.deviceGroups.split(",").map(U=>U.trim()).filter(Boolean):[],q=ie.includes(R),$=()=>{let U;q?U=ie.filter(ce=>ce!==R):U=[...ie,R],o(ce=>({...ce,deviceGroups:U.join(",")})),U.length>0&&ee(ce=>({...ce,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:q,onChange:$}),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:z.memo||z.wechatId||`设备 ${R}`}),z.status==="online"&&s.jsx("span",{className:"rounded-full bg-emerald-500/20 text-emerald-400 text-[11px] px-2 py-0.5",children:"在线"}),z.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: ",R]}),z.wechatId&&s.jsxs("span",{className:"mr-3",children:["微信号: ",z.wechatId]}),typeof z.totalFriend=="number"&&s.jsxs("span",{children:["好友数: ",z.totalFriend]})]})]})]},R)})})}),s.jsxs("div",{className:"flex justify-between items-center px-5 py-3 border-t border-gray-700/60",children:[s.jsxs("span",{className:"text-xs text-gray-400",children:["已选择"," ",i.deviceGroups?i.deviceGroups.split(",").filter(Boolean).length:0," ","台设备"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(J,{type:"button",variant:"outline",className:"border-gray-600 text-gray-200 h-8 px-4",onClick:()=>f(!1),children:"取消"}),s.jsx(J,{type:"button",className:"bg-[#38bdac] hover:bg-[#2da396] text-white h-8 px-4",onClick:()=>f(!1),children:"确定"})]})]})]})})]})})}function Q9(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})}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 Y9(){var Ho,Hl,Di;const t=Ra(),[e,n]=b.useState([]),[r,a]=b.useState(!0),[i,o]=b.useState([]),[c,u]=b.useState(null),[h,f]=b.useState(!1),[m,x]=b.useState(!1),[y,v]=b.useState(!1),[w,N]=b.useState(""),[k,E]=b.useState([]),[C,L]=b.useState(!1),[O,K]=b.useState({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),[_,H]=b.useState(null),[P,ee]=b.useState(!1),[Q,V]=b.useState(!1),[re,ae]=b.useState(null),[pe,I]=b.useState(!1),[z,R]=b.useState([]),[ie,q]=b.useState(!1),[$,U]=b.useState(""),[ce,ue]=b.useState(""),[oe,F]=b.useState(!1),[G,te]=b.useState(""),[be,ge]=b.useState(!1),[Ce,We]=b.useState(null),[gt,Lt]=b.useState(!1),[yt,Ot]=b.useState(!1),[It,Pn]=b.useState({readWeight:.5,recencyWeight:.3,payWeight:.2}),[vn,Ht]=b.useState(!1),[Xt,Cn]=b.useState(!1),[Fn,Un]=b.useState(1),[At,xn]=b.useState([]),[Nn,ve]=b.useState(!1),[Te,Ve]=b.useState([]),[st,Mt]=b.useState(!1),[jt,D]=b.useState(20),[Ie,vt]=b.useState(!1),[Rt,bt]=b.useState(!1),[it,Dt]=b.useState([]),[Jt,an]=b.useState([]),[as,nr]=b.useState([]),[Ni,ca]=b.useState(!1),[da,zr]=b.useState(1),[$r,Fr]=b.useState(20),[xr,gr]=b.useState(0),[Oa,sr]=b.useState(1),[Ms,rr]=b.useState(""),[yr,As]=b.useState(!1),[se,ye]=b.useState(null),[Ge,ft]=b.useState({tagId:"",label:"",aliases:"",url:"",type:"url",appId:"",appSecret:"",pagePath:""}),[Wn,Fs]=b.useState(!1),[Da,_a]=b.useState(!1),[Lo,ar]=b.useState(null),[Is,wi]=b.useState(null),[Ut,Dl]=b.useState({}),[ir,Oo]=b.useState(!1),[ua,_l]=b.useState(""),[za,$a]=b.useState(""),[wn,ed]=b.useState([]),[Qn,td]=b.useState(0),[Br,Do]=b.useState(1),[ji,ha]=b.useState(!1),[br,Vr]=b.useState(""),fa=b.useRef(null),ki=b.useCallback(async(T,B)=>{var ht;const de=new FormData;de.append("file",T),de.append("folder",B);const He=await(await fetch(Oc("/api/upload"),{method:"POST",body:de,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((ht=He==null?void 0:He.data)==null?void 0:ht.url)||(He==null?void 0:He.url)||""},[]),Fa=b.useCallback(T=>ki(T,"book-images"),[ki]),Si=b.useCallback(T=>{const B=T.type.startsWith("video/")?"book-videos":"book-attachments";return ki(T,B)},[ki]),[Ci,Hr]=b.useState({}),Ti=T=>String(T||"").trim().slice(0,8),_o=b.useMemo(()=>{const T=new Map;return At.forEach((B,de)=>{T.set(B.id,de+1)}),T},[At]),mt=Q9(e,_o,Ci),vr=e.length,Ba=10,Va=Math.max(1,Math.ceil(At.length/Ba)),zo=At.slice((Fn-1)*Ba,Fn*Ba),hn=async()=>{a(!0);try{const T=await De("/api/db/book?action=list",{cache:"no-store"});n(Array.isArray(T==null?void 0:T.sections)?T.sections:[])}catch(T){console.error(T),n([])}finally{a(!1)}},zl=async()=>{try{const T=await De("/api/db/config?key=book_part_badges",{cache:"no-store"});let B={};if(T&&Array.isArray(T.data)){const je=T.data.find(He=>He&&He.configKey==="book_part_badges");je&&je.configValue&&typeof je.configValue=="object"&&!Array.isArray(je.configValue)&&(B=je.configValue)}else T&&T.data&&typeof T.data=="object"&&!Array.isArray(T.data)&&(B=T.data);const de={};Object.keys(B).forEach(je=>{const He=Ti(B[je]);He&&(de[je]=He)}),Hr(de)}catch(T){console.error(T),Hr({})}},Bs=async()=>{ve(!0);try{const T=await De("/api/db/book?action=ranking",{cache:"no-store"}),B=Array.isArray(T==null?void 0:T.sections)?T.sections:[];xn(B);const de=B.filter(je=>je.isPinned).map(je=>je.id);Ve(de)}catch(T){console.error(T),xn([])}finally{ve(!1)}};b.useEffect(()=>{hn(),Bs(),zl()},[]);const Nr=T=>{o(B=>B.includes(T)?B.filter(de=>de!==T):[...B,T])},Vs=b.useCallback(T=>{const B=e,de=T.flatMap(je=>{const He=B.find(ht=>ht.id===je.id);return He?[{...He,partId:je.partId,partTitle:je.partTitle,chapterId:je.chapterId,chapterTitle:je.chapterTitle}]:[]});return n(de),Zt("/api/db/book",{action:"reorder",items:T}).then(je=>{je&&je.success===!1&&(n(B),X.error("排序失败: "+(je&&typeof je=="object"&&"error"in je?je.error:"未知错误")))}).catch(je=>{n(B),console.error("排序失败:",je),X.error("排序失败: "+(je instanceof Error?je.message:"网络或服务异常"))}),Promise.resolve()},[e]),Rs=async T=>{if(confirm(`确定要删除章节「${T.title}」吗?此操作不可恢复。`))try{const B=await di(`/api/db/book?id=${encodeURIComponent(T.id)}`);B&&B.success!==!1?(X.success("已删除"),hn(),Bs()):X.error("删除失败: "+(B&&typeof B=="object"&&"error"in B?B.error:"未知错误"))}catch(B){console.error(B),X.error("删除失败")}},Ps=b.useCallback(async()=>{Ht(!0);try{const T=await De("/api/db/config/full?key=article_ranking_weights",{cache:"no-store"}),B=T&&T.data;B&&typeof B.readWeight=="number"&&typeof B.recencyWeight=="number"&&typeof B.payWeight=="number"&&Pn({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{Ht(!1)}},[]);b.useEffect(()=>{yt&&Ps()},[yt,Ps]);const pa=async()=>{const{readWeight:T,recencyWeight:B,payWeight:de}=It,je=T+B+de;if(Math.abs(je-1)>.001){X.error("三个权重之和必须等于 1");return}Cn(!0);try{const He=await St("/api/db/config",{key:"article_ranking_weights",value:{readWeight:T,recencyWeight:B,payWeight:de},description:"文章排名算法权重"});He&&He.success!==!1?(X.success("排名权重已保存"),Ot(!1),hn(),Bs()):X.error("保存失败: "+(He&&typeof He=="object"&&"error"in He?He.error:""))}catch(He){console.error(He),X.error("保存失败")}finally{Cn(!1)}},Ur=b.useCallback(async()=>{Mt(!0);try{const T=await De("/api/db/config/full?key=pinned_section_ids",{cache:"no-store"}),B=T&&T.data;Array.isArray(B)&&Ve(B)}catch{}finally{Mt(!1)}},[]),Yn=b.useCallback(async()=>{try{const T=await De("/api/db/persons");T!=null&&T.success&&T.persons&&Dt(T.persons.map(B=>{const de=B.deviceGroups,je=Array.isArray(de)?de.join(","):de??"";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}}))}catch{}},[]),Hs=b.useCallback(async()=>{try{const T=await De("/api/db/link-tags");T!=null&&T.success&&T.linkTags&&an(T.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{}},[]),Wr=b.useCallback(async()=>{try{const T=await De("/api/db/config/full?key=ckb_lead_webhook_url",{cache:"no-store"});T!=null&&T.success&&typeof T.data=="string"&&Vr(T.data)}catch{}},[]),wr=b.useCallback(async()=>{try{const T=await De("/api/db/ckb-person-leads");if(T!=null&&T.success&&T.byPerson){const B={};for(const de of T.byPerson)B[de.token]=de.total;Dl(B)}}catch{}},[]),ma=b.useCallback(async(T,B,de=1)=>{_l(T),$a(B),Oo(!0),Do(de),ha(!0);try{const je=await De(`/api/db/ckb-person-leads?token=${encodeURIComponent(T)}&page=${de}&pageSize=20`);je!=null&&je.success?(ed(je.records||[]),td(je.total||0)):X.error((je==null?void 0:je.error)||"加载获客详情失败")}catch(je){X.error(je instanceof Error?je.message:"加载获客详情失败")}finally{ha(!1)}},[]),Kr=b.useCallback(async()=>{ca(!0);try{const T=new URLSearchParams({page:String(da),pageSize:String($r)}),B=Ms.trim();B&&T.set("search",B);const de=await De(`/api/db/link-tags?${T.toString()}`);if(de!=null&&de.success){const je=Array.isArray(de.linkTags)?de.linkTags:[];nr(je.map(He=>({id:He.tagId,label:He.label,aliases:He.aliases||"",url:He.url,type:He.type||"url",appId:He.appId||"",pagePath:He.pagePath||"",hasAppSecret:!!He.hasAppSecret}))),gr(typeof de.total=="number"?de.total:0),sr(typeof de.totalPages=="number"&&de.totalPages>0?de.totalPages:1)}}catch(T){console.error(T),X.error("加载链接标签失败")}finally{ca(!1)}},[da,$r,Ms]),[jr,$o]=b.useState([]),[Ha,Us]=b.useState(""),[xa,gs]=b.useState(!1),Ei=b.useRef(null),$l=b.useCallback(async()=>{try{const T=await De("/api/admin/linked-miniprograms");T!=null&&T.success&&Array.isArray(T.data)&&$o(T.data.map(B=>({...B,key:B.key})))}catch{}},[]),Ua=jr.filter(T=>!Ha.trim()||T.name.toLowerCase().includes(Ha.toLowerCase())||T.key&&T.key.toLowerCase().includes(Ha.toLowerCase())||T.appId.toLowerCase().includes(Ha.toLowerCase())),kr=async T=>{const B=Te.includes(T)?Te.filter(de=>de!==T):[...Te,T];Ve(B);try{await St("/api/db/config",{key:"pinned_section_ids",value:B,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"}),Bs()}catch{Ve(Te)}},qr=b.useCallback(async()=>{vt(!0);try{const T=await De("/api/db/config/full?key=unpaid_preview_percent",{cache:"no-store"}),B=T&&T.data;typeof B=="number"&&B>0&&B<=100&&D(B)}catch{}finally{vt(!1)}},[]),Mi=async()=>{if(jt<1||jt>100){X.error("预览比例需在 1~100 之间");return}bt(!0);try{const T=await St("/api/db/config",{key:"unpaid_preview_percent",value:jt,description:"小程序未付费内容默认预览比例(%)"});T&&T.success!==!1?X.success("预览比例已保存"):X.error("保存失败: "+(T.error||""))}catch{X.error("保存失败")}finally{bt(!1)}};b.useEffect(()=>{Ur(),qr(),Yn(),Hs(),wr(),$l(),Wr()},[Ur,qr,Yn,Hs,wr,$l,Wr]),b.useEffect(()=>{Kr()},[Kr]);const Ai=async T=>{We({section:T,orders:[]}),Lt(!0);try{const B=await De(`/api/db/book?action=section-orders&id=${encodeURIComponent(T.id)}`),de=B!=null&&B.success&&Array.isArray(B.orders)?B.orders:[];We(je=>je?{...je,orders:de}:null)}catch(B){console.error(B),We(de=>de?{...de,orders:[]}:null)}finally{Lt(!1)}},Ls=async T=>{x(!0);try{const B=T.mid!=null&&T.mid>0?`/api/db/book?action=read&mid=${T.mid}`:`/api/db/book?action=read&id=${encodeURIComponent(T.id)}`,de=await De(B);if(de!=null&&de.success&&de.section){const je=de.section,He=je.editionPremium===!0;u({id:T.id,originalId:T.id,title:de.section.title??T.title,price:de.section.price??T.price,content:de.section.content??"",filePath:T.filePath,isFree:T.isFree||T.price===0,isNew:je.isNew??T.isNew,isPinned:Te.includes(T.id),hotScore:T.hotScore??0,editionStandard:He?!1:je.editionStandard??!0,editionPremium:He})}else u({id:T.id,originalId:T.id,title:T.title,price:T.price,content:"",filePath:T.filePath,isFree:T.isFree,isNew:T.isNew,isPinned:Te.includes(T.id),hotScore:T.hotScore??0,editionStandard:!0,editionPremium:!1}),de&&!de.success&&X.error("无法读取文件内容: "+(de.error||"未知错误"))}catch(B){console.error(B),u({id:T.id,title:T.title,price:T.price,content:"",filePath:T.filePath,isFree:T.isFree})}finally{x(!1)}},Ii=async()=>{var T;if(c){v(!0);try{let B=c.content||"";const de=[new RegExp(`^#+\\s*${c.id.replace(".","\\.")}\\s+.*$`,"gm"),new RegExp(`^#+\\s*${c.id.replace(".","\\.")}[::].*$`,"gm"),new RegExp(`^#\\s+.*${(T=c.title)==null?void 0:T.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const Ln of de)B=B.replace(Ln,"");B=B.replace(/^\s*\n+/,"").trim();const je=c.originalId||c.id,He=c.id!==je,ht=await Zt("/api/db/book",{id:je,...He?{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,previewPercent:c.previewPercent??null,editionStandard:c.editionPremium?!1:c.editionStandard??!0,editionPremium:c.editionPremium??!1,saveToFile:!0},{timeout:w1}),Tt=He?c.id:je;c.isPinned!==Te.includes(Tt)&&await kr(Tt),ht&&ht.success!==!1?(X.success(`已保存:${c.title}`),u(null),hn(),Yn(),Hs()):X.error("保存失败: "+(ht&&typeof ht=="object"&&"error"in ht?ht.error:"未知错误"))}catch(B){console.error(B);const de=B instanceof Error&&B.name==="AbortError"?"保存超时,请检查网络或稍后重试":"保存失败";X.error(de)}finally{v(!1)}}},Ri=async()=>{if(!O.id||!O.title){X.error("请填写章节ID和标题");return}v(!0);try{const T=mt.find(je=>je.id===O.partId),B=T==null?void 0:T.chapters.find(je=>je.id===O.chapterId),de=await Zt("/api/db/book",{id:O.id,title:O.title,price:O.isFree?0:O.price,content:O.content||"",partId:O.partId,partTitle:(T==null?void 0:T.title)??"",chapterId:O.chapterId,chapterTitle:(B==null?void 0:B.title)??"",isFree:O.isFree,isNew:O.isNew,editionStandard:O.editionPremium?!1:O.editionStandard??!0,editionPremium:O.editionPremium??!1,hotScore:O.hotScore??0,saveToFile:!1},{timeout:w1});if(de&&de.success!==!1){if(O.isPinned){const je=[...Te,O.id];Ve(je);try{await St("/api/db/config",{key:"pinned_section_ids",value:je,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"})}catch{}}X.success(`章节创建成功:${O.title}`),f(!1),K({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),hn(),Yn(),Hs()}else X.error("创建失败: "+(de&&typeof de=="object"&&"error"in de?de.error:"未知错误"))}catch(T){console.error(T),X.error("创建失败")}finally{v(!1)}},Fl=T=>{K(B=>{var de;return{...B,partId:T.id,chapterId:((de=T.chapters[0])==null?void 0:de.id)??"chapter-1"}}),f(!0)},Pi=T=>{H({id:T.id,title:T.title,badgeText:Ti(T.badgeText)})},Li=async()=>{var T;if((T=_==null?void 0:_.title)!=null&&T.trim()){ee(!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||""})),de=await Zt("/api/db/book",{action:"reorder",items:B});if(de&&de.success!==!1){const je=_.title.trim(),He={...Ci},ht=Ti(_.badgeText);ht?He[_.id]=ht:delete He[_.id];const Tt=await St("/api/db/config",{key:"book_part_badges",value:He,description:"目录篇名角标(key=part_id, value=角标文案)"});if(Tt&&Tt.success===!1){X.error("更新篇名角标失败: "+(Tt.error||"未知错误"));return}Hr(He),n(Ln=>Ln.map(M=>M.partId===_.id?{...M,partTitle:je}:M)),H(null),hn()}else X.error("更新篇名失败: "+(de&&typeof de=="object"&&"error"in de?de.error:"未知错误"))}catch(B){console.error(B),X.error("更新篇名失败")}finally{ee(!1)}}},Bl=T=>{const B=T.chapters.length+1,de=`chapter-${T.id}-${B}-${Date.now()}`;K({id:`${B}.1`,title:"新章节",price:1,partId:T.id,chapterId:de,content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),f(!0)},is=(T,B)=>{const de=B.sections;let je=1,He=!1,ht=!1;if(de.length>0){const Tt=typeof de[0].price=="number"?de[0].price:Number(de[0].price)||1,Ln=!!(de[0].isFree||Tt===0);ht=de.some(M=>{const fe=typeof M.price=="number"?M.price:Number(M.price)||1,we=!!(M.isFree||fe===0);return fe!==Tt||we!==Ln}),je=Ln?0:Tt,He=Ln}ae({part:T,chapter:B,title:B.title,price:je,isFree:He,priceMixed:ht,initialTitle:B.title,initialPrice:je,initialIsFree:He})},Gr=async()=>{var He;if(!((He=re==null?void 0:re.title)!=null&&He.trim()))return;const T=re,B=T.title.trim(),de=B!==T.initialTitle,je=T.isFree!==T.initialIsFree||!T.isFree&&Number(T.price)!==Number(T.initialPrice);if(!de&&!je){X.info("未修改任何内容"),ae(null);return}if(T.priceMixed&&je){const ht=T.chapter.sections.length,Tt=T.isFree?"全部设为免费":`全部设为 ¥${T.price}`;if(!confirm(`本章 ${ht} 节当前定价不一致,保存后将${Tt},确定?`))return}I(!0);try{if(de){const ht=e.map(fe=>({id:fe.id,partId:fe.partId||T.part.id,partTitle:fe.partId===T.part.id?T.part.title:fe.partTitle||"",chapterId:fe.chapterId||T.chapter.id,chapterTitle:fe.partId===T.part.id&&fe.chapterId===T.chapter.id?B:fe.chapterTitle||""})),Tt=await Zt("/api/db/book",{action:"reorder",items:ht});if(Tt&&Tt.success===!1){X.error("保存章节名失败: "+(Tt&&typeof Tt=="object"&&"error"in Tt?Tt.error:"未知错误"));return}const Ln=T.part.id,M=T.chapter.id;n(fe=>fe.map(we=>we.partId===Ln&&we.chapterId===M?{...we,chapterTitle:B}:we))}if(je){const ht=await Zt("/api/db/book",{action:"update-chapter-pricing",partId:T.part.id,chapterId:T.chapter.id,price:T.isFree?0:Number(T.price)||0,isFree:T.isFree});if(ht&&ht.success===!1){X.error("保存定价失败: "+(ht&&typeof ht=="object"&&"error"in ht?ht.error:"未知错误")),de&&hn();return}}ae(null),hn(),X.success("已保存")}catch(ht){console.error(ht),X.error("保存失败")}finally{I(!1)}},Fo=async(T,B)=>{const de=B.sections.map(je=>je.id);if(de.length===0){X.info("该章下无小节,无需删除");return}if(confirm(`确定要删除「第${T.chapters.indexOf(B)+1}章 | ${B.title}」吗?将删除共 ${de.length} 节,此操作不可恢复。`))try{for(const je of de)await di(`/api/db/book?id=${encodeURIComponent(je)}`);hn()}catch(je){console.error(je),X.error("删除失败")}},Wa=async()=>{if(!G.trim()){X.error("请输入篇名");return}ge(!0);try{const T=`part-new-${Date.now()}`,B="chapter-1",de=`part-placeholder-${Date.now()}`,je=await Zt("/api/db/book",{id:de,title:"占位节(可编辑)",price:0,content:"",partId:T,partTitle:G.trim(),chapterId:B,chapterTitle:"第1章 | 待编辑",saveToFile:!1});je&&je.success!==!1?(X.success(`篇「${G}」创建成功`),V(!1),te(""),hn()):X.error("创建失败: "+(je&&typeof je=="object"&&"error"in je?je.error:"未知错误"))}catch(T){console.error(T),X.error("创建失败")}finally{ge(!1)}},Vl=async()=>{if(z.length===0){X.error("请先勾选要移动的章节");return}const T=mt.find(de=>de.id===$),B=T==null?void 0:T.chapters.find(de=>de.id===ce);if(!T||!B||!$||!ce){X.error("请选择目标篇和章");return}F(!0);try{const de=()=>{const Tt=new Set(z),Ln=e.map(Re=>({id:Re.id,partId:Re.partId||"",partTitle:Re.partTitle||"",chapterId:Re.chapterId||"",chapterTitle:Re.chapterTitle||""})),M=Ln.filter(Re=>Tt.has(Re.id)).map(Re=>({...Re,partId:$,partTitle:T.title||$,chapterId:ce,chapterTitle:B.title||ce})),fe=Ln.filter(Re=>!Tt.has(Re.id));let we=fe.length;for(let Re=fe.length-1;Re>=0;Re-=1){const Xe=fe[Re];if(Xe.partId===$&&Xe.chapterId===ce){we=Re+1;break}}return[...fe.slice(0,we),...M,...fe.slice(we)]},je=async()=>{const Tt=de(),Ln=await Zt("/api/db/book",{action:"reorder",items:Tt});return Ln&&Ln.success!==!1?(X.success(`已移动 ${z.length} 节到「${T.title}」-「${B.title}」`),q(!1),R([]),await hn(),!0):!1},He={action:"move-sections",sectionIds:z,targetPartId:$,targetChapterId:ce,targetPartTitle:T.title||$,targetChapterTitle:B.title||ce},ht=await Zt("/api/db/book",He);if(ht&&ht.success!==!1)X.success(`已移动 ${ht.count??z.length} 节到「${T.title}」-「${B.title}」`),q(!1),R([]),await hn();else{const Tt=ht&&typeof ht=="object"&&"error"in ht?ht.error||"":"未知错误";if((Tt.includes("缺少 id")||Tt.includes("无效的 action"))&&await je())return;X.error("移动失败: "+Tt)}}catch(de){console.error(de),X.error("移动失败: "+(de instanceof Error?de.message:"网络或服务异常"))}finally{F(!1)}},Oi=T=>{R(B=>B.includes(T)?B.filter(de=>de!==T):[...B,T])},Bo=async T=>{const B=e.filter(de=>de.partId===T.id).map(de=>de.id);if(B.length===0){X.info("该篇下暂无小节可删除");return}if(confirm(`确定要删除「${T.title}」整篇吗?将删除共 ${B.length} 节内容,此操作不可恢复。`))try{for(const de of B)await di(`/api/db/book?id=${encodeURIComponent(de)}`);hn()}catch(de){console.error(de),X.error("删除失败")}},ga=async()=>{var T;if(w.trim()){L(!0);try{const B=await De(`/api/search?q=${encodeURIComponent(w)}`);B!=null&&B.success&&((T=B.data)!=null&&T.results)?E(B.data.results):(E([]),B&&!B.success&&X.error("搜索失败: "+B.error))}catch(B){console.error(B),E([]),X.error("搜索失败")}finally{L(!1)}}},ys=mt.find(T=>T.id===O.partId),Vo=(ys==null?void 0:ys.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:["共 ",mt.length," 篇 · ",vr," 节内容"]})]}),s.jsx("div",{className:"flex gap-2",children:s.jsxs(J,{onClick:()=>Ot(!0),variant:"outline",className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:[s.jsx(Nh,{className:"w-4 h-4 mr-2"}),"排名算法"]})})]}),s.jsx($t,{open:h,onOpenChange:f,children:s.jsxs(zt,{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(Ft,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs(Bt,{className:"text-white flex items-center gap-2",children:[s.jsx(Dn,{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(Z,{className:"text-gray-300",children:"章节ID *"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 9.15",value:O.id,onChange:T=>K({...O,id:T.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"价格 (元)"}),s.jsx(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:O.isFree?0:O.price,onChange:T=>K({...O,price:Number(T.target.value),isFree:Number(T.target.value)===0}),disabled:O.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"免费"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:O.isFree,onChange:T=>K({...O,isFree:T.target.checked,price:T.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"最新新增"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:O.isNew,onChange:T=>K({...O,isNew:T.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"小程序直推"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:O.isPinned,onChange:T=>K({...O,isPinned:T.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{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:O.editionPremium!==!0,onChange:()=>K({...O,editionStandard:!0,editionPremium:!1}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"普通版"})]}),s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"new-edition-type",checked:O.editionPremium===!0,onChange:()=>K({...O,editionStandard:!1,editionPremium:!0}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"增值版"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"热度分"}),s.jsx(le,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:O.hotScore??0,onChange:T=>K({...O,hotScore:Math.max(0,parseFloat(T.target.value)||0)})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"章节标题 *"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入章节标题",value:O.title,onChange:T=>K({...O,title:T.target.value})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"所属篇"}),s.jsxs(Nc,{value:O.partId,onValueChange:T=>{var de;const B=mt.find(je=>je.id===T);K({...O,partId:T,chapterId:((de=B==null?void 0:B.chapters[0])==null?void 0:de.id)??"chapter-1"})},children:[s.jsx(il,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(wc,{})}),s.jsxs(ol,{className:"bg-[#0f2137] border-gray-700",children:[mt.map(T=>s.jsx(Ys,{value:T.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:T.title},T.id)),mt.length===0&&s.jsx(Ys,{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(Z,{className:"text-gray-300",children:"所属章"}),s.jsxs(Nc,{value:O.chapterId,onValueChange:T=>K({...O,chapterId:T}),children:[s.jsx(il,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(wc,{})}),s.jsxs(ol,{className:"bg-[#0f2137] border-gray-700",children:[Vo.map(T=>s.jsx(Ys,{value:T.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:T.title},T.id)),Vo.length===0&&s.jsx(Ys,{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(Z,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),s.jsx(f0,{content:O.content||"",onChange:T=>K({...O,content:T}),onImageUpload:Fa,onMediaUpload:Si,persons:it,linkTags:Jt,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(yn,{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:Ri,disabled:y||!O.id||!O.title,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:y?s.jsxs(s.Fragment,{children:[s.jsx(Fe,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Dn,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),s.jsx($t,{open:!!_,onOpenChange:T=>!T&&H(null),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Ft,{children:s.jsxs(Bt,{className:"text-white flex items-center gap-2",children:[s.jsx(en,{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(Z,{className:"text-gray-300",children:"篇名"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:_.title,onChange:T=>H({..._,title:T.target.value}),placeholder:"输入篇名"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"左侧图标文字(可选)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:_.badgeText||"",onChange:T=>H({..._,badgeText:Ti(T.target.value)}),placeholder:"例如:派 / 新 / 热",maxLength:8}),s.jsx("p",{className:"text-xs text-gray-500",children:"保存后会同步到目录左侧图标文字(小程序与管理端目录树)。"})]})]}),s.jsxs(yn,{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:Li,disabled:P||!((Ho=_==null?void 0:_.title)!=null&&Ho.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:P?s.jsxs(s.Fragment,{children:[s.jsx(Fe,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx($t,{open:!!re,onOpenChange:T=>!T&&ae(null),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsxs(Ft,{children:[s.jsxs(Bt,{className:"text-white flex items-center gap-2",children:[s.jsx(en,{className:"w-5 h-5 text-[#38bdac]"}),"章节设置"]}),s.jsx("p",{className:"text-gray-400 text-sm font-normal pt-1",children:"修改本章显示名称,或为本章下全部节设置统一金额(仍可在单节编辑里单独改某一节)。"})]}),re&&s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"章节名称(如:第8章|底层结构)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:re.title,onChange:T=>ae({...re,title:T.target.value}),placeholder:"输入章节名称"})]}),s.jsxs("div",{className:"space-y-2 border-t border-gray-700/60 pt-4",children:[s.jsxs(Z,{className:"text-gray-300",children:["本章统一定价(应用于本章全部 ",re.chapter.sections.length," 节)"]}),re.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(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:re.isFree?0:re.price,onChange:T=>ae({...re,price:Number(T.target.value),isFree:Number(T.target.value)===0}),disabled:re.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:re.isFree||re.price===0,onChange:T=>ae({...re,isFree:T.target.checked,price:T.target.checked?0:re.initialPrice>0?re.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(yn,{children:[s.jsx(J,{variant:"outline",onClick:()=>ae(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(J,{onClick:Gr,disabled:pe||!((Hl=re==null?void 0:re.title)!=null&&Hl.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:pe?s.jsxs(s.Fragment,{children:[s.jsx(Fe,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx($t,{open:ie,onOpenChange:T=>{var B;if(q(T),T&&mt.length>0){const de=mt[0];U(de.id),ue(((B=de.chapters[0])==null?void 0:B.id)??"")}},children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Ft,{children:s.jsx(Bt,{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:z.length})," 节,请选择目标篇与章。"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"目标篇"}),s.jsxs(Nc,{value:$,onValueChange:T=>{var de;U(T);const B=mt.find(je=>je.id===T);ue(((de=B==null?void 0:B.chapters[0])==null?void 0:de.id)??"")},children:[s.jsx(il,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(wc,{placeholder:"选择篇"})}),s.jsx(ol,{className:"bg-[#0f2137] border-gray-700",children:mt.map(T=>s.jsx(Ys,{value:T.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:T.title},T.id))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"目标章"}),s.jsxs(Nc,{value:ce,onValueChange:ue,children:[s.jsx(il,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(wc,{placeholder:"选择章"})}),s.jsx(ol,{className:"bg-[#0f2137] border-gray-700",children:(((Di=mt.find(T=>T.id===$))==null?void 0:Di.chapters)??[]).map(T=>s.jsx(Ys,{value:T.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:T.title},T.id))})]})]})]}),s.jsxs(yn,{children:[s.jsx(J,{variant:"outline",onClick:()=>q(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(J,{onClick:Vl,disabled:oe||z.length===0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:oe?s.jsxs(s.Fragment,{children:[s.jsx(Fe,{className:"w-4 h-4 mr-2 animate-spin"}),"移动中..."]}):"确认移动"})]})]})}),s.jsx($t,{open:!!Ce,onOpenChange:T=>!T&&We(null),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",showCloseButton:!0,children:[s.jsx(Ft,{children:s.jsxs(Bt,{className:"text-white",children:["付款记录 — ",(Ce==null?void 0:Ce.section.title)??""]})}),s.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:gt?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(Fe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):Ce&&Ce.orders.length===0?s.jsx("p",{className:"text-gray-500 text-center py-6",children:"暂无付款记录"}):Ce?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:Ce.orders.map(T=>s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("td",{className:"py-2 pr-2",children:s.jsx("button",{className:"text-blue-400 hover:text-blue-300 hover:underline text-left truncate max-w-[180px] block",title:`查看订单 ${T.orderSn}`,onClick:()=>window.open(`/orders?search=${T.orderSn??T.id??""}`,"_blank"),children:T.orderSn?T.orderSn.length>16?T.orderSn.slice(0,8)+"..."+T.orderSn.slice(-6):T.orderSn:"-"})}),s.jsx("td",{className:"py-2 pr-2",children:s.jsx("button",{className:"text-[#38bdac] hover:text-[#2da396] hover:underline text-left truncate max-w-[140px] block",title:`查看用户 ${T.userId??T.openId??""}`,onClick:()=>window.open(`/users?search=${T.userId??T.openId??""}`,"_blank"),children:(()=>{const B=T.userId??T.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:["¥",T.amount??0]}),s.jsx("td",{className:"py-2 pr-2 text-gray-300",children:T.status??"-"}),s.jsx("td",{className:"py-2 pr-2 text-gray-500",children:T.payTime??T.createdAt??"-"})]},T.id??T.orderSn??""))})]}):null})]})}),s.jsx($t,{open:yt,onOpenChange:Ot,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Ft,{children:s.jsxs(Bt,{className:"text-white flex items-center gap-2",children:[s.jsx(Nh,{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)"}),vn?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(Z,{className:"text-gray-400 text-xs",children:"阅读权重"}),s.jsx(le,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:It.readWeight,onChange:T=>Pn(B=>({...B,readWeight:Math.max(0,Math.min(1,parseFloat(T.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"新度权重"}),s.jsx(le,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:It.recencyWeight,onChange:T=>Pn(B=>({...B,recencyWeight:Math.max(0,Math.min(1,parseFloat(T.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-400 text-xs",children:"付款权重"}),s.jsx(le,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:It.payWeight,onChange:T=>Pn(B=>({...B,payWeight:Math.max(0,Math.min(1,parseFloat(T.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(J,{onClick:pa,disabled:Xt||Math.abs(It.readWeight+It.recencyWeight+It.payWeight-1)>.001,className:"w-full bg-amber-500 hover:bg-amber-600 text-white",children:Xt?"保存中...":"保存权重"})]})]})]})}),s.jsx($t,{open:Q,onOpenChange:V,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Ft,{children:s.jsxs(Bt,{className:"text-white flex items-center gap-2",children:[s.jsx(Dn,{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(Z,{className:"text-gray-300",children:"篇名(如:第六篇|真实的社会)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:G,onChange:T=>te(T.target.value),placeholder:"输入篇名"})]})}),s.jsxs(yn,{children:[s.jsx(J,{variant:"outline",onClick:()=>{V(!1),te("")},className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(J,{onClick:Wa,disabled:be||!G.trim(),className:"bg-amber-500 hover:bg-amber-600 text-white",children:be?s.jsxs(s.Fragment,{children:[s.jsx(Fe,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Dn,{className:"w-4 h-4 mr-2"}),"创建篇"]})})]})]})}),s.jsx($t,{open:!!c,onOpenChange:()=>u(null),children:s.jsxs(zt,{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(Ft,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs(Bt,{className:"text-white flex items-center gap-2",children:[s.jsx(en,{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(Z,{className:"text-gray-300",children:"章节ID"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:c.id,onChange:T=>u({...c,id:T.target.value}),placeholder:"如: 9.15"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"价格 (元)"}),s.jsx(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:c.isFree?0:c.price,onChange:T=>u({...c,price:Number(T.target.value),isFree:Number(T.target.value)===0}),disabled:c.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{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:T=>u({...c,isFree:T.target.checked,price:T.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"预览%"}),s.jsx(le,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",placeholder:`全局 ${jt}%`,value:c.previewPercent??"",onChange:T=>{const B=T.target.value===""?void 0:Math.min(100,Math.max(0,Number(T.target.value)));u({...c,previewPercent:B})}})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{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:T=>u({...c,isNew:T.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{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:T=>u({...c,isPinned:T.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{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(Z,{className:"text-gray-300",children:"热度分"}),s.jsx(le,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:c.hotScore??0,onChange:T=>u({...c,hotScore:Math.max(0,parseFloat(T.target.value)||0)})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"章节标题"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:c.title,onChange:T=>u({...c,title:T.target.value})})]}),c.filePath&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"文件路径"}),s.jsx(le,{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(Z,{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(Fe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(f0,{ref:fa,content:c.content||"",onChange:T=>u({...c,content:T}),onImageUpload:Fa,onMediaUpload:Si,persons:it,linkTags:Jt,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(yn,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[c&&s.jsxs(J,{variant:"outline",onClick:()=>Ai({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(er,{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(ts,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsx(J,{onClick:Ii,disabled:y,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:y?s.jsxs(s.Fragment,{children:[s.jsx(Fe,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),s.jsxs(Dc,{defaultValue:"chapters",className:"space-y-6",children:[s.jsxs(Nl,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(tn,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(er,{className:"w-4 h-4 mr-2"}),"章节管理"]}),s.jsxs(tn,{value:"ranking",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(wg,{className:"w-4 h-4 mr-2"}),"内容排行榜"]}),s.jsxs(tn,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(Ta,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),s.jsxs(tn,{value:"link-person",className:"data-[state=active]:bg-purple-500/20 data-[state=active]:text-purple-400 text-gray-400",children:[s.jsx(Sa,{className:"w-4 h-4 mr-2"}),"链接人与事"]}),s.jsxs(tn,{value:"link-tag",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(y1,{className:"w-4 h-4 mr-2"}),"链接标签"]})]}),s.jsxs(nn,{value:"chapters",className:"space-y-4",children:[s.jsxs("div",{className:"rounded-2xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between shadow-sm",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac] flex items-center justify-center text-white shadow-lg shadow-[#38bdac]/20 shrink-0",children:s.jsx(er,{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:vr}),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(Dn,{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(Dn,{className:"w-4 h-4 mr-2"}),"新建篇"]}),s.jsxs(J,{variant:"outline",onClick:()=>q(!0),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:["批量移动(已选 ",z.length," 节)"]})]}),r?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(Fe,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(W9,{parts:mt,expandedParts:i,onTogglePart:Nr,onReorder:Vs,onReadSection:Ls,onDeleteSection:Rs,onAddSectionInPart:Fl,onAddChapterInPart:Bl,onDeleteChapter:Fo,onEditPart:Pi,onDeletePart:Bo,onEditChapter:is,selectedSectionIds:z,onToggleSectionSelect:Oi,onShowSectionOrders:Ai,pinnedSectionIds:Te})]}),s.jsx(nn,{value:"search",className:"space-y-4",children:s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(ct,{children:s.jsx(dt,{className:"text-white",children:"内容搜索"})}),s.jsxs(ze,{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",placeholder:"搜索标题或内容...",value:w,onChange:T=>N(T.target.value),onKeyDown:T=>T.key==="Enter"&&ga()}),s.jsx(J,{onClick:ga,disabled:C||!w.trim(),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:C?s.jsx(Fe,{className:"w-4 h-4 animate-spin"}):s.jsx(Ta,{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(T=>s.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors",onClick:()=>Ls({id:T.id,mid:T.mid,title:T.title,price:T.price??1,filePath:""}),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:T.id}),s.jsx("span",{className:"text-white",children:T.title}),Te.includes(T.id)&&s.jsx(kc,{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:T.matchType==="title"?"标题匹配":"内容匹配"})]}),T.snippet&&s.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:T.snippet}),(T.partTitle||T.chapterTitle)&&s.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[T.partTitle," · ",T.chapterTitle]})]},T.id))]})]})]})}),s.jsxs(nn,{value:"ranking",className:"space-y-4",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(ct,{className:"pb-3",children:s.jsxs(dt,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Nh,{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(Z,{className:"text-gray-400 text-sm whitespace-nowrap",children:"未付费预览比例"}),s.jsx(le,{type:"number",min:"1",max:"100",className:"bg-[#0a1628] border-gray-700 text-white w-20",value:jt,onChange:T=>D(Math.max(1,Math.min(100,Number(T.target.value)||20))),disabled:Ie}),s.jsx("span",{className:"text-gray-500 text-sm",children:"%"})]}),s.jsx(J,{size:"sm",onClick:Mi,disabled:Rt,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:Rt?"保存中...":"保存"}),s.jsxs("span",{className:"text-xs text-gray-500",children:["小程序未付费用户默认显示文章前 ",jt,"% 内容"]})]})})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(ct,{className:"pb-3",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs(dt,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(wg,{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:()=>Bs(),disabled:Nn,className:"text-gray-400 hover:text-white h-7 w-7 p-0",title:"刷新排行榜",children:s.jsx(Fe,{className:`w-4 h-4 ${Nn?"animate-spin":""}`})}),s.jsx(J,{variant:"ghost",size:"sm",disabled:Fn<=1||Nn,onClick:()=>Un(T=>Math.max(1,T-1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(d5,{className:"w-4 h-4"})}),s.jsxs("span",{className:"text-gray-400 min-w-[60px] text-center",children:[Fn," / ",Va]}),s.jsx(J,{variant:"ghost",size:"sm",disabled:Fn>=Va||Nn,onClick:()=>Un(T=>Math.min(Va,T+1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(ll,{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:"编辑"})]}),zo.map((T,B)=>{const de=(Fn-1)*Ba+B+1,je=T.isPinned??Te.includes(T.id);return s.jsxs("div",{className:`grid grid-cols-[40px_40px_1fr_80px_80px_80px_60px] gap-2 px-3 py-2.5 items-center border-b border-gray-700/30 hover:bg-[#162840] transition-colors ${je?"bg-amber-500/5":""}`,children:[s.jsx("span",{className:`text-sm font-bold ${de<=3?"text-amber-400":"text-gray-500"}`,children:de<=3?["🥇","🥈","🥉"][de-1]:`#${de}`}),s.jsx(J,{variant:"ghost",size:"sm",className:`h-6 w-6 p-0 ${je?"text-amber-400":"text-gray-600 hover:text-amber-400"}`,onClick:()=>kr(T.id),disabled:st,title:je?"取消置顶":"强制置顶(精选推荐/首页最新更新)",children:je?s.jsx(kc,{className:"w-3.5 h-3.5 fill-current"}):s.jsx(DM,{className:"w-3.5 h-3.5"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"text-white text-sm truncate block",children:T.title}),s.jsxs("span",{className:"text-gray-600 text-xs",children:[T.partTitle," · ",T.chapterTitle]})]}),s.jsx("span",{className:"text-right text-sm text-blue-400 font-mono",children:T.clickCount??0}),s.jsx("span",{className:"text-right text-sm text-green-400 font-mono",children:T.payCount??0}),s.jsx("span",{className:"text-right text-sm text-amber-400 font-mono",children:(T.hotScore??0).toFixed(1)}),s.jsx("div",{className:"text-right",children:s.jsx(J,{variant:"ghost",size:"sm",className:"text-gray-500 hover:text-[#38bdac] h-6 px-1",onClick:()=>Ls({id:T.id,mid:T.mid,title:T.title,price:T.price,filePath:""}),title:"编辑文章",children:s.jsx(en,{className:"w-3 h-3"})})})]},T.id)}),zo.length===0&&s.jsx("div",{className:"py-8 text-center text-gray-500",children:"暂无数据"})]})})]})]}),s.jsxs(nn,{value:"link-person",className:"space-y-4",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ct,{className:"pb-3",children:[s.jsxs(dt,{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:()=>{Yn()},title:"刷新",children:s.jsx(Fe,{className:"w-4 h-4"})}),s.jsxs(J,{size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",onClick:()=>{ar(null),_a(!0)},children:[s.jsx(Dn,{className:"w-4 h-4 mr-2"}),"添加"]})]})]}),s.jsx("div",{className:"max-h-[400px] overflow-y-auto",children:it.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-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:it.map(T=>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:T.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:()=>{Ut[T.id]&&ma(T.id,T.name)},title:Ut[T.id]?"点击查看获客详情":T.name,children:T.name})}),s.jsx("td",{className:"py-2 px-3",children:T.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:T.userId?s.jsxs("div",{className:"flex flex-col gap-0.5 items-start max-w-[100px]",children:[T.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: ${T.userId}`,onClick:()=>t(`/users?search=${encodeURIComponent(T.userId||"")}`),children:T.name})]}):s.jsx("span",{className:"text-gray-600",children:"—"})}),(()=>{const B=Ut[T.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&&ma(T.id,T.name)},children:B})})(),s.jsx("td",{className:"py-2 px-3 text-white truncate max-w-[220px]",title:`planId: ${T.ckbPlanId??"-"}`,children:s.jsx("div",{className:"flex items-center gap-1.5",children:s.jsx("span",{className:"truncate",children:T.ckbPlanId?T.personSource==="vip_sync"?"超级个体拉群(统一计划)":`SOUL链接人与事-${T.name}`:"—"})})}),s.jsx("td",{className:"py-2 px-3 text-center",children:T.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 q9(T.personId||"");if(B!=null&&B.success&&B.person){const de=B.person;ar({id:de.token??de.personId,personId:de.personId,name:de.name,personSource:de.personSource??"",userId:de.userId??"",label:de.label??"",ckbApiKey:de.ckbApiKey??"",remarkType:de.remarkType,remarkFormat:de.remarkFormat,addFriendInterval:de.addFriendInterval,startTime:de.startTime,endTime:de.endTime,deviceGroups:de.deviceGroups})}else ar(T),B!=null&&B.error&&X.error(B.error)}catch(B){console.error(B),ar(T),X.error(B instanceof Error?B.message:"加载人物详情失败")}_a(!0)},children:s.jsx(b1,{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:()=>ma(T.id,T.name),children:s.jsx(_n,{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:T.personSource==="vip_sync"?"删除本地 @人物(不删统一获客计划)":"删除(同时删除存客宝对应获客计划)",onClick:()=>wi(T),children:s.jsx(ts,{className:"w-3 h-3"})})]})})]},T.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(ct,{className:"pb-3",children:[s.jsxs(dt,{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(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(Z,{className:"text-gray-400 text-xs",children:"存客宝 API 地址"}),s.jsx(le,{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(Z,{className:"text-gray-400 text-xs",children:"绑定计划"}),s.jsx(le,{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(ct,{className:"pb-3",children:[s.jsxs(dt,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Nh,{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(Z,{className:"text-gray-400 text-xs",children:"Webhook URL"}),s.jsx(le,{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:br,onChange:T=>Vr(T.target.value)})]}),s.jsxs(J,{size:"sm",className:"bg-blue-500 hover:bg-blue-600 text-white h-8",onClick:async()=>{const T=br.trim();try{const B=await St("/api/db/config",{key:"ckb_lead_webhook_url",value:T,description:"获客线索 Webhook 通知 URL(企微/飞书)"});B!=null&&B.success?X.success(T?"Webhook 已保存":"Webhook 已清除"):X.error((B==null?void 0:B.error)??"保存失败")}catch{X.error("保存失败")}},children:[s.jsx(Sn,{className:"w-3.5 h-3.5 mr-1"}),"保存"]})]}),s.jsx("p",{className:"text-xs text-gray-500",children:"配置企业微信或飞书群机器人 Webhook URL,获客成功后自动推送通知"})]})]})]}),s.jsxs(nn,{value:"link-tag",className:"space-y-4",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ct,{className:"pb-3",children:[s.jsxs(dt,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(y1,{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(Z,{className:"text-gray-400 text-xs",children:"搜索"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white h-8 w-48",placeholder:"按标签ID/显示文字搜索",value:Ms,onChange:T=>{rr(T.target.value),zr(1)}})]}),s.jsx(J,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 hover:bg-gray-700/50 h-8",onClick:()=>{Hs(),Kr()},title:"刷新",children:s.jsx(Fe,{className:"w-4 h-4"})})]}),s.jsxs(J,{size:"sm",className:"bg-amber-500 hover:bg-amber-600 text-white h-8",onClick:()=>{ye(null),ft({tagId:"",label:"",aliases:"",url:"",type:"url",appId:"",appSecret:"",pagePath:""}),Us(""),gs(!1),As(!0)},children:[s.jsx(Dn,{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:Ni?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:"加载中..."})}):as.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:"暂无链接标签,添加后可在编辑器中使用 #标签 跳转"})}):as.map(T=>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:()=>{ye(T),ft({tagId:T.id,label:T.label,aliases:T.aliases??"",url:T.url,type:T.type,appId:T.appId??"",appSecret:"",pagePath:T.pagePath??""}),Us(T.appId??""),gs(!1),As(!0)},title:"点击编辑标签",children:["#",T.label]})}),s.jsx("td",{className:"px-3 py-2 text-gray-500 text-xs truncate max-w-[120px]",title:T.aliases||"",children:T.aliases||"—"}),s.jsx("td",{className:"px-3 py-2",children:s.jsx(Be,{variant:"secondary",className:`text-[10px] ${T.type==="ckb"?"bg-green-500/20 text-green-300 border-green-500/30":T.type==="miniprogram"||T.type==="wxlink"?"bg-[#38bdac]/20 text-[#38bdac] border-[#38bdac]/30":"bg-gray-700 text-gray-300"}`,children:T.type==="url"?"网页":T.type==="ckb"?"存客宝":T.type==="wxlink"?"小程序链接":"小程序"})}),s.jsx("td",{className:"px-3 py-2 text-gray-300",children:T.type==="miniprogram"?s.jsxs("div",{className:"space-y-0.5",children:[(()=>{const B=jr.find(de=>de.key===T.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)||T.appId||"—"]})]})})(),T.pagePath&&s.jsx("div",{className:"text-xs text-gray-500 font-mono",children:T.pagePath}),s.jsxs("div",{className:`text-xs ${T.hasAppSecret?"text-emerald-400/90":"text-amber-500/80"}`,children:["AppSecret:",T.hasAppSecret?"已保存(仅服务端)":"未配置"]})]}):T.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:T.url,children:T.url||"—"}),s.jsx("div",{className:"text-[11px] text-gray-500",children:"小程序内点击 → web-view 打开 → 自动唤起目标小程序"})]}):T.url?s.jsxs("a",{href:T.url,target:"_blank",rel:"noreferrer",className:"text-blue-400 text-xs truncate max-w-[420px] hover:underline inline-flex items-center gap-1",children:[T.url," ",s.jsx(mi,{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:()=>{ye(T),ft({tagId:T.id,label:T.label,aliases:T.aliases??"",url:T.url,type:T.type,appId:T.appId??"",appSecret:"",pagePath:T.pagePath??""}),Us(T.appId??""),gs(!1),As(!0)},title:"编辑",children:s.jsx(b1,{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(`确定要删除「#${T.label}」吗?`))try{const B=await di(`/api/db/link-tags?tagId=${encodeURIComponent(T.id)}`);B!=null&&B.success?(X.success("已删除"),Hs(),Kr()):X.error((B==null?void 0:B.error)??"删除失败")}catch(B){console.error(B),X.error("删除失败")}},title:"删除",children:s.jsx(ts,{className:"w-3 h-3"})})]})})]},T.id))})]})}),s.jsx(Zs,{page:da,pageSize:$r,total:xr,totalPages:Oa,onPageChange:T=>zr(T),onPageSizeChange:T=>{Fr(T),zr(1)}})]})]})]}),s.jsx($t,{open:yr,onOpenChange:As,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg p-4 gap-3",children:[s.jsxs(Ft,{className:"gap-1",children:[s.jsx(Bt,{className:"text-base",children:se?"编辑链接标签":"添加链接标签"}),s.jsx(uf,{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(Z,{className:"text-gray-300 text-sm",children:"标签ID"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm font-mono",placeholder:"留空自动生成;或自定义短 ID(如 kr),最长 50 字符",value:Ge.tagId,disabled:!!se,onChange:T=>ft(B=>({...B,tagId:T.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"显示文字"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"如 神仙团队",value:Ge.label,onChange:T=>ft(B=>({...B,label:T.target.value}))})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"别名(多个用逗号分隔,同指向一个目标)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"如 团队招募, 团队合伙人",value:Ge.aliases,onChange:T=>ft(B=>({...B,aliases:T.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(Z,{className:"text-gray-300 text-sm",children:"类型"}),s.jsxs(Nc,{value:Ge.type,onValueChange:T=>ft(B=>({...B,type:T})),children:[s.jsx(il,{className:"bg-[#0a1628] border-gray-700 text-white h-8",children:s.jsx(wc,{})}),s.jsxs(ol,{className:"bg-[#0f2137] border-gray-700 text-white",children:[s.jsx(Ys,{value:"url",children:"网页链接"}),s.jsx(Ys,{value:"miniprogram",children:"小程序(API跳转)"}),s.jsx(Ys,{value:"wxlink",children:"小程序链接(右上角复制)"}),s.jsx(Ys,{value:"ckb",children:"存客宝"})]})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:Ge.type==="url"?"URL地址":Ge.type==="ckb"?"存客宝计划URL":Ge.type==="wxlink"?"小程序链接":"小程序 mpKey / 微信 AppID"}),Ge.type==="wxlink"?s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"粘贴小程序右上角 ... → 复制链接 得到的 URL",value:Ge.url,onChange:T=>ft(B=>({...B,url:T.target.value}))}):Ge.type==="miniprogram"&&jr.length>0?s.jsxs("div",{ref:Ei,className:"relative",children:[s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"搜索名称或密钥",value:xa?Ha:Ge.appId,onChange:T=>{const B=T.target.value;Us(B),gs(!0),jr.some(de=>de.key===B)||ft(de=>({...de,appId:B}))},onFocus:()=>{Us(Ge.appId),gs(!0)},onBlur:()=>setTimeout(()=>gs(!1),150)}),xa&&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:Ua.length===0?s.jsx("div",{className:"px-3 py-2 text-gray-500 text-xs",children:"无匹配,可手动输入密钥"}):Ua.map(T=>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(),ft(de=>({...de,appId:T.key,pagePath:T.path||""})),Us(""),gs(!1)},children:[s.jsx("span",{children:T.name}),s.jsx("span",{className:"text-xs text-gray-400 font-mono",children:T.key})]},T.key))})]}):s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:Ge.type==="url"?"https://...":Ge.type==="ckb"?"https://ckbapi.quwanzhi.com/...":"关联配置的 key,或直接填 wx 开头的 AppID",value:Ge.type==="url"||Ge.type==="ckb"?Ge.url:Ge.appId,onChange:T=>{Ge.type==="url"||Ge.type==="ckb"?ft(B=>({...B,url:T.target.value})):ft(B=>({...B,appId:T.target.value}))}})]})]}),Ge.type==="wxlink"&&s.jsx("p",{className:"text-[11px] text-amber-400/80 leading-snug px-0.5",children:"操作:打开目标小程序 → 右上角「...」→「复制链接」→ 粘贴到上面。小程序内点击此标签会在 web-view 中打开,微信自动唤起目标小程序,无需修改小程序版本。"}),Ge.type==="miniprogram"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"页面路径(可选)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm font-mono",placeholder:"pages/index/index",value:Ge.pagePath,onChange:T=>ft(B=>({...B,pagePath:T.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-300 text-sm",children:"AppSecret(微信公众平台 · 仅服务端存储)"}),s.jsx(le,{type:"password",autoComplete:"new-password",className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm font-mono",placeholder:se!=null&&se.hasAppSecret?"已保存密钥,留空不改;填写则覆盖":"粘贴目标小程序 AppSecret",value:Ge.appSecret,onChange:T=>ft(B=>({...B,appSecret:T.target.value}))}),s.jsx("p",{className:"text-[11px] text-gray-500 leading-snug",children:"与 AppID 成对落库;接口响应与小程序配置中均不会返回此字段。"})]})]})]}),s.jsxs(yn,{className:"gap-2 pt-1",children:[s.jsx(J,{variant:"outline",onClick:()=>As(!1),className:"border-gray-600",children:"取消"}),s.jsx(J,{onClick:async()=>{const T={tagId:Ge.tagId.trim(),label:Ge.label.trim(),aliases:Ge.aliases.trim(),url:Ge.url.trim(),type:Ge.type,appId:Ge.appId.trim(),appSecret:Ge.appSecret.trim(),pagePath:Ge.pagePath.trim()};if(T.tagId){const B=T.tagId;if([...B].length>50){X.error("标签ID 最长 50 个字符");return}if(/[#,\n\r\t]/.test(B)){X.error("标签ID 不能含 #、逗号或换行");return}}if(!T.label){X.error("显示文字必填");return}T.type==="miniprogram"&&(T.url=""),T.type==="wxlink"&&(T.appId="",T.pagePath=""),Fs(!0);try{const B=await St("/api/db/link-tags",T);B!=null&&B.success?(X.success(se?"已更新":"已添加"),As(!1),Hs(),Kr()):X.error((B==null?void 0:B.error)??"保存失败")}catch(B){console.error(B),X.error("保存失败")}finally{Fs(!1)}},disabled:Wn,className:"bg-amber-500 hover:bg-amber-600 text-white",children:Wn?"保存中...":"保存"})]})]})})]})]}),s.jsx(J9,{open:Da,onOpenChange:_a,editingPerson:Lo,onSubmit:async T=>{var je;const B={personId:T.personId||T.name.toLowerCase().replace(/\s+/g,"_")+"_"+Date.now().toString(36),name:T.name,userId:T.boundUserId,aliases:T.aliases||void 0,label:T.label,ckbApiKey:T.ckbApiKey||void 0,greeting:T.greeting||void 0,tips:T.tips||void 0,remarkType:T.remarkType||void 0,remarkFormat:T.remarkFormat||void 0,addFriendInterval:T.addFriendInterval,startTime:T.startTime||void 0,endTime:T.endTime||void 0,deviceGroups:(je=T.deviceGroups)!=null&&je.trim()?T.deviceGroups.split(",").map(He=>parseInt(He.trim(),10)).filter(He=>!Number.isNaN(He)):void 0},de=await St("/api/db/persons",B);if(de&&de.success===!1){const He=de;He.ckbResponse&&console.log("存客宝返回",He.ckbResponse);const ht=He.error||"操作失败";throw new Error(ht)}if(Yn(),X.success(Lo?"已保存":"已添加"),de!=null&&de.ckbCreateResult&&Object.keys(de.ckbCreateResult).length>0){const He=de.ckbCreateResult;console.log("存客宝创建结果",He);const ht=He.planId??He.id,Tt=ht!=null?[`planId: ${ht}`]:[];He.apiKey!=null&&Tt.push("apiKey: ***"),X.info(Tt.length?`存客宝创建结果:${Tt.join(",")}`:"存客宝创建结果见控制台")}}}),s.jsx($t,{open:!!Is,onOpenChange:T=>{T||wi(null)},children:s.jsxs(zt,{showCloseButton:!0,className:"bg-[#0f2137] border-gray-700 text-white max-w-md p-4 gap-3",children:[s.jsxs(Ft,{className:"gap-1",children:[s.jsx(Bt,{className:"text-white text-base",children:"确认删除"}),s.jsx(uf,{className:"text-gray-400 text-sm leading-relaxed wrap-break-word",children:Is&&s.jsxs(s.Fragment,{children:[Is.personSource==="vip_sync"?s.jsxs(s.Fragment,{children:[s.jsxs("p",{children:["确定删除超级个体「",Is.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链接人与事-",Is.name,"」?将同时删除存客宝对应获客计划。"]})}),s.jsxs("p",{className:"mt-1.5",children:["二次确认:删除后无法恢复,文章中的 @",Is.name," 将无法正常跳转。"]})]})})]}),s.jsxs(yn,{className:"gap-2 sm:gap-2 pt-1",children:[s.jsx(J,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-300",onClick:()=>wi(null),children:"取消"}),s.jsx(J,{variant:"destructive",size:"sm",className:"bg-red-600 hover:bg-red-700",onClick:async()=>{Is&&(await di(`/api/db/persons?personId=${Is.personId}`),wi(null),Yn(),X.success("已删除"))},children:"确定删除"})]})]})}),s.jsx($t,{open:ir,onOpenChange:Oo,children:s.jsxs(zt,{className:"max-w-2xl bg-[#0f2137] border-gray-700",children:[s.jsx(Ft,{children:s.jsxs(Bt,{className:"text-white flex items-center gap-2",children:[s.jsx(_n,{className:"w-5 h-5 text-green-400"}),za," — 获客详情(共 ",Qn," 条)"]})}),s.jsx("div",{className:"max-h-[450px] overflow-y-auto space-y-2",children:ji?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(Fe,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):wn.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:"时间"})]}),wn.map((T,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:(Br-1)*20+B+1}),s.jsx("span",{className:"text-white truncate",children:T.nickname||T.name||T.userId||"-"}),s.jsx("span",{className:"text-gray-300 text-xs",children:T.phone||"-"}),s.jsx("span",{className:"text-gray-300 text-xs truncate",children:T.wechatId||"-"}),s.jsx("span",{className:"text-xs",children:T.source==="article_mention"?s.jsx("span",{className:"text-purple-400",children:"文章@"}):T.source==="index_lead"?s.jsx("span",{className:"text-blue-400",children:"首页"}):s.jsx("span",{className:"text-gray-500",children:T.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:T.createdAt?new Date(T.createdAt).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"-"})]},T.id))]})}),Qn>20&&s.jsxs("div",{className:"flex items-center justify-center gap-2 pt-2",children:[s.jsx(J,{size:"sm",variant:"outline",disabled:Br<=1,onClick:()=>ma(ua,za,Br-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:[Br," / ",Math.ceil(Qn/20)]}),s.jsx(J,{size:"sm",variant:"outline",disabled:Br>=Math.ceil(Qn/20),onClick:()=>ma(ua,za,Br+1),className:"border-gray-600 text-gray-300 bg-transparent h-7 px-3",children:"下一页"})]})]})})]})}const li={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 ij(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):li.stats}function oj(t){return Array.isArray(t)?t.map(e=>typeof e=="string"?e:String(e??"")).filter(Boolean):li.highlights}function X9(){const[t,e]=b.useState(li),[n,r]=b.useState(!0),[a,i]=b.useState(!1),[o,c]=b.useState(!1),u=b.useRef(null);b.useEffect(()=>{De("/api/admin/author-settings").then(k=>{const E=k==null?void 0:k.data;E&&typeof E=="object"&&e({name:String(E.name??li.name),avatar:String(E.avatar??li.avatar),avatarImg:String(E.avatarImg??""),title:String(E.title??li.title),bio:String(E.bio??li.bio),stats:ij(E.stats).length?ij(E.stats):li.stats,highlights:oj(E.highlights).length?oj(E.highlights):li.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(L=>L.label||L.value),highlights:t.highlights.filter(Boolean)},E=await St("/api/admin/author-settings",k);if(!E||E.success===!1){X.error("保存失败: "+(E&&typeof E=="object"&&"error"in E?E.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),X.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{i(!1)}},f=async k=>{var C;const E=(C=k.target.files)==null?void 0:C[0];if(E){c(!0);try{const L=new FormData;L.append("file",E),L.append("folder","avatars");const O=gu(),K={};O&&(K.Authorization=`Bearer ${O}`);const H=await(await fetch(Oc("/api/upload"),{method:"POST",body:L,credentials:"include",headers:K})).json();H!=null&&H.success&&(H!=null&&H.url)?e(P=>({...P,avatarImg:H.url})):X.error("上传失败: "+((H==null?void 0:H.error)||"未知错误"))}catch(L){console.error(L),X.error("上传失败")}finally{c(!1),u.current&&(u.current.value="")}}},m=()=>e(k=>({...k,stats:[...k.stats,{label:"",value:""}]})),x=k=>e(E=>({...E,stats:E.stats.filter((C,L)=>L!==k)})),y=(k,E,C)=>e(L=>({...L,stats:L.stats.map((O,K)=>K===k?{...O,[E]:C}:O)})),v=()=>e(k=>({...k,highlights:[...k.highlights,""]})),w=k=>e(E=>({...E,highlights:E.highlights.filter((C,L)=>L!==k)})),N=(k,E)=>e(C=>({...C,highlights:C.highlights.map((L,O)=>O===k?E:L)}));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(Sn,{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(ct,{children:[s.jsxs(dt,{className:"flex items-center gap-2 text-white",children:[s.jsx(ci,{className:"w-4 h-4 text-[#38bdac]"}),"基本信息"]}),s.jsx(Yt,{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(Z,{className:"text-gray-300",children:"姓名"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.name,onChange:k=>e(E=>({...E,name:k.target.value})),placeholder:"卡若"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"首字母占位(无头像时显示)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white w-20",value:t.avatar,onChange:k=>e(E=>({...E,avatar:k.target.value.slice(0,1)||"K"})),placeholder:"K"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx($j,{className:"w-3 h-3 text-[#38bdac]"}),"头像图片"]}),s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(le,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:t.avatarImg,onChange:k=>e(E=>({...E,avatarImg:k.target.value})),placeholder:"上传或粘贴 URL,如 /uploads/avatars/xxx.png"}),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(of,{className:"w-4 h-4 mr-2"}),o?"上传中...":"上传"]})]}),t.avatarImg&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:vo(t.avatarImg.startsWith("http")?t.avatarImg:Oc(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(Z,{className:"text-gray-300",children:"头衔"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.title,onChange:k=>e(E=>({...E,title:k.target.value})),placeholder:"Soul派对房主理人 · 私域运营专家"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"个人简介"}),s.jsx(wl,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[120px]",value:t.bio,onChange:k=>e(E=>({...E,bio:k.target.value})),placeholder:"每天早上6点到9点..."})]})]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ct,{children:[s.jsx(dt,{className:"text-white",children:"统计数据"}),s.jsx(Yt,{className:"text-gray-400",children:"展示在作者卡片中的数字指标,如「商业案例 62」「连续直播 365天」。第一个「商业案例」的值可由书籍统计自动更新。"})]}),s.jsxs(ze,{className:"space-y-3",children:[t.stats.map((k,E)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(le,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.label,onChange:C=>y(E,"label",C.target.value),placeholder:"标签"}),s.jsx(le,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.value,onChange:C=>y(E,"value",C.target.value),placeholder:"数值"}),s.jsx(J,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>x(E),children:s.jsx(ts,{className:"w-4 h-4"})})]},E)),s.jsxs(J,{variant:"outline",size:"sm",onClick:m,className:"border-gray-600 text-gray-400",children:[s.jsx(Dn,{className:"w-4 h-4 mr-2"}),"添加统计项"]})]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ct,{children:[s.jsx(dt,{className:"text-white",children:"亮点标签"}),s.jsx(Yt,{className:"text-gray-400",children:"作者优势或成就的简短描述,以标签形式展示。"})]}),s.jsxs(ze,{className:"space-y-3",children:[t.highlights.map((k,E)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(le,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k,onChange:C=>N(E,C.target.value),placeholder:"5年私域运营经验"}),s.jsx(J,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>w(E),children:s.jsx(ts,{className:"w-4 h-4"})})]},E)),s.jsxs(J,{variant:"outline",size:"sm",onClick:v,className:"border-gray-600 text-gray-400",children:[s.jsx(Dn,{className:"w-4 h-4 mr-2"}),"添加亮点"]})]})]})]})]})}function Z9(t){return confirm(`确定删除该${t}?此操作不可恢复。`)?window.prompt(`请输入「删除」以确认删除${t}`)==="删除":!1}function eV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o]=b.useState(10),[c,u]=b.useState(0),[h,f]=b.useState(""),m=hf(h,300),[x,y]=b.useState(!0),[v,w]=b.useState(null),[N,k]=b.useState(!1),[E,C]=b.useState(null),[L,O]=b.useState(""),[K,_]=b.useState(""),[H,P]=b.useState(""),[ee,Q]=b.useState("admin"),[V,re]=b.useState("active"),[ae,pe]=b.useState(!1);async function I(){var U;y(!0),w(null);try{const ce=new URLSearchParams({page:String(a),pageSize:String(o)});m.trim()&&ce.set("search",m.trim());const ue=await De(`/api/admin/users?${ce}`);ue!=null&&ue.success?(e(ue.records||[]),r(ue.total??0),u(ue.totalPages??0)):w(ue.error||"加载失败")}catch(ce){const ue=ce;w(ue.status===403?"无权限访问":((U=ue==null?void 0:ue.data)==null?void 0:U.error)||"加载失败"),e([])}finally{y(!1)}}b.useEffect(()=>{I()},[a,o,m]);const z=()=>{C(null),O(""),_(""),P(""),Q("admin"),re("active"),k(!0)},R=U=>{C(U),O(U.username),_(""),P(U.name||""),Q(U.role==="super_admin"?"super_admin":"admin"),re(U.status==="disabled"?"disabled":"active"),k(!0)},ie=async()=>{var U;if(!L.trim()){w("用户名不能为空");return}if(!E&&!K){w("新建时密码必填,至少 6 位");return}if(K&&K.length<6){w("密码至少 6 位");return}w(null),pe(!0);try{if(E){const ce=await Zt("/api/admin/users",{id:E.id,password:K||void 0,name:H.trim(),role:ee,status:V});ce!=null&&ce.success?(k(!1),I()):w((ce==null?void 0:ce.error)||"保存失败")}else{const ce=await St("/api/admin/users",{username:L.trim(),password:K,name:H.trim(),role:ee});ce!=null&&ce.success?(k(!1),I()):w((ce==null?void 0:ce.error)||"保存失败")}}catch(ce){const ue=ce;w(((U=ue==null?void 0:ue.data)==null?void 0:U.error)||"保存失败")}finally{pe(!1)}},q=async U=>{var ce;if(!Z9("管理员")){w("已取消删除");return}try{const ue=await di(`/api/admin/users?id=${U}`);ue!=null&&ue.success?I():w((ue==null?void 0:ue.error)||"删除失败")}catch(ue){const oe=ue;w(((ce=oe==null?void 0:oe.data)==null?void 0:ce.error)||"删除失败")}},$=U=>{if(!U)return"-";try{const ce=new Date(U);return isNaN(ce.getTime())?U:ce.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(jc,{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(le,{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(Fe,{className:`w-4 h-4 ${x?"animate-spin":""}`})}),s.jsxs(J,{onClick:z,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Dn,{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(fs,{children:[s.jsx(ps,{children:s.jsxs(xt,{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(ms,{children:[t.map(U=>s.jsxs(xt,{className:"border-gray-700/50",children:[s.jsx(Ne,{className:"text-gray-300",children:U.id}),s.jsx(Ne,{className:"text-white font-medium",children:U.username}),s.jsx(Ne,{className:"text-gray-400",children:U.name||"-"}),s.jsx(Ne,{children:s.jsx(Be,{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(Ne,{children:s.jsx(Be,{variant:"outline",className:U.status==="active"?"border-[#38bdac]/50 text-[#38bdac]":"border-gray-500 text-gray-500",children:U.status==="active"?"正常":"已禁用"})}),s.jsx(Ne,{className:"text-gray-500 text-sm",children:$(U.createdAt)}),s.jsxs(Ne,{className:"text-right",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>R(U),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(en,{className:"w-4 h-4"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>q(U.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(js,{className:"w-4 h-4"})})]})]},U.id)),t.length===0&&!x&&s.jsx(xt,{children:s.jsx(Ne,{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(Zs,{page:a,pageSize:o,total:n,totalPages:c,onPageChange:i})})]})})}),s.jsx($t,{open:N,onOpenChange:k,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(Ft,{children:s.jsx(Bt,{className:"text-white",children:E?"编辑管理员":"新增管理员"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"用户名"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"登录用户名",value:L,onChange:U=>O(U.target.value),disabled:!!E}),E&&s.jsx("p",{className:"text-xs text-gray-500",children:"用户名不可修改"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:E?"新密码(留空不改)":"密码"}),s.jsx(le,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:E?"留空表示不修改":"至少 6 位",value:K,onChange:U=>_(U.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"昵称"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"显示名称",value:H,onChange:U=>P(U.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"角色"}),s.jsxs("select",{value:ee,onChange:U=>Q(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:"超级管理员"})]})]}),E&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"状态"}),s.jsxs("select",{value:V,onChange:U=>re(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(yn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>k(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(ts,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:ie,disabled:ae,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),ae?"保存中...":"保存"]})]})]})})]})}function Mn({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 C4(){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(ct,{className:"pb-3",children:s.jsxs(dt,{className:"text-white flex items-center gap-2",children:[s.jsx(vg,{className:"w-5 h-5 text-[#38bdac]"}),"1. Authentication"]})}),s.jsx(ze,{className:"space-y-4",children:s.jsx(Mn,{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(ct,{className:"pb-3",children:s.jsxs(dt,{className:"text-white flex items-center gap-2",children:[s.jsx(er,{className:"w-5 h-5 text-[#38bdac]"}),"2. 章节管理 (Chapters)"]})}),s.jsxs(ze,{className:"space-y-4",children:[s.jsx(Mn,{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(Mn,{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(Mn,{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(Mn,{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(Mn,{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(Mn,{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(Mn,{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(ct,{className:"pb-3",children:s.jsxs(dt,{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(Mn,{method:"GET",url:"/api/db/persons",desc:"人物列表",headers:t,response:`{ - "success": true, - "data": [ - { "personId": "p1", "label": "张三", "aliases": ["老张"], ... } - ] -}`}),s.jsx(Mn,{method:"GET",url:"/api/db/person?personId={id}",desc:"人物详情",headers:t,response:`{ - "success": true, - "data": { - "personId": "p1", - "label": "张三", - "aliases": ["老张"], - "description": "..." - } -}`}),s.jsx(Mn,{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(Mn,{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(ct,{className:"pb-3",children:s.jsxs(dt,{className:"text-white flex items-center gap-2",children:[s.jsx(Bd,{className:"w-5 h-5 text-[#38bdac]"}),"4. 链接标签 (#LinkTags)"]})}),s.jsxs(ze,{className:"space-y-4",children:[s.jsx(Mn,{method:"GET",url:"/api/db/link-tags",desc:"标签列表",headers:t,response:`{ - "success": true, - "data": [ - { "tagId": "t1", "label": "官网", "aliases": [], "type": "url", "url": "https://..." } - ] -}`}),s.jsx(Mn,{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(Mn,{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(ct,{className:"pb-3",children:s.jsxs(dt,{className:"text-white flex items-center gap-2",children:[s.jsx(Ta,{className:"w-5 h-5 text-[#38bdac]"}),"5. 内容搜索"]})}),s.jsx(ze,{className:"space-y-4",children:s.jsx(Mn,{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(ct,{className:"pb-3",children:s.jsxs(dt,{className:"text-white flex items-center gap-2",children:[s.jsx(wg,{className:"w-5 h-5 text-[#38bdac]"}),"6. 内容排行"]})}),s.jsx(ze,{className:"space-y-4",children:s.jsx(Mn,{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(ct,{className:"pb-3",children:s.jsxs(dt,{className:"text-white flex items-center gap-2",children:[s.jsx(yl,{className:"w-5 h-5 text-[#38bdac]"}),"7. 小程序接口"]})}),s.jsxs(ze,{className:"space-y-4",children:[s.jsx(Mn,{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(Mn,{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(Mn,{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(Mn,{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(Mn,{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 tV={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},nV={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},sV={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...nV},ckbLeadApiKey:""},rV={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0},aV={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"}},iV=["system","author","admin","api-docs"],lj=["basic","mp","oss","features"];function oV(){const[t,e]=T0(),n=t.get("tab")??"system",r=iV.includes(n)?n:"system",a=t.get("section")??"basic",i=lj.includes(a)?a:"basic",[o,c]=b.useState(sV),[u,h]=b.useState(rV),[f,m]=b.useState(tV),[x,y]=b.useState("{}"),[v,w]=b.useState("NEW"),[N,k]=b.useState({}),[E,C]=b.useState(!1),[L,O]=b.useState(!0),[K,_]=b.useState(!1),[H,P]=b.useState(""),[ee,Q]=b.useState(""),[V,re]=b.useState(!1),[ae,pe]=b.useState(!1),I=(oe,F,G=!1)=>{P(oe),Q(F),re(G),_(!0)};b.useEffect(()=>{(async()=>{try{const F=await De("/api/admin/settings");if(!F||F.success===!1)return;if(F.featureConfig&&Object.keys(F.featureConfig).length&&h(G=>({...G,...F.featureConfig})),F.mpConfig&&typeof F.mpConfig=="object"){const G={...F.mpConfig};m(We=>({...We,...G}));const te=G.mpUi,be=te!=null&&typeof te=="object"&&!Array.isArray(te)?te:{},ge=be.chaptersPage&&typeof be.chaptersPage=="object"&&!Array.isArray(be.chaptersPage)?be.chaptersPage:{},Ce=ge.newBadgeText??ge.sectionNewBadgeText;w(typeof Ce=="string"&&Ce.trim()?Ce.trim():"NEW"),y(JSON.stringify(be,null,2))}if(F.ossConfig&&typeof F.ossConfig=="object"&&k(G=>({...G,...F.ossConfig})),F.siteSettings&&typeof F.siteSettings=="object"){const G=F.siteSettings;c(te=>({...te,...typeof G.sectionPrice=="number"&&{sectionPrice:G.sectionPrice},...typeof G.baseBookPrice=="number"&&{baseBookPrice:G.baseBookPrice},...typeof G.distributorShare=="number"&&{distributorShare:G.distributorShare},...G.authorInfo&&typeof G.authorInfo=="object"&&{authorInfo:{...te.authorInfo,...G.authorInfo}},...typeof G.ckbLeadApiKey=="string"&&{ckbLeadApiKey:G.ckbLeadApiKey}}))}}catch(F){console.error("Load settings error:",F)}finally{O(!1)}})()},[]);const z=async(oe,F)=>{pe(!0);try{const G=await St("/api/admin/settings",{featureConfig:oe});if(!G||G.success===!1){F(),I("保存失败",(G==null?void 0:G.error)??"未知错误",!0);return}I("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(G){console.error("Save feature config error:",G),F(),I("保存失败",G instanceof Error?G.message:String(G),!0)}finally{pe(!1)}},R=(oe,F)=>{const G=u,te={...G,[oe]:F};h(te),z(te,()=>h(G))},[ie,q]=b.useState(!1),$=async oe=>{const F=f,G={...F,auditMode:oe};m(G),q(!0);try{const te=await St("/api/admin/settings",{mpConfig:G});if(!te||te.success===!1){m(F),I("保存失败",(te==null?void 0:te.error)??"未知错误",!0);return}I("已保存",oe?"审核模式已开启,小程序将隐藏所有支付入口。":"审核模式已关闭,支付功能已恢复。")}catch(te){m(F),I("保存失败",te instanceof Error?te.message:String(te),!0)}finally{q(!1)}},U=async()=>{C(!0);try{let oe={};try{const ge=x.trim();if(ge){const Ce=JSON.parse(ge);if(Ce&&typeof Ce=="object"&&!Array.isArray(Ce))oe=Ce;else{I("保存失败","小程序文案 mpUi 须为 JSON 对象(非数组)",!0),C(!1);return}}}catch{I("保存失败","小程序文案 mpUi 不是合法 JSON",!0),C(!1);return}const F=oe.chaptersPage,G=F&&typeof F=="object"&&!Array.isArray(F)?{...F}:{},te=v.trim();te?G.newBadgeText=te:delete G.newBadgeText,delete G.sectionNewBadgeText,oe.chaptersPage=G;const be=await St("/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(!be||be.success===!1){I("保存失败",(be==null?void 0:be.error)??"未知错误",!0);return}I("已保存","设置已保存成功。")}catch(oe){console.error("Save settings error:",oe),I("保存失败",oe instanceof Error?oe.message:String(oe),!0)}finally{C(!1)}},ce=oe=>{if(oe==="system"){const F=new URLSearchParams(t);F.delete("tab"),lj.includes(F.get("section")||"basic")||F.set("section","basic"),e(F);return}e({tab:oe})},ue=oe=>{const F=new URLSearchParams(t);F.delete("tab"),F.set("section",oe),e(F)};return L?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:E,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),E?"保存中...":"保存设置"]})]}),s.jsxs(Dc,{value:r,onValueChange:ce,className:"w-full",children:[s.jsxs(Nl,{className:"mb-6 bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(tn,{value:"system",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(co,{className:"w-4 h-4 mr-2"}),"系统设置"]}),s.jsxs(tn,{value:"author",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(bh,{className:"w-4 h-4 mr-2"}),"作者详情"]}),s.jsxs(tn,{value:"admin",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(jc,{className:"w-4 h-4 mr-2"}),"管理员"]}),s.jsxs(tn,{value:"api-docs",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",onClick:oe=>{oe.preventDefault(),window.open("/api-docs","_blank")},children:[s.jsx(_j,{className:"w-4 h-4 mr-2"}),"API 文档 ↗"]})]}),s.jsxs(nn,{value:"system",className:"mt-0",children:[s.jsxs("p",{className:"text-xs text-gray-500 mb-3",children:["MBTI 默认头像已迁至"," ",s.jsx(Rc,{to:"/users",className:"text-[#38bdac] underline",children:"用户管理(用户列表点头像打开)"})]}),s.jsxs(Dc,{value:i,onValueChange:ue,className:"w-full",children:[s.jsxs(Nl,{className:"mb-4 bg-[#0a1628] border border-gray-700/50 p-1 flex-wrap h-auto gap-1",children:[s.jsxs(tn,{value:"basic",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(oM,{className:"w-3.5 h-3.5 mr-1"}),"基础与价格"]}),s.jsxs(tn,{value:"mp",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(yl,{className:"w-3.5 h-3.5 mr-1"}),"小程序与审核"]}),s.jsxs(tn,{value:"oss",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(x1,{className:"w-3.5 h-3.5 mr-1"}),"OSS"]}),s.jsxs(tn,{value:"features",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(co,{className:"w-3.5 h-3.5 mr-1"}),"功能开关"]})]}),s.jsxs(nn,{value:"basic",className:"space-y-6 mt-0",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ct,{children:[s.jsxs(dt,{className:"text-white flex items-center gap-2",children:[s.jsx(bh,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),s.jsx(Yt,{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(Z,{htmlFor:"author-name",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(bh,{className:"w-3 h-3"}),"主理人名称"]}),s.jsx(le,{id:"author-name",className:"bg-[#0a1628] border-gray-700 text-white",value:o.authorInfo.name??"",onChange:oe=>c(F=>({...F,authorInfo:{...F.authorInfo,name:oe.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{htmlFor:"start-date",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(mg,{className:"w-3 h-3"}),"开播日期"]}),s.jsx(le,{id:"start-date",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 2025年10月15日",value:o.authorInfo.startDate??"",onChange:oe=>c(F=>({...F,authorInfo:{...F.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(Z,{htmlFor:"live-time",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(mg,{className:"w-3 h-3"}),"直播时间"]}),s.jsx(le,{id:"live-time",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: 06:00-09:00",value:o.authorInfo.liveTime??"",onChange:oe=>c(F=>({...F,authorInfo:{...F.authorInfo,liveTime:oe.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{htmlFor:"platform",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Fj,{className:"w-3 h-3"}),"直播平台"]}),s.jsx(le,{id:"platform",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例如: Soul派对房",value:o.authorInfo.platform??"",onChange:oe=>c(F=>({...F,authorInfo:{...F.authorInfo,platform:oe.target.value}}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{htmlFor:"description",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(er,{className:"w-3 h-3"}),"简介描述"]}),s.jsx(le,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:o.authorInfo.description??"",onChange:oe=>c(F=>({...F,authorInfo:{...F.authorInfo,description:oe.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),s.jsx(wl,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:o.authorInfo.bio??"",onChange:oe=>c(F=>({...F,authorInfo:{...F.authorInfo,bio:oe.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{htmlFor:"ckb-lead-api-key",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Sa,{className:"w-3 h-3"}),"链接卡若存客宝密钥"]}),s.jsx(le,{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(F=>({...F,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(ct,{children:[s.jsxs(dt,{className:"text-white flex items-center gap-2",children:[s.jsx(sf,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),s.jsx(Yt,{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(Z,{className:"text-gray-300",children:"单节价格 (元)"}),s.jsx(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.sectionPrice,onChange:oe=>c(F=>({...F,sectionPrice:Number.parseFloat(oe.target.value)||1}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"整本价格 (元)"}),s.jsx(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.baseBookPrice,onChange:oe=>c(F=>({...F,baseBookPrice:Number.parseFloat(oe.target.value)||9.9}))})]})]})})]})]}),s.jsxs(nn,{value:"mp",className:"space-y-6 mt-0",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ct,{children:[s.jsxs(dt,{className:"text-white flex items-center gap-2",children:[s.jsx(yl,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),s.jsx(Yt,{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(Z,{className:"text-gray-300",children:"小程序 AppID"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:f.appId??"",onChange:oe=>m(F=>({...F,appId:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"提现订阅模板 ID"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"用户申请提现时需授权",value:f.withdrawSubscribeTmplId??"",onChange:oe=>m(F=>({...F,withdrawSubscribeTmplId:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"微信支付商户号"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"1318592501",value:f.mchId??"",onChange:oe=>m(F=>({...F,mchId:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"最低提现金额 (元)"}),s.jsx(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:f.minWithdraw??10,onChange:oe=>m(F=>({...F,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(Z,{className:"text-gray-300",children:"目录 NEW 角标文案"}),s.jsx(le,{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(Z,{className:"text-gray-300",children:"小程序界面文案 mpUi(JSON)"}),s.jsx(J,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-200",onClick:()=>y(JSON.stringify(aV,null,2)),children:"填入默认模板"})]}),s.jsx("p",{className:"text-xs text-gray-500",children:"覆盖 Tab 文案、首页/目录标题、我的页名片与阅读记录路径等;仅填需要改的字段也可(与后端默认值深合并)。保存后小程序约 5 分钟内通过 config 缓存刷新。"}),s.jsx(wl,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm min-h-[280px]",spellCheck:!1,value:x,onChange:oe=>y(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(ct,{children:[s.jsxs(dt,{className:"text-white flex items-center gap-2",children:[s.jsx(jc,{className:"w-5 h-5 text-amber-400"}),"小程序审核模式"]}),s.jsx(Yt,{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(jc,{className:`w-4 h-4 ${f.auditMode?"text-amber-400":"text-gray-400"}`}),s.jsx(Z,{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(Vt,{id:"audit-mode",checked:f.auditMode??!1,disabled:ie,onCheckedChange:$})]})})]})]}),s.jsx(nn,{value:"oss",className:"space-y-6 mt-0",children:s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ct,{children:[s.jsxs(dt,{className:"text-white flex items-center gap-2",children:[s.jsx(x1,{className:"w-5 h-5 text-[#38bdac]"}),"OSS 配置(阿里云对象存储)"]}),s.jsx(Yt,{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(Z,{className:"text-gray-300",children:"Endpoint"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"oss-cn-hangzhou.aliyuncs.com",value:N.endpoint??"",onChange:oe=>k(F=>({...F,endpoint:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"Bucket"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"bucket 名称",value:N.bucket??"",onChange:oe=>k(F=>({...F,bucket:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"Region"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"oss-cn-hangzhou",value:N.region??"",onChange:oe=>k(F=>({...F,region:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"AccessKey ID"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"AccessKey ID",value:N.accessKeyId??"",onChange:oe=>k(F=>({...F,accessKeyId:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"AccessKey Secret"}),s.jsx(le,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"AccessKey Secret",value:N.accessKeySecret??"",onChange:oe=>k(F=>({...F,accessKeySecret:oe.target.value}))})]})]})})]})}),s.jsxs(nn,{value:"features",className:"space-y-6 mt-0",children:[s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ct,{children:[s.jsxs(dt,{className:"text-white flex items-center gap-2",children:[s.jsx(co,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),s.jsx(Yt,{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(_n,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(Z,{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(Vt,{id:"match-enabled",checked:u.matchEnabled,disabled:ae,onCheckedChange:oe=>R("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(yg,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(Z,{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(Rc,{to:"/distribution?tab=settings",className:"underline mx-1 text-[#38bdac]",children:"推广中心 → 推广设置"}),"为同一套接口,在此仅控制是否展示入口。"]})]}),s.jsx(Vt,{id:"referral-enabled",checked:u.referralEnabled,disabled:ae,onCheckedChange:oe=>R("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(er,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(Z,{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(Vt,{id:"search-enabled",checked:u.searchEnabled,disabled:ae,onCheckedChange:oe=>R("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(co,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(Z,{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(Vt,{id:"about-enabled",checked:u.aboutEnabled,disabled:ae,onCheckedChange:oe=>R("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(ct,{children:[s.jsxs(dt,{className:"text-white flex items-center gap-2",children:[s.jsx(rf,{className:"w-5 h-5 text-[#38bdac]"}),"小程序模块显隐说明"]}),s.jsx(Yt,{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(_n,{className:"w-3 h-3"})},{mod:"推广中心 / 推荐好友",ctrl:"推广功能开关",icon:s.jsx(yg,{className:"w-3 h-3"})},{mod:"搜索",ctrl:"搜索功能开关",icon:s.jsx(er,{className:"w-3 h-3"})},{mod:"关于页面",ctrl:"关于页面开关",icon:s.jsx(bh,{className:"w-3 h-3"})},{mod:"支付 / VIP / 充值 / 收益",ctrl:"审核模式",icon:s.jsx(jc,{className:"w-3 h-3"})},{mod:"超级个体名片",ctrl:"审核模式",icon:s.jsx(rA,{className:"w-3 h-3"})},{mod:"首页获客入口",ctrl:"已移除",icon:s.jsx(I5,{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(nn,{value:"author",className:"mt-0",children:s.jsx(X9,{})}),s.jsx(nn,{value:"admin",className:"mt-0",children:s.jsx(eV,{})}),s.jsx(nn,{value:"api-docs",className:"mt-0",children:s.jsx(C4,{})})]}),s.jsx($t,{open:K,onOpenChange:_,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsxs(Ft,{children:[s.jsx(Bt,{className:V?"text-red-400":"text-[#38bdac]",children:H}),s.jsx(uf,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:ee})]}),s.jsx(yn,{className:"mt-4",children:s.jsx(J,{onClick:()=>_(!1),className:V?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const cj={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 lV(){const[t,e]=b.useState(!1),[n,r]=b.useState(cj),[a,i]=b.useState(""),o=async()=>{e(!0);try{const k=await De("/api/config");k!=null&&k.paymentMethods&&r({...cj,...k.paymentMethods})}catch(k){console.error(k)}finally{e(!1)}};b.useEffect(()=>{o()},[]);const c=async()=>{e(!0);try{await St("/api/db/config",{key:"payment_methods",value:n,description:"支付方式配置"}),X.success("配置已保存!")}catch(k){console.error("保存失败:",k),X.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{e(!1)}},u=(k,E)=>{navigator.clipboard.writeText(k),i(E),setTimeout(()=>i(""),2e3)},h=(k,E)=>{r(C=>({...C,wechat:{...C.wechat,[k]:E}}))},f=(k,E)=>{r(C=>({...C,alipay:{...C.alipay,[k]:E}}))},m=(k,E)=>{r(C=>({...C,usdt:{...C.usdt,[k]:E}}))},x=(k,E)=>{r(C=>({...C,paypal:{...C.paypal,[k]:E}}))},y=n.wechat,v=n.alipay,w=n.usdt,N=n.paypal;return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold mb-2 text-white",children:"支付配置"}),s.jsx("p",{className:"text-gray-400",children:"配置微信、支付宝、USDT、PayPal等支付参数"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(J,{variant:"outline",onClick:o,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Fe,{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(Sn,{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(Lj,{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(Dc,{defaultValue:"wechat",className:"space-y-6",children:[s.jsxs(Nl,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[s.jsxs(tn,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[s.jsx(yl,{className:"w-4 h-4 mr-2"}),"微信"]}),s.jsxs(tn,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[s.jsx(g1,{className:"w-4 h-4 mr-2"}),"支付宝"]}),s.jsxs(tn,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[s.jsx(m1,{className:"w-4 h-4 mr-2"}),"USDT"]}),s.jsxs(tn,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[s.jsx(bg,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),s.jsx(nn,{value:"wechat",className:"space-y-4",children:s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ct,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(dt,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(yl,{className:"w-5 h-5"}),"微信支付配置"]}),s.jsx(Yt,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),s.jsx(Vt,{checked:!!y.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(Z,{className:"text-gray-300",children:"网站AppID"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.websiteAppId??""),onChange:k=>h("websiteAppId",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"商户号"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.merchantId??""),onChange:k=>h("merchantId",k.target.value)})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[s.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[s.jsx(mi,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置(核心功能)"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"微信收款码/支付链接"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://收款码图片URL 或 weixin://支付链接",value:String(y.qrCode??""),onChange:k=>h("qrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户点击微信支付后显示的二维码图片URL"})]}),s.jsxs("div",{className:"space-y-2 bg-[#07C160]/5 p-4 rounded-xl border border-[#07C160]/20",children:[s.jsx(Z,{className:"text-[#07C160] font-medium",children:"微信群跳转链接(支付成功后跳转)"}),s.jsx(le,{className:"bg-[#0a1628] border-[#07C160]/30 text-white placeholder:text-gray-500",placeholder:"https://weixin.qq.com/g/... 或微信群二维码图片URL",value:String(y.groupQrCode??""),onChange:k=>h("groupQrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-[#07C160]/70",children:"用户支付成功后将自动跳转到此链接,进入指定微信群"})]})]})]})]})}),s.jsx(nn,{value:"alipay",className:"space-y-4",children:s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ct,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(dt,{className:"text-[#1677FF] flex items-center gap-2",children:[s.jsx(g1,{className:"w-5 h-5"}),"支付宝配置"]}),s.jsx(Yt,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),s.jsx(Vt,{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(Z,{className:"text-gray-300",children:"合作者身份 (PID)"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(le,{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(dp,{className:"w-4 h-4 text-green-500"}):s.jsx(Dj,{className:"w-4 h-4 text-gray-400"})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"安全校验码 (Key)"}),s.jsx(le,{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(mi,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"支付宝收款码/跳转链接"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://qr.alipay.com/... 或收款码图片URL",value:String(v.qrCode??""),onChange:k=>f("qrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户点击支付宝支付后显示的二维码"})]})]})]})]})}),s.jsx(nn,{value:"usdt",className:"space-y-4",children:s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ct,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(dt,{className:"text-[#26A17B] flex items-center gap-2",children:[s.jsx(m1,{className:"w-5 h-5"}),"USDT配置"]}),s.jsx(Yt,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),s.jsx(Vt,{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(Z,{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(Z,{className:"text-gray-300",children:"收款地址"}),s.jsx(le,{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(Z,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(w.exchangeRate)??7.2,onChange:k=>m("exchangeRate",Number.parseFloat(k.target.value)||7.2)})]})]})]})}),s.jsx(nn,{value:"paypal",className:"space-y-4",children:s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ct,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(dt,{className:"text-[#169BD7] flex items-center gap-2",children:[s.jsx(bg,{className:"w-5 h-5"}),"PayPal配置"]}),s.jsx(Yt,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),s.jsx(Vt,{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(Z,{className:"text-gray-300",children:"PayPal邮箱"}),s.jsx(le,{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(Z,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(le,{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 cV={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},dV={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},uV={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function hV(){const[t,e]=b.useState({siteConfig:{...cV},menuConfig:{...dV},pageConfig:{...uV}}),[n,r]=b.useState(!1),[a,i]=b.useState(!1);b.useEffect(()=>{De("/api/config").then(f=>{f!=null&&f.siteConfig&&e(m=>({...m,siteConfig:{...m.siteConfig,...f.siteConfig}})),f!=null&&f.menuConfig&&e(m=>({...m,menuConfig:{...m.menuConfig,...f.menuConfig}})),f!=null&&f.pageConfig&&e(m=>({...m,pageConfig:{...m.pageConfig,...f.pageConfig}}))}).catch(console.error)},[]);const o=async()=>{i(!0);try{await St("/api/db/config",{key:"site_config",value:t.siteConfig,description:"网站基础配置"}),await St("/api/db/config",{key:"menu_config",value:t.menuConfig,description:"底部菜单配置"}),await St("/api/db/config",{key:"page_config",value:t.pageConfig,description:"页面标题配置"}),r(!0),setTimeout(()=>r(!1),2e3),X.success("配置已保存")}catch(f){console.error(f),X.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(Sn,{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(ct,{children:[s.jsxs(dt,{className:"text-white flex items-center gap-2",children:[s.jsx(bg,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),s.jsx(Yt,{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(Z,{htmlFor:"site-name",className:"text-gray-300",children:"网站名称"}),s.jsx(le,{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(Z,{htmlFor:"site-title",className:"text-gray-300",children:"网站标题"}),s.jsx(le,{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(Z,{htmlFor:"site-desc",className:"text-gray-300",children:"网站描述"}),s.jsx(le,{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(Z,{htmlFor:"logo",className:"text-gray-300",children:"Logo地址"}),s.jsx(le,{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(Z,{htmlFor:"favicon",className:"text-gray-300",children:"Favicon地址"}),s.jsx(le,{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(ct,{children:[s.jsxs(dt,{className:"text-white flex items-center gap-2",children:[s.jsx(TM,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),s.jsx(Yt,{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(Z,{htmlFor:"primary-color",className:"text-gray-300",children:"主色调"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(le,{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(le,{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(ct,{children:[s.jsxs(dt,{className:"text-white flex items-center gap-2",children:[s.jsx(vM,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),s.jsx(Yt,{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(Vt,{checked:(m==null?void 0:m.enabled)??!0,onCheckedChange:x=>e(y=>({...y,menuConfig:{...y.menuConfig,[f]:{...m,enabled:x}}}))}),s.jsx("span",{className:"text-gray-300 w-16 capitalize",children:f}),s.jsx(le,{className:"bg-[#0f2137] border-gray-700 text-white max-w-[200px]",value:(m==null?void 0:m.label)??"",onChange:x=>e(y=>({...y,menuConfig:{...y.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(ct,{children:[s.jsxs(dt,{className:"text-white flex items-center gap-2",children:[s.jsx(_j,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),s.jsx(Yt,{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(Z,{className:"text-gray-300",children:"首页标题"}),s.jsx(le,{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(Z,{className:"text-gray-300",children:"首页副标题"}),s.jsx(le,{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(Z,{className:"text-gray-300",children:"目录页标题"}),s.jsx(le,{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(Z,{className:"text-gray-300",children:"匹配页标题"}),s.jsx(le,{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(Z,{className:"text-gray-300",children:"我的页标题"}),s.jsx(le,{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(Z,{className:"text-gray-300",children:"关于作者标题"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:h.aboutTitle??"",onChange:f=>e(m=>({...m,pageConfig:{...m.pageConfig,aboutTitle:f.target.value}}))})]})]})]})]})]})]})}function fV(){const[t,e]=b.useState(""),[n,r]=b.useState(""),[a,i]=b.useState(""),[o,c]=b.useState({}),u=async()=>{var y,v,w,N;try{const k=await De("/api/config"),E=(v=(y=k==null?void 0:k.liveQRCodes)==null?void 0:y[0])==null?void 0:v.urls;Array.isArray(E)&&e(E.join(` -`));const C=(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)}};b.useEffect(()=>{u()},[]);const h=(y,v)=>{navigator.clipboard.writeText(y),i(v),setTimeout(()=>i(""),2e3)},f=async()=>{try{const y=t.split(` -`).map(w=>w.trim()).filter(Boolean),v=[...o.liveQRCodes||[]];v[0]?v[0].urls=y:v.push({id:"live-1",name:"微信群活码",urls:y,clickCount:0}),await St("/api/db/config",{key:"live_qr_codes",value:v,description:"群活码配置"}),X.success("群活码配置已保存!"),await u()}catch(y){console.error(y),X.error("保存失败: "+(y instanceof Error?y.message:String(y)))}},m=async()=>{var y;try{await St("/api/db/config",{key:"payment_methods",value:{...o.paymentMethods||{},wechat:{...((y=o.paymentMethods)==null?void 0:y.wechat)||{},groupQrCode:n}},description:"支付方式配置"}),X.success("微信群链接已保存!用户支付成功后将自动跳转"),await u()}catch(v){console.error(v),X.error("保存失败: "+(v instanceof Error?v.message:String(v)))}},x=()=>{n?window.open(n,"_blank"):X.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(Lj,{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(ct,{children:[s.jsxs(dt,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(N1,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),s.jsx(Yt,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),s.jsxs(ze,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Ng,{className:"w-4 h-4"}),"微信群链接 / 活码链接"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(le,{placeholder:"https://cli.im/xxxxx 或 https://weixin.qq.com/g/...",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",value:n,onChange:y=>r(y.target.value)}),s.jsx(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(dp,{className:"w-4 h-4 text-green-500"}):s.jsx(Dj,{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(mi,{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(of,{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(mi,{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(ct,{children:[s.jsxs(dt,{className:"text-white flex items-center gap-2",children:[s.jsx(N1,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),s.jsx(Yt,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),s.jsxs(ze,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(Z,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Ng,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),s.jsx(wl,{placeholder:"https://cli.im/group1\\nhttps://cli.im/group2",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 min-h-[120px] font-mono text-sm",value:t,onChange:y=>e(y.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"每行填写一个群链接,系统将按顺序或随机分配"})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[s.jsx("span",{className:"text-sm text-gray-400",children:"已配置群数量"}),s.jsxs("span",{className:"font-bold text-[#38bdac]",children:[t.split(` -`).filter(Boolean).length," 个"]})]}),s.jsxs(J,{onClick:f,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(of,{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 dj={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}},pV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function mV(){const[t,e]=b.useState(dj),[n,r]=b.useState(!0),[a,i]=b.useState(!1),[o,c]=b.useState(!1),[u,h]=b.useState(null),[f,m]=b.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),x=async()=>{r(!0);try{const C=await De("/api/db/config/full?key=match_config"),L=(C==null?void 0:C.data)??(C==null?void 0:C.config);L&&e({...dj,...L})}catch(C){console.error("加载匹配配置失败:",C)}finally{r(!1)}};b.useEffect(()=>{x()},[]);const y=async()=>{i(!0);try{const C=await St("/api/db/config",{key:"match_config",value:t,description:"匹配功能配置"});C&&C.success!==!1?X.success("配置保存成功!"):X.error("保存失败: "+(C&&typeof C=="object"&&"error"in C?C.error:"未知错误"))}catch(C){console.error("保存配置失败:",C),X.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){X.error("请填写类型ID和名称");return}const C=[...t.matchTypes];if(u){const L=C.findIndex(O=>O.id===u.id);L!==-1&&(C[L]={...f})}else{if(C.some(L=>L.id===f.id)){X.error("类型ID已存在");return}C.push({...f})}e({...t,matchTypes:C}),c(!1)},k=C=>{confirm("确定要删除这个匹配类型吗?")&&e({...t,matchTypes:t.matchTypes.filter(L=>L.id!==C)})},E=C=>{e({...t,matchTypes:t.matchTypes.map(L=>L.id===C?{...L,enabled:!L.enabled}:L)})};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(co,{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(Fe,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]}),s.jsxs(J,{onClick:y,disabled:a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存配置"]})]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(ct,{children:[s.jsxs(dt,{className:"text-white flex items-center gap-2",children:[s.jsx(xi,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),s.jsx(Yt,{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(Z,{className:"text-gray-300",children:"每日免费匹配次数"}),s.jsx(le,{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(Z,{className:"text-gray-300",children:"付费匹配价格(元)"}),s.jsx(le,{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(Z,{className:"text-gray-300",children:"每日最大匹配次数"}),s.jsx(le,{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(Vt,{checked:t.settings.enableFreeMatches,onCheckedChange:C=>e({...t,settings:{...t.settings,enableFreeMatches:C}})}),s.jsx(Z,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Vt,{checked:t.settings.enablePaidMatches,onCheckedChange:C=>e({...t,settings:{...t.settings,enablePaidMatches:C}})}),s.jsx(Z,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(ct,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(dt,{className:"text-white flex items-center gap-2",children:[s.jsx(_n,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),s.jsx(Yt,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(J,{onClick:w,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Dn,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),s.jsx(ze,{children:s.jsxs(fs,{children:[s.jsx(ps,{children:s.jsxs(xt,{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(ms,{children:t.matchTypes.map(C=>s.jsxs(xt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(Ne,{children:s.jsx("span",{className:"text-2xl",children:C.icon})}),s.jsx(Ne,{className:"font-mono text-gray-300",children:C.id}),s.jsx(Ne,{className:"text-white font-medium",children:C.label}),s.jsx(Ne,{className:"text-gray-300",children:C.matchLabel}),s.jsx(Ne,{children:s.jsxs(Be,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",C.price]})}),s.jsx(Ne,{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(Ne,{children:s.jsx(Vt,{checked:C.enabled,onCheckedChange:()=>E(C.id)})}),s.jsx(Ne,{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(en,{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(js,{className:"w-4 h-4"})})]})})]},C.id))})]})})]}),s.jsx($t,{open:o,onOpenChange:c,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(Ft,{children:s.jsxs(Bt,{className:"text-white flex items-center gap-2",children:[u?s.jsx(en,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(Dn,{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(Z,{className:"text-gray-300",children:"类型ID(英文)"}),s.jsx(le,{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(Z,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:pV.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(Z,{className:"text-gray-300",children:"显示名称"}),s.jsx(le,{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(Z,{className:"text-gray-300",children:"匹配标签"}),s.jsx(le,{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(Z,{className:"text-gray-300",children:"单次匹配价格(元)"}),s.jsx(le,{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(Vt,{checked:f.matchFromDB,onCheckedChange:C=>m({...f,matchFromDB:C})}),s.jsx(Z,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Vt,{checked:f.showJoinAfterMatch,onCheckedChange:C=>m({...f,showJoinAfterMatch:C})}),s.jsx(Z,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Vt,{checked:f.enabled,onCheckedChange:C=>m({...f,enabled:C})}),s.jsx(Z,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(yn,{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(Sn,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const uj={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function xV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(""),[f,m]=b.useState(!0),[x,y]=b.useState(null);async function v(){m(!0),y(null);try{const N=new URLSearchParams({page:String(a),pageSize:String(o)});u&&N.set("matchType",u);const k=await De(`/api/db/match-records?${N}`);k!=null&&k.success?(e(k.records||[]),r(k.total??0)):y("加载匹配记录失败")}catch(N){console.error("加载匹配记录失败",N),y("加载失败,请检查网络后重试")}finally{m(!1)}}b.useEffect(()=>{v()},[a,u]);const w=Math.ceil(n/o)||1;return s.jsxs("div",{className:"p-8 w-full",children:[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:()=>y(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"匹配记录"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["找伙伴匹配统计,共 ",n," 条记录"]})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("select",{value:u,onChange:N=>{h(N.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部类型"}),Object.entries(uj).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(Fe,{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(Fe,{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(fs,{children:[s.jsx(ps,{children:s.jsxs(xt,{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(ms,{children:[t.map(N=>s.jsxs(xt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(Ne,{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:vo(N.userAvatar),alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const E=k.currentTarget.nextElementSibling;E&&E.classList.remove("hidden")}}):null,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(Ne,{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:vo(N.matchedUserAvatar),alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const E=k.currentTarget.nextElementSibling;E&&E.classList.remove("hidden")}}):null,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(Ne,{children:s.jsx(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:uj[N.matchType]||N.matchType})}),s.jsxs(Ne,{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(Ne,{className:"text-gray-400",children:N.createdAt?new Date(N.createdAt).toLocaleString():"-"})]},N.id)),t.length===0&&s.jsx(xt,{children:s.jsx(Ne,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(Zs,{page:a,totalPages:w,total:n,pageSize:o,onPageChange:i,onPageSizeChange:N=>{c(N),i(1)}})]})})})]})}function gV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0);async function a(){r(!0);try{const i=await De("/api/db/vip-members?limit=100");if(i!=null&&i.success&&i.data){const o=[...i.data].map((c,u)=>({...c,vipSort:typeof c.vipSort=="number"?c.vipSort:u+1}));o.sort((c,u)=>(c.vipSort??999999)-(u.vipSort??999999)),e(o)}}catch(i){console.error("Load VIP members error:",i),X.error("加载 VIP 成员失败")}finally{r(!1)}}return b.useEffect(()=>{a()},[]),s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("div",{className:"flex justify-between items-center mb-8",children:s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Tc,{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(fs,{children:[s.jsx(ps,{children:s.jsxs(xt,{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(ms,{children:[t.map((i,o)=>{var c;return s.jsxs(xt,{className:"border-gray-700/50",children:[s.jsx(Ne,{className:"text-gray-300",children:o+1}),s.jsx(Ne,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[i.avatar?s.jsx("img",{src:vo(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(Ne,{className:"text-gray-300",children:i.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置超级个体)"})}),s.jsx(Ne,{className:"text-gray-300",children:i.vipSort??o+1})]},i.id)}),t.length===0&&s.jsx(xt,{children:s.jsx(Ne,{colSpan:5,className:"text-center py-12 text-gray-500",children:"当前没有有效的超级个体用户。"})})]})]})})})]})}function T4(t){const e=Ra(),[n,r]=b.useState([]),[a,i]=b.useState(!0),[o,c]=b.useState(!1),[u,h]=b.useState(null),[f,m]=b.useState({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:0,enabled:!0}),[x,y]=b.useState(!1),[v,w]=b.useState(!1),N=b.useRef(null),k=async P=>{var Q;const ee=(Q=P.target.files)==null?void 0:Q[0];if(ee){w(!0);try{const V=new FormData;V.append("file",ee),V.append("folder","mentors");const re=gu(),ae={};re&&(ae.Authorization=`Bearer ${re}`);const I=await(await fetch(Oc("/api/upload"),{method:"POST",body:V,credentials:"include",headers:ae})).json();I!=null&&I.success&&(I!=null&&I.url)?m(z=>({...z,avatar:I.url})):X.error("上传失败: "+((I==null?void 0:I.error)||"未知错误"))}catch(V){console.error(V),X.error("上传失败")}finally{w(!1),N.current&&(N.current.value="")}}};async function E(){i(!0);try{const P=await De("/api/db/mentors");P!=null&&P.success&&P.data&&r(P.data)}catch(P){console.error("Load mentors error:",P)}finally{i(!1)}}b.useEffect(()=>{E()},[]);const C=()=>{m({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:n.length>0?Math.max(...n.map(P=>P.sort))+1:0,enabled:!0})},L=()=>{h(null),C(),c(!0)},O=P=>{h(P),m({name:P.name,avatar:P.avatar||"",intro:P.intro||"",tags:P.tags||"",priceSingle:P.priceSingle!=null?String(P.priceSingle):"",priceHalfYear:P.priceHalfYear!=null?String(P.priceHalfYear):"",priceYear:P.priceYear!=null?String(P.priceYear):"",quote:P.quote||"",whyFind:P.whyFind||"",offering:P.offering||"",judgmentStyle:P.judgmentStyle||"",sort:P.sort,enabled:P.enabled??!0}),c(!0)},K=async()=>{if(!f.name.trim()){X.error("导师姓名不能为空");return}y(!0);try{const P=Q=>Q===""?void 0:parseFloat(Q),ee={name:f.name.trim(),avatar:f.avatar.trim()||void 0,intro:f.intro.trim()||void 0,tags:f.tags.trim()||void 0,priceSingle:P(f.priceSingle),priceHalfYear:P(f.priceHalfYear),priceYear:P(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 Q=await Zt("/api/db/mentors",{id:u.id,...ee});Q!=null&&Q.success?(c(!1),E()):X.error("更新失败: "+(Q==null?void 0:Q.error))}else{const Q=await St("/api/db/mentors",ee);Q!=null&&Q.success?(c(!1),E()):X.error("新增失败: "+(Q==null?void 0:Q.error))}}catch(P){console.error("Save error:",P),X.error("保存失败")}finally{y(!1)}},_=async P=>{if(confirm("确定删除该导师?"))try{const ee=await di(`/api/db/mentors?id=${P}`);ee!=null&&ee.success?E():X.error("删除失败: "+(ee==null?void 0:ee.error))}catch(ee){console.error("Delete error:",ee),X.error("删除失败")}},H=P=>P!=null?`¥${P}`:"-";return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(_n,{className:"w-5 h-5 text-[#38bdac]"}),"导师管理"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师列表,支持每个导师独立配置单次/半年/年度价格"})]}),s.jsxs(J,{onClick:L,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Dn,{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(fs,{children:[s.jsx(ps,{children:s.jsxs(xt,{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-right text-gray-400",children:"操作"})]})}),s.jsxs(ms,{children:[n.map(P=>s.jsxs(xt,{className:"border-gray-700/50",children:[s.jsx(Ne,{className:"text-gray-300",children:P.id}),s.jsx(Ne,{children:s.jsxs("button",{type:"button",onClick:()=>e(`/users?search=${encodeURIComponent(P.name)}`),className:"text-[#38bdac] hover:text-[#2da396] hover:underline flex items-center gap-1",title:"在用户管理中查看",children:[P.name,s.jsx(mi,{className:"w-3 h-3"})]})}),s.jsx(Ne,{className:"text-gray-400 max-w-[200px] truncate",children:P.intro||"-"}),s.jsx(Ne,{className:"text-gray-400",children:H(P.priceSingle)}),s.jsx(Ne,{className:"text-gray-400",children:H(P.priceHalfYear)}),s.jsx(Ne,{className:"text-gray-400",children:H(P.priceYear)}),s.jsx(Ne,{className:"text-gray-400",children:P.sort}),s.jsxs(Ne,{className:"text-right",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>O(P),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(en,{className:"w-4 h-4"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>_(P.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(js,{className:"w-4 h-4"})})]})]},P.id)),n.length===0&&s.jsx(xt,{children:s.jsx(Ne,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无导师,点击「新增导师」添加"})})]})]})})}),s.jsx($t,{open:o,onOpenChange:c,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg max-h-[90vh] overflow-y-auto",children:[s.jsx(Ft,{children:s.jsx(Bt,{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(Z,{className:"text-gray-300",children:"姓名 *"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:卡若",value:f.name,onChange:P=>m(ee=>({...ee,name:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"排序"}),s.jsx(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:f.sort,onChange:P=>m(ee=>({...ee,sort:parseInt(P.target.value,10)||0}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"头像"}),s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(le,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:f.avatar,onChange:P=>m(ee=>({...ee,avatar:P.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 P;return(P=N.current)==null?void 0:P.click()},children:[s.jsx(of,{className:"w-4 h-4 mr-2"}),v?"上传中...":"上传"]})]}),f.avatar&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:vo(f.avatar.startsWith("http")?f.avatar:Oc(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(Z,{className:"text-gray-300",children:"简介"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:结构判断型咨询 · Decision > Execution",value:f.intro,onChange:P=>m(ee=>({...ee,intro:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"技能标签(逗号分隔)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:项目结构判断、风险止损、人×项目匹配",value:f.tags,onChange:P=>m(ee=>({...ee,tags:P.target.value}))})]}),s.jsxs("div",{className:"border-t border-gray-700 pt-4",children:[s.jsx(Z,{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(Z,{className:"text-gray-500 text-xs",children:"单次咨询 ¥"}),s.jsx(le,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"980",value:f.priceSingle,onChange:P=>m(ee=>({...ee,priceSingle:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"半年咨询 ¥"}),s.jsx(le,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"19800",value:f.priceHalfYear,onChange:P=>m(ee=>({...ee,priceHalfYear:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"年度咨询 ¥"}),s.jsx(le,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"29800",value:f.priceYear,onChange:P=>m(ee=>({...ee,priceYear:P.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"引言"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:大多数人失败,不是因为不努力...",value:f.quote,onChange:P=>m(ee=>({...ee,quote:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"为什么找(文本)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:f.whyFind,onChange:P=>m(ee=>({...ee,whyFind:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"提供什么(文本)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:f.offering,onChange:P=>m(ee=>({...ee,offering:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"判断风格(逗号分隔)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:冷静、克制、偏风险视角",value:f.judgmentStyle,onChange:P=>m(ee=>({...ee,judgmentStyle:P.target.value}))})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",id:"enabled",checked:f.enabled,onChange:P=>m(ee=>({...ee,enabled:P.target.checked})),className:"rounded border-gray-600 bg-[#0a1628]"}),s.jsx(Z,{htmlFor:"enabled",className:"text-gray-300 cursor-pointer",children:"上架(小程序可见)"})]})]}),s.jsxs(yn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>c(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(ts,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:K,disabled:x,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"}),x?"保存中...":"保存"]})]})]})})]})}function yV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[a,i]=b.useState("");async function o(){r(!0);try{const h=a?`/api/db/mentor-consultations?status=${a}`:"/api/db/mentor-consultations",f=await De(h);f!=null&&f.success&&f.data&&e(f.data)}catch(h){console.error("Load consultations error:",h)}finally{r(!1)}}b.useEffect(()=>{o()},[a]);const c={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},u={single:"单次",half_year:"半年",year:"年度"};return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(mg,{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(Fe,{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(fs,{children:[s.jsx(ps,{children:s.jsxs(xt,{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(ms,{children:[t.map(h=>s.jsxs(xt,{className:"border-gray-700/50",children:[s.jsx(Ne,{className:"text-gray-300",children:h.id}),s.jsx(Ne,{className:"text-gray-400",children:h.userId}),s.jsx(Ne,{className:"text-gray-400",children:h.mentorId}),s.jsx(Ne,{className:"text-gray-400",children:u[h.consultationType]||h.consultationType}),s.jsxs(Ne,{className:"text-white",children:["¥",h.amount]}),s.jsx(Ne,{className:"text-gray-400",children:c[h.status]||h.status}),s.jsx(Ne,{className:"text-gray-500 text-sm",children:h.createdAt})]},h.id)),t.length===0&&s.jsx(xt,{children:s.jsx(Ne,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}const $d={poolSource:["vip"],requirePhone:!0,requireNickname:!0,requireAvatar:!1,requireBusiness:!1},hj={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:$d},bV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function vV(){const t=Ra(),[e,n]=b.useState(hj),[r,a]=b.useState(!0),[i,o]=b.useState(!1),[c,u]=b.useState(!1),[h,f]=b.useState(null),[m,x]=b.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),[y,v]=b.useState(null),[w,N]=b.useState(!1),k=async()=>{N(!0);try{const P=await De("/api/db/match-pool-counts");P!=null&&P.success&&P.data&&v(P.data)}catch(P){console.error("加载池子人数失败:",P)}finally{N(!1)}},E=async()=>{a(!0);try{const P=await De("/api/db/config/full?key=match_config"),ee=(P==null?void 0:P.data)??(P==null?void 0:P.config);if(ee){let Q=ee.poolSettings??$d;Q.poolSource&&!Array.isArray(Q.poolSource)&&(Q={...Q,poolSource:[Q.poolSource]}),n({...hj,...ee,poolSettings:Q})}}catch(P){console.error("加载匹配配置失败:",P)}finally{a(!1)}};b.useEffect(()=>{E(),k()},[]);const C=async()=>{o(!0);try{const P=await St("/api/db/config",{key:"match_config",value:e,description:"匹配功能配置"});X.error((P==null?void 0:P.success)!==!1?"配置保存成功!":"保存失败: "+((P==null?void 0:P.error)||"未知错误"))}catch(P){console.error(P),X.error("保存失败")}finally{o(!1)}},L=P=>{f(P),x({...P}),u(!0)},O=()=>{f(null),x({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),u(!0)},K=()=>{if(!m.id||!m.label){X.error("请填写类型ID和名称");return}const P=[...e.matchTypes];if(h){const ee=P.findIndex(Q=>Q.id===h.id);ee!==-1&&(P[ee]={...m})}else{if(P.some(ee=>ee.id===m.id)){X.error("类型ID已存在");return}P.push({...m})}n({...e,matchTypes:P}),u(!1)},_=P=>{confirm("确定要删除这个匹配类型吗?")&&n({...e,matchTypes:e.matchTypes.filter(ee=>ee.id!==P)})},H=P=>{n({...e,matchTypes:e.matchTypes.map(ee=>ee.id===P?{...ee,enabled:!ee.enabled}:ee)})};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:E,disabled:r,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Fe,{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(Sn,{className:"w-4 h-4 mr-2"})," ",i?"保存中...":"保存配置"]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(ct,{children:[s.jsxs(dt,{className:"text-white flex items-center gap-2",children:[s.jsx(zj,{className:"w-5 h-5 text-blue-400"})," 匹配池选择"]}),s.jsx(Yt,{className:"text-gray-400",children:"选择匹配的用户池和完善程度要求,只有满足条件的用户才可被匹配到"})]}),s.jsxs(ze,{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx(Z,{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(P=>{const ee=e.poolSettings??$d,V=(Array.isArray(ee.poolSource)?ee.poolSource:[ee.poolSource]).includes(P.value),re=y==null?void 0:y[P.countKey],ae=()=>{const pe=Array.isArray(ee.poolSource)?[...ee.poolSource]:[ee.poolSource],I=V?pe.filter(z=>z!==P.value):[...pe,P.value];I.length===0&&I.push(P.value),n({...e,poolSettings:{...ee,poolSource:I}})};return s.jsxs("button",{type:"button",onClick:ae,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:P.icon}),s.jsx("span",{className:`text-sm font-medium ${V?"text-[#38bdac]":"text-gray-300"}`,children:P.label})]}),s.jsxs("span",{className:"text-lg font-bold text-white",children:[w?"...":re??"-",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:P.desc}),s.jsx("span",{role:"link",tabIndex:0,onClick:pe=>{pe.stopPropagation(),t(`/users?pool=${P.value}`)},onKeyDown:pe=>{pe.key==="Enter"&&(pe.stopPropagation(),t(`/users?pool=${P.value}`))},className:"text-[#38bdac] text-xs mt-2 inline-block hover:underline cursor-pointer",children:"查看用户列表 →"})]},P.value)})})]}),s.jsxs("div",{className:"space-y-3 pt-4 border-t border-gray-700/50",children:[s.jsx(Z,{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(P=>{const Q=(e.poolSettings??$d)[P.key];return s.jsxs("div",{className:"flex items-center gap-3 bg-[#0a1628] rounded-lg p-3",children:[s.jsx(Vt,{checked:Q,onCheckedChange:V=>n({...e,poolSettings:{...e.poolSettings??$d,[P.key]:V}})}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{children:P.icon}),s.jsx(Z,{className:"text-gray-300 text-sm",children:P.label})]})]},P.key)})})]})]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(ct,{children:[s.jsxs(dt,{className:"text-white flex items-center gap-2",children:[s.jsx(xi,{className:"w-5 h-5 text-yellow-400"})," 基础设置"]}),s.jsx(Yt,{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(Z,{className:"text-gray-300",children:"每日免费匹配次数"}),s.jsx(le,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.freeMatchLimit,onChange:P=>n({...e,freeMatchLimit:parseInt(P.target.value,10)||0})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"付费匹配价格(元)"}),s.jsx(le,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:e.matchPrice,onChange:P=>n({...e,matchPrice:parseFloat(P.target.value)||1})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"每日最大匹配次数"}),s.jsx(le,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.settings.maxMatchesPerDay,onChange:P=>n({...e,settings:{...e.settings,maxMatchesPerDay:parseInt(P.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(Vt,{checked:e.settings.enableFreeMatches,onCheckedChange:P=>n({...e,settings:{...e.settings,enableFreeMatches:P}})}),s.jsx(Z,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Vt,{checked:e.settings.enablePaidMatches,onCheckedChange:P=>n({...e,settings:{...e.settings,enablePaidMatches:P}})}),s.jsx(Z,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(_e,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(ct,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(dt,{className:"text-white flex items-center gap-2",children:[s.jsx(_n,{className:"w-5 h-5 text-[#38bdac]"})," 匹配类型管理"]}),s.jsx(Yt,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(J,{onClick:O,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Dn,{className:"w-4 h-4 mr-1"})," 添加类型"]})]}),s.jsx(ze,{children:s.jsxs(fs,{children:[s.jsx(ps,{children:s.jsxs(xt,{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(ms,{children:e.matchTypes.map(P=>s.jsxs(xt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(Ne,{children:s.jsx("span",{className:"text-2xl",children:P.icon})}),s.jsx(Ne,{className:"font-mono text-gray-300",children:P.id}),s.jsx(Ne,{className:"text-white font-medium",children:P.label}),s.jsx(Ne,{className:"text-gray-300",children:P.matchLabel}),s.jsx(Ne,{children:s.jsxs(Be,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",P.price]})}),s.jsx(Ne,{children:P.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(Ne,{children:s.jsx(Vt,{checked:P.enabled,onCheckedChange:()=>H(P.id)})}),s.jsx(Ne,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>L(P),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(en,{className:"w-4 h-4"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>_(P.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(js,{className:"w-4 h-4"})})]})})]},P.id))})]})})]}),s.jsx($t,{open:c,onOpenChange:u,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(Ft,{children:s.jsxs(Bt,{className:"text-white flex items-center gap-2",children:[h?s.jsx(en,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(Dn,{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(Z,{className:"text-gray-300",children:"类型ID(英文)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:m.id,onChange:P=>x({...m,id:P.target.value}),disabled:!!h})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:bV.map(P=>s.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${m.icon===P?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>x({...m,icon:P}),children:P},P))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"显示名称"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.label,onChange:P=>x({...m,label:P.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"匹配标签"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.matchLabel,onChange:P=>x({...m,matchLabel:P.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Z,{className:"text-gray-300",children:"单次匹配价格(元)"}),s.jsx(le,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:m.price,onChange:P=>x({...m,price:parseFloat(P.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(Vt,{checked:m.matchFromDB,onCheckedChange:P=>x({...m,matchFromDB:P})}),s.jsx(Z,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Vt,{checked:m.showJoinAfterMatch,onCheckedChange:P=>x({...m,showJoinAfterMatch:P})}),s.jsx(Z,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Vt,{checked:m.enabled,onCheckedChange:P=>x({...m,enabled:P})}),s.jsx(Z,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(yn,{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:K,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{className:"w-4 h-4 mr-2"})," 保存"]})]})]})})]})}const fj={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function NV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(""),[f,m]=b.useState(!0),[x,y]=b.useState(null),[v,w]=b.useState(null);async function N(){m(!0),y(null);try{const C=new URLSearchParams({page:String(a),pageSize:String(o)});u&&C.set("matchType",u);const L=await De(`/api/db/match-records?${C}`);L!=null&&L.success?(e(L.records||[]),r(L.total??0)):y("加载匹配记录失败")}catch{y("加载失败,请检查网络后重试")}finally{m(!1)}}b.useEffect(()=>{N()},[a,u]);const k=Math.ceil(n/o)||1,E=({userId:C,nickname:L,avatar:O})=>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:[O?s.jsx("img",{src:vo(O),alt:"",className:"w-full h-full object-cover",onError:K=>{K.currentTarget.style.display="none"}}):null,s.jsx("span",{className:O?"hidden":"",children:(L||C||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white group-hover:text-[#38bdac] transition-colors",children:L||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:()=>y(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("p",{className:"text-gray-400",children:["共 ",n," 条匹配记录 · 点击用户名查看详情"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("select",{value:u,onChange: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(fj).map(([C,L])=>s.jsx("option",{value:C,children:L},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(Fe,{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(Fe,{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(fs,{children:[s.jsx(ps,{children:s.jsxs(xt,{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(ms,{children:[t.map(C=>s.jsxs(xt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(Ne,{children:s.jsx(E,{userId:C.userId,nickname:C.userNickname,avatar:C.userAvatar})}),s.jsx(Ne,{children:C.matchedUserId?s.jsx(E,{userId:C.matchedUserId,nickname:C.matchedNickname,avatar:C.matchedUserAvatar}):s.jsx("span",{className:"text-gray-500",children:"—"})}),s.jsx(Ne,{children:s.jsx(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:fj[C.matchType]||C.matchType})}),s.jsxs(Ne,{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(Ne,{className:"text-gray-400",children:C.createdAt?new Date(C.createdAt).toLocaleString():"-"})]},C.id)),t.length===0&&s.jsx(xt,{children:s.jsx(Ne,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(Zs,{page:a,totalPages:k,total:n,pageSize:o,onPageChange:i,onPageSizeChange:C=>{c(C),i(1)}})]})})}),s.jsx(V0,{open:!!v,onClose:()=>w(null),userId:v,onUserUpdated:N})]})}function wV(){const[t,e]=b.useState("records");return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>e("records"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="records"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"匹配记录"}),s.jsx("button",{type:"button",onClick:()=>e("pool"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="pool"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"匹配池设置"})]}),t==="records"&&s.jsx(NV,{}),t==="pool"&&s.jsx(vV,{})]})}const pj={investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function jV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(!0),[f,m]=b.useState("investor"),[x,y]=b.useState(null);async function v(){h(!0);try{const E=new URLSearchParams({page:String(a),pageSize:String(o),matchType:f}),C=await De(`/api/db/match-records?${E}`);C!=null&&C.success&&(e(C.records||[]),r(C.total??0))}catch(E){console.error(E)}finally{h(!1)}}b.useEffect(()=>{v()},[a,f]);const w=async E=>{if(!E.phone&&!E.wechatId){X.info("该记录无联系方式,无法推送到存客宝");return}y(E.id);try{const C=await St("/api/ckb/join",{type:E.matchType||"investor",phone:E.phone||"",wechat:E.wechatId||"",userId:E.userId,name:E.userNickname||""});X.error((C==null?void 0:C.message)||(C!=null&&C.success?"推送成功":"推送失败"))}catch(C){X.error("推送失败: "+(C instanceof Error?C.message:"网络错误"))}finally{y(null)}},N=Math.ceil(n/o)||1,k=E=>!!(E.phone||E.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:E=>{m(E.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:Object.entries(pj).map(([E,C])=>s.jsx("option",{value:E,children:C},E))}),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(Fe,{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(Fe,{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(fs,{children:[s.jsx(ps,{children:s.jsxs(xt,{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(ms,{children:[t.map(E=>{var C,L;return s.jsxs(xt,{className:`border-gray-700/50 ${k(E)?"hover:bg-[#0a1628]":"opacity-60"}`,children:[s.jsx(Ne,{className:"text-white",children:E.userNickname||((C=E.userId)==null?void 0:C.slice(0,12))}),s.jsx(Ne,{className:"text-white",children:E.matchedNickname||((L=E.matchedUserId)==null?void 0:L.slice(0,12))}),s.jsx(Ne,{children:s.jsx(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:pj[E.matchType]||E.matchType})}),s.jsxs(Ne,{className:"text-sm",children:[E.phone&&s.jsxs("div",{className:"text-green-400",children:["📱 ",E.phone]}),E.wechatId&&s.jsxs("div",{className:"text-blue-400",children:["💬 ",E.wechatId]}),!E.phone&&!E.wechatId&&s.jsx("span",{className:"text-gray-600",children:"无联系方式"})]}),s.jsx(Ne,{className:"text-gray-400 text-sm",children:E.createdAt?new Date(E.createdAt).toLocaleString():"-"}),s.jsx(Ne,{className:"text-right",children:k(E)?s.jsxs(J,{size:"sm",onClick:()=>w(E),disabled:x===E.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"}),x===E.id?"推送中...":"推送CKB"]}):s.jsx("span",{className:"text-gray-600 text-xs",children:"—"})})]},E.id)}),t.length===0&&s.jsx(xt,{children:s.jsx(Ne,{colSpan:6,className:"text-center py-12 text-gray-500",children:"暂无记录"})})]})]}),s.jsx(Zs,{page:a,totalPages:N,total:n,pageSize:o,onPageChange:i,onPageSizeChange:E=>{c(E),i(1)}})]})})})]})}const mj={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},kV={single:"单次",half_year:"半年",year:"年度"};function SV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[a,i]=b.useState("");async function o(){r(!0);try{const c=a?`/api/db/mentor-consultations?status=${a}`:"/api/db/mentor-consultations",u=await De(c);u!=null&&u.success&&u.data&&e(u.data)}catch(c){console.error(c)}finally{r(!1)}}return b.useEffect(()=>{o()},[a]),s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsx("p",{className:"text-gray-400",children:"导师咨询预约记录"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("select",{value:a,onChange:c=>i(c.target.value),className:"bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2 text-gray-300 text-sm",children:[s.jsx("option",{value:"",children:"全部状态"}),Object.entries(mj).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(Fe,{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(fs,{children:[s.jsx(ps,{children:s.jsxs(xt,{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(ms,{children:[t.map(c=>s.jsxs(xt,{className:"border-gray-700/50",children:[s.jsx(Ne,{className:"text-gray-300",children:c.id}),s.jsx(Ne,{className:"text-gray-400",children:c.userId}),s.jsx(Ne,{className:"text-gray-400",children:c.mentorId}),s.jsx(Ne,{className:"text-gray-400",children:kV[c.consultationType]||c.consultationType}),s.jsxs(Ne,{className:"text-white",children:["¥",c.amount]}),s.jsx(Ne,{className:"text-gray-400",children:mj[c.status]||c.status}),s.jsx(Ne,{className:"text-gray-500 text-sm",children:c.createdAt?new Date(c.createdAt).toLocaleString():"-"})]},c.id)),t.length===0&&s.jsx(xt,{children:s.jsx(Ne,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}function CV(){const[t,e]=b.useState("booking");return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{type:"button",onClick:()=>e("booking"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="booking"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"预约记录"}),s.jsx("button",{type:"button",onClick:()=>e("manage"),className:`px-4 py-2 rounded-lg text-sm font-medium transition-all ${t==="manage"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,children:"导师管理"})]}),t==="booking"&&s.jsx(SV,{}),t==="manage"&&s.jsx("div",{className:"-mx-8",children:s.jsx(T4,{embedded:!0})})]})}function TV(){const[t,e]=b.useState([]),[n,r]=b.useState(0),[a,i]=b.useState(1),[o,c]=b.useState(10),[u,h]=b.useState(!0);async function f(){h(!0);try{const x=new URLSearchParams({page:String(a),pageSize:String(o),matchType:"team"}),y=await De(`/api/db/match-records?${x}`);y!=null&&y.success&&(e(y.records||[]),r(y.total??0))}catch(x){console.error(x)}finally{h(!1)}}b.useEffect(()=>{f()},[a]);const m=Math.ceil(n/o)||1;return s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("div",{children:[s.jsxs("p",{className:"text-gray-400",children:["团队招募匹配记录,共 ",n," 条"]}),s.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"用户通过「团队招募」提交联系方式到存客宝"})]}),s.jsxs("button",{type:"button",onClick:f,disabled:u,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(Fe,{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(Fe,{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(fs,{children:[s.jsx(ps,{children:s.jsxs(xt,{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(ms,{children:[t.map(x=>s.jsxs(xt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(Ne,{className:"text-white",children:x.userNickname||x.userId}),s.jsx(Ne,{className:"text-white",children:x.matchedNickname||x.matchedUserId}),s.jsxs(Ne,{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(Ne,{className:"text-gray-400",children:x.createdAt?new Date(x.createdAt).toLocaleString():"-"})]},x.id)),t.length===0&&s.jsx(xt,{children:s.jsx(Ne,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无团队招募记录"})})]})]}),s.jsx(Zs,{page:a,totalPages:m,total:n,pageSize:o,onPageChange:i,onPageSizeChange:x=>{c(x),i(1)}})]})})})]})}const xj={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募",join:"加入",match:"匹配"},gj={partner:"⭐",investor:"👥",mentor:"❤️",team:"🎮",join:"📋",match:"🔗"};function EV({onSwitchTab:t,onOpenCKB:e}={}){const n=Ra(),[r,a]=b.useState(null),[i,o]=b.useState(null),[c,u]=b.useState(!0),h=b.useCallback(async()=>{var x,y;u(!0);try{const[v,w]=await Promise.allSettled([De("/api/db/match-records?stats=true"),De("/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 De("/api/db/match-records?page=1&pageSize=200");if(k!=null&&k.success&&k.records){const E=new Set(k.records.map(C=>C.userId).filter(Boolean));N={...N,uniqueUsers:E.size}}}catch{}a(N)}w.status==="fulfilled"&&((y=w.value)!=null&&y.success)&&w.value.data&&o(w.value.data)}catch(v){console.error("加载统计失败:",v)}finally{u(!1)}},[]);b.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(mi,{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(xi,{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(_n,{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 y=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:gj[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:xj[x.matchType]||x.matchType}),s.jsxs("span",{className:"text-gray-500",children:[x.count," (",y.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(y,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(Sa,{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:gj[x.matchType]||"📋"}),s.jsx("span",{className:"text-gray-400",children:xj[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 MV=["partner","investor","mentor","team"],dg=[{key:"join_partner",label:"找伙伴场景"},{key:"join_investor",label:"资源对接场景"},{key:"join_mentor",label:"导师顾问场景"},{key:"join_team",label:"团队招募场景"},{key:"match",label:"匹配上报"},{key:"lead",label:"链接卡若"}],yj=`# 场景获客接口摘要 -- 地址:POST /v1/api/scenarios -- 必填:apiKey、sign、timestamp -- 主标识:phone 或 wechatId 至少一项 -- 可选:name、source、remark、tags、siteTags、portrait -- 签名:排除 sign/apiKey/portrait,键名升序拼接值后双重 MD5 -- 成功:code=200,message=新增成功 或 已存在`;function AV({initialTab:t="overview"}){const[e,n]=b.useState(t),[r,a]=b.useState("13800000000"),[i,o]=b.useState(""),[c,u]=b.useState(""),[h,f]=b.useState(yj),[m,x]=b.useState(!1),[y,v]=b.useState(!1),[w,N]=b.useState([]),[k,E]=b.useState([]),[C,L]=b.useState({}),[O,K]=b.useState([{endpoint:"/api/ckb/join",label:"找伙伴",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"资源对接",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"导师顾问",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"团队招募",method:"POST",status:"idle"},{endpoint:"/api/ckb/match",label:"匹配上报",method:"POST",status:"idle"},{endpoint:"/api/miniprogram/ckb/lead",label:"链接卡若",method:"POST",status:"idle"},{endpoint:"/api/match/config",label:"匹配配置",method:"GET",status:"idle"}]),_=b.useMemo(()=>{const I={};return dg.forEach(z=>{I[z.key]=C[z.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 z=r.trim(),R=i.trim();return I<=3?{type:MV[I],phone:z||void 0,wechat:R||void 0,userId:"admin_test",name:"后台测试"}:I===4?{matchType:"partner",phone:z||void 0,wechat:R||void 0,userId:"admin_test",nickname:"后台测试",matchedUser:{id:"test",nickname:"测试",matchScore:88}}:I===5?{phone:z||void 0,wechatId:R||void 0,userId:"admin_test",name:"后台测试"}:{}};async function P(){v(!0);try{const[I,z,R]=await Promise.all([De("/api/db/config/full?key=ckb_config"),De("/api/db/ckb-leads?mode=submitted&page=1&pageSize=50"),De("/api/db/ckb-leads?mode=contact&page=1&pageSize=50")]),ie=I==null?void 0:I.data;ie!=null&&ie.routes&&L(ie.routes),ie!=null&&ie.docNotes&&u(ie.docNotes),ie!=null&&ie.docContent&&f(ie.docContent),z!=null&&z.success&&N(z.records||[]),R!=null&&R.success&&E(R.records||[])}finally{v(!1)}}b.useEffect(()=>{n(t)},[t]),b.useEffect(()=>{P()},[]);const ee=b.useMemo(()=>{const I=$=>($||"").replace(/\D/g,"")||"",z=$=>{const U=I($.phone);if(U)return`phone:${U}`;const ce=($.userId||"").trim();if(ce)return`user:${ce}`;const ue=($.wechatId||"").trim();return ue?`wechat:${ue}`:`row:${$.id}`},R=[...k].sort(($,U)=>{const ce=$.createdAt?new Date($.createdAt).getTime():0;return(U.createdAt?new Date(U.createdAt).getTime():0)-ce}),ie=new Set,q=[];for(const $ of R){const U=z($);ie.has(U)||(ie.add(U),q.push($))}return q},[k]);async function Q(){x(!0);try{const I=await St("/api/db/config",{key:"ckb_config",value:{routes:_,docNotes:c,docContent:h},description:"存客宝接口配置"});X.error((I==null?void 0:I.success)!==!1?"存客宝配置已保存":`保存失败: ${(I==null?void 0:I.error)||"未知错误"}`)}catch(I){X.error(`保存失败: ${I instanceof Error?I.message:"网络错误"}`)}finally{x(!1)}}const V=(I,z)=>{L(R=>({...R,[I]:{..._[I],...z}}))},re=async I=>{const z=O[I];if(z.method==="POST"&&!r.trim()&&!i.trim()){X.error("请填写测试手机号");return}const R=[...O];R[I]={...z,status:"testing",message:void 0,responseTime:void 0},K(R);const ie=performance.now();try{const q=z.method==="GET"?await De(z.endpoint):await St(z.endpoint,H(I)),$=Math.round(performance.now()-ie),U=(q==null?void 0:q.message)||"",ce=(q==null?void 0:q.success)===!0||U.includes("已存在")||U.includes("已加入")||U.includes("已提交"),ue=[...O];ue[I]={...z,status:ce?"success":"error",message:U||(ce?"正常":"异常"),responseTime:$},K(ue),await P()}catch(q){const $=Math.round(performance.now()-ie),U=[...O];U[I]={...z,status:"error",message:q instanceof Error?q.message:"失败",responseTime:$},K(U)}},ae=async()=>{if(!r.trim()&&!i.trim()){X.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(yl,{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:z}),R?s.jsx("p",{className:"text-gray-500 text-sm mt-2 max-w-md mx-auto leading-relaxed",children:R}):null]})})}):I.map(ie=>s.jsxs("tr",{className:"border-t border-gray-700/30",children:[s.jsx("td",{className:"px-4 py-3 text-white",children:ie.userNickname||ie.userId}),s.jsx("td",{className:"px-4 py-3 text-gray-300",children:ie.matchType}),s.jsx("td",{className:"px-4 py-3 text-green-400",children:ie.phone||"—"}),s.jsx("td",{className:"px-4 py-3 text-blue-400",children:ie.wechatId||"—"}),s.jsx("td",{className:"px-4 py-3 text-gray-400",children:ie.createdAt?new Date(ie.createdAt).toLocaleString():"—"})]},String(ie.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(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(mi,{className:"w-3 h-3"})," API 文档"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(J,{onClick:()=>P(),variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Fe,{className:`w-3.5 h-3.5 mr-1 ${y?"animate-spin":""}`})," 刷新"]}),s.jsxs(J,{onClick:Q,disabled:m,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Sn,{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,z])=>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:z},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:ee.length}),k.length!==ee.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:dg.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"&&pe(w,"暂无已提交线索","用户通过场景提交后会出现于此。"),e==="contact"&&s.jsxs("div",{className:"space-y-2",children:[k.length>ee.length&&s.jsxs("p",{className:"text-xs text-gray-500",children:["已合并 ",k.length-ee.length," 条重复(同手机号或同用户 ID 仅保留最近一条)"]}),pe(ee,"暂无有联系方式线索","存客宝留资同步后显示;完整列表与筛选请前往「用户管理 → 获客列表」。")]}),e==="config"&&s.jsx("div",{className:"space-y-4",children:dg.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(Z,{className:"text-gray-500 text-xs",children:"API 地址"}),s.jsx(le,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[I.key].apiUrl,onChange:z=>V(I.key,{apiUrl:z.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"API Key"}),s.jsx(le,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[I.key].apiKey,onChange:z=>V(I.key,{apiKey:z.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"Source"}),s.jsx(le,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[I.key].source,onChange:z=>V(I.key,{source:z.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"Tags"}),s.jsx(le,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[I.key].tags,onChange:z=>V(I.key,{tags:z.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"SiteTags"}),s.jsx(le,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[I.key].siteTags,onChange:z=>V(I.key,{siteTags:z.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"说明备注"}),s.jsx(le,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:_[I.key].notes,onChange:z=>V(I.key,{notes:z.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(yl,{className:"w-4 h-4 text-gray-500 shrink-0"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(Z,{className:"text-gray-500 text-xs",children:"测试手机号"}),s.jsx(le,{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(Z,{className:"text-gray-500 text-xs",children:"微信号(可选)"}),s.jsx(le,{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:ae,className:"bg-orange-500 hover:bg-orange-600 text-white",children:[s.jsx(xi,{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:O.map((I,z)=>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(Fe,{className:"w-3 h-3 text-yellow-400 animate-spin shrink-0"}),I.status==="success"&&s.jsx(Pj,{className:"w-3 h-3 text-green-400 shrink-0"}),I.status==="error"&&s.jsx(Oj,{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:()=>re(z),disabled:I.status==="testing",className:"text-orange-400/60 hover:text-orange-400 text-[10px] disabled:opacity-50",children:"测试"})]})]},`${I.endpoint}-${z}`))})]}),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(mi,{className:"w-3 h-3"})," 打开外链"]})]}),s.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-400 leading-6",children:h||yj})]}),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 IV=[{id:"stats",label:"数据统计",icon:gc,desc:"匹配与获客概览"},{id:"partner",label:"找伙伴",icon:_n,desc:"匹配池与记录"},{id:"resource",label:"资源对接",icon:H5,desc:"人脉资源"},{id:"mentor",label:"导师预约",icon:F5,desc:"预约与管理"},{id:"team",label:"团队招募",icon:Sc,desc:"团队协作"}];function RV(){const[t,e]=b.useState("stats"),[n,r]=b.useState(!1),[a,i]=b.useState("overview");return s.jsxs("div",{className:"p-8 w-full 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(_n,{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(Sa,{className:"w-3.5 h-3.5 mr-1.5"}),"存客宝",s.jsx(ll,{className:`w-3 h-3 ml-1 transition-transform ${n?"rotate-90":""}`})]})]}),n&&s.jsx(AV,{initialTab:a}),s.jsx("div",{className:"flex gap-1 mb-6 bg-[#0a1628] rounded-lg p-1 border border-gray-700/40",children:IV.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(EV,{onSwitchTab:o=>e(o),onOpenCKB:o=>{i(o||"overview"),r(!0)}}),t==="partner"&&s.jsx(wV,{}),t==="resource"&&s.jsx(jV,{}),t==="mentor"&&s.jsx(CV,{}),t==="team"&&s.jsx(TV,{})]})}function PV(){const t=To();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(Rj,{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(Rc,{to:"/",children:[s.jsx(X5,{className:"w-4 h-4 mr-2"}),"返回首页"]})})]})})}function LV(){return s.jsxs(OE,{children:[s.jsx(cn,{path:"/login",element:s.jsx(II,{})}),s.jsxs(cn,{path:"/",element:s.jsx(LA,{}),children:[s.jsx(cn,{index:!0,element:s.jsx(yh,{to:"/dashboard",replace:!0})}),s.jsx(cn,{path:"dashboard",element:s.jsx(UP,{})}),s.jsx(cn,{path:"orders",element:s.jsx(WP,{})}),s.jsx(cn,{path:"users",element:s.jsx(XP,{})}),s.jsx(cn,{path:"distribution",element:s.jsx(v8,{})}),s.jsx(cn,{path:"withdrawals",element:s.jsx(N8,{})}),s.jsx(cn,{path:"content",element:s.jsx(Y9,{})}),s.jsx(cn,{path:"referral-settings",element:s.jsx(k2,{})}),s.jsx(cn,{path:"author-settings",element:s.jsx(yh,{to:"/settings?tab=author",replace:!0})}),s.jsx(cn,{path:"vip-roles",element:s.jsx(gV,{})}),s.jsx(cn,{path:"mentors",element:s.jsx(T4,{})}),s.jsx(cn,{path:"mentor-consultations",element:s.jsx(yV,{})}),s.jsx(cn,{path:"admin-users",element:s.jsx(yh,{to:"/settings?tab=admin",replace:!0})}),s.jsx(cn,{path:"settings",element:s.jsx(oV,{})}),s.jsx(cn,{path:"payment",element:s.jsx(lV,{})}),s.jsx(cn,{path:"site",element:s.jsx(hV,{})}),s.jsx(cn,{path:"qrcodes",element:s.jsx(fV,{})}),s.jsx(cn,{path:"find-partner",element:s.jsx(RV,{})}),s.jsx(cn,{path:"match",element:s.jsx(mV,{})}),s.jsx(cn,{path:"match-records",element:s.jsx(xV,{})}),s.jsx(cn,{path:"api-doc",element:s.jsx(yh,{to:"/api-docs",replace:!0})}),s.jsx(cn,{path:"api-docs",element:s.jsx(C4,{})})]}),s.jsx(cn,{path:"*",element:s.jsx(PV,{})})]})}FT.createRoot(document.getElementById("root")).render(s.jsx(b.StrictMode,{children:s.jsx(HE,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:s.jsx(LV,{})})})); diff --git a/soul-admin/dist/index.html b/soul-admin/dist/index.html index 22119f82..449f1874 100644 --- a/soul-admin/dist/index.html +++ b/soul-admin/dist/index.html @@ -4,8 +4,8 @@ 管理后台 - Soul创业派对 - - + +
    diff --git a/soul-admin/src/components/modules/user/MemberUserSelect.tsx b/soul-admin/src/components/modules/user/MemberUserSelect.tsx new file mode 100644 index 00000000..1d8b98f0 --- /dev/null +++ b/soul-admin/src/components/modules/user/MemberUserSelect.tsx @@ -0,0 +1,473 @@ +/** + * 绑定会员用户:外观类似原生 Select。 + * 在 Radix Dialog 内请传入 portalMountRef + positionContainerRef,将 Portal 挂在 Dialog 内, + * 否则挂 body 会被 modal 的 disableOutsidePointerEvents 拦截,搜索框无法点击输入。 + */ +import type { RefObject } from 'react' +import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react' +import { createPortal } from 'react-dom' +import { ChevronDown, X } from 'lucide-react' +import { apiUrl } from '@/api/client' +import { cn, normalizeImageUrl } from '@/lib/utils' +import { Button } from '@/components/ui/button' +import { Input } from '@/components/ui/input' +import { Label } from '@/components/ui/label' +import toast from '@/utils/toast' +import { get } from '@/api/client' +import { useDebounce } from '@/hooks/useDebounce' + +const PAGE_SIZE = 10 + +export interface DbUserListItem { + id: string + nickname?: string | null + phone?: string | null + wechatId?: string | null + /** 头像 URL 或路径(与 /api/db/users 一致) */ + avatar?: string | null +} + +/** 列表/触发器展示用:相对路径走 apiUrl,绝对 URL 走 normalize */ +function userListAvatarSrc(avatar?: string | null): string { + const a = (avatar ?? '').trim() + if (!a) return '' + if (/^https?:\/\//i.test(a)) return normalizeImageUrl(a) + const path = a.startsWith('/') ? a : `/${a}` + return normalizeImageUrl(apiUrl(path)) +} + +function TriggerAvatarNickname(props: { + nickname: string + avatar?: string | null +}) { + const { nickname, avatar } = props + const avSrc = userListAvatarSrc(avatar) + return ( + <> + + {avSrc ? ( + { + ;(e.currentTarget as HTMLImageElement).style.display = 'none' + }} + /> + ) : ( + + {nickname.slice(0, 1)} + + )} + + {nickname} + + ) +} + +function mergePickerUsers(prev: DbUserListItem[], batch: DbUserListItem[]): DbUserListItem[] { + const seen = new Set(prev.map((u) => u.id).filter(Boolean)) + const out = [...prev] + for (const u of batch) { + const id = u.id + if (id && !seen.has(id)) { + seen.add(id) + out.push(u) + } + } + return out +} + +export interface MemberUserSelectProps { + id?: string + label: React.ReactNode + /** 当前绑定的用户 id */ + value: string + /** 展示用摘要(编辑态可由父组件预拉取) */ + preview: { id: string; nickname: string; phone?: string | null; avatar?: string | null } | null + previewLoading?: boolean + onSelect: (user: DbUserListItem) => void + onClear: () => void + /** 父级弹窗是否打开,关闭时自动收起下拉 */ + containerOpen: boolean + disabled?: boolean + hint?: React.ReactNode + className?: string + /** 下拉 DOM 挂载点:须为 DialogContent 内、与表单滚动区并列的容器(非 body) */ + portalMountRef?: RefObject + /** 定位基准:一般为 DialogContent 根节点(含 transform),与 portal 同在 Dialog 内时用视口差换算 top/left */ + positionContainerRef?: RefObject +} + +export function MemberUserSelect({ + id: labelId, + label, + value, + preview, + previewLoading = false, + onSelect, + onClear, + containerOpen, + disabled = false, + hint, + className, + portalMountRef, + positionContainerRef, +}: MemberUserSelectProps) { + const [open, setOpen] = useState(false) + const [search, setSearch] = useState('') + const debouncedSearch = useDebounce(search, 300) + const [users, setUsers] = useState([]) + const [loading, setLoading] = useState(false) + const [loadingMore, setLoadingMore] = useState(false) + const [total, setTotal] = useState(0) + const pageRef = useRef(1) + const fetchingRef = useRef(false) + const exhaustedRef = useRef(false) + const scrollRef = useRef(null) + const triggerRef = useRef(null) + const [panelBox, setPanelBox] = useState({ top: 0, left: 0, width: 320, maxH: 360 }) + + const updatePanelPosition = useCallback(() => { + const t = triggerRef.current + if (!t || typeof window === 'undefined') return + const tRect = t.getBoundingClientRect() + const maxH = Math.min(400, Math.max(200, window.innerHeight - tRect.bottom - 16)) + const boundary = positionContainerRef?.current + if (boundary) { + const d = boundary.getBoundingClientRect() + setPanelBox({ + top: tRect.bottom - d.top + 6, + left: tRect.left - d.left, + width: Math.max(tRect.width, 300), + maxH, + }) + } else { + setPanelBox({ + top: tRect.bottom + 6, + left: tRect.left, + width: Math.max(tRect.width, 300), + maxH, + }) + } + }, [positionContainerRef]) + + useEffect(() => { + if (!containerOpen) { + setOpen(false) + setSearch('') + } + }, [containerOpen]) + + useLayoutEffect(() => { + if (!open) return + updatePanelPosition() + window.addEventListener('scroll', updatePanelPosition, true) + window.addEventListener('resize', updatePanelPosition) + return () => { + window.removeEventListener('scroll', updatePanelPosition, true) + window.removeEventListener('resize', updatePanelPosition) + } + }, [open, updatePanelPosition]) + + const loadPage = useCallback(async (page: number, q: string, append: boolean) => { + if (fetchingRef.current) return + fetchingRef.current = true + if (append) setLoadingMore(true) + else setLoading(true) + try { + const params = new URLSearchParams({ + page: String(page), + pageSize: String(PAGE_SIZE), + search: q.trim(), + }) + const data = await get<{ + success?: boolean + users?: DbUserListItem[] + total?: number + error?: string + }>(`/api/db/users?${params}`) + if (data?.success && Array.isArray(data.users)) { + const batch = data.users + const t = typeof data.total === 'number' ? data.total : 0 + setTotal(t) + if (append) { + if (batch.length === 0) { + exhaustedRef.current = true + } else { + setUsers((prev) => { + const next = mergePickerUsers(prev, batch) + if (next.length === prev.length) { + exhaustedRef.current = true + } else { + pageRef.current = page + } + return next + }) + } + } else { + setUsers(batch) + pageRef.current = page + } + } else if (data?.error) { + toast.error(data.error) + } + } catch (e) { + toast.error(e instanceof Error ? e.message : '加载用户列表失败') + } finally { + fetchingRef.current = false + setLoading(false) + setLoadingMore(false) + } + }, []) + + useEffect(() => { + if (!open) return + pageRef.current = 1 + exhaustedRef.current = false + void loadPage(1, debouncedSearch, false) + }, [open, debouncedSearch, loadPage]) + + const tryLoadMore = useCallback(() => { + if (loading || loadingMore || fetchingRef.current) return + if (exhaustedRef.current) return + if (total > 0 && users.length >= total) return + void loadPage(pageRef.current + 1, debouncedSearch, true) + }, [debouncedSearch, loadPage, loading, loadingMore, total, users.length]) + + useLayoutEffect(() => { + if (!open || loading || loadingMore) return + if (exhaustedRef.current) return + if (total > 0 && users.length >= total) return + if (users.length === 0) return + const el = scrollRef.current + if (!el) return + if (el.scrollHeight > el.clientHeight + 12) return + tryLoadMore() + }, [open, users.length, loading, loadingMore, total, tryLoadMore]) + + const handlePick = (u: DbUserListItem) => { + const uid = (u.id || '').trim() + if (!uid) return + onSelect(u) + setOpen(false) + setSearch('') + } + + const handleClear = (e: React.MouseEvent) => { + e.preventDefault() + e.stopPropagation() + if (disabled || previewLoading) return + onClear() + } + + const hasValue = Boolean(value.trim()) + const showStatsRow = total > 0 + + const portalTarget: HTMLElement | null = + typeof document === 'undefined' + ? null + : portalMountRef?.current ?? document.body + + const dropdown = + open && + portalTarget && + createPortal( + /* data-* 供外层 Dialog 识别:Radix modal 会禁用「弹窗外的指针」,需 onPointerDownOutside preventDefault */ +
    +
    { + e.preventDefault() + setOpen(false) + }} + /> +
    +
    + setSearch(e.target.value)} + onMouseDown={(e) => e.stopPropagation()} + autoFocus + /> +
    + {showStatsRow ? ( +

    + 已加载 {users.length} / {total} 条 + {users.length < total ? ' · 下滑加载更多' : ''} +

    + ) : null} +
    { + const el = e.currentTarget + if (loading || loadingMore) return + if (exhaustedRef.current) return + if (total > 0 && users.length >= total) return + if (el.scrollHeight - el.scrollTop - el.clientHeight < 100) tryLoadMore() + }} + > + {loading && users.length === 0 ? ( +
    正在加载…
    + ) : users.length === 0 ? ( +
    + 暂无用户,请调整搜索条件 +
    + ) : ( +
    + {users.map((u) => { + const idStr = u.id || '' + const selected = value === idStr + const avSrc = userListAvatarSrc(u.avatar) + const nick = (u.nickname && String(u.nickname).trim()) || '(无昵称)' + return ( + + ) + })} + {loadingMore && ( +
    加载更多…
    + )} +
    + )} +
    +
    + +
    +
    +
    , + portalTarget, + ) + + return ( +
    + {typeof label === 'string' ? ( + + ) : ( + label + )} +
    + + {hasValue && ( + + )} +
    + {hint &&
    {hint}
    } + {dropdown} +
    + ) +} diff --git a/soul-admin/src/pages/content/ContentPage.tsx b/soul-admin/src/pages/content/ContentPage.tsx index b130b88b..059143de 100644 --- a/soul-admin/src/pages/content/ContentPage.tsx +++ b/soul-admin/src/pages/content/ContentPage.tsx @@ -536,6 +536,7 @@ export function ContentPage() { endTime?: string deviceGroups?: string | number[] personSource?: string + isPinned?: boolean } const data = await get<{ success?: boolean; persons?: PersonResp[] }>('/api/db/persons') if (data?.success && data.persons) { @@ -559,6 +560,7 @@ export function ContentPage() { startTime: p.startTime, endTime: p.endTime, deviceGroups: deviceGroupsStr, + isPinned: !!p.isPinned, } }), ) @@ -566,6 +568,34 @@ export function ContentPage() { } catch { /* ignore */ } }, []) + const handlePersonPin = useCallback( + async (p: PersonItem, nextPinned: boolean) => { + const pid = (p.personId || p.id || '').trim() + if (!pid) { + toast.error('缺少 personId') + return + } + if (nextPinned && !(p.userId || '').trim()) { + toast.info('未绑定会员时,小程序仍显示 @ 名称,头像可能为默认图') + } + try { + const res = await put<{ success?: boolean; error?: string }>('/api/db/persons/pin', { + personId: pid, + isPinned: nextPinned, + }) + if (!res?.success) { + toast.error(res?.error || '置顶失败') + return + } + toast.success(nextPinned ? '已设为小程序首页置顶(全局仅一条)' : '已取消置顶') + await loadPersons() + } catch (e) { + toast.error(e instanceof Error ? e.message : '操作失败') + } + }, + [loadPersons], + ) + const loadLinkTags = useCallback(async () => { try { const data = await get<{ @@ -2268,7 +2298,7 @@ export function ContentPage() { - 链接人与事 + @列表 @@ -2558,7 +2588,7 @@ export function ContentPage() { @ - AI列表 — 链接人与事(编辑器内输入 @ 可链接) + AI列表 — @列表(编辑器内输入 @ 可链接)

    @@ -2609,6 +2639,7 @@ export function ContentPage() { 会员 获客数 获客计划 + 置顶 状态 操作 @@ -2676,6 +2707,22 @@ export function ContentPage() {

    + + + {p.ckbPlanId ? ( 启用 @@ -2755,7 +2802,7 @@ export function ContentPage() { - {/* 存客宝绑定配置(与链接人与事同一 tab) */} + {/* 存客宝绑定配置(与 @列表 同一 tab) */} diff --git a/soul-admin/src/pages/content/PersonAddEditModal.tsx b/soul-admin/src/pages/content/PersonAddEditModal.tsx index 940251db..607172be 100644 --- a/soul-admin/src/pages/content/PersonAddEditModal.tsx +++ b/soul-admin/src/pages/content/PersonAddEditModal.tsx @@ -1,8 +1,8 @@ /** - * 链接人与事 — 添加/编辑弹窗 + * @列表 — 添加/编辑弹窗 * 配置与存客宝 API 获客一致(参考 Cunkebao FriendRequestSettings) */ -import { useEffect, useState } from 'react' +import { useEffect, useRef, useState } from 'react' import { Dialog, DialogContent, @@ -23,7 +23,10 @@ import { SelectValue, } from '@/components/ui/select' import toast from '@/utils/toast' +import { get } from '@/api/client' +import { useDebounce } from '@/hooks/useDebounce' import { getCkbDevices, getCkbPlans, type CkbDevice, type CkbPlan } from '@/api/ckb' +import { MemberUserSelect, type DbUserListItem } from '@/components/modules/user/MemberUserSelect' export interface PersonFormData { personId: string @@ -91,6 +94,8 @@ export function PersonAddEditModal({ onSubmit, }: PersonAddEditModalProps) { const isEdit = !!editingPerson + const dialogContentRef = useRef(null) + const memberUserPortalLayerRef = useRef(null) const [form, setForm] = useState(defaultForm) const [saving, setSaving] = useState(false) const [deviceSelectorOpen, setDeviceSelectorOpen] = useState(false) @@ -101,17 +106,79 @@ export function PersonAddEditModal({ const [planLoading, setPlanLoading] = useState(false) const [planKeyword, setPlanKeyword] = useState('') const [planDropdownOpen, setPlanDropdownOpen] = useState(false) + /** 绑定会员:列表选中后的展示(与 form.boundUserId 同步) */ + const [boundMemberPreview, setBoundMemberPreview] = useState<{ + id: string + nickname: string + phone?: string | null + avatar?: string | null + } | null>(null) + const [boundPreviewLoading, setBoundPreviewLoading] = useState(false) /** 必填项校验错误,用于红色边框与提示 */ const [errors, setErrors] = useState<{ name?: string addFriendInterval?: string deviceGroups?: string }>({}) + /** 名称/别名与他人(及名称↔别名交叉)唯一性,防抖后请求 /api/db/persons/check-unique */ + const [personUniqueCheck, setPersonUniqueCheck] = useState<{ loading: boolean; messages: string[] }>({ + loading: false, + messages: [], + }) + + const debouncedPersonName = useDebounce(form.name, 400) + const debouncedPersonAliases = useDebounce(form.aliases, 400) + + useEffect(() => { + if (!open) { + setPersonUniqueCheck({ loading: false, messages: [] }) + return + } + const n = debouncedPersonName.trim() + const a = debouncedPersonAliases.trim() + if (!n && !a) { + setPersonUniqueCheck({ loading: false, messages: [] }) + return + } + let cancelled = false + setPersonUniqueCheck((s) => ({ ...s, loading: true })) + const exclude = isEdit ? (editingPerson?.personId ?? '').trim() : '' + const params = new URLSearchParams() + if (n) params.set('name', debouncedPersonName.trim()) + params.set('aliases', debouncedPersonAliases) + if (exclude) params.set('excludePersonId', exclude) + + void get<{ success?: boolean; ok?: boolean; messages?: string[]; error?: string }>( + `/api/db/persons/check-unique?${params.toString()}`, + ) + .then((res) => { + if (cancelled) return + if (res?.success === false && res?.error) { + setPersonUniqueCheck({ loading: false, messages: [res.error] }) + return + } + if (res?.ok === false && Array.isArray(res.messages) && res.messages.length > 0) { + setPersonUniqueCheck({ loading: false, messages: res.messages }) + return + } + setPersonUniqueCheck({ loading: false, messages: [] }) + }) + .catch(() => { + if (cancelled) return + setPersonUniqueCheck({ loading: false, messages: [] }) + }) + + return () => { + cancelled = true + } + }, [open, debouncedPersonName, debouncedPersonAliases, isEdit, editingPerson?.personId]) useEffect(() => { if (open) { // 每次打开时重置设备搜索关键字 setDeviceKeyword('') + setBoundMemberPreview(null) + setBoundPreviewLoading(false) if (editingPerson) { setForm({ personId: editingPerson.personId ?? editingPerson.name ?? '', @@ -130,6 +197,30 @@ export function PersonAddEditModal({ endTime: editingPerson.endTime ?? '22:00', deviceGroups: editingPerson.deviceGroups ?? '', }) + const uid = (editingPerson.userId ?? '').trim() + if (uid) { + setBoundPreviewLoading(true) + void get<{ success?: boolean; user?: DbUserListItem | null }>( + `/api/db/users?id=${encodeURIComponent(uid)}`, + ) + .then((data) => { + const u = data?.user + if (u?.id) { + setBoundMemberPreview({ + id: u.id, + nickname: (u.nickname && String(u.nickname).trim()) || u.id, + phone: u.phone, + avatar: u.avatar ?? undefined, + }) + } else { + setBoundMemberPreview({ id: uid, nickname: uid, phone: undefined, avatar: undefined }) + } + }) + .catch(() => { + setBoundMemberPreview({ id: uid, nickname: uid, phone: undefined, avatar: undefined }) + }) + .finally(() => setBoundPreviewLoading(false)) + } } else { setForm({ ...defaultForm }) } @@ -178,6 +269,18 @@ export function PersonAddEditModal({ } } + const clearBoundUser = () => { + setForm((f) => { + const uid = (f.boundUserId || '').trim() + const next = { ...f, boundUserId: '' } + if (!isEdit && uid && (f.personId || '').trim() === uid) { + next.personId = '' + } + return next + }) + setBoundMemberPreview(null) + } + const selectPlan = (plan: CkbPlan) => { const dg = Array.isArray(plan.deviceGroups) ? plan.deviceGroups.map(String).join(',') : '' setForm((f) => ({ @@ -226,6 +329,10 @@ export function PersonAddEditModal({ ) return } + if (personUniqueCheck.messages.length > 0) { + toast.error(personUniqueCheck.messages[0] ?? '名称或别名与他人重复') + return + } setSaving(true) try { await onSubmit(form) @@ -240,19 +347,25 @@ export function PersonAddEditModal({ return ( - - - - {isEdit ? '编辑人物' : '添加人物 — 存客宝 API 获客'} - - - {isEdit - ? '修改后同步到存客宝计划' - : '添加时自动生成 token,并同步创建存客宝场景获客计划'} - - + + {/* overflow 勿 hidden:会裁剪内部 fixed 下拉的滚动区并阻断滚轮 */} +
    +
    + + + {isEdit ? '编辑人物' : '添加人物 — 存客宝 API 获客'} + + + {isEdit + ? '修改后同步到存客宝计划' + : '添加时自动生成 token,并同步创建存客宝场景获客计划'} + + -
    +
    {/* 基础信息 — 单行三列 */}

    基础信息

    @@ -262,7 +375,13 @@ export function PersonAddEditModal({ 名称 * 0 + ? 'border-amber-600 focus-visible:ring-amber-600/50' + : 'border-gray-700' + }`} placeholder="如 卡若" value={form.name} onChange={(e) => { @@ -277,9 +396,9 @@ export function PersonAddEditModal({ setForm((f) => ({ ...f, personId: e.target.value }))} - disabled={isEdit} + disabled={isEdit || !!(form.boundUserId || '').trim()} />
    @@ -291,25 +410,62 @@ export function PersonAddEditModal({ onChange={(e) => setForm((f) => ({ ...f, label: e.target.value }))} />
    -
    - - setForm((f) => ({ ...f, boundUserId: e.target.value.trim() }))} - /> -

    保存前请在用户管理中核对 id;同一会员只能绑定一个 @人物。

    -
    + { + const id = (u.id || '').trim() + if (!id) return + setForm((f) => ({ + ...f, + boundUserId: id, + ...(!isEdit ? { personId: id } : {}), + })) + setBoundMemberPreview({ + id, + nickname: (u.nickname && String(u.nickname).trim()) || id, + phone: u.phone, + avatar: u.avatar ?? undefined, + }) + }} + onClear={clearBoundUser} + hint={ + + 单选;保存时后端校验用户是否存在。同一会员只能绑定一个 @人物;绑定后获客统计可与超级个体对齐。 + + } + />
    0 + ? 'border-amber-600 focus-visible:ring-amber-600/50' + : 'border-gray-700' + }`} placeholder="如 卡卡, 若若" value={form.aliases} onChange={(e) => setForm((f) => ({ ...f, aliases: e.target.value }))} />
    +
    + {personUniqueCheck.loading ? ( +

    正在检测名称与别名是否与他人重复…

    + ) : personUniqueCheck.messages.length > 0 ? ( +
    + {personUniqueCheck.messages.map((msg, i) => ( +

    {msg}

    + ))} +
    + ) : null} +
    @@ -532,19 +688,21 @@ export function PersonAddEditModal({
    + - - - - + + + + + {/* 设备多选面板 */} {deviceSelectorOpen && ( diff --git a/soul-admin/src/pages/distribution/DistributionPage.tsx b/soul-admin/src/pages/distribution/DistributionPage.tsx index 0f6c85be..ba14348f 100644 --- a/soul-admin/src/pages/distribution/DistributionPage.tsx +++ b/soul-admin/src/pages/distribution/DistributionPage.tsx @@ -1,6 +1,7 @@ import toast from '@/utils/toast' -import { useState, useEffect } from 'react' +import { useState, useEffect, useCallback, useRef } from 'react' import { useSearchParams } from 'react-router-dom' +import { useDebounce } from '@/hooks/useDebounce' import { Users, TrendingUp, @@ -17,6 +18,8 @@ import { Undo2, Settings, Zap, + UserPlus, + Trash2, } from 'lucide-react' import { ReferralSettingsPage } from '@/pages/referral-settings/ReferralSettingsPage' import { Pagination } from '@/components/ui/Pagination' @@ -32,7 +35,7 @@ import { DialogFooter, DialogTitle, } from '@/components/ui/dialog' -import { get, put } from '@/api/client' +import { get, post, put } from '@/api/client' interface TodayClicksByPageItem { page: string @@ -128,7 +131,9 @@ interface Order { export function DistributionPage() { const [searchParams] = useSearchParams() - const [activeTab, setActiveTab] = useState<'overview' | 'orders' | 'bindings' | 'withdrawals' | 'settings'>('overview') + const [activeTab, setActiveTab] = useState< + 'overview' | 'orders' | 'bindings' | 'withdrawals' | 'settings' | 'leads' + >('overview') /** 订单 Tab 内:普通订单 / 代付请求 */ const [orderSubView, setOrderSubView] = useState<'orders' | 'giftpay'>('orders') const [orders, setOrders] = useState([]) @@ -174,13 +179,249 @@ 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 + } + }, [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 待推送 + } + useEffect(() => { loadInitialData() }, []) useEffect(() => { const t = searchParams.get('tab') - if (t === 'overview' || t === 'orders' || t === 'bindings' || t === 'withdrawals' || t === 'settings') { + if ( + t === 'overview' || + t === 'orders' || + t === 'bindings' || + t === 'withdrawals' || + t === 'settings' || + t === 'leads' + ) { setActiveTab(t) } }, [searchParams]) @@ -190,6 +431,10 @@ export function DistributionPage() { }, [activeTab, statusFilter]) useEffect(() => { + if (activeTab === 'leads') { + setLoading(false) + return + } loadTabData(activeTab) }, [activeTab]) @@ -201,7 +446,22 @@ export function DistributionPage() { if (['orders', 'bindings', 'withdrawals'].includes(activeTab)) { void loadTabData(activeTab, true) } - }, [page, pageSize, statusFilter, searchTerm, activeTab, orderSubView, giftPayPage, giftPayStatusFilter]) + if (activeTab === 'leads') { + void loadCkbLeads() + } + }, [ + page, + pageSize, + statusFilter, + searchTerm, + activeTab, + orderSubView, + giftPayPage, + giftPayStatusFilter, + ckbLeadPage, + ckbLeadPageSize, + loadCkbLeads, + ]) useEffect(() => { if (activeTab === 'withdrawals') loadAutoApprove() @@ -352,6 +612,8 @@ export function DistributionPage() { } break } + case 'leads': + break } setLoadedTabs((prev) => new Set(prev).add(tab)) } catch (e) { @@ -363,6 +625,10 @@ export function DistributionPage() { async function refreshCurrentTab() { setError(null) + if (activeTab === 'leads') { + await loadCkbLeads() + return + } setLoadedTabs((prev) => { const next = new Set(prev) next.delete(activeTab) @@ -525,6 +791,7 @@ 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 @@ -561,12 +828,14 @@ export function DistributionPage() { @@ -578,6 +847,7 @@ 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) => ( + + )} +
    +
    +

    总留资条数

    +

    {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/users/UsersPage.tsx b/soul-admin/src/pages/users/UsersPage.tsx index c5a25748..bd275638 100644 --- a/soul-admin/src/pages/users/UsersPage.tsx +++ b/soul-admin/src/pages/users/UsersPage.tsx @@ -1,5 +1,5 @@ import toast from '@/utils/toast' -import { useState, useEffect, useCallback, useMemo } from 'react' +import { useState, useEffect, useCallback, useMemo, useRef } from 'react' import { Card, CardContent } from '@/components/ui/card' import { Input } from '@/components/ui/input' import { Button } from '@/components/ui/button' @@ -281,6 +281,10 @@ export function UsersPage() { const [leadsPushStatusFilter, setLeadsPushStatusFilter] = useState('') const [leadsStats, setLeadsStats] = useState<{ uniqueUsers?: number; sourceStats?: { source: string; cnt: number }[] }>({}) const [retryingLeadId, setRetryingLeadId] = useState(null) + const [deletingLeadId, setDeletingLeadId] = useState(null) + const [leadSelectedIds, setLeadSelectedIds] = useState([]) + const [batchDeletingLeads, setBatchDeletingLeads] = useState(false) + const leadsHeaderCheckboxRef = useRef(null) const [batchRetrying, setBatchRetrying] = useState(false) const loadLeads = useCallback(async (searchVal?: string, sourceVal?: string) => { setLeadsLoading(true) @@ -323,13 +327,48 @@ export function UsersPage() { } }, [leadsPage, leadsPageSize, debouncedLeadsSearch, leadsSourceFilter, leadsPushStatusFilter]) + useEffect(() => { + setLeadSelectedIds([]) + }, [debouncedLeadsSearch, leadsSourceFilter, leadsPushStatusFilter]) + + type LeadRetryRecordPatch = { + pushStatus?: string + retryCount?: number + ckbError?: string + lastPushAt?: string | null + nextRetryAt?: string | null + } + + function mergeLeadRowAfterRetry(row: (typeof leadsRecords)[0], rec: LeadRetryRecordPatch) { + 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 retryLeadPush(recordId: number) { if (!recordId) return setRetryingLeadId(recordId) try { - const data = await post<{ success?: boolean; pushed?: boolean; error?: string }>('/api/db/ckb-leads/retry', { id: recordId }) + const data = await post<{ + success?: boolean + pushed?: boolean + error?: string + record?: LeadRetryRecordPatch + }>('/api/db/ckb-leads/retry', { id: recordId }) if (data?.success) { toast.success(data.pushed ? '重推成功' : '已发起重推,请刷新查看状态') + if (data.record) { + setLeadsRecords((prev) => + prev.map((row) => + row.id === recordId ? mergeLeadRowAfterRetry(row, data.record!) : row, + ), + ) + } } else { toast.error(data?.error || '重推失败') } @@ -337,6 +376,24 @@ export function UsersPage() { toast.error(e instanceof Error ? e.message : '重推请求失败') } finally { setRetryingLeadId(null) + } + } + + async function deleteLeadRecord(recordId: number) { + if (!recordId) return + if (!confirm('确定删除该条获客记录?删除后不可恢复。')) return + setDeletingLeadId(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 { + setDeletingLeadId(null) loadLeads() } } @@ -351,8 +408,18 @@ export function UsersPage() { let successCount = 0 for (const row of failedRows) { try { - const data = await post<{ success?: boolean; pushed?: boolean }>('/api/db/ckb-leads/retry', { id: row.id }) + const data = await post<{ + success?: boolean + pushed?: boolean + record?: LeadRetryRecordPatch + }>('/api/db/ckb-leads/retry', { id: row.id }) if (data?.success && data.pushed) successCount++ + if (data?.success && data.record) { + const patch = data.record + setLeadsRecords((prev) => + prev.map((r) => (r.id === row.id ? mergeLeadRowAfterRetry(r, patch) : r)), + ) + } } catch { // 单条失败继续下一条,避免中断整批重推 } @@ -360,7 +427,6 @@ export function UsersPage() { setBatchRetrying(false) const total = failedRows.length toast.success(`批量重推完成:成功 ${successCount} / ${total}`) - loadLeads() } function exportFailedLeadsCsv() { @@ -941,6 +1007,62 @@ export function UsersPage() { return { leadsRows: out, leadsRawCount: rows.length, leadsDeduped: rows.length - out.length } }, [leadsRecords, debouncedLeadsSearch]) + useEffect(() => { + const pageIds = leadsRows.map((r) => r.id) + const n = pageIds.filter((id) => leadSelectedIds.includes(id)).length + const el = leadsHeaderCheckboxRef.current + if (el) { + el.indeterminate = n > 0 && n < pageIds.length + } + }, [leadsRows, leadSelectedIds]) + + function toggleLeadSelectAllOnPage() { + const pageIds = leadsRows.map((r) => r.id) + const allOn = pageIds.length > 0 && pageIds.every((id) => leadSelectedIds.includes(id)) + if (allOn) { + setLeadSelectedIds((prev) => prev.filter((id) => !pageIds.includes(id))) + } else { + setLeadSelectedIds((prev) => [...new Set([...prev, ...pageIds])]) + } + } + + function toggleLeadOne(id: number) { + setLeadSelectedIds((prev) => (prev.includes(id) ? prev.filter((x) => x !== id) : [...prev, id])) + } + + async function batchDeleteLeadRecords() { + if (leadSelectedIds.length === 0) { + toast.info('请先勾选要删除的记录') + return + } + const n = leadSelectedIds.length + if (!confirm(`确定批量删除选中的 ${n} 条获客记录?删除后不可恢复。`)) return + const CHUNK = 500 + setBatchDeletingLeads(true) + try { + let totalDeleted = 0 + for (let i = 0; i < leadSelectedIds.length; i += CHUNK) { + const slice = leadSelectedIds.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} 条`) + setLeadSelectedIds([]) + } catch (e) { + toast.error(e instanceof Error ? e.message : '批量删除请求失败') + } finally { + setBatchDeletingLeads(false) + loadLeads() + } + } + const pushStatusBadge = (status?: string) => { if (status === 'success') return 成功 if (status === 'failed') return 失败 @@ -1439,17 +1561,40 @@ export function UsersPage() { + + {!leadsLoading && leadsRows.length > 0 && ( +

    + 已选 {leadSelectedIds.length} 条 · 可翻页继续勾选 · 改搜索/筛选会清空选择 + {leadSelectedIds.length > 0 && ( + + )} +

    + )} {leadsLoading ? ( @@ -1462,6 +1607,18 @@ export function UsersPage() { + + 0 && leadsRows.every((r) => leadSelectedIds.includes(r.id)) + } + onChange={toggleLeadSelectAllOnPage} + className="w-4 h-4 rounded border-gray-600 bg-[#0f2137] accent-[#38bdac] cursor-pointer" + title="全选本页(展示行)" + /> + 昵称 手机号 微信号 @@ -1476,6 +1633,15 @@ export function UsersPage() { {leadsRows.map((r) => ( + + toggleLeadOne(r.id)} + disabled={batchDeletingLeads} + className="w-4 h-4 rounded border-gray-600 bg-[#0f2137] accent-[#38bdac] cursor-pointer" + /> + {r.userNickname || r.name || '-'} {r.phone || '-'} {r.wechatId || '-'} @@ -1500,13 +1666,27 @@ export function UsersPage() { + {r.createdAt ? new Date(r.createdAt).toLocaleString() : '-'} @@ -1514,7 +1694,7 @@ export function UsersPage() { ))} {leadsRows.length === 0 && ( - +

    暂无获客线索

    diff --git a/soul-admin/tsconfig.tsbuildinfo b/soul-admin/tsconfig.tsbuildinfo index c577121c..ba8a6f82 100644 --- a/soul-admin/tsconfig.tsbuildinfo +++ b/soul-admin/tsconfig.tsbuildinfo @@ -1 +1 @@ -{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/api/auth.ts","./src/api/ckb.ts","./src/api/client.ts","./src/components/rechargealert.tsx","./src/components/richeditor.tsx","./src/components/modules/mbti/mbtiavatarsmanager.tsx","./src/components/modules/user/setvipmodal.tsx","./src/components/modules/user/userdetailmodal.tsx","./src/components/ui/pagination.tsx","./src/components/ui/badge.tsx","./src/components/ui/button.tsx","./src/components/ui/card.tsx","./src/components/ui/dialog.tsx","./src/components/ui/input.tsx","./src/components/ui/label.tsx","./src/components/ui/select.tsx","./src/components/ui/slider.tsx","./src/components/ui/switch.tsx","./src/components/ui/table.tsx","./src/components/ui/tabs.tsx","./src/components/ui/textarea.tsx","./src/hooks/usedebounce.ts","./src/layouts/adminlayout.tsx","./src/lib/mbtiavatarprompts.ts","./src/lib/utils.ts","./src/pages/admin-users/adminuserspage.tsx","./src/pages/api-doc/apidocpage.tsx","./src/pages/api-docs/apidocspage.tsx","./src/pages/author-settings/authorsettingspage.tsx","./src/pages/chapters/chapterspage.tsx","./src/pages/content/chaptertree.tsx","./src/pages/content/contentpage.tsx","./src/pages/content/personaddeditmodal.tsx","./src/pages/dashboard/dashboardpage.tsx","./src/pages/distribution/distributionpage.tsx","./src/pages/find-partner/findpartnerpage.tsx","./src/pages/find-partner/tabs/ckbconfigpanel.tsx","./src/pages/find-partner/tabs/ckbstatstab.tsx","./src/pages/find-partner/tabs/findpartnertab.tsx","./src/pages/find-partner/tabs/matchpooltab.tsx","./src/pages/find-partner/tabs/matchrecordstab.tsx","./src/pages/find-partner/tabs/mentorbookingtab.tsx","./src/pages/find-partner/tabs/mentortab.tsx","./src/pages/find-partner/tabs/resourcedockingtab.tsx","./src/pages/find-partner/tabs/teamrecruittab.tsx","./src/pages/linked-mp/linkedmppage.tsx","./src/pages/login/loginpage.tsx","./src/pages/match/matchpage.tsx","./src/pages/match-records/matchrecordspage.tsx","./src/pages/mentor-consultations/mentorconsultationspage.tsx","./src/pages/mentors/mentorspage.tsx","./src/pages/not-found/notfoundpage.tsx","./src/pages/orders/orderspage.tsx","./src/pages/payment/paymentpage.tsx","./src/pages/qrcodes/qrcodespage.tsx","./src/pages/referral-settings/referralsettingspage.tsx","./src/pages/settings/settingspage.tsx","./src/pages/site/sitepage.tsx","./src/pages/users/userspage.tsx","./src/pages/vip-roles/viprolespage.tsx","./src/pages/withdrawals/withdrawalspage.tsx","./src/utils/toast.ts"],"version":"5.6.3"} \ No newline at end of file +{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/api/auth.ts","./src/api/ckb.ts","./src/api/client.ts","./src/components/rechargealert.tsx","./src/components/richeditor.tsx","./src/components/modules/mbti/mbtiavatarsmanager.tsx","./src/components/modules/user/memberuserselect.tsx","./src/components/modules/user/setvipmodal.tsx","./src/components/modules/user/userdetailmodal.tsx","./src/components/ui/pagination.tsx","./src/components/ui/badge.tsx","./src/components/ui/button.tsx","./src/components/ui/card.tsx","./src/components/ui/dialog.tsx","./src/components/ui/input.tsx","./src/components/ui/label.tsx","./src/components/ui/select.tsx","./src/components/ui/slider.tsx","./src/components/ui/switch.tsx","./src/components/ui/table.tsx","./src/components/ui/tabs.tsx","./src/components/ui/textarea.tsx","./src/hooks/usedebounce.ts","./src/layouts/adminlayout.tsx","./src/lib/mbtiavatarprompts.ts","./src/lib/utils.ts","./src/pages/admin-users/adminuserspage.tsx","./src/pages/api-doc/apidocpage.tsx","./src/pages/api-docs/apidocspage.tsx","./src/pages/author-settings/authorsettingspage.tsx","./src/pages/chapters/chapterspage.tsx","./src/pages/content/chaptertree.tsx","./src/pages/content/contentpage.tsx","./src/pages/content/personaddeditmodal.tsx","./src/pages/dashboard/dashboardpage.tsx","./src/pages/distribution/distributionpage.tsx","./src/pages/find-partner/findpartnerpage.tsx","./src/pages/find-partner/tabs/ckbconfigpanel.tsx","./src/pages/find-partner/tabs/ckbstatstab.tsx","./src/pages/find-partner/tabs/findpartnertab.tsx","./src/pages/find-partner/tabs/matchpooltab.tsx","./src/pages/find-partner/tabs/matchrecordstab.tsx","./src/pages/find-partner/tabs/mentorbookingtab.tsx","./src/pages/find-partner/tabs/mentortab.tsx","./src/pages/find-partner/tabs/resourcedockingtab.tsx","./src/pages/find-partner/tabs/teamrecruittab.tsx","./src/pages/linked-mp/linkedmppage.tsx","./src/pages/login/loginpage.tsx","./src/pages/match/matchpage.tsx","./src/pages/match-records/matchrecordspage.tsx","./src/pages/mentor-consultations/mentorconsultationspage.tsx","./src/pages/mentors/mentorspage.tsx","./src/pages/not-found/notfoundpage.tsx","./src/pages/orders/orderspage.tsx","./src/pages/payment/paymentpage.tsx","./src/pages/qrcodes/qrcodespage.tsx","./src/pages/referral-settings/referralsettingspage.tsx","./src/pages/settings/settingspage.tsx","./src/pages/site/sitepage.tsx","./src/pages/users/userspage.tsx","./src/pages/vip-roles/viprolespage.tsx","./src/pages/withdrawals/withdrawalspage.tsx","./src/utils/toast.ts"],"version":"5.6.3"} \ No newline at end of file diff --git a/soul-api/internal/handler/autolink.go b/soul-api/internal/handler/autolink.go index 316e20b1..92d2bd54 100644 --- a/soul-api/internal/handler/autolink.go +++ b/soul-api/internal/handler/autolink.go @@ -26,8 +26,55 @@ func isValidNameOrLabel(s string) bool { return re.MatchString(s) } -// ensurePersonByName 按名称确保 Person 存在,不存在则创建(含存客宝计划),返回 token -func ensurePersonByName(db *gorm.DB, name string) (token string, err error) { +// splitPersonAliases 解析 persons.aliases(逗号 / 中文逗号 / 顿号分隔) +func splitPersonAliases(s string) []string { + s = strings.TrimSpace(s) + if s == "" { + return nil + } + s = strings.ReplaceAll(s, ",", ",") + s = strings.ReplaceAll(s, "、", ",") + parts := strings.Split(s, ",") + out := make([]string, 0, len(parts)) + for _, p := range parts { + t := strings.TrimSpace(p) + if t != "" { + out = append(out, t) + } + } + return out +} + +// buildPersonAliasTokenMap 别名 -> person.token(同一别名多条人物时按 id 升序先命中者优先) +func buildPersonAliasTokenMap(db *gorm.DB) map[string]string { + var rows []model.Person + if err := db.Select("id", "token", "aliases"). + Where("aliases IS NOT NULL AND aliases != ?", ""). + Order("id ASC"). + Find(&rows).Error; err != nil || len(rows) == 0 { + return map[string]string{} + } + out := make(map[string]string) + for _, p := range rows { + tok := strings.TrimSpace(p.Token) + if tok == "" { + continue + } + for _, a := range splitPersonAliases(p.Aliases) { + key := sanitizeNameOrLabel(a) + if key == "" || !isValidNameOrLabel(key) { + continue + } + if _, exists := out[key]; !exists { + out[key] = tok + } + } + } + return out +} + +// ensurePersonByName 按名称或 aliases 确保 Person 存在,不存在则创建(含存客宝计划),返回 token +func ensurePersonByName(db *gorm.DB, name string, aliasToken map[string]string) (token string, err error) { name = strings.TrimSpace(name) if name == "" { return "", nil @@ -44,6 +91,14 @@ func ensurePersonByName(db *gorm.DB, name string) (token string, err error) { if db.Where("name = ?", name).First(&p).Error == nil { return p.Token, nil } + if aliasToken != nil { + if tok := aliasToken[clean]; tok != "" { + return tok, nil + } + if tok := aliasToken[name]; tok != "" { + return tok, nil + } + } created, err := createPersonMinimal(db, clean, "") if err != nil { return "", err @@ -93,6 +148,7 @@ func ParseAutoLinkContent(content string) (string, error) { return content, nil } db := database.DB() + aliasToken := buildPersonAliasTokenMap(db) // 1. 提取所有 @name 和 #label(排除 <> 避免匹配到 HTML 标签内) mentionRe := regexp.MustCompile(`@([^\s@#<>]+)`) @@ -109,7 +165,7 @@ func ParseAutoLinkContent(content string) (string, error) { if clean == "" || !isValidNameOrLabel(clean) || names[clean] != "" { continue } - token, err := ensurePersonByName(db, clean) + token, err := ensurePersonByName(db, clean, aliasToken) if err == nil && token != "" { names[clean] = token names[raw] = token // 原始名也映射 diff --git a/soul-api/internal/handler/ckb.go b/soul-api/internal/handler/ckb.go index 781f62ac..849d9835 100644 --- a/soul-api/internal/handler/ckb.go +++ b/soul-api/internal/handler/ckb.go @@ -199,6 +199,23 @@ func pushLeadToCKB(name, phone, wechatId, leadKey string) (ckbLeadPushResult, er }, nil } +// resolvePersonForLead 按 token 优先、其次 person_id 查人物(与列表 personMap 双键一致)。 +// 若仅用 token 查询失败,会误用全局 apiKey,存客宝常返回「无效的apiKey」。 +func resolvePersonForLead(db *gorm.DB, targetUserID string) (model.Person, bool) { + tok := strings.TrimSpace(targetUserID) + if tok == "" { + return model.Person{}, false + } + var p model.Person + if err := db.Where("token = ?", tok).First(&p).Error; err == nil { + return p, true + } + if err := db.Where("person_id = ?", tok).First(&p).Error; err == nil { + return p, true + } + return model.Person{}, false +} + func retryOneLeadRecord(ctx context.Context, db *gorm.DB, r model.CkbLeadRecord) bool { select { case <-ctx.Done(): @@ -241,8 +258,7 @@ func retryOneLeadRecord(ctx context.Context, db *gorm.DB, r model.CkbLeadRecord) } if source != "index_link_button" { if v, ok := p["targetUserId"].(string); ok && strings.TrimSpace(v) != "" { - var person model.Person - if db.Where("token = ?", strings.TrimSpace(v)).First(&person).Error == nil && strings.TrimSpace(person.CkbApiKey) != "" { + if person, found := resolvePersonForLead(db, v); found && strings.TrimSpace(person.CkbApiKey) != "" { leadKey = strings.TrimSpace(person.CkbApiKey) targetName = strings.TrimSpace(person.Name) if person.UserID != nil { @@ -731,19 +747,16 @@ func CKBLead(c *gin.Context) { } // 存客宝 scenarios 内部 API 需要计划级 apiKey(persons.ckb_api_key),不是 token - // 文章 @ 场景:targetUserId=token → 查 Person 取 CkbApiKey 作为 leadKey + // 文章 @ 场景:targetUserId 一般为 Person.token;兼容 person_id,与列表展示双键解析一致 // 首页链接卡若:targetUserId 为空 → 用全局 getCkbLeadApiKey() leadKey := getCkbLeadApiKey() targetName := strings.TrimSpace(body.TargetNickname) targetMemberID := strings.TrimSpace(body.TargetMemberID) personTips := "" // Person 配置的获客成功提示,优先于默认文案 if body.TargetUserID != "" { - var p model.Person - if db.Where("token = ?", body.TargetUserID).First(&p).Error != nil { - fmt.Printf("[CKBLead] 未找到人物 token=%s,回退全局获客池\n", body.TargetUserID) - } else { + if p, ok := resolvePersonForLead(db, body.TargetUserID); ok { if strings.TrimSpace(p.CkbApiKey) != "" { - leadKey = p.CkbApiKey + leadKey = strings.TrimSpace(p.CkbApiKey) } personTips = strings.TrimSpace(p.Tips) if targetName == "" { @@ -754,15 +767,32 @@ func CKBLead(c *gin.Context) { targetMemberID = strings.TrimSpace(*p.UserID) } } + } else { + fmt.Printf("[CKBLead] 未找到人物 targetUserId=%s(非 token/person_id),回退全局 apiKey\n", body.TargetUserID) } } - // 去重:同一用户对同一目标人物只记录一次(不再限制时间间隔,允许对不同人物立即提交) - repeatedSubmit := false - if body.UserID != "" && body.TargetUserID != "" { + // 去重:同一用户对同一 @人物(targetUserId=Person.token)仅允许一条有效留资;已存在则不再写库、不调存客宝(不同人物互不影响) + targetTok := strings.TrimSpace(body.TargetUserID) + if body.UserID != "" && targetTok != "" { var existCount int64 - db.Model(&model.CkbLeadRecord{}).Where("user_id = ? AND target_person_id = ?", body.UserID, body.TargetUserID).Count(&existCount) - repeatedSubmit = existCount > 0 + db.Model(&model.CkbLeadRecord{}).Where("user_id = ? AND target_person_id = ?", body.UserID, targetTok).Count(&existCount) + if existCount > 0 { + who := targetName + if who == "" { + who = "对方" + } + msg := fmt.Sprintf("您已向「%s」留资过,无需重复提交", who) + c.JSON(http.StatusOK, gin.H{ + "success": true, + "message": msg, + "data": gin.H{ + "repeatedSubmit": true, + "skipped": true, + }, + }) + return + } } source := strings.TrimSpace(body.Source) @@ -838,8 +868,6 @@ func CKBLead(c *gin.Context) { var msg string if personTips != "" { msg = personTips - } else if repeatedSubmit { - msg = fmt.Sprintf("您已留资过,我们已再次通知 %s,请耐心等待添加", who) } else { msg = fmt.Sprintf("提交成功,%s 会尽快联系您", who) } @@ -849,7 +877,7 @@ func CKBLead(c *gin.Context) { data = m } } - data["repeatedSubmit"] = repeatedSubmit + data["repeatedSubmit"] = false go sendLeadWebhook(db, leadWebhookPayload{ LeadName: name, @@ -859,7 +887,7 @@ func CKBLead(c *gin.Context) { MemberName: strings.TrimSpace(body.TargetMemberName), TargetMemberID: targetMemberID, Source: source, - Repeated: repeatedSubmit, + Repeated: false, LeadUserID: body.UserID, }) @@ -920,8 +948,6 @@ func CKBLead(c *gin.Context) { var msg string if personTips != "" { msg = personTips - } else if repeatedSubmit { - msg = fmt.Sprintf("您已留资过,我们已再次通知 %s,请耐心等待添加", who) } else { msg = fmt.Sprintf("提交成功,%s 会尽快联系您", who) } @@ -933,7 +959,7 @@ func CKBLead(c *gin.Context) { MemberName: strings.TrimSpace(body.TargetMemberName), TargetMemberID: targetMemberID, Source: source, - Repeated: repeatedSubmit, + Repeated: false, LeadUserID: body.UserID, }) markLeadPushSuccess(db, rec.ID) @@ -988,6 +1014,8 @@ func leadSourceLabel(source string) string { return "首页·链接卡若按钮" case "index_lead": return "首页·留资弹窗" + case "home_pinned_person": + return "首页·置顶@人物" default: if source == "" { return "未知来源" diff --git a/soul-api/internal/handler/db_ckb_leads.go b/soul-api/internal/handler/db_ckb_leads.go index 473c19a7..c9ac9900 100644 --- a/soul-api/internal/handler/db_ckb_leads.go +++ b/soul-api/internal/handler/db_ckb_leads.go @@ -1,6 +1,7 @@ package handler import ( + "fmt" "net/http" "strconv" "strings" @@ -65,6 +66,25 @@ func DBCKBLeadList(c *gin.Context) { personMap[persons[i].Token] = &persons[i] } } + // 批量查 users:头像、昵称(与会员资料一致) + uidSet := make(map[string]struct{}) + for _, r := range records { + if strings.TrimSpace(r.UserID) != "" { + uidSet[r.UserID] = struct{}{} + } + } + uids := make([]string, 0, len(uidSet)) + for id := range uidSet { + uids = append(uids, id) + } + userMap := make(map[string]*model.User) + if len(uids) > 0 { + var urows []model.User + db.Select("id", "nickname", "avatar").Where("id IN ?", uids).Find(&urows) + for i := range urows { + userMap[urows[i].ID] = &urows[i] + } + } out := make([]gin.H, 0, len(records)) for _, r := range records { personName := "" @@ -73,10 +93,19 @@ func DBCKBLeadList(c *gin.Context) { personName = p.Name ckbPlanId = p.CkbPlanID } + displayNick := r.Nickname + userAvatar := "" + if u := userMap[r.UserID]; u != nil { + userAvatar = resolveAvatarURL(getStringValue(u.Avatar)) + if u.Nickname != nil && strings.TrimSpace(*u.Nickname) != "" { + displayNick = strings.TrimSpace(*u.Nickname) + } + } out = append(out, gin.H{ "id": r.ID, "userId": r.UserID, - "userNickname": r.Nickname, + "userNickname": displayNick, + "userAvatar": userAvatar, "matchType": "lead", "phone": r.Phone, "wechatId": r.WechatID, @@ -95,8 +124,8 @@ func DBCKBLeadList(c *gin.Context) { } // 统计摘要:来源分布、去重获客人数 type sourceStat struct { - Source string `gorm:"column:source"` - Cnt int64 `gorm:"column:cnt"` + Source string `gorm:"column:source" json:"source"` + Cnt int64 `gorm:"column:cnt" json:"cnt"` } var sourceStats []sourceStat db.Raw("SELECT COALESCE(source,'未知') as source, COUNT(*) as cnt FROM ckb_lead_records GROUP BY source ORDER BY cnt DESC").Scan(&sourceStats) @@ -186,7 +215,90 @@ func DBCKBLeadRetry(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"success": false, "error": msg}) return } - c.JSON(http.StatusOK, gin.H{"success": true, "pushed": ok}) + db := database.DB() + var r model.CkbLeadRecord + if err := db.Where("id = ?", body.ID).First(&r).Error; err != nil { + c.JSON(http.StatusOK, gin.H{"success": true, "pushed": ok}) + return + } + c.JSON(http.StatusOK, gin.H{ + "success": true, + "pushed": ok, + "record": gin.H{ + "id": r.ID, + "pushStatus": r.PushStatus, + "retryCount": r.RetryCount, + "ckbError": r.CkbError, + "lastPushAt": r.LastPushAt, + "nextRetryAt": r.NextRetryAt, + }, + }) +} + +// DBCKBLeadDelete POST /api/db/ckb-leads/delete 管理端-删除一条留资记录(运营清理误报/测试数据) +func DBCKBLeadDelete(c *gin.Context) { + var body struct { + ID int64 `json:"id" binding:"required"` + } + if err := c.ShouldBindJSON(&body); err != nil || body.ID <= 0 { + c.JSON(http.StatusOK, gin.H{"success": false, "error": "缺少有效 id"}) + return + } + db := database.DB() + res := db.Delete(&model.CkbLeadRecord{}, body.ID) + if res.Error != nil { + c.JSON(http.StatusOK, gin.H{"success": false, "error": res.Error.Error()}) + return + } + if res.RowsAffected == 0 { + c.JSON(http.StatusOK, gin.H{"success": false, "error": "记录不存在或已删除"}) + return + } + c.JSON(http.StatusOK, gin.H{"success": true}) +} + +// ckbLeadDeleteBatchMax 单次批量删除上限,防止误操作与请求过大 +const ckbLeadDeleteBatchMax = 500 + +// DBCKBLeadDeleteBatch POST /api/db/ckb-leads/delete-batch 管理端-批量删除留资记录 +func DBCKBLeadDeleteBatch(c *gin.Context) { + var body struct { + IDs []int64 `json:"ids" binding:"required"` + } + if err := c.ShouldBindJSON(&body); err != nil { + c.JSON(http.StatusOK, gin.H{"success": false, "error": "请传入 ids 数组"}) + return + } + seen := make(map[int64]struct{}) + clean := make([]int64, 0, len(body.IDs)) + for _, id := range body.IDs { + if id <= 0 { + continue + } + if _, ok := seen[id]; ok { + continue + } + seen[id] = struct{}{} + clean = append(clean, id) + } + if len(clean) == 0 { + c.JSON(http.StatusOK, gin.H{"success": false, "error": "没有有效的 id"}) + return + } + if len(clean) > ckbLeadDeleteBatchMax { + c.JSON(http.StatusOK, gin.H{ + "success": false, + "error": fmt.Sprintf("单次最多删除 %d 条,请减少勾选或分批提交", ckbLeadDeleteBatchMax), + }) + return + } + db := database.DB() + res := db.Where("id IN ?", clean).Delete(&model.CkbLeadRecord{}) + if res.Error != nil { + c.JSON(http.StatusOK, gin.H{"success": false, "error": res.Error.Error()}) + return + } + c.JSON(http.StatusOK, gin.H{"success": true, "deleted": res.RowsAffected}) } // CKBPlanStats GET /api/db/ckb-plan-stats 存客宝获客计划统计(基于 ckb_submit_records + ckb_lead_records) diff --git a/soul-api/internal/handler/db_person.go b/soul-api/internal/handler/db_person.go index 82d9f676..6540d44a 100644 --- a/soul-api/internal/handler/db_person.go +++ b/soul-api/internal/handler/db_person.go @@ -118,6 +118,116 @@ func DBPersonList(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"success": true, "persons": rows}) } +// collectPersonUniquenessConflicts 检测名称/别名是否与其他 @人物 冲突(与 autolink 一致:sanitize + 逗号分隔别名) +// excludePersonID 非空时排除该 person_id(编辑当前条) +func collectPersonUniquenessConflicts(db *gorm.DB, name, aliasesStr, excludePersonID string) []string { + name = strings.TrimSpace(name) + aliasesStr = strings.TrimSpace(aliasesStr) + excludePersonID = strings.TrimSpace(excludePersonID) + + var messages []string + nameKey := "" + if name != "" { + nameKey = sanitizeNameOrLabel(name) + if nameKey == "" || !isValidNameOrLabel(nameKey) { + nameKey = "" + } + } + + seenLocal := make(map[string]bool) + dupAlias := make(map[string]bool) + var inputAliasKeys []string + for _, seg := range splitPersonAliases(aliasesStr) { + k := sanitizeNameOrLabel(seg) + if k == "" || !isValidNameOrLabel(k) { + continue + } + if seenLocal[k] { + dupAlias[k] = true + continue + } + seenLocal[k] = true + inputAliasKeys = append(inputAliasKeys, k) + } + for k := range dupAlias { + messages = append(messages, fmt.Sprintf("别名「%s」重复填写", k)) + } + + if nameKey != "" { + for _, ak := range inputAliasKeys { + if ak == nameKey { + messages = append(messages, fmt.Sprintf("名称与别名「%s」重复", nameKey)) + break + } + } + } + + var rows []model.Person + q := db.Select("person_id", "name", "aliases") + if excludePersonID != "" { + q = q.Where("person_id != ?", excludePersonID) + } + if err := q.Find(&rows).Error; err != nil { + return []string{"查询人物列表失败: " + err.Error()} + } + + for _, p := range rows { + display := strings.TrimSpace(p.Name) + oNameKey := sanitizeNameOrLabel(display) + if oNameKey == "" { + continue + } + oAliasSet := make(map[string]bool) + for _, a := range splitPersonAliases(p.Aliases) { + k := sanitizeNameOrLabel(a) + if k != "" && isValidNameOrLabel(k) { + oAliasSet[k] = true + } + } + + if nameKey != "" { + if oNameKey == nameKey { + messages = append(messages, fmt.Sprintf("名称「%s」与已有 @人物「%s」重复", nameKey, display)) + } + if oAliasSet[nameKey] { + messages = append(messages, fmt.Sprintf("名称「%s」已被 @人物「%s」用作别名", nameKey, display)) + } + } + for _, ak := range inputAliasKeys { + if oNameKey == ak { + messages = append(messages, fmt.Sprintf("别名「%s」与 @人物「%s」的名称重复", ak, display)) + } + if oAliasSet[ak] { + messages = append(messages, fmt.Sprintf("别名「%s」已被 @人物「%s」使用", ak, display)) + } + } + } + + seen := make(map[string]bool) + uniq := make([]string, 0, len(messages)) + for _, m := range messages { + if m != "" && !seen[m] { + seen[m] = true + uniq = append(uniq, m) + } + } + return uniq +} + +// DBPersonCheckUnique GET /api/db/persons/check-unique?name=&aliases=&excludePersonId= 管理端-实时检测名称/别名唯一性 +func DBPersonCheckUnique(c *gin.Context) { + name := strings.TrimSpace(c.Query("name")) + aliases := strings.TrimSpace(c.Query("aliases")) + exclude := strings.TrimSpace(c.Query("excludePersonId")) + if name == "" && aliases == "" { + c.JSON(http.StatusOK, gin.H{"success": true, "ok": true, "messages": []string{}}) + return + } + db := database.DB() + msgs := collectPersonUniquenessConflicts(db, name, aliases, exclude) + c.JSON(http.StatusOK, gin.H{"success": true, "ok": len(msgs) == 0, "messages": msgs}) +} + // DBPersonDetail GET /api/db/person 管理端-单个人物详情(编辑回显用) func DBPersonDetail(c *gin.Context) { pid := c.Query("personId") @@ -184,7 +294,17 @@ func DBPersonSave(c *gin.Context) { if body.PersonID == "" { body.PersonID = fmt.Sprintf("%s_%d", strings.ToLower(strings.ReplaceAll(strings.TrimSpace(body.Name), " ", "_")), time.Now().UnixMilli()) } - if db.Where("person_id = ?", body.PersonID).First(&existing).Error == nil { + isUpdate := db.Where("person_id = ?", body.PersonID).First(&existing).Error == nil + excludeUniq := "" + if isUpdate { + excludeUniq = existing.PersonID + } + if msgs := collectPersonUniquenessConflicts(db, body.Name, body.Aliases, excludeUniq); len(msgs) > 0 { + c.JSON(http.StatusOK, gin.H{"success": false, "error": msgs[0], "messages": msgs}) + return + } + + if isUpdate { if uidBind != "" { var conflict model.Person if db.Where("user_id = ? AND person_id != ?", uidBind, existing.PersonID).First(&conflict).Error == nil { @@ -532,7 +652,7 @@ func genPersonToken() (string, error) { return s + "0123456789abcdefghijklmnopqrstuv"[:(32-len(s))], nil } -// DBPersonPin PUT /api/db/persons/pin 管理端-置顶/取消置顶人物到小程序首页 +// DBPersonPin PUT /api/db/persons/pin 管理端-置顶/取消置顶人物到小程序首页(置顶时全局仅一条) func DBPersonPin(c *gin.Context) { var body struct { PersonID string `json:"personId" binding:"required"` @@ -554,10 +674,18 @@ func DBPersonPin(c *gin.Context) { } else { pinned = !row.IsPinned } - if err := db.Model(&row).Update("is_pinned", pinned).Error; err != nil { + if err := db.Transaction(func(tx *gorm.DB) error { + if pinned { + if err := tx.Model(&model.Person{}).Where("is_pinned = ?", true).Update("is_pinned", false).Error; err != nil { + return err + } + } + return tx.Model(&model.Person{}).Where("person_id = ?", row.PersonID).Update("is_pinned", pinned).Error + }); err != nil { c.JSON(http.StatusOK, gin.H{"success": false, "error": err.Error()}) return } + invalidateReadExtrasCache() c.JSON(http.StatusOK, gin.H{"success": true, "isPinned": pinned}) } @@ -608,6 +736,7 @@ func DBPersonPinnedToken(c *gin.Context) { } // CKBPinnedPerson GET /api/miniprogram/ckb/pinned-person 小程序首页:当前置顶人物(无置顶时 data 为 null) +// name 为 @人物展示名(Person.Name);avatar 为绑定会员用户头像(与运营文案「点击链接@名」一致) func CKBPinnedPerson(c *gin.Context) { db := database.DB() var p model.Person @@ -620,25 +749,24 @@ func CKBPinnedPerson(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"success": false, "message": err.Error()}) return } - nickname := strings.TrimSpace(p.Name) + personName := strings.TrimSpace(p.Name) + if personName == "" { + c.JSON(http.StatusOK, gin.H{"success": true, "data": nil}) + return + } avatar := "" if p.UserID != nil && *p.UserID != "" { var u model.User - if db.Select("nickname", "avatar").Where("id = ?", *p.UserID).First(&u).Error == nil { - if v := getStringValue(u.Nickname); v != "" { - nickname = v - } - if v := getUrlValue(u.Avatar); v != "" { - avatar = v - } + if db.Select("avatar").Where("id = ?", *p.UserID).First(&u).Error == nil { + avatar = resolveAvatarURL(getStringValue(u.Avatar)) } } c.JSON(http.StatusOK, gin.H{ "success": true, "data": gin.H{ - "nickname": nickname, - "avatar": avatar, - "token": strings.TrimSpace(p.Token), + "name": personName, + "avatar": avatar, + "token": strings.TrimSpace(p.Token), }, }) } diff --git a/soul-api/internal/router/router.go b/soul-api/internal/router/router.go index 66bff9ce..f0aa4364 100644 --- a/soul-api/internal/router/router.go +++ b/soul-api/internal/router/router.go @@ -215,6 +215,7 @@ func Setup(cfg *config.Config) *gin.Engine { db.DELETE("/mentors", handler.DBMentorsAction) db.GET("/mentor-consultations", handler.DBMentorConsultationsList) db.GET("/persons", handler.DBPersonList) + db.GET("/persons/check-unique", handler.DBPersonCheckUnique) db.GET("/person", handler.DBPersonDetail) db.GET("/persons/pinned-token", handler.DBPersonPinnedToken) db.PUT("/persons/pin", handler.DBPersonPin) @@ -226,6 +227,8 @@ func Setup(cfg *config.Config) *gin.Engine { db.GET("/persons/pinned", handler.DBPersonPinnedList) db.GET("/ckb-leads", handler.DBCKBLeadList) db.POST("/ckb-leads/retry", handler.DBCKBLeadRetry) + db.POST("/ckb-leads/delete", handler.DBCKBLeadDelete) + db.POST("/ckb-leads/delete-batch", handler.DBCKBLeadDeleteBatch) db.GET("/ckb-person-leads", handler.DBCKBPersonLeads) db.GET("/ckb-plan-stats", handler.CKBPlanStats) db.GET("/user-rules", handler.DBUserRulesList)