From 07c26281ff5b56556ed9f6747eee11e4d64fcd19 Mon Sep 17 00:00:00 2001 From: Alex-larget <33240357+Alex-larget@users.noreply.github.com> Date: Mon, 30 Mar 2026 18:09:29 +0800 Subject: [PATCH] 1 --- miniprogram/app.js | 4 +- miniprogram/pages/read/read.js | 106 +- miniprogram/pages/read/read.wxml | 9 +- miniprogram/pages/read/read.wxss | 20 +- miniprogram/pages/referral/referral.js | 8 +- miniprogram/project.private.config.json | 7 + miniprogram/utils/mpPagePopups.js | 71 +- soul-admin/.env.example | 2 +- soul-admin/dist/assets/index-BRyXRtx1.js | 1666 --------------------- soul-admin/dist/assets/index-BXuoM4lB.js | 1031 +++++++++++++ soul-admin/dist/assets/index-BfljfNs2.css | 1 - soul-admin/dist/assets/index-CXKq85jN.js | 1010 ------------- soul-admin/dist/assets/index-DNOTbQsR.css | 1 + soul-admin/dist/index.html | 26 +- soul-api/docs/master.py | 2 +- soul-api/internal/config/config.go | 2 +- soul-api/internal/database/database.go | 10 + soul-api/master.py | 2 +- soul-api/wechat/info.log | 48 + 19 files changed, 1259 insertions(+), 2767 deletions(-) delete mode 100644 soul-admin/dist/assets/index-BRyXRtx1.js create mode 100644 soul-admin/dist/assets/index-BXuoM4lB.js delete mode 100644 soul-admin/dist/assets/index-BfljfNs2.css delete mode 100644 soul-admin/dist/assets/index-CXKq85jN.js create mode 100644 soul-admin/dist/assets/index-DNOTbQsR.css diff --git a/miniprogram/app.js b/miniprogram/app.js index 3469647f..a7f8366f 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -11,8 +11,8 @@ const DEFAULT_APP_ID = 'wxb8bbb2b10dec74aa' const DEFAULT_MCH_ID = '1318592501' const DEFAULT_WITHDRAW_TMPL_ID = 'u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE' // baseUrl 手动切换(注释方式): -const API_BASE_URL = 'http://localhost:8080' -// const API_BASE_URL = 'https://soulapi.quwanzhi.com' +// const API_BASE_URL = 'http://localhost:9090' +const API_BASE_URL = 'https://soulapi.quwanzhi.com' const CONFIG_CACHE_KEY = 'mpConfigCacheV1' // 与上传版本号对齐;设置页展示优先用 wx.getAccountInfoSync().miniProgram.version(正式版),否则用本字段 const APP_DISPLAY_VERSION = '1.7.2' diff --git a/miniprogram/pages/read/read.js b/miniprogram/pages/read/read.js index 1072ac6f..b3b7899a 100644 --- a/miniprogram/pages/read/read.js +++ b/miniprogram/pages/read/read.js @@ -46,6 +46,18 @@ const READ_UI_DEFAULTS = { timelineTitleSuffix: '(预览{percent}%)', } +/** 章节未返回前:用默认比例与价格生成 readUi,避免云端 read_preview_ui 为空时付费墙/预览条不显示 */ +function buildReadUiFilled(pct, priceTok) { + const base = { ...READ_UI_DEFAULTS } + const filled = {} + Object.keys(base).forEach((k) => { + filled[k] = String(base[k] || '') + .replace(/\{percent\}/g, String(pct)) + .replace(/\{price\}/g, String(priceTok)) + }) + return filled +} + /** 阅读页解析正文用:人物字典 + #标签(与 /config/read-extras 一致) */ function getContentParseConfig() { const g = getApp().globalData || {} @@ -161,11 +173,11 @@ Page({ previewPercent: 20, /** 未解锁时:按 previewPercent 裁切可见高度(px)。0 表示未启用/待测量 */ previewMaxHeightPx: 0, - /** mpUi.readPage.beforeLoginHint:未登录付费墙上方说明文案 */ - readBeforeLoginHint: '', - /** 朋友圈单页:标题与说明(mpUi.readPage.singlePageTitle / singlePagePaywallHint) */ - readSinglePageTitle: '解锁全文', - readSinglePageHint: '', + /** 与 mpPagePopups READ_PAGE_FALLBACK 一致;getConfig 前首屏即有字 */ + readBeforeLoginHint: '试读进度与下方百分比以后台配置为准;登录后可购买解锁全文。', + readSinglePageTitle: '解锁完整内容', + readSinglePageHint: + '当前为朋友圈单页预览,无法在此登录或付款。请点击底部「前往小程序」进入完整版后再解锁本章。', showPaywall: false, // 上一篇/下一篇 @@ -211,8 +223,8 @@ Page({ // 未付费预览比例(与后端 unpaid_preview_percent / 章节 preview_percent 一致) effectivePreviewPercent: 20, - // 付费墙 / 朋友圈文案(后端 read_preview_ui + 占位符已替换) - readUi: {}, + // 付费墙 / 朋友圈文案(后端 read_preview_ui + 占位符已替换;无云端时用 READ_UI_DEFAULTS) + readUi: buildReadUiFilled(20, '1'), }, _isLockedState(state) { @@ -305,8 +317,16 @@ Page({ /** 章节接口 meta:预览比例 + 付费墙/朋友圈文案模板 */ _applyChapterMetaFromResponse(res) { if (!res || typeof res !== 'object') return + const rawPct = + typeof res.unpaidPreviewPercent === 'number' + ? res.unpaidPreviewPercent + : typeof res.unpaid_preview_percent === 'number' + ? res.unpaid_preview_percent + : null const pct = - typeof res.unpaidPreviewPercent === 'number' ? res.unpaidPreviewPercent : 20 + rawPct != null && !isNaN(Number(rawPct)) + ? Math.min(100, Math.max(1, Math.round(Number(rawPct)))) + : 20 const priceNum = res.price != null ? Number(res.price) @@ -368,36 +388,30 @@ Page({ Promise.all([ app.getConfig(), app.getReadExtras() - ]).then(([cfg, extras]) => { - if (cfg) { - const mp = (cfg && cfg.mpConfig) || {} - const auditMode = !!mp.auditMode - app.globalData.auditMode = auditMode - const readBeforeLoginHint = - mpPagePopups.getReadPageContent(app, 'beforeLoginHint') || - String((mp.mpUi && mp.mpUi.readPage && mp.mpUi.readPage.beforeLoginHint) || '').trim() - let readSinglePageTitle = - mpPagePopups.getReadPageContent(app, 'singlePageTitle') || - String((mp.mpUi && mp.mpUi.readPage && mp.mpUi.readPage.singlePageTitle) || '').trim() || - '解锁全文' - readSinglePageTitle = readSinglePageTitle || '解锁全文' - const readSinglePageHint = - mpPagePopups.getReadPageContent(app, 'singlePagePaywallHint') || - String((mp.mpUi && mp.mpUi.readPage && mp.mpUi.readPage.singlePagePaywallHint) || '').trim() - if (typeof this.setData === 'function') { - this.setData({ - auditMode, - readBeforeLoginHint, - readSinglePageTitle, - readSinglePageHint, - }) + ]) + .then(([cfg, extras]) => { + if (cfg) { + const mp = (cfg && cfg.mpConfig) || {} + const auditMode = !!mp.auditMode + app.globalData.auditMode = auditMode + if (typeof this.setData === 'function') { + this.setData({ auditMode }) + } } - } - if (extras && Array.isArray(extras.linkTags)) { - app.globalData.linkTagsConfig = extras.linkTags - app.globalData.linkedMiniprograms = extras.linkedMiniprograms || [] - } - }).catch(() => {}) + if (extras && Array.isArray(extras.linkTags)) { + app.globalData.linkTagsConfig = extras.linkTags + app.globalData.linkedMiniprograms = extras.linkedMiniprograms || [] + } + }) + .catch(() => {}) + .finally(() => { + if (typeof this.setData !== 'function') return + this.setData({ + readBeforeLoginHint: mpPagePopups.getReadPageContent(app, 'beforeLoginHint'), + readSinglePageTitle: mpPagePopups.getReadPageContent(app, 'singlePageTitle'), + readSinglePageHint: mpPagePopups.getReadPageContent(app, 'singlePagePaywallHint'), + }) + }) // 支持 scene(扫码)、mid、id、ref、gift(代付) const sceneStr = (options && options.scene) || '' @@ -644,6 +658,7 @@ Page({ const cached = wx.getStorageSync(cacheKey) if (cached && cached.content) { await app.getReadExtras() + this._applyChapterMetaFromResponse(cached) const { lines, segments } = contentParser.parseContent(cached.content, getContentParseConfig()) // 预览比例由前端按高度裁切,这里渲染完整内容 const previewCount = lines.length @@ -1082,6 +1097,14 @@ Page({ } }, + // 朋友圈/剪贴板文案:控制长度,避免复制过长 + _formatMomentsClipboardText(text) { + const t = String(text || '').trim() + const maxLen = 150 + const truncated = t.length > maxLen ? t.slice(0, maxLen) + '...' : t + return `${truncated}\n👉` + }, + // 复制链接 copyLink() { const userInfo = app.globalData.userInfo @@ -1108,9 +1131,10 @@ Page({ 推荐给正在创业或想创业的朋友,搜"卡若创业派对"小程序就能看! #创业派对 #私域运营 #商业案例` - + + const copyText = this._formatMomentsClipboardText(shareText) wx.setClipboardData({ - data: shareText + data: copyText // 不额外 showToast:系统已有「内容已复制」,避免与自定义文案叠两层 }) }, @@ -1149,8 +1173,10 @@ Page({ const copyText = paras ? `${title}\n\n${paras}${footer}` : `${title}${footer || `\n\n—— 预览约 ${this.data.effectivePreviewPercent ?? 20}% ,搜「卡若创业派对」小程序阅读全文 ——`}` + + const clipboardText = this._formatMomentsClipboardText(copyText) wx.setClipboardData({ - data: copyText, + data: clipboardText, success: () => { // 系统会在 setClipboardData 成功后自动 toast「内容已复制」,与下方引导弹窗重复,先关掉再弹窗 wx.hideToast() diff --git a/miniprogram/pages/read/read.wxml b/miniprogram/pages/read/read.wxml index 0b981a1a..6899cced 100644 --- a/miniprogram/pages/read/read.wxml +++ b/miniprogram/pages/read/read.wxml @@ -142,7 +142,7 @@ {{readUi.singlePageUnlockTitle || '解锁完整内容'}} - {{readUi.fullUnlockDesc}} + {{readUi.fullUnlockDesc || '可先上滑阅读预览;需要全文时,点下方「支付¥1」查看说明'}} {{readUi.singlePagePayButtonText || '支付解锁'}} @@ -229,7 +229,7 @@ {{readUi.singlePageUnlockTitle || '解锁完整内容'}} - {{readUi.fullUnlockDesc}} + {{readUi.fullUnlockDesc || '可先上滑阅读预览;需要全文时,点下方「支付¥1」查看说明'}} {{readUi.singlePagePayButtonText || '支付解锁'}} @@ -243,6 +243,7 @@ {{readUi.fullUnlockTitle || '解锁完整内容'}} {{readUi.fullUnlockDesc || '可先上滑阅读预览'}} {{readUi.fullLockedProgressText}} + 已阅读约 {{effectivePreviewPercent}}% ,购买后继续阅读 购买本章 @@ -261,10 +262,6 @@ 审核中,暂不支持购买 {{readUi.fullPaywallTip || '分享给好友一起学习,还能赚取佣金'}} - - - 代付分享 - diff --git a/miniprogram/pages/read/read.wxss b/miniprogram/pages/read/read.wxss index 50be4860..4d6543a7 100644 --- a/miniprogram/pages/read/read.wxss +++ b/miniprogram/pages/read/read.wxss @@ -812,25 +812,7 @@ button.action-share-native { color: rgba(255, 255, 255, 0.6); } -/* ===== 代付分享 ===== */ -.btn-gift-inline { - /* 与 btn-share-inline 同风格 */ -} -.gift-share-row { - display: flex; - align-items: center; - justify-content: center; - gap: 12rpx; - margin-top: 24rpx; - padding: 20rpx; - background: rgba(255, 215, 0, 0.08); - border-radius: 24rpx; - border: 1rpx solid rgba(255, 215, 0, 0.2); -} -.gift-share-icon { font-size: 32rpx; } -.gift-share-text { font-size: 28rpx; color: #FFD700; } - -/* 代付分享弹窗 */ +/* ===== 代付分享弹窗 ===== */ .gift-modal { padding: 32rpx; } .gift-desc { font-size: 28rpx; diff --git a/miniprogram/pages/referral/referral.js b/miniprogram/pages/referral/referral.js index 5be1c44d..d63ab325 100644 --- a/miniprogram/pages/referral/referral.js +++ b/miniprogram/pages/referral/referral.js @@ -610,9 +610,15 @@ Page({ // 随机选择一条文案 const randomIndex = Math.floor(Math.random() * shareTexts.length) const shareText = shareTexts[randomIndex] + + // 剪贴板文案太长时会影响粘贴体验:截取约150字+省略号,并加👉提示 + const t = String(shareText || '').trim() + const maxLen = 150 + const truncated = t.length > maxLen ? t.slice(0, maxLen) + '...' : t + const clipboardText = `${truncated}\n👉` wx.setClipboardData({ - data: shareText, + data: clipboardText, success: () => { wx.showModal({ title: '文案已复制', diff --git a/miniprogram/project.private.config.json b/miniprogram/project.private.config.json index 42deec97..7d4bdd14 100644 --- a/miniprogram/project.private.config.json +++ b/miniprogram/project.private.config.json @@ -23,6 +23,13 @@ "condition": { "miniprogram": { "list": [ + { + "name": "阅读详情", + "pathName": "pages/read/read", + "query": "mid=233", + "scene": null, + "launchMode": "default" + }, { "name": "个人资料", "pathName": "pages/avatar-nickname/avatar-nickname", diff --git a/miniprogram/utils/mpPagePopups.js b/miniprogram/utils/mpPagePopups.js index 5af90128..05c9be5a 100644 --- a/miniprogram/utils/mpPagePopups.js +++ b/miniprogram/utils/mpPagePopups.js @@ -1,15 +1,51 @@ /** * 从 mpConfig.mpUi.pagePopupItems 按 pagePath + key 取文案(管理端 CRUD)。 * 兼容旧版 mpUi.memberDetailPage / readPage 字段。 + * 云端未配置或 content 为空时,使用本文件内写死兜底(与种子文案一致)。 * * 当前代码显式引用的键(与 soul-admin 默认种子 / db.defaultMpUi 一致,勿改 key 除非双端同步): * - MEMBER_PATH unlockIntroTitle, unlockIntroBody → member-detail.js _showUnlockIntroThenLogin * - READ_PATH beforeLoginHint, singlePageTitle, singlePagePaywallHint → read.js onLoad + * - READ_PATH global* → app.js getGlobalPopupContent(与 pagePopupItems 同页路径存全局键) */ const MEMBER_PATH = '/pages/member-detail/member-detail' const READ_PATH = '/pages/read/read' +/** 阅读页 mpUi 兜底(pagePopupItems / readPage 均无或为空时) */ +const READ_PAGE_FALLBACK = { + beforeLoginHint: '试读进度与下方百分比以后台配置为准;登录后可购买解锁全文。', + singlePageTitle: '解锁完整内容', + singlePagePaywallHint: + '当前为朋友圈单页预览,无法在此登录或付款。请点击底部「前往小程序」进入完整版后再解锁本章。', +} + +/** 成员详情解锁说明兜底 */ +const MEMBER_DETAIL_FALLBACK = { + unlockIntroTitle: '解锁与链接说明', + unlockIntroBody: + '「链接」用于提交留资,由对方通过获客计划跟进;「解锁」用于复制手机/微信号后自行添加好友。\n\n请确认已了解后再登录。', +} + +/** + * 全局弹窗键与 app.js showModal 兜底一致(pagePath 仍为 READ_PATH,key 以 global 开头) + */ +const GLOBAL_POPUP_FALLBACK = { + globalSinglePageAuthTitle: '请打开完整小程序', + globalSinglePageAuthBody: + '当前是朋友圈预览,无法在这里登录或付款。请先点击屏幕底部「前往小程序」,进入完整版后再解锁本章。', + globalAvatarGuideTitle: '设置头像与昵称', + globalAvatarGuideBody: '头像与昵称会出现在名片与匹配卡片上,方便伙伴认出你。', + globalVipProfileHintTitle: '补全对外展示信息', + globalVipProfileHintBody: 'VIP 名片与派对场景会展示头像与昵称,补全后对方更容易认出你。', + globalVipPhoneTitle: '补全手机号', + globalVipPhoneBody: '手机号用于找伙伴、提现验证与重要通知,仅本人可见。', + globalVipWechatOptionalTitle: '补全微信号(可选)', + globalVipWechatOptionalBody: '填写微信号后,对方在允许的场景下能更快加到你;不填也可继续使用。', + globalAppUpdateTitle: '更新提示', + globalAppUpdateBody: '新版本已准备好,重启后即可使用', +} + function getList(app) { const mpUi = app.globalData.configCache && app.globalData.configCache.mpConfig ? app.globalData.configCache.mpConfig.mpUi @@ -42,9 +78,18 @@ function getReadPageContent(app, key) { const rp = (app.globalData.configCache && app.globalData.configCache.mpConfig && app.globalData.configCache.mpConfig.mpUi && app.globalData.configCache.mpConfig.mpUi.readPage) || {} - if (key === 'beforeLoginHint') return String(rp.beforeLoginHint || '').trim() - if (key === 'singlePageTitle') return String(rp.singlePageTitle || '').trim() - if (key === 'singlePagePaywallHint') return String(rp.singlePagePaywallHint || '').trim() + if (key === 'beforeLoginHint') { + const s = String(rp.beforeLoginHint || '').trim() + return s || READ_PAGE_FALLBACK.beforeLoginHint + } + if (key === 'singlePageTitle') { + const s = String(rp.singlePageTitle || '').trim() + return s || READ_PAGE_FALLBACK.singlePageTitle + } + if (key === 'singlePagePaywallHint') { + const s = String(rp.singlePagePaywallHint || '').trim() + return s || READ_PAGE_FALLBACK.singlePagePaywallHint + } return '' } @@ -54,15 +99,31 @@ function getMemberDetailContent(app, key) { const md = (app.globalData.configCache && app.globalData.configCache.mpConfig && app.globalData.configCache.mpConfig.mpUi && app.globalData.configCache.mpConfig.mpUi.memberDetailPage) || {} - if (key === 'unlockIntroTitle') return String(md.unlockIntroTitle || '').trim() - if (key === 'unlockIntroBody') return String(md.unlockIntroBody || '').trim() + if (key === 'unlockIntroTitle') { + const s = String(md.unlockIntroTitle || '').trim() + return s || MEMBER_DETAIL_FALLBACK.unlockIntroTitle + } + if (key === 'unlockIntroBody') { + const s = String(md.unlockIntroBody || '').trim() + return s || MEMBER_DETAIL_FALLBACK.unlockIntroBody + } return '' } +/** + * 全局弹窗文案:与阅读页共用 pagePath(后台种子挂在 /pages/read/read),key 为 global* 开头 + */ +function getGlobalPopupContent(app, key) { + const v = getPagePopupContent(app, READ_PATH, key) + if (v) return v + return GLOBAL_POPUP_FALLBACK[key] || '' +} + module.exports = { getPagePopupContent, getReadPageContent, getMemberDetailContent, + getGlobalPopupContent, MEMBER_PATH, READ_PATH, } diff --git a/soul-admin/.env.example b/soul-admin/.env.example index 5b4688fe..89fd7704 100644 --- a/soul-admin/.env.example +++ b/soul-admin/.env.example @@ -1,3 +1,3 @@ # 对接后端 base URL(不改 API 路径,仅改此处即可切换 Next → Gin) # VITE_API_BASE_URL=http://localhost:3006 -VITE_API_BASE_URL=http://localhost:8080 +VITE_API_BASE_URL=http://localhost:9090 diff --git a/soul-admin/dist/assets/index-BRyXRtx1.js b/soul-admin/dist/assets/index-BRyXRtx1.js deleted file mode 100644 index 5001bef3..00000000 --- a/soul-admin/dist/assets/index-BRyXRtx1.js +++ /dev/null @@ -1,1666 +0,0 @@ -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js -function KE(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 _j(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Pg={exports:{}},Jd={},Ig={exports:{}},At={};/** -======== -function UE(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 Oj(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ag={exports:{}},Gd={},Ig={exports:{}},At={};/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @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. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */var f1;function qE(){if(f1)return At;f1=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),o=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),m=Symbol.iterator;function g(B){return B===null||typeof B!="object"?null:(B=m&&B[m]||B["@@iterator"],typeof B=="function"?B:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,j={};function v(B,W,fe){this.props=B,this.context=W,this.refs=j,this.updater=fe||b}v.prototype.isReactComponent={},v.prototype.setState=function(B,W){if(typeof B!="object"&&typeof B!="function"&&B!=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,B,W,"setState")},v.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function k(){}k.prototype=v.prototype;function T(B,W,fe){this.props=B,this.context=W,this.refs=j,this.updater=fe||b}var C=T.prototype=new k;C.constructor=T,N(C,v.prototype),C.isPureReactComponent=!0;var R=Array.isArray,O=Object.prototype.hasOwnProperty,U={current:null},I={key:!0,ref:!0,__self:!0,__source:!0};function z(B,W,fe){var he,de={},D=null,q=null;if(W!=null)for(he in W.ref!==void 0&&(q=W.ref),W.key!==void 0&&(D=""+W.key),W)O.call(W,he)&&!I.hasOwnProperty(he)&&(de[he]=W[he]);var _=arguments.length-2;if(_===1)de.children=fe;else if(1<_){for(var Z=Array(_),re=0;re<_;re++)Z[re]=arguments[re+2];de.children=Z}if(B&&B.defaultProps)for(he in _=B.defaultProps,_)de[he]===void 0&&(de[he]=_[he]);return{$$typeof:t,type:B,key:D,ref:q,props:de,_owner:U.current}}function L(B,W){return{$$typeof:t,type:B.type,key:W,ref:B.ref,props:B.props,_owner:B._owner}}function Q(B){return typeof B=="object"&&B!==null&&B.$$typeof===t}function se(B){var W={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(fe){return W[fe]})}var $=/\/+/g;function ie(B,W){return typeof B=="object"&&B!==null&&B.key!=null?se(""+B.key):W.toString(36)}function le(B,W,fe,he,de){var D=typeof B;(D==="undefined"||D==="boolean")&&(B=null);var q=!1;if(B===null)q=!0;else switch(D){case"string":case"number":q=!0;break;case"object":switch(B.$$typeof){case t:case e:q=!0}}if(q)return q=B,de=de(q),B=he===""?"."+ie(q,0):he,R(de)?(fe="",B!=null&&(fe=B.replace($,"$&/")+"/"),le(de,W,fe,"",function(re){return re})):de!=null&&(Q(de)&&(de=L(de,fe+(!de.key||q&&q.key===de.key?"":(""+de.key).replace($,"$&/")+"/")+B)),W.push(de)),1;if(q=0,he=he===""?".":he+":",R(B))for(var _=0;_>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license React - * react-jsx-runtime.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. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */var m1;function GE(){if(m1)return Jd;m1=1;var t=$u(),e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function o(c,u,h){var f,m={},g=null,b=null;h!==void 0&&(g=""+h),u.key!==void 0&&(g=""+u.key),u.ref!==void 0&&(b=u.ref);for(f in u)r.call(u,f)&&!i.hasOwnProperty(f)&&(m[f]=u[f]);if(c&&c.defaultProps)for(f in u=c.defaultProps,u)m[f]===void 0&&(m[f]=u[f]);return{$$typeof:e,type:c,key:g,ref:b,props:m,_owner:a.current}}return Jd.Fragment=n,Jd.jsx=o,Jd.jsxs=o,Jd}var g1;function JE(){return g1||(g1=1,Pg.exports=GE()),Pg.exports}var s=JE(),y=$u();const Ks=_j(y),Mp=KE({__proto__:null,default:Ks},[y]);var Fh={},Rg={exports:{}},ur={},Lg={exports:{}},Og={};/** -======== - */var f1;function KE(){if(f1)return Gd;f1=1;var t=_u(),e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function o(c,u,h){var f,m={},g=null,b=null;h!==void 0&&(g=""+h),u.key!==void 0&&(g=""+u.key),u.ref!==void 0&&(b=u.ref);for(f in u)r.call(u,f)&&!i.hasOwnProperty(f)&&(m[f]=u[f]);if(c&&c.defaultProps)for(f in u=c.defaultProps,u)m[f]===void 0&&(m[f]=u[f]);return{$$typeof:e,type:c,key:g,ref:b,props:m,_owner:a.current}}return Gd.Fragment=n,Gd.jsx=o,Gd.jsxs=o,Gd}var p1;function qE(){return p1||(p1=1,Ag.exports=KE()),Ag.exports}var s=qE(),y=_u();const Hs=Oj(y),Tp=UE({__proto__:null,default:Hs},[y]);var zh={},Pg={exports:{}},lr={},Rg={exports:{}},Lg={};/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license React - * scheduler.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. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */var x1;function QE(){return x1||(x1=1,(function(t){function e(F,ge){var X=F.length;F.push(ge);e:for(;0>>1,W=F[B];if(0>>1;Ba(de,X))Da(q,de)?(F[B]=q,F[D]=X,B=D):(F[B]=de,F[he]=X,B=he);else if(Da(q,X))F[B]=q,F[D]=X,B=D;else break e}}return ge}function a(F,ge){var X=F.sortIndex-ge.sortIndex;return X!==0?X:F.id-ge.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,c=o.now();t.unstable_now=function(){return o.now()-c}}var u=[],h=[],f=1,m=null,g=3,b=!1,N=!1,j=!1,v=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(F){for(var ge=n(h);ge!==null;){if(ge.callback===null)r(h);else if(ge.startTime<=F)r(h),ge.sortIndex=ge.expirationTime,e(u,ge);else break;ge=n(h)}}function R(F){if(j=!1,C(F),!N)if(n(u)!==null)N=!0,P(O);else{var ge=n(h);ge!==null&&Y(R,ge.startTime-F)}}function O(F,ge){N=!1,j&&(j=!1,k(z),z=-1),b=!0;var X=g;try{for(C(ge),m=n(u);m!==null&&(!(m.expirationTime>ge)||F&&!se());){var B=m.callback;if(typeof B=="function"){m.callback=null,g=m.priorityLevel;var W=B(m.expirationTime<=ge);ge=t.unstable_now(),typeof W=="function"?m.callback=W:m===n(u)&&r(u),C(ge)}else r(u);m=n(u)}if(m!==null)var fe=!0;else{var he=n(h);he!==null&&Y(R,he.startTime-ge),fe=!1}return fe}finally{m=null,g=X,b=!1}}var U=!1,I=null,z=-1,L=5,Q=-1;function se(){return!(t.unstable_now()-QF||125B?(F.sortIndex=X,e(h,F),n(u)===null&&F===n(h)&&(j?(k(z),z=-1):j=!0,Y(R,X-B))):(F.sortIndex=W,e(u,F),N||b||(N=!0,P(O))),F},t.unstable_shouldYield=se,t.unstable_wrapCallback=function(F){var ge=g;return function(){var X=g;g=ge;try{return F.apply(this,arguments)}finally{g=X}}}})(Og)),Og}var y1;function YE(){return y1||(y1=1,Lg.exports=QE()),Lg.exports}/** -======== - */var m1;function GE(){return m1||(m1=1,(function(t){function e(F,ge){var X=F.length;F.push(ge);e:for(;0>>1,W=F[B];if(0>>1;Ba(de,X))Da(q,de)?(F[B]=q,F[D]=X,B=D):(F[B]=de,F[he]=X,B=he);else if(Da(q,X))F[B]=q,F[D]=X,B=D;else break e}}return ge}function a(F,ge){var X=F.sortIndex-ge.sortIndex;return X!==0?X:F.id-ge.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,c=o.now();t.unstable_now=function(){return o.now()-c}}var u=[],h=[],f=1,m=null,g=3,b=!1,N=!1,j=!1,v=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(F){for(var ge=n(h);ge!==null;){if(ge.callback===null)r(h);else if(ge.startTime<=F)r(h),ge.sortIndex=ge.expirationTime,e(u,ge);else break;ge=n(h)}}function R(F){if(j=!1,C(F),!N)if(n(u)!==null)N=!0,I(O);else{var ge=n(h);ge!==null&&Y(R,ge.startTime-F)}}function O(F,ge){N=!1,j&&(j=!1,k(z),z=-1),b=!0;var X=g;try{for(C(ge),m=n(u);m!==null&&(!(m.expirationTime>ge)||F&&!se());){var B=m.callback;if(typeof B=="function"){m.callback=null,g=m.priorityLevel;var W=B(m.expirationTime<=ge);ge=t.unstable_now(),typeof W=="function"?m.callback=W:m===n(u)&&r(u),C(ge)}else r(u);m=n(u)}if(m!==null)var fe=!0;else{var he=n(h);he!==null&&Y(R,he.startTime-ge),fe=!1}return fe}finally{m=null,g=X,b=!1}}var U=!1,P=null,z=-1,L=5,Q=-1;function se(){return!(t.unstable_now()-QF||125B?(F.sortIndex=X,e(h,F),n(u)===null&&F===n(h)&&(j?(k(z),z=-1):j=!0,Y(R,X-B))):(F.sortIndex=W,e(u,F),N||b||(N=!0,I(O))),F},t.unstable_shouldYield=se,t.unstable_wrapCallback=function(F){var ge=g;return function(){var X=g;g=ge;try{return F.apply(this,arguments)}finally{g=X}}}})(Lg)),Lg}var g1;function JE(){return g1||(g1=1,Rg.exports=GE()),Rg.exports}/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @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. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */var b1;function XE(){if(b1)return ur;b1=1;var t=$u(),e=YE();function n(l){for(var d="https://reactjs.org/docs/error-decoder.html?invariant="+l,p=1;p"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,h=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},m={};function g(l){return u.call(m,l)?!0:u.call(f,l)?!1:h.test(l)?m[l]=!0:(f[l]=!0,!1)}function b(l,d,p,x){if(p!==null&&p.type===0)return!1;switch(typeof d){case"function":case"symbol":return!0;case"boolean":return x?!1:p!==null?!p.acceptsBooleans:(l=l.toLowerCase().slice(0,5),l!=="data-"&&l!=="aria-");default:return!1}}function N(l,d,p,x){if(d===null||typeof d>"u"||b(l,d,p,x))return!0;if(x)return!1;if(p!==null)switch(p.type){case 3:return!d;case 4:return d===!1;case 5:return isNaN(d);case 6:return isNaN(d)||1>d}return!1}function j(l,d,p,x,w,S,A){this.acceptsBooleans=d===2||d===3||d===4,this.attributeName=x,this.attributeNamespace=w,this.mustUseProperty=p,this.propertyName=l,this.type=d,this.sanitizeURL=S,this.removeEmptyString=A}var v={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){v[l]=new j(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var d=l[0];v[d]=new j(d,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){v[l]=new j(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){v[l]=new j(l,2,!1,l,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(l){v[l]=new j(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){v[l]=new j(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){v[l]=new j(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){v[l]=new j(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){v[l]=new j(l,5,!1,l.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function T(l){return l[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(l){var d=l.replace(k,T);v[d]=new j(d,1,!1,l,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(l){var d=l.replace(k,T);v[d]=new j(d,1,!1,l,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(l){var d=l.replace(k,T);v[d]=new j(d,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){v[l]=new j(l,1,!1,l.toLowerCase(),null,!1,!1)}),v.xlinkHref=new j("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){v[l]=new j(l,1,!1,l.toLowerCase(),null,!0,!0)});function C(l,d,p,x){var w=v.hasOwnProperty(d)?v[d]:null;(w!==null?w.type!==0:x||!(2K||w[A]!==S[K]){var ne=` -`+w[A].replace(" at new "," at ");return l.displayName&&ne.includes("")&&(ne=ne.replace("",l.displayName)),ne}while(1<=A&&0<=K);break}}}finally{fe=!1,Error.prepareStackTrace=p}return(l=l?l.displayName||l.name:"")?W(l):""}function de(l){switch(l.tag){case 5:return W(l.type);case 16:return W("Lazy");case 13:return W("Suspense");case 19:return W("SuspenseList");case 0:case 2:case 15:return l=he(l.type,!1),l;case 11:return l=he(l.type.render,!1),l;case 1:return l=he(l.type,!0),l;default:return""}}function D(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case I:return"Fragment";case U:return"Portal";case L:return"Profiler";case z:return"StrictMode";case ie:return"Suspense";case le:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case se:return(l.displayName||"Context")+".Consumer";case Q:return(l._context.displayName||"Context")+".Provider";case $:var d=l.render;return l=l.displayName,l||(l=d.displayName||d.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case me:return d=l.displayName||null,d!==null?d:D(l.type)||"Memo";case P:d=l._payload,l=l._init;try{return D(l(d))}catch{}}return null}function q(l){var d=l.type;switch(l.tag){case 24:return"Cache";case 9:return(d.displayName||"Context")+".Consumer";case 10:return(d._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=d.render,l=l.displayName||l.name||"",d.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return d;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return D(d);case 8:return d===z?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d}return null}function _(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function Z(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function re(l){var d=Z(l)?"checked":"value",p=Object.getOwnPropertyDescriptor(l.constructor.prototype,d),x=""+l[d];if(!l.hasOwnProperty(d)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var w=p.get,S=p.set;return Object.defineProperty(l,d,{configurable:!0,get:function(){return w.call(this)},set:function(A){x=""+A,S.call(this,A)}}),Object.defineProperty(l,d,{enumerable:p.enumerable}),{getValue:function(){return x},setValue:function(A){x=""+A},stopTracking:function(){l._valueTracker=null,delete l[d]}}}}function we(l){l._valueTracker||(l._valueTracker=re(l))}function Fe(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var p=d.getValue(),x="";return l&&(x=Z(l)?l.checked?"true":"false":l.value),l=x,l!==p?(d.setValue(l),!0):!1}function Ue(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}function jt(l,d){var p=d.checked;return X({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??l._wrapperState.initialChecked})}function jn(l,d){var p=d.defaultValue==null?"":d.defaultValue,x=d.checked!=null?d.checked:d.defaultChecked;p=_(d.value!=null?d.value:p),l._wrapperState={initialChecked:x,initialValue:p,controlled:d.type==="checkbox"||d.type==="radio"?d.checked!=null:d.value!=null}}function pt(l,d){d=d.checked,d!=null&&C(l,"checked",d,!1)}function Pt(l,d){pt(l,d);var p=_(d.value),x=d.type;if(p!=null)x==="number"?(p===0&&l.value===""||l.value!=p)&&(l.value=""+p):l.value!==""+p&&(l.value=""+p);else if(x==="submit"||x==="reset"){l.removeAttribute("value");return}d.hasOwnProperty("value")?Hn(l,d.type,p):d.hasOwnProperty("defaultValue")&&Hn(l,d.type,_(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 x=d.type;if(!(x!=="submit"&&x!=="reset"||d.value!==void 0&&d.value!==null))return;d=""+l._wrapperState.initialValue,p||d===l.value||(l.value=d),l.defaultValue=d}p=l.name,p!==""&&(l.name=""),l.defaultChecked=!!l._wrapperState.initialChecked,p!==""&&(l.name=p)}function Hn(l,d,p){(d!=="number"||Ue(l.ownerDocument)!==l)&&(p==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+p&&(l.defaultValue=""+p))}var mn=Array.isArray;function Wt(l,d,p,x){if(l=l.options,d){d={};for(var w=0;w"+d.valueOf().toString()+"",d=Ne.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;d.firstChild;)l.appendChild(d.firstChild)}});function We(l,d){if(d){var p=l.firstChild;if(p&&p===l.lastChild&&p.nodeType===3){p.nodeValue=d;return}}l.textContent=d}var at={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Lt=["Webkit","ms","Moz","O"];Object.keys(at).forEach(function(l){Lt.forEach(function(d){d=d+l.charAt(0).toUpperCase()+l.substring(1),at[d]=at[l]})});function Ct(l,d,p){return d==null||typeof d=="boolean"||d===""?"":p||typeof d!="number"||d===0||at.hasOwnProperty(l)&&at[l]?(""+d).trim():d+"px"}function $e(l,d){l=l.style;for(var p in d)if(d.hasOwnProperty(p)){var x=p.indexOf("--")===0,w=Ct(p,d[p],x);p==="float"&&(p="cssFloat"),x?l.setProperty(p,w):l[p]=w}}var H=X({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Qe(l,d){if(d){if(H[l]&&(d.children!=null||d.dangerouslySetInnerHTML!=null))throw Error(n(137,l));if(d.dangerouslySetInnerHTML!=null){if(d.children!=null)throw Error(n(60));if(typeof d.dangerouslySetInnerHTML!="object"||!("__html"in d.dangerouslySetInnerHTML))throw Error(n(61))}if(d.style!=null&&typeof d.style!="object")throw Error(n(62))}}function vt(l,d){if(l.indexOf("-")===-1)return typeof d.is=="string";switch(l){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ft=null;function yt(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var bt=null,It=null,Qt=null;function kn(l){if(l=Ld(l)){if(typeof bt!="function")throw Error(n(280));var d=l.stateNode;d&&(d=th(d),bt(l.stateNode,l.type,d))}}function zs(l){It?Qt?Qt.push(l):Qt=[l]:It=l}function mr(){if(It){var l=It,d=Qt;if(Qt=It=null,kn(l),d)for(l=0;l>>=0,l===0?32:31-(tl(l)/na|0)|0}var yr=64,Vs=4194304;function sa(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 Sa(l,d){var p=l.pendingLanes;if(p===0)return 0;var x=0,w=l.suspendedLanes,S=l.pingedLanes,A=p&268435455;if(A!==0){var K=A&~w;K!==0?x=sa(K):(S&=A,S!==0&&(x=sa(S)))}else A=p&~w,A!==0?x=sa(A):S!==0&&(x=sa(S));if(x===0)return 0;if(d!==0&&d!==x&&(d&w)===0&&(w=x&-x,S=d&-d,w>=S||w===16&&(S&4194240)!==0))return d;if((x&4)!==0&&(x|=p&16),d=l.entangledLanes,d!==0)for(l=l.entanglements,d&=x;0p;p++)d.push(l);return d}function ra(l,d,p){l.pendingLanes|=d,d!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,d=31-Jn(d),l[d]=p}function Ca(l,d){var p=l.pendingLanes&~d;l.pendingLanes=d,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=d,l.mutableReadLanes&=d,l.entangledLanes&=d,d=l.entanglements;var x=l.eventTimes;for(l=l.expirationTimes;0=Ji),wd=" ",jd=!1;function kd(l,d){switch(l){case"keyup":return bd.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Sd(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var M=!1;function ee(l,d){switch(l){case"compositionend":return Sd(d);case"keypress":return d.which!==32?null:(jd=!0,wd);case"textInput":return l=d.data,l===wd&&jd?null:l;default:return null}}function be(l,d){if(M)return l==="compositionend"||!vd&&kd(l,d)?(l=Ra(),aa=ri=ar=null,M=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1=d)return{node:p,offset:d-l};l=x}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=gb(p)}}function yb(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?yb(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function bb(){for(var l=window,d=Ue();d instanceof l.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)l=d.contentWindow;else break;d=Ue(l.document)}return d}function pm(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 Z4(l){var d=bb(),p=l.focusedElem,x=l.selectionRange;if(d!==p&&p&&p.ownerDocument&&yb(p.ownerDocument.documentElement,p)){if(x!==null&&pm(p)){if(d=x.start,l=x.end,l===void 0&&(l=d),"selectionStart"in p)p.selectionStart=d,p.selectionEnd=Math.min(l,p.value.length);else if(l=(d=p.ownerDocument||document)&&d.defaultView||window,l.getSelection){l=l.getSelection();var w=p.textContent.length,S=Math.min(x.start,w);x=x.end===void 0?S:Math.min(x.end,w),!l.extend&&S>x&&(w=x,x=S,S=w),w=xb(p,S);var A=xb(p,x);w&&A&&(l.rangeCount!==1||l.anchorNode!==w.node||l.anchorOffset!==w.offset||l.focusNode!==A.node||l.focusOffset!==A.offset)&&(d=d.createRange(),d.setStart(w.node,w.offset),l.removeAllRanges(),S>x?(l.addRange(d),l.extend(A.node,A.offset)):(d.setEnd(A.node,A.offset),l.addRange(d)))}}for(d=[],l=p;l=l.parentNode;)l.nodeType===1&&d.push({element:l,left:l.scrollLeft,top:l.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p=document.documentMode,dc=null,mm=null,Md=null,gm=!1;function vb(l,d,p){var x=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;gm||dc==null||dc!==Ue(x)||(x=dc,"selectionStart"in x&&pm(x)?x={start:x.selectionStart,end:x.selectionEnd}:(x=(x.ownerDocument&&x.ownerDocument.defaultView||window).getSelection(),x={anchorNode:x.anchorNode,anchorOffset:x.anchorOffset,focusNode:x.focusNode,focusOffset:x.focusOffset}),Md&&Td(Md,x)||(Md=x,x=Xu(mm,"onSelect"),0mc||(l.current=Tm[mc],Tm[mc]=null,mc--)}function ln(l,d){mc++,Tm[mc]=l.current,l.current=d}var eo={},As=Zi(eo),ir=Zi(!1),fl=eo;function gc(l,d){var p=l.type.contextTypes;if(!p)return eo;var x=l.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===d)return x.__reactInternalMemoizedMaskedChildContext;var w={},S;for(S in p)w[S]=d[S];return x&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=d,l.__reactInternalMemoizedMaskedChildContext=w),w}function or(l){return l=l.childContextTypes,l!=null}function nh(){xn(ir),xn(As)}function Ob(l,d,p){if(As.current!==eo)throw Error(n(168));ln(As,d),ln(ir,p)}function Db(l,d,p){var x=l.stateNode;if(d=d.childContextTypes,typeof x.getChildContext!="function")return p;x=x.getChildContext();for(var w in x)if(!(w in d))throw Error(n(108,q(l)||"Unknown",w));return X({},p,x)}function sh(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||eo,fl=As.current,ln(As,l),ln(ir,ir.current),!0}function _b(l,d,p){var x=l.stateNode;if(!x)throw Error(n(169));p?(l=Db(l,d,fl),x.__reactInternalMemoizedMergedChildContext=l,xn(ir),xn(As),ln(As,l)):xn(ir),ln(ir,p)}var di=null,rh=!1,Mm=!1;function $b(l){di===null?di=[l]:di.push(l)}function uE(l){rh=!0,$b(l)}function to(){if(!Mm&&di!==null){Mm=!0;var l=0,d=lt;try{var p=di;for(lt=1;l>=A,w-=A,ui=1<<32-Jn(d)+w|p<gt?(ds=dt,dt=null):ds=dt.sibling;var Ht=Ee(pe,dt,xe[gt],Le);if(Ht===null){dt===null&&(dt=ds);break}l&&dt&&Ht.alternate===null&&d(pe,dt),ae=S(Ht,ae,gt),ct===null?st=Ht:ct.sibling=Ht,ct=Ht,dt=ds}if(gt===xe.length)return p(pe,dt),Nn&&ml(pe,gt),st;if(dt===null){for(;gtgt?(ds=dt,dt=null):ds=dt.sibling;var uo=Ee(pe,dt,Ht.value,Le);if(uo===null){dt===null&&(dt=ds);break}l&&dt&&uo.alternate===null&&d(pe,dt),ae=S(uo,ae,gt),ct===null?st=uo:ct.sibling=uo,ct=uo,dt=ds}if(Ht.done)return p(pe,dt),Nn&&ml(pe,gt),st;if(dt===null){for(;!Ht.done;gt++,Ht=xe.next())Ht=Ie(pe,Ht.value,Le),Ht!==null&&(ae=S(Ht,ae,gt),ct===null?st=Ht:ct.sibling=Ht,ct=Ht);return Nn&&ml(pe,gt),st}for(dt=x(pe,dt);!Ht.done;gt++,Ht=xe.next())Ht=qe(dt,pe,gt,Ht.value,Le),Ht!==null&&(l&&Ht.alternate!==null&&dt.delete(Ht.key===null?gt:Ht.key),ae=S(Ht,ae,gt),ct===null?st=Ht:ct.sibling=Ht,ct=Ht);return l&&dt.forEach(function(WE){return d(pe,WE)}),Nn&&ml(pe,gt),st}function zn(pe,ae,xe,Le){if(typeof xe=="object"&&xe!==null&&xe.type===I&&xe.key===null&&(xe=xe.props.children),typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case O:e:{for(var st=xe.key,ct=ae;ct!==null;){if(ct.key===st){if(st=xe.type,st===I){if(ct.tag===7){p(pe,ct.sibling),ae=w(ct,xe.props.children),ae.return=pe,pe=ae;break e}}else if(ct.elementType===st||typeof st=="object"&&st!==null&&st.$$typeof===P&&Ub(st)===ct.type){p(pe,ct.sibling),ae=w(ct,xe.props),ae.ref=Od(pe,ct,xe),ae.return=pe,pe=ae;break e}p(pe,ct);break}else d(pe,ct);ct=ct.sibling}xe.type===I?(ae=jl(xe.props.children,pe.mode,Le,xe.key),ae.return=pe,pe=ae):(Le=Ih(xe.type,xe.key,xe.props,null,pe.mode,Le),Le.ref=Od(pe,ae,xe),Le.return=pe,pe=Le)}return A(pe);case U:e:{for(ct=xe.key;ae!==null;){if(ae.key===ct)if(ae.tag===4&&ae.stateNode.containerInfo===xe.containerInfo&&ae.stateNode.implementation===xe.implementation){p(pe,ae.sibling),ae=w(ae,xe.children||[]),ae.return=pe,pe=ae;break e}else{p(pe,ae);break}else d(pe,ae);ae=ae.sibling}ae=Cg(xe,pe.mode,Le),ae.return=pe,pe=ae}return A(pe);case P:return ct=xe._init,zn(pe,ae,ct(xe._payload),Le)}if(mn(xe))return Ze(pe,ae,xe,Le);if(ge(xe))return nt(pe,ae,xe,Le);lh(pe,xe)}return typeof xe=="string"&&xe!==""||typeof xe=="number"?(xe=""+xe,ae!==null&&ae.tag===6?(p(pe,ae.sibling),ae=w(ae,xe),ae.return=pe,pe=ae):(p(pe,ae),ae=Sg(xe,pe.mode,Le),ae.return=pe,pe=ae),A(pe)):p(pe,ae)}return zn}var vc=Wb(!0),Kb=Wb(!1),ch=Zi(null),dh=null,Nc=null,Om=null;function Dm(){Om=Nc=dh=null}function _m(l){var d=ch.current;xn(ch),l._currentValue=d}function $m(l,d,p){for(;l!==null;){var x=l.alternate;if((l.childLanes&d)!==d?(l.childLanes|=d,x!==null&&(x.childLanes|=d)):x!==null&&(x.childLanes&d)!==d&&(x.childLanes|=d),l===p)break;l=l.return}}function wc(l,d){dh=l,Om=Nc=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(lr=!0),l.firstContext=null)}function Br(l){var d=l._currentValue;if(Om!==l)if(l={context:l,memoizedValue:d,next:null},Nc===null){if(dh===null)throw Error(n(308));Nc=l,dh.dependencies={lanes:0,firstContext:l}}else Nc=Nc.next=l;return d}var gl=null;function zm(l){gl===null?gl=[l]:gl.push(l)}function qb(l,d,p,x){var w=d.interleaved;return w===null?(p.next=p,zm(d)):(p.next=w.next,w.next=p),d.interleaved=p,fi(l,x)}function fi(l,d){l.lanes|=d;var p=l.alternate;for(p!==null&&(p.lanes|=d),p=l,l=l.return;l!==null;)l.childLanes|=d,p=l.alternate,p!==null&&(p.childLanes|=d),p=l,l=l.return;return p.tag===3?p.stateNode:null}var no=!1;function Fm(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Gb(l,d){l=l.updateQueue,d.updateQueue===l&&(d.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function pi(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function so(l,d,p){var x=l.updateQueue;if(x===null)return null;if(x=x.shared,(Bt&2)!==0){var w=x.pending;return w===null?d.next=d:(d.next=w.next,w.next=d),x.pending=d,fi(l,p)}return w=x.interleaved,w===null?(d.next=d,zm(x)):(d.next=w.next,w.next=d),x.interleaved=d,fi(l,p)}function uh(l,d,p){if(d=d.updateQueue,d!==null&&(d=d.shared,(p&4194240)!==0)){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,nl(l,p)}}function Jb(l,d){var p=l.updateQueue,x=l.alternate;if(x!==null&&(x=x.updateQueue,p===x)){var w=null,S=null;if(p=p.firstBaseUpdate,p!==null){do{var A={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};S===null?w=S=A:S=S.next=A,p=p.next}while(p!==null);S===null?w=S=d:S=S.next=d}else w=S=d;p={baseState:x.baseState,firstBaseUpdate:w,lastBaseUpdate:S,shared:x.shared,effects:x.effects},l.updateQueue=p;return}l=p.lastBaseUpdate,l===null?p.firstBaseUpdate=d:l.next=d,p.lastBaseUpdate=d}function hh(l,d,p,x){var w=l.updateQueue;no=!1;var S=w.firstBaseUpdate,A=w.lastBaseUpdate,K=w.shared.pending;if(K!==null){w.shared.pending=null;var ne=K,ye=ne.next;ne.next=null,A===null?S=ye:A.next=ye,A=ne;var Pe=l.alternate;Pe!==null&&(Pe=Pe.updateQueue,K=Pe.lastBaseUpdate,K!==A&&(K===null?Pe.firstBaseUpdate=ye:K.next=ye,Pe.lastBaseUpdate=ne))}if(S!==null){var Ie=w.baseState;A=0,Pe=ye=ne=null,K=S;do{var Ee=K.lane,qe=K.eventTime;if((x&Ee)===Ee){Pe!==null&&(Pe=Pe.next={eventTime:qe,lane:0,tag:K.tag,payload:K.payload,callback:K.callback,next:null});e:{var Ze=l,nt=K;switch(Ee=d,qe=p,nt.tag){case 1:if(Ze=nt.payload,typeof Ze=="function"){Ie=Ze.call(qe,Ie,Ee);break e}Ie=Ze;break e;case 3:Ze.flags=Ze.flags&-65537|128;case 0:if(Ze=nt.payload,Ee=typeof Ze=="function"?Ze.call(qe,Ie,Ee):Ze,Ee==null)break e;Ie=X({},Ie,Ee);break e;case 2:no=!0}}K.callback!==null&&K.lane!==0&&(l.flags|=64,Ee=w.effects,Ee===null?w.effects=[K]:Ee.push(K))}else qe={eventTime:qe,lane:Ee,tag:K.tag,payload:K.payload,callback:K.callback,next:null},Pe===null?(ye=Pe=qe,ne=Ie):Pe=Pe.next=qe,A|=Ee;if(K=K.next,K===null){if(K=w.shared.pending,K===null)break;Ee=K,K=Ee.next,Ee.next=null,w.lastBaseUpdate=Ee,w.shared.pending=null}}while(!0);if(Pe===null&&(ne=Ie),w.baseState=ne,w.firstBaseUpdate=ye,w.lastBaseUpdate=Pe,d=w.shared.interleaved,d!==null){w=d;do A|=w.lane,w=w.next;while(w!==d)}else S===null&&(w.shared.lanes=0);bl|=A,l.lanes=A,l.memoizedState=Ie}}function Qb(l,d,p){if(l=d.effects,d.effects=null,l!==null)for(d=0;dp?p:4,l(!0);var x=Wm.transition;Wm.transition={};try{l(!1),d()}finally{lt=p,Wm.transition=x}}function mv(){return Vr().memoizedState}function mE(l,d,p){var x=oo(l);if(p={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null},gv(l))xv(d,p);else if(p=qb(l,d,p,x),p!==null){var w=Ws();ha(p,l,x,w),yv(p,d,x)}}function gE(l,d,p){var x=oo(l),w={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null};if(gv(l))xv(d,w);else{var S=l.alternate;if(l.lanes===0&&(S===null||S.lanes===0)&&(S=d.lastRenderedReducer,S!==null))try{var A=d.lastRenderedState,K=S(A,p);if(w.hasEagerState=!0,w.eagerState=K,oa(K,A)){var ne=d.interleaved;ne===null?(w.next=w,zm(d)):(w.next=ne.next,ne.next=w),d.interleaved=w;return}}catch{}finally{}p=qb(l,d,w,x),p!==null&&(w=Ws(),ha(p,l,x,w),yv(p,d,x))}}function gv(l){var d=l.alternate;return l===En||d!==null&&d===En}function xv(l,d){zd=mh=!0;var p=l.pending;p===null?d.next=d:(d.next=p.next,p.next=d),l.pending=d}function yv(l,d,p){if((p&4194240)!==0){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,nl(l,p)}}var yh={readContext:Br,useCallback:Ps,useContext:Ps,useEffect:Ps,useImperativeHandle:Ps,useInsertionEffect:Ps,useLayoutEffect:Ps,useMemo:Ps,useReducer:Ps,useRef:Ps,useState:Ps,useDebugValue:Ps,useDeferredValue:Ps,useTransition:Ps,useMutableSource:Ps,useSyncExternalStore:Ps,useId:Ps,unstable_isNewReconciler:!1},xE={readContext:Br,useCallback:function(l,d){return _a().memoizedState=[l,d===void 0?null:d],l},useContext:Br,useEffect:ov,useImperativeHandle:function(l,d,p){return p=p!=null?p.concat([l]):null,gh(4194308,4,dv.bind(null,d,l),p)},useLayoutEffect:function(l,d){return gh(4194308,4,l,d)},useInsertionEffect:function(l,d){return gh(4,2,l,d)},useMemo:function(l,d){var p=_a();return d=d===void 0?null:d,l=l(),p.memoizedState=[l,d],l},useReducer:function(l,d,p){var x=_a();return d=p!==void 0?p(d):d,x.memoizedState=x.baseState=d,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:d},x.queue=l,l=l.dispatch=mE.bind(null,En,l),[x.memoizedState,l]},useRef:function(l){var d=_a();return l={current:l},d.memoizedState=l},useState:av,useDebugValue:Xm,useDeferredValue:function(l){return _a().memoizedState=l},useTransition:function(){var l=av(!1),d=l[0];return l=pE.bind(null,l[1]),_a().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,p){var x=En,w=_a();if(Nn){if(p===void 0)throw Error(n(407));p=p()}else{if(p=d(),cs===null)throw Error(n(349));(yl&30)!==0||ev(x,d,p)}w.memoizedState=p;var S={value:p,getSnapshot:d};return w.queue=S,ov(nv.bind(null,x,S,l),[l]),x.flags|=2048,Vd(9,tv.bind(null,x,S,p,d),void 0,null),p},useId:function(){var l=_a(),d=cs.identifierPrefix;if(Nn){var p=hi,x=ui;p=(x&~(1<<32-Jn(x)-1)).toString(32)+p,d=":"+d+"R"+p,p=Fd++,0<\/script>",l=l.removeChild(l.firstChild)):typeof x.is=="string"?l=A.createElement(p,{is:x.is}):(l=A.createElement(p),p==="select"&&(A=l,x.multiple?A.multiple=!0:x.size&&(A.size=x.size))):l=A.createElementNS(l,p),l[Oa]=d,l[Rd]=x,$v(l,d,!1,!1),d.stateNode=l;e:{switch(A=vt(p,x),p){case"dialog":gn("cancel",l),gn("close",l),w=x;break;case"iframe":case"object":case"embed":gn("load",l),w=x;break;case"video":case"audio":for(w=0;wEc&&(d.flags|=128,x=!0,Hd(S,!1),d.lanes=4194304)}else{if(!x)if(l=fh(A),l!==null){if(d.flags|=128,x=!0,p=l.updateQueue,p!==null&&(d.updateQueue=p,d.flags|=4),Hd(S,!0),S.tail===null&&S.tailMode==="hidden"&&!A.alternate&&!Nn)return Is(d),null}else 2*nn()-S.renderingStartTime>Ec&&p!==1073741824&&(d.flags|=128,x=!0,Hd(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=nn(),d.sibling=null,p=Cn.current,ln(Cn,x?p&1|2:p&1),d):(Is(d),null);case 22:case 23:return wg(),x=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==x&&(d.flags|=8192),x&&(d.mode&1)!==0?(Sr&1073741824)!==0&&(Is(d),d.subtreeFlags&6&&(d.flags|=8192)):Is(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function SE(l,d){switch(Pm(d),d.tag){case 1:return or(d.type)&&nh(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return jc(),xn(ir),xn(As),Um(),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(xn(Cn),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));bc()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return xn(Cn),null;case 4:return jc(),null;case 10:return _m(d.type._context),null;case 22:case 23:return wg(),null;case 24:return null;default:return null}}var wh=!1,Rs=!1,CE=typeof WeakSet=="function"?WeakSet:Set,Ye=null;function Sc(l,d){var p=l.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(x){Pn(l,d,x)}else p.current=null}function dg(l,d,p){try{p()}catch(x){Pn(l,d,x)}}var Bv=!1;function EE(l,d){if(wm=rr,l=bb(),pm(l)){if("selectionStart"in l)var p={start:l.selectionStart,end:l.selectionEnd};else e:{p=(p=l.ownerDocument)&&p.defaultView||window;var x=p.getSelection&&p.getSelection();if(x&&x.rangeCount!==0){p=x.anchorNode;var w=x.anchorOffset,S=x.focusNode;x=x.focusOffset;try{p.nodeType,S.nodeType}catch{p=null;break e}var A=0,K=-1,ne=-1,ye=0,Pe=0,Ie=l,Ee=null;t:for(;;){for(var qe;Ie!==p||w!==0&&Ie.nodeType!==3||(K=A+w),Ie!==S||x!==0&&Ie.nodeType!==3||(ne=A+x),Ie.nodeType===3&&(A+=Ie.nodeValue.length),(qe=Ie.firstChild)!==null;)Ee=Ie,Ie=qe;for(;;){if(Ie===l)break t;if(Ee===p&&++ye===w&&(K=A),Ee===S&&++Pe===x&&(ne=A),(qe=Ie.nextSibling)!==null)break;Ie=Ee,Ee=Ie.parentNode}Ie=qe}p=K===-1||ne===-1?null:{start:K,end:ne}}else p=null}p=p||{start:0,end:0}}else p=null;for(jm={focusedElem:l,selectionRange:p},rr=!1,Ye=d;Ye!==null;)if(d=Ye,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,Ye=l;else for(;Ye!==null;){d=Ye;try{var Ze=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(Ze!==null){var nt=Ze.memoizedProps,zn=Ze.memoizedState,pe=d.stateNode,ae=pe.getSnapshotBeforeUpdate(d.elementType===d.type?nt:ca(d.type,nt),zn);pe.__reactInternalSnapshotBeforeUpdate=ae}break;case 3:var xe=d.stateNode.containerInfo;xe.nodeType===1?xe.textContent="":xe.nodeType===9&&xe.documentElement&&xe.removeChild(xe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Le){Pn(d,d.return,Le)}if(l=d.sibling,l!==null){l.return=d.return,Ye=l;break}Ye=d.return}return Ze=Bv,Bv=!1,Ze}function Ud(l,d,p){var x=d.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var w=x=x.next;do{if((w.tag&l)===l){var S=w.destroy;w.destroy=void 0,S!==void 0&&dg(d,p,S)}w=w.next}while(w!==x)}}function jh(l,d){if(d=d.updateQueue,d=d!==null?d.lastEffect:null,d!==null){var p=d=d.next;do{if((p.tag&l)===l){var x=p.create;p.destroy=x()}p=p.next}while(p!==d)}}function ug(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 Vv(l){var d=l.alternate;d!==null&&(l.alternate=null,Vv(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[Oa],delete d[Rd],delete d[Em],delete d[cE],delete d[dE])),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 Hv(l){return l.tag===5||l.tag===3||l.tag===4}function Uv(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||Hv(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 hg(l,d,p){var x=l.tag;if(x===5||x===6)l=l.stateNode,d?p.nodeType===8?p.parentNode.insertBefore(l,d):p.insertBefore(l,d):(p.nodeType===8?(d=p.parentNode,d.insertBefore(l,p)):(d=p,d.appendChild(l)),p=p._reactRootContainer,p!=null||d.onclick!==null||(d.onclick=eh));else if(x!==4&&(l=l.child,l!==null))for(hg(l,d,p),l=l.sibling;l!==null;)hg(l,d,p),l=l.sibling}function fg(l,d,p){var x=l.tag;if(x===5||x===6)l=l.stateNode,d?p.insertBefore(l,d):p.appendChild(l);else if(x!==4&&(l=l.child,l!==null))for(fg(l,d,p),l=l.sibling;l!==null;)fg(l,d,p),l=l.sibling}var ws=null,da=!1;function ro(l,d,p){for(p=p.child;p!==null;)Wv(l,d,p),p=p.sibling}function Wv(l,d,p){if(Bs&&typeof Bs.onCommitFiberUnmount=="function")try{Bs.onCommitFiberUnmount(Zs,p)}catch{}switch(p.tag){case 5:Rs||Sc(p,d);case 6:var x=ws,w=da;ws=null,ro(l,d,p),ws=x,da=w,ws!==null&&(da?(l=ws,p=p.stateNode,l.nodeType===8?l.parentNode.removeChild(p):l.removeChild(p)):ws.removeChild(p.stateNode));break;case 18:ws!==null&&(da?(l=ws,p=p.stateNode,l.nodeType===8?Cm(l.parentNode,p):l.nodeType===1&&Cm(l,p),sr(l)):Cm(ws,p.stateNode));break;case 4:x=ws,w=da,ws=p.stateNode.containerInfo,da=!0,ro(l,d,p),ws=x,da=w;break;case 0:case 11:case 14:case 15:if(!Rs&&(x=p.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){w=x=x.next;do{var S=w,A=S.destroy;S=S.tag,A!==void 0&&((S&2)!==0||(S&4)!==0)&&dg(p,d,A),w=w.next}while(w!==x)}ro(l,d,p);break;case 1:if(!Rs&&(Sc(p,d),x=p.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=p.memoizedProps,x.state=p.memoizedState,x.componentWillUnmount()}catch(K){Pn(p,d,K)}ro(l,d,p);break;case 21:ro(l,d,p);break;case 22:p.mode&1?(Rs=(x=Rs)||p.memoizedState!==null,ro(l,d,p),Rs=x):ro(l,d,p);break;default:ro(l,d,p)}}function Kv(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var p=l.stateNode;p===null&&(p=l.stateNode=new CE),d.forEach(function(x){var w=DE.bind(null,l,x);p.has(x)||(p.add(x),x.then(w,w))})}}function ua(l,d){var p=d.deletions;if(p!==null)for(var x=0;xw&&(w=A),x&=~S}if(x=w,x=nn()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*ME(x/1960))-x,10l?16:l,io===null)var x=!1;else{if(l=io,io=null,Th=0,(Bt&6)!==0)throw Error(n(331));var w=Bt;for(Bt|=4,Ye=l.current;Ye!==null;){var S=Ye,A=S.child;if((Ye.flags&16)!==0){var K=S.deletions;if(K!==null){for(var ne=0;nenn()-gg?Nl(l,0):mg|=p),dr(l,d)}function a1(l,d){d===0&&((l.mode&1)===0?d=1:(d=Vs,Vs<<=1,(Vs&130023424)===0&&(Vs=4194304)));var p=Ws();l=fi(l,d),l!==null&&(ra(l,d,p),dr(l,p))}function OE(l){var d=l.memoizedState,p=0;d!==null&&(p=d.retryLane),a1(l,p)}function DE(l,d){var p=0;switch(l.tag){case 13:var x=l.stateNode,w=l.memoizedState;w!==null&&(p=w.retryLane);break;case 19:x=l.stateNode;break;default:throw Error(n(314))}x!==null&&x.delete(d),a1(l,p)}var i1;i1=function(l,d,p){if(l!==null)if(l.memoizedProps!==d.pendingProps||ir.current)lr=!0;else{if((l.lanes&p)===0&&(d.flags&128)===0)return lr=!1,jE(l,d,p);lr=(l.flags&131072)!==0}else lr=!1,Nn&&(d.flags&1048576)!==0&&zb(d,ih,d.index);switch(d.lanes=0,d.tag){case 2:var x=d.type;Nh(l,d),l=d.pendingProps;var w=gc(d,As.current);wc(d,p),w=qm(null,d,x,l,w,p);var S=Gm();return d.flags|=1,typeof w=="object"&&w!==null&&typeof w.render=="function"&&w.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,or(x)?(S=!0,sh(d)):S=!1,d.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,Fm(d),w.updater=bh,d.stateNode=w,w._reactInternals=d,eg(d,x,l,p),d=rg(null,d,x,!0,S,p)):(d.tag=0,Nn&&S&&Am(d),Us(null,d,w,p),d=d.child),d;case 16:x=d.elementType;e:{switch(Nh(l,d),l=d.pendingProps,w=x._init,x=w(x._payload),d.type=x,w=d.tag=$E(x),l=ca(x,l),w){case 0:d=sg(null,d,x,l,p);break e;case 1:d=Iv(null,d,x,l,p);break e;case 11:d=Ev(null,d,x,l,p);break e;case 14:d=Tv(null,d,x,ca(x.type,l),p);break e}throw Error(n(306,x,""))}return d;case 0:return x=d.type,w=d.pendingProps,w=d.elementType===x?w:ca(x,w),sg(l,d,x,w,p);case 1:return x=d.type,w=d.pendingProps,w=d.elementType===x?w:ca(x,w),Iv(l,d,x,w,p);case 3:e:{if(Rv(d),l===null)throw Error(n(387));x=d.pendingProps,S=d.memoizedState,w=S.element,Gb(l,d),hh(d,x,null,p);var A=d.memoizedState;if(x=A.element,S.isDehydrated)if(S={element:x,isDehydrated:!1,cache:A.cache,pendingSuspenseBoundaries:A.pendingSuspenseBoundaries,transitions:A.transitions},d.updateQueue.baseState=S,d.memoizedState=S,d.flags&256){w=kc(Error(n(423)),d),d=Lv(l,d,x,p,w);break e}else if(x!==w){w=kc(Error(n(424)),d),d=Lv(l,d,x,p,w);break e}else for(kr=Xi(d.stateNode.containerInfo.firstChild),jr=d,Nn=!0,la=null,p=Kb(d,null,x,p),d.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(bc(),x===w){d=mi(l,d,p);break e}Us(l,d,x,p)}d=d.child}return d;case 5:return Yb(d),l===null&&Rm(d),x=d.type,w=d.pendingProps,S=l!==null?l.memoizedProps:null,A=w.children,km(x,w)?A=null:S!==null&&km(x,S)&&(d.flags|=32),Pv(l,d),Us(l,d,A,p),d.child;case 6:return l===null&&Rm(d),null;case 13:return Ov(l,d,p);case 4:return Bm(d,d.stateNode.containerInfo),x=d.pendingProps,l===null?d.child=vc(d,null,x,p):Us(l,d,x,p),d.child;case 11:return x=d.type,w=d.pendingProps,w=d.elementType===x?w:ca(x,w),Ev(l,d,x,w,p);case 7:return Us(l,d,d.pendingProps,p),d.child;case 8:return Us(l,d,d.pendingProps.children,p),d.child;case 12:return Us(l,d,d.pendingProps.children,p),d.child;case 10:e:{if(x=d.type._context,w=d.pendingProps,S=d.memoizedProps,A=w.value,ln(ch,x._currentValue),x._currentValue=A,S!==null)if(oa(S.value,A)){if(S.children===w.children&&!ir.current){d=mi(l,d,p);break e}}else for(S=d.child,S!==null&&(S.return=d);S!==null;){var K=S.dependencies;if(K!==null){A=S.child;for(var ne=K.firstContext;ne!==null;){if(ne.context===x){if(S.tag===1){ne=pi(-1,p&-p),ne.tag=2;var ye=S.updateQueue;if(ye!==null){ye=ye.shared;var Pe=ye.pending;Pe===null?ne.next=ne:(ne.next=Pe.next,Pe.next=ne),ye.pending=ne}}S.lanes|=p,ne=S.alternate,ne!==null&&(ne.lanes|=p),$m(S.return,p,d),K.lanes|=p;break}ne=ne.next}}else if(S.tag===10)A=S.type===d.type?null:S.child;else if(S.tag===18){if(A=S.return,A===null)throw Error(n(341));A.lanes|=p,K=A.alternate,K!==null&&(K.lanes|=p),$m(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}Us(l,d,w.children,p),d=d.child}return d;case 9:return w=d.type,x=d.pendingProps.children,wc(d,p),w=Br(w),x=x(w),d.flags|=1,Us(l,d,x,p),d.child;case 14:return x=d.type,w=ca(x,d.pendingProps),w=ca(x.type,w),Tv(l,d,x,w,p);case 15:return Mv(l,d,d.type,d.pendingProps,p);case 17:return x=d.type,w=d.pendingProps,w=d.elementType===x?w:ca(x,w),Nh(l,d),d.tag=1,or(x)?(l=!0,sh(d)):l=!1,wc(d,p),vv(d,x,w),eg(d,x,w,p),rg(null,d,x,!0,l,p);case 19:return _v(l,d,p);case 22:return Av(l,d,p)}throw Error(n(156,d.tag))};function o1(l,d){return Fi(l,d)}function _E(l,d,p,x){this.tag=l,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ur(l,d,p,x){return new _E(l,d,p,x)}function kg(l){return l=l.prototype,!(!l||!l.isReactComponent)}function $E(l){if(typeof l=="function")return kg(l)?1:0;if(l!=null){if(l=l.$$typeof,l===$)return 11;if(l===me)return 14}return 2}function co(l,d){var p=l.alternate;return p===null?(p=Ur(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 Ih(l,d,p,x,w,S){var A=2;if(x=l,typeof l=="function")kg(l)&&(A=1);else if(typeof l=="string")A=5;else e:switch(l){case I:return jl(p.children,w,S,d);case z:A=8,w|=8;break;case L:return l=Ur(12,p,d,w|2),l.elementType=L,l.lanes=S,l;case ie:return l=Ur(13,p,d,w),l.elementType=ie,l.lanes=S,l;case le:return l=Ur(19,p,d,w),l.elementType=le,l.lanes=S,l;case Y:return Rh(p,w,S,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case Q:A=10;break e;case se:A=9;break e;case $:A=11;break e;case me:A=14;break e;case P:A=16,x=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=Ur(A,p,d,w),d.elementType=l,d.type=x,d.lanes=S,d}function jl(l,d,p,x){return l=Ur(7,l,x,d),l.lanes=p,l}function Rh(l,d,p,x){return l=Ur(22,l,x,d),l.elementType=Y,l.lanes=p,l.stateNode={isHidden:!1},l}function Sg(l,d,p){return l=Ur(6,l,null,d),l.lanes=p,l}function Cg(l,d,p){return d=Ur(4,l.children!==null?l.children:[],l.key,d),d.lanes=p,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function zE(l,d,p,x,w){this.tag=d,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ui(0),this.expirationTimes=Ui(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ui(0),this.identifierPrefix=x,this.onRecoverableError=w,this.mutableSourceEagerHydrationData=null}function Eg(l,d,p,x,w,S,A,K,ne){return l=new zE(l,d,p,K,ne),d===1?(d=1,S===!0&&(d|=8)):d=0,S=Ur(3,null,null,d),l.current=S,S.stateNode=l,S.memoizedState={element:x,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},Fm(S),l}function FE(l,d,p){var x=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Rg.exports=XE(),Rg.exports}var N1;function ZE(){if(N1)return Fh;N1=1;var t=$j();return Fh.createRoot=t.createRoot,Fh.hydrateRoot=t.hydrateRoot,Fh}var eT=ZE(),od=$j();const zj=_j(od);/** -======== - */var x1;function QE(){if(x1)return lr;x1=1;var t=_u(),e=JE();function n(l){for(var d="https://reactjs.org/docs/error-decoder.html?invariant="+l,p=1;p"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,h=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},m={};function g(l){return u.call(m,l)?!0:u.call(f,l)?!1:h.test(l)?m[l]=!0:(f[l]=!0,!1)}function b(l,d,p,x){if(p!==null&&p.type===0)return!1;switch(typeof d){case"function":case"symbol":return!0;case"boolean":return x?!1:p!==null?!p.acceptsBooleans:(l=l.toLowerCase().slice(0,5),l!=="data-"&&l!=="aria-");default:return!1}}function N(l,d,p,x){if(d===null||typeof d>"u"||b(l,d,p,x))return!0;if(x)return!1;if(p!==null)switch(p.type){case 3:return!d;case 4:return d===!1;case 5:return isNaN(d);case 6:return isNaN(d)||1>d}return!1}function j(l,d,p,x,w,S,A){this.acceptsBooleans=d===2||d===3||d===4,this.attributeName=x,this.attributeNamespace=w,this.mustUseProperty=p,this.propertyName=l,this.type=d,this.sanitizeURL=S,this.removeEmptyString=A}var v={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){v[l]=new j(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var d=l[0];v[d]=new j(d,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){v[l]=new j(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){v[l]=new j(l,2,!1,l,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(l){v[l]=new j(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){v[l]=new j(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){v[l]=new j(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){v[l]=new j(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){v[l]=new j(l,5,!1,l.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function T(l){return l[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(l){var d=l.replace(k,T);v[d]=new j(d,1,!1,l,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(l){var d=l.replace(k,T);v[d]=new j(d,1,!1,l,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(l){var d=l.replace(k,T);v[d]=new j(d,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){v[l]=new j(l,1,!1,l.toLowerCase(),null,!1,!1)}),v.xlinkHref=new j("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){v[l]=new j(l,1,!1,l.toLowerCase(),null,!0,!0)});function C(l,d,p,x){var w=v.hasOwnProperty(d)?v[d]:null;(w!==null?w.type!==0:x||!(2K||w[A]!==S[K]){var ne=` -`+w[A].replace(" at new "," at ");return l.displayName&&ne.includes("")&&(ne=ne.replace("",l.displayName)),ne}while(1<=A&&0<=K);break}}}finally{fe=!1,Error.prepareStackTrace=p}return(l=l?l.displayName||l.name:"")?W(l):""}function de(l){switch(l.tag){case 5:return W(l.type);case 16:return W("Lazy");case 13:return W("Suspense");case 19:return W("SuspenseList");case 0:case 2:case 15:return l=he(l.type,!1),l;case 11:return l=he(l.type.render,!1),l;case 1:return l=he(l.type,!0),l;default:return""}}function D(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case P:return"Fragment";case U:return"Portal";case L:return"Profiler";case z:return"StrictMode";case ie:return"Suspense";case le:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case se:return(l.displayName||"Context")+".Consumer";case Q:return(l._context.displayName||"Context")+".Provider";case $:var d=l.render;return l=l.displayName,l||(l=d.displayName||d.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case me:return d=l.displayName||null,d!==null?d:D(l.type)||"Memo";case I:d=l._payload,l=l._init;try{return D(l(d))}catch{}}return null}function q(l){var d=l.type;switch(l.tag){case 24:return"Cache";case 9:return(d.displayName||"Context")+".Consumer";case 10:return(d._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=d.render,l=l.displayName||l.name||"",d.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return d;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return D(d);case 8:return d===z?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d}return null}function _(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function Z(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function re(l){var d=Z(l)?"checked":"value",p=Object.getOwnPropertyDescriptor(l.constructor.prototype,d),x=""+l[d];if(!l.hasOwnProperty(d)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var w=p.get,S=p.set;return Object.defineProperty(l,d,{configurable:!0,get:function(){return w.call(this)},set:function(A){x=""+A,S.call(this,A)}}),Object.defineProperty(l,d,{enumerable:p.enumerable}),{getValue:function(){return x},setValue:function(A){x=""+A},stopTracking:function(){l._valueTracker=null,delete l[d]}}}}function we(l){l._valueTracker||(l._valueTracker=re(l))}function Fe(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var p=d.getValue(),x="";return l&&(x=Z(l)?l.checked?"true":"false":l.value),l=x,l!==p?(d.setValue(l),!0):!1}function Ue(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}function jt(l,d){var p=d.checked;return X({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??l._wrapperState.initialChecked})}function Nn(l,d){var p=d.defaultValue==null?"":d.defaultValue,x=d.checked!=null?d.checked:d.defaultChecked;p=_(d.value!=null?d.value:p),l._wrapperState={initialChecked:x,initialValue:p,controlled:d.type==="checkbox"||d.type==="radio"?d.checked!=null:d.value!=null}}function pt(l,d){d=d.checked,d!=null&&C(l,"checked",d,!1)}function It(l,d){pt(l,d);var p=_(d.value),x=d.type;if(p!=null)x==="number"?(p===0&&l.value===""||l.value!=p)&&(l.value=""+p):l.value!==""+p&&(l.value=""+p);else if(x==="submit"||x==="reset"){l.removeAttribute("value");return}d.hasOwnProperty("value")?Bn(l,d.type,p):d.hasOwnProperty("defaultValue")&&Bn(l,d.type,_(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(l.defaultChecked=!!d.defaultChecked)}function hn(l,d,p){if(d.hasOwnProperty("value")||d.hasOwnProperty("defaultValue")){var x=d.type;if(!(x!=="submit"&&x!=="reset"||d.value!==void 0&&d.value!==null))return;d=""+l._wrapperState.initialValue,p||d===l.value||(l.value=d),l.defaultValue=d}p=l.name,p!==""&&(l.name=""),l.defaultChecked=!!l._wrapperState.initialChecked,p!==""&&(l.name=p)}function Bn(l,d,p){(d!=="number"||Ue(l.ownerDocument)!==l)&&(p==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+p&&(l.defaultValue=""+p))}var fn=Array.isArray;function Wt(l,d,p,x){if(l=l.options,d){d={};for(var w=0;w"+d.valueOf().toString()+"",d=Ne.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;d.firstChild;)l.appendChild(d.firstChild)}});function We(l,d){if(d){var p=l.firstChild;if(p&&p===l.lastChild&&p.nodeType===3){p.nodeValue=d;return}}l.textContent=d}var at={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Lt=["Webkit","ms","Moz","O"];Object.keys(at).forEach(function(l){Lt.forEach(function(d){d=d+l.charAt(0).toUpperCase()+l.substring(1),at[d]=at[l]})});function Ct(l,d,p){return d==null||typeof d=="boolean"||d===""?"":p||typeof d!="number"||d===0||at.hasOwnProperty(l)&&at[l]?(""+d).trim():d+"px"}function $e(l,d){l=l.style;for(var p in d)if(d.hasOwnProperty(p)){var x=p.indexOf("--")===0,w=Ct(p,d[p],x);p==="float"&&(p="cssFloat"),x?l.setProperty(p,w):l[p]=w}}var H=X({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Qe(l,d){if(d){if(H[l]&&(d.children!=null||d.dangerouslySetInnerHTML!=null))throw Error(n(137,l));if(d.dangerouslySetInnerHTML!=null){if(d.children!=null)throw Error(n(60));if(typeof d.dangerouslySetInnerHTML!="object"||!("__html"in d.dangerouslySetInnerHTML))throw Error(n(61))}if(d.style!=null&&typeof d.style!="object")throw Error(n(62))}}function vt(l,d){if(l.indexOf("-")===-1)return typeof d.is=="string";switch(l){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ft=null;function yt(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var bt=null,Pt=null,Qt=null;function wn(l){if(l=Rd(l)){if(typeof bt!="function")throw Error(n(280));var d=l.stateNode;d&&(d=eh(d),bt(l.stateNode,l.type,d))}}function Ds(l){Pt?Qt?Qt.push(l):Qt=[l]:Pt=l}function hr(){if(Pt){var l=Pt,d=Qt;if(Qt=Pt=null,wn(l),d)for(l=0;l>>=0,l===0?32:31-(el(l)/Zr|0)|0}var mr=64,zs=4194304;function ea(l){switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function wa(l,d){var p=l.pendingLanes;if(p===0)return 0;var x=0,w=l.suspendedLanes,S=l.pingedLanes,A=p&268435455;if(A!==0){var K=A&~w;K!==0?x=ea(K):(S&=A,S!==0&&(x=ea(S)))}else A=p&~w,A!==0?x=ea(A):S!==0&&(x=ea(S));if(x===0)return 0;if(d!==0&&d!==x&&(d&w)===0&&(w=x&-x,S=d&-d,w>=S||w===16&&(S&4194240)!==0))return d;if((x&4)!==0&&(x|=p&16),d=l.entangledLanes,d!==0)for(l=l.entanglements,d&=x;0p;p++)d.push(l);return d}function ta(l,d,p){l.pendingLanes|=d,d!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,d=31-qn(d),l[d]=p}function ja(l,d){var p=l.pendingLanes&~d;l.pendingLanes=d,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=d,l.mutableReadLanes&=d,l.entangledLanes&=d,d=l.entanglements;var x=l.eventTimes;for(l=l.expirationTimes;0=Gi),Nd=" ",wd=!1;function jd(l,d){switch(l){case"keyup":return yd.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kd(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var M=!1;function ee(l,d){switch(l){case"compositionend":return kd(d);case"keypress":return d.which!==32?null:(wd=!0,Nd);case"textInput":return l=d.data,l===Nd&&wd?null:l;default:return null}}function be(l,d){if(M)return l==="compositionend"||!bd&&jd(l,d)?(l=Aa(),na=si=nr=null,M=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1=d)return{node:p,offset:d-l};l=x}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=pb(p)}}function gb(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?gb(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function xb(){for(var l=window,d=Ue();d instanceof l.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)l=d.contentWindow;else break;d=Ue(l.document)}return d}function fm(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 Y4(l){var d=xb(),p=l.focusedElem,x=l.selectionRange;if(d!==p&&p&&p.ownerDocument&&gb(p.ownerDocument.documentElement,p)){if(x!==null&&fm(p)){if(d=x.start,l=x.end,l===void 0&&(l=d),"selectionStart"in p)p.selectionStart=d,p.selectionEnd=Math.min(l,p.value.length);else if(l=(d=p.ownerDocument||document)&&d.defaultView||window,l.getSelection){l=l.getSelection();var w=p.textContent.length,S=Math.min(x.start,w);x=x.end===void 0?S:Math.min(x.end,w),!l.extend&&S>x&&(w=x,x=S,S=w),w=mb(p,S);var A=mb(p,x);w&&A&&(l.rangeCount!==1||l.anchorNode!==w.node||l.anchorOffset!==w.offset||l.focusNode!==A.node||l.focusOffset!==A.offset)&&(d=d.createRange(),d.setStart(w.node,w.offset),l.removeAllRanges(),S>x?(l.addRange(d),l.extend(A.node,A.offset)):(d.setEnd(A.node,A.offset),l.addRange(d)))}}for(d=[],l=p;l=l.parentNode;)l.nodeType===1&&d.push({element:l,left:l.scrollLeft,top:l.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p=document.documentMode,cc=null,pm=null,Td=null,mm=!1;function yb(l,d,p){var x=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;mm||cc==null||cc!==Ue(x)||(x=cc,"selectionStart"in x&&fm(x)?x={start:x.selectionStart,end:x.selectionEnd}:(x=(x.ownerDocument&&x.ownerDocument.defaultView||window).getSelection(),x={anchorNode:x.anchorNode,anchorOffset:x.anchorOffset,focusNode:x.focusNode,focusOffset:x.focusOffset}),Td&&Ed(Td,x)||(Td=x,x=Yu(pm,"onSelect"),0pc||(l.current=Em[pc],Em[pc]=null,pc--)}function ln(l,d){pc++,Em[pc]=l.current,l.current=d}var Zi={},Es=Xi(Zi),sr=Xi(!1),hl=Zi;function mc(l,d){var p=l.type.contextTypes;if(!p)return Zi;var x=l.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===d)return x.__reactInternalMemoizedMaskedChildContext;var w={},S;for(S in p)w[S]=d[S];return x&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=d,l.__reactInternalMemoizedMaskedChildContext=w),w}function rr(l){return l=l.childContextTypes,l!=null}function th(){mn(sr),mn(Es)}function Rb(l,d,p){if(Es.current!==Zi)throw Error(n(168));ln(Es,d),ln(sr,p)}function Lb(l,d,p){var x=l.stateNode;if(d=d.childContextTypes,typeof x.getChildContext!="function")return p;x=x.getChildContext();for(var w in x)if(!(w in d))throw Error(n(108,q(l)||"Unknown",w));return X({},p,x)}function nh(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||Zi,hl=Es.current,ln(Es,l),ln(sr,sr.current),!0}function Ob(l,d,p){var x=l.stateNode;if(!x)throw Error(n(169));p?(l=Lb(l,d,hl),x.__reactInternalMemoizedMergedChildContext=l,mn(sr),mn(Es),ln(Es,l)):mn(sr),ln(sr,p)}var ci=null,sh=!1,Tm=!1;function Db(l){ci===null?ci=[l]:ci.push(l)}function cE(l){sh=!0,Db(l)}function eo(){if(!Tm&&ci!==null){Tm=!0;var l=0,d=lt;try{var p=ci;for(lt=1;l>=A,w-=A,di=1<<32-qn(d)+w|p<gt?(ls=dt,dt=null):ls=dt.sibling;var Ht=Ee(pe,dt,xe[gt],Le);if(Ht===null){dt===null&&(dt=ls);break}l&&dt&&Ht.alternate===null&&d(pe,dt),ae=S(Ht,ae,gt),ct===null?st=Ht:ct.sibling=Ht,ct=Ht,dt=ls}if(gt===xe.length)return p(pe,dt),bn&&pl(pe,gt),st;if(dt===null){for(;gtgt?(ls=dt,dt=null):ls=dt.sibling;var co=Ee(pe,dt,Ht.value,Le);if(co===null){dt===null&&(dt=ls);break}l&&dt&&co.alternate===null&&d(pe,dt),ae=S(co,ae,gt),ct===null?st=co:ct.sibling=co,ct=co,dt=ls}if(Ht.done)return p(pe,dt),bn&&pl(pe,gt),st;if(dt===null){for(;!Ht.done;gt++,Ht=xe.next())Ht=Pe(pe,Ht.value,Le),Ht!==null&&(ae=S(Ht,ae,gt),ct===null?st=Ht:ct.sibling=Ht,ct=Ht);return bn&&pl(pe,gt),st}for(dt=x(pe,dt);!Ht.done;gt++,Ht=xe.next())Ht=qe(dt,pe,gt,Ht.value,Le),Ht!==null&&(l&&Ht.alternate!==null&&dt.delete(Ht.key===null?gt:Ht.key),ae=S(Ht,ae,gt),ct===null?st=Ht:ct.sibling=Ht,ct=Ht);return l&&dt.forEach(function(HE){return d(pe,HE)}),bn&&pl(pe,gt),st}function _n(pe,ae,xe,Le){if(typeof xe=="object"&&xe!==null&&xe.type===P&&xe.key===null&&(xe=xe.props.children),typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case O:e:{for(var st=xe.key,ct=ae;ct!==null;){if(ct.key===st){if(st=xe.type,st===P){if(ct.tag===7){p(pe,ct.sibling),ae=w(ct,xe.props.children),ae.return=pe,pe=ae;break e}}else if(ct.elementType===st||typeof st=="object"&&st!==null&&st.$$typeof===I&&Vb(st)===ct.type){p(pe,ct.sibling),ae=w(ct,xe.props),ae.ref=Ld(pe,ct,xe),ae.return=pe,pe=ae;break e}p(pe,ct);break}else d(pe,ct);ct=ct.sibling}xe.type===P?(ae=wl(xe.props.children,pe.mode,Le,xe.key),ae.return=pe,pe=ae):(Le=Ih(xe.type,xe.key,xe.props,null,pe.mode,Le),Le.ref=Ld(pe,ae,xe),Le.return=pe,pe=Le)}return A(pe);case U:e:{for(ct=xe.key;ae!==null;){if(ae.key===ct)if(ae.tag===4&&ae.stateNode.containerInfo===xe.containerInfo&&ae.stateNode.implementation===xe.implementation){p(pe,ae.sibling),ae=w(ae,xe.children||[]),ae.return=pe,pe=ae;break e}else{p(pe,ae);break}else d(pe,ae);ae=ae.sibling}ae=Sg(xe,pe.mode,Le),ae.return=pe,pe=ae}return A(pe);case I:return ct=xe._init,_n(pe,ae,ct(xe._payload),Le)}if(fn(xe))return Ze(pe,ae,xe,Le);if(ge(xe))return nt(pe,ae,xe,Le);oh(pe,xe)}return typeof xe=="string"&&xe!==""||typeof xe=="number"?(xe=""+xe,ae!==null&&ae.tag===6?(p(pe,ae.sibling),ae=w(ae,xe),ae.return=pe,pe=ae):(p(pe,ae),ae=kg(xe,pe.mode,Le),ae.return=pe,pe=ae),A(pe)):p(pe,ae)}return _n}var bc=Hb(!0),Ub=Hb(!1),lh=Xi(null),ch=null,vc=null,Lm=null;function Om(){Lm=vc=ch=null}function Dm(l){var d=lh.current;mn(lh),l._currentValue=d}function _m(l,d,p){for(;l!==null;){var x=l.alternate;if((l.childLanes&d)!==d?(l.childLanes|=d,x!==null&&(x.childLanes|=d)):x!==null&&(x.childLanes&d)!==d&&(x.childLanes|=d),l===p)break;l=l.return}}function Nc(l,d){ch=l,Lm=vc=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(ar=!0),l.firstContext=null)}function $r(l){var d=l._currentValue;if(Lm!==l)if(l={context:l,memoizedValue:d,next:null},vc===null){if(ch===null)throw Error(n(308));vc=l,ch.dependencies={lanes:0,firstContext:l}}else vc=vc.next=l;return d}var ml=null;function $m(l){ml===null?ml=[l]:ml.push(l)}function Wb(l,d,p,x){var w=d.interleaved;return w===null?(p.next=p,$m(d)):(p.next=w.next,w.next=p),d.interleaved=p,hi(l,x)}function hi(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 to=!1;function zm(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Kb(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 fi(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function no(l,d,p){var x=l.updateQueue;if(x===null)return null;if(x=x.shared,(Bt&2)!==0){var w=x.pending;return w===null?d.next=d:(d.next=w.next,w.next=d),x.pending=d,hi(l,p)}return w=x.interleaved,w===null?(d.next=d,$m(x)):(d.next=w.next,w.next=d),x.interleaved=d,hi(l,p)}function dh(l,d,p){if(d=d.updateQueue,d!==null&&(d=d.shared,(p&4194240)!==0)){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,tl(l,p)}}function qb(l,d){var p=l.updateQueue,x=l.alternate;if(x!==null&&(x=x.updateQueue,p===x)){var w=null,S=null;if(p=p.firstBaseUpdate,p!==null){do{var A={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};S===null?w=S=A:S=S.next=A,p=p.next}while(p!==null);S===null?w=S=d:S=S.next=d}else w=S=d;p={baseState:x.baseState,firstBaseUpdate:w,lastBaseUpdate:S,shared:x.shared,effects:x.effects},l.updateQueue=p;return}l=p.lastBaseUpdate,l===null?p.firstBaseUpdate=d:l.next=d,p.lastBaseUpdate=d}function uh(l,d,p,x){var w=l.updateQueue;to=!1;var S=w.firstBaseUpdate,A=w.lastBaseUpdate,K=w.shared.pending;if(K!==null){w.shared.pending=null;var ne=K,ye=ne.next;ne.next=null,A===null?S=ye:A.next=ye,A=ne;var Ie=l.alternate;Ie!==null&&(Ie=Ie.updateQueue,K=Ie.lastBaseUpdate,K!==A&&(K===null?Ie.firstBaseUpdate=ye:K.next=ye,Ie.lastBaseUpdate=ne))}if(S!==null){var Pe=w.baseState;A=0,Ie=ye=ne=null,K=S;do{var Ee=K.lane,qe=K.eventTime;if((x&Ee)===Ee){Ie!==null&&(Ie=Ie.next={eventTime:qe,lane:0,tag:K.tag,payload:K.payload,callback:K.callback,next:null});e:{var Ze=l,nt=K;switch(Ee=d,qe=p,nt.tag){case 1:if(Ze=nt.payload,typeof Ze=="function"){Pe=Ze.call(qe,Pe,Ee);break e}Pe=Ze;break e;case 3:Ze.flags=Ze.flags&-65537|128;case 0:if(Ze=nt.payload,Ee=typeof Ze=="function"?Ze.call(qe,Pe,Ee):Ze,Ee==null)break e;Pe=X({},Pe,Ee);break e;case 2:to=!0}}K.callback!==null&&K.lane!==0&&(l.flags|=64,Ee=w.effects,Ee===null?w.effects=[K]:Ee.push(K))}else qe={eventTime:qe,lane:Ee,tag:K.tag,payload:K.payload,callback:K.callback,next:null},Ie===null?(ye=Ie=qe,ne=Pe):Ie=Ie.next=qe,A|=Ee;if(K=K.next,K===null){if(K=w.shared.pending,K===null)break;Ee=K,K=Ee.next,Ee.next=null,w.lastBaseUpdate=Ee,w.shared.pending=null}}while(!0);if(Ie===null&&(ne=Pe),w.baseState=ne,w.firstBaseUpdate=ye,w.lastBaseUpdate=Ie,d=w.shared.interleaved,d!==null){w=d;do A|=w.lane,w=w.next;while(w!==d)}else S===null&&(w.shared.lanes=0);yl|=A,l.lanes=A,l.memoizedState=Pe}}function Gb(l,d,p){if(l=d.effects,d.effects=null,l!==null)for(d=0;dp?p:4,l(!0);var x=Um.transition;Um.transition={};try{l(!1),d()}finally{lt=p,Um.transition=x}}function fv(){return zr().memoizedState}function fE(l,d,p){var x=io(l);if(p={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null},pv(l))mv(d,p);else if(p=Wb(l,d,p,x),p!==null){var w=Vs();ca(p,l,x,w),gv(p,d,x)}}function pE(l,d,p){var x=io(l),w={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null};if(pv(l))mv(d,w);else{var S=l.alternate;if(l.lanes===0&&(S===null||S.lanes===0)&&(S=d.lastRenderedReducer,S!==null))try{var A=d.lastRenderedState,K=S(A,p);if(w.hasEagerState=!0,w.eagerState=K,ra(K,A)){var ne=d.interleaved;ne===null?(w.next=w,$m(d)):(w.next=ne.next,ne.next=w),d.interleaved=w;return}}catch{}finally{}p=Wb(l,d,w,x),p!==null&&(w=Vs(),ca(p,l,x,w),gv(p,d,x))}}function pv(l){var d=l.alternate;return l===Sn||d!==null&&d===Sn}function mv(l,d){$d=ph=!0;var p=l.pending;p===null?d.next=d:(d.next=p.next,p.next=d),l.pending=d}function gv(l,d,p){if((p&4194240)!==0){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,tl(l,p)}}var xh={readContext:$r,useCallback:Ts,useContext:Ts,useEffect:Ts,useImperativeHandle:Ts,useInsertionEffect:Ts,useLayoutEffect:Ts,useMemo:Ts,useReducer:Ts,useRef:Ts,useState:Ts,useDebugValue:Ts,useDeferredValue:Ts,useTransition:Ts,useMutableSource:Ts,useSyncExternalStore:Ts,useId:Ts,unstable_isNewReconciler:!1},mE={readContext:$r,useCallback:function(l,d){return La().memoizedState=[l,d===void 0?null:d],l},useContext:$r,useEffect:av,useImperativeHandle:function(l,d,p){return p=p!=null?p.concat([l]):null,mh(4194308,4,lv.bind(null,d,l),p)},useLayoutEffect:function(l,d){return mh(4194308,4,l,d)},useInsertionEffect:function(l,d){return mh(4,2,l,d)},useMemo:function(l,d){var p=La();return d=d===void 0?null:d,l=l(),p.memoizedState=[l,d],l},useReducer:function(l,d,p){var x=La();return d=p!==void 0?p(d):d,x.memoizedState=x.baseState=d,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:d},x.queue=l,l=l.dispatch=fE.bind(null,Sn,l),[x.memoizedState,l]},useRef:function(l){var d=La();return l={current:l},d.memoizedState=l},useState:sv,useDebugValue:Ym,useDeferredValue:function(l){return La().memoizedState=l},useTransition:function(){var l=sv(!1),d=l[0];return l=hE.bind(null,l[1]),La().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,p){var x=Sn,w=La();if(bn){if(p===void 0)throw Error(n(407));p=p()}else{if(p=d(),is===null)throw Error(n(349));(xl&30)!==0||Xb(x,d,p)}w.memoizedState=p;var S={value:p,getSnapshot:d};return w.queue=S,av(ev.bind(null,x,S,l),[l]),x.flags|=2048,Bd(9,Zb.bind(null,x,S,p,d),void 0,null),p},useId:function(){var l=La(),d=is.identifierPrefix;if(bn){var p=ui,x=di;p=(x&~(1<<32-qn(x)-1)).toString(32)+p,d=":"+d+"R"+p,p=zd++,0<\/script>",l=l.removeChild(l.firstChild)):typeof x.is=="string"?l=A.createElement(p,{is:x.is}):(l=A.createElement(p),p==="select"&&(A=l,x.multiple?A.multiple=!0:x.size&&(A.size=x.size))):l=A.createElementNS(l,p),l[Pa]=d,l[Pd]=x,Dv(l,d,!1,!1),d.stateNode=l;e:{switch(A=vt(p,x),p){case"dialog":pn("cancel",l),pn("close",l),w=x;break;case"iframe":case"object":case"embed":pn("load",l),w=x;break;case"video":case"audio":for(w=0;wCc&&(d.flags|=128,x=!0,Vd(S,!1),d.lanes=4194304)}else{if(!x)if(l=hh(A),l!==null){if(d.flags|=128,x=!0,p=l.updateQueue,p!==null&&(d.updateQueue=p,d.flags|=4),Vd(S,!0),S.tail===null&&S.tailMode==="hidden"&&!A.alternate&&!bn)return Ms(d),null}else 2*nn()-S.renderingStartTime>Cc&&p!==1073741824&&(d.flags|=128,x=!0,Vd(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=nn(),d.sibling=null,p=kn.current,ln(kn,x?p&1|2:p&1),d):(Ms(d),null);case 22:case 23:return Ng(),x=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==x&&(d.flags|=8192),x&&(d.mode&1)!==0?(wr&1073741824)!==0&&(Ms(d),d.subtreeFlags&6&&(d.flags|=8192)):Ms(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function jE(l,d){switch(Am(d),d.tag){case 1:return rr(d.type)&&th(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return wc(),mn(sr),mn(Es),Hm(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return Bm(d),null;case 13:if(mn(kn),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));yc()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return mn(kn),null;case 4:return wc(),null;case 10:return Dm(d.type._context),null;case 22:case 23:return Ng(),null;case 24:return null;default:return null}}var Nh=!1,As=!1,kE=typeof WeakSet=="function"?WeakSet:Set,Ye=null;function kc(l,d){var p=l.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(x){Mn(l,d,x)}else p.current=null}function cg(l,d,p){try{p()}catch(x){Mn(l,d,x)}}var zv=!1;function SE(l,d){if(Nm=tr,l=xb(),fm(l)){if("selectionStart"in l)var p={start:l.selectionStart,end:l.selectionEnd};else e:{p=(p=l.ownerDocument)&&p.defaultView||window;var x=p.getSelection&&p.getSelection();if(x&&x.rangeCount!==0){p=x.anchorNode;var w=x.anchorOffset,S=x.focusNode;x=x.focusOffset;try{p.nodeType,S.nodeType}catch{p=null;break e}var A=0,K=-1,ne=-1,ye=0,Ie=0,Pe=l,Ee=null;t:for(;;){for(var qe;Pe!==p||w!==0&&Pe.nodeType!==3||(K=A+w),Pe!==S||x!==0&&Pe.nodeType!==3||(ne=A+x),Pe.nodeType===3&&(A+=Pe.nodeValue.length),(qe=Pe.firstChild)!==null;)Ee=Pe,Pe=qe;for(;;){if(Pe===l)break t;if(Ee===p&&++ye===w&&(K=A),Ee===S&&++Ie===x&&(ne=A),(qe=Pe.nextSibling)!==null)break;Pe=Ee,Ee=Pe.parentNode}Pe=qe}p=K===-1||ne===-1?null:{start:K,end:ne}}else p=null}p=p||{start:0,end:0}}else p=null;for(wm={focusedElem:l,selectionRange:p},tr=!1,Ye=d;Ye!==null;)if(d=Ye,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,Ye=l;else for(;Ye!==null;){d=Ye;try{var Ze=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(Ze!==null){var nt=Ze.memoizedProps,_n=Ze.memoizedState,pe=d.stateNode,ae=pe.getSnapshotBeforeUpdate(d.elementType===d.type?nt:ia(d.type,nt),_n);pe.__reactInternalSnapshotBeforeUpdate=ae}break;case 3:var xe=d.stateNode.containerInfo;xe.nodeType===1?xe.textContent="":xe.nodeType===9&&xe.documentElement&&xe.removeChild(xe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Le){Mn(d,d.return,Le)}if(l=d.sibling,l!==null){l.return=d.return,Ye=l;break}Ye=d.return}return Ze=zv,zv=!1,Ze}function Hd(l,d,p){var x=d.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var w=x=x.next;do{if((w.tag&l)===l){var S=w.destroy;w.destroy=void 0,S!==void 0&&cg(d,p,S)}w=w.next}while(w!==x)}}function wh(l,d){if(d=d.updateQueue,d=d!==null?d.lastEffect:null,d!==null){var p=d=d.next;do{if((p.tag&l)===l){var x=p.create;p.destroy=x()}p=p.next}while(p!==d)}}function dg(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 Fv(l){var d=l.alternate;d!==null&&(l.alternate=null,Fv(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[Pa],delete d[Pd],delete d[Cm],delete d[oE],delete d[lE])),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 Bv(l){return l.tag===5||l.tag===3||l.tag===4}function Vv(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||Bv(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 ug(l,d,p){var x=l.tag;if(x===5||x===6)l=l.stateNode,d?p.nodeType===8?p.parentNode.insertBefore(l,d):p.insertBefore(l,d):(p.nodeType===8?(d=p.parentNode,d.insertBefore(l,p)):(d=p,d.appendChild(l)),p=p._reactRootContainer,p!=null||d.onclick!==null||(d.onclick=Zu));else if(x!==4&&(l=l.child,l!==null))for(ug(l,d,p),l=l.sibling;l!==null;)ug(l,d,p),l=l.sibling}function hg(l,d,p){var x=l.tag;if(x===5||x===6)l=l.stateNode,d?p.insertBefore(l,d):p.appendChild(l);else if(x!==4&&(l=l.child,l!==null))for(hg(l,d,p),l=l.sibling;l!==null;)hg(l,d,p),l=l.sibling}var bs=null,oa=!1;function so(l,d,p){for(p=p.child;p!==null;)Hv(l,d,p),p=p.sibling}function Hv(l,d,p){if($s&&typeof $s.onCommitFiberUnmount=="function")try{$s.onCommitFiberUnmount(Qs,p)}catch{}switch(p.tag){case 5:As||kc(p,d);case 6:var x=bs,w=oa;bs=null,so(l,d,p),bs=x,oa=w,bs!==null&&(oa?(l=bs,p=p.stateNode,l.nodeType===8?l.parentNode.removeChild(p):l.removeChild(p)):bs.removeChild(p.stateNode));break;case 18:bs!==null&&(oa?(l=bs,p=p.stateNode,l.nodeType===8?Sm(l.parentNode,p):l.nodeType===1&&Sm(l,p),er(l)):Sm(bs,p.stateNode));break;case 4:x=bs,w=oa,bs=p.stateNode.containerInfo,oa=!0,so(l,d,p),bs=x,oa=w;break;case 0:case 11:case 14:case 15:if(!As&&(x=p.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){w=x=x.next;do{var S=w,A=S.destroy;S=S.tag,A!==void 0&&((S&2)!==0||(S&4)!==0)&&cg(p,d,A),w=w.next}while(w!==x)}so(l,d,p);break;case 1:if(!As&&(kc(p,d),x=p.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=p.memoizedProps,x.state=p.memoizedState,x.componentWillUnmount()}catch(K){Mn(p,d,K)}so(l,d,p);break;case 21:so(l,d,p);break;case 22:p.mode&1?(As=(x=As)||p.memoizedState!==null,so(l,d,p),As=x):so(l,d,p);break;default:so(l,d,p)}}function Uv(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var p=l.stateNode;p===null&&(p=l.stateNode=new kE),d.forEach(function(x){var w=LE.bind(null,l,x);p.has(x)||(p.add(x),x.then(w,w))})}}function la(l,d){var p=d.deletions;if(p!==null)for(var x=0;xw&&(w=A),x&=~S}if(x=w,x=nn()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*EE(x/1960))-x,10l?16:l,ao===null)var x=!1;else{if(l=ao,ao=null,Eh=0,(Bt&6)!==0)throw Error(n(331));var w=Bt;for(Bt|=4,Ye=l.current;Ye!==null;){var S=Ye,A=S.child;if((Ye.flags&16)!==0){var K=S.deletions;if(K!==null){for(var ne=0;nenn()-mg?vl(l,0):pg|=p),or(l,d)}function s1(l,d){d===0&&((l.mode&1)===0?d=1:(d=zs,zs<<=1,(zs&130023424)===0&&(zs=4194304)));var p=Vs();l=hi(l,d),l!==null&&(ta(l,d,p),or(l,p))}function RE(l){var d=l.memoizedState,p=0;d!==null&&(p=d.retryLane),s1(l,p)}function LE(l,d){var p=0;switch(l.tag){case 13:var x=l.stateNode,w=l.memoizedState;w!==null&&(p=w.retryLane);break;case 19:x=l.stateNode;break;default:throw Error(n(314))}x!==null&&x.delete(d),s1(l,p)}var r1;r1=function(l,d,p){if(l!==null)if(l.memoizedProps!==d.pendingProps||sr.current)ar=!0;else{if((l.lanes&p)===0&&(d.flags&128)===0)return ar=!1,NE(l,d,p);ar=(l.flags&131072)!==0}else ar=!1,bn&&(d.flags&1048576)!==0&&_b(d,ah,d.index);switch(d.lanes=0,d.tag){case 2:var x=d.type;vh(l,d),l=d.pendingProps;var w=mc(d,Es.current);Nc(d,p),w=Km(null,d,x,l,w,p);var S=qm();return d.flags|=1,typeof w=="object"&&w!==null&&typeof w.render=="function"&&w.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,rr(x)?(S=!0,nh(d)):S=!1,d.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,zm(d),w.updater=yh,d.stateNode=w,w._reactInternals=d,Zm(d,x,l,p),d=sg(null,d,x,!0,S,p)):(d.tag=0,bn&&S&&Mm(d),Bs(null,d,w,p),d=d.child),d;case 16:x=d.elementType;e:{switch(vh(l,d),l=d.pendingProps,w=x._init,x=w(x._payload),d.type=x,w=d.tag=DE(x),l=ia(x,l),w){case 0:d=ng(null,d,x,l,p);break e;case 1:d=Av(null,d,x,l,p);break e;case 11:d=Sv(null,d,x,l,p);break e;case 14:d=Cv(null,d,x,ia(x.type,l),p);break e}throw Error(n(306,x,""))}return d;case 0:return x=d.type,w=d.pendingProps,w=d.elementType===x?w:ia(x,w),ng(l,d,x,w,p);case 1:return x=d.type,w=d.pendingProps,w=d.elementType===x?w:ia(x,w),Av(l,d,x,w,p);case 3:e:{if(Iv(d),l===null)throw Error(n(387));x=d.pendingProps,S=d.memoizedState,w=S.element,Kb(l,d),uh(d,x,null,p);var A=d.memoizedState;if(x=A.element,S.isDehydrated)if(S={element:x,isDehydrated:!1,cache:A.cache,pendingSuspenseBoundaries:A.pendingSuspenseBoundaries,transitions:A.transitions},d.updateQueue.baseState=S,d.memoizedState=S,d.flags&256){w=jc(Error(n(423)),d),d=Pv(l,d,x,p,w);break e}else if(x!==w){w=jc(Error(n(424)),d),d=Pv(l,d,x,p,w);break e}else for(Nr=Yi(d.stateNode.containerInfo.firstChild),vr=d,bn=!0,aa=null,p=Ub(d,null,x,p),d.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(yc(),x===w){d=pi(l,d,p);break e}Bs(l,d,x,p)}d=d.child}return d;case 5:return Jb(d),l===null&&Pm(d),x=d.type,w=d.pendingProps,S=l!==null?l.memoizedProps:null,A=w.children,jm(x,w)?A=null:S!==null&&jm(x,S)&&(d.flags|=32),Mv(l,d),Bs(l,d,A,p),d.child;case 6:return l===null&&Pm(d),null;case 13:return Rv(l,d,p);case 4:return Fm(d,d.stateNode.containerInfo),x=d.pendingProps,l===null?d.child=bc(d,null,x,p):Bs(l,d,x,p),d.child;case 11:return x=d.type,w=d.pendingProps,w=d.elementType===x?w:ia(x,w),Sv(l,d,x,w,p);case 7:return Bs(l,d,d.pendingProps,p),d.child;case 8:return Bs(l,d,d.pendingProps.children,p),d.child;case 12:return Bs(l,d,d.pendingProps.children,p),d.child;case 10:e:{if(x=d.type._context,w=d.pendingProps,S=d.memoizedProps,A=w.value,ln(lh,x._currentValue),x._currentValue=A,S!==null)if(ra(S.value,A)){if(S.children===w.children&&!sr.current){d=pi(l,d,p);break e}}else for(S=d.child,S!==null&&(S.return=d);S!==null;){var K=S.dependencies;if(K!==null){A=S.child;for(var ne=K.firstContext;ne!==null;){if(ne.context===x){if(S.tag===1){ne=fi(-1,p&-p),ne.tag=2;var ye=S.updateQueue;if(ye!==null){ye=ye.shared;var Ie=ye.pending;Ie===null?ne.next=ne:(ne.next=Ie.next,Ie.next=ne),ye.pending=ne}}S.lanes|=p,ne=S.alternate,ne!==null&&(ne.lanes|=p),_m(S.return,p,d),K.lanes|=p;break}ne=ne.next}}else if(S.tag===10)A=S.type===d.type?null:S.child;else if(S.tag===18){if(A=S.return,A===null)throw Error(n(341));A.lanes|=p,K=A.alternate,K!==null&&(K.lanes|=p),_m(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}Bs(l,d,w.children,p),d=d.child}return d;case 9:return w=d.type,x=d.pendingProps.children,Nc(d,p),w=$r(w),x=x(w),d.flags|=1,Bs(l,d,x,p),d.child;case 14:return x=d.type,w=ia(x,d.pendingProps),w=ia(x.type,w),Cv(l,d,x,w,p);case 15:return Ev(l,d,d.type,d.pendingProps,p);case 17:return x=d.type,w=d.pendingProps,w=d.elementType===x?w:ia(x,w),vh(l,d),d.tag=1,rr(x)?(l=!0,nh(d)):l=!1,Nc(d,p),yv(d,x,w),Zm(d,x,w,p),sg(null,d,x,!0,l,p);case 19:return Ov(l,d,p);case 22:return Tv(l,d,p)}throw Error(n(156,d.tag))};function a1(l,d){return zi(l,d)}function OE(l,d,p,x){this.tag=l,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Br(l,d,p,x){return new OE(l,d,p,x)}function jg(l){return l=l.prototype,!(!l||!l.isReactComponent)}function DE(l){if(typeof l=="function")return jg(l)?1:0;if(l!=null){if(l=l.$$typeof,l===$)return 11;if(l===me)return 14}return 2}function lo(l,d){var p=l.alternate;return p===null?(p=Br(l.tag,d,l.key,l.mode),p.elementType=l.elementType,p.type=l.type,p.stateNode=l.stateNode,p.alternate=l,l.alternate=p):(p.pendingProps=d,p.type=l.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=l.flags&14680064,p.childLanes=l.childLanes,p.lanes=l.lanes,p.child=l.child,p.memoizedProps=l.memoizedProps,p.memoizedState=l.memoizedState,p.updateQueue=l.updateQueue,d=l.dependencies,p.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},p.sibling=l.sibling,p.index=l.index,p.ref=l.ref,p}function Ih(l,d,p,x,w,S){var A=2;if(x=l,typeof l=="function")jg(l)&&(A=1);else if(typeof l=="string")A=5;else e:switch(l){case P:return wl(p.children,w,S,d);case z:A=8,w|=8;break;case L:return l=Br(12,p,d,w|2),l.elementType=L,l.lanes=S,l;case ie:return l=Br(13,p,d,w),l.elementType=ie,l.lanes=S,l;case le:return l=Br(19,p,d,w),l.elementType=le,l.lanes=S,l;case Y:return Ph(p,w,S,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case Q:A=10;break e;case se:A=9;break e;case $:A=11;break e;case me:A=14;break e;case I:A=16,x=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=Br(A,p,d,w),d.elementType=l,d.type=x,d.lanes=S,d}function wl(l,d,p,x){return l=Br(7,l,x,d),l.lanes=p,l}function Ph(l,d,p,x){return l=Br(22,l,x,d),l.elementType=Y,l.lanes=p,l.stateNode={isHidden:!1},l}function kg(l,d,p){return l=Br(6,l,null,d),l.lanes=p,l}function Sg(l,d,p){return d=Br(4,l.children!==null?l.children:[],l.key,d),d.lanes=p,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function _E(l,d,p,x,w){this.tag=d,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Hi(0),this.expirationTimes=Hi(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Hi(0),this.identifierPrefix=x,this.onRecoverableError=w,this.mutableSourceEagerHydrationData=null}function Cg(l,d,p,x,w,S,A,K,ne){return l=new _E(l,d,p,K,ne),d===1?(d=1,S===!0&&(d|=8)):d=0,S=Br(3,null,null,d),l.current=S,S.stateNode=l,S.memoizedState={element:x,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},zm(S),l}function $E(l,d,p){var x=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Pg.exports=QE(),Pg.exports}var b1;function YE(){if(b1)return zh;b1=1;var t=Dj();return zh.createRoot=t.createRoot,zh.hydrateRoot=t.hydrateRoot,zh}var XE=YE(),id=Dj();const _j=Oj(id);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @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 -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */function wu(){return wu=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function q0(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function nT(){return Math.random().toString(36).substr(2,8)}function j1(t,e){return{usr:t.state,key:t.key,idx:e}}function Lx(t,e,n,r){return n===void 0&&(n=null),wu({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?ld(e):e,{state:n,key:e&&e.key||r||nT()})}function Cf(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 ld(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 sT(t,e,n,r){r===void 0&&(r={});let{window:a=document.defaultView,v5Compat:i=!1}=r,o=a.history,c=So.Pop,u=null,h=f();h==null&&(h=0,o.replaceState(wu({},o.state,{idx:h}),""));function f(){return(o.state||{idx:null}).idx}function m(){c=So.Pop;let v=f(),k=v==null?null:v-h;h=v,u&&u({action:c,location:j.location,delta:k})}function g(v,k){c=So.Push;let T=Lx(j.location,v,k);h=f()+1;let C=j1(T,h),R=j.createHref(T);try{o.pushState(C,"",R)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;a.location.assign(R)}i&&u&&u({action:c,location:j.location,delta:1})}function b(v,k){c=So.Replace;let T=Lx(j.location,v,k);h=f();let C=j1(T,h),R=j.createHref(T);o.replaceState(C,"",R),i&&u&&u({action:c,location:j.location,delta:0})}function N(v){let k=a.location.origin!=="null"?a.location.origin:a.location.href,T=typeof v=="string"?v:Cf(v);return T=T.replace(/ $/,"%20"),Bn(k,"No window.location.(origin|href) available to create URL for href: "+T),new URL(T,k)}let j={get action(){return c},get location(){return t(a,o)},listen(v){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(w1,m),u=v,()=>{a.removeEventListener(w1,m),u=null}},createHref(v){return e(a,v)},createURL:N,encodeLocation(v){let k=N(v);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:g,replace:b,go(v){return o.go(v)}};return j}var k1;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(k1||(k1={}));function rT(t,e,n){return n===void 0&&(n="/"),aT(t,e,n)}function aT(t,e,n,r){let a=typeof e=="string"?ld(e):e,i=G0(a.pathname||"/",n);if(i==null)return null;let o=Fj(t);iT(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("/")&&(Bn(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&&(Bn(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+h+'".')),Fj(i.children,e,f,h)),!(i.path==null&&!i.index)&&e.push({path:h,score:fT(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 Bj(i.path))a(i,o,u)}),e}function Bj(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=Bj(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 iT(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:pT(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const oT=/^:[\w-]+$/,lT=3,cT=2,dT=1,uT=10,hT=-2,S1=t=>t==="*";function fT(t,e){let n=t.split("/"),r=n.length;return n.some(S1)&&(r+=hT),e&&(r+=cT),n.filter(a=>!S1(a)).reduce((a,i)=>a+(oT.test(i)?lT:i===""?dT:uT),r)}function pT(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 mT(t,e,n){let{routesMeta:r}=t,a={},i="/",o=[];for(let c=0;c{let{paramName:g,isOptional:b}=f;if(g==="*"){let j=c[m]||"";o=i.slice(0,i.length-j.length).replace(/(.)\/+$/,"$1")}const N=c[m];return b&&!N?h[g]=void 0:h[g]=(N||"").replace(/%2F/g,"/"),h},{}),pathname:i,pathnameBase:o,pattern:t}}function xT(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),q0(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 yT(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return q0(!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 G0(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 bT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,vT=t=>bT.test(t);function NT(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:a=""}=typeof t=="string"?ld(t):t,i;if(n)if(vT(n))i=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),q0(!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:kT(r),hash:ST(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 Dg(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 wT(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function J0(t,e){let n=wT(t);return e?n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Q0(t,e,n,r){r===void 0&&(r=!1);let a;typeof t=="string"?a=ld(t):(a=wu({},t),Bn(!a.pathname||!a.pathname.includes("?"),Dg("?","pathname","search",a)),Bn(!a.pathname||!a.pathname.includes("#"),Dg("#","pathname","hash",a)),Bn(!a.search||!a.search.includes("#"),Dg("#","search","hash",a)));let i=t===""||a.pathname==="",o=i?"/":a.pathname,c;if(o==null)c=n;else{let m=e.length-1;if(!r&&o.startsWith("..")){let g=o.split("/");for(;g[0]==="..";)g.shift(),m-=1;a.pathname=g.join("/")}c=m>=0?e[m]:"/"}let u=NT(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,"/"),jT=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),kT=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,ST=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function CT(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Vj=["post","put","patch","delete"];new Set(Vj);const ET=["get",...Vj];new Set(ET);/** -======== - */function Nu(){return Nu=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 eT(){return Math.random().toString(36).substr(2,8)}function N1(t,e){return{usr:t.state,key:t.key,idx:e}}function Rx(t,e,n,r){return n===void 0&&(n=null),Nu({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?od(e):e,{state:n,key:e&&e.key||r||eT()})}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 od(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 tT(t,e,n,r){r===void 0&&(r={});let{window:a=document.defaultView,v5Compat:i=!1}=r,o=a.history,c=ko.Pop,u=null,h=f();h==null&&(h=0,o.replaceState(Nu({},o.state,{idx:h}),""));function f(){return(o.state||{idx:null}).idx}function m(){c=ko.Pop;let v=f(),k=v==null?null:v-h;h=v,u&&u({action:c,location:j.location,delta:k})}function g(v,k){c=ko.Push;let T=Rx(j.location,v,k);h=f()+1;let C=N1(T,h),R=j.createHref(T);try{o.pushState(C,"",R)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;a.location.assign(R)}i&&u&&u({action:c,location:j.location,delta:1})}function b(v,k){c=ko.Replace;let T=Rx(j.location,v,k);h=f();let C=N1(T,h),R=j.createHref(T);o.replaceState(C,"",R),i&&u&&u({action:c,location:j.location,delta:0})}function N(v){let k=a.location.origin!=="null"?a.location.origin:a.location.href,T=typeof v=="string"?v:Sf(v);return T=T.replace(/ $/,"%20"),zn(k,"No window.location.(origin|href) available to create URL for href: "+T),new URL(T,k)}let j={get action(){return c},get location(){return t(a,o)},listen(v){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(v1,m),u=v,()=>{a.removeEventListener(v1,m),u=null}},createHref(v){return e(a,v)},createURL:N,encodeLocation(v){let k=N(v);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:g,replace:b,go(v){return o.go(v)}};return j}var w1;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(w1||(w1={}));function nT(t,e,n){return n===void 0&&(n="/"),sT(t,e,n)}function sT(t,e,n,r){let a=typeof e=="string"?od(e):e,i=K0(a.pathname||"/",n);if(i==null)return null;let o=$j(t);rT(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=Ao([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+'".')),$j(i.children,e,f,h)),!(i.path==null&&!i.index)&&e.push({path:h,score:uT(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 zj(i.path))a(i,o,u)}),e}function zj(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=zj(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 rT(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:hT(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const aT=/^:[\w-]+$/,iT=3,oT=2,lT=1,cT=10,dT=-2,j1=t=>t==="*";function uT(t,e){let n=t.split("/"),r=n.length;return n.some(j1)&&(r+=dT),e&&(r+=oT),n.filter(a=>!j1(a)).reduce((a,i)=>a+(aT.test(i)?iT:i===""?lT:cT),r)}function hT(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 fT(t,e,n){let{routesMeta:r}=t,a={},i="/",o=[];for(let c=0;c{let{paramName:g,isOptional:b}=f;if(g==="*"){let j=c[m]||"";o=i.slice(0,i.length-j.length).replace(/(.)\/+$/,"$1")}const N=c[m];return b&&!N?h[g]=void 0:h[g]=(N||"").replace(/%2F/g,"/"),h},{}),pathname:i,pathnameBase:o,pattern:t}}function mT(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 gT(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 K0(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 xT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,yT=t=>xT.test(t);function bT(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:a=""}=typeof t=="string"?od(t):t,i;if(n)if(yT(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=k1(n.substring(1),"/"):i=k1(n,e)}else i=e;return{pathname:i,search:wT(r),hash:jT(a)}}function k1(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 Og(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 vT(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function q0(t,e){let n=vT(t);return e?n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function G0(t,e,n,r){r===void 0&&(r=!1);let a;typeof t=="string"?a=od(t):(a=Nu({},t),zn(!a.pathname||!a.pathname.includes("?"),Og("?","pathname","search",a)),zn(!a.pathname||!a.pathname.includes("#"),Og("#","pathname","hash",a)),zn(!a.search||!a.search.includes("#"),Og("#","search","hash",a)));let i=t===""||a.pathname==="",o=i?"/":a.pathname,c;if(o==null)c=n;else{let m=e.length-1;if(!r&&o.startsWith("..")){let g=o.split("/");for(;g[0]==="..";)g.shift(),m-=1;a.pathname=g.join("/")}c=m>=0?e[m]:"/"}let u=bT(a,c),h=o&&o!=="/"&&o.endsWith("/"),f=(i||o===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(h||f)&&(u.pathname+="/"),u}const Ao=t=>t.join("/").replace(/\/\/+/g,"/"),NT=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),wT=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,jT=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function kT(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Fj=["post","put","patch","delete"];new Set(Fj);const ST=["get",...Fj];new Set(ST);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * 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 -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */function ju(){return ju=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=Q0(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 PT=y.createContext(null);function IT(t){let e=y.useContext($i).outlet;return e&&y.createElement(PT.Provider,{value:t},e)}function Wj(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=y.useContext(Uo),{matches:a}=y.useContext($i),{pathname:i}=Wo(),o=JSON.stringify(J0(a,r.v7_relativeSplatPath));return y.useMemo(()=>Q0(t,JSON.parse(o),i,n==="path"),[t,o,i,n])}function RT(t,e){return LT(t,e)}function LT(t,e,n,r){cd()||Bn(!1);let{navigator:a}=y.useContext(Uo),{matches:i}=y.useContext($i),o=i[i.length-1],c=o?o.params:{};o&&o.pathname;let u=o?o.pathnameBase:"/";o&&o.route;let h=Wo(),f;if(e){var m;let v=typeof e=="string"?ld(e):e;u==="/"||(m=v.pathname)!=null&&m.startsWith(u)||Bn(!1),f=v}else f=h;let g=f.pathname||"/",b=g;if(u!=="/"){let v=u.replace(/^\//,"").split("/");b="/"+g.replace(/^\//,"").split("/").slice(v.length).join("/")}let N=rT(t,{pathname:b}),j=zT(N&&N.map(v=>Object.assign({},v,{params:Object.assign({},c,v.params),pathname:Po([u,a.encodeLocation?a.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?u:Po([u,a.encodeLocation?a.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),i,n,r);return e&&j?y.createElement(Ap.Provider,{value:{location:ju({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:So.Pop}},j):j}function OT(){let t=HT(),e=CT(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 DT=y.createElement(OT,null);class _T 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($i.Provider,{value:this.props.routeContext},y.createElement(Hj.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function $T(t){let{routeContext:e,match:n,children:r}=t,a=y.useContext(Y0);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),y.createElement($i.Provider,{value:e},r)}function zT(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||Bn(!1),o=o.slice(0,Math.min(o.length,f+1))}let u=!1,h=-1;if(n&&r&&r.v7_partialHydration)for(let f=0;f=0?o=o.slice(0,h+1):o=[o[0]];break}}}return o.reduceRight((f,m,g)=>{let b,N=!1,j=null,v=null;n&&(b=c&&m.route.id?c[m.route.id]:void 0,j=m.route.errorElement||DT,u&&(h<0&&g===0?(WT("route-fallback"),N=!0,v=null):h===g&&(N=!0,v=m.route.hydrateFallbackElement||null)));let k=e.concat(o.slice(0,g+1)),T=()=>{let C;return b?C=j:N?C=v:m.route.Component?C=y.createElement(m.route.Component,null):m.route.element?C=m.route.element:C=f,y.createElement($T,{match:m,routeContext:{outlet:f,matches:k,isDataRoute:n!=null},children:C})};return n&&(m.route.ErrorBoundary||m.route.errorElement||g===0)?y.createElement(_T,{location:n.location,revalidation:n.revalidation,component:j,error:b,children:T(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):T()},null)}var Kj=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(Kj||{}),qj=(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})(qj||{});function FT(t){let e=y.useContext(Y0);return e||Bn(!1),e}function BT(t){let e=y.useContext(TT);return e||Bn(!1),e}function VT(t){let e=y.useContext($i);return e||Bn(!1),e}function Gj(t){let e=VT(),n=e.matches[e.matches.length-1];return n.route.id||Bn(!1),n.route.id}function HT(){var t;let e=y.useContext(Hj),n=BT(),r=Gj();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function UT(){let{router:t}=FT(Kj.UseNavigateStable),e=Gj(qj.UseNavigateStable),n=y.useRef(!1);return Uj(()=>{n.current=!0}),y.useCallback(function(a,i){i===void 0&&(i={}),n.current&&(typeof a=="number"?t.navigate(a):t.navigate(a,ju({fromRouteId:e},i)))},[t,e])}const E1={};function WT(t,e,n){E1[t]||(E1[t]=!0)}function KT(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;cd()||Bn(!1);let{future:i,static:o}=y.useContext(Uo),{matches:c}=y.useContext($i),{pathname:u}=Wo(),h=qa(),f=Q0(e,J0(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 qT(t){return IT(t.context)}function cn(t){Bn(!1)}function GT(t){let{basename:e="/",children:n=null,location:r,navigationType:a=So.Pop,navigator:i,static:o=!1,future:c}=t;cd()&&Bn(!1);let u=e.replace(/^\/*/,"/"),h=y.useMemo(()=>({basename:u,navigator:i,static:o,future:ju({v7_relativeSplatPath:!1},c)}),[u,c,i,o]);typeof r=="string"&&(r=ld(r));let{pathname:f="/",search:m="",hash:g="",state:b=null,key:N="default"}=r,j=y.useMemo(()=>{let v=G0(f,u);return v==null?null:{location:{pathname:v,search:m,hash:g,state:b,key:N},navigationType:a}},[u,f,m,g,b,N,a]);return j==null?null:y.createElement(Uo.Provider,{value:h},y.createElement(Ap.Provider,{children:n,value:j}))}function JT(t){let{children:e,location:n}=t;return RT(Ox(e),n)}new Promise(()=>{});function Ox(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,Ox(r.props.children,i));return}r.type!==cn&&Bn(!1),!r.props.index||!r.props.children||Bn(!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=Ox(r.props.children,i)),n.push(o)}),n}/** -======== - */function wu(){return wu=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=G0(h,JSON.parse(o),i,f.relative==="path");t==null&&e!=="/"&&(m.pathname=m.pathname==="/"?e:Ao([e,m.pathname])),(f.replace?r.replace:r.push)(m,f.state,f)},[e,r,o,i,t])}const MT=y.createContext(null);function AT(t){let e=y.useContext(_i).outlet;return e&&y.createElement(MT.Provider,{value:t},e)}function Hj(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=y.useContext(Ho),{matches:a}=y.useContext(_i),{pathname:i}=Uo(),o=JSON.stringify(q0(a,r.v7_relativeSplatPath));return y.useMemo(()=>G0(t,JSON.parse(o),i,n==="path"),[t,o,i,n])}function IT(t,e){return PT(t,e)}function PT(t,e,n,r){ld()||zn(!1);let{navigator:a}=y.useContext(Ho),{matches:i}=y.useContext(_i),o=i[i.length-1],c=o?o.params:{};o&&o.pathname;let u=o?o.pathnameBase:"/";o&&o.route;let h=Uo(),f;if(e){var m;let v=typeof e=="string"?od(e):e;u==="/"||(m=v.pathname)!=null&&m.startsWith(u)||zn(!1),f=v}else f=h;let g=f.pathname||"/",b=g;if(u!=="/"){let v=u.replace(/^\//,"").split("/");b="/"+g.replace(/^\//,"").split("/").slice(v.length).join("/")}let N=nT(t,{pathname:b}),j=_T(N&&N.map(v=>Object.assign({},v,{params:Object.assign({},c,v.params),pathname:Ao([u,a.encodeLocation?a.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?u:Ao([u,a.encodeLocation?a.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),i,n,r);return e&&j?y.createElement(Mp.Provider,{value:{location:wu({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:ko.Pop}},j):j}function RT(){let t=BT(),e=kT(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 LT=y.createElement(RT,null);class OT 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(_i.Provider,{value:this.props.routeContext},y.createElement(Bj.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function DT(t){let{routeContext:e,match:n,children:r}=t,a=y.useContext(J0);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),y.createElement(_i.Provider,{value:e},r)}function _T(t,e,n,r){var a;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var i;if(!n)return null;if(n.errors)t=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,c=(a=n)==null?void 0:a.errors;if(c!=null){let f=o.findIndex(m=>m.route.id&&(c==null?void 0:c[m.route.id])!==void 0);f>=0||zn(!1),o=o.slice(0,Math.min(o.length,f+1))}let u=!1,h=-1;if(n&&r&&r.v7_partialHydration)for(let f=0;f=0?o=o.slice(0,h+1):o=[o[0]];break}}}return o.reduceRight((f,m,g)=>{let b,N=!1,j=null,v=null;n&&(b=c&&m.route.id?c[m.route.id]:void 0,j=m.route.errorElement||LT,u&&(h<0&&g===0?(HT("route-fallback"),N=!0,v=null):h===g&&(N=!0,v=m.route.hydrateFallbackElement||null)));let k=e.concat(o.slice(0,g+1)),T=()=>{let C;return b?C=j:N?C=v:m.route.Component?C=y.createElement(m.route.Component,null):m.route.element?C=m.route.element:C=f,y.createElement(DT,{match:m,routeContext:{outlet:f,matches:k,isDataRoute:n!=null},children:C})};return n&&(m.route.ErrorBoundary||m.route.errorElement||g===0)?y.createElement(OT,{location:n.location,revalidation:n.revalidation,component:j,error:b,children:T(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):T()},null)}var Uj=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(Uj||{}),Wj=(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})(Wj||{});function $T(t){let e=y.useContext(J0);return e||zn(!1),e}function zT(t){let e=y.useContext(CT);return e||zn(!1),e}function FT(t){let e=y.useContext(_i);return e||zn(!1),e}function Kj(t){let e=FT(),n=e.matches[e.matches.length-1];return n.route.id||zn(!1),n.route.id}function BT(){var t;let e=y.useContext(Bj),n=zT(),r=Kj();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function VT(){let{router:t}=$T(Uj.UseNavigateStable),e=Kj(Wj.UseNavigateStable),n=y.useRef(!1);return Vj(()=>{n.current=!0}),y.useCallback(function(a,i){i===void 0&&(i={}),n.current&&(typeof a=="number"?t.navigate(a):t.navigate(a,wu({fromRouteId:e},i)))},[t,e])}const S1={};function HT(t,e,n){S1[t]||(S1[t]=!0)}function UT(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Fh(t){let{to:e,replace:n,state:r,relative:a}=t;ld()||zn(!1);let{future:i,static:o}=y.useContext(Ho),{matches:c}=y.useContext(_i),{pathname:u}=Uo(),h=Ka(),f=G0(e,q0(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 WT(t){return AT(t.context)}function cn(t){zn(!1)}function KT(t){let{basename:e="/",children:n=null,location:r,navigationType:a=ko.Pop,navigator:i,static:o=!1,future:c}=t;ld()&&zn(!1);let u=e.replace(/^\/*/,"/"),h=y.useMemo(()=>({basename:u,navigator:i,static:o,future:wu({v7_relativeSplatPath:!1},c)}),[u,c,i,o]);typeof r=="string"&&(r=od(r));let{pathname:f="/",search:m="",hash:g="",state:b=null,key:N="default"}=r,j=y.useMemo(()=>{let v=K0(f,u);return v==null?null:{location:{pathname:v,search:m,hash:g,state:b,key:N},navigationType:a}},[u,f,m,g,b,N,a]);return j==null?null:y.createElement(Ho.Provider,{value:h},y.createElement(Mp.Provider,{children:n,value:j}))}function qT(t){let{children:e,location:n}=t;return IT(Lx(e),n)}new Promise(()=>{});function Lx(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,Lx(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=Lx(r.props.children,i)),n.push(o)}),n}/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * 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 -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */function Dx(){return Dx=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[a]=t[a]);return n}function YT(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function XT(t,e){return t.button===0&&(!e||e==="_self")&&!YT(t)}function _x(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 ZT(t,e){let n=_x(t);return e&&e.forEach((r,a)=>{n.has(a)||e.getAll(a).forEach(i=>{n.append(a,i)})}),n}const e5=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],t5="6";try{window.__reactRouterVersion=t5}catch{}const n5="startTransition",T1=Mp[n5];function s5(t){let{basename:e,children:n,future:r,window:a}=t,i=y.useRef();i.current==null&&(i.current=tT({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&&T1?T1(()=>u(m)):u(m)},[u,h]);return y.useLayoutEffect(()=>o.listen(f),[o,f]),y.useEffect(()=>KT(r),[r]),y.createElement(GT,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:o,future:r})}const r5=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",a5=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_l=y.forwardRef(function(e,n){let{onClick:r,relative:a,reloadDocument:i,replace:o,state:c,target:u,to:h,preventScrollReset:f,viewTransition:m}=e,g=QT(e,e5),{basename:b}=y.useContext(Uo),N,j=!1;if(typeof h=="string"&&a5.test(h)&&(N=h,r5))try{let C=new URL(window.location.href),R=h.startsWith("//")?new URL(C.protocol+h):new URL(h),O=G0(R.pathname,b);R.origin===C.origin&&O!=null?h=O+R.search+R.hash:j=!0}catch{}let v=MT(h,{relative:a}),k=i5(h,{replace:o,state:c,target:u,preventScrollReset:f,relative:a,viewTransition:m});function T(C){r&&r(C),C.defaultPrevented||k(C)}return y.createElement("a",Dx({},g,{href:N||v,onClick:j||i?r:T,ref:n,target:u}))});var M1;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(M1||(M1={}));var A1;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(A1||(A1={}));function i5(t,e){let{target:n,replace:r,state:a,preventScrollReset:i,relative:o,viewTransition:c}=e===void 0?{}:e,u=qa(),h=Wo(),f=Wj(t,{relative:o});return y.useCallback(m=>{if(XT(m,n)){m.preventDefault();let g=r!==void 0?r:Cf(h)===Cf(f);u(t,{replace:g,state:a,preventScrollReset:i,relative:o,viewTransition:c})}},[h,u,f,r,a,n,t,i,o,c])}function X0(t){let e=y.useRef(_x(t)),n=y.useRef(!1),r=Wo(),a=y.useMemo(()=>ZT(r.search,n.current?null:e.current),[r.search]),i=qa(),o=y.useCallback((c,u)=>{const h=_x(typeof c=="function"?c(a):c);n.current=!0,i("?"+h,u)},[i,a]);return[a,o]}/** -======== - */function Ox(){return Ox=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[a]=t[a]);return n}function JT(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function QT(t,e){return t.button===0&&(!e||e==="_self")&&!JT(t)}function Dx(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 YT(t,e){let n=Dx(t);return e&&e.forEach((r,a)=>{n.has(a)||e.getAll(a).forEach(i=>{n.append(a,i)})}),n}const XT=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],ZT="6";try{window.__reactRouterVersion=ZT}catch{}const e5="startTransition",C1=Tp[e5];function t5(t){let{basename:e,children:n,future:r,window:a}=t,i=y.useRef();i.current==null&&(i.current=ZE({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&&C1?C1(()=>u(m)):u(m)},[u,h]);return y.useLayoutEffect(()=>o.listen(f),[o,f]),y.useEffect(()=>UT(r),[r]),y.createElement(KT,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:o,future:r})}const n5=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",s5=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Dl=y.forwardRef(function(e,n){let{onClick:r,relative:a,reloadDocument:i,replace:o,state:c,target:u,to:h,preventScrollReset:f,viewTransition:m}=e,g=GT(e,XT),{basename:b}=y.useContext(Ho),N,j=!1;if(typeof h=="string"&&s5.test(h)&&(N=h,n5))try{let C=new URL(window.location.href),R=h.startsWith("//")?new URL(C.protocol+h):new URL(h),O=K0(R.pathname,b);R.origin===C.origin&&O!=null?h=O+R.search+R.hash:j=!0}catch{}let v=ET(h,{relative:a}),k=r5(h,{replace:o,state:c,target:u,preventScrollReset:f,relative:a,viewTransition:m});function T(C){r&&r(C),C.defaultPrevented||k(C)}return y.createElement("a",Ox({},g,{href:N||v,onClick:j||i?r:T,ref:n,target:u}))});var E1;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(E1||(E1={}));var T1;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(T1||(T1={}));function r5(t,e){let{target:n,replace:r,state:a,preventScrollReset:i,relative:o,viewTransition:c}=e===void 0?{}:e,u=Ka(),h=Uo(),f=Hj(t,{relative:o});return y.useCallback(m=>{if(QT(m,n)){m.preventDefault();let g=r!==void 0?r:Sf(h)===Sf(f);u(t,{replace:g,state:a,preventScrollReset:i,relative:o,viewTransition:c})}},[h,u,f,r,a,n,t,i,o,c])}function Q0(t){let e=y.useRef(Dx(t)),n=y.useRef(!1),r=Uo(),a=y.useMemo(()=>YT(r.search,n.current?null:e.current),[r.search]),i=Ka(),o=y.useCallback((c,u)=>{const h=Dx(typeof c=="function"?c(a):c);n.current=!0,i("?"+h,u)},[i,a]);return[a,o]}/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const o5=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),l5=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),P1=t=>{const e=l5(t);return e.charAt(0).toUpperCase()+e.slice(1)},Jj=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),c5=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/** -======== - */const a5=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i5=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),M1=t=>{const e=i5(t);return e.charAt(0).toUpperCase()+e.slice(1)},qj=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),o5=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */var d5={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"};/** -======== - */var l5={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"};/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const u5=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,...d5,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:Jj("lucide",a),...!i&&!c5(c)&&{"aria-hidden":"true"},...c},[...o.map(([h,f])=>y.createElement(h,f)),...Array.isArray(i)?i:[i]]));/** -======== - */const c5=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,...l5,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:qj("lucide",a),...!i&&!o5(c)&&{"aria-hidden":"true"},...c},[...o.map(([h,f])=>y.createElement(h,f)),...Array.isArray(i)?i:[i]]));/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const Te=(t,e)=>{const n=y.forwardRef(({className:r,...a},i)=>y.createElement(u5,{ref:i,iconNode:e,className:Jj(`lucide-${o5(P1(t))}`,`lucide-${t}`,r),...a}));return n.displayName=P1(t),n};/** -======== - */const Te=(t,e)=>{const n=y.forwardRef(({className:r,...a},i)=>y.createElement(c5,{ref:i,iconNode:e,className:qj(`lucide-${a5(M1(t))}`,`lucide-${t}`,r),...a}));return n.displayName=M1(t),n};/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const h5=[["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"}]],_g=Te("arrow-up-down",h5);/** -======== - */const d5=[["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"}]],Dg=Te("arrow-up-down",d5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const f5=[["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"}]],p5=Te("at-sign",f5);/** -======== - */const u5=[["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"}]],h5=Te("at-sign",u5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const m5=[["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"}]],I1=Te("bitcoin",m5);/** -======== - */const f5=[["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"}]],A1=Te("bitcoin",f5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const g5=[["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"}]],x5=Te("bold",g5);/** -======== - */const p5=[["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"}]],m5=Te("bold",p5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const y5=[["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"}]],fr=Te("book-open",y5);/** -======== - */const g5=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],dr=Te("book-open",g5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const b5=[["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"}]],$x=Te("calendar",b5);/** -======== - */const x5=[["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"}]],_x=Te("calendar",x5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const v5=[["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"}]],Qd=Te("chart-column",v5);/** -======== - */const y5=[["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"}]],Jd=Te("chart-column",y5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const N5=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Pp=Te("check",N5);/** -======== - */const b5=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ap=Te("check",b5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const w5=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],$l=Te("chevron-down",w5);/** -======== - */const v5=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],_l=Te("chevron-down",v5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const j5=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],k5=Te("chevron-left",j5);/** -======== - */const N5=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],w5=Te("chevron-left",N5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const S5=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],El=Te("chevron-right",S5);/** -======== - */const j5=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Cl=Te("chevron-right",j5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const C5=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],zx=Te("chevron-up",C5);/** -======== - */const k5=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],$x=Te("chevron-up",k5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const E5=[["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"}]],Qj=Te("circle-alert",E5);/** -======== - */const S5=[["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"}]],Gj=Te("circle-alert",S5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const T5=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],$g=Te("circle-check-big",T5);/** -======== - */const C5=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],_g=Te("circle-check-big",C5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const M5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Yj=Te("circle-check",M5);/** -======== - */const E5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Jj=Te("circle-check",E5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const A5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],P5=Te("circle-plus",A5);/** -======== - */const T5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],M5=Te("circle-plus",T5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const I5=[["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"}]],Xj=Te("circle-question-mark",I5);/** -======== - */const A5=[["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"}]],Qj=Te("circle-question-mark",A5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const R5=[["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=Te("circle-user",R5);/** -======== - */const I5=[["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=Te("circle-user",I5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const L5=[["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"}]],Zj=Te("circle-x",L5);/** -======== - */const P5=[["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"}]],Yj=Te("circle-x",P5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const O5=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Fx=Te("clock",O5);/** -======== - */const R5=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],zx=Te("clock",R5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const D5=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],R1=Te("cloud",D5);/** -======== - */const L5=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],I1=Te("cloud",L5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const _5=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],$5=Te("code",_5);/** -======== - */const O5=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],D5=Te("code",O5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const z5=[["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"}]],ek=Te("copy",z5);/** -======== - */const _5=[["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"}]],Xj=Te("copy",_5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const F5=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],L1=Te("credit-card",F5);/** -======== - */const $5=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],P1=Te("credit-card",$5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const B5=[["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"}]],Wc=Te("crown",B5);/** -======== - */const z5=[["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"}]],Uc=Te("crown",z5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const V5=[["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"}]],Ef=Te("dollar-sign",V5);/** -======== - */const F5=[["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"}]],Cf=Te("dollar-sign",F5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const H5=[["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"}]],U5=Te("download",H5);/** -======== - */const B5=[["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"}]],V5=Te("download",B5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const W5=[["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"}]],_o=Te("external-link",W5);/** -======== - */const H5=[["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"}]],Do=Te("external-link",H5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const K5=[["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"}]],q5=Te("eye-off",K5);/** -======== - */const U5=[["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"}]],W5=Te("eye-off",U5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const G5=[["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"}]],Tf=Te("eye",G5);/** -======== - */const K5=[["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"}]],Ef=Te("eye",K5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const J5=[["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"}]],tk=Te("file-text",J5);/** -======== - */const q5=[["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"}]],Zj=Te("file-text",q5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const Q5=[["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"}]],nk=Te("funnel",Q5);/** -======== - */const G5=[["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"}]],ek=Te("funnel",G5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const Y5=[["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"}]],Bx=Te("gift",Y5);/** -======== - */const J5=[["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"}]],Fx=Te("gift",J5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const X5=[["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=Te("git-merge",X5);/** -======== - */const Q5=[["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"}]],Y5=Te("git-merge",Q5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const eM=[["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"}]],Vx=Te("globe",eM);/** -======== - */const X5=[["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"}]],Bx=Te("globe",X5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const tM=[["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"}]],nM=Te("graduation-cap",tM);/** -======== - */const Z5=[["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"}]],eM=Te("graduation-cap",Z5);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const sM=[["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"}]],xi=Te("grip-vertical",sM);/** -======== - */const tM=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],gi=Te("grip-vertical",tM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const rM=[["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"}]],aM=Te("handshake",rM);/** -======== - */const nM=[["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"}]],sM=Te("handshake",nM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const iM=[["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"}]],O1=Te("hash",iM);/** -======== - */const rM=[["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"}]],R1=Te("hash",rM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const oM=[["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"}]],lM=Te("heading-1",oM);/** -======== - */const aM=[["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"}]],iM=Te("heading-1",aM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const cM=[["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"}]],dM=Te("heading-2",cM);/** -======== - */const oM=[["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"}]],lM=Te("heading-2",oM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const uM=[["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"}]],hM=Te("heading-3",uM);/** -======== - */const cM=[["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"}]],dM=Te("heading-3",cM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const fM=[["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"}]],pM=Te("house",fM);/** -======== - */const uM=[["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"}]],hM=Te("house",uM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const mM=[["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"}]],sk=Te("image",mM);/** -======== - */const fM=[["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"}]],tk=Te("image",fM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const gM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Hh=Te("info",gM);/** -======== - */const pM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Vh=Te("info",pM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const xM=[["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"}]],yM=Te("italic",xM);/** -======== - */const mM=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],gM=Te("italic",mM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const bM=[["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"}]],Hx=Te("key",bM);/** -======== - */const xM=[["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"}]],Vx=Te("key",xM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const vM=[["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"}]],NM=Te("layout-dashboard",vM);/** -======== - */const yM=[["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"}]],bM=Te("layout-dashboard",yM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const wM=[["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"}]],jM=Te("layout-grid",wM);/** -======== - */const vM=[["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"}]],NM=Te("layout-grid",vM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const kM=[["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"}]],Ai=Te("link-2",kM);/** -======== - */const wM=[["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"}]],Mi=Te("link-2",wM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const SM=[["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"}]],Ux=Te("link",SM);/** -======== - */const jM=[["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"}]],Hx=Te("link",jM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const CM=[["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"}]],EM=Te("list-ordered",CM);/** -======== - */const kM=[["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"}]],SM=Te("list-ordered",kM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const TM=[["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=Te("list",TM);/** -======== - */const CM=[["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"}]],EM=Te("list",CM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const AM=[["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"}]],PM=Te("lock",AM);/** -======== - */const TM=[["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=Te("lock",TM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const IM=[["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"}]],RM=Te("log-out",IM);/** -======== - */const AM=[["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"}]],IM=Te("log-out",AM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const LM=[["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"}]],rk=Te("map-pin",LM);/** -======== - */const PM=[["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"}]],nk=Te("map-pin",PM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const OM=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],DM=Te("menu",OM);/** -======== - */const RM=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],LM=Te("menu",RM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const _M=[["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"}]],$M=Te("message-circle",_M);/** -======== - */const OM=[["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"}]],DM=Te("message-circle",OM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const zM=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],ak=Te("message-square",zM);/** -======== - */const _M=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],sk=Te("message-square",_M);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const FM=[["path",{d:"M5 12h14",key:"1ays0h"}]],BM=Te("minus",FM);/** -======== - */const $M=[["path",{d:"M5 12h14",key:"1ays0h"}]],zM=Te("minus",$M);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const VM=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],pa=Te("navigation",VM);/** -======== - */const FM=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],ua=Te("navigation",FM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const HM=[["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"}]],UM=Te("palette",HM);/** -======== - */const BM=[["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"}]],VM=Te("palette",BM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const WM=[["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"}]],KM=Te("paperclip",WM);/** -======== - */const HM=[["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"}]],UM=Te("paperclip",HM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const qM=[["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"}]],sn=Te("pen-line",qM);/** -======== - */const WM=[["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"}]],sn=Te("pen-line",WM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const GM=[["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"}]],Wx=Te("pencil",GM);/** -======== - */const KM=[["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"}]],Ux=Te("pencil",KM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const JM=[["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"}]],QM=Te("percent",JM);/** -======== - */const qM=[["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"}]],GM=Te("percent",qM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const YM=[["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"}]],D1=Te("phone",YM);/** -======== - */const JM=[["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"}]],L1=Te("phone",JM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const XM=[["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"}]],_1=Te("pin",XM);/** -======== - */const QM=[["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"}]],O1=Te("pin",QM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const ZM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Fn=Te("plus",ZM);/** -======== - */const YM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],$n=Te("plus",YM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const eA=[["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"}]],$1=Te("qr-code",eA);/** -======== - */const XM=[["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"}]],D1=Te("qr-code",XM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const tA=[["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"}]],nA=Te("quote",tA);/** -======== - */const ZM=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],eA=Te("quote",ZM);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const sA=[["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"}]],rA=Te("redo",sA);/** -======== - */const tA=[["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"}]],nA=Te("redo",tA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const aA=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],He=Te("refresh-cw",aA);/** -======== - */const sA=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],He=Te("refresh-cw",sA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const iA=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],oA=Te("rotate-ccw",iA);/** -======== - */const rA=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],aA=Te("rotate-ccw",rA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const lA=[["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"}]],Tn=Te("save",lA);/** -======== - */const iA=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Cn=Te("save",iA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const cA=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],xa=Te("search",cA);/** -======== - */const oA=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],pa=Te("search",oA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const dA=[["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"}]],uA=Te("send",dA);/** -======== - */const lA=[["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"}]],cA=Te("send",lA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const hA=[["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=Te("settings",hA);/** -======== - */const dA=[["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"}]],So=Te("settings",dA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const fA=[["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"}]],Uh=Te("settings-2",fA);/** -======== - */const uA=[["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"}]],Hh=Te("settings-2",uA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const pA=[["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"}]],mA=Te("share-2",pA);/** -======== - */const hA=[["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"}]],fA=Te("share-2",hA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const gA=[["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"}]],Bc=Te("shield-check",gA);/** -======== - */const pA=[["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"}]],Fc=Te("shield-check",pA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const xA=[["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"}]],cu=Te("shopping-bag",xA);/** -======== - */const mA=[["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"}]],lu=Te("shopping-bag",mA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const yA=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],zl=Te("smartphone",yA);/** -======== - */const gA=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],$l=Te("smartphone",gA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const bA=[["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"}]],vA=Te("smile",bA);/** -======== - */const xA=[["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"}]],yA=Te("smile",xA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const NA=[["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"}]],wA=Te("sparkles",NA);/** -======== - */const bA=[["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"}]],vA=Te("sparkles",bA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const jA=[["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"}]],Vc=Te("star",jA);/** -======== - */const NA=[["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"}]],Bc=Te("star",NA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const kA=[["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"}]],SA=Te("strikethrough",kA);/** -======== - */const wA=[["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"}]],jA=Te("strikethrough",wA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */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"}]],EA=Te("table",CA);/** -======== - */const kA=[["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"}]],SA=Te("table",kA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const TA=[["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"}]],du=Te("tag",TA);/** -======== - */const CA=[["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"}]],cu=Te("tag",CA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const MA=[["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"}]],Zn=Te("trash-2",MA);/** -======== - */const EA=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Yn=Te("trash-2",EA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const AA=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Mf=Te("trending-up",AA);/** -======== - */const TA=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Tf=Te("trending-up",TA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */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"}]],Kx=Te("trophy",PA);/** -======== - */const MA=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],Wx=Te("trophy",MA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const IA=[["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"}]],ik=Te("undo-2",IA);/** -======== - */const AA=[["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"}]],rk=Te("undo-2",AA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const RA=[["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"}]],LA=Te("undo",RA);/** -======== - */const IA=[["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"}]],PA=Te("undo",IA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const OA=[["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"}]],Af=Te("upload",OA);/** -======== - */const RA=[["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"}]],Mf=Te("upload",RA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const DA=[["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"}]],Hc=Te("user-plus",DA);/** -======== - */const LA=[["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"}]],Vc=Te("user-plus",LA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const _A=[["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=Te("user",_A);/** -======== - */const OA=[["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"}]],Si=Te("user",OA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const $A=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Kn=Te("users",$A);/** -======== - */const DA=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Un=Te("users",DA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const zA=[["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"}]],FA=Te("video",zA);/** -======== - */const _A=[["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"}]],$A=Te("video",_A);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const BA=[["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"}]],Qc=Te("wallet",BA);/** -======== - */const zA=[["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"}]],Jc=Te("wallet",zA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const VA=[["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"}]],HA=Te("wand-sparkles",VA);/** -======== - */const FA=[["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"}]],BA=Te("wand-sparkles",FA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const UA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],es=Te("x",UA);/** -======== - */const VA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Xn=Te("x",VA);/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */const WA=[["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"}]],$o=Te("zap",WA),Z0="admin_token";function zu(){try{return localStorage.getItem(Z0)}catch{return null}}function KA(t){try{localStorage.setItem(Z0,t)}catch{}}function zg(){try{localStorage.removeItem(Z0)}catch{}}const qA="https://soulapi.quwanzhi.com",GA=15e3,z1=6e4,JA=()=>qA;function Fl(t){const e=JA(),n=t.startsWith("/")?t:`/${t}`;return e?`${e}${n}`:n}async function Ip(t,e={}){const{data:n,...r}=e,a=Fl(t),i=new Headers(r.headers),o=zu();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??GA,h=new AbortController,f=setTimeout(()=>h.abort(),u),m=await fetch(a,{...r,headers:i,body:c,credentials:"include",signal:h.signal}).finally(()=>clearTimeout(f)),g=m.headers.get("Content-Type")||"";let b;if(g.includes("application/json"))try{b=await m.json()}catch{throw new Error(`API 响应解析失败 (${m.status})`)}else{const j=await m.text();throw new Error(`API 返回非 JSON 响应 (${m.status}): ${j.slice(0,100)}`)}const N=j=>{const v=j,k=((v==null?void 0:v.message)||(v==null?void 0:v.error)||"").toString();(k.includes("可提现金额不足")||k.includes("可提现不足")||k.includes("余额不足"))&&window.dispatchEvent(new CustomEvent("recharge-alert",{detail:k}))};if(!m.ok){N(b);const j=new Error((b==null?void 0:b.error)||`HTTP ${m.status}`);throw j.status=m.status,j.data=b,j}return N(b),b}function Oe(t,e){return Ip(t,{...e,method:"GET"})}function kt(t,e,n){return Ip(t,{...n,method:"POST",data:e})}function Xt(t,e,n){return Ip(t,{...n,method:"PUT",data:e})}function Ei(t,e){return Ip(t,{...e,method:"DELETE"})}function QA(){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(Qj,{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(es,{className:"w-4 h-4"})})]}):null}const YA=[{icon:NM,label:"数据概览",href:"/dashboard"},{icon:fr,label:"内容管理",href:"/content"},{icon:Kn,label:"用户管理",href:"/users"},{icon:Z5,label:"找伙伴",href:"/find-partner"},{icon:Qc,label:"推广中心",href:"/distribution"}];function XA(){const t=Wo(),e=y.useRef(t.pathname);e.current=t.pathname;const n=qa(),[r,a]=y.useState(!1),[i,o]=y.useState(!1);y.useEffect(()=>{a(!0)},[]),y.useEffect(()=>{if(!r)return;let u=!1;if(!zu()){n("/login",{replace:!0});return}return Oe("/api/admin").then(h=>{u||(h&&h.success!==!1?o(!0):(zg(),n("/login",{replace:!0,state:{from:e.current}})))}).catch(()=>{u||(zg(),n("/login",{replace:!0,state:{from:e.current}}))}),()=>{u=!0}},[r,n]);const c=async()=>{zg();try{await kt("/api/admin/logout",{})}catch{}n("/login",{replace:!0})};return!r||!i?s.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[s.jsx("div",{className:"w-64 bg-[#0f2137] border-r border-gray-700/50"}),s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-[#38bdac]",children:"加载中..."})})]}):s.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[s.jsxs("div",{className:"w-64 bg-[#0f2137] flex flex-col border-r border-gray-700/50 shadow-xl",children:[s.jsxs("div",{className:"p-6 border-b border-gray-700/50",children:[s.jsx("h1",{className:"text-xl font-bold text-[#38bdac]",children:"管理后台"}),s.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Soul创业派对"})]}),s.jsxs("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:[YA.map(u=>{const h=t.pathname===u.href;return s.jsxs(_l,{to:u.href,className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${h?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[s.jsx(u.icon,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"text-sm",children:u.label})]},u.href)}),s.jsx("div",{className:"pt-4 mt-4 border-t border-gray-700/50",children:s.jsxs(_l,{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:c,className:"w-full flex items-center gap-3 px-4 py-3 text-gray-400 hover:text-white rounded-lg hover:bg-gray-700/50 transition-colors",children:[s.jsx(RM,{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(QA,{}),s.jsx("div",{className:"w-full min-w-0 min-h-full flex-1",children:s.jsx(qT,{})})]})]})}function F1(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function ey(...t){return e=>{let n=!1;const r=t.map(a=>{const i=F1(a,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a{let{children:i,...o}=r;ok(i)&&typeof Pf=="function"&&(i=Pf(i._payload));const c=y.Children.toArray(i),u=c.find(sP);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 ck=lk("Slot");function tP(t){const e=y.forwardRef((n,r)=>{let{children:a,...i}=n;if(ok(a)&&typeof Pf=="function"&&(a=Pf(a._payload)),y.isValidElement(a)){const o=aP(a),c=rP(i,a.props);return a.type!==y.Fragment&&(c.ref=r?ey(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 nP=Symbol("radix.slottable");function sP(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===nP}function rP(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 aP(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 dk(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,V1=uk,hk=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return V1(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:i}=e,o=Object.keys(a).map(h=>{const f=n==null?void 0:n[h],m=i==null?void 0:i[h];if(f===null)return null;const g=B1(f)||B1(m);return a[h][g]}),c=n&&Object.entries(n).reduce((h,f)=>{let[m,g]=f;return g===void 0||(h[m]=g),h},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,f)=>{let{class:m,className:g,...b}=f;return Object.entries(b).every(N=>{let[j,v]=N;return Array.isArray(v)?v.includes({...i,...c}[j]):{...i,...c}[j]===v})?[...h,m,g]:h},[]);return V1(t,o,u,n==null?void 0:n.class,n==null?void 0:n.className)},iP=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),fk=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),If="-",H1=[],lP="arbitrary..",cP=t=>{const e=uP(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return dP(o);const c=o.split(If),u=c[0]===""&&c.length>1?1:0;return pk(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=r[o],h=n[o];return u?h?iP(h,u):u:h||H1}return n[o]||H1}}},pk=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const a=t[e],i=n.nextPart.get(a);if(i){const h=pk(t,e+1,i);if(h)return h}const o=n.validators;if(o===null)return;const c=e===0?t.join(If):t.slice(e).join(If),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?lP+r:void 0})(),uP=t=>{const{theme:e,classGroups:n}=t;return hP(n,e)},hP=(t,e)=>{const n=fk();for(const r in t){const a=t[r];ty(a,n,r,e)}return n},ty=(t,e,n,r)=>{const a=t.length;for(let i=0;i{if(typeof t=="string"){pP(t,e,n);return}if(typeof t=="function"){mP(t,e,n,r);return}gP(t,e,n,r)},pP=(t,e,n)=>{const r=t===""?e:mk(e,t);r.classGroupId=n},mP=(t,e,n,r)=>{if(xP(t)){ty(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(oP(n,t))},gP=(t,e,n,r)=>{const a=Object.entries(t),i=a.length;for(let o=0;o{let n=t;const r=e.split(If),a=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,yP=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)}}},qx="!",U1=":",bP=[],W1=(t,e,n,r,a)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),vP=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=a=>{const i=[];let o=0,c=0,u=0,h;const f=a.length;for(let j=0;ju?h-u:void 0;return W1(i,b,g,N)};if(e){const a=e+U1,i=r;r=o=>o.startsWith(a)?i(o.slice(a.length)):W1(bP,!1,o,void 0,!0)}if(n){const a=r;r=i=>n({className:i,parseClassName:a})}return r},NP=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}},wP=t=>({cache:yP(t.cacheSize),parseClassName:vP(t),sortModifiers:NP(t),...cP(t)}),jP=/\s+/,kP=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:i}=e,o=[],c=t.trim().split(jP);let u="";for(let h=c.length-1;h>=0;h-=1){const f=c[h],{isExternal:m,modifiers:g,hasImportantModifier:b,baseClassName:N,maybePostfixModifierPosition:j}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let v=!!j,k=r(v?N.substring(0,j):N);if(!k){if(!v){u=f+(u.length>0?" "+u:u);continue}if(k=r(N),!k){u=f+(u.length>0?" "+u:u);continue}v=!1}const T=g.length===0?"":g.length===1?g[0]:i(g).join(":"),C=b?T+qx:T,R=C+k;if(o.indexOf(R)>-1)continue;o.push(R);const O=a(k,v);for(let U=0;U0?" "+u:u)}return u},SP=(...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=wP(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=kP(u,n);return a(u,f),f};return i=o,(...u)=>i(SP(...u))},EP=[],Xn=t=>{const e=n=>n[t]||EP;return e.isThemeGetter=!0,e},xk=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,yk=/^\((?:(\w[\w-]*):)?(.+)\)$/i,TP=/^\d+\/\d+$/,MP=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,AP=/\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$/,PP=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,IP=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,RP=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Mc=t=>TP.test(t),Tt=t=>!!t&&!Number.isNaN(Number(t)),ho=t=>!!t&&Number.isInteger(Number(t)),Fg=t=>t.endsWith("%")&&Tt(t.slice(0,-1)),yi=t=>MP.test(t),LP=()=>!0,OP=t=>AP.test(t)&&!PP.test(t),bk=()=>!1,DP=t=>IP.test(t),_P=t=>RP.test(t),$P=t=>!et(t)&&!tt(t),zP=t=>dd(t,wk,bk),et=t=>xk.test(t),kl=t=>dd(t,jk,OP),Bg=t=>dd(t,UP,Tt),K1=t=>dd(t,vk,bk),FP=t=>dd(t,Nk,_P),Wh=t=>dd(t,kk,DP),tt=t=>yk.test(t),Yd=t=>ud(t,jk),BP=t=>ud(t,WP),q1=t=>ud(t,vk),VP=t=>ud(t,wk),HP=t=>ud(t,Nk),Kh=t=>ud(t,kk,!0),dd=(t,e,n)=>{const r=xk.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},ud=(t,e,n=!1)=>{const r=yk.exec(t);return r?r[1]?e(r[1]):n:!1},vk=t=>t==="position"||t==="percentage",Nk=t=>t==="image"||t==="url",wk=t=>t==="length"||t==="size"||t==="bg-size",jk=t=>t==="length",UP=t=>t==="number",WP=t=>t==="family-name",kk=t=>t==="shadow",KP=()=>{const t=Xn("color"),e=Xn("font"),n=Xn("text"),r=Xn("font-weight"),a=Xn("tracking"),i=Xn("leading"),o=Xn("breakpoint"),c=Xn("container"),u=Xn("spacing"),h=Xn("radius"),f=Xn("shadow"),m=Xn("inset-shadow"),g=Xn("text-shadow"),b=Xn("drop-shadow"),N=Xn("blur"),j=Xn("perspective"),v=Xn("aspect"),k=Xn("ease"),T=Xn("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"],O=()=>[...R(),tt,et],U=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],z=()=>[tt,et,u],L=()=>[Mc,"full","auto",...z()],Q=()=>[ho,"none","subgrid",tt,et],se=()=>["auto",{span:["full",ho,tt,et]},ho,tt,et],$=()=>[ho,"auto",tt,et],ie=()=>["auto","min","max","fr",tt,et],le=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],me=()=>["start","end","center","stretch","center-safe","end-safe"],P=()=>["auto",...z()],Y=()=>[Mc,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...z()],F=()=>[t,tt,et],ge=()=>[...R(),q1,K1,{position:[tt,et]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],B=()=>["auto","cover","contain",VP,zP,{size:[tt,et]}],W=()=>[Fg,Yd,kl],fe=()=>["","none","full",h,tt,et],he=()=>["",Tt,Yd,kl],de=()=>["solid","dashed","dotted","double"],D=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],q=()=>[Tt,Fg,q1,K1],_=()=>["","none",N,tt,et],Z=()=>["none",Tt,tt,et],re=()=>["none",Tt,tt,et],we=()=>[Tt,tt,et],Fe=()=>[Mc,"full",...z()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[yi],breakpoint:[yi],color:[LP],container:[yi],"drop-shadow":[yi],ease:["in","out","in-out"],font:[$P],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[yi],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[yi],shadow:[yi],spacing:["px",Tt],text:[yi],"text-shadow":[yi],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Mc,et,tt,v]}],container:["container"],columns:[{columns:[Tt,et,tt,c]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:O()}],overflow:[{overflow:U()}],"overflow-x":[{"overflow-x":U()}],"overflow-y":[{"overflow-y":U()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{start:L()}],end:[{end:L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[ho,"auto",tt,et]}],basis:[{basis:[Mc,"full","auto",c,...z()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Tt,Mc,"auto","initial","none",et]}],grow:[{grow:["",Tt,tt,et]}],shrink:[{shrink:["",Tt,tt,et]}],order:[{order:[ho,"first","last","none",tt,et]}],"grid-cols":[{"grid-cols":Q()}],"col-start-end":[{col:se()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":Q()}],"row-start-end":[{row:se()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ie()}],"auto-rows":[{"auto-rows":ie()}],gap:[{gap:z()}],"gap-x":[{"gap-x":z()}],"gap-y":[{"gap-y":z()}],"justify-content":[{justify:[...le(),"normal"]}],"justify-items":[{"justify-items":[...me(),"normal"]}],"justify-self":[{"justify-self":["auto",...me()]}],"align-content":[{content:["normal",...le()]}],"align-items":[{items:[...me(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...me(),{baseline:["","last"]}]}],"place-content":[{"place-content":le()}],"place-items":[{"place-items":[...me(),"baseline"]}],"place-self":[{"place-self":["auto",...me()]}],p:[{p:z()}],px:[{px:z()}],py:[{py:z()}],ps:[{ps:z()}],pe:[{pe:z()}],pt:[{pt:z()}],pr:[{pr:z()}],pb:[{pb:z()}],pl:[{pl:z()}],m:[{m:P()}],mx:[{mx:P()}],my:[{my:P()}],ms:[{ms:P()}],me:[{me:P()}],mt:[{mt:P()}],mr:[{mr:P()}],mb:[{mb:P()}],ml:[{ml:P()}],"space-x":[{"space-x":z()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":z()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],w:[{w:[c,"screen",...Y()]}],"min-w":[{"min-w":[c,"screen","none",...Y()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",n,Yd,kl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,tt,Bg]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Fg,et]}],"font-family":[{font:[BP,et,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,tt,et]}],"line-clamp":[{"line-clamp":[Tt,"none",tt,Bg]}],leading:[{leading:[i,...z()]}],"list-image":[{"list-image":["none",tt,et]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",tt,et]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...de(),"wavy"]}],"text-decoration-thickness":[{decoration:[Tt,"from-font","auto",tt,kl]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[Tt,"auto",tt,et]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:z()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",tt,et]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",tt,et]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ge()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:B()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ho,tt,et],radial:["",tt,et],conic:[ho,tt,et]},HP,FP]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:W()}],"gradient-via-pos":[{via:W()}],"gradient-to-pos":[{to:W()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],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:[...de(),"hidden","none"]}],"divide-style":[{divide:[...de(),"hidden","none"]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...de(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Tt,tt,et]}],"outline-w":[{outline:["",Tt,Yd,kl]}],"outline-color":[{outline:F()}],shadow:[{shadow:["","none",f,Kh,Wh]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":["none",m,Kh,Wh]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:he()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[Tt,kl]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":he()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":["none",g,Kh,Wh]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[Tt,tt,et]}],"mix-blend":[{"mix-blend":[...D(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":D()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Tt]}],"mask-image-linear-from-pos":[{"mask-linear-from":q()}],"mask-image-linear-to-pos":[{"mask-linear-to":q()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":q()}],"mask-image-t-to-pos":[{"mask-t-to":q()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":q()}],"mask-image-r-to-pos":[{"mask-r-to":q()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":q()}],"mask-image-b-to-pos":[{"mask-b-to":q()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":q()}],"mask-image-l-to-pos":[{"mask-l-to":q()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":q()}],"mask-image-x-to-pos":[{"mask-x-to":q()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":q()}],"mask-image-y-to-pos":[{"mask-y-to":q()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[tt,et]}],"mask-image-radial-from-pos":[{"mask-radial-from":q()}],"mask-image-radial-to-pos":[{"mask-radial-to":q()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"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":[Tt]}],"mask-image-conic-from-pos":[{"mask-conic-from":q()}],"mask-image-conic-to-pos":[{"mask-conic-to":q()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ge()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:B()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",tt,et]}],filter:[{filter:["","none",tt,et]}],blur:[{blur:_()}],brightness:[{brightness:[Tt,tt,et]}],contrast:[{contrast:[Tt,tt,et]}],"drop-shadow":[{"drop-shadow":["","none",b,Kh,Wh]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:["",Tt,tt,et]}],"hue-rotate":[{"hue-rotate":[Tt,tt,et]}],invert:[{invert:["",Tt,tt,et]}],saturate:[{saturate:[Tt,tt,et]}],sepia:[{sepia:["",Tt,tt,et]}],"backdrop-filter":[{"backdrop-filter":["","none",tt,et]}],"backdrop-blur":[{"backdrop-blur":_()}],"backdrop-brightness":[{"backdrop-brightness":[Tt,tt,et]}],"backdrop-contrast":[{"backdrop-contrast":[Tt,tt,et]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Tt,tt,et]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Tt,tt,et]}],"backdrop-invert":[{"backdrop-invert":["",Tt,tt,et]}],"backdrop-opacity":[{"backdrop-opacity":[Tt,tt,et]}],"backdrop-saturate":[{"backdrop-saturate":[Tt,tt,et]}],"backdrop-sepia":[{"backdrop-sepia":["",Tt,tt,et]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":z()}],"border-spacing-x":[{"border-spacing-x":z()}],"border-spacing-y":[{"border-spacing-y":z()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",tt,et]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Tt,"initial",tt,et]}],ease:[{ease:["linear","initial",k,tt,et]}],delay:[{delay:[Tt,tt,et]}],animate:[{animate:["none",T,tt,et]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,tt,et]}],"perspective-origin":[{"perspective-origin":O()}],rotate:[{rotate:Z()}],"rotate-x":[{"rotate-x":Z()}],"rotate-y":[{"rotate-y":Z()}],"rotate-z":[{"rotate-z":Z()}],scale:[{scale:re()}],"scale-x":[{"scale-x":re()}],"scale-y":[{"scale-y":re()}],"scale-z":[{"scale-z":re()}],"scale-3d":["scale-3d"],skew:[{skew:we()}],"skew-x":[{"skew-x":we()}],"skew-y":[{"skew-y":we()}],transform:[{transform:[tt,et,"","none","gpu","cpu"]}],"transform-origin":[{origin:O()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Fe()}],"translate-x":[{"translate-x":Fe()}],"translate-y":[{"translate-y":Fe()}],"translate-z":[{"translate-z":Fe()}],"translate-none":["translate-none"],accent:[{accent:F()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:F()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",tt,et]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":z()}],"scroll-mx":[{"scroll-mx":z()}],"scroll-my":[{"scroll-my":z()}],"scroll-ms":[{"scroll-ms":z()}],"scroll-me":[{"scroll-me":z()}],"scroll-mt":[{"scroll-mt":z()}],"scroll-mr":[{"scroll-mr":z()}],"scroll-mb":[{"scroll-mb":z()}],"scroll-ml":[{"scroll-ml":z()}],"scroll-p":[{"scroll-p":z()}],"scroll-px":[{"scroll-px":z()}],"scroll-py":[{"scroll-py":z()}],"scroll-ps":[{"scroll-ps":z()}],"scroll-pe":[{"scroll-pe":z()}],"scroll-pt":[{"scroll-pt":z()}],"scroll-pr":[{"scroll-pr":z()}],"scroll-pb":[{"scroll-pb":z()}],"scroll-pl":[{"scroll-pl":z()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",tt,et]}],fill:[{fill:["none",...F()]}],"stroke-w":[{stroke:[Tt,Yd,kl,Bg]}],stroke:[{stroke:["none",...F()]}],"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"]}},qP=CP(KP);function zt(...t){return qP(uk(t))}function ya(t){if(!t)return"";let e=t.trim();return e?(e=e.replace(/^(https?)\/\//,"$1://"),e):""}const GP=hk("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?ck:"button";return s.jsx(i,{"data-slot":"button",className:zt(GP({variant:e,size:n,className:t})),...a})}function ce({className:t,type:e,...n}){return s.jsx("input",{type:e,"data-slot":"input",className:zt("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 JP(){const t=qa(),[e,n]=y.useState(""),[r,a]=y.useState(""),[i,o]=y.useState(""),[c,u]=y.useState(!1);y.useEffect(()=>{zu()&&t("/dashboard",{replace:!0})},[t]);const h=async()=>{o(""),u(!0);try{const f=await kt("/api/admin",{username:e.trim(),password:r});if((f==null?void 0:f.success)!==!1&&(f!=null&&f.token)){KA(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(Bc,{className:"w-8 h-8 text-[#38bdac]"})}),s.jsx("h1",{className:"text-2xl font-bold text-white mb-2",children:"管理后台"}),s.jsx("p",{className:"text-gray-400",children:"一场SOUL的创业实验场"})]}),s.jsxs("div",{className:"bg-[#0f2137] rounded-2xl p-8 shadow-xl border border-gray-700/50 backdrop-blur-xl",children:[s.jsx("h2",{className:"text-xl font-semibold text-white mb-6 text-center",children:"管理员登录"}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"用户名"}),s.jsxs("div",{className:"relative",children:[s.jsx(Ci,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(ce,{type:"text",value:e,onChange:f=>{n(f.target.value),i&&o("")},placeholder:"请输入用户名",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-gray-400 text-sm mb-2",children:"密码"}),s.jsxs("div",{className:"relative",children:[s.jsx(PM,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(ce,{type:"password",value:r,onChange:f=>{a(f.target.value),i&&o("")},placeholder:"请输入密码",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]",onKeyDown:f=>f.key==="Enter"&&h()})]})]}),i&&s.jsx("div",{className:"bg-red-500/10 text-red-400 text-sm p-3 rounded-lg border border-red-500/20",children:i}),s.jsx(J,{onClick:h,disabled:c,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white py-5 disabled:opacity-50",children:c?"登录中...":"登录"})]})]}),s.jsx("p",{className:"text-center text-gray-500 text-xs mt-6",children:"Soul创业实验场 · 后台管理系统"})]})]})}const De=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:zt("rounded-xl border bg-card text-card-foreground shadow",t),...e}));De.displayName="Card";const ut=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:zt("flex flex-col space-y-1.5 p-6",t),...e}));ut.displayName="CardHeader";const ht=y.forwardRef(({className:t,...e},n)=>s.jsx("h3",{ref:n,className:zt("font-semibold leading-none tracking-tight",t),...e}));ht.displayName="CardTitle";const qt=y.forwardRef(({className:t,...e},n)=>s.jsx("p",{ref:n,className:zt("text-sm text-muted-foreground",t),...e}));qt.displayName="CardDescription";const _e=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:zt("p-6 pt-0",t),...e}));_e.displayName="CardContent";const QP=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:zt("flex items-center p-6 pt-0",t),...e}));QP.displayName="CardFooter";const YP={success:{bg:"#f0fdf4",border:"#22c55e",icon:"✓"},error:{bg:"#fef2f2",border:"#ef4444",icon:"✕"},info:{bg:"#eff6ff",border:"#3b82f6",icon:"ℹ"}};function Vg(t,e="info",n=3e3){const r=`toast-${Date.now()}`,a=YP[e],i=document.createElement("div");i.id=r,i.setAttribute("role","alert"),Object.assign(i.style,{position:"fixed",top:"24px",right:"24px",zIndex:"9999",display:"flex",alignItems:"center",gap:"10px",padding:"12px 18px",borderRadius:"10px",background:a.bg,border:`1.5px solid ${a.border}`,boxShadow:"0 4px 20px rgba(0,0,0,.12)",fontSize:"14px",color:"#1a1a1a",fontWeight:"500",maxWidth:"380px",lineHeight:"1.5",opacity:"0",transform:"translateY(-8px)",transition:"opacity .22s ease, transform .22s ease",pointerEvents:"none"});const o=document.createElement("span");Object.assign(o.style,{width:"20px",height:"20px",borderRadius:"50%",background:a.border,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:"700",flexShrink:"0"}),o.textContent=a.icon;const c=document.createElement("span");c.textContent=t,i.appendChild(o),i.appendChild(c),document.body.appendChild(i),requestAnimationFrame(()=>{i.style.opacity="1",i.style.transform="translateY(0)"});const u=setTimeout(()=>h(r),n);function h(f){clearTimeout(u);const m=document.getElementById(f);m&&(m.style.opacity="0",m.style.transform="translateY(-8px)",setTimeout(()=>{var g;return(g=m.parentNode)==null?void 0:g.removeChild(m)},250))}}const G={success:(t,e)=>Vg(t,"success",e),error:(t,e)=>Vg(t,"error",e),info:(t,e)=>Vg(t,"info",e)};function St(t,e,{checkForDefaultPrevented:n=!0}={}){return function(a){if(t==null||t(a),n===!1||!a.defaultPrevented)return e==null?void 0:e(a)}}function XP(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 Ko(t,e=[]){let n=[];function r(i,o){const c=y.createContext(o),u=n.length;n=[...n,o];const h=m=>{var k;const{scope:g,children:b,...N}=m,j=((k=g==null?void 0:g[t])==null?void 0:k[u])||c,v=y.useMemo(()=>N,Object.values(N));return s.jsx(j.Provider,{value:v,children:b})};h.displayName=i+"Provider";function f(m,g){var j;const b=((j=g==null?void 0:g[t])==null?void 0:j[u])||c,N=y.useContext(b);if(N)return N;if(o!==void 0)return o;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[h,f]}const a=()=>{const i=n.map(o=>y.createContext(o));return function(c){const u=(c==null?void 0:c[t])||i;return y.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])}};return a.scopeName=t,[r,ZP(a,...e)]}function ZP(...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 Os=globalThis!=null&&globalThis.document?y.useLayoutEffect:()=>{},eI=Mp[" useId ".trim().toString()]||(()=>{}),tI=0;function Io(t){const[e,n]=y.useState(eI());return Os(()=>{n(r=>r??String(tI++))},[t]),e?`radix-${e}`:""}var nI=Mp[" useInsertionEffect ".trim().toString()]||Os;function Bl({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[a,i,o]=sI({defaultProp:e,onChange:n}),c=t!==void 0,u=c?t:a;{const f=y.useRef(t!==void 0);y.useEffect(()=>{const m=f.current;m!==c&&console.warn(`${r} is changing from ${m?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=c},[c,r])}const h=y.useCallback(f=>{var m;if(c){const g=rI(f)?f(t):f;g!==t&&((m=o.current)==null||m.call(o,g))}else i(f)},[c,t,i,o]);return[u,h]}function sI({defaultProp:t,onChange:e}){const[n,r]=y.useState(t),a=y.useRef(n),i=y.useRef(e);return nI(()=>{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 rI(t){return typeof t=="function"}function ku(t){const e=aI(t),n=y.forwardRef((r,a)=>{const{children:i,...o}=r,c=y.Children.toArray(i),u=c.find(oI);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 aI(t){const e=y.forwardRef((n,r)=>{const{children:a,...i}=n;if(y.isValidElement(a)){const o=cI(a),c=lI(i,a.props);return a.type!==y.Fragment&&(c.ref=r?ey(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 iI=Symbol("radix.slottable");function oI(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===iI}function lI(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 cI(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 dI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Mt=dI.reduce((t,e)=>{const n=ku(`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 uI(t,e){t&&od.flushSync(()=>t.dispatchEvent(e))}function zo(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 hI(t,e=globalThis==null?void 0:globalThis.document){const n=zo(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 fI="DismissableLayer",Gx="dismissableLayer.update",pI="dismissableLayer.pointerDownOutside",mI="dismissableLayer.focusOutside",G1,Sk=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ny=y.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,onDismiss:c,...u}=t,h=y.useContext(Sk),[f,m]=y.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=y.useState({}),N=Jt(e,I=>m(I)),j=Array.from(h.layers),[v]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),k=j.indexOf(v),T=f?j.indexOf(f):-1,C=h.layersWithOutsidePointerEventsDisabled.size>0,R=T>=k,O=yI(I=>{const z=I.target,L=[...h.branches].some(Q=>Q.contains(z));!R||L||(a==null||a(I),o==null||o(I),I.defaultPrevented||c==null||c())},g),U=bI(I=>{const z=I.target;[...h.branches].some(Q=>Q.contains(z))||(i==null||i(I),o==null||o(I),I.defaultPrevented||c==null||c())},g);return hI(I=>{T===h.layers.size-1&&(r==null||r(I),!I.defaultPrevented&&c&&(I.preventDefault(),c()))},g),y.useEffect(()=>{if(f)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(G1=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),J1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=G1)}},[f,g,n,h]),y.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),J1())},[f,h]),y.useEffect(()=>{const I=()=>b({});return document.addEventListener(Gx,I),()=>document.removeEventListener(Gx,I)},[]),s.jsx(Mt.div,{...u,ref:N,style:{pointerEvents:C?R?"auto":"none":void 0,...t.style},onFocusCapture:St(t.onFocusCapture,U.onFocusCapture),onBlurCapture:St(t.onBlurCapture,U.onBlurCapture),onPointerDownCapture:St(t.onPointerDownCapture,O.onPointerDownCapture)})});ny.displayName=fI;var gI="DismissableLayerBranch",xI=y.forwardRef((t,e)=>{const n=y.useContext(Sk),r=y.useRef(null),a=Jt(e,r);return y.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),s.jsx(Mt.div,{...t,ref:a})});xI.displayName=gI;function yI(t,e=globalThis==null?void 0:globalThis.document){const n=zo(t),r=y.useRef(!1),a=y.useRef(()=>{});return y.useEffect(()=>{const i=c=>{if(c.target&&!r.current){let u=function(){Ck(pI,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 bI(t,e=globalThis==null?void 0:globalThis.document){const n=zo(t),r=y.useRef(!1);return y.useEffect(()=>{const a=i=>{i.target&&!r.current&&Ck(mI,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 J1(){const t=new CustomEvent(Gx);document.dispatchEvent(t)}function Ck(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?uI(a,i):a.dispatchEvent(i)}var Hg="focusScope.autoFocusOnMount",Ug="focusScope.autoFocusOnUnmount",Q1={bubbles:!1,cancelable:!0},vI="FocusScope",sy=y.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=t,[c,u]=y.useState(null),h=zo(a),f=zo(i),m=y.useRef(null),g=Jt(e,j=>u(j)),b=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let j=function(C){if(b.paused||!c)return;const R=C.target;c.contains(R)?m.current=R:mo(m.current,{select:!0})},v=function(C){if(b.paused||!c)return;const R=C.relatedTarget;R!==null&&(c.contains(R)||mo(m.current,{select:!0}))},k=function(C){if(document.activeElement===document.body)for(const O of C)O.removedNodes.length>0&&mo(c)};document.addEventListener("focusin",j),document.addEventListener("focusout",v);const T=new MutationObserver(k);return c&&T.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",v),T.disconnect()}}},[r,c,b.paused]),y.useEffect(()=>{if(c){X1.add(b);const j=document.activeElement;if(!c.contains(j)){const k=new CustomEvent(Hg,Q1);c.addEventListener(Hg,h),c.dispatchEvent(k),k.defaultPrevented||(NI(CI(Ek(c)),{select:!0}),document.activeElement===j&&mo(c))}return()=>{c.removeEventListener(Hg,h),setTimeout(()=>{const k=new CustomEvent(Ug,Q1);c.addEventListener(Ug,f),c.dispatchEvent(k),k.defaultPrevented||mo(j??document.body,{select:!0}),c.removeEventListener(Ug,f),X1.remove(b)},0)}}},[c,h,f,b]);const N=y.useCallback(j=>{if(!n&&!r||b.paused)return;const v=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,k=document.activeElement;if(v&&k){const T=j.currentTarget,[C,R]=wI(T);C&&R?!j.shiftKey&&k===R?(j.preventDefault(),n&&mo(C,{select:!0})):j.shiftKey&&k===C&&(j.preventDefault(),n&&mo(R,{select:!0})):k===T&&j.preventDefault()}},[n,r,b.paused]);return s.jsx(Mt.div,{tabIndex:-1,...o,ref:g,onKeyDown:N})});sy.displayName=vI;function NI(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(mo(r,{select:e}),document.activeElement!==n)return}function wI(t){const e=Ek(t),n=Y1(e,t),r=Y1(e.reverse(),t);return[n,r]}function Ek(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 Y1(t,e){for(const n of t)if(!jI(n,{upTo:e}))return n}function jI(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 kI(t){return t instanceof HTMLInputElement&&"select"in t}function mo(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&kI(t)&&e&&t.select()}}var X1=SI();function SI(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=Z1(t,e),t.unshift(e)},remove(e){var n;t=Z1(t,e),(n=t[0])==null||n.resume()}}}function Z1(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function CI(t){return t.filter(e=>e.tagName!=="A")}var EI="Portal",ry=y.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[a,i]=y.useState(!1);Os(()=>i(!0),[]);const o=n||a&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return o?zj.createPortal(s.jsx(Mt.div,{...r,ref:e}),o):null});ry.displayName=EI;function TI(t,e){return y.useReducer((n,r)=>e[n][r]??n,t)}var Fu=t=>{const{present:e,children:n}=t,r=MI(e),a=typeof n=="function"?n({present:r.isPresent}):y.Children.only(n),i=Jt(r.ref,AI(a));return typeof n=="function"||r.isPresent?y.cloneElement(a,{ref:i}):null};Fu.displayName="Presence";function MI(t){const[e,n]=y.useState(),r=y.useRef(null),a=y.useRef(t),i=y.useRef("none"),o=t?"mounted":"unmounted",[c,u]=TI(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const h=qh(r.current);i.current=c==="mounted"?h:"none"},[c]),Os(()=>{const h=r.current,f=a.current;if(f!==t){const g=i.current,b=qh(h);t?u("MOUNT"):b==="none"||(h==null?void 0:h.display)==="none"?u("UNMOUNT"):u(f&&g!==b?"ANIMATION_OUT":"UNMOUNT"),a.current=t}},[t,u]),Os(()=>{if(e){let h;const f=e.ownerDocument.defaultView??window,m=b=>{const j=qh(r.current).includes(CSS.escape(b.animationName));if(b.target===e&&j&&(u("ANIMATION_END"),!a.current)){const v=e.style.animationFillMode;e.style.animationFillMode="forwards",h=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=v)})}},g=b=>{b.target===e&&(i.current=qh(r.current))};return e.addEventListener("animationstart",g),e.addEventListener("animationcancel",m),e.addEventListener("animationend",m),()=>{f.clearTimeout(h),e.removeEventListener("animationstart",g),e.removeEventListener("animationcancel",m),e.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:y.useCallback(h=>{r.current=h?getComputedStyle(h):null,n(h)},[])}}function qh(t){return(t==null?void 0:t.animationName)||"none"}function AI(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 Wg=0;function Tk(){y.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??eN()),document.body.insertAdjacentElement("beforeend",t[1]??eN()),Wg++,()=>{Wg===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Wg--}},[])}function eN(){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 Ba=function(){return Ba=Object.assign||function(e){for(var n,r=1,a=arguments.length;r"u")return qI;var e=GI(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])}},QI=Ik(),Kc="data-scroll-locked",YI=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(II,` { - overflow: hidden `).concat(r,`; - padding-right: `).concat(c,"px ").concat(r,`; - } - body[`).concat(Kc,`] { -======== - */const HA=[["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"}]],_o=Te("zap",HA),Y0="admin_token";function $u(){try{return localStorage.getItem(Y0)}catch{return null}}function UA(t){try{localStorage.setItem(Y0,t)}catch{}}function $g(){try{localStorage.removeItem(Y0)}catch{}}const WA="https://soulapi.quwanzhi.com",KA=15e3,_1=6e4,qA=()=>WA;function zl(t){const e=qA(),n=t.startsWith("/")?t:`/${t}`;return e?`${e}${n}`:n}async function Ip(t,e={}){const{data:n,...r}=e,a=zl(t),i=new Headers(r.headers),o=$u();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??KA,h=new AbortController,f=setTimeout(()=>h.abort(),u),m=await fetch(a,{...r,headers:i,body:c,credentials:"include",signal:h.signal}).finally(()=>clearTimeout(f)),g=m.headers.get("Content-Type")||"";let b;if(g.includes("application/json"))try{b=await m.json()}catch{throw new Error(`API 响应解析失败 (${m.status})`)}else{const j=await m.text();throw new Error(`API 返回非 JSON 响应 (${m.status}): ${j.slice(0,100)}`)}const N=j=>{const v=j,k=((v==null?void 0:v.message)||(v==null?void 0:v.error)||"").toString();(k.includes("可提现金额不足")||k.includes("可提现不足")||k.includes("余额不足"))&&window.dispatchEvent(new CustomEvent("recharge-alert",{detail:k}))};if(!m.ok){N(b);const j=new Error((b==null?void 0:b.error)||`HTTP ${m.status}`);throw j.status=m.status,j.data=b,j}return N(b),b}function Oe(t,e){return Ip(t,{...e,method:"GET"})}function kt(t,e,n){return Ip(t,{...n,method:"POST",data:e})}function Xt(t,e,n){return Ip(t,{...n,method:"PUT",data:e})}function Ci(t,e){return Ip(t,{...e,method:"DELETE"})}function GA(){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(Gj,{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(Xn,{className:"w-4 h-4"})})]}):null}const JA=[{icon:bM,label:"数据概览",href:"/dashboard"},{icon:dr,label:"内容管理",href:"/content"},{icon:Un,label:"用户管理",href:"/users"},{icon:Y5,label:"找伙伴",href:"/find-partner"},{icon:Jc,label:"推广中心",href:"/distribution"}];function QA(){const t=Uo(),e=y.useRef(t.pathname);e.current=t.pathname;const n=Ka(),[r,a]=y.useState(!1),[i,o]=y.useState(!1);y.useEffect(()=>{a(!0)},[]),y.useEffect(()=>{if(!r)return;let u=!1;if(!$u()){n("/login",{replace:!0});return}return Oe("/api/admin").then(h=>{u||(h&&h.success!==!1?o(!0):($g(),n("/login",{replace:!0,state:{from:e.current}})))}).catch(()=>{u||($g(),n("/login",{replace:!0,state:{from:e.current}}))}),()=>{u=!0}},[r,n]);const c=async()=>{$g();try{await kt("/api/admin/logout",{})}catch{}n("/login",{replace:!0})};return!r||!i?s.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[s.jsx("div",{className:"w-64 bg-[#0f2137] border-r border-gray-700/50"}),s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-[#38bdac]",children:"加载中..."})})]}):s.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[s.jsxs("div",{className:"w-64 bg-[#0f2137] flex flex-col border-r border-gray-700/50 shadow-xl",children:[s.jsxs("div",{className:"p-6 border-b border-gray-700/50",children:[s.jsx("h1",{className:"text-xl font-bold text-[#38bdac]",children:"管理后台"}),s.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Soul创业派对"})]}),s.jsxs("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:[JA.map(u=>{const h=t.pathname===u.href;return s.jsxs(Dl,{to:u.href,className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${h?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[s.jsx(u.icon,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"text-sm",children:u.label})]},u.href)}),s.jsx("div",{className:"pt-4 mt-4 border-t border-gray-700/50",children:s.jsxs(Dl,{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(So,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"text-sm",children:"系统设置"})]})})]}),s.jsx("div",{className:"p-4 border-t border-gray-700/50 space-y-1",children:s.jsxs("button",{type:"button",onClick:c,className:"w-full flex items-center gap-3 px-4 py-3 text-gray-400 hover:text-white rounded-lg hover:bg-gray-700/50 transition-colors",children:[s.jsx(IM,{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(GA,{}),s.jsx("div",{className:"w-full min-w-0 min-h-full flex-1",children:s.jsx(WT,{})})]})]})}function $1(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function X0(...t){return e=>{let n=!1;const r=t.map(a=>{const i=$1(a,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a{let{children:i,...o}=r;ak(i)&&typeof Af=="function"&&(i=Af(i._payload));const c=y.Children.toArray(i),u=c.find(tI);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 ok=ik("Slot");function ZA(t){const e=y.forwardRef((n,r)=>{let{children:a,...i}=n;if(ak(a)&&typeof Af=="function"&&(a=Af(a._payload)),y.isValidElement(a)){const o=sI(a),c=nI(i,a.props);return a.type!==y.Fragment&&(c.ref=r?X0(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 eI=Symbol("radix.slottable");function tI(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===eI}function nI(t,e){const n={...e};for(const r in e){const a=t[r],i=e[r];/^on[A-Z]/.test(r)?a&&i?n[r]=(...c)=>{const u=i(...c);return a(...c),u}:a&&(n[r]=a):r==="style"?n[r]={...a,...i}:r==="className"&&(n[r]=[a,i].filter(Boolean).join(" "))}return{...t,...n}}function sI(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 lk(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,F1=ck,dk=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return F1(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:i}=e,o=Object.keys(a).map(h=>{const f=n==null?void 0:n[h],m=i==null?void 0:i[h];if(f===null)return null;const g=z1(f)||z1(m);return a[h][g]}),c=n&&Object.entries(n).reduce((h,f)=>{let[m,g]=f;return g===void 0||(h[m]=g),h},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,f)=>{let{class:m,className:g,...b}=f;return Object.entries(b).every(N=>{let[j,v]=N;return Array.isArray(v)?v.includes({...i,...c}[j]):{...i,...c}[j]===v})?[...h,m,g]:h},[]);return F1(t,o,u,n==null?void 0:n.class,n==null?void 0:n.className)},rI=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),uk=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),If="-",B1=[],iI="arbitrary..",oI=t=>{const e=cI(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return lI(o);const c=o.split(If),u=c[0]===""&&c.length>1?1:0;return hk(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=r[o],h=n[o];return u?h?rI(h,u):u:h||B1}return n[o]||B1}}},hk=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const a=t[e],i=n.nextPart.get(a);if(i){const h=hk(t,e+1,i);if(h)return h}const o=n.validators;if(o===null)return;const c=e===0?t.join(If):t.slice(e).join(If),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?iI+r:void 0})(),cI=t=>{const{theme:e,classGroups:n}=t;return dI(n,e)},dI=(t,e)=>{const n=uk();for(const r in t){const a=t[r];Z0(a,n,r,e)}return n},Z0=(t,e,n,r)=>{const a=t.length;for(let i=0;i{if(typeof t=="string"){hI(t,e,n);return}if(typeof t=="function"){fI(t,e,n,r);return}pI(t,e,n,r)},hI=(t,e,n)=>{const r=t===""?e:fk(e,t);r.classGroupId=n},fI=(t,e,n,r)=>{if(mI(t)){Z0(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(aI(n,t))},pI=(t,e,n,r)=>{const a=Object.entries(t),i=a.length;for(let o=0;o{let n=t;const r=e.split(If),a=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,gI=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)}}},Kx="!",V1=":",xI=[],H1=(t,e,n,r,a)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),yI=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=a=>{const i=[];let o=0,c=0,u=0,h;const f=a.length;for(let j=0;ju?h-u:void 0;return H1(i,b,g,N)};if(e){const a=e+V1,i=r;r=o=>o.startsWith(a)?i(o.slice(a.length)):H1(xI,!1,o,void 0,!0)}if(n){const a=r;r=i=>n({className:i,parseClassName:a})}return r},bI=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}},vI=t=>({cache:gI(t.cacheSize),parseClassName:yI(t),sortModifiers:bI(t),...oI(t)}),NI=/\s+/,wI=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:i}=e,o=[],c=t.trim().split(NI);let u="";for(let h=c.length-1;h>=0;h-=1){const f=c[h],{isExternal:m,modifiers:g,hasImportantModifier:b,baseClassName:N,maybePostfixModifierPosition:j}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let v=!!j,k=r(v?N.substring(0,j):N);if(!k){if(!v){u=f+(u.length>0?" "+u:u);continue}if(k=r(N),!k){u=f+(u.length>0?" "+u:u);continue}v=!1}const T=g.length===0?"":g.length===1?g[0]:i(g).join(":"),C=b?T+Kx:T,R=C+k;if(o.indexOf(R)>-1)continue;o.push(R);const O=a(k,v);for(let U=0;U0?" "+u:u)}return u},jI=(...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=vI(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=wI(u,n);return a(u,f),f};return i=o,(...u)=>i(jI(...u))},SI=[],Qn=t=>{const e=n=>n[t]||SI;return e.isThemeGetter=!0,e},mk=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,gk=/^\((?:(\w[\w-]*):)?(.+)\)$/i,CI=/^\d+\/\d+$/,EI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,TI=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,MI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,AI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,II=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Tc=t=>CI.test(t),Tt=t=>!!t&&!Number.isNaN(Number(t)),uo=t=>!!t&&Number.isInteger(Number(t)),zg=t=>t.endsWith("%")&&Tt(t.slice(0,-1)),xi=t=>EI.test(t),PI=()=>!0,RI=t=>TI.test(t)&&!MI.test(t),xk=()=>!1,LI=t=>AI.test(t),OI=t=>II.test(t),DI=t=>!et(t)&&!tt(t),_I=t=>cd(t,vk,xk),et=t=>mk.test(t),jl=t=>cd(t,Nk,RI),Fg=t=>cd(t,VI,Tt),U1=t=>cd(t,yk,xk),$I=t=>cd(t,bk,OI),Uh=t=>cd(t,wk,LI),tt=t=>gk.test(t),Qd=t=>dd(t,Nk),zI=t=>dd(t,HI),W1=t=>dd(t,yk),FI=t=>dd(t,vk),BI=t=>dd(t,bk),Wh=t=>dd(t,wk,!0),cd=(t,e,n)=>{const r=mk.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},dd=(t,e,n=!1)=>{const r=gk.exec(t);return r?r[1]?e(r[1]):n:!1},yk=t=>t==="position"||t==="percentage",bk=t=>t==="image"||t==="url",vk=t=>t==="length"||t==="size"||t==="bg-size",Nk=t=>t==="length",VI=t=>t==="number",HI=t=>t==="family-name",wk=t=>t==="shadow",UI=()=>{const t=Qn("color"),e=Qn("font"),n=Qn("text"),r=Qn("font-weight"),a=Qn("tracking"),i=Qn("leading"),o=Qn("breakpoint"),c=Qn("container"),u=Qn("spacing"),h=Qn("radius"),f=Qn("shadow"),m=Qn("inset-shadow"),g=Qn("text-shadow"),b=Qn("drop-shadow"),N=Qn("blur"),j=Qn("perspective"),v=Qn("aspect"),k=Qn("ease"),T=Qn("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],R=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],O=()=>[...R(),tt,et],U=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto","contain","none"],z=()=>[tt,et,u],L=()=>[Tc,"full","auto",...z()],Q=()=>[uo,"none","subgrid",tt,et],se=()=>["auto",{span:["full",uo,tt,et]},uo,tt,et],$=()=>[uo,"auto",tt,et],ie=()=>["auto","min","max","fr",tt,et],le=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],me=()=>["start","end","center","stretch","center-safe","end-safe"],I=()=>["auto",...z()],Y=()=>[Tc,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...z()],F=()=>[t,tt,et],ge=()=>[...R(),W1,U1,{position:[tt,et]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],B=()=>["auto","cover","contain",FI,_I,{size:[tt,et]}],W=()=>[zg,Qd,jl],fe=()=>["","none","full",h,tt,et],he=()=>["",Tt,Qd,jl],de=()=>["solid","dashed","dotted","double"],D=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],q=()=>[Tt,zg,W1,U1],_=()=>["","none",N,tt,et],Z=()=>["none",Tt,tt,et],re=()=>["none",Tt,tt,et],we=()=>[Tt,tt,et],Fe=()=>[Tc,"full",...z()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[xi],breakpoint:[xi],color:[PI],container:[xi],"drop-shadow":[xi],ease:["in","out","in-out"],font:[DI],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[xi],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[xi],shadow:[xi],spacing:["px",Tt],text:[xi],"text-shadow":[xi],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Tc,et,tt,v]}],container:["container"],columns:[{columns:[Tt,et,tt,c]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:O()}],overflow:[{overflow:U()}],"overflow-x":[{"overflow-x":U()}],"overflow-y":[{"overflow-y":U()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{start:L()}],end:[{end:L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[uo,"auto",tt,et]}],basis:[{basis:[Tc,"full","auto",c,...z()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Tt,Tc,"auto","initial","none",et]}],grow:[{grow:["",Tt,tt,et]}],shrink:[{shrink:["",Tt,tt,et]}],order:[{order:[uo,"first","last","none",tt,et]}],"grid-cols":[{"grid-cols":Q()}],"col-start-end":[{col:se()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":Q()}],"row-start-end":[{row:se()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ie()}],"auto-rows":[{"auto-rows":ie()}],gap:[{gap:z()}],"gap-x":[{"gap-x":z()}],"gap-y":[{"gap-y":z()}],"justify-content":[{justify:[...le(),"normal"]}],"justify-items":[{"justify-items":[...me(),"normal"]}],"justify-self":[{"justify-self":["auto",...me()]}],"align-content":[{content:["normal",...le()]}],"align-items":[{items:[...me(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...me(),{baseline:["","last"]}]}],"place-content":[{"place-content":le()}],"place-items":[{"place-items":[...me(),"baseline"]}],"place-self":[{"place-self":["auto",...me()]}],p:[{p:z()}],px:[{px:z()}],py:[{py:z()}],ps:[{ps:z()}],pe:[{pe:z()}],pt:[{pt:z()}],pr:[{pr:z()}],pb:[{pb:z()}],pl:[{pl:z()}],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":z()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":z()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],w:[{w:[c,"screen",...Y()]}],"min-w":[{"min-w":[c,"screen","none",...Y()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",n,Qd,jl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,tt,Fg]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",zg,et]}],"font-family":[{font:[zI,et,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,tt,et]}],"line-clamp":[{"line-clamp":[Tt,"none",tt,Fg]}],leading:[{leading:[i,...z()]}],"list-image":[{"list-image":["none",tt,et]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",tt,et]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...de(),"wavy"]}],"text-decoration-thickness":[{decoration:[Tt,"from-font","auto",tt,jl]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[Tt,"auto",tt,et]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:z()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",tt,et]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",tt,et]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ge()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:B()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},uo,tt,et],radial:["",tt,et],conic:[uo,tt,et]},BI,$I]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:W()}],"gradient-via-pos":[{via:W()}],"gradient-to-pos":[{to:W()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],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:[...de(),"hidden","none"]}],"divide-style":[{divide:[...de(),"hidden","none"]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...de(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Tt,tt,et]}],"outline-w":[{outline:["",Tt,Qd,jl]}],"outline-color":[{outline:F()}],shadow:[{shadow:["","none",f,Wh,Uh]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":["none",m,Wh,Uh]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:he()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[Tt,jl]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":he()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":["none",g,Wh,Uh]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[Tt,tt,et]}],"mix-blend":[{"mix-blend":[...D(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":D()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Tt]}],"mask-image-linear-from-pos":[{"mask-linear-from":q()}],"mask-image-linear-to-pos":[{"mask-linear-to":q()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":q()}],"mask-image-t-to-pos":[{"mask-t-to":q()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":q()}],"mask-image-r-to-pos":[{"mask-r-to":q()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":q()}],"mask-image-b-to-pos":[{"mask-b-to":q()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":q()}],"mask-image-l-to-pos":[{"mask-l-to":q()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":q()}],"mask-image-x-to-pos":[{"mask-x-to":q()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":q()}],"mask-image-y-to-pos":[{"mask-y-to":q()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[tt,et]}],"mask-image-radial-from-pos":[{"mask-radial-from":q()}],"mask-image-radial-to-pos":[{"mask-radial-to":q()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"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":[Tt]}],"mask-image-conic-from-pos":[{"mask-conic-from":q()}],"mask-image-conic-to-pos":[{"mask-conic-to":q()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ge()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:B()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",tt,et]}],filter:[{filter:["","none",tt,et]}],blur:[{blur:_()}],brightness:[{brightness:[Tt,tt,et]}],contrast:[{contrast:[Tt,tt,et]}],"drop-shadow":[{"drop-shadow":["","none",b,Wh,Uh]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:["",Tt,tt,et]}],"hue-rotate":[{"hue-rotate":[Tt,tt,et]}],invert:[{invert:["",Tt,tt,et]}],saturate:[{saturate:[Tt,tt,et]}],sepia:[{sepia:["",Tt,tt,et]}],"backdrop-filter":[{"backdrop-filter":["","none",tt,et]}],"backdrop-blur":[{"backdrop-blur":_()}],"backdrop-brightness":[{"backdrop-brightness":[Tt,tt,et]}],"backdrop-contrast":[{"backdrop-contrast":[Tt,tt,et]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Tt,tt,et]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Tt,tt,et]}],"backdrop-invert":[{"backdrop-invert":["",Tt,tt,et]}],"backdrop-opacity":[{"backdrop-opacity":[Tt,tt,et]}],"backdrop-saturate":[{"backdrop-saturate":[Tt,tt,et]}],"backdrop-sepia":[{"backdrop-sepia":["",Tt,tt,et]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":z()}],"border-spacing-x":[{"border-spacing-x":z()}],"border-spacing-y":[{"border-spacing-y":z()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",tt,et]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Tt,"initial",tt,et]}],ease:[{ease:["linear","initial",k,tt,et]}],delay:[{delay:[Tt,tt,et]}],animate:[{animate:["none",T,tt,et]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,tt,et]}],"perspective-origin":[{"perspective-origin":O()}],rotate:[{rotate:Z()}],"rotate-x":[{"rotate-x":Z()}],"rotate-y":[{"rotate-y":Z()}],"rotate-z":[{"rotate-z":Z()}],scale:[{scale:re()}],"scale-x":[{"scale-x":re()}],"scale-y":[{"scale-y":re()}],"scale-z":[{"scale-z":re()}],"scale-3d":["scale-3d"],skew:[{skew:we()}],"skew-x":[{"skew-x":we()}],"skew-y":[{"skew-y":we()}],transform:[{transform:[tt,et,"","none","gpu","cpu"]}],"transform-origin":[{origin:O()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Fe()}],"translate-x":[{"translate-x":Fe()}],"translate-y":[{"translate-y":Fe()}],"translate-z":[{"translate-z":Fe()}],"translate-none":["translate-none"],accent:[{accent:F()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:F()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",tt,et]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":z()}],"scroll-mx":[{"scroll-mx":z()}],"scroll-my":[{"scroll-my":z()}],"scroll-ms":[{"scroll-ms":z()}],"scroll-me":[{"scroll-me":z()}],"scroll-mt":[{"scroll-mt":z()}],"scroll-mr":[{"scroll-mr":z()}],"scroll-mb":[{"scroll-mb":z()}],"scroll-ml":[{"scroll-ml":z()}],"scroll-p":[{"scroll-p":z()}],"scroll-px":[{"scroll-px":z()}],"scroll-py":[{"scroll-py":z()}],"scroll-ps":[{"scroll-ps":z()}],"scroll-pe":[{"scroll-pe":z()}],"scroll-pt":[{"scroll-pt":z()}],"scroll-pr":[{"scroll-pr":z()}],"scroll-pb":[{"scroll-pb":z()}],"scroll-pl":[{"scroll-pl":z()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",tt,et]}],fill:[{fill:["none",...F()]}],"stroke-w":[{stroke:[Tt,Qd,jl,Fg]}],stroke:[{stroke:["none",...F()]}],"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"]}},WI=kI(UI);function zt(...t){return WI(ck(t))}function ma(t){if(!t)return"";let e=t.trim();return e?(e=e.replace(/^(https?)\/\//,"$1://"),e):""}const KI=dk("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?ok:"button";return s.jsx(i,{"data-slot":"button",className:zt(KI({variant:e,size:n,className:t})),...a})}function ce({className:t,type:e,...n}){return s.jsx("input",{type:e,"data-slot":"input",className:zt("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 qI(){const t=Ka(),[e,n]=y.useState(""),[r,a]=y.useState(""),[i,o]=y.useState(""),[c,u]=y.useState(!1);y.useEffect(()=>{$u()&&t("/dashboard",{replace:!0})},[t]);const h=async()=>{o(""),u(!0);try{const f=await kt("/api/admin",{username:e.trim(),password:r});if((f==null?void 0:f.success)!==!1&&(f!=null&&f.token)){UA(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(Fc,{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(Si,{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(MM,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-500"}),s.jsx(ce,{type:"password",value:r,onChange:f=>{a(f.target.value),i&&o("")},placeholder:"请输入密码",className:"pl-10 bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 focus:border-[#38bdac]",onKeyDown:f=>f.key==="Enter"&&h()})]})]}),i&&s.jsx("div",{className:"bg-red-500/10 text-red-400 text-sm p-3 rounded-lg border border-red-500/20",children:i}),s.jsx(J,{onClick:h,disabled:c,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white py-5 disabled:opacity-50",children:c?"登录中...":"登录"})]})]}),s.jsx("p",{className:"text-center text-gray-500 text-xs mt-6",children:"Soul创业实验场 · 后台管理系统"})]})]})}const De=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:zt("rounded-xl border bg-card text-card-foreground shadow",t),...e}));De.displayName="Card";const ut=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:zt("flex flex-col space-y-1.5 p-6",t),...e}));ut.displayName="CardHeader";const ht=y.forwardRef(({className:t,...e},n)=>s.jsx("h3",{ref:n,className:zt("font-semibold leading-none tracking-tight",t),...e}));ht.displayName="CardTitle";const qt=y.forwardRef(({className:t,...e},n)=>s.jsx("p",{ref:n,className:zt("text-sm text-muted-foreground",t),...e}));qt.displayName="CardDescription";const _e=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:zt("p-6 pt-0",t),...e}));_e.displayName="CardContent";const GI=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:zt("flex items-center p-6 pt-0",t),...e}));GI.displayName="CardFooter";const JI={success:{bg:"#f0fdf4",border:"#22c55e",icon:"✓"},error:{bg:"#fef2f2",border:"#ef4444",icon:"✕"},info:{bg:"#eff6ff",border:"#3b82f6",icon:"ℹ"}};function Bg(t,e="info",n=3e3){const r=`toast-${Date.now()}`,a=JI[e],i=document.createElement("div");i.id=r,i.setAttribute("role","alert"),Object.assign(i.style,{position:"fixed",top:"24px",right:"24px",zIndex:"9999",display:"flex",alignItems:"center",gap:"10px",padding:"12px 18px",borderRadius:"10px",background:a.bg,border:`1.5px solid ${a.border}`,boxShadow:"0 4px 20px rgba(0,0,0,.12)",fontSize:"14px",color:"#1a1a1a",fontWeight:"500",maxWidth:"380px",lineHeight:"1.5",opacity:"0",transform:"translateY(-8px)",transition:"opacity .22s ease, transform .22s ease",pointerEvents:"none"});const o=document.createElement("span");Object.assign(o.style,{width:"20px",height:"20px",borderRadius:"50%",background:a.border,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:"700",flexShrink:"0"}),o.textContent=a.icon;const c=document.createElement("span");c.textContent=t,i.appendChild(o),i.appendChild(c),document.body.appendChild(i),requestAnimationFrame(()=>{i.style.opacity="1",i.style.transform="translateY(0)"});const u=setTimeout(()=>h(r),n);function h(f){clearTimeout(u);const m=document.getElementById(f);m&&(m.style.opacity="0",m.style.transform="translateY(-8px)",setTimeout(()=>{var g;return(g=m.parentNode)==null?void 0:g.removeChild(m)},250))}}const G={success:(t,e)=>Bg(t,"success",e),error:(t,e)=>Bg(t,"error",e),info:(t,e)=>Bg(t,"info",e)};function St(t,e,{checkForDefaultPrevented:n=!0}={}){return function(a){if(t==null||t(a),n===!1||!a.defaultPrevented)return e==null?void 0:e(a)}}function QI(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 Wo(t,e=[]){let n=[];function r(i,o){const c=y.createContext(o),u=n.length;n=[...n,o];const h=m=>{var k;const{scope:g,children:b,...N}=m,j=((k=g==null?void 0:g[t])==null?void 0:k[u])||c,v=y.useMemo(()=>N,Object.values(N));return s.jsx(j.Provider,{value:v,children:b})};h.displayName=i+"Provider";function f(m,g){var j;const b=((j=g==null?void 0:g[t])==null?void 0:j[u])||c,N=y.useContext(b);if(N)return N;if(o!==void 0)return o;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[h,f]}const a=()=>{const i=n.map(o=>y.createContext(o));return function(c){const u=(c==null?void 0:c[t])||i;return y.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])}};return a.scopeName=t,[r,YI(a,...e)]}function YI(...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 Ps=globalThis!=null&&globalThis.document?y.useLayoutEffect:()=>{},XI=Tp[" useId ".trim().toString()]||(()=>{}),ZI=0;function Io(t){const[e,n]=y.useState(XI());return Ps(()=>{n(r=>r??String(ZI++))},[t]),e?`radix-${e}`:""}var eP=Tp[" useInsertionEffect ".trim().toString()]||Ps;function Fl({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[a,i,o]=tP({defaultProp:e,onChange:n}),c=t!==void 0,u=c?t:a;{const f=y.useRef(t!==void 0);y.useEffect(()=>{const m=f.current;m!==c&&console.warn(`${r} is changing from ${m?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=c},[c,r])}const h=y.useCallback(f=>{var m;if(c){const g=nP(f)?f(t):f;g!==t&&((m=o.current)==null||m.call(o,g))}else i(f)},[c,t,i,o]);return[u,h]}function tP({defaultProp:t,onChange:e}){const[n,r]=y.useState(t),a=y.useRef(n),i=y.useRef(e);return eP(()=>{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 nP(t){return typeof t=="function"}function ju(t){const e=sP(t),n=y.forwardRef((r,a)=>{const{children:i,...o}=r,c=y.Children.toArray(i),u=c.find(aP);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 sP(t){const e=y.forwardRef((n,r)=>{const{children:a,...i}=n;if(y.isValidElement(a)){const o=oP(a),c=iP(i,a.props);return a.type!==y.Fragment&&(c.ref=r?X0(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 rP=Symbol("radix.slottable");function aP(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===rP}function iP(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 oP(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 lP=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Mt=lP.reduce((t,e)=>{const n=ju(`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 cP(t,e){t&&id.flushSync(()=>t.dispatchEvent(e))}function $o(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 dP(t,e=globalThis==null?void 0:globalThis.document){const n=$o(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 uP="DismissableLayer",qx="dismissableLayer.update",hP="dismissableLayer.pointerDownOutside",fP="dismissableLayer.focusOutside",K1,jk=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ey=y.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,onDismiss:c,...u}=t,h=y.useContext(jk),[f,m]=y.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=y.useState({}),N=Jt(e,P=>m(P)),j=Array.from(h.layers),[v]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),k=j.indexOf(v),T=f?j.indexOf(f):-1,C=h.layersWithOutsidePointerEventsDisabled.size>0,R=T>=k,O=gP(P=>{const z=P.target,L=[...h.branches].some(Q=>Q.contains(z));!R||L||(a==null||a(P),o==null||o(P),P.defaultPrevented||c==null||c())},g),U=xP(P=>{const z=P.target;[...h.branches].some(Q=>Q.contains(z))||(i==null||i(P),o==null||o(P),P.defaultPrevented||c==null||c())},g);return dP(P=>{T===h.layers.size-1&&(r==null||r(P),!P.defaultPrevented&&c&&(P.preventDefault(),c()))},g),y.useEffect(()=>{if(f)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(K1=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),q1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=K1)}},[f,g,n,h]),y.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),q1())},[f,h]),y.useEffect(()=>{const P=()=>b({});return document.addEventListener(qx,P),()=>document.removeEventListener(qx,P)},[]),s.jsx(Mt.div,{...u,ref:N,style:{pointerEvents:C?R?"auto":"none":void 0,...t.style},onFocusCapture:St(t.onFocusCapture,U.onFocusCapture),onBlurCapture:St(t.onBlurCapture,U.onBlurCapture),onPointerDownCapture:St(t.onPointerDownCapture,O.onPointerDownCapture)})});ey.displayName=uP;var pP="DismissableLayerBranch",mP=y.forwardRef((t,e)=>{const n=y.useContext(jk),r=y.useRef(null),a=Jt(e,r);return y.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),s.jsx(Mt.div,{...t,ref:a})});mP.displayName=pP;function gP(t,e=globalThis==null?void 0:globalThis.document){const n=$o(t),r=y.useRef(!1),a=y.useRef(()=>{});return y.useEffect(()=>{const i=c=>{if(c.target&&!r.current){let u=function(){kk(hP,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 xP(t,e=globalThis==null?void 0:globalThis.document){const n=$o(t),r=y.useRef(!1);return y.useEffect(()=>{const a=i=>{i.target&&!r.current&&kk(fP,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 q1(){const t=new CustomEvent(qx);document.dispatchEvent(t)}function kk(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?cP(a,i):a.dispatchEvent(i)}var Vg="focusScope.autoFocusOnMount",Hg="focusScope.autoFocusOnUnmount",G1={bubbles:!1,cancelable:!0},yP="FocusScope",ty=y.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=t,[c,u]=y.useState(null),h=$o(a),f=$o(i),m=y.useRef(null),g=Jt(e,j=>u(j)),b=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let j=function(C){if(b.paused||!c)return;const R=C.target;c.contains(R)?m.current=R:po(m.current,{select:!0})},v=function(C){if(b.paused||!c)return;const R=C.relatedTarget;R!==null&&(c.contains(R)||po(m.current,{select:!0}))},k=function(C){if(document.activeElement===document.body)for(const O of C)O.removedNodes.length>0&&po(c)};document.addEventListener("focusin",j),document.addEventListener("focusout",v);const T=new MutationObserver(k);return c&&T.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",v),T.disconnect()}}},[r,c,b.paused]),y.useEffect(()=>{if(c){Q1.add(b);const j=document.activeElement;if(!c.contains(j)){const k=new CustomEvent(Vg,G1);c.addEventListener(Vg,h),c.dispatchEvent(k),k.defaultPrevented||(bP(kP(Sk(c)),{select:!0}),document.activeElement===j&&po(c))}return()=>{c.removeEventListener(Vg,h),setTimeout(()=>{const k=new CustomEvent(Hg,G1);c.addEventListener(Hg,f),c.dispatchEvent(k),k.defaultPrevented||po(j??document.body,{select:!0}),c.removeEventListener(Hg,f),Q1.remove(b)},0)}}},[c,h,f,b]);const N=y.useCallback(j=>{if(!n&&!r||b.paused)return;const v=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,k=document.activeElement;if(v&&k){const T=j.currentTarget,[C,R]=vP(T);C&&R?!j.shiftKey&&k===R?(j.preventDefault(),n&&po(C,{select:!0})):j.shiftKey&&k===C&&(j.preventDefault(),n&&po(R,{select:!0})):k===T&&j.preventDefault()}},[n,r,b.paused]);return s.jsx(Mt.div,{tabIndex:-1,...o,ref:g,onKeyDown:N})});ty.displayName=yP;function bP(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(po(r,{select:e}),document.activeElement!==n)return}function vP(t){const e=Sk(t),n=J1(e,t),r=J1(e.reverse(),t);return[n,r]}function Sk(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 J1(t,e){for(const n of t)if(!NP(n,{upTo:e}))return n}function NP(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 wP(t){return t instanceof HTMLInputElement&&"select"in t}function po(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&wP(t)&&e&&t.select()}}var Q1=jP();function jP(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=Y1(t,e),t.unshift(e)},remove(e){var n;t=Y1(t,e),(n=t[0])==null||n.resume()}}}function Y1(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function kP(t){return t.filter(e=>e.tagName!=="A")}var SP="Portal",ny=y.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[a,i]=y.useState(!1);Ps(()=>i(!0),[]);const o=n||a&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return o?_j.createPortal(s.jsx(Mt.div,{...r,ref:e}),o):null});ny.displayName=SP;function CP(t,e){return y.useReducer((n,r)=>e[n][r]??n,t)}var zu=t=>{const{present:e,children:n}=t,r=EP(e),a=typeof n=="function"?n({present:r.isPresent}):y.Children.only(n),i=Jt(r.ref,TP(a));return typeof n=="function"||r.isPresent?y.cloneElement(a,{ref:i}):null};zu.displayName="Presence";function EP(t){const[e,n]=y.useState(),r=y.useRef(null),a=y.useRef(t),i=y.useRef("none"),o=t?"mounted":"unmounted",[c,u]=CP(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const h=Kh(r.current);i.current=c==="mounted"?h:"none"},[c]),Ps(()=>{const h=r.current,f=a.current;if(f!==t){const g=i.current,b=Kh(h);t?u("MOUNT"):b==="none"||(h==null?void 0:h.display)==="none"?u("UNMOUNT"):u(f&&g!==b?"ANIMATION_OUT":"UNMOUNT"),a.current=t}},[t,u]),Ps(()=>{if(e){let h;const f=e.ownerDocument.defaultView??window,m=b=>{const j=Kh(r.current).includes(CSS.escape(b.animationName));if(b.target===e&&j&&(u("ANIMATION_END"),!a.current)){const v=e.style.animationFillMode;e.style.animationFillMode="forwards",h=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=v)})}},g=b=>{b.target===e&&(i.current=Kh(r.current))};return e.addEventListener("animationstart",g),e.addEventListener("animationcancel",m),e.addEventListener("animationend",m),()=>{f.clearTimeout(h),e.removeEventListener("animationstart",g),e.removeEventListener("animationcancel",m),e.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:y.useCallback(h=>{r.current=h?getComputedStyle(h):null,n(h)},[])}}function Kh(t){return(t==null?void 0:t.animationName)||"none"}function TP(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 Ug=0;function Ck(){y.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??X1()),document.body.insertAdjacentElement("beforeend",t[1]??X1()),Ug++,()=>{Ug===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Ug--}},[])}function X1(){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 za=function(){return za=Object.assign||function(e){for(var n,r=1,a=arguments.length;r"u")return WP;var e=KP(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])}},GP=Ak(),Wc="data-scroll-locked",JP=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(AP,` { - overflow: hidden `).concat(r,`; - padding-right: `).concat(c,"px ").concat(r,`; - } - body[`).concat(Wc,`] { ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - 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(""),` - } - -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - .`).concat(gf,` { - right: `).concat(c,"px ").concat(r,`; - } - - .`).concat(xf,` { - margin-right: `).concat(c,"px ").concat(r,`; - } - - .`).concat(gf," .").concat(gf,` { - right: 0 `).concat(r,`; - } - - .`).concat(xf," .").concat(xf,` { - margin-right: 0 `).concat(r,`; - } - - body[`).concat(Kc,`] { - `).concat(RI,": ").concat(c,`px; - } -`)},nN=function(){var t=parseInt(document.body.getAttribute(Kc)||"0",10);return isFinite(t)?t:0},XI=function(){y.useEffect(function(){return document.body.setAttribute(Kc,(nN()+1).toString()),function(){var t=nN()-1;t<=0?document.body.removeAttribute(Kc):document.body.setAttribute(Kc,t.toString())}},[])},ZI=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,a=r===void 0?"margin":r;XI();var i=y.useMemo(function(){return JI(a)},[a]);return y.createElement(QI,{styles:YI(i,!e,a,n?"":"!important")})},Jx=!1;if(typeof window<"u")try{var Gh=Object.defineProperty({},"passive",{get:function(){return Jx=!0,!0}});window.addEventListener("test",Gh,Gh),window.removeEventListener("test",Gh,Gh)}catch{Jx=!1}var Ac=Jx?{passive:!1}:!1,eR=function(t){return t.tagName==="TEXTAREA"},Rk=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!eR(t)&&n[e]==="visible")},tR=function(t){return Rk(t,"overflowY")},nR=function(t){return Rk(t,"overflowX")},sN=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=Lk(t,r);if(a){var i=Ok(t,r),o=i[1],c=i[2];if(o>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},sR=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},rR=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},Lk=function(t,e){return t==="v"?tR(e):nR(e)},Ok=function(t,e){return t==="v"?sR(e):rR(e)},aR=function(t,e){return t==="h"&&e==="rtl"?-1:1},iR=function(t,e,n,r,a){var i=aR(t,window.getComputedStyle(e).direction),o=i*r,c=n.target,u=e.contains(c),h=!1,f=o>0,m=0,g=0;do{if(!c)break;var b=Ok(t,c),N=b[0],j=b[1],v=b[2],k=j-v-i*N;(N||k)&&Lk(t,c)&&(m+=k,g+=N);var T=c.parentNode;c=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!u&&c!==document.body||u&&(e.contains(c)||e===c));return(f&&Math.abs(m)<1||!f&&Math.abs(g)<1)&&(h=!0),h},Jh=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},rN=function(t){return[t.deltaX,t.deltaY]},aN=function(t){return t&&"current"in t?t.current:t},oR=function(t,e){return t[0]===e[0]&&t[1]===e[1]},lR=function(t){return` - .block-interactivity-`.concat(t,` {pointer-events: none;} - .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},cR=0,Pc=[];function dR(t){var e=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),a=y.useState(cR++)[0],i=y.useState(Ik)[0],o=y.useRef(t);y.useEffect(function(){o.current=t},[t]),y.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(a));var j=PI([t.lockRef.current],(t.shards||[]).map(aN),!0).filter(Boolean);return j.forEach(function(v){return v.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),j.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(a))})}}},[t.inert,t.lockRef.current,t.shards]);var c=y.useCallback(function(j,v){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!o.current.allowPinchZoom;var k=Jh(j),T=n.current,C="deltaX"in j?j.deltaX:T[0]-k[0],R="deltaY"in j?j.deltaY:T[1]-k[1],O,U=j.target,I=Math.abs(C)>Math.abs(R)?"h":"v";if("touches"in j&&I==="h"&&U.type==="range")return!1;var z=window.getSelection(),L=z&&z.anchorNode,Q=L?L===U||L.contains(U):!1;if(Q)return!1;var se=sN(I,U);if(!se)return!0;if(se?O=I:(O=I==="v"?"h":"v",se=sN(I,U)),!se)return!1;if(!r.current&&"changedTouches"in j&&(C||R)&&(r.current=O),!O)return!0;var $=r.current||O;return iR($,v,j,$==="h"?C:R)},[]),u=y.useCallback(function(j){var v=j;if(!(!Pc.length||Pc[Pc.length-1]!==i)){var k="deltaY"in v?rN(v):Jh(v),T=e.current.filter(function(O){return O.name===v.type&&(O.target===v.target||v.target===O.shadowParent)&&oR(O.delta,k)})[0];if(T&&T.should){v.cancelable&&v.preventDefault();return}if(!T){var C=(o.current.shards||[]).map(aN).filter(Boolean).filter(function(O){return O.contains(v.target)}),R=C.length>0?c(v,C[0]):!o.current.noIsolation;R&&v.cancelable&&v.preventDefault()}}},[]),h=y.useCallback(function(j,v,k,T){var C={name:j,delta:v,target:k,should:T,shadowParent:uR(k)};e.current.push(C),setTimeout(function(){e.current=e.current.filter(function(R){return R!==C})},1)},[]),f=y.useCallback(function(j){n.current=Jh(j),r.current=void 0},[]),m=y.useCallback(function(j){h(j.type,rN(j),j.target,c(j,t.lockRef.current))},[]),g=y.useCallback(function(j){h(j.type,Jh(j),j.target,c(j,t.lockRef.current))},[]);y.useEffect(function(){return Pc.push(i),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",u,Ac),document.addEventListener("touchmove",u,Ac),document.addEventListener("touchstart",f,Ac),function(){Pc=Pc.filter(function(j){return j!==i}),document.removeEventListener("wheel",u,Ac),document.removeEventListener("touchmove",u,Ac),document.removeEventListener("touchstart",f,Ac)}},[]);var b=t.removeScrollBar,N=t.inert;return y.createElement(y.Fragment,null,N?y.createElement(i,{styles:lR(a)}):null,b?y.createElement(ZI,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function uR(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const hR=FI(Pk,dR);var ay=y.forwardRef(function(t,e){return y.createElement(Rp,Ba({},t,{ref:e,sideCar:hR}))});ay.classNames=Rp.classNames;var fR=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Ic=new WeakMap,Qh=new WeakMap,Yh={},Jg=0,Dk=function(t){return t&&(t.host||Dk(t.parentNode))},pR=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=Dk(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})},mR=function(t,e,n,r){var a=pR(e,Array.isArray(t)?t:[t]);Yh[n]||(Yh[n]=new WeakMap);var i=Yh[n],o=[],c=new Set,u=new Set(a),h=function(m){!m||c.has(m)||(c.add(m),h(m.parentNode))};a.forEach(h);var f=function(m){!m||u.has(m)||Array.prototype.forEach.call(m.children,function(g){if(c.has(g))f(g);else try{var b=g.getAttribute(r),N=b!==null&&b!=="false",j=(Ic.get(g)||0)+1,v=(i.get(g)||0)+1;Ic.set(g,j),i.set(g,v),o.push(g),j===1&&N&&Qh.set(g,!0),v===1&&g.setAttribute(n,"true"),N||g.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",g,k)}})};return f(e),c.clear(),Jg++,function(){o.forEach(function(m){var g=Ic.get(m)-1,b=i.get(m)-1;Ic.set(m,g),i.set(m,b),g||(Qh.has(m)||m.removeAttribute(r),Qh.delete(m)),b||m.removeAttribute(n)}),Jg--,Jg||(Ic=new WeakMap,Ic=new WeakMap,Qh=new WeakMap,Yh={})}},_k=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),a=fR(t);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),mR(r,a,n,"aria-hidden")):function(){return null}},Lp="Dialog",[$k]=Ko(Lp),[gR,Na]=$k(Lp),zk=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]=Bl({prop:r,defaultProp:a??!1,onChange:i,caller:Lp});return s.jsx(gR,{scope:e,triggerRef:c,contentRef:u,contentId:Io(),titleId:Io(),descriptionId:Io(),open:h,onOpenChange:f,onOpenToggle:y.useCallback(()=>f(m=>!m),[f]),modal:o,children:n})};zk.displayName=Lp;var Fk="DialogTrigger",xR=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Na(Fk,n),i=Jt(e,a.triggerRef);return s.jsx(Mt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":ly(a.open),...r,ref:i,onClick:St(t.onClick,a.onOpenToggle)})});xR.displayName=Fk;var iy="DialogPortal",[yR,Bk]=$k(iy,{forceMount:void 0}),Vk=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:a}=t,i=Na(iy,e);return s.jsx(yR,{scope:e,forceMount:n,children:y.Children.map(r,o=>s.jsx(Fu,{present:n||i.open,children:s.jsx(ry,{asChild:!0,container:a,children:o})}))})};Vk.displayName=iy;var Rf="DialogOverlay",Hk=y.forwardRef((t,e)=>{const n=Bk(Rf,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=Na(Rf,t.__scopeDialog);return i.modal?s.jsx(Fu,{present:r||i.open,children:s.jsx(vR,{...a,ref:e})}):null});Hk.displayName=Rf;var bR=ku("DialogOverlay.RemoveScroll"),vR=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Na(Rf,n);return s.jsx(ay,{as:bR,allowPinchZoom:!0,shards:[a.contentRef],children:s.jsx(Mt.div,{"data-state":ly(a.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Vl="DialogContent",Uk=y.forwardRef((t,e)=>{const n=Bk(Vl,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=Na(Vl,t.__scopeDialog);return s.jsx(Fu,{present:r||i.open,children:i.modal?s.jsx(NR,{...a,ref:e}):s.jsx(wR,{...a,ref:e})})});Uk.displayName=Vl;var NR=y.forwardRef((t,e)=>{const n=Na(Vl,t.__scopeDialog),r=y.useRef(null),a=Jt(e,n.contentRef,r);return y.useEffect(()=>{const i=r.current;if(i)return _k(i)},[]),s.jsx(Wk,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:St(t.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:St(t.onPointerDownOutside,i=>{const o=i.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0;(o.button===2||c)&&i.preventDefault()}),onFocusOutside:St(t.onFocusOutside,i=>i.preventDefault())})}),wR=y.forwardRef((t,e)=>{const n=Na(Vl,t.__scopeDialog),r=y.useRef(!1),a=y.useRef(!1);return s.jsx(Wk,{...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()}})}),Wk=y.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,...o}=t,c=Na(Vl,n),u=y.useRef(null),h=Jt(e,u);return Tk(),s.jsxs(s.Fragment,{children:[s.jsx(sy,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:s.jsx(ny,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":ly(c.open),...o,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(jR,{titleId:c.titleId}),s.jsx(SR,{contentRef:u,descriptionId:c.descriptionId})]})]})}),oy="DialogTitle",Kk=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Na(oy,n);return s.jsx(Mt.h2,{id:a.titleId,...r,ref:e})});Kk.displayName=oy;var qk="DialogDescription",Gk=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Na(qk,n);return s.jsx(Mt.p,{id:a.descriptionId,...r,ref:e})});Gk.displayName=qk;var Jk="DialogClose",Qk=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Na(Jk,n);return s.jsx(Mt.button,{type:"button",...r,ref:e,onClick:St(t.onClick,()=>a.onOpenChange(!1))})});Qk.displayName=Jk;function ly(t){return t?"open":"closed"}var Yk="DialogTitleWarning",[mH,Xk]=XP(Yk,{contentName:Vl,titleName:oy,docsSlug:"dialog"}),jR=({titleId:t})=>{const e=Xk(Yk),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},kR="DialogDescriptionWarning",SR=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Xk(kR).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},CR=zk,ER=Vk,TR=Hk,MR=Uk,AR=Kk,PR=Gk,IR=Qk;function Dt(t){return s.jsx(CR,{"data-slot":"dialog",...t})}function RR(t){return s.jsx(ER,{...t})}const Zk=y.forwardRef(({className:t,...e},n)=>s.jsx(TR,{ref:n,className:zt("fixed inset-0 z-50 bg-black/50",t),...e}));Zk.displayName="DialogOverlay";const Ot=y.forwardRef(({className:t,children:e,showCloseButton:n=!0,...r},a)=>s.jsxs(RR,{children:[s.jsx(Zk,{}),s.jsxs(MR,{ref:a,"aria-describedby":void 0,className:zt("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(IR,{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(es,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ot.displayName="DialogContent";function _t({className:t,...e}){return s.jsx("div",{className:zt("flex flex-col gap-2 text-center sm:text-left",t),...e})}function rn({className:t,...e}){return s.jsx("div",{className:zt("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function $t(t){return s.jsx(AR,{className:"text-lg font-semibold leading-none",...t})}function Yc(t){return s.jsx(PR,{className:"text-sm text-muted-foreground",...t})}const LR=hk("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?ck:"span";return s.jsx(a,{className:zt(LR({variant:e}),t),...r})}var OR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],DR=OR.reduce((t,e)=>{const n=lk(`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}},{}),_R="Label",e2=y.forwardRef((t,e)=>s.jsx(DR.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())}}));e2.displayName=_R;var t2=e2;const te=y.forwardRef(({className:t,...e},n)=>s.jsx(t2,{ref:n,className:zt("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));te.displayName=t2.displayName;function cy(t){const e=t+"CollectionProvider",[n,r]=Ko(e),[a,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=j=>{const{scope:v,children:k}=j,T=Ks.useRef(null),C=Ks.useRef(new Map).current;return s.jsx(a,{scope:v,itemMap:C,collectionRef:T,children:k})};o.displayName=e;const c=t+"CollectionSlot",u=ku(c),h=Ks.forwardRef((j,v)=>{const{scope:k,children:T}=j,C=i(c,k),R=Jt(v,C.collectionRef);return s.jsx(u,{ref:R,children:T})});h.displayName=c;const f=t+"CollectionItemSlot",m="data-radix-collection-item",g=ku(f),b=Ks.forwardRef((j,v)=>{const{scope:k,children:T,...C}=j,R=Ks.useRef(null),O=Jt(v,R),U=i(f,k);return Ks.useEffect(()=>(U.itemMap.set(R,{ref:R,...C}),()=>void U.itemMap.delete(R))),s.jsx(g,{[m]:"",ref:O,children:T})});b.displayName=f;function N(j){const v=i(t+"CollectionConsumer",j);return Ks.useCallback(()=>{const T=v.collectionRef.current;if(!T)return[];const C=Array.from(T.querySelectorAll(`[${m}]`));return Array.from(v.itemMap.values()).sort((U,I)=>C.indexOf(U.ref.current)-C.indexOf(I.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:o,Slot:h,ItemSlot:b},N,r]}var $R=y.createContext(void 0);function Op(t){const e=y.useContext($R);return t||e||"ltr"}var Qg="rovingFocusGroup.onEntryFocus",zR={bubbles:!1,cancelable:!0},Bu="RovingFocusGroup",[Qx,n2,FR]=cy(Bu),[BR,s2]=Ko(Bu,[FR]),[VR,HR]=BR(Bu),r2=y.forwardRef((t,e)=>s.jsx(Qx.Provider,{scope:t.__scopeRovingFocusGroup,children:s.jsx(Qx.Slot,{scope:t.__scopeRovingFocusGroup,children:s.jsx(UR,{...t,ref:e})})}));r2.displayName=Bu;var UR=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,g=y.useRef(null),b=Jt(e,g),N=Op(i),[j,v]=Bl({prop:o,defaultProp:c??null,onChange:u,caller:Bu}),[k,T]=y.useState(!1),C=zo(h),R=n2(n),O=y.useRef(!1),[U,I]=y.useState(0);return y.useEffect(()=>{const z=g.current;if(z)return z.addEventListener(Qg,C),()=>z.removeEventListener(Qg,C)},[C]),s.jsx(VR,{scope:n,orientation:r,dir:N,loop:a,currentTabStopId:j,onItemFocus:y.useCallback(z=>v(z),[v]),onItemShiftTab:y.useCallback(()=>T(!0),[]),onFocusableItemAdd:y.useCallback(()=>I(z=>z+1),[]),onFocusableItemRemove:y.useCallback(()=>I(z=>z-1),[]),children:s.jsx(Mt.div,{tabIndex:k||U===0?-1:0,"data-orientation":r,...m,ref:b,style:{outline:"none",...t.style},onMouseDown:St(t.onMouseDown,()=>{O.current=!0}),onFocus:St(t.onFocus,z=>{const L=!O.current;if(z.target===z.currentTarget&&L&&!k){const Q=new CustomEvent(Qg,zR);if(z.currentTarget.dispatchEvent(Q),!Q.defaultPrevented){const se=R().filter(P=>P.focusable),$=se.find(P=>P.active),ie=se.find(P=>P.id===j),me=[$,ie,...se].filter(Boolean).map(P=>P.ref.current);o2(me,f)}}O.current=!1}),onBlur:St(t.onBlur,()=>T(!1))})})}),a2="RovingFocusGroupItem",i2=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:i,children:o,...c}=t,u=Io(),h=i||u,f=HR(a2,n),m=f.currentTabStopId===h,g=n2(n),{onFocusableItemAdd:b,onFocusableItemRemove:N,currentTabStopId:j}=f;return y.useEffect(()=>{if(r)return b(),()=>N()},[r,b,N]),s.jsx(Qx.ItemSlot,{scope:n,id:h,focusable:r,active:a,children:s.jsx(Mt.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:St(t.onMouseDown,v=>{r?f.onItemFocus(h):v.preventDefault()}),onFocus:St(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:St(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){f.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const k=qR(v,f.orientation,f.dir);if(k!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let C=g().filter(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(v.currentTarget);C=f.loop?GR(C,R+1):C.slice(R+1)}setTimeout(()=>o2(C))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:j!=null}):o})})});i2.displayName=a2;var WR={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function KR(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function qR(t,e,n){const r=KR(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return WR[r]}function o2(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function GR(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var JR=r2,QR=i2,Dp="Tabs",[YR]=Ko(Dp,[s2]),l2=s2(),[XR,dy]=YR(Dp),c2=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:i,orientation:o="horizontal",dir:c,activationMode:u="automatic",...h}=t,f=Op(c),[m,g]=Bl({prop:r,onChange:a,defaultProp:i??"",caller:Dp});return s.jsx(XR,{scope:n,baseId:Io(),value:m,onValueChange:g,orientation:o,dir:f,activationMode:u,children:s.jsx(Mt.div,{dir:f,"data-orientation":o,...h,ref:e})})});c2.displayName=Dp;var d2="TabsList",u2=y.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...a}=t,i=dy(d2,n),o=l2(n);return s.jsx(JR,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:s.jsx(Mt.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:e})})});u2.displayName=d2;var h2="TabsTrigger",f2=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...i}=t,o=dy(h2,n),c=l2(n),u=g2(o.baseId,r),h=x2(o.baseId,r),f=r===o.value;return s.jsx(QR,{asChild:!0,...c,focusable:!a,active:f,children:s.jsx(Mt.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":h,"data-state":f?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:u,...i,ref:e,onMouseDown:St(t.onMouseDown,m=>{!a&&m.button===0&&m.ctrlKey===!1?o.onValueChange(r):m.preventDefault()}),onKeyDown:St(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&o.onValueChange(r)}),onFocus:St(t.onFocus,()=>{const m=o.activationMode!=="manual";!f&&!a&&m&&o.onValueChange(r)})})})});f2.displayName=h2;var p2="TabsContent",m2=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:a,children:i,...o}=t,c=dy(p2,n),u=g2(c.baseId,r),h=x2(c.baseId,r),f=r===c.value,m=y.useRef(f);return y.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),s.jsx(Fu,{present:a||f,children:({present:g})=>s.jsx(Mt.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!g,id:h,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:g&&i})})});m2.displayName=p2;function g2(t,e){return`${t}-trigger-${e}`}function x2(t,e){return`${t}-content-${e}`}var ZR=c2,y2=u2,b2=f2,v2=m2;const Xc=ZR,Hl=y.forwardRef(({className:t,...e},n)=>s.jsx(y2,{ref:n,className:zt("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));Hl.displayName=y2.displayName;const en=y.forwardRef(({className:t,...e},n)=>s.jsx(b2,{ref:n,className:zt("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...e}));en.displayName=b2.displayName;const tn=y.forwardRef(({className:t,...e},n)=>s.jsx(v2,{ref:n,className:zt("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));tn.displayName=v2.displayName;function uy(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 hy(t){const[e,n]=y.useState(void 0);return Os(()=>{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 _p="Switch",[e8]=Ko(_p),[t8,n8]=e8(_p),N2=y.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:i,required:o,disabled:c,value:u="on",onCheckedChange:h,form:f,...m}=t,[g,b]=y.useState(null),N=Jt(e,C=>b(C)),j=y.useRef(!1),v=g?f||!!g.closest("form"):!0,[k,T]=Bl({prop:a,defaultProp:i??!1,onChange:h,caller:_p});return s.jsxs(t8,{scope:n,checked:k,disabled:c,children:[s.jsx(Mt.button,{type:"button",role:"switch","aria-checked":k,"aria-required":o,"data-state":S2(k),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:N,onClick:St(t.onClick,C=>{T(R=>!R),v&&(j.current=C.isPropagationStopped(),j.current||C.stopPropagation())})}),v&&s.jsx(k2,{control:g,bubbles:!j.current,name:r,value:u,checked:k,required:o,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});N2.displayName=_p;var w2="SwitchThumb",j2=y.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,a=n8(w2,n);return s.jsx(Mt.span,{"data-state":S2(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:e})});j2.displayName=w2;var s8="SwitchBubbleInput",k2=y.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...a},i)=>{const o=y.useRef(null),c=Jt(o,i),u=uy(n),h=hy(e);return y.useEffect(()=>{const f=o.current;if(!f)return;const m=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&b){const N=new Event("click",{bubbles:r});b.call(f,n),f.dispatchEvent(N)}},[u,n,r]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:c,style:{...a.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});k2.displayName=s8;function S2(t){return t?"checked":"unchecked"}var C2=N2,r8=j2;const Ut=y.forwardRef(({className:t,...e},n)=>s.jsx(C2,{className:zt("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(r8,{className:zt("pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Ut.displayName=C2.displayName;const a8={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 i8(t){return a8[t]||t||"行为"}function o8(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 fy({open:t,onClose:e,userId:n,onUserUpdated:r}){var Ya,gr,Qs,xr,Ys,Fs;const[a,i]=y.useState(null),[o,c]=y.useState([]),[u,h]=y.useState({}),[f,m]=y.useState([]),[g,b]=y.useState(null),[N,j]=y.useState(null),[v,k]=y.useState(!1),[T,C]=y.useState(!1),[R,O]=y.useState(!1),[U,I]=y.useState("info"),[z,L]=y.useState(""),[Q,se]=y.useState(""),[$,ie]=y.useState(""),[le,me]=y.useState([]),[P,Y]=y.useState(""),[F,ge]=y.useState(""),[X,B]=y.useState(""),[W,fe]=y.useState(!1),[he,de]=y.useState({isVip:!1,vipExpireDate:"",vipRole:"",vipName:"",vipProject:"",vipContact:"",vipBio:""}),[D,q]=y.useState([]),[_,Z]=y.useState(!1),[re,we]=y.useState(""),[Fe,Ue]=y.useState(""),[jt,jn]=y.useState(!1),[pt,Pt]=y.useState(!1),[pn,Hn]=y.useState(null),[mn,Wt]=y.useState(null),[bn,Mn]=y.useState(""),[Un,ns]=y.useState(""),[Rt,vn]=y.useState(""),[Ne,Me]=y.useState(!1),[We,at]=y.useState(null),[Lt,Ct]=y.useState(!1),[$e,H]=y.useState({}),[Qe,vt]=y.useState([]);y.useEffect(()=>{t&&n&&(Ct(!1),I("info"),Hn(null),Wt(null),at(null),ge(""),B(""),yt(),Oe("/api/db/vip-roles").then(oe=>{oe!=null&&oe.success&&oe.data&&q(oe.data)}).catch(()=>{}))},[t,n]),y.useEffect(()=>{t&&Oe("/api/admin/mbti-avatars").then(oe=>{oe!=null&&oe.avatars&&typeof oe.avatars=="object"?H(oe.avatars):H({})}).catch(()=>H({}))},[t]);const Ft=(oe,ve)=>{const Xe=(oe||"").trim();if(Xe)return ya(Xe);const Nt=(ve||"").trim().toUpperCase();return/^[EI][NS][FT][JP]$/.test(Nt)?($e[Nt]||"").trim():""};async function yt(){if(n){k(!0);try{const oe=await Oe(`/api/db/users?id=${encodeURIComponent(n)}`);if(oe!=null&&oe.success&&oe.user){const ve=oe.user;i(ve),L(ve.phone||""),se(ve.wechatId||""),ie(ve.nickname||""),Mn(ve.phone||""),ns(ve.wechatId||""),vn(ve.openId||"");try{me(typeof ve.tags=="string"?JSON.parse(ve.tags||"[]"):[])}catch{me([])}de({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 Xe=ve.tracks||[];c(Xe.map(Nt=>({...Nt,actionLabel:Nt.actionLabel||Nt.action,timeAgo:Nt.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?j(ve.data):j(null)}catch{j(null)}try{const ve=await Oe(`/api/orders?userId=${encodeURIComponent(n)}&status=paid&pageSize=50`);ve!=null&&ve.success&&ve.orders?vt(ve.orders):vt([])}catch{vt([])}}catch(oe){console.error("Load user detail error:",oe)}finally{k(!1)}}}async function bt(){if(!(a!=null&&a.phone)){G.info("用户未绑定手机号,无法同步");return}C(!0);try{const oe=await kt("/api/ckb/sync",{action:"full_sync",phone:a.phone,userId:a.id});oe!=null&&oe.success?(G.success("同步成功"),yt()):G.error("同步失败: "+(oe==null?void 0:oe.error))}catch(oe){console.error("Sync CKB error:",oe),G.error("同步失败")}finally{C(!1)}}async function It(){if(a){if(he.isVip&&!he.vipExpireDate.trim()){G.error("开启 VIP 请填写有效到期日");return}O(!0);try{const oe={id:a.id,phone:z.trim()||void 0,wechatId:Q.trim(),nickname:$||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 Xt("/api/db/users",oe);ve!=null&&ve.success?(G.success("保存成功"),yt(),r==null||r()):G.error("保存失败: "+(ve==null?void 0:ve.error))}catch(oe){console.error("Save user error:",oe),G.error("保存失败")}finally{O(!1)}}}const Qt=()=>{P&&!le.includes(P)&&(me([...le,P]),Y(""))},kn=oe=>me(le.filter(ve=>ve!==oe));async function zs(){if(a){if(!F){G.error("请输入新密码");return}if(F!==X){G.error("两次密码不一致");return}if(F.length<6){G.error("密码至少 6 位");return}fe(!0);try{const oe=await Xt("/api/db/users",{id:a.id,password:F});oe!=null&&oe.success?(G.success("修改成功"),ge(""),B("")):G.error("修改失败: "+((oe==null?void 0:oe.error)||""))}catch{G.error("修改失败")}finally{fe(!1)}}}async function mr(){if(!a)return;const oe=parseFloat(re);if(Number.isNaN(oe)||oe===0){G.error("请输入有效金额(正数增加、负数扣减)");return}jn(!0);try{const ve=await kt(`/api/admin/users/${a.id}/balance/adjust`,{amount:oe,remark:Fe||void 0});ve!=null&&ve.success?(G.success("余额已调整"),Z(!1),we(""),Ue(""),yt(),r==null||r()):G.error("调整失败: "+((ve==null?void 0:ve.error)||""))}catch{G.error("调整失败")}finally{jn(!1)}}async function Qa(){if(!bn&&!Rt&&!Un){Wt("请至少输入手机号、微信号或 OpenID 中的一项");return}Pt(!0),Wt(null),Hn(null);try{const oe=new URLSearchParams;bn&&oe.set("phone",bn),Rt&&oe.set("openId",Rt),Un&&oe.set("wechatId",Un);const ve=await Oe(`/api/admin/shensheshou/query?${oe}`);ve!=null&&ve.success&&ve.data?(Hn(ve.data),a&&await Yr(ve.data)):Wt((ve==null?void 0:ve.error)||"未查询到数据,该用户可能未在神射手收录")}catch(oe){console.error("SSS query error:",oe),Wt("请求失败,请检查神射手接口配置")}finally{Pt(!1)}}async function Yr(oe){if(a)try{await kt("/api/admin/shensheshou/enrich",{userId:a.id,phone:bn||a.phone||"",openId:Rt||a.openId||"",wechatId:Un||a.wechatId||""}),yt()}catch(ve){console.error("SSS enrich error:",ve)}}async function Xr(){if(a){Me(!0),at(null);try{const oe=Array.from(new Set(o.filter(Xs=>Xs.action==="view_chapter"||Xs.action==="purchase"||Xs.action==="first_pay").map(Xs=>(Xs.chapterTitle||Xs.target||"").trim()).filter(Boolean))).slice(0,12),ve={viewChapter:u.view_chapter||0,purchase:u.purchase||0,firstPay:u.first_pay||0},Xe=oe.length>0?`意向章节:${oe.join("、")}`:"",Nt={users:[{phone:a.phone||"",name:a.nickname||"",openId:a.openId||"",tags:le,purchaseIntent:ve,purchaseIntentChapters:oe,remark:Xe}]},Zt=await kt("/api/admin/shensheshou/ingest",Nt);Zt!=null&&Zt.success&&Zt.data?at(Zt.data):at({error:(Zt==null?void 0:Zt.error)||"推送失败"})}catch(oe){console.error("SSS ingest error:",oe),at({error:"请求失败"})}finally{Me(!1)}}}const ja=oe=>{const Xe={view_chapter:fr,purchase:cu,match:Kn,login:Ci,register:Ci,share:Ai,bind_phone:D1,bind_wechat:$M,fill_profile:du,fill_avatar:Ci,visit_page:pa,first_pay:cu,vip_activate:Wc,click_super:Kn,lead_submit:D1,withdraw:Hx,referral_bind:Ai,card_click:Ci,btn_click:$o,tab_click:pa,nav_click:pa,page_view:pa,search:pa}[oe]||Fx;return s.jsx(Xe,{className:"w-4 h-4"})};function Pr(oe){const ve=String(oe||"").trim();return ve.length>22&&/^[a-zA-Z0-9_-]+$/.test(ve)}const Ir=y.useMemo(()=>o8(u,a),[u,a]);function Zr(){const oe=[...le];for(const ve of Ir)oe.includes(ve)||oe.push(ve);me(oe),G.success("已将旅程推断标签合并到已选")}return t?s.jsxs(s.Fragment,{children:[s.jsx(Dt,{open:t,onOpenChange:()=>e(),children:s.jsxs(Ot,{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(_t,{children:s.jsxs($t,{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"})]})}),v?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):a?s.jsxs("div",{className:"flex flex-col min-h-0 flex-1 overflow-hidden",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row gap-2.5 p-2.5 bg-[#0a1628] rounded-lg mb-2 shrink-0",children:[s.jsxs("div",{className:"flex gap-2.5 min-w-0 flex-1",children:[s.jsx("div",{className:"w-11 h-11 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-lg text-[#38bdac] shrink-0",children:Ft(a.avatar,a.mbti)&&!Lt?s.jsx("img",{src:Ft(a.avatar,a.mbti),className:"w-full h-full rounded-full object-cover",alt:"",onError:()=>Ct(!0)}):((Ya=a.nickname)==null?void 0:Ya.charAt(0))||"?"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.jsx("h3",{className:"text-base font-bold text-white leading-tight",children:a.nickname}),a.isAdmin&&s.jsx(Be,{className:"bg-purple-500/20 text-purple-400 border-0 text-[10px] py-0",children:"管理员"}),a.hasFullBook&&s.jsx(Be,{className:"bg-green-500/20 text-green-400 border-0 text-[10px] py-0",children:"全书已购"}),a.vipRole&&s.jsx(Be,{className:"bg-amber-500/20 text-amber-400 border-0 text-[10px] py-0",children:a.vipRole})]}),a.referralCode&&s.jsxs("p",{className:"text-[10px] text-gray-500 mt-0.5",children:["推荐码 ",s.jsx("code",{className:"text-[#38bdac]",children:a.referralCode})]}),s.jsxs("div",{className:"mt-1 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-1.5 text-[11px]",children:[s.jsxs("div",{className:"px-2 py-1 rounded bg-[#162840] border border-gray-700/50",children:[s.jsx("span",{className:"text-gray-500",children:"昵称"}),s.jsx("p",{className:"text-white truncate",children:$||a.nickname||"—"})]}),s.jsxs("div",{className:"px-2 py-1 rounded bg-[#162840] border border-gray-700/50",children:[s.jsx("span",{className:"text-gray-500",children:"手机号"}),s.jsx("p",{className:"text-white truncate",children:z||"—"})]}),s.jsxs("div",{className:"px-2 py-1 rounded bg-[#162840] border border-gray-700/50",children:[s.jsx("span",{className:"text-gray-500",children:"微信标识"}),s.jsx("p",{className:"text-white truncate",children:Q||"—"})]}),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:()=>{we(""),Ue(""),Z(!0)},children:"调整"})]}),s.jsxs("p",{className:"text-sm font-bold text-white leading-tight",children:["¥",((N==null?void 0:N.balance)??0).toFixed(2)]}),s.jsx("p",{className:"text-[9px] text-gray-600",children:"可消费/抵扣"})]}),s.jsxs("div",{className:"rounded-md bg-[#162840] px-2 py-1.5 border border-gray-700/40",children:[s.jsx("p",{className:"text-[9px] text-gray-500",children:"推荐人数"}),s.jsx("p",{className:"text-sm font-bold text-white leading-tight",children:a.referralCount??0}),s.jsx("p",{className:"text-[9px] text-gray-600",children:a.createdAt?`注册 ${new Date(a.createdAt).toLocaleDateString()}`:"—"})]})]})]}),s.jsxs(Xc,{value:U,onValueChange:I,className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[s.jsxs(Hl,{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(en,{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(en,{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(pa,{className:"w-3 h-3 mr-0.5"}),"旅程与轨迹"]}),s.jsx(en,{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(en,{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(tn,{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(te,{className:"text-gray-400 text-[11px]",children:"昵称"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"昵称",value:$,onChange:oe=>ie(oe.target.value)})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{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:z,onChange:oe=>L(oe.target.value)})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{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:Q,onChange:oe=>se(oe.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(rk,{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(Wc,{className:"w-3.5 h-3.5 text-amber-400 shrink-0"}),s.jsx("span",{className:"text-white text-xs font-medium",children:"超级个体"}),a.isVip&&s.jsx(Be,{className:"bg-amber-500/20 text-amber-400 border-0 text-[10px] py-0 shrink-0",children:a.vipRole||"VIP"})]}),s.jsx(Ut,{className:"scale-90",checked:he.isVip,onCheckedChange:oe=>de(ve=>({...ve,isVip:oe}))})]}),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(te,{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:oe=>de(ve=>({...ve,vipExpireDate:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(te,{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:oe=>de(ve=>({...ve,vipRole:oe.target.value})),children:[s.jsx("option",{value:"",children:"请选择"}),D.map(oe=>s.jsx("option",{value:oe.name,children:oe.name},oe.id))]})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(te,{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:oe=>de(ve=>({...ve,vipName:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(te,{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:oe=>de(ve=>({...ve,vipProject:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(te,{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:oe=>de(ve=>({...ve,vipContact:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5 sm:col-span-2",children:[s.jsx(te,{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:oe=>de(ve=>({...ve,vipBio:oe.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($o,{className:"w-3.5 h-3.5 text-[#38bdac]"}),s.jsx("span",{className:"text-white text-xs font-medium",children:"外部资料 · 神射手 / 存客宝(与上方基础信息联动)"})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-1.5 mb-1.5",children:[s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:手机",value:bn,onChange:oe=>Mn(oe.target.value)}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:微信号",value:Un,onChange:oe=>ns(oe.target.value)}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:OpenID",value:Rt,onChange:oe=>vn(oe.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:Qa,disabled:pt,children:[pt?s.jsx(He,{className:"w-3 h-3 animate-spin"}):s.jsx(xa,{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:Xr,disabled:Ne||!a.phone,children:Ne?"推送…":"推神射手"}),s.jsx(J,{size:"sm",variant:"outline",className:"h-7 text-[11px] px-2",onClick:bt,disabled:T||!a.phone,children:T?"同步…":"存客宝同步"})]}),a.ckbSyncedAt&&s.jsxs("p",{className:"text-[10px] text-gray-500 mt-1",children:["最近存客宝同步:",new Date(a.ckbSyncedAt).toLocaleString()]}),mn&&s.jsx("p",{className:"mt-1 text-red-400 text-[11px]",children:mn}),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??"—"})]})]}),We&&s.jsx("p",{className:"mt-1 text-[11px]",children:We.error?s.jsx("span",{className:"text-red-400",children:String(We.error)}):s.jsx("span",{className:"text-green-400",children:"推送成功"})})]}),s.jsxs("div",{className:"p-2 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[s.jsx(Hx,{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:F,onChange:oe=>ge(oe.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:oe=>B(oe.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:zs,disabled:W||!F||!X,children:W?"保存中":"确认修改"})]})]})]}),s.jsxs(tn,{value:"journey",className:"flex-1 min-h-0 overflow-y-auto space-y-2 pr-0.5",children:[Qe.length>0&&s.jsxs("div",{className:"p-2 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[s.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[s.jsx(cu,{className:"w-3.5 h-3.5 text-amber-400"}),s.jsxs("span",{className:"text-white text-xs font-medium",children:["购买清单(",Qe.length," 笔)"]})]}),s.jsx("div",{className:"space-y-1 max-h-[120px] overflow-y-auto",children:Qe.map((oe,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:oe.productType==="fullbook"||oe.productType==="vip"?"全书/VIP":`章节 ${oe.productId||""}`}),s.jsxs("span",{className:"text-gray-500 ml-2",children:["¥",Number(oe.amount||0).toFixed(2)]})]}),s.jsx("span",{className:"text-gray-500 text-[10px] shrink-0",children:oe.createdAt?new Date(oe.createdAt).toLocaleString("zh-CN"):""})]},oe.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(pa,{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((oe,ve)=>ve[1]-oe[1]).map(([oe,ve])=>s.jsxs(Be,{variant:"outline",className:"text-[10px] border-gray-600 text-gray-300 bg-[#162840] py-0 h-5",children:[i8(oe)," ×",ve]},oe))})]}),s.jsx("div",{className:"space-y-1.5",children:o.length>0?o.map((oe,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:ja(oe.action)}),ve0?((g==null?void 0:g.visits)||[]).map((oe,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:["第 ",oe.seq||ve+1," 次 · ",oe.referrerNickname||"微信用户",oe.referrerId?`(${oe.referrerId})`:""]}),oe.page?s.jsx("p",{className:"text-gray-500 text-[10px] truncate",children:oe.page}):null]}),s.jsx("span",{className:"text-gray-500 text-[10px] shrink-0",children:oe.visitedAt?new Date(oe.visitedAt).toLocaleString():""})]},`${oe.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(Ai,{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((oe,ve)=>{var Nt;const Xe=oe;return s.jsxs("div",{className:"flex items-center justify-between p-1.5 bg-[#162840] rounded text-xs",children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx("div",{className:"w-6 h-6 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-[10px] text-[#38bdac] shrink-0",children:((Nt=Xe.nickname)==null?void 0:Nt.charAt(0))||"?"}),s.jsx("span",{className:"text-white truncate",children:Xe.nickname})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[Xe.status==="vip"&&s.jsx(Be,{className:"bg-green-500/20 text-green-400 border-0 text-[10px] py-0",children:"已购"}),s.jsx("span",{className:"text-gray-500 text-[10px]",children:Xe.createdAt?new Date(Xe.createdAt).toLocaleDateString():""})]})]},Xe.id||ve)}):s.jsx("p",{className:"text-gray-500 text-sm text-center py-3",children:"暂无推荐用户"})})]})]}),s.jsxs(tn,{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(du,{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(Yj,{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:Ir.length===0,onClick:Zr,children:"合并到已选"})]}),Ir.length>0?s.jsx("div",{className:"flex flex-wrap gap-1",children:Ir.map(oe=>s.jsxs(Be,{variant:"outline",className:`text-[10px] py-0 h-5 border-cyan-500/30 ${le.includes(oe)?"bg-cyan-500/15 text-cyan-200":"text-gray-300"}`,children:[le.includes(oe)?"✓ ":"",oe]},oe))}):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(oe=>s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-[11px] mb-1",children:oe.category}),s.jsx("div",{className:"flex flex-wrap gap-1",children:oe.tags.map(ve=>s.jsxs("button",{type:"button",onClick:()=>{le.includes(ve)?kn(ve):me([...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))})]},oe.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((oe,ve)=>s.jsxs(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1 text-[11px] py-0",children:[oe,s.jsx("button",{type:"button",onClick:()=>kn(oe),className:"ml-1 hover:text-red-400",children:s.jsx(es,{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:P,onChange:oe=>Y(oe.target.value),onKeyDown:oe=>oe.key==="Enter"&&Qt()}),s.jsx(J,{onClick:Qt,className:"bg-[#38bdac] hover:bg-[#2da396] h-8 text-xs px-3",children:"添加"})]})]})]}),(()=>{const oe=a.tags||a.ckbTags||"";let ve=[];try{const Nt=typeof oe=="string"?JSON.parse(oe||"[]"):[];ve=Array.isArray(Nt)?Nt:typeof oe=="string"?oe.split(","):[]}catch{ve=typeof oe=="string"?oe.split(","):[]}const Xe=ve.map(Nt=>String(Nt).trim()).filter(Boolean);return Xe.length===0?null:s.jsxs("div",{className:"p-2.5 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[s.jsx(du,{className:"w-3.5 h-3.5 text-purple-400"}),s.jsx("span",{className:"text-white text-sm font-medium",children:"存客宝标签"})]}),s.jsx("div",{className:"flex flex-wrap gap-1",children:Xe.map((Nt,Zt)=>s.jsx(Be,{className:"bg-purple-500/20 text-purple-400 border-0 text-[11px] py-0",children:Nt},Zt))})]})})()]})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-gray-700 mt-3 shrink-0",children:[s.jsxs(J,{variant:"outline",onClick:e,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(es,{className:"w-4 h-4 mr-2"}),"关闭"]}),s.jsxs(J,{onClick:It,disabled:R,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),R?"保存中...":"保存修改"]})]})]}):s.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}),s.jsx(Dt,{open:_,onOpenChange:Z,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsx($t,{children:"调整余额"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{children:[s.jsx(te,{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:re,onChange:oe=>we(oe.target.value)})]}),s.jsxs("div",{children:[s.jsx(te,{className:"text-gray-300 text-sm",children:"备注(可选)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"如:活动补偿",value:Fe,onChange:oe=>Ue(oe.target.value)})]})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(J,{variant:"outline",onClick:()=>Z(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(J,{onClick:mr,disabled:jt,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:jt?"提交中...":"确认调整"})]})]})})]}):null}function l8(){const t=qa(),[e,n]=y.useState(!0),[r,a]=y.useState(!0),[i,o]=y.useState(!0),[c,u]=y.useState([]),[h,f]=y.useState([]),[m,g]=y.useState(0),[b,N]=y.useState(0),[j,v]=y.useState(0),[k,T]=y.useState(0),[C,R]=y.useState(null),[O,U]=y.useState(null),[I,z]=y.useState(!1),[L,Q]=y.useState(0),[se,$]=y.useState(!1),[ie,le]=y.useState(null),[me,P]=y.useState("overview"),[Y,F]=y.useState([]),[ge,X]=y.useState(!1),[B,W]=y.useState("today"),[fe,he]=y.useState(null),[de,D]=y.useState(!1),[q,_]=y.useState(!0),[Z,re]=y.useState(null),[we,Fe]=y.useState(null),[Ue,jt]=y.useState([]),jn=Ne=>{const Me=Ne;if((Me==null?void 0:Me.status)===401)R("登录已过期,请重新登录");else{if((Me==null?void 0:Me.name)==="AbortError")return;R("加载失败,请检查网络或联系管理员")}};async function pt(Ne){var Lt,Ct;const Me=Ne?{signal:Ne}:void 0;n(!0),R(null);try{const $e=await Oe("/api/admin/dashboard/stats",Me);$e!=null&&$e.success&&(g($e.totalUsers??0),N($e.paidOrderCount??0),v($e.totalRevenue??0),T($e.conversionRate??0))}catch($e){if(($e==null?void 0:$e.name)!=="AbortError"){console.error("stats 失败,尝试 overview 降级",$e);try{const H=await Oe("/api/admin/dashboard/overview",Me);H!=null&&H.success&&(g(H.totalUsers??0),N(H.paidOrderCount??0),v(H.totalRevenue??0),T(H.conversionRate??0))}catch(H){jn(H)}}}finally{n(!1)}try{const $e=await Oe("/api/admin/balance/summary",Me);$e!=null&&$e.success&&$e.data&&Q($e.data.totalGifted??0)}catch{}try{const $e=await Oe("/api/db/ckb-plan-stats",Me);$e!=null&&$e.success&&$e.data?le({ckbTotal:$e.data.ckbTotal??0,withContact:$e.data.withContact??0}):le(null)}catch{le(null)}_(!0);try{const[$e,H]=await Promise.allSettled([Oe("/api/db/match-records?stats=true",Me),Oe("/api/admin/distribution/overview",Me)]);$e.status==="fulfilled"&&((Lt=$e.value)!=null&&Lt.success)&&$e.value.data?re({totalMatches:$e.value.data.totalMatches??0,todayMatches:$e.value.data.todayMatches??0,uniqueUsers:$e.value.data.uniqueUsers??0,paidMatchCount:$e.value.data.paidMatchCount??0}):re(null),H.status==="fulfilled"&&((Ct=H.value)!=null&&Ct.success)&&H.value.overview?Fe({todayClicks:H.value.overview.todayClicks??0,todayBindings:H.value.overview.todayBindings??0,todayConversions:H.value.overview.todayConversions??0,monthClicks:H.value.overview.monthClicks??0,monthBindings:H.value.overview.monthBindings??0,monthConversions:H.value.overview.monthConversions??0,totalClicks:H.value.overview.totalClicks??0,totalBindings:H.value.overview.totalBindings??0,totalConversions:H.value.overview.totalConversions??0,conversionRate:H.value.overview.conversionRate}):Fe(null)}catch{re(null),Fe(null)}finally{_(!1)}try{const $e=await Oe("/api/db/vip-members?limit=500",Me);$e!=null&&$e.success&&Array.isArray($e.data)?jt($e.data):jt([])}catch{jt([])}a(!0),o(!0);const We=async()=>{try{const $e=await Oe("/api/admin/dashboard/recent-orders?limit=10",Me);if($e!=null&&$e.success&&$e.recentOrders)f($e.recentOrders);else throw new Error("no data")}catch($e){if(($e==null?void 0:$e.name)!=="AbortError")try{const H=await Oe("/api/admin/orders?page=1&pageSize=20&status=paid",Me),vt=((H==null?void 0:H.orders)??[]).filter(Ft=>["paid","completed","success"].includes(Ft.status||""));f(vt.slice(0,5))}catch{f([])}}finally{a(!1)}},at=async()=>{try{const $e=await Oe("/api/admin/dashboard/new-users",Me);if($e!=null&&$e.success&&$e.newUsers)u($e.newUsers);else throw new Error("no data")}catch($e){if(($e==null?void 0:$e.name)!=="AbortError")try{const H=await Oe("/api/db/users?page=1&pageSize=10",Me);u((H==null?void 0:H.users)??[])}catch{u([])}}finally{o(!1)}};await Promise.all([We(),at()])}async function Pt(Ne){const Me=Ne||B;D(!0);try{const We=await Oe(`/api/admin/track/stats?period=${Me}`);We!=null&&We.success&&he({total:We.total??0,byModule:We.byModule??{}})}catch{he(null)}finally{D(!1)}}const pn={home:"首页",chapters:"目录",read:"阅读页",my:"我的",vip:"超级个体",wallet:"钱包",match:"找伙伴",referral:"推广中心",search:"搜索",settings:"设置",about:"关于",member_detail:"成员详情",other:"其他"},Hn={btn_click:"按钮点击",nav_click:"导航点击",card_click:"卡片点击",tab_click:"标签切换",page_view:"页面浏览",share:"分享",purchase:"购买",register:"注册",rule_trigger:"规则触发",view_chapter:"浏览章节",link_click:"链接点击"},mn=Ne=>Ne?Ne.replace(/^part-/,"").replace(/^soulvip_/,"").replace(/^super_?/,"").replace(/^user_/,"").replace(/[_-]+/g," ").trim():"",Wt=Ne=>{if(!Ne)return"";const Me=Ne.trim().toLowerCase();if(!Me)return"";const We=Ue.find(Lt=>{const Ct=String(Lt.id||"").toLowerCase();return Ct===Me||Ct.includes(Me)||Me.includes(Ct)});if(We)return We.name||We.nickname||"";const at=Ue.find(Lt=>{const Ct=String(Lt.token||"").toLowerCase();return Ct&&(Ct===Me||Ct.includes(Me)||Me.includes(Ct))});return at&&(at.name||at.nickname)||""},bn=Ne=>{if(!Ne)return"未命名点击";const Me=Ne.trim(),We=Me.toLowerCase();if(/^链接头像[_-]/.test(Me)){const Lt=mn(Me.replace(/^链接头像[_-]/,""));return Lt?`头像:${Lt}`:"头像点击"}if(/^member[_-]?detail$/i.test(We)||We.includes("member detail"))return"成员详情";if(/^giftpay$/i.test(We)||We.includes("gift pay"))return"代付入口";if(/^part[-_]/i.test(We))return`章节:${mn(Me)}`;if(We.includes("soulvip")||We.includes("super")){const Lt=Me.replace(/^超级个体[::]?/i,"").replace(/^super[_-]?/i,"").replace(/^soulvip[_-]?/i,"").replace(/^user[_-]?/i,"").trim(),Ct=Wt(Lt)||Wt(mn(Lt));return Ct?`超级个体:${Ct}`:`超级个体:${mn(Lt)}`}if(We.includes("qgdtw")||We.includes("token")||We.includes("0000"))return`对象:${mn(Me)}`;const at={开始匹配:"开始匹配",mentor:"导师顾问",team:"团队招募",investor:"资源对接",充值:"充值",退款:"退款",wallet:"钱包",设置:"设置",VIP:"VIP会员",推广:"推广中心",目录:"目录",搜索:"搜索",匹配:"找伙伴",settings:"设置",expired:"已过期",active:"活跃",converted:"已转化",fill_profile:"完善资料",register:"注册",purchase:"购买",链接卡若:"链接卡若",更多分享:"更多分享",分享朋友圈文案:"分享朋友圈",选择金额10:"选择金额10元",member_detail:"成员详情",giftPay:"代付入口"};return at[Me]?at[Me]:/^[a-z0-9_-]+$/i.test(Me)&&mn(Me)||Me},Mn=Ne=>{const Me=pn[Ne.module]||pn[Ne.page]||Ne.module||Ne.page||"其他",We=Hn[Ne.action]||Ne.action||"点击",at=bn(Ne.target);return`${Me} · ${We} · ${at}`};async function Un(){X(!0);try{const Ne=await Oe("/api/admin/super-individual/stats");Ne!=null&&Ne.success&&Array.isArray(Ne.data)&&F(Ne.data)}catch{}finally{X(!1)}}y.useEffect(()=>{const Ne=new AbortController;return pt(Ne.signal),Pt(),Un(),()=>{Ne.abort()}},[]);const ns=m,Rt=Ne=>{const Me=Ne.productType||"",We=Ne.description||"";if(Me==="balance_recharge")return{title:`余额充值 ¥${typeof Ne.amount=="number"?Ne.amount.toFixed(2):parseFloat(String(Ne.amount||"0")).toFixed(2)}`,subtitle:"余额充值"};if(Me==="gift_pay")return{title:`代付 ¥${typeof Ne.amount=="number"?Ne.amount.toFixed(2):parseFloat(String(Ne.amount||"0")).toFixed(2)}`,subtitle:"好友代付"};if(Me==="gift_pay_batch"){const at=typeof Ne.amount=="number"?Ne.amount.toFixed(2):parseFloat(String(Ne.amount||"0")).toFixed(2);return{title:We||`代付分享 ¥${at}`,subtitle:"代付分享"}}if(Me==="section"&&We.includes("代付领取"))return{title:We.replace("代付领取 - ",""),subtitle:"代付领取"};if(We){if(Me==="section"&&We.includes("章节")){if(We.includes("-")){const at=We.split("-");if(at.length>=3)return{title:`第${at[1]}章 第${at[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:We,subtitle:"章节购买"}}return Me==="fullbook"||We.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:Me==="vip"||We.includes("VIP")?{title:"超级个体开通费用",subtitle:"超级个体"}:Me==="match"||We.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:We,subtitle:Me==="section"?"单章":Me==="fullbook"?"全书":"其他"}}return Me==="section"?{title:`章节 ${Ne.productId||""}`,subtitle:"单章购买"}:Me==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:Me==="vip"?{title:"超级个体开通费用",subtitle:"超级个体"}:Me==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:Me||"其他"}},vn=[{title:"总用户数",value:e?null:ns,sub:null,icon:Kn,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:e?null:`¥${(j??0).toFixed(2)}`,sub:L>0?`含代付 ¥${L.toFixed(2)}`:null,icon:Mf,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:e?null:b,sub:null,icon:cu,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:fr,color:"text-orange-400",bg:"bg-orange-500/20",link:"/distribution"},{title:"存客宝获客",value:ie?ie.ckbTotal??0:null,sub:(ie==null?void 0:ie.withContact)!=null?`含联系方式 ${ie.withContact} 人`:null,icon:Hc,color:"text-cyan-400",bg:"bg-cyan-500/20",link:"/users?tab=leads"},{title:"伙伴&推广协同",value:q?null:((Z==null?void 0:Z.totalMatches)??0)+((we==null?void 0:we.totalClicks)??0),sub:q?null:`找伙伴 ${(Z==null?void 0:Z.totalMatches)??0} / 推广 ${(we==null?void 0:we.totalClicks)??0}`,icon:Qd,color:"text-emerald-400",bg:"bg-emerald-500/20",link:"/find-partner"}];return s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),C&&s.jsxs("div",{className:"mb-6 px-4 py-3 rounded-lg bg-amber-500/20 border border-amber-500/50 text-amber-200 text-sm flex items-center justify-between",children:[s.jsx("span",{children:C}),s.jsx("button",{type:"button",onClick:()=>pt(),className:"text-amber-400 hover:text-amber-300 underline",children:"重试"})]}),s.jsx("div",{className:"grid gap-6 mb-8 grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 xl:grid-cols-6",children:vn.map((Ne,Me)=>s.jsxs(De,{className:"min-w-0 bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>Ne.link&&t(Ne.link),children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsx(ht,{className:"text-sm font-medium text-gray-400",children:Ne.title}),s.jsx("div",{className:`p-2 rounded-lg ${Ne.bg}`,children:s.jsx(Ne.icon,{className:`w-4 h-4 ${Ne.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:Ne.value!=null?Ne.value:s.jsxs("span",{className:"inline-flex items-center gap-2 text-gray-500",children:[s.jsx(He,{className:"w-4 h-4 animate-spin"}),"加载中"]})}),Ne.sub&&s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:Ne.sub})]}),s.jsx(El,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},Me))}),s.jsxs("div",{className:"flex gap-2 mb-6 mt-2",children:[s.jsx("button",{type:"button",onClick:()=>P("overview"),className:`px-5 py-2 rounded-lg text-sm font-medium transition-colors ${me==="overview"?"bg-[#38bdac] text-white":"bg-[#0f2137] text-gray-400 hover:text-white hover:bg-gray-700/50 border border-gray-700/50"}`,children:"数据概览"}),s.jsx("button",{type:"button",onClick:()=>P("tags"),className:`px-5 py-2 rounded-lg text-sm font-medium transition-colors ${me==="tags"?"bg-[#38bdac] text-white":"bg-[#0f2137] text-gray-400 hover:text-white hover:bg-gray-700/50 border border-gray-700/50"}`,children:"用户标签点击统计"}),s.jsx("button",{type:"button",onClick:()=>P("super"),className:`px-5 py-2 rounded-lg text-sm font-medium transition-colors ${me==="super"?"bg-[#38bdac] text-white":"bg-[#0f2137] text-gray-400 hover:text-white hover:bg-gray-700/50 border border-gray-700/50"}`,children:"超级个体统计"})]}),me==="overview"&&s.jsxs("div",{className:"space-y-8",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between",children:[s.jsx(ht,{className:"text-white",children:"找伙伴 × 推广中心(共统计)"}),s.jsxs("button",{type:"button",onClick:()=>pt(),disabled:q,className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1 disabled:opacity-50",title:"刷新共统计",children:[s.jsx(He,{className:`w-3.5 h-3.5 ${q?"animate-spin":""}`}),"刷新"]})]}),s.jsxs(_e,{children:[q&&!Z&&!we?s.jsxs("div",{className:"flex items-center justify-center py-10 text-gray-500",children:[s.jsx(He,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-6 gap-4",children:[s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"找伙伴总匹配"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(Z==null?void 0:Z.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:(Z==null?void 0:Z.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:(Z==null?void 0:Z.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:(we==null?void 0:we.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:(we==null?void 0:we.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:(we==null?void 0:we.totalConversions)??0})]})]}),(we==null?void 0:we.conversionRate)&&s.jsxs("p",{className:"text-xs text-gray-500 mt-3",children:["推广转化率:",we.conversionRate]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between",children:[s.jsx(ht,{className:"text-white",children:"最近订单"}),s.jsxs("button",{type:"button",onClick:()=>pt(),disabled:r||i,className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1 disabled:opacity-50",title:"刷新",children:[r||i?s.jsx(He,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(He,{className:"w-3.5 h-3.5"}),"刷新"]})]}),s.jsx(_e,{children:s.jsx("div",{className:"space-y-3",children:r&&h.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(He,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[h.slice(0,se?10:4).map(Ne=>{var Ct;const Me=Ne.referrerId?c.find($e=>$e.id===Ne.referrerId):void 0,We=Ne.referralCode||(Me==null?void 0:Me.referralCode)||(Me==null?void 0:Me.nickname)||(Ne.referrerId?String(Ne.referrerId).slice(0,8):""),at=Rt(Ne),Lt=Ne.userNickname||((Ct=c.find($e=>$e.id===Ne.userId))==null?void 0:Ct.nickname)||"匿名用户";return s.jsxs("div",{className:"flex items-start justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30 hover:border-[#38bdac]/30 transition-colors",children:[s.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[Ne.userAvatar?s.jsx("img",{src:Ne.userAvatar,alt:Lt,className:"w-9 h-9 rounded-full object-cover shrink-0 mt-0.5",onError:$e=>{$e.currentTarget.style.display="none";const H=$e.currentTarget.nextElementSibling;H&&H.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 ${Ne.userAvatar?"hidden":""}`,children:Lt.charAt(0)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("button",{type:"button",onClick:()=>{Ne.userId&&(U(Ne.userId),z(!0))},className:"text-sm text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:Lt}),s.jsx("span",{className:"text-gray-600",children:"·"}),s.jsx("span",{className:"text-sm font-medium text-white truncate",title:at.title,children:at.title})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[at.subtitle&&at.subtitle!=="章节购买"&&s.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:at.subtitle}),s.jsx("span",{children:new Date(Ne.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),We&&s.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",We]})]})]}),s.jsxs("div",{className:"text-right ml-4 shrink-0",children:[s.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(Ne.amount).toFixed(2)]}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:Ne.paymentMethod||"微信"})]})]},Ne.id)}),h.length>4&&!se&&s.jsx("button",{type:"button",onClick:()=>$(!0),className:"w-full py-2 text-sm text-[#38bdac] hover:text-[#2da396] border border-dashed border-gray-600 rounded-lg hover:border-[#38bdac]/50 transition-colors",children:"展开更多"}),h.length===0&&!r&&s.jsxs("div",{className:"text-center py-12",children:[s.jsx(cu,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(ut,{children:s.jsx(ht,{className:"text-white",children:"新注册用户"})}),s.jsx(_e,{children:s.jsx("div",{className:"space-y-3",children:i&&c.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(He,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[c.slice(0,5).map(Ne=>{var Me;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:((Me=Ne.nickname)==null?void 0:Me.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("button",{type:"button",onClick:()=>{U(Ne.id),z(!0)},className:"text-sm font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:Ne.nickname||"匿名用户"}),s.jsx("p",{className:"text-xs text-gray-500",children:Ne.phone||"未绑定手机"})]})]}),s.jsx("p",{className:"text-xs text-gray-400",children:Ne.createdAt?new Date(Ne.createdAt).toLocaleDateString():"-"})]},Ne.id)}),c.length===0&&!i&&s.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})})]})]})]}),me==="tags"&&s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between",children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Qd,{className:"w-5 h-5 text-[#38bdac]"}),"分类标签点击统计"]}),s.jsx("div",{className:"flex items-center gap-2",children:["today","week","month","all"].map(Ne=>s.jsx("button",{type:"button",onClick:()=>{W(Ne),Pt(Ne)},className:`px-3 py-1 text-xs rounded-full transition-colors ${B===Ne?"bg-[#38bdac] text-white":"bg-gray-700/50 text-gray-400 hover:bg-gray-700"}`,children:{today:"今日",week:"本周",month:"本月",all:"全部"}[Ne]},Ne))})]}),s.jsx(_e,{children:de&&!fe?s.jsxs("div",{className:"flex items-center justify-center py-12 text-gray-500",children:[s.jsx(He,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):fe&&Object.keys(fe.byModule).length>0?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("p",{className:"text-sm text-gray-400",children:["总点击 ",s.jsx("span",{className:"text-white font-bold text-lg",children:fe.total})," 次"]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Object.entries(fe.byModule).sort((Ne,Me)=>Me[1].reduce((We,at)=>We+at.count,0)-Ne[1].reduce((We,at)=>We+at.count,0)).slice(0,5).map(([Ne,Me])=>{const We=Me.reduce((at,Lt)=>at+Lt.count,0);return s.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("span",{className:"text-sm font-medium text-[#38bdac]",children:pn[Ne]||Ne}),s.jsxs("span",{className:"text-xs text-gray-500",children:[We," 次"]})]}),s.jsx("div",{className:"space-y-2",children:Me.sort((at,Lt)=>Lt.count-at.count).slice(0,8).map((at,Lt)=>{const Ct=Mn(at);return s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-gray-300 truncate mr-2",title:Ct,children:Ct}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx("div",{className:"w-16 h-1.5 bg-gray-700 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-[#38bdac] rounded-full",style:{width:`${We>0?at.count/We*100:0}%`}})}),s.jsx("span",{className:"text-gray-400 w-8 text-right",children:at.count})]})]},Lt)})})]},Ne)})})]}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Qd,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无点击数据"}),s.jsx("p",{className:"text-gray-600 text-xs mt-1",children:"小程序端接入埋点后,数据将在此实时展示"})]})})]}),me==="super"&&s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between",children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Qd,{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:ge,children:[s.jsx(He,{className:`w-3.5 h-3.5 mr-1 ${ge?"animate-spin":""}`}),"刷新"]})]}),s.jsx(_e,{children:ge&&Y.length===0?s.jsxs("div",{className:"flex items-center justify-center py-12 text-gray-500",children:[s.jsx(He,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):Y.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:Y.map((Ne,Me)=>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:Me+1}),s.jsx("td",{className:"py-2 px-3",children:s.jsxs("div",{className:"flex items-center gap-2",children:[Ne.avatar?s.jsx("img",{src:Ne.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(Ne.nickname||Ne.userId)}`),title:"点击跳转用户管理",children:Ne.nickname||Ne.userId})]})}),s.jsx("td",{className:"py-2 px-3 text-center text-white font-bold",children:Ne.clicks}),s.jsx("td",{className:"py-2 px-3 text-center text-[#38bdac]",children:Ne.uniqueClicks}),s.jsx("td",{className:"py-2 px-3 text-center text-gray-400",children:Ne.uniqueClicks>0?(Ne.clicks/Ne.uniqueClicks).toFixed(1):"-"}),s.jsx("td",{className:"py-2 px-3 text-center text-green-400 text-xs font-medium",children:typeof Ne.leadCount=="number"?Ne.leadCount:0}),s.jsx("td",{className:"py-2 px-3 text-gray-400 text-xs",children:Ne.phone||"-"})]},Ne.userId))})]})}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Qd,{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(fy,{open:I,onClose:()=>{z(!1),U(null)},userId:O,onUserUpdated:()=>pt()})]})}const ps=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{className:"relative w-full overflow-auto",children:s.jsx("table",{ref:n,className:zt("w-full caption-bottom text-sm",t),...e})}));ps.displayName="Table";const ms=y.forwardRef(({className:t,...e},n)=>s.jsx("thead",{ref:n,className:zt("[&_tr]:border-b",t),...e}));ms.displayName="TableHeader";const gs=y.forwardRef(({className:t,...e},n)=>s.jsx("tbody",{ref:n,className:zt("[&_tr:last-child]:border-0",t),...e}));gs.displayName="TableBody";const xt=y.forwardRef(({className:t,...e},n)=>s.jsx("tr",{ref:n,className:zt("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));xt.displayName="TableRow";const Se=y.forwardRef(({className:t,...e},n)=>s.jsx("th",{ref:n,className:zt("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));Se.displayName="TableHead";const je=y.forwardRef(({className:t,...e},n)=>s.jsx("td",{ref:n,className:zt("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));je.displayName="TableCell";function Ul(t,e){const[n,r]=y.useState(t);return y.useEffect(()=>{const a=setTimeout(()=>r(t),e);return()=>clearTimeout(a)},[t,e]),n}function qs({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 c8(){const[t,e]=y.useState([]),[n,r]=y.useState([]),[a,i]=y.useState(0),[o,c]=y.useState(0),[u,h]=y.useState(0),[f,m]=y.useState(1),[g,b]=y.useState(10),[N,j]=y.useState(""),v=Ul(N,300),[k,T]=y.useState("all"),[C,R]=y.useState(!0),[O,U]=y.useState(null),[I,z]=y.useState(null),[L,Q]=y.useState(""),[se,$]=y.useState(!1);async function ie(){R(!0),U(null);try{const X=k==="all"?"":k==="completed"?"completed":k,B=new URLSearchParams({page:String(f),pageSize:String(g),...X&&{status:X},...v&&{search:v}}),[W,fe]=await Promise.all([Oe(`/api/admin/orders?${B}`),Oe("/api/db/users?page=1&pageSize=500")]);W!=null&&W.success&&(e(W.orders||[]),i(W.total??0),c(W.totalRevenue??0),h(W.todayRevenue??0)),fe!=null&&fe.success&&fe.users&&r(fe.users)}catch(X){console.error("加载订单失败",X),U("加载订单失败,请检查网络后重试")}finally{R(!1)}}y.useEffect(()=>{m(1)},[v,k]),y.useEffect(()=>{ie()},[f,g,v,k]);const le=X=>{var B;return X.userNickname||((B=n.find(W=>W.id===X.userId))==null?void 0:B.nickname)||"匿名用户"},me=X=>{var B;return((B=n.find(W=>W.id===X))==null?void 0:B.phone)||"-"},P=X=>{const B=X.productType||X.type||"",W=X.description||"";if(B==="balance_recharge")return{name:`余额充值 ¥${Number(X.amount||0).toFixed(2)}`,type:"余额充值"};if(W){if(B==="section"&&(W.includes("章节")||W.includes("代付领取"))){if(W.includes("代付领取"))return{name:W.replace("代付领取 - ",""),type:"代付领取"};if(W.includes("-")){const fe=W.split("-");if(fe.length>=3)return{name:`第${fe[1]}章 第${fe[2]}节`,type:"《一场Soul的创业实验》"}}return{name:W,type:"章节购买"}}return B==="fullbook"||W.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:B==="vip"||W.includes("VIP")?{name:"超级个体开通费用",type:"超级个体"}:B==="match"||W.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:W,type:"其他"}}return B==="section"?{name:`章节 ${X.productId||X.sectionId||""}`,type:"单章"}:B==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:B==="vip"?{name:"超级个体开通费用",type:"超级个体"}:B==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:B||"其他"}},Y=Math.ceil(a/g)||1;async function F(){var X;if(!(!(I!=null&&I.orderSn)&&!(I!=null&&I.id))){$(!0),U(null);try{const B=await Xt("/api/admin/orders/refund",{orderSn:I.orderSn||I.id,reason:L||void 0});B!=null&&B.success?(z(null),Q(""),ie()):U((B==null?void 0:B.error)||"退款失败")}catch(B){const W=B;U(((X=W==null?void 0:W.data)==null?void 0:X.error)||"退款失败,请检查网络后重试")}finally{$(!1)}}}function ge(){if(t.length===0){G.info("暂无数据可导出");return}const X=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],B=t.map(D=>{const q=P(D);return[D.orderSn||D.id||"",le(D),me(D.userId),q.name,Number(D.amount||0).toFixed(2),D.paymentMethod==="wechat"?"微信支付":D.paymentMethod==="balance"?"余额支付":D.paymentMethod==="alipay"?"支付宝":D.paymentMethod||"微信支付",D.status==="refunded"?"已退款":D.status==="paid"||D.status==="completed"?"已完成":D.status==="pending"||D.status==="created"?"待支付":"已失败",D.status==="refunded"&&D.refundReason?D.refundReason:"-",D.referrerEarnings?Number(D.referrerEarnings).toFixed(2):"-",D.createdAt?new Date(D.createdAt).toLocaleString("zh-CN"):""].join(",")}),W="\uFEFF"+[X.join(","),...B].join(` -`),fe=new Blob([W],{type:"text/csv;charset=utf-8"}),he=URL.createObjectURL(fe),de=document.createElement("a");de.href=he,de.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,de.click(),URL.revokeObjectURL(he)}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:()=>U(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"订单管理"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",t.length," 笔订单"]})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs(J,{variant:"outline",onClick:ie,disabled:C,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${C?"animate-spin":""}`}),"刷新"]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsx("span",{className:"text-gray-400",children:"总收入:"}),s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",o.toFixed(2)]}),s.jsx("span",{className:"text-gray-600",children:"|"}),s.jsx("span",{className:"text-gray-400",children:"今日:"}),s.jsxs("span",{className:"text-[#FFD700] font-bold",children:["¥",u.toFixed(2)]})]})]})]}),s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsxs("div",{className:"relative flex-1 max-w-md",children:[s.jsx(xa,{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:N,onChange:X=>j(X.target.value)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(nk,{className:"w-4 h-4 text-gray-400"}),s.jsxs("select",{value:k,onChange:X=>T(X.target.value),className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"pending",children:"待支付"}),s.jsx("option",{value:"created",children:"已创建"}),s.jsx("option",{value:"failed",children:"已失败"}),s.jsx("option",{value:"refunded",children:"已退款"})]})]}),s.jsxs(J,{variant:"outline",onClick:ge,disabled:t.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(U5,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:C?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(ps,{children:[s.jsx(ms,{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(gs,{children:[t.map(X=>{const B=P(X);return s.jsxs(xt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsxs(je,{className:"font-mono text-xs text-gray-400",children:[(X.orderSn||X.id||"").slice(0,12),"..."]}),s.jsx(je,{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(Be,{className:"bg-emerald-500/20 text-emerald-400 hover:bg-emerald-500/20 border-0 text-xs",children:"代付领取"}),X.payerUserId&&X.paymentMethod!=="gift_pay"&&s.jsx(Be,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"代付"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:me(X.userId)}),X.payerUserId&&X.payerNickname&&s.jsxs("p",{className:"text-amber-400/80 text-xs mt-0.5",children:[X.paymentMethod==="gift_pay"?"赠送人:":"代付人:",X.payerNickname]})]})}),s.jsx(je,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[B.name,(X.productType||X.type)==="vip"&&s.jsx(Be,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"超级个体"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:B.type})]})}),s.jsxs(je,{className:"text-[#38bdac] font-bold",children:["¥",Number(X.amount||0).toFixed(2)]}),s.jsx(je,{className:"text-gray-300",children:X.paymentMethod==="wechat"?"微信支付":X.paymentMethod==="balance"?"余额支付":X.paymentMethod==="alipay"?"支付宝":X.paymentMethod||"微信支付"}),s.jsx(je,{children:s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[X.status==="refunded"?s.jsx(Be,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):X.status==="paid"||X.status==="completed"?s.jsx(Be,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):X.status==="pending"||X.status==="created"?s.jsx(Be,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):s.jsx(Be,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"}),(X.status==="paid"||X.status==="completed")&&(X.webhookPushStatus==="sent"?s.jsx(Be,{className:"bg-emerald-500/20 text-emerald-300 hover:bg-emerald-500/20 border-0",children:"已推送"}):s.jsx(Be,{className:"bg-orange-500/20 text-orange-300 hover:bg-orange-500/20 border-0",children:"待补推"}))]})}),s.jsx(je,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:X.refundReason,children:X.status==="refunded"&&X.refundReason?X.refundReason:"-"}),s.jsx(je,{className:"text-[#FFD700]",children:X.referrerEarnings?`¥${Number(X.referrerEarnings).toFixed(2)}`:"-"}),s.jsx(je,{className:"text-gray-400 text-sm",children:new Date(X.createdAt).toLocaleString("zh-CN")}),s.jsx(je,{children:(X.status==="paid"||X.status==="completed")&&X.paymentMethod!=="balance"&&s.jsxs(J,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{z(X),Q("")},children:[s.jsx(ik,{className:"w-3 h-3 mr-1"}),"退款"]})})]},X.id)}),t.length===0&&s.jsx(xt,{children:s.jsx(je,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),s.jsx(qs,{page:f,totalPages:Y,total:a,pageSize:g,onPageChange:m,onPageSizeChange:X=>{b(X),m(1)}})]})})}),s.jsx(Dt,{open:!!I,onOpenChange:X=>!X&&z(null),children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(_t,{children:s.jsx($t,{className:"text-white",children:"订单退款"})}),I&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",I.orderSn||I.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(I.amount||0).toFixed(2)]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),s.jsx("div",{className:"form-input",children:s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:L,onChange:X=>Q(X.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>z(null),disabled:se,children:"取消"}),s.jsx(J,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:F,disabled:se,children:se?"退款中...":"确认退款"})]})]})})]})}const tc=y.forwardRef(({className:t,...e},n)=>s.jsx("textarea",{className:zt("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}));tc.displayName="Textarea";const iN=["INTJ","INTP","ENTJ","ENTP","INFJ","INFP","ENFJ","ENFP","ISTJ","ISFJ","ESTJ","ESFJ","ISTP","ISFP","ESTP","ESFP"],E2={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 d8(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 u8(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 h8(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 oN(t){const e=E2[t],n=d8(e.group),r=u8(e.mood),a=h8(e.mood),i=` -======== - .`).concat(mf,` { - right: `).concat(c,"px ").concat(r,`; - } - - .`).concat(gf,` { - margin-right: `).concat(c,"px ").concat(r,`; - } - - .`).concat(mf," .").concat(mf,` { - right: 0 `).concat(r,`; - } - - .`).concat(gf," .").concat(gf,` { - margin-right: 0 `).concat(r,`; - } - - body[`).concat(Wc,`] { - `).concat(IP,": ").concat(c,`px; - } -`)},eN=function(){var t=parseInt(document.body.getAttribute(Wc)||"0",10);return isFinite(t)?t:0},QP=function(){y.useEffect(function(){return document.body.setAttribute(Wc,(eN()+1).toString()),function(){var t=eN()-1;t<=0?document.body.removeAttribute(Wc):document.body.setAttribute(Wc,t.toString())}},[])},YP=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,a=r===void 0?"margin":r;QP();var i=y.useMemo(function(){return qP(a)},[a]);return y.createElement(GP,{styles:JP(i,!e,a,n?"":"!important")})},Gx=!1;if(typeof window<"u")try{var qh=Object.defineProperty({},"passive",{get:function(){return Gx=!0,!0}});window.addEventListener("test",qh,qh),window.removeEventListener("test",qh,qh)}catch{Gx=!1}var Mc=Gx?{passive:!1}:!1,XP=function(t){return t.tagName==="TEXTAREA"},Ik=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!XP(t)&&n[e]==="visible")},ZP=function(t){return Ik(t,"overflowY")},eR=function(t){return Ik(t,"overflowX")},tN=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=Pk(t,r);if(a){var i=Rk(t,r),o=i[1],c=i[2];if(o>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},tR=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},nR=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},Pk=function(t,e){return t==="v"?ZP(e):eR(e)},Rk=function(t,e){return t==="v"?tR(e):nR(e)},sR=function(t,e){return t==="h"&&e==="rtl"?-1:1},rR=function(t,e,n,r,a){var i=sR(t,window.getComputedStyle(e).direction),o=i*r,c=n.target,u=e.contains(c),h=!1,f=o>0,m=0,g=0;do{if(!c)break;var b=Rk(t,c),N=b[0],j=b[1],v=b[2],k=j-v-i*N;(N||k)&&Pk(t,c)&&(m+=k,g+=N);var T=c.parentNode;c=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!u&&c!==document.body||u&&(e.contains(c)||e===c));return(f&&Math.abs(m)<1||!f&&Math.abs(g)<1)&&(h=!0),h},Gh=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},nN=function(t){return[t.deltaX,t.deltaY]},sN=function(t){return t&&"current"in t?t.current:t},aR=function(t,e){return t[0]===e[0]&&t[1]===e[1]},iR=function(t){return` - .block-interactivity-`.concat(t,` {pointer-events: none;} - .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},oR=0,Ac=[];function lR(t){var e=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),a=y.useState(oR++)[0],i=y.useState(Ak)[0],o=y.useRef(t);y.useEffect(function(){o.current=t},[t]),y.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(a));var j=MP([t.lockRef.current],(t.shards||[]).map(sN),!0).filter(Boolean);return j.forEach(function(v){return v.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),j.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(a))})}}},[t.inert,t.lockRef.current,t.shards]);var c=y.useCallback(function(j,v){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!o.current.allowPinchZoom;var k=Gh(j),T=n.current,C="deltaX"in j?j.deltaX:T[0]-k[0],R="deltaY"in j?j.deltaY:T[1]-k[1],O,U=j.target,P=Math.abs(C)>Math.abs(R)?"h":"v";if("touches"in j&&P==="h"&&U.type==="range")return!1;var z=window.getSelection(),L=z&&z.anchorNode,Q=L?L===U||L.contains(U):!1;if(Q)return!1;var se=tN(P,U);if(!se)return!0;if(se?O=P:(O=P==="v"?"h":"v",se=tN(P,U)),!se)return!1;if(!r.current&&"changedTouches"in j&&(C||R)&&(r.current=O),!O)return!0;var $=r.current||O;return rR($,v,j,$==="h"?C:R)},[]),u=y.useCallback(function(j){var v=j;if(!(!Ac.length||Ac[Ac.length-1]!==i)){var k="deltaY"in v?nN(v):Gh(v),T=e.current.filter(function(O){return O.name===v.type&&(O.target===v.target||v.target===O.shadowParent)&&aR(O.delta,k)})[0];if(T&&T.should){v.cancelable&&v.preventDefault();return}if(!T){var C=(o.current.shards||[]).map(sN).filter(Boolean).filter(function(O){return O.contains(v.target)}),R=C.length>0?c(v,C[0]):!o.current.noIsolation;R&&v.cancelable&&v.preventDefault()}}},[]),h=y.useCallback(function(j,v,k,T){var C={name:j,delta:v,target:k,should:T,shadowParent:cR(k)};e.current.push(C),setTimeout(function(){e.current=e.current.filter(function(R){return R!==C})},1)},[]),f=y.useCallback(function(j){n.current=Gh(j),r.current=void 0},[]),m=y.useCallback(function(j){h(j.type,nN(j),j.target,c(j,t.lockRef.current))},[]),g=y.useCallback(function(j){h(j.type,Gh(j),j.target,c(j,t.lockRef.current))},[]);y.useEffect(function(){return Ac.push(i),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",u,Mc),document.addEventListener("touchmove",u,Mc),document.addEventListener("touchstart",f,Mc),function(){Ac=Ac.filter(function(j){return j!==i}),document.removeEventListener("wheel",u,Mc),document.removeEventListener("touchmove",u,Mc),document.removeEventListener("touchstart",f,Mc)}},[]);var b=t.removeScrollBar,N=t.inert;return y.createElement(y.Fragment,null,N?y.createElement(i,{styles:iR(a)}):null,b?y.createElement(YP,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function cR(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const dR=$P(Mk,lR);var sy=y.forwardRef(function(t,e){return y.createElement(Pp,za({},t,{ref:e,sideCar:dR}))});sy.classNames=Pp.classNames;var uR=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Ic=new WeakMap,Jh=new WeakMap,Qh={},Gg=0,Lk=function(t){return t&&(t.host||Lk(t.parentNode))},hR=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=Lk(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})},fR=function(t,e,n,r){var a=hR(e,Array.isArray(t)?t:[t]);Qh[n]||(Qh[n]=new WeakMap);var i=Qh[n],o=[],c=new Set,u=new Set(a),h=function(m){!m||c.has(m)||(c.add(m),h(m.parentNode))};a.forEach(h);var f=function(m){!m||u.has(m)||Array.prototype.forEach.call(m.children,function(g){if(c.has(g))f(g);else try{var b=g.getAttribute(r),N=b!==null&&b!=="false",j=(Ic.get(g)||0)+1,v=(i.get(g)||0)+1;Ic.set(g,j),i.set(g,v),o.push(g),j===1&&N&&Jh.set(g,!0),v===1&&g.setAttribute(n,"true"),N||g.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",g,k)}})};return f(e),c.clear(),Gg++,function(){o.forEach(function(m){var g=Ic.get(m)-1,b=i.get(m)-1;Ic.set(m,g),i.set(m,b),g||(Jh.has(m)||m.removeAttribute(r),Jh.delete(m)),b||m.removeAttribute(n)}),Gg--,Gg||(Ic=new WeakMap,Ic=new WeakMap,Jh=new WeakMap,Qh={})}},Ok=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),a=uR(t);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),fR(r,a,n,"aria-hidden")):function(){return null}},Rp="Dialog",[Dk]=Wo(Rp),[pR,ya]=Dk(Rp),_k=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]=Fl({prop:r,defaultProp:a??!1,onChange:i,caller:Rp});return s.jsx(pR,{scope:e,triggerRef:c,contentRef:u,contentId:Io(),titleId:Io(),descriptionId:Io(),open:h,onOpenChange:f,onOpenToggle:y.useCallback(()=>f(m=>!m),[f]),modal:o,children:n})};_k.displayName=Rp;var $k="DialogTrigger",mR=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=ya($k,n),i=Jt(e,a.triggerRef);return s.jsx(Mt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":iy(a.open),...r,ref:i,onClick:St(t.onClick,a.onOpenToggle)})});mR.displayName=$k;var ry="DialogPortal",[gR,zk]=Dk(ry,{forceMount:void 0}),Fk=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:a}=t,i=ya(ry,e);return s.jsx(gR,{scope:e,forceMount:n,children:y.Children.map(r,o=>s.jsx(zu,{present:n||i.open,children:s.jsx(ny,{asChild:!0,container:a,children:o})}))})};Fk.displayName=ry;var Pf="DialogOverlay",Bk=y.forwardRef((t,e)=>{const n=zk(Pf,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=ya(Pf,t.__scopeDialog);return i.modal?s.jsx(zu,{present:r||i.open,children:s.jsx(yR,{...a,ref:e})}):null});Bk.displayName=Pf;var xR=ju("DialogOverlay.RemoveScroll"),yR=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=ya(Pf,n);return s.jsx(sy,{as:xR,allowPinchZoom:!0,shards:[a.contentRef],children:s.jsx(Mt.div,{"data-state":iy(a.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Bl="DialogContent",Vk=y.forwardRef((t,e)=>{const n=zk(Bl,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=ya(Bl,t.__scopeDialog);return s.jsx(zu,{present:r||i.open,children:i.modal?s.jsx(bR,{...a,ref:e}):s.jsx(vR,{...a,ref:e})})});Vk.displayName=Bl;var bR=y.forwardRef((t,e)=>{const n=ya(Bl,t.__scopeDialog),r=y.useRef(null),a=Jt(e,n.contentRef,r);return y.useEffect(()=>{const i=r.current;if(i)return Ok(i)},[]),s.jsx(Hk,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:St(t.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:St(t.onPointerDownOutside,i=>{const o=i.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0;(o.button===2||c)&&i.preventDefault()}),onFocusOutside:St(t.onFocusOutside,i=>i.preventDefault())})}),vR=y.forwardRef((t,e)=>{const n=ya(Bl,t.__scopeDialog),r=y.useRef(!1),a=y.useRef(!1);return s.jsx(Hk,{...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()}})}),Hk=y.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,...o}=t,c=ya(Bl,n),u=y.useRef(null),h=Jt(e,u);return Ck(),s.jsxs(s.Fragment,{children:[s.jsx(ty,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:s.jsx(ey,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":iy(c.open),...o,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(NR,{titleId:c.titleId}),s.jsx(jR,{contentRef:u,descriptionId:c.descriptionId})]})]})}),ay="DialogTitle",Uk=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=ya(ay,n);return s.jsx(Mt.h2,{id:a.titleId,...r,ref:e})});Uk.displayName=ay;var Wk="DialogDescription",Kk=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=ya(Wk,n);return s.jsx(Mt.p,{id:a.descriptionId,...r,ref:e})});Kk.displayName=Wk;var qk="DialogClose",Gk=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=ya(qk,n);return s.jsx(Mt.button,{type:"button",...r,ref:e,onClick:St(t.onClick,()=>a.onOpenChange(!1))})});Gk.displayName=qk;function iy(t){return t?"open":"closed"}var Jk="DialogTitleWarning",[pH,Qk]=QI(Jk,{contentName:Bl,titleName:ay,docsSlug:"dialog"}),NR=({titleId:t})=>{const e=Qk(Jk),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},wR="DialogDescriptionWarning",jR=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Qk(wR).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},kR=_k,SR=Fk,CR=Bk,ER=Vk,TR=Uk,MR=Kk,AR=Gk;function Dt(t){return s.jsx(kR,{"data-slot":"dialog",...t})}function IR(t){return s.jsx(SR,{...t})}const Yk=y.forwardRef(({className:t,...e},n)=>s.jsx(CR,{ref:n,className:zt("fixed inset-0 z-50 bg-black/50",t),...e}));Yk.displayName="DialogOverlay";const Ot=y.forwardRef(({className:t,children:e,showCloseButton:n=!0,...r},a)=>s.jsxs(IR,{children:[s.jsx(Yk,{}),s.jsxs(ER,{ref:a,"aria-describedby":void 0,className:zt("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(AR,{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(Xn,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ot.displayName="DialogContent";function _t({className:t,...e}){return s.jsx("div",{className:zt("flex flex-col gap-2 text-center sm:text-left",t),...e})}function rn({className:t,...e}){return s.jsx("div",{className:zt("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function $t(t){return s.jsx(TR,{className:"text-lg font-semibold leading-none",...t})}function Qc(t){return s.jsx(MR,{className:"text-sm text-muted-foreground",...t})}const PR=dk("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?ok:"span";return s.jsx(a,{className:zt(PR({variant:e}),t),...r})}var RR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],LR=RR.reduce((t,e)=>{const n=ik(`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}},{}),OR="Label",Xk=y.forwardRef((t,e)=>s.jsx(LR.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())}}));Xk.displayName=OR;var Zk=Xk;const te=y.forwardRef(({className:t,...e},n)=>s.jsx(Zk,{ref:n,className:zt("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));te.displayName=Zk.displayName;function oy(t){const e=t+"CollectionProvider",[n,r]=Wo(e),[a,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=j=>{const{scope:v,children:k}=j,T=Hs.useRef(null),C=Hs.useRef(new Map).current;return s.jsx(a,{scope:v,itemMap:C,collectionRef:T,children:k})};o.displayName=e;const c=t+"CollectionSlot",u=ju(c),h=Hs.forwardRef((j,v)=>{const{scope:k,children:T}=j,C=i(c,k),R=Jt(v,C.collectionRef);return s.jsx(u,{ref:R,children:T})});h.displayName=c;const f=t+"CollectionItemSlot",m="data-radix-collection-item",g=ju(f),b=Hs.forwardRef((j,v)=>{const{scope:k,children:T,...C}=j,R=Hs.useRef(null),O=Jt(v,R),U=i(f,k);return Hs.useEffect(()=>(U.itemMap.set(R,{ref:R,...C}),()=>void U.itemMap.delete(R))),s.jsx(g,{[m]:"",ref:O,children:T})});b.displayName=f;function N(j){const v=i(t+"CollectionConsumer",j);return Hs.useCallback(()=>{const T=v.collectionRef.current;if(!T)return[];const C=Array.from(T.querySelectorAll(`[${m}]`));return Array.from(v.itemMap.values()).sort((U,P)=>C.indexOf(U.ref.current)-C.indexOf(P.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:o,Slot:h,ItemSlot:b},N,r]}var DR=y.createContext(void 0);function Lp(t){const e=y.useContext(DR);return t||e||"ltr"}var Jg="rovingFocusGroup.onEntryFocus",_R={bubbles:!1,cancelable:!0},Fu="RovingFocusGroup",[Jx,e2,$R]=oy(Fu),[zR,t2]=Wo(Fu,[$R]),[FR,BR]=zR(Fu),n2=y.forwardRef((t,e)=>s.jsx(Jx.Provider,{scope:t.__scopeRovingFocusGroup,children:s.jsx(Jx.Slot,{scope:t.__scopeRovingFocusGroup,children:s.jsx(VR,{...t,ref:e})})}));n2.displayName=Fu;var VR=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,g=y.useRef(null),b=Jt(e,g),N=Lp(i),[j,v]=Fl({prop:o,defaultProp:c??null,onChange:u,caller:Fu}),[k,T]=y.useState(!1),C=$o(h),R=e2(n),O=y.useRef(!1),[U,P]=y.useState(0);return y.useEffect(()=>{const z=g.current;if(z)return z.addEventListener(Jg,C),()=>z.removeEventListener(Jg,C)},[C]),s.jsx(FR,{scope:n,orientation:r,dir:N,loop:a,currentTabStopId:j,onItemFocus:y.useCallback(z=>v(z),[v]),onItemShiftTab:y.useCallback(()=>T(!0),[]),onFocusableItemAdd:y.useCallback(()=>P(z=>z+1),[]),onFocusableItemRemove:y.useCallback(()=>P(z=>z-1),[]),children:s.jsx(Mt.div,{tabIndex:k||U===0?-1:0,"data-orientation":r,...m,ref:b,style:{outline:"none",...t.style},onMouseDown:St(t.onMouseDown,()=>{O.current=!0}),onFocus:St(t.onFocus,z=>{const L=!O.current;if(z.target===z.currentTarget&&L&&!k){const Q=new CustomEvent(Jg,_R);if(z.currentTarget.dispatchEvent(Q),!Q.defaultPrevented){const se=R().filter(I=>I.focusable),$=se.find(I=>I.active),ie=se.find(I=>I.id===j),me=[$,ie,...se].filter(Boolean).map(I=>I.ref.current);a2(me,f)}}O.current=!1}),onBlur:St(t.onBlur,()=>T(!1))})})}),s2="RovingFocusGroupItem",r2=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:i,children:o,...c}=t,u=Io(),h=i||u,f=BR(s2,n),m=f.currentTabStopId===h,g=e2(n),{onFocusableItemAdd:b,onFocusableItemRemove:N,currentTabStopId:j}=f;return y.useEffect(()=>{if(r)return b(),()=>N()},[r,b,N]),s.jsx(Jx.ItemSlot,{scope:n,id:h,focusable:r,active:a,children:s.jsx(Mt.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:St(t.onMouseDown,v=>{r?f.onItemFocus(h):v.preventDefault()}),onFocus:St(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:St(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){f.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const k=WR(v,f.orientation,f.dir);if(k!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let C=g().filter(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(v.currentTarget);C=f.loop?KR(C,R+1):C.slice(R+1)}setTimeout(()=>a2(C))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:j!=null}):o})})});r2.displayName=s2;var HR={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function UR(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function WR(t,e,n){const r=UR(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return HR[r]}function a2(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function KR(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var qR=n2,GR=r2,Op="Tabs",[JR]=Wo(Op,[t2]),i2=t2(),[QR,ly]=JR(Op),o2=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:i,orientation:o="horizontal",dir:c,activationMode:u="automatic",...h}=t,f=Lp(c),[m,g]=Fl({prop:r,onChange:a,defaultProp:i??"",caller:Op});return s.jsx(QR,{scope:n,baseId:Io(),value:m,onValueChange:g,orientation:o,dir:f,activationMode:u,children:s.jsx(Mt.div,{dir:f,"data-orientation":o,...h,ref:e})})});o2.displayName=Op;var l2="TabsList",c2=y.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...a}=t,i=ly(l2,n),o=i2(n);return s.jsx(qR,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:s.jsx(Mt.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:e})})});c2.displayName=l2;var d2="TabsTrigger",u2=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...i}=t,o=ly(d2,n),c=i2(n),u=p2(o.baseId,r),h=m2(o.baseId,r),f=r===o.value;return s.jsx(GR,{asChild:!0,...c,focusable:!a,active:f,children:s.jsx(Mt.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":h,"data-state":f?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:u,...i,ref:e,onMouseDown:St(t.onMouseDown,m=>{!a&&m.button===0&&m.ctrlKey===!1?o.onValueChange(r):m.preventDefault()}),onKeyDown:St(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&o.onValueChange(r)}),onFocus:St(t.onFocus,()=>{const m=o.activationMode!=="manual";!f&&!a&&m&&o.onValueChange(r)})})})});u2.displayName=d2;var h2="TabsContent",f2=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:a,children:i,...o}=t,c=ly(h2,n),u=p2(c.baseId,r),h=m2(c.baseId,r),f=r===c.value,m=y.useRef(f);return y.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),s.jsx(zu,{present:a||f,children:({present:g})=>s.jsx(Mt.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!g,id:h,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:g&&i})})});f2.displayName=h2;function p2(t,e){return`${t}-trigger-${e}`}function m2(t,e){return`${t}-content-${e}`}var YR=o2,g2=c2,x2=u2,y2=f2;const Yc=YR,Vl=y.forwardRef(({className:t,...e},n)=>s.jsx(g2,{ref:n,className:zt("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));Vl.displayName=g2.displayName;const en=y.forwardRef(({className:t,...e},n)=>s.jsx(x2,{ref:n,className:zt("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...e}));en.displayName=x2.displayName;const tn=y.forwardRef(({className:t,...e},n)=>s.jsx(y2,{ref:n,className:zt("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));tn.displayName=y2.displayName;function cy(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 dy(t){const[e,n]=y.useState(void 0);return Ps(()=>{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 Dp="Switch",[XR]=Wo(Dp),[ZR,e8]=XR(Dp),b2=y.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:i,required:o,disabled:c,value:u="on",onCheckedChange:h,form:f,...m}=t,[g,b]=y.useState(null),N=Jt(e,C=>b(C)),j=y.useRef(!1),v=g?f||!!g.closest("form"):!0,[k,T]=Fl({prop:a,defaultProp:i??!1,onChange:h,caller:Dp});return s.jsxs(ZR,{scope:n,checked:k,disabled:c,children:[s.jsx(Mt.button,{type:"button",role:"switch","aria-checked":k,"aria-required":o,"data-state":j2(k),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:N,onClick:St(t.onClick,C=>{T(R=>!R),v&&(j.current=C.isPropagationStopped(),j.current||C.stopPropagation())})}),v&&s.jsx(w2,{control:g,bubbles:!j.current,name:r,value:u,checked:k,required:o,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});b2.displayName=Dp;var v2="SwitchThumb",N2=y.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,a=e8(v2,n);return s.jsx(Mt.span,{"data-state":j2(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:e})});N2.displayName=v2;var t8="SwitchBubbleInput",w2=y.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...a},i)=>{const o=y.useRef(null),c=Jt(o,i),u=cy(n),h=dy(e);return y.useEffect(()=>{const f=o.current;if(!f)return;const m=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&b){const N=new Event("click",{bubbles:r});b.call(f,n),f.dispatchEvent(N)}},[u,n,r]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:c,style:{...a.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});w2.displayName=t8;function j2(t){return t?"checked":"unchecked"}var k2=b2,n8=N2;const Ut=y.forwardRef(({className:t,...e},n)=>s.jsx(k2,{className:zt("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(n8,{className:zt("pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Ut.displayName=k2.displayName;const s8={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 r8(t){return s8[t]||t||"行为"}function a8(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 uy({open:t,onClose:e,userId:n,onUserUpdated:r}){var Qa,fr,qs,pr,Gs,_s;const[a,i]=y.useState(null),[o,c]=y.useState([]),[u,h]=y.useState({}),[f,m]=y.useState([]),[g,b]=y.useState(null),[N,j]=y.useState(null),[v,k]=y.useState(!1),[T,C]=y.useState(!1),[R,O]=y.useState(!1),[U,P]=y.useState("info"),[z,L]=y.useState(""),[Q,se]=y.useState(""),[$,ie]=y.useState(""),[le,me]=y.useState([]),[I,Y]=y.useState(""),[F,ge]=y.useState(""),[X,B]=y.useState(""),[W,fe]=y.useState(!1),[he,de]=y.useState({isVip:!1,vipExpireDate:"",vipRole:"",vipName:"",vipProject:"",vipContact:"",vipBio:""}),[D,q]=y.useState([]),[_,Z]=y.useState(!1),[re,we]=y.useState(""),[Fe,Ue]=y.useState(""),[jt,Nn]=y.useState(!1),[pt,It]=y.useState(!1),[hn,Bn]=y.useState(null),[fn,Wt]=y.useState(null),[xn,En]=y.useState(""),[Vn,es]=y.useState(""),[Rt,yn]=y.useState(""),[Ne,Me]=y.useState(!1),[We,at]=y.useState(null),[Lt,Ct]=y.useState(!1),[$e,H]=y.useState({}),[Qe,vt]=y.useState([]);y.useEffect(()=>{t&&n&&(Ct(!1),P("info"),Bn(null),Wt(null),at(null),ge(""),B(""),yt(),Oe("/api/db/vip-roles").then(oe=>{oe!=null&&oe.success&&oe.data&&q(oe.data)}).catch(()=>{}))},[t,n]),y.useEffect(()=>{t&&Oe("/api/admin/mbti-avatars").then(oe=>{oe!=null&&oe.avatars&&typeof oe.avatars=="object"?H(oe.avatars):H({})}).catch(()=>H({}))},[t]);const Ft=(oe,ve)=>{const Xe=(oe||"").trim();if(Xe)return ma(Xe);const Nt=(ve||"").trim().toUpperCase();return/^[EI][NS][FT][JP]$/.test(Nt)?($e[Nt]||"").trim():""};async function yt(){if(n){k(!0);try{const oe=await Oe(`/api/db/users?id=${encodeURIComponent(n)}`);if(oe!=null&&oe.success&&oe.user){const ve=oe.user;i(ve),L(ve.phone||""),se(ve.wechatId||""),ie(ve.nickname||""),En(ve.phone||""),es(ve.wechatId||""),yn(ve.openId||"");try{me(typeof ve.tags=="string"?JSON.parse(ve.tags||"[]"):[])}catch{me([])}de({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 Xe=ve.tracks||[];c(Xe.map(Nt=>({...Nt,actionLabel:Nt.actionLabel||Nt.action,timeAgo:Nt.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?j(ve.data):j(null)}catch{j(null)}try{const ve=await Oe(`/api/orders?userId=${encodeURIComponent(n)}&status=paid&pageSize=50`);ve!=null&&ve.success&&ve.orders?vt(ve.orders):vt([])}catch{vt([])}}catch(oe){console.error("Load user detail error:",oe)}finally{k(!1)}}}async function bt(){if(!(a!=null&&a.phone)){G.info("用户未绑定手机号,无法同步");return}C(!0);try{const oe=await kt("/api/ckb/sync",{action:"full_sync",phone:a.phone,userId:a.id});oe!=null&&oe.success?(G.success("同步成功"),yt()):G.error("同步失败: "+(oe==null?void 0:oe.error))}catch(oe){console.error("Sync CKB error:",oe),G.error("同步失败")}finally{C(!1)}}async function Pt(){if(a){if(he.isVip&&!he.vipExpireDate.trim()){G.error("开启 VIP 请填写有效到期日");return}O(!0);try{const oe={id:a.id,phone:z.trim()||void 0,wechatId:Q.trim(),nickname:$||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 Xt("/api/db/users",oe);ve!=null&&ve.success?(G.success("保存成功"),yt(),r==null||r()):G.error("保存失败: "+(ve==null?void 0:ve.error))}catch(oe){console.error("Save user error:",oe),G.error("保存失败")}finally{O(!1)}}}const Qt=()=>{I&&!le.includes(I)&&(me([...le,I]),Y(""))},wn=oe=>me(le.filter(ve=>ve!==oe));async function Ds(){if(a){if(!F){G.error("请输入新密码");return}if(F!==X){G.error("两次密码不一致");return}if(F.length<6){G.error("密码至少 6 位");return}fe(!0);try{const oe=await Xt("/api/db/users",{id:a.id,password:F});oe!=null&&oe.success?(G.success("修改成功"),ge(""),B("")):G.error("修改失败: "+((oe==null?void 0:oe.error)||""))}catch{G.error("修改失败")}finally{fe(!1)}}}async function hr(){if(!a)return;const oe=parseFloat(re);if(Number.isNaN(oe)||oe===0){G.error("请输入有效金额(正数增加、负数扣减)");return}Nn(!0);try{const ve=await kt(`/api/admin/users/${a.id}/balance/adjust`,{amount:oe,remark:Fe||void 0});ve!=null&&ve.success?(G.success("余额已调整"),Z(!1),we(""),Ue(""),yt(),r==null||r()):G.error("调整失败: "+((ve==null?void 0:ve.error)||""))}catch{G.error("调整失败")}finally{Nn(!1)}}async function Ja(){if(!xn&&!Rt&&!Vn){Wt("请至少输入手机号、微信号或 OpenID 中的一项");return}It(!0),Wt(null),Bn(null);try{const oe=new URLSearchParams;xn&&oe.set("phone",xn),Rt&&oe.set("openId",Rt),Vn&&oe.set("wechatId",Vn);const ve=await Oe(`/api/admin/shensheshou/query?${oe}`);ve!=null&&ve.success&&ve.data?(Bn(ve.data),a&&await Gr(ve.data)):Wt((ve==null?void 0:ve.error)||"未查询到数据,该用户可能未在神射手收录")}catch(oe){console.error("SSS query error:",oe),Wt("请求失败,请检查神射手接口配置")}finally{It(!1)}}async function Gr(oe){if(a)try{await kt("/api/admin/shensheshou/enrich",{userId:a.id,phone:xn||a.phone||"",openId:Rt||a.openId||"",wechatId:Vn||a.wechatId||""}),yt()}catch(ve){console.error("SSS enrich error:",ve)}}async function Jr(){if(a){Me(!0),at(null);try{const oe=Array.from(new Set(o.filter(Js=>Js.action==="view_chapter"||Js.action==="purchase"||Js.action==="first_pay").map(Js=>(Js.chapterTitle||Js.target||"").trim()).filter(Boolean))).slice(0,12),ve={viewChapter:u.view_chapter||0,purchase:u.purchase||0,firstPay:u.first_pay||0},Xe=oe.length>0?`意向章节:${oe.join("、")}`:"",Nt={users:[{phone:a.phone||"",name:a.nickname||"",openId:a.openId||"",tags:le,purchaseIntent:ve,purchaseIntentChapters:oe,remark:Xe}]},Zt=await kt("/api/admin/shensheshou/ingest",Nt);Zt!=null&&Zt.success&&Zt.data?at(Zt.data):at({error:(Zt==null?void 0:Zt.error)||"推送失败"})}catch(oe){console.error("SSS ingest error:",oe),at({error:"请求失败"})}finally{Me(!1)}}}const va=oe=>{const Xe={view_chapter:dr,purchase:lu,match:Un,login:Si,register:Si,share:Mi,bind_phone:L1,bind_wechat:DM,fill_profile:cu,fill_avatar:Si,visit_page:ua,first_pay:lu,vip_activate:Uc,click_super:Un,lead_submit:L1,withdraw:Vx,referral_bind:Mi,card_click:Si,btn_click:_o,tab_click:ua,nav_click:ua,page_view:ua,search:ua}[oe]||zx;return s.jsx(Xe,{className:"w-4 h-4"})};function Tr(oe){const ve=String(oe||"").trim();return ve.length>22&&/^[a-zA-Z0-9_-]+$/.test(ve)}const Mr=y.useMemo(()=>a8(u,a),[u,a]);function Qr(){const oe=[...le];for(const ve of Mr)oe.includes(ve)||oe.push(ve);me(oe),G.success("已将旅程推断标签合并到已选")}return t?s.jsxs(s.Fragment,{children:[s.jsx(Dt,{open:t,onOpenChange:()=>e(),children:s.jsxs(Ot,{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(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(Si,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(a==null?void 0:a.phone)&&s.jsx(Be,{className:"bg-green-500/20 text-green-400 border-0 ml-2",children:"已绑定手机"}),(a==null?void 0:a.isVip)&&s.jsx(Be,{className:"bg-amber-500/20 text-amber-400 border-0",children:"VIP"})]})}),v?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):a?s.jsxs("div",{className:"flex flex-col min-h-0 flex-1 overflow-hidden",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row gap-2.5 p-2.5 bg-[#0a1628] rounded-lg mb-2 shrink-0",children:[s.jsxs("div",{className:"flex gap-2.5 min-w-0 flex-1",children:[s.jsx("div",{className:"w-11 h-11 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-lg text-[#38bdac] shrink-0",children:Ft(a.avatar,a.mbti)&&!Lt?s.jsx("img",{src:Ft(a.avatar,a.mbti),className:"w-full h-full rounded-full object-cover",alt:"",onError:()=>Ct(!0)}):((Qa=a.nickname)==null?void 0:Qa.charAt(0))||"?"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.jsx("h3",{className:"text-base font-bold text-white leading-tight",children:a.nickname}),a.isAdmin&&s.jsx(Be,{className:"bg-purple-500/20 text-purple-400 border-0 text-[10px] py-0",children:"管理员"}),a.hasFullBook&&s.jsx(Be,{className:"bg-green-500/20 text-green-400 border-0 text-[10px] py-0",children:"全书已购"}),a.vipRole&&s.jsx(Be,{className:"bg-amber-500/20 text-amber-400 border-0 text-[10px] py-0",children:a.vipRole})]}),a.referralCode&&s.jsxs("p",{className:"text-[10px] text-gray-500 mt-0.5",children:["推荐码 ",s.jsx("code",{className:"text-[#38bdac]",children:a.referralCode})]}),s.jsxs("div",{className:"mt-1 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-1.5 text-[11px]",children:[s.jsxs("div",{className:"px-2 py-1 rounded bg-[#162840] border border-gray-700/50",children:[s.jsx("span",{className:"text-gray-500",children:"昵称"}),s.jsx("p",{className:"text-white truncate",children:$||a.nickname||"—"})]}),s.jsxs("div",{className:"px-2 py-1 rounded bg-[#162840] border border-gray-700/50",children:[s.jsx("span",{className:"text-gray-500",children:"手机号"}),s.jsx("p",{className:"text-white truncate",children:z||"—"})]}),s.jsxs("div",{className:"px-2 py-1 rounded bg-[#162840] border border-gray-700/50",children:[s.jsx("span",{className:"text-gray-500",children:"微信标识"}),s.jsx("p",{className:"text-white truncate",children:Q||"—"})]}),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:()=>{we(""),Ue(""),Z(!0)},children:"调整"})]}),s.jsxs("p",{className:"text-sm font-bold text-white leading-tight",children:["¥",((N==null?void 0:N.balance)??0).toFixed(2)]}),s.jsx("p",{className:"text-[9px] text-gray-600",children:"可消费/抵扣"})]}),s.jsxs("div",{className:"rounded-md bg-[#162840] px-2 py-1.5 border border-gray-700/40",children:[s.jsx("p",{className:"text-[9px] text-gray-500",children:"推荐人数"}),s.jsx("p",{className:"text-sm font-bold text-white leading-tight",children:a.referralCount??0}),s.jsx("p",{className:"text-[9px] text-gray-600",children:a.createdAt?`注册 ${new Date(a.createdAt).toLocaleDateString()}`:"—"})]})]})]}),s.jsxs(Yc,{value:U,onValueChange:P,className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[s.jsxs(Vl,{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(en,{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(en,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-[11px] px-2 py-1 h-7",children:[s.jsx(ua,{className:"w-3 h-3 mr-0.5"}),"旅程与轨迹"]}),s.jsx(en,{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(en,{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(tn,{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(te,{className:"text-gray-400 text-[11px]",children:"昵称"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"昵称",value:$,onChange:oe=>ie(oe.target.value)})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{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:z,onChange:oe=>L(oe.target.value)})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{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:Q,onChange:oe=>se(oe.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(nk,{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(Uc,{className:"w-3.5 h-3.5 text-amber-400 shrink-0"}),s.jsx("span",{className:"text-white text-xs font-medium",children:"超级个体"}),a.isVip&&s.jsx(Be,{className:"bg-amber-500/20 text-amber-400 border-0 text-[10px] py-0 shrink-0",children:a.vipRole||"VIP"})]}),s.jsx(Ut,{className:"scale-90",checked:he.isVip,onCheckedChange:oe=>de(ve=>({...ve,isVip:oe}))})]}),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(te,{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:oe=>de(ve=>({...ve,vipExpireDate:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(te,{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:oe=>de(ve=>({...ve,vipRole:oe.target.value})),children:[s.jsx("option",{value:"",children:"请选择"}),D.map(oe=>s.jsx("option",{value:oe.name,children:oe.name},oe.id))]})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(te,{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:oe=>de(ve=>({...ve,vipName:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(te,{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:oe=>de(ve=>({...ve,vipProject:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(te,{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:oe=>de(ve=>({...ve,vipContact:oe.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5 sm:col-span-2",children:[s.jsx(te,{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:oe=>de(ve=>({...ve,vipBio:oe.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(_o,{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:xn,onChange:oe=>En(oe.target.value)}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:微信号",value:Vn,onChange:oe=>es(oe.target.value)}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:OpenID",value:Rt,onChange:oe=>yn(oe.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:Ja,disabled:pt,children:[pt?s.jsx(He,{className:"w-3 h-3 animate-spin"}):s.jsx(pa,{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:Jr,disabled:Ne||!a.phone,children:Ne?"推送…":"推神射手"}),s.jsx(J,{size:"sm",variant:"outline",className:"h-7 text-[11px] px-2",onClick:bt,disabled:T||!a.phone,children:T?"同步…":"存客宝同步"})]}),a.ckbSyncedAt&&s.jsxs("p",{className:"text-[10px] text-gray-500 mt-1",children:["最近存客宝同步:",new Date(a.ckbSyncedAt).toLocaleString()]}),fn&&s.jsx("p",{className:"mt-1 text-red-400 text-[11px]",children:fn}),hn&&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:hn.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:hn.user_level??"—"})]})]}),We&&s.jsx("p",{className:"mt-1 text-[11px]",children:We.error?s.jsx("span",{className:"text-red-400",children:String(We.error)}):s.jsx("span",{className:"text-green-400",children:"推送成功"})})]}),s.jsxs("div",{className:"p-2 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[s.jsx(Vx,{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:F,onChange:oe=>ge(oe.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:oe=>B(oe.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:Ds,disabled:W||!F||!X,children:W?"保存中":"确认修改"})]})]})]}),s.jsxs(tn,{value:"journey",className:"flex-1 min-h-0 overflow-y-auto space-y-2 pr-0.5",children:[Qe.length>0&&s.jsxs("div",{className:"p-2 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[s.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[s.jsx(lu,{className:"w-3.5 h-3.5 text-amber-400"}),s.jsxs("span",{className:"text-white text-xs font-medium",children:["购买清单(",Qe.length," 笔)"]})]}),s.jsx("div",{className:"space-y-1 max-h-[120px] overflow-y-auto",children:Qe.map((oe,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:oe.productType==="fullbook"||oe.productType==="vip"?"全书/VIP":`章节 ${oe.productId||""}`}),s.jsxs("span",{className:"text-gray-500 ml-2",children:["¥",Number(oe.amount||0).toFixed(2)]})]}),s.jsx("span",{className:"text-gray-500 text-[10px] shrink-0",children:oe.createdAt?new Date(oe.createdAt).toLocaleString("zh-CN"):""})]},oe.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(ua,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0"}),s.jsxs("span",{children:["全站埋点共 ",o.length," 条;用于 RFM 与「标签体系」旅程推断"]})]}),Object.keys(u).length>0&&s.jsx("div",{className:"flex flex-wrap gap-1 pt-1 border-t border-gray-700/40",children:Object.entries(u).sort((oe,ve)=>ve[1]-oe[1]).map(([oe,ve])=>s.jsxs(Be,{variant:"outline",className:"text-[10px] border-gray-600 text-gray-300 bg-[#162840] py-0 h-5",children:[r8(oe)," ×",ve]},oe))})]}),s.jsx("div",{className:"space-y-1.5",children:o.length>0?o.map((oe,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:va(oe.action)}),ve0?((g==null?void 0:g.visits)||[]).map((oe,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:["第 ",oe.seq||ve+1," 次 · ",oe.referrerNickname||"微信用户",oe.referrerId?`(${oe.referrerId})`:""]}),oe.page?s.jsx("p",{className:"text-gray-500 text-[10px] truncate",children:oe.page}):null]}),s.jsx("span",{className:"text-gray-500 text-[10px] shrink-0",children:oe.visitedAt?new Date(oe.visitedAt).toLocaleString():""})]},`${oe.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(Mi,{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((oe,ve)=>{var Nt;const Xe=oe;return s.jsxs("div",{className:"flex items-center justify-between p-1.5 bg-[#162840] rounded text-xs",children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx("div",{className:"w-6 h-6 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-[10px] text-[#38bdac] shrink-0",children:((Nt=Xe.nickname)==null?void 0:Nt.charAt(0))||"?"}),s.jsx("span",{className:"text-white truncate",children:Xe.nickname})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[Xe.status==="vip"&&s.jsx(Be,{className:"bg-green-500/20 text-green-400 border-0 text-[10px] py-0",children:"已购"}),s.jsx("span",{className:"text-gray-500 text-[10px]",children:Xe.createdAt?new Date(Xe.createdAt).toLocaleDateString():""})]})]},Xe.id||ve)}):s.jsx("p",{className:"text-gray-500 text-sm text-center py-3",children:"暂无推荐用户"})})]})]}),s.jsxs(tn,{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(cu,{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(Jj,{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:Mr.length===0,onClick:Qr,children:"合并到已选"})]}),Mr.length>0?s.jsx("div",{className:"flex flex-wrap gap-1",children:Mr.map(oe=>s.jsxs(Be,{variant:"outline",className:`text-[10px] py-0 h-5 border-cyan-500/30 ${le.includes(oe)?"bg-cyan-500/15 text-cyan-200":"text-gray-300"}`,children:[le.includes(oe)?"✓ ":"",oe]},oe))}):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(oe=>s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-[11px] mb-1",children:oe.category}),s.jsx("div",{className:"flex flex-wrap gap-1",children:oe.tags.map(ve=>s.jsxs("button",{type:"button",onClick:()=>{le.includes(ve)?wn(ve):me([...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))})]},oe.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((oe,ve)=>s.jsxs(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1 text-[11px] py-0",children:[oe,s.jsx("button",{type:"button",onClick:()=>wn(oe),className:"ml-1 hover:text-red-400",children:s.jsx(Xn,{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:oe=>Y(oe.target.value),onKeyDown:oe=>oe.key==="Enter"&&Qt()}),s.jsx(J,{onClick:Qt,className:"bg-[#38bdac] hover:bg-[#2da396] h-8 text-xs px-3",children:"添加"})]})]})]}),(()=>{const oe=a.tags||a.ckbTags||"";let ve=[];try{const Nt=typeof oe=="string"?JSON.parse(oe||"[]"):[];ve=Array.isArray(Nt)?Nt:typeof oe=="string"?oe.split(","):[]}catch{ve=typeof oe=="string"?oe.split(","):[]}const Xe=ve.map(Nt=>String(Nt).trim()).filter(Boolean);return Xe.length===0?null:s.jsxs("div",{className:"p-2.5 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[s.jsx(cu,{className:"w-3.5 h-3.5 text-purple-400"}),s.jsx("span",{className:"text-white text-sm font-medium",children:"存客宝标签"})]}),s.jsx("div",{className:"flex flex-wrap gap-1",children:Xe.map((Nt,Zt)=>s.jsx(Be,{className:"bg-purple-500/20 text-purple-400 border-0 text-[11px] py-0",children:Nt},Zt))})]})})()]})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-gray-700 mt-3 shrink-0",children:[s.jsxs(J,{variant:"outline",onClick:e,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Xn,{className:"w-4 h-4 mr-2"}),"关闭"]}),s.jsxs(J,{onClick:Pt,disabled:R,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),R?"保存中...":"保存修改"]})]})]}):s.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}),s.jsx(Dt,{open:_,onOpenChange:Z,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsx($t,{children:"调整余额"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{children:[s.jsx(te,{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:re,onChange:oe=>we(oe.target.value)})]}),s.jsxs("div",{children:[s.jsx(te,{className:"text-gray-300 text-sm",children:"备注(可选)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"如:活动补偿",value:Fe,onChange:oe=>Ue(oe.target.value)})]})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(J,{variant:"outline",onClick:()=>Z(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(J,{onClick:hr,disabled:jt,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:jt?"提交中...":"确认调整"})]})]})})]}):null}function i8(){const t=Ka(),[e,n]=y.useState(!0),[r,a]=y.useState(!0),[i,o]=y.useState(!0),[c,u]=y.useState([]),[h,f]=y.useState([]),[m,g]=y.useState(0),[b,N]=y.useState(0),[j,v]=y.useState(0),[k,T]=y.useState(0),[C,R]=y.useState(null),[O,U]=y.useState(null),[P,z]=y.useState(!1),[L,Q]=y.useState(0),[se,$]=y.useState(!1),[ie,le]=y.useState(null),[me,I]=y.useState("overview"),[Y,F]=y.useState([]),[ge,X]=y.useState(!1),[B,W]=y.useState("today"),[fe,he]=y.useState(null),[de,D]=y.useState(!1),[q,_]=y.useState(!0),[Z,re]=y.useState(null),[we,Fe]=y.useState(null),[Ue,jt]=y.useState([]),Nn=Ne=>{const Me=Ne;if((Me==null?void 0:Me.status)===401)R("登录已过期,请重新登录");else{if((Me==null?void 0:Me.name)==="AbortError")return;R("加载失败,请检查网络或联系管理员")}};async function pt(Ne){var Lt,Ct;const Me=Ne?{signal:Ne}:void 0;n(!0),R(null);try{const $e=await Oe("/api/admin/dashboard/stats",Me);$e!=null&&$e.success&&(g($e.totalUsers??0),N($e.paidOrderCount??0),v($e.totalRevenue??0),T($e.conversionRate??0))}catch($e){if(($e==null?void 0:$e.name)!=="AbortError"){console.error("stats 失败,尝试 overview 降级",$e);try{const H=await Oe("/api/admin/dashboard/overview",Me);H!=null&&H.success&&(g(H.totalUsers??0),N(H.paidOrderCount??0),v(H.totalRevenue??0),T(H.conversionRate??0))}catch(H){Nn(H)}}}finally{n(!1)}try{const $e=await Oe("/api/admin/balance/summary",Me);$e!=null&&$e.success&&$e.data&&Q($e.data.totalGifted??0)}catch{}try{const $e=await Oe("/api/db/ckb-plan-stats",Me);$e!=null&&$e.success&&$e.data?le({ckbTotal:$e.data.ckbTotal??0,withContact:$e.data.withContact??0}):le(null)}catch{le(null)}_(!0);try{const[$e,H]=await Promise.allSettled([Oe("/api/db/match-records?stats=true",Me),Oe("/api/admin/distribution/overview",Me)]);$e.status==="fulfilled"&&((Lt=$e.value)!=null&&Lt.success)&&$e.value.data?re({totalMatches:$e.value.data.totalMatches??0,todayMatches:$e.value.data.todayMatches??0,uniqueUsers:$e.value.data.uniqueUsers??0,paidMatchCount:$e.value.data.paidMatchCount??0}):re(null),H.status==="fulfilled"&&((Ct=H.value)!=null&&Ct.success)&&H.value.overview?Fe({todayClicks:H.value.overview.todayClicks??0,todayBindings:H.value.overview.todayBindings??0,todayConversions:H.value.overview.todayConversions??0,monthClicks:H.value.overview.monthClicks??0,monthBindings:H.value.overview.monthBindings??0,monthConversions:H.value.overview.monthConversions??0,totalClicks:H.value.overview.totalClicks??0,totalBindings:H.value.overview.totalBindings??0,totalConversions:H.value.overview.totalConversions??0,conversionRate:H.value.overview.conversionRate}):Fe(null)}catch{re(null),Fe(null)}finally{_(!1)}try{const $e=await Oe("/api/db/vip-members?limit=500",Me);$e!=null&&$e.success&&Array.isArray($e.data)?jt($e.data):jt([])}catch{jt([])}a(!0),o(!0);const We=async()=>{try{const $e=await Oe("/api/admin/dashboard/recent-orders?limit=10",Me);if($e!=null&&$e.success&&$e.recentOrders)f($e.recentOrders);else throw new Error("no data")}catch($e){if(($e==null?void 0:$e.name)!=="AbortError")try{const H=await Oe("/api/admin/orders?page=1&pageSize=20&status=paid",Me),vt=((H==null?void 0:H.orders)??[]).filter(Ft=>["paid","completed","success"].includes(Ft.status||""));f(vt.slice(0,5))}catch{f([])}}finally{a(!1)}},at=async()=>{try{const $e=await Oe("/api/admin/dashboard/new-users",Me);if($e!=null&&$e.success&&$e.newUsers)u($e.newUsers);else throw new Error("no data")}catch($e){if(($e==null?void 0:$e.name)!=="AbortError")try{const H=await Oe("/api/db/users?page=1&pageSize=10",Me);u((H==null?void 0:H.users)??[])}catch{u([])}}finally{o(!1)}};await Promise.all([We(),at()])}async function It(Ne){const Me=Ne||B;D(!0);try{const We=await Oe(`/api/admin/track/stats?period=${Me}`);We!=null&&We.success&&he({total:We.total??0,byModule:We.byModule??{}})}catch{he(null)}finally{D(!1)}}const hn={home:"首页",chapters:"目录",read:"阅读页",my:"我的",vip:"超级个体",wallet:"钱包",match:"找伙伴",referral:"推广中心",search:"搜索",settings:"设置",about:"关于",member_detail:"成员详情",other:"其他"},Bn={btn_click:"按钮点击",nav_click:"导航点击",card_click:"卡片点击",tab_click:"标签切换",page_view:"页面浏览",share:"分享",purchase:"购买",register:"注册",rule_trigger:"规则触发",view_chapter:"浏览章节",link_click:"链接点击"},fn=Ne=>Ne?Ne.replace(/^part-/,"").replace(/^soulvip_/,"").replace(/^super_?/,"").replace(/^user_/,"").replace(/[_-]+/g," ").trim():"",Wt=Ne=>{if(!Ne)return"";const Me=Ne.trim().toLowerCase();if(!Me)return"";const We=Ue.find(Lt=>{const Ct=String(Lt.id||"").toLowerCase();return Ct===Me||Ct.includes(Me)||Me.includes(Ct)});if(We)return We.name||We.nickname||"";const at=Ue.find(Lt=>{const Ct=String(Lt.token||"").toLowerCase();return Ct&&(Ct===Me||Ct.includes(Me)||Me.includes(Ct))});return at&&(at.name||at.nickname)||""},xn=Ne=>{if(!Ne)return"未命名点击";const Me=Ne.trim(),We=Me.toLowerCase();if(/^链接头像[_-]/.test(Me)){const Lt=fn(Me.replace(/^链接头像[_-]/,""));return Lt?`头像:${Lt}`:"头像点击"}if(/^member[_-]?detail$/i.test(We)||We.includes("member detail"))return"成员详情";if(/^giftpay$/i.test(We)||We.includes("gift pay"))return"代付入口";if(/^part[-_]/i.test(We))return`章节:${fn(Me)}`;if(We.includes("soulvip")||We.includes("super")){const Lt=Me.replace(/^超级个体[::]?/i,"").replace(/^super[_-]?/i,"").replace(/^soulvip[_-]?/i,"").replace(/^user[_-]?/i,"").trim(),Ct=Wt(Lt)||Wt(fn(Lt));return Ct?`超级个体:${Ct}`:`超级个体:${fn(Lt)}`}if(We.includes("qgdtw")||We.includes("token")||We.includes("0000"))return`对象:${fn(Me)}`;const at={开始匹配:"开始匹配",mentor:"导师顾问",team:"团队招募",investor:"资源对接",充值:"充值",退款:"退款",wallet:"钱包",设置:"设置",VIP:"VIP会员",推广:"推广中心",目录:"目录",搜索:"搜索",匹配:"找伙伴",settings:"设置",expired:"已过期",active:"活跃",converted:"已转化",fill_profile:"完善资料",register:"注册",purchase:"购买",链接卡若:"链接卡若",更多分享:"更多分享",分享朋友圈文案:"分享朋友圈",选择金额10:"选择金额10元",member_detail:"成员详情",giftPay:"代付入口"};return at[Me]?at[Me]:/^[a-z0-9_-]+$/i.test(Me)&&fn(Me)||Me},En=Ne=>{const Me=hn[Ne.module]||hn[Ne.page]||Ne.module||Ne.page||"其他",We=Bn[Ne.action]||Ne.action||"点击",at=xn(Ne.target);return`${Me} · ${We} · ${at}`};async function Vn(){X(!0);try{const Ne=await Oe("/api/admin/super-individual/stats");Ne!=null&&Ne.success&&Array.isArray(Ne.data)&&F(Ne.data)}catch{}finally{X(!1)}}y.useEffect(()=>{const Ne=new AbortController;return pt(Ne.signal),It(),Vn(),()=>{Ne.abort()}},[]);const es=m,Rt=Ne=>{const Me=Ne.productType||"",We=Ne.description||"";if(Me==="balance_recharge")return{title:`余额充值 ¥${typeof Ne.amount=="number"?Ne.amount.toFixed(2):parseFloat(String(Ne.amount||"0")).toFixed(2)}`,subtitle:"余额充值"};if(Me==="gift_pay")return{title:`代付 ¥${typeof Ne.amount=="number"?Ne.amount.toFixed(2):parseFloat(String(Ne.amount||"0")).toFixed(2)}`,subtitle:"好友代付"};if(Me==="gift_pay_batch"){const at=typeof Ne.amount=="number"?Ne.amount.toFixed(2):parseFloat(String(Ne.amount||"0")).toFixed(2);return{title:We||`代付分享 ¥${at}`,subtitle:"代付分享"}}if(Me==="section"&&We.includes("代付领取"))return{title:We.replace("代付领取 - ",""),subtitle:"代付领取"};if(We){if(Me==="section"&&We.includes("章节")){if(We.includes("-")){const at=We.split("-");if(at.length>=3)return{title:`第${at[1]}章 第${at[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:We,subtitle:"章节购买"}}return Me==="fullbook"||We.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:Me==="vip"||We.includes("VIP")?{title:"超级个体开通费用",subtitle:"超级个体"}:Me==="match"||We.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:We,subtitle:Me==="section"?"单章":Me==="fullbook"?"全书":"其他"}}return Me==="section"?{title:`章节 ${Ne.productId||""}`,subtitle:"单章购买"}:Me==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:Me==="vip"?{title:"超级个体开通费用",subtitle:"超级个体"}:Me==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:Me||"其他"}},yn=[{title:"总用户数",value:e?null:es,sub:null,icon:Un,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:e?null:`¥${(j??0).toFixed(2)}`,sub:L>0?`含代付 ¥${L.toFixed(2)}`:null,icon:Tf,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:e?null:b,sub:null,icon:lu,color:"text-purple-400",bg:"bg-purple-500/20",link:"/orders"},{title:"转化率",value:e?null:`${typeof k=="number"?k.toFixed(1):0}%`,sub:null,icon:dr,color:"text-orange-400",bg:"bg-orange-500/20",link:"/distribution"},{title:"存客宝获客",value:ie?ie.ckbTotal??0:null,sub:(ie==null?void 0:ie.withContact)!=null?`含联系方式 ${ie.withContact} 人`:null,icon:Vc,color:"text-cyan-400",bg:"bg-cyan-500/20",link:"/users?tab=leads"},{title:"伙伴&推广协同",value:q?null:((Z==null?void 0:Z.totalMatches)??0)+((we==null?void 0:we.totalClicks)??0),sub:q?null:`找伙伴 ${(Z==null?void 0:Z.totalMatches)??0} / 推广 ${(we==null?void 0:we.totalClicks)??0}`,icon:Jd,color:"text-emerald-400",bg:"bg-emerald-500/20",link:"/find-partner"}];return s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),C&&s.jsxs("div",{className:"mb-6 px-4 py-3 rounded-lg bg-amber-500/20 border border-amber-500/50 text-amber-200 text-sm flex items-center justify-between",children:[s.jsx("span",{children:C}),s.jsx("button",{type:"button",onClick:()=>pt(),className:"text-amber-400 hover:text-amber-300 underline",children:"重试"})]}),s.jsx("div",{className:"grid gap-6 mb-8 grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 xl:grid-cols-6",children:yn.map((Ne,Me)=>s.jsxs(De,{className:"min-w-0 bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>Ne.link&&t(Ne.link),children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsx(ht,{className:"text-sm font-medium text-gray-400",children:Ne.title}),s.jsx("div",{className:`p-2 rounded-lg ${Ne.bg}`,children:s.jsx(Ne.icon,{className:`w-4 h-4 ${Ne.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:Ne.value!=null?Ne.value:s.jsxs("span",{className:"inline-flex items-center gap-2 text-gray-500",children:[s.jsx(He,{className:"w-4 h-4 animate-spin"}),"加载中"]})}),Ne.sub&&s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:Ne.sub})]}),s.jsx(Cl,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},Me))}),s.jsxs("div",{className:"flex gap-2 mb-6 mt-2",children:[s.jsx("button",{type:"button",onClick:()=>I("overview"),className:`px-5 py-2 rounded-lg text-sm font-medium transition-colors ${me==="overview"?"bg-[#38bdac] text-white":"bg-[#0f2137] text-gray-400 hover:text-white hover:bg-gray-700/50 border border-gray-700/50"}`,children:"数据概览"}),s.jsx("button",{type:"button",onClick:()=>I("tags"),className:`px-5 py-2 rounded-lg text-sm font-medium transition-colors ${me==="tags"?"bg-[#38bdac] text-white":"bg-[#0f2137] text-gray-400 hover:text-white hover:bg-gray-700/50 border border-gray-700/50"}`,children:"用户标签点击统计"}),s.jsx("button",{type:"button",onClick:()=>I("super"),className:`px-5 py-2 rounded-lg text-sm font-medium transition-colors ${me==="super"?"bg-[#38bdac] text-white":"bg-[#0f2137] text-gray-400 hover:text-white hover:bg-gray-700/50 border border-gray-700/50"}`,children:"超级个体统计"})]}),me==="overview"&&s.jsxs("div",{className:"space-y-8",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between",children:[s.jsx(ht,{className:"text-white",children:"找伙伴 × 推广中心(共统计)"}),s.jsxs("button",{type:"button",onClick:()=>pt(),disabled:q,className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1 disabled:opacity-50",title:"刷新共统计",children:[s.jsx(He,{className:`w-3.5 h-3.5 ${q?"animate-spin":""}`}),"刷新"]})]}),s.jsxs(_e,{children:[q&&!Z&&!we?s.jsxs("div",{className:"flex items-center justify-center py-10 text-gray-500",children:[s.jsx(He,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-6 gap-4",children:[s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"找伙伴总匹配"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(Z==null?void 0:Z.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:(Z==null?void 0:Z.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:(Z==null?void 0:Z.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:(we==null?void 0:we.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:(we==null?void 0:we.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:(we==null?void 0:we.totalConversions)??0})]})]}),(we==null?void 0:we.conversionRate)&&s.jsxs("p",{className:"text-xs text-gray-500 mt-3",children:["推广转化率:",we.conversionRate]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between",children:[s.jsx(ht,{className:"text-white",children:"最近订单"}),s.jsxs("button",{type:"button",onClick:()=>pt(),disabled:r||i,className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1 disabled:opacity-50",title:"刷新",children:[r||i?s.jsx(He,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(He,{className:"w-3.5 h-3.5"}),"刷新"]})]}),s.jsx(_e,{children:s.jsx("div",{className:"space-y-3",children:r&&h.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(He,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[h.slice(0,se?10:4).map(Ne=>{var Ct;const Me=Ne.referrerId?c.find($e=>$e.id===Ne.referrerId):void 0,We=Ne.referralCode||(Me==null?void 0:Me.referralCode)||(Me==null?void 0:Me.nickname)||(Ne.referrerId?String(Ne.referrerId).slice(0,8):""),at=Rt(Ne),Lt=Ne.userNickname||((Ct=c.find($e=>$e.id===Ne.userId))==null?void 0:Ct.nickname)||"匿名用户";return s.jsxs("div",{className:"flex items-start justify-between p-4 bg-[#0a1628] rounded-lg border border-gray-700/30 hover:border-[#38bdac]/30 transition-colors",children:[s.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[Ne.userAvatar?s.jsx("img",{src:Ne.userAvatar,alt:Lt,className:"w-9 h-9 rounded-full object-cover shrink-0 mt-0.5",onError:$e=>{$e.currentTarget.style.display="none";const H=$e.currentTarget.nextElementSibling;H&&H.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 ${Ne.userAvatar?"hidden":""}`,children:Lt.charAt(0)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("button",{type:"button",onClick:()=>{Ne.userId&&(U(Ne.userId),z(!0))},className:"text-sm text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:Lt}),s.jsx("span",{className:"text-gray-600",children:"·"}),s.jsx("span",{className:"text-sm font-medium text-white truncate",title:at.title,children:at.title})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[at.subtitle&&at.subtitle!=="章节购买"&&s.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:at.subtitle}),s.jsx("span",{children:new Date(Ne.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),We&&s.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",We]})]})]}),s.jsxs("div",{className:"text-right ml-4 shrink-0",children:[s.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(Ne.amount).toFixed(2)]}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:Ne.paymentMethod||"微信"})]})]},Ne.id)}),h.length>4&&!se&&s.jsx("button",{type:"button",onClick:()=>$(!0),className:"w-full py-2 text-sm text-[#38bdac] hover:text-[#2da396] border border-dashed border-gray-600 rounded-lg hover:border-[#38bdac]/50 transition-colors",children:"展开更多"}),h.length===0&&!r&&s.jsxs("div",{className:"text-center py-12",children:[s.jsx(lu,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(ut,{children:s.jsx(ht,{className:"text-white",children:"新注册用户"})}),s.jsx(_e,{children:s.jsx("div",{className:"space-y-3",children:i&&c.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(He,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[c.slice(0,5).map(Ne=>{var Me;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:((Me=Ne.nickname)==null?void 0:Me.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("button",{type:"button",onClick:()=>{U(Ne.id),z(!0)},className:"text-sm font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:Ne.nickname||"匿名用户"}),s.jsx("p",{className:"text-xs text-gray-500",children:Ne.phone||"未绑定手机"})]})]}),s.jsx("p",{className:"text-xs text-gray-400",children:Ne.createdAt?new Date(Ne.createdAt).toLocaleDateString():"-"})]},Ne.id)}),c.length===0&&!i&&s.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})})]})]})]}),me==="tags"&&s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between",children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Jd,{className:"w-5 h-5 text-[#38bdac]"}),"分类标签点击统计"]}),s.jsx("div",{className:"flex items-center gap-2",children:["today","week","month","all"].map(Ne=>s.jsx("button",{type:"button",onClick:()=>{W(Ne),It(Ne)},className:`px-3 py-1 text-xs rounded-full transition-colors ${B===Ne?"bg-[#38bdac] text-white":"bg-gray-700/50 text-gray-400 hover:bg-gray-700"}`,children:{today:"今日",week:"本周",month:"本月",all:"全部"}[Ne]},Ne))})]}),s.jsx(_e,{children:de&&!fe?s.jsxs("div",{className:"flex items-center justify-center py-12 text-gray-500",children:[s.jsx(He,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):fe&&Object.keys(fe.byModule).length>0?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("p",{className:"text-sm text-gray-400",children:["总点击 ",s.jsx("span",{className:"text-white font-bold text-lg",children:fe.total})," 次"]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Object.entries(fe.byModule).sort((Ne,Me)=>Me[1].reduce((We,at)=>We+at.count,0)-Ne[1].reduce((We,at)=>We+at.count,0)).slice(0,5).map(([Ne,Me])=>{const We=Me.reduce((at,Lt)=>at+Lt.count,0);return s.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("span",{className:"text-sm font-medium text-[#38bdac]",children:hn[Ne]||Ne}),s.jsxs("span",{className:"text-xs text-gray-500",children:[We," 次"]})]}),s.jsx("div",{className:"space-y-2",children:Me.sort((at,Lt)=>Lt.count-at.count).slice(0,8).map((at,Lt)=>{const Ct=En(at);return s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-gray-300 truncate mr-2",title:Ct,children:Ct}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx("div",{className:"w-16 h-1.5 bg-gray-700 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-[#38bdac] rounded-full",style:{width:`${We>0?at.count/We*100:0}%`}})}),s.jsx("span",{className:"text-gray-400 w-8 text-right",children:at.count})]})]},Lt)})})]},Ne)})})]}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Jd,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无点击数据"}),s.jsx("p",{className:"text-gray-600 text-xs mt-1",children:"小程序端接入埋点后,数据将在此实时展示"})]})})]}),me==="super"&&s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between",children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Jd,{className:"w-5 h-5 text-amber-400"}),"超级个体点击统计"]}),s.jsxs(J,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-300 h-8",onClick:Vn,disabled:ge,children:[s.jsx(He,{className:`w-3.5 h-3.5 mr-1 ${ge?"animate-spin":""}`}),"刷新"]})]}),s.jsx(_e,{children:ge&&Y.length===0?s.jsxs("div",{className:"flex items-center justify-center py-12 text-gray-500",children:[s.jsx(He,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):Y.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:Y.map((Ne,Me)=>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:Me+1}),s.jsx("td",{className:"py-2 px-3",children:s.jsxs("div",{className:"flex items-center gap-2",children:[Ne.avatar?s.jsx("img",{src:Ne.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(Ne.nickname||Ne.userId)}`),title:"点击跳转用户管理",children:Ne.nickname||Ne.userId})]})}),s.jsx("td",{className:"py-2 px-3 text-center text-white font-bold",children:Ne.clicks}),s.jsx("td",{className:"py-2 px-3 text-center text-[#38bdac]",children:Ne.uniqueClicks}),s.jsx("td",{className:"py-2 px-3 text-center text-gray-400",children:Ne.uniqueClicks>0?(Ne.clicks/Ne.uniqueClicks).toFixed(1):"-"}),s.jsx("td",{className:"py-2 px-3 text-center text-green-400 text-xs font-medium",children:typeof Ne.leadCount=="number"?Ne.leadCount:0}),s.jsx("td",{className:"py-2 px-3 text-gray-400 text-xs",children:Ne.phone||"-"})]},Ne.userId))})]})}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Jd,{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(uy,{open:P,onClose:()=>{z(!1),U(null)},userId:O,onUserUpdated:()=>pt()})]})}const us=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{className:"relative w-full overflow-auto",children:s.jsx("table",{ref:n,className:zt("w-full caption-bottom text-sm",t),...e})}));us.displayName="Table";const hs=y.forwardRef(({className:t,...e},n)=>s.jsx("thead",{ref:n,className:zt("[&_tr]:border-b",t),...e}));hs.displayName="TableHeader";const fs=y.forwardRef(({className:t,...e},n)=>s.jsx("tbody",{ref:n,className:zt("[&_tr:last-child]:border-0",t),...e}));fs.displayName="TableBody";const xt=y.forwardRef(({className:t,...e},n)=>s.jsx("tr",{ref:n,className:zt("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));xt.displayName="TableRow";const Se=y.forwardRef(({className:t,...e},n)=>s.jsx("th",{ref:n,className:zt("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));Se.displayName="TableHead";const je=y.forwardRef(({className:t,...e},n)=>s.jsx("td",{ref:n,className:zt("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));je.displayName="TableCell";function Hl(t,e){const[n,r]=y.useState(t);return y.useEffect(()=>{const a=setTimeout(()=>r(t),e);return()=>clearTimeout(a)},[t,e]),n}function Us({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 o8(){const[t,e]=y.useState([]),[n,r]=y.useState([]),[a,i]=y.useState(0),[o,c]=y.useState(0),[u,h]=y.useState(0),[f,m]=y.useState(1),[g,b]=y.useState(10),[N,j]=y.useState(""),v=Hl(N,300),[k,T]=y.useState("all"),[C,R]=y.useState(!0),[O,U]=y.useState(null),[P,z]=y.useState(null),[L,Q]=y.useState(""),[se,$]=y.useState(!1);async function ie(){R(!0),U(null);try{const X=k==="all"?"":k==="completed"?"completed":k,B=new URLSearchParams({page:String(f),pageSize:String(g),...X&&{status:X},...v&&{search:v}}),[W,fe]=await Promise.all([Oe(`/api/admin/orders?${B}`),Oe("/api/db/users?page=1&pageSize=500")]);W!=null&&W.success&&(e(W.orders||[]),i(W.total??0),c(W.totalRevenue??0),h(W.todayRevenue??0)),fe!=null&&fe.success&&fe.users&&r(fe.users)}catch(X){console.error("加载订单失败",X),U("加载订单失败,请检查网络后重试")}finally{R(!1)}}y.useEffect(()=>{m(1)},[v,k]),y.useEffect(()=>{ie()},[f,g,v,k]);const le=X=>{var B;return X.userNickname||((B=n.find(W=>W.id===X.userId))==null?void 0:B.nickname)||"匿名用户"},me=X=>{var B;return((B=n.find(W=>W.id===X))==null?void 0:B.phone)||"-"},I=X=>{const B=X.productType||X.type||"",W=X.description||"";if(B==="balance_recharge")return{name:`余额充值 ¥${Number(X.amount||0).toFixed(2)}`,type:"余额充值"};if(W){if(B==="section"&&(W.includes("章节")||W.includes("代付领取"))){if(W.includes("代付领取"))return{name:W.replace("代付领取 - ",""),type:"代付领取"};if(W.includes("-")){const fe=W.split("-");if(fe.length>=3)return{name:`第${fe[1]}章 第${fe[2]}节`,type:"《一场Soul的创业实验》"}}return{name:W,type:"章节购买"}}return B==="fullbook"||W.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:B==="vip"||W.includes("VIP")?{name:"超级个体开通费用",type:"超级个体"}:B==="match"||W.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:W,type:"其他"}}return B==="section"?{name:`章节 ${X.productId||X.sectionId||""}`,type:"单章"}:B==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:B==="vip"?{name:"超级个体开通费用",type:"超级个体"}:B==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:B||"其他"}},Y=Math.ceil(a/g)||1;async function F(){var X;if(!(!(P!=null&&P.orderSn)&&!(P!=null&&P.id))){$(!0),U(null);try{const B=await Xt("/api/admin/orders/refund",{orderSn:P.orderSn||P.id,reason:L||void 0});B!=null&&B.success?(z(null),Q(""),ie()):U((B==null?void 0:B.error)||"退款失败")}catch(B){const W=B;U(((X=W==null?void 0:W.data)==null?void 0:X.error)||"退款失败,请检查网络后重试")}finally{$(!1)}}}function ge(){if(t.length===0){G.info("暂无数据可导出");return}const X=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],B=t.map(D=>{const q=I(D);return[D.orderSn||D.id||"",le(D),me(D.userId),q.name,Number(D.amount||0).toFixed(2),D.paymentMethod==="wechat"?"微信支付":D.paymentMethod==="balance"?"余额支付":D.paymentMethod==="alipay"?"支付宝":D.paymentMethod||"微信支付",D.status==="refunded"?"已退款":D.status==="paid"||D.status==="completed"?"已完成":D.status==="pending"||D.status==="created"?"待支付":"已失败",D.status==="refunded"&&D.refundReason?D.refundReason:"-",D.referrerEarnings?Number(D.referrerEarnings).toFixed(2):"-",D.createdAt?new Date(D.createdAt).toLocaleString("zh-CN"):""].join(",")}),W="\uFEFF"+[X.join(","),...B].join(` -`),fe=new Blob([W],{type:"text/csv;charset=utf-8"}),he=URL.createObjectURL(fe),de=document.createElement("a");de.href=he,de.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,de.click(),URL.revokeObjectURL(he)}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:()=>U(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"订单管理"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",t.length," 笔订单"]})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs(J,{variant:"outline",onClick:ie,disabled:C,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${C?"animate-spin":""}`}),"刷新"]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsx("span",{className:"text-gray-400",children:"总收入:"}),s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",o.toFixed(2)]}),s.jsx("span",{className:"text-gray-600",children:"|"}),s.jsx("span",{className:"text-gray-400",children:"今日:"}),s.jsxs("span",{className:"text-[#FFD700] font-bold",children:["¥",u.toFixed(2)]})]})]})]}),s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsxs("div",{className:"relative flex-1 max-w-md",children:[s.jsx(pa,{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:N,onChange:X=>j(X.target.value)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ek,{className:"w-4 h-4 text-gray-400"}),s.jsxs("select",{value:k,onChange:X=>T(X.target.value),className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"pending",children:"待支付"}),s.jsx("option",{value:"created",children:"已创建"}),s.jsx("option",{value:"failed",children:"已失败"}),s.jsx("option",{value:"refunded",children:"已退款"})]})]}),s.jsxs(J,{variant:"outline",onClick:ge,disabled:t.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(V5,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:C?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(us,{children:[s.jsx(hs,{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(fs,{children:[t.map(X=>{const B=I(X);return s.jsxs(xt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsxs(je,{className:"font-mono text-xs text-gray-400",children:[(X.orderSn||X.id||"").slice(0,12),"..."]}),s.jsx(je,{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(Be,{className:"bg-emerald-500/20 text-emerald-400 hover:bg-emerald-500/20 border-0 text-xs",children:"代付领取"}),X.payerUserId&&X.paymentMethod!=="gift_pay"&&s.jsx(Be,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"代付"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:me(X.userId)}),X.payerUserId&&X.payerNickname&&s.jsxs("p",{className:"text-amber-400/80 text-xs mt-0.5",children:[X.paymentMethod==="gift_pay"?"赠送人:":"代付人:",X.payerNickname]})]})}),s.jsx(je,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[B.name,(X.productType||X.type)==="vip"&&s.jsx(Be,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"超级个体"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:B.type})]})}),s.jsxs(je,{className:"text-[#38bdac] font-bold",children:["¥",Number(X.amount||0).toFixed(2)]}),s.jsx(je,{className:"text-gray-300",children:X.paymentMethod==="wechat"?"微信支付":X.paymentMethod==="balance"?"余额支付":X.paymentMethod==="alipay"?"支付宝":X.paymentMethod||"微信支付"}),s.jsx(je,{children:s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[X.status==="refunded"?s.jsx(Be,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):X.status==="paid"||X.status==="completed"?s.jsx(Be,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):X.status==="pending"||X.status==="created"?s.jsx(Be,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):s.jsx(Be,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"}),(X.status==="paid"||X.status==="completed")&&(X.webhookPushStatus==="sent"?s.jsx(Be,{className:"bg-emerald-500/20 text-emerald-300 hover:bg-emerald-500/20 border-0",children:"已推送"}):s.jsx(Be,{className:"bg-orange-500/20 text-orange-300 hover:bg-orange-500/20 border-0",children:"待补推"}))]})}),s.jsx(je,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:X.refundReason,children:X.status==="refunded"&&X.refundReason?X.refundReason:"-"}),s.jsx(je,{className:"text-[#FFD700]",children:X.referrerEarnings?`¥${Number(X.referrerEarnings).toFixed(2)}`:"-"}),s.jsx(je,{className:"text-gray-400 text-sm",children:new Date(X.createdAt).toLocaleString("zh-CN")}),s.jsx(je,{children:(X.status==="paid"||X.status==="completed")&&X.paymentMethod!=="balance"&&s.jsxs(J,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{z(X),Q("")},children:[s.jsx(rk,{className:"w-3 h-3 mr-1"}),"退款"]})})]},X.id)}),t.length===0&&s.jsx(xt,{children:s.jsx(je,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),s.jsx(Us,{page:f,totalPages:Y,total:a,pageSize:g,onPageChange:m,onPageSizeChange:X=>{b(X),m(1)}})]})})}),s.jsx(Dt,{open:!!P,onOpenChange:X=>!X&&z(null),children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(_t,{children:s.jsx($t,{className:"text-white",children:"订单退款"})}),P&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",P.orderSn||P.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(P.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:L,onChange:X=>Q(X.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>z(null),disabled:se,children:"取消"}),s.jsx(J,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:F,disabled:se,children:se?"退款中...":"确认退款"})]})]})})]})}const ec=y.forwardRef(({className:t,...e},n)=>s.jsx("textarea",{className:zt("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}));ec.displayName="Textarea";const rN=["INTJ","INTP","ENTJ","ENTP","INFJ","INFP","ENFJ","ENFP","ISTJ","ISFJ","ESTJ","ESFJ","ISTP","ISFP","ESTP","ESFP"],S2={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 l8(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 c8(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 d8(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 aN(t){const e=S2[t],n=l8(e.group),r=c8(e.mood),a=d8(e.mood),i=` ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - - - - - - - - - - - - - - - - - - - - - - - - - -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js -`;return`data:image/svg+xml;utf8,${encodeURIComponent(i)}`}function f8(){const[t,e]=y.useState({}),[n,r]=y.useState(!0),[a,i]=y.useState(!1),[o,c]=y.useState(!1),u=y.useCallback(async()=>{r(!0);try{const g=await Oe("/api/admin/mbti-avatars");g!=null&&g.avatars?e(g.avatars):e({})}catch{G.error("加载 MBTI 头像配置失败")}finally{r(!1)}},[]);y.useEffect(()=>{u()},[u]);const h=async()=>{i(!0);try{const g=await kt("/api/admin/mbti-avatars",{avatars:t});if(!g||g.success===!1){G.error((g==null?void 0:g.error)||"保存失败");return}G.success("已保存,后台与小程序默认头像同步生效"),u()}catch{G.error("保存失败")}finally{i(!1)}},f=g=>{const b=oN(g);e(N=>({...N,[g]:b})),G.success(`${g} 已生成`)},m=()=>{c(!0);try{const g={...t};iN.forEach(b=>{g[b]=oN(b)}),e(g),G.success("16 型头像已生成(仅人物)")}finally{c(!1)}};return n?s.jsxs("div",{className:"flex items-center justify-center py-16 text-gray-400",children:[s.jsx(He,{className:"w-5 h-5 mr-2 animate-spin text-[#38bdac]"}),"加载配置…"]}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs(De,{className:"bg-[#0f2137] border-[#38bdac]/25 shadow-xl",children:[s.jsxs(ut,{className:"pb-2",children:[s.jsxs(ht,{className:"text-white flex items-center gap-2 text-lg",children:[s.jsx(vA,{className:"w-5 h-5 text-[#38bdac]"}),"MBTI 头像库"]}),s.jsx(qt,{className:"text-gray-400 text-sm leading-relaxed",children:"采用人物化风格,按 MBTI 性格自动生成。头像内不显示中英文,仅显示人物形象,颜色与站点主题融合。"})]}),s.jsxs(_e,{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(HA,{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(He,{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(Tn,{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:iN.map(g=>{const b=t[g]??"",N=E2[g];return s.jsxs("div",{className:"rounded-xl border border-gray-700/60 bg-[#0a1628] p-3 flex flex-col gap-2 hover:border-[#38bdac]/35 transition-colors",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 font-mono text-xs",children:g}),s.jsx("span",{className:"text-xs text-gray-400 truncate",title:N.title,children:N.title})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-16 h-16 rounded-full shrink-0 overflow-hidden flex items-center justify-center bg-[#081322] ring-2 ring-[#38bdac]/40 ring-offset-2 ring-offset-[#0a1628]",children:b?s.jsx("img",{src:b,alt:g,className:"w-full h-full object-cover scale-110"}):s.jsx("span",{className:"text-gray-600 text-[10px]",children:"未配"})}),s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"https://... 或 data:image/...",value:b,onChange:j=>e(v=>({...v,[g]:j.target.value}))})})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(J,{type:"button",size:"sm",variant:"outline",className:"h-7 text-[11px] border-[#38bdac]/40 text-[#38bdac]",onClick:()=>f(g),children:"生成这张"}),s.jsx(J,{type:"button",size:"sm",variant:"ghost",className:"h-7 text-[11px] text-gray-400",onClick:()=>e(j=>({...j,[g]:""})),children:"清空"})]})]},g)})})]})}const lN=[{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:"用户状态"}],cN=[{value:"popup",label:"弹窗提示",desc:"在小程序内弹窗引导用户完成下一步"},{value:"navigate",label:"跳转页面",desc:"引导用户跳转到指定页面"},{value:"webhook",label:"推送飞书群",desc:"触发后推送消息到飞书群Webhook"},{value:"tag",label:"自动打标签",desc:"触发后自动给用户打上指定标签"}];function T2(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 p8(t){return{...t,triggerConditions:T2(t.triggerConditions)}}const m8=[{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:"待激活"}],Rc=[{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 dN(t){return confirm(`确定删除该${t}?此操作不可恢复。`)?window.prompt(`请输入「删除」以确认删除${t}`)==="删除":!1}function g8({userId:t,userAvatar:e,nickname:n,name:r,onOpenDetail:a}){const[i,o]=y.useState(!1),c=n||r||"-",u=(c==="-"?"?":c).charAt(0),h=!!(e!=null&&e.trim())&&!i;return s.jsxs("div",{className:"flex items-center gap-2 min-w-0 max-w-[220px]",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/15 flex items-center justify-center text-xs font-medium text-[#38bdac] flex-shrink-0 overflow-hidden border border-gray-600/50","aria-hidden":!0,children:h?s.jsx("img",{src:ya(e),alt:"",className:"w-full h-full object-cover",onError:()=>o(!0)}):s.jsx("span",{children:u})}),s.jsx("button",{type:"button",className:`text-left truncate min-w-0 ${t?"hover:text-[#38bdac] cursor-pointer":"cursor-default text-gray-300"}`,disabled:!t,title:t?"查看用户详情":void 0,onClick:()=>{t&&a(t)},children:c})]})}function x8(t){const e=(t||"").trim();if(!e)return"";try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function y8(){var Ji,Gu,Nd,wd,jd,kd,Sd;const[t,e]=X0(),n=t.get("pool"),r=t.get("tab")||"users",a=["users","journey","rules","vip-roles","leads"].includes(r)?r:"users",i=(t.get("leadAction")||"").trim(),[o,c]=y.useState([]),[u,h]=y.useState(0),[f,m]=y.useState(1),[g,b]=y.useState(10),[N,j]=y.useState(""),v=Ul(N,300),k=n==="vip"?"vip":n==="complete"?"complete":"all",[T,C]=y.useState(k),[R,O]=y.useState(!0),[U,I]=y.useState(!1),[z,L]=y.useState(null),[Q,se]=y.useState(!1),[$,ie]=y.useState(!1),[le,me]=y.useState("desc");y.useEffect(()=>{n==="vip"?C("vip"):n==="complete"?C("complete"):n==="all"&&C("all")},[n]);const[P,Y]=y.useState(!1),[F,ge]=y.useState(null),[X,B]=y.useState(!1),[W,fe]=y.useState(!1),[he,de]=y.useState({referrals:[],stats:{}}),[D,q]=y.useState(!1),[_,Z]=y.useState(null),[re,we]=y.useState(!1),[Fe,Ue]=y.useState(null),[jt,jn]=y.useState(!1),[pt,Pt]=y.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),[pn,Hn]=y.useState([]),[mn,Wt]=y.useState(!1),[bn,Mn]=y.useState(!1),[Un,ns]=y.useState(null),[Rt,vn]=y.useState({title:"",description:"",trigger:"",triggerConditions:[],actionType:"popup",sort:0,enabled:!0}),[Ne,Me]=y.useState([]),[We,at]=y.useState(!1),[Lt,Ct]=y.useState(null),[$e,H]=y.useState(null),[Qe,vt]=y.useState({}),[Ft,yt]=y.useState(!1),[bt,It]=y.useState(null),[Qt,kn]=y.useState([]),[zs,mr]=y.useState(!1),[Qa,Yr]=y.useState(null),[Xr,ja]=y.useState(""),[Pr,Ir]=y.useState([]),[Zr,Ya]=y.useState(!1),[gr,Qs]=y.useState({}),[xr,Ys]=y.useState([]),[Fs,oe]=y.useState(0),[ve,Xe]=y.useState(1),[Nt]=y.useState(10),[Zt,Xs]=y.useState(!1),[Xo,ea]=y.useState(null),[Fi,Xa]=y.useState(""),bs=Ul(Fi,300),[Rr,nn]=y.useState(""),[Za,Bi]=y.useState(""),[ta,ka]=y.useState(""),[Zo,Vi]=y.useState(!1),[Zs,Bs]=y.useState({}),[el,Jn]=y.useState(null),[tl,na]=y.useState(null),[vs,yr]=y.useState([]),[Vs,sa]=y.useState(!1),Sa=y.useRef(null),[ac,ei]=y.useState(!1),[Hi,ti]=y.useState(!1),[Ui,ra]=y.useState("存客宝返回 data"),[Ca,nl]=y.useState(""),lt=y.useCallback(async(M,ee)=>{Xs(!0),ea(null);try{const be=new URLSearchParams({mode:"contact",page:String(ve),pageSize:String(Nt)}),Ae=M??bs;Ae&&be.set("search",Ae);const Ge=ee??Rr;Ge&&be.set("source",Ge),Za&&be.set("action",Za),ta&&be.set("pushStatus",ta);const Je=await Oe(`/api/db/ckb-leads?${be}`);if(Je!=null&&Je.success)Ys(Je.records||[]),oe(Je.total??0),Je.stats&&Bs(Je.stats);else{const Vt=(Je==null?void 0:Je.error)||"加载获客列表失败";ea(Vt),G.error(Vt),Ys([]),oe(0)}}catch(be){const Ae=be instanceof Error?be.message:"网络错误";ea(Ae),G.error("加载获客列表失败: "+Ae),Ys([]),oe(0)}finally{Xs(!1)}},[ve,Nt,bs,Rr,Za,ta]);y.useEffect(()=>{yr([])},[bs,Rr,Za,ta]),y.useEffect(()=>{a==="leads"&&Bi(i)},[a,i]);function Wi(M,ee){return{...M,...ee.pushStatus!==void 0?{pushStatus:ee.pushStatus}:{},...typeof ee.retryCount=="number"?{retryCount:ee.retryCount}:{},...typeof ee.ckbCode=="number"?{ckbCode:ee.ckbCode}:{},...ee.ckbMessage!==void 0?{ckbMessage:ee.ckbMessage}:{},...ee.ckbData!==void 0?{ckbData:ee.ckbData}:{},...ee.ckbError!==void 0?{ckbError:ee.ckbError}:{},...ee.lastPushAt!==void 0?{lastPushAt:ee.lastPushAt??void 0}:{},...ee.nextRetryAt!==void 0?{nextRetryAt:ee.nextRetryAt??void 0}:{}}}async function ni(M){if(M){Jn(M);try{const ee=await kt("/api/db/ckb-leads/retry",{id:M});ee!=null&&ee.success?(G.success(ee.pushed?"重推成功":"已发起重推,请刷新查看状态"),ee.record&&Ys(be=>be.map(Ae=>Ae.id===M?Wi(Ae,ee.record):Ae))):G.error((ee==null?void 0:ee.error)||"重推失败")}catch(ee){G.error(ee instanceof Error?ee.message:"重推请求失败")}finally{Jn(null)}}}async function si(M){if(M&&confirm("确定删除该条获客记录?删除后不可恢复。")){na(M);try{const ee=await kt("/api/db/ckb-leads/delete",{id:M});ee!=null&&ee.success?G.success("已删除"):G.error((ee==null?void 0:ee.error)||"删除失败")}catch(ee){G.error(ee instanceof Error?ee.message:"删除请求失败")}finally{na(null),lt()}}}async function sl(){const M=Ts.filter(Ae=>Ae.pushStatus==="failed");if(M.length===0){G.info("当前页无失败记录");return}ei(!0);let ee=0;for(const Ae of M)try{const Ge=await kt("/api/db/ckb-leads/retry",{id:Ae.id});if(Ge!=null&&Ge.success&&Ge.pushed&&ee++,Ge!=null&&Ge.success&&Ge.record){const Je=Ge.record;Ys(Vt=>Vt.map(Ve=>Ve.id===Ae.id?Wi(Ve,Je):Ve))}}catch{}ei(!1);const be=M.length;G.success(`批量重推完成:成功 ${ee} / ${be}`)}function ss(){const M=Ts.filter(Ve=>Ve.pushStatus==="failed");if(M.length===0){G.info("当前筛选下无失败记录可导出");return}const ee=Ve=>`"${String(Ve??"").replace(/"/g,'""')}"`,Ae=[["ID","昵称","手机号","微信号","对应@人","计划Key","来源","推送状态","重试次数","失败原因","下次重试时间","创建时间"].join(",")];for(const Ve of M)Ae.push([ee(Ve.id),ee(Ve.userNickname||Ve.name||""),ee(Ve.phone||""),ee(Ve.wechatId||""),ee(Ve.personName||""),ee(Ve.planApiKey||""),ee(Ve.source||""),ee(Ve.pushStatus||""),ee(typeof Ve.retryCount=="number"?Ve.retryCount:""),ee(Ve.ckbError||""),ee(Ve.nextRetryAt?new Date(Ve.nextRetryAt).toLocaleString():""),ee(Ve.createdAt?new Date(Ve.createdAt).toLocaleString():"")].join(","));const Ge=new Blob(["\uFEFF"+Ae.join(` -`)],{type:"text/csv;charset=utf-8;"}),Je=URL.createObjectURL(Ge),Vt=document.createElement("a");Vt.href=Je,Vt.download=`获客失败清单-${new Date().toISOString().slice(0,19).replace(/[:T]/g,"-")}.csv`,document.body.appendChild(Vt),Vt.click(),document.body.removeChild(Vt),URL.revokeObjectURL(Je),G.success(`已导出失败清单(${M.length} 条)`)}const rl=y.useCallback(async()=>{try{const M=await Oe("/api/admin/mbti-avatars"),ee=M!=null&&M.avatars&&typeof M.avatars=="object"?M.avatars:{};Qs(ee)}catch{Qs({})}},[]);y.useEffect(()=>{t.get("tab")==="leads"&<()},[t.get("tab"),ve,lt]),y.useEffect(()=>{if(a!=="leads")return;const M=window.setInterval(()=>{lt()},3e4);return()=>window.clearInterval(M)},[a,lt]),y.useEffect(()=>{rl()},[rl]);const br=y.useCallback((M,ee)=>{const be=(M||"").trim();if(be)return be;const Ae=(ee||"").trim().toUpperCase();return/^[EI][NS][FT][JP]$/.test(Ae)?(gr[Ae]||"").trim():""},[gr]),Ki=y.useCallback(M=>{const ee=!!M.hasFullBook,be=Number(M.purchasedSectionCount||0);return ee?{tone:"vip",main:"已购全书",sub:be>0?`另购单章 ${be} 章`:"购买项:VIP / 全书"}:be>0?{tone:"paid",main:`已购 ${be} 章`,sub:"购买项:章节"}:{tone:"free",main:"未购买",sub:""}},[]),[vr,er]=y.useState(null),Hs=y.useCallback(async()=>{try{const M=await Oe("/api/admin/users/online-stats");M!=null&&M.success&&typeof M.onlineCount=="number"?er(M.onlineCount):er(0)}catch{er(null)}},[]);y.useEffect(()=>{Hs();const M=setInterval(Hs,1e4);return()=>clearInterval(M)},[Hs]);async function tr(M=!1){var ee;O(!0),M&&I(!0),L(null);try{if(Q){const be=new URLSearchParams({search:v,limit:String(g*5)}),Ae=await Oe(`/api/db/users/rfm?${be}`);if(Ae!=null&&Ae.success){let Ge=Ae.users||[];le==="asc"&&(Ge=[...Ge].reverse());const Je=(f-1)*g;c(Ge.slice(Je,Je+g)),h(((ee=Ae.users)==null?void 0:ee.length)??0),Ge.length===0&&(se(!1),L("暂无订单数据,RFM 排序需要用户有购买记录后才能生效"))}else se(!1),L((Ae==null?void 0:Ae.error)||"RFM 加载失败,已切回普通模式")}else{const be=new URLSearchParams({page:String(f),pageSize:String(g),search:v,...T==="vip"&&{vip:"true"},...T==="complete"&&{pool:"complete"}}),Ae=await Oe(`/api/db/users?${be}`);Ae!=null&&Ae.success?(c(Ae.users||[]),h(Ae.total??0)):L((Ae==null?void 0:Ae.error)||"加载失败")}}catch(be){console.error("Load users error:",be),L("网络错误")}finally{O(!1),M&&I(!1)}}y.useEffect(()=>{m(1)},[v,T,Q]),y.useEffect(()=>{tr()},[f,g,v,T,Q,le]);const Ea=Math.ceil(u/g)||1,_n=()=>{Q?le==="desc"?me("asc"):(se(!1),me("desc")):(se(!0),me("desc"))},ic=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 Lr(M){var ee;if(!dN("用户")){G.info("已取消删除");return}try{const be=await Ei(`/api/db/users?id=${encodeURIComponent(M)}`);be!=null&&be.success?(G.success("已删除"),tr()):G.error("删除失败: "+((be==null?void 0:be.error)||"未知错误"))}catch(be){const Ae=be,Ge=((ee=Ae==null?void 0:Ae.data)==null?void 0:ee.error)||(Ae==null?void 0:Ae.message)||"网络错误";G.error("删除失败: "+Ge)}}const Ta=M=>{ge(M),Pt({phone:M.phone||"",nickname:M.nickname||"",password:"",isAdmin:!!(M.isAdmin??!1),hasFullBook:!!(M.hasFullBook??!1)}),Y(!0)},oc=()=>{ge(null),Pt({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),Y(!0)};async function Ma(){if(!pt.phone||!pt.nickname){G.error("请填写手机号和昵称");return}B(!0);try{if(F){const M=await Xt("/api/db/users",{id:F.id,phone:pt.phone||void 0,nickname:pt.nickname,isAdmin:pt.isAdmin,hasFullBook:pt.hasFullBook,...pt.password&&{password:pt.password}});if(!(M!=null&&M.success)){G.error("更新失败: "+((M==null?void 0:M.error)||""));return}}else{const M=await kt("/api/db/users",{phone:pt.phone,nickname:pt.nickname,password:pt.password,isAdmin:pt.isAdmin});if(!(M!=null&&M.success)){G.error("创建失败: "+((M==null?void 0:M.error)||""));return}}Y(!1),tr()}catch{G.error("保存失败")}finally{B(!1)}}async function Nr(M){Z(M),fe(!0),q(!0);try{const ee=await Oe(`/api/db/users/referrals?userId=${encodeURIComponent(M.id)}`);ee!=null&&ee.success?de({referrals:ee.referrals||[],stats:ee.stats||{}}):de({referrals:[],stats:{}})}catch{de({referrals:[],stats:{}})}finally{q(!1)}}const nr=y.useCallback(async()=>{Wt(!0);try{const M=await Oe("/api/db/user-rules");M!=null&&M.success&&Hn((M.rules||[]).map(ee=>p8(ee)))}catch{}finally{Wt(!1)}},[]);async function xd(){if(!Rt.title){G.error("请填写规则标题");return}B(!0);try{if(Un){const M=await Xt("/api/db/user-rules",{id:Un.id,...Rt});if(!(M!=null&&M.success)){G.error("更新失败: "+((M==null?void 0:M.error)||""));return}}else{const M=await kt("/api/db/user-rules",Rt);if(!(M!=null&&M.success)){G.error("创建失败: "+((M==null?void 0:M.error)||""));return}}Mn(!1),nr()}catch{G.error("保存失败")}finally{B(!1)}}async function wr(M){if(!dN("规则")){G.info("已取消删除");return}try{const ee=await Ei(`/api/db/user-rules?id=${M}`);ee!=null&&ee.success&&nr()}catch{}}async function sr(M){try{await Xt("/api/db/user-rules",{id:M.id,enabled:!M.enabled}),nr()}catch{}}const rs=y.useCallback(async()=>{at(!0);try{const M=await Oe("/api/db/vip-members?limit=500");if(M!=null&&M.success&&M.data){const ee=[...M.data].map((be,Ae)=>({...be,vipSort:typeof be.vipSort=="number"?be.vipSort:Ae+1}));ee.sort((be,Ae)=>(be.vipSort??999999)-(Ae.vipSort??999999)),Me(ee)}else M&&M.error&&G.error(M.error)}catch{G.error("加载超级个体列表失败")}finally{at(!1)}},[]),[rr,qi]=y.useState(!1),[Aa,Pa]=y.useState(null),[Or,Ia]=y.useState(""),[al,ar]=y.useState(!1),[ri,aa]=y.useState(!1),[Ra,La]=y.useState(null),[ai,il]=y.useState(""),[as,ia]=y.useState(!1),ol=["创业者","资源整合者","技术达人","投资人","产品经理","流量操盘手"],ii=M=>{Pa(M),Ia(M.vipRole||""),qi(!0)},yd=M=>{La(M),il((M.webhookUrl||"").trim()),aa(!0)},ll=async M=>{const ee=M.trim();if(Aa){if(!ee){G.error("请选择或输入标签");return}ar(!0);try{const be=await Xt("/api/db/users",{id:Aa.id,vipRole:ee});if(!(be!=null&&be.success)){G.error((be==null?void 0:be.error)||"更新超级个体标签失败");return}G.success("已更新超级个体标签"),qi(!1),Pa(null),await rs()}catch{G.error("更新超级个体标签失败")}finally{ar(!1)}}},cl=async()=>{if(!Ra)return;const M=ai.trim();if(M&&!/^https?:\/\//i.test(M)){G.error("Webhook 地址需以 http/https 开头");return}ia(!0);try{const ee=await Xt("/api/db/vip-members/webhook",{userId:Ra.id,webhookUrl:M});if(!(ee!=null&&ee.success)){G.error((ee==null?void 0:ee.error)||"保存飞书群 Webhook 失败");return}G.success(M?"已保存该超级个体的飞书群 Webhook":"已清空该超级个体的飞书群 Webhook"),aa(!1),La(null),await rs()}catch{G.error("保存飞书群 Webhook 失败")}finally{ia(!1)}},[oi,Dr]=y.useState(!1),[_r,Gi]=y.useState(null),[dl,ul]=y.useState(""),[li,E]=y.useState(!1),V=M=>{Gi(M),ul(M.vipSort!=null?String(M.vipSort):""),Dr(!0)},ue=async()=>{if(!_r)return;const M=Number(dl);if(!Number.isFinite(M)){G.error("请输入有效的数字序号");return}E(!0);try{const ee=await Xt("/api/db/users",{id:_r.id,vipSort:M});if(!(ee!=null&&ee.success)){G.error((ee==null?void 0:ee.error)||"更新排序序号失败");return}G.success("已更新排序序号"),Dr(!1),Gi(null),await rs()}catch{G.error("更新排序序号失败")}finally{E(!1)}},ke=(M,ee)=>{M.dataTransfer.effectAllowed="move",M.dataTransfer.setData("text/plain",ee),Ct(ee)},Ke=(M,ee)=>{M.preventDefault(),$e!==ee&&H(ee)},mt=()=>{Ct(null),H(null)},wt=async(M,ee)=>{M.preventDefault();const be=M.dataTransfer.getData("text/plain")||Lt;if(Ct(null),H(null),!be||be===ee)return;const Ae=Ne.find(Ve=>Ve.id===be),Ge=Ne.find(Ve=>Ve.id===ee);if(!Ae||!Ge)return;const Je=Ae.vipSort??Ne.findIndex(Ve=>Ve.id===be)+1,Vt=Ge.vipSort??Ne.findIndex(Ve=>Ve.id===ee)+1;Me(Ve=>{const Yt=[...Ve],Ms=Yt.findIndex(cc=>cc.id===be),$r=Yt.findIndex(cc=>cc.id===ee);if(Ms===-1||$r===-1)return Ve;const Qi=[...Yt],[Cd,Ed]=[Qi[Ms],Qi[$r]];return Qi[Ms]={...Ed,vipSort:Je},Qi[$r]={...Cd,vipSort:Vt},Qi});try{const[Ve,Yt]=await Promise.all([Xt("/api/db/users",{id:be,vipSort:Vt}),Xt("/api/db/users",{id:ee,vipSort:Je})]);if(!(Ve!=null&&Ve.success)||!(Yt!=null&&Yt.success)){G.error((Ve==null?void 0:Ve.error)||(Yt==null?void 0:Yt.error)||"更新排序失败"),await rs();return}G.success("已更新排序"),await rs()}catch{G.error("更新排序失败"),await rs()}},An=y.useCallback(async()=>{yt(!0);try{const M=await Oe("/api/db/users/journey-stats");M!=null&&M.success&&M.stats&&vt(M.stats)}catch{}finally{yt(!1)}},[]),is=y.useCallback(async M=>{It(M),mr(!0);try{const ee=await Oe(`/api/db/users/journey-users?stage=${M}&limit=50`);ee!=null&&ee.success&&ee.users&&kn(ee.users)}catch{}finally{mr(!1)}},[]),Sn=y.useCallback(async(M,ee)=>{Yr(M),ja(ee),Ya(!0);try{const be=await Oe(`/api/db/users/tracks?userId=${M}&limit=50`);be!=null&&be.success&&be.tracks&&Ir(be.tracks)}catch{}finally{Ya(!1)}},[]),[Ns,$n]=y.useState(!1),lc=async()=>{$n(!0);try{const M=await kt("/api/admin/shensheshou/batch-enrich",{limit:20});M!=null&&M.success?(G.success(`批量补全完成:${M.enriched} 人已补全,${M.skipped} 人跳过`),tr()):G.error((M==null?void 0:M.error)||"批量补全失败")}catch{G.error("批量补全请求失败")}finally{$n(!1)}},lm=M=>{const ee=[M.phone,M.nickname,M.avatar,M.wechatId,M.mbti,M.industry,M.region,M.position],be=ee.filter(Ae=>Ae!=null&&Ae!=="").length;return Math.round(be/ee.length*100)},{leadsRows:Ts,leadsRawCount:cm,leadsDeduped:qu}=y.useMemo(()=>{const M=Ve=>(Ve||"").replace(/\D/g,"")||"",ee=Ve=>{const Yt=M(Ve.phone);if(Yt)return`phone:${Yt}`;const Ms=(Ve.userId||"").trim();if(Ms)return`user:${Ms}`;const $r=(Ve.wechatId||"").trim();return $r?`wechat:${$r}`:`row:${Ve.id}`},be=bs.trim().toLowerCase();let Ae=xr;be&&(Ae=xr.filter(Ve=>[Ve.userNickname,Ve.name,Ve.phone,Ve.wechatId,Ve.personName,Ve.source,Ve.planApiKey].filter(Boolean).join(" ").toLowerCase().includes(be)));const Ge=[...Ae].sort((Ve,Yt)=>{const Ms=Ve.createdAt?new Date(Ve.createdAt).getTime():0;return(Yt.createdAt?new Date(Yt.createdAt).getTime():0)-Ms});if(!Zo)return{leadsRows:Ge,leadsRawCount:Ae.length,leadsDeduped:0};const Je=new Set,Vt=[];for(const Ve of Ge){const Yt=ee(Ve);Je.has(Yt)||(Je.add(Yt),Vt.push(Ve))}return{leadsRows:Vt,leadsRawCount:Ae.length,leadsDeduped:Ae.length-Vt.length}},[xr,bs,Zo]);y.useEffect(()=>{const M=Ts.map(Ae=>Ae.id),ee=M.filter(Ae=>vs.includes(Ae)).length,be=Sa.current;be&&(be.indeterminate=ee>0&&eebe.id),ee=M.length>0&&M.every(be=>vs.includes(be));yr(ee?be=>be.filter(Ae=>!M.includes(Ae)):be=>[...new Set([...be,...M])])}function um(M){yr(ee=>ee.includes(M)?ee.filter(be=>be!==M):[...ee,M])}async function hm(){if(vs.length===0){G.info("请先勾选要删除的记录");return}const M=vs.length;if(!confirm(`确定批量删除选中的 ${M} 条获客记录?删除后不可恢复。`))return;const ee=500;sa(!0);try{let be=0;for(let Ae=0;Ae{const ee=M||"";return ee==="success"?s.jsx(Be,{className:"bg-emerald-500/20 text-emerald-300 border-0 text-xs",children:"已推送(存客宝已接收)"}):ee==="pending_verify"?s.jsx(Be,{className:"bg-sky-500/20 text-sky-300 border-0 text-xs",children:"待通过 / 处理中"}):ee==="expired"?s.jsx(Be,{className:"bg-gray-500/20 text-gray-300 border-0 text-xs",children:"已过期"}):ee==="failed"?s.jsx(Be,{className:"bg-red-500/20 text-red-300 border-0 text-xs",children:"失败"}):ee==="pending"?s.jsx(Be,{className:"bg-amber-500/20 text-amber-300 border-0 text-xs",children:"待推送"}):ee?s.jsx(Be,{className:"bg-violet-500/20 text-violet-300 border-0 text-xs",title:ee,children:ee}):s.jsx(Be,{className:"bg-amber-500/20 text-amber-300 border-0 text-xs",children:"待推送"})},bd=y.useMemo(()=>{const M=new Map;for(const ee of Ts){if(ee.pushStatus!=="failed")continue;const be=(ee.ckbError||"未知错误").trim()||"未知错误";M.set(be,(M.get(be)||0)+1)}return Array.from(M.entries()).map(([ee,be])=>({reason:ee,count:be})).sort((ee,be)=>be.count-ee.count)},[Ts]);async function vd(){const M=Ts.filter(Je=>Je.pushStatus==="failed");if(M.length===0){G.info("当前页无失败记录");return}const ee=bd.slice(0,8).map(Je=>`- ${Je.reason}:${Je.count} 条`).join(` -`),be=M.slice(0,30).map(Je=>Je.id).join(", "),Ae=M.slice(0,20).map(Je=>`#${Je.id} | ${Je.userNickname||Je.name||"-"} | 手机:${Je.phone||"-"} | 来源:${Je.source||"-"} | 重试:${Je.retryCount??0} | 错误:${Je.ckbError||"-"}`).join(` -`),Ge=["【获客失败排障信息】",`时间:${new Date().toLocaleString()}`,`当前页失败总数:${M.length}`,"主要失败原因:",ee||"- 无",`最近失败记录ID(最多30条):${be||"无"}`,"","失败记录明细(最多20条):",Ae||"无"].join(` -`);try{await navigator.clipboard.writeText(Ge),G.success("已复制排障信息")}catch{G.error("复制失败,请检查浏览器剪贴板权限")}}return s.jsxs("div",{className:"p-8 w-full",children:[z&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[s.jsx("span",{children:z}),s.jsx("button",{type:"button",onClick:()=>L(null),children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-start gap-6 mb-6 flex-wrap",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"用户管理"}),s.jsxs("p",{className:"text-gray-400 mt-1 text-sm",children:["共 ",u," 位注册用户",vr!==null&&s.jsxs("span",{className:"text-[#38bdac] ml-1",children:["· 在线 ",vr," 人"]}),Q&&" · RFM 排序中"]})]}),s.jsx(De,{className:"shrink-0 w-full max-w-md border-[#38bdac]/35 bg-[#0f2137]/90",children:s.jsxs(_e,{className:"p-3 sm:p-4 space-y-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsxs("button",{type:"button",onClick:()=>ie(M=>!M),className:"flex items-center gap-2 min-w-0 flex-1 text-left rounded-lg px-1 py-0.5 hover:bg-white/5 transition-colors","aria-expanded":$,children:[s.jsx(Mf,{className:"w-5 h-5 text-[#38bdac] shrink-0"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-semibold text-white",children:"算法配置"}),s.jsx("div",{className:"text-xs text-gray-500 truncate",children:$?"RFM · Are you good(用户价值分层)":"RFM · 点击展开说明"})]}),$?s.jsx(zx,{className:"w-4 h-4 text-gray-400 shrink-0"}):s.jsx($l,{className:"w-4 h-4 text-gray-400 shrink-0"})]}),s.jsx(J,{type:"button",variant:"outline",size:"sm",onClick:_n,className:"border-[#38bdac]/50 text-[#38bdac] hover:bg-[#38bdac]/10 bg-transparent shrink-0",children:Q?le==="desc"?"RFM 降序":"RFM 升序":"按 RFM 排序"})]}),$&&s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-xs text-gray-400 leading-relaxed",children:["综合分 0–100(六维度):最近消费 R(25%)+ 订单频次 F(20%)+ 累计金额 M(20%)+ 推荐人数(15%)+ 行为轨迹(10%)+ 资料完善(10%)。各维度在全量用户中归一化,与后端"," ",s.jsx("code",{className:"text-gray-500",children:"/api/db/users/rfm"})," 一致。"]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:m8.map(({level:M,range:ee,label:be})=>s.jsxs(Be,{variant:"outline",className:`text-[10px] border-0 ${ic(M)}`,children:[M," ",ee," · ",be]},M))})]})]})})]}),s.jsxs(Xc,{value:a,onValueChange:M=>{const ee=new URLSearchParams(t);M==="users"?ee.delete("tab"):ee.set("tab",M),e(ee)},className:"w-full",children:[s.jsxs(Hl,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-6 flex-wrap h-auto gap-1",children:[s.jsxs(en,{value:"users",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",children:[s.jsx(Kn,{className:"w-4 h-4"})," 用户列表"]}),s.jsxs(en,{value:"leads",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:()=>lt(),children:[s.jsx(Hc,{className:"w-4 h-4"})," 获客列表"]}),s.jsxs(en,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:An,children:[s.jsx(pa,{className:"w-4 h-4"})," 用户旅程总览"]}),s.jsxs(en,{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(en,{value:"vip-roles",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:rs,children:[s.jsx(Wc,{className:"w-4 h-4"})," 超级个体列表"]})]}),s.jsxs(tn,{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:lc,disabled:Ns,className:"border-purple-500/50 text-purple-400 hover:bg-purple-500/10 bg-transparent",title:"批量调用神射手补全有手机号用户的资料",children:[Ns?s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx($o,{className:"w-4 h-4 mr-2"}),"批量补全"]}),s.jsxs(J,{variant:"outline",onClick:()=>tr(!0),disabled:U,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${U?"animate-spin":""}`})," 刷新"]}),s.jsxs("select",{value:T,onChange:M=>{const ee=M.target.value;C(ee),m(1),n&&(t.delete("pool"),e(t))},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",disabled:Q,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(xa,{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:N,onChange:M=>j(M.target.value)})]}),s.jsxs(J,{onClick:oc,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Hc,{className:"w-4 h-4 mr-2"})," 添加用户"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:R?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(ps,{children:[s.jsx(ms,{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:_n,children:[s.jsxs("div",{className:"flex items-center gap-1 group",children:[s.jsx(Mf,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"RFM分值"}),Q?le==="desc"?s.jsx($l,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(zx,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(_g,{className:"w-3.5 h-3.5 text-gray-600 group-hover:text-gray-400"})]}),Q&&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(gs,{children:[o.map(M=>{var ee,be,Ae;return s.jsxs(xt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(je,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[(()=>{var Vt;const Ge=br(M.avatar,M.mbti),Je=((Vt=M.nickname)==null?void 0:Vt.charAt(0))||"?";return s.jsx("button",{type:"button",title:"点击管理 MBTI 默认头像库",onClick:()=>jn(!0),className:"w-10 h-10 shrink-0 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] overflow-hidden ring-1 ring-transparent hover:ring-[#38bdac]/60 transition",children:Ge?s.jsx("img",{src:Ge,className:"w-full h-full rounded-full object-cover",alt:"",onError:Ve=>{var $r;const Yt=Ve.target;if(Yt.style.display="none",Yt.nextElementSibling)return;const Ms=document.createElement("span");Ms.textContent=Je,($r=Yt.parentElement)==null||$r.appendChild(Ms)}}):Je})})(),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("button",{type:"button",onClick:()=>{Ue(M.id),we(!0)},className:"font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left truncate max-w-[120px]",children:M.nickname}),M.isAdmin&&s.jsx(Be,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),M.openId&&!((ee=M.id)!=null&&ee.startsWith("user_"))&&s.jsx(Be,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0 text-xs",children:"微信"})]}),s.jsxs("p",{className:"text-xs text-gray-500 font-mono truncate max-w-[140px]",title:M.id,children:[(be=M.id)==null?void 0:be.slice(0,16),(((Ae=M.id)==null?void 0:Ae.length)??0)>16?"…":""]})]})]})}),s.jsx(je,{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(je,{children:(()=>{const Ge=Ki(M);return Ge.tone==="vip"?s.jsxs("div",{className:"space-y-1",children:[s.jsx(Be,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:Ge.main}),Ge.sub&&s.jsx("p",{className:"text-[11px] text-amber-300/80",children:Ge.sub})]}):Ge.tone==="paid"?s.jsxs("div",{className:"space-y-1",children:[s.jsx(Be,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:Ge.main}),Ge.sub&&s.jsx("p",{className:"text-[11px] text-blue-300/80",children:Ge.sub})]}):s.jsx(Be,{variant:"outline",className:"text-gray-500 border-gray-600",children:Ge.main})})()}),s.jsx(je,{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:()=>Nr(M),role:"button",tabIndex:0,onKeyDown:Ge=>Ge.key==="Enter"&&Nr(M),children:[s.jsx(Kn,{className:"w-3 h-3"})," 绑定",M.referralCount||0,"人"]})]})}),s.jsx(je,{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 ${ic(M.rfmLevel)}`,children:M.rfmLevel})]}):s.jsx("span",{className:"text-gray-600 text-xs",children:"无订单"})}),s.jsx(je,{children:(()=>{const Ge=lm(M),Je=Ge>=75?"text-green-400":Ge>=50?"text-yellow-400":"text-gray-500";return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-12 h-1.5 bg-gray-700 rounded-full overflow-hidden",children:s.jsx("div",{className:`h-full rounded-full ${Ge>=75?"bg-green-500":Ge>=50?"bg-yellow-500":"bg-gray-500"}`,style:{width:`${Ge}%`}})}),s.jsxs("span",{className:`text-xs ${Je}`,children:[Ge,"%"]})]})})()}),s.jsx(je,{className:"text-gray-400",children:M.createdAt?new Date(M.createdAt).toLocaleDateString():"-"}),s.jsx(je,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>{Ue(M.id),we(!0)},className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"用户详情",children:s.jsx(Tf,{className:"w-4 h-4"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>Ta(M),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑用户",children:s.jsx(sn,{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:()=>Lr(M.id),title:"删除",children:s.jsx(Zn,{className:"w-4 h-4"})})]})})]},M.id)}),o.length===0&&s.jsx(xt,{children:s.jsx(je,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),s.jsx(qs,{page:f,totalPages:Ea,total:u,pageSize:g,onPageChange:m,onPageSizeChange:M=>{b(M),m(1)}})]})})})]}),s.jsxs(tn,{value:"leads",children:[Xo&&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:Xo}),s.jsx("button",{type:"button",className:"shrink-0 ml-2",onClick:()=>ea(null),"aria-label":"关闭",children:"×"})]}),!Zt&&s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-4",children:[s.jsxs("div",{className:"p-3 bg-[#0f2137] border border-gray-700/50 rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs",children:"线索总条数(含留资/加入/匹配)"}),s.jsx("p",{className:"text-xl font-bold text-white",children:Fs})]}),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:Zs.uniqueUsers??0})]}),(Zs.sourceStats&&Zs.sourceStats.length>0?Zs.sourceStats.slice(0,2):[]).map(M=>s.jsxs("div",{className:"p-3 bg-[#0f2137] border border-gray-700/50 rounded-lg",children:[s.jsxs("p",{className:"text-gray-500 text-xs",children:["来源:",M.source]}),s.jsx("p",{className:"text-xl font-bold text-purple-400",children:M.cnt})]},M.source))]}),!Zt&&bd.length>0&&s.jsx(De,{className:"bg-[#3a1010]/35 border-red-900/60 shadow-lg mb-4",children:s.jsxs(_e,{className:"p-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 mb-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-red-200 font-medium",children:"失败原因聚合"}),s.jsx("p",{className:"text-red-300/70 text-xs",children:"基于当前页筛选结果,按失败原因聚合统计"})]}),s.jsx(J,{type:"button",variant:"outline",onClick:vd,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:bd.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(xa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(ce,{placeholder:"搜索昵称/手机/微信/@人/来源/类型…",value:Fi,onChange:M=>Xa(M.target.value),className:"pl-9 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"})]}),Zs.sourceStats&&Zs.sourceStats.length>0&&s.jsxs("select",{value:Rr,onChange:M=>{nn(M.target.value),Xe(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部来源"}),Zs.sourceStats.map(M=>s.jsxs("option",{value:M.source,children:[M.source,"(",M.cnt,")"]},M.source))]}),s.jsxs("select",{value:Za,onChange:M=>{const ee=M.target.value;Bi(ee),Xe(1),e(be=>{const Ae=new URLSearchParams(be);return Ae.set("tab","leads"),ee?Ae.set("leadAction",ee):Ae.delete("leadAction"),Ae})},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",title:"按业务类型筛选",children:[s.jsx("option",{value:"",children:"全部类型"}),s.jsx("option",{value:"lead",children:"留资线索(文章@ / 首页链接)"}),s.jsx("option",{value:"join",children:"加入报名(导师 / 资源对接 / 团队)"}),s.jsx("option",{value:"match",children:"匹配上报(找伙伴匹配)"})]}),s.jsxs("label",{className:"flex items-center gap-2 text-xs text-gray-400 select-none bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2",children:[s.jsx("input",{type:"checkbox",checked:Zo,onChange:M=>Vi(M.target.checked),className:"w-4 h-4 rounded border-gray-600 bg-[#0f2137] accent-[#38bdac] cursor-pointer"}),"去重展示"]}),s.jsxs("select",{value:ta,onChange:M=>{ka(M.target.value),Xe(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部状态"}),s.jsx("option",{value:"pending",children:"待推送"}),s.jsx("option",{value:"success",children:"已推送(存客宝已接收)"}),s.jsx("option",{value:"pending_verify",children:"待通过 / 处理中"}),s.jsx("option",{value:"expired",children:"已过期"}),s.jsx("option",{value:"failed",children:"推送失败"})]}),s.jsx(J,{type:"button",variant:"outline",onClick:()=>{ka("failed"),Xe(1)},className:"border-red-600/60 text-red-300 hover:bg-red-500/10 bg-transparent text-xs h-9",children:"只看失败"}),s.jsxs("span",{className:"text-xs text-gray-500 whitespace-nowrap max-w-[min(100%,20rem)]",title:"同一页内:相同手机号或相同用户 ID(含微信侧标识)只保留最近一条",children:["本页 ",cm," 条",qu>0?` · 已合并 ${qu} 条重复`:""]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx(J,{variant:"outline",onClick:ss,disabled:Zt,className:"border-cyan-600/60 text-cyan-300 hover:bg-cyan-500/10 bg-transparent",children:"导出失败清单"}),s.jsxs(J,{variant:"outline",onClick:sl,disabled:ac||Vs||Zt,className:"border-amber-600/60 text-amber-300 hover:bg-amber-500/10 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${ac?"animate-spin":""}`}),"重推本页失败项"]}),s.jsxs(J,{variant:"outline",onClick:()=>void hm(),disabled:Vs||vs.length===0||Zt,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[s.jsx(Zn,{className:`w-4 h-4 mr-2 ${Vs?"animate-pulse":""}`}),Vs?"删除中…":`批量删除(${vs.length})`]}),s.jsxs(J,{variant:"outline",onClick:()=>lt(),disabled:Zt,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${Zt?"animate-spin":""}`})," 刷新"]})]})]}),!Zt&&Ts.length>0&&s.jsxs("p",{className:"text-xs text-gray-500 mb-2",children:["已选 ",s.jsx("span",{className:"text-[#38bdac]",children:vs.length})," 条 · 可翻页继续勾选 · 改搜索/筛选会清空选择",vs.length>0&&s.jsx("button",{type:"button",className:"ml-2 text-gray-400 hover:text-gray-200 underline",onClick:()=>yr([]),children:"清空"})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:Zt?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(ps,{children:[s.jsx(ms,{children:s.jsxs(xt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Se,{className:"text-gray-400 w-10 text-center",children:s.jsx("input",{ref:Sa,type:"checkbox",checked:Ts.length>0&&Ts.every(M=>vs.includes(M.id)),onChange:dm,className:"w-4 h-4 rounded border-gray-600 bg-[#0f2137] accent-[#38bdac] cursor-pointer",title:"全选本页(展示行)"})}),s.jsx(Se,{className:"text-gray-400",children:"昵称"}),s.jsx(Se,{className:"text-gray-400",children:"手机号"}),s.jsx(Se,{className:"text-gray-400",children:"微信号"}),s.jsx(Se,{className:"text-gray-400",children:"对应 @人"}),s.jsx(Se,{className:"text-gray-400",children:"获客计划(Key)"}),s.jsx(Se,{className:"text-gray-400",children:"推送状态"}),s.jsx(Se,{className:"text-gray-400",children:"时间"}),s.jsx(Se,{className:"text-gray-400",children:"重试"})]})}),s.jsxs(gs,{children:[Ts.map(M=>s.jsxs(xt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(je,{className:"text-center align-middle w-10",children:s.jsx("input",{type:"checkbox",checked:vs.includes(M.id),onChange:()=>um(M.id),disabled:Vs,className:"w-4 h-4 rounded border-gray-600 bg-[#0f2137] accent-[#38bdac] cursor-pointer"})}),s.jsx(je,{className:"text-gray-300 align-middle",children:s.jsx(g8,{userId:M.userId,userAvatar:M.userAvatar,nickname:M.userNickname,name:M.name,onOpenDetail:ee=>{Ue(ee),we(!0)}})}),s.jsx(je,{className:"text-gray-300",children:M.phone||"-"}),s.jsx(je,{className:"text-gray-300",children:M.wechatId||"-"}),s.jsx(je,{className:"text-[#38bdac]",children:M.personName||"-"}),s.jsx(je,{className:"text-gray-400 text-xs",children:(()=>{const ee=(M.planApiKey||"").trim();if(!ee)return"-";const be=ee.length<=10?ee:`${ee.slice(0,6)}…${ee.slice(-4)}`;return s.jsx("button",{type:"button",className:"font-mono text-gray-400 hover:text-gray-200 underline decoration-dotted",title:ee,onClick:async()=>{try{await navigator.clipboard.writeText(ee),G.success("已复制计划Key")}catch{G.error("复制失败,请手动复制")}},children:be})})()}),s.jsx(je,{children:s.jsxs("div",{className:"space-y-1",children:[fm(M.pushStatus),(typeof M.ckbCode=="number"||(M.ckbMessage||"").trim())&&s.jsx("p",{className:"text-[11px] text-gray-500 max-w-[260px] truncate",title:[typeof M.ckbCode=="number"?`code=${M.ckbCode}`:"",(M.ckbMessage||"").trim()?`message=${String(M.ckbMessage).trim()}`:"",(M.ckbData||"").trim()?`data=${String(M.ckbData).trim()}`:""].filter(Boolean).join(" | "),children:[typeof M.ckbCode=="number"?`code=${M.ckbCode}`:"",(M.ckbMessage||"").trim()?String(M.ckbMessage).trim():""].filter(Boolean).join(" · ")}),!!(M.ckbData||"").trim()&&s.jsx("button",{type:"button",className:"text-[11px] text-sky-300/90 hover:text-sky-200 underline decoration-dotted",onClick:()=>{const ee=String(M.ckbData||"").trim();ra(`存客宝返回 data(#${M.id})`),nl(x8(ee)),ti(!0)},children:"查看 data"}),!!M.ckbError&&s.jsx("p",{className:"text-[11px] text-red-300 max-w-[220px] truncate",title:M.ckbError,children:M.ckbError})]})}),s.jsx(je,{className:"text-gray-400 whitespace-nowrap",children:M.createdAt?new Date(M.createdAt).toLocaleString():"-"}),s.jsx(je,{className:"text-gray-400 text-xs align-top py-3 min-w-[148px]",children:s.jsxs("div",{className:"flex flex-col gap-3",children:[s.jsx("p",{className:"text-gray-400 leading-snug",children:typeof M.retryCount=="number"?`第 ${M.retryCount} 次`:"-"}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs(J,{size:"sm",variant:"outline",disabled:Vs||el===M.id||tl===M.id,onClick:()=>ni(M.id),className:"h-8 px-2.5 text-[11px] border-gray-600 text-gray-200 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(He,{className:`w-3 h-3 mr-1 ${el===M.id?"animate-spin":""}`}),"重推"]}),s.jsxs(J,{size:"sm",variant:"outline",disabled:Vs||tl===M.id||el===M.id,onClick:()=>si(M.id),className:"h-8 px-2.5 text-[11px] border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent shrink-0",children:[s.jsx(Zn,{className:`w-3 h-3 mr-1 ${tl===M.id?"animate-pulse":""}`}),"删除"]})]})]})})]},M.id)),Ts.length===0&&s.jsx(xt,{children:s.jsx(je,{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(Hc,{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:bs.trim()||Rr?"当前搜索或来源筛选下没有匹配记录,可清空条件后重试。":"存客宝场景产生的手机号 / 微信留资会出现在此列表。请确认获客计划已开启,并有用户完成留资。"}),s.jsxs(J,{type:"button",variant:"outline",onClick:()=>lt(),disabled:Zt,className:"border-[#38bdac]/40 text-[#38bdac] hover:bg-[#38bdac]/10 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${Zt?"animate-spin":""}`}),"重新加载"]})]})})})]})]}),s.jsx(qs,{page:ve,totalPages:Math.ceil(Fs/Nt)||1,total:Fs,pageSize:Nt,onPageChange:Xe,onPageSizeChange:()=>{}})]})})})]}),s.jsxs(tn,{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:An,disabled:Ft,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${Ft?"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:Rc.map((M,ee)=>s.jsxs("div",{className:"relative flex flex-col items-center",children:[s.jsxs("div",{className:`relative w-full p-3 rounded-xl border ${M.color} text-center cursor-pointer hover:opacity-80 transition-opacity ${bt===M.id?"ring-2 ring-[#38bdac]":""}`,onClick:()=>is(M.id),title:`点击查看「${M.label}」阶段的用户`,children:[s.jsx("div",{className:"text-2xl mb-1",children:M.icon}),s.jsx("div",{className:`text-xs font-medium ${M.color.split(" ").find(be=>be.startsWith("text-"))}`,children:M.label}),Qe[M.id]!==void 0&&s.jsxs("div",{className:"mt-1.5 text-xs text-gray-400",children:[s.jsx("span",{className:"font-bold text-white",children:Qe[M.id]})," 人"]}),s.jsx("div",{className:"absolute -top-2.5 -left-2.5 w-5 h-5 rounded-full bg-[#0a1628] border border-gray-700 flex items-center justify-center text-[10px] text-gray-500",children:ee+1})]}),ees.jsxs("div",{className:"flex items-start gap-3 p-2 bg-[#0a1628] rounded",children:[s.jsx("span",{className:"text-[#38bdac] font-mono text-xs shrink-0 mt-0.5",children:M.step}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-300",children:M.action}),s.jsxs("p",{className:"text-gray-600 text-xs",children:["→ ",M.next]})]})]},M.step))})]}),s.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/50 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(fr,{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:"实时更新"})]}),Ft?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(He,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Object.keys(Qe).length>0?s.jsx("div",{className:"space-y-2",children:(()=>{const M=Rc.reduce((ee,be)=>ee+(Qe[be.id]||0),0);return Rc.map(ee=>{const be=Qe[ee.id]||0,Ae=M>0?Math.round(be/M*100):0,Ge=be>0?Math.max(Ae,6):0;return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-gray-500 text-xs w-[5.5rem] shrink-0 leading-tight",children:[ee.icon," ",ee.label]}),s.jsx("div",{className:"flex-1 h-2.5 bg-[#0a1628] rounded-full overflow-hidden border border-gray-700/40",children:s.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-[#38bdac]/50 to-[#38bdac] transition-all",style:{width:`${Ge}%`}})}),s.jsx("span",{className:"text-gray-400 text-xs w-14 text-right tabular-nums",children:be}),s.jsx("span",{className:"text-gray-600 text-[10px] w-8 text-right tabular-nums",children:M>0?`${Ae}%`:"—"})]},ee.id)})})()}):s.jsx("div",{className:"text-center py-8",children:s.jsx("p",{className:"text-gray-500 text-sm",children:"点击「刷新数据」加载统计"})})]})]}),bt&&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(Kn,{className:"w-4 h-4 text-[#38bdac]"}),s.jsxs("span",{className:"text-white font-medium",children:[(Ji=Rc.find(M=>M.id===bt))==null?void 0:Ji.icon," ",(Gu=Rc.find(M=>M.id===bt))==null?void 0:Gu.label," 阶段用户"]}),s.jsxs(Be,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-xs",children:[Qt.length," 人"]})]}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>It(null),className:"text-gray-400 hover:text-white",children:s.jsx(es,{className:"w-4 h-4"})})]}),zs?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(He,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Qt.length===0?s.jsx("p",{className:"text-gray-500 text-center py-6",children:"该阶段暂无用户"}):s.jsxs(ps,{children:[s.jsx(ms,{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(gs,{children:Qt.map(M=>s.jsxs(xt,{className:"border-gray-700/50 hover:bg-[#0a1628]",children:[s.jsx(je,{className:"text-white",children:M.nickname||"微信用户"}),s.jsx(je,{className:"text-gray-300",children:M.phone||"-"}),s.jsx(je,{className:"text-gray-400 text-xs",children:M.createdAt?new Date(M.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx(je,{className:"text-right",children:s.jsxs(J,{variant:"ghost",size:"sm",className:"text-[#38bdac] hover:bg-[#38bdac]/10",onClick:()=>Sn(M.id,M.nickname||"微信用户"),children:[s.jsx(Tf,{className:"w-4 h-4 mr-1"})," 行为轨迹"]})})]},M.id))})]})]}),s.jsx(Dt,{open:!!Qa,onOpenChange:M=>{M||Yr(null)},children:s.jsxs(Ot,{className:"sm:max-w-[600px] bg-[#0f2137] border-gray-700 text-white max-h-[80vh] overflow-y-auto",children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(pa,{className:"w-5 h-5 text-[#38bdac]"}),Xr," 的行为轨迹"]})}),Zr?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):Pr.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"}),Pr.map((M,ee)=>s.jsxs("div",{className:"relative flex items-start gap-3 py-2",children:[s.jsx("div",{className:"absolute left-[-13px] top-3 w-2.5 h-2.5 rounded-full bg-[#38bdac] border-2 border-[#0f2137] z-10"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"text-white text-sm font-medium",children:M.actionLabel}),M.module&&s.jsx(Be,{className:"bg-purple-500/10 text-purple-400 border border-purple-500/30 text-[10px]",children:M.module})]}),(M.chapterTitle||M.target)&&s.jsx("p",{className:"text-gray-400 text-xs mt-0.5 truncate",children:M.chapterTitle||M.target}),s.jsxs("p",{className:"text-gray-600 text-[10px] mt-0.5",children:[M.timeAgo," · ",M.createdAt?new Date(M.createdAt).toLocaleString("zh-CN"):""]})]})]},M.id||ee))]})]})})]}),s.jsxs(tn,{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:nr,disabled:mn,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${mn?"animate-spin":""}`})," 刷新"]}),s.jsxs(J,{onClick:()=>{ns(null),vn({title:"",description:"",trigger:"",triggerConditions:[],actionType:"popup",sort:0,enabled:!0}),Mn(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Fn,{className:"w-4 h-4 mr-2"})," 添加规则"]})]})]}),mn?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):pn.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(fr,{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:nr,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(He,{className:"w-4 h-4 mr-2"})," 重新加载"]})]}):s.jsx("div",{className:"space-y-2",children:pn.map(M=>{var be;const ee=T2(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(sn,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0"}),s.jsx("span",{className:"text-white font-medium text-sm truncate",children:M.title}),M.trigger&&s.jsx(Be,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-[10px] shrink-0",children:M.trigger}),ee.length>0&&s.jsxs("div",{className:"flex flex-wrap gap-0.5 ml-1",children:[ee.slice(0,3).map(Ae=>{const Ge=lN.find(Je=>Je.value===Ae);return s.jsx(Be,{className:"bg-purple-500/10 text-purple-400 border border-purple-500/30 text-[9px]",children:(Ge==null?void 0:Ge.label)||Ae},Ae)}),ee.length>3&&s.jsxs("span",{className:"text-gray-500 text-[9px]",children:["+",ee.length-3]})]}),M.actionType&&M.actionType!=="popup"&&s.jsx(Be,{className:"bg-amber-500/10 text-amber-400 border border-amber-500/30 text-[9px] shrink-0",children:((be=cN.find(Ae=>Ae.value===M.actionType))==null?void 0:be.label)||M.actionType})]}),s.jsxs("div",{className:"flex items-center gap-1.5 ml-3 shrink-0",children:[s.jsx(Ut,{checked:M.enabled,onCheckedChange:()=>sr(M)}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>{ns(M),vn({title:M.title,description:M.description,trigger:M.trigger,triggerConditions:ee,actionType:M.actionType||"popup",sort:M.sort,enabled:M.enabled}),Mn(!0)},className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10 h-7 w-7 p-0",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>wr(M.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10 h-7 w-7 p-0",children:s.jsx(Zn,{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(tn,{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:rs,disabled:We,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${We?"animate-spin":""}`})," ","刷新"]})})]}),We?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):Ne.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(Wc,{className:"w-12 h-12 text-amber-400/30 mx-auto mb-4"}),s.jsx("p",{className:"text-gray-400 mb-4",children:"当前没有有效的超级个体用户。"})]}):s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:s.jsxs(ps,{children:[s.jsx(ms,{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(gs,{children:Ne.map((M,ee)=>{var Ge;const be=Lt===M.id,Ae=$e===M.id;return s.jsxs(xt,{draggable:!0,onDragStart:Je=>ke(Je,M.id),onDragOver:Je=>Ke(Je,M.id),onDrop:Je=>wt(Je,M.id),onDragEnd:mt,className:`border-gray-700/50 cursor-grab active:cursor-grabbing select-none ${be?"opacity-60":""} ${Ae?"bg-[#38bdac]/10":""}`,children:[s.jsx(je,{className:"text-gray-300",children:ee+1}),s.jsx(je,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[br(M.avatar,M.mbti)?s.jsx("img",{src:br(M.avatar,M.mbti),className:"w-8 h-8 rounded-full object-cover border border-amber-400/60",alt:"",onError:Je=>{var Ve,Yt;Je.target.style.display="none";const Vt=document.createElement("div");Vt.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",Vt.textContent=((Ve=M.name)==null?void 0:Ve[0])||"创",(Yt=Je.target.parentElement)==null||Yt.appendChild(Vt)}}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/20 border border-amber-400/60 flex items-center justify-center text-amber-300 text-sm",children:((Ge=M.name)==null?void 0:Ge[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:M.name})})]})}),s.jsx(je,{className:"text-gray-300 whitespace-nowrap",children:M.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置)"})}),s.jsx(je,{className:"text-center text-blue-400 text-xs font-mono",children:M.clickCount!=null?String(M.clickCount):"-"}),s.jsx(je,{className:"text-center text-green-400 text-xs font-mono",children:M.leadCount!=null?String(M.leadCount):"-"}),s.jsx(je,{className:"text-gray-300",children:M.vipSort??ee+1}),s.jsx(je,{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(je,{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:()=>ii(M),title:"设置超级个体标签",children:s.jsx(du,{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:()=>yd(M),title:"编辑飞书群Webhook",children:s.jsx(sn,{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:()=>V(M),title:"设置排序序号",children:s.jsx(_g,{className:"w-3.5 h-3.5"})})]})})]},M.id)})})]})})})]})]}),s.jsx(Dt,{open:jt,onOpenChange:jn,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-6xl",children:[s.jsx(_t,{children:s.jsx($t,{className:"text-white",children:"MBTI 默认头像库"})}),s.jsx(f8,{})]})}),s.jsx(Dt,{open:oi,onOpenChange:M=>{Dr(M),M||Gi(null)},children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(_g,{className:"w-5 h-5 text-[#38bdac]"}),"设置排序 — ",_r==null?void 0:_r.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(te,{className:"text-gray-300 text-sm",children:"排序序号(数字越小越靠前)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:1",value:dl,onChange:M=>ul(M.target.value)})]}),s.jsxs(rn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>Dr(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(es,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:ue,disabled:li,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),li?"保存中...":"保存"]})]})]})}),s.jsx(Dt,{open:rr,onOpenChange:M=>{qi(M),M||Pa(null)},children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(Wc,{className:"w-5 h-5 text-amber-400"}),"设置超级个体标签 — ",Aa==null?void 0:Aa.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(te,{className:"text-gray-300 text-sm",children:"选择或输入标签"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:ol.map(M=>s.jsx(J,{variant:Or===M?"default":"outline",size:"sm",className:Or===M?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50",onClick:()=>Ia(M),children:M},M))}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"或手动输入"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创业者、资源整合者等",value:Or,onChange:M=>Ia(M.target.value)})]})]}),s.jsxs(rn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>qi(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(es,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:()=>ll(Or),disabled:al,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),al?"保存中...":"保存"]})]})]})}),s.jsx(Dt,{open:ri,onOpenChange:M=>{aa(M),M||La(null)},children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-xl",children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(sn,{className:"w-5 h-5 text-[#38bdac]"}),"设置飞书群 Webhook — ",Ra==null?void 0:Ra.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(te,{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:ai,onChange:M=>il(M.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"当用户点击该超级个体头像并提交链接时,线索将优先推送到这里配置的飞书群。"})]}),s.jsxs(rn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>aa(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(es,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:cl,disabled:as,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),as?"保存中...":"保存"]})]})]})}),s.jsx(Dt,{open:P,onOpenChange:Y,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[F?s.jsx(sn,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(Hc,{className:"w-5 h-5 text-[#38bdac]"}),F?"编辑用户":"添加用户"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"手机号"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:pt.phone,onChange:M=>Pt({...pt,phone:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"昵称"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:pt.nickname,onChange:M=>Pt({...pt,nickname:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:F?"新密码 (留空则不修改)":"密码"}),s.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:F?"留空则不修改":"请输入密码",value:pt.password,onChange:M=>Pt({...pt,password:M.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(te,{className:"text-gray-300",children:"管理员权限"}),s.jsx(Ut,{checked:pt.isAdmin,onCheckedChange:M=>Pt({...pt,isAdmin:M})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(te,{className:"text-gray-300",children:"已购全书"}),s.jsx(Ut,{checked:pt.hasFullBook,onCheckedChange:M=>Pt({...pt,hasFullBook:M})})]})]}),s.jsxs(rn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>Y(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(es,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:Ma,disabled:X,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),X?"保存中...":"保存"]})]})]})}),s.jsx(Dt,{open:bn,onOpenChange:Mn,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[90vh] overflow-y-auto",children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(sn,{className:"w-5 h-5 text-[#38bdac]"}),Un?"编辑规则":"添加规则"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"规则标题 *"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:匹配后填写头像、付款1980需填写信息",value:Rt.title,onChange:M=>vn({...Rt,title:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"规则描述"}),s.jsx(tc,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[60px] resize-none",placeholder:"弹窗内容/推送文案...",value:Rt.description,onChange:M=>vn({...Rt,description:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"触发条件(可多选)"}),s.jsx("div",{className:"space-y-2",children:["用户状态","阅读行为","付费行为","社交行为","分销行为"].map(M=>{const ee=lN.filter(be=>be.group===M);return ee.length===0?null:s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] text-gray-500 mb-1",children:M}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:ee.map(be=>{const Ae=(Rt.triggerConditions||[]).includes(be.value);return s.jsx("button",{type:"button",className:`px-2.5 py-1 rounded-md text-xs border transition-colors ${Ae?"bg-[#38bdac]/20 border-[#38bdac]/50 text-[#38bdac]":"bg-[#0a1628] border-gray-700 text-gray-400 hover:border-gray-500"}`,onClick:()=>{const Ge=Rt.triggerConditions||[],Je=Ae?Ge.filter(Vt=>Vt!==be.value):[...Ge,be.value];vn({...Rt,triggerConditions:Je})},children:be.label},be.value)})})]},M)})}),(Rt.triggerConditions||[]).length>0&&s.jsxs("p",{className:"text-[10px] text-[#38bdac]",children:["已选 ",(Rt.triggerConditions||[]).length," 个触发条件(满足任一即触发)"]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{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:Rt.trigger,onChange:M=>vn({...Rt,trigger:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"推送动作"}),s.jsx("div",{className:"grid grid-cols-2 gap-2",children:cN.map(M=>s.jsxs("button",{type:"button",className:`p-2 rounded-lg border text-left transition-colors ${Rt.actionType===M.value?"bg-[#38bdac]/15 border-[#38bdac]/50":"bg-[#0a1628] border-gray-700 hover:border-gray-500"}`,onClick:()=>vn({...Rt,actionType:M.value}),children:[s.jsx("span",{className:`text-xs font-medium ${Rt.actionType===M.value?"text-[#38bdac]":"text-gray-300"}`,children:M.label}),s.jsx("p",{className:"text-[10px] text-gray-500 mt-0.5",children:M.desc})]},M.value))})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{children:s.jsx(te,{className:"text-gray-300",children:"启用状态"})}),s.jsx(Ut,{checked:Rt.enabled,onCheckedChange:M=>vn({...Rt,enabled:M})})]})]}),s.jsxs(rn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>Mn(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(es,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:xd,disabled:X,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),X?"保存中...":"保存"]})]})]})}),s.jsx(Dt,{open:W,onOpenChange:fe,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(Kn,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系 - ",_==null?void 0:_.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:((Nd=he.stats)==null?void 0:Nd.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:((wd=he.stats)==null?void 0:wd.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:["¥",(((jd=he.stats)==null?void 0:jd.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:["¥",(((kd=he.stats)==null?void 0:kd.pendingEarnings)||0).toFixed(2)]}),s.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),D?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(He,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((Sd=he.referrals)==null?void 0:Sd.length)??0)>0?s.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(he.referrals??[]).map((M,ee)=>{var Ae;const be=M;return s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg p-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:((Ae=be.nickname)==null?void 0:Ae.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white text-sm",children:be.nickname}),s.jsx("div",{className:"text-xs text-gray-500",children:be.phone||(be.hasOpenId?"微信用户":"未绑定")})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[be.status==="vip"&&s.jsx(Be,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),be.status==="paid"&&s.jsxs(Be,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",be.purchasedSections,"章"]}),be.status==="free"&&s.jsx(Be,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),s.jsx("span",{className:"text-xs text-gray-500",children:be.createdAt?new Date(be.createdAt).toLocaleDateString():""})]})]},be.id||ee)})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),s.jsx(rn,{children:s.jsx(J,{variant:"outline",onClick:()=>fe(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),s.jsx(fy,{open:re,onClose:()=>we(!1),userId:Fe,onUserUpdated:tr}),s.jsx(Dt,{open:Hi,onOpenChange:ti,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700/60 text-white max-w-2xl",children:[s.jsx(_t,{children:s.jsx($t,{className:"text-white",children:Ui})}),s.jsx("div",{className:"mt-2",children:s.jsx("pre",{className:"text-xs text-gray-200 bg-[#0a1628] border border-gray-700/60 rounded-lg p-3 max-h-[520px] overflow-auto whitespace-pre-wrap break-words",children:Ca||"—"})}),s.jsxs(rn,{children:[s.jsx(J,{type:"button",variant:"outline",className:"border-gray-600 text-gray-200 hover:bg-gray-700/50 bg-transparent",onClick:async()=>{try{await navigator.clipboard.writeText(Ca||""),G.success("已复制 data")}catch{G.error("复制失败,请手动复制")}},disabled:!Ca,children:"复制 data"}),s.jsx(J,{type:"button",className:"bg-[#38bdac] hover:bg-[#2aa896] text-white",onClick:()=>ti(!1),children:"关闭"})]})]})})]})}function Lf(t,[e,n]){return Math.min(n,Math.max(e,t))}var M2=["PageUp","PageDown"],A2=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],P2={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},hd="Slider",[Yx,b8,v8]=cy(hd),[I2]=Ko(hd,[v8]),[N8,$p]=I2(hd),R2=y.forwardRef((t,e)=>{const{name:n,min:r=0,max:a=100,step:i=1,orientation:o="horizontal",disabled:c=!1,minStepsBetweenThumbs:u=0,defaultValue:h=[r],value:f,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:b=!1,form:N,...j}=t,v=y.useRef(new Set),k=y.useRef(0),C=o==="horizontal"?w8:j8,[R=[],O]=Bl({prop:f,defaultProp:h,onChange:se=>{var ie;(ie=[...v.current][k.current])==null||ie.focus(),m(se)}}),U=y.useRef(R);function I(se){const $=T8(R,se);Q(se,$)}function z(se){Q(se,k.current)}function L(){const se=U.current[k.current];R[k.current]!==se&&g(R)}function Q(se,$,{commit:ie}={commit:!1}){const le=I8(i),me=R8(Math.round((se-r)/i)*i+r,le),P=Lf(me,[r,a]);O((Y=[])=>{const F=C8(Y,P,$);if(P8(F,u*i)){k.current=F.indexOf(P);const ge=String(F)!==String(Y);return ge&&ie&&g(F),ge?F:Y}else return Y})}return s.jsx(N8,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:a,valueIndexToChangeRef:k,thumbs:v.current,values:R,orientation:o,form:N,children:s.jsx(Yx.Provider,{scope:t.__scopeSlider,children:s.jsx(Yx.Slot,{scope:t.__scopeSlider,children:s.jsx(C,{"aria-disabled":c,"data-disabled":c?"":void 0,...j,ref:e,onPointerDown:St(j.onPointerDown,()=>{c||(U.current=R)}),min:r,max:a,inverted:b,onSlideStart:c?void 0:I,onSlideMove:c?void 0:z,onSlideEnd:c?void 0:L,onHomeKeyDown:()=>!c&&Q(r,0,{commit:!0}),onEndKeyDown:()=>!c&&Q(a,R.length-1,{commit:!0}),onStepKeyDown:({event:se,direction:$})=>{if(!c){const me=M2.includes(se.key)||se.shiftKey&&A2.includes(se.key)?10:1,P=k.current,Y=R[P],F=i*me*$;Q(Y+F,P,{commit:!0})}}})})})})});R2.displayName=hd;var[L2,O2]=I2(hd,{startEdge:"left",endEdge:"right",size:"width",direction:1}),w8=y.forwardRef((t,e)=>{const{min:n,max:r,dir:a,inverted:i,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onStepKeyDown:h,...f}=t,[m,g]=y.useState(null),b=Jt(e,C=>g(C)),N=y.useRef(void 0),j=Op(a),v=j==="ltr",k=v&&!i||!v&&i;function T(C){const R=N.current||m.getBoundingClientRect(),O=[0,R.width],I=py(O,k?[n,r]:[r,n]);return N.current=R,I(C-R.left)}return s.jsx(L2,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:s.jsx(D2,{dir:j,"data-orientation":"horizontal",...f,ref:b,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:C=>{const R=T(C.clientX);o==null||o(R)},onSlideMove:C=>{const R=T(C.clientX);c==null||c(R)},onSlideEnd:()=>{N.current=void 0,u==null||u()},onStepKeyDown:C=>{const O=P2[k?"from-left":"from-right"].includes(C.key);h==null||h({event:C,direction:O?-1:1})}})})}),j8=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=Jt(e,f),g=y.useRef(void 0),b=!a;function N(j){const v=g.current||f.current.getBoundingClientRect(),k=[0,v.height],C=py(k,b?[r,n]:[n,r]);return g.current=v,C(j-v.top)}return s.jsx(L2,{scope:t.__scopeSlider,startEdge:b?"bottom":"top",endEdge:b?"top":"bottom",size:"height",direction:b?1:-1,children:s.jsx(D2,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:j=>{const v=N(j.clientY);i==null||i(v)},onSlideMove:j=>{const v=N(j.clientY);o==null||o(v)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:j=>{const k=P2[b?"from-bottom":"from-top"].includes(j.key);u==null||u({event:j,direction:k?-1:1})}})})}),D2=y.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:a,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:c,onStepKeyDown:u,...h}=t,f=$p(hd,n);return s.jsx(Mt.span,{...h,ref:e,onKeyDown:St(t.onKeyDown,m=>{m.key==="Home"?(o(m),m.preventDefault()):m.key==="End"?(c(m),m.preventDefault()):M2.concat(A2).includes(m.key)&&(u(m),m.preventDefault())}),onPointerDown:St(t.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(g)?g.focus():r(m)}),onPointerMove:St(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&a(m)}),onPointerUp:St(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),i(m))})})}),_2="SliderTrack",$2=y.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=$p(_2,n);return s.jsx(Mt.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...r,ref:e})});$2.displayName=_2;var Xx="SliderRange",z2=y.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=$p(Xx,n),i=O2(Xx,n),o=y.useRef(null),c=Jt(e,o),u=a.values.length,h=a.values.map(g=>V2(g,a.min,a.max)),f=u>1?Math.min(...h):0,m=100-Math.max(...h);return s.jsx(Mt.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...r,ref:c,style:{...t.style,[i.startEdge]:f+"%",[i.endEdge]:m+"%"}})});z2.displayName=Xx;var Zx="SliderThumb",F2=y.forwardRef((t,e)=>{const n=b8(t.__scopeSlider),[r,a]=y.useState(null),i=Jt(e,c=>a(c)),o=y.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return s.jsx(k8,{...t,ref:i,index:o})}),k8=y.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:a,...i}=t,o=$p(Zx,n),c=O2(Zx,n),[u,h]=y.useState(null),f=Jt(e,T=>h(T)),m=u?o.form||!!u.closest("form"):!0,g=hy(u),b=o.values[r],N=b===void 0?0:V2(b,o.min,o.max),j=E8(r,o.values.length),v=g==null?void 0:g[c.size],k=v?M8(v,N,c.direction):0;return y.useEffect(()=>{if(u)return o.thumbs.add(u),()=>{o.thumbs.delete(u)}},[u,o.thumbs]),s.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${N}% + ${k}px)`},children:[s.jsx(Yx.ItemSlot,{scope:t.__scopeSlider,children:s.jsx(Mt.span,{role:"slider","aria-label":t["aria-label"]||j,"aria-valuemin":o.min,"aria-valuenow":b,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...i,ref:f,style:b===void 0?{display:"none"}:t.style,onFocus:St(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),m&&s.jsx(B2,{name:a??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:b},r)]})});F2.displayName=Zx;var S8="RadioBubbleInput",B2=y.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const a=y.useRef(null),i=Jt(a,r),o=uy(e);return y.useEffect(()=>{const c=a.current;if(!c)return;const u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(o!==e&&f){const m=new Event("input",{bubbles:!0});f.call(c,e),c.dispatchEvent(m)}},[o,e]),s.jsx(Mt.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});B2.displayName=S8;function C8(t=[],e,n){const r=[...t];return r[n]=e,r.sort((a,i)=>a-i)}function V2(t,e,n){const i=100/(n-e)*(t-e);return Lf(i,[0,100])}function E8(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function T8(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 M8(t,e,n){const r=t/2,i=py([0,50],[0,r]);return(r-i(e)*n)*n}function A8(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function P8(t,e){if(e>0){const n=A8(t);return Math.min(...n)>=e}return!0}function py(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 I8(t){return(String(t).split(".")[1]||"").length}function R8(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var L8=R2,O8=$2,D8=z2,_8=F2;function $8({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(L8,{defaultValue:e,value:n,min:r,max:a,className:zt("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",t),...i,children:[s.jsx(O8,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:s.jsx(D8,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:o.length},(c,u)=>s.jsx(_8,{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 z8={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,withdrawFee:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function H2(t){const e=!!(t!=null&&t.embedded),[n,r]=y.useState(z8),[a,i]=y.useState(!0),[o,c]=y.useState(!1);y.useEffect(()=>{Oe("/api/admin/referral-settings").then(f=>{const m=f==null?void 0:f.data;m&&typeof m=="object"&&r({distributorShare:m.distributorShare??90,minWithdrawAmount:m.minWithdrawAmount??10,bindingDays:m.bindingDays??30,userDiscount:m.userDiscount??5,withdrawFee:m.withdrawFee??5,enableAutoWithdraw:m.enableAutoWithdraw??!1,vipOrderShareVip:m.vipOrderShareVip??20,vipOrderShareNonVip:m.vipOrderShareNonVip??10})}).catch(console.error).finally(()=>i(!1))},[]);const u=async()=>{c(!0);try{const f={distributorShare:Number(n.distributorShare)||0,minWithdrawAmount:Number(n.minWithdrawAmount)||0,bindingDays:Number(n.bindingDays)||0,userDiscount:Number(n.userDiscount)||0,withdrawFee:Number(n.withdrawFee)??5,enableAutoWithdraw:!!n.enableAutoWithdraw,vipOrderShareVip:Number(n.vipOrderShareVip)||20,vipOrderShareNonVip:Number(n.vipOrderShareNonVip)||10},m=await kt("/api/admin/referral-settings",f);if(!m||m.success===!1){G.error("保存失败: "+(m&&typeof m=="object"&&"error"in m?m.error:""));return}G.success(`✅ 分销配置已保存成功! -======== -`;return`data:image/svg+xml;utf8,${encodeURIComponent(i)}`}function u8(){const[t,e]=y.useState({}),[n,r]=y.useState(!0),[a,i]=y.useState(!1),[o,c]=y.useState(!1),u=y.useCallback(async()=>{r(!0);try{const g=await Oe("/api/admin/mbti-avatars");g!=null&&g.avatars?e(g.avatars):e({})}catch{G.error("加载 MBTI 头像配置失败")}finally{r(!1)}},[]);y.useEffect(()=>{u()},[u]);const h=async()=>{i(!0);try{const g=await kt("/api/admin/mbti-avatars",{avatars:t});if(!g||g.success===!1){G.error((g==null?void 0:g.error)||"保存失败");return}G.success("已保存,后台与小程序默认头像同步生效"),u()}catch{G.error("保存失败")}finally{i(!1)}},f=g=>{const b=aN(g);e(N=>({...N,[g]:b})),G.success(`${g} 已生成`)},m=()=>{c(!0);try{const g={...t};rN.forEach(b=>{g[b]=aN(b)}),e(g),G.success("16 型头像已生成(仅人物)")}finally{c(!1)}};return n?s.jsxs("div",{className:"flex items-center justify-center py-16 text-gray-400",children:[s.jsx(He,{className:"w-5 h-5 mr-2 animate-spin text-[#38bdac]"}),"加载配置…"]}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs(De,{className:"bg-[#0f2137] border-[#38bdac]/25 shadow-xl",children:[s.jsxs(ut,{className:"pb-2",children:[s.jsxs(ht,{className:"text-white flex items-center gap-2 text-lg",children:[s.jsx(yA,{className:"w-5 h-5 text-[#38bdac]"}),"MBTI 头像库"]}),s.jsx(qt,{className:"text-gray-400 text-sm leading-relaxed",children:"采用人物化风格,按 MBTI 性格自动生成。头像内不显示中英文,仅显示人物形象,颜色与站点主题融合。"})]}),s.jsxs(_e,{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(BA,{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(He,{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(Cn,{className:"w-3.5 h-3.5 mr-1"}),a?"保存中…":"保存映射"]})]})]}),s.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:rN.map(g=>{const b=t[g]??"",N=S2[g];return s.jsxs("div",{className:"rounded-xl border border-gray-700/60 bg-[#0a1628] p-3 flex flex-col gap-2 hover:border-[#38bdac]/35 transition-colors",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 font-mono text-xs",children:g}),s.jsx("span",{className:"text-xs text-gray-400 truncate",title:N.title,children:N.title})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-16 h-16 rounded-full shrink-0 overflow-hidden flex items-center justify-center bg-[#081322] ring-2 ring-[#38bdac]/40 ring-offset-2 ring-offset-[#0a1628]",children:b?s.jsx("img",{src:b,alt:g,className:"w-full h-full object-cover scale-110"}):s.jsx("span",{className:"text-gray-600 text-[10px]",children:"未配"})}),s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"https://... 或 data:image/...",value:b,onChange:j=>e(v=>({...v,[g]:j.target.value}))})})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(J,{type:"button",size:"sm",variant:"outline",className:"h-7 text-[11px] border-[#38bdac]/40 text-[#38bdac]",onClick:()=>f(g),children:"生成这张"}),s.jsx(J,{type:"button",size:"sm",variant:"ghost",className:"h-7 text-[11px] text-gray-400",onClick:()=>e(j=>({...j,[g]:""})),children:"清空"})]})]},g)})})]})}const iN=[{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:"用户状态"}],oN=[{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 h8(t){return{...t,triggerConditions:C2(t.triggerConditions)}}const f8=[{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 lN(t){return confirm(`确定删除该${t}?此操作不可恢复。`)?window.prompt(`请输入「删除」以确认删除${t}`)==="删除":!1}function p8({userId:t,userAvatar:e,nickname:n,name:r,onOpenDetail:a}){const[i,o]=y.useState(!1),c=n||r||"-",u=(c==="-"?"?":c).charAt(0),h=!!(e!=null&&e.trim())&&!i;return s.jsxs("div",{className:"flex items-center gap-2 min-w-0 max-w-[220px]",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/15 flex items-center justify-center text-xs font-medium text-[#38bdac] flex-shrink-0 overflow-hidden border border-gray-600/50","aria-hidden":!0,children:h?s.jsx("img",{src:ma(e),alt:"",className:"w-full h-full object-cover",onError:()=>o(!0)}):s.jsx("span",{children:u})}),s.jsx("button",{type:"button",className:`text-left truncate min-w-0 ${t?"hover:text-[#38bdac] cursor-pointer":"cursor-default text-gray-300"}`,disabled:!t,title:t?"查看用户详情":void 0,onClick:()=>{t&&a(t)},children:c})]})}function m8(t){const e=(t||"").trim();if(!e)return"";try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function g8(){var Gi,qu,vd,Nd,wd,jd,kd;const[t,e]=Q0(),n=t.get("pool"),r=t.get("tab")||"users",a=["users","journey","rules","vip-roles","leads"].includes(r)?r:"users",i=(t.get("leadAction")||"").trim(),[o,c]=y.useState([]),[u,h]=y.useState(0),[f,m]=y.useState(1),[g,b]=y.useState(10),[N,j]=y.useState(""),v=Hl(N,300),k=n==="vip"?"vip":n==="complete"?"complete":"all",[T,C]=y.useState(k),[R,O]=y.useState(!0),[U,P]=y.useState(!1),[z,L]=y.useState(null),[Q,se]=y.useState(!1),[$,ie]=y.useState(!1),[le,me]=y.useState("desc");y.useEffect(()=>{n==="vip"?C("vip"):n==="complete"?C("complete"):n==="all"&&C("all")},[n]);const[I,Y]=y.useState(!1),[F,ge]=y.useState(null),[X,B]=y.useState(!1),[W,fe]=y.useState(!1),[he,de]=y.useState({referrals:[],stats:{}}),[D,q]=y.useState(!1),[_,Z]=y.useState(null),[re,we]=y.useState(!1),[Fe,Ue]=y.useState(null),[jt,Nn]=y.useState(!1),[pt,It]=y.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),[hn,Bn]=y.useState([]),[fn,Wt]=y.useState(!1),[xn,En]=y.useState(!1),[Vn,es]=y.useState(null),[Rt,yn]=y.useState({title:"",description:"",trigger:"",triggerConditions:[],actionType:"popup",sort:0,enabled:!0}),[Ne,Me]=y.useState([]),[We,at]=y.useState(!1),[Lt,Ct]=y.useState(null),[$e,H]=y.useState(null),[Qe,vt]=y.useState({}),[Ft,yt]=y.useState(!1),[bt,Pt]=y.useState(null),[Qt,wn]=y.useState([]),[Ds,hr]=y.useState(!1),[Ja,Gr]=y.useState(null),[Jr,va]=y.useState(""),[Tr,Mr]=y.useState([]),[Qr,Qa]=y.useState(!1),[fr,qs]=y.useState({}),[pr,Gs]=y.useState([]),[_s,oe]=y.useState(0),[ve,Xe]=y.useState(1),[Nt]=y.useState(10),[Zt,Js]=y.useState(!1),[Yo,Yr]=y.useState(null),[zi,Ya]=y.useState(""),gs=Hl(zi,300),[Ar,nn]=y.useState(""),[Xa,Fi]=y.useState(""),[Xr,Na]=y.useState(""),[Xo,Bi]=y.useState(!1),[Qs,$s]=y.useState({}),[Zo,qn]=y.useState(null),[el,Zr]=y.useState(null),[xs,mr]=y.useState([]),[zs,ea]=y.useState(!1),wa=y.useRef(null),[rc,Za]=y.useState(!1),[Vi,ei]=y.useState(!1),[Hi,ta]=y.useState("存客宝返回 data"),[ja,tl]=y.useState(""),lt=y.useCallback(async(M,ee)=>{Js(!0),Yr(null);try{const be=new URLSearchParams({mode:"contact",page:String(ve),pageSize:String(Nt)}),Ae=M??gs;Ae&&be.set("search",Ae);const Ge=ee??Ar;Ge&&be.set("source",Ge),Xa&&be.set("action",Xa),Xr&&be.set("pushStatus",Xr);const Je=await Oe(`/api/db/ckb-leads?${be}`);if(Je!=null&&Je.success)Gs(Je.records||[]),oe(Je.total??0),Je.stats&&$s(Je.stats);else{const Vt=(Je==null?void 0:Je.error)||"加载获客列表失败";Yr(Vt),G.error(Vt),Gs([]),oe(0)}}catch(be){const Ae=be instanceof Error?be.message:"网络错误";Yr(Ae),G.error("加载获客列表失败: "+Ae),Gs([]),oe(0)}finally{Js(!1)}},[ve,Nt,gs,Ar,Xa,Xr]);y.useEffect(()=>{mr([])},[gs,Ar,Xa,Xr]),y.useEffect(()=>{a==="leads"&&Fi(i)},[a,i]);function Ui(M,ee){return{...M,...ee.pushStatus!==void 0?{pushStatus:ee.pushStatus}:{},...typeof ee.retryCount=="number"?{retryCount:ee.retryCount}:{},...typeof ee.ckbCode=="number"?{ckbCode:ee.ckbCode}:{},...ee.ckbMessage!==void 0?{ckbMessage:ee.ckbMessage}:{},...ee.ckbData!==void 0?{ckbData:ee.ckbData}:{},...ee.ckbError!==void 0?{ckbError:ee.ckbError}:{},...ee.lastPushAt!==void 0?{lastPushAt:ee.lastPushAt??void 0}:{},...ee.nextRetryAt!==void 0?{nextRetryAt:ee.nextRetryAt??void 0}:{}}}async function ti(M){if(M){qn(M);try{const ee=await kt("/api/db/ckb-leads/retry",{id:M});ee!=null&&ee.success?(G.success(ee.pushed?"重推成功":"已发起重推,请刷新查看状态"),ee.record&&Gs(be=>be.map(Ae=>Ae.id===M?Ui(Ae,ee.record):Ae))):G.error((ee==null?void 0:ee.error)||"重推失败")}catch(ee){G.error(ee instanceof Error?ee.message:"重推请求失败")}finally{qn(null)}}}async function ni(M){if(M&&confirm("确定删除该条获客记录?删除后不可恢复。")){Zr(M);try{const ee=await kt("/api/db/ckb-leads/delete",{id:M});ee!=null&&ee.success?G.success("已删除"):G.error((ee==null?void 0:ee.error)||"删除失败")}catch(ee){G.error(ee instanceof Error?ee.message:"删除请求失败")}finally{Zr(null),lt()}}}async function nl(){const M=Ss.filter(Ae=>Ae.pushStatus==="failed");if(M.length===0){G.info("当前页无失败记录");return}Za(!0);let ee=0;for(const Ae of M)try{const Ge=await kt("/api/db/ckb-leads/retry",{id:Ae.id});if(Ge!=null&&Ge.success&&Ge.pushed&&ee++,Ge!=null&&Ge.success&&Ge.record){const Je=Ge.record;Gs(Vt=>Vt.map(Ve=>Ve.id===Ae.id?Ui(Ve,Je):Ve))}}catch{}Za(!1);const be=M.length;G.success(`批量重推完成:成功 ${ee} / ${be}`)}function ts(){const M=Ss.filter(Ve=>Ve.pushStatus==="failed");if(M.length===0){G.info("当前筛选下无失败记录可导出");return}const ee=Ve=>`"${String(Ve??"").replace(/"/g,'""')}"`,Ae=[["ID","昵称","手机号","微信号","对应@人","计划Key","来源","推送状态","重试次数","失败原因","下次重试时间","创建时间"].join(",")];for(const Ve of M)Ae.push([ee(Ve.id),ee(Ve.userNickname||Ve.name||""),ee(Ve.phone||""),ee(Ve.wechatId||""),ee(Ve.personName||""),ee(Ve.planApiKey||""),ee(Ve.source||""),ee(Ve.pushStatus||""),ee(typeof Ve.retryCount=="number"?Ve.retryCount:""),ee(Ve.ckbError||""),ee(Ve.nextRetryAt?new Date(Ve.nextRetryAt).toLocaleString():""),ee(Ve.createdAt?new Date(Ve.createdAt).toLocaleString():"")].join(","));const Ge=new Blob(["\uFEFF"+Ae.join(` -`)],{type:"text/csv;charset=utf-8;"}),Je=URL.createObjectURL(Ge),Vt=document.createElement("a");Vt.href=Je,Vt.download=`获客失败清单-${new Date().toISOString().slice(0,19).replace(/[:T]/g,"-")}.csv`,document.body.appendChild(Vt),Vt.click(),document.body.removeChild(Vt),URL.revokeObjectURL(Je),G.success(`已导出失败清单(${M.length} 条)`)}const sl=y.useCallback(async()=>{try{const M=await Oe("/api/admin/mbti-avatars"),ee=M!=null&&M.avatars&&typeof M.avatars=="object"?M.avatars:{};qs(ee)}catch{qs({})}},[]);y.useEffect(()=>{t.get("tab")==="leads"&<()},[t.get("tab"),ve,lt]),y.useEffect(()=>{if(a!=="leads")return;const M=window.setInterval(()=>{lt()},3e4);return()=>window.clearInterval(M)},[a,lt]),y.useEffect(()=>{sl()},[sl]);const gr=y.useCallback((M,ee)=>{const be=(M||"").trim();if(be)return be;const Ae=(ee||"").trim().toUpperCase();return/^[EI][NS][FT][JP]$/.test(Ae)?(fr[Ae]||"").trim():""},[fr]),Wi=y.useCallback(M=>{const ee=!!M.hasFullBook,be=Number(M.purchasedSectionCount||0);return ee?{tone:"vip",main:"已购全书",sub:be>0?`另购单章 ${be} 章`:"购买项:VIP / 全书"}:be>0?{tone:"paid",main:`已购 ${be} 章`,sub:"购买项:章节"}:{tone:"free",main:"未购买",sub:""}},[]),[xr,Ys]=y.useState(null),Fs=y.useCallback(async()=>{try{const M=await Oe("/api/admin/users/online-stats");M!=null&&M.success&&typeof M.onlineCount=="number"?Ys(M.onlineCount):Ys(0)}catch{Ys(null)}},[]);y.useEffect(()=>{Fs();const M=setInterval(Fs,1e4);return()=>clearInterval(M)},[Fs]);async function Xs(M=!1){var ee;O(!0),M&&P(!0),L(null);try{if(Q){const be=new URLSearchParams({search:v,limit:String(g*5)}),Ae=await Oe(`/api/db/users/rfm?${be}`);if(Ae!=null&&Ae.success){let Ge=Ae.users||[];le==="asc"&&(Ge=[...Ge].reverse());const Je=(f-1)*g;c(Ge.slice(Je,Je+g)),h(((ee=Ae.users)==null?void 0:ee.length)??0),Ge.length===0&&(se(!1),L("暂无订单数据,RFM 排序需要用户有购买记录后才能生效"))}else se(!1),L((Ae==null?void 0:Ae.error)||"RFM 加载失败,已切回普通模式")}else{const be=new URLSearchParams({page:String(f),pageSize:String(g),search:v,...T==="vip"&&{vip:"true"},...T==="complete"&&{pool:"complete"}}),Ae=await Oe(`/api/db/users?${be}`);Ae!=null&&Ae.success?(c(Ae.users||[]),h(Ae.total??0)):L((Ae==null?void 0:Ae.error)||"加载失败")}}catch(be){console.error("Load users error:",be),L("网络错误")}finally{O(!1),M&&P(!1)}}y.useEffect(()=>{m(1)},[v,T,Q]),y.useEffect(()=>{Xs()},[f,g,v,T,Q,le]);const ka=Math.ceil(u/g)||1,On=()=>{Q?le==="desc"?me("asc"):(se(!1),me("desc")):(se(!0),me("desc"))},ac=M=>({S:"bg-amber-500/20 text-amber-400",A:"bg-green-500/20 text-green-400",B:"bg-blue-500/20 text-blue-400",C:"bg-gray-500/20 text-gray-400",D:"bg-red-500/20 text-red-400"})[M||""]||"bg-gray-500/20 text-gray-400";async function Ir(M){var ee;if(!lN("用户")){G.info("已取消删除");return}try{const be=await Ci(`/api/db/users?id=${encodeURIComponent(M)}`);be!=null&&be.success?(G.success("已删除"),Xs()):G.error("删除失败: "+((be==null?void 0:be.error)||"未知错误"))}catch(be){const Ae=be,Ge=((ee=Ae==null?void 0:Ae.data)==null?void 0:ee.error)||(Ae==null?void 0:Ae.message)||"网络错误";G.error("删除失败: "+Ge)}}const Sa=M=>{ge(M),It({phone:M.phone||"",nickname:M.nickname||"",password:"",isAdmin:!!(M.isAdmin??!1),hasFullBook:!!(M.hasFullBook??!1)}),Y(!0)},ic=()=>{ge(null),It({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),Y(!0)};async function Ca(){if(!pt.phone||!pt.nickname){G.error("请填写手机号和昵称");return}B(!0);try{if(F){const M=await Xt("/api/db/users",{id:F.id,phone:pt.phone||void 0,nickname:pt.nickname,isAdmin:pt.isAdmin,hasFullBook:pt.hasFullBook,...pt.password&&{password:pt.password}});if(!(M!=null&&M.success)){G.error("更新失败: "+((M==null?void 0:M.error)||""));return}}else{const M=await kt("/api/db/users",{phone:pt.phone,nickname:pt.nickname,password:pt.password,isAdmin:pt.isAdmin});if(!(M!=null&&M.success)){G.error("创建失败: "+((M==null?void 0:M.error)||""));return}}Y(!1),Xs()}catch{G.error("保存失败")}finally{B(!1)}}async function yr(M){Z(M),fe(!0),q(!0);try{const ee=await Oe(`/api/db/users/referrals?userId=${encodeURIComponent(M.id)}`);ee!=null&&ee.success?de({referrals:ee.referrals||[],stats:ee.stats||{}}):de({referrals:[],stats:{}})}catch{de({referrals:[],stats:{}})}finally{q(!1)}}const Zs=y.useCallback(async()=>{Wt(!0);try{const M=await Oe("/api/db/user-rules");M!=null&&M.success&&Bn((M.rules||[]).map(ee=>h8(ee)))}catch{}finally{Wt(!1)}},[]);async function gd(){if(!Rt.title){G.error("请填写规则标题");return}B(!0);try{if(Vn){const M=await Xt("/api/db/user-rules",{id:Vn.id,...Rt});if(!(M!=null&&M.success)){G.error("更新失败: "+((M==null?void 0:M.error)||""));return}}else{const M=await kt("/api/db/user-rules",Rt);if(!(M!=null&&M.success)){G.error("创建失败: "+((M==null?void 0:M.error)||""));return}}En(!1),Zs()}catch{G.error("保存失败")}finally{B(!1)}}async function br(M){if(!lN("规则")){G.info("已取消删除");return}try{const ee=await Ci(`/api/db/user-rules?id=${M}`);ee!=null&&ee.success&&Zs()}catch{}}async function er(M){try{await Xt("/api/db/user-rules",{id:M.id,enabled:!M.enabled}),Zs()}catch{}}const ns=y.useCallback(async()=>{at(!0);try{const M=await Oe("/api/db/vip-members?limit=500");if(M!=null&&M.success&&M.data){const ee=[...M.data].map((be,Ae)=>({...be,vipSort:typeof be.vipSort=="number"?be.vipSort:Ae+1}));ee.sort((be,Ae)=>(be.vipSort??999999)-(Ae.vipSort??999999)),Me(ee)}else M&&M.error&&G.error(M.error)}catch{G.error("加载超级个体列表失败")}finally{at(!1)}},[]),[tr,Ki]=y.useState(!1),[Ea,Ta]=y.useState(null),[Pr,Ma]=y.useState(""),[rl,nr]=y.useState(!1),[si,na]=y.useState(!1),[Aa,Ia]=y.useState(null),[ri,al]=y.useState(""),[ss,sa]=y.useState(!1),il=["创业者","资源整合者","技术达人","投资人","产品经理","流量操盘手"],ai=M=>{Ta(M),Ma(M.vipRole||""),Ki(!0)},xd=M=>{Ia(M),al((M.webhookUrl||"").trim()),na(!0)},ol=async M=>{const ee=M.trim();if(Ea){if(!ee){G.error("请选择或输入标签");return}nr(!0);try{const be=await Xt("/api/db/users",{id:Ea.id,vipRole:ee});if(!(be!=null&&be.success)){G.error((be==null?void 0:be.error)||"更新超级个体标签失败");return}G.success("已更新超级个体标签"),Ki(!1),Ta(null),await ns()}catch{G.error("更新超级个体标签失败")}finally{nr(!1)}}},ll=async()=>{if(!Aa)return;const M=ri.trim();if(M&&!/^https?:\/\//i.test(M)){G.error("Webhook 地址需以 http/https 开头");return}sa(!0);try{const ee=await Xt("/api/db/vip-members/webhook",{userId:Aa.id,webhookUrl:M});if(!(ee!=null&&ee.success)){G.error((ee==null?void 0:ee.error)||"保存飞书群 Webhook 失败");return}G.success(M?"已保存该超级个体的飞书群 Webhook":"已清空该超级个体的飞书群 Webhook"),na(!1),Ia(null),await ns()}catch{G.error("保存飞书群 Webhook 失败")}finally{sa(!1)}},[ii,Rr]=y.useState(!1),[Lr,qi]=y.useState(null),[cl,dl]=y.useState(""),[oi,E]=y.useState(!1),V=M=>{qi(M),dl(M.vipSort!=null?String(M.vipSort):""),Rr(!0)},ue=async()=>{if(!Lr)return;const M=Number(cl);if(!Number.isFinite(M)){G.error("请输入有效的数字序号");return}E(!0);try{const ee=await Xt("/api/db/users",{id:Lr.id,vipSort:M});if(!(ee!=null&&ee.success)){G.error((ee==null?void 0:ee.error)||"更新排序序号失败");return}G.success("已更新排序序号"),Rr(!1),qi(null),await ns()}catch{G.error("更新排序序号失败")}finally{E(!1)}},ke=(M,ee)=>{M.dataTransfer.effectAllowed="move",M.dataTransfer.setData("text/plain",ee),Ct(ee)},Ke=(M,ee)=>{M.preventDefault(),$e!==ee&&H(ee)},mt=()=>{Ct(null),H(null)},wt=async(M,ee)=>{M.preventDefault();const be=M.dataTransfer.getData("text/plain")||Lt;if(Ct(null),H(null),!be||be===ee)return;const Ae=Ne.find(Ve=>Ve.id===be),Ge=Ne.find(Ve=>Ve.id===ee);if(!Ae||!Ge)return;const Je=Ae.vipSort??Ne.findIndex(Ve=>Ve.id===be)+1,Vt=Ge.vipSort??Ne.findIndex(Ve=>Ve.id===ee)+1;Me(Ve=>{const Yt=[...Ve],Cs=Yt.findIndex(lc=>lc.id===be),Or=Yt.findIndex(lc=>lc.id===ee);if(Cs===-1||Or===-1)return Ve;const Ji=[...Yt],[Sd,Cd]=[Ji[Cs],Ji[Or]];return Ji[Cs]={...Cd,vipSort:Je},Ji[Or]={...Sd,vipSort:Vt},Ji});try{const[Ve,Yt]=await Promise.all([Xt("/api/db/users",{id:be,vipSort:Vt}),Xt("/api/db/users",{id:ee,vipSort:Je})]);if(!(Ve!=null&&Ve.success)||!(Yt!=null&&Yt.success)){G.error((Ve==null?void 0:Ve.error)||(Yt==null?void 0:Yt.error)||"更新排序失败"),await ns();return}G.success("已更新排序"),await ns()}catch{G.error("更新排序失败"),await ns()}},Tn=y.useCallback(async()=>{yt(!0);try{const M=await Oe("/api/db/users/journey-stats");M!=null&&M.success&&M.stats&&vt(M.stats)}catch{}finally{yt(!1)}},[]),rs=y.useCallback(async M=>{Pt(M),hr(!0);try{const ee=await Oe(`/api/db/users/journey-users?stage=${M}&limit=50`);ee!=null&&ee.success&&ee.users&&wn(ee.users)}catch{}finally{hr(!1)}},[]),jn=y.useCallback(async(M,ee)=>{Gr(M),va(ee),Qa(!0);try{const be=await Oe(`/api/db/users/tracks?userId=${M}&limit=50`);be!=null&&be.success&&be.tracks&&Mr(be.tracks)}catch{}finally{Qa(!1)}},[]),[ys,Dn]=y.useState(!1),oc=async()=>{Dn(!0);try{const M=await kt("/api/admin/shensheshou/batch-enrich",{limit:20});M!=null&&M.success?(G.success(`批量补全完成:${M.enriched} 人已补全,${M.skipped} 人跳过`),Xs()):G.error((M==null?void 0:M.error)||"批量补全失败")}catch{G.error("批量补全请求失败")}finally{Dn(!1)}},om=M=>{const ee=[M.phone,M.nickname,M.avatar,M.wechatId,M.mbti,M.industry,M.region,M.position],be=ee.filter(Ae=>Ae!=null&&Ae!=="").length;return Math.round(be/ee.length*100)},{leadsRows:Ss,leadsRawCount:lm,leadsDeduped:Ku}=y.useMemo(()=>{const M=Ve=>(Ve||"").replace(/\D/g,"")||"",ee=Ve=>{const Yt=M(Ve.phone);if(Yt)return`phone:${Yt}`;const Cs=(Ve.userId||"").trim();if(Cs)return`user:${Cs}`;const Or=(Ve.wechatId||"").trim();return Or?`wechat:${Or}`:`row:${Ve.id}`},be=gs.trim().toLowerCase();let Ae=pr;be&&(Ae=pr.filter(Ve=>[Ve.userNickname,Ve.name,Ve.phone,Ve.wechatId,Ve.personName,Ve.source,Ve.planApiKey].filter(Boolean).join(" ").toLowerCase().includes(be)));const Ge=[...Ae].sort((Ve,Yt)=>{const Cs=Ve.createdAt?new Date(Ve.createdAt).getTime():0;return(Yt.createdAt?new Date(Yt.createdAt).getTime():0)-Cs});if(!Xo)return{leadsRows:Ge,leadsRawCount:Ae.length,leadsDeduped:0};const Je=new Set,Vt=[];for(const Ve of Ge){const Yt=ee(Ve);Je.has(Yt)||(Je.add(Yt),Vt.push(Ve))}return{leadsRows:Vt,leadsRawCount:Ae.length,leadsDeduped:Ae.length-Vt.length}},[pr,gs,Xo]);y.useEffect(()=>{const M=Ss.map(Ae=>Ae.id),ee=M.filter(Ae=>xs.includes(Ae)).length,be=wa.current;be&&(be.indeterminate=ee>0&&eebe.id),ee=M.length>0&&M.every(be=>xs.includes(be));mr(ee?be=>be.filter(Ae=>!M.includes(Ae)):be=>[...new Set([...be,...M])])}function dm(M){mr(ee=>ee.includes(M)?ee.filter(be=>be!==M):[...ee,M])}async function um(){if(xs.length===0){G.info("请先勾选要删除的记录");return}const M=xs.length;if(!confirm(`确定批量删除选中的 ${M} 条获客记录?删除后不可恢复。`))return;const ee=500;ea(!0);try{let be=0;for(let Ae=0;Ae{const ee=M||"";return ee==="success"?s.jsx(Be,{className:"bg-emerald-500/20 text-emerald-300 border-0 text-xs",children:"已推送(存客宝已接收)"}):ee==="pending_verify"?s.jsx(Be,{className:"bg-sky-500/20 text-sky-300 border-0 text-xs",children:"待通过 / 处理中"}):ee==="expired"?s.jsx(Be,{className:"bg-gray-500/20 text-gray-300 border-0 text-xs",children:"已过期"}):ee==="failed"?s.jsx(Be,{className:"bg-red-500/20 text-red-300 border-0 text-xs",children:"失败"}):ee==="pending"?s.jsx(Be,{className:"bg-amber-500/20 text-amber-300 border-0 text-xs",children:"待推送"}):ee?s.jsx(Be,{className:"bg-violet-500/20 text-violet-300 border-0 text-xs",title:ee,children:ee}):s.jsx(Be,{className:"bg-amber-500/20 text-amber-300 border-0 text-xs",children:"待推送"})},yd=y.useMemo(()=>{const M=new Map;for(const ee of Ss){if(ee.pushStatus!=="failed")continue;const be=(ee.ckbError||"未知错误").trim()||"未知错误";M.set(be,(M.get(be)||0)+1)}return Array.from(M.entries()).map(([ee,be])=>({reason:ee,count:be})).sort((ee,be)=>be.count-ee.count)},[Ss]);async function bd(){const M=Ss.filter(Je=>Je.pushStatus==="failed");if(M.length===0){G.info("当前页无失败记录");return}const ee=yd.slice(0,8).map(Je=>`- ${Je.reason}:${Je.count} 条`).join(` -`),be=M.slice(0,30).map(Je=>Je.id).join(", "),Ae=M.slice(0,20).map(Je=>`#${Je.id} | ${Je.userNickname||Je.name||"-"} | 手机:${Je.phone||"-"} | 来源:${Je.source||"-"} | 重试:${Je.retryCount??0} | 错误:${Je.ckbError||"-"}`).join(` -`),Ge=["【获客失败排障信息】",`时间:${new Date().toLocaleString()}`,`当前页失败总数:${M.length}`,"主要失败原因:",ee||"- 无",`最近失败记录ID(最多30条):${be||"无"}`,"","失败记录明细(最多20条):",Ae||"无"].join(` -`);try{await navigator.clipboard.writeText(Ge),G.success("已复制排障信息")}catch{G.error("复制失败,请检查浏览器剪贴板权限")}}return s.jsxs("div",{className:"p-8 w-full",children:[z&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[s.jsx("span",{children:z}),s.jsx("button",{type:"button",onClick:()=>L(null),children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-start gap-6 mb-6 flex-wrap",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"用户管理"}),s.jsxs("p",{className:"text-gray-400 mt-1 text-sm",children:["共 ",u," 位注册用户",xr!==null&&s.jsxs("span",{className:"text-[#38bdac] ml-1",children:["· 在线 ",xr," 人"]}),Q&&" · RFM 排序中"]})]}),s.jsx(De,{className:"shrink-0 w-full max-w-md border-[#38bdac]/35 bg-[#0f2137]/90",children:s.jsxs(_e,{className:"p-3 sm:p-4 space-y-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsxs("button",{type:"button",onClick:()=>ie(M=>!M),className:"flex items-center gap-2 min-w-0 flex-1 text-left rounded-lg px-1 py-0.5 hover:bg-white/5 transition-colors","aria-expanded":$,children:[s.jsx(Tf,{className:"w-5 h-5 text-[#38bdac] shrink-0"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-semibold text-white",children:"算法配置"}),s.jsx("div",{className:"text-xs text-gray-500 truncate",children:$?"RFM · Are you good(用户价值分层)":"RFM · 点击展开说明"})]}),$?s.jsx($x,{className:"w-4 h-4 text-gray-400 shrink-0"}):s.jsx(_l,{className:"w-4 h-4 text-gray-400 shrink-0"})]}),s.jsx(J,{type:"button",variant:"outline",size:"sm",onClick:On,className:"border-[#38bdac]/50 text-[#38bdac] hover:bg-[#38bdac]/10 bg-transparent shrink-0",children:Q?le==="desc"?"RFM 降序":"RFM 升序":"按 RFM 排序"})]}),$&&s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-xs text-gray-400 leading-relaxed",children:["综合分 0–100(六维度):最近消费 R(25%)+ 订单频次 F(20%)+ 累计金额 M(20%)+ 推荐人数(15%)+ 行为轨迹(10%)+ 资料完善(10%)。各维度在全量用户中归一化,与后端"," ",s.jsx("code",{className:"text-gray-500",children:"/api/db/users/rfm"})," 一致。"]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:f8.map(({level:M,range:ee,label:be})=>s.jsxs(Be,{variant:"outline",className:`text-[10px] border-0 ${ac(M)}`,children:[M," ",ee," · ",be]},M))})]})]})})]}),s.jsxs(Yc,{value:a,onValueChange:M=>{const ee=new URLSearchParams(t);M==="users"?ee.delete("tab"):ee.set("tab",M),e(ee)},className:"w-full",children:[s.jsxs(Vl,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-6 flex-wrap h-auto gap-1",children:[s.jsxs(en,{value:"users",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",children:[s.jsx(Un,{className:"w-4 h-4"})," 用户列表"]}),s.jsxs(en,{value:"leads",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:()=>lt(),children:[s.jsx(Vc,{className:"w-4 h-4"})," 获客列表"]}),s.jsxs(en,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Tn,children:[s.jsx(ua,{className:"w-4 h-4"})," 用户旅程总览"]}),s.jsxs(en,{value:"rules",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Zs,children:[s.jsx(So,{className:"w-4 h-4"})," 规则配置"]}),s.jsxs(en,{value:"vip-roles",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:ns,children:[s.jsx(Uc,{className:"w-4 h-4"})," 超级个体列表"]})]}),s.jsxs(tn,{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:oc,disabled:ys,className:"border-purple-500/50 text-purple-400 hover:bg-purple-500/10 bg-transparent",title:"批量调用神射手补全有手机号用户的资料",children:[ys?s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(_o,{className:"w-4 h-4 mr-2"}),"批量补全"]}),s.jsxs(J,{variant:"outline",onClick:()=>Xs(!0),disabled:U,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${U?"animate-spin":""}`})," 刷新"]}),s.jsxs("select",{value:T,onChange:M=>{const ee=M.target.value;C(ee),m(1),n&&(t.delete("pool"),e(t))},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",disabled:Q,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(pa,{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:N,onChange:M=>j(M.target.value)})]}),s.jsxs(J,{onClick:ic,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Vc,{className:"w-4 h-4 mr-2"})," 添加用户"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:R?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(us,{children:[s.jsx(hs,{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:On,children:[s.jsxs("div",{className:"flex items-center gap-1 group",children:[s.jsx(Tf,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"RFM分值"}),Q?le==="desc"?s.jsx(_l,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx($x,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(Dg,{className:"w-3.5 h-3.5 text-gray-600 group-hover:text-gray-400"})]}),Q&&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(fs,{children:[o.map(M=>{var ee,be,Ae;return s.jsxs(xt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(je,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[(()=>{var Vt;const Ge=gr(M.avatar,M.mbti),Je=((Vt=M.nickname)==null?void 0:Vt.charAt(0))||"?";return s.jsx("button",{type:"button",title:"点击管理 MBTI 默认头像库",onClick:()=>Nn(!0),className:"w-10 h-10 shrink-0 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] overflow-hidden ring-1 ring-transparent hover:ring-[#38bdac]/60 transition",children:Ge?s.jsx("img",{src:Ge,className:"w-full h-full rounded-full object-cover",alt:"",onError:Ve=>{var Or;const Yt=Ve.target;if(Yt.style.display="none",Yt.nextElementSibling)return;const Cs=document.createElement("span");Cs.textContent=Je,(Or=Yt.parentElement)==null||Or.appendChild(Cs)}}):Je})})(),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("button",{type:"button",onClick:()=>{Ue(M.id),we(!0)},className:"font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left truncate max-w-[120px]",children:M.nickname}),M.isAdmin&&s.jsx(Be,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),M.openId&&!((ee=M.id)!=null&&ee.startsWith("user_"))&&s.jsx(Be,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0 text-xs",children:"微信"})]}),s.jsxs("p",{className:"text-xs text-gray-500 font-mono truncate max-w-[140px]",title:M.id,children:[(be=M.id)==null?void 0:be.slice(0,16),(((Ae=M.id)==null?void 0:Ae.length)??0)>16?"…":""]})]})]})}),s.jsx(je,{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(je,{children:(()=>{const Ge=Wi(M);return Ge.tone==="vip"?s.jsxs("div",{className:"space-y-1",children:[s.jsx(Be,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:Ge.main}),Ge.sub&&s.jsx("p",{className:"text-[11px] text-amber-300/80",children:Ge.sub})]}):Ge.tone==="paid"?s.jsxs("div",{className:"space-y-1",children:[s.jsx(Be,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:Ge.main}),Ge.sub&&s.jsx("p",{className:"text-[11px] text-blue-300/80",children:Ge.sub})]}):s.jsx(Be,{variant:"outline",className:"text-gray-500 border-gray-600",children:Ge.main})})()}),s.jsx(je,{children:s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(M.earnings||0)).toFixed(2)]}),parseFloat(String(M.pendingEarnings||0))>0&&s.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String(M.pendingEarnings||0)).toFixed(2)]}),s.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>yr(M),role:"button",tabIndex:0,onKeyDown:Ge=>Ge.key==="Enter"&&yr(M),children:[s.jsx(Un,{className:"w-3 h-3"})," 绑定",M.referralCount||0,"人"]})]})}),s.jsx(je,{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 ${ac(M.rfmLevel)}`,children:M.rfmLevel})]}):s.jsx("span",{className:"text-gray-600 text-xs",children:"无订单"})}),s.jsx(je,{children:(()=>{const Ge=om(M),Je=Ge>=75?"text-green-400":Ge>=50?"text-yellow-400":"text-gray-500";return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-12 h-1.5 bg-gray-700 rounded-full overflow-hidden",children:s.jsx("div",{className:`h-full rounded-full ${Ge>=75?"bg-green-500":Ge>=50?"bg-yellow-500":"bg-gray-500"}`,style:{width:`${Ge}%`}})}),s.jsxs("span",{className:`text-xs ${Je}`,children:[Ge,"%"]})]})})()}),s.jsx(je,{className:"text-gray-400",children:M.createdAt?new Date(M.createdAt).toLocaleDateString():"-"}),s.jsx(je,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>{Ue(M.id),we(!0)},className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"用户详情",children:s.jsx(Ef,{className:"w-4 h-4"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>Sa(M),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑用户",children:s.jsx(sn,{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:()=>Ir(M.id),title:"删除",children:s.jsx(Yn,{className:"w-4 h-4"})})]})})]},M.id)}),o.length===0&&s.jsx(xt,{children:s.jsx(je,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),s.jsx(Us,{page:f,totalPages:ka,total:u,pageSize:g,onPageChange:m,onPageSizeChange:M=>{b(M),m(1)}})]})})})]}),s.jsxs(tn,{value:"leads",children:[Yo&&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:Yo}),s.jsx("button",{type:"button",className:"shrink-0 ml-2",onClick:()=>Yr(null),"aria-label":"关闭",children:"×"})]}),!Zt&&s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3 mb-4",children:[s.jsxs("div",{className:"p-3 bg-[#0f2137] border border-gray-700/50 rounded-lg",children:[s.jsx("p",{className:"text-gray-500 text-xs",children:"线索总条数(含留资/加入/匹配)"}),s.jsx("p",{className:"text-xl font-bold text-white",children:_s})]}),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:Qs.uniqueUsers??0})]}),(Qs.sourceStats&&Qs.sourceStats.length>0?Qs.sourceStats.slice(0,2):[]).map(M=>s.jsxs("div",{className:"p-3 bg-[#0f2137] border border-gray-700/50 rounded-lg",children:[s.jsxs("p",{className:"text-gray-500 text-xs",children:["来源:",M.source]}),s.jsx("p",{className:"text-xl font-bold text-purple-400",children:M.cnt})]},M.source))]}),!Zt&&yd.length>0&&s.jsx(De,{className:"bg-[#3a1010]/35 border-red-900/60 shadow-lg mb-4",children:s.jsxs(_e,{className:"p-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 mb-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-red-200 font-medium",children:"失败原因聚合"}),s.jsx("p",{className:"text-red-300/70 text-xs",children:"基于当前页筛选结果,按失败原因聚合统计"})]}),s.jsx(J,{type:"button",variant:"outline",onClick:bd,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:yd.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(pa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(ce,{placeholder:"搜索昵称/手机/微信/@人/来源/类型…",value:zi,onChange:M=>Ya(M.target.value),className:"pl-9 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"})]}),Qs.sourceStats&&Qs.sourceStats.length>0&&s.jsxs("select",{value:Ar,onChange:M=>{nn(M.target.value),Xe(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部来源"}),Qs.sourceStats.map(M=>s.jsxs("option",{value:M.source,children:[M.source,"(",M.cnt,")"]},M.source))]}),s.jsxs("select",{value:Xa,onChange:M=>{const ee=M.target.value;Fi(ee),Xe(1),e(be=>{const Ae=new URLSearchParams(be);return Ae.set("tab","leads"),ee?Ae.set("leadAction",ee):Ae.delete("leadAction"),Ae})},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",title:"按业务类型筛选",children:[s.jsx("option",{value:"",children:"全部类型"}),s.jsx("option",{value:"lead",children:"留资线索(文章@ / 首页链接)"}),s.jsx("option",{value:"join",children:"加入报名(导师 / 资源对接 / 团队)"}),s.jsx("option",{value:"match",children:"匹配上报(找伙伴匹配)"})]}),s.jsxs("label",{className:"flex items-center gap-2 text-xs text-gray-400 select-none bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2",children:[s.jsx("input",{type:"checkbox",checked:Xo,onChange:M=>Bi(M.target.checked),className:"w-4 h-4 rounded border-gray-600 bg-[#0f2137] accent-[#38bdac] cursor-pointer"}),"去重展示"]}),s.jsxs("select",{value:Xr,onChange:M=>{Na(M.target.value),Xe(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部状态"}),s.jsx("option",{value:"pending",children:"待推送"}),s.jsx("option",{value:"success",children:"已推送(存客宝已接收)"}),s.jsx("option",{value:"pending_verify",children:"待通过 / 处理中"}),s.jsx("option",{value:"expired",children:"已过期"}),s.jsx("option",{value:"failed",children:"推送失败"})]}),s.jsx(J,{type:"button",variant:"outline",onClick:()=>{Na("failed"),Xe(1)},className:"border-red-600/60 text-red-300 hover:bg-red-500/10 bg-transparent text-xs h-9",children:"只看失败"}),s.jsxs("span",{className:"text-xs text-gray-500 whitespace-nowrap max-w-[min(100%,20rem)]",title:"同一页内:相同手机号或相同用户 ID(含微信侧标识)只保留最近一条",children:["本页 ",lm," 条",Ku>0?` · 已合并 ${Ku} 条重复`:""]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx(J,{variant:"outline",onClick:ts,disabled:Zt,className:"border-cyan-600/60 text-cyan-300 hover:bg-cyan-500/10 bg-transparent",children:"导出失败清单"}),s.jsxs(J,{variant:"outline",onClick:nl,disabled:rc||zs||Zt,className:"border-amber-600/60 text-amber-300 hover:bg-amber-500/10 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${rc?"animate-spin":""}`}),"重推本页失败项"]}),s.jsxs(J,{variant:"outline",onClick:()=>void um(),disabled:zs||xs.length===0||Zt,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[s.jsx(Yn,{className:`w-4 h-4 mr-2 ${zs?"animate-pulse":""}`}),zs?"删除中…":`批量删除(${xs.length})`]}),s.jsxs(J,{variant:"outline",onClick:()=>lt(),disabled:Zt,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${Zt?"animate-spin":""}`})," 刷新"]})]})]}),!Zt&&Ss.length>0&&s.jsxs("p",{className:"text-xs text-gray-500 mb-2",children:["已选 ",s.jsx("span",{className:"text-[#38bdac]",children:xs.length})," 条 · 可翻页继续勾选 · 改搜索/筛选会清空选择",xs.length>0&&s.jsx("button",{type:"button",className:"ml-2 text-gray-400 hover:text-gray-200 underline",onClick:()=>mr([]),children:"清空"})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:Zt?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(us,{children:[s.jsx(hs,{children:s.jsxs(xt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Se,{className:"text-gray-400 w-10 text-center",children:s.jsx("input",{ref:wa,type:"checkbox",checked:Ss.length>0&&Ss.every(M=>xs.includes(M.id)),onChange:cm,className:"w-4 h-4 rounded border-gray-600 bg-[#0f2137] accent-[#38bdac] cursor-pointer",title:"全选本页(展示行)"})}),s.jsx(Se,{className:"text-gray-400",children:"昵称"}),s.jsx(Se,{className:"text-gray-400",children:"手机号"}),s.jsx(Se,{className:"text-gray-400",children:"微信号"}),s.jsx(Se,{className:"text-gray-400",children:"对应 @人"}),s.jsx(Se,{className:"text-gray-400",children:"获客计划(Key)"}),s.jsx(Se,{className:"text-gray-400",children:"推送状态"}),s.jsx(Se,{className:"text-gray-400",children:"时间"}),s.jsx(Se,{className:"text-gray-400",children:"重试"})]})}),s.jsxs(fs,{children:[Ss.map(M=>s.jsxs(xt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(je,{className:"text-center align-middle w-10",children:s.jsx("input",{type:"checkbox",checked:xs.includes(M.id),onChange:()=>dm(M.id),disabled:zs,className:"w-4 h-4 rounded border-gray-600 bg-[#0f2137] accent-[#38bdac] cursor-pointer"})}),s.jsx(je,{className:"text-gray-300 align-middle",children:s.jsx(p8,{userId:M.userId,userAvatar:M.userAvatar,nickname:M.userNickname,name:M.name,onOpenDetail:ee=>{Ue(ee),we(!0)}})}),s.jsx(je,{className:"text-gray-300",children:M.phone||"-"}),s.jsx(je,{className:"text-gray-300",children:M.wechatId||"-"}),s.jsx(je,{className:"text-[#38bdac]",children:M.personName||"-"}),s.jsx(je,{className:"text-gray-400 text-xs",children:(()=>{const ee=(M.planApiKey||"").trim();if(!ee)return"-";const be=ee.length<=10?ee:`${ee.slice(0,6)}…${ee.slice(-4)}`;return s.jsx("button",{type:"button",className:"font-mono text-gray-400 hover:text-gray-200 underline decoration-dotted",title:ee,onClick:async()=>{try{await navigator.clipboard.writeText(ee),G.success("已复制计划Key")}catch{G.error("复制失败,请手动复制")}},children:be})})()}),s.jsx(je,{children:s.jsxs("div",{className:"space-y-1",children:[hm(M.pushStatus),(typeof M.ckbCode=="number"||(M.ckbMessage||"").trim())&&s.jsx("p",{className:"text-[11px] text-gray-500 max-w-[260px] truncate",title:[typeof M.ckbCode=="number"?`code=${M.ckbCode}`:"",(M.ckbMessage||"").trim()?`message=${String(M.ckbMessage).trim()}`:"",(M.ckbData||"").trim()?`data=${String(M.ckbData).trim()}`:""].filter(Boolean).join(" | "),children:[typeof M.ckbCode=="number"?`code=${M.ckbCode}`:"",(M.ckbMessage||"").trim()?String(M.ckbMessage).trim():""].filter(Boolean).join(" · ")}),!!(M.ckbData||"").trim()&&s.jsx("button",{type:"button",className:"text-[11px] text-sky-300/90 hover:text-sky-200 underline decoration-dotted",onClick:()=>{const ee=String(M.ckbData||"").trim();ta(`存客宝返回 data(#${M.id})`),tl(m8(ee)),ei(!0)},children:"查看 data"}),!!M.ckbError&&s.jsx("p",{className:"text-[11px] text-red-300 max-w-[220px] truncate",title:M.ckbError,children:M.ckbError})]})}),s.jsx(je,{className:"text-gray-400 whitespace-nowrap",children:M.createdAt?new Date(M.createdAt).toLocaleString():"-"}),s.jsx(je,{className:"text-gray-400 text-xs align-top py-3 min-w-[148px]",children:s.jsxs("div",{className:"flex flex-col gap-3",children:[s.jsx("p",{className:"text-gray-400 leading-snug",children:typeof M.retryCount=="number"?`第 ${M.retryCount} 次`:"-"}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs(J,{size:"sm",variant:"outline",disabled:zs||Zo===M.id||el===M.id,onClick:()=>ti(M.id),className:"h-8 px-2.5 text-[11px] border-gray-600 text-gray-200 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(He,{className:`w-3 h-3 mr-1 ${Zo===M.id?"animate-spin":""}`}),"重推"]}),s.jsxs(J,{size:"sm",variant:"outline",disabled:zs||el===M.id||Zo===M.id,onClick:()=>ni(M.id),className:"h-8 px-2.5 text-[11px] border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent shrink-0",children:[s.jsx(Yn,{className:`w-3 h-3 mr-1 ${el===M.id?"animate-pulse":""}`}),"删除"]})]})]})})]},M.id)),Ss.length===0&&s.jsx(xt,{children:s.jsx(je,{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(Vc,{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:gs.trim()||Ar?"当前搜索或来源筛选下没有匹配记录,可清空条件后重试。":"存客宝场景产生的手机号 / 微信留资会出现在此列表。请确认获客计划已开启,并有用户完成留资。"}),s.jsxs(J,{type:"button",variant:"outline",onClick:()=>lt(),disabled:Zt,className:"border-[#38bdac]/40 text-[#38bdac] hover:bg-[#38bdac]/10 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${Zt?"animate-spin":""}`}),"重新加载"]})]})})})]})]}),s.jsx(Us,{page:ve,totalPages:Math.ceil(_s/Nt)||1,total:_s,pageSize:Nt,onPageChange:Xe,onPageSizeChange:()=>{}})]})})})]}),s.jsxs(tn,{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:Tn,disabled:Ft,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${Ft?"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,ee)=>s.jsxs("div",{className:"relative flex flex-col items-center",children:[s.jsxs("div",{className:`relative w-full p-3 rounded-xl border ${M.color} text-center cursor-pointer hover:opacity-80 transition-opacity ${bt===M.id?"ring-2 ring-[#38bdac]":""}`,onClick:()=>rs(M.id),title:`点击查看「${M.label}」阶段的用户`,children:[s.jsx("div",{className:"text-2xl mb-1",children:M.icon}),s.jsx("div",{className:`text-xs font-medium ${M.color.split(" ").find(be=>be.startsWith("text-"))}`,children:M.label}),Qe[M.id]!==void 0&&s.jsxs("div",{className:"mt-1.5 text-xs text-gray-400",children:[s.jsx("span",{className:"font-bold text-white",children:Qe[M.id]})," 人"]}),s.jsx("div",{className:"absolute -top-2.5 -left-2.5 w-5 h-5 rounded-full bg-[#0a1628] border border-gray-700 flex items-center justify-center text-[10px] text-gray-500",children:ee+1})]}),ees.jsxs("div",{className:"flex items-start gap-3 p-2 bg-[#0a1628] rounded",children:[s.jsx("span",{className:"text-[#38bdac] font-mono text-xs shrink-0 mt-0.5",children:M.step}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-300",children:M.action}),s.jsxs("p",{className:"text-gray-600 text-xs",children:["→ ",M.next]})]})]},M.step))})]}),s.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/50 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(dr,{className:"w-4 h-4 text-purple-400"}),s.jsx("span",{className:"text-white font-medium",children:"行为锚点统计"}),s.jsx("span",{className:"text-gray-500 text-xs ml-auto",children:"实时更新"})]}),Ft?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(He,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Object.keys(Qe).length>0?s.jsx("div",{className:"space-y-2",children:(()=>{const M=Pc.reduce((ee,be)=>ee+(Qe[be.id]||0),0);return Pc.map(ee=>{const be=Qe[ee.id]||0,Ae=M>0?Math.round(be/M*100):0,Ge=be>0?Math.max(Ae,6):0;return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-gray-500 text-xs w-[5.5rem] shrink-0 leading-tight",children:[ee.icon," ",ee.label]}),s.jsx("div",{className:"flex-1 h-2.5 bg-[#0a1628] rounded-full overflow-hidden border border-gray-700/40",children:s.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-[#38bdac]/50 to-[#38bdac] transition-all",style:{width:`${Ge}%`}})}),s.jsx("span",{className:"text-gray-400 text-xs w-14 text-right tabular-nums",children:be}),s.jsx("span",{className:"text-gray-600 text-[10px] w-8 text-right tabular-nums",children:M>0?`${Ae}%`:"—"})]},ee.id)})})()}):s.jsx("div",{className:"text-center py-8",children:s.jsx("p",{className:"text-gray-500 text-sm",children:"点击「刷新数据」加载统计"})})]})]}),bt&&s.jsxs("div",{className:"mt-6 bg-[#0f2137] border border-gray-700/50 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Un,{className:"w-4 h-4 text-[#38bdac]"}),s.jsxs("span",{className:"text-white font-medium",children:[(Gi=Pc.find(M=>M.id===bt))==null?void 0:Gi.icon," ",(qu=Pc.find(M=>M.id===bt))==null?void 0:qu.label," 阶段用户"]}),s.jsxs(Be,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-xs",children:[Qt.length," 人"]})]}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>Pt(null),className:"text-gray-400 hover:text-white",children:s.jsx(Xn,{className:"w-4 h-4"})})]}),Ds?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(He,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Qt.length===0?s.jsx("p",{className:"text-gray-500 text-center py-6",children:"该阶段暂无用户"}):s.jsxs(us,{children:[s.jsx(hs,{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(fs,{children:Qt.map(M=>s.jsxs(xt,{className:"border-gray-700/50 hover:bg-[#0a1628]",children:[s.jsx(je,{className:"text-white",children:M.nickname||"微信用户"}),s.jsx(je,{className:"text-gray-300",children:M.phone||"-"}),s.jsx(je,{className:"text-gray-400 text-xs",children:M.createdAt?new Date(M.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx(je,{className:"text-right",children:s.jsxs(J,{variant:"ghost",size:"sm",className:"text-[#38bdac] hover:bg-[#38bdac]/10",onClick:()=>jn(M.id,M.nickname||"微信用户"),children:[s.jsx(Ef,{className:"w-4 h-4 mr-1"})," 行为轨迹"]})})]},M.id))})]})]}),s.jsx(Dt,{open:!!Ja,onOpenChange:M=>{M||Gr(null)},children:s.jsxs(Ot,{className:"sm:max-w-[600px] bg-[#0f2137] border-gray-700 text-white max-h-[80vh] overflow-y-auto",children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(ua,{className:"w-5 h-5 text-[#38bdac]"}),Jr," 的行为轨迹"]})}),Qr?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):Tr.length===0?s.jsx("p",{className:"text-gray-500 text-center py-8",children:"该用户暂无行为记录"}):s.jsxs("div",{className:"relative pl-6 space-y-0",children:[s.jsx("div",{className:"absolute left-[11px] top-2 bottom-2 w-0.5 bg-gray-700"}),Tr.map((M,ee)=>s.jsxs("div",{className:"relative flex items-start gap-3 py-2",children:[s.jsx("div",{className:"absolute left-[-13px] top-3 w-2.5 h-2.5 rounded-full bg-[#38bdac] border-2 border-[#0f2137] z-10"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"text-white text-sm font-medium",children:M.actionLabel}),M.module&&s.jsx(Be,{className:"bg-purple-500/10 text-purple-400 border border-purple-500/30 text-[10px]",children:M.module})]}),(M.chapterTitle||M.target)&&s.jsx("p",{className:"text-gray-400 text-xs mt-0.5 truncate",children:M.chapterTitle||M.target}),s.jsxs("p",{className:"text-gray-600 text-[10px] mt-0.5",children:[M.timeAgo," · ",M.createdAt?new Date(M.createdAt).toLocaleString("zh-CN"):""]})]})]},M.id||ee))]})]})})]}),s.jsxs(tn,{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:Zs,disabled:fn,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${fn?"animate-spin":""}`})," 刷新"]}),s.jsxs(J,{onClick:()=>{es(null),yn({title:"",description:"",trigger:"",triggerConditions:[],actionType:"popup",sort:0,enabled:!0}),En(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx($n,{className:"w-4 h-4 mr-2"})," 添加规则"]})]})]}),fn?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):hn.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(dr,{className:"w-12 h-12 text-[#38bdac]/30 mx-auto mb-4"}),s.jsx("p",{className:"text-gray-400 mb-4",children:"暂无规则(重启服务将自动写入10条默认规则)"}),s.jsxs(J,{onClick:Zs,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(He,{className:"w-4 h-4 mr-2"})," 重新加载"]})]}):s.jsx("div",{className:"space-y-2",children:hn.map(M=>{var be;const ee=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(sn,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0"}),s.jsx("span",{className:"text-white font-medium text-sm truncate",children:M.title}),M.trigger&&s.jsx(Be,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-[10px] shrink-0",children:M.trigger}),ee.length>0&&s.jsxs("div",{className:"flex flex-wrap gap-0.5 ml-1",children:[ee.slice(0,3).map(Ae=>{const Ge=iN.find(Je=>Je.value===Ae);return s.jsx(Be,{className:"bg-purple-500/10 text-purple-400 border border-purple-500/30 text-[9px]",children:(Ge==null?void 0:Ge.label)||Ae},Ae)}),ee.length>3&&s.jsxs("span",{className:"text-gray-500 text-[9px]",children:["+",ee.length-3]})]}),M.actionType&&M.actionType!=="popup"&&s.jsx(Be,{className:"bg-amber-500/10 text-amber-400 border border-amber-500/30 text-[9px] shrink-0",children:((be=oN.find(Ae=>Ae.value===M.actionType))==null?void 0:be.label)||M.actionType})]}),s.jsxs("div",{className:"flex items-center gap-1.5 ml-3 shrink-0",children:[s.jsx(Ut,{checked:M.enabled,onCheckedChange:()=>er(M)}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>{es(M),yn({title:M.title,description:M.description,trigger:M.trigger,triggerConditions:ee,actionType:M.actionType||"popup",sort:M.sort,enabled:M.enabled}),En(!0)},className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10 h-7 w-7 p-0",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>br(M.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10 h-7 w-7 p-0",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]}),M.description&&s.jsxs("details",{className:"ml-[52px] mt-1",children:[s.jsxs("summary",{className:"text-gray-500 text-xs cursor-pointer hover:text-gray-400 select-none",children:["查看完整描述",s.jsxs("span",{className:"text-gray-600 ml-1",children:["(",M.description.length," 字,默认折叠)"]})]}),s.jsx("p",{className:"text-gray-400 text-sm mt-1 pl-1 border-l-2 border-gray-700 whitespace-pre-wrap",children:M.description})]})]},M.id)})})]}),s.jsxs(tn,{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:ns,disabled:We,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${We?"animate-spin":""}`})," ","刷新"]})})]}),We?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):Ne.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(Uc,{className:"w-12 h-12 text-amber-400/30 mx-auto mb-4"}),s.jsx("p",{className:"text-gray-400 mb-4",children:"当前没有有效的超级个体用户。"})]}):s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:s.jsxs(us,{children:[s.jsx(hs,{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(fs,{children:Ne.map((M,ee)=>{var Ge;const be=Lt===M.id,Ae=$e===M.id;return s.jsxs(xt,{draggable:!0,onDragStart:Je=>ke(Je,M.id),onDragOver:Je=>Ke(Je,M.id),onDrop:Je=>wt(Je,M.id),onDragEnd:mt,className:`border-gray-700/50 cursor-grab active:cursor-grabbing select-none ${be?"opacity-60":""} ${Ae?"bg-[#38bdac]/10":""}`,children:[s.jsx(je,{className:"text-gray-300",children:ee+1}),s.jsx(je,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[gr(M.avatar,M.mbti)?s.jsx("img",{src:gr(M.avatar,M.mbti),className:"w-8 h-8 rounded-full object-cover border border-amber-400/60",alt:"",onError:Je=>{var Ve,Yt;Je.target.style.display="none";const Vt=document.createElement("div");Vt.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",Vt.textContent=((Ve=M.name)==null?void 0:Ve[0])||"创",(Yt=Je.target.parentElement)==null||Yt.appendChild(Vt)}}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/20 border border-amber-400/60 flex items-center justify-center text-amber-300 text-sm",children:((Ge=M.name)==null?void 0:Ge[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:M.name})})]})}),s.jsx(je,{className:"text-gray-300 whitespace-nowrap",children:M.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置)"})}),s.jsx(je,{className:"text-center text-blue-400 text-xs font-mono",children:M.clickCount!=null?String(M.clickCount):"-"}),s.jsx(je,{className:"text-center text-green-400 text-xs font-mono",children:M.leadCount!=null?String(M.leadCount):"-"}),s.jsx(je,{className:"text-gray-300",children:M.vipSort??ee+1}),s.jsx(je,{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(je,{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:()=>ai(M),title:"设置超级个体标签",children:s.jsx(cu,{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:()=>xd(M),title:"编辑飞书群Webhook",children:s.jsx(sn,{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:()=>V(M),title:"设置排序序号",children:s.jsx(Dg,{className:"w-3.5 h-3.5"})})]})})]},M.id)})})]})})})]})]}),s.jsx(Dt,{open:jt,onOpenChange:Nn,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-6xl",children:[s.jsx(_t,{children:s.jsx($t,{className:"text-white",children:"MBTI 默认头像库"})}),s.jsx(u8,{})]})}),s.jsx(Dt,{open:ii,onOpenChange:M=>{Rr(M),M||qi(null)},children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(Dg,{className:"w-5 h-5 text-[#38bdac]"}),"设置排序 — ",Lr==null?void 0:Lr.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(te,{className:"text-gray-300 text-sm",children:"排序序号(数字越小越靠前)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:1",value:cl,onChange:M=>dl(M.target.value)})]}),s.jsxs(rn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>Rr(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Xn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:ue,disabled:oi,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),oi?"保存中...":"保存"]})]})]})}),s.jsx(Dt,{open:tr,onOpenChange:M=>{Ki(M),M||Ta(null)},children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(Uc,{className:"w-5 h-5 text-amber-400"}),"设置超级个体标签 — ",Ea==null?void 0:Ea.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(te,{className:"text-gray-300 text-sm",children:"选择或输入标签"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:il.map(M=>s.jsx(J,{variant:Pr===M?"default":"outline",size:"sm",className:Pr===M?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50",onClick:()=>Ma(M),children:M},M))}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"或手动输入"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创业者、资源整合者等",value:Pr,onChange:M=>Ma(M.target.value)})]})]}),s.jsxs(rn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>Ki(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Xn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:()=>ol(Pr),disabled:rl,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),rl?"保存中...":"保存"]})]})]})}),s.jsx(Dt,{open:si,onOpenChange:M=>{na(M),M||Ia(null)},children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-xl",children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(sn,{className:"w-5 h-5 text-[#38bdac]"}),"设置飞书群 Webhook — ",Aa==null?void 0:Aa.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(te,{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:ri,onChange:M=>al(M.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"当用户点击该超级个体头像并提交链接时,线索将优先推送到这里配置的飞书群。"})]}),s.jsxs(rn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>na(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Xn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:ll,disabled:ss,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),ss?"保存中...":"保存"]})]})]})}),s.jsx(Dt,{open:I,onOpenChange:Y,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[F?s.jsx(sn,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(Vc,{className:"w-5 h-5 text-[#38bdac]"}),F?"编辑用户":"添加用户"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"手机号"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:pt.phone,onChange:M=>It({...pt,phone:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"昵称"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:pt.nickname,onChange:M=>It({...pt,nickname:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:F?"新密码 (留空则不修改)":"密码"}),s.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:F?"留空则不修改":"请输入密码",value:pt.password,onChange:M=>It({...pt,password:M.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(te,{className:"text-gray-300",children:"管理员权限"}),s.jsx(Ut,{checked:pt.isAdmin,onCheckedChange:M=>It({...pt,isAdmin:M})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(te,{className:"text-gray-300",children:"已购全书"}),s.jsx(Ut,{checked:pt.hasFullBook,onCheckedChange:M=>It({...pt,hasFullBook:M})})]})]}),s.jsxs(rn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>Y(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Xn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:Ca,disabled:X,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),X?"保存中...":"保存"]})]})]})}),s.jsx(Dt,{open:xn,onOpenChange:En,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[90vh] overflow-y-auto",children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(sn,{className:"w-5 h-5 text-[#38bdac]"}),Vn?"编辑规则":"添加规则"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"规则标题 *"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:匹配后填写头像、付款1980需填写信息",value:Rt.title,onChange:M=>yn({...Rt,title:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"规则描述"}),s.jsx(ec,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[60px] resize-none",placeholder:"弹窗内容/推送文案...",value:Rt.description,onChange:M=>yn({...Rt,description:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"触发条件(可多选)"}),s.jsx("div",{className:"space-y-2",children:["用户状态","阅读行为","付费行为","社交行为","分销行为"].map(M=>{const ee=iN.filter(be=>be.group===M);return ee.length===0?null:s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] text-gray-500 mb-1",children:M}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:ee.map(be=>{const Ae=(Rt.triggerConditions||[]).includes(be.value);return s.jsx("button",{type:"button",className:`px-2.5 py-1 rounded-md text-xs border transition-colors ${Ae?"bg-[#38bdac]/20 border-[#38bdac]/50 text-[#38bdac]":"bg-[#0a1628] border-gray-700 text-gray-400 hover:border-gray-500"}`,onClick:()=>{const Ge=Rt.triggerConditions||[],Je=Ae?Ge.filter(Vt=>Vt!==be.value):[...Ge,be.value];yn({...Rt,triggerConditions:Je})},children:be.label},be.value)})})]},M)})}),(Rt.triggerConditions||[]).length>0&&s.jsxs("p",{className:"text-[10px] text-[#38bdac]",children:["已选 ",(Rt.triggerConditions||[]).length," 个触发条件(满足任一即触发)"]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{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:Rt.trigger,onChange:M=>yn({...Rt,trigger:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"推送动作"}),s.jsx("div",{className:"grid grid-cols-2 gap-2",children:oN.map(M=>s.jsxs("button",{type:"button",className:`p-2 rounded-lg border text-left transition-colors ${Rt.actionType===M.value?"bg-[#38bdac]/15 border-[#38bdac]/50":"bg-[#0a1628] border-gray-700 hover:border-gray-500"}`,onClick:()=>yn({...Rt,actionType:M.value}),children:[s.jsx("span",{className:`text-xs font-medium ${Rt.actionType===M.value?"text-[#38bdac]":"text-gray-300"}`,children:M.label}),s.jsx("p",{className:"text-[10px] text-gray-500 mt-0.5",children:M.desc})]},M.value))})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{children:s.jsx(te,{className:"text-gray-300",children:"启用状态"})}),s.jsx(Ut,{checked:Rt.enabled,onCheckedChange:M=>yn({...Rt,enabled:M})})]})]}),s.jsxs(rn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>En(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Xn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:gd,disabled:X,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),X?"保存中...":"保存"]})]})]})}),s.jsx(Dt,{open:W,onOpenChange:fe,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(Un,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系 - ",_==null?void 0:_.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:((vd=he.stats)==null?void 0:vd.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:((Nd=he.stats)==null?void 0:Nd.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:["¥",(((wd=he.stats)==null?void 0:wd.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:["¥",(((jd=he.stats)==null?void 0:jd.pendingEarnings)||0).toFixed(2)]}),s.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),D?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(He,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((kd=he.referrals)==null?void 0:kd.length)??0)>0?s.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(he.referrals??[]).map((M,ee)=>{var Ae;const be=M;return s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg p-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:((Ae=be.nickname)==null?void 0:Ae.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white text-sm",children:be.nickname}),s.jsx("div",{className:"text-xs text-gray-500",children:be.phone||(be.hasOpenId?"微信用户":"未绑定")})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[be.status==="vip"&&s.jsx(Be,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),be.status==="paid"&&s.jsxs(Be,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",be.purchasedSections,"章"]}),be.status==="free"&&s.jsx(Be,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),s.jsx("span",{className:"text-xs text-gray-500",children:be.createdAt?new Date(be.createdAt).toLocaleDateString():""})]})]},be.id||ee)})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),s.jsx(rn,{children:s.jsx(J,{variant:"outline",onClick:()=>fe(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),s.jsx(uy,{open:re,onClose:()=>we(!1),userId:Fe,onUserUpdated:Xs}),s.jsx(Dt,{open:Vi,onOpenChange:ei,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700/60 text-white max-w-2xl",children:[s.jsx(_t,{children:s.jsx($t,{className:"text-white",children:Hi})}),s.jsx("div",{className:"mt-2",children:s.jsx("pre",{className:"text-xs text-gray-200 bg-[#0a1628] border border-gray-700/60 rounded-lg p-3 max-h-[520px] overflow-auto whitespace-pre-wrap break-words",children:ja||"—"})}),s.jsxs(rn,{children:[s.jsx(J,{type:"button",variant:"outline",className:"border-gray-600 text-gray-200 hover:bg-gray-700/50 bg-transparent",onClick:async()=>{try{await navigator.clipboard.writeText(ja||""),G.success("已复制 data")}catch{G.error("复制失败,请手动复制")}},disabled:!ja,children:"复制 data"}),s.jsx(J,{type:"button",className:"bg-[#38bdac] hover:bg-[#2aa896] text-white",onClick:()=>ei(!1),children:"关闭"})]})]})})]})}function Rf(t,[e,n]){return Math.min(n,Math.max(e,t))}var E2=["PageUp","PageDown"],T2=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],M2={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},ud="Slider",[Qx,x8,y8]=oy(ud),[A2]=Wo(ud,[y8]),[b8,_p]=A2(ud),I2=y.forwardRef((t,e)=>{const{name:n,min:r=0,max:a=100,step:i=1,orientation:o="horizontal",disabled:c=!1,minStepsBetweenThumbs:u=0,defaultValue:h=[r],value:f,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:b=!1,form:N,...j}=t,v=y.useRef(new Set),k=y.useRef(0),C=o==="horizontal"?v8:N8,[R=[],O]=Fl({prop:f,defaultProp:h,onChange:se=>{var ie;(ie=[...v.current][k.current])==null||ie.focus(),m(se)}}),U=y.useRef(R);function P(se){const $=C8(R,se);Q(se,$)}function z(se){Q(se,k.current)}function L(){const se=U.current[k.current];R[k.current]!==se&&g(R)}function Q(se,$,{commit:ie}={commit:!1}){const le=A8(i),me=I8(Math.round((se-r)/i)*i+r,le),I=Rf(me,[r,a]);O((Y=[])=>{const F=k8(Y,I,$);if(M8(F,u*i)){k.current=F.indexOf(I);const ge=String(F)!==String(Y);return ge&&ie&&g(F),ge?F:Y}else return Y})}return s.jsx(b8,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:a,valueIndexToChangeRef:k,thumbs:v.current,values:R,orientation:o,form:N,children:s.jsx(Qx.Provider,{scope:t.__scopeSlider,children:s.jsx(Qx.Slot,{scope:t.__scopeSlider,children:s.jsx(C,{"aria-disabled":c,"data-disabled":c?"":void 0,...j,ref:e,onPointerDown:St(j.onPointerDown,()=>{c||(U.current=R)}),min:r,max:a,inverted:b,onSlideStart:c?void 0:P,onSlideMove:c?void 0:z,onSlideEnd:c?void 0:L,onHomeKeyDown:()=>!c&&Q(r,0,{commit:!0}),onEndKeyDown:()=>!c&&Q(a,R.length-1,{commit:!0}),onStepKeyDown:({event:se,direction:$})=>{if(!c){const me=E2.includes(se.key)||se.shiftKey&&T2.includes(se.key)?10:1,I=k.current,Y=R[I],F=i*me*$;Q(Y+F,I,{commit:!0})}}})})})})});I2.displayName=ud;var[P2,R2]=A2(ud,{startEdge:"left",endEdge:"right",size:"width",direction:1}),v8=y.forwardRef((t,e)=>{const{min:n,max:r,dir:a,inverted:i,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onStepKeyDown:h,...f}=t,[m,g]=y.useState(null),b=Jt(e,C=>g(C)),N=y.useRef(void 0),j=Lp(a),v=j==="ltr",k=v&&!i||!v&&i;function T(C){const R=N.current||m.getBoundingClientRect(),O=[0,R.width],P=hy(O,k?[n,r]:[r,n]);return N.current=R,P(C-R.left)}return s.jsx(P2,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:s.jsx(L2,{dir:j,"data-orientation":"horizontal",...f,ref:b,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:C=>{const R=T(C.clientX);o==null||o(R)},onSlideMove:C=>{const R=T(C.clientX);c==null||c(R)},onSlideEnd:()=>{N.current=void 0,u==null||u()},onStepKeyDown:C=>{const O=M2[k?"from-left":"from-right"].includes(C.key);h==null||h({event:C,direction:O?-1:1})}})})}),N8=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=Jt(e,f),g=y.useRef(void 0),b=!a;function N(j){const v=g.current||f.current.getBoundingClientRect(),k=[0,v.height],C=hy(k,b?[r,n]:[n,r]);return g.current=v,C(j-v.top)}return s.jsx(P2,{scope:t.__scopeSlider,startEdge:b?"bottom":"top",endEdge:b?"top":"bottom",size:"height",direction:b?1:-1,children:s.jsx(L2,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:j=>{const v=N(j.clientY);i==null||i(v)},onSlideMove:j=>{const v=N(j.clientY);o==null||o(v)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:j=>{const k=M2[b?"from-bottom":"from-top"].includes(j.key);u==null||u({event:j,direction:k?-1:1})}})})}),L2=y.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:a,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:c,onStepKeyDown:u,...h}=t,f=_p(ud,n);return s.jsx(Mt.span,{...h,ref:e,onKeyDown:St(t.onKeyDown,m=>{m.key==="Home"?(o(m),m.preventDefault()):m.key==="End"?(c(m),m.preventDefault()):E2.concat(T2).includes(m.key)&&(u(m),m.preventDefault())}),onPointerDown:St(t.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(g)?g.focus():r(m)}),onPointerMove:St(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&a(m)}),onPointerUp:St(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),i(m))})})}),O2="SliderTrack",D2=y.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=_p(O2,n);return s.jsx(Mt.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...r,ref:e})});D2.displayName=O2;var Yx="SliderRange",_2=y.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=_p(Yx,n),i=R2(Yx,n),o=y.useRef(null),c=Jt(e,o),u=a.values.length,h=a.values.map(g=>F2(g,a.min,a.max)),f=u>1?Math.min(...h):0,m=100-Math.max(...h);return s.jsx(Mt.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...r,ref:c,style:{...t.style,[i.startEdge]:f+"%",[i.endEdge]:m+"%"}})});_2.displayName=Yx;var Xx="SliderThumb",$2=y.forwardRef((t,e)=>{const n=x8(t.__scopeSlider),[r,a]=y.useState(null),i=Jt(e,c=>a(c)),o=y.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return s.jsx(w8,{...t,ref:i,index:o})}),w8=y.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:a,...i}=t,o=_p(Xx,n),c=R2(Xx,n),[u,h]=y.useState(null),f=Jt(e,T=>h(T)),m=u?o.form||!!u.closest("form"):!0,g=dy(u),b=o.values[r],N=b===void 0?0:F2(b,o.min,o.max),j=S8(r,o.values.length),v=g==null?void 0:g[c.size],k=v?E8(v,N,c.direction):0;return y.useEffect(()=>{if(u)return o.thumbs.add(u),()=>{o.thumbs.delete(u)}},[u,o.thumbs]),s.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${N}% + ${k}px)`},children:[s.jsx(Qx.ItemSlot,{scope:t.__scopeSlider,children:s.jsx(Mt.span,{role:"slider","aria-label":t["aria-label"]||j,"aria-valuemin":o.min,"aria-valuenow":b,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...i,ref:f,style:b===void 0?{display:"none"}:t.style,onFocus:St(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),m&&s.jsx(z2,{name:a??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:b},r)]})});$2.displayName=Xx;var j8="RadioBubbleInput",z2=y.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const a=y.useRef(null),i=Jt(a,r),o=cy(e);return y.useEffect(()=>{const c=a.current;if(!c)return;const u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(o!==e&&f){const m=new Event("input",{bubbles:!0});f.call(c,e),c.dispatchEvent(m)}},[o,e]),s.jsx(Mt.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});z2.displayName=j8;function k8(t=[],e,n){const r=[...t];return r[n]=e,r.sort((a,i)=>a-i)}function F2(t,e,n){const i=100/(n-e)*(t-e);return Rf(i,[0,100])}function S8(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 E8(t,e,n){const r=t/2,i=hy([0,50],[0,r]);return(r-i(e)*n)*n}function T8(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function M8(t,e){if(e>0){const n=T8(t);return Math.min(...n)>=e}return!0}function hy(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 A8(t){return(String(t).split(".")[1]||"").length}function I8(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var P8=I2,R8=D2,L8=_2,O8=$2;function D8({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(P8,{defaultValue:e,value:n,min:r,max:a,className:zt("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",t),...i,children:[s.jsx(R8,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:s.jsx(L8,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:o.length},(c,u)=>s.jsx(O8,{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 _8={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,withdrawFee:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function B2(t){const e=!!(t!=null&&t.embedded),[n,r]=y.useState(_8),[a,i]=y.useState(!0),[o,c]=y.useState(!1);y.useEffect(()=>{Oe("/api/admin/referral-settings").then(f=>{const m=f==null?void 0:f.data;m&&typeof m=="object"&&r({distributorShare:m.distributorShare??90,minWithdrawAmount:m.minWithdrawAmount??10,bindingDays:m.bindingDays??30,userDiscount:m.userDiscount??5,withdrawFee:m.withdrawFee??5,enableAutoWithdraw:m.enableAutoWithdraw??!1,vipOrderShareVip:m.vipOrderShareVip??20,vipOrderShareNonVip:m.vipOrderShareNonVip??10})}).catch(console.error).finally(()=>i(!1))},[]);const u=async()=>{c(!0);try{const f={distributorShare:Number(n.distributorShare)||0,minWithdrawAmount:Number(n.minWithdrawAmount)||0,bindingDays:Number(n.bindingDays)||0,userDiscount:Number(n.userDiscount)||0,withdrawFee:Number(n.withdrawFee)??5,enableAutoWithdraw:!!n.enableAutoWithdraw,vipOrderShareVip:Number(n.vipOrderShareVip)||20,vipOrderShareNonVip:Number(n.vipOrderShareNonVip)||10},m=await kt("/api/admin/referral-settings",f);if(!m||m.success===!1){G.error("保存失败: "+(m&&typeof m=="object"&&"error"in m?m.error:""));return}G.success(`✅ 分销配置已保存成功! ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - -• 小程序与网站的推广规则会一起生效 -• 绑定关系会使用新的天数配置 -• 佣金比例会立即应用到新订单 - -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js -如有缓存,请刷新前台/小程序页面。`)}catch(f){console.error(f),G.error("保存失败: "+(f instanceof Error?f.message:String(f)))}finally{c(!1)}},h=f=>m=>{const g=parseFloat(m.target.value||"0");r(b=>({...b,[f]:isNaN(g)?0:g}))};return a?s.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):s.jsxs("div",{className:e?"p-4 w-full":"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Qc,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置(与系统设置中的「推广功能」开关配合:开关在"," ",s.jsx(_l,{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(Tn,{className:"w-4 h-4 mr-2"}),o?"保存中...":"保存配置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"flex items-center gap-2 text-white",children:[s.jsx(QM,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),s.jsx(qt,{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(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Hh,{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(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Kn,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx($8,{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(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Hh,{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(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Hh,{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(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Kn,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"flex items-center gap-2 text-white",children:[s.jsx(Qc,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),s.jsx(qt,{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(te,{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(te,{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(te,{className:"text-gray-300 flex items-center gap-2",children:["自动提现开关",s.jsx(Be,{variant:"outline",className:"border-[#38bdac]/40 text-[#38bdac] text-[10px]",children:"预留"})]}),s.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[s.jsx(Ut,{checked:n.enableAutoWithdraw,onCheckedChange:f=>r(m=>({...m,enableAutoWithdraw:f}))}),s.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(ut,{children:s.jsxs(ht,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[s.jsx(Hh,{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 F8(){const[t]=X0(),e=qa(),[n,r]=y.useState("overview"),[a,i]=y.useState("orders"),[o,c]=y.useState([]),[u,h]=y.useState(null),[f,m]=y.useState([]),[g,b]=y.useState([]),[N,j]=y.useState([]),[v,k]=y.useState(!0),[T,C]=y.useState(null),[R,O]=y.useState(""),[U,I]=y.useState("all"),[z,L]=y.useState(1),[Q,se]=y.useState(10),[$,ie]=y.useState(0),[le,me]=y.useState(new Set),[P,Y]=y.useState(null),[F,ge]=y.useState(""),[X,B]=y.useState(!1),[W,fe]=y.useState(null),[he,de]=y.useState(""),[D,q]=y.useState(!1),[_,Z]=y.useState(!1),[re,we]=y.useState(!1),[Fe,Ue]=y.useState([]),[jt,jn]=y.useState(1),[pt,Pt]=y.useState(0),[pn,Hn]=y.useState("");y.useEffect(()=>{t.get("tab")==="leads"&&e("/users?tab=leads",{replace:!0})},[t,e]),y.useEffect(()=>{mn()},[]),y.useEffect(()=>{const H=t.get("tab");(H==="overview"||H==="orders"||H==="bindings"||H==="withdrawals"||H==="settings")&&r(H)},[t]),y.useEffect(()=>{L(1)},[n,U]),y.useEffect(()=>{Wt(n)},[n]),y.useEffect(()=>{if(n==="orders"&&a==="giftpay"){Wt("giftPay",!0);return}["orders","bindings","withdrawals"].includes(n)&&Wt(n,!0)},[z,Q,U,R,n,a,jt,pn]),y.useEffect(()=>{n==="withdrawals"&&Rt()},[n]);async function mn(){C(null);try{const H=await Oe("/api/admin/distribution/overview");H!=null&&H.success&&H.overview&&h(H.overview)}catch(H){console.error("[Admin] 概览接口异常:",H),C("加载概览失败")}try{const H=await Oe("/api/db/users");j((H==null?void 0:H.users)||[])}catch(H){console.error("[Admin] 用户数据加载失败:",H)}}async function Wt(H,Qe=!1){var vt;if(!(!Qe&&le.has(H))){k(!0);try{const Ft=N;switch(H){case"overview":break;case"orders":{try{const yt=new URLSearchParams({page:String(z),pageSize:String(Q),...U!=="all"&&{status:U},...R&&{search:R}}),bt=await Oe(`/api/admin/orders?${yt}`);if(bt!=null&&bt.success&&bt.orders){const It=bt.orders.map(Qt=>{const kn=Ft.find(mr=>mr.id===Qt.userId),zs=Qt.referrerId?Ft.find(mr=>mr.id===Qt.referrerId):null;return{...Qt,amount:parseFloat(String(Qt.amount))||0,userNickname:(kn==null?void 0:kn.nickname)||Qt.userNickname||"未知用户",userPhone:(kn==null?void 0:kn.phone)||Qt.userPhone||"-",referrerNickname:(zs==null?void 0:zs.nickname)||null,referrerCode:(zs==null?void 0:zs.referralCode)??null,type:Qt.productType||Qt.type}});c(It),ie(bt.total??It.length)}else c([]),ie(0)}catch(yt){console.error(yt),C("加载订单失败"),c([])}break}case"bindings":{try{const yt=new URLSearchParams({page:String(z),pageSize:String(Q),...U!=="all"&&{status:U}}),bt=await Oe(`/api/db/distribution?${yt}`);m((bt==null?void 0:bt.bindings)||[]),ie((bt==null?void 0:bt.total)??((vt=bt==null?void 0:bt.bindings)==null?void 0:vt.length)??0)}catch(yt){console.error(yt),C("加载绑定数据失败"),m([])}break}case"withdrawals":{try{const yt=U==="completed"?"success":U==="rejected"?"failed":U,bt=new URLSearchParams({...yt&&yt!=="all"&&{status:yt},page:String(z),pageSize:String(Q)}),It=await Oe(`/api/admin/withdrawals?${bt}`);if(It!=null&&It.success&&It.withdrawals){const Qt=It.withdrawals.map(kn=>({...kn,account:kn.account??"未绑定微信号",status:kn.status==="success"?"completed":kn.status==="failed"?"rejected":kn.status}));b(Qt),ie((It==null?void 0:It.total)??Qt.length)}else It!=null&&It.success||C(`获取提现记录失败: ${(It==null?void 0:It.error)||"未知错误"}`),b([])}catch(yt){console.error(yt),C("加载提现数据失败"),b([])}break}case"giftPay":{try{const yt=new URLSearchParams({page:String(jt),pageSize:"20",...pn&&{status:pn}}),bt=await Oe(`/api/admin/gift-pay-requests?${yt}`);bt!=null&&bt.success&&bt.data?(Ue(bt.data),Pt(bt.total??bt.data.length)):(Ue([]),Pt(0))}catch(yt){console.error(yt),C("加载代付请求失败"),Ue([])}break}}me(yt=>new Set(yt).add(H))}catch(Ft){console.error(Ft)}finally{k(!1)}}}async function bn(){C(null),me(H=>{const Qe=new Set(H);return Qe.delete(n),n==="orders"&&a==="giftpay"&&Qe.delete("giftPay"),Qe}),n==="overview"&&mn(),n==="orders"&&a==="giftpay"?await Wt("giftPay",!0):await Wt(n,!0)}async function Mn(H){if(confirm("确认审核通过并打款?"))try{const Qe=await Xt("/api/admin/withdrawals",{id:H,action:"approve"});if(!(Qe!=null&&Qe.success)){const vt=(Qe==null?void 0:Qe.message)||(Qe==null?void 0:Qe.error)||"操作失败";G.error(vt);return}await bn()}catch(Qe){console.error(Qe),G.error("操作失败")}}function Un(H){fe(H),de("")}async function ns(){const H=W;if(!H)return;const Qe=he.trim();if(!Qe){G.error("请填写拒绝原因");return}q(!0);try{const vt=await Xt("/api/admin/withdrawals",{id:H,action:"reject",errorMessage:Qe});if(!(vt!=null&&vt.success)){G.error((vt==null?void 0:vt.error)||"操作失败");return}G.success("已拒绝该提现申请"),fe(null),de(""),await bn()}catch(vt){console.error(vt),G.error("操作失败")}finally{q(!1)}}async function Rt(){try{const H=await Oe("/api/admin/withdrawals/auto-approve");H!=null&&H.success&&typeof H.enableAutoApprove=="boolean"&&Z(H.enableAutoApprove)}catch{}}async function vn(H){we(!0);try{const Qe=await Xt("/api/admin/withdrawals/auto-approve",{enableAutoApprove:H});Qe!=null&&Qe.success?(Z(H),G.success(H?"已开启自动审批,新提现将自动打款":"已关闭自动审批")):G.error("更新失败: "+((Qe==null?void 0:Qe.error)??""))}catch{G.error("更新失败")}finally{we(!1)}}function Ne(){W&&G.info("已取消操作"),fe(null),de("")}async function Me(){var H;if(!(!(P!=null&&P.orderSn)&&!(P!=null&&P.id))){B(!0),C(null);try{const Qe=await Xt("/api/admin/orders/refund",{orderSn:P.orderSn||P.id,reason:F||void 0});Qe!=null&&Qe.success?(Y(null),ge(""),await Wt("orders",!0)):C((Qe==null?void 0:Qe.error)||"退款失败")}catch(Qe){const vt=Qe;C(((H=vt==null?void 0:vt.data)==null?void 0:H.error)||"退款失败,请检查网络后重试")}finally{B(!1)}}}function We(H){const Qe={active:"bg-green-500/20 text-green-400",converted:"bg-blue-500/20 text-blue-400",expired:"bg-gray-500/20 text-gray-400",cancelled:"bg-red-500/20 text-red-400",pending:"bg-orange-500/20 text-orange-400",pending_confirm:"bg-orange-500/20 text-orange-400",processing:"bg-blue-500/20 text-blue-400",completed:"bg-green-500/20 text-green-400",rejected:"bg-red-500/20 text-red-400"},vt={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return s.jsx(Be,{className:`${Qe[H]||"bg-gray-500/20 text-gray-400"} border-0`,children:vt[H]||H})}const at=Math.ceil($/Q)||1,Lt=o,Ct=f.filter(H=>{var vt,Ft,yt,bt;if(!R)return!0;const Qe=R.toLowerCase();return((vt=H.refereeNickname)==null?void 0:vt.toLowerCase().includes(Qe))||((Ft=H.refereePhone)==null?void 0:Ft.includes(Qe))||((yt=H.referrerName)==null?void 0:yt.toLowerCase().includes(Qe))||((bt=H.referrerCode)==null?void 0:bt.toLowerCase().includes(Qe))}),$e=g.filter(H=>{var vt;if(!R)return!0;const Qe=R.toLowerCase();return((vt=H.userName)==null?void 0:vt.toLowerCase().includes(Qe))||H.account&&H.account.toLowerCase().includes(Qe)});return s.jsxs("div",{className:"p-8 w-full",children:[T&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[s.jsx("span",{children:T}),s.jsx("button",{type:"button",onClick:()=>C(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-semibold text-white",children:"推广中心"}),s.jsx("p",{className:"text-gray-500 text-sm mt-0.5",children:"分销绑定、提现审核、推广设置"})]}),s.jsxs(J,{onClick:bn,disabled:v,variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[s.jsx(He,{className:`w-3.5 h-3.5 mr-1.5 ${v?"animate-spin":""}`}),"刷新"]})]}),s.jsx("div",{className:"flex gap-1 mb-6 bg-[#0a1628] rounded-lg p-1 border border-gray-700/40",children:[{key:"overview",label:"数据概览",icon:Mf},{key:"orders",label:"订单与代付",icon:Ef},{key:"bindings",label:"绑定管理",icon:Ai},{key:"withdrawals",label:"提现审核",icon:Qc},{key:"settings",label:"推广设置",icon:Co}].map(H=>s.jsxs("button",{type:"button",onClick:()=>{r(H.key),I("all"),O(""),H.key!=="orders"&&i("orders")},className:`flex-1 flex items-center justify-center gap-1.5 px-3 py-2 rounded-md text-sm transition-all ${n===H.key?"bg-[#38bdac] text-white shadow-md":"text-gray-400 hover:text-white hover:bg-gray-700/40"}`,children:[s.jsx(H.icon,{className:"w-3.5 h-3.5"}),H.label]},H.key))}),v?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(He,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[n==="overview"&&u&&s.jsxs("div",{className:"space-y-6",children:[s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("span",{className:"text-sm font-medium text-gray-300 flex items-center gap-2",children:[s.jsx($o,{className:"w-4 h-4 text-amber-400"}),"推广转化漏斗"]}),s.jsx(J,{type:"button",size:"sm",variant:"ghost",onClick:()=>void bn(),disabled:v,className:"text-gray-400 h-7",children:s.jsx(He,{className:`w-3.5 h-3.5 ${v?"animate-spin":""}`})})]}),s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"text-gray-500 text-xs border-b border-gray-700/50",children:[s.jsx("th",{className:"pb-2 text-left font-normal",children:"指标"}),s.jsx("th",{className:"pb-2 text-right font-normal",children:"今日"}),s.jsx("th",{className:"pb-2 text-right font-normal",children:"本月"}),s.jsx("th",{className:"pb-2 text-right font-normal",children:"累计"})]})}),s.jsxs("tbody",{className:"text-white",children:[s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(Tf,{className:"w-4 h-4 text-blue-400"}),"点击数"]}),s.jsx("td",{className:"py-2.5 text-right font-bold",children:u.todayClicks}),s.jsx("td",{className:"py-2.5 text-right",children:u.monthClicks}),s.jsx("td",{className:"py-2.5 text-right",children:u.totalClicks})]}),s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(Ai,{className:"w-4 h-4 text-green-400"}),"绑定关系"]}),s.jsx("td",{className:"py-2.5 text-right font-bold",children:u.todayBindings}),s.jsx("td",{className:"py-2.5 text-right",children:u.monthBindings}),s.jsx("td",{className:"py-2.5 text-right",children:u.totalBindings})]}),s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx($g,{className:"w-4 h-4 text-purple-400"}),"付款转化"]}),s.jsx("td",{className:"py-2.5 text-right font-bold",children:u.todayConversions}),s.jsx("td",{className:"py-2.5 text-right",children:u.monthConversions}),s.jsx("td",{className:"py-2.5 text-right",children:u.totalConversions})]}),s.jsxs("tr",{children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(Ef,{className:"w-4 h-4 text-[#38bdac]"}),"佣金收入"]}),s.jsxs("td",{className:"py-2.5 text-right font-bold text-[#38bdac]",children:["¥",(u.todayEarnings??0).toFixed(0)]}),s.jsxs("td",{className:"py-2.5 text-right text-[#38bdac]",children:["¥",(u.monthEarnings??0).toFixed(0)]}),s.jsxs("td",{className:"py-2.5 text-right text-[#38bdac]",children:["¥",(u.totalEarnings??0).toFixed(0)]})]})]})]})}),u.conversionRate&&s.jsxs("p",{className:"text-xs text-gray-500 mt-3 text-right",children:["综合转化率 ",u.conversionRate]})]})}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(De,{className:"bg-orange-500/10 border-orange-500/30",children:s.jsx(_e,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Fx,{className:"w-5 h-5 text-orange-400 shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-orange-300 font-medium text-sm",children:"即将过期绑定"}),s.jsxs("p",{className:"text-xl font-bold text-white",children:[u.expiringBindings," ",s.jsx("span",{className:"text-sm font-normal text-orange-300/60",children:"个 · 7天内"})]})]})]})})}),s.jsx(De,{className:"bg-blue-500/10 border-blue-500/30",children:s.jsx(_e,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Qc,{className:"w-5 h-5 text-blue-400 shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-blue-300 font-medium text-sm",children:"待审核提现"}),s.jsxs("p",{className:"text-xl font-bold text-white",children:[u.pendingWithdrawals," ",s.jsxs("span",{className:"text-sm font-normal text-blue-300/60",children:["笔 · ¥",(u.pendingWithdrawAmount??0).toFixed(0)]})]})]}),s.jsx(J,{onClick:()=>r("withdrawals"),variant:"outline",size:"sm",className:"border-blue-500/50 text-blue-400 hover:bg-blue-500/20 shrink-0",children:"去审核"})]})})})]}),s.jsx(De,{className:"bg-emerald-500/10 border-emerald-500/30",children:s.jsxs(_e,{className:"p-4 flex flex-wrap items-center justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-emerald-300 font-medium text-sm",children:"获客线索(存客宝)"}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"留资列表、推送状态与重试已统一至「用户管理 → 获客列表」,避免与推广中心重复维护。"})]}),s.jsx(_l,{to:"/users?tab=leads",className:"shrink-0",children:s.jsx(J,{type:"button",variant:"outline",size:"sm",className:"border-emerald-500/50 text-emerald-400 hover:bg-emerald-500/15 bg-transparent",children:"打开获客列表"})})]})}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-4",children:s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-white/5",children:[s.jsx(Kn,{className:"w-5 h-5 text-gray-400 shrink-0"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-lg font-bold text-white",children:u.totalDistributors}),s.jsx("p",{className:"text-[10px] text-gray-500",children:"推广用户"})]})]}),s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-white/5",children:[s.jsx($g,{className:"w-5 h-5 text-green-400 shrink-0"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-lg font-bold text-green-400",children:u.activeDistributors}),s.jsx("p",{className:"text-[10px] text-gray-500",children:"有收益用户"})]})]})]})})})]}),n==="orders"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2 mb-2",children:[s.jsx("button",{type:"button",className:`px-3 py-1.5 rounded-md text-xs font-medium transition-all ${a==="orders"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,onClick:()=>i("orders"),children:"普通订单"}),s.jsxs("button",{type:"button",className:`px-3 py-1.5 rounded-md text-xs font-medium transition-all ${a==="giftpay"?"bg-amber-500/20 text-amber-400 border border-amber-500/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,onClick:()=>{i("giftpay"),Wt("giftPay",!0)},children:[s.jsx(Bx,{className:"w-3 h-3 inline mr-1"}),"代付请求"]})]}),a==="orders"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(xa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ce,{value:R,onChange:H=>O(H.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:U,onChange:H=>I(H.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 bn(),disabled:v,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${v?"animate-spin":""}`}),"刷新"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-0",children:[o.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无订单数据"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"订单号"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"商品"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"支付方式"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"退款原因"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"推荐人/邀请码"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"分销佣金"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"下单时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Lt.map(H=>{var Qe,vt;return s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsxs("td",{className:"p-4 font-mono text-xs text-gray-400",children:[(Qe=H.id)==null?void 0:Qe.slice(0,12),"..."]}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:H.userNickname}),s.jsx("p",{className:"text-gray-500 text-xs",children:H.userPhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:(()=>{const Ft=H.productType||H.type,yt=H.description||"",bt=String(H.productId||H.sectionId||""),It=Ft==="vip"||yt.includes("VIP")||yt.toLowerCase().includes("vip")||bt.toLowerCase().includes("vip");return Ft==="balance_recharge"?`余额充值 ¥${typeof H.amount=="number"?H.amount.toFixed(2):parseFloat(String(H.amount||"0")).toFixed(2)}`:It?"超级个体开通费用":Ft==="fullbook"?`${H.bookName||"《底层逻辑》"} - 全本`:Ft==="match"?"匹配次数购买":`${H.bookName||"《底层逻辑》"} - ${H.sectionTitle||H.chapterTitle||`章节${H.productId||H.sectionId||""}`}`})()}),s.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const Ft=H.productType||H.type,yt=H.description||"",bt=String(H.productId||H.sectionId||""),It=Ft==="vip"||yt.includes("VIP")||yt.toLowerCase().includes("vip")||bt.toLowerCase().includes("vip");return Ft==="balance_recharge"?"余额充值":It?"超级个体":Ft==="fullbook"?"全书解锁":Ft==="match"?"功能权益":H.chapterTitle||"单章购买"})()})]})}),s.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof H.amount=="number"?H.amount.toFixed(2):parseFloat(String(H.amount||"0")).toFixed(2)]}),s.jsx("td",{className:"p-4 text-gray-300",children:H.paymentMethod==="wechat"?"微信支付":H.paymentMethod==="balance"?"余额支付":H.paymentMethod==="alipay"?"支付宝":H.paymentMethod||"微信支付"}),s.jsx("td",{className:"p-4",children:H.status==="refunded"?s.jsx(Be,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):H.status==="completed"||H.status==="paid"?s.jsx(Be,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):H.status==="pending"||H.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:H.refundReason,children:H.status==="refunded"&&H.refundReason?H.refundReason:"-"}),s.jsx("td",{className:"p-4 text-gray-300 text-sm",children:H.referrerId||H.referralCode?s.jsxs("span",{title:H.referralCode||H.referrerCode||H.referrerId||"",children:[H.referrerNickname||H.referralCode||H.referrerCode||((vt=H.referrerId)==null?void 0:vt.slice(0,8)),(H.referralCode||H.referrerCode)&&` (${H.referralCode||H.referrerCode})`]}):"-"}),s.jsx("td",{className:"p-4 text-[#FFD700]",children:H.referrerEarnings?`¥${(typeof H.referrerEarnings=="number"?H.referrerEarnings:parseFloat(String(H.referrerEarnings))).toFixed(2)}`:"-"}),s.jsx("td",{className:"p-4 text-gray-400 text-sm",children:H.createdAt?new Date(H.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:(H.status==="paid"||H.status==="completed")&&s.jsxs(J,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{Y(H),ge("")},children:[s.jsx(ik,{className:"w-3 h-3 mr-1"}),"退款"]})})]},H.id)})})]})}),n==="orders"&&s.jsx(qs,{page:z,totalPages:at,total:$,pageSize:Q,onPageChange:L,onPageSizeChange:H=>{se(H),L(1)}})]})})]}),a==="giftpay"&&s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(ut,{children:s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[s.jsx(ht,{className:"text-white text-base",children:"代付请求列表"}),s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsxs("select",{className:"bg-[#0a1628] border border-gray-700 text-white rounded px-3 py-1.5 text-sm",value:pn,onChange:H=>{Hn(H.target.value),jn(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 Wt("giftPay",!0),disabled:v,className:"border-gray-600 text-gray-300",children:[s.jsx(He,{className:`w-3.5 h-3.5 mr-1 ${v?"animate-spin":""}`}),"刷新"]})]})]})}),s.jsxs(_e,{children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"请求号"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"发起人"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"商品/金额"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"份数/已领"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"付款人"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"状态"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"创建时间"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Fe.map(H=>s.jsxs("tr",{className:"hover:bg-[#0a1628]",children:[s.jsx("td",{className:"p-3 font-mono text-xs text-gray-400",children:H.requestSn}),s.jsx("td",{className:"p-3 text-white text-sm",children:H.initiatorNick||H.initiatorUserId}),s.jsxs("td",{className:"p-3",children:[s.jsxs("p",{className:"text-white",children:[H.productType," · ¥",H.amount.toFixed(2)]}),H.description&&s.jsx("p",{className:"text-gray-500 text-xs",children:H.description})]}),s.jsx("td",{className:"p-3 text-gray-400",children:(H.quantity??1)>1?`${H.quantity}份 / 已领${H.redeemedCount??0}`:"-"}),s.jsx("td",{className:"p-3 text-gray-400",children:H.payerNick||(H.payerUserId?H.payerUserId:"-")}),s.jsx("td",{className:"p-3",children:s.jsx(Be,{className:H.status==="paid"?"bg-green-500/20 text-green-400 border-0":H.status==="pending"||H.status==="pending_pay"?"bg-amber-500/20 text-amber-400 border-0":H.status==="refunded"?"bg-red-500/20 text-red-400 border-0":"bg-gray-500/20 text-gray-400 border-0",children:H.status==="paid"?"已支付":H.status==="pending"||H.status==="pending_pay"?"待支付":H.status==="refunded"?"已退款":H.status==="cancelled"?"已取消":"已过期"})}),s.jsx("td",{className:"p-3 text-gray-400 text-xs",children:H.createdAt?new Date(H.createdAt).toLocaleString("zh-CN"):"-"})]},H.id))})]})}),Fe.length===0&&!v&&s.jsx("p",{className:"text-center py-8 text-gray-500",children:"暂无代付请求"}),pt>20&&s.jsx("div",{className:"mt-4 flex justify-center",children:s.jsx(qs,{page:jt,totalPages:Math.ceil(pt/20),total:pt,pageSize:20,onPageChange:jn,onPageSizeChange:()=>{}})})]})]})]}),n==="bindings"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(xa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ce,{value:R,onChange:H=>O(H.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:U,onChange:H=>I(H.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 bn(),disabled:v,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${v?"animate-spin":""}`}),"刷新"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-0",children:[Ct.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无绑定数据"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"访客"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"分销商"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"绑定时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"到期时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"佣金"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Ct.map(H=>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:H.refereeNickname||"匿名用户"}),s.jsx("p",{className:"text-gray-500 text-xs",children:H.refereePhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white",children:H.referrerName||"-"}),s.jsx("p",{className:"text-gray-500 text-xs font-mono",children:H.referrerCode})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:H.boundAt?new Date(H.boundAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:H.expiresAt?new Date(H.expiresAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:We(H.status)}),s.jsx("td",{className:"p-4",children:H.commission?s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",H.commission.toFixed(2)]}):s.jsx("span",{className:"text-gray-500",children:"-"})})]},H.id))})]})}),n==="bindings"&&s.jsx(qs,{page:z,totalPages:at,total:$,pageSize:Q,onPageChange:L,onPageSizeChange:H=>{se(H),L(1)}})]})})]}),n==="withdrawals"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(xa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ce,{value:R,onChange:H=>O(H.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:U,onChange:H=>I(H.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($o,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-sm text-gray-300",children:"自动审批"}),s.jsx(Ut,{checked:_,onCheckedChange:vn,disabled:re,className:"data-[state=checked]:bg-[#38bdac]"})]}),s.jsxs(J,{type:"button",variant:"outline",onClick:()=>void bn(),disabled:v,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${v?"animate-spin":""}`}),"刷新"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-0",children:[$e.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无提现记录"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"申请人"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"收款方式"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"收款账号"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"备注"}),s.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:$e.map(H=>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:[H.userAvatar?s.jsx("img",{src:H.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:(H.userName||H.name||"?").slice(0,1)}),s.jsx("p",{className:"text-white font-medium",children:H.userName||H.name})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",H.amount.toFixed(2)]})}),s.jsx("td",{className:"p-4",children:s.jsx(Be,{className:H.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:H.method==="wechat"?"微信":"支付宝"})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-mono text-xs",children:H.account}),s.jsx("p",{className:"text-gray-500 text-xs",children:H.name})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:H.createdAt?new Date(H.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:We(H.status)}),s.jsx("td",{className:"p-4 max-w-[160px]",children:s.jsx("span",{className:`text-xs ${H.status==="rejected"||H.status==="failed"?"text-red-400":"text-gray-400"}`,title:H.remark,children:H.remark||"-"})}),s.jsx("td",{className:"p-4 text-right",children:H.status==="pending"&&s.jsxs("div",{className:"flex gap-2 justify-end",children:[s.jsxs(J,{size:"sm",onClick:()=>Mn(H.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx($g,{className:"w-4 h-4 mr-1"}),"通过"]}),s.jsxs(J,{size:"sm",variant:"outline",onClick:()=>Un(H.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[s.jsx(Zj,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},H.id))})]})}),n==="withdrawals"&&s.jsx(qs,{page:z,totalPages:at,total:$,pageSize:Q,onPageChange:L,onPageSizeChange:H=>{se(H),L(1)}})]})})]})]}),s.jsx(Dt,{open:!!P,onOpenChange:H=>!H&&Y(null),children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(_t,{children:s.jsx($t,{className:"text-white",children:"订单退款"})}),P&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",P.orderSn||P.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof P.amount=="number"?P.amount.toFixed(2):parseFloat(String(P.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:F,onChange:H=>ge(H.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>Y(null),disabled:X,children:"取消"}),s.jsx(J,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:Me,disabled:X,children:X?"退款中...":"确认退款"})]})]})}),s.jsx(Dt,{open:!!W,onOpenChange:H=>!H&&Ne(),children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(_t,{children:s.jsx($t,{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:he,onChange:H=>de(H.target.value)})})]})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:Ne,disabled:D,children:"取消"}),s.jsx(J,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:ns,disabled:D||!he.trim(),children:D?"提交中...":"确认拒绝"})]})]})}),n==="settings"&&s.jsx("div",{className:"-mx-8 -mt-6",children:s.jsx(H2,{embedded:!0})})]})}function B8(){const[t,e]=y.useState([]),[n,r]=y.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[a,i]=y.useState(!0),[o,c]=y.useState(null),[u,h]=y.useState("all"),[f,m]=y.useState(1),[g,b]=y.useState(10),[N,j]=y.useState(0),[v,k]=y.useState(null),[T,C]=y.useState(null),[R,O]=y.useState(""),[U,I]=y.useState(!1);async function z(){var P,Y,F,ge,X,B,W;i(!0),c(null);try{const fe=new URLSearchParams({status:u,page:String(f),pageSize:String(g)}),he=await Oe(`/api/admin/withdrawals?${fe}`);if(he!=null&&he.success){const de=he.withdrawals||[];e(de),j(he.total??((P=he.stats)==null?void 0:P.total)??de.length),r({total:((Y=he.stats)==null?void 0:Y.total)??he.total??de.length,pendingCount:((F=he.stats)==null?void 0:F.pendingCount)??0,pendingAmount:((ge=he.stats)==null?void 0:ge.pendingAmount)??0,successCount:((X=he.stats)==null?void 0:X.successCount)??0,successAmount:((B=he.stats)==null?void 0:B.successAmount)??0,failedCount:((W=he.stats)==null?void 0:W.failedCount)??0})}else c("加载提现记录失败")}catch(fe){console.error("Load withdrawals error:",fe),c("加载失败,请检查网络后重试")}finally{i(!1)}}y.useEffect(()=>{m(1)},[u]),y.useEffect(()=>{z()},[u,f,g]);const L=Math.ceil(N/g)||1;async function Q(P){const Y=t.find(F=>F.id===P);if(Y!=null&&Y.userCommissionInfo&&Y.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${Y.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。 - -确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;k(P);try{const F=await Xt("/api/admin/withdrawals",{id:P,action:"approve"});F!=null&&F.success?z():G.error("操作失败: "+((F==null?void 0:F.error)??""))}catch{G.error("操作失败")}finally{k(null)}}async function se(P){if(confirm("确认撤回该笔打款?仅在用户未确认收款前可撤回。")){k(P);try{const Y=await kt("/api/admin/withdrawals/cancel",{id:P});Y!=null&&Y.success?(G.success("已撤回打款"),z()):G.error("撤回失败: "+((Y==null?void 0:Y.error)??"未知错误"))}catch{G.error("撤回失败")}finally{k(null)}}}function $(P){C(P),O("")}async function ie(){const P=T;if(!P)return;const Y=R.trim();if(!Y){G.error("请填写拒绝原因");return}I(!0);try{const F=await Xt("/api/admin/withdrawals",{id:P,action:"reject",errorMessage:Y});F!=null&&F.success?(G.success("已拒绝该提现申请"),C(null),O(""),z()):G.error("操作失败: "+((F==null?void 0:F.error)??""))}catch{G.error("操作失败")}finally{I(!1)}}function le(){T&&G.info("已取消操作"),C(null),O("")}function me(P){switch(P){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:P})}}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:z,disabled:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${a?"animate-spin":""}`}),"刷新"]})]}),s.jsx(De,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:s.jsx(_e,{className:"p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Ef,{className:"w-5 h-5 text-[#38bdac] mt-0.5"}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-white font-medium mb-2",children:"自动分账规则"}),s.jsxs("div",{className:"text-sm text-gray-400 space-y-1",children:[s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"分销比例"}),":推广者获得订单金额的"," ",s.jsx("span",{className:"text-white font-medium",children:"90%"})]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"结算方式"}),":用户付款后,分销收益自动计入推广者账户"]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"提现方式"}),":用户在小程序端点击提现,系统自动转账到微信零钱"]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"审批流程"}),":待处理的提现需管理员手动确认打款后批准(自动审批开关在推广中心-提现审核)"]})]})]})]})})}),s.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-[#38bdac]",children:n.total}),s.jsx("div",{className:"text-sm text-gray-400",children:"总申请"})]})}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-orange-400",children:n.pendingCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"待处理"}),s.jsxs("div",{className:"text-xs text-orange-400 mt-1",children:["¥",n.pendingAmount.toFixed(2)]})]})}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-green-400",children:n.successCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"已完成"}),s.jsxs("div",{className:"text-xs text-green-400 mt-1",children:["¥",n.successAmount.toFixed(2)]})]})}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-red-400",children:n.failedCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"已拒绝"})]})})]}),s.jsx("div",{className:"flex gap-2 mb-4",children:["all","pending","processing","pending_confirm","success","failed"].map(P=>s.jsx(J,{variant:u===P?"default":"outline",size:"sm",onClick:()=>h(P),className:u===P?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:P==="all"?"全部":P==="pending"?"待处理":P==="processing"?"处理中":P==="pending_confirm"?"待确认收款":P==="success"?"已完成":"已拒绝"},P))}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:a?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.length===0?s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Qc,{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(P=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4 text-gray-400",children:new Date(P.createdAt??"").toLocaleString()}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[P.userAvatar?s.jsx("img",{src:ya(P.userAvatar),alt:P.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:(P.userName??"?").charAt(0)}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-white",children:P.userName??"未知"}),s.jsx("p",{className:"text-xs text-gray-500",children:P.userPhone??P.referralCode??(P.userId??"").slice(0,10)})]})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(P.amount).toFixed(2)]})}),s.jsx("td",{className:"p-4",children:P.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:["¥",P.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:["¥",P.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:["¥",P.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:P.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",P.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):s.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),s.jsx("td",{className:"p-4",children:me(P.status)}),s.jsx("td",{className:"p-4 max-w-[180px]",children:s.jsx("span",{className:`text-xs ${P.status==="rejected"||P.status==="failed"?"text-red-400":"text-gray-400"}`,title:P.remark,children:P.remark||"-"})}),s.jsx("td",{className:"p-4 text-gray-400",children:P.processedAt?new Date(P.processedAt).toLocaleString():"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:P.userConfirmedAt?s.jsxs("span",{className:"text-green-400",title:P.userConfirmedAt,children:["已确认 ",new Date(P.userConfirmedAt).toLocaleString()]}):"-"}),s.jsxs("td",{className:"p-4 text-right",children:[(P.status==="pending"||P.status==="pending_confirm")&&s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsxs(J,{size:"sm",onClick:()=>Q(P.id),disabled:v===P.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[s.jsx(Pp,{className:"w-4 h-4 mr-1"}),"批准"]}),s.jsxs(J,{size:"sm",variant:"outline",onClick:()=>$(P.id),disabled:v===P.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[s.jsx(es,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(P.status==="processing"||P.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:()=>se(P.id),disabled:v===P.id,className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:"撤回打款"})}),(P.status==="success"||P.status==="completed")&&P.transactionId&&s.jsx("span",{className:"text-xs text-gray-500 font-mono",children:P.transactionId})]})]},P.id))})]})}),s.jsx(qs,{page:f,totalPages:L,total:N,pageSize:g,onPageChange:m,onPageSizeChange:P=>{b(P),m(1)}})]})})}),s.jsx(Dt,{open:!!T,onOpenChange:P=>!P&&le(),children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(_t,{children:s.jsx($t,{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:P=>O(P.target.value)})})]})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:le,disabled:U,children:"取消"}),s.jsx(J,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:ie,disabled:U||!R.trim(),children:U?"提交中...":"确认拒绝"})]})]})})]})}var Yg={exports:{}},Xg={};/** -======== -如有缓存,请刷新前台/小程序页面。`)}catch(f){console.error(f),G.error("保存失败: "+(f instanceof Error?f.message:String(f)))}finally{c(!1)}},h=f=>m=>{const g=parseFloat(m.target.value||"0");r(b=>({...b,[f]:isNaN(g)?0:g}))};return a?s.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):s.jsxs("div",{className:e?"p-4 w-full":"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Jc,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置(与系统设置中的「推广功能」开关配合:开关在"," ",s.jsx(Dl,{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(Cn,{className:"w-4 h-4 mr-2"}),o?"保存中...":"保存配置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"flex items-center gap-2 text-white",children:[s.jsx(GM,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),s.jsx(qt,{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(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Vh,{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(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Un,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(D8,{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(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Vh,{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(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Vh,{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(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Un,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"flex items-center gap-2 text-white",children:[s.jsx(Jc,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),s.jsx(qt,{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(te,{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(te,{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(te,{className:"text-gray-300 flex items-center gap-2",children:["自动提现开关",s.jsx(Be,{variant:"outline",className:"border-[#38bdac]/40 text-[#38bdac] text-[10px]",children:"预留"})]}),s.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[s.jsx(Ut,{checked:n.enableAutoWithdraw,onCheckedChange:f=>r(m=>({...m,enableAutoWithdraw:f}))}),s.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(ut,{children:s.jsxs(ht,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[s.jsx(Vh,{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 $8(){const[t]=Q0(),e=Ka(),[n,r]=y.useState("overview"),[a,i]=y.useState("orders"),[o,c]=y.useState([]),[u,h]=y.useState(null),[f,m]=y.useState([]),[g,b]=y.useState([]),[N,j]=y.useState([]),[v,k]=y.useState(!0),[T,C]=y.useState(null),[R,O]=y.useState(""),[U,P]=y.useState("all"),[z,L]=y.useState(1),[Q,se]=y.useState(10),[$,ie]=y.useState(0),[le,me]=y.useState(new Set),[I,Y]=y.useState(null),[F,ge]=y.useState(""),[X,B]=y.useState(!1),[W,fe]=y.useState(null),[he,de]=y.useState(""),[D,q]=y.useState(!1),[_,Z]=y.useState(!1),[re,we]=y.useState(!1),[Fe,Ue]=y.useState([]),[jt,Nn]=y.useState(1),[pt,It]=y.useState(0),[hn,Bn]=y.useState("");y.useEffect(()=>{t.get("tab")==="leads"&&e("/users?tab=leads",{replace:!0})},[t,e]),y.useEffect(()=>{fn()},[]),y.useEffect(()=>{const H=t.get("tab");(H==="overview"||H==="orders"||H==="bindings"||H==="withdrawals"||H==="settings")&&r(H)},[t]),y.useEffect(()=>{L(1)},[n,U]),y.useEffect(()=>{Wt(n)},[n]),y.useEffect(()=>{if(n==="orders"&&a==="giftpay"){Wt("giftPay",!0);return}["orders","bindings","withdrawals"].includes(n)&&Wt(n,!0)},[z,Q,U,R,n,a,jt,hn]),y.useEffect(()=>{n==="withdrawals"&&Rt()},[n]);async function fn(){C(null);try{const H=await Oe("/api/admin/distribution/overview");H!=null&&H.success&&H.overview&&h(H.overview)}catch(H){console.error("[Admin] 概览接口异常:",H),C("加载概览失败")}try{const H=await Oe("/api/db/users");j((H==null?void 0:H.users)||[])}catch(H){console.error("[Admin] 用户数据加载失败:",H)}}async function Wt(H,Qe=!1){var vt;if(!(!Qe&&le.has(H))){k(!0);try{const Ft=N;switch(H){case"overview":break;case"orders":{try{const yt=new URLSearchParams({page:String(z),pageSize:String(Q),...U!=="all"&&{status:U},...R&&{search:R}}),bt=await Oe(`/api/admin/orders?${yt}`);if(bt!=null&&bt.success&&bt.orders){const Pt=bt.orders.map(Qt=>{const wn=Ft.find(hr=>hr.id===Qt.userId),Ds=Qt.referrerId?Ft.find(hr=>hr.id===Qt.referrerId):null;return{...Qt,amount:parseFloat(String(Qt.amount))||0,userNickname:(wn==null?void 0:wn.nickname)||Qt.userNickname||"未知用户",userPhone:(wn==null?void 0:wn.phone)||Qt.userPhone||"-",referrerNickname:(Ds==null?void 0:Ds.nickname)||null,referrerCode:(Ds==null?void 0:Ds.referralCode)??null,type:Qt.productType||Qt.type}});c(Pt),ie(bt.total??Pt.length)}else c([]),ie(0)}catch(yt){console.error(yt),C("加载订单失败"),c([])}break}case"bindings":{try{const yt=new URLSearchParams({page:String(z),pageSize:String(Q),...U!=="all"&&{status:U}}),bt=await Oe(`/api/db/distribution?${yt}`);m((bt==null?void 0:bt.bindings)||[]),ie((bt==null?void 0:bt.total)??((vt=bt==null?void 0:bt.bindings)==null?void 0:vt.length)??0)}catch(yt){console.error(yt),C("加载绑定数据失败"),m([])}break}case"withdrawals":{try{const yt=U==="completed"?"success":U==="rejected"?"failed":U,bt=new URLSearchParams({...yt&&yt!=="all"&&{status:yt},page:String(z),pageSize:String(Q)}),Pt=await Oe(`/api/admin/withdrawals?${bt}`);if(Pt!=null&&Pt.success&&Pt.withdrawals){const Qt=Pt.withdrawals.map(wn=>({...wn,account:wn.account??"未绑定微信号",status:wn.status==="success"?"completed":wn.status==="failed"?"rejected":wn.status}));b(Qt),ie((Pt==null?void 0:Pt.total)??Qt.length)}else Pt!=null&&Pt.success||C(`获取提现记录失败: ${(Pt==null?void 0:Pt.error)||"未知错误"}`),b([])}catch(yt){console.error(yt),C("加载提现数据失败"),b([])}break}case"giftPay":{try{const yt=new URLSearchParams({page:String(jt),pageSize:"20",...hn&&{status:hn}}),bt=await Oe(`/api/admin/gift-pay-requests?${yt}`);bt!=null&&bt.success&&bt.data?(Ue(bt.data),It(bt.total??bt.data.length)):(Ue([]),It(0))}catch(yt){console.error(yt),C("加载代付请求失败"),Ue([])}break}}me(yt=>new Set(yt).add(H))}catch(Ft){console.error(Ft)}finally{k(!1)}}}async function xn(){C(null),me(H=>{const Qe=new Set(H);return Qe.delete(n),n==="orders"&&a==="giftpay"&&Qe.delete("giftPay"),Qe}),n==="overview"&&fn(),n==="orders"&&a==="giftpay"?await Wt("giftPay",!0):await Wt(n,!0)}async function En(H){if(confirm("确认审核通过并打款?"))try{const Qe=await Xt("/api/admin/withdrawals",{id:H,action:"approve"});if(!(Qe!=null&&Qe.success)){const vt=(Qe==null?void 0:Qe.message)||(Qe==null?void 0:Qe.error)||"操作失败";G.error(vt);return}await xn()}catch(Qe){console.error(Qe),G.error("操作失败")}}function Vn(H){fe(H),de("")}async function es(){const H=W;if(!H)return;const Qe=he.trim();if(!Qe){G.error("请填写拒绝原因");return}q(!0);try{const vt=await Xt("/api/admin/withdrawals",{id:H,action:"reject",errorMessage:Qe});if(!(vt!=null&&vt.success)){G.error((vt==null?void 0:vt.error)||"操作失败");return}G.success("已拒绝该提现申请"),fe(null),de(""),await xn()}catch(vt){console.error(vt),G.error("操作失败")}finally{q(!1)}}async function Rt(){try{const H=await Oe("/api/admin/withdrawals/auto-approve");H!=null&&H.success&&typeof H.enableAutoApprove=="boolean"&&Z(H.enableAutoApprove)}catch{}}async function yn(H){we(!0);try{const Qe=await Xt("/api/admin/withdrawals/auto-approve",{enableAutoApprove:H});Qe!=null&&Qe.success?(Z(H),G.success(H?"已开启自动审批,新提现将自动打款":"已关闭自动审批")):G.error("更新失败: "+((Qe==null?void 0:Qe.error)??""))}catch{G.error("更新失败")}finally{we(!1)}}function Ne(){W&&G.info("已取消操作"),fe(null),de("")}async function Me(){var H;if(!(!(I!=null&&I.orderSn)&&!(I!=null&&I.id))){B(!0),C(null);try{const Qe=await Xt("/api/admin/orders/refund",{orderSn:I.orderSn||I.id,reason:F||void 0});Qe!=null&&Qe.success?(Y(null),ge(""),await Wt("orders",!0)):C((Qe==null?void 0:Qe.error)||"退款失败")}catch(Qe){const vt=Qe;C(((H=vt==null?void 0:vt.data)==null?void 0:H.error)||"退款失败,请检查网络后重试")}finally{B(!1)}}}function We(H){const Qe={active:"bg-green-500/20 text-green-400",converted:"bg-blue-500/20 text-blue-400",expired:"bg-gray-500/20 text-gray-400",cancelled:"bg-red-500/20 text-red-400",pending:"bg-orange-500/20 text-orange-400",pending_confirm:"bg-orange-500/20 text-orange-400",processing:"bg-blue-500/20 text-blue-400",completed:"bg-green-500/20 text-green-400",rejected:"bg-red-500/20 text-red-400"},vt={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return s.jsx(Be,{className:`${Qe[H]||"bg-gray-500/20 text-gray-400"} border-0`,children:vt[H]||H})}const at=Math.ceil($/Q)||1,Lt=o,Ct=f.filter(H=>{var vt,Ft,yt,bt;if(!R)return!0;const Qe=R.toLowerCase();return((vt=H.refereeNickname)==null?void 0:vt.toLowerCase().includes(Qe))||((Ft=H.refereePhone)==null?void 0:Ft.includes(Qe))||((yt=H.referrerName)==null?void 0:yt.toLowerCase().includes(Qe))||((bt=H.referrerCode)==null?void 0:bt.toLowerCase().includes(Qe))}),$e=g.filter(H=>{var vt;if(!R)return!0;const Qe=R.toLowerCase();return((vt=H.userName)==null?void 0:vt.toLowerCase().includes(Qe))||H.account&&H.account.toLowerCase().includes(Qe)});return s.jsxs("div",{className:"p-8 w-full",children:[T&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[s.jsx("span",{children:T}),s.jsx("button",{type:"button",onClick:()=>C(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-semibold text-white",children:"推广中心"}),s.jsx("p",{className:"text-gray-500 text-sm mt-0.5",children:"分销绑定、提现审核、推广设置"})]}),s.jsxs(J,{onClick:xn,disabled:v,variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[s.jsx(He,{className:`w-3.5 h-3.5 mr-1.5 ${v?"animate-spin":""}`}),"刷新"]})]}),s.jsx("div",{className:"flex gap-1 mb-6 bg-[#0a1628] rounded-lg p-1 border border-gray-700/40",children:[{key:"overview",label:"数据概览",icon:Tf},{key:"orders",label:"订单与代付",icon:Cf},{key:"bindings",label:"绑定管理",icon:Mi},{key:"withdrawals",label:"提现审核",icon:Jc},{key:"settings",label:"推广设置",icon:So}].map(H=>s.jsxs("button",{type:"button",onClick:()=>{r(H.key),P("all"),O(""),H.key!=="orders"&&i("orders")},className:`flex-1 flex items-center justify-center gap-1.5 px-3 py-2 rounded-md text-sm transition-all ${n===H.key?"bg-[#38bdac] text-white shadow-md":"text-gray-400 hover:text-white hover:bg-gray-700/40"}`,children:[s.jsx(H.icon,{className:"w-3.5 h-3.5"}),H.label]},H.key))}),v?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(He,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[n==="overview"&&u&&s.jsxs("div",{className:"space-y-6",children:[s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("span",{className:"text-sm font-medium text-gray-300 flex items-center gap-2",children:[s.jsx(_o,{className:"w-4 h-4 text-amber-400"}),"推广转化漏斗"]}),s.jsx(J,{type:"button",size:"sm",variant:"ghost",onClick:()=>void xn(),disabled:v,className:"text-gray-400 h-7",children:s.jsx(He,{className:`w-3.5 h-3.5 ${v?"animate-spin":""}`})})]}),s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"text-gray-500 text-xs border-b border-gray-700/50",children:[s.jsx("th",{className:"pb-2 text-left font-normal",children:"指标"}),s.jsx("th",{className:"pb-2 text-right font-normal",children:"今日"}),s.jsx("th",{className:"pb-2 text-right font-normal",children:"本月"}),s.jsx("th",{className:"pb-2 text-right font-normal",children:"累计"})]})}),s.jsxs("tbody",{className:"text-white",children:[s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(Ef,{className:"w-4 h-4 text-blue-400"}),"点击数"]}),s.jsx("td",{className:"py-2.5 text-right font-bold",children:u.todayClicks}),s.jsx("td",{className:"py-2.5 text-right",children:u.monthClicks}),s.jsx("td",{className:"py-2.5 text-right",children:u.totalClicks})]}),s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(Mi,{className:"w-4 h-4 text-green-400"}),"绑定关系"]}),s.jsx("td",{className:"py-2.5 text-right font-bold",children:u.todayBindings}),s.jsx("td",{className:"py-2.5 text-right",children:u.monthBindings}),s.jsx("td",{className:"py-2.5 text-right",children:u.totalBindings})]}),s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(_g,{className:"w-4 h-4 text-purple-400"}),"付款转化"]}),s.jsx("td",{className:"py-2.5 text-right font-bold",children:u.todayConversions}),s.jsx("td",{className:"py-2.5 text-right",children:u.monthConversions}),s.jsx("td",{className:"py-2.5 text-right",children:u.totalConversions})]}),s.jsxs("tr",{children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(Cf,{className:"w-4 h-4 text-[#38bdac]"}),"佣金收入"]}),s.jsxs("td",{className:"py-2.5 text-right font-bold text-[#38bdac]",children:["¥",(u.todayEarnings??0).toFixed(0)]}),s.jsxs("td",{className:"py-2.5 text-right text-[#38bdac]",children:["¥",(u.monthEarnings??0).toFixed(0)]}),s.jsxs("td",{className:"py-2.5 text-right text-[#38bdac]",children:["¥",(u.totalEarnings??0).toFixed(0)]})]})]})]})}),u.conversionRate&&s.jsxs("p",{className:"text-xs text-gray-500 mt-3 text-right",children:["综合转化率 ",u.conversionRate]})]})}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(De,{className:"bg-orange-500/10 border-orange-500/30",children:s.jsx(_e,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(zx,{className:"w-5 h-5 text-orange-400 shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-orange-300 font-medium text-sm",children:"即将过期绑定"}),s.jsxs("p",{className:"text-xl font-bold text-white",children:[u.expiringBindings," ",s.jsx("span",{className:"text-sm font-normal text-orange-300/60",children:"个 · 7天内"})]})]})]})})}),s.jsx(De,{className:"bg-blue-500/10 border-blue-500/30",children:s.jsx(_e,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Jc,{className:"w-5 h-5 text-blue-400 shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-blue-300 font-medium text-sm",children:"待审核提现"}),s.jsxs("p",{className:"text-xl font-bold text-white",children:[u.pendingWithdrawals," ",s.jsxs("span",{className:"text-sm font-normal text-blue-300/60",children:["笔 · ¥",(u.pendingWithdrawAmount??0).toFixed(0)]})]})]}),s.jsx(J,{onClick:()=>r("withdrawals"),variant:"outline",size:"sm",className:"border-blue-500/50 text-blue-400 hover:bg-blue-500/20 shrink-0",children:"去审核"})]})})})]}),s.jsx(De,{className:"bg-emerald-500/10 border-emerald-500/30",children:s.jsxs(_e,{className:"p-4 flex flex-wrap items-center justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-emerald-300 font-medium text-sm",children:"获客线索(存客宝)"}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"留资列表、推送状态与重试已统一至「用户管理 → 获客列表」,避免与推广中心重复维护。"})]}),s.jsx(Dl,{to:"/users?tab=leads",className:"shrink-0",children:s.jsx(J,{type:"button",variant:"outline",size:"sm",className:"border-emerald-500/50 text-emerald-400 hover:bg-emerald-500/15 bg-transparent",children:"打开获客列表"})})]})}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-4",children:s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-white/5",children:[s.jsx(Un,{className:"w-5 h-5 text-gray-400 shrink-0"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-lg font-bold text-white",children:u.totalDistributors}),s.jsx("p",{className:"text-[10px] text-gray-500",children:"推广用户"})]})]}),s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-white/5",children:[s.jsx(_g,{className:"w-5 h-5 text-green-400 shrink-0"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-lg font-bold text-green-400",children:u.activeDistributors}),s.jsx("p",{className:"text-[10px] text-gray-500",children:"有收益用户"})]})]})]})})})]}),n==="orders"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2 mb-2",children:[s.jsx("button",{type:"button",className:`px-3 py-1.5 rounded-md text-xs font-medium transition-all ${a==="orders"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,onClick:()=>i("orders"),children:"普通订单"}),s.jsxs("button",{type:"button",className:`px-3 py-1.5 rounded-md text-xs font-medium transition-all ${a==="giftpay"?"bg-amber-500/20 text-amber-400 border border-amber-500/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,onClick:()=>{i("giftpay"),Wt("giftPay",!0)},children:[s.jsx(Fx,{className:"w-3 h-3 inline mr-1"}),"代付请求"]})]}),a==="orders"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(pa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ce,{value:R,onChange:H=>O(H.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:U,onChange:H=>P(H.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 xn(),disabled:v,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${v?"animate-spin":""}`}),"刷新"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-0",children:[o.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无订单数据"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"订单号"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"商品"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"支付方式"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"退款原因"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"推荐人/邀请码"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"分销佣金"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"下单时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Lt.map(H=>{var Qe,vt;return s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsxs("td",{className:"p-4 font-mono text-xs text-gray-400",children:[(Qe=H.id)==null?void 0:Qe.slice(0,12),"..."]}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:H.userNickname}),s.jsx("p",{className:"text-gray-500 text-xs",children:H.userPhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:(()=>{const Ft=H.productType||H.type,yt=H.description||"",bt=String(H.productId||H.sectionId||""),Pt=Ft==="vip"||yt.includes("VIP")||yt.toLowerCase().includes("vip")||bt.toLowerCase().includes("vip");return Ft==="balance_recharge"?`余额充值 ¥${typeof H.amount=="number"?H.amount.toFixed(2):parseFloat(String(H.amount||"0")).toFixed(2)}`:Pt?"超级个体开通费用":Ft==="fullbook"?`${H.bookName||"《底层逻辑》"} - 全本`:Ft==="match"?"匹配次数购买":`${H.bookName||"《底层逻辑》"} - ${H.sectionTitle||H.chapterTitle||`章节${H.productId||H.sectionId||""}`}`})()}),s.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const Ft=H.productType||H.type,yt=H.description||"",bt=String(H.productId||H.sectionId||""),Pt=Ft==="vip"||yt.includes("VIP")||yt.toLowerCase().includes("vip")||bt.toLowerCase().includes("vip");return Ft==="balance_recharge"?"余额充值":Pt?"超级个体":Ft==="fullbook"?"全书解锁":Ft==="match"?"功能权益":H.chapterTitle||"单章购买"})()})]})}),s.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof H.amount=="number"?H.amount.toFixed(2):parseFloat(String(H.amount||"0")).toFixed(2)]}),s.jsx("td",{className:"p-4 text-gray-300",children:H.paymentMethod==="wechat"?"微信支付":H.paymentMethod==="balance"?"余额支付":H.paymentMethod==="alipay"?"支付宝":H.paymentMethod||"微信支付"}),s.jsx("td",{className:"p-4",children:H.status==="refunded"?s.jsx(Be,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):H.status==="completed"||H.status==="paid"?s.jsx(Be,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):H.status==="pending"||H.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:H.refundReason,children:H.status==="refunded"&&H.refundReason?H.refundReason:"-"}),s.jsx("td",{className:"p-4 text-gray-300 text-sm",children:H.referrerId||H.referralCode?s.jsxs("span",{title:H.referralCode||H.referrerCode||H.referrerId||"",children:[H.referrerNickname||H.referralCode||H.referrerCode||((vt=H.referrerId)==null?void 0:vt.slice(0,8)),(H.referralCode||H.referrerCode)&&` (${H.referralCode||H.referrerCode})`]}):"-"}),s.jsx("td",{className:"p-4 text-[#FFD700]",children:H.referrerEarnings?`¥${(typeof H.referrerEarnings=="number"?H.referrerEarnings:parseFloat(String(H.referrerEarnings))).toFixed(2)}`:"-"}),s.jsx("td",{className:"p-4 text-gray-400 text-sm",children:H.createdAt?new Date(H.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:(H.status==="paid"||H.status==="completed")&&s.jsxs(J,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{Y(H),ge("")},children:[s.jsx(rk,{className:"w-3 h-3 mr-1"}),"退款"]})})]},H.id)})})]})}),n==="orders"&&s.jsx(Us,{page:z,totalPages:at,total:$,pageSize:Q,onPageChange:L,onPageSizeChange:H=>{se(H),L(1)}})]})})]}),a==="giftpay"&&s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(ut,{children:s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[s.jsx(ht,{className:"text-white text-base",children:"代付请求列表"}),s.jsxs("div",{className:"flex gap-2 items-center",children:[s.jsxs("select",{className:"bg-[#0a1628] border border-gray-700 text-white rounded px-3 py-1.5 text-sm",value:hn,onChange:H=>{Bn(H.target.value),Nn(1)},children:[s.jsx("option",{value:"",children:"全部状态"}),s.jsx("option",{value:"pending",children:"待支付(旧)"}),s.jsx("option",{value:"pending_pay",children:"待发起人支付"}),s.jsx("option",{value:"paid",children:"已支付"}),s.jsx("option",{value:"refunded",children:"已退款"}),s.jsx("option",{value:"cancelled",children:"已取消"}),s.jsx("option",{value:"expired",children:"已过期"})]}),s.jsxs(J,{size:"sm",variant:"outline",onClick:()=>void Wt("giftPay",!0),disabled:v,className:"border-gray-600 text-gray-300",children:[s.jsx(He,{className:`w-3.5 h-3.5 mr-1 ${v?"animate-spin":""}`}),"刷新"]})]})]})}),s.jsxs(_e,{children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"请求号"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"发起人"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"商品/金额"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"份数/已领"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"付款人"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"状态"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"创建时间"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Fe.map(H=>s.jsxs("tr",{className:"hover:bg-[#0a1628]",children:[s.jsx("td",{className:"p-3 font-mono text-xs text-gray-400",children:H.requestSn}),s.jsx("td",{className:"p-3 text-white text-sm",children:H.initiatorNick||H.initiatorUserId}),s.jsxs("td",{className:"p-3",children:[s.jsxs("p",{className:"text-white",children:[H.productType," · ¥",H.amount.toFixed(2)]}),H.description&&s.jsx("p",{className:"text-gray-500 text-xs",children:H.description})]}),s.jsx("td",{className:"p-3 text-gray-400",children:(H.quantity??1)>1?`${H.quantity}份 / 已领${H.redeemedCount??0}`:"-"}),s.jsx("td",{className:"p-3 text-gray-400",children:H.payerNick||(H.payerUserId?H.payerUserId:"-")}),s.jsx("td",{className:"p-3",children:s.jsx(Be,{className:H.status==="paid"?"bg-green-500/20 text-green-400 border-0":H.status==="pending"||H.status==="pending_pay"?"bg-amber-500/20 text-amber-400 border-0":H.status==="refunded"?"bg-red-500/20 text-red-400 border-0":"bg-gray-500/20 text-gray-400 border-0",children:H.status==="paid"?"已支付":H.status==="pending"||H.status==="pending_pay"?"待支付":H.status==="refunded"?"已退款":H.status==="cancelled"?"已取消":"已过期"})}),s.jsx("td",{className:"p-3 text-gray-400 text-xs",children:H.createdAt?new Date(H.createdAt).toLocaleString("zh-CN"):"-"})]},H.id))})]})}),Fe.length===0&&!v&&s.jsx("p",{className:"text-center py-8 text-gray-500",children:"暂无代付请求"}),pt>20&&s.jsx("div",{className:"mt-4 flex justify-center",children:s.jsx(Us,{page:jt,totalPages:Math.ceil(pt/20),total:pt,pageSize:20,onPageChange:Nn,onPageSizeChange:()=>{}})})]})]})]}),n==="bindings"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(pa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ce,{value:R,onChange:H=>O(H.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:U,onChange:H=>P(H.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 xn(),disabled:v,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${v?"animate-spin":""}`}),"刷新"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-0",children:[Ct.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无绑定数据"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"访客"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"分销商"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"绑定时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"到期时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"佣金"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Ct.map(H=>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:H.refereeNickname||"匿名用户"}),s.jsx("p",{className:"text-gray-500 text-xs",children:H.refereePhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white",children:H.referrerName||"-"}),s.jsx("p",{className:"text-gray-500 text-xs font-mono",children:H.referrerCode})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:H.boundAt?new Date(H.boundAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:H.expiresAt?new Date(H.expiresAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:We(H.status)}),s.jsx("td",{className:"p-4",children:H.commission?s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",H.commission.toFixed(2)]}):s.jsx("span",{className:"text-gray-500",children:"-"})})]},H.id))})]})}),n==="bindings"&&s.jsx(Us,{page:z,totalPages:at,total:$,pageSize:Q,onPageChange:L,onPageSizeChange:H=>{se(H),L(1)}})]})})]}),n==="withdrawals"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(pa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ce,{value:R,onChange:H=>O(H.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:U,onChange:H=>P(H.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(_o,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-sm text-gray-300",children:"自动审批"}),s.jsx(Ut,{checked:_,onCheckedChange:yn,disabled:re,className:"data-[state=checked]:bg-[#38bdac]"})]}),s.jsxs(J,{type:"button",variant:"outline",onClick:()=>void xn(),disabled:v,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${v?"animate-spin":""}`}),"刷新"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-0",children:[$e.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无提现记录"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"申请人"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"收款方式"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"收款账号"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"备注"}),s.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:$e.map(H=>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:[H.userAvatar?s.jsx("img",{src:H.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:(H.userName||H.name||"?").slice(0,1)}),s.jsx("p",{className:"text-white font-medium",children:H.userName||H.name})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",H.amount.toFixed(2)]})}),s.jsx("td",{className:"p-4",children:s.jsx(Be,{className:H.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:H.method==="wechat"?"微信":"支付宝"})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-mono text-xs",children:H.account}),s.jsx("p",{className:"text-gray-500 text-xs",children:H.name})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:H.createdAt?new Date(H.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:We(H.status)}),s.jsx("td",{className:"p-4 max-w-[160px]",children:s.jsx("span",{className:`text-xs ${H.status==="rejected"||H.status==="failed"?"text-red-400":"text-gray-400"}`,title:H.remark,children:H.remark||"-"})}),s.jsx("td",{className:"p-4 text-right",children:H.status==="pending"&&s.jsxs("div",{className:"flex gap-2 justify-end",children:[s.jsxs(J,{size:"sm",onClick:()=>En(H.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(_g,{className:"w-4 h-4 mr-1"}),"通过"]}),s.jsxs(J,{size:"sm",variant:"outline",onClick:()=>Vn(H.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[s.jsx(Yj,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},H.id))})]})}),n==="withdrawals"&&s.jsx(Us,{page:z,totalPages:at,total:$,pageSize:Q,onPageChange:L,onPageSizeChange:H=>{se(H),L(1)}})]})})]})]}),s.jsx(Dt,{open:!!I,onOpenChange:H=>!H&&Y(null),children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(_t,{children:s.jsx($t,{className:"text-white",children:"订单退款"})}),I&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",I.orderSn||I.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof I.amount=="number"?I.amount.toFixed(2):parseFloat(String(I.amount||"0")).toFixed(2)]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),s.jsx("div",{className:"form-input",children:s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:F,onChange:H=>ge(H.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>Y(null),disabled:X,children:"取消"}),s.jsx(J,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:Me,disabled:X,children:X?"退款中...":"确认退款"})]})]})}),s.jsx(Dt,{open:!!W,onOpenChange:H=>!H&&Ne(),children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(_t,{children:s.jsx($t,{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:he,onChange:H=>de(H.target.value)})})]})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:Ne,disabled:D,children:"取消"}),s.jsx(J,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:es,disabled:D||!he.trim(),children:D?"提交中...":"确认拒绝"})]})]})}),n==="settings"&&s.jsx("div",{className:"-mx-8 -mt-6",children:s.jsx(B2,{embedded:!0})})]})}function z8(){const[t,e]=y.useState([]),[n,r]=y.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[a,i]=y.useState(!0),[o,c]=y.useState(null),[u,h]=y.useState("all"),[f,m]=y.useState(1),[g,b]=y.useState(10),[N,j]=y.useState(0),[v,k]=y.useState(null),[T,C]=y.useState(null),[R,O]=y.useState(""),[U,P]=y.useState(!1);async function z(){var I,Y,F,ge,X,B,W;i(!0),c(null);try{const fe=new URLSearchParams({status:u,page:String(f),pageSize:String(g)}),he=await Oe(`/api/admin/withdrawals?${fe}`);if(he!=null&&he.success){const de=he.withdrawals||[];e(de),j(he.total??((I=he.stats)==null?void 0:I.total)??de.length),r({total:((Y=he.stats)==null?void 0:Y.total)??he.total??de.length,pendingCount:((F=he.stats)==null?void 0:F.pendingCount)??0,pendingAmount:((ge=he.stats)==null?void 0:ge.pendingAmount)??0,successCount:((X=he.stats)==null?void 0:X.successCount)??0,successAmount:((B=he.stats)==null?void 0:B.successAmount)??0,failedCount:((W=he.stats)==null?void 0:W.failedCount)??0})}else c("加载提现记录失败")}catch(fe){console.error("Load withdrawals error:",fe),c("加载失败,请检查网络后重试")}finally{i(!1)}}y.useEffect(()=>{m(1)},[u]),y.useEffect(()=>{z()},[u,f,g]);const L=Math.ceil(N/g)||1;async function Q(I){const Y=t.find(F=>F.id===I);if(Y!=null&&Y.userCommissionInfo&&Y.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${Y.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。 - -确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;k(I);try{const F=await Xt("/api/admin/withdrawals",{id:I,action:"approve"});F!=null&&F.success?z():G.error("操作失败: "+((F==null?void 0:F.error)??""))}catch{G.error("操作失败")}finally{k(null)}}async function se(I){if(confirm("确认撤回该笔打款?仅在用户未确认收款前可撤回。")){k(I);try{const Y=await kt("/api/admin/withdrawals/cancel",{id:I});Y!=null&&Y.success?(G.success("已撤回打款"),z()):G.error("撤回失败: "+((Y==null?void 0:Y.error)??"未知错误"))}catch{G.error("撤回失败")}finally{k(null)}}}function $(I){C(I),O("")}async function ie(){const I=T;if(!I)return;const Y=R.trim();if(!Y){G.error("请填写拒绝原因");return}P(!0);try{const F=await Xt("/api/admin/withdrawals",{id:I,action:"reject",errorMessage:Y});F!=null&&F.success?(G.success("已拒绝该提现申请"),C(null),O(""),z()):G.error("操作失败: "+((F==null?void 0:F.error)??""))}catch{G.error("操作失败")}finally{P(!1)}}function le(){T&&G.info("已取消操作"),C(null),O("")}function me(I){switch(I){case"pending":return s.jsx(Be,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待处理"});case"pending_confirm":return s.jsx(Be,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待用户确认"});case"processing":return s.jsx(Be,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:"已审批等待打款"});case"success":case"completed":return s.jsx(Be,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"});case"failed":case"rejected":return s.jsx(Be,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已拒绝"});default:return s.jsx(Be,{className:"bg-gray-500/20 text-gray-400 border-0",children:I})}}return s.jsxs("div",{className:"p-8 w-full",children:[o&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[s.jsx("span",{children:o}),s.jsx("button",{type:"button",onClick:()=>c(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-start mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold text-white",children:"分账提现管理"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"管理用户分销收益的提现申请"})]}),s.jsxs(J,{variant:"outline",onClick:z,disabled:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${a?"animate-spin":""}`}),"刷新"]})]}),s.jsx(De,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:s.jsx(_e,{className:"p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Cf,{className:"w-5 h-5 text-[#38bdac] mt-0.5"}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-white font-medium mb-2",children:"自动分账规则"}),s.jsxs("div",{className:"text-sm text-gray-400 space-y-1",children:[s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"分销比例"}),":推广者获得订单金额的"," ",s.jsx("span",{className:"text-white font-medium",children:"90%"})]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"结算方式"}),":用户付款后,分销收益自动计入推广者账户"]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"提现方式"}),":用户在小程序端点击提现,系统自动转账到微信零钱"]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"审批流程"}),":待处理的提现需管理员手动确认打款后批准(自动审批开关在推广中心-提现审核)"]})]})]})]})})}),s.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-[#38bdac]",children:n.total}),s.jsx("div",{className:"text-sm text-gray-400",children:"总申请"})]})}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-orange-400",children:n.pendingCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"待处理"}),s.jsxs("div",{className:"text-xs text-orange-400 mt-1",children:["¥",n.pendingAmount.toFixed(2)]})]})}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-green-400",children:n.successCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"已完成"}),s.jsxs("div",{className:"text-xs text-green-400 mt-1",children:["¥",n.successAmount.toFixed(2)]})]})}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-red-400",children:n.failedCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"已拒绝"})]})})]}),s.jsx("div",{className:"flex gap-2 mb-4",children:["all","pending","processing","pending_confirm","success","failed"].map(I=>s.jsx(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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:a?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.length===0?s.jsxs("div",{className:"text-center py-12",children:[s.jsx(Jc,{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:ma(I.userAvatar),alt:I.userName??"",className:"w-8 h-8 rounded-full object-cover"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:(I.userName??"?").charAt(0)}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-white",children:I.userName??"未知"}),s.jsx("p",{className:"text-xs text-gray-500",children:I.userPhone??I.referralCode??(I.userId??"").slice(0,10)})]})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(I.amount).toFixed(2)]})}),s.jsx("td",{className:"p-4",children:I.userCommissionInfo?s.jsxs("div",{className:"text-xs space-y-1",children:[s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"累计佣金:"}),s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",I.userCommissionInfo.totalCommission.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"已提现:"}),s.jsxs("span",{className:"text-gray-400",children:["¥",I.userCommissionInfo.withdrawnEarnings.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"待审核:"}),s.jsxs("span",{className:"text-orange-400",children:["¥",I.userCommissionInfo.pendingWithdrawals.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4 pt-1 border-t border-gray-700/30",children:[s.jsx("span",{className:"text-gray-500",children:"审核后余额:"}),s.jsxs("span",{className:I.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",I.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):s.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),s.jsx("td",{className:"p-4",children:me(I.status)}),s.jsx("td",{className:"p-4 max-w-[180px]",children:s.jsx("span",{className:`text-xs ${I.status==="rejected"||I.status==="failed"?"text-red-400":"text-gray-400"}`,title:I.remark,children:I.remark||"-"})}),s.jsx("td",{className:"p-4 text-gray-400",children:I.processedAt?new Date(I.processedAt).toLocaleString():"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:I.userConfirmedAt?s.jsxs("span",{className:"text-green-400",title:I.userConfirmedAt,children:["已确认 ",new Date(I.userConfirmedAt).toLocaleString()]}):"-"}),s.jsxs("td",{className:"p-4 text-right",children:[(I.status==="pending"||I.status==="pending_confirm")&&s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsxs(J,{size:"sm",onClick:()=>Q(I.id),disabled:v===I.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[s.jsx(Ap,{className:"w-4 h-4 mr-1"}),"批准"]}),s.jsxs(J,{size:"sm",variant:"outline",onClick:()=>$(I.id),disabled:v===I.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[s.jsx(Xn,{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:()=>se(I.id),disabled:v===I.id,className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:"撤回打款"})}),(I.status==="success"||I.status==="completed")&&I.transactionId&&s.jsx("span",{className:"text-xs text-gray-500 font-mono",children:I.transactionId})]})]},I.id))})]})}),s.jsx(Us,{page:f,totalPages:L,total:N,pageSize:g,onPageChange:m,onPageSizeChange:I=>{b(I),m(1)}})]})})}),s.jsx(Dt,{open:!!T,onOpenChange:I=>!I&&le(),children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(_t,{children:s.jsx($t,{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=>O(I.target.value)})})]})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:le,disabled:U,children:"取消"}),s.jsx(J,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:ie,disabled:U||!R.trim(),children:U?"提交中...":"确认拒绝"})]})]})})]})}var Qg={exports:{}},Yg={};/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @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. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */var uN;function V8(){if(uN)return Xg;uN=1;var t=$u();function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,a=t.useEffect,i=t.useLayoutEffect,o=t.useDebugValue;function c(m,g){var b=g(),N=r({inst:{value:b,getSnapshot:g}}),j=N[0].inst,v=N[1];return i(function(){j.value=b,j.getSnapshot=g,u(j)&&v({inst:j})},[m,b,g]),a(function(){return u(j)&&v({inst:j}),m(function(){u(j)&&v({inst:j})})},[m]),o(b),b}function u(m){var g=m.getSnapshot;m=m.value;try{var b=g();return!n(m,b)}catch{return!0}}function h(m,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:c;return Xg.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,Xg}var hN;function U2(){return hN||(hN=1,Yg.exports=V8()),Yg.exports}var W2=U2();function ks(t){this.content=t}ks.prototype={constructor:ks,find:function(t){for(var e=0;e>1}};ks.from=function(t){if(t instanceof ks)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new ks(e)};function K2(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=K2(a.content,i.content,n+1);if(o!=null)return o}n+=a.nodeSize}}function q2(t,e,n,r){for(let a=t.childCount,i=e.childCount;;){if(a==0||i==0)return a==i?null:{a:n,b:r};let o=t.child(--a),c=e.child(--i),u=o.nodeSize;if(o==c){n-=u,r-=u;continue}if(!o.sameMarkup(c))return{a:n,b:r};if(o.isText&&o.text!=c.text){let h=0,f=Math.min(o.text.length,c.text.length);for(;he&&r(u,a+c,i||null,o)!==!1&&u.content.size){let f=c+1;u.nodesBetween(Math.max(0,e-f),Math.min(u.content.size,n-f),r,a+f)}c=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,a){let i="",o=!0;return this.nodesBetween(e,n,(c,u)=>{let h=c.isText?c.text.slice(Math.max(e,u)-u,n-u):c.isLeaf?a?typeof a=="function"?a(c):a:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&h||c.isTextblock)&&r&&(o?o=!1:i+=r),i+=h},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,a=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(a[a.length-1]=n.withText(n.text+r.text),i=1);ie)for(let i=0,o=0;oe&&((on)&&(c.isText?c=c.cut(Math.max(0,e-o),Math.min(c.text.length,n-o)):c=c.cut(Math.max(0,e-o-1),Math.min(c.content.size,n-o-1))),r.push(c),a+=c.nodeSize),o=u}return new Ce(r,a)}cutByIndex(e,n){return e==n?Ce.empty:e==0&&n==this.content.length?this:new Ce(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let a=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return a[e]=n,new Ce(a,i)}addToStart(e){return new Ce([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Ce(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let a=this.child(n),i=r+a.nodeSize;if(i>=e)return i==e?Xh(n+1,i):Xh(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return Ce.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Ce(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Ce.empty;let n,r=0;for(let a=0;athis.type.rank&&(n||(n=e.slice(0,a)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-a.type.rank),n}};on.none=[];class Df extends Error{}class ze{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=J2(this.content,e+this.openStart,n);return r&&new ze(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ze(G2(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 ze.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 ze(Ce.fromJSON(e,n.content),r,a)}static maxOpen(e,n=!0){let r=0,a=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)a++;return new ze(e,r,a)}}ze.empty=new ze(Ce.empty,0,0);function G2(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(G2(i.content,e-a-1,n-a-1)))}function J2(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=J2(o.content,e-i-1,n,o);return c&&t.replaceChild(a,o.copy(c))}function H8(t,e,n){if(n.openStart>t.depth)throw new Df("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Df("Inconsistent open depths");return Q2(t,e,n,0)}function Q2(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 uu(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&&(Il(t.nodeAfter,r),i++));for(let c=i;ca&&t0(t,e,a+1),o=r.depth>a&&t0(n,r,a+1),c=[];return uu(null,t,a,c),i&&o&&e.index(a)==n.index(a)?(Y2(i,o),Il(Rl(i,X2(t,e,n,r,a+1)),c)):(i&&Il(Rl(i,_f(t,e,a+1)),c),uu(e,n,a,c),o&&Il(Rl(o,_f(n,r,a+1)),c)),uu(r,null,a,c),new Ce(c)}function _f(t,e,n){let r=[];if(uu(null,t,n,r),t.depth>n){let a=t0(t,e,n+1);Il(Rl(a,_f(t,e,n+1)),r)}return uu(e,null,n,r),new Ce(r)}function U8(t,e){let n=e.depth-t.openStart,a=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)a=e.node(i).copy(Ce.from(a));return{start:a.resolveNoCache(t.openStart+n),end:a.resolveNoCache(a.content.size-t.openEnd-n)}}class Su{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 $f(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 Su(n,r,i)}static resolveCached(e,n){let r=fN.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()+")"),Z2(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=Ce.empty,a=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,a,i),c=o&&o.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let u=a;un.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let a=Ce.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,a,r);return i.type.checkAttrs(i.attrs),i}};Ri.prototype.text=void 0;class zf extends Ri{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):Z2(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 zf(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new zf(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 Z2(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Wl{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new G8(e,n);if(r.next==null)return Wl.empty;let a=eS(r);r.next&&r.err("Unexpected trailing text");let i=t6(e6(a));return n6(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(` -`)}}Wl.empty=new Wl(!0);class G8{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 eS(t){let e=[];do e.push(J8(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function J8(t){let e=[];do e.push(Q8(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Q8(t){let e=Z8(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=Y8(t,e);else break;return e}function pN(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Y8(t,e){let n=pN(t),r=n;return t.eat(",")&&(t.next!="}"?r=pN(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function X8(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 Z8(t){if(t.eat("(")){let e=eS(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=X8(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 e6(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 Wl(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:sS(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ri(this,this.computeAttrs(e),Ce.from(n),on.setFrom(r))}createChecked(e=null,n,r){return n=Ce.from(n),this.checkContent(n),new Ri(this,this.computeAttrs(e),n,on.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=Ce.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let a=this.contentMatch.matchFragment(n),i=a&&a.fillBefore(Ce.empty,!0);return i?new Ri(this,e,n.append(i),on.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 iS(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 s6(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 r6{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?s6(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class zp{constructor(e,n,r,a){this.name=e,this.rank=n,this.schema=r,this.spec=a,this.attrs=aS(e,a.attrs),this.excluded=null;let i=nS(this.attrs);this.instance=i?new on(this,i):null}create(e=null){return!e&&this.instance?this.instance:new on(this,sS(this.attrs,e))}static compile(e,n){let r=Object.create(null),a=0;return e.forEach((i,o)=>r[i]=new zp(i,a++,n,o)),r}removeFromSet(e){for(var n=0;n-1}}class oS{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=ks.from(e.nodes),n.marks=ks.from(e.marks||{}),this.nodes=gN.compile(this.spec.nodes,this),this.marks=zp.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]=Wl.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?xN(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==""?[]:xN(this,o.split(" "))}this.nodeFromJSON=a=>Ri.fromJSON(this,a),this.markFromJSON=a=>on.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 gN){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 zf(r,r.defaultAttrs,e,on.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 xN(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 a6(t){return t.tag!=null}function i6(t){return t.style!=null}class Ro{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(a=>{if(a6(a))this.tags.push(a);else if(i6(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 bN(this,n,!1);return r.addAll(e,on.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new bN(this,n,!0);return r.addAll(e,on.none,n.from,n.to),ze.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=vN(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=vN(o)),o.node||o.ignore||o.mark||(o.node=a)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ro(e,Ro.schemaRules(e)))}}const lS={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},o6={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},cS={ol:!0,ul:!0},Cu=1,s0=2,hu=4;function yN(t,e,n){return e!=null?(e?Cu:0)|(e==="full"?s0:0):t&&t.whitespace=="pre"?Cu|s0:n&~hu}class Zh{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=on.none,this.match=i||(o&hu?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Ce.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,a;return(a=r.findWrapping(e.type))?(this.match=r,a):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Cu)){let r=this.content[this.content.length-1],a;if(r&&r.isText&&(a=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==a[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-a[0].length))}}let n=Ce.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(Ce.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!lS.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class bN{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=yN(null,n.preserveWhitespace,0)|(r?hu:0);a?i=new Zh(a.type,a.attrs,on.none,!0,n.topMatch||a.type.contentMatch,o):r?i=new Zh(null,null,on.none,!0,null,o):i=new Zh(e.schema.topNodeType,null,on.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&s0?"full":this.localPreserveWS||(a.options&Cu)>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):NN(h.type,e))?(u=h.addToSet(u),!1):!0),this.nodes.push(new Zh(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|=Cu)}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 l6(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&cS.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function c6(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function vN(t){let e={};for(let n in t)e[n]=t[n];return e}function NN(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&&yf(ex(r),a(e,n),null,e.attrs)}static renderSpec(e,n,r=null,a){return yf(e,n,r,a)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new nc(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=wN(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return wN(e.marks)}}function wN(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function ex(t){return t.document||window.document}const jN=new WeakMap;function d6(t){let e=jN.get(t);return e===void 0&&jN.set(t,e=u6(t)),e}function u6(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let a=0;a-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=a.indexOf(" ");o>0&&(n=a.slice(0,o),a=a.slice(o+1));let c,u=n?t.createElementNS(n,a):t.createElement(a),h=e[1],f=1;if(h&&typeof h=="object"&&h.nodeType==null&&!Array.isArray(h)){f=2;for(let m in h)if(h[m]!=null){let g=m.indexOf(" ");g>0?u.setAttributeNS(m.slice(0,g),m.slice(g+1),h[m]):m=="style"&&u.style?u.style.cssText=h[m]:u.setAttribute(m,h[m])}}for(let m=f;mf)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:b,contentDOM:N}=yf(t,g,n,r);if(u.appendChild(b),N){if(c)throw new RangeError("Multiple content holes");c=N}}}return{dom:u,contentDOM:c}}const dS=65535,uS=Math.pow(2,16);function h6(t,e){return t+e*uS}function kN(t){return t&dS}function f6(t){return(t-(t&dS))/uS}const hS=1,fS=2,bf=4,pS=8;class r0{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&pS)>0}get deletedBefore(){return(this.delInfo&(hS|bf))>0}get deletedAfter(){return(this.delInfo&(fS|bf))>0}get deletedAcross(){return(this.delInfo&bf)>0}}class Er{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Er.empty)return Er.empty}recover(e){let n=0,r=kN(e);if(!this.inverted)for(let a=0;ae)break;let h=this.ranges[c+i],f=this.ranges[c+o],m=u+h;if(e<=m){let g=h?e==u?-1:e==m?1:n:n,b=u+a+(g<0?0:f);if(r)return b;let N=e==(n<0?u:m)?null:h6(c/3,e-u),j=e==u?fS:e==m?hS:bf;return(n<0?e!=u:e!=m)&&(j|=pS),new r0(b,j,N)}a+=f-h}return r?e+a:new r0(e+a,0,null)}touches(e,n){let r=0,a=kN(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 Eu;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 qn.fromReplace(e,this.from,this.to,i)}invert(){return new ga(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 Eo(n.pos,r.pos,this.mark)}merge(e){return e instanceof Eo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Eo(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 Eo(n.from,n.to,e.markFromJSON(n.mark))}}$s.jsonID("addMark",Eo);class ga extends $s{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 ze(my(n.content,a=>a.mark(this.mark.removeFromSet(a.marks)),e),n.openStart,n.openEnd);return qn.fromReplace(e,this.from,this.to,r)}invert(){return new Eo(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 ga(n.pos,r.pos,this.mark)}merge(e){return e instanceof ga&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ga(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 ga(n.from,n.to,e.markFromJSON(n.mark))}}$s.jsonID("removeMark",ga);class To extends $s{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return qn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return qn.fromReplace(e,this.pos,this.pos+1,new ze(Ce.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let a=0;ar.pos?null:new xs(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 xs(n.from,n.to,n.gapFrom,n.gapTo,ze.fromJSON(e,n.slice),n.insert,!!n.structure)}}$s.jsonID("replaceAround",xs);function a0(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 p6(t,e,n,r){let a=[],i=[],o,c;t.doc.nodesBetween(e,n,(u,h,f)=>{if(!u.isInline)return;let m=u.marks;if(!r.isInSet(m)&&f.type.allowsMarkType(r.type)){let g=Math.max(h,e),b=Math.min(h+u.nodeSize,n),N=r.addToSet(m);for(let j=0;jt.step(u)),i.forEach(u=>t.step(u))}function m6(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 zp){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 ga(o.from,o.to,o.style)))}function gy(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 g6(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function fd(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,a=0,i=0;;--r){let o=t.$from.node(r),c=t.$from.index(r)+a,u=t.$to.indexAfter(r)-i;if(rn;N--)j||r.index(N)>0?(j=!0,f=Ce.from(r.node(N).copy(f)),m++):u--;let g=Ce.empty,b=0;for(let N=i,j=!1;N>n;N--)j||a.after(N+1)=0;o--){if(r.size){let c=n[o].type.contentMatch.matchFragment(r);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Ce.from(n[o].type.create(n[o].attrs,r))}let a=e.start,i=e.end;t.step(new xs(a,i,a,i,new ze(r,0,0),n.length,!0))}function N6(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)&&w6(t.doc,t.mapping.slice(i).map(c),r)){let h=null;if(r.schema.linebreakReplacement){let b=r.whitespace=="pre",N=!!r.contentMatch.matchType(r.schema.linebreakReplacement);b&&!N?h=!1:!b&&N&&(h=!0)}h===!1&&gS(t,o,c,i),gy(t,t.mapping.slice(i).map(c,1),r,void 0,h===null);let f=t.mapping.slice(i),m=f.map(c,1),g=f.map(c+o.nodeSize,1);return t.step(new xs(m,g,m+1,g-1,new ze(Ce.from(r.create(u,null,o.marks)),0,0),1,!0)),h===!0&&mS(t,o,c,i),!1}})}function mS(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 gS(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 w6(t,e,n){let r=t.resolve(e),a=r.index();return r.parent.canReplaceWith(a,a+1,n)}function j6(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 xs(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new ze(Ce.from(o),0,0),1,!0))}function Li(t,e,n=1,r){let a=t.resolve(e),i=a.depth-n,o=r&&r[r.length-1]||a.parent;if(i<0||a.parent.type.spec.isolating||!a.parent.canReplace(a.index(),a.parent.childCount)||!o.type.validContent(a.parent.content.cutByIndex(a.index(),a.parent.childCount)))return!1;for(let h=a.depth-1,f=n-2;h>i;h--,f--){let m=a.node(h),g=a.index(h);if(m.type.spec.isolating)return!1;let b=m.content.cutByIndex(g,m.childCount),N=r&&r[f+1];N&&(b=b.replaceChild(0,N.type.create(N.attrs)));let j=r&&r[f]||m;if(!m.canReplace(g+1,m.childCount)||!j.type.validContent(b))return!1}let c=a.indexAfter(i),u=r&&r[0];return a.node(i).canReplaceWith(c,c,u?u.type:a.node(i+1).type)}function k6(t,e,n=1,r){let a=t.doc.resolve(e),i=Ce.empty,o=Ce.empty;for(let c=a.depth,u=a.depth-n,h=n-1;c>u;c--,h--){i=Ce.from(a.node(c).copy(i));let f=r&&r[h];o=Ce.from(f?f.type.create(f.attrs,o):a.node(c).copy(o))}t.step(new fs(e,e,new ze(i.append(o),n,n),!0))}function qo(t,e){let n=t.resolve(e),r=n.index();return xS(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function S6(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&&xS(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 C6(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);gS(t,f.node(),f.before(),c)}o.inlineContent&&gy(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 fs(h,u.map(e+n,-1),ze.empty,!0)),r===!0){let f=t.doc.resolve(h);mS(t,f.node(),f.before(),t.steps.length)}return t}function E6(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 Bp(t,e,n=e,r=ze.empty){if(e==n&&!r.size)return null;let a=t.resolve(e),i=t.resolve(n);return bS(a,i,r)?new fs(e,n,r):new T6(a,i,r).fit()}function bS(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class T6{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=Ce.empty;for(let a=0;a<=e.depth;a++){let i=e.node(a);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(a))})}for(let a=e.depth;a>0;a--)this.placed=Ce.from(e.node(a).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let h=this.findFittable();h?this.placeNodes(h):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,a=this.close(e<0?this.$to:r.doc.resolve(e));if(!a)return null;let i=this.placed,o=r.depth,c=a.depth;for(;o&&c&&i.childCount==1;)i=i.firstChild.content,o--,c--;let u=new ze(i,o,c);return e>-1?new xs(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new fs(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=nx(this.unplaced.content,r-1).firstChild,a=i.content):a=this.unplaced.content;let o=a.firstChild;for(let c=this.depth;c>=0;c--){let{type:u,match:h}=this.frontier[c],f,m=null;if(n==1&&(o?h.matchType(o.type)||(m=h.fillBefore(Ce.from(o),!1)):i&&u.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:c,parent:i,inject:m};if(n==2&&o&&(f=h.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:c,parent:i,wrap:f};if(i&&h.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,a=nx(e,n);return!a.childCount||a.firstChild.isLeaf?!1:(this.unplaced=new ze(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=nx(e,n);if(a.childCount<=1&&n>0){let i=e.size-n<=n+a.size;this.unplaced=new ze(nu(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new ze(nu(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:a,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let j=0;j1||u==0||j.content.size)&&(m=v,f.push(vS(j.mark(g.allowedMarks(j.marks)),h==1?u:0,h==c.childCount?b:-1)))}let N=h==c.childCount;N||(b=-1),this.placed=su(this.placed,n,Ce.from(f)),this.frontier[n].match=m,N&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let j=0,v=c;j1&&a==this.$to.end(--r);)++a;return a}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:a}=this.frontier[n],i=n=0;c--){let{match:u,type:h}=this.frontier[c],f=sx(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=su(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=su(this.placed,this.depth,Ce.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(Ce.empty,!0);n.childCount&&(this.placed=su(this.placed,this.frontier.length,n))}}function nu(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(nu(t.firstChild.content,e-1,n)))}function su(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(su(t.lastChild.content,e-1,n)))}function nx(t,e){for(let n=0;n1&&(r=r.replaceChild(0,vS(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(Ce.empty,!0)))),t.copy(r)}function sx(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&&!M6(n,i.content,o)?c:null}function M6(t,e,n){for(let r=n;r0;g--,b--){let N=a.node(g).type.spec;if(N.defining||N.definingAsContext||N.isolating)break;o.indexOf(g)>-1?c=g:a.before(g)==b&&o.splice(1,0,-g)}let u=o.indexOf(c),h=[],f=r.openStart;for(let g=r.content,b=0;;b++){let N=g.firstChild;if(h.push(N),b==r.openStart)break;g=N.content}for(let g=f-1;g>=0;g--){let b=h[g],N=A6(b.type);if(N&&!b.sameMarkup(a.node(Math.abs(c)-1)))f=g;else if(N||!b.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let b=(g+f+1)%(r.openStart+1),N=h[b];if(N)for(let j=0;j=0&&(t.replace(e,n,r),!(t.steps.length>m));g--){let b=o[g];b<0||(e=a.before(b),n=i.after(b))}}function 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(Ce.empty,!0))}return t}function I6(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let a=E6(t.doc,e,r.type);a!=null&&(e=n=a)}t.replaceRange(e,n,new ze(Ce.from(r),0,0))}function R6(t,e,n){let r=t.doc.resolve(e),a=t.doc.resolve(n),i=wS(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 wS(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 qc extends $s{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 qn.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 qn.fromReplace(e,this.pos,this.pos+1,new ze(Ce.from(a),0,n.isLeaf?0:1))}getMap(){return Er.empty}invert(e){return new qc(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 qc(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 qc(n.pos,n.attr,n.value)}}$s.jsonID("attr",qc);class Tu extends $s{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 qn.ok(r)}getMap(){return Er.empty}invert(e){return new Tu(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 Tu(n.attr,n.value)}}$s.jsonID("docAttr",Tu);let Zc=class extends Error{};Zc=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Zc.prototype=Object.create(Error.prototype);Zc.prototype.constructor=Zc;Zc.prototype.name="TransformError";class yy{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Eu}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Zc(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=ze.empty){let a=Bp(this.doc,e,n,r);return a&&this.step(a),this}replaceWith(e,n,r){return this.replace(e,n,new ze(Ce.from(r),0,0))}delete(e,n){return this.replace(e,n,ze.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return P6(this,e,n,r),this}replaceRangeWith(e,n,r){return I6(this,e,n,r),this}deleteRange(e,n){return R6(this,e,n),this}lift(e,n){return x6(this,e,n),this}join(e,n=1){return C6(this,e,n),this}wrap(e,n){return v6(this,e,n),this}setBlockType(e,n=e,r,a=null){return N6(this,e,n,r,a),this}setNodeMarkup(e,n,r=null,a){return j6(this,e,n,r,a),this}setNodeAttribute(e,n,r){return this.step(new qc(e,n,r)),this}setDocAttribute(e,n){return this.step(new Tu(e,n)),this}addNodeMark(e,n){return this.step(new To(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 on)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 k6(this,e,n,r),this}addMark(e,n,r){return p6(this,e,n,r),this}removeMark(e,n,r){return m6(this,e,n,r),this}clearIncompatible(e,n,r){return gy(this,e,n,r),this}}const rx=Object.create(null);class ft{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new jS(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?_c(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):_c(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 _c(e,e,0,0,1)||new Mr(e)}static atEnd(e){return _c(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=rx[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 rx)throw new RangeError("Duplicate use of selection JSON ID "+e);return rx[e]=n,n.prototype.jsonID=e,n}getBookmark(){return ot.between(this.$anchor,this.$head).getBookmark()}}ft.prototype.visible=!0;class jS{constructor(e,n){this.$from=e,this.$to=n}}let CN=!1;function EN(t){!CN&&!t.parent.inlineContent&&(CN=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class ot extends ft{constructor(e,n=e){EN(e),EN(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return ft.near(r);let a=e.resolve(n.map(this.anchor));return new ot(a.parent.inlineContent?a:r,r)}replace(e,n=ze.empty){if(super.replace(e,n),n==ze.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ot&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Vp(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new ot(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let a=e.resolve(n);return new this(a,r==n?a:e.resolve(r))}static between(e,n,r){let a=e.pos-n.pos;if((!r||a)&&(r=a>=0?1:-1),!n.parent.inlineContent){let i=ft.findFrom(n,r,!0)||ft.findFrom(n,-r,!0);if(i)n=i.$head;else return ft.near(n,r)}return e.parent.inlineContent||(a==0?e=n:(e=(ft.findFrom(e,-r,!0)||ft.findFrom(e,r,!0)).$anchor,e.pos0?0:1);a>0?o=0;o+=a){let c=e.child(o);if(c.isAtom){if(!i&&it.isSelectable(c))return it.create(t,n-(a<0?c.nodeSize:0))}else{let u=_c(t,c,n+a,a<0?c.childCount:0,a,i);if(u)return u}n+=c.nodeSize*a}return null}function TN(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 MN=1,ef=2,AN=4;class O6 extends yy{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|=ef,this}ensureMarks(e){return on.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&ef)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~ef,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)||on.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|=AN,this}get scrolledIntoView(){return(this.updated&AN)>0}}function PN(t,e){return!e||!t?t:t.bind(e)}class ru{constructor(e,n,r){this.name=e,this.init=PN(n.init,r),this.apply=PN(n.apply,r)}}const D6=[new ru("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new ru("selection",{init(t,e){return t.selection||ft.atStart(e.doc)},apply(t){return t.selection}}),new ru("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new ru("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class ax{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=D6.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 ru(r.key,r.spec.state,r))})}}class Uc{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 ax(e.schema,e.plugins),i=new Uc(a);return a.fields.forEach(o=>{if(o.name=="doc")i.doc=Ri.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 kS(t,e,n){for(let r in t){let a=t[r];a instanceof Function?a=a.bind(e):r=="handleDOMEvents"&&(a=kS(a,e,{})),n[r]=a}return n}class fn{constructor(e){this.spec=e,this.props={},e.props&&kS(e.props,this,this.props),this.key=e.key?e.key.key:SS("plugin")}getState(e){return e[this.key]}}const ix=Object.create(null);function SS(t){return t in ix?t+"$"+ ++ix[t]:(ix[t]=0,t+"$")}class wn{constructor(e="key"){this.key=SS(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const vy=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function CS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const ES=(t,e,n)=>{let r=CS(t,n);if(!r)return!1;let a=Ny(r);if(!a){let o=r.blockRange(),c=o&&fd(o);return c==null?!1:(e&&e(t.tr.lift(o,c).scrollIntoView()),!0)}let i=a.nodeBefore;if(DS(t,a,e,-1))return!0;if(r.parent.content.size==0&&(ed(i,"end")||it.isSelectable(i)))for(let o=r.depth;;o--){let c=Bp(t.doc,r.before(o),r.after(o),ze.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},_6=(t,e,n)=>{let r=CS(t,n);if(!r)return!1;let a=Ny(r);return a?TS(t,a,e):!1},$6=(t,e,n)=>{let r=AS(t,n);if(!r)return!1;let a=wy(r);return a?TS(t,a,e):!1};function TS(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=Bp(t.doc,i,u,ze.empty);if(!h||h.from!=i||h instanceof fs&&h.slice.size>=u-i)return!1;if(n){let f=t.tr.step(h);f.setSelection(ot.create(f.doc,i)),n(f.scrollIntoView())}return!0}function ed(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 MS=(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=Ny(r)}let o=i&&i.nodeBefore;return!o||!it.isSelectable(o)?!1:(e&&e(t.tr.setSelection(it.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function Ny(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 AS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=AS(t,n);if(!r)return!1;let a=wy(r);if(!a)return!1;let i=a.nodeAfter;if(DS(t,a,e,1))return!0;if(r.parent.content.size==0&&(ed(i,"start")||it.isSelectable(i))){let o=Bp(t.doc,r.before(),r.after(),ze.empty);if(o&&o.slice.size{let{$head:r,empty:a}=t.selection,i=r;if(!a)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let n=t.selection,r=n instanceof it,a;if(r){if(n.node.isTextblock||!qo(t.doc,n.from))return!1;a=n.from}else if(a=Fp(t.doc,n.from,-1),a==null)return!1;if(e){let i=t.tr.join(a);r&&i.setSelection(it.create(i.doc,a-t.doc.resolve(a).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},F6=(t,e)=>{let n=t.selection,r;if(n instanceof it){if(n.node.isTextblock||!qo(t.doc,n.to))return!1;r=n.to}else if(r=Fp(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},B6=(t,e)=>{let{$from:n,$to:r}=t.selection,a=n.blockRange(r),i=a&&fd(a);return i==null?!1:(e&&e(t.tr.lift(a,i).scrollIntoView()),!0)},RS=(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 jy(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=jy(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},LS=(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=jy(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(Li(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),a=r&&fd(r);return a==null?!1:(e&&e(t.tr.lift(r,a).scrollIntoView()),!0)};function H6(t){return(e,n)=>{let{$from:r,$to:a}=e.selection;if(e.selection instanceof it&&e.selection.node.isBlock)return!r.parentOffset||!Li(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=jy(r.node(b-1).contentMatchAt(r.indexAfter(b-1))),i.unshift(u&&c?{type:c}:null),o=b;break}else{if(b==1)return!1;i.unshift(null)}let f=e.tr;(e.selection instanceof ot||e.selection instanceof Mr)&&f.deleteSelection();let m=f.mapping.map(r.pos),g=Li(f.doc,m,i.length,i);if(g||(i[0]=c?{type:c}:null,g=Li(f.doc,m,i.length,i)),!g)return!1;if(f.split(m,i.length,i),!u&&h&&r.node(o).type!=c){let b=f.mapping.map(r.before(o)),N=f.doc.resolve(b);c&&r.node(o-1).canReplaceWith(N.index(),N.index()+1,c)&&f.setNodeMarkup(f.mapping.map(r.before(o)),c)}return n&&n(f.scrollIntoView()),!0}}const U6=H6(),W6=(t,e)=>{let{$from:n,to:r}=t.selection,a,i=n.sharedDepth(r);return i==0?!1:(a=n.before(i),e&&e(t.tr.setSelection(it.create(t.doc,a))),!0)};function K6(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||qo(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function DS(t,e,n,r){let a=e.nodeBefore,i=e.nodeAfter,o,c,u=a.type.spec.isolating||i.type.spec.isolating;if(!u&&K6(t,e,n))return!0;let h=!u&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(o=(c=a.contentMatchAt(a.childCount)).findWrapping(i.type))&&c.matchType(o[0]||i.type).validEnd){if(n){let b=e.pos+i.nodeSize,N=Ce.empty;for(let k=o.length-1;k>=0;k--)N=Ce.from(o[k].create(null,N));N=Ce.from(a.copy(N));let j=t.tr.step(new xs(e.pos-1,b,e.pos,b,new ze(N,1,0),o.length,!0)),v=j.doc.resolve(b+2*o.length);v.nodeAfter&&v.nodeAfter.type==a.type&&qo(j.doc,v.pos)&&j.join(v.pos),n(j.scrollIntoView())}return!0}let f=i.type.spec.isolating||r>0&&u?null:ft.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),g=m&&fd(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(h&&ed(i,"start",!0)&&ed(a,"end")){let b=a,N=[];for(;N.push(b),!b.isTextblock;)b=b.lastChild;let j=i,v=1;for(;!j.isTextblock;j=j.firstChild)v++;if(b.canReplace(b.childCount,b.childCount,j.content)){if(n){let k=Ce.empty;for(let C=N.length-1;C>=0;C--)k=Ce.from(N[C].copy(k));let T=t.tr.step(new xs(e.pos-N.length,e.pos+i.nodeSize,e.pos+v,e.pos+i.nodeSize-v,new ze(k,N.length,0),0,!0));n(T.scrollIntoView())}return!0}}return!1}function _S(t){return function(e,n){let r=e.selection,a=t<0?r.$from:r.$to,i=a.depth;for(;a.node(i).isInline;){if(!i)return!1;i--}return a.node(i).isTextblock?(n&&n(e.tr.setSelection(ot.create(e.doc,t<0?a.start(i):a.end(i)))),!0):!1}}const q6=_S(-1),G6=_S(1);function J6(t,e=null){return function(n,r){let{$from:a,$to:i}=n.selection,o=a.blockRange(i),c=o&&xy(o,t,e);return c?(r&&r(n.tr.wrap(o,c).scrollIntoView()),!0):!1}}function IN(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 $f(u,u,e.depth),e.endIndex=0;f--)i=Ce.from(n[f].type.create(n[f].attrs,i));t.step(new xs(e.start-(r?2:0),e.end,e.start,e.end,new ze(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?eL(e,n,t,i):tL(e,n,i):!0:!1}}function eL(t,e,n,r){let a=t.tr,i=r.end,o=r.$to.end(r.depth);ij;N--)b-=a.child(N).nodeSize,r.delete(b-1,b+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,u=n.endIndex==a.childCount,h=i.node(-1),f=i.index(-1);if(!h.canReplace(f+(c?0:1),f+1,o.content.append(u?Ce.empty:Ce.from(a))))return!1;let m=i.pos,g=m+o.nodeSize;return r.step(new xs(m-(c?1:0),g+(u?1:0),m+1,g-1,new ze((c?Ce.empty:Ce.from(a.copy(Ce.empty))).append(u?Ce.empty:Ce.from(a.copy(Ce.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function nL(t){return function(e,n){let{$from:r,$to:a}=e.selection,i=r.blockRange(a,h=>h.childCount>0&&h.firstChild.type==t);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let c=i.parent,u=c.child(o-1);if(u.type!=t)return!1;if(n){let h=u.lastChild&&u.lastChild.type==c.type,f=Ce.from(h?t.create():null),m=new ze(Ce.from(t.create(null,Ce.from(c.type.create(null,f)))),h?3:1,0),g=i.start,b=i.end;n(e.tr.step(new xs(g-(h?3:1),b,g,b,m,1,!0)).scrollIntoView())}return!0}}const Ss=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},td=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let i0=null;const ki=function(t,e,n){let r=i0||(i0=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},sL=function(){i0=null},ql=function(t,e,n,r){return n&&(RN(t,e,n,r,-1)||RN(t,e,n,r,1))},rL=/^(img|br|input|textarea|hr)$/i;function RN(t,e,n,r,a){for(var i;;){if(t==n&&e==r)return!0;if(e==(a<0?0:Gr(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Vu(t)||rL.test(t.nodeName)||t.contentEditable=="false")return!1;e=Ss(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?Gr(t):0}else return!1}}function Gr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function aL(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=Gr(t)}else if(t.parentNode&&!Vu(t))e=Ss(t),t=t.parentNode;else return null}}function iL(t,e){for(;;){if(t.nodeType==3&&e2),qr=nd||(Ua?/Mac/.test(Ua.platform):!1),FS=Ua?/Win/.test(Ua.platform):!1,Pi=/Android \d/.test(Go),Hu=!!LN&&"webkitFontSmoothing"in LN.documentElement.style,dL=Hu?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function uL(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function bi(t,e){return typeof t=="number"?t:t[e]}function hL(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 ON(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=td(o);continue}let c=o,u=c==i.body,h=u?uL(i):hL(c),f=0,m=0;if(e.toph.bottom-bi(r,"bottom")&&(m=e.bottom-e.top>h.bottom-h.top?e.top+bi(a,"top")-h.top:e.bottom-h.bottom+bi(a,"bottom")),e.lefth.right-bi(r,"right")&&(f=e.right-h.right+bi(a,"right")),f||m)if(u)i.defaultView.scrollBy(f,m);else{let b=c.scrollLeft,N=c.scrollTop;m&&(c.scrollTop+=m),f&&(c.scrollLeft+=f);let j=c.scrollLeft-b,v=c.scrollTop-N;e={left:e.left-j,top:e.top-v,right:e.right-j,bottom:e.bottom-v}}let g=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(g))break;o=g=="absolute"?o.offsetParent:td(o)}}function fL(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:BS(t.dom)}}function BS(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=td(r));return e}function pL({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;VS(n,r==0?0:r-e)}function VS(t,e){for(let n=0;n=c){o=Math.max(N.bottom,o),c=Math.min(N.top,c);let j=N.left>e.left?N.left-e.left:N.right=(N.left+N.right)/2?1:0));continue}}else N.top>e.top&&!u&&N.left<=e.left&&N.right>=e.left&&(u=f,h={left:Math.max(N.left,Math.min(N.right,e.left)),top:N.top});!n&&(e.left>=N.right&&e.top>=N.top||e.left>=N.left&&e.top>=N.bottom)&&(i=m+1)}}return!n&&u&&(n=u,a=h,r=0),n&&n.nodeType==3?gL(n,a):!n||r&&n.nodeType==1?{node:t,offset:i}:HS(n,a)}function gL(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 Sy(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 bL(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 US(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&a++}let h;Hu&&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=bL(t,r,a,e))}c==null&&(c=yL(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function DN(t){return t.top=0&&a==r.nodeValue.length?(u--,f=1):n<0?u--:h++,Xd(go(ki(r,u,h),f),f<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&a&&(n<0||a==Gr(r))){let u=r.childNodes[a-1];if(u.nodeType==1)return ox(u.getBoundingClientRect(),!1)}if(i==null&&a=0)}if(i==null&&a&&(n<0||a==Gr(r))){let u=r.childNodes[a-1],h=u.nodeType==3?ki(u,Gr(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(h)return Xd(go(h,1),!1)}if(i==null&&a=0)}function Xd(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 ox(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function KS(t,e,n){let r=t.state,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 wL(t,e,n){let r=e.selection,a=n=="up"?r.$from:r.$to;return KS(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=WS(t,a.pos,1);for(let c=i.firstChild;c;c=c.nextSibling){let u;if(c.nodeType==1)u=c.getClientRects();else if(c.nodeType==3)u=ki(c,0,c.nodeValue.length).getClientRects();else continue;for(let h=0;hf.top+1&&(n=="up"?o.top-f.top>(f.bottom-o.top)*2:f.bottom-o.bottom>(o.bottom-f.top)*2))return!1}}return!0})}const jL=/[\u0590-\u08ac]/;function kL(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?!jL.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?i:o:KS(t,e,()=>{let{focusNode:u,focusOffset:h,anchorNode:f,anchorOffset:m}=t.domSelectionRange(),g=c.caretBidiLevel;c.modify("move",n,"character");let b=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:N,focusOffset:j}=t.domSelectionRange(),v=N&&!b.contains(N.nodeType==1?N:N.parentNode)||u==N&&h==j;try{c.collapse(f,m),u&&(u!=f||h!=m)&&c.extend&&c.extend(u,h)}catch{}return g!=null&&(c.caretBidiLevel=g),v}):r.pos==r.start()||r.pos==r.end()}let _N=null,$N=null,zN=!1;function SL(t,e,n){return _N==e&&$N==n?zN:(_N=e,$N=n,zN=n=="up"||n=="down"?wL(t,e,n):kL(t,e,n))}const Qr=0,FN=1,Tl=2,Wa=3;class Uu{constructor(e,n,r,a){this.parent=e,this.children=n,this.dom=r,this.contentDOM=a,this.dirty=Qr,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;nSs(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 GS){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 qS&&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?Ss(i.dom)+1:0}}else{let i,o=!0;for(;i=r=f&&n<=h-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,f);e=o;for(let m=c;m>0;m--){let g=this.children[m-1];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(1)){a=Ss(g.dom)+1;break}e-=g.size}a==-1&&(a=0)}if(a>-1&&(h>n||c==this.children.length-1)){n=h;for(let f=c+1;fN&&on){let N=c;c=u,u=N}let b=document.createRange();b.setEnd(u.node,u.offset),b.setStart(c.node,c.offset),h.removeAllRanges(),h.addRange(b)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,a=0;a=r:er){let c=r+i.border,u=o-i.border;if(e>=c&&n<=u){this.dirty=e==r||n==o?Tl:FN,e==c&&n==u&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Wa:i.markDirty(e-c,n-c);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Tl:Wa}r=o}this.dirty=Tl}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Tl:FN;n.dirty{if(!i)return a;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(o.nodeType!=1){let c=document.createElement("span");c.appendChild(o),o=c}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==Qr&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class CL extends Uu{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 Gl extends Uu{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=nc.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Gl(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Wa||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Wa&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Qr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(i=u0(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}=nc.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!m&&!n.isText&&f.nodeName!="BR"&&(f.hasAttribute("contenteditable")||(f.contentEditable="false"),n.type.spec.draggable&&(f.draggable=!0));let g=f;return f=YS(f,r,n),h?u=new EL(e,n,r,a,f,m||null,g,h,i,o+1):n.isText?new Up(e,n,r,a,f,g,i):new Oo(e,n,r,a,f,m||null,g,i,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Ce.empty)}return e}matchesNode(e,n,r){return this.dirty==Qr&&e.eq(this.node)&&Ff(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 ML(this,o&&o.node,e);IL(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?on.none:this.node.child(f).marks,r,e,f),u.placeWidget(h,e,a)},(h,f,m,g)=>{u.syncToMarks(h.marks,r,e,g);let b;u.findNodeMatch(h,f,m,g)||c&&e.state.selection.from>a&&e.state.selection.to-1&&u.updateNodeAt(h,f,m,b,e)||u.updateNextNode(h,f,m,e,g,a)||u.addNode(h,f,m,e,a),a+=h.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==Tl)&&(o&&this.protectLocalComposition(e,o),JS(this.contentDOM,this.children,e),nd&&RL(this.dom))}localCompositionInfo(e,n){let{from:r,to:a}=e.state.selection;if(!(e.state.selection instanceof ot)||rn+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,c=LL(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 CL(this,i,n,a);e.input.compositionNodes.push(o),this.children=u0(this.children,r,r+a.length,e,o)}update(e,n,r,a){return this.dirty==Wa||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,a),!0)}updateInner(e,n,r,a){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(a,this.posAtStart),this.dirty=Qr}updateOuterDeco(e){if(Ff(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=QS(this.dom,this.nodeDOM,d0(this.outerDeco,this.node,n),d0(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 BN(t,e,n,r,a){YS(r,e,t);let i=new Oo(void 0,t,e,n,r,r,r,a,0);return i.contentDOM&&i.updateChildren(a,0),i}class Up extends Oo{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==Wa||this.dirty!=Qr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Qr||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,a.trackWrites==this.nodeDOM&&(a.trackWrites=null)),this.node=e,this.dirty=Qr,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let a=this.node.cut(e,n),i=document.createTextNode(a.text);return new Up(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=Wa)}get domAtom(){return!1}isText(e){return this.node.text==e}}class GS extends Uu{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Qr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class EL extends Oo{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==Wa)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 JS(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=Gl.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 Gl)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 PL(t,e){return t.type.side-e.type.side}function IL(t,e,n,r){let a=e.locals(t),i=0;if(a.length==0){for(let h=0;hi;)c.push(a[o++]);let N=i+g.nodeSize;if(g.isText){let v=N;o!v.inline):c.slice();r(g,j,e.forChild(i,g),b),i=N}}function RL(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 LL(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 u0(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 Cy(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(Hp(n)){for(u=o;a&&!a.node;)a=a.parent;let m=a.node;if(a&&m.isAtom&&it.isSelectable(m)&&a.parent&&!(m.isInline&&oL(n.focusNode,n.focusOffset,a.dom))){let g=a.posBefore;h=new it(o==g?c:r.resolve(g))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let m=o,g=o;for(let b=0;b{(n.anchorNode!=r||n.anchorOffset!=a)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!XS(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function DL(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Ss(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&pr&&Lo<=11&&(n.disabled=!0,n.disabled=!1)}function ZS(t,e){if(e instanceof it){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(KN(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else KN(t)}function KN(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Ey(t,e,n,r){return t.someProp("createSelectionBetween",a=>a(t,e,n))||ot.between(e,n,r)}function qN(t){return t.editable&&!t.hasFocus()?!1:eC(t)}function eC(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 _L(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return ql(e.node,e.offset,n.anchorNode,n.anchorOffset)}function h0(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 xo(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function GN(t,e,n){let r=t.state.selection;if(r instanceof ot)if(n.indexOf("s")>-1){let{$head:a}=r,i=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(a.pos+i.nodeSize*(e<0?-1:1));return xo(t,new ot(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let a=h0(t.state,e);return a&&a instanceof it?xo(t,a):!1}else if(!(qr&&n.indexOf("m")>-1)){let a=r.$head,i=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter,o;if(!i||i.isText)return!1;let c=e<0?a.pos-i.nodeSize:a.pos;return i.isAtom||(o=t.docView.descAt(c))&&!o.contentDOM?it.isSelectable(i)?xo(t,new it(e<0?t.state.doc.resolve(a.pos-i.nodeSize):a)):Hu?xo(t,new ot(t.state.doc.resolve(e<0?c:c+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof it&&r.node.isInline)return xo(t,new ot(e>0?r.$to:r.$from));{let a=h0(t.state,e);return a?xo(t,a):!1}}}function Bf(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function pu(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Oc(t,e){return e<0?$L(t):zL(t)}function $L(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a,i,o=!1;for(Jr&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(pu(c,-1))a=n,i=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(tC(n))break;{let c=n.previousSibling;for(;c&&pu(c,-1);)a=n.parentNode,i=Ss(c),c=c.previousSibling;if(c)n=c,r=Bf(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?f0(t,n,r):a&&f0(t,a,i)}function zL(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a=Bf(n),i,o;for(;;)if(r{t.state==a&&Oi(t)},50)}function JN(t,e){let n=t.state.doc.resolve(e);if(!(Es||FS)&&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 QN(t,e,n){let r=t.state.selection;if(r instanceof ot&&!r.empty||n.indexOf("s")>-1||qr&&n.indexOf("m")>-1)return!1;let{$from:a,$to:i}=r;if(!a.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=h0(t.state,e);if(o&&o instanceof it)return xo(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?xo(t,c):!1}return!1}function YN(t,e){if(!(t.state.selection instanceof ot))return!0;let{$head:n,$anchor:r,empty:a}=t.state.selection;if(!n.sameParent(r))return!0;if(!a)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function XN(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function VL(t){if(!Ds||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;XN(t,r,"true"),setTimeout(()=>XN(t,r,"false"),20)}return!1}function HL(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function UL(t,e){let n=e.keyCode,r=HL(e);if(n==8||qr&&n==72&&r=="c")return YN(t,-1)||Oc(t,-1);if(n==46&&!e.shiftKey||qr&&n==68&&r=="c")return YN(t,1)||Oc(t,1);if(n==13||n==27)return!0;if(n==37||qr&&n==66&&r=="c"){let a=n==37?JN(t,t.state.selection.from)=="ltr"?-1:1:-1;return GN(t,a,r)||Oc(t,a)}else if(n==39||qr&&n==70&&r=="c"){let a=n==39?JN(t,t.state.selection.from)=="ltr"?1:-1:1;return GN(t,a,r)||Oc(t,a)}else{if(n==38||qr&&n==80&&r=="c")return QN(t,-1,r)||Oc(t,-1);if(n==40||qr&&n==78&&r=="c")return VL(t)||QN(t,1,r)||Oc(t,1);if(r==(qr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Ty(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")||nc.fromSchema(t.state.schema),c=oC(),u=c.createElement("div");u.appendChild(o.serializeFragment(r,{document:c}));let h=u.firstChild,f,m=0;for(;h&&h.nodeType==1&&(f=iC[h.nodeName.toLowerCase()]);){for(let b=f.length-1;b>=0;b--){let N=c.createElement(f[b]);for(;u.firstChild;)N.appendChild(u.firstChild);u.appendChild(N),m++}h=u.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${a} ${i}${m?` -${m}`:""} ${JSON.stringify(n)}`);let g=t.someProp("clipboardTextSerializer",b=>b(e,t))||e.content.textBetween(0,e.content.size,` - -`);return{dom:u,text:g,slice:e}}function nC(t,e,n,r,a){let i=a.parent.type.spec.code,o,c;if(!n&&!e)return null;let u=!!e&&(r||i||!n);if(u){if(t.someProp("transformPastedText",g=>{e=g(e,i||r,t)}),i)return c=new ze(Ce.from(t.state.schema.text(e.replace(/\r\n?/g,` -`))),0,0),t.someProp("transformPasted",g=>{c=g(c,t,!0)}),c;let m=t.someProp("clipboardTextParser",g=>g(e,a,r,t));if(m)c=m;else{let g=a.marks(),{schema:b}=t.state,N=nc.fromSchema(b);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(j=>{let v=o.appendChild(document.createElement("p"));j&&v.appendChild(N.serializeNode(b.text(j,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),o=GL(n),Hu&&JL(o);let h=o&&o.querySelector("[data-pm-slice]"),f=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(f&&f[3])for(let m=+f[3];m>0;m--){let g=o.firstChild;for(;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;o=g}if(c||(c=(t.someProp("clipboardParser")||t.someProp("domParser")||Ro.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||f),context:a,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!WL.test(g.parentNode.nodeName)?{ignore:!0}:null}})),f)c=QL(ZN(c,+f[1],+f[2]),f[4]);else if(c=ze.maxOpen(KL(c.content,a),!0),c.openStart||c.openEnd){let m=0,g=0;for(let b=c.content.firstChild;m{c=m(c,t,u)}),c}const WL=/^(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 KL(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&&rC(u,i,c,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=aC(o[o.length-1],i.length));let f=sC(c,u);o.push(f),a=a.matchType(f.type),i=u}}),o)return Ce.from(o)}return t}function sC(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,Ce.from(t));return t}function rC(t,e,n,r,a){if(a1&&(i=0),a=n&&(c=e<0?o.contentMatchAt(0).fillBefore(c,i<=a).append(c):c.append(o.contentMatchAt(o.childCount).fillBefore(Ce.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(c))}function ZN(t,e,n){return en})),cx.createHTML(t)):t}function GL(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=oC().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),a;if((a=r&&iC[r[1].toLowerCase()])&&(t=a.map(i=>"<"+i+">").join("")+t+a.map(i=>"").reverse().join("")),n.innerHTML=qL(t),a)for(let i=0;i=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;a=Ce.from(u.create(r[c+1],a)),i++,o++}return new ze(a,i,o)}const Gs={},Js={},YL={touchstart:!0,touchmove:!0};class XL{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 ZL(t){for(let e in Gs){let n=Gs[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{tO(t,r)&&!My(t,r)&&(t.editable||!(r.type in Js))&&n(t,r)},YL[e]?{passive:!0}:void 0)}Ds&&t.dom.addEventListener("input",()=>null),m0(t)}function Mo(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function eO(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 m0(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>My(t,r))})}function My(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function tO(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 nO(t,e){!My(t,e)&&Gs[e.type]&&(t.editable||!(e.type in Js))&&Gs[e.type](t,e)}Js.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!cC(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Pi&&Es&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),nd&&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,Cl(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||UL(t,n)?n.preventDefault():Mo(t,"key")};Js.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Js.keypress=(t,e)=>{let n=e;if(cC(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||qr&&n.metaKey)return;if(t.someProp("handleKeyPress",a=>a(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof ot)||!r.$from.sameParent(r.$to)){let a=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(a).scrollIntoView();!/[\r\n]/.test(a)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,a,i))&&t.dispatch(i()),n.preventDefault()}};function Wp(t){return{left:t.clientX,top:t.clientY}}function sO(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 Gc(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 rO(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&it.isSelectable(r)?(Gc(t,new it(n)),!0):!1}function aO(t,e){if(e==-1)return!1;let n=t.state.selection,r,a;n instanceof it&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let c=o>i.depth?i.nodeAfter:i.node(o);if(it.isSelectable(c)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?a=i.before(n.$from.depth):a=i.before(o);break}}return a!=null?(Gc(t,it.create(t.state.doc,a)),!0):!1}function iO(t,e,n,r,a){return Ay(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(a?aO(t,n):rO(t,n))}function oO(t,e,n,r){return Ay(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",a=>a(t,e,r))}function lO(t,e,n,r){return Ay(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",a=>a(t,e,r))||cO(t,n,r)}function cO(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Gc(t,ot.create(r,0,r.content.size)),!0):!1;let a=r.resolve(e);for(let i=a.depth+1;i>0;i--){let o=i>a.depth?a.nodeAfter:a.node(i),c=a.before(i);if(o.inlineContent)Gc(t,ot.create(r,c+1,c+1+o.content.size));else if(it.isSelectable(o))Gc(t,it.create(r,c));else continue;return!0}}function Py(t){return Vf(t)}const lC=qr?"metaKey":"ctrlKey";Gs.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Py(t),a=Date.now(),i="singleClick";a-t.input.lastClick.time<500&&sO(n,t.input.lastClick)&&!n[lC]&&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(Wp(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new dO(t,o,n,!!r)):(i=="doubleClick"?oO:lO)(t,o.pos,o.inside,n)?n.preventDefault():Mo(t,"pointer"))};class dO{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[lC],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let f=e.state.doc.resolve(n.pos);i=f.parent,o=f.depth?f.before():0}const c=a?null:r.target,u=c?e.docView.nearestDesc(c,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:h}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||h instanceof it&&h.from<=o&&h.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Jr&&!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)),Mo(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(()=>Oi(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(Wp(e))),this.updateAllowDefault(e),this.allowDefault||!n?Mo(this.view,"pointer"):iO(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ds&&this.mightDrag&&!this.mightDrag.node.isAtom||Es&&!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)?(Gc(this.view,ft.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Mo(this.view,"pointer")}move(e){this.updateAllowDefault(e),Mo(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)}}Gs.touchstart=t=>{t.input.lastTouch=Date.now(),Py(t),Mo(t,"pointer")};Gs.touchmove=t=>{t.input.lastTouch=Date.now(),Mo(t,"pointer")};Gs.contextmenu=t=>Py(t);function cC(t,e){return t.composing?!0:Ds&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const uO=Pi?5e3:-1;Js.compositionstart=Js.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof ot&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Es&&FS&&hO(t)))t.markCursor=t.state.storedMarks||n.marks(),Vf(t,!0),t.markCursor=null;else if(Vf(t,!e.selection.empty),Jr&&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}dC(t,uO)};function hO(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"}Js.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++,dC(t,20))};function dC(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Vf(t),e))}function uC(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=pO());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function fO(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=aL(e.focusNode,e.focusOffset),r=iL(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 pO(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Vf(t,e=!1){if(!(Pi&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),uC(t),e||t.docView&&t.docView.dirty){let n=Cy(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 mO(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 Mu=pr&&Lo<15||nd&&dL<604;Gs.copy=Js.cut=(t,e)=>{let n=e,r=t.state.selection,a=n.type=="cut";if(r.empty)return;let i=Mu?null:n.clipboardData,o=r.content(),{dom:c,text:u}=Ty(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",c.innerHTML),i.setData("text/plain",u)):mO(t,c),a&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function gO(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function xO(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?Au(t,r.value,null,a,e):Au(t,r.textContent,r.innerHTML,a,e)},50)}function Au(t,e,n,r,a){let i=nC(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,a,i||ze.empty)))return!0;if(!i)return!1;let o=gO(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 hC(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," "):""}Js.paste=(t,e)=>{let n=e;if(t.composing&&!Pi)return;let r=Mu?null:n.clipboardData,a=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Au(t,hC(r),r.getData("text/html"),a,n)?n.preventDefault():xO(t,n)};class fC{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const yO=qr?"altKey":"ctrlKey";function pC(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[yO]}Gs.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(Wp(n)),o;if(!(i&&i.pos>=a.from&&i.pos<=(a instanceof it?a.to-1:a.to))){if(r&&r.mightDrag)o=it.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let m=t.docView.nearestDesc(n.target,!0);m&&m.node.type.spec.draggable&&m!=t.docView&&(o=it.create(t.state.doc,m.posBefore))}}let c=(o||t.state.selection).content(),{dom:u,text:h,slice:f}=Ty(t,c);(!n.dataTransfer.files.length||!Es||zS>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Mu?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",Mu||n.dataTransfer.setData("text/plain",h),t.dragging=new fC(f,pC(t,n),o)};Gs.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Js.dragover=Js.dragenter=(t,e)=>e.preventDefault();Js.drop=(t,e)=>{try{bO(t,e,t.dragging)}finally{t.dragging=null}};function bO(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Wp(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=nC(t,hC(e.dataTransfer),Mu?null:e.dataTransfer.getData("text/html"),!1,a);let o=!!(n&&pC(t,e));if(t.someProp("handleDrop",b=>b(t,e,i||ze.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let c=i?yS(t.state.doc,a.pos,i):a.pos;c==null&&(c=a.pos);let u=t.state.tr;if(o){let{node:b}=n;b?b.replace(u):u.deleteSelection()}let h=u.mapping.map(c),f=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,m=u.doc;if(f?u.replaceRangeWith(h,h,i.content.firstChild):u.replaceRange(h,h,i),u.doc.eq(m))return;let g=u.doc.resolve(h);if(f&&it.isSelectable(i.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(i.content.firstChild))u.setSelection(new it(g));else{let b=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((N,j,v,k)=>b=k),u.setSelection(Ey(t,g,u.doc.resolve(b)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}Gs.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())&&Oi(t)},20))};Gs.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)};Gs.beforeinput=(t,e)=>{if(Es&&Pi&&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,Cl(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 Js)Gs[t]=Js[t];function Pu(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 Hf{constructor(e,n){this.toDOM=e,this.spec=n||Ll,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 ts(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Hf&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Pu(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Do{constructor(e,n){this.attrs=e,this.spec=n||Ll}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 ts(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==Ls||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Ll)}mapInner(e,n,r,a,i){let o;for(let c=0;c{let h=u+r,f;if(f=gC(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 Do){let h=Math.max(i,u.from)-i,f=Math.min(o,u.to)-i;ha.map(e,n,Ll));return vo.from(r)}forChild(e,n){if(n.isLeaf)return an.empty;let r=[];for(let a=0;an instanceof an)?e:e.reduce((n,r)=>n.concat(r instanceof an?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let v=j-N-(b-g);for(let k=0;kT+f-m)continue;let C=c[k]+f-m;b>=C?c[k+1]=g<=C?-2:-1:g>=f&&v&&(c[k]+=v,c[k+1]+=v)}m+=v}),f=n.maps[h].map(f,-1)}let u=!1;for(let h=0;h=r.content.size){u=!0;continue}let g=n.map(t[h+1]+i,-1),b=g-a,{index:N,offset:j}=r.content.findIndex(m),v=r.maybeChild(N);if(v&&j==m&&j+v.nodeSize==b){let k=c[h+2].mapInner(n,v,f+1,t[h]+i+1,o);k!=Ls?(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=Uf(h,r,0,o);e=f.local;for(let m=0;mn&&o.to{let h=gC(t,c,u+n);if(h){i=!0;let f=Uf(h,c,n+u+1,r);f!=Ls&&a.push(u,u+c.nodeSize,f)}});let o=mC(i?xC(t):t,-n).sort(Ol);for(let c=0;c0;)e++;t.splice(e,0,n)}function dx(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Ls&&e.push(r)}),t.cursorWrapper&&e.push(an.create(t.state.doc,[t.cursorWrapper.deco])),vo.from(e)}const wO={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},jO=pr&&Lo<=11;class kO{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 SO{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new kO,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():Ds&&e.composing&&r.some(a=>a.type=="childList"&&a.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),jO&&(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,wO)),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(qN(this.view)){if(this.suppressingSelectionUpdates)return Oi(this.view);if(pr&&Lo<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ql(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=td(i))n.add(i);for(let i=e.anchorNode;i;i=td(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)&&qN(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(Jr&&u.length){let f=u.filter(m=>m.nodeName=="BR");if(f.length==2){let[m,g]=f;m.parentNode&&m.parentNode.parentNode==g.parentNode?g.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let g of f){let b=g.parentNode;b&&b.nodeName=="LI"&&(!m||TO(e,m)!=b)&&g.remove()}}}let h=null;i<0&&a&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||a)&&(i>-1&&(e.docView.markDirty(i,o),CO(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,MO(e,u)),this.handleDOMChange(i,o,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Oi(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let f=0;fa;v--){let k=r.childNodes[v-1],T=k.pmViewDesc;if(k.nodeName=="BR"&&!T){i=v;break}if(!T||T.size)break}let m=t.state.doc,g=t.someProp("domParser")||Ro.fromSchema(t.state.schema),b=m.resolve(o),N=null,j=g.parse(r,{topNode:b.parent,topMatch:b.parent.contentMatchAt(b.index()),topOpen:!0,from:a,to:i,preserveWhitespace:b.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:PO,context:b});if(h&&h[0].pos!=null){let v=h[0].pos,k=h[1]&&h[1].pos;k==null&&(k=v),N={anchor:v+o,head:k+o}}return{doc:j,sel:N,from:o,to:c}}function PO(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Ds&&/^(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||Ds&&/^(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 IO=/^(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 RO(t,e,n,r,a){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let I=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,z=Cy(t,I);if(z&&!t.state.selection.eq(z)){if(Es&&Pi&&t.input.lastKeyCode===13&&Date.now()-100Q(t,Cl(13,"Enter"))))return;let L=t.state.tr.setSelection(z);I=="pointer"?L.setMeta("pointer",!0):I=="key"&&L.scrollIntoView(),i&&L.setMeta("composition",i),t.dispatch(L)}return}let o=t.state.doc.resolve(e),c=o.sharedDepth(n);e=o.before(c+1),n=t.state.doc.resolve(n).after(c+1);let u=t.state.selection,h=AO(t,e,n),f=t.state.doc,m=f.slice(h.from,h.to),g,b;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||Pi)&&a.some(I=>I.nodeType==1&&!IO.test(I.nodeName))&&(!N||N.endA>=N.endB)&&t.someProp("handleKeyDown",I=>I(t,Cl(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!N)if(r&&u instanceof ot&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(h.sel&&h.sel.anchor!=h.sel.head))N={start:u.from,endA:u.to,endB:u.to};else{if(h.sel){let I=aw(t,t.state.doc,h.sel);if(I&&!I.eq(t.state.selection)){let z=t.state.tr.setSelection(I);i&&z.setMeta("composition",i),t.dispatch(z)}}return}t.state.selection.fromt.state.selection.from&&N.start<=t.state.selection.from+2&&t.state.selection.from>=h.from?N.start=t.state.selection.from:N.endA=t.state.selection.to-2&&t.state.selection.to<=h.to&&(N.endB+=t.state.selection.to-N.endA,N.endA=t.state.selection.to)),pr&&Lo<=11&&N.endB==N.start+1&&N.endA==N.start&&N.start>h.from&&h.doc.textBetween(N.start-h.from-1,N.start-h.from+1)=="  "&&(N.start--,N.endA--,N.endB--);let j=h.doc.resolveNoCache(N.start-h.from),v=h.doc.resolveNoCache(N.endB-h.from),k=f.resolve(N.start),T=j.sameParent(v)&&j.parent.inlineContent&&k.end()>=N.endA;if((nd&&t.input.lastIOSEnter>Date.now()-225&&(!T||a.some(I=>I.nodeName=="DIV"||I.nodeName=="P"))||!T&&j.posI(t,Cl(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>N.start&&OO(f,N.start,N.endA,j,v)&&t.someProp("handleKeyDown",I=>I(t,Cl(8,"Backspace")))){Pi&&Es&&t.domObserver.suppressSelectionUpdates();return}Es&&N.endB==N.start&&(t.input.lastChromeDelete=Date.now()),Pi&&!T&&j.start()!=v.start()&&v.parentOffset==0&&j.depth==v.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==N.endA&&(N.endB-=2,v=h.doc.resolveNoCache(N.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function(I){return I(t,Cl(13,"Enter"))})},20));let C=N.start,R=N.endA,O=I=>{let z=I||t.state.tr.replace(C,R,h.doc.slice(N.start-h.from,N.endB-h.from));if(h.sel){let L=aw(t,z.doc,h.sel);L&&!(Es&&t.composing&&L.empty&&(N.start!=N.endB||t.input.lastChromeDeleteOi(t),20));let I=O(t.state.tr.delete(C,R)),z=f.resolve(N.start).marksAcross(f.resolve(N.endA));z&&I.ensureMarks(z),t.dispatch(I)}else if(N.endA==N.endB&&(U=LO(j.parent.content.cut(j.parentOffset,v.parentOffset),k.parent.content.cut(k.parentOffset,N.endA-k.start())))){let I=O(t.state.tr);U.type=="add"?I.addMark(C,R,U.mark):I.removeMark(C,R,U.mark),t.dispatch(I)}else if(j.parent.child(j.index()).isText&&j.index()==v.index()-(v.textOffset?0:1)){let I=j.parent.textBetween(j.parentOffset,v.parentOffset),z=()=>O(t.state.tr.insertText(I,C,R));t.someProp("handleTextInput",L=>L(t,C,R,I,z))||t.dispatch(z())}else t.dispatch(O());else t.dispatch(O())}function aw(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Ey(t,e.resolve(n.anchor),e.resolve(n.head))}function LO(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||ux(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 DO(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 yC{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 XL,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(uw),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=cw(this),lw(this),this.nodeViews=dw(this),this.docView=BN(this.state.doc,ow(this),dx(this),this.dom,this),this.domObserver=new SO(this,(r,a,i,o)=>RO(this,r,a,i,o)),this.domObserver.start(),ZL(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&&m0(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(uw),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&&(uC(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=dw(this);$O(b,this.nodeViews)&&(this.nodeViews=b,i=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&m0(this),this.editable=cw(this),lw(this);let u=dx(this),h=ow(this),f=a.plugins!=e.plugins&&!a.doc.eq(e.doc)?"reset":e.scrollToSelection>a.scrollToSelection?"to selection":"preserve",m=i||!this.docView.matchesNode(e.doc,h,u);(m||!e.selection.eq(a.selection))&&(o=!0);let g=f=="preserve"&&o&&this.dom.style.overflowAnchor==null&&fL(this);if(o){this.domObserver.stop();let b=m&&(pr||Es)&&!this.composing&&!a.selection.empty&&!e.selection.empty&&_O(a.selection,e.selection);if(m){let N=Es?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=fO(this)),(i||!this.docView.update(e.doc,h,u,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=BN(e.doc,h,u,this.dom,this)),N&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(b=!0)}b||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&_L(this))?Oi(this,b):(ZS(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(a),!((r=this.dragging)===null||r===void 0)&&r.node&&!a.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,a),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():g&&pL(g)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof it){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&ON(this,n.getBoundingClientRect(),e)}else ON(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 fC(e.slice,e.move,a<0?void 0:it.create(this.state.doc,a))}someProp(e,n){let r=this._props&&this._props[e],a;if(r!=null&&(a=n?n(r):r))return a;for(let o=0;on.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return vL(this,e)}coordsAtPos(e,n=1){return WS(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 SL(this,n||this.state,e)}pasteHTML(e,n){return Au(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Au(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Ty(this,e)}destroy(){this.docView&&(eO(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],dx(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,sL())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return nO(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ds&&this.root.nodeType===11&&lL(this.dom.ownerDocument)==this.dom&&EO(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}yC.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function ow(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"),[ts.node(0,t.state.doc.content.size,e)]}function lw(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:ts.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function cw(t){return!t.someProp("editable",e=>e(t.state)===!1)}function _O(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 dw(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 $O(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 uw(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 Fo={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:"'"},Wf={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},zO=typeof navigator<"u"&&/Mac/.test(navigator.platform),FO=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Cs=0;Cs<10;Cs++)Fo[48+Cs]=Fo[96+Cs]=String(Cs);for(var Cs=1;Cs<=24;Cs++)Fo[Cs+111]="F"+Cs;for(var Cs=65;Cs<=90;Cs++)Fo[Cs]=String.fromCharCode(Cs+32),Wf[Cs]=String.fromCharCode(Cs);for(var hx in Fo)Wf.hasOwnProperty(hx)||(Wf[hx]=Fo[hx]);function BO(t){var e=zO&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||FO&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Wf:Fo)[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 VO=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),HO=typeof navigator<"u"&&/Win/.test(navigator.platform);function UO(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)qO(t,n,{get:e[n],enumerable:!0})};function Kp(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 qp=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:a}=n,i=this.buildProps(a);return Object.fromEntries(Object.entries(t).map(([o,c])=>[o,(...h)=>{const f=c(...h)(i);return!a.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(a),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:a}=this,{view:i}=r,o=[],c=!!t,u=t||a.tr,h=()=>(!c&&e&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(u),o.every(m=>m===!0)),f={...Object.fromEntries(Object.entries(n).map(([m,g])=>[m,(...N)=>{const j=this.buildProps(u,e),v=g(...N)(j);return o.push(v),f}])),run:h};return f}createCan(t){const{rawCommands:e,state:n}=this,r=!1,a=t||n.tr,i=this.buildProps(a,r);return{...Object.fromEntries(Object.entries(e).map(([c,u])=>[c,(...h)=>u(...h)({...i,dispatch:void 0})])),chain:()=>this.createChain(a,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:a}=this,{view:i}=r,o={tr:t,editor:r,view:i,state:Kp({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}},bC={};Oy(bC,{blur:()=>GO,clearContent:()=>JO,clearNodes:()=>QO,command:()=>YO,createParagraphNear:()=>XO,cut:()=>ZO,deleteCurrentNode:()=>eD,deleteNode:()=>tD,deleteRange:()=>nD,deleteSelection:()=>sD,enter:()=>rD,exitCode:()=>aD,extendMarkRange:()=>iD,first:()=>oD,focus:()=>cD,forEach:()=>dD,insertContent:()=>uD,insertContentAt:()=>pD,joinBackward:()=>xD,joinDown:()=>gD,joinForward:()=>yD,joinItemBackward:()=>bD,joinItemForward:()=>vD,joinTextblockBackward:()=>ND,joinTextblockForward:()=>wD,joinUp:()=>mD,keyboardShortcut:()=>kD,lift:()=>SD,liftEmptyBlock:()=>CD,liftListItem:()=>ED,newlineInCode:()=>TD,resetAttributes:()=>MD,scrollIntoView:()=>AD,selectAll:()=>PD,selectNodeBackward:()=>ID,selectNodeForward:()=>RD,selectParentNode:()=>LD,selectTextblockEnd:()=>OD,selectTextblockStart:()=>DD,setContent:()=>_D,setMark:()=>s_,setMeta:()=>r_,setNode:()=>a_,setNodeSelection:()=>i_,setTextDirection:()=>o_,setTextSelection:()=>l_,sinkListItem:()=>c_,splitBlock:()=>d_,splitListItem:()=>u_,toggleList:()=>h_,toggleMark:()=>f_,toggleNode:()=>p_,toggleWrap:()=>m_,undoInputRule:()=>g_,unsetAllMarks:()=>x_,unsetMark:()=>y_,unsetTextDirection:()=>b_,updateAttributes:()=>v_,wrapIn:()=>N_,wrapInList:()=>w_});var GO=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),JO=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),QO=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:a}=r;return n&&a.forEach(({$from:i,$to:o})=>{t.doc.nodesBetween(i.pos,o.pos,(c,u)=>{if(c.type.isText)return;const{doc:h,mapping:f}=e,m=h.resolve(f.map(u)),g=h.resolve(f.map(u+c.nodeSize)),b=m.blockRange(g);if(!b)return;const N=fd(b);if(c.type.isTextblock){const{defaultType:j}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(b.start,j)}(N||N===0)&&e.lift(b,N)})}),!0},YO=t=>e=>t(e),XO=()=>({state:t,dispatch:e})=>LS(t,e),ZO=(t,e)=>({editor:n,tr:r})=>{const{state:a}=n,i=a.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new ot(r.doc.resolve(Math.max(o-1,0)))),!0},eD=()=>({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 Gn(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 tD=t=>({tr:e,state:n,dispatch:r})=>{const a=Gn(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},nD=t=>({tr:e,dispatch:n})=>{const{from:r,to:a}=t;return n&&e.delete(r,a),!0},sD=()=>({state:t,dispatch:e})=>vy(t,e),rD=()=>({commands:t})=>t.keyboardShortcut("Enter"),aD=()=>({state:t,dispatch:e})=>V6(t,e);function Dy(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Kf(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(a=>n.strict?e[a]===t[a]:Dy(e[a])?e[a].test(t[a]):e[a]===t[a]):!0}function vC(t,e,n={}){return t.find(r=>r.type===e&&Kf(Object.fromEntries(Object.keys(n).map(a=>[a,r.attrs[a]])),n))}function hw(t,e,n={}){return!!vC(t,e,n)}function _y(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),!vC([...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&&hw([...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=zi(t,r.schema),{doc:o,selection:c}=n,{$from:u,from:h,to:f}=c;if(a){const m=_y(u,i,e);if(m&&m.from<=h&&m.to>=f){const g=ot.create(o,m.from,m.to);n.setSelection(g)}}return!0},oD=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=()=>{(qf()||fw())&&r.dom.focus(),lD()&&!qf()&&!fw()&&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=wC(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},dD=(t,e)=>n=>t.every((r,a)=>e(r,{...n,index:a})),uD=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),jC=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&&jC(r)}return t};function tf(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 jC(n)}function Iu(t,e,n){if(t instanceof Ri||t instanceof Ce)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,a=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return Ce.fromArray(t.map(c=>e.nodeFromJSON(c)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),Iu("",e,n)}if(a){if(n.errorOnInvalidContent){let o=!1,c="";const u=new oS({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?Ro.fromSchema(u).parseSlice(tf(t),n.parseOptions):Ro.fromSchema(u).parse(tf(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const i=Ro.fromSchema(e);return n.slice?i.parseSlice(tf(t),n.parseOptions).content:i.parse(tf(t),n.parseOptions)}return Iu("",e,n)}function hD(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 fD=t=>!("type"in t),pD=(t,e,n)=>({tr:r,dispatch:a,editor:i})=>{var o;if(a){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const u=v=>{i.emit("contentError",{editor:i,error:v,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},h={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Iu(e,i.schema,{parseOptions:h,errorOnInvalidContent:!0})}catch(v){u(v)}try{c=Iu(e,i.schema,{parseOptions:h,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(v){return u(v),!1}let{from:f,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,b=!0;if((fD(c)?c:[c]).forEach(v=>{v.check(),g=g?v.isText&&v.marks.length===0:!1,b=b?v.isBlock:!1}),f===m&&b){const{parent:v}=r.doc.resolve(f);v.isTextblock&&!v.type.spec.code&&!v.childCount&&(f-=1,m+=1)}let j;if(g){if(Array.isArray(e))j=e.map(v=>v.text||"").join("");else if(e instanceof Ce){let v="";e.forEach(k=>{k.text&&(v+=k.text)}),j=v}else typeof e=="object"&&e&&e.text?j=e.text:j=e;r.insertText(j,f,m)}else{j=c;const v=r.doc.resolve(f),k=v.node(),T=v.parentOffset===0,C=k.isText||k.isTextblock,R=k.content.size>0;T&&C&&R&&(f=Math.max(0,f-1)),r.replaceWith(f,m,j)}n.updateSelection&&hD(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:f,text:j}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:f,text:j})}return!0},mD=()=>({state:t,dispatch:e})=>z6(t,e),gD=()=>({state:t,dispatch:e})=>F6(t,e),xD=()=>({state:t,dispatch:e})=>ES(t,e),yD=()=>({state:t,dispatch:e})=>PS(t,e),bD=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Fp(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},vD=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Fp(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})=>_6(t,e),wD=()=>({state:t,dispatch:e})=>$6(t,e);function kC(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function jD(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=jD(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 Bo(t,e,n={}){const{from:r,to:a,empty:i}=t.selection,o=e?Gn(e,t.schema):null,c=[];t.doc.nodesBetween(r,a,(m,g)=>{if(m.isText)return;const b=Math.max(r,g),N=Math.min(a,g+m.nodeSize);c.push({node:m,from:b,to:N})});const u=a-r,h=c.filter(m=>o?o.name===m.node.type.name:!0).filter(m=>Kf(m.node.attrs,n,{strict:!1}));return i?!!h.length:h.reduce((m,g)=>m+g.to-g.from,0)>=u}var SD=(t,e={})=>({state:n,dispatch:r})=>{const a=Gn(t,n.schema);return Bo(n,a,e)?B6(n,r):!1},CD=()=>({state:t,dispatch:e})=>OS(t,e),ED=t=>({state:e,dispatch:n})=>{const r=Gn(t,e.schema);return Z6(r)(e,n)},TD=()=>({state:t,dispatch:e})=>RS(t,e);function Gp(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function pw(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 MD=(t,e)=>({tr:n,state:r,dispatch:a})=>{let i=null,o=null;const c=Gp(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(i=Gn(t,r.schema)),c==="mark"&&(o=zi(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,pw(f.attrs,e))),o&&f.marks.length&&f.marks.forEach(g=>{o===g.type&&(u=!0,a&&n.addMark(m,m+f.nodeSize,o.create(pw(g.attrs,e))))})})}),u},AD=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),PD=()=>({tr:t,dispatch:e})=>{if(e){const n=new Mr(t.doc);t.setSelection(n)}return!0},ID=()=>({state:t,dispatch:e})=>MS(t,e),RD=()=>({state:t,dispatch:e})=>IS(t,e),LD=()=>({state:t,dispatch:e})=>W6(t,e),OD=()=>({state:t,dispatch:e})=>G6(t,e),DD=()=>({state:t,dispatch:e})=>q6(t,e);function g0(t,e,n={},r={}){return Iu(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var _D=(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=g0(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 SC(t,e){const n=zi(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 CC(t,e){const n=new yy(t);return e.forEach(r=>{r.steps.forEach(a=>{n.step(a)})}),n}function $D(t){for(let e=0;e{n(a)&&r.push({node:a,pos:i})}),r}function EC(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 Jp(t){return e=>EC(e.$from,t)}function rt(t,e,n){return t.config[e]===void 0&&t.parent?rt(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?rt(t.parent,e,n):null}):t.config[e]}function $y(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=rt(e,"addExtensions",n);return r?[e,...$y(r())]:e}).flat(10)}function zy(t,e){const n=nc.fromSchema(e).serializeFragment(t),a=document.implementation.createHTMLDocument().createElement("div");return a.appendChild(n),a.innerHTML}function TC(t){return typeof t=="function"}function Kt(t,e=void 0,...n){return TC(t)?e?t.bind(e)(...n):t(...n):t}function FD(t={}){return Object.keys(t).length===0&&t.constructor===Object}function sd(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 MC(t){const e=[],{nodeExtensions:n,markExtensions:r}=sd(t),a=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(h=>h.name!=="text").map(h=>h.name),c=r.map(h=>h.name),u=[...o,...c];return t.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage,extensions:a},m=rt(h,"addGlobalAttributes",f);if(!m)return;m().forEach(b=>{let N;Array.isArray(b.types)?N=b.types:b.types==="*"?N=u:b.types==="nodes"?N=o:b.types==="marks"?N=c:N=[],N.forEach(j=>{Object.entries(b.attributes).forEach(([v,k])=>{e.push({type:j,name:v,attribute:{...i,...k}})})})})}),a.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage},m=rt(h,"addAttributes",f);if(!m)return;const g=m();Object.entries(g).forEach(([b,N])=>{const j={...i,...N};typeof(j==null?void 0:j.default)=="function"&&(j.default=j.default()),j!=null&&j.isRequired&&(j==null?void 0:j.default)===void 0&&delete j.default,e.push({type:h.name,name:b,attribute:j})})}),e}function BD(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 mw(t){const e=[],n=BD(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([...mw(r[a]),...mw(i)]);r[a]=Array.from(c.entries()).map(([u,h])=>`${u}: ${h}`).join("; ")}else r[a]=i}),r},{})}function Ru(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)=>Gt(n,r),{})}function VD(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function gw(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):VD(n.getAttribute(o.name));return c==null?i:{...i,[o.name]:c}},{});return{...r,...a}}}}function xw(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&FD(n)?!1:n!=null))}function yw(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 HD(t,e){var n;const r=MC(t),{nodeExtensions:a,markExtensions:i}=sd(t),o=(n=a.find(h=>rt(h,"topNode")))==null?void 0:n.name,c=Object.fromEntries(a.map(h=>{const f=r.filter(k=>k.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((k,T)=>{const C=rt(T,"extendNodeSchema",m);return{...k,...C?C(h):{}}},{}),b=xw({...g,content:Kt(rt(h,"content",m)),marks:Kt(rt(h,"marks",m)),group:Kt(rt(h,"group",m)),inline:Kt(rt(h,"inline",m)),atom:Kt(rt(h,"atom",m)),selectable:Kt(rt(h,"selectable",m)),draggable:Kt(rt(h,"draggable",m)),code:Kt(rt(h,"code",m)),whitespace:Kt(rt(h,"whitespace",m)),linebreakReplacement:Kt(rt(h,"linebreakReplacement",m)),defining:Kt(rt(h,"defining",m)),isolating:Kt(rt(h,"isolating",m)),attrs:Object.fromEntries(f.map(yw))}),N=Kt(rt(h,"parseHTML",m));N&&(b.parseDOM=N.map(k=>gw(k,f)));const j=rt(h,"renderHTML",m);j&&(b.toDOM=k=>j({node:k,HTMLAttributes:Ru(k,f)}));const v=rt(h,"renderText",m);return v&&(b.toText=v),[h.name,b]})),u=Object.fromEntries(i.map(h=>{const f=r.filter(v=>v.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((v,k)=>{const T=rt(k,"extendMarkSchema",m);return{...v,...T?T(h):{}}},{}),b=xw({...g,inclusive:Kt(rt(h,"inclusive",m)),excludes:Kt(rt(h,"excludes",m)),group:Kt(rt(h,"group",m)),spanning:Kt(rt(h,"spanning",m)),code:Kt(rt(h,"code",m)),attrs:Object.fromEntries(f.map(yw))}),N=Kt(rt(h,"parseHTML",m));N&&(b.parseDOM=N.map(v=>gw(v,f)));const j=rt(h,"renderHTML",m);return j&&(b.toDOM=v=>j({mark:v,HTMLAttributes:Ru(v,f)})),[h.name,b]}));return new oS({topNode:o,nodes:c,marks:u})}function UD(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function mu(t){return t.sort((n,r)=>{const a=rt(n,"priority")||100,i=rt(r,"priority")||100;return a>i?-1:ar.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function PC(t,e,n){const{from:r,to:a}=e,{blockSeparator:i=` - -`,textSerializers:o={}}=n||{};let c="";return t.nodesBetween(r,a,(u,h,f,m)=>{var g;u.isBlock&&h>r&&(c+=i);const b=o==null?void 0:o[u.type.name];if(b)return f&&(c+=b({node:u,pos:h,parent:f,index:m,range:e})),!1;u.isText&&(c+=(g=u==null?void 0:u.text)==null?void 0:g.slice(Math.max(r,h)-h,a-h))}),c}function WD(t,e){const n={from:0,to:t.content.size};return PC(t,n,e)}function IC(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function KD(t,e){const n=Gn(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 RC(t,e){const n=Gp(typeof e=="string"?e:e.name,t.schema);return n==="node"?KD(t,e):n==="mark"?SC(t,e):{}}function qD(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 GD(t){const e=qD(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 LC(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((a,i)=>{const o=[];if(a.ranges.length)a.forEach((c,u)=>{o.push({from:c,to:u})});else{const{from:c,to:u}=n[i];if(c===void 0||u===void 0)return;o.push({from:c,to:u})}o.forEach(({from:c,to:u})=>{const h=e.slice(i).map(c,-1),f=e.slice(i).map(u),m=e.invert().map(h,-1),g=e.invert().map(f);r.push({oldRange:{from:m,to:g},newRange:{from:h,to:f}})})}),GD(r)}function Fy(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(a=>{const i=n.resolve(t),o=_y(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 JD=(t,e,n,r=20)=>{const a=t.doc.resolve(n);let i=r,o=null;for(;i>0&&o===null;){const c=a.node(i);(c==null?void 0:c.type.name)===e?o=c:i-=1}return[o,i]};function Zd(t,e){return e.nodes[t]||e.marks[t]||null}function vf(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 QD=(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 x0(t,e,n={}){const{empty:r,ranges:a}=t.selection,i=e?zi(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>i?i.name===m.type.name:!0).find(m=>Kf(m.attrs,n,{strict:!1}));let o=0;const c=[];if(a.forEach(({$from:m,$to:g})=>{const b=m.pos,N=g.pos;t.doc.nodesBetween(b,N,(j,v)=>{if(i&&j.inlineContent&&!j.type.allowsMarkType(i))return!1;if(!j.isText&&!j.marks.length)return;const k=Math.max(b,v),T=Math.min(N,v+j.nodeSize),C=T-k;o+=C,c.push(...j.marks.map(R=>({mark:R,from:k,to:T})))})}),o===0)return!1;const u=c.filter(m=>i?i.name===m.mark.type.name:!0).filter(m=>Kf(m.mark.attrs,n,{strict:!1})).reduce((m,g)=>m+g.to-g.from,0),h=c.filter(m=>i?m.mark.type!==i&&m.mark.type.excludes(i):!0).reduce((m,g)=>m+g.to-g.from,0);return(u>0?u+h:u)>=o}function YD(t,e,n={}){if(!e)return Bo(t,null,n)||x0(t,null,n);const r=Gp(e,t.schema);return r==="node"?Bo(t,e,n):r==="mark"?x0(t,e,n):!1}var XD=(t,e)=>{const{$from:n,$to:r,$anchor:a}=t.selection;if(e){const i=Jp(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 bw(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function vw(t,e){const{nodeExtensions:n}=sd(e),r=n.find(o=>o.name===t);if(!r)return!1;const a={name:r.name,options:r.options,storage:r.storage},i=Kt(rt(r,"group",a));return typeof i!="string"?!1:i.split(" ").includes("list")}function Qp(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&&(Qp(i,{ignoreWhitespace:n,checkChildren:e})||(a=!1))}),a}return!1}function OC(t){return t instanceof it}var DC=class _C{constructor(e){this.position=e}static fromJSON(e){return new _C(e.position)}toJSON(){return{position:this.position}}};function e_(t,e){const n=e.mapping.mapResult(t.position);return{position:new DC(n.pos),mapResult:n}}function t_(t){return new DC(t)}function n_(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,g)=>{if(h)return!1;if(f.isInline){const b=!g||g.type.allowsMarkType(n),N=!!n.isInSet(f.marks)||!f.marks.some(j=>j.type.excludes(n));h=b&&N}return!h}),h})}var s_=(t,e={})=>({tr:n,state:r,dispatch:a})=>{const{selection:i}=n,{empty:o,ranges:c}=i,u=zi(t,r.schema);if(a)if(o){const h=SC(r,u);n.addStoredMark(u.create({...h,...e}))}else c.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;r.doc.nodesBetween(f,m,(g,b)=>{const N=Math.max(b,f),j=Math.min(b+g.nodeSize,m);g.marks.find(k=>k.type===u)?g.marks.forEach(k=>{u===k.type&&n.addMark(N,j,u.create({...k.attrs,...e}))}):n.addMark(N,j,u.create(e))})});return n_(r,n,u)},r_=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),a_=(t,e={})=>({state:n,dispatch:r,chain:a})=>{const i=Gn(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})=>IN(i,{...o,...e})(n)?!0:c.clearNodes()).command(({state:c})=>IN(i,{...o,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},i_=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,a=Al(t,0,r.content.size),i=it.create(r,a);e.setSelection(i)}return!0},o_=(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},l_=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:a,to:i}=typeof t=="number"?{from:t,to:t}:t,o=ot.atStart(r).from,c=ot.atEnd(r).to,u=Al(a,o,c),h=Al(i,o,c),f=ot.create(r,u,h);e.setSelection(f)}return!0},c_=t=>({state:e,dispatch:n})=>{const r=Gn(t,e.schema);return nL(r)(e,n)};function Nw(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 d_=({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=vf(h,c.node().type.name,c.node().attrs);if(i instanceof it&&i.node.isBlock)return!c.parentOffset||!Li(o,c.pos)?!1:(r&&(t&&Nw(n,a.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const m=u.parentOffset===u.parent.content.size,g=c.depth===0?void 0:$D(c.node(-1).contentMatchAt(c.indexAfter(-1)));let b=m&&g?[{type:g,attrs:f}]:void 0,N=Li(e.doc,e.mapping.map(c.pos),1,b);if(!b&&!N&&Li(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(N=!0,b=g?[{type:g,attrs:f}]:void 0),r){if(N&&(i instanceof ot&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,b),g&&!m&&!c.parentOffset&&c.parent.type!==g)){const j=e.mapping.map(c.before()),v=e.doc.resolve(j);c.node(-1).canReplaceWith(v.index(),v.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}t&&Nw(n,a.extensionManager.splittableMarks),e.scrollIntoView()}return N},u_=(t,e={})=>({tr:n,state:r,dispatch:a,editor:i})=>{var o;const c=Gn(t,r.schema),{$from:u,$to:h}=r.selection,f=r.selection.node;if(f&&f.isBlock||u.depth<2||!u.sameParent(h))return!1;const m=u.node(-1);if(m.type!==c)return!1;const g=i.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==c||u.index(-2)!==u.node(-2).childCount-1)return!1;if(a){let k=Ce.empty;const T=u.index(-1)?1:u.index(-2)?2:3;for(let z=u.depth-T;z>=u.depth-3;z-=1)k=Ce.from(u.node(z).copy(k));const C=u.indexAfter(-1){if(I>-1)return!1;z.isTextblock&&z.content.size===0&&(I=L+1)}),I>-1&&n.setSelection(ot.near(n.doc.resolve(I))),n.scrollIntoView()}return!0}const b=h.pos===u.end()?m.contentMatchAt(0).defaultType:null,N={...vf(g,m.type.name,m.attrs),...e},j={...vf(g,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,h.pos);const v=b?[{type:c,attrs:N},{type:b,attrs:j}]:[{type:c,attrs:N}];if(!Li(n.doc,u.pos,2))return!1;if(a){const{selection:k,storedMarks:T}=r,{splittableMarks:C}=i.extensionManager,R=T||k.$to.parentOffset&&k.$from.marks();if(n.split(u.pos,2,v).scrollIntoView(),!R||!a)return!0;const O=R.filter(U=>C.includes(U.type.name));n.ensureMarks(O)}return!0},px=(t,e)=>{const n=Jp(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)&&qo(t.doc,n.pos)&&t.join(n.pos),!0},mx=(t,e)=>{const n=Jp(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)&&qo(t.doc,r)&&t.join(r),!0},h_=(t,e,n,r={})=>({editor:a,tr:i,state:o,dispatch:c,chain:u,commands:h,can:f})=>{const{extensions:m,splittableMarks:g}=a.extensionManager,b=Gn(t,o.schema),N=Gn(e,o.schema),{selection:j,storedMarks:v}=o,{$from:k,$to:T}=j,C=k.blockRange(T),R=v||j.$to.parentOffset&&j.$from.marks();if(!C)return!1;const O=Jp(U=>vw(U.type.name,m))(j);if(C.depth>=1&&O&&C.depth-O.depth<=1){if(O.node.type===b)return h.liftListItem(N);if(vw(O.node.type.name,m)&&b.validContent(O.node.content)&&c)return u().command(()=>(i.setNodeMarkup(O.pos,b),!0)).command(()=>px(i,b)).command(()=>mx(i,b)).run()}return!n||!R||!c?u().command(()=>f().wrapInList(b,r)?!0:h.clearNodes()).wrapInList(b,r).command(()=>px(i,b)).command(()=>mx(i,b)).run():u().command(()=>{const U=f().wrapInList(b,r),I=R.filter(z=>g.includes(z.type.name));return i.ensureMarks(I),U?!0:h.clearNodes()}).wrapInList(b,r).command(()=>px(i,b)).command(()=>mx(i,b)).run()},f_=(t,e={},n={})=>({state:r,commands:a})=>{const{extendEmptyMarkRange:i=!1}=n,o=zi(t,r.schema);return x0(r,o,e)?a.unsetMark(o,{extendEmptyMarkRange:i}):a.setMark(o,e)},p_=(t,e,n={})=>({state:r,commands:a})=>{const i=Gn(t,r.schema),o=Gn(e,r.schema),c=Bo(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})},m_=(t,e={})=>({state:n,commands:r})=>{const a=Gn(t,n.schema);return Bo(n,a,e)?r.lift(a):r.wrapIn(a,e)},g_=()=>({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},x_=()=>({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},y_=(t,e={})=>({tr:n,state:r,dispatch:a})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:c}=n,u=zi(t,r.schema),{$from:h,empty:f,ranges:m}=c;if(!a)return!0;if(f&&o){let{from:g,to:b}=c;const N=(i=h.marks().find(v=>v.type===u))==null?void 0:i.attrs,j=_y(h,u,N);j&&(g=j.from,b=j.to),n.removeMark(g,b,u)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,u)});return n.removeStoredMark(u),!0},b_=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},v_=(t,e={})=>({tr:n,state:r,dispatch:a})=>{let i=null,o=null;const c=Gp(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(i=Gn(t,r.schema)),c==="mark"&&(o=zi(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;let g,b,N,j;n.selection.empty?r.doc.nodesBetween(f,m,(v,k)=>{i&&i===v.type&&(u=!0,N=Math.max(k,f),j=Math.min(k+v.nodeSize,m),g=k,b=v)}):r.doc.nodesBetween(f,m,(v,k)=>{k=f&&k<=m&&(i&&i===v.type&&(u=!0,a&&n.setNodeMarkup(k,void 0,{...v.attrs,...e})),o&&v.marks.length&&v.marks.forEach(T=>{if(o===T.type&&(u=!0,a)){const C=Math.max(k,f),R=Math.min(k+v.nodeSize,m);n.addMark(C,R,o.create({...T.attrs,...e}))}}))}),b&&(g!==void 0&&a&&n.setNodeMarkup(g,void 0,{...b.attrs,...e}),o&&b.marks.length&&b.marks.forEach(v=>{o===v.type&&a&&n.addMark(N,j,o.create({...v.attrs,...e}))}))}),u},N_=(t,e={})=>({state:n,dispatch:r})=>{const a=Gn(t,n.schema);return J6(a,e)(n,r)},w_=(t,e={})=>({state:n,dispatch:r})=>{const a=Gn(t,n.schema);return Q6(a,e)(n,r)},j_=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={}}},Yp=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},k_=(t,e)=>{if(Dy(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 nf(t){var e;const{editor:n,from:r,to:a,text:i,rules:o,plugin:c}=t,{view:u}=n;if(u.composing)return!1;const h=u.state.doc.resolve(r);if(h.parent.type.spec.code||(e=h.nodeBefore||h.nodeAfter)!=null&&e.marks.find(g=>g.type.spec.code))return!1;let f=!1;const m=QD(h)+i;return o.forEach(g=>{if(f)return;const b=k_(m,g.find);if(!b)return;const N=u.state.tr,j=Kp({state:u.state,transaction:N}),v={from:r-(b[0].length-i.length),to:a},{commands:k,chain:T,can:C}=new qp({editor:n,state:j});g.handler({state:j,range:v,match:b,commands:k,chain:T,can:C})===null||!N.steps.length||(g.undoable&&N.setMeta(c,{transform:N,from:r,to:a,text:i}),u.dispatch(N),f=!0)}),f}function S_(t){const{editor:e,rules:n}=t,r=new fn({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=zy(Ce.from(f),o.schema);const{from:m}=u,g=m+f.length;nf({editor:e,from:m,to:g,text:f,rules:n,plugin:r})}),a.selectionSet||a.docChanged?null:i}},props:{handleTextInput(a,i,o,c){return nf({editor:e,from:i,to:o,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:a=>(setTimeout(()=>{const{$cursor:i}=a.state.selection;i&&nf({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?nf({editor:e,from:o.pos,to:o.pos,text:` -`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function C_(t){return Object.prototype.toString.call(t).slice(8,-1)}function sf(t){return C_(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function $C(t,e){const n={...t};return sf(t)&&sf(e)&&Object.keys(e).forEach(r=>{sf(e[r])&&sf(t[r])?n[r]=$C(t[r],e[r]):n[r]=e[r]}),n}var By=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...Kt(rt(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Kt(rt(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>$C(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}},sc=class zC extends By{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new zC(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 E_(t){return typeof t=="number"}var T_=class{constructor(t){this.find=t.find,this.handler=t.handler}},M_=(t,e,n)=>{if(Dy(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 A_(t){const{editor:e,state:n,from:r,to:a,rule:i,pasteEvent:o,dropEvent:c}=t,{commands:u,chain:h,can:f}=new qp({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,a,(b,N)=>{var j,v,k,T,C;if((v=(j=b.type)==null?void 0:j.spec)!=null&&v.code||!(b.isText||b.isTextblock||b.isInline))return;const R=(C=(T=(k=b.content)==null?void 0:k.size)!=null?T:b.nodeSize)!=null?C:0,O=Math.max(r,N),U=Math.min(a,N+R);if(O>=U)return;const I=b.isText?b.text||"":b.textBetween(O-N,U-N,void 0,"");M_(I,i.find,o).forEach(L=>{if(L.index===void 0)return;const Q=O+L.index+1,se=Q+L[0].length,$={from:n.tr.mapping.map(Q),to:n.tr.mapping.map(se)},ie=i.handler({state:n,range:$,match:L,commands:u,chain:h,can:f,pasteEvent:o,dropEvent:c});m.push(ie)})}),m.every(b=>b!==null)}var rf=null,P_=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function I_(t){const{editor:e,rules:n}=t;let r=null,a=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const u=({state:f,from:m,to:g,rule:b,pasteEvt:N})=>{const j=f.tr,v=Kp({state:f,transaction:j});if(!(!A_({editor:e,state:v,from:Math.max(m-1,0),to:g.b-1,rule:b,pasteEvent:N,dropEvent:c})||!j.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,j}};return n.map(f=>new fn({view(m){const g=N=>{var j;r=(j=m.dom.parentElement)!=null&&j.contains(N.target)?m.dom.parentElement:null,r&&(rf=e)},b=()=>{rf&&(rf=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",b),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",b)}}},props:{handleDOMEvents:{drop:(m,g)=>{if(i=r===m.dom.parentElement,c=g,!i){const b=rf;b!=null&&b.isEditable&&setTimeout(()=>{const N=b.state.selection;N&&b.commands.deleteRange({from:N.from,to:N.to})},10)}return!1},paste:(m,g)=>{var b;const N=(b=g.clipboardData)==null?void 0:b.getData("text/html");return o=g,a=!!(N!=null&&N.includes("data-pm-slice")),!1}}},appendTransaction:(m,g,b)=>{const N=m[0],j=N.getMeta("uiEvent")==="paste"&&!a,v=N.getMeta("uiEvent")==="drop"&&!i,k=N.getMeta("applyPasteRules"),T=!!k;if(!j&&!v&&!T)return;if(T){let{text:O}=k;typeof O=="string"?O=O:O=zy(Ce.from(O),b.schema);const{from:U}=k,I=U+O.length,z=P_(O);return u({rule:f,state:b,from:U,to:{b:I},pasteEvt:z})}const C=g.doc.content.findDiffStart(b.doc.content),R=g.doc.content.findDiffEnd(b.doc.content);if(!(!E_(C)||!R||C===R.b))return u({rule:f,state:b,from:C,to:R,pasteEvt:o})}}))}var Xp=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=AC(t),this.schema=HD(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Zd(e.name,this.schema)},r=rt(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return mu([...this.extensions].reverse()).flatMap(r=>{const a={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Zd(r.name,this.schema)},i=[],o=rt(r,"addKeyboardShortcuts",a);let c={};if(r.type==="mark"&&rt(r,"exitable",a)&&(c.ArrowRight=()=>sc.handleExit({editor:t,mark:r})),o){const g=Object.fromEntries(Object.entries(o()).map(([b,N])=>[b,()=>N({editor:t})]));c={...c,...g}}const u=KO(c);i.push(u);const h=rt(r,"addInputRules",a);if(bw(r,t.options.enableInputRules)&&h){const g=h();if(g&&g.length){const b=S_({editor:t,rules:g}),N=Array.isArray(b)?b:[b];i.push(...N)}}const f=rt(r,"addPasteRules",a);if(bw(r,t.options.enablePasteRules)&&f){const g=f();if(g&&g.length){const b=I_({editor:t,rules:g});i.push(...b)}}const m=rt(r,"addProseMirrorPlugins",a);if(m){const g=m();i.push(...g)}return i})}get attributes(){return MC(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=sd(this.extensions);return Object.fromEntries(e.filter(n=>!!rt(n,"addNodeView")).map(n=>{const r=this.attributes.filter(u=>u.type===n.name),a={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Gn(n.name,this.schema)},i=rt(n,"addNodeView",a);if(!i)return[];const o=i();if(!o)return[];const c=(u,h,f,m,g)=>{const b=Ru(u,r);return o({node:u,view:h,getPos:f,decorations:m,innerDecorations:g,editor:t,extension:n,HTMLAttributes:b})};return[n.name,c]}))}dispatchTransaction(t){const{editor:e}=this;return mu([...this.extensions].reverse()).reduceRight((r,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:Zd(a.name,this.schema)},o=rt(a,"dispatchTransaction",i);return o?c=>{o.call(i,{transaction:c,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return mu([...this.extensions]).reduce((r,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:Zd(a.name,this.schema)},o=rt(a,"transformPastedHTML",i);return o?(c,u)=>{const h=r(c,u);return o.call(i,h)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=sd(this.extensions);return Object.fromEntries(e.filter(n=>!!rt(n,"addMarkView")).map(n=>{const r=this.attributes.filter(c=>c.type===n.name),a={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:zi(n.name,this.schema)},i=rt(n,"addMarkView",a);if(!i)return[];const o=(c,u,h)=>{const f=Ru(c,r);return i()({mark:c,view:u,inline:h,editor:t,extension:n,HTMLAttributes:f,updateAttributes:m=>{q_(c,t,m)}})};return[n.name,o]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Zd(e.name,this.schema)};e.type==="mark"&&((n=Kt(rt(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const a=rt(e,"onBeforeCreate",r),i=rt(e,"onCreate",r),o=rt(e,"onUpdate",r),c=rt(e,"onSelectionUpdate",r),u=rt(e,"onTransaction",r),h=rt(e,"onFocus",r),f=rt(e,"onBlur",r),m=rt(e,"onDestroy",r);a&&this.editor.on("beforeCreate",a),i&&this.editor.on("create",i),o&&this.editor.on("update",o),c&&this.editor.on("selectionUpdate",c),u&&this.editor.on("transaction",u),h&&this.editor.on("focus",h),f&&this.editor.on("blur",f),m&&this.editor.on("destroy",m)})}};Xp.resolve=AC;Xp.sort=mu;Xp.flatten=$y;var R_={};Oy(R_,{ClipboardTextSerializer:()=>BC,Commands:()=>VC,Delete:()=>HC,Drop:()=>UC,Editable:()=>WC,FocusEvents:()=>qC,Keymap:()=>GC,Paste:()=>JC,Tabindex:()=>QC,TextDirection:()=>YC,focusEventsPluginKey:()=>KC});var Dn=class FC extends By{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new FC(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},BC=Dn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new fn({key:new wn("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=IC(n);return PC(r,{from:o,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),VC=Dn.create({name:"commands",addCommands(){return{...bC}}}),HC=Dn.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,a;const i=()=>{var o,c,u,h;if((h=(u=(c=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:c.filterTransaction)==null?void 0:u.call(c,t))!=null?h:t.getMeta("y-sync$"))return;const f=CC(t.before,[t,...e]);LC(f).forEach(b=>{f.mapping.mapResult(b.oldRange.from).deletedAfter&&f.mapping.mapResult(b.oldRange.to).deletedBefore&&f.before.nodesBetween(b.oldRange.from,b.oldRange.to,(N,j)=>{const v=j+N.nodeSize-2,k=b.oldRange.from<=j&&v<=b.oldRange.to;this.editor.emit("delete",{type:"node",node:N,from:j,to:v,newFrom:f.mapping.map(j),newTo:f.mapping.map(v),deletedRange:b.oldRange,newRange:b.newRange,partial:!k,editor:this.editor,transaction:t,combinedTransform:f})})});const g=f.mapping;f.steps.forEach((b,N)=>{var j,v;if(b instanceof ga){const k=g.slice(N).map(b.from,-1),T=g.slice(N).map(b.to),C=g.invert().map(k,-1),R=g.invert().map(T),O=(j=f.doc.nodeAt(k-1))==null?void 0:j.marks.some(I=>I.eq(b.mark)),U=(v=f.doc.nodeAt(T))==null?void 0:v.marks.some(I=>I.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:T},partial:!!(U||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()}}),UC=Dn.create({name:"drop",addProseMirrorPlugins(){return[new fn({key:new wn("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),WC=Dn.create({name:"editable",addProseMirrorPlugins(){return[new fn({key:new wn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),KC=new wn("focusEvents"),qC=Dn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new fn({key:KC,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),GC=Dn.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:c})=>{const{selection:u,doc:h}=c,{empty:f,$anchor:m}=u,{pos:g,parent:b}=m,N=m.parent.isTextblock&&g>0?c.doc.resolve(g-1):m,j=N.parent.type.spec.isolating,v=m.pos-m.parentOffset,k=j&&N.parent.childCount===1?v===m.pos:ft.atStart(h).from===g;return!f||!b.type.isTextblock||b.textContent.length||!k||k&&m.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},a={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return qf()||kC()?i:a},addProseMirrorPlugins(){return[new fn({key:new wn("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(j=>j.getMeta("composition")))return;const r=t.some(j=>j.docChanged)&&!e.doc.eq(n.doc),a=t.some(j=>j.getMeta("preventClearDocument"));if(!r||a)return;const{empty:i,from:o,to:c}=e.selection,u=ft.atStart(e.doc).from,h=ft.atEnd(e.doc).to;if(i||!(o===u&&c===h)||!Qp(n.doc))return;const g=n.tr,b=Kp({state:n,transaction:g}),{commands:N}=new qp({editor:this.editor,state:b});if(N.clearNodes(),!!g.steps.length)return g}})]}}),JC=Dn.create({name:"paste",addProseMirrorPlugins(){return[new fn({key:new wn("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),QC=Dn.create({name:"tabindex",addProseMirrorPlugins(){return[new fn({key:new wn("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),YC=Dn.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=sd(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 fn({key:new wn("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),L_=class au{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 au(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 au(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 au(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 au(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)}},O_=`.ProseMirror { -======== - */var cN;function F8(){if(cN)return Yg;cN=1;var t=_u();function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,a=t.useEffect,i=t.useLayoutEffect,o=t.useDebugValue;function c(m,g){var b=g(),N=r({inst:{value:b,getSnapshot:g}}),j=N[0].inst,v=N[1];return i(function(){j.value=b,j.getSnapshot=g,u(j)&&v({inst:j})},[m,b,g]),a(function(){return u(j)&&v({inst:j}),m(function(){u(j)&&v({inst:j})})},[m]),o(b),b}function u(m){var g=m.getSnapshot;m=m.value;try{var b=g();return!n(m,b)}catch{return!0}}function h(m,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:c;return Yg.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,Yg}var dN;function V2(){return dN||(dN=1,Qg.exports=F8()),Qg.exports}var H2=V2();function Ns(t){this.content=t}Ns.prototype={constructor:Ns,find:function(t){for(var e=0;e>1}};Ns.from=function(t){if(t instanceof Ns)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ns(e)};function U2(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=U2(a.content,i.content,n+1);if(o!=null)return o}n+=a.nodeSize}}function W2(t,e,n,r){for(let a=t.childCount,i=e.childCount;;){if(a==0||i==0)return a==i?null:{a:n,b:r};let o=t.child(--a),c=e.child(--i),u=o.nodeSize;if(o==c){n-=u,r-=u;continue}if(!o.sameMarkup(c))return{a:n,b:r};if(o.isText&&o.text!=c.text){let h=0,f=Math.min(o.text.length,c.text.length);for(;he&&r(u,a+c,i||null,o)!==!1&&u.content.size){let f=c+1;u.nodesBetween(Math.max(0,e-f),Math.min(u.content.size,n-f),r,a+f)}c=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,a){let i="",o=!0;return this.nodesBetween(e,n,(c,u)=>{let h=c.isText?c.text.slice(Math.max(e,u)-u,n-u):c.isLeaf?a?typeof a=="function"?a(c):a:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&h||c.isTextblock)&&r&&(o?o=!1:i+=r),i+=h},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,a=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(a[a.length-1]=n.withText(n.text+r.text),i=1);ie)for(let i=0,o=0;oe&&((on)&&(c.isText?c=c.cut(Math.max(0,e-o),Math.min(c.text.length,n-o)):c=c.cut(Math.max(0,e-o-1),Math.min(c.content.size,n-o-1))),r.push(c),a+=c.nodeSize),o=u}return new Ce(r,a)}cutByIndex(e,n){return e==n?Ce.empty:e==0&&n==this.content.length?this:new Ce(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let a=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return a[e]=n,new Ce(a,i)}addToStart(e){return new Ce([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Ce(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let a=this.child(n),i=r+a.nodeSize;if(i>=e)return i==e?Yh(n+1,i):Yh(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return Ce.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Ce(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Ce.empty;let n,r=0;for(let a=0;athis.type.rank&&(n||(n=e.slice(0,a)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-a.type.rank),n}};on.none=[];class Of extends Error{}class ze{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=q2(this.content,e+this.openStart,n);return r&&new ze(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ze(K2(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 ze.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 ze(Ce.fromJSON(e,n.content),r,a)}static maxOpen(e,n=!0){let r=0,a=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)a++;return new ze(e,r,a)}}ze.empty=new ze(Ce.empty,0,0);function K2(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(K2(i.content,e-a-1,n-a-1)))}function q2(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=q2(o.content,e-i-1,n,o);return c&&t.replaceChild(a,o.copy(c))}function B8(t,e,n){if(n.openStart>t.depth)throw new Of("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Of("Inconsistent open depths");return G2(t,e,n,0)}function G2(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 du(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&&(Il(t.nodeAfter,r),i++));for(let c=i;ca&&e0(t,e,a+1),o=r.depth>a&&e0(n,r,a+1),c=[];return du(null,t,a,c),i&&o&&e.index(a)==n.index(a)?(J2(i,o),Il(Pl(i,Q2(t,e,n,r,a+1)),c)):(i&&Il(Pl(i,Df(t,e,a+1)),c),du(e,n,a,c),o&&Il(Pl(o,Df(n,r,a+1)),c)),du(r,null,a,c),new Ce(c)}function Df(t,e,n){let r=[];if(du(null,t,n,r),t.depth>n){let a=e0(t,e,n+1);Il(Pl(a,Df(t,e,n+1)),r)}return du(e,null,n,r),new Ce(r)}function V8(t,e){let n=e.depth-t.openStart,a=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)a=e.node(i).copy(Ce.from(a));return{start:a.resolveNoCache(t.openStart+n),end:a.resolveNoCache(a.content.size-t.openEnd-n)}}class ku{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 _f(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 ku(n,r,i)}static resolveCached(e,n){let r=uN.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()+")"),Y2(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=Ce.empty,a=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,a,i),c=o&&o.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let u=a;un.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let a=Ce.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,a,r);return i.type.checkAttrs(i.attrs),i}};Pi.prototype.text=void 0;class $f extends Pi{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):Y2(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 $f(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new $f(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 Y2(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Ul{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new K8(e,n);if(r.next==null)return Ul.empty;let a=X2(r);r.next&&r.err("Unexpected trailing text");let i=Z8(X8(a));return e6(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(` -`)}}Ul.empty=new Ul(!0);class K8{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 X2(t){let e=[];do e.push(q8(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function q8(t){let e=[];do e.push(G8(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function G8(t){let e=Y8(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=J8(t,e);else break;return e}function hN(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function J8(t,e){let n=hN(t),r=n;return t.eat(",")&&(t.next!="}"?r=hN(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Q8(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 Y8(t){if(t.eat("(")){let e=X2(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=Q8(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 X8(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 Ul(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:tS(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Pi(this,this.computeAttrs(e),Ce.from(n),on.setFrom(r))}createChecked(e=null,n,r){return n=Ce.from(n),this.checkContent(n),new Pi(this,this.computeAttrs(e),n,on.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=Ce.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let a=this.contentMatch.matchFragment(n),i=a&&a.fillBefore(Ce.empty,!0);return i?new Pi(this,e,n.append(i),on.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 rS(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 t6(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 n6{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?t6(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class $p{constructor(e,n,r,a){this.name=e,this.rank=n,this.schema=r,this.spec=a,this.attrs=sS(e,a.attrs),this.excluded=null;let i=eS(this.attrs);this.instance=i?new on(this,i):null}create(e=null){return!e&&this.instance?this.instance:new on(this,tS(this.attrs,e))}static compile(e,n){let r=Object.create(null),a=0;return e.forEach((i,o)=>r[i]=new $p(i,a++,n,o)),r}removeFromSet(e){for(var n=0;n-1}}class aS{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=Ns.from(e.nodes),n.marks=Ns.from(e.marks||{}),this.nodes=pN.compile(this.spec.nodes,this),this.marks=$p.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]=Ul.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?mN(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==""?[]:mN(this,o.split(" "))}this.nodeFromJSON=a=>Pi.fromJSON(this,a),this.markFromJSON=a=>on.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 pN){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 $f(r,r.defaultAttrs,e,on.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 mN(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 s6(t){return t.tag!=null}function r6(t){return t.style!=null}class Po{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(a=>{if(s6(a))this.tags.push(a);else if(r6(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 xN(this,n,!1);return r.addAll(e,on.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new xN(this,n,!0);return r.addAll(e,on.none,n.from,n.to),ze.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=yN(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=yN(o)),o.node||o.ignore||o.mark||(o.node=a)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Po(e,Po.schemaRules(e)))}}const iS={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},a6={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},oS={ol:!0,ul:!0},Su=1,n0=2,uu=4;function gN(t,e,n){return e!=null?(e?Su:0)|(e==="full"?n0:0):t&&t.whitespace=="pre"?Su|n0:n&~uu}class Xh{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=on.none,this.match=i||(o&uu?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Ce.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,a;return(a=r.findWrapping(e.type))?(this.match=r,a):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&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=Ce.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(Ce.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!iS.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class xN{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=gN(null,n.preserveWhitespace,0)|(r?uu:0);a?i=new Xh(a.type,a.attrs,on.none,!0,n.topMatch||a.type.contentMatch,o):r?i=new Xh(null,null,on.none,!0,null,o):i=new Xh(e.schema.topNodeType,null,on.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&n0?"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):bN(h.type,e))?(u=h.addToSet(u),!1):!0),this.nodes.push(new Xh(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 i6(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&oS.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function o6(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function yN(t){let e={};for(let n in t)e[n]=t[n];return e}function bN(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&&xf(Zg(r),a(e,n),null,e.attrs)}static renderSpec(e,n,r=null,a){return xf(e,n,r,a)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new tc(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=vN(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return vN(e.marks)}}function vN(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Zg(t){return t.document||window.document}const NN=new WeakMap;function l6(t){let e=NN.get(t);return e===void 0&&NN.set(t,e=c6(t)),e}function c6(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let a=0;a-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=a.indexOf(" ");o>0&&(n=a.slice(0,o),a=a.slice(o+1));let c,u=n?t.createElementNS(n,a):t.createElement(a),h=e[1],f=1;if(h&&typeof h=="object"&&h.nodeType==null&&!Array.isArray(h)){f=2;for(let m in h)if(h[m]!=null){let g=m.indexOf(" ");g>0?u.setAttributeNS(m.slice(0,g),m.slice(g+1),h[m]):m=="style"&&u.style?u.style.cssText=h[m]:u.setAttribute(m,h[m])}}for(let m=f;mf)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:b,contentDOM:N}=xf(t,g,n,r);if(u.appendChild(b),N){if(c)throw new RangeError("Multiple content holes");c=N}}}return{dom:u,contentDOM:c}}const lS=65535,cS=Math.pow(2,16);function d6(t,e){return t+e*cS}function wN(t){return t&lS}function u6(t){return(t-(t&lS))/cS}const dS=1,uS=2,yf=4,hS=8;class s0{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&hS)>0}get deletedBefore(){return(this.delInfo&(dS|yf))>0}get deletedAfter(){return(this.delInfo&(uS|yf))>0}get deletedAcross(){return(this.delInfo&yf)>0}}class kr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&kr.empty)return kr.empty}recover(e){let n=0,r=wN(e);if(!this.inverted)for(let a=0;ae)break;let h=this.ranges[c+i],f=this.ranges[c+o],m=u+h;if(e<=m){let g=h?e==u?-1:e==m?1:n:n,b=u+a+(g<0?0:f);if(r)return b;let N=e==(n<0?u:m)?null:d6(c/3,e-u),j=e==u?uS:e==m?dS:yf;return(n<0?e!=u:e!=m)&&(j|=hS),new s0(b,j,N)}a+=f-h}return r?e+a:new s0(e+a,0,null)}touches(e,n){let r=0,a=wN(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 Cu;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;ri&&u!o.isAtom||!c.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),a),n.openStart,n.openEnd);return Wn.fromReplace(e,this.from,this.to,i)}invert(){return new fa(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Co(n.pos,r.pos,this.mark)}merge(e){return e instanceof Co&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Co(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 Co(n.from,n.to,e.markFromJSON(n.mark))}}Os.jsonID("addMark",Co);class fa extends Os{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 ze(fy(n.content,a=>a.mark(this.mark.removeFromSet(a.marks)),e),n.openStart,n.openEnd);return Wn.fromReplace(e,this.from,this.to,r)}invert(){return new Co(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new fa(n.pos,r.pos,this.mark)}merge(e){return e instanceof fa&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new fa(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new fa(n.from,n.to,e.markFromJSON(n.mark))}}Os.jsonID("removeMark",fa);class Eo extends Os{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Wn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Wn.fromReplace(e,this.pos,this.pos+1,new ze(Ce.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let a=0;ar.pos?null:new ps(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 ps(n.from,n.to,n.gapFrom,n.gapTo,ze.fromJSON(e,n.slice),n.insert,!!n.structure)}}Os.jsonID("replaceAround",ps);function r0(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 h6(t,e,n,r){let a=[],i=[],o,c;t.doc.nodesBetween(e,n,(u,h,f)=>{if(!u.isInline)return;let m=u.marks;if(!r.isInSet(m)&&f.type.allowsMarkType(r.type)){let g=Math.max(h,e),b=Math.min(h+u.nodeSize,n),N=r.addToSet(m);for(let j=0;jt.step(u)),i.forEach(u=>t.step(u))}function f6(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 $p){let h=o.marks,f;for(;f=r.isInSet(h);)(u||(u=[])).push(f),h=f.removeFromSet(h)}else r?r.isInSet(o.marks)&&(u=[r]):u=o.marks;if(u&&u.length){let h=Math.min(c+o.nodeSize,n);for(let f=0;ft.step(new fa(o.from,o.to,o.style)))}function py(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 p6(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function hd(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,a=0,i=0;;--r){let o=t.$from.node(r),c=t.$from.index(r)+a,u=t.$to.indexAfter(r)-i;if(rn;N--)j||r.index(N)>0?(j=!0,f=Ce.from(r.node(N).copy(f)),m++):u--;let g=Ce.empty,b=0;for(let N=i,j=!1;N>n;N--)j||a.after(N+1)=0;o--){if(r.size){let c=n[o].type.contentMatch.matchFragment(r);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Ce.from(n[o].type.create(n[o].attrs,r))}let a=e.start,i=e.end;t.step(new ps(a,i,a,i,new ze(r,0,0),n.length,!0))}function b6(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)&&v6(t.doc,t.mapping.slice(i).map(c),r)){let h=null;if(r.schema.linebreakReplacement){let b=r.whitespace=="pre",N=!!r.contentMatch.matchType(r.schema.linebreakReplacement);b&&!N?h=!1:!b&&N&&(h=!0)}h===!1&&pS(t,o,c,i),py(t,t.mapping.slice(i).map(c,1),r,void 0,h===null);let f=t.mapping.slice(i),m=f.map(c,1),g=f.map(c+o.nodeSize,1);return t.step(new ps(m,g,m+1,g-1,new ze(Ce.from(r.create(u,null,o.marks)),0,0),1,!0)),h===!0&&fS(t,o,c,i),!1}})}function fS(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 pS(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 v6(t,e,n){let r=t.resolve(e),a=r.index();return r.parent.canReplaceWith(a,a+1,n)}function N6(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 ps(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new ze(Ce.from(o),0,0),1,!0))}function Ri(t,e,n=1,r){let a=t.resolve(e),i=a.depth-n,o=r&&r[r.length-1]||a.parent;if(i<0||a.parent.type.spec.isolating||!a.parent.canReplace(a.index(),a.parent.childCount)||!o.type.validContent(a.parent.content.cutByIndex(a.index(),a.parent.childCount)))return!1;for(let h=a.depth-1,f=n-2;h>i;h--,f--){let m=a.node(h),g=a.index(h);if(m.type.spec.isolating)return!1;let b=m.content.cutByIndex(g,m.childCount),N=r&&r[f+1];N&&(b=b.replaceChild(0,N.type.create(N.attrs)));let j=r&&r[f]||m;if(!m.canReplace(g+1,m.childCount)||!j.type.validContent(b))return!1}let c=a.indexAfter(i),u=r&&r[0];return a.node(i).canReplaceWith(c,c,u?u.type:a.node(i+1).type)}function w6(t,e,n=1,r){let a=t.doc.resolve(e),i=Ce.empty,o=Ce.empty;for(let c=a.depth,u=a.depth-n,h=n-1;c>u;c--,h--){i=Ce.from(a.node(c).copy(i));let f=r&&r[h];o=Ce.from(f?f.type.create(f.attrs,o):a.node(c).copy(o))}t.step(new ds(e,e,new ze(i.append(o),n,n),!0))}function Ko(t,e){let n=t.resolve(e),r=n.index();return mS(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function j6(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&&mS(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 k6(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);pS(t,f.node(),f.before(),c)}o.inlineContent&&py(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 ds(h,u.map(e+n,-1),ze.empty,!0)),r===!0){let f=t.doc.resolve(h);fS(t,f.node(),f.before(),t.steps.length)}return t}function S6(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 Fp(t,e,n=e,r=ze.empty){if(e==n&&!r.size)return null;let a=t.resolve(e),i=t.resolve(n);return xS(a,i,r)?new ds(e,n,r):new C6(a,i,r).fit()}function xS(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class C6{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=Ce.empty;for(let a=0;a<=e.depth;a++){let i=e.node(a);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(a))})}for(let a=e.depth;a>0;a--)this.placed=Ce.from(e.node(a).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let h=this.findFittable();h?this.placeNodes(h):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,a=this.close(e<0?this.$to:r.doc.resolve(e));if(!a)return null;let i=this.placed,o=r.depth,c=a.depth;for(;o&&c&&i.childCount==1;)i=i.firstChild.content,o--,c--;let u=new ze(i,o,c);return e>-1?new ps(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new ds(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=tx(this.unplaced.content,r-1).firstChild,a=i.content):a=this.unplaced.content;let o=a.firstChild;for(let c=this.depth;c>=0;c--){let{type:u,match:h}=this.frontier[c],f,m=null;if(n==1&&(o?h.matchType(o.type)||(m=h.fillBefore(Ce.from(o),!1)):i&&u.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:c,parent:i,inject:m};if(n==2&&o&&(f=h.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:c,parent:i,wrap:f};if(i&&h.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,a=tx(e,n);return!a.childCount||a.firstChild.isLeaf?!1:(this.unplaced=new ze(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=tx(e,n);if(a.childCount<=1&&n>0){let i=e.size-n<=n+a.size;this.unplaced=new ze(tu(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new ze(tu(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:a,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let j=0;j1||u==0||j.content.size)&&(m=v,f.push(yS(j.mark(g.allowedMarks(j.marks)),h==1?u:0,h==c.childCount?b:-1)))}let N=h==c.childCount;N||(b=-1),this.placed=nu(this.placed,n,Ce.from(f)),this.frontier[n].match=m,N&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let j=0,v=c;j1&&a==this.$to.end(--r);)++a;return a}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:a}=this.frontier[n],i=n=0;c--){let{match:u,type:h}=this.frontier[c],f=nx(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=nu(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=nu(this.placed,this.depth,Ce.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(Ce.empty,!0);n.childCount&&(this.placed=nu(this.placed,this.frontier.length,n))}}function tu(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(tu(t.firstChild.content,e-1,n)))}function nu(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(nu(t.lastChild.content,e-1,n)))}function tx(t,e){for(let n=0;n1&&(r=r.replaceChild(0,yS(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(Ce.empty,!0)))),t.copy(r)}function nx(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&&!E6(n,i.content,o)?c:null}function E6(t,e,n){for(let r=n;r0;g--,b--){let N=a.node(g).type.spec;if(N.defining||N.definingAsContext||N.isolating)break;o.indexOf(g)>-1?c=g:a.before(g)==b&&o.splice(1,0,-g)}let u=o.indexOf(c),h=[],f=r.openStart;for(let g=r.content,b=0;;b++){let N=g.firstChild;if(h.push(N),b==r.openStart)break;g=N.content}for(let g=f-1;g>=0;g--){let b=h[g],N=T6(b.type);if(N&&!b.sameMarkup(a.node(Math.abs(c)-1)))f=g;else if(N||!b.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let b=(g+f+1)%(r.openStart+1),N=h[b];if(N)for(let j=0;j=0&&(t.replace(e,n,r),!(t.steps.length>m));g--){let b=o[g];b<0||(e=a.before(b),n=i.after(b))}}function bS(t,e,n,r,a){if(er){let i=a.contentMatchAt(0),o=i.fillBefore(t).append(t);t=o.append(i.matchFragment(o).fillBefore(Ce.empty,!0))}return t}function A6(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let a=S6(t.doc,e,r.type);a!=null&&(e=n=a)}t.replaceRange(e,n,new ze(Ce.from(r),0,0))}function I6(t,e,n){let r=t.doc.resolve(e),a=t.doc.resolve(n),i=vS(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 vS(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 Kc extends Os{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Wn.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let a=n.type.create(r,null,n.marks);return Wn.fromReplace(e,this.pos,this.pos+1,new ze(Ce.from(a),0,n.isLeaf?0:1))}getMap(){return kr.empty}invert(e){return new Kc(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 Kc(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 Kc(n.pos,n.attr,n.value)}}Os.jsonID("attr",Kc);class Eu extends Os{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let a in e.attrs)n[a]=e.attrs[a];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Wn.ok(r)}getMap(){return kr.empty}invert(e){return new Eu(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 Eu(n.attr,n.value)}}Os.jsonID("docAttr",Eu);let Xc=class extends Error{};Xc=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Xc.prototype=Object.create(Error.prototype);Xc.prototype.constructor=Xc;Xc.prototype.name="TransformError";class gy{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Cu}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Xc(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=ze.empty){let a=Fp(this.doc,e,n,r);return a&&this.step(a),this}replaceWith(e,n,r){return this.replace(e,n,new ze(Ce.from(r),0,0))}delete(e,n){return this.replace(e,n,ze.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return M6(this,e,n,r),this}replaceRangeWith(e,n,r){return A6(this,e,n,r),this}deleteRange(e,n){return I6(this,e,n),this}lift(e,n){return m6(this,e,n),this}join(e,n=1){return k6(this,e,n),this}wrap(e,n){return y6(this,e,n),this}setBlockType(e,n=e,r,a=null){return b6(this,e,n,r,a),this}setNodeMarkup(e,n,r=null,a){return N6(this,e,n,r,a),this}setNodeAttribute(e,n,r){return this.step(new Kc(e,n,r)),this}setDocAttribute(e,n){return this.step(new Eu(e,n)),this}addNodeMark(e,n){return this.step(new Eo(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 on)n.isInSet(r.marks)&&this.step(new Wl(e,n));else{let a=r.marks,i,o=[];for(;i=n.isInSet(a);)o.push(new Wl(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 w6(this,e,n,r),this}addMark(e,n,r){return h6(this,e,n,r),this}removeMark(e,n,r){return f6(this,e,n,r),this}clearIncompatible(e,n,r){return py(this,e,n,r),this}}const sx=Object.create(null);class ft{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new NS(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?Dc(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):Dc(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Cr(e.node(0))}static atStart(e){return Dc(e,e,0,0,1)||new Cr(e)}static atEnd(e){return Dc(e,e,e.content.size,e.childCount,-1)||new Cr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=sx[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 sx)throw new RangeError("Duplicate use of selection JSON ID "+e);return sx[e]=n,n.prototype.jsonID=e,n}getBookmark(){return ot.between(this.$anchor,this.$head).getBookmark()}}ft.prototype.visible=!0;class NS{constructor(e,n){this.$from=e,this.$to=n}}let kN=!1;function SN(t){!kN&&!t.parent.inlineContent&&(kN=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class ot extends ft{constructor(e,n=e){SN(e),SN(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return ft.near(r);let a=e.resolve(n.map(this.anchor));return new ot(a.parent.inlineContent?a:r,r)}replace(e,n=ze.empty){if(super.replace(e,n),n==ze.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ot&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Bp(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new ot(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let a=e.resolve(n);return new this(a,r==n?a:e.resolve(r))}static between(e,n,r){let a=e.pos-n.pos;if((!r||a)&&(r=a>=0?1:-1),!n.parent.inlineContent){let i=ft.findFrom(n,r,!0)||ft.findFrom(n,-r,!0);if(i)n=i.$head;else return ft.near(n,r)}return e.parent.inlineContent||(a==0?e=n:(e=(ft.findFrom(e,-r,!0)||ft.findFrom(e,r,!0)).$anchor,e.pos0?0:1);a>0?o=0;o+=a){let c=e.child(o);if(c.isAtom){if(!i&&it.isSelectable(c))return it.create(t,n-(a<0?c.nodeSize:0))}else{let u=Dc(t,c,n+a,a<0?c.childCount:0,a,i);if(u)return u}n+=c.nodeSize*a}return null}function CN(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 EN=1,Zh=2,TN=4;class R6 extends gy{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|=Zh,this}ensureMarks(e){return on.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&Zh)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Zh,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)||on.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|=TN,this}get scrolledIntoView(){return(this.updated&TN)>0}}function MN(t,e){return!e||!t?t:t.bind(e)}class su{constructor(e,n,r){this.name=e,this.init=MN(n.init,r),this.apply=MN(n.apply,r)}}const L6=[new su("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new su("selection",{init(t,e){return t.selection||ft.atStart(e.doc)},apply(t){return t.selection}}),new su("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new su("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class rx{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=L6.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 su(r.key,r.spec.state,r))})}}class Hc{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 rx(e.schema,e.plugins),i=new Hc(a);return a.fields.forEach(o=>{if(o.name=="doc")i.doc=Pi.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 wS(t,e,n){for(let r in t){let a=t[r];a instanceof Function?a=a.bind(e):r=="handleDOMEvents"&&(a=wS(a,e,{})),n[r]=a}return n}class un{constructor(e){this.spec=e,this.props={},e.props&&wS(e.props,this,this.props),this.key=e.key?e.key.key:jS("plugin")}getState(e){return e[this.key]}}const ax=Object.create(null);function jS(t){return t in ax?t+"$"+ ++ax[t]:(ax[t]=0,t+"$")}class vn{constructor(e="key"){this.key=jS(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const yy=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function kS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const SS=(t,e,n)=>{let r=kS(t,n);if(!r)return!1;let a=by(r);if(!a){let o=r.blockRange(),c=o&&hd(o);return c==null?!1:(e&&e(t.tr.lift(o,c).scrollIntoView()),!0)}let i=a.nodeBefore;if(LS(t,a,e,-1))return!0;if(r.parent.content.size==0&&(Zc(i,"end")||it.isSelectable(i)))for(let o=r.depth;;o--){let c=Fp(t.doc,r.before(o),r.after(o),ze.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},O6=(t,e,n)=>{let r=kS(t,n);if(!r)return!1;let a=by(r);return a?CS(t,a,e):!1},D6=(t,e,n)=>{let r=TS(t,n);if(!r)return!1;let a=vy(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=Fp(t.doc,i,u,ze.empty);if(!h||h.from!=i||h instanceof ds&&h.slice.size>=u-i)return!1;if(n){let f=t.tr.step(h);f.setSelection(ot.create(f.doc,i)),n(f.scrollIntoView())}return!0}function 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 ES=(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=by(r)}let o=i&&i.nodeBefore;return!o||!it.isSelectable(o)?!1:(e&&e(t.tr.setSelection(it.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function by(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 TS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=TS(t,n);if(!r)return!1;let a=vy(r);if(!a)return!1;let i=a.nodeAfter;if(LS(t,a,e,1))return!0;if(r.parent.content.size==0&&(Zc(i,"start")||it.isSelectable(i))){let o=Fp(t.doc,r.before(),r.after(),ze.empty);if(o&&o.slice.size{let{$head:r,empty:a}=t.selection,i=r;if(!a)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let n=t.selection,r=n instanceof it,a;if(r){if(n.node.isTextblock||!Ko(t.doc,n.from))return!1;a=n.from}else if(a=zp(t.doc,n.from,-1),a==null)return!1;if(e){let i=t.tr.join(a);r&&i.setSelection(it.create(i.doc,a-t.doc.resolve(a).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},$6=(t,e)=>{let n=t.selection,r;if(n instanceof it){if(n.node.isTextblock||!Ko(t.doc,n.to))return!1;r=n.to}else if(r=zp(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},z6=(t,e)=>{let{$from:n,$to:r}=t.selection,a=n.blockRange(r),i=a&&hd(a);return i==null?!1:(e&&e(t.tr.lift(a,i).scrollIntoView()),!0)},IS=(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 Ny(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=Ny(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},PS=(t,e)=>{let n=t.selection,{$from:r,$to:a}=n;if(n instanceof Cr||r.parent.inlineContent||a.parent.inlineContent)return!1;let i=Ny(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(Ri(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),a=r&&hd(r);return a==null?!1:(e&&e(t.tr.lift(r,a).scrollIntoView()),!0)};function B6(t){return(e,n)=>{let{$from:r,$to:a}=e.selection;if(e.selection instanceof it&&e.selection.node.isBlock)return!r.parentOffset||!Ri(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=Ny(r.node(b-1).contentMatchAt(r.indexAfter(b-1))),i.unshift(u&&c?{type:c}:null),o=b;break}else{if(b==1)return!1;i.unshift(null)}let f=e.tr;(e.selection instanceof ot||e.selection instanceof Cr)&&f.deleteSelection();let m=f.mapping.map(r.pos),g=Ri(f.doc,m,i.length,i);if(g||(i[0]=c?{type:c}:null,g=Ri(f.doc,m,i.length,i)),!g)return!1;if(f.split(m,i.length,i),!u&&h&&r.node(o).type!=c){let b=f.mapping.map(r.before(o)),N=f.doc.resolve(b);c&&r.node(o-1).canReplaceWith(N.index(),N.index()+1,c)&&f.setNodeMarkup(f.mapping.map(r.before(o)),c)}return n&&n(f.scrollIntoView()),!0}}const V6=B6(),H6=(t,e)=>{let{$from:n,to:r}=t.selection,a,i=n.sharedDepth(r);return i==0?!1:(a=n.before(i),e&&e(t.tr.setSelection(it.create(t.doc,a))),!0)};function U6(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||Ko(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function LS(t,e,n,r){let a=e.nodeBefore,i=e.nodeAfter,o,c,u=a.type.spec.isolating||i.type.spec.isolating;if(!u&&U6(t,e,n))return!0;let h=!u&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(o=(c=a.contentMatchAt(a.childCount)).findWrapping(i.type))&&c.matchType(o[0]||i.type).validEnd){if(n){let b=e.pos+i.nodeSize,N=Ce.empty;for(let k=o.length-1;k>=0;k--)N=Ce.from(o[k].create(null,N));N=Ce.from(a.copy(N));let j=t.tr.step(new ps(e.pos-1,b,e.pos,b,new ze(N,1,0),o.length,!0)),v=j.doc.resolve(b+2*o.length);v.nodeAfter&&v.nodeAfter.type==a.type&&Ko(j.doc,v.pos)&&j.join(v.pos),n(j.scrollIntoView())}return!0}let f=i.type.spec.isolating||r>0&&u?null:ft.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),g=m&&hd(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(h&&Zc(i,"start",!0)&&Zc(a,"end")){let b=a,N=[];for(;N.push(b),!b.isTextblock;)b=b.lastChild;let j=i,v=1;for(;!j.isTextblock;j=j.firstChild)v++;if(b.canReplace(b.childCount,b.childCount,j.content)){if(n){let k=Ce.empty;for(let C=N.length-1;C>=0;C--)k=Ce.from(N[C].copy(k));let T=t.tr.step(new ps(e.pos-N.length,e.pos+i.nodeSize,e.pos+v,e.pos+i.nodeSize-v,new ze(k,N.length,0),0,!0));n(T.scrollIntoView())}return!0}}return!1}function OS(t){return function(e,n){let r=e.selection,a=t<0?r.$from:r.$to,i=a.depth;for(;a.node(i).isInline;){if(!i)return!1;i--}return a.node(i).isTextblock?(n&&n(e.tr.setSelection(ot.create(e.doc,t<0?a.start(i):a.end(i)))),!0):!1}}const W6=OS(-1),K6=OS(1);function q6(t,e=null){return function(n,r){let{$from:a,$to:i}=n.selection,o=a.blockRange(i),c=o&&my(o,t,e);return c?(r&&r(n.tr.wrap(o,c).scrollIntoView()),!0):!1}}function AN(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 _f(u,u,e.depth),e.endIndex=0;f--)i=Ce.from(n[f].type.create(n[f].attrs,i));t.step(new ps(e.start-(r?2:0),e.end,e.start,e.end,new ze(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?X6(e,n,t,i):Z6(e,n,i):!0:!1}}function X6(t,e,n,r){let a=t.tr,i=r.end,o=r.$to.end(r.depth);ij;N--)b-=a.child(N).nodeSize,r.delete(b-1,b+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,u=n.endIndex==a.childCount,h=i.node(-1),f=i.index(-1);if(!h.canReplace(f+(c?0:1),f+1,o.content.append(u?Ce.empty:Ce.from(a))))return!1;let m=i.pos,g=m+o.nodeSize;return r.step(new ps(m-(c?1:0),g+(u?1:0),m+1,g-1,new ze((c?Ce.empty:Ce.from(a.copy(Ce.empty))).append(u?Ce.empty:Ce.from(a.copy(Ce.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function eL(t){return function(e,n){let{$from:r,$to:a}=e.selection,i=r.blockRange(a,h=>h.childCount>0&&h.firstChild.type==t);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let c=i.parent,u=c.child(o-1);if(u.type!=t)return!1;if(n){let h=u.lastChild&&u.lastChild.type==c.type,f=Ce.from(h?t.create():null),m=new ze(Ce.from(t.create(null,Ce.from(c.type.create(null,f)))),h?3:1,0),g=i.start,b=i.end;n(e.tr.step(new ps(g-(h?3:1),b,g,b,m,1,!0)).scrollIntoView())}return!0}}const ws=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},ed=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let a0=null;const ji=function(t,e,n){let r=a0||(a0=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},tL=function(){a0=null},Kl=function(t,e,n,r){return n&&(IN(t,e,n,r,-1)||IN(t,e,n,r,1))},nL=/^(img|br|input|textarea|hr)$/i;function IN(t,e,n,r,a){for(var i;;){if(t==n&&e==r)return!0;if(e==(a<0?0:Wr(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Bu(t)||nL.test(t.nodeName)||t.contentEditable=="false")return!1;e=ws(t)+(a<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(a<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=a;else return!1;else t=o,e=a<0?Wr(t):0}else return!1}}function Wr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function sL(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Wr(t)}else if(t.parentNode&&!Bu(t))e=ws(t),t=t.parentNode;else return null}}function rL(t,e){for(;;){if(t.nodeType==3&&e2),Ur=td||(Ha?/Mac/.test(Ha.platform):!1),$S=Ha?/Win/.test(Ha.platform):!1,Ai=/Android \d/.test(qo),Vu=!!PN&&"webkitFontSmoothing"in PN.documentElement.style,lL=Vu?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function cL(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 yi(t,e){return typeof t=="number"?t:t[e]}function dL(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 RN(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=ed(o);continue}let c=o,u=c==i.body,h=u?cL(i):dL(c),f=0,m=0;if(e.toph.bottom-yi(r,"bottom")&&(m=e.bottom-e.top>h.bottom-h.top?e.top+yi(a,"top")-h.top:e.bottom-h.bottom+yi(a,"bottom")),e.lefth.right-yi(r,"right")&&(f=e.right-h.right+yi(a,"right")),f||m)if(u)i.defaultView.scrollBy(f,m);else{let b=c.scrollLeft,N=c.scrollTop;m&&(c.scrollTop+=m),f&&(c.scrollLeft+=f);let j=c.scrollLeft-b,v=c.scrollTop-N;e={left:e.left-j,top:e.top-v,right:e.right-j,bottom:e.bottom-v}}let g=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(g))break;o=g=="absolute"?o.offsetParent:ed(o)}}function uL(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:zS(t.dom)}}function zS(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=ed(r));return e}function hL({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;FS(n,r==0?0:r-e)}function FS(t,e){for(let n=0;n=c){o=Math.max(N.bottom,o),c=Math.min(N.top,c);let j=N.left>e.left?N.left-e.left:N.right=(N.left+N.right)/2?1:0));continue}}else N.top>e.top&&!u&&N.left<=e.left&&N.right>=e.left&&(u=f,h={left:Math.max(N.left,Math.min(N.right,e.left)),top:N.top});!n&&(e.left>=N.right&&e.top>=N.top||e.left>=N.left&&e.top>=N.bottom)&&(i=m+1)}}return!n&&u&&(n=u,a=h,r=0),n&&n.nodeType==3?pL(n,a):!n||r&&n.nodeType==1?{node:t,offset:i}:BS(n,a)}function pL(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 jy(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function mL(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 xL(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 VS(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&a++}let h;Vu&&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=xL(t,r,a,e))}c==null&&(c=gL(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function LN(t){return t.top=0&&a==r.nodeValue.length?(u--,f=1):n<0?u--:h++,Yd(mo(ji(r,u,h),f),f<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&a&&(n<0||a==Wr(r))){let u=r.childNodes[a-1];if(u.nodeType==1)return ix(u.getBoundingClientRect(),!1)}if(i==null&&a=0)}if(i==null&&a&&(n<0||a==Wr(r))){let u=r.childNodes[a-1],h=u.nodeType==3?ji(u,Wr(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(h)return Yd(mo(h,1),!1)}if(i==null&&a=0)}function Yd(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 ix(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 US(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 vL(t,e,n){let r=e.selection,a=n=="up"?r.$from:r.$to;return US(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=HS(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=ji(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 NL=/[\u0590-\u08ac]/;function wL(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?!NL.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?i:o:US(t,e,()=>{let{focusNode:u,focusOffset:h,anchorNode:f,anchorOffset:m}=t.domSelectionRange(),g=c.caretBidiLevel;c.modify("move",n,"character");let b=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:N,focusOffset:j}=t.domSelectionRange(),v=N&&!b.contains(N.nodeType==1?N:N.parentNode)||u==N&&h==j;try{c.collapse(f,m),u&&(u!=f||h!=m)&&c.extend&&c.extend(u,h)}catch{}return g!=null&&(c.caretBidiLevel=g),v}):r.pos==r.start()||r.pos==r.end()}let ON=null,DN=null,_N=!1;function jL(t,e,n){return ON==e&&DN==n?_N:(ON=e,DN=n,_N=n=="up"||n=="down"?vL(t,e,n):wL(t,e,n))}const qr=0,$N=1,El=2,Ua=3;class Hu{constructor(e,n,r,a){this.parent=e,this.children=n,this.dom=r,this.contentDOM=a,this.dirty=qr,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;nws(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 KS){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 WS&&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?ws(i.dom)+1:0}}else{let i,o=!0;for(;i=r=f&&n<=h-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,f);e=o;for(let m=c;m>0;m--){let g=this.children[m-1];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(1)){a=ws(g.dom)+1;break}e-=g.size}a==-1&&(a=0)}if(a>-1&&(h>n||c==this.children.length-1)){n=h;for(let f=c+1;fN&&on){let N=c;c=u,u=N}let b=document.createRange();b.setEnd(u.node,u.offset),b.setStart(c.node,c.offset),h.removeAllRanges(),h.addRange(b)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,a=0;a=r:er){let c=r+i.border,u=o-i.border;if(e>=c&&n<=u){this.dirty=e==r||n==o?El:$N,e==c&&n==u&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Ua:i.markDirty(e-c,n-c);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?El:Ua}r=o}this.dirty=El}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?El:$N;n.dirty{if(!i)return a;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(o.nodeType!=1){let c=document.createElement("span");c.appendChild(o),o=c}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==qr&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class kL extends Hu{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 ql extends Hu{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=tc.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ql(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Ua||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ua&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=qr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(i=d0(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}=tc.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!m&&!n.isText&&f.nodeName!="BR"&&(f.hasAttribute("contenteditable")||(f.contentEditable="false"),n.type.spec.draggable&&(f.draggable=!0));let g=f;return f=JS(f,r,n),h?u=new SL(e,n,r,a,f,m||null,g,h,i,o+1):n.isText?new Hp(e,n,r,a,f,g,i):new Lo(e,n,r,a,f,m||null,g,i,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Ce.empty)}return e}matchesNode(e,n,r){return this.dirty==qr&&e.eq(this.node)&&zf(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 EL(this,o&&o.node,e);AL(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?on.none:this.node.child(f).marks,r,e,f),u.placeWidget(h,e,a)},(h,f,m,g)=>{u.syncToMarks(h.marks,r,e,g);let b;u.findNodeMatch(h,f,m,g)||c&&e.state.selection.from>a&&e.state.selection.to-1&&u.updateNodeAt(h,f,m,b,e)||u.updateNextNode(h,f,m,e,g,a)||u.addNode(h,f,m,e,a),a+=h.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==El)&&(o&&this.protectLocalComposition(e,o),qS(this.contentDOM,this.children,e),td&&IL(this.dom))}localCompositionInfo(e,n){let{from:r,to:a}=e.state.selection;if(!(e.state.selection instanceof ot)||rn+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,c=PL(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 kL(this,i,n,a);e.input.compositionNodes.push(o),this.children=d0(this.children,r,r+a.length,e,o)}update(e,n,r,a){return this.dirty==Ua||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,a),!0)}updateInner(e,n,r,a){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(a,this.posAtStart),this.dirty=qr}updateOuterDeco(e){if(zf(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=GS(this.dom,this.nodeDOM,c0(this.outerDeco,this.node,n),c0(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 zN(t,e,n,r,a){JS(r,e,t);let i=new Lo(void 0,t,e,n,r,r,r,a,0);return i.contentDOM&&i.updateChildren(a,0),i}class Hp extends Lo{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==Ua||this.dirty!=qr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=qr||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,a.trackWrites==this.nodeDOM&&(a.trackWrites=null)),this.node=e,this.dirty=qr,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let a=this.node.cut(e,n),i=document.createTextNode(a.text);return new Hp(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=Ua)}get domAtom(){return!1}isText(e){return this.node.text==e}}class KS extends Hu{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==qr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class SL extends Lo{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==Ua)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 qS(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=ql.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 ql)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 ML(t,e){return t.type.side-e.type.side}function AL(t,e,n,r){let a=e.locals(t),i=0;if(a.length==0){for(let h=0;hi;)c.push(a[o++]);let N=i+g.nodeSize;if(g.isText){let v=N;o!v.inline):c.slice();r(g,j,e.forChild(i,g),b),i=N}}function IL(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 PL(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 d0(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 ky(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(Vp(n)){for(u=o;a&&!a.node;)a=a.parent;let m=a.node;if(a&&m.isAtom&&it.isSelectable(m)&&a.parent&&!(m.isInline&&aL(n.focusNode,n.focusOffset,a.dom))){let g=a.posBefore;h=new it(o==g?c:r.resolve(g))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let m=o,g=o;for(let b=0;b{(n.anchorNode!=r||n.anchorOffset!=a)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!QS(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function LL(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,ws(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&ur&&Ro<=11&&(n.disabled=!0,n.disabled=!1)}function YS(t,e){if(e instanceof it){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(UN(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else UN(t)}function UN(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Sy(t,e,n,r){return t.someProp("createSelectionBetween",a=>a(t,e,n))||ot.between(e,n,r)}function WN(t){return t.editable&&!t.hasFocus()?!1:XS(t)}function XS(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 OL(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Kl(e.node,e.offset,n.anchorNode,n.anchorOffset)}function u0(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 go(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function KN(t,e,n){let r=t.state.selection;if(r instanceof ot)if(n.indexOf("s")>-1){let{$head:a}=r,i=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(a.pos+i.nodeSize*(e<0?-1:1));return go(t,new ot(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let a=u0(t.state,e);return a&&a instanceof it?go(t,a):!1}else if(!(Ur&&n.indexOf("m")>-1)){let a=r.$head,i=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter,o;if(!i||i.isText)return!1;let c=e<0?a.pos-i.nodeSize:a.pos;return i.isAtom||(o=t.docView.descAt(c))&&!o.contentDOM?it.isSelectable(i)?go(t,new it(e<0?t.state.doc.resolve(a.pos-i.nodeSize):a)):Vu?go(t,new ot(t.state.doc.resolve(e<0?c:c+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof it&&r.node.isInline)return go(t,new ot(e>0?r.$to:r.$from));{let a=u0(t.state,e);return a?go(t,a):!1}}}function Ff(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function fu(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Lc(t,e){return e<0?DL(t):_L(t)}function DL(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a,i,o=!1;for(Kr&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(fu(c,-1))a=n,i=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(ZS(n))break;{let c=n.previousSibling;for(;c&&fu(c,-1);)a=n.parentNode,i=ws(c),c=c.previousSibling;if(c)n=c,r=Ff(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?h0(t,n,r):a&&h0(t,a,i)}function _L(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a=Ff(n),i,o;for(;;)if(r{t.state==a&&Li(t)},50)}function qN(t,e){let n=t.state.doc.resolve(e);if(!(ks||$S)&&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 GN(t,e,n){let r=t.state.selection;if(r instanceof ot&&!r.empty||n.indexOf("s")>-1||Ur&&n.indexOf("m")>-1)return!1;let{$from:a,$to:i}=r;if(!a.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=u0(t.state,e);if(o&&o instanceof it)return go(t,o)}if(!a.parent.inlineContent){let o=e<0?a:i,c=r instanceof Cr?ft.near(o,e):ft.findFrom(o,e);return c?go(t,c):!1}return!1}function JN(t,e){if(!(t.state.selection instanceof ot))return!0;let{$head:n,$anchor:r,empty:a}=t.state.selection;if(!n.sameParent(r))return!0;if(!a)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function QN(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function FL(t){if(!Rs||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;QN(t,r,"true"),setTimeout(()=>QN(t,r,"false"),20)}return!1}function BL(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function VL(t,e){let n=e.keyCode,r=BL(e);if(n==8||Ur&&n==72&&r=="c")return JN(t,-1)||Lc(t,-1);if(n==46&&!e.shiftKey||Ur&&n==68&&r=="c")return JN(t,1)||Lc(t,1);if(n==13||n==27)return!0;if(n==37||Ur&&n==66&&r=="c"){let a=n==37?qN(t,t.state.selection.from)=="ltr"?-1:1:-1;return KN(t,a,r)||Lc(t,a)}else if(n==39||Ur&&n==70&&r=="c"){let a=n==39?qN(t,t.state.selection.from)=="ltr"?1:-1:1;return KN(t,a,r)||Lc(t,a)}else{if(n==38||Ur&&n==80&&r=="c")return GN(t,-1,r)||Lc(t,-1);if(n==40||Ur&&n==78&&r=="c")return FL(t)||GN(t,1,r)||Lc(t,1);if(r==(Ur?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Cy(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")||tc.fromSchema(t.state.schema),c=aC(),u=c.createElement("div");u.appendChild(o.serializeFragment(r,{document:c}));let h=u.firstChild,f,m=0;for(;h&&h.nodeType==1&&(f=rC[h.nodeName.toLowerCase()]);){for(let b=f.length-1;b>=0;b--){let N=c.createElement(f[b]);for(;u.firstChild;)N.appendChild(u.firstChild);u.appendChild(N),m++}h=u.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${a} ${i}${m?` -${m}`:""} ${JSON.stringify(n)}`);let g=t.someProp("clipboardTextSerializer",b=>b(e,t))||e.content.textBetween(0,e.content.size,` - -`);return{dom:u,text:g,slice:e}}function eC(t,e,n,r,a){let i=a.parent.type.spec.code,o,c;if(!n&&!e)return null;let u=!!e&&(r||i||!n);if(u){if(t.someProp("transformPastedText",g=>{e=g(e,i||r,t)}),i)return c=new ze(Ce.from(t.state.schema.text(e.replace(/\r\n?/g,` -`))),0,0),t.someProp("transformPasted",g=>{c=g(c,t,!0)}),c;let m=t.someProp("clipboardTextParser",g=>g(e,a,r,t));if(m)c=m;else{let g=a.marks(),{schema:b}=t.state,N=tc.fromSchema(b);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(j=>{let v=o.appendChild(document.createElement("p"));j&&v.appendChild(N.serializeNode(b.text(j,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),o=KL(n),Vu&&qL(o);let h=o&&o.querySelector("[data-pm-slice]"),f=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(f&&f[3])for(let m=+f[3];m>0;m--){let g=o.firstChild;for(;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;o=g}if(c||(c=(t.someProp("clipboardParser")||t.someProp("domParser")||Po.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||f),context:a,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!HL.test(g.parentNode.nodeName)?{ignore:!0}:null}})),f)c=GL(YN(c,+f[1],+f[2]),f[4]);else if(c=ze.maxOpen(UL(c.content,a),!0),c.openStart||c.openEnd){let m=0,g=0;for(let b=c.content.firstChild;m{c=m(c,t,u)}),c}const HL=/^(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 UL(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&&nC(u,i,c,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=sC(o[o.length-1],i.length));let f=tC(c,u);o.push(f),a=a.matchType(f.type),i=u}}),o)return Ce.from(o)}return t}function tC(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,Ce.from(t));return t}function nC(t,e,n,r,a){if(a1&&(i=0),a=n&&(c=e<0?o.contentMatchAt(0).fillBefore(c,i<=a).append(c):c.append(o.contentMatchAt(o.childCount).fillBefore(Ce.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(c))}function YN(t,e,n){return en})),lx.createHTML(t)):t}function KL(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=aC().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),a;if((a=r&&rC[r[1].toLowerCase()])&&(t=a.map(i=>"<"+i+">").join("")+t+a.map(i=>"").reverse().join("")),n.innerHTML=WL(t),a)for(let i=0;i=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;a=Ce.from(u.create(r[c+1],a)),i++,o++}return new ze(a,i,o)}const Ws={},Ks={},JL={touchstart:!0,touchmove:!0};class QL{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 YL(t){for(let e in Ws){let n=Ws[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{ZL(t,r)&&!Ey(t,r)&&(t.editable||!(r.type in Ks))&&n(t,r)},JL[e]?{passive:!0}:void 0)}Rs&&t.dom.addEventListener("input",()=>null),p0(t)}function To(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function XL(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 p0(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Ey(t,r))})}function Ey(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function ZL(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 eO(t,e){!Ey(t,e)&&Ws[e.type]&&(t.editable||!(e.type in Ks))&&Ws[e.type](t,e)}Ks.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!oC(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Ai&&ks&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),td&&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,Sl(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||VL(t,n)?n.preventDefault():To(t,"key")};Ks.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Ks.keypress=(t,e)=>{let n=e;if(oC(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Ur&&n.metaKey)return;if(t.someProp("handleKeyPress",a=>a(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof ot)||!r.$from.sameParent(r.$to)){let a=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(a).scrollIntoView();!/[\r\n]/.test(a)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,a,i))&&t.dispatch(i()),n.preventDefault()}};function Up(t){return{left:t.clientX,top:t.clientY}}function tO(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Ty(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 qc(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 nO(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&it.isSelectable(r)?(qc(t,new it(n)),!0):!1}function sO(t,e){if(e==-1)return!1;let n=t.state.selection,r,a;n instanceof it&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let c=o>i.depth?i.nodeAfter:i.node(o);if(it.isSelectable(c)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?a=i.before(n.$from.depth):a=i.before(o);break}}return a!=null?(qc(t,it.create(t.state.doc,a)),!0):!1}function rO(t,e,n,r,a){return Ty(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(a?sO(t,n):nO(t,n))}function aO(t,e,n,r){return Ty(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",a=>a(t,e,r))}function iO(t,e,n,r){return Ty(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",a=>a(t,e,r))||oO(t,n,r)}function oO(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(qc(t,ot.create(r,0,r.content.size)),!0):!1;let a=r.resolve(e);for(let i=a.depth+1;i>0;i--){let o=i>a.depth?a.nodeAfter:a.node(i),c=a.before(i);if(o.inlineContent)qc(t,ot.create(r,c+1,c+1+o.content.size));else if(it.isSelectable(o))qc(t,it.create(r,c));else continue;return!0}}function My(t){return Bf(t)}const iC=Ur?"metaKey":"ctrlKey";Ws.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=My(t),a=Date.now(),i="singleClick";a-t.input.lastClick.time<500&&tO(n,t.input.lastClick)&&!n[iC]&&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(Up(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new lO(t,o,n,!!r)):(i=="doubleClick"?aO:iO)(t,o.pos,o.inside,n)?n.preventDefault():To(t,"pointer"))};class lO{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[iC],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let f=e.state.doc.resolve(n.pos);i=f.parent,o=f.depth?f.before():0}const c=a?null:r.target,u=c?e.docView.nearestDesc(c,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:h}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||h instanceof it&&h.from<=o&&h.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Kr&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),To(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(()=>Li(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(Up(e))),this.updateAllowDefault(e),this.allowDefault||!n?To(this.view,"pointer"):rO(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Rs&&this.mightDrag&&!this.mightDrag.node.isAtom||ks&&!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)?(qc(this.view,ft.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):To(this.view,"pointer")}move(e){this.updateAllowDefault(e),To(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)}}Ws.touchstart=t=>{t.input.lastTouch=Date.now(),My(t),To(t,"pointer")};Ws.touchmove=t=>{t.input.lastTouch=Date.now(),To(t,"pointer")};Ws.contextmenu=t=>My(t);function oC(t,e){return t.composing?!0:Rs&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const cO=Ai?5e3:-1;Ks.compositionstart=Ks.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof ot&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||ks&&$S&&dO(t)))t.markCursor=t.state.storedMarks||n.marks(),Bf(t,!0),t.markCursor=null;else if(Bf(t,!e.selection.empty),Kr&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let a=r.focusNode,i=r.focusOffset;a&&a.nodeType==1&&i!=0;){let o=i<0?a.lastChild:a.childNodes[i-1];if(!o)break;if(o.nodeType==3){let c=t.domSelection();c&&c.collapse(o,o.nodeValue.length);break}else a=o,i=-1}}t.input.composing=!0}lC(t,cO)};function dO(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"}Ks.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++,lC(t,20))};function lC(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Bf(t),e))}function cC(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=hO());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function uO(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=sL(e.focusNode,e.focusOffset),r=rL(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 hO(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Bf(t,e=!1){if(!(Ai&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),cC(t),e||t.docView&&t.docView.dirty){let n=ky(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 fO(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 Tu=ur&&Ro<15||td&&lL<604;Ws.copy=Ks.cut=(t,e)=>{let n=e,r=t.state.selection,a=n.type=="cut";if(r.empty)return;let i=Tu?null:n.clipboardData,o=r.content(),{dom:c,text:u}=Cy(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",c.innerHTML),i.setData("text/plain",u)):fO(t,c),a&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function pO(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function mO(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let a=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Mu(t,r.value,null,a,e):Mu(t,r.textContent,r.innerHTML,a,e)},50)}function Mu(t,e,n,r,a){let i=eC(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,a,i||ze.empty)))return!0;if(!i)return!1;let o=pO(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 dC(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," "):""}Ks.paste=(t,e)=>{let n=e;if(t.composing&&!Ai)return;let r=Tu?null:n.clipboardData,a=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Mu(t,dC(r),r.getData("text/html"),a,n)?n.preventDefault():mO(t,n)};class uC{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const gO=Ur?"altKey":"ctrlKey";function hC(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[gO]}Ws.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(Up(n)),o;if(!(i&&i.pos>=a.from&&i.pos<=(a instanceof it?a.to-1:a.to))){if(r&&r.mightDrag)o=it.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let m=t.docView.nearestDesc(n.target,!0);m&&m.node.type.spec.draggable&&m!=t.docView&&(o=it.create(t.state.doc,m.posBefore))}}let c=(o||t.state.selection).content(),{dom:u,text:h,slice:f}=Cy(t,c);(!n.dataTransfer.files.length||!ks||_S>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Tu?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",Tu||n.dataTransfer.setData("text/plain",h),t.dragging=new uC(f,hC(t,n),o)};Ws.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Ks.dragover=Ks.dragenter=(t,e)=>e.preventDefault();Ks.drop=(t,e)=>{try{xO(t,e,t.dragging)}finally{t.dragging=null}};function xO(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Up(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=eC(t,dC(e.dataTransfer),Tu?null:e.dataTransfer.getData("text/html"),!1,a);let o=!!(n&&hC(t,e));if(t.someProp("handleDrop",b=>b(t,e,i||ze.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let c=i?gS(t.state.doc,a.pos,i):a.pos;c==null&&(c=a.pos);let u=t.state.tr;if(o){let{node:b}=n;b?b.replace(u):u.deleteSelection()}let h=u.mapping.map(c),f=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,m=u.doc;if(f?u.replaceRangeWith(h,h,i.content.firstChild):u.replaceRange(h,h,i),u.doc.eq(m))return;let g=u.doc.resolve(h);if(f&&it.isSelectable(i.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(i.content.firstChild))u.setSelection(new it(g));else{let b=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((N,j,v,k)=>b=k),u.setSelection(Sy(t,g,u.doc.resolve(b)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}Ws.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())&&Li(t)},20))};Ws.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)};Ws.beforeinput=(t,e)=>{if(ks&&Ai&&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,Sl(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 Ks)Ws[t]=Ks[t];function Au(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 Vf{constructor(e,n){this.toDOM=e,this.spec=n||Rl,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 Zn(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Vf&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Au(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Oo{constructor(e,n){this.attrs=e,this.spec=n||Rl}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 Zn(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==Is||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Rl)}mapInner(e,n,r,a,i){let o;for(let c=0;c{let h=u+r,f;if(f=pC(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 Oo){let h=Math.max(i,u.from)-i,f=Math.min(o,u.to)-i;ha.map(e,n,Rl));return bo.from(r)}forChild(e,n){if(n.isLeaf)return an.empty;let r=[];for(let a=0;an instanceof an)?e:e.reduce((n,r)=>n.concat(r instanceof an?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let v=j-N-(b-g);for(let k=0;kT+f-m)continue;let C=c[k]+f-m;b>=C?c[k+1]=g<=C?-2:-1:g>=f&&v&&(c[k]+=v,c[k+1]+=v)}m+=v}),f=n.maps[h].map(f,-1)}let u=!1;for(let h=0;h=r.content.size){u=!0;continue}let g=n.map(t[h+1]+i,-1),b=g-a,{index:N,offset:j}=r.content.findIndex(m),v=r.maybeChild(N);if(v&&j==m&&j+v.nodeSize==b){let k=c[h+2].mapInner(n,v,f+1,t[h]+i+1,o);k!=Is?(c[h]=m,c[h+1]=b,c[h+2]=k):(c[h+1]=-2,u=!0)}else u=!0}if(u){let h=bO(c,t,e,n,a,i,o),f=Hf(h,r,0,o);e=f.local;for(let m=0;mn&&o.to{let h=pC(t,c,u+n);if(h){i=!0;let f=Hf(h,c,n+u+1,r);f!=Is&&a.push(u,u+c.nodeSize,f)}});let o=fC(i?mC(t):t,-n).sort(Ll);for(let c=0;c0;)e++;t.splice(e,0,n)}function cx(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Is&&e.push(r)}),t.cursorWrapper&&e.push(an.create(t.state.doc,[t.cursorWrapper.deco])),bo.from(e)}const vO={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},NO=ur&&Ro<=11;class wO{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 jO{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new wO,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():Rs&&e.composing&&r.some(a=>a.type=="childList"&&a.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),NO&&(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,vO)),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(WN(this.view)){if(this.suppressingSelectionUpdates)return Li(this.view);if(ur&&Ro<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Kl(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=ed(i))n.add(i);for(let i=e.anchorNode;i;i=ed(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)&&WN(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,c=!1,u=[];if(e.editable)for(let f=0;ff.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let f of u)if(f.nodeName=="BR"&&f.parentNode){let m=f.nextSibling;m&&m.nodeType==1&&m.contentEditable=="false"&&f.parentNode.removeChild(f)}}else if(Kr&&u.length){let f=u.filter(m=>m.nodeName=="BR");if(f.length==2){let[m,g]=f;m.parentNode&&m.parentNode.parentNode==g.parentNode?g.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let g of f){let b=g.parentNode;b&&b.nodeName=="LI"&&(!m||CO(e,m)!=b)&&g.remove()}}}let h=null;i<0&&a&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||a)&&(i>-1&&(e.docView.markDirty(i,o),kO(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,EO(e,u)),this.handleDOMChange(i,o,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Li(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let f=0;fa;v--){let k=r.childNodes[v-1],T=k.pmViewDesc;if(k.nodeName=="BR"&&!T){i=v;break}if(!T||T.size)break}let m=t.state.doc,g=t.someProp("domParser")||Po.fromSchema(t.state.schema),b=m.resolve(o),N=null,j=g.parse(r,{topNode:b.parent,topMatch:b.parent.contentMatchAt(b.index()),topOpen:!0,from:a,to:i,preserveWhitespace:b.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:MO,context:b});if(h&&h[0].pos!=null){let v=h[0].pos,k=h[1]&&h[1].pos;k==null&&(k=v),N={anchor:v+o,head:k+o}}return{doc:j,sel:N,from:o,to:c}}function MO(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Rs&&/^(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||Rs&&/^(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 AO=/^(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 IO(t,e,n,r,a){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let P=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,z=ky(t,P);if(z&&!t.state.selection.eq(z)){if(ks&&Ai&&t.input.lastKeyCode===13&&Date.now()-100Q(t,Sl(13,"Enter"))))return;let L=t.state.tr.setSelection(z);P=="pointer"?L.setMeta("pointer",!0):P=="key"&&L.scrollIntoView(),i&&L.setMeta("composition",i),t.dispatch(L)}return}let o=t.state.doc.resolve(e),c=o.sharedDepth(n);e=o.before(c+1),n=t.state.doc.resolve(n).after(c+1);let u=t.state.selection,h=TO(t,e,n),f=t.state.doc,m=f.slice(h.from,h.to),g,b;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||Ai)&&a.some(P=>P.nodeType==1&&!AO.test(P.nodeName))&&(!N||N.endA>=N.endB)&&t.someProp("handleKeyDown",P=>P(t,Sl(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!N)if(r&&u instanceof ot&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(h.sel&&h.sel.anchor!=h.sel.head))N={start:u.from,endA:u.to,endB:u.to};else{if(h.sel){let P=sw(t,t.state.doc,h.sel);if(P&&!P.eq(t.state.selection)){let z=t.state.tr.setSelection(P);i&&z.setMeta("composition",i),t.dispatch(z)}}return}t.state.selection.fromt.state.selection.from&&N.start<=t.state.selection.from+2&&t.state.selection.from>=h.from?N.start=t.state.selection.from:N.endA=t.state.selection.to-2&&t.state.selection.to<=h.to&&(N.endB+=t.state.selection.to-N.endA,N.endA=t.state.selection.to)),ur&&Ro<=11&&N.endB==N.start+1&&N.endA==N.start&&N.start>h.from&&h.doc.textBetween(N.start-h.from-1,N.start-h.from+1)=="  "&&(N.start--,N.endA--,N.endB--);let j=h.doc.resolveNoCache(N.start-h.from),v=h.doc.resolveNoCache(N.endB-h.from),k=f.resolve(N.start),T=j.sameParent(v)&&j.parent.inlineContent&&k.end()>=N.endA;if((td&&t.input.lastIOSEnter>Date.now()-225&&(!T||a.some(P=>P.nodeName=="DIV"||P.nodeName=="P"))||!T&&j.posP(t,Sl(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>N.start&&RO(f,N.start,N.endA,j,v)&&t.someProp("handleKeyDown",P=>P(t,Sl(8,"Backspace")))){Ai&&ks&&t.domObserver.suppressSelectionUpdates();return}ks&&N.endB==N.start&&(t.input.lastChromeDelete=Date.now()),Ai&&!T&&j.start()!=v.start()&&v.parentOffset==0&&j.depth==v.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==N.endA&&(N.endB-=2,v=h.doc.resolveNoCache(N.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function(P){return P(t,Sl(13,"Enter"))})},20));let C=N.start,R=N.endA,O=P=>{let z=P||t.state.tr.replace(C,R,h.doc.slice(N.start-h.from,N.endB-h.from));if(h.sel){let L=sw(t,z.doc,h.sel);L&&!(ks&&t.composing&&L.empty&&(N.start!=N.endB||t.input.lastChromeDeleteLi(t),20));let P=O(t.state.tr.delete(C,R)),z=f.resolve(N.start).marksAcross(f.resolve(N.endA));z&&P.ensureMarks(z),t.dispatch(P)}else if(N.endA==N.endB&&(U=PO(j.parent.content.cut(j.parentOffset,v.parentOffset),k.parent.content.cut(k.parentOffset,N.endA-k.start())))){let P=O(t.state.tr);U.type=="add"?P.addMark(C,R,U.mark):P.removeMark(C,R,U.mark),t.dispatch(P)}else if(j.parent.child(j.index()).isText&&j.index()==v.index()-(v.textOffset?0:1)){let P=j.parent.textBetween(j.parentOffset,v.parentOffset),z=()=>O(t.state.tr.insertText(P,C,R));t.someProp("handleTextInput",L=>L(t,C,R,P,z))||t.dispatch(z())}else t.dispatch(O());else t.dispatch(O())}function sw(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Sy(t,e.resolve(n.anchor),e.resolve(n.head))}function PO(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||dx(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 LO(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 gC{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 QL,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(cw),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=ow(this),iw(this),this.nodeViews=lw(this),this.docView=zN(this.state.doc,aw(this),cx(this),this.dom,this),this.domObserver=new jO(this,(r,a,i,o)=>IO(this,r,a,i,o)),this.domObserver.start(),YL(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&&p0(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(cw),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&&(cC(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=lw(this);DO(b,this.nodeViews)&&(this.nodeViews=b,i=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&p0(this),this.editable=ow(this),iw(this);let u=cx(this),h=aw(this),f=a.plugins!=e.plugins&&!a.doc.eq(e.doc)?"reset":e.scrollToSelection>a.scrollToSelection?"to selection":"preserve",m=i||!this.docView.matchesNode(e.doc,h,u);(m||!e.selection.eq(a.selection))&&(o=!0);let g=f=="preserve"&&o&&this.dom.style.overflowAnchor==null&&uL(this);if(o){this.domObserver.stop();let b=m&&(ur||ks)&&!this.composing&&!a.selection.empty&&!e.selection.empty&&OO(a.selection,e.selection);if(m){let N=ks?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=uO(this)),(i||!this.docView.update(e.doc,h,u,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=zN(e.doc,h,u,this.dom,this)),N&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(b=!0)}b||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&OL(this))?Li(this,b):(YS(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(a),!((r=this.dragging)===null||r===void 0)&&r.node&&!a.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,a),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():g&&hL(g)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof it){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&RN(this,n.getBoundingClientRect(),e)}else RN(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 uC(e.slice,e.move,a<0?void 0:it.create(this.state.doc,a))}someProp(e,n){let r=this._props&&this._props[e],a;if(r!=null&&(a=n?n(r):r))return a;for(let o=0;on.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return yL(this,e)}coordsAtPos(e,n=1){return HS(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 jL(this,n||this.state,e)}pasteHTML(e,n){return Mu(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Mu(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Cy(this,e)}destroy(){this.docView&&(XL(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],cx(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,tL())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return eO(this,e)}domSelectionRange(){let e=this.domSelection();return e?Rs&&this.root.nodeType===11&&iL(this.dom.ownerDocument)==this.dom&&SO(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}gC.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function aw(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"),[Zn.node(0,t.state.doc.content.size,e)]}function iw(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:Zn.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function ow(t){return!t.someProp("editable",e=>e(t.state)===!1)}function OO(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 lw(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 DO(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 cw(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 zo={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:"'"},Uf={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},_O=typeof navigator<"u"&&/Mac/.test(navigator.platform),$O=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var js=0;js<10;js++)zo[48+js]=zo[96+js]=String(js);for(var js=1;js<=24;js++)zo[js+111]="F"+js;for(var js=65;js<=90;js++)zo[js]=String.fromCharCode(js+32),Uf[js]=String.fromCharCode(js);for(var ux in zo)Uf.hasOwnProperty(ux)||(Uf[ux]=zo[ux]);function zO(t){var e=_O&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||$O&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Uf:zo)[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 FO=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),BO=typeof navigator<"u"&&/Win/.test(navigator.platform);function VO(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)WO(t,n,{get:e[n],enumerable:!0})};function Wp(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 Kp=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:a}=n,i=this.buildProps(a);return Object.fromEntries(Object.entries(t).map(([o,c])=>[o,(...h)=>{const f=c(...h)(i);return!a.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(a),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:a}=this,{view:i}=r,o=[],c=!!t,u=t||a.tr,h=()=>(!c&&e&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(u),o.every(m=>m===!0)),f={...Object.fromEntries(Object.entries(n).map(([m,g])=>[m,(...N)=>{const j=this.buildProps(u,e),v=g(...N)(j);return o.push(v),f}])),run:h};return f}createCan(t){const{rawCommands:e,state:n}=this,r=!1,a=t||n.tr,i=this.buildProps(a,r);return{...Object.fromEntries(Object.entries(e).map(([c,u])=>[c,(...h)=>u(...h)({...i,dispatch:void 0})])),chain:()=>this.createChain(a,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:a}=this,{view:i}=r,o={tr:t,editor:r,view:i,state:Wp({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}},xC={};Ry(xC,{blur:()=>KO,clearContent:()=>qO,clearNodes:()=>GO,command:()=>JO,createParagraphNear:()=>QO,cut:()=>YO,deleteCurrentNode:()=>XO,deleteNode:()=>ZO,deleteRange:()=>eD,deleteSelection:()=>tD,enter:()=>nD,exitCode:()=>sD,extendMarkRange:()=>rD,first:()=>aD,focus:()=>oD,forEach:()=>lD,insertContent:()=>cD,insertContentAt:()=>hD,joinBackward:()=>mD,joinDown:()=>pD,joinForward:()=>gD,joinItemBackward:()=>xD,joinItemForward:()=>yD,joinTextblockBackward:()=>bD,joinTextblockForward:()=>vD,joinUp:()=>fD,keyboardShortcut:()=>wD,lift:()=>jD,liftEmptyBlock:()=>kD,liftListItem:()=>SD,newlineInCode:()=>CD,resetAttributes:()=>ED,scrollIntoView:()=>TD,selectAll:()=>MD,selectNodeBackward:()=>AD,selectNodeForward:()=>ID,selectParentNode:()=>PD,selectTextblockEnd:()=>RD,selectTextblockStart:()=>LD,setContent:()=>OD,setMark:()=>t_,setMeta:()=>n_,setNode:()=>s_,setNodeSelection:()=>r_,setTextDirection:()=>a_,setTextSelection:()=>i_,sinkListItem:()=>o_,splitBlock:()=>l_,splitListItem:()=>c_,toggleList:()=>d_,toggleMark:()=>u_,toggleNode:()=>h_,toggleWrap:()=>f_,undoInputRule:()=>p_,unsetAllMarks:()=>m_,unsetMark:()=>g_,unsetTextDirection:()=>x_,updateAttributes:()=>y_,wrapIn:()=>b_,wrapInList:()=>v_});var KO=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),qO=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),GO=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:a}=r;return n&&a.forEach(({$from:i,$to:o})=>{t.doc.nodesBetween(i.pos,o.pos,(c,u)=>{if(c.type.isText)return;const{doc:h,mapping:f}=e,m=h.resolve(f.map(u)),g=h.resolve(f.map(u+c.nodeSize)),b=m.blockRange(g);if(!b)return;const N=hd(b);if(c.type.isTextblock){const{defaultType:j}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(b.start,j)}(N||N===0)&&e.lift(b,N)})}),!0},JO=t=>e=>t(e),QO=()=>({state:t,dispatch:e})=>PS(t,e),YO=(t,e)=>({editor:n,tr:r})=>{const{state:a}=n,i=a.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new ot(r.doc.resolve(Math.max(o-1,0)))),!0},XO=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const a=t.selection.$anchor;for(let i=a.depth;i>0;i-=1)if(a.node(i).type===r.type){if(e){const c=a.before(i),u=a.after(i);t.delete(c,u).scrollIntoView()}return!0}return!1};function Kn(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var ZO=t=>({tr:e,state:n,dispatch:r})=>{const a=Kn(t,n.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===a){if(r){const u=i.before(o),h=i.after(o);e.delete(u,h).scrollIntoView()}return!0}return!1},eD=t=>({tr:e,dispatch:n})=>{const{from:r,to:a}=t;return n&&e.delete(r,a),!0},tD=()=>({state:t,dispatch:e})=>yy(t,e),nD=()=>({commands:t})=>t.keyboardShortcut("Enter"),sD=()=>({state:t,dispatch:e})=>F6(t,e);function Ly(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Wf(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(a=>n.strict?e[a]===t[a]:Ly(e[a])?e[a].test(t[a]):e[a]===t[a]):!0}function yC(t,e,n={}){return t.find(r=>r.type===e&&Wf(Object.fromEntries(Object.keys(n).map(a=>[a,r.attrs[a]])),n))}function dw(t,e,n={}){return!!yC(t,e,n)}function Oy(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),!yC([...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&&dw([...t.parent.child(o-1).marks],e,n);)o-=1,c-=t.parent.child(o).nodeSize;for(;u({tr:n,state:r,dispatch:a})=>{const i=$i(t,r.schema),{doc:o,selection:c}=n,{$from:u,from:h,to:f}=c;if(a){const m=Oy(u,i,e);if(m&&m.from<=h&&m.to>=f){const g=ot.create(o,m.from,m.to);n.setSelection(g)}}return!0},aD=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=()=>{(Kf()||uw())&&r.dom.focus(),iD()&&!Kf()&&!uw()&&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&&!bC(n.state.selection))return o(),!0;const c=vC(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},lD=(t,e)=>n=>t.every((r,a)=>e(r,{...n,index:a})),cD=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),NC=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&&NC(r)}return t};function ef(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 NC(n)}function Iu(t,e,n){if(t instanceof Pi||t instanceof Ce)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,a=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return Ce.fromArray(t.map(c=>e.nodeFromJSON(c)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),Iu("",e,n)}if(a){if(n.errorOnInvalidContent){let o=!1,c="";const u=new aS({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?Po.fromSchema(u).parseSlice(ef(t),n.parseOptions):Po.fromSchema(u).parse(ef(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const i=Po.fromSchema(e);return n.slice?i.parseSlice(ef(t),n.parseOptions).content:i.parse(ef(t),n.parseOptions)}return Iu("",e,n)}function dD(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 uD=t=>!("type"in t),hD=(t,e,n)=>({tr:r,dispatch:a,editor:i})=>{var o;if(a){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const u=v=>{i.emit("contentError",{editor:i,error:v,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},h={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Iu(e,i.schema,{parseOptions:h,errorOnInvalidContent:!0})}catch(v){u(v)}try{c=Iu(e,i.schema,{parseOptions:h,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(v){return u(v),!1}let{from:f,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,b=!0;if((uD(c)?c:[c]).forEach(v=>{v.check(),g=g?v.isText&&v.marks.length===0:!1,b=b?v.isBlock:!1}),f===m&&b){const{parent:v}=r.doc.resolve(f);v.isTextblock&&!v.type.spec.code&&!v.childCount&&(f-=1,m+=1)}let j;if(g){if(Array.isArray(e))j=e.map(v=>v.text||"").join("");else if(e instanceof Ce){let v="";e.forEach(k=>{k.text&&(v+=k.text)}),j=v}else typeof e=="object"&&e&&e.text?j=e.text:j=e;r.insertText(j,f,m)}else{j=c;const v=r.doc.resolve(f),k=v.node(),T=v.parentOffset===0,C=k.isText||k.isTextblock,R=k.content.size>0;T&&C&&R&&(f=Math.max(0,f-1)),r.replaceWith(f,m,j)}n.updateSelection&&dD(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:f,text:j}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:f,text:j})}return!0},fD=()=>({state:t,dispatch:e})=>_6(t,e),pD=()=>({state:t,dispatch:e})=>$6(t,e),mD=()=>({state:t,dispatch:e})=>SS(t,e),gD=()=>({state:t,dispatch:e})=>MS(t,e),xD=()=>({state:t,dispatch:e,tr:n})=>{try{const r=zp(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},yD=()=>({state:t,dispatch:e,tr:n})=>{try{const r=zp(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},bD=()=>({state:t,dispatch:e})=>O6(t,e),vD=()=>({state:t,dispatch:e})=>D6(t,e);function wC(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function ND(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=ND(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 Fo(t,e,n={}){const{from:r,to:a,empty:i}=t.selection,o=e?Kn(e,t.schema):null,c=[];t.doc.nodesBetween(r,a,(m,g)=>{if(m.isText)return;const b=Math.max(r,g),N=Math.min(a,g+m.nodeSize);c.push({node:m,from:b,to:N})});const u=a-r,h=c.filter(m=>o?o.name===m.node.type.name:!0).filter(m=>Wf(m.node.attrs,n,{strict:!1}));return i?!!h.length:h.reduce((m,g)=>m+g.to-g.from,0)>=u}var jD=(t,e={})=>({state:n,dispatch:r})=>{const a=Kn(t,n.schema);return Fo(n,a,e)?z6(n,r):!1},kD=()=>({state:t,dispatch:e})=>RS(t,e),SD=t=>({state:e,dispatch:n})=>{const r=Kn(t,e.schema);return Y6(r)(e,n)},CD=()=>({state:t,dispatch:e})=>IS(t,e);function qp(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function hw(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 ED=(t,e)=>({tr:n,state:r,dispatch:a})=>{let i=null,o=null;const c=qp(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(i=Kn(t,r.schema)),c==="mark"&&(o=$i(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{r.doc.nodesBetween(h.$from.pos,h.$to.pos,(f,m)=>{i&&i===f.type&&(u=!0,a&&n.setNodeMarkup(m,void 0,hw(f.attrs,e))),o&&f.marks.length&&f.marks.forEach(g=>{o===g.type&&(u=!0,a&&n.addMark(m,m+f.nodeSize,o.create(hw(g.attrs,e))))})})}),u},TD=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),MD=()=>({tr:t,dispatch:e})=>{if(e){const n=new Cr(t.doc);t.setSelection(n)}return!0},AD=()=>({state:t,dispatch:e})=>ES(t,e),ID=()=>({state:t,dispatch:e})=>AS(t,e),PD=()=>({state:t,dispatch:e})=>H6(t,e),RD=()=>({state:t,dispatch:e})=>K6(t,e),LD=()=>({state:t,dispatch:e})=>W6(t,e);function m0(t,e,n={},r={}){return Iu(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var OD=(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=m0(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 jC(t,e){const n=$i(e,t.schema),{from:r,to:a,empty:i}=t.selection,o=[];i?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,a,u=>{o.push(...u.marks)});const c=o.find(u=>u.type.name===n.name);return c?{...c.attrs}:{}}function kC(t,e){const n=new gy(t);return e.forEach(r=>{r.steps.forEach(a=>{n.step(a)})}),n}function DD(t){for(let e=0;e{n(a)&&r.push({node:a,pos:i})}),r}function SC(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 Gp(t){return e=>SC(e.$from,t)}function rt(t,e,n){return t.config[e]===void 0&&t.parent?rt(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?rt(t.parent,e,n):null}):t.config[e]}function Dy(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=rt(e,"addExtensions",n);return r?[e,...Dy(r())]:e}).flat(10)}function _y(t,e){const n=tc.fromSchema(e).serializeFragment(t),a=document.implementation.createHTMLDocument().createElement("div");return a.appendChild(n),a.innerHTML}function CC(t){return typeof t=="function"}function Kt(t,e=void 0,...n){return CC(t)?e?t.bind(e)(...n):t(...n):t}function $D(t={}){return Object.keys(t).length===0&&t.constructor===Object}function nd(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 EC(t){const e=[],{nodeExtensions:n,markExtensions:r}=nd(t),a=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(h=>h.name!=="text").map(h=>h.name),c=r.map(h=>h.name),u=[...o,...c];return t.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage,extensions:a},m=rt(h,"addGlobalAttributes",f);if(!m)return;m().forEach(b=>{let N;Array.isArray(b.types)?N=b.types:b.types==="*"?N=u:b.types==="nodes"?N=o:b.types==="marks"?N=c:N=[],N.forEach(j=>{Object.entries(b.attributes).forEach(([v,k])=>{e.push({type:j,name:v,attribute:{...i,...k}})})})})}),a.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage},m=rt(h,"addAttributes",f);if(!m)return;const g=m();Object.entries(g).forEach(([b,N])=>{const j={...i,...N};typeof(j==null?void 0:j.default)=="function"&&(j.default=j.default()),j!=null&&j.isRequired&&(j==null?void 0:j.default)===void 0&&delete j.default,e.push({type:h.name,name:b,attribute:j})})}),e}function zD(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 fw(t){const e=[],n=zD(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([...fw(r[a]),...fw(i)]);r[a]=Array.from(c.entries()).map(([u,h])=>`${u}: ${h}`).join("; ")}else r[a]=i}),r},{})}function Pu(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)=>Gt(n,r),{})}function FD(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function pw(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):FD(n.getAttribute(o.name));return c==null?i:{...i,[o.name]:c}},{});return{...r,...a}}}}function mw(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&$D(n)?!1:n!=null))}function gw(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 BD(t,e){var n;const r=EC(t),{nodeExtensions:a,markExtensions:i}=nd(t),o=(n=a.find(h=>rt(h,"topNode")))==null?void 0:n.name,c=Object.fromEntries(a.map(h=>{const f=r.filter(k=>k.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((k,T)=>{const C=rt(T,"extendNodeSchema",m);return{...k,...C?C(h):{}}},{}),b=mw({...g,content:Kt(rt(h,"content",m)),marks:Kt(rt(h,"marks",m)),group:Kt(rt(h,"group",m)),inline:Kt(rt(h,"inline",m)),atom:Kt(rt(h,"atom",m)),selectable:Kt(rt(h,"selectable",m)),draggable:Kt(rt(h,"draggable",m)),code:Kt(rt(h,"code",m)),whitespace:Kt(rt(h,"whitespace",m)),linebreakReplacement:Kt(rt(h,"linebreakReplacement",m)),defining:Kt(rt(h,"defining",m)),isolating:Kt(rt(h,"isolating",m)),attrs:Object.fromEntries(f.map(gw))}),N=Kt(rt(h,"parseHTML",m));N&&(b.parseDOM=N.map(k=>pw(k,f)));const j=rt(h,"renderHTML",m);j&&(b.toDOM=k=>j({node:k,HTMLAttributes:Pu(k,f)}));const v=rt(h,"renderText",m);return v&&(b.toText=v),[h.name,b]})),u=Object.fromEntries(i.map(h=>{const f=r.filter(v=>v.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((v,k)=>{const T=rt(k,"extendMarkSchema",m);return{...v,...T?T(h):{}}},{}),b=mw({...g,inclusive:Kt(rt(h,"inclusive",m)),excludes:Kt(rt(h,"excludes",m)),group:Kt(rt(h,"group",m)),spanning:Kt(rt(h,"spanning",m)),code:Kt(rt(h,"code",m)),attrs:Object.fromEntries(f.map(gw))}),N=Kt(rt(h,"parseHTML",m));N&&(b.parseDOM=N.map(v=>pw(v,f)));const j=rt(h,"renderHTML",m);return j&&(b.toDOM=v=>j({mark:v,HTMLAttributes:Pu(v,f)})),[h.name,b]}));return new aS({topNode:o,nodes:c,marks:u})}function VD(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function pu(t){return t.sort((n,r)=>{const a=rt(n,"priority")||100,i=rt(r,"priority")||100;return a>i?-1:ar.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function MC(t,e,n){const{from:r,to:a}=e,{blockSeparator:i=` - -`,textSerializers:o={}}=n||{};let c="";return t.nodesBetween(r,a,(u,h,f,m)=>{var g;u.isBlock&&h>r&&(c+=i);const b=o==null?void 0:o[u.type.name];if(b)return f&&(c+=b({node:u,pos:h,parent:f,index:m,range:e})),!1;u.isText&&(c+=(g=u==null?void 0:u.text)==null?void 0:g.slice(Math.max(r,h)-h,a-h))}),c}function HD(t,e){const n={from:0,to:t.content.size};return MC(t,n,e)}function AC(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function UD(t,e){const n=Kn(e,t.schema),{from:r,to:a}=t.selection,i=[];t.doc.nodesBetween(r,a,c=>{i.push(c)});const o=i.reverse().find(c=>c.type.name===n.name);return o?{...o.attrs}:{}}function IC(t,e){const n=qp(typeof e=="string"?e:e.name,t.schema);return n==="node"?UD(t,e):n==="mark"?jC(t,e):{}}function WD(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 KD(t){const e=WD(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 PC(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((a,i)=>{const o=[];if(a.ranges.length)a.forEach((c,u)=>{o.push({from:c,to:u})});else{const{from:c,to:u}=n[i];if(c===void 0||u===void 0)return;o.push({from:c,to:u})}o.forEach(({from:c,to:u})=>{const h=e.slice(i).map(c,-1),f=e.slice(i).map(u),m=e.invert().map(h,-1),g=e.invert().map(f);r.push({oldRange:{from:m,to:g},newRange:{from:h,to:f}})})}),KD(r)}function $y(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(a=>{const i=n.resolve(t),o=Oy(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 qD=(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 Xd(t,e){return e.nodes[t]||e.marks[t]||null}function bf(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 GD=(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 g0(t,e,n={}){const{empty:r,ranges:a}=t.selection,i=e?$i(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>i?i.name===m.type.name:!0).find(m=>Wf(m.attrs,n,{strict:!1}));let o=0;const c=[];if(a.forEach(({$from:m,$to:g})=>{const b=m.pos,N=g.pos;t.doc.nodesBetween(b,N,(j,v)=>{if(i&&j.inlineContent&&!j.type.allowsMarkType(i))return!1;if(!j.isText&&!j.marks.length)return;const k=Math.max(b,v),T=Math.min(N,v+j.nodeSize),C=T-k;o+=C,c.push(...j.marks.map(R=>({mark:R,from:k,to:T})))})}),o===0)return!1;const u=c.filter(m=>i?i.name===m.mark.type.name:!0).filter(m=>Wf(m.mark.attrs,n,{strict:!1})).reduce((m,g)=>m+g.to-g.from,0),h=c.filter(m=>i?m.mark.type!==i&&m.mark.type.excludes(i):!0).reduce((m,g)=>m+g.to-g.from,0);return(u>0?u+h:u)>=o}function JD(t,e,n={}){if(!e)return Fo(t,null,n)||g0(t,null,n);const r=qp(e,t.schema);return r==="node"?Fo(t,e,n):r==="mark"?g0(t,e,n):!1}var QD=(t,e)=>{const{$from:n,$to:r,$anchor:a}=t.selection;if(e){const i=Gp(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 xw(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function yw(t,e){const{nodeExtensions:n}=nd(e),r=n.find(o=>o.name===t);if(!r)return!1;const a={name:r.name,options:r.options,storage:r.storage},i=Kt(rt(r,"group",a));return typeof i!="string"?!1:i.split(" ").includes("list")}function Jp(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&&(Jp(i,{ignoreWhitespace:n,checkChildren:e})||(a=!1))}),a}return!1}function RC(t){return t instanceof it}var LC=class OC{constructor(e){this.position=e}static fromJSON(e){return new OC(e.position)}toJSON(){return{position:this.position}}};function XD(t,e){const n=e.mapping.mapResult(t.position);return{position:new LC(n.pos),mapResult:n}}function ZD(t){return new LC(t)}function e_(t,e,n){var r;const{selection:a}=e;let i=null;if(bC(a)&&(i=a.$cursor),i){const c=(r=t.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(c)||!c.some(h=>h.type.excludes(n)))}const{ranges:o}=a;return o.some(({$from:c,$to:u})=>{let h=c.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(c.pos,u.pos,(f,m,g)=>{if(h)return!1;if(f.isInline){const b=!g||g.type.allowsMarkType(n),N=!!n.isInSet(f.marks)||!f.marks.some(j=>j.type.excludes(n));h=b&&N}return!h}),h})}var t_=(t,e={})=>({tr:n,state:r,dispatch:a})=>{const{selection:i}=n,{empty:o,ranges:c}=i,u=$i(t,r.schema);if(a)if(o){const h=jC(r,u);n.addStoredMark(u.create({...h,...e}))}else c.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;r.doc.nodesBetween(f,m,(g,b)=>{const N=Math.max(b,f),j=Math.min(b+g.nodeSize,m);g.marks.find(k=>k.type===u)?g.marks.forEach(k=>{u===k.type&&n.addMark(N,j,u.create({...k.attrs,...e}))}):n.addMark(N,j,u.create(e))})});return e_(r,n,u)},n_=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),s_=(t,e={})=>({state:n,dispatch:r,chain:a})=>{const i=Kn(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),i.isTextblock?a().command(({commands:c})=>AN(i,{...o,...e})(n)?!0:c.clearNodes()).command(({state:c})=>AN(i,{...o,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},r_=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,a=Ml(t,0,r.content.size),i=it.create(r,a);e.setSelection(i)}return!0},a_=(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},i_=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:a,to:i}=typeof t=="number"?{from:t,to:t}:t,o=ot.atStart(r).from,c=ot.atEnd(r).to,u=Ml(a,o,c),h=Ml(i,o,c),f=ot.create(r,u,h);e.setSelection(f)}return!0},o_=t=>({state:e,dispatch:n})=>{const r=Kn(t,e.schema);return eL(r)(e,n)};function bw(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 l_=({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=bf(h,c.node().type.name,c.node().attrs);if(i instanceof it&&i.node.isBlock)return!c.parentOffset||!Ri(o,c.pos)?!1:(r&&(t&&bw(n,a.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const m=u.parentOffset===u.parent.content.size,g=c.depth===0?void 0:DD(c.node(-1).contentMatchAt(c.indexAfter(-1)));let b=m&&g?[{type:g,attrs:f}]:void 0,N=Ri(e.doc,e.mapping.map(c.pos),1,b);if(!b&&!N&&Ri(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(N=!0,b=g?[{type:g,attrs:f}]:void 0),r){if(N&&(i instanceof ot&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,b),g&&!m&&!c.parentOffset&&c.parent.type!==g)){const j=e.mapping.map(c.before()),v=e.doc.resolve(j);c.node(-1).canReplaceWith(v.index(),v.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}t&&bw(n,a.extensionManager.splittableMarks),e.scrollIntoView()}return N},c_=(t,e={})=>({tr:n,state:r,dispatch:a,editor:i})=>{var o;const c=Kn(t,r.schema),{$from:u,$to:h}=r.selection,f=r.selection.node;if(f&&f.isBlock||u.depth<2||!u.sameParent(h))return!1;const m=u.node(-1);if(m.type!==c)return!1;const g=i.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==c||u.index(-2)!==u.node(-2).childCount-1)return!1;if(a){let k=Ce.empty;const T=u.index(-1)?1:u.index(-2)?2:3;for(let z=u.depth-T;z>=u.depth-3;z-=1)k=Ce.from(u.node(z).copy(k));const C=u.indexAfter(-1){if(P>-1)return!1;z.isTextblock&&z.content.size===0&&(P=L+1)}),P>-1&&n.setSelection(ot.near(n.doc.resolve(P))),n.scrollIntoView()}return!0}const b=h.pos===u.end()?m.contentMatchAt(0).defaultType:null,N={...bf(g,m.type.name,m.attrs),...e},j={...bf(g,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,h.pos);const v=b?[{type:c,attrs:N},{type:b,attrs:j}]:[{type:c,attrs:N}];if(!Ri(n.doc,u.pos,2))return!1;if(a){const{selection:k,storedMarks:T}=r,{splittableMarks:C}=i.extensionManager,R=T||k.$to.parentOffset&&k.$from.marks();if(n.split(u.pos,2,v).scrollIntoView(),!R||!a)return!0;const O=R.filter(U=>C.includes(U.type.name));n.ensureMarks(O)}return!0},fx=(t,e)=>{const n=Gp(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)&&Ko(t.doc,n.pos)&&t.join(n.pos),!0},px=(t,e)=>{const n=Gp(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)&&Ko(t.doc,r)&&t.join(r),!0},d_=(t,e,n,r={})=>({editor:a,tr:i,state:o,dispatch:c,chain:u,commands:h,can:f})=>{const{extensions:m,splittableMarks:g}=a.extensionManager,b=Kn(t,o.schema),N=Kn(e,o.schema),{selection:j,storedMarks:v}=o,{$from:k,$to:T}=j,C=k.blockRange(T),R=v||j.$to.parentOffset&&j.$from.marks();if(!C)return!1;const O=Gp(U=>yw(U.type.name,m))(j);if(C.depth>=1&&O&&C.depth-O.depth<=1){if(O.node.type===b)return h.liftListItem(N);if(yw(O.node.type.name,m)&&b.validContent(O.node.content)&&c)return u().command(()=>(i.setNodeMarkup(O.pos,b),!0)).command(()=>fx(i,b)).command(()=>px(i,b)).run()}return!n||!R||!c?u().command(()=>f().wrapInList(b,r)?!0:h.clearNodes()).wrapInList(b,r).command(()=>fx(i,b)).command(()=>px(i,b)).run():u().command(()=>{const U=f().wrapInList(b,r),P=R.filter(z=>g.includes(z.type.name));return i.ensureMarks(P),U?!0:h.clearNodes()}).wrapInList(b,r).command(()=>fx(i,b)).command(()=>px(i,b)).run()},u_=(t,e={},n={})=>({state:r,commands:a})=>{const{extendEmptyMarkRange:i=!1}=n,o=$i(t,r.schema);return g0(r,o,e)?a.unsetMark(o,{extendEmptyMarkRange:i}):a.setMark(o,e)},h_=(t,e,n={})=>({state:r,commands:a})=>{const i=Kn(t,r.schema),o=Kn(e,r.schema),c=Fo(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})},f_=(t,e={})=>({state:n,commands:r})=>{const a=Kn(t,n.schema);return Fo(n,a,e)?r.lift(a):r.wrapIn(a,e)},p_=()=>({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},m_=()=>({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},g_=(t,e={})=>({tr:n,state:r,dispatch:a})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:c}=n,u=$i(t,r.schema),{$from:h,empty:f,ranges:m}=c;if(!a)return!0;if(f&&o){let{from:g,to:b}=c;const N=(i=h.marks().find(v=>v.type===u))==null?void 0:i.attrs,j=Oy(h,u,N);j&&(g=j.from,b=j.to),n.removeMark(g,b,u)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,u)});return n.removeStoredMark(u),!0},x_=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},y_=(t,e={})=>({tr:n,state:r,dispatch:a})=>{let i=null,o=null;const c=qp(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(i=Kn(t,r.schema)),c==="mark"&&(o=$i(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;let g,b,N,j;n.selection.empty?r.doc.nodesBetween(f,m,(v,k)=>{i&&i===v.type&&(u=!0,N=Math.max(k,f),j=Math.min(k+v.nodeSize,m),g=k,b=v)}):r.doc.nodesBetween(f,m,(v,k)=>{k=f&&k<=m&&(i&&i===v.type&&(u=!0,a&&n.setNodeMarkup(k,void 0,{...v.attrs,...e})),o&&v.marks.length&&v.marks.forEach(T=>{if(o===T.type&&(u=!0,a)){const C=Math.max(k,f),R=Math.min(k+v.nodeSize,m);n.addMark(C,R,o.create({...T.attrs,...e}))}}))}),b&&(g!==void 0&&a&&n.setNodeMarkup(g,void 0,{...b.attrs,...e}),o&&b.marks.length&&b.marks.forEach(v=>{o===v.type&&a&&n.addMark(N,j,o.create({...v.attrs,...e}))}))}),u},b_=(t,e={})=>({state:n,dispatch:r})=>{const a=Kn(t,n.schema);return q6(a,e)(n,r)},v_=(t,e={})=>({state:n,dispatch:r})=>{const a=Kn(t,n.schema);return G6(a,e)(n,r)},N_=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={}}},Qp=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},w_=(t,e)=>{if(Ly(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 tf(t){var e;const{editor:n,from:r,to:a,text:i,rules:o,plugin:c}=t,{view:u}=n;if(u.composing)return!1;const h=u.state.doc.resolve(r);if(h.parent.type.spec.code||(e=h.nodeBefore||h.nodeAfter)!=null&&e.marks.find(g=>g.type.spec.code))return!1;let f=!1;const m=GD(h)+i;return o.forEach(g=>{if(f)return;const b=w_(m,g.find);if(!b)return;const N=u.state.tr,j=Wp({state:u.state,transaction:N}),v={from:r-(b[0].length-i.length),to:a},{commands:k,chain:T,can:C}=new Kp({editor:n,state:j});g.handler({state:j,range:v,match:b,commands:k,chain:T,can:C})===null||!N.steps.length||(g.undoable&&N.setMeta(c,{transform:N,from:r,to:a,text:i}),u.dispatch(N),f=!0)}),f}function j_(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=_y(Ce.from(f),o.schema);const{from:m}=u,g=m+f.length;tf({editor:e,from:m,to:g,text:f,rules:n,plugin:r})}),a.selectionSet||a.docChanged?null:i}},props:{handleTextInput(a,i,o,c){return tf({editor:e,from:i,to:o,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:a=>(setTimeout(()=>{const{$cursor:i}=a.state.selection;i&&tf({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?tf({editor:e,from:o.pos,to:o.pos,text:` -`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function k_(t){return Object.prototype.toString.call(t).slice(8,-1)}function nf(t){return k_(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function DC(t,e){const n={...t};return nf(t)&&nf(e)&&Object.keys(e).forEach(r=>{nf(e[r])&&nf(t[r])?n[r]=DC(t[r],e[r]):n[r]=e[r]}),n}var zy=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...Kt(rt(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Kt(rt(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>DC(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}},nc=class _C extends zy{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new _C(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 S_(t){return typeof t=="number"}var C_=class{constructor(t){this.find=t.find,this.handler=t.handler}},E_=(t,e,n)=>{if(Ly(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 T_(t){const{editor:e,state:n,from:r,to:a,rule:i,pasteEvent:o,dropEvent:c}=t,{commands:u,chain:h,can:f}=new Kp({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,a,(b,N)=>{var j,v,k,T,C;if((v=(j=b.type)==null?void 0:j.spec)!=null&&v.code||!(b.isText||b.isTextblock||b.isInline))return;const R=(C=(T=(k=b.content)==null?void 0:k.size)!=null?T:b.nodeSize)!=null?C:0,O=Math.max(r,N),U=Math.min(a,N+R);if(O>=U)return;const P=b.isText?b.text||"":b.textBetween(O-N,U-N,void 0,"");E_(P,i.find,o).forEach(L=>{if(L.index===void 0)return;const Q=O+L.index+1,se=Q+L[0].length,$={from:n.tr.mapping.map(Q),to:n.tr.mapping.map(se)},ie=i.handler({state:n,range:$,match:L,commands:u,chain:h,can:f,pasteEvent:o,dropEvent:c});m.push(ie)})}),m.every(b=>b!==null)}var sf=null,M_=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function A_(t){const{editor:e,rules:n}=t;let r=null,a=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const u=({state:f,from:m,to:g,rule:b,pasteEvt:N})=>{const j=f.tr,v=Wp({state:f,transaction:j});if(!(!T_({editor:e,state:v,from:Math.max(m-1,0),to:g.b-1,rule:b,pasteEvent:N,dropEvent:c})||!j.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,j}};return n.map(f=>new un({view(m){const g=N=>{var j;r=(j=m.dom.parentElement)!=null&&j.contains(N.target)?m.dom.parentElement:null,r&&(sf=e)},b=()=>{sf&&(sf=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",b),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",b)}}},props:{handleDOMEvents:{drop:(m,g)=>{if(i=r===m.dom.parentElement,c=g,!i){const b=sf;b!=null&&b.isEditable&&setTimeout(()=>{const N=b.state.selection;N&&b.commands.deleteRange({from:N.from,to:N.to})},10)}return!1},paste:(m,g)=>{var b;const N=(b=g.clipboardData)==null?void 0:b.getData("text/html");return o=g,a=!!(N!=null&&N.includes("data-pm-slice")),!1}}},appendTransaction:(m,g,b)=>{const N=m[0],j=N.getMeta("uiEvent")==="paste"&&!a,v=N.getMeta("uiEvent")==="drop"&&!i,k=N.getMeta("applyPasteRules"),T=!!k;if(!j&&!v&&!T)return;if(T){let{text:O}=k;typeof O=="string"?O=O:O=_y(Ce.from(O),b.schema);const{from:U}=k,P=U+O.length,z=M_(O);return u({rule:f,state:b,from:U,to:{b:P},pasteEvt:z})}const C=g.doc.content.findDiffStart(b.doc.content),R=g.doc.content.findDiffEnd(b.doc.content);if(!(!S_(C)||!R||C===R.b))return u({rule:f,state:b,from:C,to:R,pasteEvt:o})}}))}var Yp=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=TC(t),this.schema=BD(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:Xd(e.name,this.schema)},r=rt(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return pu([...this.extensions].reverse()).flatMap(r=>{const a={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Xd(r.name,this.schema)},i=[],o=rt(r,"addKeyboardShortcuts",a);let c={};if(r.type==="mark"&&rt(r,"exitable",a)&&(c.ArrowRight=()=>nc.handleExit({editor:t,mark:r})),o){const g=Object.fromEntries(Object.entries(o()).map(([b,N])=>[b,()=>N({editor:t})]));c={...c,...g}}const u=UO(c);i.push(u);const h=rt(r,"addInputRules",a);if(xw(r,t.options.enableInputRules)&&h){const g=h();if(g&&g.length){const b=j_({editor:t,rules:g}),N=Array.isArray(b)?b:[b];i.push(...N)}}const f=rt(r,"addPasteRules",a);if(xw(r,t.options.enablePasteRules)&&f){const g=f();if(g&&g.length){const b=A_({editor:t,rules:g});i.push(...b)}}const m=rt(r,"addProseMirrorPlugins",a);if(m){const g=m();i.push(...g)}return i})}get attributes(){return EC(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=nd(this.extensions);return Object.fromEntries(e.filter(n=>!!rt(n,"addNodeView")).map(n=>{const r=this.attributes.filter(u=>u.type===n.name),a={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Kn(n.name,this.schema)},i=rt(n,"addNodeView",a);if(!i)return[];const o=i();if(!o)return[];const c=(u,h,f,m,g)=>{const b=Pu(u,r);return o({node:u,view:h,getPos:f,decorations:m,innerDecorations:g,editor:t,extension:n,HTMLAttributes:b})};return[n.name,c]}))}dispatchTransaction(t){const{editor:e}=this;return pu([...this.extensions].reverse()).reduceRight((r,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:Xd(a.name,this.schema)},o=rt(a,"dispatchTransaction",i);return o?c=>{o.call(i,{transaction:c,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return pu([...this.extensions]).reduce((r,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:Xd(a.name,this.schema)},o=rt(a,"transformPastedHTML",i);return o?(c,u)=>{const h=r(c,u);return o.call(i,h)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=nd(this.extensions);return Object.fromEntries(e.filter(n=>!!rt(n,"addMarkView")).map(n=>{const r=this.attributes.filter(c=>c.type===n.name),a={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:$i(n.name,this.schema)},i=rt(n,"addMarkView",a);if(!i)return[];const o=(c,u,h)=>{const f=Pu(c,r);return i()({mark:c,view:u,inline:h,editor:t,extension:n,HTMLAttributes:f,updateAttributes:m=>{W_(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:Xd(e.name,this.schema)};e.type==="mark"&&((n=Kt(rt(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const a=rt(e,"onBeforeCreate",r),i=rt(e,"onCreate",r),o=rt(e,"onUpdate",r),c=rt(e,"onSelectionUpdate",r),u=rt(e,"onTransaction",r),h=rt(e,"onFocus",r),f=rt(e,"onBlur",r),m=rt(e,"onDestroy",r);a&&this.editor.on("beforeCreate",a),i&&this.editor.on("create",i),o&&this.editor.on("update",o),c&&this.editor.on("selectionUpdate",c),u&&this.editor.on("transaction",u),h&&this.editor.on("focus",h),f&&this.editor.on("blur",f),m&&this.editor.on("destroy",m)})}};Yp.resolve=TC;Yp.sort=pu;Yp.flatten=Dy;var I_={};Ry(I_,{ClipboardTextSerializer:()=>zC,Commands:()=>FC,Delete:()=>BC,Drop:()=>VC,Editable:()=>HC,FocusEvents:()=>WC,Keymap:()=>KC,Paste:()=>qC,Tabindex:()=>GC,TextDirection:()=>JC,focusEventsPluginKey:()=>UC});var Ln=class $C extends zy{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new $C(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},zC=Ln.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new un({key:new vn("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:a}=e,{ranges:i}=a,o=Math.min(...i.map(f=>f.$from.pos)),c=Math.max(...i.map(f=>f.$to.pos)),u=AC(n);return MC(r,{from:o,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),FC=Ln.create({name:"commands",addCommands(){return{...xC}}}),BC=Ln.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,a;const i=()=>{var o,c,u,h;if((h=(u=(c=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:c.filterTransaction)==null?void 0:u.call(c,t))!=null?h:t.getMeta("y-sync$"))return;const f=kC(t.before,[t,...e]);PC(f).forEach(b=>{f.mapping.mapResult(b.oldRange.from).deletedAfter&&f.mapping.mapResult(b.oldRange.to).deletedBefore&&f.before.nodesBetween(b.oldRange.from,b.oldRange.to,(N,j)=>{const v=j+N.nodeSize-2,k=b.oldRange.from<=j&&v<=b.oldRange.to;this.editor.emit("delete",{type:"node",node:N,from:j,to:v,newFrom:f.mapping.map(j),newTo:f.mapping.map(v),deletedRange:b.oldRange,newRange:b.newRange,partial:!k,editor:this.editor,transaction:t,combinedTransform:f})})});const g=f.mapping;f.steps.forEach((b,N)=>{var j,v;if(b instanceof fa){const k=g.slice(N).map(b.from,-1),T=g.slice(N).map(b.to),C=g.invert().map(k,-1),R=g.invert().map(T),O=(j=f.doc.nodeAt(k-1))==null?void 0:j.marks.some(P=>P.eq(b.mark)),U=(v=f.doc.nodeAt(T))==null?void 0:v.marks.some(P=>P.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:T},partial:!!(U||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()}}),VC=Ln.create({name:"drop",addProseMirrorPlugins(){return[new un({key:new vn("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),HC=Ln.create({name:"editable",addProseMirrorPlugins(){return[new un({key:new vn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),UC=new vn("focusEvents"),WC=Ln.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new un({key:UC,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}}}})]}}),KC=Ln.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:c})=>{const{selection:u,doc:h}=c,{empty:f,$anchor:m}=u,{pos:g,parent:b}=m,N=m.parent.isTextblock&&g>0?c.doc.resolve(g-1):m,j=N.parent.type.spec.isolating,v=m.pos-m.parentOffset,k=j&&N.parent.childCount===1?v===m.pos:ft.atStart(h).from===g;return!f||!b.type.isTextblock||b.textContent.length||!k||k&&m.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},a={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Kf()||wC()?i:a},addProseMirrorPlugins(){return[new un({key:new vn("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(j=>j.getMeta("composition")))return;const r=t.some(j=>j.docChanged)&&!e.doc.eq(n.doc),a=t.some(j=>j.getMeta("preventClearDocument"));if(!r||a)return;const{empty:i,from:o,to:c}=e.selection,u=ft.atStart(e.doc).from,h=ft.atEnd(e.doc).to;if(i||!(o===u&&c===h)||!Jp(n.doc))return;const g=n.tr,b=Wp({state:n,transaction:g}),{commands:N}=new Kp({editor:this.editor,state:b});if(N.clearNodes(),!!g.steps.length)return g}})]}}),qC=Ln.create({name:"paste",addProseMirrorPlugins(){return[new un({key:new vn("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),GC=Ln.create({name:"tabindex",addProseMirrorPlugins(){return[new un({key:new vn("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),JC=Ln.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=nd(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 vn("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),P_=class ru{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 ru(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 ru(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 ru(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 ru(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)}},R_=`.ProseMirror { ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - 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; -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js -}`;function D_(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 __=class extends j_{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:e_,createMappablePosition:t_},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=wC(e,this.options.autofocus);this.editorState=Uc.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=D_(O_,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=TC(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?[WC,BC.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),VC,qC,GC,QC,UC,JC,HC,YC.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 Xp(r,this)}createCommandManager(){this.commandManager=new qp({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=g0(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=g0(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 yC(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 RC(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return YD(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return zy(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=` - -`,textSerializers:n={}}=t||{};return WD(this.state.doc,{blockSeparator:e,textSerializers:{...IC(this.schema),...n}})}get isEmpty(){return Qp(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 L_(e,this)}get $doc(){return this.$pos(0)}};function rd(t){return new Yp({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(Fy(n.from,n.to,e.doc).filter(b=>b.mark.type.excluded.find(j=>j===t.type&&j!==b.mark.type)).filter(b=>b.to>h).length)return null;fn.from&&i.delete(n.from+u,h);const g=n.from+u+o.length;i.addMark(n.from+u,g,t.type.create(a||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function XC(t){return new Yp({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 y0(t){return new Yp({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 ad(t){return new Yp({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&&xy(u,t.type,i);if(!h)return null;if(o.wrap(u,h),t.keepMarks&&t.editor){const{selection:m,storedMarks:g}=e,{splittableMarks:b}=t.editor.extensionManager,N=g||m.$to.parentOffset&&m.$from.marks();if(N){const j=N.filter(v=>b.includes(v.type.name));o.ensureMarks(j)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";a().updateAttributes(m,i).run()}const f=o.doc.resolve(n.from-1).nodeBefore;f&&f.type===t.type&&qo(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,f))&&o.join(n.from-1)},undoable:t.undoable})}var $_=t=>"touches"in t,z_=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,$_(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 F_(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof it){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let a=r.depth;for(;a>=0;){const i=r.index(a);if(r.node(a).contentMatchAt(i).matchType(e))return!0;a-=1}return!1}function B_(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var V_={};Oy(V_,{createAtomBlockMarkdownSpec:()=>H_,createBlockMarkdownSpec:()=>U_,createInlineMarkdownSpec:()=>ZC,parseAttributes:()=>Vy,parseIndentedBlocks:()=>b0,renderNestedMarkdownContent:()=>Uy,serializeAttributes:()=>Hy});function Vy(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,h=>(n.push(h),`__QUOTED_${n.length-1}__`)),a=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(a){const h=a.map(f=>f.trim().slice(1));e.class=h.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,h,f])=>{var m;const g=parseInt(((m=f.match(/__QUOTED_(\d+)__/))==null?void 0:m[1])||"0",10),b=n[g];b&&(e[h]=b.slice(1,-1))});const u=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return u&&u.split(/\s+/).filter(Boolean).forEach(f=>{f.match(/^[a-zA-Z][\w-]*$/)&&(e[f]=!0)}),e}function Hy(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 H_(t){const{nodeName:e,name:n,parseAttributes:r=Vy,serializeAttributes:a=Hy,defaultAttributes:i={},requiredAttributes:o=[],allowedAttributes:c}=t,u=n||e,h=f=>{if(!c)return f;const m={};return c.forEach(g=>{g in f&&(m[g]=f[g])}),m};return{parseMarkdown:(f,m)=>{const g={...i,...f.attributes};return m.createNode(e,g,[])},markdownTokenizer:{name:e,level:"block",start(f){var m;const g=new RegExp(`^:::${u}(?:\\s|$)`,"m"),b=(m=f.match(g))==null?void 0:m.index;return b!==void 0?b:-1},tokenize(f,m,g){const b=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),N=f.match(b);if(!N)return;const j=N[1]||"",v=r(j);if(!o.find(T=>!(T in v)))return{type:e,raw:N[0],attributes:v}}},renderMarkdown:f=>{const m=h(f.attrs||{}),g=a(m),b=g?` {${g}}`:"";return`:::${u}${b} :::`}}}function U_(t){const{nodeName:e,name:n,getContent:r,parseAttributes:a=Vy,serializeAttributes:i=Hy,defaultAttributes:o={},content:c="block",allowedAttributes:u}=t,h=n||e,f=m=>{if(!u)return m;const g={};return u.forEach(b=>{b in m&&(g[b]=m[b])}),g};return{parseMarkdown:(m,g)=>{let b;if(r){const j=r(m);b=typeof j=="string"?[{type:"text",text:j}]:j}else c==="block"?b=g.parseChildren(m.tokens||[]):b=g.parseInline(m.tokens||[]);const N={...o,...m.attributes};return g.createNode(e,N,b)},markdownTokenizer:{name:e,level:"block",start(m){var g;const b=new RegExp(`^:::${h}`,"m"),N=(g=m.match(b))==null?void 0:g.index;return N!==void 0?N:-1},tokenize(m,g,b){var N;const j=new RegExp(`^:::${h}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),v=m.match(j);if(!v)return;const[k,T=""]=v,C=a(T);let R=1;const O=k.length;let U="";const I=/^:::([\w-]*)(\s.*)?/gm,z=m.slice(O);for(I.lastIndex=0;;){const L=I.exec(z);if(L===null)break;const Q=L.index,se=L[1];if(!((N=L[2])!=null&&N.endsWith(":::"))){if(se)R+=1;else if(R-=1,R===0){const $=z.slice(0,Q);U=$.trim();const ie=m.slice(0,O+Q+L[0].length);let le=[];if(U)if(c==="block")for(le=b.blockTokens($),le.forEach(me=>{me.text&&(!me.tokens||me.tokens.length===0)&&(me.tokens=b.inlineTokens(me.text))});le.length>0;){const me=le[le.length-1];if(me.type==="paragraph"&&(!me.text||me.text.trim()===""))le.pop();else break}else le=b.inlineTokens(U);return{type:e,raw:ie,attributes:C,content:U,tokens:le}}}}}},renderMarkdown:(m,g)=>{const b=f(m.attrs||{}),N=i(b),j=N?` {${N}}`:"",v=g.renderChildren(m.content||[],` -======== -}`;function L_(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 O_=class extends N_{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:XD,createMappablePosition:ZD},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=vC(e,this.options.autofocus);this.editorState=Hc.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=L_(R_,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?[HC,zC.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),FC,WC,KC,GC,VC,qC,BC,JC.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 Yp(r,this)}createCommandManager(){this.commandManager=new Kp({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=m0(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=m0(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 gC(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 IC(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return JD(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return _y(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=` - -`,textSerializers:n={}}=t||{};return HD(this.state.doc,{blockSeparator:e,textSerializers:{...AC(this.schema),...n}})}get isEmpty(){return Jp(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 sd(t){return new Qp({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($y(n.from,n.to,e.doc).filter(b=>b.mark.type.excluded.find(j=>j===t.type&&j!==b.mark.type)).filter(b=>b.to>h).length)return null;fn.from&&i.delete(n.from+u,h);const g=n.from+u+o.length;i.addMark(n.from+u,g,t.type.create(a||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function QC(t){return new Qp({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 x0(t){return new Qp({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 rd(t){return new Qp({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&&my(u,t.type,i);if(!h)return null;if(o.wrap(u,h),t.keepMarks&&t.editor){const{selection:m,storedMarks:g}=e,{splittableMarks:b}=t.editor.extensionManager,N=g||m.$to.parentOffset&&m.$from.marks();if(N){const j=N.filter(v=>b.includes(v.type.name));o.ensureMarks(j)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";a().updateAttributes(m,i).run()}const f=o.doc.resolve(n.from-1).nodeBefore;f&&f.type===t.type&&Ko(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,f))&&o.join(n.from-1)},undoable:t.undoable})}var D_=t=>"touches"in t,__=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,D_(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 $_(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof it){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let a=r.depth;for(;a>=0;){const i=r.index(a);if(r.node(a).contentMatchAt(i).matchType(e))return!0;a-=1}return!1}function z_(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var F_={};Ry(F_,{createAtomBlockMarkdownSpec:()=>B_,createBlockMarkdownSpec:()=>V_,createInlineMarkdownSpec:()=>YC,parseAttributes:()=>Fy,parseIndentedBlocks:()=>y0,renderNestedMarkdownContent:()=>Vy,serializeAttributes:()=>By});function Fy(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,h=>(n.push(h),`__QUOTED_${n.length-1}__`)),a=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(a){const h=a.map(f=>f.trim().slice(1));e.class=h.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,h,f])=>{var m;const g=parseInt(((m=f.match(/__QUOTED_(\d+)__/))==null?void 0:m[1])||"0",10),b=n[g];b&&(e[h]=b.slice(1,-1))});const u=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return u&&u.split(/\s+/).filter(Boolean).forEach(f=>{f.match(/^[a-zA-Z][\w-]*$/)&&(e[f]=!0)}),e}function By(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 B_(t){const{nodeName:e,name:n,parseAttributes:r=Fy,serializeAttributes:a=By,defaultAttributes:i={},requiredAttributes:o=[],allowedAttributes:c}=t,u=n||e,h=f=>{if(!c)return f;const m={};return c.forEach(g=>{g in f&&(m[g]=f[g])}),m};return{parseMarkdown:(f,m)=>{const g={...i,...f.attributes};return m.createNode(e,g,[])},markdownTokenizer:{name:e,level:"block",start(f){var m;const g=new RegExp(`^:::${u}(?:\\s|$)`,"m"),b=(m=f.match(g))==null?void 0:m.index;return b!==void 0?b:-1},tokenize(f,m,g){const b=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),N=f.match(b);if(!N)return;const j=N[1]||"",v=r(j);if(!o.find(T=>!(T in v)))return{type:e,raw:N[0],attributes:v}}},renderMarkdown:f=>{const m=h(f.attrs||{}),g=a(m),b=g?` {${g}}`:"";return`:::${u}${b} :::`}}}function V_(t){const{nodeName:e,name:n,getContent:r,parseAttributes:a=Fy,serializeAttributes:i=By,defaultAttributes:o={},content:c="block",allowedAttributes:u}=t,h=n||e,f=m=>{if(!u)return m;const g={};return u.forEach(b=>{b in m&&(g[b]=m[b])}),g};return{parseMarkdown:(m,g)=>{let b;if(r){const j=r(m);b=typeof j=="string"?[{type:"text",text:j}]:j}else c==="block"?b=g.parseChildren(m.tokens||[]):b=g.parseInline(m.tokens||[]);const N={...o,...m.attributes};return g.createNode(e,N,b)},markdownTokenizer:{name:e,level:"block",start(m){var g;const b=new RegExp(`^:::${h}`,"m"),N=(g=m.match(b))==null?void 0:g.index;return N!==void 0?N:-1},tokenize(m,g,b){var N;const j=new RegExp(`^:::${h}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),v=m.match(j);if(!v)return;const[k,T=""]=v,C=a(T);let R=1;const O=k.length;let U="";const P=/^:::([\w-]*)(\s.*)?/gm,z=m.slice(O);for(P.lastIndex=0;;){const L=P.exec(z);if(L===null)break;const Q=L.index,se=L[1];if(!((N=L[2])!=null&&N.endsWith(":::"))){if(se)R+=1;else if(R-=1,R===0){const $=z.slice(0,Q);U=$.trim();const ie=m.slice(0,O+Q+L[0].length);let le=[];if(U)if(c==="block")for(le=b.blockTokens($),le.forEach(me=>{me.text&&(!me.tokens||me.tokens.length===0)&&(me.tokens=b.inlineTokens(me.text))});le.length>0;){const me=le[le.length-1];if(me.type==="paragraph"&&(!me.text||me.text.trim()===""))le.pop();else break}else le=b.inlineTokens(U);return{type:e,raw:ie,attributes:C,content:U,tokens:le}}}}}},renderMarkdown:(m,g)=>{const b=f(m.attrs||{}),N=i(b),j=N?` {${N}}`:"",v=g.renderChildren(m.content||[],` ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - -`);return`:::${h}${j} - -${v} - -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js -:::`}}}function W_(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 K_(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function ZC(t){const{nodeName:e,name:n,getContent:r,parseAttributes:a=W_,serializeAttributes:i=K_,defaultAttributes:o={},selfClosing:c=!1,allowedAttributes:u}=t,h=n||e,f=g=>{if(!u)return g;const b={};return u.forEach(N=>{const j=typeof N=="string"?N:N.name,v=typeof N=="string"?void 0:N.skipIfDefault;if(j in g){const k=g[j];if(v!==void 0&&k===v)return;b[j]=k}}),b},m=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(g,b)=>{const N={...o,...g.attributes};if(c)return b.createNode(e,N);const j=r?r(g):g.content||"";return j?b.createNode(e,N,[b.createTextNode(j)]):b.createNode(e,N,[])},markdownTokenizer:{name:e,level:"inline",start(g){const b=c?new RegExp(`\\[${m}\\s*[^\\]]*\\]`):new RegExp(`\\[${m}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${m}\\]`),N=g.match(b),j=N==null?void 0:N.index;return j!==void 0?j:-1},tokenize(g,b,N){const j=c?new RegExp(`^\\[${m}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${m}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${m}\\]`),v=g.match(j);if(!v)return;let k="",T="";if(c){const[,R]=v;T=R}else{const[,R,O]=v;T=R,k=O||""}const C=a(T.trim());return{type:e,raw:v[0],content:k.trim(),attributes:C}}},renderMarkdown:g=>{let b="";r?b=r(g):g.content&&g.content.length>0&&(b=g.content.filter(k=>k.type==="text").map(k=>k.text).join(""));const N=f(g.attrs||{}),j=i(N),v=j?` ${j}`:"";return c?`[${h}${v}]`:`[${h}${v}]${b}[/${h}]`}}}function b0(t,e,n){var r,a,i,o;const c=t.split(` -`),u=[];let h="",f=0;const m=e.baseIndentSize||2;for(;f0)break;if(g.trim()===""){f+=1,h=`${h}${g} -`;continue}else return}const N=e.extractItemData(b),{indentLevel:j,mainContent:v}=N;h=`${h}${g} -`;const k=[v];for(f+=1;fQ.trim()!=="");if(I===-1)break;if((((a=(r=c[f+1+I].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:a.length)||0)>j){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)>j)k.push(O),h=`${h}${O} -`,f+=1;else break}let T;const C=k.slice(1);if(C.length>0){const O=C.map(U=>U.slice(j+m)).join(` -`);O.trim()&&(e.customNestedParser?T=e.customNestedParser(O):T=n.blockTokens(O))}const R=e.createToken(N,T);u.push(R)}if(u.length!==0)return{items:u,raw:h}}function Uy(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const a=typeof n=="function"?n(r):n,[i,...o]=t.content,c=e.renderChildren([i]),u=[`${a}${c}`];return o&&o.length>0&&o.forEach(h=>{const f=e.renderChildren([h]);if(f){const m=f.split(` -`).map(g=>g?e.indent(g):"").join(` -`);u.push(m)}}),u.join(` -`)}function q_(t,e,n={}){const{state:r}=e,{doc:a,tr:i}=r,o=t;a.descendants((c,u)=>{const h=i.mapping.map(u),f=i.mapping.map(u)+c.nodeSize;let m=null;if(c.marks.forEach(b=>{if(b!==o)return!1;m=b}),!m)return;let g=!1;if(Object.keys(n).forEach(b=>{n[b]!==m.attrs[b]&&(g=!0)}),g){const b=t.type.create({...t.attrs,...n});i.removeMark(h,f,t.type),i.addMark(h,f,b)}}),i.docChanged&&e.view.dispatch(i)}var Vn=class e3 extends By{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new e3(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Jl(t){return new T_({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:a})=>{const i=Kt(t.getAttributes,void 0,r,a);if(i===!1||i===null)return null;const{tr:o}=e,c=r[r.length-1],u=r[0];let h=n.to;if(c){const f=u.search(/\S/),m=n.from+u.indexOf(c),g=m+c.length;if(Fy(n.from,n.to,e.doc).filter(N=>N.mark.type.excluded.find(v=>v===t.type&&v!==N.mark.type)).filter(N=>N.to>m).length)return null;gn.from&&o.delete(n.from+f,m),h=n.from+f+c.length,o.addMark(n.from+f,h,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:G_,getOwnPropertySymbols:J_}=Object,{hasOwnProperty:Q_}=Object.prototype;function gx(t,e){return function(r,a,i){return t(r,a,i)&&e(r,a,i)}}function af(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 Y_(t){return t!=null?t[Symbol.toStringTag]:void 0}function ww(t){return G_(t).concat(J_(t))}const X_=Object.hasOwn||((t,e)=>Q_.call(t,e));function rc(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const Z_="__v",e7="__o",t7="_owner",{getOwnPropertyDescriptor:jw,keys:kw}=Object;function n7(t,e){return t.byteLength===e.byteLength&&Gf(new Uint8Array(t),new Uint8Array(e))}function s7(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 r7(t,e){return t.byteLength===e.byteLength&&Gf(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function a7(t,e){return rc(t.getTime(),e.getTime())}function i7(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function o7(t,e){return t===e}function Sw(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const a=new Array(r),i=t.entries();let o,c,u=0;for(;(o=i.next())&&!o.done;){const h=e.entries();let f=!1,m=0;for(;(c=h.next())&&!c.done;){if(a[m]){m++;continue}const g=o.value,b=c.value;if(n.equals(g[0],b[0],u,m,t,e,n)&&n.equals(g[1],b[1],g[0],b[0],t,e,n)){f=a[m]=!0;break}m++}if(!f)return!1;u++}return!0}const l7=rc;function c7(t,e,n){const r=kw(t);let a=r.length;if(kw(e).length!==a)return!1;for(;a-- >0;)if(!t3(t,e,n,r[a]))return!1;return!0}function eu(t,e,n){const r=ww(t);let a=r.length;if(ww(e).length!==a)return!1;let i,o,c;for(;a-- >0;)if(i=r[a],!t3(t,e,n,i)||(o=jw(t,i),c=jw(e,i),(o||c)&&(!o||!c||o.configurable!==c.configurable||o.enumerable!==c.enumerable||o.writable!==c.writable)))return!1;return!0}function d7(t,e){return rc(t.valueOf(),e.valueOf())}function u7(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 Gf(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 h7(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 t3(t,e,n,r){return(r===t7||r===e7||r===Z_)&&(t.$$typeof||e.$$typeof)?!0:X_(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const f7="[object ArrayBuffer]",p7="[object Arguments]",m7="[object Boolean]",g7="[object DataView]",x7="[object Date]",y7="[object Error]",b7="[object Map]",v7="[object Number]",N7="[object Object]",w7="[object RegExp]",j7="[object Set]",k7="[object String]",S7={"[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},C7="[object URL]",E7=Object.prototype.toString;function T7({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:a,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:c,areObjectsEqual:u,arePrimitiveWrappersEqual:h,areRegExpsEqual:f,areSetsEqual:m,areTypedArraysEqual:g,areUrlsEqual:b,unknownTagComparators:N}){return function(v,k,T){if(v===k)return!0;if(v==null||k==null)return!1;const C=typeof v;if(C!==typeof k)return!1;if(C!=="object")return C==="number"?c(v,k,T):C==="function"?i(v,k,T):!1;const R=v.constructor;if(R!==k.constructor)return!1;if(R===Object)return u(v,k,T);if(Array.isArray(v))return e(v,k,T);if(R===Date)return r(v,k,T);if(R===RegExp)return f(v,k,T);if(R===Map)return o(v,k,T);if(R===Set)return m(v,k,T);const O=E7.call(v);if(O===x7)return r(v,k,T);if(O===w7)return f(v,k,T);if(O===b7)return o(v,k,T);if(O===j7)return m(v,k,T);if(O===N7)return typeof v.then!="function"&&typeof k.then!="function"&&u(v,k,T);if(O===C7)return b(v,k,T);if(O===y7)return a(v,k,T);if(O===p7)return u(v,k,T);if(S7[O])return g(v,k,T);if(O===f7)return t(v,k,T);if(O===g7)return n(v,k,T);if(O===m7||O===v7||O===k7)return h(v,k,T);if(N){let U=N[O];if(!U){const I=Y_(v);I&&(U=N[I])}if(U)return U(v,k,T)}return!1}}function M7({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:n7,areArraysEqual:n?eu:s7,areDataViewsEqual:r7,areDatesEqual:a7,areErrorsEqual:i7,areFunctionsEqual:o7,areMapsEqual:n?gx(Sw,eu):Sw,areNumbersEqual:l7,areObjectsEqual:n?eu:c7,arePrimitiveWrappersEqual:d7,areRegExpsEqual:u7,areSetsEqual:n?gx(Cw,eu):Cw,areTypedArraysEqual:n?gx(Gf,eu):Gf,areUrlsEqual:h7,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const a=af(r.areArraysEqual),i=af(r.areMapsEqual),o=af(r.areObjectsEqual),c=af(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:a,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:c})}return r}function A7(t){return function(e,n,r,a,i,o,c){return t(e,n,c)}}function P7({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 I7=Jo();Jo({strict:!0});Jo({circular:!0});Jo({circular:!0,strict:!0});Jo({createInternalComparator:()=>rc});Jo({strict:!0,createInternalComparator:()=>rc});Jo({circular:!0,createInternalComparator:()=>rc});Jo({circular:!0,createInternalComparator:()=>rc,strict:!0});function Jo(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:a=!1}=t,i=M7(t),o=T7(i),c=n?n(o):A7(o);return P7({circular:e,comparator:o,createState:r,equals:c,strict:a})}var xx={exports:{}},yx={};/** -======== -:::`}}}function H_(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 U_(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function YC(t){const{nodeName:e,name:n,getContent:r,parseAttributes:a=H_,serializeAttributes:i=U_,defaultAttributes:o={},selfClosing:c=!1,allowedAttributes:u}=t,h=n||e,f=g=>{if(!u)return g;const b={};return u.forEach(N=>{const j=typeof N=="string"?N:N.name,v=typeof N=="string"?void 0:N.skipIfDefault;if(j in g){const k=g[j];if(v!==void 0&&k===v)return;b[j]=k}}),b},m=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(g,b)=>{const N={...o,...g.attributes};if(c)return b.createNode(e,N);const j=r?r(g):g.content||"";return j?b.createNode(e,N,[b.createTextNode(j)]):b.createNode(e,N,[])},markdownTokenizer:{name:e,level:"inline",start(g){const b=c?new RegExp(`\\[${m}\\s*[^\\]]*\\]`):new RegExp(`\\[${m}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${m}\\]`),N=g.match(b),j=N==null?void 0:N.index;return j!==void 0?j:-1},tokenize(g,b,N){const j=c?new RegExp(`^\\[${m}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${m}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${m}\\]`),v=g.match(j);if(!v)return;let k="",T="";if(c){const[,R]=v;T=R}else{const[,R,O]=v;T=R,k=O||""}const C=a(T.trim());return{type:e,raw:v[0],content:k.trim(),attributes:C}}},renderMarkdown:g=>{let b="";r?b=r(g):g.content&&g.content.length>0&&(b=g.content.filter(k=>k.type==="text").map(k=>k.text).join(""));const N=f(g.attrs||{}),j=i(N),v=j?` ${j}`:"";return c?`[${h}${v}]`:`[${h}${v}]${b}[/${h}]`}}}function y0(t,e,n){var r,a,i,o;const c=t.split(` -`),u=[];let h="",f=0;const m=e.baseIndentSize||2;for(;f0)break;if(g.trim()===""){f+=1,h=`${h}${g} -`;continue}else return}const N=e.extractItemData(b),{indentLevel:j,mainContent:v}=N;h=`${h}${g} -`;const k=[v];for(f+=1;fQ.trim()!=="");if(P===-1)break;if((((a=(r=c[f+1+P].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:a.length)||0)>j){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)>j)k.push(O),h=`${h}${O} -`,f+=1;else break}let T;const C=k.slice(1);if(C.length>0){const O=C.map(U=>U.slice(j+m)).join(` -`);O.trim()&&(e.customNestedParser?T=e.customNestedParser(O):T=n.blockTokens(O))}const R=e.createToken(N,T);u.push(R)}if(u.length!==0)return{items:u,raw:h}}function Vy(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const a=typeof n=="function"?n(r):n,[i,...o]=t.content,c=e.renderChildren([i]),u=[`${a}${c}`];return o&&o.length>0&&o.forEach(h=>{const f=e.renderChildren([h]);if(f){const m=f.split(` -`).map(g=>g?e.indent(g):"").join(` -`);u.push(m)}}),u.join(` -`)}function W_(t,e,n={}){const{state:r}=e,{doc:a,tr:i}=r,o=t;a.descendants((c,u)=>{const h=i.mapping.map(u),f=i.mapping.map(u)+c.nodeSize;let m=null;if(c.marks.forEach(b=>{if(b!==o)return!1;m=b}),!m)return;let g=!1;if(Object.keys(n).forEach(b=>{n[b]!==m.attrs[b]&&(g=!0)}),g){const b=t.type.create({...t.attrs,...n});i.removeMark(h,f,t.type),i.addMark(h,f,b)}}),i.docChanged&&e.view.dispatch(i)}var Fn=class XC extends zy{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new XC(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Gl(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),g=m+c.length;if($y(n.from,n.to,e.doc).filter(N=>N.mark.type.excluded.find(v=>v===t.type&&v!==N.mark.type)).filter(N=>N.to>m).length)return null;gn.from&&o.delete(n.from+f,m),h=n.from+f+c.length,o.addMark(n.from+f,h,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:K_,getOwnPropertySymbols:q_}=Object,{hasOwnProperty:G_}=Object.prototype;function mx(t,e){return function(r,a,i){return t(r,a,i)&&e(r,a,i)}}function rf(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 J_(t){return t!=null?t[Symbol.toStringTag]:void 0}function vw(t){return K_(t).concat(q_(t))}const Q_=Object.hasOwn||((t,e)=>G_.call(t,e));function sc(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const Y_="__v",X_="__o",Z_="_owner",{getOwnPropertyDescriptor:Nw,keys:ww}=Object;function e7(t,e){return t.byteLength===e.byteLength&&qf(new Uint8Array(t),new Uint8Array(e))}function t7(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 n7(t,e){return t.byteLength===e.byteLength&&qf(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function s7(t,e){return sc(t.getTime(),e.getTime())}function r7(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function a7(t,e){return t===e}function jw(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const a=new Array(r),i=t.entries();let o,c,u=0;for(;(o=i.next())&&!o.done;){const h=e.entries();let f=!1,m=0;for(;(c=h.next())&&!c.done;){if(a[m]){m++;continue}const g=o.value,b=c.value;if(n.equals(g[0],b[0],u,m,t,e,n)&&n.equals(g[1],b[1],g[0],b[0],t,e,n)){f=a[m]=!0;break}m++}if(!f)return!1;u++}return!0}const i7=sc;function o7(t,e,n){const r=ww(t);let a=r.length;if(ww(e).length!==a)return!1;for(;a-- >0;)if(!ZC(t,e,n,r[a]))return!1;return!0}function Zd(t,e,n){const r=vw(t);let a=r.length;if(vw(e).length!==a)return!1;let i,o,c;for(;a-- >0;)if(i=r[a],!ZC(t,e,n,i)||(o=Nw(t,i),c=Nw(e,i),(o||c)&&(!o||!c||o.configurable!==c.configurable||o.enumerable!==c.enumerable||o.writable!==c.writable)))return!1;return!0}function l7(t,e){return sc(t.valueOf(),e.valueOf())}function c7(t,e){return t.source===e.source&&t.flags===e.flags}function kw(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 qf(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 d7(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 ZC(t,e,n,r){return(r===Z_||r===X_||r===Y_)&&(t.$$typeof||e.$$typeof)?!0:Q_(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const u7="[object ArrayBuffer]",h7="[object Arguments]",f7="[object Boolean]",p7="[object DataView]",m7="[object Date]",g7="[object Error]",x7="[object Map]",y7="[object Number]",b7="[object Object]",v7="[object RegExp]",N7="[object Set]",w7="[object String]",j7={"[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},k7="[object URL]",S7=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:g,areUrlsEqual:b,unknownTagComparators:N}){return function(v,k,T){if(v===k)return!0;if(v==null||k==null)return!1;const C=typeof v;if(C!==typeof k)return!1;if(C!=="object")return C==="number"?c(v,k,T):C==="function"?i(v,k,T):!1;const R=v.constructor;if(R!==k.constructor)return!1;if(R===Object)return u(v,k,T);if(Array.isArray(v))return e(v,k,T);if(R===Date)return r(v,k,T);if(R===RegExp)return f(v,k,T);if(R===Map)return o(v,k,T);if(R===Set)return m(v,k,T);const O=S7.call(v);if(O===m7)return r(v,k,T);if(O===v7)return f(v,k,T);if(O===x7)return o(v,k,T);if(O===N7)return m(v,k,T);if(O===b7)return typeof v.then!="function"&&typeof k.then!="function"&&u(v,k,T);if(O===k7)return b(v,k,T);if(O===g7)return a(v,k,T);if(O===h7)return u(v,k,T);if(j7[O])return g(v,k,T);if(O===u7)return t(v,k,T);if(O===p7)return n(v,k,T);if(O===f7||O===y7||O===w7)return h(v,k,T);if(N){let U=N[O];if(!U){const P=J_(v);P&&(U=N[P])}if(U)return U(v,k,T)}return!1}}function E7({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:e7,areArraysEqual:n?Zd:t7,areDataViewsEqual:n7,areDatesEqual:s7,areErrorsEqual:r7,areFunctionsEqual:a7,areMapsEqual:n?mx(jw,Zd):jw,areNumbersEqual:i7,areObjectsEqual:n?Zd:o7,arePrimitiveWrappersEqual:l7,areRegExpsEqual:c7,areSetsEqual:n?mx(kw,Zd):kw,areTypedArraysEqual:n?mx(qf,Zd):qf,areUrlsEqual:d7,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const a=rf(r.areArraysEqual),i=rf(r.areMapsEqual),o=rf(r.areObjectsEqual),c=rf(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:a,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:c})}return r}function T7(t){return function(e,n,r,a,i,o,c){return t(e,n,c)}}function M7({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 A7=Go();Go({strict:!0});Go({circular:!0});Go({circular:!0,strict:!0});Go({createInternalComparator:()=>sc});Go({strict:!0,createInternalComparator:()=>sc});Go({circular:!0,createInternalComparator:()=>sc});Go({circular:!0,createInternalComparator:()=>sc,strict:!0});function Go(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:a=!1}=t,i=E7(t),o=C7(i),c=n?n(o):T7(o);return M7({circular:e,comparator:o,createState:r,equals:c,strict:a})}var gx={exports:{}},xx={};/** ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - * @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. -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js - */var Ew;function R7(){if(Ew)return yx;Ew=1;var t=$u(),e=U2();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 yx.useSyncExternalStoreWithSelector=function(h,f,m,g,b){var N=i(null);if(N.current===null){var j={hasValue:!1,value:null};N.current=j}else j=N.current;N=c(function(){function k(U){if(!T){if(T=!0,C=U,U=g(U),b!==void 0&&j.hasValue){var I=j.value;if(b(I,U))return R=I}return R=U}if(I=R,r(C,U))return I;var z=g(U);return b!==void 0&&b(I,z)?(C=U,I):(C=U,R=z)}var T=!1,C,R,O=m===void 0?null:m;return[function(){return k(f())},O===null?void 0:function(){return k(O())}]},[f,m,g,b]);var v=a(h,N[0],N[1]);return o(function(){j.hasValue=!0,j.value=v},[v]),u(v),v},yx}var Tw;function L7(){return Tw||(Tw=1,xx.exports=R7()),xx.exports}var O7=L7(),D7=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},_7=({contentComponent:t})=>{const e=W2.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return s.jsx(s.Fragment,{children:Object.values(e)})};function $7(){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]:zj.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 z7=class extends Ks.Component{constructor(t){var e;super(t),this.editorContentRef=Ks.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=$7(),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:D7(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&s.jsx(_7,{contentComponent:t.contentComponent})]})}},F7=y.forwardRef((t,e)=>{const n=Ks.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Ks.createElement(z7,{key:n,innerRef:e,...t})}),n3=Ks.memo(F7),B7=typeof window<"u"?y.useLayoutEffect:y.useEffect,V7=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 H7(t){var e;const[n]=y.useState(()=>new V7(t.editor)),r=O7.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:I7);return B7(()=>n.watch(t.editor),[t.editor,n]),y.useDebugValue(r),r}var U7=!1,v0=typeof window>"u",W7=v0||!!(typeof window<"u"&&window.next),K7=class s3{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?v0||W7?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 __(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?s3.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 q7(t={},e=[]){const n=y.useRef(t);n.current=t;const[r]=y.useState(()=>new K7(n)),a=W2.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return y.useDebugValue(a),y.useEffect(r.onRender(e)),H7({editor:a,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),a}var r3=y.createContext({editor:null});r3.Consumer;var G7=y.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),J7=()=>y.useContext(G7);Ks.forwardRef((t,e)=>{const{onDragStart:n}=J7(),r=t.as||"div";return s.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});Ks.createContext({markViewContentRef:()=>{}});var Wy=y.createContext({get editor(){throw new Error("useTiptap must be used within a provider")}});Wy.displayName="TiptapContext";var Q7=()=>y.useContext(Wy);function a3({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(r3.Provider,{value:i,children:s.jsx(Wy.Provider,{value:a,children:n})})}a3.displayName="Tiptap";function i3({...t}){const{editor:e}=Q7();return s.jsx(n3,{editor:e,...t})}i3.displayName="Tiptap.Content";Object.assign(a3,{Content:i3});var Jf=(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]},Y7=/^\s*>\s$/,X7=Vn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Jf("blockquote",{...Gt(this.options.HTMLAttributes,t),children:Jf("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[ad({find:Y7,type:this.type})]}}),Z7=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,e$=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,t$=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,n$=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,s$=sc.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 Jf("strong",{...Gt(this.options.HTMLAttributes,t),children:Jf("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[rd({find:Z7,type:this.type}),rd({find:t$,type:this.type})]},addPasteRules(){return[Jl({find:e$,type:this.type}),Jl({find:n$,type:this.type})]}}),r$=/(^|[^`])`([^`]+)`(?!`)$/,a$=/(^|[^`])`([^`]+)`(?!`)/g,i$=sc.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Gt(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[rd({find:r$,type:this.type})]},addPasteRules(){return[Jl({find:a$,type:this.type})]}}),bx=4,o$=/^```([a-z]+)?[\s\n]$/,l$=/^~~~([a-z]+)?[\s\n]$/,c$=Vn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:bx,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",Gt(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:bx,{state:r}=t,{selection:a}=r,{$from:i,empty:o}=a;if(i.parent.type!==this.type)return!1;const c=" ".repeat(n);return o?t.commands.insertContent(c):t.commands.command(({tr:u})=>{const{from:h,to:f}=a,b=r.doc.textBetween(h,f,` -`,` -`).split(` -`).map(N=>c+N).join(` -`);return u.replaceWith(h,f,r.schema.text(b)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:bx,{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,` -======== - */var Sw;function I7(){if(Sw)return xx;Sw=1;var t=_u(),e=V2();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 xx.useSyncExternalStoreWithSelector=function(h,f,m,g,b){var N=i(null);if(N.current===null){var j={hasValue:!1,value:null};N.current=j}else j=N.current;N=c(function(){function k(U){if(!T){if(T=!0,C=U,U=g(U),b!==void 0&&j.hasValue){var P=j.value;if(b(P,U))return R=P}return R=U}if(P=R,r(C,U))return P;var z=g(U);return b!==void 0&&b(P,z)?(C=U,P):(C=U,R=z)}var T=!1,C,R,O=m===void 0?null:m;return[function(){return k(f())},O===null?void 0:function(){return k(O())}]},[f,m,g,b]);var v=a(h,N[0],N[1]);return o(function(){j.hasValue=!0,j.value=v},[v]),u(v),v},xx}var Cw;function P7(){return Cw||(Cw=1,gx.exports=I7()),gx.exports}var R7=P7(),L7=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},O7=({contentComponent:t})=>{const e=H2.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return s.jsx(s.Fragment,{children:Object.values(e)})};function D7(){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]:_j.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 _7=class extends Hs.Component{constructor(t){var e;super(t),this.editorContentRef=Hs.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=D7(),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:L7(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&s.jsx(O7,{contentComponent:t.contentComponent})]})}},$7=y.forwardRef((t,e)=>{const n=Hs.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Hs.createElement(_7,{key:n,innerRef:e,...t})}),e3=Hs.memo($7),z7=typeof window<"u"?y.useLayoutEffect:y.useEffect,F7=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 B7(t){var e;const[n]=y.useState(()=>new F7(t.editor)),r=R7.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:A7);return z7(()=>n.watch(t.editor),[t.editor,n]),y.useDebugValue(r),r}var V7=!1,b0=typeof window>"u",H7=b0||!!(typeof window<"u"&&window.next),U7=class t3{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?b0||H7?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 O_(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?t3.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 W7(t={},e=[]){const n=y.useRef(t);n.current=t;const[r]=y.useState(()=>new U7(n)),a=H2.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return y.useDebugValue(a),y.useEffect(r.onRender(e)),B7({editor:a,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),a}var n3=y.createContext({editor:null});n3.Consumer;var K7=y.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),q7=()=>y.useContext(K7);Hs.forwardRef((t,e)=>{const{onDragStart:n}=q7(),r=t.as||"div";return s.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});Hs.createContext({markViewContentRef:()=>{}});var Hy=y.createContext({get editor(){throw new Error("useTiptap must be used within a provider")}});Hy.displayName="TiptapContext";var G7=()=>y.useContext(Hy);function s3({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(n3.Provider,{value:i,children:s.jsx(Hy.Provider,{value:a,children:n})})}s3.displayName="Tiptap";function r3({...t}){const{editor:e}=G7();return s.jsx(e3,{editor:e,...t})}r3.displayName="Tiptap.Content";Object.assign(s3,{Content:r3});var Gf=(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]},J7=/^\s*>\s$/,Q7=Fn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Gf("blockquote",{...Gt(this.options.HTMLAttributes,t),children:Gf("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[rd({find:J7,type:this.type})]}}),Y7=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,X7=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Z7=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,e$=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,t$=nc.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 Gf("strong",{...Gt(this.options.HTMLAttributes,t),children:Gf("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[sd({find:Y7,type:this.type}),sd({find:Z7,type:this.type})]},addPasteRules(){return[Gl({find:X7,type:this.type}),Gl({find:e$,type:this.type})]}}),n$=/(^|[^`])`([^`]+)`(?!`)$/,s$=/(^|[^`])`([^`]+)`(?!`)/g,r$=nc.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Gt(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[sd({find:n$,type:this.type})]},addPasteRules(){return[Gl({find:s$,type:this.type})]}}),yx=4,a$=/^```([a-z]+)?[\s\n]$/,i$=/^~~~([a-z]+)?[\s\n]$/,o$=Fn.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",Gt(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(N=>c+N).join(` -`);return u.replaceWith(h,f,r.schema.text(b)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e: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,` ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js -`,` -`).split(` -`);let N=0,j=0;const v=h-f;for(let U=0;U=v){N=U;break}j+=b[U].length+1}const T=((u=b[N].match(/^ */))==null?void 0:u[0])||"",C=Math.min(T.length,n);if(C===0)return!0;let R=f;for(let U=0;U{const{from:u,to:h}=a,g=r.doc.textBetween(u,h,` -`,` -`).split(` -`).map(b=>{var N;const j=((N=b.match(/^ */))==null?void 0:N[0])||"",v=Math.min(j.length,n);return b.slice(v)}).join(` -`);return c.replaceWith(u,h,r.schema.text(g)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:a}=n;if(!a||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(` - -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js -`);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[y0({find:o$,type:this.type,getAttributes:t=>({language:t[1]})}),y0({find:l$,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new fn({key:new wn("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),a=r?JSON.parse(r):void 0,i=a==null?void 0:a.mode;if(!n||!i)return!1;const{tr:o,schema:c}=t.state,u=c.text(n.replace(/\r\n?/g,` -`));return o.replaceSelectionWith(this.type.create({language:i},u)),o.selection.$from.parent.type!==this.type&&o.setSelection(ot.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),d$=Vn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` - -`):""}),u$=Vn.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",Gt(this.options.HTMLAttributes,t)]},renderText(){return` -`},renderMarkdown:()=>` -`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:a,storedMarks:i}=n;if(a.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:c}=r.extensionManager,u=i||a.$to.parentOffset&&a.$from.marks();return e().insertContent({type:this.name}).command(({tr:h,dispatch:f})=>{if(f&&u&&o){const m=u.filter(g=>c.includes(g.type.name));h.ensureMarks(m)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),h$=Vn.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]}`,Gt(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=>y0({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),f$=Vn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Gt(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!F_(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,a=t();return OC(n)?a.insertContentAt(r.pos,{type:this.name}):a.insertContent({type:this.name}),a.command(({state:i,tr:o,dispatch:c})=>{if(c){const{$to:u}=o.selection,h=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?o.setSelection(ot.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(it.create(o.doc,u.pos)):o.setSelection(ot.create(o.doc,u.pos));else{const f=i.schema.nodes[this.options.nextNodeType]||u.parent.type.contentMatch.defaultType,m=f==null?void 0:f.create();m&&(o.insert(h,m),o.setSelection(ot.create(o.doc,h+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[XC({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),p$=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,m$=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,g$=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,x$=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,y$=sc.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",Gt(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[rd({find:p$,type:this.type}),rd({find:g$,type:this.type})]},addPasteRules(){return[Jl({find:m$,type:this.type}),Jl({find:x$,type:this.type})]}});const b$="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",v$="ελ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",N0="numeric",w0="ascii",j0="alpha",gu="asciinumeric",iu="alphanumeric",k0="domain",o3="emoji",N$="scheme",w$="slashscheme",vx="whitespace";function j$(t,e){return t in e||(e[t]=[]),e[t]}function Pl(t,e,n){e[N0]&&(e[gu]=!0,e[iu]=!0),e[w0]&&(e[gu]=!0,e[j0]=!0),e[gu]&&(e[iu]=!0),e[j0]&&(e[iu]=!0),e[iu]&&(e[k0]=!0),e[o3]&&(e[k0]=!0);for(const r in e){const a=j$(r,n);a.indexOf(t)<0&&a.push(t)}}function k$(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function hr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}hr.groups={};hr.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),In=(t,e,n,r,a)=>t.tr(e,n,r,a),Mw=(t,e,n,r,a)=>t.ts(e,n,r,a),Re=(t,e,n,r,a)=>t.tt(e,n,r,a),wi="WORD",S0="UWORD",l3="ASCIINUMERICAL",c3="ALPHANUMERICAL",Lu="LOCALHOST",C0="TLD",E0="UTLD",Nf="SCHEME",zc="SLASH_SCHEME",Ky="NUM",T0="WS",qy="NL",xu="OPENBRACE",yu="CLOSEBRACE",Qf="OPENBRACKET",Yf="CLOSEBRACKET",Xf="OPENPAREN",Zf="CLOSEPAREN",ep="OPENANGLEBRACKET",tp="CLOSEANGLEBRACKET",np="FULLWIDTHLEFTPAREN",sp="FULLWIDTHRIGHTPAREN",rp="LEFTCORNERBRACKET",ap="RIGHTCORNERBRACKET",ip="LEFTWHITECORNERBRACKET",op="RIGHTWHITECORNERBRACKET",lp="FULLWIDTHLESSTHAN",cp="FULLWIDTHGREATERTHAN",dp="AMPERSAND",up="APOSTROPHE",hp="ASTERISK",yo="AT",fp="BACKSLASH",pp="BACKTICK",mp="CARET",No="COLON",Gy="COMMA",gp="DOLLAR",za="DOT",xp="EQUALS",Jy="EXCLAMATION",Kr="HYPHEN",bu="PERCENT",yp="PIPE",bp="PLUS",vp="POUND",vu="QUERY",Qy="QUOTE",d3="FULLWIDTHMIDDLEDOT",Yy="SEMI",Fa="SLASH",Nu="TILDE",Np="UNDERSCORE",u3="EMOJI",wp="SYM";var h3=Object.freeze({__proto__:null,ALPHANUMERICAL:c3,AMPERSAND:dp,APOSTROPHE:up,ASCIINUMERICAL:l3,ASTERISK:hp,AT:yo,BACKSLASH:fp,BACKTICK:pp,CARET:mp,CLOSEANGLEBRACKET:tp,CLOSEBRACE:yu,CLOSEBRACKET:Yf,CLOSEPAREN:Zf,COLON:No,COMMA:Gy,DOLLAR:gp,DOT:za,EMOJI:u3,EQUALS:xp,EXCLAMATION:Jy,FULLWIDTHGREATERTHAN:cp,FULLWIDTHLEFTPAREN:np,FULLWIDTHLESSTHAN:lp,FULLWIDTHMIDDLEDOT:d3,FULLWIDTHRIGHTPAREN:sp,HYPHEN:Kr,LEFTCORNERBRACKET:rp,LEFTWHITECORNERBRACKET:ip,LOCALHOST:Lu,NL:qy,NUM:Ky,OPENANGLEBRACKET:ep,OPENBRACE:xu,OPENBRACKET:Qf,OPENPAREN:Xf,PERCENT:bu,PIPE:yp,PLUS:bp,POUND:vp,QUERY:vu,QUOTE:Qy,RIGHTCORNERBRACKET:ap,RIGHTWHITECORNERBRACKET:op,SCHEME:Nf,SEMI:Yy,SLASH:Fa,SLASH_SCHEME:zc,SYM:wp,TILDE:Nu,TLD:C0,UNDERSCORE:Np,UTLD:E0,UWORD:S0,WORD:wi,WS:T0});const vi=/[a-z]/,tu=new RegExp("\\p{L}","u"),Nx=new RegExp("\\p{Emoji}","u"),Ni=/\d/,wx=/\s/,Aw="\r",jx=` -`,S$="️",C$="‍",kx="";let of=null,lf=null;function E$(t=[]){const e={};hr.groups=e;const n=new hr;of==null&&(of=Pw(b$)),lf==null&&(lf=Pw(v$)),Re(n,"'",up),Re(n,"{",xu),Re(n,"}",yu),Re(n,"[",Qf),Re(n,"]",Yf),Re(n,"(",Xf),Re(n,")",Zf),Re(n,"<",ep),Re(n,">",tp),Re(n,"(",np),Re(n,")",sp),Re(n,"「",rp),Re(n,"」",ap),Re(n,"『",ip),Re(n,"』",op),Re(n,"<",lp),Re(n,">",cp),Re(n,"&",dp),Re(n,"*",hp),Re(n,"@",yo),Re(n,"`",pp),Re(n,"^",mp),Re(n,":",No),Re(n,",",Gy),Re(n,"$",gp),Re(n,".",za),Re(n,"=",xp),Re(n,"!",Jy),Re(n,"-",Kr),Re(n,"%",bu),Re(n,"|",yp),Re(n,"+",bp),Re(n,"#",vp),Re(n,"?",vu),Re(n,'"',Qy),Re(n,"/",Fa),Re(n,";",Yy),Re(n,"~",Nu),Re(n,"_",Np),Re(n,"\\",fp),Re(n,"・",d3);const r=In(n,Ni,Ky,{[N0]:!0});In(r,Ni,r);const a=In(r,vi,l3,{[gu]:!0}),i=In(r,tu,c3,{[iu]:!0}),o=In(n,vi,wi,{[w0]:!0});In(o,Ni,a),In(o,vi,o),In(a,Ni,a),In(a,vi,a);const c=In(n,tu,S0,{[j0]:!0});In(c,vi),In(c,Ni,i),In(c,tu,c),In(i,Ni,i),In(i,vi),In(i,tu,i);const u=Re(n,jx,qy,{[vx]:!0}),h=Re(n,Aw,T0,{[vx]:!0}),f=In(n,wx,T0,{[vx]:!0});Re(n,kx,f),Re(h,jx,u),Re(h,kx,f),In(h,wx,f),Re(f,Aw),Re(f,jx),In(f,wx,f),Re(f,kx,f);const m=In(n,Nx,u3,{[o3]:!0});Re(m,"#"),In(m,Nx,m),Re(m,S$,m);const g=Re(m,C$);Re(g,"#"),In(g,Nx,m);const b=[[vi,o],[Ni,a]],N=[[vi,null],[tu,c],[Ni,i]];for(let j=0;jj[0]>v[0]?1:-1);for(let j=0;j=0?T[k0]=!0:vi.test(v)?Ni.test(v)?T[gu]=!0:T[w0]=!0:T[N0]=!0,Mw(n,v,v,T)}return Mw(n,"localhost",Lu,{ascii:!0}),n.jd=new hr(wp),{start:n,tokens:Object.assign({groups:e},h3)}}function f3(t,e){const n=T$(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,a=[];let i=0,o=0;for(;o=0&&(m+=n[o].length,g++),h+=n[o].length,i+=n[o].length,o++;i-=m,o-=g,h-=m,a.push({t:f.t,v:e.slice(i-h,i),s:i-h,e:i})}return a}function T$(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 fo(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 Ou={defaultProtocol:"http",events:null,format:Iw,formatHref:Iw,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Xy(t,e=null){let n=Object.assign({},Ou);t&&(n=Object.assign(n,t instanceof Xy?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=Ou.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 Zp(t,e){class n extends p3{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 Rw=Zp("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Lw=Zp("text"),M$=Zp("nl"),cf=Zp("url",{isLink:!0,toHref(t=Ou.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Lu&&t[1].t===No}}),Wr=t=>new hr(t);function A$({groups:t}){const e=t.domain.concat([dp,hp,yo,fp,pp,mp,gp,xp,Kr,Ky,bu,yp,bp,vp,Fa,wp,Nu,Np]),n=[up,No,Gy,za,Jy,bu,vu,Qy,Yy,ep,tp,xu,yu,Yf,Qf,Xf,Zf,np,sp,rp,ap,ip,op,lp,cp],r=[dp,up,hp,fp,pp,mp,gp,xp,Kr,xu,yu,bu,yp,bp,vp,vu,Fa,wp,Nu,Np],a=Wr(),i=Re(a,Nu);Et(i,r,i),Et(i,t.domain,i);const o=Wr(),c=Wr(),u=Wr();Et(a,t.domain,o),Et(a,t.scheme,c),Et(a,t.slashscheme,u),Et(o,r,i),Et(o,t.domain,o);const h=Re(o,yo);Re(i,yo,h),Re(c,yo,h),Re(u,yo,h);const f=Re(i,za);Et(f,r,i),Et(f,t.domain,i);const m=Wr();Et(h,t.domain,m),Et(m,t.domain,m);const g=Re(m,za);Et(g,t.domain,m);const b=Wr(Rw);Et(g,t.tld,b),Et(g,t.utld,b),Re(h,Lu,b);const N=Re(m,Kr);Re(N,Kr,N),Et(N,t.domain,m),Et(b,t.domain,m),Re(b,za,g),Re(b,Kr,N);const j=Re(b,No);Et(j,t.numeric,Rw);const v=Re(o,Kr),k=Re(o,za);Re(v,Kr,v),Et(v,t.domain,o),Et(k,r,i),Et(k,t.domain,o);const T=Wr(cf);Et(k,t.tld,T),Et(k,t.utld,T),Et(T,t.domain,o),Et(T,r,i),Re(T,za,k),Re(T,Kr,v),Re(T,yo,h);const C=Re(T,No),R=Wr(cf);Et(C,t.numeric,R);const O=Wr(cf),U=Wr();Et(O,e,O),Et(O,n,U),Et(U,e,O),Et(U,n,U),Re(T,Fa,O),Re(R,Fa,O);const I=Re(c,No),z=Re(u,No),L=Re(z,Fa),Q=Re(L,Fa);Et(c,t.domain,o),Re(c,za,k),Re(c,Kr,v),Et(u,t.domain,o),Re(u,za,k),Re(u,Kr,v),Et(I,t.domain,O),Re(I,Fa,O),Re(I,vu,O),Et(Q,t.domain,O),Et(Q,e,O),Re(Q,Fa,O);const se=[[xu,yu],[Qf,Yf],[Xf,Zf],[ep,tp],[np,sp],[rp,ap],[ip,op],[lp,cp]];for(let $=0;$=0&&g++,a++,f++;if(g<0)a-=f,a0&&(i.push(Sx(Lw,e,o)),o=[]),a-=g,f-=g;const b=m.t,N=n.slice(a-f,a);i.push(Sx(b,e,N))}}return o.length>0&&i.push(Sx(Lw,e,o)),i}function Sx(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 I$=typeof console<"u"&&console&&console.warn||(()=>{}),R$="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",yn={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function L$(){return hr.groups={},yn.scanner=null,yn.parser=null,yn.tokenQueue=[],yn.pluginQueue=[],yn.customSchemes=[],yn.initialized=!1,yn}function Ow(t,e=!1){if(yn.initialized&&I$(`linkifyjs: already initialized - will not register custom scheme "${t}" ${R$}`),!/^[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`);yn.customSchemes.push([t,e])}function O$(){yn.scanner=E$(yn.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=CC(n.doc,[...e]);if(LC(c).forEach(({newRange:h})=>{const f=zD(r.doc,h,b=>b.isTextblock);let m,g;if(f.length>1)m=f[0],g=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(f.length){const b=r.doc.textBetween(h.from,h.to," "," ");if(!_$.test(b))return;m=f[0],g=r.doc.textBetween(m.pos,h.to,void 0," ")}if(m&&g){const b=g.split(D$).filter(Boolean);if(b.length<=0)return!1;const N=b[b.length-1],j=m.pos+g.lastIndexOf(N);if(!N)return!1;const v=Zy(N).map(k=>k.toObject(t.defaultProtocol));if(!z$(v))return!1;v.filter(k=>k.isLink).map(k=>({...k,from:j+k.start+1,to:j+k.end+1})).filter(k=>r.schema.marks.code?!r.doc.rangeHasMark(k.from,k.to,r.schema.marks.code):!0).filter(k=>t.validate(k.value)).filter(k=>t.shouldAutoLink(k.value)).forEach(k=>{Fy(k.from,k.to,r.doc).some(T=>T.mark.type===t.type)||o.addMark(k.from,k.to,t.type.create({href:k.href}))})}}),!!o.steps.length)return o}})}function B$(t){return new fn({key:new wn("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=RC(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 V$(t){return new fn({key:new wn("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=m3(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($$,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var H$=sc.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"){Ow(t);return}Ow(t.scheme,t.optionalSlashes)})},onDestroy(){L$()},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",Gt(this.options.HTMLAttributes,t),0]:["a",Gt(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[Jl({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,a=m3(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(F$({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(B$({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(V$({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),U$=Object.defineProperty,W$=(t,e)=>{for(var n in e)U$(t,n,{get:e[n],enumerable:!0})},K$="listItem",Dw="textStyle",_w=/^\s*([-+*])\s$/,g3=Vn.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",Gt(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(K$,this.editor.getAttributes(Dw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=ad({find:_w,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ad({find:_w,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Dw),editor:this.editor})),[t]}}),x3=Vn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Gt(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)=>Uy(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)}}}),q$={};W$(q$,{findListItemPos:()=>Wu,getNextListDepth:()=>tb,handleBackspace:()=>M0,handleDelete:()=>A0,hasListBefore:()=>y3,hasListItemAfter:()=>G$,hasListItemBefore:()=>b3,listItemHasSubList:()=>v3,nextListIsDeeper:()=>N3,nextListIsHigher:()=>w3});var Wu=(t,e)=>{const{$from:n}=e.selection,r=Gn(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}},tb=(t,e)=>{const n=Wu(t,e);if(!n)return!1;const[,r]=JD(e,t,n.$pos.pos+4);return r},y3=(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))},b3=(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)},v3=(t,e,n)=>{if(!n)return!1;const r=Gn(t,e.schema);let a=!1;return n.descendants(i=>{i.type===r&&(a=!0)}),a},M0=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Bo(t.state,e)&&y3(t.state,e,n)){const{$anchor:c}=t.state.selection,u=t.state.doc.resolve(c.before()-1),h=[];u.node().descendants((g,b)=>{g.type.name===e&&h.push({node:g,pos:b})});const f=h.at(-1);if(!f)return!1;const m=t.state.doc.resolve(u.start()+f.pos+1);return t.chain().cut({from:c.start()-1,to:c.end()+1},m.end()).joinForward().run()}if(!Bo(t.state,e)||!ZD(t.state))return!1;const r=Wu(e,t.state);if(!r)return!1;const i=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=v3(e,t.state,i);return b3(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},N3=(t,e)=>{const n=tb(t,e),r=Wu(t,e);return!r||!n?!1:n>r.depth},w3=(t,e)=>{const n=tb(t,e),r=Wu(t,e);return!r||!n?!1:n{if(!Bo(t.state,e)||!XD(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():w3(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},G$=(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)},j3=Dn.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&&A0(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&&A0(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&M0(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&M0(t,n,r)&&(e=!0)}),e}}}}),$w=/^(\s*)(\d+)\.\s+(.*)$/,J$=/^\s/;function Q$(t){const e=[];let n=0,r=0;for(;ne;)g.push(t[m]),m+=1;if(g.length>0){const b=Math.min(...g.map(j=>j.indent)),N=k3(g,b,n);h.push({type:"list",ordered:!0,start:g[0].number,items:N,raw:g.map(j=>j.raw).join(` -`)})}a.push({type:"list_item",raw:o.raw,tokens:h}),i=m}else i+=1}return a}function Y$(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 X$="listItem",zw="textStyle",Fw=/^(\d+)\.\s$/,S3=Vn.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",Gt(this.options.HTMLAttributes,n),0]:["ol",Gt(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?Y$(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]=Q$(a);if(i.length===0)return;const c=k3(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(X$,this.editor.getAttributes(zw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=ad({find:Fw,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=ad({find:Fw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(zw)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),Z$=/^\s*(\[([( |x])?\])\s$/,ez=Vn.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",Gt(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 Uy(t,e,a)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const a=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),c=document.createElement("input"),u=document.createElement("div"),h=m=>{var g,b;c.ariaLabel=((b=(g=this.options.a11y)==null?void 0:g.checkboxLabel)==null?void 0:b.call(g,m,c.checked))||`Task item checkbox for ${m.textContent||"empty task item"}`};h(t),i.contentEditable="false",c.type="checkbox",c.addEventListener("mousedown",m=>m.preventDefault()),c.addEventListener("change",m=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){c.checked=!c.checked;return}const{checked:g}=m.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:b})=>{const N=n();if(typeof N!="number")return!1;const j=b.doc.nodeAt(N);return b.setNodeMarkup(N,void 0,{...j==null?void 0:j.attrs,checked:g}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,g)||(c.checked=!c.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([m,g])=>{a.setAttribute(m,g)}),a.dataset.checked=t.attrs.checked,c.checked=t.attrs.checked,i.append(c,o),a.append(i,u),Object.entries(e).forEach(([m,g])=>{a.setAttribute(m,g)});let f=new Set(Object.keys(e));return{dom:a,contentDOM:u,update:m=>{if(m.type!==this.type)return!1;a.dataset.checked=m.attrs.checked,c.checked=m.attrs.checked,h(m);const g=r.extensionManager.attributes,b=Ru(m,g),N=new Set(Object.keys(b)),j=this.options.HTMLAttributes;return f.forEach(v=>{N.has(v)||(v in j?a.setAttribute(v,j[v]):a.removeAttribute(v))}),Object.entries(b).forEach(([v,k])=>{k==null?v in j?a.setAttribute(v,j[v]):a.removeAttribute(v):a.setAttribute(v,k)}),f=N,!0}}}},addInputRules(){return[ad({find:Z$,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),tz=Vn.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",Gt(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=b0(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=b0(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()}}});Dn.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(g3.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(x3.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(j3.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(S3.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(ez.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(tz.configure(this.options.taskList)),t}});var Bw=" ",nz=" ",sz=Vn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Gt(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===Bw||r[0].text===nz)?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?Bw:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),rz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,az=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,iz=sc.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",Gt(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[rd({find:rz,type:this.type})]},addPasteRules(){return[Jl({find:az,type:this.type})]}}),oz=Vn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),lz=sc.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",Gt(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 cz(t={}){return new fn({view(e){return new dz(e,t)}})}class dz{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(a=>{let i=o=>{this[a](o)};return e.dom.addEventListener(a,i),{name:a,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,a=this.editorView.dom,i=a.getBoundingClientRect(),o=i.width/a.offsetWidth,c=i.height/a.offsetHeight;if(n){let m=e.nodeBefore,g=e.nodeAfter;if(m||g){let b=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(b){let N=b.getBoundingClientRect(),j=m?N.bottom:N.top;m&&g&&(j=(j+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let v=this.width/2*c;r={left:N.left,right:N.right,top:j-v,bottom:j+v}}}}if(!r){let m=this.editorView.coordsAtPos(this.cursorPos),g=this.width/2*o;r={left:m.left-g,right:m.left+g,top:m.top,bottom:m.bottom}}let u=this.editorView.dom.offsetParent;this.element||(this.element=u.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let h,f;if(!u||u==document.body&&getComputedStyle(u).position=="static")h=-pageXOffset,f=-pageYOffset;else{let m=u.getBoundingClientRect(),g=m.width/u.offsetWidth,b=m.height/u.offsetHeight;h=m.left-u.scrollLeft*g,f=m.top-u.scrollTop*b}this.element.style.left=(r.left-h)/o+"px",this.element.style.top=(r.top-f)/c+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/c+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),a=r&&r.type.spec.disableDropCursor,i=typeof a=="function"?a(this.editorView,n,e):a;if(n&&!i){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=yS(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 Ln extends ft{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Ln.valid(r)?new Ln(r):ft.near(r)}content(){return ze.empty}eq(e){return e instanceof Ln&&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 Ln(e.resolve(n.pos))}getBookmark(){return new nb(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!uz(e)||!hz(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&&Ln.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(Ln.valid(u))return u}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!it.isSelectable(i)){e=e.doc.resolve(a+i.nodeSize*n),r=!1;continue e}break}i=o,a+=n;let c=e.doc.resolve(a);if(Ln.valid(c))return c}return null}}}Ln.prototype.visible=!1;Ln.findFrom=Ln.findGapCursorFrom;ft.jsonID("gapcursor",Ln);class nb{constructor(e){this.pos=e}map(e){return new nb(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Ln.valid(n)?new Ln(n):ft.near(n)}}function C3(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function uz(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||C3(a.type))return!0;if(a.inlineContent)return!1}}return!0}function hz(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||C3(a.type))return!0;if(a.inlineContent)return!1}}return!0}function fz(){return new fn({props:{decorations:xz,createSelectionBetween(t,e,n){return e.pos==n.pos&&Ln.valid(n)?new Ln(n):null},handleClick:mz,handleKeyDown:pz,handleDOMEvents:{beforeinput:gz}}})}const pz=Ly({ArrowLeft:df("horiz",-1),ArrowRight:df("horiz",1),ArrowUp:df("vert",-1),ArrowDown:df("vert",1)});function df(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,a,i){let o=r.selection,c=e>0?o.$to:o.$from,u=o.empty;if(o instanceof ot){if(!i.endOfTextblock(n)||c.depth==0)return!1;u=!1,c=r.doc.resolve(e>0?c.after():c.before())}let h=Ln.findGapCursorFrom(c,e,u);return h?(a&&a(r.tr.setSelection(new Ln(h))),!0):!1}}function mz(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Ln.valid(r))return!1;let a=t.posAtCoords({left:n.clientX,top:n.clientY});return a&&a.inside>-1&&it.isSelectable(t.state.doc.nodeAt(a.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Ln(r))),!0)}function gz(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Ln))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let a=Ce.empty;for(let o=r.length-1;o>=0;o--)a=Ce.from(r[o].createAndFill(null,a));let i=t.state.tr.replace(n.pos,n.pos,new ze(a,0,0));return i.setSelection(ot.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function xz(t){if(!(t.selection instanceof Ln))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",an.create(t.doc,[ts.widget(t.selection.head,e,{key:"gapcursor"})])}var jp=200,ys=function(){};ys.prototype.append=function(e){return e.length?(e=ys.from(e),!this.length&&e||e.length=n?ys.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};ys.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ys.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)};ys.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};ys.from=function(e){return e instanceof ys?e:e&&e.length?new E3(e):ys.empty};var E3=(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<=jp)return new e(this.values.concat(a.flatten()))},e.prototype.leafPrepend=function(a){if(this.length+a.length<=jp)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})(ys);ys.empty=new E3([]);var yz=(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})(ys);const bz=500;class ma{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let a,i;n&&(a=this.remapping(r,this.items.length),i=a.maps.length);let o=e.tr,c,u,h=[],f=[];return this.items.forEach((m,g)=>{if(!m.step){a||(a=this.remapping(r,g+1),i=a.maps.length),i--,f.push(m);return}if(a){f.push(new po(m.map));let b=m.step.map(a.slice(i)),N;b&&o.maybeStep(b).doc&&(N=o.mapping.maps[o.mapping.maps.length-1],h.push(new po(N,void 0,void 0,h.length+f.length))),i--,N&&a.appendMap(N,i)}else o.maybeStep(m.step);if(m.selection)return c=a?m.selection.map(a.slice(i)):m.selection,u=new ma(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=vz(c,h),o-=h),new ma(c.append(i),o)}remapping(e,n){let r=new Eu;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 ma(this.items.append(e.map(n=>new po(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],a=Math.max(0,this.items.length-n),i=e.mapping,o=e.steps.length,c=this.eventCount;this.items.forEach(g=>{g.selection&&c--},a);let u=n;this.items.forEach(g=>{let b=i.getMirror(--u);if(b==null)return;o=Math.min(o,b);let N=i.maps[b];if(g.step){let j=e.steps[b].invert(e.docs[b]),v=g.selection&&g.selection.map(i.slice(u+1,b));v&&c++,r.push(new po(N,j,v))}else r.push(new po(N))},a);let h=[];for(let g=n;gbz&&(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 po(h.invert(),u,f),g,b=a.length-1;(g=a.length&&a[b].merge(m))?a[b]=g:a.push(m)}}else o.map&&r--},this.items.length,0),new ma(ys.from(a.reverse()),i)}}ma.empty=new ma(ys.empty,0);function vz(t,e){let n;return t.forEach((r,a)=>{if(r.selection&&e--==0)return n=a,!1}),t.slice(n)}let po=class T3{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 T3(n.getMap().invert(),n,this.selection)}}};class bo{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 wz(t,e,n,r){let a=n.getMeta(Dl),i;if(a)return a.historyState;n.getMeta(Sz)&&(t=new bo(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(Dl))return o.getMeta(Dl).redo?new bo(t.done.addTransform(n,void 0,r,wf(e)),t.undone,Vw(n.mapping.maps),t.prevTime,t.prevComposition):new bo(t.done,t.undone.addTransform(n,void 0,r,wf(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||!jz(n,t.prevRanges)),h=o?Cx(t.prevRanges,n.mapping):Vw(n.mapping.maps);return new bo(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,wf(e)),ma.empty,h,n.time,c??t.prevComposition)}else return(i=n.getMeta("rebased"))?new bo(t.done.rebased(n,i),t.undone.rebased(n,i),Cx(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new bo(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Cx(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function jz(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 Vw(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 Cx(t,e){if(!t)return null;let n=[];for(let r=0;r{let a=Dl.getState(n);if(!a||(t?a.undone:a.done).eventCount==0)return!1;if(r){let i=kz(a,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const A3=M3(!1,!0),P3=M3(!0,!0);Dn.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 fn({key:new wn("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 Ez=Dn.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[cz(this.options)]}});Dn.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new fn({key:new wn("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:a}=e,i=[];if(!n||!r)return an.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(ts.node(h,h+u.nodeSize,{class:this.options.className}))}),an.create(t,i)}}})]}});var Tz=Dn.create({name:"gapCursor",addProseMirrorPlugins(){return[fz()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Kt(rt(t,"allowGapCursor",n)))!=null?e:null}}}),Uw="placeholder";function Mz(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var Az=Dn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Uw,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${Mz(this.options.dataAttribute)}`:`data-${Uw}`;return[new fn({key:new wn("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&&Qp(c);if((h||!this.options.showOnlyCurrent)&&f){const m=[this.options.emptyNodeClass];o&&m.push(this.options.emptyEditorClass);const g=ts.node(u,u+c.nodeSize,{class:m.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:c,pos:u,hasAnchor:h}):this.options.placeholder});i.push(g)}return this.options.includeChildren}),an.create(e,i)}}})]}});Dn.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new fn({key:new wn("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||OC(n.selection)||t.view.dragging?null:an.create(n.doc,[ts.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Ww({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var Pz=Dn.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new wn(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 fn({key:e,appendTransaction:(a,i,o)=>{const{doc:c,tr:u,schema:h}=o,f=e.getState(o),m=c.content.size,g=h.nodes[n];if(f)return u.insert(m,g.create())},state:{init:(a,i)=>{const o=i.tr.doc.lastChild;return!Ww({node:o,types:r})},apply:(a,i)=>{if(!a.docChanged||a.getMeta("__uniqueIDTransaction"))return i;const o=a.doc.lastChild;return!Ww({node:o,types:r})}}})]}}),Iz=Dn.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>A3(t,e),redo:()=>({state:t,dispatch:e})=>P3(t,e)}},addProseMirrorPlugins(){return[Cz(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()}}}),Rz=Dn.create({name:"starterKit",addExtensions(){var t,e,n,r;const a=[];return this.options.bold!==!1&&a.push(s$.configure(this.options.bold)),this.options.blockquote!==!1&&a.push(X7.configure(this.options.blockquote)),this.options.bulletList!==!1&&a.push(g3.configure(this.options.bulletList)),this.options.code!==!1&&a.push(i$.configure(this.options.code)),this.options.codeBlock!==!1&&a.push(c$.configure(this.options.codeBlock)),this.options.document!==!1&&a.push(d$.configure(this.options.document)),this.options.dropcursor!==!1&&a.push(Ez.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&a.push(Tz.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&a.push(u$.configure(this.options.hardBreak)),this.options.heading!==!1&&a.push(h$.configure(this.options.heading)),this.options.undoRedo!==!1&&a.push(Iz.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&a.push(f$.configure(this.options.horizontalRule)),this.options.italic!==!1&&a.push(y$.configure(this.options.italic)),this.options.listItem!==!1&&a.push(x3.configure(this.options.listItem)),this.options.listKeymap!==!1&&a.push(j3.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&a.push(H$.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&a.push(S3.configure(this.options.orderedList)),this.options.paragraph!==!1&&a.push(sz.configure(this.options.paragraph)),this.options.strike!==!1&&a.push(iz.configure(this.options.strike)),this.options.text!==!1&&a.push(oz.configure(this.options.text)),this.options.underline!==!1&&a.push(lz.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&a.push(Pz.configure((r=this.options)==null?void 0:r.trailingNode)),a}}),Lz=Rz,Oz=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Dz=Vn.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",Gt(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,a,i,o;const c=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",u=(a=(r=t.attrs)==null?void 0:r.alt)!=null?a:"",h=(o=(i=t.attrs)==null?void 0:i.title)!=null?o:"";return h?`![${u}](${c} "${h}")`:`![${u}](${c})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:a,getPos:i,HTMLAttributes:o,editor:c})=>{const u=document.createElement("img");Object.entries(o).forEach(([m,g])=>{if(g!=null)switch(m){case"width":case"height":break;default:u.setAttribute(m,g);break}}),u.src=o.src;const h=new z_({element:u,editor:c,node:a,getPos:i,onResize:(m,g)=>{u.style.width=`${m}px`,u.style.height=`${g}px`},onCommit:(m,g)=>{const b=i();b!==void 0&&this.editor.chain().setNodeSelection(b).updateAttributes(this.name,{width:m,height:g}).run()},onUpdate:(m,g,b)=>m.type===a.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),f=h.dom;return f.style.visibility="hidden",f.style.pointerEvents="none",u.onload=()=>{f.style.visibility="",f.style.pointerEvents=""},h}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[XC({find:Oz,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),_z=Dz;function $z(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:o,$position:c}=t,u=r&&!a,h=B_(n),f=new RegExp(`\\s${h}$`),m=o?"^":"",g=a?"":h,b=u?new RegExp(`${m}${h}.*?(?=\\s${g}|$)`,"gm"):new RegExp(`${m}(?:^)?${h}[^\\s${g}]*`,"gm"),N=((e=c.nodeBefore)==null?void 0:e.isText)&&c.nodeBefore.text;if(!N)return null;const j=c.pos-N.length,v=Array.from(N.matchAll(b)).pop();if(!v||v.input===void 0||v.index===void 0)return null;const k=v.input.slice(Math.max(0,v.index-1),v.index),T=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(k);if(i!==null&&!T)return null;const C=j+v.index;let R=C+v[0].length;return u&&f.test(N.slice(R-1,R+1))&&(v[0]+=" ",R+=1),C=c.pos?{range:{from:C,to:R},query:v[0].slice(n.length),text:v[0]}:null}var zz=new wn("suggestion");function Fz({pluginKey:t=zz,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:a=!1,allowedPrefixes:i=[" "],startOfLine:o=!1,decorationTag:c="span",decorationClass:u="suggestion",decorationContent:h="",decorationEmptyClass:f="is-empty",command:m=()=>null,items:g=()=>[],render:b=()=>({}),allow:N=()=>!0,findSuggestionMatch:j=$z,shouldShow:v}){let k;const T=b==null?void 0:b(),C=()=>{const I=e.state.selection.$anchor.pos,z=e.view.coordsAtPos(I),{top:L,right:Q,bottom:se,left:$}=z;try{return new DOMRect($,L,Q-$,se-L)}catch{return null}},R=(I,z)=>z?()=>{const L=t.getState(e.state),Q=L==null?void 0:L.decorationId,se=I.dom.querySelector(`[data-decoration-id="${Q}"]`);return(se==null?void 0:se.getBoundingClientRect())||null}:C;function O(I,z){var L;try{const se=t.getState(I.state),$=se!=null&&se.decorationId?I.dom.querySelector(`[data-decoration-id="${se.decorationId}"]`):null,ie={editor:e,range:(se==null?void 0:se.range)||{from:0,to:0},query:(se==null?void 0:se.query)||null,text:(se==null?void 0:se.text)||null,items:[],command:le=>m({editor:e,range:(se==null?void 0:se.range)||{from:0,to:0},props:le}),decorationNode:$,clientRect:R(I,$)};(L=T==null?void 0:T.onExit)==null||L.call(T,ie)}catch{}const Q=I.state.tr.setMeta(z,{exit:!0});I.dispatch(Q)}const U=new fn({key:t,view(){return{update:async(I,z)=>{var L,Q,se,$,ie,le,me;const P=(L=this.key)==null?void 0:L.getState(z),Y=(Q=this.key)==null?void 0:Q.getState(I.state),F=P.active&&Y.active&&P.range.from!==Y.range.from,ge=!P.active&&Y.active,X=P.active&&!Y.active,B=!ge&&!X&&P.query!==Y.query,W=ge||F&&B,fe=B||F,he=X||F&&B;if(!W&&!fe&&!he)return;const de=he&&!W?P:Y,D=I.dom.querySelector(`[data-decoration-id="${de.decorationId}"]`);k={editor:e,range:de.range,query:de.query,text:de.text,items:[],command:q=>m({editor:e,range:de.range,props:q}),decorationNode:D,clientRect:R(I,D)},W&&((se=T==null?void 0:T.onBeforeStart)==null||se.call(T,k)),fe&&(($=T==null?void 0:T.onBeforeUpdate)==null||$.call(T,k)),(fe||W)&&(k.items=await g({editor:e,query:de.query})),he&&((ie=T==null?void 0:T.onExit)==null||ie.call(T,k)),fe&&((le=T==null?void 0:T.onUpdate)==null||le.call(T,k)),W&&((me=T==null?void 0:T.onStart)==null||me.call(T,k))},destroy:()=>{var I;k&&((I=T==null?void 0:T.onExit)==null||I.call(T,k))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(I,z,L,Q){const{isEditable:se}=e,{composing:$}=e.view,{selection:ie}=I,{empty:le,from:me}=ie,P={...z},Y=I.getMeta(t);if(Y&&Y.exit)return P.active=!1,P.decorationId=null,P.range={from:0,to:0},P.query=null,P.text=null,P;if(P.composing=$,se&&(le||e.view.composing)){(mez.range.to)&&!$&&!z.composing&&(P.active=!1);const F=j({char:n,allowSpaces:r,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:o,$position:ie.$from}),ge=`id_${Math.floor(Math.random()*4294967295)}`;F&&N({editor:e,state:Q,range:F.range,isActive:z.active})&&(!v||v({editor:e,range:F.range,query:F.query,text:F.text,transaction:I}))?(P.active=!0,P.decorationId=z.decorationId?z.decorationId:ge,P.range=F.range,P.query=F.query,P.text=F.text):P.active=!1}else P.active=!1;return P.active||(P.decorationId=null,P.range={from:0,to:0},P.query=null,P.text=null),P}},props:{handleKeyDown(I,z){var L,Q,se,$;const{active:ie,range:le}=U.getState(I.state);if(!ie)return!1;if(z.key==="Escape"||z.key==="Esc"){const P=U.getState(I.state),Y=(L=k==null?void 0:k.decorationNode)!=null?L:null,F=Y??(P!=null&&P.decorationId?I.dom.querySelector(`[data-decoration-id="${P.decorationId}"]`):null);if(((Q=T==null?void 0:T.onKeyDown)==null?void 0:Q.call(T,{view:I,event:z,range:P.range}))||!1)return!0;const X={editor:e,range:P.range,query:P.query,text:P.text,items:[],command:B=>m({editor:e,range:P.range,props:B}),decorationNode:F,clientRect:F?()=>F.getBoundingClientRect()||null:null};return(se=T==null?void 0:T.onExit)==null||se.call(T,X),O(I,t),!0}return(($=T==null?void 0:T.onKeyDown)==null?void 0:$.call(T,{view:I,event:z,range:le}))||!1},decorations(I){const{active:z,range:L,decorationId:Q,query:se}=U.getState(I);if(!z)return null;const $=!(se!=null&&se.length),ie=[u];return $&&ie.push(f),an.create(I.doc,[ts.inline(L.from,L.to,{nodeName:c,class:ie.join(" "),"data-decoration-id":Q,"data-decoration-content":h})])}}});return U}function Bz({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const a=new wn;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 I3(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>Bz({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function Kw(t,e){const n=I3(t),r=n.find(a=>a.char===e);return r||(n.length?n[0]:null)}var Vz=Vn.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",Gt(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=Kw(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Gt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=Gt({"data-type":this.name},this.options.HTMLAttributes,e);const a=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof a=="string"?["span",Gt({"data-type":this.name},this.options.HTMLAttributes,e),a]:a},...ZC({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:Kw(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 Ri,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 I3(this).map(Fz)}}),Hz=Vz,Uz=Az;let P0,I0;if(typeof WeakMap<"u"){let t=new WeakMap;P0=e=>t.get(e),I0=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;P0=r=>{for(let a=0;a(n==10&&(n=0),t[n++]=r,t[n++]=a)}var On=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 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 qz(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 Jz(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 wa(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 em(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=Ql(e.$head)||Qz(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Qz(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 R0(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function Yz(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function sb(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function R3(t,e,n){const r=t.node(-1),a=On.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 Yl(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 L3(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let a=0;af!=n.pos-i);u.unshift(n.pos-i);const h=u.map(f=>{const m=r.nodeAt(f);if(!m)throw new RangeError(`No cell with offset ${f} found`);const g=i+f+1;return new jS(c.resolve(g),c.resolve(g+m.content.size))});super(h[0].$from,h[0].$to,h),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),a=e.resolve(n.map(this.$headCell.pos));if(R0(r)&&R0(a)&&sb(r,a)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?ji.rowSelection(r,a):i&&this.isColSelection()?ji.colSelection(r,a):new ji(r,a)}return ot.between(r,a)}content(){const e=this.$anchorCell.node(-1),n=On.get(e),r=this.$anchorCell.start(-1),a=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},o=[];for(let u=a.top;u0||v>0){let k=N.attrs;if(j>0&&(k=Yl(k,0,j)),v>0&&(k=Yl(k,k.colspan-v,v)),b.lefta.bottom){const k={...N.attrs,rowspan:Math.min(b.bottom,a.bottom)-Math.max(b.top,a.top)};b.top0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,a=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,a)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),a=On.get(r),i=e.start(-1),o=a.findCell(e.pos-i),c=a.findCell(n.pos-i),u=e.node(0);return o.top<=c.top?(o.top>0&&(e=u.resolve(i+a.map[o.left])),c.bottom0&&(n=u.resolve(i+a.map[c.left])),o.bottom0)return!1;const o=a+this.$anchorCell.nodeAfter.attrs.colspan,c=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,c)==n.width}eq(e){return e instanceof ji&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),a=On.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(ts.node(r,r+n.nodeSize,{class:"selectedCell"}))}),an.create(t.doc,e)}function tF({$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 nF({$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 sF(t,e,n){const r=(e||t).selection,a=(e||t).doc;let i,o;if(r instanceof it&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")i=hn.create(a,r.from);else if(o=="row"){const c=a.resolve(r.from+1);i=hn.rowSelection(c,c)}else if(!n){const c=On.get(r.node),u=r.from+1,h=u+c.map[c.width*c.height-1];i=hn.create(a,u+1,h)}}else r instanceof ot&&tF(r)?i=ot.create(a,r.from):r instanceof ot&&nF(r)&&(i=ot.create(a,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}const rF=new wn("fix-tables");function D3(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=aF(t,a,i,n))};return e?e.doc!=t.doc&&D3(e.doc,t.doc,0,r):t.doc.descendants(r),n}function aF(t,e,n,r){const a=On.get(e);if(!a.problems)return r;r||(r=t.tr);const i=[];for(let u=0;u0){let b="cell";f.firstChild&&(b=f.firstChild.type.spec.tableRole);const N=[];for(let v=0;v0?-1:0;Xz(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;dF(e,r,a+c)&&(c=a==0||a==e.height?null:0);for(let h=0,f=e.width*a;h0&&a0&&m==e.map[f-e.width]){const g=n.nodeAt(m).attrs;t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...g,rowspan:g.rowspan-1}),h+=g.colspan-1}else if(a0&&n[i]==n[i-1]||r.right0&&n[a]==n[a-t]||r.bottom0){const f=u+1+h.content.size,m=qw(h)?u+1:f;i.replaceWith(m+r.tableStart,f+r.tableStart,c)}i.setSelection(new hn(i.doc.resolve(u+r.tableStart))),e(i)}return!0}function Jw(t,e){const n=_s(t.schema);return gF(({node:r})=>n[r.type.spec.tableRole])(t,e)}function gF(t){return(e,n)=>{const r=e.selection;let a,i;if(r instanceof hn){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;a=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{var o;if(a=Jz(r.$from),!a)return!1;i=(o=Ql(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=Ga(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 yF(t){return function(e,n){if(!wa(e))return!1;if(n){const r=_s(e.schema),a=Ga(e),i=e.tr,o=a.map.cellsInRect(t=="column"?{left:a.left,top:0,right:a.right,bottom:a.map.height}:t=="row"?{left:0,top:a.top,right:a.map.width,bottom:a.bottom}:a),c=o.map(u=>a.table.nodeAt(u));for(let u=0;u{const b=g+i.tableStart,N=o.doc.nodeAt(b);N&&o.setNodeMarkup(b,m,N.attrs)}),r(o)}return!0}}Du("row",{useDeprecatedLogic:!0});Du("column",{useDeprecatedLogic:!0});const bF=Du("cell",{useDeprecatedLogic:!0});function vF(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 uf(t,e){const n=t.selection;if(!(n instanceof hn))return!1;if(e){const r=t.tr,a=_s(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 ze(a,0,0))}),r.docChanged&&e(r)}return!0}function wF(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const a=e.child(0),i=a.type.spec.tableRole,o=a.type.schema,c=[];if(i=="row")for(let u=0;u=0;o--){const{rowspan:c,colspan:u}=i.child(o).attrs;for(let h=a;h=e.length&&e.push(Ce.empty),n[a]r&&(g=g.type.createChecked(Yl(g.attrs,g.attrs.colspan,f+g.attrs.colspan-r),g.content)),h.push(g),f+=g.attrs.colspan;for(let b=1;ba&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,a-m.attrs.rowspan)},m.content)),u.push(m)}i.push(Ce.from(u))}n=i,e=a}return{width:t,height:e,rows:n}}function SF(t,e,n,r,a,i,o){const c=t.doc.type.schema,u=_s(c);let h,f;if(a>e.width)for(let m=0,g=0;me.height){const m=[];for(let N=0,j=(e.height-1)*e.width;N=e.width?!1:n.nodeAt(e.map[j+N]).type==u.header_cell;m.push(v?f||(f=u.header_cell.createAndFill()):h||(h=u.cell.createAndFill()))}const g=u.row.create(null,Ce.from(m)),b=[];for(let N=e.height;N{if(!a)return!1;const i=n.selection;if(i instanceof hn)return jf(n,r,ft.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const o=F3(a,t,e);if(o==null)return!1;if(t=="horiz")return jf(n,r,ft.near(n.doc.resolve(i.head+e),e));{const c=n.doc.resolve(o),u=R3(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),jf(n,r,h)}}}function ff(t,e){return(n,r,a)=>{if(!a)return!1;const i=n.selection;let o;if(i instanceof hn)o=i;else{const u=F3(a,t,e);if(u==null)return!1;o=new hn(n.doc.resolve(u))}const c=R3(o.$headCell,t,e);return c?jf(n,r,new hn(o.$anchorCell,c)):!1}}function EF(t,e){const n=t.state.doc,r=Ql(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new hn(r))),!0):!1}function TF(t,e,n){if(!wa(t.state))return!1;let r=wF(n);const a=t.state.selection;if(a instanceof hn){r||(r={width:1,height:1,rows:[Ce.from(L0(_s(t.state.schema).cell,n))]});const i=a.$anchorCell.node(-1),o=a.$anchorCell.start(-1),c=On.get(i).rectBetween(a.$anchorCell.pos-o,a.$headCell.pos-o);return r=kF(r,c.right-c.left,c.bottom-c.top),ej(t.state,t.dispatch,o,c,r),!0}else if(r){const i=em(t.state),o=i.start(-1);return ej(t.state,t.dispatch,o,On.get(i.node(-1)).findCell(i.pos-o),r),!0}else return!1}function MF(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=tj(t,e.target);let a;if(e.shiftKey&&t.state.selection instanceof hn)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(a=Ql(t.state.selection.$anchor))!=null&&((n=Tx(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=Tx(t,h);const m=wo.getState(t.state)==null;if(!f||!sb(u,f))if(m)f=u;else return;const g=new hn(u,f);if(m||!t.state.selection.eq(g)){const b=t.state.tr.setSelection(g);m&&b.setMeta(wo,u.pos),t.dispatch(b)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",c),wo.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(wo,-1))}function c(u){const h=u,f=wo.getState(t.state);let m;if(f!=null)m=t.state.doc.resolve(f);else if(tj(t,h.target)!=r&&(m=Tx(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 F3(t,e,n){if(!(t.state.selection instanceof ot))return null;const{$head:r}=t.state.selection;for(let a=r.depth-1;a>=0;a--){const i=r.node(a);if((n<0?r.index(a):r.indexAfter(a))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const o=r.before(a),c=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?o:null}}return null}function tj(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Tx(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&&Ql(t.state.doc.resolve(r))||Ql(t.state.doc.resolve(a))}var AF=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")),O0(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,O0(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function O0(t,e,n,r,a,i){let o=0,c=!0,u=e.firstChild;const h=t.firstChild;if(h){for(let m=0,g=0;mnew r(m,n,g)),new IF(-1,!1)},apply(o,c){return c.apply(o)}},props:{attributes:o=>{const c=Tr.getState(o);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,c)=>{RF(o,c,t,a)},mouseleave:o=>{LF(o)},mousedown:(o,c)=>{OF(o,c,e,n)}},decorations:o=>{const c=Tr.getState(o);if(c&&c.activeHandle>-1)return FF(o,c.activeHandle)},nodeViews:{}}});return i}var IF=class kf{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Tr);if(r&&r.setHandle!=null)return new kf(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new kf(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let a=e.mapping.map(n.activeHandle,-1);return R0(e.doc.resolve(a))||(a=-1),new kf(a,n.dragging)}return n}};function RF(t,e,n,r){if(!t.editable)return;const a=Tr.getState(t.state);if(a&&!a.dragging){const i=_F(e.target);let o=-1;if(i){const{left:c,right:u}=i.getBoundingClientRect();e.clientX-c<=n?o=nj(t,e,"left",n):u-e.clientX<=n&&(o=nj(t,e,"right",n))}if(o!=a.activeHandle){if(!r&&o!==-1){const c=t.state.doc.resolve(o),u=c.node(-1),h=On.get(u),f=c.start(-1);if(h.colCount(c.pos-f)+c.nodeAfter.attrs.colspan-1==h.width-1)return}B3(t,o)}}}function LF(t){if(!t.editable)return;const e=Tr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&B3(t,-1)}function OF(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=Tr.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const c=t.state.doc.nodeAt(o.activeHandle),u=DF(t,o.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta(Tr,{setDragging:{startX:e.clientX,startWidth:u}}));function h(m){i.removeEventListener("mouseup",h),i.removeEventListener("mousemove",f);const g=Tr.getState(t.state);g!=null&&g.dragging&&($F(t,g.activeHandle,sj(g.dragging,m,n)),t.dispatch(t.state.tr.setMeta(Tr,{setDragging:null})))}function f(m){if(!m.which)return h(m);const g=Tr.getState(t.state);if(g&&g.dragging){const b=sj(g.dragging,m,n);rj(t,g.activeHandle,b,r)}}return rj(t,o.activeHandle,u,r),i.addEventListener("mouseup",h),i.addEventListener("mousemove",f),e.preventDefault(),!0}function DF(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",Gt(this.options.HTMLAttributes,t),0]}}),H3=Vn.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",Gt(this.options.HTMLAttributes,t),0]}}),U3=Vn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Gt(this.options.HTMLAttributes,t),0]}});function D0(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function aj(t,e,n,r,a,i){var o;let c=0,u=!0,h=e.firstChild;const f=t.firstChild;if(f!==null)for(let g=0,b=0;g{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function WF(t,e,n,r,a){const i=UF(t),o=[],c=[];for(let h=0;h{const{selection:e}=t.state;if(!KF(e))return!1;let n=0;const r=EC(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},qF="";function GF(t){return(t||"").replace(/\s+/g," ").trim()}function JF(t,e,n={}){var r;const a=(r=n.cellLineSeparator)!=null?r:qF;if(!t||!t.content||t.content.length===0)return"";const i=[];t.content.forEach(N=>{const j=[];N.content&&N.content.forEach(v=>{let k="";v.content&&Array.isArray(v.content)&&v.content.length>1?k=v.content.map(O=>e.renderChildren(O)).join(a):k=v.content?e.renderChildren(v.content):"";const T=GF(k),C=v.type==="tableHeader";j.push({text:T,isHeader:C})}),i.push(j)});const o=i.reduce((N,j)=>Math.max(N,j.length),0);if(o===0)return"";const c=new Array(o).fill(0);i.forEach(N=>{var j;for(let v=0;vc[v]&&(c[v]=T),c[v]<3&&(c[v]=3)}});const u=(N,j)=>N+" ".repeat(Math.max(0,j-N.length)),h=i[0],f=h.some(N=>N.isHeader);let m=` -`;const g=new Array(o).fill(0).map((N,j)=>f&&h[j]&&h[j].text||"");return m+=`| ${g.map((N,j)=>u(N,c[j])).join(" | ")} | -`,m+=`| ${c.map(N=>"-".repeat(Math.max(3,N))).join(" | ")} | -`,(f?i.slice(1):i).forEach(N=>{m+=`| ${new Array(o).fill(0).map((j,v)=>u(N[v]&&N[v].text||"",c[v])).join(" | ")} | -`}),m}var QF=JF,W3=Vn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:VF,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}=HF(t,this.options.cellMinWidth),i=e.style;function o(){return i||(r?`width: ${r}`:`min-width: ${a}`)}const c=["table",Gt(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)=>QF(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:a,editor:i})=>{const o=WF(i.schema,t,e,n);if(a){const c=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(ot.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>iF(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>oF(t,e),deleteColumn:()=>({state:t,dispatch:e})=>cF(t,e),addRowBefore:()=>({state:t,dispatch:e})=>uF(t,e),addRowAfter:()=>({state:t,dispatch:e})=>hF(t,e),deleteRow:()=>({state:t,dispatch:e})=>pF(t,e),deleteTable:()=>({state:t,dispatch:e})=>NF(t,e),mergeCells:()=>({state:t,dispatch:e})=>Gw(t,e),splitCell:()=>({state:t,dispatch:e})=>Jw(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Du("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Du("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>bF(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Gw(t,e)?!0:Jw(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>xF(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Yw(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Yw(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&_3(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=hn.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:pf,"Mod-Backspace":pf,Delete:pf,"Mod-Delete":pf}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[PF({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],BF({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:Kt(rt(t,"tableRole",e))}}});Dn.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(W3.configure(this.options.table)),this.options.tableCell!==!1&&t.push(V3.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(H3.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(U3.configure(this.options.tableRow)),t}});function YF(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function XF(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}function ZF(t){if(!t)return"";let e=t;return e=e.replace(/]*>(.*?)<\/h1>/gi,`# $1 -======== -`);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[x0({find:a$,type:this.type,getAttributes:t=>({language:t[1]})}),x0({find:i$,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new un({key:new vn("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),a=r?JSON.parse(r):void 0,i=a==null?void 0:a.mode;if(!n||!i)return!1;const{tr:o,schema:c}=t.state,u=c.text(n.replace(/\r\n?/g,` -`));return o.replaceSelectionWith(this.type.create({language:i},u)),o.selection.$from.parent.type!==this.type&&o.setSelection(ot.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),l$=Fn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` - -`):""}),c$=Fn.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Gt(this.options.HTMLAttributes,t)]},renderText(){return` -`},renderMarkdown:()=>` -`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:a,storedMarks:i}=n;if(a.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:c}=r.extensionManager,u=i||a.$to.parentOffset&&a.$from.marks();return e().insertContent({type:this.name}).command(({tr:h,dispatch:f})=>{if(f&&u&&o){const m=u.filter(g=>c.includes(g.type.name));h.ensureMarks(m)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),d$=Fn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Gt(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=>x0({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),u$=Fn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Gt(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!$_(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,a=t();return RC(n)?a.insertContentAt(r.pos,{type:this.name}):a.insertContent({type:this.name}),a.command(({state:i,tr:o,dispatch:c})=>{if(c){const{$to:u}=o.selection,h=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?o.setSelection(ot.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(it.create(o.doc,u.pos)):o.setSelection(ot.create(o.doc,u.pos));else{const f=i.schema.nodes[this.options.nextNodeType]||u.parent.type.contentMatch.defaultType,m=f==null?void 0:f.create();m&&(o.insert(h,m),o.setSelection(ot.create(o.doc,h+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[QC({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),h$=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,f$=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,p$=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,m$=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,g$=nc.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",Gt(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[sd({find:h$,type:this.type}),sd({find:p$,type:this.type})]},addPasteRules(){return[Gl({find:f$,type:this.type}),Gl({find:m$,type:this.type})]}});const x$="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",y$="ελ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",v0="numeric",N0="ascii",w0="alpha",mu="asciinumeric",au="alphanumeric",j0="domain",a3="emoji",b$="scheme",v$="slashscheme",bx="whitespace";function N$(t,e){return t in e||(e[t]=[]),e[t]}function Al(t,e,n){e[v0]&&(e[mu]=!0,e[au]=!0),e[N0]&&(e[mu]=!0,e[w0]=!0),e[mu]&&(e[au]=!0),e[w0]&&(e[au]=!0),e[au]&&(e[j0]=!0),e[a3]&&(e[j0]=!0);for(const r in e){const a=N$(r,n);a.indexOf(t)<0&&a.push(t)}}function w$(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function cr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}cr.groups={};cr.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;rt.ta(e,n,r,a),An=(t,e,n,r,a)=>t.tr(e,n,r,a),Ew=(t,e,n,r,a)=>t.ts(e,n,r,a),Re=(t,e,n,r,a)=>t.tt(e,n,r,a),Ni="WORD",k0="UWORD",i3="ASCIINUMERICAL",o3="ALPHANUMERICAL",Ru="LOCALHOST",S0="TLD",C0="UTLD",vf="SCHEME",$c="SLASH_SCHEME",Uy="NUM",E0="WS",Wy="NL",gu="OPENBRACE",xu="CLOSEBRACE",Jf="OPENBRACKET",Qf="CLOSEBRACKET",Yf="OPENPAREN",Xf="CLOSEPAREN",Zf="OPENANGLEBRACKET",ep="CLOSEANGLEBRACKET",tp="FULLWIDTHLEFTPAREN",np="FULLWIDTHRIGHTPAREN",sp="LEFTCORNERBRACKET",rp="RIGHTCORNERBRACKET",ap="LEFTWHITECORNERBRACKET",ip="RIGHTWHITECORNERBRACKET",op="FULLWIDTHLESSTHAN",lp="FULLWIDTHGREATERTHAN",cp="AMPERSAND",dp="APOSTROPHE",up="ASTERISK",xo="AT",hp="BACKSLASH",fp="BACKTICK",pp="CARET",vo="COLON",Ky="COMMA",mp="DOLLAR",Da="DOT",gp="EQUALS",qy="EXCLAMATION",Hr="HYPHEN",yu="PERCENT",xp="PIPE",yp="PLUS",bp="POUND",bu="QUERY",Gy="QUOTE",l3="FULLWIDTHMIDDLEDOT",Jy="SEMI",_a="SLASH",vu="TILDE",vp="UNDERSCORE",c3="EMOJI",Np="SYM";var d3=Object.freeze({__proto__:null,ALPHANUMERICAL:o3,AMPERSAND:cp,APOSTROPHE:dp,ASCIINUMERICAL:i3,ASTERISK:up,AT:xo,BACKSLASH:hp,BACKTICK:fp,CARET:pp,CLOSEANGLEBRACKET:ep,CLOSEBRACE:xu,CLOSEBRACKET:Qf,CLOSEPAREN:Xf,COLON:vo,COMMA:Ky,DOLLAR:mp,DOT:Da,EMOJI:c3,EQUALS:gp,EXCLAMATION:qy,FULLWIDTHGREATERTHAN:lp,FULLWIDTHLEFTPAREN:tp,FULLWIDTHLESSTHAN:op,FULLWIDTHMIDDLEDOT:l3,FULLWIDTHRIGHTPAREN:np,HYPHEN:Hr,LEFTCORNERBRACKET:sp,LEFTWHITECORNERBRACKET:ap,LOCALHOST:Ru,NL:Wy,NUM:Uy,OPENANGLEBRACKET:Zf,OPENBRACE:gu,OPENBRACKET:Jf,OPENPAREN:Yf,PERCENT:yu,PIPE:xp,PLUS:yp,POUND:bp,QUERY:bu,QUOTE:Gy,RIGHTCORNERBRACKET:rp,RIGHTWHITECORNERBRACKET:ip,SCHEME:vf,SEMI:Jy,SLASH:_a,SLASH_SCHEME:$c,SYM:Np,TILDE:vu,TLD:S0,UNDERSCORE:vp,UTLD:C0,UWORD:k0,WORD:Ni,WS:E0});const bi=/[a-z]/,eu=new RegExp("\\p{L}","u"),vx=new RegExp("\\p{Emoji}","u"),vi=/\d/,Nx=/\s/,Tw="\r",wx=` -`,j$="️",k$="‍",jx="";let af=null,of=null;function S$(t=[]){const e={};cr.groups=e;const n=new cr;af==null&&(af=Mw(x$)),of==null&&(of=Mw(y$)),Re(n,"'",dp),Re(n,"{",gu),Re(n,"}",xu),Re(n,"[",Jf),Re(n,"]",Qf),Re(n,"(",Yf),Re(n,")",Xf),Re(n,"<",Zf),Re(n,">",ep),Re(n,"(",tp),Re(n,")",np),Re(n,"「",sp),Re(n,"」",rp),Re(n,"『",ap),Re(n,"』",ip),Re(n,"<",op),Re(n,">",lp),Re(n,"&",cp),Re(n,"*",up),Re(n,"@",xo),Re(n,"`",fp),Re(n,"^",pp),Re(n,":",vo),Re(n,",",Ky),Re(n,"$",mp),Re(n,".",Da),Re(n,"=",gp),Re(n,"!",qy),Re(n,"-",Hr),Re(n,"%",yu),Re(n,"|",xp),Re(n,"+",yp),Re(n,"#",bp),Re(n,"?",bu),Re(n,'"',Gy),Re(n,"/",_a),Re(n,";",Jy),Re(n,"~",vu),Re(n,"_",vp),Re(n,"\\",hp),Re(n,"・",l3);const r=An(n,vi,Uy,{[v0]:!0});An(r,vi,r);const a=An(r,bi,i3,{[mu]:!0}),i=An(r,eu,o3,{[au]:!0}),o=An(n,bi,Ni,{[N0]:!0});An(o,vi,a),An(o,bi,o),An(a,vi,a),An(a,bi,a);const c=An(n,eu,k0,{[w0]:!0});An(c,bi),An(c,vi,i),An(c,eu,c),An(i,vi,i),An(i,bi),An(i,eu,i);const u=Re(n,wx,Wy,{[bx]:!0}),h=Re(n,Tw,E0,{[bx]:!0}),f=An(n,Nx,E0,{[bx]:!0});Re(n,jx,f),Re(h,wx,u),Re(h,jx,f),An(h,Nx,f),Re(f,Tw),Re(f,wx),An(f,Nx,f),Re(f,jx,f);const m=An(n,vx,c3,{[a3]:!0});Re(m,"#"),An(m,vx,m),Re(m,j$,m);const g=Re(m,k$);Re(g,"#"),An(g,vx,m);const b=[[bi,o],[vi,a]],N=[[bi,null],[eu,c],[vi,i]];for(let j=0;jj[0]>v[0]?1:-1);for(let j=0;j=0?T[j0]=!0:bi.test(v)?vi.test(v)?T[mu]=!0:T[N0]=!0:T[v0]=!0,Ew(n,v,v,T)}return Ew(n,"localhost",Ru,{ascii:!0}),n.jd=new cr(Np),{start:n,tokens:Object.assign({groups:e},d3)}}function u3(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,g++),h+=n[o].length,i+=n[o].length,o++;i-=m,o-=g,h-=m,a.push({t:f.t,v:e.slice(i-h,i),s:i-h,e:i})}return a}function 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 ho(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 Lu={defaultProtocol:"http",events:null,format:Aw,formatHref:Aw,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Qy(t,e=null){let n=Object.assign({},Lu);t&&(n=Object.assign(n,t instanceof Qy?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=Lu.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 Xp(t,e){class n extends h3{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 Iw=Xp("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Pw=Xp("text"),E$=Xp("nl"),lf=Xp("url",{isLink:!0,toHref(t=Lu.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Ru&&t[1].t===vo}}),Vr=t=>new cr(t);function T$({groups:t}){const e=t.domain.concat([cp,up,xo,hp,fp,pp,mp,gp,Hr,Uy,yu,xp,yp,bp,_a,Np,vu,vp]),n=[dp,vo,Ky,Da,qy,yu,bu,Gy,Jy,Zf,ep,gu,xu,Qf,Jf,Yf,Xf,tp,np,sp,rp,ap,ip,op,lp],r=[cp,dp,up,hp,fp,pp,mp,gp,Hr,gu,xu,yu,xp,yp,bp,bu,_a,Np,vu,vp],a=Vr(),i=Re(a,vu);Et(i,r,i),Et(i,t.domain,i);const o=Vr(),c=Vr(),u=Vr();Et(a,t.domain,o),Et(a,t.scheme,c),Et(a,t.slashscheme,u),Et(o,r,i),Et(o,t.domain,o);const h=Re(o,xo);Re(i,xo,h),Re(c,xo,h),Re(u,xo,h);const f=Re(i,Da);Et(f,r,i),Et(f,t.domain,i);const m=Vr();Et(h,t.domain,m),Et(m,t.domain,m);const g=Re(m,Da);Et(g,t.domain,m);const b=Vr(Iw);Et(g,t.tld,b),Et(g,t.utld,b),Re(h,Ru,b);const N=Re(m,Hr);Re(N,Hr,N),Et(N,t.domain,m),Et(b,t.domain,m),Re(b,Da,g),Re(b,Hr,N);const j=Re(b,vo);Et(j,t.numeric,Iw);const v=Re(o,Hr),k=Re(o,Da);Re(v,Hr,v),Et(v,t.domain,o),Et(k,r,i),Et(k,t.domain,o);const T=Vr(lf);Et(k,t.tld,T),Et(k,t.utld,T),Et(T,t.domain,o),Et(T,r,i),Re(T,Da,k),Re(T,Hr,v),Re(T,xo,h);const C=Re(T,vo),R=Vr(lf);Et(C,t.numeric,R);const O=Vr(lf),U=Vr();Et(O,e,O),Et(O,n,U),Et(U,e,O),Et(U,n,U),Re(T,_a,O),Re(R,_a,O);const P=Re(c,vo),z=Re(u,vo),L=Re(z,_a),Q=Re(L,_a);Et(c,t.domain,o),Re(c,Da,k),Re(c,Hr,v),Et(u,t.domain,o),Re(u,Da,k),Re(u,Hr,v),Et(P,t.domain,O),Re(P,_a,O),Re(P,bu,O),Et(Q,t.domain,O),Et(Q,e,O),Re(Q,_a,O);const se=[[gu,xu],[Jf,Qf],[Yf,Xf],[Zf,ep],[tp,np],[sp,rp],[ap,ip],[op,lp]];for(let $=0;$=0&&g++,a++,f++;if(g<0)a-=f,a0&&(i.push(kx(Pw,e,o)),o=[]),a-=g,f-=g;const b=m.t,N=n.slice(a-f,a);i.push(kx(b,e,N))}}return o.length>0&&i.push(kx(Pw,e,o)),i}function kx(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 A$=typeof console<"u"&&console&&console.warn||(()=>{}),I$="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",gn={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function P$(){return cr.groups={},gn.scanner=null,gn.parser=null,gn.tokenQueue=[],gn.pluginQueue=[],gn.customSchemes=[],gn.initialized=!1,gn}function Rw(t,e=!1){if(gn.initialized&&A$(`linkifyjs: already initialized - will not register custom scheme "${t}" ${I$}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format. -1. Must only contain digits, lowercase ASCII letters or "-" -2. Cannot start or end with "-" -3. "-" cannot repeat`);gn.customSchemes.push([t,e])}function R$(){gn.scanner=S$(gn.customSchemes);for(let t=0;t{const a=e.some(h=>h.docChanged)&&!n.doc.eq(r.doc),i=e.some(h=>h.getMeta("preventAutolink"));if(!a||i)return;const{tr:o}=r,c=kC(n.doc,[...e]);if(PC(c).forEach(({newRange:h})=>{const f=_D(r.doc,h,b=>b.isTextblock);let m,g;if(f.length>1)m=f[0],g=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(f.length){const b=r.doc.textBetween(h.from,h.to," "," ");if(!O$.test(b))return;m=f[0],g=r.doc.textBetween(m.pos,h.to,void 0," ")}if(m&&g){const b=g.split(L$).filter(Boolean);if(b.length<=0)return!1;const N=b[b.length-1],j=m.pos+g.lastIndexOf(N);if(!N)return!1;const v=Yy(N).map(k=>k.toObject(t.defaultProtocol));if(!_$(v))return!1;v.filter(k=>k.isLink).map(k=>({...k,from:j+k.start+1,to:j+k.end+1})).filter(k=>r.schema.marks.code?!r.doc.rangeHasMark(k.from,k.to,r.schema.marks.code):!0).filter(k=>t.validate(k.value)).filter(k=>t.shouldAutoLink(k.value)).forEach(k=>{$y(k.from,k.to,r.doc).some(T=>T.mark.type===t.type)||o.addMark(k.from,k.to,t.type.create({href:k.href}))})}}),!!o.steps.length)return o}})}function z$(t){return new un({key:new vn("handleClickLink"),props:{handleClick:(e,n,r)=>{var a,i;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const u=r.target;if(!u)return!1;const h=t.editor.view.dom;o=u.closest("a"),o&&!h.contains(o)&&(o=null)}if(!o)return!1;let c=!1;if(t.enableClickSelection&&(c=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const u=IC(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 F$(t){return new un({key:new vn("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:a}=t,{state:i}=e,{selection:o}=i,{empty:c}=o;if(c)return!1;let u="";r.content.forEach(f=>{u+=f.textContent});const h=f3(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 kl(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(D$,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var B$=nc.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"){Rw(t);return}Rw(t.scheme,t.optionalSlashes)})},onDestroy(){P$()},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)=>!!kl(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=>!!kl(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=>!!kl(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Gt(this.options.HTMLAttributes,t),0]:["a",Gt(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=>!!kl(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=>!!kl(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[Gl({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,a=f3(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!kl(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($$({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:a=>!!kl(a,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(z$({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(F$({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),V$=Object.defineProperty,H$=(t,e)=>{for(var n in e)V$(t,n,{get:e[n],enumerable:!0})},U$="listItem",Lw="textStyle",Ow=/^\s*([-+*])\s$/,p3=Fn.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Gt(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(U$,this.editor.getAttributes(Lw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=rd({find:Ow,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=rd({find:Ow,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Lw),editor:this.editor})),[t]}}),m3=Fn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Gt(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)=>Vy(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)}}}),W$={};H$(W$,{findListItemPos:()=>Uu,getNextListDepth:()=>Zy,handleBackspace:()=>T0,handleDelete:()=>M0,hasListBefore:()=>g3,hasListItemAfter:()=>K$,hasListItemBefore:()=>x3,listItemHasSubList:()=>y3,nextListIsDeeper:()=>b3,nextListIsHigher:()=>v3});var Uu=(t,e)=>{const{$from:n}=e.selection,r=Kn(t,e.schema);let a=null,i=n.depth,o=n.pos,c=null;for(;i>0&&c===null;)a=n.node(i),a.type===r?c=i:(i-=1,o-=1);return c===null?null:{$pos:e.doc.resolve(o),depth:c}},Zy=(t,e)=>{const n=Uu(t,e);if(!n)return!1;const[,r]=qD(e,t,n.$pos.pos+4);return r},g3=(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))},x3=(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)},y3=(t,e,n)=>{if(!n)return!1;const r=Kn(t,e.schema);let a=!1;return n.descendants(i=>{i.type===r&&(a=!0)}),a},T0=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Fo(t.state,e)&&g3(t.state,e,n)){const{$anchor:c}=t.state.selection,u=t.state.doc.resolve(c.before()-1),h=[];u.node().descendants((g,b)=>{g.type.name===e&&h.push({node:g,pos:b})});const f=h.at(-1);if(!f)return!1;const m=t.state.doc.resolve(u.start()+f.pos+1);return t.chain().cut({from:c.start()-1,to:c.end()+1},m.end()).joinForward().run()}if(!Fo(t.state,e)||!YD(t.state))return!1;const r=Uu(e,t.state);if(!r)return!1;const i=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=y3(e,t.state,i);return x3(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},b3=(t,e)=>{const n=Zy(t,e),r=Uu(t,e);return!r||!n?!1:n>r.depth},v3=(t,e)=>{const n=Zy(t,e),r=Uu(t,e);return!r||!n?!1:n{if(!Fo(t.state,e)||!QD(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:a}=n;return!n.empty&&r.sameParent(a)?!1:b3(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():v3(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},K$=(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)},N3=Ln.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&M0(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&&M0(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&&T0(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&&T0(t,n,r)&&(e=!0)}),e}}}}),Dw=/^(\s*)(\d+)\.\s+(.*)$/,q$=/^\s/;function G$(t){const e=[];let n=0,r=0;for(;ne;)g.push(t[m]),m+=1;if(g.length>0){const b=Math.min(...g.map(j=>j.indent)),N=w3(g,b,n);h.push({type:"list",ordered:!0,start:g[0].number,items:N,raw:g.map(j=>j.raw).join(` -`)})}a.push({type:"list_item",raw:o.raw,tokens:h}),i=m}else i+=1}return a}function J$(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 Q$="listItem",_w="textStyle",$w=/^(\d+)\.\s$/,j3=Fn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Gt(this.options.HTMLAttributes,n),0]:["ol",Gt(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?J$(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]=G$(a);if(i.length===0)return;const c=w3(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(Q$,this.editor.getAttributes(_w)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=rd({find:$w,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=rd({find:$w,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(_w)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),Y$=/^\s*(\[([( |x])?\])\s$/,X$=Fn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Gt(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 Vy(t,e,a)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const a=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),c=document.createElement("input"),u=document.createElement("div"),h=m=>{var g,b;c.ariaLabel=((b=(g=this.options.a11y)==null?void 0:g.checkboxLabel)==null?void 0:b.call(g,m,c.checked))||`Task item checkbox for ${m.textContent||"empty task item"}`};h(t),i.contentEditable="false",c.type="checkbox",c.addEventListener("mousedown",m=>m.preventDefault()),c.addEventListener("change",m=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){c.checked=!c.checked;return}const{checked:g}=m.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:b})=>{const N=n();if(typeof N!="number")return!1;const j=b.doc.nodeAt(N);return b.setNodeMarkup(N,void 0,{...j==null?void 0:j.attrs,checked:g}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,g)||(c.checked=!c.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([m,g])=>{a.setAttribute(m,g)}),a.dataset.checked=t.attrs.checked,c.checked=t.attrs.checked,i.append(c,o),a.append(i,u),Object.entries(e).forEach(([m,g])=>{a.setAttribute(m,g)});let f=new Set(Object.keys(e));return{dom:a,contentDOM:u,update:m=>{if(m.type!==this.type)return!1;a.dataset.checked=m.attrs.checked,c.checked=m.attrs.checked,h(m);const g=r.extensionManager.attributes,b=Pu(m,g),N=new Set(Object.keys(b)),j=this.options.HTMLAttributes;return f.forEach(v=>{N.has(v)||(v in j?a.setAttribute(v,j[v]):a.removeAttribute(v))}),Object.entries(b).forEach(([v,k])=>{k==null?v in j?a.setAttribute(v,j[v]):a.removeAttribute(v):a.setAttribute(v,k)}),f=N,!0}}}},addInputRules(){return[rd({find:Y$,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Z$=Fn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",Gt(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=y0(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=y0(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},n);if(a)return{type:"taskList",raw:a.raw,items:a.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Ln.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(p3.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(m3.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(N3.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(j3.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(X$.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Z$.configure(this.options.taskList)),t}});var zw=" ",ez=" ",tz=Fn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Gt(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===zw||r[0].text===ez)?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?zw:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),nz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,sz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,rz=nc.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",Gt(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[sd({find:nz,type:this.type})]},addPasteRules(){return[Gl({find:sz,type:this.type})]}}),az=Fn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),iz=nc.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",Gt(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 oz(t={}){return new un({view(e){return new lz(e,t)}})}class lz{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(a=>{let i=o=>{this[a](o)};return e.dom.addEventListener(a,i),{name:a,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,a=this.editorView.dom,i=a.getBoundingClientRect(),o=i.width/a.offsetWidth,c=i.height/a.offsetHeight;if(n){let m=e.nodeBefore,g=e.nodeAfter;if(m||g){let b=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(b){let N=b.getBoundingClientRect(),j=m?N.bottom:N.top;m&&g&&(j=(j+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let v=this.width/2*c;r={left:N.left,right:N.right,top:j-v,bottom:j+v}}}}if(!r){let m=this.editorView.coordsAtPos(this.cursorPos),g=this.width/2*o;r={left:m.left-g,right:m.left+g,top:m.top,bottom:m.bottom}}let u=this.editorView.dom.offsetParent;this.element||(this.element=u.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let h,f;if(!u||u==document.body&&getComputedStyle(u).position=="static")h=-pageXOffset,f=-pageYOffset;else{let m=u.getBoundingClientRect(),g=m.width/u.offsetWidth,b=m.height/u.offsetHeight;h=m.left-u.scrollLeft*g,f=m.top-u.scrollTop*b}this.element.style.left=(r.left-h)/o+"px",this.element.style.top=(r.top-f)/c+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/c+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),a=r&&r.type.spec.disableDropCursor,i=typeof a=="function"?a(this.editorView,n,e):a;if(n&&!i){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=gS(this.editorView.state.doc,o,this.editorView.dragging.slice);c!=null&&(o=c)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Pn extends ft{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Pn.valid(r)?new Pn(r):ft.near(r)}content(){return ze.empty}eq(e){return e instanceof Pn&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Pn(e.resolve(n.pos))}getBookmark(){return new eb(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!cz(e)||!dz(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let a=n.contentMatchAt(e.index()).defaultType;return a&&a.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Pn.valid(e))return e;let a=e.pos,i=null;for(let o=e.depth;;o--){let c=e.node(o);if(n>0?e.indexAfter(o)0){i=c.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;a+=n;let u=e.doc.resolve(a);if(Pn.valid(u))return u}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!it.isSelectable(i)){e=e.doc.resolve(a+i.nodeSize*n),r=!1;continue e}break}i=o,a+=n;let c=e.doc.resolve(a);if(Pn.valid(c))return c}return null}}}Pn.prototype.visible=!1;Pn.findFrom=Pn.findGapCursorFrom;ft.jsonID("gapcursor",Pn);class eb{constructor(e){this.pos=e}map(e){return new eb(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Pn.valid(n)?new Pn(n):ft.near(n)}}function k3(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function cz(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||k3(a.type))return!0;if(a.inlineContent)return!1}}return!0}function dz(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||k3(a.type))return!0;if(a.inlineContent)return!1}}return!0}function uz(){return new un({props:{decorations:mz,createSelectionBetween(t,e,n){return e.pos==n.pos&&Pn.valid(n)?new Pn(n):null},handleClick:fz,handleKeyDown:hz,handleDOMEvents:{beforeinput:pz}}})}const hz=Py({ArrowLeft:cf("horiz",-1),ArrowRight:cf("horiz",1),ArrowUp:cf("vert",-1),ArrowDown:cf("vert",1)});function cf(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,a,i){let o=r.selection,c=e>0?o.$to:o.$from,u=o.empty;if(o instanceof ot){if(!i.endOfTextblock(n)||c.depth==0)return!1;u=!1,c=r.doc.resolve(e>0?c.after():c.before())}let h=Pn.findGapCursorFrom(c,e,u);return h?(a&&a(r.tr.setSelection(new Pn(h))),!0):!1}}function fz(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Pn.valid(r))return!1;let a=t.posAtCoords({left:n.clientX,top:n.clientY});return a&&a.inside>-1&&it.isSelectable(t.state.doc.nodeAt(a.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Pn(r))),!0)}function pz(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Pn))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let a=Ce.empty;for(let o=r.length-1;o>=0;o--)a=Ce.from(r[o].createAndFill(null,a));let i=t.state.tr.replace(n.pos,n.pos,new ze(a,0,0));return i.setSelection(ot.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function mz(t){if(!(t.selection instanceof Pn))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",an.create(t.doc,[Zn.widget(t.selection.head,e,{key:"gapcursor"})])}var wp=200,ms=function(){};ms.prototype.append=function(e){return e.length?(e=ms.from(e),!this.length&&e||e.length=n?ms.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};ms.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};ms.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)};ms.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};ms.from=function(e){return e instanceof ms?e:e&&e.length?new S3(e):ms.empty};var S3=(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<=wp)return new e(this.values.concat(a.flatten()))},e.prototype.leafPrepend=function(a){if(this.length+a.length<=wp)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})(ms);ms.empty=new S3([]);var gz=(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})(ms);const xz=500;class ha{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let a,i;n&&(a=this.remapping(r,this.items.length),i=a.maps.length);let o=e.tr,c,u,h=[],f=[];return this.items.forEach((m,g)=>{if(!m.step){a||(a=this.remapping(r,g+1),i=a.maps.length),i--,f.push(m);return}if(a){f.push(new fo(m.map));let b=m.step.map(a.slice(i)),N;b&&o.maybeStep(b).doc&&(N=o.mapping.maps[o.mapping.maps.length-1],h.push(new fo(N,void 0,void 0,h.length+f.length))),i--,N&&a.appendMap(N,i)}else o.maybeStep(m.step);if(m.selection)return c=a?m.selection.map(a.slice(i)):m.selection,u=new ha(this.items.slice(0,r).append(f.reverse().concat(h)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:o,selection:c}}addTransform(e,n,r,a){let i=[],o=this.eventCount,c=this.items,u=!a&&c.length?c.get(c.length-1):null;for(let f=0;fbz&&(c=yz(c,h),o-=h),new ha(c.append(i),o)}remapping(e,n){let r=new Cu;return this.items.forEach((a,i)=>{let o=a.mirrorOffset!=null&&i-a.mirrorOffset>=e?r.maps.length-a.mirrorOffset:void 0;r.appendMap(a.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new ha(this.items.append(e.map(n=>new fo(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],a=Math.max(0,this.items.length-n),i=e.mapping,o=e.steps.length,c=this.eventCount;this.items.forEach(g=>{g.selection&&c--},a);let u=n;this.items.forEach(g=>{let b=i.getMirror(--u);if(b==null)return;o=Math.min(o,b);let N=i.maps[b];if(g.step){let j=e.steps[b].invert(e.docs[b]),v=g.selection&&g.selection.map(i.slice(u+1,b));v&&c++,r.push(new fo(N,j,v))}else r.push(new fo(N))},a);let h=[];for(let g=n;gxz&&(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 fo(h.invert(),u,f),g,b=a.length-1;(g=a.length&&a[b].merge(m))?a[b]=g:a.push(m)}}else o.map&&r--},this.items.length,0),new ha(ms.from(a.reverse()),i)}}ha.empty=new ha(ms.empty,0);function yz(t,e){let n;return t.forEach((r,a)=>{if(r.selection&&e--==0)return n=a,!1}),t.slice(n)}let fo=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 yo{constructor(e,n,r,a,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=a,this.prevComposition=i}}const bz=20;function vz(t,e,n,r){let a=n.getMeta(Ol),i;if(a)return a.historyState;n.getMeta(jz)&&(t=new yo(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(Ol))return o.getMeta(Ol).redo?new yo(t.done.addTransform(n,void 0,r,Nf(e)),t.undone,Fw(n.mapping.maps),t.prevTime,t.prevComposition):new yo(t.done,t.undone.addTransform(n,void 0,r,Nf(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||!Nz(n,t.prevRanges)),h=o?Sx(t.prevRanges,n.mapping):Fw(n.mapping.maps);return new yo(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,Nf(e)),ha.empty,h,n.time,c??t.prevComposition)}else return(i=n.getMeta("rebased"))?new yo(t.done.rebased(n,i),t.undone.rebased(n,i),Sx(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new yo(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Sx(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Nz(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 Fw(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 Sx(t,e){if(!t)return null;let n=[];for(let r=0;r{let a=Ol.getState(n);if(!a||(t?a.undone:a.done).eventCount==0)return!1;if(r){let i=wz(a,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const T3=E3(!1,!0),M3=E3(!0,!0);Ln.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new un({key:new vn("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const a=this.options.limit;if(a==null||a===0){t=!0;return}const i=this.storage.characters({node:r.doc});if(i>a){const o=i-a,c=0,u=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${a} characters. Content was automatically trimmed.`);const h=r.tr.deleteRange(c,u);return t=!0,h}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const a=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||a>r&&i>r&&i<=a)return!0;if(a>r&&i>r&&i>a||!e.getMeta("paste"))return!1;const c=e.selection.$head.pos,u=i-r,h=c-u,f=c;return e.deleteRange(h,f),!(this.storage.characters({node:e.doc})>r)}})]}});var Sz=Ln.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[oz(this.options)]}});Ln.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new un({key:new vn("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:a}=e,i=[];if(!n||!r)return an.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(Zn.node(h,h+u.nodeSize,{class:this.options.className}))}),an.create(t,i)}}})]}});var Cz=Ln.create({name:"gapCursor",addProseMirrorPlugins(){return[uz()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Kt(rt(t,"allowGapCursor",n)))!=null?e:null}}}),Vw="placeholder";function Ez(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var Tz=Ln.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Vw,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${Ez(this.options.dataAttribute)}`:`data-${Vw}`;return[new un({key:new vn("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:a}=n,i=[];if(!r)return null;const o=this.editor.isEmpty;return e.descendants((c,u)=>{const h=a>=u&&a<=u+c.nodeSize,f=!c.isLeaf&&Jp(c);if((h||!this.options.showOnlyCurrent)&&f){const m=[this.options.emptyNodeClass];o&&m.push(this.options.emptyEditorClass);const g=Zn.node(u,u+c.nodeSize,{class:m.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:c,pos:u,hasAnchor:h}):this.options.placeholder});i.push(g)}return this.options.includeChildren}),an.create(e,i)}}})]}});Ln.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new un({key:new vn("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||RC(n.selection)||t.view.dragging?null:an.create(n.doc,[Zn.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Hw({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var Mz=Ln.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new vn(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,a])=>a).filter(a=>(this.options.notAfter||[]).concat(n).includes(a.name));return[new un({key:e,appendTransaction:(a,i,o)=>{const{doc:c,tr:u,schema:h}=o,f=e.getState(o),m=c.content.size,g=h.nodes[n];if(f)return u.insert(m,g.create())},state:{init:(a,i)=>{const o=i.tr.doc.lastChild;return!Hw({node:o,types:r})},apply:(a,i)=>{if(!a.docChanged||a.getMeta("__uniqueIDTransaction"))return i;const o=a.doc.lastChild;return!Hw({node:o,types:r})}}})]}}),Az=Ln.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>T3(t,e),redo:()=>({state:t,dispatch:e})=>M3(t,e)}},addProseMirrorPlugins(){return[kz(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()}}}),Iz=Ln.create({name:"starterKit",addExtensions(){var t,e,n,r;const a=[];return this.options.bold!==!1&&a.push(t$.configure(this.options.bold)),this.options.blockquote!==!1&&a.push(Q7.configure(this.options.blockquote)),this.options.bulletList!==!1&&a.push(p3.configure(this.options.bulletList)),this.options.code!==!1&&a.push(r$.configure(this.options.code)),this.options.codeBlock!==!1&&a.push(o$.configure(this.options.codeBlock)),this.options.document!==!1&&a.push(l$.configure(this.options.document)),this.options.dropcursor!==!1&&a.push(Sz.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&a.push(Cz.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&a.push(c$.configure(this.options.hardBreak)),this.options.heading!==!1&&a.push(d$.configure(this.options.heading)),this.options.undoRedo!==!1&&a.push(Az.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&a.push(u$.configure(this.options.horizontalRule)),this.options.italic!==!1&&a.push(g$.configure(this.options.italic)),this.options.listItem!==!1&&a.push(m3.configure(this.options.listItem)),this.options.listKeymap!==!1&&a.push(N3.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&a.push(B$.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&a.push(j3.configure(this.options.orderedList)),this.options.paragraph!==!1&&a.push(tz.configure(this.options.paragraph)),this.options.strike!==!1&&a.push(rz.configure(this.options.strike)),this.options.text!==!1&&a.push(az.configure(this.options.text)),this.options.underline!==!1&&a.push(iz.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&a.push(Mz.configure((r=this.options)==null?void 0:r.trailingNode)),a}}),Pz=Iz,Rz=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Lz=Fn.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",Gt(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,a,i,o;const c=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",u=(a=(r=t.attrs)==null?void 0:r.alt)!=null?a:"",h=(o=(i=t.attrs)==null?void 0:i.title)!=null?o:"";return h?`![${u}](${c} "${h}")`:`![${u}](${c})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:a,getPos:i,HTMLAttributes:o,editor:c})=>{const u=document.createElement("img");Object.entries(o).forEach(([m,g])=>{if(g!=null)switch(m){case"width":case"height":break;default:u.setAttribute(m,g);break}}),u.src=o.src;const h=new __({element:u,editor:c,node:a,getPos:i,onResize:(m,g)=>{u.style.width=`${m}px`,u.style.height=`${g}px`},onCommit:(m,g)=>{const b=i();b!==void 0&&this.editor.chain().setNodeSelection(b).updateAttributes(this.name,{width:m,height:g}).run()},onUpdate:(m,g,b)=>m.type===a.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),f=h.dom;return f.style.visibility="hidden",f.style.pointerEvents="none",u.onload=()=>{f.style.visibility="",f.style.pointerEvents=""},h}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[QC({find:Rz,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),Oz=Lz;function Dz(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:o,$position:c}=t,u=r&&!a,h=z_(n),f=new RegExp(`\\s${h}$`),m=o?"^":"",g=a?"":h,b=u?new RegExp(`${m}${h}.*?(?=\\s${g}|$)`,"gm"):new RegExp(`${m}(?:^)?${h}[^\\s${g}]*`,"gm"),N=((e=c.nodeBefore)==null?void 0:e.isText)&&c.nodeBefore.text;if(!N)return null;const j=c.pos-N.length,v=Array.from(N.matchAll(b)).pop();if(!v||v.input===void 0||v.index===void 0)return null;const k=v.input.slice(Math.max(0,v.index-1),v.index),T=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(k);if(i!==null&&!T)return null;const C=j+v.index;let R=C+v[0].length;return u&&f.test(N.slice(R-1,R+1))&&(v[0]+=" ",R+=1),C=c.pos?{range:{from:C,to:R},query:v[0].slice(n.length),text:v[0]}:null}var _z=new vn("suggestion");function $z({pluginKey:t=_z,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:a=!1,allowedPrefixes:i=[" "],startOfLine:o=!1,decorationTag:c="span",decorationClass:u="suggestion",decorationContent:h="",decorationEmptyClass:f="is-empty",command:m=()=>null,items:g=()=>[],render:b=()=>({}),allow:N=()=>!0,findSuggestionMatch:j=Dz,shouldShow:v}){let k;const T=b==null?void 0:b(),C=()=>{const P=e.state.selection.$anchor.pos,z=e.view.coordsAtPos(P),{top:L,right:Q,bottom:se,left:$}=z;try{return new DOMRect($,L,Q-$,se-L)}catch{return null}},R=(P,z)=>z?()=>{const L=t.getState(e.state),Q=L==null?void 0:L.decorationId,se=P.dom.querySelector(`[data-decoration-id="${Q}"]`);return(se==null?void 0:se.getBoundingClientRect())||null}:C;function O(P,z){var L;try{const se=t.getState(P.state),$=se!=null&&se.decorationId?P.dom.querySelector(`[data-decoration-id="${se.decorationId}"]`):null,ie={editor:e,range:(se==null?void 0:se.range)||{from:0,to:0},query:(se==null?void 0:se.query)||null,text:(se==null?void 0:se.text)||null,items:[],command:le=>m({editor:e,range:(se==null?void 0:se.range)||{from:0,to:0},props:le}),decorationNode:$,clientRect:R(P,$)};(L=T==null?void 0:T.onExit)==null||L.call(T,ie)}catch{}const Q=P.state.tr.setMeta(z,{exit:!0});P.dispatch(Q)}const U=new un({key:t,view(){return{update:async(P,z)=>{var L,Q,se,$,ie,le,me;const I=(L=this.key)==null?void 0:L.getState(z),Y=(Q=this.key)==null?void 0:Q.getState(P.state),F=I.active&&Y.active&&I.range.from!==Y.range.from,ge=!I.active&&Y.active,X=I.active&&!Y.active,B=!ge&&!X&&I.query!==Y.query,W=ge||F&&B,fe=B||F,he=X||F&&B;if(!W&&!fe&&!he)return;const de=he&&!W?I:Y,D=P.dom.querySelector(`[data-decoration-id="${de.decorationId}"]`);k={editor:e,range:de.range,query:de.query,text:de.text,items:[],command:q=>m({editor:e,range:de.range,props:q}),decorationNode:D,clientRect:R(P,D)},W&&((se=T==null?void 0:T.onBeforeStart)==null||se.call(T,k)),fe&&(($=T==null?void 0:T.onBeforeUpdate)==null||$.call(T,k)),(fe||W)&&(k.items=await g({editor:e,query:de.query})),he&&((ie=T==null?void 0:T.onExit)==null||ie.call(T,k)),fe&&((le=T==null?void 0:T.onUpdate)==null||le.call(T,k)),W&&((me=T==null?void 0:T.onStart)==null||me.call(T,k))},destroy:()=>{var P;k&&((P=T==null?void 0:T.onExit)==null||P.call(T,k))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(P,z,L,Q){const{isEditable:se}=e,{composing:$}=e.view,{selection:ie}=P,{empty:le,from:me}=ie,I={...z},Y=P.getMeta(t);if(Y&&Y.exit)return I.active=!1,I.decorationId=null,I.range={from:0,to:0},I.query=null,I.text=null,I;if(I.composing=$,se&&(le||e.view.composing)){(mez.range.to)&&!$&&!z.composing&&(I.active=!1);const F=j({char:n,allowSpaces:r,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:o,$position:ie.$from}),ge=`id_${Math.floor(Math.random()*4294967295)}`;F&&N({editor:e,state:Q,range:F.range,isActive:z.active})&&(!v||v({editor:e,range:F.range,query:F.query,text:F.text,transaction:P}))?(I.active=!0,I.decorationId=z.decorationId?z.decorationId:ge,I.range=F.range,I.query=F.query,I.text=F.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(P,z){var L,Q,se,$;const{active:ie,range:le}=U.getState(P.state);if(!ie)return!1;if(z.key==="Escape"||z.key==="Esc"){const I=U.getState(P.state),Y=(L=k==null?void 0:k.decorationNode)!=null?L:null,F=Y??(I!=null&&I.decorationId?P.dom.querySelector(`[data-decoration-id="${I.decorationId}"]`):null);if(((Q=T==null?void 0:T.onKeyDown)==null?void 0:Q.call(T,{view:P,event:z,range:I.range}))||!1)return!0;const X={editor:e,range:I.range,query:I.query,text:I.text,items:[],command:B=>m({editor:e,range:I.range,props:B}),decorationNode:F,clientRect:F?()=>F.getBoundingClientRect()||null:null};return(se=T==null?void 0:T.onExit)==null||se.call(T,X),O(P,t),!0}return(($=T==null?void 0:T.onKeyDown)==null?void 0:$.call(T,{view:P,event:z,range:le}))||!1},decorations(P){const{active:z,range:L,decorationId:Q,query:se}=U.getState(P);if(!z)return null;const $=!(se!=null&&se.length),ie=[u];return $&&ie.push(f),an.create(P.doc,[Zn.inline(L.from,L.to,{nodeName:c,class:ie.join(" "),"data-decoration-id":Q,"data-decoration-content":h})])}}});return U}function zz({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const a=new vn;return{editor:t,char:r,pluginKey:a,command:({editor:i,range:o,props:c})=>{var u,h,f;const m=i.view.state.selection.$to.nodeAfter;((u=m==null?void 0:m.text)==null?void 0:u.startsWith(" "))&&(o.to+=1),i.chain().focus().insertContentAt(o,[{type:n,attrs:{...c,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(f=(h=i.view.dom.ownerDocument.defaultView)==null?void 0:h.getSelection())==null||f.collapseToEnd()},allow:({state:i,range:o})=>{const c=i.doc.resolve(o.from),u=i.schema.nodes[n];return!!c.parent.type.contentMatch.matchType(u)},...e}}function A3(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>zz({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function Uw(t,e){const n=A3(t),r=n.find(a=>a.char===e);return r||(n.length?n[0]:null)}var Fz=Fn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!=null?n:"@"}${(r=t.attrs.label)!=null?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,a;return["span",Gt(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=Uw(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Gt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=Gt({"data-type":this.name},this.options.HTMLAttributes,e);const a=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof a=="string"?["span",Gt({"data-type":this.name},this.options.HTMLAttributes,e),a]:a},...YC({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:Uw(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 Pi,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 A3(this).map($z)}}),Bz=Fz,Vz=Tz;let A0,I0;if(typeof WeakMap<"u"){let t=new WeakMap;A0=e=>t.get(e),I0=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;A0=r=>{for(let a=0;a(n==10&&(n=0),t[n++]=r,t[n++]=a)}var Rn=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e=n){(i||(i=[])).push({type:"overlong_rowspan",pos:f,n:k-C});break}const R=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 Wz(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 qz(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 ba(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 Zp(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=Jl(e.$head)||Gz(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Gz(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 P0(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function Jz(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function tb(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function I3(t,e,n){const r=t.node(-1),a=Rn.get(r),i=t.start(-1),o=a.nextCell(t.pos-i,e,n);return o==null?null:t.node(0).resolve(i+o)}function Ql(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 P3(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let a=0;af!=n.pos-i);u.unshift(n.pos-i);const h=u.map(f=>{const m=r.nodeAt(f);if(!m)throw new RangeError(`No cell with offset ${f} found`);const g=i+f+1;return new NS(c.resolve(g),c.resolve(g+m.content.size))});super(h[0].$from,h[0].$to,h),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),a=e.resolve(n.map(this.$headCell.pos));if(P0(r)&&P0(a)&&tb(r,a)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?wi.rowSelection(r,a):i&&this.isColSelection()?wi.colSelection(r,a):new wi(r,a)}return ot.between(r,a)}content(){const e=this.$anchorCell.node(-1),n=Rn.get(e),r=this.$anchorCell.start(-1),a=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},o=[];for(let u=a.top;u0||v>0){let k=N.attrs;if(j>0&&(k=Ql(k,0,j)),v>0&&(k=Ql(k,k.colspan-v,v)),b.lefta.bottom){const k={...N.attrs,rowspan:Math.min(b.bottom,a.bottom)-Math.max(b.top,a.top)};b.top0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,a=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,a)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),a=Rn.get(r),i=e.start(-1),o=a.findCell(e.pos-i),c=a.findCell(n.pos-i),u=e.node(0);return o.top<=c.top?(o.top>0&&(e=u.resolve(i+a.map[o.left])),c.bottom0&&(n=u.resolve(i+a.map[c.left])),o.bottom0)return!1;const o=a+this.$anchorCell.nodeAfter.attrs.colspan,c=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,c)==n.width}eq(e){return e instanceof wi&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),a=Rn.get(r),i=e.start(-1),o=a.findCell(e.pos-i),c=a.findCell(n.pos-i),u=e.node(0);return o.left<=c.left?(o.left>0&&(e=u.resolve(i+a.map[o.top*a.width])),c.right0&&(n=u.resolve(i+a.map[c.top*a.width])),o.right{e.push(Zn.node(r,r+n.nodeSize,{class:"selectedCell"}))}),an.create(t.doc,e)}function Zz({$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 eF({$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 tF(t,e,n){const r=(e||t).selection,a=(e||t).doc;let i,o;if(r instanceof it&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")i=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=Rn.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 ot&&Zz(r)?i=ot.create(a,r.from):r instanceof ot&&eF(r)&&(i=ot.create(a,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}const nF=new vn("fix-tables");function L3(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=sF(t,a,i,n))};return e?e.doc!=t.doc&&L3(e.doc,t.doc,0,r):t.doc.descendants(r),n}function sF(t,e,n,r){const a=Rn.get(e);if(!a.problems)return r;r||(r=t.tr);const i=[];for(let u=0;u0){let b="cell";f.firstChild&&(b=f.firstChild.type.spec.tableRole);const N=[];for(let v=0;v0?-1:0;Qz(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;lF(e,r,a+c)&&(c=a==0||a==e.height?null:0);for(let h=0,f=e.width*a;h0&&a0&&m==e.map[f-e.width]){const g=n.nodeAt(m).attrs;t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...g,rowspan:g.rowspan-1}),h+=g.colspan-1}else if(a0&&n[i]==n[i-1]||r.right0&&n[a]==n[a-t]||r.bottom0){const f=u+1+h.content.size,m=Ww(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 qw(t,e){const n=Ls(t.schema);return pF(({node:r})=>n[r.type.spec.tableRole])(t,e)}function pF(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=qz(r.$from),!a)return!1;i=(o=Jl(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=qa(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 gF(t){return function(e,n){if(!ba(e))return!1;if(n){const r=Ls(e.schema),a=qa(e),i=e.tr,o=a.map.cellsInRect(t=="column"?{left:a.left,top:0,right:a.right,bottom:a.map.height}:t=="row"?{left:0,top:a.top,right:a.map.width,bottom:a.bottom}:a),c=o.map(u=>a.table.nodeAt(u));for(let u=0;u{const b=g+i.tableStart,N=o.doc.nodeAt(b);N&&o.setNodeMarkup(b,m,N.attrs)}),r(o)}return!0}}Ou("row",{useDeprecatedLogic:!0});Ou("column",{useDeprecatedLogic:!0});const xF=Ou("cell",{useDeprecatedLogic:!0});function yF(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 df(t,e){const n=t.selection;if(!(n instanceof dn))return!1;if(e){const r=t.tr,a=Ls(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 ze(a,0,0))}),r.docChanged&&e(r)}return!0}function vF(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const a=e.child(0),i=a.type.spec.tableRole,o=a.type.schema,c=[];if(i=="row")for(let u=0;u=0;o--){const{rowspan:c,colspan:u}=i.child(o).attrs;for(let h=a;h=e.length&&e.push(Ce.empty),n[a]r&&(g=g.type.createChecked(Ql(g.attrs,g.attrs.colspan,f+g.attrs.colspan-r),g.content)),h.push(g),f+=g.attrs.colspan;for(let b=1;ba&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,a-m.attrs.rowspan)},m.content)),u.push(m)}i.push(Ce.from(u))}n=i,e=a}return{width:t,height:e,rows:n}}function jF(t,e,n,r,a,i,o){const c=t.doc.type.schema,u=Ls(c);let h,f;if(a>e.width)for(let m=0,g=0;me.height){const m=[];for(let N=0,j=(e.height-1)*e.width;N=e.width?!1:n.nodeAt(e.map[j+N]).type==u.header_cell;m.push(v?f||(f=u.header_cell.createAndFill()):h||(h=u.cell.createAndFill()))}const g=u.row.create(null,Ce.from(m)),b=[];for(let N=e.height;N{if(!a)return!1;const i=n.selection;if(i instanceof dn)return wf(n,r,ft.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const o=$3(a,t,e);if(o==null)return!1;if(t=="horiz")return wf(n,r,ft.near(n.doc.resolve(i.head+e),e));{const c=n.doc.resolve(o),u=I3(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),wf(n,r,h)}}}function hf(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=$3(a,t,e);if(u==null)return!1;o=new dn(n.doc.resolve(u))}const c=I3(o.$headCell,t,e);return c?wf(n,r,new dn(o.$anchorCell,c)):!1}}function SF(t,e){const n=t.state.doc,r=Jl(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new dn(r))),!0):!1}function CF(t,e,n){if(!ba(t.state))return!1;let r=vF(n);const a=t.state.selection;if(a instanceof dn){r||(r={width:1,height:1,rows:[Ce.from(R0(Ls(t.state.schema).cell,n))]});const i=a.$anchorCell.node(-1),o=a.$anchorCell.start(-1),c=Rn.get(i).rectBetween(a.$anchorCell.pos-o,a.$headCell.pos-o);return r=wF(r,c.right-c.left,c.bottom-c.top),Xw(t.state,t.dispatch,o,c,r),!0}else if(r){const i=Zp(t.state),o=i.start(-1);return Xw(t.state,t.dispatch,o,Rn.get(i.node(-1)).findCell(i.pos-o),r),!0}else return!1}function EF(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=Jl(t.state.selection.$anchor))!=null&&((n=Ex(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=Ex(t,h);const m=No.getState(t.state)==null;if(!f||!tb(u,f))if(m)f=u;else return;const g=new dn(u,f);if(m||!t.state.selection.eq(g)){const b=t.state.tr.setSelection(g);m&&b.setMeta(No,u.pos),t.dispatch(b)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",c),No.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(No,-1))}function c(u){const h=u,f=No.getState(t.state);let m;if(f!=null)m=t.state.doc.resolve(f);else if(Zw(t,h.target)!=r&&(m=Ex(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 $3(t,e,n){if(!(t.state.selection instanceof ot))return null;const{$head:r}=t.state.selection;for(let a=r.depth-1;a>=0;a--){const i=r.node(a);if((n<0?r.index(a):r.indexAfter(a))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const o=r.before(a),c=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?o:null}}return null}function Zw(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Ex(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&&Jl(t.state.doc.resolve(r))||Jl(t.state.doc.resolve(a))}var TF=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")),L0(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,L0(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function L0(t,e,n,r,a,i){let o=0,c=!0,u=e.firstChild;const h=t.firstChild;if(h){for(let m=0,g=0;mnew r(m,n,g)),new AF(-1,!1)},apply(o,c){return c.apply(o)}},props:{attributes:o=>{const c=Sr.getState(o);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,c)=>{IF(o,c,t,a)},mouseleave:o=>{PF(o)},mousedown:(o,c)=>{RF(o,c,e,n)}},decorations:o=>{const c=Sr.getState(o);if(c&&c.activeHandle>-1)return $F(o,c.activeHandle)},nodeViews:{}}});return i}var AF=class jf{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Sr);if(r&&r.setHandle!=null)return new jf(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new jf(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let a=e.mapping.map(n.activeHandle,-1);return P0(e.doc.resolve(a))||(a=-1),new jf(a,n.dragging)}return n}};function IF(t,e,n,r){if(!t.editable)return;const a=Sr.getState(t.state);if(a&&!a.dragging){const i=OF(e.target);let o=-1;if(i){const{left:c,right:u}=i.getBoundingClientRect();e.clientX-c<=n?o=ej(t,e,"left",n):u-e.clientX<=n&&(o=ej(t,e,"right",n))}if(o!=a.activeHandle){if(!r&&o!==-1){const c=t.state.doc.resolve(o),u=c.node(-1),h=Rn.get(u),f=c.start(-1);if(h.colCount(c.pos-f)+c.nodeAfter.attrs.colspan-1==h.width-1)return}z3(t,o)}}}function PF(t){if(!t.editable)return;const e=Sr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&z3(t,-1)}function RF(t,e,n,r){var a;if(!t.editable)return!1;const i=(a=t.dom.ownerDocument.defaultView)!==null&&a!==void 0?a:window,o=Sr.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const c=t.state.doc.nodeAt(o.activeHandle),u=LF(t,o.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta(Sr,{setDragging:{startX:e.clientX,startWidth:u}}));function h(m){i.removeEventListener("mouseup",h),i.removeEventListener("mousemove",f);const g=Sr.getState(t.state);g!=null&&g.dragging&&(DF(t,g.activeHandle,tj(g.dragging,m,n)),t.dispatch(t.state.tr.setMeta(Sr,{setDragging:null})))}function f(m){if(!m.which)return h(m);const g=Sr.getState(t.state);if(g&&g.dragging){const b=tj(g.dragging,m,n);nj(t,g.activeHandle,b,r)}}return nj(t,o.activeHandle,u,r),i.addEventListener("mouseup",h),i.addEventListener("mousemove",f),e.preventDefault(),!0}function LF(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",Gt(this.options.HTMLAttributes,t),0]}}),B3=Fn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",Gt(this.options.HTMLAttributes,t),0]}}),V3=Fn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Gt(this.options.HTMLAttributes,t),0]}});function O0(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function sj(t,e,n,r,a,i){var o;let c=0,u=!0,h=e.firstChild;const f=t.firstChild;if(f!==null)for(let g=0,b=0;g{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function HF(t,e,n,r,a){const i=VF(t),o=[],c=[];for(let h=0;h{const{selection:e}=t.state;if(!UF(e))return!1;let n=0;const r=SC(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},WF="";function KF(t){return(t||"").replace(/\s+/g," ").trim()}function qF(t,e,n={}){var r;const a=(r=n.cellLineSeparator)!=null?r:WF;if(!t||!t.content||t.content.length===0)return"";const i=[];t.content.forEach(N=>{const j=[];N.content&&N.content.forEach(v=>{let k="";v.content&&Array.isArray(v.content)&&v.content.length>1?k=v.content.map(O=>e.renderChildren(O)).join(a):k=v.content?e.renderChildren(v.content):"";const T=KF(k),C=v.type==="tableHeader";j.push({text:T,isHeader:C})}),i.push(j)});const o=i.reduce((N,j)=>Math.max(N,j.length),0);if(o===0)return"";const c=new Array(o).fill(0);i.forEach(N=>{var j;for(let v=0;vc[v]&&(c[v]=T),c[v]<3&&(c[v]=3)}});const u=(N,j)=>N+" ".repeat(Math.max(0,j-N.length)),h=i[0],f=h.some(N=>N.isHeader);let m=` -`;const g=new Array(o).fill(0).map((N,j)=>f&&h[j]&&h[j].text||"");return m+=`| ${g.map((N,j)=>u(N,c[j])).join(" | ")} | -`,m+=`| ${c.map(N=>"-".repeat(Math.max(3,N))).join(" | ")} | -`,(f?i.slice(1):i).forEach(N=>{m+=`| ${new Array(o).fill(0).map((j,v)=>u(N[v]&&N[v].text||"",c[v])).join(" | ")} | -`}),m}var GF=qF,H3=Fn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:FF,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}=BF(t,this.options.cellMinWidth),i=e.style;function o(){return i||(r?`width: ${r}`:`min-width: ${a}`)}const c=["table",Gt(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)=>GF(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:a,editor:i})=>{const o=HF(i.schema,t,e,n);if(a){const c=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(ot.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>rF(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>aF(t,e),deleteColumn:()=>({state:t,dispatch:e})=>oF(t,e),addRowBefore:()=>({state:t,dispatch:e})=>cF(t,e),addRowAfter:()=>({state:t,dispatch:e})=>dF(t,e),deleteRow:()=>({state:t,dispatch:e})=>hF(t,e),deleteTable:()=>({state:t,dispatch:e})=>bF(t,e),mergeCells:()=>({state:t,dispatch:e})=>Kw(t,e),splitCell:()=>({state:t,dispatch:e})=>qw(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Ou("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Ou("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>xF(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Kw(t,e)?!0:qw(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>mF(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Jw(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Jw(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&O3(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:ff,"Mod-Backspace":ff,Delete:ff,"Mod-Delete":ff}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[MF({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],zF({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:Kt(rt(t,"tableRole",e))}}});Ln.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(H3.configure(this.options.table)),this.options.tableCell!==!1&&t.push(F3.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(B3.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(V3.configure(this.options.tableRow)),t}});function JF(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function QF(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}function YF(t){if(!t)return"";let e=t;return e=e.replace(/]*>(.*?)<\/h1>/gi,`# $1 ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - -`),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,` - -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js -`),e.trim()}function oj(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 eB=Vn.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 端全宽播放)"]]}}),tB=Vn.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",Gt(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 lj(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}const nB=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)=>`
    - @${lj(o.name)} - ${lj(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 sB(t){var r;const e=[],n=(r=t.clipboardData)==null?void 0:r.items;if(!n)return e;for(let a=0;a{const h=y.useRef(null),f=y.useRef(null),m=y.useRef(null),g=y.useRef(null),[b,N]=y.useState(""),[j,v]=y.useState(!1),k=y.useRef(oj(t)),T=y.useCallback((se,$)=>{var P;const ie=g.current;if(!ie||!n)return!1;const le=sB($);if(le.length>0)return $.preventDefault(),(async()=>{for(const Y of le)try{const F=await n(Y);F&&ie.chain().focus().setImage({src:F}).run()}catch(F){console.error("粘贴图片上传失败",F)}})(),!0;const me=(P=$.clipboardData)==null?void 0:P.getData("text/html");if(me&&/data:image\/[^;"']+;base64,/i.test(me)){$.preventDefault();const{from:Y,to:F}=ie.state.selection;return(async()=>{try{const ge=await iB(me,n);ie.chain().focus().insertContentAt({from:Y,to:F},ge).run()}catch(ge){console.error("粘贴 HTML 内 base64 转换失败",ge)}})(),!0}return!1},[n]),C=q7({extensions:[Lz.configure({link:{openOnClick:!1,HTMLAttributes:{class:"rich-link"}}}),_z.configure({inline:!0,allowBase64:!0,HTMLAttributes:{class:"rich-editor-img-thumb"}}),eB,Hz.configure({HTMLAttributes:{class:"mention-tag"},suggestion:nB(a)}),tB,Uz.configure({placeholder:o}),W3.configure({resizable:!0}),U3,V3,H3],content:k.current,onUpdate:({editor:se})=>{e(se.getHTML())},editorProps:{attributes:{class:"rich-editor-content"},handlePaste:T}});y.useEffect(()=>{g.current=C??null},[C]),y.useImperativeHandle(u,()=>({getHTML:()=>(C==null?void 0:C.getHTML())||"",getMarkdown:()=>ZF((C==null?void 0:C.getHTML())||"")})),y.useEffect(()=>{if(C&&t!==C.getHTML()){const se=oj(t);se!==C.getHTML()&&C.commands.setContent(se)}},[t]);const R=y.useCallback(async se=>{if(r)return r(se);if(n)return n(se);throw new Error("未配置上传")},[n,r]),O=y.useCallback(async se=>{var ie;const $=(ie=se.target.files)==null?void 0:ie[0];if(!(!$||!C)){if(n){const le=await n($);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($)}se.target.value=""}},[C,n]),U=y.useCallback(async se=>{var ie;const $=(ie=se.target.files)==null?void 0:ie[0];if(!(!$||!C)){try{const le=await R($);le&&C.chain().focus().insertContent({type:"videoEmbed",attrs:{src:le}}).run()}catch(le){console.error(le)}se.target.value=""}},[C,R]),I=y.useCallback(async se=>{var ie;const $=(ie=se.target.files)==null?void 0:ie[0];if(!(!$||!C)){try{const le=await R($);if(!le)return;const me=$.name||"附件";C.chain().focus().insertContent(`

    附件 ${YF(me)}

    `).run()}catch(le){console.error(le)}se.target.value=""}},[C,R]),z=y.useCallback(()=>{C&&C.chain().focus().insertContent("@").run()},[C]),L=y.useCallback(se=>{C&&C.chain().focus().insertContent([{type:"linkTag",attrs:{label:se.label,url:se.url||"",tagType:se.type||"url",tagId:se.id||"",pagePath:se.pagePath||"",appId:se.appId||"",mpKey:se.type==="miniprogram"&&se.appId||""}},{type:"text",text:" "}]).run()},[C]),Q=y.useCallback(()=>{!C||!b||(C.chain().focus().setLink({href:b}).run(),N(""),v(!1))},[C,b]);return C?s.jsxs("div",{className:`rich-editor-wrapper ${c||""}`,children:[s.jsxs("div",{className:"rich-editor-toolbar",children:[s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>C.chain().focus().toggleBold().run(),className:C.isActive("bold")?"is-active":"",type:"button",children:s.jsx(x5,{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(yM,{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(SA,{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($5,{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(lM,{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(dM,{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(hM,{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(EM,{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(nA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().setHorizontalRule().run(),type:"button",children:s.jsx(BM,{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:U,className:"hidden"}),s.jsx("input",{ref:m,type:"file",onChange:I,className:"hidden"}),s.jsx("button",{onClick:()=>{var se;return(se=h.current)==null?void 0:se.click()},type:"button",title:"上传图片",children:s.jsx(sk,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>{var se;return(se=f.current)==null?void 0:se.click()},type:"button",title:"上传视频",disabled:!r&&!n,children:s.jsx(FA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>{var se;return(se=m.current)==null?void 0:se.click()},type:"button",title:"上传附件(生成下载链接)",disabled:!r&&!n,children:s.jsx(KM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:z,type:"button",title:"插入 @ 并选择人物",className:a.length?"mention-trigger-btn":"",disabled:a.length===0,children:s.jsx(p5,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>v(!j),className:C.isActive("link")?"is-active":"",type:"button",title:"链接",children:s.jsx(Ux,{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(EA,{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(LA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().redo().run(),disabled:!C.can().redo(),type:"button",children:s.jsx(rA,{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:se=>{const $=i.find(ie=>ie.id===se.target.value);$&&L($),se.target.value=""},defaultValue:"",children:[s.jsx("option",{value:"",disabled:!0,children:"# 插入链接标签"}),i.map(se=>s.jsx("option",{value:se.id,children:se.label},se.id))]})})]})]}),j&&s.jsxs("div",{className:"link-input-bar",children:[s.jsx("input",{type:"url",placeholder:"输入链接地址...",value:b,onChange:se=>N(se.target.value),onKeyDown:se=>se.key==="Enter"&&Q(),className:"link-input"}),s.jsx("button",{onClick:Q,className:"link-confirm",type:"button",children:"确定"}),s.jsx("button",{onClick:()=>{C.chain().focus().unsetLink().run(),v(!1)},className:"link-remove",type:"button",children:"移除"})]}),s.jsx(n3,{editor:C})]}):null});_0.displayName="RichEditor";const oB=["top","right","bottom","left"],Vo=Math.min,Cr=Math.max,kp=Math.round,mf=Math.floor,Ha=t=>({x:t,y:t}),lB={left:"right",right:"left",bottom:"top",top:"bottom"},cB={start:"end",end:"start"};function $0(t,e,n){return Cr(t,Vo(e,n))}function Di(t,e){return typeof t=="function"?t(e):t}function _i(t){return t.split("-")[0]}function pd(t){return t.split("-")[1]}function rb(t){return t==="x"?"y":"x"}function ab(t){return t==="y"?"height":"width"}const dB=new Set(["top","bottom"]);function Va(t){return dB.has(_i(t))?"y":"x"}function ib(t){return rb(Va(t))}function uB(t,e,n){n===void 0&&(n=!1);const r=pd(t),a=ib(t),i=ab(a);let o=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=Sp(o)),[o,Sp(o)]}function hB(t){const e=Sp(t);return[z0(t),e,z0(e)]}function z0(t){return t.replace(/start|end/g,e=>cB[e])}const cj=["left","right"],dj=["right","left"],fB=["top","bottom"],pB=["bottom","top"];function mB(t,e,n){switch(t){case"top":case"bottom":return n?e?dj:cj:e?cj:dj;case"left":case"right":return e?fB:pB;default:return[]}}function gB(t,e,n,r){const a=pd(t);let i=mB(_i(t),n==="start",r);return a&&(i=i.map(o=>o+"-"+a),e&&(i=i.concat(i.map(z0)))),i}function Sp(t){return t.replace(/left|right|bottom|top/g,e=>lB[e])}function xB(t){return{top:0,right:0,bottom:0,left:0,...t}}function K3(t){return typeof t!="number"?xB(t):{top:t,right:t,bottom:t,left:t}}function Cp(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 uj(t,e,n){let{reference:r,floating:a}=t;const i=Va(e),o=ib(e),c=ab(o),u=_i(e),h=i==="y",f=r.x+r.width/2-a.width/2,m=r.y+r.height/2-a.height/2,g=r[c]/2-a[c]/2;let b;switch(u){case"top":b={x:f,y:r.y-a.height};break;case"bottom":b={x:f,y:r.y+r.height};break;case"right":b={x:r.x+r.width,y:m};break;case"left":b={x:r.x-a.width,y:m};break;default:b={x:r.x,y:r.y}}switch(pd(e)){case"start":b[o]-=g*(n&&h?-1:1);break;case"end":b[o]+=g*(n&&h?-1:1);break}return b}async function yB(t,e){var n;e===void 0&&(e={});const{x:r,y:a,platform:i,rects:o,elements:c,strategy:u}=t,{boundary:h="clippingAncestors",rootBoundary:f="viewport",elementContext:m="floating",altBoundary:g=!1,padding:b=0}=Di(e,t),N=K3(b),v=c[g?m==="floating"?"reference":"floating":m],k=Cp(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:h,rootBoundary:f,strategy:u})),T=m==="floating"?{x:r,y:a,width:o.floating.width,height:o.floating.height}:o.reference,C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),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},O=Cp(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:T,offsetParent:C,strategy:u}):T);return{top:(k.top-O.top+N.top)/R.y,bottom:(O.bottom-k.bottom+N.bottom)/R.y,left:(k.left-O.left+N.left)/R.x,right:(O.right-k.right+N.right)/R.x}}const bB=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}=uj(h,r,u),g=r,b={},N=0;for(let v=0;v({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:a,rects:i,platform:o,elements:c,middlewareData:u}=e,{element:h,padding:f=0}=Di(t,e)||{};if(h==null)return{};const m=K3(f),g={x:n,y:r},b=ib(a),N=ab(b),j=await o.getDimensions(h),v=b==="y",k=v?"top":"left",T=v?"bottom":"right",C=v?"clientHeight":"clientWidth",R=i.reference[N]+i.reference[b]-g[b]-i.floating[N],O=g[b]-i.reference[b],U=await(o.getOffsetParent==null?void 0:o.getOffsetParent(h));let I=U?U[C]:0;(!I||!await(o.isElement==null?void 0:o.isElement(U)))&&(I=c.floating[C]||i.floating[N]);const z=R/2-O/2,L=I/2-j[N]/2-1,Q=Vo(m[k],L),se=Vo(m[T],L),$=Q,ie=I-j[N]-se,le=I/2-j[N]/2+z,me=$0($,le,ie),P=!u.arrow&&pd(a)!=null&&le!==me&&i.reference[N]/2-(le<$?Q:se)-j[N]/2<0,Y=P?le<$?le-$:le-ie:0;return{[b]:g[b]+Y,data:{[b]:me,centerOffset:le-me-Y,...P&&{alignmentOffset:Y}},reset:P}}}),NB=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:a,middlewareData:i,rects:o,initialPlacement:c,platform:u,elements:h}=e,{mainAxis:f=!0,crossAxis:m=!0,fallbackPlacements:g,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:N="none",flipAlignment:j=!0,...v}=Di(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const k=_i(a),T=Va(c),C=_i(c)===c,R=await(u.isRTL==null?void 0:u.isRTL(h.floating)),O=g||(C||!j?[Sp(c)]:hB(c)),U=N!=="none";!g&&U&&O.push(...gB(c,j,N,R));const I=[c,...O],z=await u.detectOverflow(e,v),L=[];let Q=((r=i.flip)==null?void 0:r.overflows)||[];if(f&&L.push(z[k]),m){const le=uB(a,o,R);L.push(z[le[0]],z[le[1]])}if(Q=[...Q,{placement:a,overflows:L}],!L.every(le=>le<=0)){var se,$;const le=(((se=i.flip)==null?void 0:se.index)||0)+1,me=I[le];if(me&&(!(m==="alignment"?T!==Va(me):!1)||Q.every(F=>Va(F.placement)===T?F.overflows[0]>0:!0)))return{data:{index:le,overflows:Q},reset:{placement:me}};let P=($=Q.filter(Y=>Y.overflows[0]<=0).sort((Y,F)=>Y.overflows[1]-F.overflows[1])[0])==null?void 0:$.placement;if(!P)switch(b){case"bestFit":{var ie;const Y=(ie=Q.filter(F=>{if(U){const ge=Va(F.placement);return ge===T||ge==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(ge=>ge>0).reduce((ge,X)=>ge+X,0)]).sort((F,ge)=>F[1]-ge[1])[0])==null?void 0:ie[0];Y&&(P=Y);break}case"initialPlacement":P=c;break}if(a!==P)return{reset:{placement:P}}}return{}}}};function hj(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function fj(t){return oB.some(e=>t[e]>=0)}const wB=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:a="referenceHidden",...i}=Di(t,e);switch(a){case"referenceHidden":{const o=await r.detectOverflow(e,{...i,elementContext:"reference"}),c=hj(o,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:fj(c)}}}case"escaped":{const o=await r.detectOverflow(e,{...i,altBoundary:!0}),c=hj(o,n.floating);return{data:{escapedOffsets:c,escaped:fj(c)}}}default:return{}}}}},q3=new Set(["left","top"]);async function jB(t,e){const{placement:n,platform:r,elements:a}=t,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),o=_i(n),c=pd(n),u=Va(n)==="y",h=q3.has(o)?-1:1,f=i&&u?-1:1,m=Di(e,t);let{mainAxis:g,crossAxis:b,alignmentAxis:N}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof N=="number"&&(b=c==="end"?N*-1:N),u?{x:b*f,y:g*h}:{x:g*h,y:b*f}}const kB=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 jB(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}}}}},SB=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:a,platform:i}=e,{mainAxis:o=!0,crossAxis:c=!1,limiter:u={fn:k=>{let{x:T,y:C}=k;return{x:T,y:C}}},...h}=Di(t,e),f={x:n,y:r},m=await i.detectOverflow(e,h),g=Va(_i(a)),b=rb(g);let N=f[b],j=f[g];if(o){const k=b==="y"?"top":"left",T=b==="y"?"bottom":"right",C=N+m[k],R=N-m[T];N=$0(C,N,R)}if(c){const k=g==="y"?"top":"left",T=g==="y"?"bottom":"right",C=j+m[k],R=j-m[T];j=$0(C,j,R)}const v=u.fn({...e,[b]:N,[g]:j});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[b]:o,[g]:c}}}}}},CB=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}=Di(t,e),f={x:n,y:r},m=Va(a),g=rb(m);let b=f[g],N=f[m];const j=Di(c,e),v=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(u){const C=g==="y"?"height":"width",R=i.reference[g]-i.floating[C]+v.mainAxis,O=i.reference[g]+i.reference[C]-v.mainAxis;bO&&(b=O)}if(h){var k,T;const C=g==="y"?"width":"height",R=q3.has(_i(a)),O=i.reference[m]-i.floating[C]+(R&&((k=o.offset)==null?void 0:k[m])||0)+(R?0:v.crossAxis),U=i.reference[m]+i.reference[C]+(R?0:((T=o.offset)==null?void 0:T[m])||0)-(R?v.crossAxis:0);NU&&(N=U)}return{[g]:b,[m]:N}}}},EB=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}=Di(t,e),f=await o.detectOverflow(e,h),m=_i(a),g=pd(a),b=Va(a)==="y",{width:N,height:j}=i.floating;let v,k;m==="top"||m==="bottom"?(v=m,k=g===(await(o.isRTL==null?void 0:o.isRTL(c.floating))?"start":"end")?"left":"right"):(k=m,v=g==="end"?"top":"bottom");const T=j-f.top-f.bottom,C=N-f.left-f.right,R=Vo(j-f[v],T),O=Vo(N-f[k],C),U=!e.middlewareData.shift;let I=R,z=O;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(z=C),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(I=T),U&&!g){const Q=Cr(f.left,0),se=Cr(f.right,0),$=Cr(f.top,0),ie=Cr(f.bottom,0);b?z=N-2*(Q!==0||se!==0?Q+se:Cr(f.left,f.right)):I=j-2*($!==0||ie!==0?$+ie:Cr(f.top,f.bottom))}await u({...e,availableWidth:z,availableHeight:I});const L=await o.getDimensions(c.floating);return N!==L.width||j!==L.height?{reset:{rects:!0}}:{}}}};function tm(){return typeof window<"u"}function md(t){return G3(t)?(t.nodeName||"").toLowerCase():"#document"}function Ar(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Ja(t){var e;return(e=(G3(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function G3(t){return tm()?t instanceof Node||t instanceof Ar(t).Node:!1}function ba(t){return tm()?t instanceof Element||t instanceof Ar(t).Element:!1}function Ka(t){return tm()?t instanceof HTMLElement||t instanceof Ar(t).HTMLElement:!1}function pj(t){return!tm()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Ar(t).ShadowRoot}const TB=new Set(["inline","contents"]);function Ku(t){const{overflow:e,overflowX:n,overflowY:r,display:a}=va(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!TB.has(a)}const MB=new Set(["table","td","th"]);function AB(t){return MB.has(md(t))}const PB=[":popover-open",":modal"];function nm(t){return PB.some(e=>{try{return t.matches(e)}catch{return!1}})}const IB=["transform","translate","scale","rotate","perspective"],RB=["transform","translate","scale","rotate","perspective","filter"],LB=["paint","layout","strict","content"];function ob(t){const e=lb(),n=ba(t)?va(t):t;return IB.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)||RB.some(r=>(n.willChange||"").includes(r))||LB.some(r=>(n.contain||"").includes(r))}function OB(t){let e=Ho(t);for(;Ka(e)&&!id(e);){if(ob(e))return e;if(nm(e))return null;e=Ho(e)}return null}function lb(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const DB=new Set(["html","body","#document"]);function id(t){return DB.has(md(t))}function va(t){return Ar(t).getComputedStyle(t)}function sm(t){return ba(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ho(t){if(md(t)==="html")return t;const e=t.assignedSlot||t.parentNode||pj(t)&&t.host||Ja(t);return pj(e)?e.host:e}function J3(t){const e=Ho(t);return id(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ka(e)&&Ku(e)?e:J3(e)}function _u(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const a=J3(t),i=a===((r=t.ownerDocument)==null?void 0:r.body),o=Ar(a);if(i){const c=F0(o);return e.concat(o,o.visualViewport||[],Ku(a)?a:[],c&&n?_u(c):[])}return e.concat(a,_u(a,[],n))}function F0(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Q3(t){const e=va(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const a=Ka(t),i=a?t.offsetWidth:n,o=a?t.offsetHeight:r,c=kp(n)!==i||kp(r)!==o;return c&&(n=i,r=o),{width:n,height:r,$:c}}function cb(t){return ba(t)?t:t.contextElement}function Jc(t){const e=cb(t);if(!Ka(e))return Ha(1);const n=e.getBoundingClientRect(),{width:r,height:a,$:i}=Q3(e);let o=(i?kp(n.width):n.width)/r,c=(i?kp(n.height):n.height)/a;return(!o||!Number.isFinite(o))&&(o=1),(!c||!Number.isFinite(c))&&(c=1),{x:o,y:c}}const _B=Ha(0);function Y3(t){const e=Ar(t);return!lb()||!e.visualViewport?_B:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function $B(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Ar(t)?!1:e}function Xl(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const a=t.getBoundingClientRect(),i=cb(t);let o=Ha(1);e&&(r?ba(r)&&(o=Jc(r)):o=Jc(t));const c=$B(i,n,r)?Y3(i):Ha(0);let u=(a.left+c.x)/o.x,h=(a.top+c.y)/o.y,f=a.width/o.x,m=a.height/o.y;if(i){const g=Ar(i),b=r&&ba(r)?Ar(r):r;let N=g,j=F0(N);for(;j&&r&&b!==N;){const v=Jc(j),k=j.getBoundingClientRect(),T=va(j),C=k.left+(j.clientLeft+parseFloat(T.paddingLeft))*v.x,R=k.top+(j.clientTop+parseFloat(T.paddingTop))*v.y;u*=v.x,h*=v.y,f*=v.x,m*=v.y,u+=C,h+=R,N=Ar(j),j=F0(N)}}return Cp({width:f,height:m,x:u,y:h})}function rm(t,e){const n=sm(t).scrollLeft;return e?e.left+n:Xl(Ja(t)).left+n}function X3(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-rm(t,n),a=n.top+e.scrollTop;return{x:r,y:a}}function zB(t){let{elements:e,rect:n,offsetParent:r,strategy:a}=t;const i=a==="fixed",o=Ja(r),c=e?nm(e.floating):!1;if(r===o||c&&i)return n;let u={scrollLeft:0,scrollTop:0},h=Ha(1);const f=Ha(0),m=Ka(r);if((m||!m&&!i)&&((md(r)!=="body"||Ku(o))&&(u=sm(r)),Ka(r))){const b=Xl(r);h=Jc(r),f.x=b.x+r.clientLeft,f.y=b.y+r.clientTop}const g=o&&!m&&!i?X3(o,u):Ha(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-u.scrollLeft*h.x+f.x+g.x,y:n.y*h.y-u.scrollTop*h.y+f.y+g.y}}function FB(t){return Array.from(t.getClientRects())}function BB(t){const e=Ja(t),n=sm(t),r=t.ownerDocument.body,a=Cr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=Cr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+rm(t);const c=-n.scrollTop;return va(r).direction==="rtl"&&(o+=Cr(e.clientWidth,r.clientWidth)-a),{width:a,height:i,x:o,y:c}}const mj=25;function VB(t,e){const n=Ar(t),r=Ja(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=lb();(!f||f&&e==="fixed")&&(c=a.offsetLeft,u=a.offsetTop)}const h=rm(r);if(h<=0){const f=r.ownerDocument,m=f.body,g=getComputedStyle(m),b=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,N=Math.abs(r.clientWidth-m.clientWidth-b);N<=mj&&(i-=N)}else h<=mj&&(i+=h);return{width:i,height:o,x:c,y:u}}const HB=new Set(["absolute","fixed"]);function UB(t,e){const n=Xl(t,!0,e==="fixed"),r=n.top+t.clientTop,a=n.left+t.clientLeft,i=Ka(t)?Jc(t):Ha(1),o=t.clientWidth*i.x,c=t.clientHeight*i.y,u=a*i.x,h=r*i.y;return{width:o,height:c,x:u,y:h}}function gj(t,e,n){let r;if(e==="viewport")r=VB(t,n);else if(e==="document")r=BB(Ja(t));else if(ba(e))r=UB(e,n);else{const a=Y3(t);r={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return Cp(r)}function Z3(t,e){const n=Ho(t);return n===e||!ba(n)||id(n)?!1:va(n).position==="fixed"||Z3(n,e)}function WB(t,e){const n=e.get(t);if(n)return n;let r=_u(t,[],!1).filter(c=>ba(c)&&md(c)!=="body"),a=null;const i=va(t).position==="fixed";let o=i?Ho(t):t;for(;ba(o)&&!id(o);){const c=va(o),u=ob(o);!u&&c.position==="fixed"&&(a=null),(i?!u&&!a:!u&&c.position==="static"&&!!a&&HB.has(a.position)||Ku(o)&&!u&&Z3(t,o))?r=r.filter(f=>f!==o):a=c,o=Ho(o)}return e.set(t,r),r}function KB(t){let{element:e,boundary:n,rootBoundary:r,strategy:a}=t;const o=[...n==="clippingAncestors"?nm(e)?[]:WB(e,this._c):[].concat(n),r],c=o[0],u=o.reduce((h,f)=>{const m=gj(e,f,a);return h.top=Cr(m.top,h.top),h.right=Vo(m.right,h.right),h.bottom=Vo(m.bottom,h.bottom),h.left=Cr(m.left,h.left),h},gj(e,c,a));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function qB(t){const{width:e,height:n}=Q3(t);return{width:e,height:n}}function GB(t,e,n){const r=Ka(e),a=Ja(e),i=n==="fixed",o=Xl(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const u=Ha(0);function h(){u.x=rm(a)}if(r||!r&&!i)if((md(e)!=="body"||Ku(a))&&(c=sm(e)),r){const b=Xl(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?X3(a,c):Ha(0),m=o.left+c.scrollLeft-u.x-f.x,g=o.top+c.scrollTop-u.y-f.y;return{x:m,y:g,width:o.width,height:o.height}}function Mx(t){return va(t).position==="static"}function xj(t,e){if(!Ka(t)||va(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Ja(t)===n&&(n=n.ownerDocument.body),n}function e4(t,e){const n=Ar(t);if(nm(t))return n;if(!Ka(t)){let a=Ho(t);for(;a&&!id(a);){if(ba(a)&&!Mx(a))return a;a=Ho(a)}return n}let r=xj(t,e);for(;r&&AB(r)&&Mx(r);)r=xj(r,e);return r&&id(r)&&Mx(r)&&!ob(r)?n:r||OB(t)||n}const JB=async function(t){const e=this.getOffsetParent||e4,n=this.getDimensions,r=await n(t.floating);return{reference:GB(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function QB(t){return va(t).direction==="rtl"}const YB={convertOffsetParentRelativeRectToViewportRelativeRect:zB,getDocumentElement:Ja,getClippingRect:KB,getOffsetParent:e4,getElementRects:JB,getClientRects:FB,getDimensions:qB,getScale:Jc,isElement:ba,isRTL:QB};function t4(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function XB(t,e){let n=null,r;const a=Ja(t);function i(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function o(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),i();const h=t.getBoundingClientRect(),{left:f,top:m,width:g,height:b}=h;if(c||e(),!g||!b)return;const N=mf(m),j=mf(a.clientWidth-(f+g)),v=mf(a.clientHeight-(m+b)),k=mf(f),C={rootMargin:-N+"px "+-j+"px "+-v+"px "+-k+"px",threshold:Cr(0,Vo(1,u))||1};let R=!0;function O(U){const I=U[0].intersectionRatio;if(I!==u){if(!R)return o();I?o(!1,I):r=setTimeout(()=>{o(!1,1e-7)},1e3)}I===1&&!t4(h,t.getBoundingClientRect())&&o(),R=!1}try{n=new IntersectionObserver(O,{...C,root:a.ownerDocument})}catch{n=new IntersectionObserver(O,C)}n.observe(t)}return o(!0),i}function ZB(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=cb(t),f=a||i?[...h?_u(h):[],..._u(e)]:[];f.forEach(k=>{a&&k.addEventListener("scroll",n,{passive:!0}),i&&k.addEventListener("resize",n)});const m=h&&c?XB(h,n):null;let g=-1,b=null;o&&(b=new ResizeObserver(k=>{let[T]=k;T&&T.target===h&&b&&(b.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var C;(C=b)==null||C.observe(e)})),n()}),h&&!u&&b.observe(h),b.observe(e));let N,j=u?Xl(t):null;u&&v();function v(){const k=Xl(t);j&&!t4(j,k)&&n(),j=k,N=requestAnimationFrame(v)}return n(),()=>{var k;f.forEach(T=>{a&&T.removeEventListener("scroll",n),i&&T.removeEventListener("resize",n)}),m==null||m(),(k=b)==null||k.disconnect(),b=null,u&&cancelAnimationFrame(N)}}const e9=kB,t9=SB,n9=NB,s9=EB,r9=wB,yj=vB,a9=CB,i9=(t,e,n)=>{const r=new Map,a={platform:YB,...n},i={...a.platform,_c:r};return bB(t,e,{...a,platform:i})};var o9=typeof document<"u",l9=function(){},Sf=o9?y.useLayoutEffect:l9;function Ep(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(!Ep(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)&&!Ep(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function n4(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function bj(t,e){const n=n4(t);return Math.round(e*n)/n}function Ax(t){const e=y.useRef(t);return Sf(()=>{e.current=t}),e}function c9(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:i,floating:o}={},transform:c=!0,whileElementsMounted:u,open:h}=t,[f,m]=y.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[g,b]=y.useState(r);Ep(g,r)||b(r);const[N,j]=y.useState(null),[v,k]=y.useState(null),T=y.useCallback(F=>{F!==U.current&&(U.current=F,j(F))},[]),C=y.useCallback(F=>{F!==I.current&&(I.current=F,k(F))},[]),R=i||N,O=o||v,U=y.useRef(null),I=y.useRef(null),z=y.useRef(f),L=u!=null,Q=Ax(u),se=Ax(a),$=Ax(h),ie=y.useCallback(()=>{if(!U.current||!I.current)return;const F={placement:e,strategy:n,middleware:g};se.current&&(F.platform=se.current),i9(U.current,I.current,F).then(ge=>{const X={...ge,isPositioned:$.current!==!1};le.current&&!Ep(z.current,X)&&(z.current=X,od.flushSync(()=>{m(X)}))})},[g,e,n,se,$]);Sf(()=>{h===!1&&z.current.isPositioned&&(z.current.isPositioned=!1,m(F=>({...F,isPositioned:!1})))},[h]);const le=y.useRef(!1);Sf(()=>(le.current=!0,()=>{le.current=!1}),[]),Sf(()=>{if(R&&(U.current=R),O&&(I.current=O),R&&O){if(Q.current)return Q.current(R,O,ie);ie()}},[R,O,ie,Q,L]);const me=y.useMemo(()=>({reference:U,floating:I,setReference:T,setFloating:C}),[T,C]),P=y.useMemo(()=>({reference:R,floating:O}),[R,O]),Y=y.useMemo(()=>{const F={position:n,left:0,top:0};if(!P.floating)return F;const ge=bj(P.floating,f.x),X=bj(P.floating,f.y);return c?{...F,transform:"translate("+ge+"px, "+X+"px)",...n4(P.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ge,top:X}},[n,c,P.floating,f.x,f.y]);return y.useMemo(()=>({...f,update:ie,refs:me,elements:P,floatingStyles:Y}),[f,ie,me,P,Y])}const d9=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?yj({element:r.current,padding:a}).fn(n):{}:r?yj({element:r,padding:a}).fn(n):{}}}},u9=(t,e)=>({...e9(t),options:[t,e]}),h9=(t,e)=>({...t9(t),options:[t,e]}),f9=(t,e)=>({...a9(t),options:[t,e]}),p9=(t,e)=>({...n9(t),options:[t,e]}),m9=(t,e)=>({...s9(t),options:[t,e]}),g9=(t,e)=>({...r9(t),options:[t,e]}),x9=(t,e)=>({...d9(t),options:[t,e]});var y9="Arrow",s4=y.forwardRef((t,e)=>{const{children:n,width:r=10,height:a=5,...i}=t;return s.jsx(Mt.svg,{...i,ref:e,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});s4.displayName=y9;var b9=s4,db="Popper",[r4,a4]=Ko(db),[v9,i4]=r4(db),o4=t=>{const{__scopePopper:e,children:n}=t,[r,a]=y.useState(null);return s.jsx(v9,{scope:e,anchor:r,onAnchorChange:a,children:n})};o4.displayName=db;var l4="PopperAnchor",c4=y.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...a}=t,i=i4(l4,n),o=y.useRef(null),c=Jt(e,o),u=y.useRef(null);return y.useEffect(()=>{const h=u.current;u.current=(r==null?void 0:r.current)||o.current,h!==u.current&&i.onAnchorChange(u.current)}),r?null:s.jsx(Mt.div,{...a,ref:c})});c4.displayName=l4;var ub="PopperContent",[N9,w9]=r4(ub),d4=y.forwardRef((t,e)=>{var q,_,Z,re,we,Fe;const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:i="center",alignOffset:o=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:h=[],collisionPadding:f=0,sticky:m="partial",hideWhenDetached:g=!1,updatePositionStrategy:b="optimized",onPlaced:N,...j}=t,v=i4(ub,n),[k,T]=y.useState(null),C=Jt(e,Ue=>T(Ue)),[R,O]=y.useState(null),U=hy(R),I=(U==null?void 0:U.width)??0,z=(U==null?void 0:U.height)??0,L=r+(i!=="center"?"-"+i:""),Q=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},se=Array.isArray(h)?h:[h],$=se.length>0,ie={padding:Q,boundary:se.filter(k9),altBoundary:$},{refs:le,floatingStyles:me,placement:P,isPositioned:Y,middlewareData:F}=c9({strategy:"fixed",placement:L,whileElementsMounted:(...Ue)=>ZB(...Ue,{animationFrame:b==="always"}),elements:{reference:v.anchor},middleware:[u9({mainAxis:a+z,alignmentAxis:o}),u&&h9({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?f9():void 0,...ie}),u&&p9({...ie}),m9({...ie,apply:({elements:Ue,rects:jt,availableWidth:jn,availableHeight:pt})=>{const{width:Pt,height:pn}=jt.reference,Hn=Ue.floating.style;Hn.setProperty("--radix-popper-available-width",`${jn}px`),Hn.setProperty("--radix-popper-available-height",`${pt}px`),Hn.setProperty("--radix-popper-anchor-width",`${Pt}px`),Hn.setProperty("--radix-popper-anchor-height",`${pn}px`)}}),R&&x9({element:R,padding:c}),S9({arrowWidth:I,arrowHeight:z}),g&&g9({strategy:"referenceHidden",...ie})]}),[ge,X]=f4(P),B=zo(N);Os(()=>{Y&&(B==null||B())},[Y,B]);const W=(q=F.arrow)==null?void 0:q.x,fe=(_=F.arrow)==null?void 0:_.y,he=((Z=F.arrow)==null?void 0:Z.centerOffset)!==0,[de,D]=y.useState();return Os(()=>{k&&D(window.getComputedStyle(k).zIndex)},[k]),s.jsx("div",{ref:le.setFloating,"data-radix-popper-content-wrapper":"",style:{...me,transform:Y?me.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:de,"--radix-popper-transform-origin":[(re=F.transformOrigin)==null?void 0:re.x,(we=F.transformOrigin)==null?void 0:we.y].join(" "),...((Fe=F.hide)==null?void 0:Fe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:s.jsx(N9,{scope:n,placedSide:ge,onArrowChange:O,arrowX:W,arrowY:fe,shouldHideArrow:he,children:s.jsx(Mt.div,{"data-side":ge,"data-align":X,...j,ref:C,style:{...j.style,animation:Y?void 0:"none"}})})})});d4.displayName=ub;var u4="PopperArrow",j9={top:"bottom",right:"left",bottom:"top",left:"right"},h4=y.forwardRef(function(e,n){const{__scopePopper:r,...a}=e,i=w9(u4,r),o=j9[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(b9,{...a,ref:n,style:{...a.style,display:"block"}})})});h4.displayName=u4;function k9(t){return t!==null}var S9=t=>({name:"transformOrigin",options:t,fn(e){var v,k,T;const{placement:n,rects:r,middlewareData:a}=e,o=((v=a.arrow)==null?void 0:v.centerOffset)!==0,c=o?0:t.arrowWidth,u=o?0:t.arrowHeight,[h,f]=f4(n),m={start:"0%",center:"50%",end:"100%"}[f],g=(((k=a.arrow)==null?void 0:k.x)??0)+c/2,b=(((T=a.arrow)==null?void 0:T.y)??0)+u/2;let N="",j="";return h==="bottom"?(N=o?m:`${g}px`,j=`${-u}px`):h==="top"?(N=o?m:`${g}px`,j=`${r.floating.height+u}px`):h==="right"?(N=`${-u}px`,j=o?m:`${b}px`):h==="left"&&(N=`${r.floating.width+u}px`,j=o?m:`${b}px`),{data:{x:N,y:j}}}});function f4(t){const[e,n="center"]=t.split("-");return[e,n]}var C9=o4,E9=c4,T9=d4,M9=h4,p4=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"}),A9="VisuallyHidden",P9=y.forwardRef((t,e)=>s.jsx(Mt.span,{...t,ref:e,style:{...p4,...t.style}}));P9.displayName=A9;var I9=[" ","Enter","ArrowUp","ArrowDown"],R9=[" ","Enter"],Zl="Select",[am,im,L9]=cy(Zl),[gd]=Ko(Zl,[L9,a4]),om=a4(),[O9,Qo]=gd(Zl),[D9,_9]=gd(Zl),m4=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:a,onOpenChange:i,value:o,defaultValue:c,onValueChange:u,dir:h,name:f,autoComplete:m,disabled:g,required:b,form:N}=t,j=om(e),[v,k]=y.useState(null),[T,C]=y.useState(null),[R,O]=y.useState(!1),U=Op(h),[I,z]=Bl({prop:r,defaultProp:a??!1,onChange:i,caller:Zl}),[L,Q]=Bl({prop:o,defaultProp:c,onChange:u,caller:Zl}),se=y.useRef(null),$=v?N||!!v.closest("form"):!0,[ie,le]=y.useState(new Set),me=Array.from(ie).map(P=>P.props.value).join(";");return s.jsx(C9,{...j,children:s.jsxs(O9,{required:b,scope:e,trigger:v,onTriggerChange:k,valueNode:T,onValueNodeChange:C,valueNodeHasChildren:R,onValueNodeHasChildrenChange:O,contentId:Io(),value:L,onValueChange:Q,open:I,onOpenChange:z,dir:U,triggerPointerDownPosRef:se,disabled:g,children:[s.jsx(am.Provider,{scope:e,children:s.jsx(D9,{scope:t.__scopeSelect,onNativeOptionAdd:y.useCallback(P=>{le(Y=>new Set(Y).add(P))},[]),onNativeOptionRemove:y.useCallback(P=>{le(Y=>{const F=new Set(Y);return F.delete(P),F})},[]),children:n})}),$?s.jsxs(_4,{"aria-hidden":!0,required:b,tabIndex:-1,name:f,autoComplete:m,value:L,onChange:P=>Q(P.target.value),disabled:g,form:N,children:[L===void 0?s.jsx("option",{value:""}):null,Array.from(ie)]},me):null]})})};m4.displayName=Zl;var g4="SelectTrigger",x4=y.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...a}=t,i=om(n),o=Qo(g4,n),c=o.disabled||r,u=Jt(e,o.onTriggerChange),h=im(n),f=y.useRef("touch"),[m,g,b]=z4(j=>{const v=h().filter(C=>!C.disabled),k=v.find(C=>C.value===o.value),T=F4(v,j,k);T!==void 0&&o.onValueChange(T.value)}),N=j=>{c||(o.onOpenChange(!0),b()),j&&(o.triggerPointerDownPosRef.current={x:Math.round(j.pageX),y:Math.round(j.pageY)})};return s.jsx(E9,{asChild:!0,...i,children:s.jsx(Mt.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":$4(o.value)?"":void 0,...a,ref:u,onClick:St(a.onClick,j=>{j.currentTarget.focus(),f.current!=="mouse"&&N(j)}),onPointerDown:St(a.onPointerDown,j=>{f.current=j.pointerType;const v=j.target;v.hasPointerCapture(j.pointerId)&&v.releasePointerCapture(j.pointerId),j.button===0&&j.ctrlKey===!1&&j.pointerType==="mouse"&&(N(j),j.preventDefault())}),onKeyDown:St(a.onKeyDown,j=>{const v=m.current!=="";!(j.ctrlKey||j.altKey||j.metaKey)&&j.key.length===1&&g(j.key),!(v&&j.key===" ")&&I9.includes(j.key)&&(N(),j.preventDefault())})})})});x4.displayName=g4;var y4="SelectValue",b4=y.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,children:i,placeholder:o="",...c}=t,u=Qo(y4,n),{onValueNodeHasChildrenChange:h}=u,f=i!==void 0,m=Jt(e,u.onValueNodeChange);return Os(()=>{h(f)},[h,f]),s.jsx(Mt.span,{...c,ref:m,style:{pointerEvents:"none"},children:$4(u.value)?s.jsx(s.Fragment,{children:o}):i})});b4.displayName=y4;var $9="SelectIcon",v4=y.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...a}=t;return s.jsx(Mt.span,{"aria-hidden":!0,...a,ref:e,children:r||"▼"})});v4.displayName=$9;var z9="SelectPortal",N4=t=>s.jsx(ry,{asChild:!0,...t});N4.displayName=z9;var ec="SelectContent",w4=y.forwardRef((t,e)=>{const n=Qo(ec,t.__scopeSelect),[r,a]=y.useState();if(Os(()=>{a(new DocumentFragment)},[]),!n.open){const i=r;return i?od.createPortal(s.jsx(j4,{scope:t.__scopeSelect,children:s.jsx(am.Slot,{scope:t.__scopeSelect,children:s.jsx("div",{children:t.children})})}),i):null}return s.jsx(k4,{...t,ref:e})});w4.displayName=ec;var fa=10,[j4,Yo]=gd(ec),F9="SelectContentImpl",B9=ku("SelectContent.RemoveScroll"),k4=y.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:o,side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:b,sticky:N,hideWhenDetached:j,avoidCollisions:v,...k}=t,T=Qo(ec,n),[C,R]=y.useState(null),[O,U]=y.useState(null),I=Jt(e,q=>R(q)),[z,L]=y.useState(null),[Q,se]=y.useState(null),$=im(n),[ie,le]=y.useState(!1),me=y.useRef(!1);y.useEffect(()=>{if(C)return _k(C)},[C]),Tk();const P=y.useCallback(q=>{const[_,...Z]=$().map(Fe=>Fe.ref.current),[re]=Z.slice(-1),we=document.activeElement;for(const Fe of q)if(Fe===we||(Fe==null||Fe.scrollIntoView({block:"nearest"}),Fe===_&&O&&(O.scrollTop=0),Fe===re&&O&&(O.scrollTop=O.scrollHeight),Fe==null||Fe.focus(),document.activeElement!==we))return},[$,O]),Y=y.useCallback(()=>P([z,C]),[P,z,C]);y.useEffect(()=>{ie&&Y()},[ie,Y]);const{onOpenChange:F,triggerPointerDownPosRef:ge}=T;y.useEffect(()=>{if(C){let q={x:0,y:0};const _=re=>{var we,Fe;q={x:Math.abs(Math.round(re.pageX)-(((we=ge.current)==null?void 0:we.x)??0)),y:Math.abs(Math.round(re.pageY)-(((Fe=ge.current)==null?void 0:Fe.y)??0))}},Z=re=>{q.x<=10&&q.y<=10?re.preventDefault():C.contains(re.target)||F(!1),document.removeEventListener("pointermove",_),ge.current=null};return ge.current!==null&&(document.addEventListener("pointermove",_),document.addEventListener("pointerup",Z,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",_),document.removeEventListener("pointerup",Z,{capture:!0})}}},[C,F,ge]),y.useEffect(()=>{const q=()=>F(!1);return window.addEventListener("blur",q),window.addEventListener("resize",q),()=>{window.removeEventListener("blur",q),window.removeEventListener("resize",q)}},[F]);const[X,B]=z4(q=>{const _=$().filter(we=>!we.disabled),Z=_.find(we=>we.ref.current===document.activeElement),re=F4(_,q,Z);re&&setTimeout(()=>re.ref.current.focus())}),W=y.useCallback((q,_,Z)=>{const re=!me.current&&!Z;(T.value!==void 0&&T.value===_||re)&&(L(q),re&&(me.current=!0))},[T.value]),fe=y.useCallback(()=>C==null?void 0:C.focus(),[C]),he=y.useCallback((q,_,Z)=>{const re=!me.current&&!Z;(T.value!==void 0&&T.value===_||re)&&se(q)},[T.value]),de=r==="popper"?B0:S4,D=de===B0?{side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:b,sticky:N,hideWhenDetached:j,avoidCollisions:v}:{};return s.jsx(j4,{scope:n,content:C,viewport:O,onViewportChange:U,itemRefCallback:W,selectedItem:z,onItemLeave:fe,itemTextRefCallback:he,focusSelectedItem:Y,selectedItemText:Q,position:r,isPositioned:ie,searchRef:X,children:s.jsx(ay,{as:B9,allowPinchZoom:!0,children:s.jsx(sy,{asChild:!0,trapped:T.open,onMountAutoFocus:q=>{q.preventDefault()},onUnmountAutoFocus:St(a,q=>{var _;(_=T.trigger)==null||_.focus({preventScroll:!0}),q.preventDefault()}),children:s.jsx(ny,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:q=>q.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:s.jsx(de,{role:"listbox",id:T.contentId,"data-state":T.open?"open":"closed",dir:T.dir,onContextMenu:q=>q.preventDefault(),...k,...D,onPlaced:()=>le(!0),ref:I,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:St(k.onKeyDown,q=>{const _=q.ctrlKey||q.altKey||q.metaKey;if(q.key==="Tab"&&q.preventDefault(),!_&&q.key.length===1&&B(q.key),["ArrowUp","ArrowDown","Home","End"].includes(q.key)){let re=$().filter(we=>!we.disabled).map(we=>we.ref.current);if(["ArrowUp","End"].includes(q.key)&&(re=re.slice().reverse()),["ArrowUp","ArrowDown"].includes(q.key)){const we=q.target,Fe=re.indexOf(we);re=re.slice(Fe+1)}setTimeout(()=>P(re)),q.preventDefault()}})})})})})})});k4.displayName=F9;var V9="SelectItemAlignedPosition",S4=y.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...a}=t,i=Qo(ec,n),o=Yo(ec,n),[c,u]=y.useState(null),[h,f]=y.useState(null),m=Jt(e,I=>f(I)),g=im(n),b=y.useRef(!1),N=y.useRef(!0),{viewport:j,selectedItem:v,selectedItemText:k,focusSelectedItem:T}=o,C=y.useCallback(()=>{if(i.trigger&&i.valueNode&&c&&h&&j&&v&&k){const I=i.trigger.getBoundingClientRect(),z=h.getBoundingClientRect(),L=i.valueNode.getBoundingClientRect(),Q=k.getBoundingClientRect();if(i.dir!=="rtl"){const we=Q.left-z.left,Fe=L.left-we,Ue=I.left-Fe,jt=I.width+Ue,jn=Math.max(jt,z.width),pt=window.innerWidth-fa,Pt=Lf(Fe,[fa,Math.max(fa,pt-jn)]);c.style.minWidth=jt+"px",c.style.left=Pt+"px"}else{const we=z.right-Q.right,Fe=window.innerWidth-L.right-we,Ue=window.innerWidth-I.right-Fe,jt=I.width+Ue,jn=Math.max(jt,z.width),pt=window.innerWidth-fa,Pt=Lf(Fe,[fa,Math.max(fa,pt-jn)]);c.style.minWidth=jt+"px",c.style.right=Pt+"px"}const se=g(),$=window.innerHeight-fa*2,ie=j.scrollHeight,le=window.getComputedStyle(h),me=parseInt(le.borderTopWidth,10),P=parseInt(le.paddingTop,10),Y=parseInt(le.borderBottomWidth,10),F=parseInt(le.paddingBottom,10),ge=me+P+ie+F+Y,X=Math.min(v.offsetHeight*5,ge),B=window.getComputedStyle(j),W=parseInt(B.paddingTop,10),fe=parseInt(B.paddingBottom,10),he=I.top+I.height/2-fa,de=$-he,D=v.offsetHeight/2,q=v.offsetTop+D,_=me+P+q,Z=ge-_;if(_<=he){const we=se.length>0&&v===se[se.length-1].ref.current;c.style.bottom="0px";const Fe=h.clientHeight-j.offsetTop-j.offsetHeight,Ue=Math.max(de,D+(we?fe:0)+Fe+Y),jt=_+Ue;c.style.height=jt+"px"}else{const we=se.length>0&&v===se[0].ref.current;c.style.top="0px";const Ue=Math.max(he,me+j.offsetTop+(we?W:0)+D)+Z;c.style.height=Ue+"px",j.scrollTop=_-he+j.offsetTop}c.style.margin=`${fa}px 0`,c.style.minHeight=X+"px",c.style.maxHeight=$+"px",r==null||r(),requestAnimationFrame(()=>b.current=!0)}},[g,i.trigger,i.valueNode,c,h,j,v,k,i.dir,r]);Os(()=>C(),[C]);const[R,O]=y.useState();Os(()=>{h&&O(window.getComputedStyle(h).zIndex)},[h]);const U=y.useCallback(I=>{I&&N.current===!0&&(C(),T==null||T(),N.current=!1)},[C,T]);return s.jsx(U9,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:b,onScrollButtonChange:U,children:s.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:R},children:s.jsx(Mt.div,{...a,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});S4.displayName=V9;var H9="SelectPopperPosition",B0=y.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=fa,...i}=t,o=om(n);return s.jsx(T9,{...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)"}})});B0.displayName=H9;var[U9,hb]=gd(ec,{}),V0="SelectViewport",C4=y.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...a}=t,i=Yo(V0,n),o=hb(V0,n),c=Jt(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(am.Slot,{scope:n,children:s.jsx(Mt.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:St(a.onScroll,h=>{const f=h.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:g}=o;if(g!=null&&g.current&&m){const b=Math.abs(u.current-f.scrollTop);if(b>0){const N=window.innerHeight-fa*2,j=parseFloat(m.style.minHeight),v=parseFloat(m.style.height),k=Math.max(j,v);if(k0?R:0,m.style.justifyContent="flex-end")}}}u.current=f.scrollTop})})})]})});C4.displayName=V0;var E4="SelectGroup",[W9,K9]=gd(E4),q9=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=Io();return s.jsx(W9,{scope:n,id:a,children:s.jsx(Mt.div,{role:"group","aria-labelledby":a,...r,ref:e})})});q9.displayName=E4;var T4="SelectLabel",G9=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=K9(T4,n);return s.jsx(Mt.div,{id:a.id,...r,ref:e})});G9.displayName=T4;var Tp="SelectItem",[J9,M4]=gd(Tp),A4=y.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:i,...o}=t,c=Qo(Tp,n),u=Yo(Tp,n),h=c.value===r,[f,m]=y.useState(i??""),[g,b]=y.useState(!1),N=Jt(e,T=>{var C;return(C=u.itemRefCallback)==null?void 0:C.call(u,T,r,a)}),j=Io(),v=y.useRef("touch"),k=()=>{a||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return s.jsx(J9,{scope:n,value:r,disabled:a,textId:j,isSelected:h,onItemTextChange:y.useCallback(T=>{m(C=>C||((T==null?void 0:T.textContent)??"").trim())},[]),children:s.jsx(am.ItemSlot,{scope:n,value:r,disabled:a,textValue:f,children:s.jsx(Mt.div,{role:"option","aria-labelledby":j,"data-highlighted":g?"":void 0,"aria-selected":h&&g,"data-state":h?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...o,ref:N,onFocus:St(o.onFocus,()=>b(!0)),onBlur:St(o.onBlur,()=>b(!1)),onClick:St(o.onClick,()=>{v.current!=="mouse"&&k()}),onPointerUp:St(o.onPointerUp,()=>{v.current==="mouse"&&k()}),onPointerDown:St(o.onPointerDown,T=>{v.current=T.pointerType}),onPointerMove:St(o.onPointerMove,T=>{var C;v.current=T.pointerType,a?(C=u.onItemLeave)==null||C.call(u):v.current==="mouse"&&T.currentTarget.focus({preventScroll:!0})}),onPointerLeave:St(o.onPointerLeave,T=>{var C;T.currentTarget===document.activeElement&&((C=u.onItemLeave)==null||C.call(u))}),onKeyDown:St(o.onKeyDown,T=>{var R;((R=u.searchRef)==null?void 0:R.current)!==""&&T.key===" "||(R9.includes(T.key)&&k(),T.key===" "&&T.preventDefault())})})})})});A4.displayName=Tp;var ou="SelectItemText",P4=y.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,...i}=t,o=Qo(ou,n),c=Yo(ou,n),u=M4(ou,n),h=_9(ou,n),[f,m]=y.useState(null),g=Jt(e,k=>m(k),u.onItemTextChange,k=>{var T;return(T=c.itemTextRefCallback)==null?void 0:T.call(c,k,u.value,u.disabled)}),b=f==null?void 0:f.textContent,N=y.useMemo(()=>s.jsx("option",{value:u.value,disabled:u.disabled,children:b},u.value),[u.disabled,u.value,b]),{onNativeOptionAdd:j,onNativeOptionRemove:v}=h;return Os(()=>(j(N),()=>v(N)),[j,v,N]),s.jsxs(s.Fragment,{children:[s.jsx(Mt.span,{id:u.textId,...i,ref:g}),u.isSelected&&o.valueNode&&!o.valueNodeHasChildren?od.createPortal(i.children,o.valueNode):null]})});P4.displayName=ou;var I4="SelectItemIndicator",R4=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return M4(I4,n).isSelected?s.jsx(Mt.span,{"aria-hidden":!0,...r,ref:e}):null});R4.displayName=I4;var H0="SelectScrollUpButton",L4=y.forwardRef((t,e)=>{const n=Yo(H0,t.__scopeSelect),r=hb(H0,t.__scopeSelect),[a,i]=y.useState(!1),o=Jt(e,r.onScrollButtonChange);return Os(()=>{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(D4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});L4.displayName=H0;var U0="SelectScrollDownButton",O4=y.forwardRef((t,e)=>{const n=Yo(U0,t.__scopeSelect),r=hb(U0,t.__scopeSelect),[a,i]=y.useState(!1),o=Jt(e,r.onScrollButtonChange);return Os(()=>{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(D4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});O4.displayName=U0;var D4=y.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=t,i=Yo("SelectScrollButton",n),o=y.useRef(null),c=im(n),u=y.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return y.useEffect(()=>()=>u(),[u]),Os(()=>{var f;const h=c().find(m=>m.ref.current===document.activeElement);(f=h==null?void 0:h.ref.current)==null||f.scrollIntoView({block:"nearest"})},[c]),s.jsx(Mt.div,{"aria-hidden":!0,...a,ref:e,style:{flexShrink:0,...a.style},onPointerDown:St(a.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:St(a.onPointerMove,()=>{var h;(h=i.onItemLeave)==null||h.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:St(a.onPointerLeave,()=>{u()})})}),Q9="SelectSeparator",Y9=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return s.jsx(Mt.div,{"aria-hidden":!0,...r,ref:e})});Y9.displayName=Q9;var W0="SelectArrow",X9=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=om(n),i=Qo(W0,n),o=Yo(W0,n);return i.open&&o.position==="popper"?s.jsx(M9,{...a,...r,ref:e}):null});X9.displayName=W0;var Z9="SelectBubbleInput",_4=y.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const a=y.useRef(null),i=Jt(r,a),o=uy(e);return y.useEffect(()=>{const c=a.current;if(!c)return;const u=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(o!==e&&f){const m=new Event("change",{bubbles:!0});f.call(c,e),c.dispatchEvent(m)}},[o,e]),s.jsx(Mt.select,{...n,style:{...p4,...n.style},ref:i,defaultValue:e})});_4.displayName=Z9;function $4(t){return t===""||t===void 0}function z4(t){const e=zo(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 F4(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=eV(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 eV(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var tV=m4,B4=x4,nV=b4,sV=v4,rV=N4,V4=w4,aV=C4,H4=A4,iV=P4,oV=R4,lV=L4,cV=O4;const jo=tV,ko=nV,Ti=y.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(B4,{ref:r,className:zt("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(sV,{asChild:!0,children:s.jsx($l,{className:"h-4 w-4 opacity-50"})})]}));Ti.displayName=B4.displayName;const Mi=y.forwardRef(({className:t,children:e,position:n="popper",...r},a)=>s.jsx(rV,{children:s.jsxs(V4,{ref:a,className:zt("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(lV,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(zx,{className:"h-4 w-4"})}),s.jsx(aV,{className:"p-1",children:e}),s.jsx(cV,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx($l,{className:"h-4 w-4"})})]})}));Mi.displayName=V4.displayName;const hs=y.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(H4,{ref:r,className:zt("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(oV,{children:s.jsx(Pp,{className:"h-4 w-4"})})}),s.jsx(iV,{children:e})]}));hs.displayName=H4.displayName;const vj=["📖","📕","📗","📘","📙","📓","📔","📒","📚","📖"];function dV(t){return t.title==="序言"||t.title.includes("序言")}function Nj(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 Px(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 uV({parts:t,expandedParts:e,onTogglePart:n,onReorder:r,onReadSection:a,onDeleteSection:i,onAddSectionInPart:o,onAddChapterInPart:c,onDeleteChapter:u,onEditPart:h,onDeletePart:f,onEditChapter:m,selectedSectionIds:g=[],onToggleSectionSelect:b,onShowSectionOrders:N,pinnedSectionIds:j=[]}){const[v,k]=y.useState(null),[T,C]=y.useState(null),R=($,ie)=>(v==null?void 0:v.type)===$&&(v==null?void 0:v.id)===ie,O=($,ie)=>(T==null?void 0:T.type)===$&&(T==null?void 0:T.id)===ie,U=y.useCallback(()=>{const $=[];for(const ie of t)for(const le of ie.chapters)for(const me of le.sections)$.push({id:me.id,partId:ie.id,partTitle:ie.title,chapterId:le.id,chapterTitle:le.title});return $},[t]),I=y.useCallback(async($,ie,le,me)=>{var X;$.preventDefault(),$.stopPropagation();const P=$.dataTransfer.getData("text/plain"),Y=Px(P);if(!Y||Y.type===ie&&Y.id===le)return;const F=U(),ge=new Map(F.map(B=>[B.id,B]));if(Y.type==="part"&&ie==="part"){const B=t.map(D=>D.id),W=B.indexOf(Y.id),fe=B.indexOf(le);if(W===-1||fe===-1)return;const he=[...B];he.splice(W,1),he.splice(W_.id===D);if(q)for(const _ of q.chapters)for(const Z of _.sections){const re=ge.get(Z.id);re&&de.push(re)}}await r(de);return}if(Y.type==="chapter"&&(ie==="chapter"||ie==="section"||ie==="part")){const B=t.find(re=>re.chapters.some(we=>we.id===Y.id)),W=B==null?void 0:B.chapters.find(re=>re.id===Y.id);if(!B||!W)return;let fe,he,de=null;if(ie==="section"){const re=ge.get(le);if(!re)return;fe=re.partId,he=re.partTitle,de=le}else if(ie==="chapter"){const re=t.find(Ue=>Ue.chapters.some(jt=>jt.id===le)),we=re==null?void 0:re.chapters.find(Ue=>Ue.id===le);if(!re||!we)return;fe=re.id,he=re.title;const Fe=F.filter(Ue=>Ue.chapterId===le).pop();de=(Fe==null?void 0:Fe.id)??null}else{const re=t.find(we=>we.id===le);if(!re)return;if(fe=re.id,he=re.title,re.chapters[0]){const we=F.filter(Fe=>Fe.partId===re.id&&Fe.chapterId===re.chapters[0].id);de=((X=we[we.length-1])==null?void 0:X.id)??null}}const D=W.sections.map(re=>re.id),q=F.filter(re=>!D.includes(re.id));let _=q.length;if(de){const re=q.findIndex(we=>we.id===de);re>=0&&(_=re+1)}const Z=D.map(re=>({...ge.get(re),partId:fe,partTitle:he,chapterId:W.id,chapterTitle:W.title}));await r([...q.slice(0,_),...Z,...q.slice(_)]);return}if(Y.type==="section"&&(ie==="section"||ie==="chapter"||ie==="part")){if(!me)return;const{partId:B,partTitle:W,chapterId:fe,chapterTitle:he}=me,de=F.findIndex(re=>re.id===Y.id);if(de===-1)return;const D=F.filter(re=>re.id!==Y.id);let q;if(ie==="section"){const re=D.findIndex(we=>we.id===le);q=re>=0?re+1:D.length}else if(ie==="chapter"){const re=D.filter(we=>we.chapterId===le).pop();q=re?D.findIndex(we=>we.id===re.id)+1:D.length}else{const re=t.find(we=>we.id===le);if(re!=null&&re.chapters[0]){const we=D.filter(Ue=>Ue.partId===re.id&&Ue.chapterId===re.chapters[0].id),Fe=we[we.length-1];q=Fe?D.findIndex(Ue=>Ue.id===Fe.id)+1:D.length}else q=D.length}const Z={...F[de],partId:B,partTitle:W,chapterId:fe,chapterTitle:he};D.splice(q,0,Z),await r(D)}},[t,U,r]),z=($,ie,le)=>({onDragEnter:me=>{me.preventDefault(),me.stopPropagation(),me.dataTransfer.dropEffect="move",C({type:$,id:ie})},onDragOver:me=>{me.preventDefault(),me.stopPropagation(),me.dataTransfer.dropEffect="move",C({type:$,id:ie})},onDragLeave:()=>C(null),onDrop:me=>{C(null);const P=Px(me.dataTransfer.getData("text/plain"));P&&($==="section"&&P.type==="section"&&P.id===ie||($==="part"?P.type==="part"?I(me,"part",ie):le&&I(me,"part",ie,le):$==="chapter"&&le?(P.type==="section"||P.type==="chapter")&&I(me,"chapter",ie,le):$==="section"&&le&&I(me,"section",ie,le)))}}),L=$=>vj[$%vj.length],Q=$=>t.slice(0,$).filter(ie=>!dV(ie)).length,se=$=>s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-gray-500 font-mono text-xs tabular-nums shrink-0 mr-1.5 max-w-[72px] truncate",title:`章节ID: ${$.id}`,children:$.id}),s.jsx("span",{className:"truncate",children:$.title})]});return s.jsx("div",{className:"space-y-3",children:t.map(($,ie)=>{var W,fe,he,de;const le=$.title==="序言"||$.title.includes("序言"),me=$.title==="尾声"||$.title.includes("尾声"),P=$.title==="附录"||$.title.includes("附录"),Y=O("part",$.id),F=e.includes($.id),ge=$.chapters.length,X=$.chapters.reduce((D,q)=>D+q.sections.length,0);if(le&&$.chapters.length===1&&$.chapters[0].sections.length===1){const D=$.chapters[0].sections[0],q=O("section",D.id),_={partId:$.id,partTitle:$.title,chapterId:$.chapters[0].id,chapterTitle:$.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:Z=>{Z.stopPropagation(),Z.dataTransfer.setData("text/plain","section:"+D.id),Z.dataTransfer.effectAllowed="move",k({type:"section",id:D.id})},onDragEnd:()=>{k(null),C(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${q?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${R("section",D.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...z("section",D.id,_),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(xi,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:Z=>Z.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(D.id),onChange:()=>b(D.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:s.jsx(fr,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[$.chapters[0].title," | ",D.title]}),j.includes(D.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(Vc,{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:Z=>Z.stopPropagation(),onClick:Z=>Z.stopPropagation(),children:[D.price===0||D.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",D.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",D.clickCount??0," · 付款 ",D.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(D.hotScore??0).toFixed(1)," · 第",D.hotRank&&D.hotRank>0?D.hotRank:"-","名"]}),N&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>N(D),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(D),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(D),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Zn,{className:"w-3.5 h-3.5"})})]})]})]},$.id)}if($.title==="2026每日派对干货"||$.title.includes("2026每日派对干货")){const D=O("part",$.id);return s.jsxs("div",{className:`rounded-xl border overflow-hidden transition-all duration-200 ${D?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50 bg-[#1C1C1E]"}`,...z("part",$.id,{partId:$.id,partTitle:$.title,chapterId:((W=$.chapters[0])==null?void 0:W.id)??"",chapterTitle:((fe=$.chapters[0])==null?void 0:fe.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:q=>{q.stopPropagation(),q.dataTransfer.setData("text/plain","part:"+$.id),q.dataTransfer.effectAllowed="move",k({type:"part",id:$.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${R("part",$.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/50"}`,children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(xi,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),s.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac]/80 flex items-center justify-center text-white font-bold shrink-0",children:$.badgeText||"派"}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:$.title}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:Nj($)})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:q=>q.stopPropagation(),onClick:q=>q.stopPropagation(),children:[o&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o($),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx(Fn,{className:"w-3.5 h-3.5"})}),h&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h($),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),f&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f($),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(Zn,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",title:"本篇章数与节数",children:[ge," 章 · ",X," 节"]}),s.jsx("button",{type:"button",draggable:!1,className:"p-1 rounded-md hover:bg-white/10 text-gray-500",title:F?"收起":"展开",onMouseDown:q=>q.stopPropagation(),onClick:q=>{q.stopPropagation(),n($.id)},children:F?s.jsx($l,{className:"w-5 h-5"}):s.jsx(El,{className:"w-5 h-5"})})]})]}),F&&$.chapters.length>0&&s.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:$.chapters.map(q=>s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[s.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:q.title}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:_=>_.stopPropagation(),children:[m&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>m($,q),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),c&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>c($),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx(Fn,{className:"w-3.5 h-3.5"})}),u&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>u($,q),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(Zn,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:q.sections.map(_=>{const Z=O("section",_.id);return s.jsxs("div",{draggable:!0,onDragStart:re=>{re.stopPropagation(),re.dataTransfer.setData("text/plain","section:"+_.id),re.dataTransfer.effectAllowed="move",k({type:"section",id:_.id})},onDragEnd:()=>{k(null),C(null)},onClick:()=>a(_),className:`flex items-center justify-between py-2 px-3 rounded-lg min-h-[40px] cursor-pointer select-none transition-all duration-200 ${Z?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${R("section",_.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...z("section",_.id,{partId:$.id,partTitle:$.title,chapterId:q.id,chapterTitle:q.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(xi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:re=>re.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(_.id),onChange:()=>b(_.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx("span",{className:"text-sm text-gray-200 truncate flex items-center min-w-0",children:se(_)}),j.includes(_.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(Vc,{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:re=>re.stopPropagation(),children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",_.clickCount??0," · 付款 ",_.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(_.hotScore??0).toFixed(1)," · 第",_.hotRank&&_.hotRank>0?_.hotRank:"-","名"]}),N&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>N(_),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(_),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Zn,{className:"w-3.5 h-3.5"})})]})]},_.id)})})]},q.id))})]},$.id)}if(P)return s.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"附录"}),s.jsx("div",{className:"space-y-3",children:$.chapters.map((D,q)=>D.sections.length>0?D.sections.map(_=>{const Z=O("section",_.id);return s.jsxs("div",{draggable:!0,onDragStart:re=>{re.stopPropagation(),re.dataTransfer.setData("text/plain","section:"+_.id),re.dataTransfer.effectAllowed="move",k({type:"section",id:_.id})},onDragEnd:()=>{k(null),C(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 group cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${Z?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${R("section",_.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...z("section",_.id,{partId:$.id,partTitle:$.title,chapterId:D.id,chapterTitle:D.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(xi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:re=>re.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(_.id),onChange:()=>b(_.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-300 truncate",children:["附录",q+1," | ",D.title," | ",_.title]}),j.includes(_.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(Vc,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",_.clickCount??0," · 付款 ",_.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(_.hotScore??0).toFixed(1)," · 第",_.hotRank&&_.hotRank>0?_.hotRank:"-","名"]}),N&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>N(_),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>a(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>i(_),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Zn,{className:"w-3.5 h-3.5"})})]})]}),s.jsx(El,{className:"w-4 h-4 text-gray-500 shrink-0"})]},_.id)}):s.jsxs("div",{className:"flex justify-between items-center py-2 select-none hover:bg-[#162840]/50 rounded px-2 -mx-2",children:[s.jsxs("span",{className:"text-sm text-gray-500",children:["附录",q+1," | ",D.title,"(空)"]}),s.jsx(El,{className:"w-4 h-4 text-gray-500 shrink-0"})]},D.id))})]},$.id);if(me&&$.chapters.length===1&&$.chapters[0].sections.length===1){const D=$.chapters[0].sections[0],q=O("section",D.id),_={partId:$.id,partTitle:$.title,chapterId:$.chapters[0].id,chapterTitle:$.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:Z=>{Z.stopPropagation(),Z.dataTransfer.setData("text/plain","section:"+D.id),Z.dataTransfer.effectAllowed="move",k({type:"section",id:D.id})},onDragEnd:()=>{k(null),C(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${q?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${R("section",D.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...z("section",D.id,_),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(xi,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:Z=>Z.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(D.id),onChange:()=>b(D.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:s.jsx(fr,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[$.chapters[0].title," | ",D.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:Z=>Z.stopPropagation(),onClick:Z=>Z.stopPropagation(),children:[D.price===0||D.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",D.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",D.clickCount??0," · 付款 ",D.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(D.hotScore??0).toFixed(1)," · 第",D.hotRank&&D.hotRank>0?D.hotRank:"-","名"]}),N&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>N(D),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(D),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(D),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Zn,{className:"w-3.5 h-3.5"})})]})]})]},$.id)}return me?s.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"尾声"}),s.jsx("div",{className:"space-y-3",children:$.chapters.map(D=>D.sections.map(q=>{const _=O("section",q.id);return s.jsxs("div",{draggable:!0,onDragStart:Z=>{Z.stopPropagation(),Z.dataTransfer.setData("text/plain","section:"+q.id),Z.dataTransfer.effectAllowed="move",k({type:"section",id:q.id})},onDragEnd:()=>{k(null),C(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${_?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${R("section",q.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...z("section",q.id,{partId:$.id,partTitle:$.title,chapterId:D.id,chapterTitle:D.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(xi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:Z=>Z.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(q.id),onChange:()=>b(q.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-300",children:[D.title," | ",q.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",q.clickCount??0," · 付款 ",q.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(q.hotScore??0).toFixed(1)," · 第",q.hotRank&&q.hotRank>0?q.hotRank:"-","名"]}),N&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>N(q),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(q),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(q),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Zn,{className:"w-3.5 h-3.5"})})]})]})]},q.id)}))})]},$.id):s.jsxs("div",{className:`rounded-xl border bg-[#1C1C1E] overflow-hidden transition-all duration-200 ${Y?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50"}`,...z("part",$.id,{partId:$.id,partTitle:$.title,chapterId:((he=$.chapters[0])==null?void 0:he.id)??"",chapterTitle:((de=$.chapters[0])==null?void 0:de.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:D=>{D.stopPropagation(),D.dataTransfer.setData("text/plain","part:"+$.id),D.dataTransfer.effectAllowed="move",k({type:"part",id:$.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${R("part",$.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] rounded-xl shadow-xl shadow-[#38bdac]/20":"hover:bg-[#162840]/50"}`,children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(xi,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),s.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac] flex items-center justify-center text-lg shadow-lg shadow-[#38bdac]/30 shrink-0",children:$.badgeText||L(Q(ie))}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:$.title}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:Nj($)})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:D=>D.stopPropagation(),onClick:D=>D.stopPropagation(),children:[o&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o($),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx(Fn,{className:"w-3.5 h-3.5"})}),h&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h($),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),f&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f($),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(Zn,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",title:"本篇章数与节数",children:[ge," 章 · ",X," 节"]}),s.jsx("button",{type:"button",draggable:!1,className:"p-1 rounded-md hover:bg-white/10 text-gray-500",title:F?"收起":"展开",onMouseDown:D=>D.stopPropagation(),onClick:D=>{D.stopPropagation(),n($.id)},children:F?s.jsx($l,{className:"w-5 h-5"}):s.jsx(El,{className:"w-5 h-5"})})]})]}),F&&s.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:$.chapters.map(D=>{const q=O("chapter",D.id);return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[s.jsxs("div",{draggable:!0,onDragStart:_=>{_.stopPropagation(),_.dataTransfer.setData("text/plain","chapter:"+D.id),_.dataTransfer.effectAllowed="move",k({type:"chapter",id:D.id})},onDragEnd:()=>{k(null),C(null)},onDragEnter:_=>{_.preventDefault(),_.stopPropagation(),_.dataTransfer.dropEffect="move",C({type:"chapter",id:D.id})},onDragOver:_=>{_.preventDefault(),_.stopPropagation(),_.dataTransfer.dropEffect="move",C({type:"chapter",id:D.id})},onDragLeave:()=>C(null),onDrop:_=>{C(null);const Z=Px(_.dataTransfer.getData("text/plain"));if(!Z)return;const re={partId:$.id,partTitle:$.title,chapterId:D.id,chapterTitle:D.title};(Z.type==="section"||Z.type==="chapter")&&I(_,"chapter",D.id,re)},className:`flex-1 min-w-0 py-2 px-2 rounded cursor-grab active:cursor-grabbing select-none -mx-2 transition-all duration-200 flex items-center gap-2 ${q?"bg-[#38bdac]/15 ring-1 ring-[#38bdac]/50":""} ${R("chapter",D.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/30"}`,children:[s.jsx(xi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),s.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:D.title})]}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:_=>_.stopPropagation(),children:[m&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>m($,D),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),c&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>c($),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx(Fn,{className:"w-3.5 h-3.5"})}),u&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>u($,D),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(Zn,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:D.sections.map(_=>{const Z=O("section",_.id);return s.jsxs("div",{draggable:!0,onDragStart:re=>{re.stopPropagation(),re.dataTransfer.setData("text/plain","section:"+_.id),re.dataTransfer.effectAllowed="move",k({type:"section",id:_.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between py-2 px-3 rounded-lg group cursor-grab active:cursor-grabbing select-none min-h-[40px] transition-all duration-200 ${Z?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${R("section",_.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] shadow-lg":"hover:bg-[#162840]/50"}`,...z("section",_.id,{partId:$.id,partTitle:$.title,chapterId:D.id,chapterTitle:D.title}),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:re=>re.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(_.id),onChange:()=>b(_.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx(xi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),s.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${_.price===0||_.isFree?"border-2 border-[#38bdac] bg-transparent":"bg-gray-500"}`}),s.jsx("span",{className:"text-sm text-gray-200 truncate flex items-center min-w-0",children:se(_)}),j.includes(_.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(Vc,{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:re=>re.stopPropagation(),onClick:re=>re.stopPropagation(),children:[_.isNew&&s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"NEW"}),_.price===0||_.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",_.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",title:"点击次数 · 付款笔数",children:["点击 ",_.clickCount??0," · 付款 ",_.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(_.hotScore??0).toFixed(1)," · 第",_.hotRank&&_.hotRank>0?_.hotRank:"-","名"]}),N&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>N(_),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5 shrink-0",children:"付款记录"}),s.jsxs("div",{className:"flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(_),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Zn,{className:"w-3.5 h-3.5"})})]})]})]},_.id)})})]},D.id)})})]},$.id)})})}function hV(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 fV(t){return Oe(`/api/db/person?personId=${encodeURIComponent(t)}`)}function pV(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 mV=10;function U4(t){const e=(t??"").trim();if(!e)return"";if(/^https?:\/\//i.test(e))return ya(e);const n=e.startsWith("/")?e:`/${e}`;return ya(Fl(n))}function gV(t){const{nickname:e,avatar:n}=t,r=U4(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 xV(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 yV({id:t,label:e,value:n,preview:r,previewLoading:a=!1,onSelect:i,onClear:o,containerOpen:c,disabled:u=!1,hint:h,className:f,portalMountRef:m,positionContainerRef:g}){const[b,N]=y.useState(!1),[j,v]=y.useState(""),k=Ul(j,300),[T,C]=y.useState([]),[R,O]=y.useState(!1),[U,I]=y.useState(!1),[z,L]=y.useState(0),Q=y.useRef(1),se=y.useRef(!1),$=y.useRef(!1),ie=y.useRef(null),le=y.useRef(null),[me,P]=y.useState({top:0,left:0,width:320,maxH:360}),Y=y.useCallback(()=>{const D=le.current;if(!D||typeof window>"u")return;const q=D.getBoundingClientRect(),_=Math.min(400,Math.max(200,window.innerHeight-q.bottom-16)),Z=g==null?void 0:g.current;if(Z){const re=Z.getBoundingClientRect();P({top:q.bottom-re.top+6,left:q.left-re.left,width:Math.max(q.width,300),maxH:_})}else P({top:q.bottom+6,left:q.left,width:Math.max(q.width,300),maxH:_})},[g]);y.useEffect(()=>{c||(N(!1),v(""))},[c]),y.useLayoutEffect(()=>{if(b)return Y(),window.addEventListener("scroll",Y,!0),window.addEventListener("resize",Y),()=>{window.removeEventListener("scroll",Y,!0),window.removeEventListener("resize",Y)}},[b,Y]);const F=y.useCallback(async(D,q,_)=>{if(!se.current){se.current=!0,_?I(!0):O(!0);try{const Z=new URLSearchParams({page:String(D),pageSize:String(mV),search:q.trim()}),re=await Oe(`/api/db/users?${Z}`);if(re!=null&&re.success&&Array.isArray(re.users)){const we=re.users,Fe=typeof re.total=="number"?re.total:0;L(Fe),_?we.length===0?$.current=!0:C(Ue=>{const jt=xV(Ue,we);return jt.length===Ue.length?$.current=!0:Q.current=D,jt}):(C(we),Q.current=D)}else re!=null&&re.error&&G.error(re.error)}catch(Z){G.error(Z instanceof Error?Z.message:"加载用户列表失败")}finally{se.current=!1,O(!1),I(!1)}}},[]);y.useEffect(()=>{b&&(Q.current=1,$.current=!1,F(1,k,!1))},[b,k,F]);const ge=y.useCallback(()=>{R||U||se.current||$.current||z>0&&T.length>=z||F(Q.current+1,k,!0)},[k,F,R,U,z,T.length]);y.useLayoutEffect(()=>{if(!b||R||U||$.current||z>0&&T.length>=z||T.length===0)return;const D=ie.current;D&&(D.scrollHeight>D.clientHeight+12||ge())},[b,T.length,R,U,z,ge]);const X=D=>{(D.id||"").trim()&&(i(D),N(!1),v(""))},B=D=>{D.preventDefault(),D.stopPropagation(),!(u||a)&&o()},W=!!n.trim(),fe=z>0,he=typeof document>"u"?null:(m==null?void 0:m.current)??document.body,de=b&&he&&od.createPortal(s.jsxs("div",{"data-member-user-select-portal":"",children:[s.jsx("div",{className:"fixed inset-0 z-40 bg-transparent","aria-hidden":!0,onMouseDown:D=>{D.preventDefault(),N(!1)}}),s.jsxs("div",{role:"listbox",className:"fixed z-50 overflow-hidden rounded-lg border border-gray-700 bg-[#0b1828] shadow-xl",style:{top:me.top,left:me.left,width:me.width,height:me.maxH,maxHeight:me.maxH,display:"grid",gridTemplateRows:fe?"auto auto minmax(0, 1fr) auto":"auto minmax(0, 1fr) auto"},children:[s.jsx("div",{className:"border-b border-gray-700/60 p-2 min-h-0",children:s.jsx(ce,{className:"bg-[#050c18] border-gray-700 text-white h-9 text-sm",placeholder:"搜索昵称、手机号、用户 id…",value:j,onChange:D=>v(D.target.value),onMouseDown:D=>D.stopPropagation(),autoFocus:!0})}),fe?s.jsxs("p",{className:"text-[11px] text-gray-500 px-3 pt-1.5 min-h-0 leading-snug",children:["已加载 ",T.length," / ",z," 条",T.length{const q=D.currentTarget;R||U||$.current||z>0&&T.length>=z||q.scrollHeight-q.scrollTop-q.clientHeight<100&&ge()},children:R&&T.length===0?s.jsx("div",{className:"flex h-40 items-center justify-center text-gray-400 text-sm",children:"正在加载…"}):T.length===0?s.jsx("div",{className:"flex h-40 items-center justify-center text-gray-500 text-sm px-3 text-center",children:"暂无用户,请调整搜索条件"}):s.jsxs("div",{className:"p-1.5 space-y-0.5",children:[T.map(D=>{const q=D.id||"",_=n===q,Z=U4(D.avatar),re=D.nickname&&String(D.nickname).trim()||"(无昵称)";return s.jsxs("button",{type:"button",role:"option","aria-selected":_,className:zt("flex w-full items-center gap-2 rounded-md border px-2.5 py-2 text-left text-sm transition-colors",_?"border-[#38bdac] bg-[#38bdac]/15 text-white":"border-transparent bg-[#050c18] hover:border-[#38bdac]/40 hover:bg-[#0a1628]"),onMouseDown:we=>we.preventDefault(),onClick:()=>X(D),children:[s.jsx("span",{className:"h-9 w-9 shrink-0 overflow-hidden rounded-full bg-gray-800",children:Z?s.jsx("img",{src:Z,alt:"",className:"h-full w-full object-cover",onError:we=>{we.currentTarget.style.display="none"}}):s.jsx("span",{className:"flex h-full w-full items-center justify-center text-[11px] text-gray-500",children:re.slice(0,1)})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"font-medium truncate",children:re}),s.jsxs("div",{className:"text-[11px] text-gray-500 font-mono truncate mt-0.5",children:[D.phone?`${D.phone} · `:"",q]})]})]},q)}),U&&s.jsx("div",{className:"py-2 text-center text-gray-500 text-xs",children:"加载更多…"})]})}),s.jsx("div",{className:"flex justify-end gap-2 border-t border-gray-700/60 px-2 py-1.5 min-h-0",children:s.jsx(J,{type:"button",variant:"ghost",size:"sm",className:"text-gray-400 h-8 text-xs",onMouseDown:D=>D.preventDefault(),onClick:()=>{o(),N(!1)},children:"清除绑定"})})]})]}),he);return s.jsxs("div",{className:zt("space-y-1.5",f),children:[typeof e=="string"?s.jsx(te,{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:zt("flex h-10 min-w-0 flex-1 items-center gap-2 rounded-md border bg-[#0a1628] px-3 text-left text-sm transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-[#38bdac]/50 focus-visible:ring-offset-0",u&&"cursor-not-allowed opacity-50",b?"border-[#38bdac] ring-1 ring-[#38bdac]/35":"border-gray-700 hover:border-gray-600"),onClick:()=>{u||(b||(v(""),Y()),N(D=>!D))},children:[s.jsx("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate",children:a?s.jsx("span",{className:"text-gray-500",children:"正在加载已绑定用户…"}):W?s.jsx(gV,{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($l,{className:zt("h-4 w-4 shrink-0 text-gray-400 transition-transform",b&&"rotate-180")})]}),W&&s.jsx(J,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0 border-gray-600 text-gray-400 hover:text-white",disabled:u||a,"aria-label":"清除已选用户",onClick:B,children:s.jsx(es,{className:"h-4 w-4"})})]}),h&&s.jsx("div",{className:"text-[11px] text-gray-500",children:h}),de]})}const W4=11,wj={personId:"",name:"",boundUserId:"",aliases:"",label:"",sceneId:W4,ckbApiKey:"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:"phone",remarkFormat:"",addFriendInterval:1,startTime:"06:00",endTime:"22:00",deviceGroups:""};function bV({open:t,onOpenChange:e,editingPerson:n,onSubmit:r}){var q;const a=!!n,i=y.useRef(null),o=y.useRef(null),[c,u]=y.useState(wj),[h,f]=y.useState(!1),[m,g]=y.useState(!1),[b,N]=y.useState([]),[j,v]=y.useState(!1),[k,T]=y.useState(""),[C,R]=y.useState([]),[O,U]=y.useState(!1),[I,z]=y.useState(""),[L,Q]=y.useState(!1),[se,$]=y.useState(null),[ie,le]=y.useState(!1),[me,P]=y.useState({}),[Y,F]=y.useState({loading:!1,messages:[]}),ge=Ul(c.name,400),X=Ul(c.aliases,400);y.useEffect(()=>{if(!t){F({loading:!1,messages:[]});return}const _=ge.trim(),Z=X.trim();if(!_&&!Z){F({loading:!1,messages:[]});return}let re=!1;F(Ue=>({...Ue,loading:!0}));const we=a?((n==null?void 0:n.personId)??"").trim():"",Fe=new URLSearchParams;return _&&Fe.set("name",ge.trim()),Fe.set("aliases",X),we&&Fe.set("excludePersonId",we),Oe(`/api/db/persons/check-unique?${Fe.toString()}`).then(Ue=>{if(!re){if((Ue==null?void 0:Ue.success)===!1&&(Ue!=null&&Ue.error)){F({loading:!1,messages:[Ue.error]});return}if((Ue==null?void 0:Ue.ok)===!1&&Array.isArray(Ue.messages)&&Ue.messages.length>0){F({loading:!1,messages:Ue.messages});return}F({loading:!1,messages:[]})}}).catch(()=>{re||F({loading:!1,messages:[]})}),()=>{re=!0}},[t,ge,X,a,n==null?void 0:n.personId]),y.useEffect(()=>{if(t){if(T(""),$(null),le(!1),n){u({personId:n.personId??n.name??"",name:n.name??"",boundUserId:n.userId??"",aliases:n.aliases??"",label:n.label??"",sceneId:W4,ckbApiKey:n.ckbApiKey??"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:n.remarkType??"phone",remarkFormat:n.remarkFormat??"",addFriendInterval:n.addFriendInterval??1,startTime:n.startTime??"06:00",endTime:n.endTime??"22:00",deviceGroups:n.deviceGroups??""});const _=(n.userId??"").trim();_&&(le(!0),Oe(`/api/db/users?id=${encodeURIComponent(_)}`).then(Z=>{const re=Z==null?void 0:Z.user;re!=null&&re.id?$({id:re.id,nickname:re.nickname&&String(re.nickname).trim()||re.id,phone:re.phone,avatar:re.avatar??void 0}):$({id:_,nickname:_,phone:void 0,avatar:void 0})}).catch(()=>{$({id:_,nickname:_,phone:void 0,avatar:void 0})}).finally(()=>le(!1)))}else u({...wj});P({}),b.length===0&&B(""),C.length===0&&W("")}},[t,n]);const B=async _=>{v(!0);try{const Z=await hV({page:1,limit:50,keyword:_});Z!=null&&Z.success&&Array.isArray(Z.devices)?N(Z.devices):Z!=null&&Z.error&&G.error(Z.error)}catch(Z){G.error(Z instanceof Error?Z.message:"加载设备列表失败")}finally{v(!1)}},W=async _=>{U(!0);try{const Z=await pV({page:1,limit:100,keyword:_});Z!=null&&Z.success&&Array.isArray(Z.plans)?R(Z.plans):Z!=null&&Z.error&&G.error(Z.error)}catch{G.error("加载计划列表失败")}finally{U(!1)}},fe=()=>{u(_=>{const Z=(_.boundUserId||"").trim(),re={..._,boundUserId:""};return!a&&Z&&(_.personId||"").trim()===Z&&(re.personId=""),re}),$(null)},he=_=>{const Z=Array.isArray(_.deviceGroups)?_.deviceGroups.map(String).join(","):"";u(re=>({...re,ckbApiKey:_.apiKey||"",greeting:_.greeting||re.greeting,tips:_.tips||re.tips,remarkType:_.remarkType||re.remarkType,remarkFormat:_.remarkFormat||re.remarkFormat,addFriendInterval:_.addInterval||re.addFriendInterval,startTime:_.startTime||re.startTime,endTime:_.endTime||re.endTime,deviceGroups:Z||re.deviceGroups})),Q(!1),G.success(`已选择计划「${_.name}」,参数已覆盖`)},de=I.trim()?C.filter(_=>(_.name||"").includes(I.trim())||String(_.id).includes(I.trim())):C,D=async()=>{var we;const _={};(!c.name||!String(c.name).trim())&&(_.name="请填写名称");const Z=c.addFriendInterval;if((typeof Z!="number"||Z<1)&&(_.addFriendInterval="添加间隔至少为 1 分钟"),(((we=c.deviceGroups)==null?void 0:we.split(",").map(Fe=>Fe.trim()).filter(Boolean))??[]).length===0&&(_.deviceGroups="请至少选择 1 台设备"),P(_),Object.keys(_).length>0){G.error(_.name||_.addFriendInterval||_.deviceGroups||"请完善必填项");return}if(Y.messages.length>0){G.error(Y.messages[0]??"名称或别名与他人重复");return}f(!0);try{await r(c),e(!1)}catch(Fe){G.error(Fe instanceof Error?Fe.message:"保存失败")}finally{f(!1)}};return s.jsx(Dt,{open:t,onOpenChange:e,children:s.jsxs(Ot,{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(_t,{children:[s.jsx($t,{className:"text-[#38bdac]",children:a?"编辑人物":"添加人物 — 存客宝 API 获客"}),s.jsx(Yc,{className:"text-gray-400 text-sm",children:a?"修改后同步到存客宝计划":"添加时自动生成 token,并同步创建存客宝场景获客计划"})]}),s.jsxs("div",{className:"space-y-6 py-2",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium text-gray-400 uppercase tracking-wider mb-3",children:"基础信息"}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(te,{className:"text-gray-400 text-xs",children:["名称 ",s.jsx("span",{className:"text-red-400",children:"*"})]}),s.jsx(ce,{className:`bg-[#0a1628] text-white ${me.name?"border-red-500 focus-visible:ring-red-500":Y.messages.length>0?"border-amber-600 focus-visible:ring-amber-600/50":"border-gray-700"}`,placeholder:"如 卡若",value:c.name,onChange:_=>{u(Z=>({...Z,name:_.target.value})),me.name&&P(Z=>({...Z,name:void 0}))}}),me.name&&s.jsx("p",{className:"text-xs text-red-400",children:me.name})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"人物ID(可选)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"自动生成",value:(c.boundUserId||"").trim()?c.boundUserId:c.personId,onChange:_=>u(Z=>({...Z,personId:_.target.value})),disabled:a||!!(c.boundUserId||"").trim()})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"标签(身份/角色)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 超级个体",value:c.label,onChange:_=>u(Z=>({...Z,label:_.target.value}))})]}),s.jsx(yV,{className:"col-span-3",id:"person-bound-member-user",label:"绑定会员用户(可选,与「用户管理」中用户一致)",containerOpen:t,portalMountRef:o,positionContainerRef:i,value:c.boundUserId,preview:se,previewLoading:ie,onSelect:_=>{const Z=(_.id||"").trim();Z&&(u(re=>({...re,boundUserId:Z,...a?{}:{personId:Z}})),$({id:Z,nickname:_.nickname&&String(_.nickname).trim()||Z,phone:_.phone,avatar:_.avatar??void 0}))},onClear:fe,hint:s.jsx("span",{children:"单选;保存时后端校验用户是否存在。同一会员只能绑定一个 @人物;绑定后获客统计可与超级个体对齐。"})}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"别名(逗号分隔,@ 可匹配)"}),s.jsx(ce,{className:`bg-[#0a1628] text-white ${Y.messages.length>0?"border-amber-600 focus-visible:ring-amber-600/50":"border-gray-700"}`,placeholder:"如 卡卡, 若若",value:c.aliases,onChange:_=>u(Z=>({...Z,aliases:_.target.value}))})]}),s.jsx("div",{className:"col-span-3 space-y-1",children:Y.loading?s.jsx("p",{className:"text-xs text-gray-500",children:"正在检测名称与别名是否与他人重复…"}):Y.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:Y.messages.map((_,Z)=>s.jsx("p",{children:_},`${Z}-${_.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(te,{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:()=>Q(!L),children:c.ckbApiKey?s.jsx("span",{className:"text-white truncate",children:((q=C.find(_=>_.apiKey===c.ckbApiKey))==null?void 0:q.name)||`获客计划 (${c.ckbApiKey.slice(0,8)}…)`}):s.jsx("span",{className:"text-gray-500",children:"点击选择已有计划 / 新建时自动创建"})}),s.jsx(J,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-200 shrink-0",onClick:()=>{W(I),Q(!0)},disabled:O,children:O?"加载...":"刷新"})]}),L&&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:I,onChange:_=>z(_.target.value),onKeyDown:_=>{_.key==="Enter"&&W(I)},autoFocus:!0})}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:de.length===0?s.jsx("div",{className:"text-center py-4 text-gray-500 text-xs",children:O?"加载中...":"暂无计划"}):de.map(_=>s.jsxs("div",{className:`px-3 py-2 cursor-pointer hover:bg-[#38bdac]/10 text-sm flex items-center justify-between ${c.ckbApiKey===_.apiKey?"bg-[#38bdac]/20 text-[#38bdac]":"text-white"}`,onClick:()=>he(_),children:[s.jsxs("div",{className:"truncate",children:[s.jsx("span",{className:"font-medium",children:_.name}),s.jsxs("span",{className:"text-xs text-gray-500 ml-2",children:["ID:",String(_.id)]})]}),_.enabled?s.jsx("span",{className:"text-[10px] text-green-400 bg-green-400/10 px-1.5 rounded shrink-0 ml-2",children:"启用"}):s.jsx("span",{className:"text-[10px] text-gray-500 bg-gray-500/10 px-1.5 rounded shrink-0 ml-2",children:"停用"})]},String(_.id)))}),s.jsx("div",{className:"p-2 border-t border-gray-700/60 flex justify-end",children:s.jsx(J,{type:"button",size:"sm",variant:"ghost",className:"text-gray-400 h-7 text-xs",onClick:()=>Q(!1),children:"关闭"})})]}),s.jsx("p",{className:"text-xs text-gray-500",children:"选择计划后自动覆盖下方参数。新建人物时若不选择则自动创建新计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(te,{className:"text-gray-400 text-xs",children:["选择设备 ",s.jsx("span",{className:"text-red-400",children:"*"})]}),s.jsxs("div",{className:`flex gap-2 rounded-md border ${me.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:()=>g(!0)}),s.jsx(J,{type:"button",variant:"outline",className:"border-0 border-l border-inherit rounded-r-md text-gray-200",onClick:()=>g(!0),children:"选择"})]}),me.deviceGroups?s.jsx("p",{className:"text-xs text-red-400",children:me.deviceGroups}):s.jsx("p",{className:"text-xs text-gray-500",children:"从存客宝设备列表中选择,至少选择 1 台设备参与获客计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"好友备注"}),s.jsxs(jo,{value:c.remarkType,onValueChange:_=>u(Z=>({...Z,remarkType:_})),children:[s.jsx(Ti,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(ko,{placeholder:"选择备注类型"})}),s.jsxs(Mi,{children:[s.jsx(hs,{value:"phone",children:"手机号"}),s.jsx(hs,{value:"nickname",children:"昵称"}),s.jsx(hs,{value:"source",children:"来源"})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"备注格式(手机号+标签,标签不超过6字)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 {手机号}-{来源标签},总长不超过10字",value:c.remarkFormat,onChange:_=>u(Z=>({...Z,remarkFormat:_.target.value}))}),s.jsx("p",{className:"text-xs text-gray-500",children:"格式:手机号+来源标签(标签≤6字,总长≤10字)"})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"打招呼语"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"你好,请通过",value:c.greeting,onChange:_=>u(Z=>({...Z,greeting:_.target.value}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"添加间隔(分钟)"}),s.jsx(ce,{type:"number",min:1,className:`bg-[#0a1628] text-white ${me.addFriendInterval?"border-red-500 focus-visible:ring-red-500":"border-gray-700"}`,value:c.addFriendInterval,onChange:_=>{u(Z=>({...Z,addFriendInterval:Number(_.target.value)||1})),me.addFriendInterval&&P(Z=>({...Z,addFriendInterval:void 0}))}}),me.addFriendInterval&&s.jsx("p",{className:"text-xs text-red-400",children:me.addFriendInterval})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"允许加人时间段"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ce,{type:"time",className:"bg-[#0a1628] border-gray-700 text-white w-24",value:c.startTime,onChange:_=>u(Z=>({...Z,startTime:_.target.value}))}),s.jsx("span",{className:"text-gray-500 text-sm shrink-0",children:"至"}),s.jsx(ce,{type:"time",className:"bg-[#0a1628] border-gray-700 text-white w-24",value:c.endTime,onChange:_=>u(Z=>({...Z,endTime:_.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"获客成功提示"}),s.jsx(tc,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[72px] resize-none",placeholder:"请注意消息,稍后加你微信",value:c.tips,onChange:_=>u(Z=>({...Z,tips:_.target.value}))})]})]})]})]})]})]}),s.jsxs(rn,{className:"gap-3 border-t border-gray-700/40 px-6 py-4 shrink-0",children:[s.jsx(J,{variant:"outline",onClick:()=>e(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(J,{onClick:D,disabled:h||Y.messages.length>0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:h?"保存中...":a?"保存":"添加"})]})]}),m&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",children:s.jsxs("div",{className:"w-full max-w-3xl max-h-[80vh] bg-[#0b1828] border border-gray-700 rounded-xl shadow-xl flex flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-gray-700/60",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-medium text-white",children:"选择设备"}),s.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"勾选需要参与本计划的设备,可多选"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(J,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-200 h-8",onClick:()=>{const _=b.map(we=>String(we.id??"")),Z=c.deviceGroups?c.deviceGroups.split(",").map(we=>we.trim()).filter(Boolean):[],re=_.length>0&&_.every(we=>Z.includes(we));u(we=>({...we,deviceGroups:re?"":_.join(",")})),!re&&_.length>0&&P(we=>({...we,deviceGroups:void 0}))},children:(()=>{const _=b.map(re=>String(re.id??"")),Z=c.deviceGroups?c.deviceGroups.split(",").map(re=>re.trim()).filter(Boolean):[];return _.length>0&&_.every(re=>Z.includes(re))?"取消全选":"全选"})()}),s.jsx(ce,{className:"bg-[#050c18] border-gray-700 text-white h-8 w-52",placeholder:"搜索备注/微信号/IMEI",value:k,onChange:_=>T(_.target.value),onKeyDown:_=>{_.key==="Enter"&&B(k)}}),s.jsx(J,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-200 h-8",onClick:()=>B(k),disabled:j,children:"刷新"}),s.jsx(J,{type:"button",size:"icon",variant:"outline",className:"border-gray-600 text-gray-300 h-8 w-8",onClick:()=>g(!1),children:"✕"})]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:j?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-400 text-sm",children:"正在加载设备列表…"}):b.length===0?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-500 text-sm",children:"暂无设备数据,请检查存客宝账号与开放 API 配置"}):s.jsx("div",{className:"p-4 space-y-2",children:b.map(_=>{const Z=String(_.id??""),re=c.deviceGroups?c.deviceGroups.split(",").map(Ue=>Ue.trim()).filter(Boolean):[],we=re.includes(Z),Fe=()=>{let Ue;we?Ue=re.filter(jt=>jt!==Z):Ue=[...re,Z],u(jt=>({...jt,deviceGroups:Ue.join(",")})),Ue.length>0&&P(jt=>({...jt,deviceGroups:void 0}))};return s.jsxs("label",{className:"flex items-center gap-3 rounded-lg border border-gray-700/60 bg-[#050c18] px-3 py-2 cursor-pointer hover:border-[#38bdac]/70",children:[s.jsx("input",{type:"checkbox",className:"h-4 w-4 accent-[#38bdac]",checked:we,onChange:Fe}),s.jsxs("div",{className:"flex flex-col min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-white truncate max-w-xs",children:_.memo||_.wechatId||`设备 ${Z}`}),_.status==="online"&&s.jsx("span",{className:"rounded-full bg-emerald-500/20 text-emerald-400 text-[11px] px-2 py-0.5",children:"在线"}),_.status==="offline"&&s.jsx("span",{className:"rounded-full bg-gray-600/20 text-gray-400 text-[11px] px-2 py-0.5",children:"离线"})]}),s.jsxs("div",{className:"text-[11px] text-gray-400 mt-0.5",children:[s.jsxs("span",{className:"mr-3",children:["ID: ",Z]}),_.wechatId&&s.jsxs("span",{className:"mr-3",children:["微信号: ",_.wechatId]}),typeof _.totalFriend=="number"&&s.jsxs("span",{children:["好友数: ",_.totalFriend]})]})]})]},Z)})})}),s.jsxs("div",{className:"flex justify-between items-center px-5 py-3 border-t border-gray-700/60",children:[s.jsxs("span",{className:"text-xs text-gray-400",children:["已选择"," ",c.deviceGroups?c.deviceGroups.split(",").filter(Boolean).length:0," ","台设备"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(J,{type:"button",variant:"outline",className:"border-gray-600 text-gray-200 h-8 px-4",onClick:()=>g(!1),children:"取消"}),s.jsx(J,{type:"button",className:"bg-[#38bdac] hover:bg-[#2da396] text-white h-8 px-4",onClick:()=>g(!1),children:"确定"})]})]})]})})]})})}function Fc(t){if(t!=null){if(typeof t=="number"&&Number.isFinite(t))return Math.round(t);if(typeof t=="string"&&t.trim()!==""){const e=Number(t.trim().replace(/%/g,""));if(Number.isFinite(e))return Math.round(e)}}}function vV(t,e,n){const r=new Map;for(const o of t){const c=o.partId||"part-1",u=o.partTitle||"未分类",h=o.chapterId||"chapter-1",f=o.chapterTitle||"未分类";r.has(c)||r.set(c,{id:c,title:u,badgeText:n[c]||"",chapters:new Map});const m=r.get(c);m.chapters.has(h)||m.chapters.set(h,{id:h,title:f,sections:[]}),m.chapters.get(h).sections.push({id:o.id,mid:o.mid,title:o.title,price:o.price??1,filePath:o.filePath,isFree:o.isFree,isNew:o.isNew,clickCount:o.clickCount??0,payCount:o.payCount??0,hotScore:o.hotScore??0,hotRank:e.get(o.id)??0,previewPercent:Fc(o.previewPercent)})}const a=Array.from(r.values()).map(o=>({...o,chapters:Array.from(o.chapters.values())})),i=new Map;for(let o=0;o{const u=i.get(o.id),h=i.get(c.id);return u!==void 0&&h!==void 0&&u!==h?u-h:u!==void 0&&h===void 0?-1:u===void 0&&h!==void 0?1:o.id.localeCompare(c.id)})}function NV(){var dl,ul,li;const t=qa(),[e,n]=y.useState([]),[r,a]=y.useState(!0),[i,o]=y.useState([]),[c,u]=y.useState(null),[h,f]=y.useState(!1),[m,g]=y.useState(!1),[b,N]=y.useState(!1),[j,v]=y.useState(""),[k,T]=y.useState([]),[C,R]=y.useState(!1),[O,U]=y.useState({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),[I,z]=y.useState(null),[L,Q]=y.useState(!1),[se,$]=y.useState(!1),[ie,le]=y.useState(null),[me,P]=y.useState(!1),[Y,F]=y.useState([]),[ge,X]=y.useState(!1),[B,W]=y.useState(""),[fe,he]=y.useState(""),[de,D]=y.useState(!1),[q,_]=y.useState(""),[Z,re]=y.useState(!1),[we,Fe]=y.useState(null),[Ue,jt]=y.useState(!1),[jn,pt]=y.useState(!1),[Pt,pn]=y.useState({readWeight:.5,recencyWeight:.3,payWeight:.2}),[Hn,mn]=y.useState(!1),[Wt,bn]=y.useState(!1),[Mn,Un]=y.useState(1),[ns,Rt]=y.useState([]),[vn,Ne]=y.useState(!1),[Me,We]=y.useState([]),[at,Lt]=y.useState(!1),[Ct,$e]=y.useState(20),[H,Qe]=y.useState(!1),[vt,Ft]=y.useState(!1),[yt,bt]=y.useState([]),[It,Qt]=y.useState([]),[kn,zs]=y.useState([]),[mr,Qa]=y.useState(!1),[Yr,Xr]=y.useState(1),[ja,Pr]=y.useState(20),[Ir,Zr]=y.useState(0),[Ya,gr]=y.useState(1),[Qs,xr]=y.useState(""),[Ys,Fs]=y.useState(!1),[oe,ve]=y.useState(null),[Xe,Nt]=y.useState({tagId:"",label:"",aliases:"",url:"",type:"url",appId:"",appSecret:"",pagePath:""}),[Zt,Xs]=y.useState(!1),[Xo,ea]=y.useState(!1),[Fi,Xa]=y.useState(null),[bs,Rr]=y.useState(null),[nn,Za]=y.useState({}),[Bi,ta]=y.useState(!1),[ka,Zo]=y.useState(""),[Vi,Zs]=y.useState(""),[Bs,el]=y.useState([]),[Jn,tl]=y.useState(0),[na,vs]=y.useState(1),[yr,Vs]=y.useState(!1),[sa,Sa]=y.useState(""),ac=y.useRef(null),ei=y.useCallback(async(E,V)=>{var mt;const ue=new FormData;ue.append("file",E),ue.append("folder",V);const Ke=await(await fetch(Fl("/api/upload"),{method:"POST",body:ue,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((mt=Ke==null?void 0:Ke.data)==null?void 0:mt.url)||(Ke==null?void 0:Ke.url)||""},[]),Hi=y.useCallback(E=>ei(E,"book-images"),[ei]),ti=y.useCallback(E=>{const V=E.type.startsWith("video/")?"book-videos":"book-attachments";return ei(E,V)},[ei]),[Ui,ra]=y.useState({}),Ca=E=>String(E||"").trim().slice(0,8),nl=y.useMemo(()=>{const E=new Map;return ns.forEach((V,ue)=>{E.set(V.id,ue+1)}),E},[ns]),lt=vV(e,nl,Ui),Wi=e.length,ni=10,si=Math.max(1,Math.ceil(ns.length/ni)),sl=ns.slice((Mn-1)*ni,Mn*ni),ss=async()=>{a(!0);try{const E=await Oe("/api/db/book?action=list",{cache:"no-store"});n(Array.isArray(E==null?void 0:E.sections)?E.sections:[])}catch(E){console.error(E),n([])}finally{a(!1)}},rl=async()=>{try{const E=await Oe("/api/db/config?key=book_part_badges",{cache:"no-store"});let V={};if(E&&Array.isArray(E.data)){const ke=E.data.find(Ke=>Ke&&Ke.configKey==="book_part_badges");ke&&ke.configValue&&typeof ke.configValue=="object"&&!Array.isArray(ke.configValue)&&(V=ke.configValue)}else E&&E.data&&typeof E.data=="object"&&!Array.isArray(E.data)&&(V=E.data);const ue={};Object.keys(V).forEach(ke=>{const Ke=Ca(V[ke]);Ke&&(ue[ke]=Ke)}),ra(ue)}catch(E){console.error(E),ra({})}},br=async()=>{Ne(!0);try{const E=await Oe("/api/db/book?action=ranking",{cache:"no-store"}),V=Array.isArray(E==null?void 0:E.sections)?E.sections:[];Rt(V);const ue=V.filter(ke=>ke.isPinned).map(ke=>ke.id);We(ue)}catch(E){console.error(E),Rt([])}finally{Ne(!1)}};y.useEffect(()=>{ss(),br(),rl()},[]);const Ki=E=>{o(V=>V.includes(E)?V.filter(ue=>ue!==E):[...V,E])},vr=y.useCallback(E=>{const V=e,ue=E.flatMap(ke=>{const Ke=V.find(mt=>mt.id===ke.id);return Ke?[{...Ke,partId:ke.partId,partTitle:ke.partTitle,chapterId:ke.chapterId,chapterTitle:ke.chapterTitle}]:[]});return n(ue),Xt("/api/db/book",{action:"reorder",items:E}).then(ke=>{ke&&ke.success===!1&&(n(V),G.error("排序失败: "+(ke&&typeof ke=="object"&&"error"in ke?ke.error:"未知错误")))}).catch(ke=>{n(V),console.error("排序失败:",ke),G.error("排序失败: "+(ke instanceof Error?ke.message:"网络或服务异常"))}),Promise.resolve()},[e]),er=async E=>{if(confirm(`确定要删除章节「${E.title}」吗?此操作不可恢复。`))try{const V=await Ei(`/api/db/book?id=${encodeURIComponent(E.id)}`);V&&V.success!==!1?(G.success("已删除"),ss(),br()):G.error("删除失败: "+(V&&typeof V=="object"&&"error"in V?V.error:"未知错误"))}catch(V){console.error(V),G.error("删除失败")}},Hs=y.useCallback(async()=>{mn(!0);try{const E=await Oe("/api/db/config/full?key=article_ranking_weights",{cache:"no-store"}),V=E&&E.data;V&&typeof V.readWeight=="number"&&typeof V.recencyWeight=="number"&&typeof V.payWeight=="number"&&pn({readWeight:Math.max(0,Math.min(1,V.readWeight)),recencyWeight:Math.max(0,Math.min(1,V.recencyWeight)),payWeight:Math.max(0,Math.min(1,V.payWeight))})}catch{}finally{mn(!1)}},[]);y.useEffect(()=>{jn&&Hs()},[jn,Hs]);const tr=async()=>{const{readWeight:E,recencyWeight:V,payWeight:ue}=Pt,ke=E+V+ue;if(Math.abs(ke-1)>.001){G.error("三个权重之和必须等于 1");return}bn(!0);try{const Ke=await kt("/api/db/config",{key:"article_ranking_weights",value:{readWeight:E,recencyWeight:V,payWeight:ue},description:"文章排名算法权重"});Ke&&Ke.success!==!1?(G.success("排名权重已保存"),pt(!1),ss(),br()):G.error("保存失败: "+(Ke&&typeof Ke=="object"&&"error"in Ke?Ke.error:""))}catch(Ke){console.error(Ke),G.error("保存失败")}finally{bn(!1)}},Ea=y.useCallback(async()=>{Lt(!0);try{const E=await Oe("/api/db/config/full?key=pinned_section_ids",{cache:"no-store"}),V=E&&E.data;Array.isArray(V)&&We(V)}catch{}finally{Lt(!1)}},[]),_n=y.useCallback(async()=>{try{const E=await Oe("/api/db/persons");E!=null&&E.success&&E.persons&&bt(E.persons.map(V=>{const ue=V.deviceGroups,ke=Array.isArray(ue)?ue.join(","):ue??"";return{id:V.token??V.personId??"",personId:V.personId,name:V.name,personSource:V.personSource??"",userId:V.userId,aliases:V.aliases??"",label:V.label??"",ckbApiKey:V.ckbApiKey??"",ckbPlanId:V.ckbPlanId,remarkType:V.remarkType,remarkFormat:V.remarkFormat,addFriendInterval:V.addFriendInterval,startTime:V.startTime,endTime:V.endTime,deviceGroups:ke,isPinned:!!V.isPinned}}))}catch{}},[]),ic=y.useCallback(async(E,V)=>{const ue=(E.personId||E.id||"").trim();if(!ue){G.error("缺少 personId");return}V&&!(E.userId||"").trim()&&G.info("未绑定会员时,小程序仍显示 @ 名称,头像可能为默认图");try{const ke=await Xt("/api/db/persons/pin",{personId:ue,isPinned:V});if(!(ke!=null&&ke.success)){G.error((ke==null?void 0:ke.error)||"置顶失败");return}G.success(V?"已设为小程序首页置顶(全局仅一条)":"已取消置顶"),await _n()}catch(ke){G.error(ke instanceof Error?ke.message:"操作失败")}},[_n]),Lr=y.useCallback(async()=>{try{const E=await Oe("/api/db/link-tags");E!=null&&E.success&&E.linkTags&&Qt(E.linkTags.map(V=>({id:V.tagId,label:V.label,url:V.url,type:V.type||"url",appId:V.appId||"",pagePath:V.pagePath||"",hasAppSecret:!!V.hasAppSecret})))}catch{}},[]),Ta=y.useCallback(async()=>{try{const E=await Oe("/api/db/config/full?key=ckb_lead_webhook_url",{cache:"no-store"});E!=null&&E.success&&typeof E.data=="string"&&Sa(E.data)}catch{}},[]),oc=y.useCallback(async()=>{try{const E=await Oe("/api/db/ckb-person-leads");if(E!=null&&E.success&&E.byPerson){const V={};for(const ue of E.byPerson)V[ue.token]=ue.total;Za(V)}}catch{}},[]),Ma=y.useCallback(async(E,V,ue=1)=>{Zo(E),Zs(V),ta(!0),vs(ue),Vs(!0);try{const ke=await Oe(`/api/db/ckb-person-leads?token=${encodeURIComponent(E)}&page=${ue}&pageSize=20`);ke!=null&&ke.success?(el(ke.records||[]),tl(ke.total||0)):G.error((ke==null?void 0:ke.error)||"加载获客详情失败")}catch(ke){G.error(ke instanceof Error?ke.message:"加载获客详情失败")}finally{Vs(!1)}},[]),Nr=y.useCallback(async()=>{Qa(!0);try{const E=new URLSearchParams({page:String(Yr),pageSize:String(ja)}),V=Qs.trim();V&&E.set("search",V);const ue=await Oe(`/api/db/link-tags?${E.toString()}`);if(ue!=null&&ue.success){const ke=Array.isArray(ue.linkTags)?ue.linkTags:[];zs(ke.map(Ke=>({id:Ke.tagId,label:Ke.label,aliases:Ke.aliases||"",url:Ke.url,type:Ke.type||"url",appId:Ke.appId||"",pagePath:Ke.pagePath||"",hasAppSecret:!!Ke.hasAppSecret}))),Zr(typeof ue.total=="number"?ue.total:0),gr(typeof ue.totalPages=="number"&&ue.totalPages>0?ue.totalPages:1)}}catch(E){console.error(E),G.error("加载链接标签失败")}finally{Qa(!1)}},[Yr,ja,Qs]),[nr,xd]=y.useState([]),[wr,sr]=y.useState(""),[rs,rr]=y.useState(!1),qi=y.useRef(null),Aa=y.useCallback(async()=>{try{const E=await Oe("/api/admin/linked-miniprograms");E!=null&&E.success&&Array.isArray(E.data)&&xd(E.data.map(V=>({...V,key:V.key})))}catch{}},[]),Pa=nr.filter(E=>!wr.trim()||E.name.toLowerCase().includes(wr.toLowerCase())||E.key&&E.key.toLowerCase().includes(wr.toLowerCase())||E.appId.toLowerCase().includes(wr.toLowerCase())),Or=async E=>{const V=Me.includes(E)?Me.filter(ue=>ue!==E):[...Me,E];We(V);try{await kt("/api/db/config",{key:"pinned_section_ids",value:V,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"}),br()}catch{We(Me)}},Ia=y.useCallback(async()=>{Qe(!0);try{const E=await Oe("/api/db/config/full?key=unpaid_preview_percent",{cache:"no-store"}),V=E&&E.data;typeof V=="number"&&V>0&&V<=100&&$e(V)}catch{}finally{Qe(!1)}},[]),al=async()=>{if(Ct<1||Ct>100){G.error("预览比例需在 1~100 之间");return}Ft(!0);try{const E=await kt("/api/db/config",{key:"unpaid_preview_percent",value:Ct,description:"小程序未付费内容默认预览比例(%)"});E&&E.success!==!1?G.success("预览比例已保存"):G.error("保存失败: "+(E.error||""))}catch{G.error("保存失败")}finally{Ft(!1)}};y.useEffect(()=>{Ea(),Ia(),_n(),Lr(),oc(),Aa(),Ta()},[Ea,Ia,_n,Lr,oc,Aa,Ta]),y.useEffect(()=>{Nr()},[Nr]);const ar=async E=>{Fe({section:E,orders:[]}),jt(!0);try{const V=await Oe(`/api/db/book?action=section-orders&id=${encodeURIComponent(E.id)}`),ue=V!=null&&V.success&&Array.isArray(V.orders)?V.orders:[];Fe(ke=>ke?{...ke,orders:ue}:null)}catch(V){console.error(V),Fe(ue=>ue?{...ue,orders:[]}:null)}finally{jt(!1)}},ri=async E=>{g(!0);try{const V=E.mid!=null&&E.mid>0?`/api/db/book?action=read&mid=${E.mid}`:`/api/db/book?action=read&id=${encodeURIComponent(E.id)}`,ue=await Oe(V);if(ue!=null&&ue.success&&ue.section){const ke=ue.section,Ke=ke.editionPremium===!0,mt=Fc(ke.previewPercent)??Fc(ke.preview_percent),wt=Fc(E.previewPercent);u({id:E.id,originalId:E.id,title:ue.section.title??E.title,price:ue.section.price??E.price,content:ue.section.content??"",filePath:E.filePath,isFree:E.isFree||E.price===0,isNew:ke.isNew??E.isNew,isPinned:Me.includes(E.id),hotScore:E.hotScore??0,previewPercent:mt??wt??void 0,editionStandard:Ke?!1:ke.editionStandard??!0,editionPremium:Ke})}else u({id:E.id,originalId:E.id,title:E.title,price:E.price,content:"",filePath:E.filePath,isFree:E.isFree,isNew:E.isNew,isPinned:Me.includes(E.id),hotScore:E.hotScore??0,previewPercent:Fc(E.previewPercent),editionStandard:!0,editionPremium:!1}),ue&&!ue.success&&G.error("无法读取文件内容: "+(ue.error||"未知错误"))}catch(V){console.error(V),u({id:E.id,title:E.title,price:E.price,content:"",filePath:E.filePath,isFree:E.isFree,previewPercent:Fc(E.previewPercent)})}finally{g(!1)}},aa=async()=>{var E;if(c){N(!0);try{let V=c.content||"";const ue=[new RegExp(`^#+\\s*${c.id.replace(".","\\.")}\\s+.*$`,"gm"),new RegExp(`^#+\\s*${c.id.replace(".","\\.")}[::].*$`,"gm"),new RegExp(`^#\\s+.*${(E=c.title)==null?void 0:E.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const is of ue)V=V.replace(is,"");V=V.replace(/^\s*\n+/,"").trim();const ke=c.originalId||c.id,Ke=c.id!==ke,mt={id:ke,...Ke?{newId:c.id}:{},title:c.title,price:c.isFree?0:c.price,content:V,isFree:c.isFree||c.price===0,isNew:c.isNew,hotScore:c.hotScore,editionStandard:c.editionPremium?!1:c.editionStandard??!0,editionPremium:c.editionPremium??!1,saveToFile:!0};c.previewPercent===null?mt.previewPercent=null:typeof c.previewPercent=="number"&&Number.isFinite(c.previewPercent)&&(mt.previewPercent=c.previewPercent);const wt=await Xt("/api/db/book",mt,{timeout:z1}),An=Ke?c.id:ke;c.isPinned!==Me.includes(An)&&await Or(An),wt&&wt.success!==!1?(G.success(`已保存:${c.title}`),u(null),ss(),_n(),Lr()):G.error("保存失败: "+(wt&&typeof wt=="object"&&"error"in wt?wt.error:"未知错误"))}catch(V){console.error(V);const ue=V instanceof Error&&V.name==="AbortError"?"保存超时,请检查网络或稍后重试":"保存失败";G.error(ue)}finally{N(!1)}}},Ra=async()=>{if(!O.id||!O.title){G.error("请填写章节ID和标题");return}N(!0);try{const E=lt.find(ke=>ke.id===O.partId),V=E==null?void 0:E.chapters.find(ke=>ke.id===O.chapterId),ue=await Xt("/api/db/book",{id:O.id,title:O.title,price:O.isFree?0:O.price,content:O.content||"",partId:O.partId,partTitle:(E==null?void 0:E.title)??"",chapterId:O.chapterId,chapterTitle:(V==null?void 0:V.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:z1});if(ue&&ue.success!==!1){if(O.isPinned){const ke=[...Me,O.id];We(ke);try{await kt("/api/db/config",{key:"pinned_section_ids",value:ke,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"})}catch{}}G.success(`章节创建成功:${O.title}`),f(!1),U({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),ss(),_n(),Lr()}else G.error("创建失败: "+(ue&&typeof ue=="object"&&"error"in ue?ue.error:"未知错误"))}catch(E){console.error(E),G.error("创建失败")}finally{N(!1)}},La=E=>{U(V=>{var ue;return{...V,partId:E.id,chapterId:((ue=E.chapters[0])==null?void 0:ue.id)??"chapter-1"}}),f(!0)},ai=E=>{z({id:E.id,title:E.title,badgeText:Ca(E.badgeText)})},il=async()=>{var E;if((E=I==null?void 0:I.title)!=null&&E.trim()){Q(!0);try{const V=e.map(ke=>({id:ke.id,partId:ke.partId||"part-1",partTitle:ke.partId===I.id?I.title.trim():ke.partTitle||"",chapterId:ke.chapterId||"chapter-1",chapterTitle:ke.chapterTitle||""})),ue=await Xt("/api/db/book",{action:"reorder",items:V});if(ue&&ue.success!==!1){const ke=I.title.trim(),Ke={...Ui},mt=Ca(I.badgeText);mt?Ke[I.id]=mt:delete Ke[I.id];const wt=await kt("/api/db/config",{key:"book_part_badges",value:Ke,description:"目录篇名角标(key=part_id, value=角标文案)"});if(wt&&wt.success===!1){G.error("更新篇名角标失败: "+(wt.error||"未知错误"));return}ra(Ke),n(An=>An.map(is=>is.partId===I.id?{...is,partTitle:ke}:is)),z(null),ss()}else G.error("更新篇名失败: "+(ue&&typeof ue=="object"&&"error"in ue?ue.error:"未知错误"))}catch(V){console.error(V),G.error("更新篇名失败")}finally{Q(!1)}}},as=E=>{const V=E.chapters.length+1,ue=`chapter-${E.id}-${V}-${Date.now()}`;U({id:`${V}.1`,title:"新章节",price:1,partId:E.id,chapterId:ue,content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),f(!0)},ia=(E,V)=>{const ue=V.sections;let ke=1,Ke=!1,mt=!1;if(ue.length>0){const wt=typeof ue[0].price=="number"?ue[0].price:Number(ue[0].price)||1,An=!!(ue[0].isFree||wt===0);mt=ue.some(is=>{const Sn=typeof is.price=="number"?is.price:Number(is.price)||1,Ns=!!(is.isFree||Sn===0);return Sn!==wt||Ns!==An}),ke=An?0:wt,Ke=An}le({part:E,chapter:V,title:V.title,price:ke,isFree:Ke,priceMixed:mt,initialTitle:V.title,initialPrice:ke,initialIsFree:Ke})},ol=async()=>{var Ke;if(!((Ke=ie==null?void 0:ie.title)!=null&&Ke.trim()))return;const E=ie,V=E.title.trim(),ue=V!==E.initialTitle,ke=E.isFree!==E.initialIsFree||!E.isFree&&Number(E.price)!==Number(E.initialPrice);if(!ue&&!ke){G.info("未修改任何内容"),le(null);return}if(E.priceMixed&&ke){const mt=E.chapter.sections.length,wt=E.isFree?"全部设为免费":`全部设为 ¥${E.price}`;if(!confirm(`本章 ${mt} 节当前定价不一致,保存后将${wt},确定?`))return}P(!0);try{if(ue){const mt=e.map(Sn=>({id:Sn.id,partId:Sn.partId||E.part.id,partTitle:Sn.partId===E.part.id?E.part.title:Sn.partTitle||"",chapterId:Sn.chapterId||E.chapter.id,chapterTitle:Sn.partId===E.part.id&&Sn.chapterId===E.chapter.id?V:Sn.chapterTitle||""})),wt=await Xt("/api/db/book",{action:"reorder",items:mt});if(wt&&wt.success===!1){G.error("保存章节名失败: "+(wt&&typeof wt=="object"&&"error"in wt?wt.error:"未知错误"));return}const An=E.part.id,is=E.chapter.id;n(Sn=>Sn.map(Ns=>Ns.partId===An&&Ns.chapterId===is?{...Ns,chapterTitle:V}:Ns))}if(ke){const mt=await Xt("/api/db/book",{action:"update-chapter-pricing",partId:E.part.id,chapterId:E.chapter.id,price:E.isFree?0:Number(E.price)||0,isFree:E.isFree});if(mt&&mt.success===!1){G.error("保存定价失败: "+(mt&&typeof mt=="object"&&"error"in mt?mt.error:"未知错误")),ue&&ss();return}}le(null),ss(),G.success("已保存")}catch(mt){console.error(mt),G.error("保存失败")}finally{P(!1)}},ii=async(E,V)=>{const ue=V.sections.map(ke=>ke.id);if(ue.length===0){G.info("该章下无小节,无需删除");return}if(confirm(`确定要删除「第${E.chapters.indexOf(V)+1}章 | ${V.title}」吗?将删除共 ${ue.length} 节,此操作不可恢复。`))try{for(const ke of ue)await Ei(`/api/db/book?id=${encodeURIComponent(ke)}`);ss()}catch(ke){console.error(ke),G.error("删除失败")}},yd=async()=>{if(!q.trim()){G.error("请输入篇名");return}re(!0);try{const E=`part-new-${Date.now()}`,V="chapter-1",ue=`part-placeholder-${Date.now()}`,ke=await Xt("/api/db/book",{id:ue,title:"占位节(可编辑)",price:0,content:"",partId:E,partTitle:q.trim(),chapterId:V,chapterTitle:"第1章 | 待编辑",saveToFile:!1});ke&&ke.success!==!1?(G.success(`篇「${q}」创建成功`),$(!1),_(""),ss()):G.error("创建失败: "+(ke&&typeof ke=="object"&&"error"in ke?ke.error:"未知错误"))}catch(E){console.error(E),G.error("创建失败")}finally{re(!1)}},ll=async()=>{if(Y.length===0){G.error("请先勾选要移动的章节");return}const E=lt.find(ue=>ue.id===B),V=E==null?void 0:E.chapters.find(ue=>ue.id===fe);if(!E||!V||!B||!fe){G.error("请选择目标篇和章");return}D(!0);try{const ue=()=>{const wt=new Set(Y),An=e.map($n=>({id:$n.id,partId:$n.partId||"",partTitle:$n.partTitle||"",chapterId:$n.chapterId||"",chapterTitle:$n.chapterTitle||""})),is=An.filter($n=>wt.has($n.id)).map($n=>({...$n,partId:B,partTitle:E.title||B,chapterId:fe,chapterTitle:V.title||fe})),Sn=An.filter($n=>!wt.has($n.id));let Ns=Sn.length;for(let $n=Sn.length-1;$n>=0;$n-=1){const lc=Sn[$n];if(lc.partId===B&&lc.chapterId===fe){Ns=$n+1;break}}return[...Sn.slice(0,Ns),...is,...Sn.slice(Ns)]},ke=async()=>{const wt=ue(),An=await Xt("/api/db/book",{action:"reorder",items:wt});return An&&An.success!==!1?(G.success(`已移动 ${Y.length} 节到「${E.title}」-「${V.title}」`),X(!1),F([]),await ss(),!0):!1},Ke={action:"move-sections",sectionIds:Y,targetPartId:B,targetChapterId:fe,targetPartTitle:E.title||B,targetChapterTitle:V.title||fe},mt=await Xt("/api/db/book",Ke);if(mt&&mt.success!==!1)G.success(`已移动 ${mt.count??Y.length} 节到「${E.title}」-「${V.title}」`),X(!1),F([]),await ss();else{const wt=mt&&typeof mt=="object"&&"error"in mt?mt.error||"":"未知错误";if((wt.includes("缺少 id")||wt.includes("无效的 action"))&&await ke())return;G.error("移动失败: "+wt)}}catch(ue){console.error(ue),G.error("移动失败: "+(ue instanceof Error?ue.message:"网络或服务异常"))}finally{D(!1)}},cl=E=>{F(V=>V.includes(E)?V.filter(ue=>ue!==E):[...V,E])},oi=async E=>{const V=e.filter(ue=>ue.partId===E.id).map(ue=>ue.id);if(V.length===0){G.info("该篇下暂无小节可删除");return}if(confirm(`确定要删除「${E.title}」整篇吗?将删除共 ${V.length} 节内容,此操作不可恢复。`))try{for(const ue of V)await Ei(`/api/db/book?id=${encodeURIComponent(ue)}`);ss()}catch(ue){console.error(ue),G.error("删除失败")}},Dr=async()=>{var E;if(j.trim()){R(!0);try{const V=await Oe(`/api/search?q=${encodeURIComponent(j)}`);V!=null&&V.success&&((E=V.data)!=null&&E.results)?T(V.data.results):(T([]),V&&!V.success&&G.error("搜索失败: "+V.error))}catch(V){console.error(V),T([]),G.error("搜索失败")}finally{R(!1)}}},_r=lt.find(E=>E.id===O.partId),Gi=(_r==null?void 0:_r.chapters)??[];return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"内容管理"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",lt.length," 篇 · ",Wi," 节内容"]})]}),s.jsx("div",{className:"flex gap-2",children:s.jsxs(J,{onClick:()=>pt(!0),variant:"outline",className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:[s.jsx(Uh,{className:"w-4 h-4 mr-2"}),"排名算法"]})})]}),s.jsx(Dt,{open:h,onOpenChange:f,children:s.jsxs(Ot,{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(_t,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(Fn,{className:"w-5 h-5 text-[#38bdac]"}),"新建章节"]})}),s.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"章节ID *"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 9.15",value:O.id,onChange:E=>U({...O,id:E.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"价格 (元)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:O.isFree?0:O.price,onChange:E=>U({...O,price:Number(E.target.value),isFree:Number(E.target.value)===0}),disabled:O.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"免费"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:O.isFree,onChange:E=>U({...O,isFree:E.target.checked,price:E.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"最新新增"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:O.isNew,onChange:E=>U({...O,isNew:E.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"小程序直推"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:O.isPinned,onChange:E=>U({...O,isPinned:E.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"文章类型"}),s.jsxs("div",{className:"flex items-center gap-4 h-10",children:[s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"new-edition-type",checked:O.editionPremium!==!0,onChange:()=>U({...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:()=>U({...O,editionStandard:!1,editionPremium:!0}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"增值版"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"热度分"}),s.jsx(ce,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:O.hotScore??0,onChange:E=>U({...O,hotScore:Math.max(0,parseFloat(E.target.value)||0)})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"章节标题 *"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入章节标题",value:O.title,onChange:E=>U({...O,title:E.target.value})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"所属篇"}),s.jsxs(jo,{value:O.partId,onValueChange:E=>{var ue;const V=lt.find(ke=>ke.id===E);U({...O,partId:E,chapterId:((ue=V==null?void 0:V.chapters[0])==null?void 0:ue.id)??"chapter-1"})},children:[s.jsx(Ti,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(ko,{})}),s.jsxs(Mi,{className:"bg-[#0f2137] border-gray-700",children:[lt.map(E=>s.jsx(hs,{value:E.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:E.title},E.id)),lt.length===0&&s.jsx(hs,{value:"part-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认篇"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"所属章"}),s.jsxs(jo,{value:O.chapterId,onValueChange:E=>U({...O,chapterId:E}),children:[s.jsx(Ti,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(ko,{})}),s.jsxs(Mi,{className:"bg-[#0f2137] border-gray-700",children:[Gi.map(E=>s.jsx(hs,{value:E.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:E.title},E.id)),Gi.length===0&&s.jsx(hs,{value:"chapter-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认章"})]})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),s.jsx(_0,{content:O.content||"",onChange:E=>U({...O,content:E}),onImageUpload:Hi,onMediaUpload:ti,persons:yt,linkTags:It,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(rn,{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:Ra,disabled:b||!O.id||!O.title,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:b?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Fn,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),s.jsx(Dt,{open:!!I,onOpenChange:E=>!E&&z(null),children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(sn,{className:"w-5 h-5 text-[#38bdac]"}),"编辑篇名"]})}),I&&s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"篇名"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:I.title,onChange:E=>z({...I,title:E.target.value}),placeholder:"输入篇名"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"左侧图标文字(可选)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:I.badgeText||"",onChange:E=>z({...I,badgeText:Ca(E.target.value)}),placeholder:"例如:派 / 新 / 热",maxLength:8}),s.jsx("p",{className:"text-xs text-gray-500",children:"保存后会同步到目录左侧图标文字(小程序与管理端目录树)。"})]})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",onClick:()=>z(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(J,{onClick:il,disabled:L||!((dl=I==null?void 0:I.title)!=null&&dl.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:L?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Dt,{open:!!ie,onOpenChange:E=>!E&&le(null),children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsxs(_t,{children:[s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(sn,{className:"w-5 h-5 text-[#38bdac]"}),"章节设置"]}),s.jsx("p",{className:"text-gray-400 text-sm font-normal pt-1",children:"修改本章显示名称,或为本章下全部节设置统一金额(仍可在单节编辑里单独改某一节)。"})]}),ie&&s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"章节名称(如:第8章|底层结构)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:ie.title,onChange:E=>le({...ie,title:E.target.value}),placeholder:"输入章节名称"})]}),s.jsxs("div",{className:"space-y-2 border-t border-gray-700/60 pt-4",children:[s.jsxs(te,{className:"text-gray-300",children:["本章统一定价(应用于本章全部 ",ie.chapter.sections.length," 节)"]}),ie.priceMixed&&s.jsx("p",{className:"text-amber-400/90 text-xs",children:"当前各节定价不一致,保存后将按下方设置全部统一。"}),s.jsxs("div",{className:"flex flex-wrap items-end gap-4",children:[s.jsxs("div",{className:"space-y-1 flex-1 min-w-[120px]",children:[s.jsx("span",{className:"text-gray-500 text-xs",children:"价格 (元)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:ie.isFree?0:ie.price,onChange:E=>le({...ie,price:Number(E.target.value),isFree:Number(E.target.value)===0}),disabled:ie.isFree,min:0,step:.01})]}),s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer pb-2",children:[s.jsx("input",{type:"checkbox",checked:ie.isFree||ie.price===0,onChange:E=>le({...ie,isFree:E.target.checked,price:E.target.checked?0:ie.initialPrice>0?ie.initialPrice:1}),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac]"}),s.jsx("span",{className:"text-gray-400 text-sm",children:"本章全部免费"})]})]})]})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",onClick:()=>le(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(J,{onClick:ol,disabled:me||!((ul=ie==null?void 0:ie.title)!=null&&ul.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:me?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Dt,{open:ge,onOpenChange:E=>{var V;if(X(E),E&<.length>0){const ue=lt[0];W(ue.id),he(((V=ue.chapters[0])==null?void 0:V.id)??"")}},children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsx($t,{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:Y.length})," 节,请选择目标篇与章。"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"目标篇"}),s.jsxs(jo,{value:B,onValueChange:E=>{var ue;W(E);const V=lt.find(ke=>ke.id===E);he(((ue=V==null?void 0:V.chapters[0])==null?void 0:ue.id)??"")},children:[s.jsx(Ti,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(ko,{placeholder:"选择篇"})}),s.jsx(Mi,{className:"bg-[#0f2137] border-gray-700",children:lt.map(E=>s.jsx(hs,{value:E.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:E.title},E.id))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"目标章"}),s.jsxs(jo,{value:fe,onValueChange:he,children:[s.jsx(Ti,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(ko,{placeholder:"选择章"})}),s.jsx(Mi,{className:"bg-[#0f2137] border-gray-700",children:(((li=lt.find(E=>E.id===B))==null?void 0:li.chapters)??[]).map(E=>s.jsx(hs,{value:E.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:E.title},E.id))})]})]})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",onClick:()=>X(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(J,{onClick:ll,disabled:de||Y.length===0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:de?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"移动中..."]}):"确认移动"})]})]})}),s.jsx(Dt,{open:!!we,onOpenChange:E=>!E&&Fe(null),children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white",children:["付款记录 — ",(we==null?void 0:we.section.title)??""]})}),s.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:Ue?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):we&&we.orders.length===0?s.jsx("p",{className:"text-gray-500 text-center py-6",children:"暂无付款记录"}):we?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:we.orders.map(E=>s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("td",{className:"py-2 pr-2",children:s.jsx("button",{className:"text-blue-400 hover:text-blue-300 hover:underline text-left truncate max-w-[180px] block",title:`查看订单 ${E.orderSn}`,onClick:()=>window.open(`/orders?search=${E.orderSn??E.id??""}`,"_blank"),children:E.orderSn?E.orderSn.length>16?E.orderSn.slice(0,8)+"..."+E.orderSn.slice(-6):E.orderSn:"-"})}),s.jsx("td",{className:"py-2 pr-2",children:s.jsx("button",{className:"text-[#38bdac] hover:text-[#2da396] hover:underline text-left truncate max-w-[140px] block",title:`查看用户 ${E.userId??E.openId??""}`,onClick:()=>window.open(`/users?search=${E.userId??E.openId??""}`,"_blank"),children:(()=>{const V=E.userId??E.openId??"-";return V.length>12?V.slice(0,6)+"..."+V.slice(-4):V})()})}),s.jsxs("td",{className:"py-2 pr-2 text-gray-300",children:["¥",E.amount??0]}),s.jsx("td",{className:"py-2 pr-2 text-gray-300",children:E.status??"-"}),s.jsx("td",{className:"py-2 pr-2 text-gray-500",children:E.payTime??E.createdAt??"-"})]},E.id??E.orderSn??""))})]}):null})]})}),s.jsx(Dt,{open:jn,onOpenChange:pt,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(Uh,{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)"}),Hn?s.jsx("p",{className:"text-gray-500",children:"加载中..."}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"阅读权重"}),s.jsx(ce,{type:"number",step:"0.1",min:"0",max:"1",className:"bg-[#0a1628] border-gray-700 text-white",value:Pt.readWeight,onChange:E=>pn(V=>({...V,readWeight:Math.max(0,Math.min(1,parseFloat(E.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{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:Pt.recencyWeight,onChange:E=>pn(V=>({...V,recencyWeight:Math.max(0,Math.min(1,parseFloat(E.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{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:Pt.payWeight,onChange:E=>pn(V=>({...V,payWeight:Math.max(0,Math.min(1,parseFloat(E.target.value)||0))}))})]})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["当前之和: ",(Pt.readWeight+Pt.recencyWeight+Pt.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:tr,disabled:Wt||Math.abs(Pt.readWeight+Pt.recencyWeight+Pt.payWeight-1)>.001,className:"w-full bg-amber-500 hover:bg-amber-600 text-white",children:Wt?"保存中...":"保存权重"})]})]})]})}),s.jsx(Dt,{open:se,onOpenChange:$,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(Fn,{className:"w-5 h-5 text-amber-400"}),"新建篇"]})}),s.jsx("div",{className:"space-y-4 py-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"篇名(如:第六篇|真实的社会)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:q,onChange:E=>_(E.target.value),placeholder:"输入篇名"})]})}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",onClick:()=>{$(!1),_("")},className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(J,{onClick:yd,disabled:Z||!q.trim(),className:"bg-amber-500 hover:bg-amber-600 text-white",children:Z?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Fn,{className:"w-4 h-4 mr-2"}),"创建篇"]})})]})]})}),s.jsx(Dt,{open:!!c,onOpenChange:()=>u(null),children:s.jsxs(Ot,{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(_t,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(sn,{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(te,{className:"text-gray-300",children:"章节ID"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:c.id,onChange:E=>u({...c,id:E.target.value}),placeholder:"如: 9.15"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"价格 (元)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:c.isFree?0:c.price,onChange:E=>u({...c,price:Number(E.target.value),isFree:Number(E.target.value)===0}),disabled:c.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"免费"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:c.isFree||c.price===0,onChange:E=>u({...c,isFree:E.target.checked,price:E.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"预览%"}),s.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",placeholder:`全局 ${Ct}%`,value:c.previewPercent!=null?String(c.previewPercent):"",onChange:E=>{const V=E.target.value.trim();if(V===""){u({...c,previewPercent:null});return}const ue=Number(V);Number.isFinite(ue)&&u({...c,previewPercent:Math.min(100,Math.max(1,Math.round(ue)))})}})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"最新新增"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:c.isNew??!1,onChange:E=>u({...c,isNew:E.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"小程序直推"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:c.isPinned??!1,onChange:E=>u({...c,isPinned:E.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"文章类型"}),s.jsxs("div",{className:"flex items-center gap-4 h-10",children:[s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"edition-type",checked: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(te,{className:"text-gray-300",children:"热度分"}),s.jsx(ce,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:c.hotScore??0,onChange:E=>u({...c,hotScore:Math.max(0,parseFloat(E.target.value)||0)})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"章节标题"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:c.title,onChange:E=>u({...c,title:E.target.value})})]}),c.filePath&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{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(te,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),m?s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700 rounded-md min-h-[400px] flex items-center justify-center",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(_0,{ref:ac,content:c.content||"",onChange:E=>u({...c,content:E}),onImageUpload:Hi,onMediaUpload:ti,persons:yt,linkTags:It,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(rn,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[c&&s.jsxs(J,{variant:"outline",onClick:()=>ar({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(fr,{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(es,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsx(J,{onClick:aa,disabled:b,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:b?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),s.jsxs(Xc,{defaultValue:"chapters",className:"space-y-6",children:[s.jsxs(Hl,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(en,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(fr,{className:"w-4 h-4 mr-2"}),"章节管理"]}),s.jsxs(en,{value:"ranking",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(Kx,{className:"w-4 h-4 mr-2"}),"内容排行榜"]}),s.jsxs(en,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(xa,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),s.jsxs(en,{value:"link-person",className:"data-[state=active]:bg-purple-500/20 data-[state=active]:text-purple-400 text-gray-400",children:[s.jsx(Ai,{className:"w-4 h-4 mr-2"}),"@列表"]}),s.jsxs(en,{value:"link-tag",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(O1,{className:"w-4 h-4 mr-2"}),"链接标签"]})]}),s.jsxs(tn,{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(fr,{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:Wi}),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(Fn,{className:"w-4 h-4 mr-2"}),"新建章节"]}),s.jsxs(J,{onClick:()=>$(!0),className:"flex-1 min-w-[120px] bg-amber-500/10 hover:bg-amber-500/20 text-amber-400 border border-amber-500/30",children:[s.jsx(Fn,{className:"w-4 h-4 mr-2"}),"新建篇"]}),s.jsxs(J,{variant:"outline",onClick:()=>X(!0),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:["批量移动(已选 ",Y.length," 节)"]})]}),r?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(uV,{parts:lt,expandedParts:i,onTogglePart:Ki,onReorder:vr,onReadSection:ri,onDeleteSection:er,onAddSectionInPart:La,onAddChapterInPart:as,onDeleteChapter:ii,onEditPart:ai,onDeletePart:oi,onEditChapter:ia,selectedSectionIds:Y,onToggleSectionSelect:cl,onShowSectionOrders:ar,pinnedSectionIds:Me})]}),s.jsx(tn,{value:"search",className:"space-y-4",children:s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(ut,{children:s.jsx(ht,{className:"text-white",children:"内容搜索"})}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",placeholder:"搜索标题或内容...",value:j,onChange:E=>v(E.target.value),onKeyDown:E=>E.key==="Enter"&&Dr()}),s.jsx(J,{onClick:Dr,disabled:C||!j.trim(),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:C?s.jsx(He,{className:"w-4 h-4 animate-spin"}):s.jsx(xa,{className:"w-4 h-4"})})]}),k.length>0&&s.jsxs("div",{className:"space-y-2 mt-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["找到 ",k.length," 个结果"]}),k.map(E=>s.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors",onClick:()=>{const V=e.find(ue=>ue.id===E.id);ri({id:E.id,mid:E.mid,title:E.title,price:E.price??1,filePath:"",previewPercent:V==null?void 0:V.previewPercent})},children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[#38bdac] font-mono text-xs",children:E.id}),s.jsx("span",{className:"text-white",children:E.title}),Me.includes(E.id)&&s.jsx(Vc,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})]}),s.jsx(Be,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:E.matchType==="title"?"标题匹配":"内容匹配"})]}),E.snippet&&s.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:E.snippet}),(E.partTitle||E.chapterTitle)&&s.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[E.partTitle," · ",E.chapterTitle]})]},E.id))]})]})]})}),s.jsxs(tn,{value:"ranking",className:"space-y-4",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs(ht,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Uh,{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(te,{className:"text-gray-400 text-sm whitespace-nowrap",children:"未付费预览比例"}),s.jsx(ce,{type:"number",min:"1",max:"100",className:"bg-[#0a1628] border-gray-700 text-white w-20",value:Ct,onChange:E=>$e(Math.max(1,Math.min(100,Number(E.target.value)||20))),disabled:H}),s.jsx("span",{className:"text-gray-500 text-sm",children:"%"})]}),s.jsx(J,{size:"sm",onClick:al,disabled:vt,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:vt?"保存中...":"保存"}),s.jsxs("span",{className:"text-xs text-gray-500",children:["小程序未付费用户默认显示文章前 ",Ct,"% 内容"]})]})})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs(ht,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Kx,{className:"w-4 h-4 text-amber-400"}),"内容排行榜",s.jsxs("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["按热度排行 · 共 ",ns.length," 节"]})]}),s.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>br(),disabled:vn,className:"text-gray-400 hover:text-white h-7 w-7 p-0",title:"刷新排行榜",children:s.jsx(He,{className:`w-4 h-4 ${vn?"animate-spin":""}`})}),s.jsx(J,{variant:"ghost",size:"sm",disabled:Mn<=1||vn,onClick:()=>Un(E=>Math.max(1,E-1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(k5,{className:"w-4 h-4"})}),s.jsxs("span",{className:"text-gray-400 min-w-[60px] text-center",children:[Mn," / ",si]}),s.jsx(J,{variant:"ghost",size:"sm",disabled:Mn>=si||vn,onClick:()=>Un(E=>Math.min(si,E+1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(El,{className:"w-4 h-4"})})]})]})}),s.jsx(_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:"编辑"})]}),sl.map((E,V)=>{const ue=(Mn-1)*ni+V+1,ke=E.isPinned??Me.includes(E.id);return s.jsxs("div",{className:`grid grid-cols-[40px_40px_1fr_80px_80px_80px_60px] gap-2 px-3 py-2.5 items-center border-b border-gray-700/30 hover:bg-[#162840] transition-colors ${ke?"bg-amber-500/5":""}`,children:[s.jsx("span",{className:`text-sm font-bold ${ue<=3?"text-amber-400":"text-gray-500"}`,children:ue<=3?["🥇","🥈","🥉"][ue-1]:`#${ue}`}),s.jsx(J,{variant:"ghost",size:"sm",className:`h-6 w-6 p-0 ${ke?"text-amber-400":"text-gray-600 hover:text-amber-400"}`,onClick:()=>Or(E.id),disabled:at,title:ke?"取消置顶":"强制置顶(精选推荐/首页最新更新)",children:ke?s.jsx(Vc,{className:"w-3.5 h-3.5 fill-current"}):s.jsx(_1,{className:"w-3.5 h-3.5"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"text-white text-sm truncate block",children:E.title}),s.jsxs("span",{className:"text-gray-600 text-xs",children:[E.partTitle," · ",E.chapterTitle]})]}),s.jsx("span",{className:"text-right text-sm text-blue-400 font-mono",children:E.clickCount??0}),s.jsx("span",{className:"text-right text-sm text-green-400 font-mono",children:E.payCount??0}),s.jsx("span",{className:"text-right text-sm text-amber-400 font-mono",children:(E.hotScore??0).toFixed(1)}),s.jsx("div",{className:"text-right",children:s.jsx(J,{variant:"ghost",size:"sm",className:"text-gray-500 hover:text-[#38bdac] h-6 px-1",onClick:()=>ri({id:E.id,mid:E.mid,title:E.title,price:E.price,filePath:"",previewPercent:E.previewPercent}),title:"编辑文章",children:s.jsx(sn,{className:"w-3 h-3"})})})]},E.id)}),sl.length===0&&s.jsx("div",{className:"py-8 text-center text-gray-500",children:"暂无数据"})]})})]})]}),s.jsxs(tn,{value:"link-person",className:"space-y-4",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"pb-3",children:[s.jsxs(ht,{className:"text-white text-base flex items-center gap-2",children:[s.jsx("span",{className:"text-[#38bdac] text-lg font-bold",children:"@"}),"AI列表 — @列表(编辑器内输入 @ 可链接)"]}),s.jsxs("div",{className:"text-xs text-gray-500 mt-1 space-y-1",children:[s.jsxs("p",{children:["文章 @ 存 ",s.jsx("span",{className:"text-gray-400",children:"token"}),";小程序点 @ 用 token 换存客宝密钥后加好友/拉群。"]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-purple-300",children:"超级个体"}),":开通且昵称合法会自动进本列表可 @;共用「超级个体拉群」统一获客计划(话术由技术侧在系统里配置,本页不填 plan/apiKey,避免误操作)。"]}),s.jsx("p",{children:"点「添加」新建的人物:每人单独一条存客宝计划(SOUL链接人与事-名称)。"})]})]}),s.jsxs(_e,{className:"space-y-3",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("p",{className:"text-xs text-gray-500",children:"本页只管理可 @ 的人物列表"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(J,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 hover:bg-gray-700/50",onClick:()=>{_n()},title:"刷新",children:s.jsx(He,{className:"w-4 h-4"})}),s.jsxs(J,{size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",onClick:()=>{Xa(null),ea(!0)},children:[s.jsx(Fn,{className:"w-4 h-4 mr-2"}),"添加"]})]})]}),s.jsx("div",{className:"max-h-[400px] overflow-y-auto",children:yt.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:yt.map(E=>s.jsxs("tr",{className:"border-b border-gray-700/30 hover:bg-[#0a1628]/80",children:[s.jsx("td",{className:"py-2 px-3 text-gray-400 text-xs font-mono",title:"32位token",children:E.id}),s.jsx("td",{className:"py-2 px-3 truncate max-w-[96px]",children:s.jsx("button",{type:"button",className:"text-amber-400 hover:text-amber-300 hover:underline text-left",onClick:()=>{nn[E.id]&&Ma(E.id,E.name)},title:nn[E.id]?"点击查看获客详情":E.name,children:E.name})}),s.jsx("td",{className:"py-2 px-3",children:E.personSource==="vip_sync"?s.jsx("span",{className:"text-[10px] text-purple-300 bg-purple-500/15 px-1.5 py-0.5 rounded whitespace-nowrap",children:"超级个体"}):s.jsx("span",{className:"text-[10px] text-gray-500 bg-gray-500/10 px-1.5 py-0.5 rounded whitespace-nowrap",children:"手工"})}),s.jsx("td",{className:"py-2 px-3 text-xs",children:E.userId?s.jsxs("div",{className:"flex flex-col gap-0.5 items-start max-w-[100px]",children:[E.personSource==="vip_sync"&&s.jsx("span",{className:"text-[10px] text-purple-300/90 leading-tight",children:"已绑定超级个体"}),s.jsx("button",{type:"button",className:"text-[#38bdac] hover:underline truncate max-w-[96px] block text-left",title:`用户ID: ${E.userId}`,onClick:()=>t(`/users?search=${encodeURIComponent(E.userId||"")}`),children:E.name})]}):s.jsx("span",{className:"text-gray-600",children:"—"})}),(()=>{const V=nn[E.id]||0;return s.jsx("td",{className:`py-2 px-3 shrink-0 w-16 text-center text-xs font-bold cursor-pointer ${V>0?"text-green-400 hover:text-green-300 hover:underline":"text-gray-600"}`,title:V>0?"点击查看获客详情":"暂无获客",onClick:()=>{V>0&&Ma(E.id,E.name)},children:V})})(),s.jsx("td",{className:"py-2 px-3 text-white truncate max-w-[220px]",title:`planId: ${E.ckbPlanId??"-"}`,children:s.jsx("div",{className:"flex items-center gap-1.5",children:s.jsx("span",{className:"truncate",children:E.ckbPlanId?E.personSource==="vip_sync"?"超级个体拉群(统一计划)":`SOUL链接人与事-${E.name}`:"—"})})}),s.jsx("td",{className:"py-2 px-2 text-center",children:s.jsx(J,{type:"button",variant:"ghost",size:"sm",className:E.isPinned?"text-amber-400 hover:text-amber-300 h-7 px-2":"text-gray-500 hover:text-amber-400/90 h-7 px-2",title:E.isPinned?"取消小程序首页置顶":"设为小程序首页置顶(全局唯一)",onClick:()=>void ic(E,!E.isPinned),children:s.jsx(_1,{className:`w-3.5 h-3.5 ${E.isPinned?"fill-amber-400":""}`})})}),s.jsx("td",{className:"py-2 px-3 text-center",children:E.ckbPlanId?s.jsx("span",{className:"text-[10px] text-green-400 bg-green-400/10 px-1.5 py-0.5 rounded",children:"启用"}):s.jsx("span",{className:"text-[10px] text-gray-500 bg-gray-500/10 px-1.5 py-0.5 rounded",children:"未配置"})}),s.jsx("td",{className:"py-2 px-2",children:s.jsxs("div",{className:"flex items-center gap-0",children:[s.jsx(J,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-[#38bdac] h-6 px-2",title:"编辑",onClick:async()=>{try{const V=await fV(E.personId||"");if(V!=null&&V.success&&V.person){const ue=V.person;Xa({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 Xa(E),V!=null&&V.error&&G.error(V.error)}catch(V){console.error(V),Xa(E),G.error(V instanceof Error?V.message:"加载人物详情失败")}ea(!0)},children:s.jsx(Wx,{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(E.id,E.name),children:s.jsx(Kn,{className:"w-3 h-3"})}),s.jsx(J,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",title:E.personSource==="vip_sync"?"删除本地 @人物(不删统一获客计划)":"删除(同时删除存客宝对应获客计划)",onClick:()=>Rr(E),children:s.jsx(es,{className:"w-3 h-3"})})]})})]},E.id))})]}):s.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无AI人物,添加后可在编辑器中 @链接"})})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"pb-3",children:[s.jsxs(ht,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(mA,{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(te,{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(te,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"pb-3",children:[s.jsxs(ht,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Uh,{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(te,{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:sa,onChange:E=>Sa(E.target.value)})]}),s.jsxs(J,{size:"sm",className:"bg-blue-500 hover:bg-blue-600 text-white h-8",onClick:async()=>{const E=sa.trim();try{const V=await kt("/api/db/config",{key:"ckb_lead_webhook_url",value:E,description:"获客线索 Webhook 通知 URL(企微/飞书)"});V!=null&&V.success?G.success(E?"Webhook 已保存":"Webhook 已清除"):G.error((V==null?void 0:V.error)??"保存失败")}catch{G.error("保存失败")}},children:[s.jsx(Tn,{className:"w-3.5 h-3.5 mr-1"}),"保存"]})]}),s.jsx("p",{className:"text-xs text-gray-500",children:"配置企业微信或飞书群机器人 Webhook URL,获客成功后自动推送通知"})]})]})]}),s.jsxs(tn,{value:"link-tag",className:"space-y-4",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"pb-3",children:[s.jsxs(ht,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(O1,{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(te,{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:Qs,onChange:E=>{xr(E.target.value),Xr(1)}})]}),s.jsx(J,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 hover:bg-gray-700/50 h-8",onClick:()=>{Lr(),Nr()},title:"刷新",children:s.jsx(He,{className:"w-4 h-4"})})]}),s.jsxs(J,{size:"sm",className:"bg-amber-500 hover:bg-amber-600 text-white h-8",onClick:()=>{ve(null),Nt({tagId:"",label:"",aliases:"",url:"",type:"url",appId:"",appSecret:"",pagePath:""}),sr(""),rr(!1),Fs(!0)},children:[s.jsx(Fn,{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:mr?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:"加载中..."})}):kn.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:"暂无链接标签,添加后可在编辑器中使用 #标签 跳转"})}):kn.map(E=>s.jsxs("tr",{className:"border-b border-gray-700/30 hover:bg-white/5",children:[s.jsx("td",{className:"px-3 py-2",children:s.jsxs("button",{type:"button",className:"text-amber-400 font-semibold hover:text-amber-300 hover:underline text-left",onClick:()=>{ve(E),Nt({tagId:E.id,label:E.label,aliases:E.aliases??"",url:E.url,type:E.type,appId:E.appId??"",appSecret:"",pagePath:E.pagePath??""}),sr(E.appId??""),rr(!1),Fs(!0)},title:"点击编辑标签",children:["#",E.label]})}),s.jsx("td",{className:"px-3 py-2 text-gray-500 text-xs truncate max-w-[120px]",title:E.aliases||"",children:E.aliases||"—"}),s.jsx("td",{className:"px-3 py-2",children:s.jsx(Be,{variant:"secondary",className:`text-[10px] ${E.type==="ckb"?"bg-green-500/20 text-green-300 border-green-500/30":E.type==="miniprogram"||E.type==="wxlink"?"bg-[#38bdac]/20 text-[#38bdac] border-[#38bdac]/30":"bg-gray-700 text-gray-300"}`,children:E.type==="url"?"网页":E.type==="ckb"?"存客宝":E.type==="wxlink"?"小程序链接":"小程序"})}),s.jsx("td",{className:"px-3 py-2 text-gray-300",children:E.type==="miniprogram"?s.jsxs("div",{className:"space-y-0.5",children:[(()=>{const V=nr.find(ue=>ue.key===E.appId);return s.jsxs(s.Fragment,{children:[V&&s.jsx("div",{className:"text-xs text-white",children:V.name}),s.jsxs("div",{className:"text-xs font-mono text-[#38bdac]",children:["AppID: ",(V==null?void 0:V.appId)||E.appId||"—"]})]})})(),E.pagePath&&s.jsx("div",{className:"text-xs text-gray-500 font-mono",children:E.pagePath}),s.jsxs("div",{className:`text-xs ${E.hasAppSecret?"text-emerald-400/90":"text-amber-500/80"}`,children:["AppSecret:",E.hasAppSecret?"已保存(仅服务端)":"未配置"]})]}):E.type==="wxlink"?s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("div",{className:"text-xs text-[#38bdac] truncate max-w-[420px] font-mono",title:E.url,children:E.url||"—"}),s.jsx("div",{className:"text-[11px] text-gray-500",children:"小程序内点击 → web-view 打开 → 自动唤起目标小程序"})]}):E.url?s.jsxs("a",{href:E.url,target:"_blank",rel:"noreferrer",className:"text-blue-400 text-xs truncate max-w-[420px] hover:underline inline-flex items-center gap-1",children:[E.url," ",s.jsx(_o,{className:"w-3 h-3 shrink-0"})]}):s.jsx("span",{className:"text-gray-500 text-xs",children:"—"})}),s.jsx("td",{className:"px-3 py-2",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(J,{variant:"ghost",size:"sm",className:"text-gray-300 hover:text-white h-7 px-2",onClick:()=>{ve(E),Nt({tagId:E.id,label:E.label,aliases:E.aliases??"",url:E.url,type:E.type,appId:E.appId??"",appSecret:"",pagePath:E.pagePath??""}),sr(E.appId??""),rr(!1),Fs(!0)},title:"编辑",children:s.jsx(Wx,{className:"w-3 h-3"})}),s.jsx(J,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-7 px-2",onClick:async()=>{if(confirm(`确定要删除「#${E.label}」吗?`))try{const V=await Ei(`/api/db/link-tags?tagId=${encodeURIComponent(E.id)}`);V!=null&&V.success?(G.success("已删除"),Lr(),Nr()):G.error((V==null?void 0:V.error)??"删除失败")}catch(V){console.error(V),G.error("删除失败")}},title:"删除",children:s.jsx(es,{className:"w-3 h-3"})})]})})]},E.id))})]})}),s.jsx(qs,{page:Yr,pageSize:ja,total:Ir,totalPages:Ya,onPageChange:E=>Xr(E),onPageSizeChange:E=>{Pr(E),Xr(1)}})]})]})]}),s.jsx(Dt,{open:Ys,onOpenChange:Fs,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg p-4 gap-3",children:[s.jsxs(_t,{className:"gap-1",children:[s.jsx($t,{className:"text-base",children:oe?"编辑链接标签":"添加链接标签"}),s.jsx(Yc,{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(te,{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:Xe.tagId,disabled:!!oe,onChange:E=>Nt(V=>({...V,tagId:E.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-300 text-sm",children:"显示文字"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"如 神仙团队",value:Xe.label,onChange:E=>Nt(V=>({...V,label:E.target.value}))})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-300 text-sm",children:"别名(多个用逗号分隔,同指向一个目标)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"如 团队招募, 团队合伙人",value:Xe.aliases,onChange:E=>Nt(V=>({...V,aliases:E.target.value}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 items-end",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-300 text-sm",children:"类型"}),s.jsxs(jo,{value:Xe.type,onValueChange:E=>Nt(V=>({...V,type:E})),children:[s.jsx(Ti,{className:"bg-[#0a1628] border-gray-700 text-white h-8",children:s.jsx(ko,{})}),s.jsxs(Mi,{className:"bg-[#0f2137] border-gray-700 text-white",children:[s.jsx(hs,{value:"url",children:"网页链接"}),s.jsx(hs,{value:"miniprogram",children:"小程序(API跳转)"}),s.jsx(hs,{value:"wxlink",children:"小程序链接(右上角复制)"}),s.jsx(hs,{value:"ckb",children:"存客宝"})]})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-300 text-sm",children:Xe.type==="url"?"URL地址":Xe.type==="ckb"?"存客宝计划URL":Xe.type==="wxlink"?"小程序链接":"小程序 mpKey / 微信 AppID"}),Xe.type==="wxlink"?s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"粘贴小程序右上角 ... → 复制链接 得到的 URL",value:Xe.url,onChange:E=>Nt(V=>({...V,url:E.target.value}))}):Xe.type==="miniprogram"&&nr.length>0?s.jsxs("div",{ref:qi,className:"relative",children:[s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"搜索名称或密钥",value:rs?wr:Xe.appId,onChange:E=>{const V=E.target.value;sr(V),rr(!0),nr.some(ue=>ue.key===V)||Nt(ue=>({...ue,appId:V}))},onFocus:()=>{sr(Xe.appId),rr(!0)},onBlur:()=>setTimeout(()=>rr(!1),150)}),rs&&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:Pa.length===0?s.jsx("div",{className:"px-3 py-2 text-gray-500 text-xs",children:"无匹配,可手动输入密钥"}):Pa.map(E=>s.jsxs("button",{type:"button",className:"w-full px-3 py-2 text-left text-sm text-white hover:bg-[#38bdac]/20 flex flex-col gap-0.5",onMouseDown:V=>{V.preventDefault(),Nt(ue=>({...ue,appId:E.key,pagePath:E.path||""})),sr(""),rr(!1)},children:[s.jsx("span",{children:E.name}),s.jsx("span",{className:"text-xs text-gray-400 font-mono",children:E.key})]},E.key))})]}):s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:Xe.type==="url"?"https://...":Xe.type==="ckb"?"https://ckbapi.quwanzhi.com/...":"关联配置的 key,或直接填 wx 开头的 AppID",value:Xe.type==="url"||Xe.type==="ckb"?Xe.url:Xe.appId,onChange:E=>{Xe.type==="url"||Xe.type==="ckb"?Nt(V=>({...V,url:E.target.value})):Nt(V=>({...V,appId:E.target.value}))}})]})]}),Xe.type==="wxlink"&&s.jsx("p",{className:"text-[11px] text-amber-400/80 leading-snug px-0.5",children:"操作:打开目标小程序 → 右上角「...」→「复制链接」→ 粘贴到上面。小程序内点击此标签会在 web-view 中打开,微信自动唤起目标小程序,无需修改小程序版本。"}),Xe.type==="miniprogram"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{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:Xe.pagePath,onChange:E=>Nt(V=>({...V,pagePath:E.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{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:oe!=null&&oe.hasAppSecret?"已保存密钥,留空不改;填写则覆盖":"粘贴目标小程序 AppSecret",value:Xe.appSecret,onChange:E=>Nt(V=>({...V,appSecret:E.target.value}))}),s.jsx("p",{className:"text-[11px] text-gray-500 leading-snug",children:"与 AppID 成对落库;接口响应与小程序配置中均不会返回此字段。"})]})]})]}),s.jsxs(rn,{className:"gap-2 pt-1",children:[s.jsx(J,{variant:"outline",onClick:()=>Fs(!1),className:"border-gray-600",children:"取消"}),s.jsx(J,{onClick:async()=>{const E={tagId:Xe.tagId.trim(),label:Xe.label.trim(),aliases:Xe.aliases.trim(),url:Xe.url.trim(),type:Xe.type,appId:Xe.appId.trim(),appSecret:Xe.appSecret.trim(),pagePath:Xe.pagePath.trim()};if(E.tagId){const V=E.tagId;if([...V].length>50){G.error("标签ID 最长 50 个字符");return}if(/[#,\n\r\t]/.test(V)){G.error("标签ID 不能含 #、逗号或换行");return}}if(!E.label){G.error("显示文字必填");return}E.type==="miniprogram"&&(E.url=""),E.type==="wxlink"&&(E.appId="",E.pagePath=""),Xs(!0);try{const V=await kt("/api/db/link-tags",E);V!=null&&V.success?(G.success(oe?"已更新":"已添加"),Fs(!1),Lr(),Nr()):G.error((V==null?void 0:V.error)??"保存失败")}catch(V){console.error(V),G.error("保存失败")}finally{Xs(!1)}},disabled:Zt,className:"bg-amber-500 hover:bg-amber-600 text-white",children:Zt?"保存中...":"保存"})]})]})})]})]}),s.jsx(bV,{open:Xo,onOpenChange:ea,editingPerson:Fi,onSubmit:async E=>{var ke;const V={personId:E.personId||E.name.toLowerCase().replace(/\s+/g,"_")+"_"+Date.now().toString(36),name:E.name,userId:E.boundUserId,aliases:E.aliases||void 0,label:E.label,ckbApiKey:E.ckbApiKey||void 0,greeting:E.greeting||void 0,tips:E.tips||void 0,remarkType:E.remarkType||void 0,remarkFormat:E.remarkFormat||void 0,addFriendInterval:E.addFriendInterval,startTime:E.startTime||void 0,endTime:E.endTime||void 0,deviceGroups:(ke=E.deviceGroups)!=null&&ke.trim()?E.deviceGroups.split(",").map(Ke=>parseInt(Ke.trim(),10)).filter(Ke=>!Number.isNaN(Ke)):void 0},ue=await kt("/api/db/persons",V);if(ue&&ue.success===!1){const Ke=ue;Ke.ckbResponse&&console.log("存客宝返回",Ke.ckbResponse);const mt=Ke.error||"操作失败";throw new Error(mt)}if(_n(),G.success(Fi?"已保存":"已添加"),ue!=null&&ue.ckbCreateResult&&Object.keys(ue.ckbCreateResult).length>0){const Ke=ue.ckbCreateResult;console.log("存客宝创建结果",Ke);const mt=Ke.planId??Ke.id,wt=mt!=null?[`planId: ${mt}`]:[];Ke.apiKey!=null&&wt.push("apiKey: ***"),G.info(wt.length?`存客宝创建结果:${wt.join(",")}`:"存客宝创建结果见控制台")}}}),s.jsx(Dt,{open:!!bs,onOpenChange:E=>{E||Rr(null)},children:s.jsxs(Ot,{showCloseButton:!0,className:"bg-[#0f2137] border-gray-700 text-white max-w-md p-4 gap-3",children:[s.jsxs(_t,{className:"gap-1",children:[s.jsx($t,{className:"text-white text-base",children:"确认删除"}),s.jsx(Yc,{className:"text-gray-400 text-sm leading-relaxed wrap-break-word",children:bs&&s.jsxs(s.Fragment,{children:[bs.personSource==="vip_sync"?s.jsxs(s.Fragment,{children:[s.jsxs("p",{children:["确定删除超级个体「",bs.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链接人与事-",bs.name,"」?将同时删除存客宝对应获客计划。"]})}),s.jsxs("p",{className:"mt-1.5",children:["二次确认:删除后无法恢复,文章中的 @",bs.name," 将无法正常跳转。"]})]})})]}),s.jsxs(rn,{className:"gap-2 sm:gap-2 pt-1",children:[s.jsx(J,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-300",onClick:()=>Rr(null),children:"取消"}),s.jsx(J,{variant:"destructive",size:"sm",className:"bg-red-600 hover:bg-red-700",onClick:async()=>{bs&&(await Ei(`/api/db/persons?personId=${bs.personId}`),Rr(null),_n(),G.success("已删除"))},children:"确定删除"})]})]})}),s.jsx(Dt,{open:Bi,onOpenChange:ta,children:s.jsxs(Ot,{className:"max-w-2xl bg-[#0f2137] border-gray-700",children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(Kn,{className:"w-5 h-5 text-green-400"}),Vi," — 获客详情(共 ",Jn," 条)"]})}),s.jsx("div",{className:"max-h-[450px] overflow-y-auto space-y-2",children:yr?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(He,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):Bs.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:"时间"})]}),Bs.map((E,V)=>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:(na-1)*20+V+1}),s.jsx("span",{className:"text-white truncate",children:E.nickname||E.name||E.userId||"-"}),s.jsx("span",{className:"text-gray-300 text-xs",children:E.phone||"-"}),s.jsx("span",{className:"text-gray-300 text-xs truncate",children:E.wechatId||"-"}),s.jsx("span",{className:"text-xs",children:E.source==="article_mention"?s.jsx("span",{className:"text-purple-400",children:"文章@"}):E.source==="index_lead"?s.jsx("span",{className:"text-blue-400",children:"首页"}):s.jsx("span",{className:"text-gray-500",children:E.source||"-"})}),s.jsx("span",{className:"text-[10px]",children:s.jsx("span",{className:"text-green-400 bg-green-400/10 px-1 py-0.5 rounded",children:"已添加"})}),s.jsx("span",{className:"text-gray-500 text-xs",children:E.createdAt?new Date(E.createdAt).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"-"})]},E.id))]})}),Jn>20&&s.jsxs("div",{className:"flex items-center justify-center gap-2 pt-2",children:[s.jsx(J,{size:"sm",variant:"outline",disabled:na<=1,onClick:()=>Ma(ka,Vi,na-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:[na," / ",Math.ceil(Jn/20)]}),s.jsx(J,{size:"sm",variant:"outline",disabled:na>=Math.ceil(Jn/20),onClick:()=>Ma(ka,Vi,na+1),className:"border-gray-600 text-gray-300 bg-transparent h-7 px-3",children:"下一页"})]})]})})]})}const Si={name:"卡若",avatar:"K",avatarImg:"",title:"Soul派对房主理人 · 私域运营专家",bio:'每天早上6点到9点,在Soul派对房分享真实的创业故事。专注私域运营与项目变现,用"云阿米巴"模式帮助创业者构建可持续的商业体系。',stats:[{label:"商业案例",value:"62"},{label:"连续直播",value:"365天"},{label:"派对分享",value:"1000+"}],highlights:["5年私域运营经验","帮助100+品牌从0到1增长","连续创业者,擅长商业模式设计"]};function jj(t){return Array.isArray(t)?t.map(e=>e&&typeof e=="object"&&"label"in e&&"value"in e?{label:String(e.label),value:String(e.value)}:{label:"",value:""}).filter(e=>e.label||e.value):Si.stats}function kj(t){return Array.isArray(t)?t.map(e=>typeof e=="string"?e:String(e??"")).filter(Boolean):Si.highlights}function wV(){const[t,e]=y.useState(Si),[n,r]=y.useState(!0),[a,i]=y.useState(!1),[o,c]=y.useState(!1),u=y.useRef(null);y.useEffect(()=>{Oe("/api/admin/author-settings").then(k=>{const T=k==null?void 0:k.data;T&&typeof T=="object"&&e({name:String(T.name??Si.name),avatar:String(T.avatar??Si.avatar),avatarImg:String(T.avatarImg??""),title:String(T.title??Si.title),bio:String(T.bio??Si.bio),stats:jj(T.stats).length?jj(T.stats):Si.stats,highlights:kj(T.highlights).length?kj(T.highlights):Si.highlights})}).catch(console.error).finally(()=>r(!1))},[]);const h=async()=>{i(!0);try{const k={name:t.name,avatar:t.avatar||"K",avatarImg:t.avatarImg,title:t.title,bio:t.bio,stats:t.stats.filter(R=>R.label||R.value),highlights:t.highlights.filter(Boolean)},T=await kt("/api/admin/author-settings",k);if(!T||T.success===!1){G.error("保存失败: "+(T&&typeof T=="object"&&"error"in T?T.error:""));return}i(!1);const C=document.createElement("div");C.className="fixed top-4 right-4 z-50 px-4 py-2 rounded-lg bg-[#38bdac] text-white text-sm shadow-lg",C.textContent="作者设置已保存",document.body.appendChild(C),setTimeout(()=>C.remove(),2e3)}catch(k){console.error(k),G.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{i(!1)}},f=async k=>{var C;const T=(C=k.target.files)==null?void 0:C[0];if(T){c(!0);try{const R=new FormData;R.append("file",T),R.append("folder","avatars");const O=zu(),U={};O&&(U.Authorization=`Bearer ${O}`);const z=await(await fetch(Fl("/api/upload"),{method:"POST",body:R,credentials:"include",headers:U})).json();z!=null&&z.success&&(z!=null&&z.url)?e(L=>({...L,avatarImg:z.url})):G.error("上传失败: "+((z==null?void 0:z.error)||"未知错误"))}catch(R){console.error(R),G.error("上传失败")}finally{c(!1),u.current&&(u.current.value="")}}},m=()=>e(k=>({...k,stats:[...k.stats,{label:"",value:""}]})),g=k=>e(T=>({...T,stats:T.stats.filter((C,R)=>R!==k)})),b=(k,T,C)=>e(R=>({...R,stats:R.stats.map((O,U)=>U===k?{...O,[T]:C}:O)})),N=()=>e(k=>({...k,highlights:[...k.highlights,""]})),j=k=>e(T=>({...T,highlights:T.highlights.filter((C,R)=>R!==k)})),v=(k,T)=>e(C=>({...C,highlights:C.highlights.map((R,O)=>O===k?T: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(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(Tn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"flex items-center gap-2 text-white",children:[s.jsx(Ci,{className:"w-4 h-4 text-[#38bdac]"}),"基本信息"]}),s.jsx(qt,{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(te,{className:"text-gray-300",children:"姓名"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.name,onChange:k=>e(T=>({...T,name:k.target.value})),placeholder:"卡若"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"首字母占位(无头像时显示)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white w-20",value:t.avatar,onChange:k=>e(T=>({...T,avatar:k.target.value.slice(0,1)||"K"})),placeholder:"K"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(sk,{className:"w-3 h-3 text-[#38bdac]"}),"头像图片"]}),s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:t.avatarImg,onChange:k=>e(T=>({...T,avatarImg:k.target.value})),placeholder:"上传或粘贴 URL,如 /uploads/avatars/xxx.png"}),s.jsx("input",{ref:u,type:"file",accept:"image/*",className:"hidden",onChange:f}),s.jsxs(J,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:o,onClick:()=>{var k;return(k=u.current)==null?void 0:k.click()},children:[s.jsx(Af,{className:"w-4 h-4 mr-2"}),o?"上传中...":"上传"]})]}),t.avatarImg&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:ya(t.avatarImg.startsWith("http")?t.avatarImg:Fl(t.avatarImg)),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"头衔"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.title,onChange:k=>e(T=>({...T,title:k.target.value})),placeholder:"Soul派对房主理人 · 私域运营专家"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"个人简介"}),s.jsx(tc,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[120px]",value:t.bio,onChange:k=>e(T=>({...T,bio:k.target.value})),placeholder:"每天早上6点到9点..."})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsx(ht,{className:"text-white",children:"统计数据"}),s.jsx(qt,{className:"text-gray-400",children:"展示在作者卡片中的数字指标,如「商业案例 62」「连续直播 365天」。第一个「商业案例」的值可由书籍统计自动更新。"})]}),s.jsxs(_e,{className:"space-y-3",children:[t.stats.map((k,T)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.label,onChange:C=>b(T,"label",C.target.value),placeholder:"标签"}),s.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.value,onChange:C=>b(T,"value",C.target.value),placeholder:"数值"}),s.jsx(J,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>g(T),children:s.jsx(es,{className:"w-4 h-4"})})]},T)),s.jsxs(J,{variant:"outline",size:"sm",onClick:m,className:"border-gray-600 text-gray-400",children:[s.jsx(Fn,{className:"w-4 h-4 mr-2"}),"添加统计项"]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsx(ht,{className:"text-white",children:"亮点标签"}),s.jsx(qt,{className:"text-gray-400",children:"作者优势或成就的简短描述,以标签形式展示。"})]}),s.jsxs(_e,{className:"space-y-3",children:[t.highlights.map((k,T)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k,onChange:C=>v(T,C.target.value),placeholder:"5年私域运营经验"}),s.jsx(J,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>j(T),children:s.jsx(es,{className:"w-4 h-4"})})]},T)),s.jsxs(J,{variant:"outline",size:"sm",onClick:N,className:"border-gray-600 text-gray-400",children:[s.jsx(Fn,{className:"w-4 h-4 mr-2"}),"添加亮点"]})]})]})]})]})}function jV(t){return confirm(`确定删除该${t}?此操作不可恢复。`)?window.prompt(`请输入「删除」以确认删除${t}`)==="删除":!1}function kV(){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=Ul(h,300),[g,b]=y.useState(!0),[N,j]=y.useState(null),[v,k]=y.useState(!1),[T,C]=y.useState(null),[R,O]=y.useState(""),[U,I]=y.useState(""),[z,L]=y.useState(""),[Q,se]=y.useState("admin"),[$,ie]=y.useState("active"),[le,me]=y.useState(!1);async function P(){var W;b(!0),j(null);try{const fe=new URLSearchParams({page:String(a),pageSize:String(o)});m.trim()&&fe.set("search",m.trim());const he=await Oe(`/api/admin/users?${fe}`);he!=null&&he.success?(e(he.records||[]),r(he.total??0),u(he.totalPages??0)):j(he.error||"加载失败")}catch(fe){const he=fe;j(he.status===403?"无权限访问":((W=he==null?void 0:he.data)==null?void 0:W.error)||"加载失败"),e([])}finally{b(!1)}}y.useEffect(()=>{P()},[a,o,m]);const Y=()=>{C(null),O(""),I(""),L(""),se("admin"),ie("active"),k(!0)},F=W=>{C(W),O(W.username),I(""),L(W.name||""),se(W.role==="super_admin"?"super_admin":"admin"),ie(W.status==="disabled"?"disabled":"active"),k(!0)},ge=async()=>{var W;if(!R.trim()){j("用户名不能为空");return}if(!T&&!U){j("新建时密码必填,至少 6 位");return}if(U&&U.length<6){j("密码至少 6 位");return}j(null),me(!0);try{if(T){const fe=await Xt("/api/admin/users",{id:T.id,password:U||void 0,name:z.trim(),role:Q,status:$});fe!=null&&fe.success?(k(!1),P()):j((fe==null?void 0:fe.error)||"保存失败")}else{const fe=await kt("/api/admin/users",{username:R.trim(),password:U,name:z.trim(),role:Q});fe!=null&&fe.success?(k(!1),P()):j((fe==null?void 0:fe.error)||"保存失败")}}catch(fe){const he=fe;j(((W=he==null?void 0:he.data)==null?void 0:W.error)||"保存失败")}finally{me(!1)}},X=async W=>{var fe;if(!jV("管理员")){j("已取消删除");return}try{const he=await Ei(`/api/admin/users?id=${W}`);he!=null&&he.success?P():j((he==null?void 0:he.error)||"删除失败")}catch(he){const de=he;j(((fe=de==null?void 0:de.data)==null?void 0:fe.error)||"删除失败")}},B=W=>{if(!W)return"-";try{const fe=new Date(W);return isNaN(fe.getTime())?W:fe.toLocaleString("zh-CN")}catch{return W}};return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Bc,{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:W=>f(W.target.value),className:"w-48 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"}),s.jsx(J,{variant:"outline",size:"sm",onClick:P,disabled:g,className:"border-gray-600 text-gray-300",children:s.jsx(He,{className:`w-4 h-4 ${g?"animate-spin":""}`})}),s.jsxs(J,{onClick:Y,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Fn,{className:"w-4 h-4 mr-2"}),"新增管理员"]})]})]}),N&&s.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 text-sm flex justify-between items-center",children:[s.jsx("span",{children:N}),s.jsx("button",{type:"button",onClick:()=>j(null),className:"text-red-400 hover:text-red-300",children:"×"})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-0",children:g?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(s.Fragment,{children:[s.jsxs(ps,{children:[s.jsx(ms,{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(gs,{children:[t.map(W=>s.jsxs(xt,{className:"border-gray-700/50",children:[s.jsx(je,{className:"text-gray-300",children:W.id}),s.jsx(je,{className:"text-white font-medium",children:W.username}),s.jsx(je,{className:"text-gray-400",children:W.name||"-"}),s.jsx(je,{children:s.jsx(Be,{variant:"outline",className:W.role==="super_admin"?"border-amber-500/50 text-amber-400":"border-gray-600 text-gray-400",children:W.role==="super_admin"?"超级管理员":"管理员"})}),s.jsx(je,{children:s.jsx(Be,{variant:"outline",className:W.status==="active"?"border-[#38bdac]/50 text-[#38bdac]":"border-gray-500 text-gray-500",children:W.status==="active"?"正常":"已禁用"})}),s.jsx(je,{className:"text-gray-500 text-sm",children:B(W.createdAt)}),s.jsxs(je,{className:"text-right",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>F(W),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(sn,{className:"w-4 h-4"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>X(W.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(Zn,{className:"w-4 h-4"})})]})]},W.id)),t.length===0&&!g&&s.jsx(xt,{children:s.jsx(je,{colSpan:7,className:"text-center py-12 text-gray-500",children:N==="无权限访问"?"仅超级管理员可查看":"暂无管理员"})})]})]}),c>1&&s.jsx("div",{className:"p-4 border-t border-gray-700/50",children:s.jsx(qs,{page:a,pageSize:o,total:n,totalPages:c,onPageChange:i})})]})})}),s.jsx(Dt,{open:v,onOpenChange:k,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(_t,{children:s.jsx($t,{className:"text-white",children:T?"编辑管理员":"新增管理员"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"用户名"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"登录用户名",value:R,onChange:W=>O(W.target.value),disabled:!!T}),T&&s.jsx("p",{className:"text-xs text-gray-500",children:"用户名不可修改"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:T?"新密码(留空不改)":"密码"}),s.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:T?"留空表示不修改":"至少 6 位",value:U,onChange:W=>I(W.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"昵称"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"显示名称",value:z,onChange:W=>L(W.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"角色"}),s.jsxs("select",{value:Q,onChange:W=>se(W.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[s.jsx("option",{value:"admin",children:"管理员"}),s.jsx("option",{value:"super_admin",children:"超级管理员"})]})]}),T&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"状态"}),s.jsxs("select",{value:$,onChange:W=>ie(W.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[s.jsx("option",{value:"active",children:"正常"}),s.jsx("option",{value:"disabled",children:"禁用"})]})]})]}),s.jsxs(rn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>k(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(es,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:ge,disabled:le,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),le?"保存中...":"保存"]})]})]})})]})}function Rn({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 K4(){const t=["Authorization: Bearer {token}","Content-Type: application/json"];return s.jsxs("div",{className:"p-8 w-full bg-[#0a1628] text-white",children:[s.jsxs("div",{className:"mb-8",children:[s.jsx("h1",{className:"text-2xl font-bold text-white",children:"API 接口文档"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"内容管理相关接口 · RESTful · 基础路径 /api · 管理端需 Bearer Token"})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Hx,{className:"w-5 h-5 text-[#38bdac]"}),"1. Authentication"]})}),s.jsx(_e,{className:"space-y-4",children:s.jsx(Rn,{method:"POST",url:"/api/admin",desc:"登录,返回 JWT token",headers:["Content-Type: application/json"],body:`{ -======== -`),e.trim()}function aj(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 XF=Fn.create({name:"videoEmbed",group:"block",atom:!0,draggable:!0,addAttributes(){return{src:{default:null}}},parseHTML(){return[{tag:"div.rich-video-wrap",getAttrs:t=>{const e=t.querySelector("video"),n=e==null?void 0:e.getAttribute("src");return n?{src:n}:!1}},{tag:"video[src]",getAttrs:t=>({src:t.getAttribute("src")})}]},renderHTML({node:t}){const e=t.attrs.src||"";return["div",{class:"rich-video-wrap"},["video",{src:e,controls:!0,preload:"metadata"}],["div",{class:"rich-video-caption"},"视频(预览已缩小,保存后 C 端全宽播放)"]]}}),ZF=Fn.create({name:"linkTag",group:"inline",inline:!0,selectable:!0,atom:!0,addAttributes(){return{label:{default:""},url:{default:""},tagType:{default:"url",parseHTML:t=>t.getAttribute("data-tag-type")||"url"},tagId:{default:"",parseHTML:t=>t.getAttribute("data-tag-id")||""},pagePath:{default:"",parseHTML:t=>t.getAttribute("data-page-path")||""},appId:{default:"",parseHTML:t=>t.getAttribute("data-app-id")||""},mpKey:{default:"",parseHTML:t=>t.getAttribute("data-mp-key")||""}}},parseHTML(){return[{tag:'span[data-type="linkTag"]',getAttrs:t=>{var e;return{label:((e=t.textContent)==null?void 0:e.replace(/^#/,"").trim())||"",url:t.getAttribute("data-url")||"",tagType:t.getAttribute("data-tag-type")||"url",tagId:t.getAttribute("data-tag-id")||"",pagePath:t.getAttribute("data-page-path")||"",appId:t.getAttribute("data-app-id")||"",mpKey:t.getAttribute("data-mp-key")||""}}}]},renderHTML({node:t,HTMLAttributes:e}){return["span",Gt(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 ij(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}const eB=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)=>`
    - @${ij(o.name)} - ${ij(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 tB(t){var r;const e=[],n=(r=t.clipboardData)==null?void 0:r.items;if(!n)return e;for(let a=0;a{const h=y.useRef(null),f=y.useRef(null),m=y.useRef(null),g=y.useRef(null),[b,N]=y.useState(""),[j,v]=y.useState(!1),k=y.useRef(aj(t)),T=y.useCallback((se,$)=>{var I;const ie=g.current;if(!ie||!n)return!1;const le=tB($);if(le.length>0)return $.preventDefault(),(async()=>{for(const Y of le)try{const F=await n(Y);F&&ie.chain().focus().setImage({src:F}).run()}catch(F){console.error("粘贴图片上传失败",F)}})(),!0;const me=(I=$.clipboardData)==null?void 0:I.getData("text/html");if(me&&/data:image\/[^;"']+;base64,/i.test(me)){$.preventDefault();const{from:Y,to:F}=ie.state.selection;return(async()=>{try{const ge=await rB(me,n);ie.chain().focus().insertContentAt({from:Y,to:F},ge).run()}catch(ge){console.error("粘贴 HTML 内 base64 转换失败",ge)}})(),!0}return!1},[n]),C=W7({extensions:[Pz.configure({link:{openOnClick:!1,HTMLAttributes:{class:"rich-link"}}}),Oz.configure({inline:!0,allowBase64:!0,HTMLAttributes:{class:"rich-editor-img-thumb"}}),XF,Bz.configure({HTMLAttributes:{class:"mention-tag"},suggestion:eB(a)}),ZF,Vz.configure({placeholder:o}),H3.configure({resizable:!0}),V3,F3,B3],content:k.current,onUpdate:({editor:se})=>{e(se.getHTML())},editorProps:{attributes:{class:"rich-editor-content"},handlePaste:T}});y.useEffect(()=>{g.current=C??null},[C]),y.useImperativeHandle(u,()=>({getHTML:()=>(C==null?void 0:C.getHTML())||"",getMarkdown:()=>YF((C==null?void 0:C.getHTML())||"")})),y.useEffect(()=>{if(C&&t!==C.getHTML()){const se=aj(t);se!==C.getHTML()&&C.commands.setContent(se)}},[t]);const R=y.useCallback(async se=>{if(r)return r(se);if(n)return n(se);throw new Error("未配置上传")},[n,r]),O=y.useCallback(async se=>{var ie;const $=(ie=se.target.files)==null?void 0:ie[0];if(!(!$||!C)){if(n){const le=await n($);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($)}se.target.value=""}},[C,n]),U=y.useCallback(async se=>{var ie;const $=(ie=se.target.files)==null?void 0:ie[0];if(!(!$||!C)){try{const le=await R($);le&&C.chain().focus().insertContent({type:"videoEmbed",attrs:{src:le}}).run()}catch(le){console.error(le)}se.target.value=""}},[C,R]),P=y.useCallback(async se=>{var ie;const $=(ie=se.target.files)==null?void 0:ie[0];if(!(!$||!C)){try{const le=await R($);if(!le)return;const me=$.name||"附件";C.chain().focus().insertContent(`

    附件 ${JF(me)}

    `).run()}catch(le){console.error(le)}se.target.value=""}},[C,R]),z=y.useCallback(()=>{C&&C.chain().focus().insertContent("@").run()},[C]),L=y.useCallback(se=>{C&&C.chain().focus().insertContent([{type:"linkTag",attrs:{label:se.label,url:se.url||"",tagType:se.type||"url",tagId:se.id||"",pagePath:se.pagePath||"",appId:se.appId||"",mpKey:se.type==="miniprogram"&&se.appId||""}},{type:"text",text:" "}]).run()},[C]),Q=y.useCallback(()=>{!C||!b||(C.chain().focus().setLink({href:b}).run(),N(""),v(!1))},[C,b]);return C?s.jsxs("div",{className:`rich-editor-wrapper ${c||""}`,children:[s.jsxs("div",{className:"rich-editor-toolbar",children:[s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>C.chain().focus().toggleBold().run(),className:C.isActive("bold")?"is-active":"",type:"button",children:s.jsx(m5,{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(gM,{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(jA,{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(D5,{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(iM,{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(lM,{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(dM,{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(EM,{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(SM,{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(eA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().setHorizontalRule().run(),type:"button",children:s.jsx(zM,{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:U,className:"hidden"}),s.jsx("input",{ref:m,type:"file",onChange:P,className:"hidden"}),s.jsx("button",{onClick:()=>{var se;return(se=h.current)==null?void 0:se.click()},type:"button",title:"上传图片",children:s.jsx(tk,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>{var se;return(se=f.current)==null?void 0:se.click()},type:"button",title:"上传视频",disabled:!r&&!n,children:s.jsx($A,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>{var se;return(se=m.current)==null?void 0:se.click()},type:"button",title:"上传附件(生成下载链接)",disabled:!r&&!n,children:s.jsx(UM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:z,type:"button",title:"插入 @ 并选择人物",className:a.length?"mention-trigger-btn":"",disabled:a.length===0,children:s.jsx(h5,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>v(!j),className:C.isActive("link")?"is-active":"",type:"button",title:"链接",children:s.jsx(Hx,{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(SA,{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(PA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().redo().run(),disabled:!C.can().redo(),type:"button",children:s.jsx(nA,{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:se=>{const $=i.find(ie=>ie.id===se.target.value);$&&L($),se.target.value=""},defaultValue:"",children:[s.jsx("option",{value:"",disabled:!0,children:"# 插入链接标签"}),i.map(se=>s.jsx("option",{value:se.id,children:se.label},se.id))]})})]})]}),j&&s.jsxs("div",{className:"link-input-bar",children:[s.jsx("input",{type:"url",placeholder:"输入链接地址...",value:b,onChange:se=>N(se.target.value),onKeyDown:se=>se.key==="Enter"&&Q(),className:"link-input"}),s.jsx("button",{onClick:Q,className:"link-confirm",type:"button",children:"确定"}),s.jsx("button",{onClick:()=>{C.chain().focus().unsetLink().run(),v(!1)},className:"link-remove",type:"button",children:"移除"})]}),s.jsx(e3,{editor:C})]}):null});D0.displayName="RichEditor";const aB=["top","right","bottom","left"],Bo=Math.min,jr=Math.max,jp=Math.round,pf=Math.floor,Va=t=>({x:t,y:t}),iB={left:"right",right:"left",bottom:"top",top:"bottom"},oB={start:"end",end:"start"};function _0(t,e,n){return jr(t,Bo(e,n))}function Oi(t,e){return typeof t=="function"?t(e):t}function Di(t){return t.split("-")[0]}function fd(t){return t.split("-")[1]}function nb(t){return t==="x"?"y":"x"}function sb(t){return t==="y"?"height":"width"}const lB=new Set(["top","bottom"]);function Ba(t){return lB.has(Di(t))?"y":"x"}function rb(t){return nb(Ba(t))}function cB(t,e,n){n===void 0&&(n=!1);const r=fd(t),a=rb(t),i=sb(a);let o=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=kp(o)),[o,kp(o)]}function dB(t){const e=kp(t);return[$0(t),e,$0(e)]}function $0(t){return t.replace(/start|end/g,e=>oB[e])}const oj=["left","right"],lj=["right","left"],uB=["top","bottom"],hB=["bottom","top"];function fB(t,e,n){switch(t){case"top":case"bottom":return n?e?lj:oj:e?oj:lj;case"left":case"right":return e?uB:hB;default:return[]}}function pB(t,e,n,r){const a=fd(t);let i=fB(Di(t),n==="start",r);return a&&(i=i.map(o=>o+"-"+a),e&&(i=i.concat(i.map($0)))),i}function kp(t){return t.replace(/left|right|bottom|top/g,e=>iB[e])}function mB(t){return{top:0,right:0,bottom:0,left:0,...t}}function U3(t){return typeof t!="number"?mB(t):{top:t,right:t,bottom:t,left:t}}function Sp(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 cj(t,e,n){let{reference:r,floating:a}=t;const i=Ba(e),o=rb(e),c=sb(o),u=Di(e),h=i==="y",f=r.x+r.width/2-a.width/2,m=r.y+r.height/2-a.height/2,g=r[c]/2-a[c]/2;let b;switch(u){case"top":b={x:f,y:r.y-a.height};break;case"bottom":b={x:f,y:r.y+r.height};break;case"right":b={x:r.x+r.width,y:m};break;case"left":b={x:r.x-a.width,y:m};break;default:b={x:r.x,y:r.y}}switch(fd(e)){case"start":b[o]-=g*(n&&h?-1:1);break;case"end":b[o]+=g*(n&&h?-1:1);break}return b}async function gB(t,e){var n;e===void 0&&(e={});const{x:r,y:a,platform:i,rects:o,elements:c,strategy:u}=t,{boundary:h="clippingAncestors",rootBoundary:f="viewport",elementContext:m="floating",altBoundary:g=!1,padding:b=0}=Oi(e,t),N=U3(b),v=c[g?m==="floating"?"reference":"floating":m],k=Sp(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:h,rootBoundary:f,strategy:u})),T=m==="floating"?{x:r,y:a,width:o.floating.width,height:o.floating.height}:o.reference,C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),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},O=Sp(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:T,offsetParent:C,strategy:u}):T);return{top:(k.top-O.top+N.top)/R.y,bottom:(O.bottom-k.bottom+N.bottom)/R.y,left:(k.left-O.left+N.left)/R.x,right:(O.right-k.right+N.right)/R.x}}const xB=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}=cj(h,r,u),g=r,b={},N=0;for(let v=0;v({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:a,rects:i,platform:o,elements:c,middlewareData:u}=e,{element:h,padding:f=0}=Oi(t,e)||{};if(h==null)return{};const m=U3(f),g={x:n,y:r},b=rb(a),N=sb(b),j=await o.getDimensions(h),v=b==="y",k=v?"top":"left",T=v?"bottom":"right",C=v?"clientHeight":"clientWidth",R=i.reference[N]+i.reference[b]-g[b]-i.floating[N],O=g[b]-i.reference[b],U=await(o.getOffsetParent==null?void 0:o.getOffsetParent(h));let P=U?U[C]:0;(!P||!await(o.isElement==null?void 0:o.isElement(U)))&&(P=c.floating[C]||i.floating[N]);const z=R/2-O/2,L=P/2-j[N]/2-1,Q=Bo(m[k],L),se=Bo(m[T],L),$=Q,ie=P-j[N]-se,le=P/2-j[N]/2+z,me=_0($,le,ie),I=!u.arrow&&fd(a)!=null&&le!==me&&i.reference[N]/2-(le<$?Q:se)-j[N]/2<0,Y=I?le<$?le-$:le-ie:0;return{[b]:g[b]+Y,data:{[b]:me,centerOffset:le-me-Y,...I&&{alignmentOffset:Y}},reset:I}}}),bB=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:a,middlewareData:i,rects:o,initialPlacement:c,platform:u,elements:h}=e,{mainAxis:f=!0,crossAxis:m=!0,fallbackPlacements:g,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:N="none",flipAlignment:j=!0,...v}=Oi(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const k=Di(a),T=Ba(c),C=Di(c)===c,R=await(u.isRTL==null?void 0:u.isRTL(h.floating)),O=g||(C||!j?[kp(c)]:dB(c)),U=N!=="none";!g&&U&&O.push(...pB(c,j,N,R));const P=[c,...O],z=await u.detectOverflow(e,v),L=[];let Q=((r=i.flip)==null?void 0:r.overflows)||[];if(f&&L.push(z[k]),m){const le=cB(a,o,R);L.push(z[le[0]],z[le[1]])}if(Q=[...Q,{placement:a,overflows:L}],!L.every(le=>le<=0)){var se,$;const le=(((se=i.flip)==null?void 0:se.index)||0)+1,me=P[le];if(me&&(!(m==="alignment"?T!==Ba(me):!1)||Q.every(F=>Ba(F.placement)===T?F.overflows[0]>0:!0)))return{data:{index:le,overflows:Q},reset:{placement:me}};let I=($=Q.filter(Y=>Y.overflows[0]<=0).sort((Y,F)=>Y.overflows[1]-F.overflows[1])[0])==null?void 0:$.placement;if(!I)switch(b){case"bestFit":{var ie;const Y=(ie=Q.filter(F=>{if(U){const ge=Ba(F.placement);return ge===T||ge==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(ge=>ge>0).reduce((ge,X)=>ge+X,0)]).sort((F,ge)=>F[1]-ge[1])[0])==null?void 0:ie[0];Y&&(I=Y);break}case"initialPlacement":I=c;break}if(a!==I)return{reset:{placement:I}}}return{}}}};function dj(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function uj(t){return aB.some(e=>t[e]>=0)}const vB=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:a="referenceHidden",...i}=Oi(t,e);switch(a){case"referenceHidden":{const o=await r.detectOverflow(e,{...i,elementContext:"reference"}),c=dj(o,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:uj(c)}}}case"escaped":{const o=await r.detectOverflow(e,{...i,altBoundary:!0}),c=dj(o,n.floating);return{data:{escapedOffsets:c,escaped:uj(c)}}}default:return{}}}}},W3=new Set(["left","top"]);async function NB(t,e){const{placement:n,platform:r,elements:a}=t,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),o=Di(n),c=fd(n),u=Ba(n)==="y",h=W3.has(o)?-1:1,f=i&&u?-1:1,m=Oi(e,t);let{mainAxis:g,crossAxis:b,alignmentAxis:N}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof N=="number"&&(b=c==="end"?N*-1:N),u?{x:b*f,y:g*h}:{x:g*h,y:b*f}}const wB=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 NB(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}}}}},jB=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:a,platform:i}=e,{mainAxis:o=!0,crossAxis:c=!1,limiter:u={fn:k=>{let{x:T,y:C}=k;return{x:T,y:C}}},...h}=Oi(t,e),f={x:n,y:r},m=await i.detectOverflow(e,h),g=Ba(Di(a)),b=nb(g);let N=f[b],j=f[g];if(o){const k=b==="y"?"top":"left",T=b==="y"?"bottom":"right",C=N+m[k],R=N-m[T];N=_0(C,N,R)}if(c){const k=g==="y"?"top":"left",T=g==="y"?"bottom":"right",C=j+m[k],R=j-m[T];j=_0(C,j,R)}const v=u.fn({...e,[b]:N,[g]:j});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[b]:o,[g]:c}}}}}},kB=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}=Oi(t,e),f={x:n,y:r},m=Ba(a),g=nb(m);let b=f[g],N=f[m];const j=Oi(c,e),v=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(u){const C=g==="y"?"height":"width",R=i.reference[g]-i.floating[C]+v.mainAxis,O=i.reference[g]+i.reference[C]-v.mainAxis;bO&&(b=O)}if(h){var k,T;const C=g==="y"?"width":"height",R=W3.has(Di(a)),O=i.reference[m]-i.floating[C]+(R&&((k=o.offset)==null?void 0:k[m])||0)+(R?0:v.crossAxis),U=i.reference[m]+i.reference[C]+(R?0:((T=o.offset)==null?void 0:T[m])||0)-(R?v.crossAxis:0);NU&&(N=U)}return{[g]:b,[m]:N}}}},SB=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}=Oi(t,e),f=await o.detectOverflow(e,h),m=Di(a),g=fd(a),b=Ba(a)==="y",{width:N,height:j}=i.floating;let v,k;m==="top"||m==="bottom"?(v=m,k=g===(await(o.isRTL==null?void 0:o.isRTL(c.floating))?"start":"end")?"left":"right"):(k=m,v=g==="end"?"top":"bottom");const T=j-f.top-f.bottom,C=N-f.left-f.right,R=Bo(j-f[v],T),O=Bo(N-f[k],C),U=!e.middlewareData.shift;let P=R,z=O;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(z=C),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(P=T),U&&!g){const Q=jr(f.left,0),se=jr(f.right,0),$=jr(f.top,0),ie=jr(f.bottom,0);b?z=N-2*(Q!==0||se!==0?Q+se:jr(f.left,f.right)):P=j-2*($!==0||ie!==0?$+ie:jr(f.top,f.bottom))}await u({...e,availableWidth:z,availableHeight:P});const L=await o.getDimensions(c.floating);return N!==L.width||j!==L.height?{reset:{rects:!0}}:{}}}};function em(){return typeof window<"u"}function pd(t){return K3(t)?(t.nodeName||"").toLowerCase():"#document"}function Er(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Ga(t){var e;return(e=(K3(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function K3(t){return em()?t instanceof Node||t instanceof Er(t).Node:!1}function ga(t){return em()?t instanceof Element||t instanceof Er(t).Element:!1}function Wa(t){return em()?t instanceof HTMLElement||t instanceof Er(t).HTMLElement:!1}function hj(t){return!em()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Er(t).ShadowRoot}const CB=new Set(["inline","contents"]);function Wu(t){const{overflow:e,overflowX:n,overflowY:r,display:a}=xa(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!CB.has(a)}const EB=new Set(["table","td","th"]);function TB(t){return EB.has(pd(t))}const MB=[":popover-open",":modal"];function tm(t){return MB.some(e=>{try{return t.matches(e)}catch{return!1}})}const AB=["transform","translate","scale","rotate","perspective"],IB=["transform","translate","scale","rotate","perspective","filter"],PB=["paint","layout","strict","content"];function ab(t){const e=ib(),n=ga(t)?xa(t):t;return AB.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)||IB.some(r=>(n.willChange||"").includes(r))||PB.some(r=>(n.contain||"").includes(r))}function RB(t){let e=Vo(t);for(;Wa(e)&&!ad(e);){if(ab(e))return e;if(tm(e))return null;e=Vo(e)}return null}function ib(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const LB=new Set(["html","body","#document"]);function ad(t){return LB.has(pd(t))}function xa(t){return Er(t).getComputedStyle(t)}function nm(t){return ga(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Vo(t){if(pd(t)==="html")return t;const e=t.assignedSlot||t.parentNode||hj(t)&&t.host||Ga(t);return hj(e)?e.host:e}function q3(t){const e=Vo(t);return ad(e)?t.ownerDocument?t.ownerDocument.body:t.body:Wa(e)&&Wu(e)?e:q3(e)}function Du(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const a=q3(t),i=a===((r=t.ownerDocument)==null?void 0:r.body),o=Er(a);if(i){const c=z0(o);return e.concat(o,o.visualViewport||[],Wu(a)?a:[],c&&n?Du(c):[])}return e.concat(a,Du(a,[],n))}function z0(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function G3(t){const e=xa(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const a=Wa(t),i=a?t.offsetWidth:n,o=a?t.offsetHeight:r,c=jp(n)!==i||jp(r)!==o;return c&&(n=i,r=o),{width:n,height:r,$:c}}function ob(t){return ga(t)?t:t.contextElement}function Gc(t){const e=ob(t);if(!Wa(e))return Va(1);const n=e.getBoundingClientRect(),{width:r,height:a,$:i}=G3(e);let o=(i?jp(n.width):n.width)/r,c=(i?jp(n.height):n.height)/a;return(!o||!Number.isFinite(o))&&(o=1),(!c||!Number.isFinite(c))&&(c=1),{x:o,y:c}}const OB=Va(0);function J3(t){const e=Er(t);return!ib()||!e.visualViewport?OB:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function DB(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Er(t)?!1:e}function Yl(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const a=t.getBoundingClientRect(),i=ob(t);let o=Va(1);e&&(r?ga(r)&&(o=Gc(r)):o=Gc(t));const c=DB(i,n,r)?J3(i):Va(0);let u=(a.left+c.x)/o.x,h=(a.top+c.y)/o.y,f=a.width/o.x,m=a.height/o.y;if(i){const g=Er(i),b=r&&ga(r)?Er(r):r;let N=g,j=z0(N);for(;j&&r&&b!==N;){const v=Gc(j),k=j.getBoundingClientRect(),T=xa(j),C=k.left+(j.clientLeft+parseFloat(T.paddingLeft))*v.x,R=k.top+(j.clientTop+parseFloat(T.paddingTop))*v.y;u*=v.x,h*=v.y,f*=v.x,m*=v.y,u+=C,h+=R,N=Er(j),j=z0(N)}}return Sp({width:f,height:m,x:u,y:h})}function sm(t,e){const n=nm(t).scrollLeft;return e?e.left+n:Yl(Ga(t)).left+n}function Q3(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-sm(t,n),a=n.top+e.scrollTop;return{x:r,y:a}}function _B(t){let{elements:e,rect:n,offsetParent:r,strategy:a}=t;const i=a==="fixed",o=Ga(r),c=e?tm(e.floating):!1;if(r===o||c&&i)return n;let u={scrollLeft:0,scrollTop:0},h=Va(1);const f=Va(0),m=Wa(r);if((m||!m&&!i)&&((pd(r)!=="body"||Wu(o))&&(u=nm(r)),Wa(r))){const b=Yl(r);h=Gc(r),f.x=b.x+r.clientLeft,f.y=b.y+r.clientTop}const g=o&&!m&&!i?Q3(o,u):Va(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-u.scrollLeft*h.x+f.x+g.x,y:n.y*h.y-u.scrollTop*h.y+f.y+g.y}}function $B(t){return Array.from(t.getClientRects())}function zB(t){const e=Ga(t),n=nm(t),r=t.ownerDocument.body,a=jr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=jr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+sm(t);const c=-n.scrollTop;return xa(r).direction==="rtl"&&(o+=jr(e.clientWidth,r.clientWidth)-a),{width:a,height:i,x:o,y:c}}const fj=25;function FB(t,e){const n=Er(t),r=Ga(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=ib();(!f||f&&e==="fixed")&&(c=a.offsetLeft,u=a.offsetTop)}const h=sm(r);if(h<=0){const f=r.ownerDocument,m=f.body,g=getComputedStyle(m),b=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,N=Math.abs(r.clientWidth-m.clientWidth-b);N<=fj&&(i-=N)}else h<=fj&&(i+=h);return{width:i,height:o,x:c,y:u}}const BB=new Set(["absolute","fixed"]);function VB(t,e){const n=Yl(t,!0,e==="fixed"),r=n.top+t.clientTop,a=n.left+t.clientLeft,i=Wa(t)?Gc(t):Va(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 pj(t,e,n){let r;if(e==="viewport")r=FB(t,n);else if(e==="document")r=zB(Ga(t));else if(ga(e))r=VB(e,n);else{const a=J3(t);r={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return Sp(r)}function Y3(t,e){const n=Vo(t);return n===e||!ga(n)||ad(n)?!1:xa(n).position==="fixed"||Y3(n,e)}function HB(t,e){const n=e.get(t);if(n)return n;let r=Du(t,[],!1).filter(c=>ga(c)&&pd(c)!=="body"),a=null;const i=xa(t).position==="fixed";let o=i?Vo(t):t;for(;ga(o)&&!ad(o);){const c=xa(o),u=ab(o);!u&&c.position==="fixed"&&(a=null),(i?!u&&!a:!u&&c.position==="static"&&!!a&&BB.has(a.position)||Wu(o)&&!u&&Y3(t,o))?r=r.filter(f=>f!==o):a=c,o=Vo(o)}return e.set(t,r),r}function UB(t){let{element:e,boundary:n,rootBoundary:r,strategy:a}=t;const o=[...n==="clippingAncestors"?tm(e)?[]:HB(e,this._c):[].concat(n),r],c=o[0],u=o.reduce((h,f)=>{const m=pj(e,f,a);return h.top=jr(m.top,h.top),h.right=Bo(m.right,h.right),h.bottom=Bo(m.bottom,h.bottom),h.left=jr(m.left,h.left),h},pj(e,c,a));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function WB(t){const{width:e,height:n}=G3(t);return{width:e,height:n}}function KB(t,e,n){const r=Wa(e),a=Ga(e),i=n==="fixed",o=Yl(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const u=Va(0);function h(){u.x=sm(a)}if(r||!r&&!i)if((pd(e)!=="body"||Wu(a))&&(c=nm(e)),r){const b=Yl(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?Q3(a,c):Va(0),m=o.left+c.scrollLeft-u.x-f.x,g=o.top+c.scrollTop-u.y-f.y;return{x:m,y:g,width:o.width,height:o.height}}function Tx(t){return xa(t).position==="static"}function mj(t,e){if(!Wa(t)||xa(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Ga(t)===n&&(n=n.ownerDocument.body),n}function X3(t,e){const n=Er(t);if(tm(t))return n;if(!Wa(t)){let a=Vo(t);for(;a&&!ad(a);){if(ga(a)&&!Tx(a))return a;a=Vo(a)}return n}let r=mj(t,e);for(;r&&TB(r)&&Tx(r);)r=mj(r,e);return r&&ad(r)&&Tx(r)&&!ab(r)?n:r||RB(t)||n}const qB=async function(t){const e=this.getOffsetParent||X3,n=this.getDimensions,r=await n(t.floating);return{reference:KB(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function GB(t){return xa(t).direction==="rtl"}const JB={convertOffsetParentRelativeRectToViewportRelativeRect:_B,getDocumentElement:Ga,getClippingRect:UB,getOffsetParent:X3,getElementRects:qB,getClientRects:$B,getDimensions:WB,getScale:Gc,isElement:ga,isRTL:GB};function Z3(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function QB(t,e){let n=null,r;const a=Ga(t);function i(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function o(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),i();const h=t.getBoundingClientRect(),{left:f,top:m,width:g,height:b}=h;if(c||e(),!g||!b)return;const N=pf(m),j=pf(a.clientWidth-(f+g)),v=pf(a.clientHeight-(m+b)),k=pf(f),C={rootMargin:-N+"px "+-j+"px "+-v+"px "+-k+"px",threshold:jr(0,Bo(1,u))||1};let R=!0;function O(U){const P=U[0].intersectionRatio;if(P!==u){if(!R)return o();P?o(!1,P):r=setTimeout(()=>{o(!1,1e-7)},1e3)}P===1&&!Z3(h,t.getBoundingClientRect())&&o(),R=!1}try{n=new IntersectionObserver(O,{...C,root:a.ownerDocument})}catch{n=new IntersectionObserver(O,C)}n.observe(t)}return o(!0),i}function YB(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=ob(t),f=a||i?[...h?Du(h):[],...Du(e)]:[];f.forEach(k=>{a&&k.addEventListener("scroll",n,{passive:!0}),i&&k.addEventListener("resize",n)});const m=h&&c?QB(h,n):null;let g=-1,b=null;o&&(b=new ResizeObserver(k=>{let[T]=k;T&&T.target===h&&b&&(b.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var C;(C=b)==null||C.observe(e)})),n()}),h&&!u&&b.observe(h),b.observe(e));let N,j=u?Yl(t):null;u&&v();function v(){const k=Yl(t);j&&!Z3(j,k)&&n(),j=k,N=requestAnimationFrame(v)}return n(),()=>{var k;f.forEach(T=>{a&&T.removeEventListener("scroll",n),i&&T.removeEventListener("resize",n)}),m==null||m(),(k=b)==null||k.disconnect(),b=null,u&&cancelAnimationFrame(N)}}const XB=wB,ZB=jB,e9=bB,t9=SB,n9=vB,gj=yB,s9=kB,r9=(t,e,n)=>{const r=new Map,a={platform:JB,...n},i={...a.platform,_c:r};return xB(t,e,{...a,platform:i})};var a9=typeof document<"u",i9=function(){},kf=a9?y.useLayoutEffect:i9;function Cp(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(!Cp(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)&&!Cp(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function e4(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function xj(t,e){const n=e4(t);return Math.round(e*n)/n}function Mx(t){const e=y.useRef(t);return kf(()=>{e.current=t}),e}function o9(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:i,floating:o}={},transform:c=!0,whileElementsMounted:u,open:h}=t,[f,m]=y.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[g,b]=y.useState(r);Cp(g,r)||b(r);const[N,j]=y.useState(null),[v,k]=y.useState(null),T=y.useCallback(F=>{F!==U.current&&(U.current=F,j(F))},[]),C=y.useCallback(F=>{F!==P.current&&(P.current=F,k(F))},[]),R=i||N,O=o||v,U=y.useRef(null),P=y.useRef(null),z=y.useRef(f),L=u!=null,Q=Mx(u),se=Mx(a),$=Mx(h),ie=y.useCallback(()=>{if(!U.current||!P.current)return;const F={placement:e,strategy:n,middleware:g};se.current&&(F.platform=se.current),r9(U.current,P.current,F).then(ge=>{const X={...ge,isPositioned:$.current!==!1};le.current&&!Cp(z.current,X)&&(z.current=X,id.flushSync(()=>{m(X)}))})},[g,e,n,se,$]);kf(()=>{h===!1&&z.current.isPositioned&&(z.current.isPositioned=!1,m(F=>({...F,isPositioned:!1})))},[h]);const le=y.useRef(!1);kf(()=>(le.current=!0,()=>{le.current=!1}),[]),kf(()=>{if(R&&(U.current=R),O&&(P.current=O),R&&O){if(Q.current)return Q.current(R,O,ie);ie()}},[R,O,ie,Q,L]);const me=y.useMemo(()=>({reference:U,floating:P,setReference:T,setFloating:C}),[T,C]),I=y.useMemo(()=>({reference:R,floating:O}),[R,O]),Y=y.useMemo(()=>{const F={position:n,left:0,top:0};if(!I.floating)return F;const ge=xj(I.floating,f.x),X=xj(I.floating,f.y);return c?{...F,transform:"translate("+ge+"px, "+X+"px)",...e4(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ge,top:X}},[n,c,I.floating,f.x,f.y]);return y.useMemo(()=>({...f,update:ie,refs:me,elements:I,floatingStyles:Y}),[f,ie,me,I,Y])}const l9=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?gj({element:r.current,padding:a}).fn(n):{}:r?gj({element:r,padding:a}).fn(n):{}}}},c9=(t,e)=>({...XB(t),options:[t,e]}),d9=(t,e)=>({...ZB(t),options:[t,e]}),u9=(t,e)=>({...s9(t),options:[t,e]}),h9=(t,e)=>({...e9(t),options:[t,e]}),f9=(t,e)=>({...t9(t),options:[t,e]}),p9=(t,e)=>({...n9(t),options:[t,e]}),m9=(t,e)=>({...l9(t),options:[t,e]});var g9="Arrow",t4=y.forwardRef((t,e)=>{const{children:n,width:r=10,height:a=5,...i}=t;return s.jsx(Mt.svg,{...i,ref:e,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});t4.displayName=g9;var x9=t4,lb="Popper",[n4,s4]=Wo(lb),[y9,r4]=n4(lb),a4=t=>{const{__scopePopper:e,children:n}=t,[r,a]=y.useState(null);return s.jsx(y9,{scope:e,anchor:r,onAnchorChange:a,children:n})};a4.displayName=lb;var i4="PopperAnchor",o4=y.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...a}=t,i=r4(i4,n),o=y.useRef(null),c=Jt(e,o),u=y.useRef(null);return y.useEffect(()=>{const h=u.current;u.current=(r==null?void 0:r.current)||o.current,h!==u.current&&i.onAnchorChange(u.current)}),r?null:s.jsx(Mt.div,{...a,ref:c})});o4.displayName=i4;var cb="PopperContent",[b9,v9]=n4(cb),l4=y.forwardRef((t,e)=>{var q,_,Z,re,we,Fe;const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:i="center",alignOffset:o=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:h=[],collisionPadding:f=0,sticky:m="partial",hideWhenDetached:g=!1,updatePositionStrategy:b="optimized",onPlaced:N,...j}=t,v=r4(cb,n),[k,T]=y.useState(null),C=Jt(e,Ue=>T(Ue)),[R,O]=y.useState(null),U=dy(R),P=(U==null?void 0:U.width)??0,z=(U==null?void 0:U.height)??0,L=r+(i!=="center"?"-"+i:""),Q=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},se=Array.isArray(h)?h:[h],$=se.length>0,ie={padding:Q,boundary:se.filter(w9),altBoundary:$},{refs:le,floatingStyles:me,placement:I,isPositioned:Y,middlewareData:F}=o9({strategy:"fixed",placement:L,whileElementsMounted:(...Ue)=>YB(...Ue,{animationFrame:b==="always"}),elements:{reference:v.anchor},middleware:[c9({mainAxis:a+z,alignmentAxis:o}),u&&d9({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?u9():void 0,...ie}),u&&h9({...ie}),f9({...ie,apply:({elements:Ue,rects:jt,availableWidth:Nn,availableHeight:pt})=>{const{width:It,height:hn}=jt.reference,Bn=Ue.floating.style;Bn.setProperty("--radix-popper-available-width",`${Nn}px`),Bn.setProperty("--radix-popper-available-height",`${pt}px`),Bn.setProperty("--radix-popper-anchor-width",`${It}px`),Bn.setProperty("--radix-popper-anchor-height",`${hn}px`)}}),R&&m9({element:R,padding:c}),j9({arrowWidth:P,arrowHeight:z}),g&&p9({strategy:"referenceHidden",...ie})]}),[ge,X]=u4(I),B=$o(N);Ps(()=>{Y&&(B==null||B())},[Y,B]);const W=(q=F.arrow)==null?void 0:q.x,fe=(_=F.arrow)==null?void 0:_.y,he=((Z=F.arrow)==null?void 0:Z.centerOffset)!==0,[de,D]=y.useState();return Ps(()=>{k&&D(window.getComputedStyle(k).zIndex)},[k]),s.jsx("div",{ref:le.setFloating,"data-radix-popper-content-wrapper":"",style:{...me,transform:Y?me.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:de,"--radix-popper-transform-origin":[(re=F.transformOrigin)==null?void 0:re.x,(we=F.transformOrigin)==null?void 0:we.y].join(" "),...((Fe=F.hide)==null?void 0:Fe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:s.jsx(b9,{scope:n,placedSide:ge,onArrowChange:O,arrowX:W,arrowY:fe,shouldHideArrow:he,children:s.jsx(Mt.div,{"data-side":ge,"data-align":X,...j,ref:C,style:{...j.style,animation:Y?void 0:"none"}})})})});l4.displayName=cb;var c4="PopperArrow",N9={top:"bottom",right:"left",bottom:"top",left:"right"},d4=y.forwardRef(function(e,n){const{__scopePopper:r,...a}=e,i=v9(c4,r),o=N9[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(x9,{...a,ref:n,style:{...a.style,display:"block"}})})});d4.displayName=c4;function w9(t){return t!==null}var j9=t=>({name:"transformOrigin",options:t,fn(e){var v,k,T;const{placement:n,rects:r,middlewareData:a}=e,o=((v=a.arrow)==null?void 0:v.centerOffset)!==0,c=o?0:t.arrowWidth,u=o?0:t.arrowHeight,[h,f]=u4(n),m={start:"0%",center:"50%",end:"100%"}[f],g=(((k=a.arrow)==null?void 0:k.x)??0)+c/2,b=(((T=a.arrow)==null?void 0:T.y)??0)+u/2;let N="",j="";return h==="bottom"?(N=o?m:`${g}px`,j=`${-u}px`):h==="top"?(N=o?m:`${g}px`,j=`${r.floating.height+u}px`):h==="right"?(N=`${-u}px`,j=o?m:`${b}px`):h==="left"&&(N=`${r.floating.width+u}px`,j=o?m:`${b}px`),{data:{x:N,y:j}}}});function u4(t){const[e,n="center"]=t.split("-");return[e,n]}var k9=a4,S9=o4,C9=l4,E9=d4,h4=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"}),T9="VisuallyHidden",M9=y.forwardRef((t,e)=>s.jsx(Mt.span,{...t,ref:e,style:{...h4,...t.style}}));M9.displayName=T9;var A9=[" ","Enter","ArrowUp","ArrowDown"],I9=[" ","Enter"],Xl="Select",[rm,am,P9]=oy(Xl),[md]=Wo(Xl,[P9,s4]),im=s4(),[R9,Jo]=md(Xl),[L9,O9]=md(Xl),f4=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:a,onOpenChange:i,value:o,defaultValue:c,onValueChange:u,dir:h,name:f,autoComplete:m,disabled:g,required:b,form:N}=t,j=im(e),[v,k]=y.useState(null),[T,C]=y.useState(null),[R,O]=y.useState(!1),U=Lp(h),[P,z]=Fl({prop:r,defaultProp:a??!1,onChange:i,caller:Xl}),[L,Q]=Fl({prop:o,defaultProp:c,onChange:u,caller:Xl}),se=y.useRef(null),$=v?N||!!v.closest("form"):!0,[ie,le]=y.useState(new Set),me=Array.from(ie).map(I=>I.props.value).join(";");return s.jsx(k9,{...j,children:s.jsxs(R9,{required:b,scope:e,trigger:v,onTriggerChange:k,valueNode:T,onValueNodeChange:C,valueNodeHasChildren:R,onValueNodeHasChildrenChange:O,contentId:Io(),value:L,onValueChange:Q,open:P,onOpenChange:z,dir:U,triggerPointerDownPosRef:se,disabled:g,children:[s.jsx(rm.Provider,{scope:e,children:s.jsx(L9,{scope:t.__scopeSelect,onNativeOptionAdd:y.useCallback(I=>{le(Y=>new Set(Y).add(I))},[]),onNativeOptionRemove:y.useCallback(I=>{le(Y=>{const F=new Set(Y);return F.delete(I),F})},[]),children:n})}),$?s.jsxs(O4,{"aria-hidden":!0,required:b,tabIndex:-1,name:f,autoComplete:m,value:L,onChange:I=>Q(I.target.value),disabled:g,form:N,children:[L===void 0?s.jsx("option",{value:""}):null,Array.from(ie)]},me):null]})})};f4.displayName=Xl;var p4="SelectTrigger",m4=y.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...a}=t,i=im(n),o=Jo(p4,n),c=o.disabled||r,u=Jt(e,o.onTriggerChange),h=am(n),f=y.useRef("touch"),[m,g,b]=_4(j=>{const v=h().filter(C=>!C.disabled),k=v.find(C=>C.value===o.value),T=$4(v,j,k);T!==void 0&&o.onValueChange(T.value)}),N=j=>{c||(o.onOpenChange(!0),b()),j&&(o.triggerPointerDownPosRef.current={x:Math.round(j.pageX),y:Math.round(j.pageY)})};return s.jsx(S9,{asChild:!0,...i,children:s.jsx(Mt.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":D4(o.value)?"":void 0,...a,ref:u,onClick:St(a.onClick,j=>{j.currentTarget.focus(),f.current!=="mouse"&&N(j)}),onPointerDown:St(a.onPointerDown,j=>{f.current=j.pointerType;const v=j.target;v.hasPointerCapture(j.pointerId)&&v.releasePointerCapture(j.pointerId),j.button===0&&j.ctrlKey===!1&&j.pointerType==="mouse"&&(N(j),j.preventDefault())}),onKeyDown:St(a.onKeyDown,j=>{const v=m.current!=="";!(j.ctrlKey||j.altKey||j.metaKey)&&j.key.length===1&&g(j.key),!(v&&j.key===" ")&&A9.includes(j.key)&&(N(),j.preventDefault())})})})});m4.displayName=p4;var g4="SelectValue",x4=y.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,children:i,placeholder:o="",...c}=t,u=Jo(g4,n),{onValueNodeHasChildrenChange:h}=u,f=i!==void 0,m=Jt(e,u.onValueNodeChange);return Ps(()=>{h(f)},[h,f]),s.jsx(Mt.span,{...c,ref:m,style:{pointerEvents:"none"},children:D4(u.value)?s.jsx(s.Fragment,{children:o}):i})});x4.displayName=g4;var D9="SelectIcon",y4=y.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...a}=t;return s.jsx(Mt.span,{"aria-hidden":!0,...a,ref:e,children:r||"▼"})});y4.displayName=D9;var _9="SelectPortal",b4=t=>s.jsx(ny,{asChild:!0,...t});b4.displayName=_9;var Zl="SelectContent",v4=y.forwardRef((t,e)=>{const n=Jo(Zl,t.__scopeSelect),[r,a]=y.useState();if(Ps(()=>{a(new DocumentFragment)},[]),!n.open){const i=r;return i?id.createPortal(s.jsx(N4,{scope:t.__scopeSelect,children:s.jsx(rm.Slot,{scope:t.__scopeSelect,children:s.jsx("div",{children:t.children})})}),i):null}return s.jsx(w4,{...t,ref:e})});v4.displayName=Zl;var da=10,[N4,Qo]=md(Zl),$9="SelectContentImpl",z9=ju("SelectContent.RemoveScroll"),w4=y.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:o,side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:b,sticky:N,hideWhenDetached:j,avoidCollisions:v,...k}=t,T=Jo(Zl,n),[C,R]=y.useState(null),[O,U]=y.useState(null),P=Jt(e,q=>R(q)),[z,L]=y.useState(null),[Q,se]=y.useState(null),$=am(n),[ie,le]=y.useState(!1),me=y.useRef(!1);y.useEffect(()=>{if(C)return Ok(C)},[C]),Ck();const I=y.useCallback(q=>{const[_,...Z]=$().map(Fe=>Fe.ref.current),[re]=Z.slice(-1),we=document.activeElement;for(const Fe of q)if(Fe===we||(Fe==null||Fe.scrollIntoView({block:"nearest"}),Fe===_&&O&&(O.scrollTop=0),Fe===re&&O&&(O.scrollTop=O.scrollHeight),Fe==null||Fe.focus(),document.activeElement!==we))return},[$,O]),Y=y.useCallback(()=>I([z,C]),[I,z,C]);y.useEffect(()=>{ie&&Y()},[ie,Y]);const{onOpenChange:F,triggerPointerDownPosRef:ge}=T;y.useEffect(()=>{if(C){let q={x:0,y:0};const _=re=>{var we,Fe;q={x:Math.abs(Math.round(re.pageX)-(((we=ge.current)==null?void 0:we.x)??0)),y:Math.abs(Math.round(re.pageY)-(((Fe=ge.current)==null?void 0:Fe.y)??0))}},Z=re=>{q.x<=10&&q.y<=10?re.preventDefault():C.contains(re.target)||F(!1),document.removeEventListener("pointermove",_),ge.current=null};return ge.current!==null&&(document.addEventListener("pointermove",_),document.addEventListener("pointerup",Z,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",_),document.removeEventListener("pointerup",Z,{capture:!0})}}},[C,F,ge]),y.useEffect(()=>{const q=()=>F(!1);return window.addEventListener("blur",q),window.addEventListener("resize",q),()=>{window.removeEventListener("blur",q),window.removeEventListener("resize",q)}},[F]);const[X,B]=_4(q=>{const _=$().filter(we=>!we.disabled),Z=_.find(we=>we.ref.current===document.activeElement),re=$4(_,q,Z);re&&setTimeout(()=>re.ref.current.focus())}),W=y.useCallback((q,_,Z)=>{const re=!me.current&&!Z;(T.value!==void 0&&T.value===_||re)&&(L(q),re&&(me.current=!0))},[T.value]),fe=y.useCallback(()=>C==null?void 0:C.focus(),[C]),he=y.useCallback((q,_,Z)=>{const re=!me.current&&!Z;(T.value!==void 0&&T.value===_||re)&&se(q)},[T.value]),de=r==="popper"?F0:j4,D=de===F0?{side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:b,sticky:N,hideWhenDetached:j,avoidCollisions:v}:{};return s.jsx(N4,{scope:n,content:C,viewport:O,onViewportChange:U,itemRefCallback:W,selectedItem:z,onItemLeave:fe,itemTextRefCallback:he,focusSelectedItem:Y,selectedItemText:Q,position:r,isPositioned:ie,searchRef:X,children:s.jsx(sy,{as:z9,allowPinchZoom:!0,children:s.jsx(ty,{asChild:!0,trapped:T.open,onMountAutoFocus:q=>{q.preventDefault()},onUnmountAutoFocus:St(a,q=>{var _;(_=T.trigger)==null||_.focus({preventScroll:!0}),q.preventDefault()}),children:s.jsx(ey,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:q=>q.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:s.jsx(de,{role:"listbox",id:T.contentId,"data-state":T.open?"open":"closed",dir:T.dir,onContextMenu:q=>q.preventDefault(),...k,...D,onPlaced:()=>le(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:St(k.onKeyDown,q=>{const _=q.ctrlKey||q.altKey||q.metaKey;if(q.key==="Tab"&&q.preventDefault(),!_&&q.key.length===1&&B(q.key),["ArrowUp","ArrowDown","Home","End"].includes(q.key)){let re=$().filter(we=>!we.disabled).map(we=>we.ref.current);if(["ArrowUp","End"].includes(q.key)&&(re=re.slice().reverse()),["ArrowUp","ArrowDown"].includes(q.key)){const we=q.target,Fe=re.indexOf(we);re=re.slice(Fe+1)}setTimeout(()=>I(re)),q.preventDefault()}})})})})})})});w4.displayName=$9;var F9="SelectItemAlignedPosition",j4=y.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...a}=t,i=Jo(Zl,n),o=Qo(Zl,n),[c,u]=y.useState(null),[h,f]=y.useState(null),m=Jt(e,P=>f(P)),g=am(n),b=y.useRef(!1),N=y.useRef(!0),{viewport:j,selectedItem:v,selectedItemText:k,focusSelectedItem:T}=o,C=y.useCallback(()=>{if(i.trigger&&i.valueNode&&c&&h&&j&&v&&k){const P=i.trigger.getBoundingClientRect(),z=h.getBoundingClientRect(),L=i.valueNode.getBoundingClientRect(),Q=k.getBoundingClientRect();if(i.dir!=="rtl"){const we=Q.left-z.left,Fe=L.left-we,Ue=P.left-Fe,jt=P.width+Ue,Nn=Math.max(jt,z.width),pt=window.innerWidth-da,It=Rf(Fe,[da,Math.max(da,pt-Nn)]);c.style.minWidth=jt+"px",c.style.left=It+"px"}else{const we=z.right-Q.right,Fe=window.innerWidth-L.right-we,Ue=window.innerWidth-P.right-Fe,jt=P.width+Ue,Nn=Math.max(jt,z.width),pt=window.innerWidth-da,It=Rf(Fe,[da,Math.max(da,pt-Nn)]);c.style.minWidth=jt+"px",c.style.right=It+"px"}const se=g(),$=window.innerHeight-da*2,ie=j.scrollHeight,le=window.getComputedStyle(h),me=parseInt(le.borderTopWidth,10),I=parseInt(le.paddingTop,10),Y=parseInt(le.borderBottomWidth,10),F=parseInt(le.paddingBottom,10),ge=me+I+ie+F+Y,X=Math.min(v.offsetHeight*5,ge),B=window.getComputedStyle(j),W=parseInt(B.paddingTop,10),fe=parseInt(B.paddingBottom,10),he=P.top+P.height/2-da,de=$-he,D=v.offsetHeight/2,q=v.offsetTop+D,_=me+I+q,Z=ge-_;if(_<=he){const we=se.length>0&&v===se[se.length-1].ref.current;c.style.bottom="0px";const Fe=h.clientHeight-j.offsetTop-j.offsetHeight,Ue=Math.max(de,D+(we?fe:0)+Fe+Y),jt=_+Ue;c.style.height=jt+"px"}else{const we=se.length>0&&v===se[0].ref.current;c.style.top="0px";const Ue=Math.max(he,me+j.offsetTop+(we?W:0)+D)+Z;c.style.height=Ue+"px",j.scrollTop=_-he+j.offsetTop}c.style.margin=`${da}px 0`,c.style.minHeight=X+"px",c.style.maxHeight=$+"px",r==null||r(),requestAnimationFrame(()=>b.current=!0)}},[g,i.trigger,i.valueNode,c,h,j,v,k,i.dir,r]);Ps(()=>C(),[C]);const[R,O]=y.useState();Ps(()=>{h&&O(window.getComputedStyle(h).zIndex)},[h]);const U=y.useCallback(P=>{P&&N.current===!0&&(C(),T==null||T(),N.current=!1)},[C,T]);return s.jsx(V9,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:b,onScrollButtonChange:U,children:s.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:R},children:s.jsx(Mt.div,{...a,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});j4.displayName=F9;var B9="SelectPopperPosition",F0=y.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=da,...i}=t,o=im(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)"}})});F0.displayName=B9;var[V9,db]=md(Zl,{}),B0="SelectViewport",k4=y.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...a}=t,i=Qo(B0,n),o=db(B0,n),c=Jt(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(rm.Slot,{scope:n,children:s.jsx(Mt.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:St(a.onScroll,h=>{const f=h.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:g}=o;if(g!=null&&g.current&&m){const b=Math.abs(u.current-f.scrollTop);if(b>0){const N=window.innerHeight-da*2,j=parseFloat(m.style.minHeight),v=parseFloat(m.style.height),k=Math.max(j,v);if(k0?R:0,m.style.justifyContent="flex-end")}}}u.current=f.scrollTop})})})]})});k4.displayName=B0;var S4="SelectGroup",[H9,U9]=md(S4),W9=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=Io();return s.jsx(H9,{scope:n,id:a,children:s.jsx(Mt.div,{role:"group","aria-labelledby":a,...r,ref:e})})});W9.displayName=S4;var C4="SelectLabel",K9=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=U9(C4,n);return s.jsx(Mt.div,{id:a.id,...r,ref:e})});K9.displayName=C4;var Ep="SelectItem",[q9,E4]=md(Ep),T4=y.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:i,...o}=t,c=Jo(Ep,n),u=Qo(Ep,n),h=c.value===r,[f,m]=y.useState(i??""),[g,b]=y.useState(!1),N=Jt(e,T=>{var C;return(C=u.itemRefCallback)==null?void 0:C.call(u,T,r,a)}),j=Io(),v=y.useRef("touch"),k=()=>{a||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return s.jsx(q9,{scope:n,value:r,disabled:a,textId:j,isSelected:h,onItemTextChange:y.useCallback(T=>{m(C=>C||((T==null?void 0:T.textContent)??"").trim())},[]),children:s.jsx(rm.ItemSlot,{scope:n,value:r,disabled:a,textValue:f,children:s.jsx(Mt.div,{role:"option","aria-labelledby":j,"data-highlighted":g?"":void 0,"aria-selected":h&&g,"data-state":h?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...o,ref:N,onFocus:St(o.onFocus,()=>b(!0)),onBlur:St(o.onBlur,()=>b(!1)),onClick:St(o.onClick,()=>{v.current!=="mouse"&&k()}),onPointerUp:St(o.onPointerUp,()=>{v.current==="mouse"&&k()}),onPointerDown:St(o.onPointerDown,T=>{v.current=T.pointerType}),onPointerMove:St(o.onPointerMove,T=>{var C;v.current=T.pointerType,a?(C=u.onItemLeave)==null||C.call(u):v.current==="mouse"&&T.currentTarget.focus({preventScroll:!0})}),onPointerLeave:St(o.onPointerLeave,T=>{var C;T.currentTarget===document.activeElement&&((C=u.onItemLeave)==null||C.call(u))}),onKeyDown:St(o.onKeyDown,T=>{var R;((R=u.searchRef)==null?void 0:R.current)!==""&&T.key===" "||(I9.includes(T.key)&&k(),T.key===" "&&T.preventDefault())})})})})});T4.displayName=Ep;var iu="SelectItemText",M4=y.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,...i}=t,o=Jo(iu,n),c=Qo(iu,n),u=E4(iu,n),h=O9(iu,n),[f,m]=y.useState(null),g=Jt(e,k=>m(k),u.onItemTextChange,k=>{var T;return(T=c.itemTextRefCallback)==null?void 0:T.call(c,k,u.value,u.disabled)}),b=f==null?void 0:f.textContent,N=y.useMemo(()=>s.jsx("option",{value:u.value,disabled:u.disabled,children:b},u.value),[u.disabled,u.value,b]),{onNativeOptionAdd:j,onNativeOptionRemove:v}=h;return Ps(()=>(j(N),()=>v(N)),[j,v,N]),s.jsxs(s.Fragment,{children:[s.jsx(Mt.span,{id:u.textId,...i,ref:g}),u.isSelected&&o.valueNode&&!o.valueNodeHasChildren?id.createPortal(i.children,o.valueNode):null]})});M4.displayName=iu;var A4="SelectItemIndicator",I4=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return E4(A4,n).isSelected?s.jsx(Mt.span,{"aria-hidden":!0,...r,ref:e}):null});I4.displayName=A4;var V0="SelectScrollUpButton",P4=y.forwardRef((t,e)=>{const n=Qo(V0,t.__scopeSelect),r=db(V0,t.__scopeSelect),[a,i]=y.useState(!1),o=Jt(e,r.onScrollButtonChange);return Ps(()=>{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(L4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});P4.displayName=V0;var H0="SelectScrollDownButton",R4=y.forwardRef((t,e)=>{const n=Qo(H0,t.__scopeSelect),r=db(H0,t.__scopeSelect),[a,i]=y.useState(!1),o=Jt(e,r.onScrollButtonChange);return Ps(()=>{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(L4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});R4.displayName=H0;var L4=y.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=t,i=Qo("SelectScrollButton",n),o=y.useRef(null),c=am(n),u=y.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return y.useEffect(()=>()=>u(),[u]),Ps(()=>{var f;const h=c().find(m=>m.ref.current===document.activeElement);(f=h==null?void 0:h.ref.current)==null||f.scrollIntoView({block:"nearest"})},[c]),s.jsx(Mt.div,{"aria-hidden":!0,...a,ref:e,style:{flexShrink:0,...a.style},onPointerDown:St(a.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:St(a.onPointerMove,()=>{var h;(h=i.onItemLeave)==null||h.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:St(a.onPointerLeave,()=>{u()})})}),G9="SelectSeparator",J9=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return s.jsx(Mt.div,{"aria-hidden":!0,...r,ref:e})});J9.displayName=G9;var U0="SelectArrow",Q9=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=im(n),i=Jo(U0,n),o=Qo(U0,n);return i.open&&o.position==="popper"?s.jsx(E9,{...a,...r,ref:e}):null});Q9.displayName=U0;var Y9="SelectBubbleInput",O4=y.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const a=y.useRef(null),i=Jt(r,a),o=cy(e);return y.useEffect(()=>{const c=a.current;if(!c)return;const u=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(u,"value").set;if(o!==e&&f){const m=new Event("change",{bubbles:!0});f.call(c,e),c.dispatchEvent(m)}},[o,e]),s.jsx(Mt.select,{...n,style:{...h4,...n.style},ref:i,defaultValue:e})});O4.displayName=Y9;function D4(t){return t===""||t===void 0}function _4(t){const e=$o(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 $4(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=X9(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 X9(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var Z9=f4,z4=m4,eV=x4,tV=y4,nV=b4,F4=v4,sV=k4,B4=T4,rV=M4,aV=I4,iV=P4,oV=R4;const wo=Z9,jo=eV,Ei=y.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(z4,{ref:r,className:zt("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(tV,{asChild:!0,children:s.jsx(_l,{className:"h-4 w-4 opacity-50"})})]}));Ei.displayName=z4.displayName;const Ti=y.forwardRef(({className:t,children:e,position:n="popper",...r},a)=>s.jsx(nV,{children:s.jsxs(F4,{ref:a,className:zt("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(iV,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx($x,{className:"h-4 w-4"})}),s.jsx(sV,{className:"p-1",children:e}),s.jsx(oV,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(_l,{className:"h-4 w-4"})})]})}));Ti.displayName=F4.displayName;const cs=y.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(B4,{ref:r,className:zt("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(aV,{children:s.jsx(Ap,{className:"h-4 w-4"})})}),s.jsx(rV,{children:e})]}));cs.displayName=B4.displayName;const yj=["📖","📕","📗","📘","📙","📓","📔","📒","📚","📖"];function lV(t){return t.title==="序言"||t.title.includes("序言")}function bj(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 Ax(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 cV({parts:t,expandedParts:e,onTogglePart:n,onReorder:r,onReadSection:a,onDeleteSection:i,onAddSectionInPart:o,onAddChapterInPart:c,onDeleteChapter:u,onEditPart:h,onDeletePart:f,onEditChapter:m,selectedSectionIds:g=[],onToggleSectionSelect:b,onShowSectionOrders:N,pinnedSectionIds:j=[]}){const[v,k]=y.useState(null),[T,C]=y.useState(null),R=($,ie)=>(v==null?void 0:v.type)===$&&(v==null?void 0:v.id)===ie,O=($,ie)=>(T==null?void 0:T.type)===$&&(T==null?void 0:T.id)===ie,U=y.useCallback(()=>{const $=[];for(const ie of t)for(const le of ie.chapters)for(const me of le.sections)$.push({id:me.id,partId:ie.id,partTitle:ie.title,chapterId:le.id,chapterTitle:le.title});return $},[t]),P=y.useCallback(async($,ie,le,me)=>{var X;$.preventDefault(),$.stopPropagation();const I=$.dataTransfer.getData("text/plain"),Y=Ax(I);if(!Y||Y.type===ie&&Y.id===le)return;const F=U(),ge=new Map(F.map(B=>[B.id,B]));if(Y.type==="part"&&ie==="part"){const B=t.map(D=>D.id),W=B.indexOf(Y.id),fe=B.indexOf(le);if(W===-1||fe===-1)return;const he=[...B];he.splice(W,1),he.splice(W_.id===D);if(q)for(const _ of q.chapters)for(const Z of _.sections){const re=ge.get(Z.id);re&&de.push(re)}}await r(de);return}if(Y.type==="chapter"&&(ie==="chapter"||ie==="section"||ie==="part")){const B=t.find(re=>re.chapters.some(we=>we.id===Y.id)),W=B==null?void 0:B.chapters.find(re=>re.id===Y.id);if(!B||!W)return;let fe,he,de=null;if(ie==="section"){const re=ge.get(le);if(!re)return;fe=re.partId,he=re.partTitle,de=le}else if(ie==="chapter"){const re=t.find(Ue=>Ue.chapters.some(jt=>jt.id===le)),we=re==null?void 0:re.chapters.find(Ue=>Ue.id===le);if(!re||!we)return;fe=re.id,he=re.title;const Fe=F.filter(Ue=>Ue.chapterId===le).pop();de=(Fe==null?void 0:Fe.id)??null}else{const re=t.find(we=>we.id===le);if(!re)return;if(fe=re.id,he=re.title,re.chapters[0]){const we=F.filter(Fe=>Fe.partId===re.id&&Fe.chapterId===re.chapters[0].id);de=((X=we[we.length-1])==null?void 0:X.id)??null}}const D=W.sections.map(re=>re.id),q=F.filter(re=>!D.includes(re.id));let _=q.length;if(de){const re=q.findIndex(we=>we.id===de);re>=0&&(_=re+1)}const Z=D.map(re=>({...ge.get(re),partId:fe,partTitle:he,chapterId:W.id,chapterTitle:W.title}));await r([...q.slice(0,_),...Z,...q.slice(_)]);return}if(Y.type==="section"&&(ie==="section"||ie==="chapter"||ie==="part")){if(!me)return;const{partId:B,partTitle:W,chapterId:fe,chapterTitle:he}=me,de=F.findIndex(re=>re.id===Y.id);if(de===-1)return;const D=F.filter(re=>re.id!==Y.id);let q;if(ie==="section"){const re=D.findIndex(we=>we.id===le);q=re>=0?re+1:D.length}else if(ie==="chapter"){const re=D.filter(we=>we.chapterId===le).pop();q=re?D.findIndex(we=>we.id===re.id)+1:D.length}else{const re=t.find(we=>we.id===le);if(re!=null&&re.chapters[0]){const we=D.filter(Ue=>Ue.partId===re.id&&Ue.chapterId===re.chapters[0].id),Fe=we[we.length-1];q=Fe?D.findIndex(Ue=>Ue.id===Fe.id)+1:D.length}else q=D.length}const Z={...F[de],partId:B,partTitle:W,chapterId:fe,chapterTitle:he};D.splice(q,0,Z),await r(D)}},[t,U,r]),z=($,ie,le)=>({onDragEnter:me=>{me.preventDefault(),me.stopPropagation(),me.dataTransfer.dropEffect="move",C({type:$,id:ie})},onDragOver:me=>{me.preventDefault(),me.stopPropagation(),me.dataTransfer.dropEffect="move",C({type:$,id:ie})},onDragLeave:()=>C(null),onDrop:me=>{C(null);const I=Ax(me.dataTransfer.getData("text/plain"));I&&($==="section"&&I.type==="section"&&I.id===ie||($==="part"?I.type==="part"?P(me,"part",ie):le&&P(me,"part",ie,le):$==="chapter"&&le?(I.type==="section"||I.type==="chapter")&&P(me,"chapter",ie,le):$==="section"&&le&&P(me,"section",ie,le)))}}),L=$=>yj[$%yj.length],Q=$=>t.slice(0,$).filter(ie=>!lV(ie)).length,se=$=>s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-gray-500 font-mono text-xs tabular-nums shrink-0 mr-1.5 max-w-[72px] truncate",title:`章节ID: ${$.id}`,children:$.id}),s.jsx("span",{className:"truncate",children:$.title})]});return s.jsx("div",{className:"space-y-3",children:t.map(($,ie)=>{var W,fe,he,de;const le=$.title==="序言"||$.title.includes("序言"),me=$.title==="尾声"||$.title.includes("尾声"),I=$.title==="附录"||$.title.includes("附录"),Y=O("part",$.id),F=e.includes($.id),ge=$.chapters.length,X=$.chapters.reduce((D,q)=>D+q.sections.length,0);if(le&&$.chapters.length===1&&$.chapters[0].sections.length===1){const D=$.chapters[0].sections[0],q=O("section",D.id),_={partId:$.id,partTitle:$.title,chapterId:$.chapters[0].id,chapterTitle:$.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:Z=>{Z.stopPropagation(),Z.dataTransfer.setData("text/plain","section:"+D.id),Z.dataTransfer.effectAllowed="move",k({type:"section",id:D.id})},onDragEnd:()=>{k(null),C(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${q?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${R("section",D.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...z("section",D.id,_),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(gi,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:Z=>Z.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(D.id),onChange:()=>b(D.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:s.jsx(dr,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[$.chapters[0].title," | ",D.title]}),j.includes(D.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(Bc,{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:Z=>Z.stopPropagation(),onClick:Z=>Z.stopPropagation(),children:[D.price===0||D.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",D.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",D.clickCount??0," · 付款 ",D.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(D.hotScore??0).toFixed(1)," · 第",D.hotRank&&D.hotRank>0?D.hotRank:"-","名"]}),N&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>N(D),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(D),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(D),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]})]},$.id)}if($.title==="2026每日派对干货"||$.title.includes("2026每日派对干货")){const D=O("part",$.id);return s.jsxs("div",{className:`rounded-xl border overflow-hidden transition-all duration-200 ${D?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50 bg-[#1C1C1E]"}`,...z("part",$.id,{partId:$.id,partTitle:$.title,chapterId:((W=$.chapters[0])==null?void 0:W.id)??"",chapterTitle:((fe=$.chapters[0])==null?void 0:fe.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:q=>{q.stopPropagation(),q.dataTransfer.setData("text/plain","part:"+$.id),q.dataTransfer.effectAllowed="move",k({type:"part",id:$.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${R("part",$.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/50"}`,children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(gi,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),s.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac]/80 flex items-center justify-center text-white font-bold shrink-0",children:$.badgeText||"派"}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:$.title}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:bj($)})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:q=>q.stopPropagation(),onClick:q=>q.stopPropagation(),children:[o&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o($),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx($n,{className:"w-3.5 h-3.5"})}),h&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h($),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),f&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f($),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",title:"本篇章数与节数",children:[ge," 章 · ",X," 节"]}),s.jsx("button",{type:"button",draggable:!1,className:"p-1 rounded-md hover:bg-white/10 text-gray-500",title:F?"收起":"展开",onMouseDown:q=>q.stopPropagation(),onClick:q=>{q.stopPropagation(),n($.id)},children:F?s.jsx(_l,{className:"w-5 h-5"}):s.jsx(Cl,{className:"w-5 h-5"})})]})]}),F&&$.chapters.length>0&&s.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:$.chapters.map(q=>s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[s.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:q.title}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:_=>_.stopPropagation(),children:[m&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>m($,q),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),c&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>c($),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx($n,{className:"w-3.5 h-3.5"})}),u&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>u($,q),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:q.sections.map(_=>{const Z=O("section",_.id);return s.jsxs("div",{draggable:!0,onDragStart:re=>{re.stopPropagation(),re.dataTransfer.setData("text/plain","section:"+_.id),re.dataTransfer.effectAllowed="move",k({type:"section",id:_.id})},onDragEnd:()=>{k(null),C(null)},onClick:()=>a(_),className:`flex items-center justify-between py-2 px-3 rounded-lg min-h-[40px] cursor-pointer select-none transition-all duration-200 ${Z?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${R("section",_.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...z("section",_.id,{partId:$.id,partTitle:$.title,chapterId:q.id,chapterTitle:q.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(gi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:re=>re.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(_.id),onChange:()=>b(_.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx("span",{className:"text-sm text-gray-200 truncate flex items-center min-w-0",children:se(_)}),j.includes(_.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(Bc,{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:re=>re.stopPropagation(),children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",_.clickCount??0," · 付款 ",_.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(_.hotScore??0).toFixed(1)," · 第",_.hotRank&&_.hotRank>0?_.hotRank:"-","名"]}),N&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>N(_),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(_),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]},_.id)})})]},q.id))})]},$.id)}if(I)return s.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"附录"}),s.jsx("div",{className:"space-y-3",children:$.chapters.map((D,q)=>D.sections.length>0?D.sections.map(_=>{const Z=O("section",_.id);return s.jsxs("div",{draggable:!0,onDragStart:re=>{re.stopPropagation(),re.dataTransfer.setData("text/plain","section:"+_.id),re.dataTransfer.effectAllowed="move",k({type:"section",id:_.id})},onDragEnd:()=>{k(null),C(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 group cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${Z?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${R("section",_.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...z("section",_.id,{partId:$.id,partTitle:$.title,chapterId:D.id,chapterTitle:D.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(gi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:re=>re.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(_.id),onChange:()=>b(_.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-300 truncate",children:["附录",q+1," | ",D.title," | ",_.title]}),j.includes(_.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(Bc,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",_.clickCount??0," · 付款 ",_.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(_.hotScore??0).toFixed(1)," · 第",_.hotRank&&_.hotRank>0?_.hotRank:"-","名"]}),N&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>N(_),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>a(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>i(_),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]}),s.jsx(Cl,{className:"w-4 h-4 text-gray-500 shrink-0"})]},_.id)}):s.jsxs("div",{className:"flex justify-between items-center py-2 select-none hover:bg-[#162840]/50 rounded px-2 -mx-2",children:[s.jsxs("span",{className:"text-sm text-gray-500",children:["附录",q+1," | ",D.title,"(空)"]}),s.jsx(Cl,{className:"w-4 h-4 text-gray-500 shrink-0"})]},D.id))})]},$.id);if(me&&$.chapters.length===1&&$.chapters[0].sections.length===1){const D=$.chapters[0].sections[0],q=O("section",D.id),_={partId:$.id,partTitle:$.title,chapterId:$.chapters[0].id,chapterTitle:$.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:Z=>{Z.stopPropagation(),Z.dataTransfer.setData("text/plain","section:"+D.id),Z.dataTransfer.effectAllowed="move",k({type:"section",id:D.id})},onDragEnd:()=>{k(null),C(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${q?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${R("section",D.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...z("section",D.id,_),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(gi,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:Z=>Z.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(D.id),onChange:()=>b(D.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:s.jsx(dr,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[$.chapters[0].title," | ",D.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:Z=>Z.stopPropagation(),onClick:Z=>Z.stopPropagation(),children:[D.price===0||D.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",D.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",D.clickCount??0," · 付款 ",D.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(D.hotScore??0).toFixed(1)," · 第",D.hotRank&&D.hotRank>0?D.hotRank:"-","名"]}),N&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>N(D),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(D),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(D),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]})]},$.id)}return me?s.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"尾声"}),s.jsx("div",{className:"space-y-3",children:$.chapters.map(D=>D.sections.map(q=>{const _=O("section",q.id);return s.jsxs("div",{draggable:!0,onDragStart:Z=>{Z.stopPropagation(),Z.dataTransfer.setData("text/plain","section:"+q.id),Z.dataTransfer.effectAllowed="move",k({type:"section",id:q.id})},onDragEnd:()=>{k(null),C(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${_?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${R("section",q.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...z("section",q.id,{partId:$.id,partTitle:$.title,chapterId:D.id,chapterTitle:D.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(gi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:Z=>Z.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(q.id),onChange:()=>b(q.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-300",children:[D.title," | ",q.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",q.clickCount??0," · 付款 ",q.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(q.hotScore??0).toFixed(1)," · 第",q.hotRank&&q.hotRank>0?q.hotRank:"-","名"]}),N&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>N(q),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(q),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(q),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]})]},q.id)}))})]},$.id):s.jsxs("div",{className:`rounded-xl border bg-[#1C1C1E] overflow-hidden transition-all duration-200 ${Y?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50"}`,...z("part",$.id,{partId:$.id,partTitle:$.title,chapterId:((he=$.chapters[0])==null?void 0:he.id)??"",chapterTitle:((de=$.chapters[0])==null?void 0:de.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:D=>{D.stopPropagation(),D.dataTransfer.setData("text/plain","part:"+$.id),D.dataTransfer.effectAllowed="move",k({type:"part",id:$.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${R("part",$.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] rounded-xl shadow-xl shadow-[#38bdac]/20":"hover:bg-[#162840]/50"}`,children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(gi,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),s.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac] flex items-center justify-center text-lg shadow-lg shadow-[#38bdac]/30 shrink-0",children:$.badgeText||L(Q(ie))}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:$.title}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:bj($)})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:D=>D.stopPropagation(),onClick:D=>D.stopPropagation(),children:[o&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o($),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx($n,{className:"w-3.5 h-3.5"})}),h&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h($),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),f&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f($),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",title:"本篇章数与节数",children:[ge," 章 · ",X," 节"]}),s.jsx("button",{type:"button",draggable:!1,className:"p-1 rounded-md hover:bg-white/10 text-gray-500",title:F?"收起":"展开",onMouseDown:D=>D.stopPropagation(),onClick:D=>{D.stopPropagation(),n($.id)},children:F?s.jsx(_l,{className:"w-5 h-5"}):s.jsx(Cl,{className:"w-5 h-5"})})]})]}),F&&s.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:$.chapters.map(D=>{const q=O("chapter",D.id);return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[s.jsxs("div",{draggable:!0,onDragStart:_=>{_.stopPropagation(),_.dataTransfer.setData("text/plain","chapter:"+D.id),_.dataTransfer.effectAllowed="move",k({type:"chapter",id:D.id})},onDragEnd:()=>{k(null),C(null)},onDragEnter:_=>{_.preventDefault(),_.stopPropagation(),_.dataTransfer.dropEffect="move",C({type:"chapter",id:D.id})},onDragOver:_=>{_.preventDefault(),_.stopPropagation(),_.dataTransfer.dropEffect="move",C({type:"chapter",id:D.id})},onDragLeave:()=>C(null),onDrop:_=>{C(null);const Z=Ax(_.dataTransfer.getData("text/plain"));if(!Z)return;const re={partId:$.id,partTitle:$.title,chapterId:D.id,chapterTitle:D.title};(Z.type==="section"||Z.type==="chapter")&&P(_,"chapter",D.id,re)},className:`flex-1 min-w-0 py-2 px-2 rounded cursor-grab active:cursor-grabbing select-none -mx-2 transition-all duration-200 flex items-center gap-2 ${q?"bg-[#38bdac]/15 ring-1 ring-[#38bdac]/50":""} ${R("chapter",D.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/30"}`,children:[s.jsx(gi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),s.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:D.title})]}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:_=>_.stopPropagation(),children:[m&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>m($,D),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),c&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>c($),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx($n,{className:"w-3.5 h-3.5"})}),u&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>u($,D),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:D.sections.map(_=>{const Z=O("section",_.id);return s.jsxs("div",{draggable:!0,onDragStart:re=>{re.stopPropagation(),re.dataTransfer.setData("text/plain","section:"+_.id),re.dataTransfer.effectAllowed="move",k({type:"section",id:_.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between py-2 px-3 rounded-lg group cursor-grab active:cursor-grabbing select-none min-h-[40px] transition-all duration-200 ${Z?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${R("section",_.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] shadow-lg":"hover:bg-[#162840]/50"}`,...z("section",_.id,{partId:$.id,partTitle:$.title,chapterId:D.id,chapterTitle:D.title}),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:re=>re.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(_.id),onChange:()=>b(_.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx(gi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),s.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${_.price===0||_.isFree?"border-2 border-[#38bdac] bg-transparent":"bg-gray-500"}`}),s.jsx("span",{className:"text-sm text-gray-200 truncate flex items-center min-w-0",children:se(_)}),j.includes(_.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(Bc,{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:re=>re.stopPropagation(),onClick:re=>re.stopPropagation(),children:[_.isNew&&s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"NEW"}),_.price===0||_.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",_.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",title:"点击次数 · 付款笔数",children:["点击 ",_.clickCount??0," · 付款 ",_.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(_.hotScore??0).toFixed(1)," · 第",_.hotRank&&_.hotRank>0?_.hotRank:"-","名"]}),N&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>N(_),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5 shrink-0",children:"付款记录"}),s.jsxs("div",{className:"flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(_),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Yn,{className:"w-3.5 h-3.5"})})]})]})]},_.id)})})]},D.id)})})]},$.id)})})}function dV(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 uV(t){return Oe(`/api/db/person?personId=${encodeURIComponent(t)}`)}function hV(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 fV=10;function V4(t){const e=(t??"").trim();if(!e)return"";if(/^https?:\/\//i.test(e))return ma(e);const n=e.startsWith("/")?e:`/${e}`;return ma(zl(n))}function pV(t){const{nickname:e,avatar:n}=t,r=V4(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 mV(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 gV({id:t,label:e,value:n,preview:r,previewLoading:a=!1,onSelect:i,onClear:o,containerOpen:c,disabled:u=!1,hint:h,className:f,portalMountRef:m,positionContainerRef:g}){const[b,N]=y.useState(!1),[j,v]=y.useState(""),k=Hl(j,300),[T,C]=y.useState([]),[R,O]=y.useState(!1),[U,P]=y.useState(!1),[z,L]=y.useState(0),Q=y.useRef(1),se=y.useRef(!1),$=y.useRef(!1),ie=y.useRef(null),le=y.useRef(null),[me,I]=y.useState({top:0,left:0,width:320,maxH:360}),Y=y.useCallback(()=>{const D=le.current;if(!D||typeof window>"u")return;const q=D.getBoundingClientRect(),_=Math.min(400,Math.max(200,window.innerHeight-q.bottom-16)),Z=g==null?void 0:g.current;if(Z){const re=Z.getBoundingClientRect();I({top:q.bottom-re.top+6,left:q.left-re.left,width:Math.max(q.width,300),maxH:_})}else I({top:q.bottom+6,left:q.left,width:Math.max(q.width,300),maxH:_})},[g]);y.useEffect(()=>{c||(N(!1),v(""))},[c]),y.useLayoutEffect(()=>{if(b)return Y(),window.addEventListener("scroll",Y,!0),window.addEventListener("resize",Y),()=>{window.removeEventListener("scroll",Y,!0),window.removeEventListener("resize",Y)}},[b,Y]);const F=y.useCallback(async(D,q,_)=>{if(!se.current){se.current=!0,_?P(!0):O(!0);try{const Z=new URLSearchParams({page:String(D),pageSize:String(fV),search:q.trim()}),re=await Oe(`/api/db/users?${Z}`);if(re!=null&&re.success&&Array.isArray(re.users)){const we=re.users,Fe=typeof re.total=="number"?re.total:0;L(Fe),_?we.length===0?$.current=!0:C(Ue=>{const jt=mV(Ue,we);return jt.length===Ue.length?$.current=!0:Q.current=D,jt}):(C(we),Q.current=D)}else re!=null&&re.error&&G.error(re.error)}catch(Z){G.error(Z instanceof Error?Z.message:"加载用户列表失败")}finally{se.current=!1,O(!1),P(!1)}}},[]);y.useEffect(()=>{b&&(Q.current=1,$.current=!1,F(1,k,!1))},[b,k,F]);const ge=y.useCallback(()=>{R||U||se.current||$.current||z>0&&T.length>=z||F(Q.current+1,k,!0)},[k,F,R,U,z,T.length]);y.useLayoutEffect(()=>{if(!b||R||U||$.current||z>0&&T.length>=z||T.length===0)return;const D=ie.current;D&&(D.scrollHeight>D.clientHeight+12||ge())},[b,T.length,R,U,z,ge]);const X=D=>{(D.id||"").trim()&&(i(D),N(!1),v(""))},B=D=>{D.preventDefault(),D.stopPropagation(),!(u||a)&&o()},W=!!n.trim(),fe=z>0,he=typeof document>"u"?null:(m==null?void 0:m.current)??document.body,de=b&&he&&id.createPortal(s.jsxs("div",{"data-member-user-select-portal":"",children:[s.jsx("div",{className:"fixed inset-0 z-40 bg-transparent","aria-hidden":!0,onMouseDown:D=>{D.preventDefault(),N(!1)}}),s.jsxs("div",{role:"listbox",className:"fixed z-50 overflow-hidden rounded-lg border border-gray-700 bg-[#0b1828] shadow-xl",style:{top:me.top,left:me.left,width:me.width,height:me.maxH,maxHeight:me.maxH,display:"grid",gridTemplateRows:fe?"auto auto minmax(0, 1fr) auto":"auto minmax(0, 1fr) auto"},children:[s.jsx("div",{className:"border-b border-gray-700/60 p-2 min-h-0",children:s.jsx(ce,{className:"bg-[#050c18] border-gray-700 text-white h-9 text-sm",placeholder:"搜索昵称、手机号、用户 id…",value:j,onChange:D=>v(D.target.value),onMouseDown:D=>D.stopPropagation(),autoFocus:!0})}),fe?s.jsxs("p",{className:"text-[11px] text-gray-500 px-3 pt-1.5 min-h-0 leading-snug",children:["已加载 ",T.length," / ",z," 条",T.length{const q=D.currentTarget;R||U||$.current||z>0&&T.length>=z||q.scrollHeight-q.scrollTop-q.clientHeight<100&&ge()},children:R&&T.length===0?s.jsx("div",{className:"flex h-40 items-center justify-center text-gray-400 text-sm",children:"正在加载…"}):T.length===0?s.jsx("div",{className:"flex h-40 items-center justify-center text-gray-500 text-sm px-3 text-center",children:"暂无用户,请调整搜索条件"}):s.jsxs("div",{className:"p-1.5 space-y-0.5",children:[T.map(D=>{const q=D.id||"",_=n===q,Z=V4(D.avatar),re=D.nickname&&String(D.nickname).trim()||"(无昵称)";return s.jsxs("button",{type:"button",role:"option","aria-selected":_,className:zt("flex w-full items-center gap-2 rounded-md border px-2.5 py-2 text-left text-sm transition-colors",_?"border-[#38bdac] bg-[#38bdac]/15 text-white":"border-transparent bg-[#050c18] hover:border-[#38bdac]/40 hover:bg-[#0a1628]"),onMouseDown:we=>we.preventDefault(),onClick:()=>X(D),children:[s.jsx("span",{className:"h-9 w-9 shrink-0 overflow-hidden rounded-full bg-gray-800",children:Z?s.jsx("img",{src:Z,alt:"",className:"h-full w-full object-cover",onError:we=>{we.currentTarget.style.display="none"}}):s.jsx("span",{className:"flex h-full w-full items-center justify-center text-[11px] text-gray-500",children:re.slice(0,1)})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"font-medium truncate",children:re}),s.jsxs("div",{className:"text-[11px] text-gray-500 font-mono truncate mt-0.5",children:[D.phone?`${D.phone} · `:"",q]})]})]},q)}),U&&s.jsx("div",{className:"py-2 text-center text-gray-500 text-xs",children:"加载更多…"})]})}),s.jsx("div",{className:"flex justify-end gap-2 border-t border-gray-700/60 px-2 py-1.5 min-h-0",children:s.jsx(J,{type:"button",variant:"ghost",size:"sm",className:"text-gray-400 h-8 text-xs",onMouseDown:D=>D.preventDefault(),onClick:()=>{o(),N(!1)},children:"清除绑定"})})]})]}),he);return s.jsxs("div",{className:zt("space-y-1.5",f),children:[typeof e=="string"?s.jsx(te,{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:zt("flex h-10 min-w-0 flex-1 items-center gap-2 rounded-md border bg-[#0a1628] px-3 text-left text-sm transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-[#38bdac]/50 focus-visible:ring-offset-0",u&&"cursor-not-allowed opacity-50",b?"border-[#38bdac] ring-1 ring-[#38bdac]/35":"border-gray-700 hover:border-gray-600"),onClick:()=>{u||(b||(v(""),Y()),N(D=>!D))},children:[s.jsx("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate",children:a?s.jsx("span",{className:"text-gray-500",children:"正在加载已绑定用户…"}):W?s.jsx(pV,{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(_l,{className:zt("h-4 w-4 shrink-0 text-gray-400 transition-transform",b&&"rotate-180")})]}),W&&s.jsx(J,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0 border-gray-600 text-gray-400 hover:text-white",disabled:u||a,"aria-label":"清除已选用户",onClick:B,children:s.jsx(Xn,{className:"h-4 w-4"})})]}),h&&s.jsx("div",{className:"text-[11px] text-gray-500",children:h}),de]})}const H4=11,vj={personId:"",name:"",boundUserId:"",aliases:"",label:"",sceneId:H4,ckbApiKey:"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:"phone",remarkFormat:"",addFriendInterval:1,startTime:"06:00",endTime:"22:00",deviceGroups:""};function xV({open:t,onOpenChange:e,editingPerson:n,onSubmit:r}){var q;const a=!!n,i=y.useRef(null),o=y.useRef(null),[c,u]=y.useState(vj),[h,f]=y.useState(!1),[m,g]=y.useState(!1),[b,N]=y.useState([]),[j,v]=y.useState(!1),[k,T]=y.useState(""),[C,R]=y.useState([]),[O,U]=y.useState(!1),[P,z]=y.useState(""),[L,Q]=y.useState(!1),[se,$]=y.useState(null),[ie,le]=y.useState(!1),[me,I]=y.useState({}),[Y,F]=y.useState({loading:!1,messages:[]}),ge=Hl(c.name,400),X=Hl(c.aliases,400);y.useEffect(()=>{if(!t){F({loading:!1,messages:[]});return}const _=ge.trim(),Z=X.trim();if(!_&&!Z){F({loading:!1,messages:[]});return}let re=!1;F(Ue=>({...Ue,loading:!0}));const we=a?((n==null?void 0:n.personId)??"").trim():"",Fe=new URLSearchParams;return _&&Fe.set("name",ge.trim()),Fe.set("aliases",X),we&&Fe.set("excludePersonId",we),Oe(`/api/db/persons/check-unique?${Fe.toString()}`).then(Ue=>{if(!re){if((Ue==null?void 0:Ue.success)===!1&&(Ue!=null&&Ue.error)){F({loading:!1,messages:[Ue.error]});return}if((Ue==null?void 0:Ue.ok)===!1&&Array.isArray(Ue.messages)&&Ue.messages.length>0){F({loading:!1,messages:Ue.messages});return}F({loading:!1,messages:[]})}}).catch(()=>{re||F({loading:!1,messages:[]})}),()=>{re=!0}},[t,ge,X,a,n==null?void 0:n.personId]),y.useEffect(()=>{if(t){if(T(""),$(null),le(!1),n){u({personId:n.personId??n.name??"",name:n.name??"",boundUserId:n.userId??"",aliases:n.aliases??"",label:n.label??"",sceneId:H4,ckbApiKey:n.ckbApiKey??"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:n.remarkType??"phone",remarkFormat:n.remarkFormat??"",addFriendInterval:n.addFriendInterval??1,startTime:n.startTime??"06:00",endTime:n.endTime??"22:00",deviceGroups:n.deviceGroups??""});const _=(n.userId??"").trim();_&&(le(!0),Oe(`/api/db/users?id=${encodeURIComponent(_)}`).then(Z=>{const re=Z==null?void 0:Z.user;re!=null&&re.id?$({id:re.id,nickname:re.nickname&&String(re.nickname).trim()||re.id,phone:re.phone,avatar:re.avatar??void 0}):$({id:_,nickname:_,phone:void 0,avatar:void 0})}).catch(()=>{$({id:_,nickname:_,phone:void 0,avatar:void 0})}).finally(()=>le(!1)))}else u({...vj});I({}),b.length===0&&B(""),C.length===0&&W("")}},[t,n]);const B=async _=>{v(!0);try{const Z=await dV({page:1,limit:50,keyword:_});Z!=null&&Z.success&&Array.isArray(Z.devices)?N(Z.devices):Z!=null&&Z.error&&G.error(Z.error)}catch(Z){G.error(Z instanceof Error?Z.message:"加载设备列表失败")}finally{v(!1)}},W=async _=>{U(!0);try{const Z=await hV({page:1,limit:100,keyword:_});Z!=null&&Z.success&&Array.isArray(Z.plans)?R(Z.plans):Z!=null&&Z.error&&G.error(Z.error)}catch{G.error("加载计划列表失败")}finally{U(!1)}},fe=()=>{u(_=>{const Z=(_.boundUserId||"").trim(),re={..._,boundUserId:""};return!a&&Z&&(_.personId||"").trim()===Z&&(re.personId=""),re}),$(null)},he=_=>{const Z=Array.isArray(_.deviceGroups)?_.deviceGroups.map(String).join(","):"";u(re=>({...re,ckbApiKey:_.apiKey||"",greeting:_.greeting||re.greeting,tips:_.tips||re.tips,remarkType:_.remarkType||re.remarkType,remarkFormat:_.remarkFormat||re.remarkFormat,addFriendInterval:_.addInterval||re.addFriendInterval,startTime:_.startTime||re.startTime,endTime:_.endTime||re.endTime,deviceGroups:Z||re.deviceGroups})),Q(!1),G.success(`已选择计划「${_.name}」,参数已覆盖`)},de=P.trim()?C.filter(_=>(_.name||"").includes(P.trim())||String(_.id).includes(P.trim())):C,D=async()=>{var we;const _={};(!c.name||!String(c.name).trim())&&(_.name="请填写名称");const Z=c.addFriendInterval;if((typeof Z!="number"||Z<1)&&(_.addFriendInterval="添加间隔至少为 1 分钟"),(((we=c.deviceGroups)==null?void 0:we.split(",").map(Fe=>Fe.trim()).filter(Boolean))??[]).length===0&&(_.deviceGroups="请至少选择 1 台设备"),I(_),Object.keys(_).length>0){G.error(_.name||_.addFriendInterval||_.deviceGroups||"请完善必填项");return}if(Y.messages.length>0){G.error(Y.messages[0]??"名称或别名与他人重复");return}f(!0);try{await r(c),e(!1)}catch(Fe){G.error(Fe instanceof Error?Fe.message:"保存失败")}finally{f(!1)}};return s.jsx(Dt,{open:t,onOpenChange:e,children:s.jsxs(Ot,{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(_t,{children:[s.jsx($t,{className:"text-[#38bdac]",children:a?"编辑人物":"添加人物 — 存客宝 API 获客"}),s.jsx(Qc,{className:"text-gray-400 text-sm",children:a?"修改后同步到存客宝计划":"添加时自动生成 token,并同步创建存客宝场景获客计划"})]}),s.jsxs("div",{className:"space-y-6 py-2",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium text-gray-400 uppercase tracking-wider mb-3",children:"基础信息"}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(te,{className:"text-gray-400 text-xs",children:["名称 ",s.jsx("span",{className:"text-red-400",children:"*"})]}),s.jsx(ce,{className:`bg-[#0a1628] text-white ${me.name?"border-red-500 focus-visible:ring-red-500":Y.messages.length>0?"border-amber-600 focus-visible:ring-amber-600/50":"border-gray-700"}`,placeholder:"如 卡若",value:c.name,onChange:_=>{u(Z=>({...Z,name:_.target.value})),me.name&&I(Z=>({...Z,name:void 0}))}}),me.name&&s.jsx("p",{className:"text-xs text-red-400",children:me.name})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"人物ID(可选)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"自动生成",value:(c.boundUserId||"").trim()?c.boundUserId:c.personId,onChange:_=>u(Z=>({...Z,personId:_.target.value})),disabled:a||!!(c.boundUserId||"").trim()})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"标签(身份/角色)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 超级个体",value:c.label,onChange:_=>u(Z=>({...Z,label:_.target.value}))})]}),s.jsx(gV,{className:"col-span-3",id:"person-bound-member-user",label:"绑定会员用户(可选,与「用户管理」中用户一致)",containerOpen:t,portalMountRef:o,positionContainerRef:i,value:c.boundUserId,preview:se,previewLoading:ie,onSelect:_=>{const Z=(_.id||"").trim();Z&&(u(re=>({...re,boundUserId:Z,...a?{}:{personId:Z}})),$({id:Z,nickname:_.nickname&&String(_.nickname).trim()||Z,phone:_.phone,avatar:_.avatar??void 0}))},onClear:fe,hint:s.jsx("span",{children:"单选;保存时后端校验用户是否存在。同一会员只能绑定一个 @人物;绑定后获客统计可与超级个体对齐。"})}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"别名(逗号分隔,@ 可匹配)"}),s.jsx(ce,{className:`bg-[#0a1628] text-white ${Y.messages.length>0?"border-amber-600 focus-visible:ring-amber-600/50":"border-gray-700"}`,placeholder:"如 卡卡, 若若",value:c.aliases,onChange:_=>u(Z=>({...Z,aliases:_.target.value}))})]}),s.jsx("div",{className:"col-span-3 space-y-1",children:Y.loading?s.jsx("p",{className:"text-xs text-gray-500",children:"正在检测名称与别名是否与他人重复…"}):Y.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:Y.messages.map((_,Z)=>s.jsx("p",{children:_},`${Z}-${_.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(te,{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:()=>Q(!L),children:c.ckbApiKey?s.jsx("span",{className:"text-white truncate",children:((q=C.find(_=>_.apiKey===c.ckbApiKey))==null?void 0:q.name)||`获客计划 (${c.ckbApiKey.slice(0,8)}…)`}):s.jsx("span",{className:"text-gray-500",children:"点击选择已有计划 / 新建时自动创建"})}),s.jsx(J,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-200 shrink-0",onClick:()=>{W(P),Q(!0)},disabled:O,children:O?"加载...":"刷新"})]}),L&&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:P,onChange:_=>z(_.target.value),onKeyDown:_=>{_.key==="Enter"&&W(P)},autoFocus:!0})}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:de.length===0?s.jsx("div",{className:"text-center py-4 text-gray-500 text-xs",children:O?"加载中...":"暂无计划"}):de.map(_=>s.jsxs("div",{className:`px-3 py-2 cursor-pointer hover:bg-[#38bdac]/10 text-sm flex items-center justify-between ${c.ckbApiKey===_.apiKey?"bg-[#38bdac]/20 text-[#38bdac]":"text-white"}`,onClick:()=>he(_),children:[s.jsxs("div",{className:"truncate",children:[s.jsx("span",{className:"font-medium",children:_.name}),s.jsxs("span",{className:"text-xs text-gray-500 ml-2",children:["ID:",String(_.id)]})]}),_.enabled?s.jsx("span",{className:"text-[10px] text-green-400 bg-green-400/10 px-1.5 rounded shrink-0 ml-2",children:"启用"}):s.jsx("span",{className:"text-[10px] text-gray-500 bg-gray-500/10 px-1.5 rounded shrink-0 ml-2",children:"停用"})]},String(_.id)))}),s.jsx("div",{className:"p-2 border-t border-gray-700/60 flex justify-end",children:s.jsx(J,{type:"button",size:"sm",variant:"ghost",className:"text-gray-400 h-7 text-xs",onClick:()=>Q(!1),children:"关闭"})})]}),s.jsx("p",{className:"text-xs text-gray-500",children:"选择计划后自动覆盖下方参数。新建人物时若不选择则自动创建新计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(te,{className:"text-gray-400 text-xs",children:["选择设备 ",s.jsx("span",{className:"text-red-400",children:"*"})]}),s.jsxs("div",{className:`flex gap-2 rounded-md border ${me.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:()=>g(!0)}),s.jsx(J,{type:"button",variant:"outline",className:"border-0 border-l border-inherit rounded-r-md text-gray-200",onClick:()=>g(!0),children:"选择"})]}),me.deviceGroups?s.jsx("p",{className:"text-xs text-red-400",children:me.deviceGroups}):s.jsx("p",{className:"text-xs text-gray-500",children:"从存客宝设备列表中选择,至少选择 1 台设备参与获客计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"好友备注"}),s.jsxs(wo,{value:c.remarkType,onValueChange:_=>u(Z=>({...Z,remarkType:_})),children:[s.jsx(Ei,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(jo,{placeholder:"选择备注类型"})}),s.jsxs(Ti,{children:[s.jsx(cs,{value:"phone",children:"手机号"}),s.jsx(cs,{value:"nickname",children:"昵称"}),s.jsx(cs,{value:"source",children:"来源"})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"备注格式(手机号+标签,标签不超过6字)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 {手机号}-{来源标签},总长不超过10字",value:c.remarkFormat,onChange:_=>u(Z=>({...Z,remarkFormat:_.target.value}))}),s.jsx("p",{className:"text-xs text-gray-500",children:"格式:手机号+来源标签(标签≤6字,总长≤10字)"})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"打招呼语"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"你好,请通过",value:c.greeting,onChange:_=>u(Z=>({...Z,greeting:_.target.value}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"添加间隔(分钟)"}),s.jsx(ce,{type:"number",min:1,className:`bg-[#0a1628] text-white ${me.addFriendInterval?"border-red-500 focus-visible:ring-red-500":"border-gray-700"}`,value:c.addFriendInterval,onChange:_=>{u(Z=>({...Z,addFriendInterval:Number(_.target.value)||1})),me.addFriendInterval&&I(Z=>({...Z,addFriendInterval:void 0}))}}),me.addFriendInterval&&s.jsx("p",{className:"text-xs text-red-400",children:me.addFriendInterval})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"允许加人时间段"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ce,{type:"time",className:"bg-[#0a1628] border-gray-700 text-white w-24",value:c.startTime,onChange:_=>u(Z=>({...Z,startTime:_.target.value}))}),s.jsx("span",{className:"text-gray-500 text-sm shrink-0",children:"至"}),s.jsx(ce,{type:"time",className:"bg-[#0a1628] border-gray-700 text-white w-24",value:c.endTime,onChange:_=>u(Z=>({...Z,endTime:_.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"获客成功提示"}),s.jsx(ec,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[72px] resize-none",placeholder:"请注意消息,稍后加你微信",value:c.tips,onChange:_=>u(Z=>({...Z,tips:_.target.value}))})]})]})]})]})]})]}),s.jsxs(rn,{className:"gap-3 border-t border-gray-700/40 px-6 py-4 shrink-0",children:[s.jsx(J,{variant:"outline",onClick:()=>e(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(J,{onClick:D,disabled:h||Y.messages.length>0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:h?"保存中...":a?"保存":"添加"})]})]}),m&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",children:s.jsxs("div",{className:"w-full max-w-3xl max-h-[80vh] bg-[#0b1828] border border-gray-700 rounded-xl shadow-xl flex flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-gray-700/60",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-medium text-white",children:"选择设备"}),s.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"勾选需要参与本计划的设备,可多选"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(J,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-200 h-8",onClick:()=>{const _=b.map(we=>String(we.id??"")),Z=c.deviceGroups?c.deviceGroups.split(",").map(we=>we.trim()).filter(Boolean):[],re=_.length>0&&_.every(we=>Z.includes(we));u(we=>({...we,deviceGroups:re?"":_.join(",")})),!re&&_.length>0&&I(we=>({...we,deviceGroups:void 0}))},children:(()=>{const _=b.map(re=>String(re.id??"")),Z=c.deviceGroups?c.deviceGroups.split(",").map(re=>re.trim()).filter(Boolean):[];return _.length>0&&_.every(re=>Z.includes(re))?"取消全选":"全选"})()}),s.jsx(ce,{className:"bg-[#050c18] border-gray-700 text-white h-8 w-52",placeholder:"搜索备注/微信号/IMEI",value:k,onChange:_=>T(_.target.value),onKeyDown:_=>{_.key==="Enter"&&B(k)}}),s.jsx(J,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-200 h-8",onClick:()=>B(k),disabled:j,children:"刷新"}),s.jsx(J,{type:"button",size:"icon",variant:"outline",className:"border-gray-600 text-gray-300 h-8 w-8",onClick:()=>g(!1),children:"✕"})]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:j?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-400 text-sm",children:"正在加载设备列表…"}):b.length===0?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-500 text-sm",children:"暂无设备数据,请检查存客宝账号与开放 API 配置"}):s.jsx("div",{className:"p-4 space-y-2",children:b.map(_=>{const Z=String(_.id??""),re=c.deviceGroups?c.deviceGroups.split(",").map(Ue=>Ue.trim()).filter(Boolean):[],we=re.includes(Z),Fe=()=>{let Ue;we?Ue=re.filter(jt=>jt!==Z):Ue=[...re,Z],u(jt=>({...jt,deviceGroups:Ue.join(",")})),Ue.length>0&&I(jt=>({...jt,deviceGroups:void 0}))};return s.jsxs("label",{className:"flex items-center gap-3 rounded-lg border border-gray-700/60 bg-[#050c18] px-3 py-2 cursor-pointer hover:border-[#38bdac]/70",children:[s.jsx("input",{type:"checkbox",className:"h-4 w-4 accent-[#38bdac]",checked:we,onChange:Fe}),s.jsxs("div",{className:"flex flex-col min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-white truncate max-w-xs",children:_.memo||_.wechatId||`设备 ${Z}`}),_.status==="online"&&s.jsx("span",{className:"rounded-full bg-emerald-500/20 text-emerald-400 text-[11px] px-2 py-0.5",children:"在线"}),_.status==="offline"&&s.jsx("span",{className:"rounded-full bg-gray-600/20 text-gray-400 text-[11px] px-2 py-0.5",children:"离线"})]}),s.jsxs("div",{className:"text-[11px] text-gray-400 mt-0.5",children:[s.jsxs("span",{className:"mr-3",children:["ID: ",Z]}),_.wechatId&&s.jsxs("span",{className:"mr-3",children:["微信号: ",_.wechatId]}),typeof _.totalFriend=="number"&&s.jsxs("span",{children:["好友数: ",_.totalFriend]})]})]})]},Z)})})}),s.jsxs("div",{className:"flex justify-between items-center px-5 py-3 border-t border-gray-700/60",children:[s.jsxs("span",{className:"text-xs text-gray-400",children:["已选择"," ",c.deviceGroups?c.deviceGroups.split(",").filter(Boolean).length:0," ","台设备"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(J,{type:"button",variant:"outline",className:"border-gray-600 text-gray-200 h-8 px-4",onClick:()=>g(!1),children:"取消"}),s.jsx(J,{type:"button",className:"bg-[#38bdac] hover:bg-[#2da396] text-white h-8 px-4",onClick:()=>g(!1),children:"确定"})]})]})]})})]})})}function zc(t){if(t!=null){if(typeof t=="number"&&Number.isFinite(t))return Math.round(t);if(typeof t=="string"&&t.trim()!==""){const e=Number(t.trim().replace(/%/g,""));if(Number.isFinite(e))return Math.round(e)}}}function yV(t,e,n){const r=new Map;for(const o of t){const c=o.partId||"part-1",u=o.partTitle||"未分类",h=o.chapterId||"chapter-1",f=o.chapterTitle||"未分类";r.has(c)||r.set(c,{id:c,title:u,badgeText:n[c]||"",chapters:new Map});const m=r.get(c);m.chapters.has(h)||m.chapters.set(h,{id:h,title:f,sections:[]}),m.chapters.get(h).sections.push({id:o.id,mid:o.mid,title:o.title,price:o.price??1,filePath:o.filePath,isFree:o.isFree,isNew:o.isNew,clickCount:o.clickCount??0,payCount:o.payCount??0,hotScore:o.hotScore??0,hotRank:e.get(o.id)??0,previewPercent:zc(o.previewPercent)})}const a=Array.from(r.values()).map(o=>({...o,chapters:Array.from(o.chapters.values())})),i=new Map;for(let o=0;o{const u=i.get(o.id),h=i.get(c.id);return u!==void 0&&h!==void 0&&u!==h?u-h:u!==void 0&&h===void 0?-1:u===void 0&&h!==void 0?1:o.id.localeCompare(c.id)})}function bV(){var cl,dl,oi;const t=Ka(),[e,n]=y.useState([]),[r,a]=y.useState(!0),[i,o]=y.useState([]),[c,u]=y.useState(null),[h,f]=y.useState(!1),[m,g]=y.useState(!1),[b,N]=y.useState(!1),[j,v]=y.useState(""),[k,T]=y.useState([]),[C,R]=y.useState(!1),[O,U]=y.useState({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),[P,z]=y.useState(null),[L,Q]=y.useState(!1),[se,$]=y.useState(!1),[ie,le]=y.useState(null),[me,I]=y.useState(!1),[Y,F]=y.useState([]),[ge,X]=y.useState(!1),[B,W]=y.useState(""),[fe,he]=y.useState(""),[de,D]=y.useState(!1),[q,_]=y.useState(""),[Z,re]=y.useState(!1),[we,Fe]=y.useState(null),[Ue,jt]=y.useState(!1),[Nn,pt]=y.useState(!1),[It,hn]=y.useState({readWeight:.5,recencyWeight:.3,payWeight:.2}),[Bn,fn]=y.useState(!1),[Wt,xn]=y.useState(!1),[En,Vn]=y.useState(1),[es,Rt]=y.useState([]),[yn,Ne]=y.useState(!1),[Me,We]=y.useState([]),[at,Lt]=y.useState(!1),[Ct,$e]=y.useState(20),[H,Qe]=y.useState(!1),[vt,Ft]=y.useState(!1),[yt,bt]=y.useState([]),[Pt,Qt]=y.useState([]),[wn,Ds]=y.useState([]),[hr,Ja]=y.useState(!1),[Gr,Jr]=y.useState(1),[va,Tr]=y.useState(20),[Mr,Qr]=y.useState(0),[Qa,fr]=y.useState(1),[qs,pr]=y.useState(""),[Gs,_s]=y.useState(!1),[oe,ve]=y.useState(null),[Xe,Nt]=y.useState({tagId:"",label:"",aliases:"",url:"",type:"url",appId:"",appSecret:"",pagePath:""}),[Zt,Js]=y.useState(!1),[Yo,Yr]=y.useState(!1),[zi,Ya]=y.useState(null),[gs,Ar]=y.useState(null),[nn,Xa]=y.useState({}),[Fi,Xr]=y.useState(!1),[Na,Xo]=y.useState(""),[Bi,Qs]=y.useState(""),[$s,Zo]=y.useState([]),[qn,el]=y.useState(0),[Zr,xs]=y.useState(1),[mr,zs]=y.useState(!1),[ea,wa]=y.useState(""),rc=y.useRef(null),Za=y.useCallback(async(E,V)=>{var mt;const ue=new FormData;ue.append("file",E),ue.append("folder",V);const Ke=await(await fetch(zl("/api/upload"),{method:"POST",body:ue,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((mt=Ke==null?void 0:Ke.data)==null?void 0:mt.url)||(Ke==null?void 0:Ke.url)||""},[]),Vi=y.useCallback(E=>Za(E,"book-images"),[Za]),ei=y.useCallback(E=>{const V=E.type.startsWith("video/")?"book-videos":"book-attachments";return Za(E,V)},[Za]),[Hi,ta]=y.useState({}),ja=E=>String(E||"").trim().slice(0,8),tl=y.useMemo(()=>{const E=new Map;return es.forEach((V,ue)=>{E.set(V.id,ue+1)}),E},[es]),lt=yV(e,tl,Hi),Ui=e.length,ti=10,ni=Math.max(1,Math.ceil(es.length/ti)),nl=es.slice((En-1)*ti,En*ti),ts=async()=>{a(!0);try{const E=await Oe("/api/db/book?action=list",{cache:"no-store"});n(Array.isArray(E==null?void 0:E.sections)?E.sections:[])}catch(E){console.error(E),n([])}finally{a(!1)}},sl=async()=>{try{const E=await Oe("/api/db/config?key=book_part_badges",{cache:"no-store"});let V={};if(E&&Array.isArray(E.data)){const ke=E.data.find(Ke=>Ke&&Ke.configKey==="book_part_badges");ke&&ke.configValue&&typeof ke.configValue=="object"&&!Array.isArray(ke.configValue)&&(V=ke.configValue)}else E&&E.data&&typeof E.data=="object"&&!Array.isArray(E.data)&&(V=E.data);const ue={};Object.keys(V).forEach(ke=>{const Ke=ja(V[ke]);Ke&&(ue[ke]=Ke)}),ta(ue)}catch(E){console.error(E),ta({})}},gr=async()=>{Ne(!0);try{const E=await Oe("/api/db/book?action=ranking",{cache:"no-store"}),V=Array.isArray(E==null?void 0:E.sections)?E.sections:[];Rt(V);const ue=V.filter(ke=>ke.isPinned).map(ke=>ke.id);We(ue)}catch(E){console.error(E),Rt([])}finally{Ne(!1)}};y.useEffect(()=>{ts(),gr(),sl()},[]);const Wi=E=>{o(V=>V.includes(E)?V.filter(ue=>ue!==E):[...V,E])},xr=y.useCallback(E=>{const V=e,ue=E.flatMap(ke=>{const Ke=V.find(mt=>mt.id===ke.id);return Ke?[{...Ke,partId:ke.partId,partTitle:ke.partTitle,chapterId:ke.chapterId,chapterTitle:ke.chapterTitle}]:[]});return n(ue),Xt("/api/db/book",{action:"reorder",items:E}).then(ke=>{ke&&ke.success===!1&&(n(V),G.error("排序失败: "+(ke&&typeof ke=="object"&&"error"in ke?ke.error:"未知错误")))}).catch(ke=>{n(V),console.error("排序失败:",ke),G.error("排序失败: "+(ke instanceof Error?ke.message:"网络或服务异常"))}),Promise.resolve()},[e]),Ys=async E=>{if(confirm(`确定要删除章节「${E.title}」吗?此操作不可恢复。`))try{const V=await Ci(`/api/db/book?id=${encodeURIComponent(E.id)}`);V&&V.success!==!1?(G.success("已删除"),ts(),gr()):G.error("删除失败: "+(V&&typeof V=="object"&&"error"in V?V.error:"未知错误"))}catch(V){console.error(V),G.error("删除失败")}},Fs=y.useCallback(async()=>{fn(!0);try{const E=await Oe("/api/db/config/full?key=article_ranking_weights",{cache:"no-store"}),V=E&&E.data;V&&typeof V.readWeight=="number"&&typeof V.recencyWeight=="number"&&typeof V.payWeight=="number"&&hn({readWeight:Math.max(0,Math.min(1,V.readWeight)),recencyWeight:Math.max(0,Math.min(1,V.recencyWeight)),payWeight:Math.max(0,Math.min(1,V.payWeight))})}catch{}finally{fn(!1)}},[]);y.useEffect(()=>{Nn&&Fs()},[Nn,Fs]);const Xs=async()=>{const{readWeight:E,recencyWeight:V,payWeight:ue}=It,ke=E+V+ue;if(Math.abs(ke-1)>.001){G.error("三个权重之和必须等于 1");return}xn(!0);try{const Ke=await kt("/api/db/config",{key:"article_ranking_weights",value:{readWeight:E,recencyWeight:V,payWeight:ue},description:"文章排名算法权重"});Ke&&Ke.success!==!1?(G.success("排名权重已保存"),pt(!1),ts(),gr()):G.error("保存失败: "+(Ke&&typeof Ke=="object"&&"error"in Ke?Ke.error:""))}catch(Ke){console.error(Ke),G.error("保存失败")}finally{xn(!1)}},ka=y.useCallback(async()=>{Lt(!0);try{const E=await Oe("/api/db/config/full?key=pinned_section_ids",{cache:"no-store"}),V=E&&E.data;Array.isArray(V)&&We(V)}catch{}finally{Lt(!1)}},[]),On=y.useCallback(async()=>{try{const E=await Oe("/api/db/persons");E!=null&&E.success&&E.persons&&bt(E.persons.map(V=>{const ue=V.deviceGroups,ke=Array.isArray(ue)?ue.join(","):ue??"";return{id:V.token??V.personId??"",personId:V.personId,name:V.name,personSource:V.personSource??"",userId:V.userId,aliases:V.aliases??"",label:V.label??"",ckbApiKey:V.ckbApiKey??"",ckbPlanId:V.ckbPlanId,remarkType:V.remarkType,remarkFormat:V.remarkFormat,addFriendInterval:V.addFriendInterval,startTime:V.startTime,endTime:V.endTime,deviceGroups:ke,isPinned:!!V.isPinned}}))}catch{}},[]),ac=y.useCallback(async(E,V)=>{const ue=(E.personId||E.id||"").trim();if(!ue){G.error("缺少 personId");return}V&&!(E.userId||"").trim()&&G.info("未绑定会员时,小程序仍显示 @ 名称,头像可能为默认图");try{const ke=await Xt("/api/db/persons/pin",{personId:ue,isPinned:V});if(!(ke!=null&&ke.success)){G.error((ke==null?void 0:ke.error)||"置顶失败");return}G.success(V?"已设为小程序首页置顶(全局仅一条)":"已取消置顶"),await On()}catch(ke){G.error(ke instanceof Error?ke.message:"操作失败")}},[On]),Ir=y.useCallback(async()=>{try{const E=await Oe("/api/db/link-tags");E!=null&&E.success&&E.linkTags&&Qt(E.linkTags.map(V=>({id:V.tagId,label:V.label,url:V.url,type:V.type||"url",appId:V.appId||"",pagePath:V.pagePath||"",hasAppSecret:!!V.hasAppSecret})))}catch{}},[]),Sa=y.useCallback(async()=>{try{const E=await Oe("/api/db/config/full?key=ckb_lead_webhook_url",{cache:"no-store"});E!=null&&E.success&&typeof E.data=="string"&&wa(E.data)}catch{}},[]),ic=y.useCallback(async()=>{try{const E=await Oe("/api/db/ckb-person-leads");if(E!=null&&E.success&&E.byPerson){const V={};for(const ue of E.byPerson)V[ue.token]=ue.total;Xa(V)}}catch{}},[]),Ca=y.useCallback(async(E,V,ue=1)=>{Xo(E),Qs(V),Xr(!0),xs(ue),zs(!0);try{const ke=await Oe(`/api/db/ckb-person-leads?token=${encodeURIComponent(E)}&page=${ue}&pageSize=20`);ke!=null&&ke.success?(Zo(ke.records||[]),el(ke.total||0)):G.error((ke==null?void 0:ke.error)||"加载获客详情失败")}catch(ke){G.error(ke instanceof Error?ke.message:"加载获客详情失败")}finally{zs(!1)}},[]),yr=y.useCallback(async()=>{Ja(!0);try{const E=new URLSearchParams({page:String(Gr),pageSize:String(va)}),V=qs.trim();V&&E.set("search",V);const ue=await Oe(`/api/db/link-tags?${E.toString()}`);if(ue!=null&&ue.success){const ke=Array.isArray(ue.linkTags)?ue.linkTags:[];Ds(ke.map(Ke=>({id:Ke.tagId,label:Ke.label,aliases:Ke.aliases||"",url:Ke.url,type:Ke.type||"url",appId:Ke.appId||"",pagePath:Ke.pagePath||"",hasAppSecret:!!Ke.hasAppSecret}))),Qr(typeof ue.total=="number"?ue.total:0),fr(typeof ue.totalPages=="number"&&ue.totalPages>0?ue.totalPages:1)}}catch(E){console.error(E),G.error("加载链接标签失败")}finally{Ja(!1)}},[Gr,va,qs]),[Zs,gd]=y.useState([]),[br,er]=y.useState(""),[ns,tr]=y.useState(!1),Ki=y.useRef(null),Ea=y.useCallback(async()=>{try{const E=await Oe("/api/admin/linked-miniprograms");E!=null&&E.success&&Array.isArray(E.data)&&gd(E.data.map(V=>({...V,key:V.key})))}catch{}},[]),Ta=Zs.filter(E=>!br.trim()||E.name.toLowerCase().includes(br.toLowerCase())||E.key&&E.key.toLowerCase().includes(br.toLowerCase())||E.appId.toLowerCase().includes(br.toLowerCase())),Pr=async E=>{const V=Me.includes(E)?Me.filter(ue=>ue!==E):[...Me,E];We(V);try{await kt("/api/db/config",{key:"pinned_section_ids",value:V,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"}),gr()}catch{We(Me)}},Ma=y.useCallback(async()=>{Qe(!0);try{const E=await Oe("/api/db/config/full?key=unpaid_preview_percent",{cache:"no-store"}),V=E&&E.data;typeof V=="number"&&V>0&&V<=100&&$e(V)}catch{}finally{Qe(!1)}},[]),rl=async()=>{if(Ct<1||Ct>100){G.error("预览比例需在 1~100 之间");return}Ft(!0);try{const E=await kt("/api/db/config",{key:"unpaid_preview_percent",value:Ct,description:"小程序未付费内容默认预览比例(%)"});E&&E.success!==!1?G.success("预览比例已保存"):G.error("保存失败: "+(E.error||""))}catch{G.error("保存失败")}finally{Ft(!1)}};y.useEffect(()=>{ka(),Ma(),On(),Ir(),ic(),Ea(),Sa()},[ka,Ma,On,Ir,ic,Ea,Sa]),y.useEffect(()=>{yr()},[yr]);const nr=async E=>{Fe({section:E,orders:[]}),jt(!0);try{const V=await Oe(`/api/db/book?action=section-orders&id=${encodeURIComponent(E.id)}`),ue=V!=null&&V.success&&Array.isArray(V.orders)?V.orders:[];Fe(ke=>ke?{...ke,orders:ue}:null)}catch(V){console.error(V),Fe(ue=>ue?{...ue,orders:[]}:null)}finally{jt(!1)}},si=async E=>{g(!0);try{const V=E.mid!=null&&E.mid>0?`/api/db/book?action=read&mid=${E.mid}`:`/api/db/book?action=read&id=${encodeURIComponent(E.id)}`,ue=await Oe(V);if(ue!=null&&ue.success&&ue.section){const ke=ue.section,Ke=ke.editionPremium===!0,mt=zc(ke.previewPercent)??zc(ke.preview_percent),wt=zc(E.previewPercent);u({id:E.id,originalId:E.id,title:ue.section.title??E.title,price:ue.section.price??E.price,content:ue.section.content??"",filePath:E.filePath,isFree:E.isFree||E.price===0,isNew:ke.isNew??E.isNew,isPinned:Me.includes(E.id),hotScore:E.hotScore??0,previewPercent:mt??wt??void 0,editionStandard:Ke?!1:ke.editionStandard??!0,editionPremium:Ke})}else u({id:E.id,originalId:E.id,title:E.title,price:E.price,content:"",filePath:E.filePath,isFree:E.isFree,isNew:E.isNew,isPinned:Me.includes(E.id),hotScore:E.hotScore??0,previewPercent:zc(E.previewPercent),editionStandard:!0,editionPremium:!1}),ue&&!ue.success&&G.error("无法读取文件内容: "+(ue.error||"未知错误"))}catch(V){console.error(V),u({id:E.id,title:E.title,price:E.price,content:"",filePath:E.filePath,isFree:E.isFree,previewPercent:zc(E.previewPercent)})}finally{g(!1)}},na=async()=>{var E;if(c){N(!0);try{let V=c.content||"";const ue=[new RegExp(`^#+\\s*${c.id.replace(".","\\.")}\\s+.*$`,"gm"),new RegExp(`^#+\\s*${c.id.replace(".","\\.")}[::].*$`,"gm"),new RegExp(`^#\\s+.*${(E=c.title)==null?void 0:E.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const rs of ue)V=V.replace(rs,"");V=V.replace(/^\s*\n+/,"").trim();const ke=c.originalId||c.id,Ke=c.id!==ke,mt={id:ke,...Ke?{newId:c.id}:{},title:c.title,price:c.isFree?0:c.price,content:V,isFree:c.isFree||c.price===0,isNew:c.isNew,hotScore:c.hotScore,editionStandard:c.editionPremium?!1:c.editionStandard??!0,editionPremium:c.editionPremium??!1,saveToFile:!0};c.previewPercent===null?mt.previewPercent=null:typeof c.previewPercent=="number"&&Number.isFinite(c.previewPercent)&&(mt.previewPercent=c.previewPercent);const wt=await Xt("/api/db/book",mt,{timeout:_1}),Tn=Ke?c.id:ke;c.isPinned!==Me.includes(Tn)&&await Pr(Tn),wt&&wt.success!==!1?(G.success(`已保存:${c.title}`),u(null),ts(),On(),Ir()):G.error("保存失败: "+(wt&&typeof wt=="object"&&"error"in wt?wt.error:"未知错误"))}catch(V){console.error(V);const ue=V instanceof Error&&V.name==="AbortError"?"保存超时,请检查网络或稍后重试":"保存失败";G.error(ue)}finally{N(!1)}}},Aa=async()=>{if(!O.id||!O.title){G.error("请填写章节ID和标题");return}N(!0);try{const E=lt.find(ke=>ke.id===O.partId),V=E==null?void 0:E.chapters.find(ke=>ke.id===O.chapterId),ue=await Xt("/api/db/book",{id:O.id,title:O.title,price:O.isFree?0:O.price,content:O.content||"",partId:O.partId,partTitle:(E==null?void 0:E.title)??"",chapterId:O.chapterId,chapterTitle:(V==null?void 0:V.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:_1});if(ue&&ue.success!==!1){if(O.isPinned){const ke=[...Me,O.id];We(ke);try{await kt("/api/db/config",{key:"pinned_section_ids",value:ke,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"})}catch{}}G.success(`章节创建成功:${O.title}`),f(!1),U({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),ts(),On(),Ir()}else G.error("创建失败: "+(ue&&typeof ue=="object"&&"error"in ue?ue.error:"未知错误"))}catch(E){console.error(E),G.error("创建失败")}finally{N(!1)}},Ia=E=>{U(V=>{var ue;return{...V,partId:E.id,chapterId:((ue=E.chapters[0])==null?void 0:ue.id)??"chapter-1"}}),f(!0)},ri=E=>{z({id:E.id,title:E.title,badgeText:ja(E.badgeText)})},al=async()=>{var E;if((E=P==null?void 0:P.title)!=null&&E.trim()){Q(!0);try{const V=e.map(ke=>({id:ke.id,partId:ke.partId||"part-1",partTitle:ke.partId===P.id?P.title.trim():ke.partTitle||"",chapterId:ke.chapterId||"chapter-1",chapterTitle:ke.chapterTitle||""})),ue=await Xt("/api/db/book",{action:"reorder",items:V});if(ue&&ue.success!==!1){const ke=P.title.trim(),Ke={...Hi},mt=ja(P.badgeText);mt?Ke[P.id]=mt:delete Ke[P.id];const wt=await kt("/api/db/config",{key:"book_part_badges",value:Ke,description:"目录篇名角标(key=part_id, value=角标文案)"});if(wt&&wt.success===!1){G.error("更新篇名角标失败: "+(wt.error||"未知错误"));return}ta(Ke),n(Tn=>Tn.map(rs=>rs.partId===P.id?{...rs,partTitle:ke}:rs)),z(null),ts()}else G.error("更新篇名失败: "+(ue&&typeof ue=="object"&&"error"in ue?ue.error:"未知错误"))}catch(V){console.error(V),G.error("更新篇名失败")}finally{Q(!1)}}},ss=E=>{const V=E.chapters.length+1,ue=`chapter-${E.id}-${V}-${Date.now()}`;U({id:`${V}.1`,title:"新章节",price:1,partId:E.id,chapterId:ue,content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),f(!0)},sa=(E,V)=>{const ue=V.sections;let ke=1,Ke=!1,mt=!1;if(ue.length>0){const wt=typeof ue[0].price=="number"?ue[0].price:Number(ue[0].price)||1,Tn=!!(ue[0].isFree||wt===0);mt=ue.some(rs=>{const jn=typeof rs.price=="number"?rs.price:Number(rs.price)||1,ys=!!(rs.isFree||jn===0);return jn!==wt||ys!==Tn}),ke=Tn?0:wt,Ke=Tn}le({part:E,chapter:V,title:V.title,price:ke,isFree:Ke,priceMixed:mt,initialTitle:V.title,initialPrice:ke,initialIsFree:Ke})},il=async()=>{var Ke;if(!((Ke=ie==null?void 0:ie.title)!=null&&Ke.trim()))return;const E=ie,V=E.title.trim(),ue=V!==E.initialTitle,ke=E.isFree!==E.initialIsFree||!E.isFree&&Number(E.price)!==Number(E.initialPrice);if(!ue&&!ke){G.info("未修改任何内容"),le(null);return}if(E.priceMixed&&ke){const mt=E.chapter.sections.length,wt=E.isFree?"全部设为免费":`全部设为 ¥${E.price}`;if(!confirm(`本章 ${mt} 节当前定价不一致,保存后将${wt},确定?`))return}I(!0);try{if(ue){const mt=e.map(jn=>({id:jn.id,partId:jn.partId||E.part.id,partTitle:jn.partId===E.part.id?E.part.title:jn.partTitle||"",chapterId:jn.chapterId||E.chapter.id,chapterTitle:jn.partId===E.part.id&&jn.chapterId===E.chapter.id?V:jn.chapterTitle||""})),wt=await Xt("/api/db/book",{action:"reorder",items:mt});if(wt&&wt.success===!1){G.error("保存章节名失败: "+(wt&&typeof wt=="object"&&"error"in wt?wt.error:"未知错误"));return}const Tn=E.part.id,rs=E.chapter.id;n(jn=>jn.map(ys=>ys.partId===Tn&&ys.chapterId===rs?{...ys,chapterTitle:V}:ys))}if(ke){const mt=await Xt("/api/db/book",{action:"update-chapter-pricing",partId:E.part.id,chapterId:E.chapter.id,price:E.isFree?0:Number(E.price)||0,isFree:E.isFree});if(mt&&mt.success===!1){G.error("保存定价失败: "+(mt&&typeof mt=="object"&&"error"in mt?mt.error:"未知错误")),ue&&ts();return}}le(null),ts(),G.success("已保存")}catch(mt){console.error(mt),G.error("保存失败")}finally{I(!1)}},ai=async(E,V)=>{const ue=V.sections.map(ke=>ke.id);if(ue.length===0){G.info("该章下无小节,无需删除");return}if(confirm(`确定要删除「第${E.chapters.indexOf(V)+1}章 | ${V.title}」吗?将删除共 ${ue.length} 节,此操作不可恢复。`))try{for(const ke of ue)await Ci(`/api/db/book?id=${encodeURIComponent(ke)}`);ts()}catch(ke){console.error(ke),G.error("删除失败")}},xd=async()=>{if(!q.trim()){G.error("请输入篇名");return}re(!0);try{const E=`part-new-${Date.now()}`,V="chapter-1",ue=`part-placeholder-${Date.now()}`,ke=await Xt("/api/db/book",{id:ue,title:"占位节(可编辑)",price:0,content:"",partId:E,partTitle:q.trim(),chapterId:V,chapterTitle:"第1章 | 待编辑",saveToFile:!1});ke&&ke.success!==!1?(G.success(`篇「${q}」创建成功`),$(!1),_(""),ts()):G.error("创建失败: "+(ke&&typeof ke=="object"&&"error"in ke?ke.error:"未知错误"))}catch(E){console.error(E),G.error("创建失败")}finally{re(!1)}},ol=async()=>{if(Y.length===0){G.error("请先勾选要移动的章节");return}const E=lt.find(ue=>ue.id===B),V=E==null?void 0:E.chapters.find(ue=>ue.id===fe);if(!E||!V||!B||!fe){G.error("请选择目标篇和章");return}D(!0);try{const ue=()=>{const wt=new Set(Y),Tn=e.map(Dn=>({id:Dn.id,partId:Dn.partId||"",partTitle:Dn.partTitle||"",chapterId:Dn.chapterId||"",chapterTitle:Dn.chapterTitle||""})),rs=Tn.filter(Dn=>wt.has(Dn.id)).map(Dn=>({...Dn,partId:B,partTitle:E.title||B,chapterId:fe,chapterTitle:V.title||fe})),jn=Tn.filter(Dn=>!wt.has(Dn.id));let ys=jn.length;for(let Dn=jn.length-1;Dn>=0;Dn-=1){const oc=jn[Dn];if(oc.partId===B&&oc.chapterId===fe){ys=Dn+1;break}}return[...jn.slice(0,ys),...rs,...jn.slice(ys)]},ke=async()=>{const wt=ue(),Tn=await Xt("/api/db/book",{action:"reorder",items:wt});return Tn&&Tn.success!==!1?(G.success(`已移动 ${Y.length} 节到「${E.title}」-「${V.title}」`),X(!1),F([]),await ts(),!0):!1},Ke={action:"move-sections",sectionIds:Y,targetPartId:B,targetChapterId:fe,targetPartTitle:E.title||B,targetChapterTitle:V.title||fe},mt=await Xt("/api/db/book",Ke);if(mt&&mt.success!==!1)G.success(`已移动 ${mt.count??Y.length} 节到「${E.title}」-「${V.title}」`),X(!1),F([]),await ts();else{const wt=mt&&typeof mt=="object"&&"error"in mt?mt.error||"":"未知错误";if((wt.includes("缺少 id")||wt.includes("无效的 action"))&&await ke())return;G.error("移动失败: "+wt)}}catch(ue){console.error(ue),G.error("移动失败: "+(ue instanceof Error?ue.message:"网络或服务异常"))}finally{D(!1)}},ll=E=>{F(V=>V.includes(E)?V.filter(ue=>ue!==E):[...V,E])},ii=async E=>{const V=e.filter(ue=>ue.partId===E.id).map(ue=>ue.id);if(V.length===0){G.info("该篇下暂无小节可删除");return}if(confirm(`确定要删除「${E.title}」整篇吗?将删除共 ${V.length} 节内容,此操作不可恢复。`))try{for(const ue of V)await Ci(`/api/db/book?id=${encodeURIComponent(ue)}`);ts()}catch(ue){console.error(ue),G.error("删除失败")}},Rr=async()=>{var E;if(j.trim()){R(!0);try{const V=await Oe(`/api/search?q=${encodeURIComponent(j)}`);V!=null&&V.success&&((E=V.data)!=null&&E.results)?T(V.data.results):(T([]),V&&!V.success&&G.error("搜索失败: "+V.error))}catch(V){console.error(V),T([]),G.error("搜索失败")}finally{R(!1)}}},Lr=lt.find(E=>E.id===O.partId),qi=(Lr==null?void 0:Lr.chapters)??[];return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"内容管理"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",lt.length," 篇 · ",Ui," 节内容"]})]}),s.jsx("div",{className:"flex gap-2",children:s.jsxs(J,{onClick:()=>pt(!0),variant:"outline",className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:[s.jsx(Hh,{className:"w-4 h-4 mr-2"}),"排名算法"]})})]}),s.jsx(Dt,{open:h,onOpenChange:f,children:s.jsxs(Ot,{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(_t,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx($n,{className:"w-5 h-5 text-[#38bdac]"}),"新建章节"]})}),s.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"章节ID *"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 9.15",value:O.id,onChange:E=>U({...O,id:E.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"价格 (元)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:O.isFree?0:O.price,onChange:E=>U({...O,price:Number(E.target.value),isFree:Number(E.target.value)===0}),disabled:O.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"免费"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:O.isFree,onChange:E=>U({...O,isFree:E.target.checked,price:E.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"最新新增"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:O.isNew,onChange:E=>U({...O,isNew:E.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"小程序直推"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:O.isPinned,onChange:E=>U({...O,isPinned:E.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"文章类型"}),s.jsxs("div",{className:"flex items-center gap-4 h-10",children:[s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"new-edition-type",checked:O.editionPremium!==!0,onChange:()=>U({...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:()=>U({...O,editionStandard:!1,editionPremium:!0}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"增值版"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"热度分"}),s.jsx(ce,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:O.hotScore??0,onChange:E=>U({...O,hotScore:Math.max(0,parseFloat(E.target.value)||0)})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"章节标题 *"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入章节标题",value:O.title,onChange:E=>U({...O,title:E.target.value})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"所属篇"}),s.jsxs(wo,{value:O.partId,onValueChange:E=>{var ue;const V=lt.find(ke=>ke.id===E);U({...O,partId:E,chapterId:((ue=V==null?void 0:V.chapters[0])==null?void 0:ue.id)??"chapter-1"})},children:[s.jsx(Ei,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(jo,{})}),s.jsxs(Ti,{className:"bg-[#0f2137] border-gray-700",children:[lt.map(E=>s.jsx(cs,{value:E.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:E.title},E.id)),lt.length===0&&s.jsx(cs,{value:"part-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认篇"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"所属章"}),s.jsxs(wo,{value:O.chapterId,onValueChange:E=>U({...O,chapterId:E}),children:[s.jsx(Ei,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(jo,{})}),s.jsxs(Ti,{className:"bg-[#0f2137] border-gray-700",children:[qi.map(E=>s.jsx(cs,{value:E.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:E.title},E.id)),qi.length===0&&s.jsx(cs,{value:"chapter-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认章"})]})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),s.jsx(D0,{content:O.content||"",onChange:E=>U({...O,content:E}),onImageUpload:Vi,onMediaUpload:ei,persons:yt,linkTags:Pt,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(rn,{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:Aa,disabled:b||!O.id||!O.title,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:b?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx($n,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),s.jsx(Dt,{open:!!P,onOpenChange:E=>!E&&z(null),children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(sn,{className:"w-5 h-5 text-[#38bdac]"}),"编辑篇名"]})}),P&&s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"篇名"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:P.title,onChange:E=>z({...P,title:E.target.value}),placeholder:"输入篇名"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"左侧图标文字(可选)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:P.badgeText||"",onChange:E=>z({...P,badgeText:ja(E.target.value)}),placeholder:"例如:派 / 新 / 热",maxLength:8}),s.jsx("p",{className:"text-xs text-gray-500",children:"保存后会同步到目录左侧图标文字(小程序与管理端目录树)。"})]})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",onClick:()=>z(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(J,{onClick:al,disabled:L||!((cl=P==null?void 0:P.title)!=null&&cl.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:L?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Dt,{open:!!ie,onOpenChange:E=>!E&&le(null),children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsxs(_t,{children:[s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(sn,{className:"w-5 h-5 text-[#38bdac]"}),"章节设置"]}),s.jsx("p",{className:"text-gray-400 text-sm font-normal pt-1",children:"修改本章显示名称,或为本章下全部节设置统一金额(仍可在单节编辑里单独改某一节)。"})]}),ie&&s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"章节名称(如:第8章|底层结构)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:ie.title,onChange:E=>le({...ie,title:E.target.value}),placeholder:"输入章节名称"})]}),s.jsxs("div",{className:"space-y-2 border-t border-gray-700/60 pt-4",children:[s.jsxs(te,{className:"text-gray-300",children:["本章统一定价(应用于本章全部 ",ie.chapter.sections.length," 节)"]}),ie.priceMixed&&s.jsx("p",{className:"text-amber-400/90 text-xs",children:"当前各节定价不一致,保存后将按下方设置全部统一。"}),s.jsxs("div",{className:"flex flex-wrap items-end gap-4",children:[s.jsxs("div",{className:"space-y-1 flex-1 min-w-[120px]",children:[s.jsx("span",{className:"text-gray-500 text-xs",children:"价格 (元)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:ie.isFree?0:ie.price,onChange:E=>le({...ie,price:Number(E.target.value),isFree:Number(E.target.value)===0}),disabled:ie.isFree,min:0,step:.01})]}),s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer pb-2",children:[s.jsx("input",{type:"checkbox",checked:ie.isFree||ie.price===0,onChange:E=>le({...ie,isFree:E.target.checked,price:E.target.checked?0:ie.initialPrice>0?ie.initialPrice:1}),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac]"}),s.jsx("span",{className:"text-gray-400 text-sm",children:"本章全部免费"})]})]})]})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",onClick:()=>le(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(J,{onClick:il,disabled:me||!((dl=ie==null?void 0:ie.title)!=null&&dl.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:me?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Dt,{open:ge,onOpenChange:E=>{var V;if(X(E),E&<.length>0){const ue=lt[0];W(ue.id),he(((V=ue.chapters[0])==null?void 0:V.id)??"")}},children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsx($t,{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:Y.length})," 节,请选择目标篇与章。"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"目标篇"}),s.jsxs(wo,{value:B,onValueChange:E=>{var ue;W(E);const V=lt.find(ke=>ke.id===E);he(((ue=V==null?void 0:V.chapters[0])==null?void 0:ue.id)??"")},children:[s.jsx(Ei,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(jo,{placeholder:"选择篇"})}),s.jsx(Ti,{className:"bg-[#0f2137] border-gray-700",children:lt.map(E=>s.jsx(cs,{value:E.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:E.title},E.id))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"目标章"}),s.jsxs(wo,{value:fe,onValueChange:he,children:[s.jsx(Ei,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(jo,{placeholder:"选择章"})}),s.jsx(Ti,{className:"bg-[#0f2137] border-gray-700",children:(((oi=lt.find(E=>E.id===B))==null?void 0:oi.chapters)??[]).map(E=>s.jsx(cs,{value:E.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:E.title},E.id))})]})]})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",onClick:()=>X(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(J,{onClick:ol,disabled:de||Y.length===0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:de?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"移动中..."]}):"确认移动"})]})]})}),s.jsx(Dt,{open:!!we,onOpenChange:E=>!E&&Fe(null),children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white",children:["付款记录 — ",(we==null?void 0:we.section.title)??""]})}),s.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:Ue?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):we&&we.orders.length===0?s.jsx("p",{className:"text-gray-500 text-center py-6",children:"暂无付款记录"}):we?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:we.orders.map(E=>s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("td",{className:"py-2 pr-2",children:s.jsx("button",{className:"text-blue-400 hover:text-blue-300 hover:underline text-left truncate max-w-[180px] block",title:`查看订单 ${E.orderSn}`,onClick:()=>window.open(`/orders?search=${E.orderSn??E.id??""}`,"_blank"),children:E.orderSn?E.orderSn.length>16?E.orderSn.slice(0,8)+"..."+E.orderSn.slice(-6):E.orderSn:"-"})}),s.jsx("td",{className:"py-2 pr-2",children:s.jsx("button",{className:"text-[#38bdac] hover:text-[#2da396] hover:underline text-left truncate max-w-[140px] block",title:`查看用户 ${E.userId??E.openId??""}`,onClick:()=>window.open(`/users?search=${E.userId??E.openId??""}`,"_blank"),children:(()=>{const V=E.userId??E.openId??"-";return V.length>12?V.slice(0,6)+"..."+V.slice(-4):V})()})}),s.jsxs("td",{className:"py-2 pr-2 text-gray-300",children:["¥",E.amount??0]}),s.jsx("td",{className:"py-2 pr-2 text-gray-300",children:E.status??"-"}),s.jsx("td",{className:"py-2 pr-2 text-gray-500",children:E.payTime??E.createdAt??"-"})]},E.id??E.orderSn??""))})]}):null})]})}),s.jsx(Dt,{open:Nn,onOpenChange:pt,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(Hh,{className:"w-5 h-5 text-amber-400"}),"文章排名算法"]})}),s.jsxs("div",{className:"space-y-4 py-2",children:[s.jsx("p",{className:"text-sm text-gray-400",children:"热度积分 = 阅读权重×阅读排名分 + 新度权重×新度排名分 + 付款权重×付款排名分(三权重之和须为 1)"}),Bn?s.jsx("p",{className:"text-gray-500",children:"加载中..."}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{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:It.readWeight,onChange:E=>hn(V=>({...V,readWeight:Math.max(0,Math.min(1,parseFloat(E.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{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:It.recencyWeight,onChange:E=>hn(V=>({...V,recencyWeight:Math.max(0,Math.min(1,parseFloat(E.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{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:It.payWeight,onChange:E=>hn(V=>({...V,payWeight:Math.max(0,Math.min(1,parseFloat(E.target.value)||0))}))})]})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["当前之和: ",(It.readWeight+It.recencyWeight+It.payWeight).toFixed(1)]}),s.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs text-gray-400",children:[s.jsx("li",{children:"阅读量前 20 名:第1名=20分、第2名=19分...第20名=1分"}),s.jsx("li",{children:"最近更新前 30 篇:第1名=30分、第2名=29分...第30名=1分"}),s.jsx("li",{children:"付款数前 20 名:第1名=20分、第2名=19分...第20名=1分"}),s.jsx("li",{children:"热度分可在编辑章节中手动覆盖"})]}),s.jsx(J,{onClick:Xs,disabled:Wt||Math.abs(It.readWeight+It.recencyWeight+It.payWeight-1)>.001,className:"w-full bg-amber-500 hover:bg-amber-600 text-white",children:Wt?"保存中...":"保存权重"})]})]})]})}),s.jsx(Dt,{open:se,onOpenChange:$,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx($n,{className:"w-5 h-5 text-amber-400"}),"新建篇"]})}),s.jsx("div",{className:"space-y-4 py-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"篇名(如:第六篇|真实的社会)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:q,onChange:E=>_(E.target.value),placeholder:"输入篇名"})]})}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",onClick:()=>{$(!1),_("")},className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(J,{onClick:xd,disabled:Z||!q.trim(),className:"bg-amber-500 hover:bg-amber-600 text-white",children:Z?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx($n,{className:"w-4 h-4 mr-2"}),"创建篇"]})})]})]})}),s.jsx(Dt,{open:!!c,onOpenChange:()=>u(null),children:s.jsxs(Ot,{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(_t,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(sn,{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(te,{className:"text-gray-300",children:"章节ID"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:c.id,onChange:E=>u({...c,id:E.target.value}),placeholder:"如: 9.15"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"价格 (元)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:c.isFree?0:c.price,onChange:E=>u({...c,price:Number(E.target.value),isFree:Number(E.target.value)===0}),disabled:c.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"免费"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:c.isFree||c.price===0,onChange:E=>u({...c,isFree:E.target.checked,price:E.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"预览%"}),s.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",placeholder:`全局 ${Ct}%`,value:c.previewPercent!=null?String(c.previewPercent):"",onChange:E=>{const V=E.target.value.trim();if(V===""){u({...c,previewPercent:null});return}const ue=Number(V);Number.isFinite(ue)&&u({...c,previewPercent:Math.min(100,Math.max(1,Math.round(ue)))})}})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"最新新增"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:c.isNew??!1,onChange:E=>u({...c,isNew:E.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"小程序直推"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:c.isPinned??!1,onChange:E=>u({...c,isPinned:E.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"文章类型"}),s.jsxs("div",{className:"flex items-center gap-4 h-10",children:[s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"edition-type",checked: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(te,{className:"text-gray-300",children:"热度分"}),s.jsx(ce,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:c.hotScore??0,onChange:E=>u({...c,hotScore:Math.max(0,parseFloat(E.target.value)||0)})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"章节标题"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:c.title,onChange:E=>u({...c,title:E.target.value})})]}),c.filePath&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{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(te,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),m?s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700 rounded-md min-h-[400px] flex items-center justify-center",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(D0,{ref:rc,content:c.content||"",onChange:E=>u({...c,content:E}),onImageUpload:Vi,onMediaUpload:ei,persons:yt,linkTags:Pt,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(rn,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[c&&s.jsxs(J,{variant:"outline",onClick:()=>nr({id:c.id,title:c.title,price:c.price}),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent mr-auto",children:[s.jsx(dr,{className:"w-4 h-4 mr-2"}),"付款记录"]}),s.jsxs(J,{variant:"outline",onClick:()=>u(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(Xn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsx(J,{onClick:na,disabled:b,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:b?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),s.jsxs(Yc,{defaultValue:"chapters",className:"space-y-6",children:[s.jsxs(Vl,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(en,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(dr,{className:"w-4 h-4 mr-2"}),"章节管理"]}),s.jsxs(en,{value:"ranking",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(Wx,{className:"w-4 h-4 mr-2"}),"内容排行榜"]}),s.jsxs(en,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(pa,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),s.jsxs(en,{value:"link-person",className:"data-[state=active]:bg-purple-500/20 data-[state=active]:text-purple-400 text-gray-400",children:[s.jsx(Mi,{className:"w-4 h-4 mr-2"}),"@列表"]}),s.jsxs(en,{value:"link-tag",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(R1,{className:"w-4 h-4 mr-2"}),"链接标签"]})]}),s.jsxs(tn,{value:"chapters",className:"space-y-4",children:[s.jsxs("div",{className:"rounded-2xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between shadow-sm",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac] flex items-center justify-center text-white shadow-lg shadow-[#38bdac]/20 shrink-0",children:s.jsx(dr,{className:"w-6 h-6"})}),s.jsxs("div",{children:[s.jsx("h2",{className:"font-bold text-base text-white leading-tight mb-1",children:"一场SOUL的创业实验场"}),s.jsx("p",{className:"text-xs text-gray-500",children:"来自Soul派对房的真实商业故事"})]})]}),s.jsxs("div",{className:"text-center shrink-0",children:[s.jsx("span",{className:"block text-2xl font-bold text-[#38bdac]",children:Ui}),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($n,{className:"w-4 h-4 mr-2"}),"新建章节"]}),s.jsxs(J,{onClick:()=>$(!0),className:"flex-1 min-w-[120px] bg-amber-500/10 hover:bg-amber-500/20 text-amber-400 border border-amber-500/30",children:[s.jsx($n,{className:"w-4 h-4 mr-2"}),"新建篇"]}),s.jsxs(J,{variant:"outline",onClick:()=>X(!0),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:["批量移动(已选 ",Y.length," 节)"]})]}),r?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(cV,{parts:lt,expandedParts:i,onTogglePart:Wi,onReorder:xr,onReadSection:si,onDeleteSection:Ys,onAddSectionInPart:Ia,onAddChapterInPart:ss,onDeleteChapter:ai,onEditPart:ri,onDeletePart:ii,onEditChapter:sa,selectedSectionIds:Y,onToggleSectionSelect:ll,onShowSectionOrders:nr,pinnedSectionIds:Me})]}),s.jsx(tn,{value:"search",className:"space-y-4",children:s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(ut,{children:s.jsx(ht,{className:"text-white",children:"内容搜索"})}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",placeholder:"搜索标题或内容...",value:j,onChange:E=>v(E.target.value),onKeyDown:E=>E.key==="Enter"&&Rr()}),s.jsx(J,{onClick:Rr,disabled:C||!j.trim(),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:C?s.jsx(He,{className:"w-4 h-4 animate-spin"}):s.jsx(pa,{className:"w-4 h-4"})})]}),k.length>0&&s.jsxs("div",{className:"space-y-2 mt-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["找到 ",k.length," 个结果"]}),k.map(E=>s.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors",onClick:()=>{const V=e.find(ue=>ue.id===E.id);si({id:E.id,mid:E.mid,title:E.title,price:E.price??1,filePath:"",previewPercent:V==null?void 0:V.previewPercent})},children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[#38bdac] font-mono text-xs",children:E.id}),s.jsx("span",{className:"text-white",children:E.title}),Me.includes(E.id)&&s.jsx(Bc,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})]}),s.jsx(Be,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:E.matchType==="title"?"标题匹配":"内容匹配"})]}),E.snippet&&s.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:E.snippet}),(E.partTitle||E.chapterTitle)&&s.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[E.partTitle," · ",E.chapterTitle]})]},E.id))]})]})]})}),s.jsxs(tn,{value:"ranking",className:"space-y-4",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs(ht,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Hh,{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(te,{className:"text-gray-400 text-sm whitespace-nowrap",children:"未付费预览比例"}),s.jsx(ce,{type:"number",min:"1",max:"100",className:"bg-[#0a1628] border-gray-700 text-white w-20",value:Ct,onChange:E=>$e(Math.max(1,Math.min(100,Number(E.target.value)||20))),disabled:H}),s.jsx("span",{className:"text-gray-500 text-sm",children:"%"})]}),s.jsx(J,{size:"sm",onClick:rl,disabled:vt,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:vt?"保存中...":"保存"}),s.jsxs("span",{className:"text-xs text-gray-500",children:["小程序未付费用户默认显示文章前 ",Ct,"% 内容"]})]})})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs(ht,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Wx,{className:"w-4 h-4 text-amber-400"}),"内容排行榜",s.jsxs("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["按热度排行 · 共 ",es.length," 节"]})]}),s.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>gr(),disabled:yn,className:"text-gray-400 hover:text-white h-7 w-7 p-0",title:"刷新排行榜",children:s.jsx(He,{className:`w-4 h-4 ${yn?"animate-spin":""}`})}),s.jsx(J,{variant:"ghost",size:"sm",disabled:En<=1||yn,onClick:()=>Vn(E=>Math.max(1,E-1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(w5,{className:"w-4 h-4"})}),s.jsxs("span",{className:"text-gray-400 min-w-[60px] text-center",children:[En," / ",ni]}),s.jsx(J,{variant:"ghost",size:"sm",disabled:En>=ni||yn,onClick:()=>Vn(E=>Math.min(ni,E+1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(Cl,{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:"编辑"})]}),nl.map((E,V)=>{const ue=(En-1)*ti+V+1,ke=E.isPinned??Me.includes(E.id);return s.jsxs("div",{className:`grid grid-cols-[40px_40px_1fr_80px_80px_80px_60px] gap-2 px-3 py-2.5 items-center border-b border-gray-700/30 hover:bg-[#162840] transition-colors ${ke?"bg-amber-500/5":""}`,children:[s.jsx("span",{className:`text-sm font-bold ${ue<=3?"text-amber-400":"text-gray-500"}`,children:ue<=3?["🥇","🥈","🥉"][ue-1]:`#${ue}`}),s.jsx(J,{variant:"ghost",size:"sm",className:`h-6 w-6 p-0 ${ke?"text-amber-400":"text-gray-600 hover:text-amber-400"}`,onClick:()=>Pr(E.id),disabled:at,title:ke?"取消置顶":"强制置顶(精选推荐/首页最新更新)",children:ke?s.jsx(Bc,{className:"w-3.5 h-3.5 fill-current"}):s.jsx(O1,{className:"w-3.5 h-3.5"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"text-white text-sm truncate block",children:E.title}),s.jsxs("span",{className:"text-gray-600 text-xs",children:[E.partTitle," · ",E.chapterTitle]})]}),s.jsx("span",{className:"text-right text-sm text-blue-400 font-mono",children:E.clickCount??0}),s.jsx("span",{className:"text-right text-sm text-green-400 font-mono",children:E.payCount??0}),s.jsx("span",{className:"text-right text-sm text-amber-400 font-mono",children:(E.hotScore??0).toFixed(1)}),s.jsx("div",{className:"text-right",children:s.jsx(J,{variant:"ghost",size:"sm",className:"text-gray-500 hover:text-[#38bdac] h-6 px-1",onClick:()=>si({id:E.id,mid:E.mid,title:E.title,price:E.price,filePath:"",previewPercent:E.previewPercent}),title:"编辑文章",children:s.jsx(sn,{className:"w-3 h-3"})})})]},E.id)}),nl.length===0&&s.jsx("div",{className:"py-8 text-center text-gray-500",children:"暂无数据"})]})})]})]}),s.jsxs(tn,{value:"link-person",className:"space-y-4",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"pb-3",children:[s.jsxs(ht,{className:"text-white text-base flex items-center gap-2",children:[s.jsx("span",{className:"text-[#38bdac] text-lg font-bold",children:"@"}),"AI列表 — @列表(编辑器内输入 @ 可链接)"]}),s.jsxs("div",{className:"text-xs text-gray-500 mt-1 space-y-1",children:[s.jsxs("p",{children:["文章 @ 存 ",s.jsx("span",{className:"text-gray-400",children:"token"}),";小程序点 @ 用 token 换存客宝密钥后加好友/拉群。"]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-purple-300",children:"超级个体"}),":开通且昵称合法会自动进本列表可 @;共用「超级个体拉群」统一获客计划(话术由技术侧在系统里配置,本页不填 plan/apiKey,避免误操作)。"]}),s.jsx("p",{children:"点「添加」新建的人物:每人单独一条存客宝计划(SOUL链接人与事-名称)。"})]})]}),s.jsxs(_e,{className:"space-y-3",children:[s.jsxs("div",{className:"flex justify-between items-center",children:[s.jsx("p",{className:"text-xs text-gray-500",children:"本页只管理可 @ 的人物列表"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(J,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 hover:bg-gray-700/50",onClick:()=>{On()},title:"刷新",children:s.jsx(He,{className:"w-4 h-4"})}),s.jsxs(J,{size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",onClick:()=>{Ya(null),Yr(!0)},children:[s.jsx($n,{className:"w-4 h-4 mr-2"}),"添加"]})]})]}),s.jsx("div",{className:"max-h-[400px] overflow-y-auto",children:yt.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:yt.map(E=>s.jsxs("tr",{className:"border-b border-gray-700/30 hover:bg-[#0a1628]/80",children:[s.jsx("td",{className:"py-2 px-3 text-gray-400 text-xs font-mono",title:"32位token",children:E.id}),s.jsx("td",{className:"py-2 px-3 truncate max-w-[96px]",children:s.jsx("button",{type:"button",className:"text-amber-400 hover:text-amber-300 hover:underline text-left",onClick:()=>{nn[E.id]&&Ca(E.id,E.name)},title:nn[E.id]?"点击查看获客详情":E.name,children:E.name})}),s.jsx("td",{className:"py-2 px-3",children:E.personSource==="vip_sync"?s.jsx("span",{className:"text-[10px] text-purple-300 bg-purple-500/15 px-1.5 py-0.5 rounded whitespace-nowrap",children:"超级个体"}):s.jsx("span",{className:"text-[10px] text-gray-500 bg-gray-500/10 px-1.5 py-0.5 rounded whitespace-nowrap",children:"手工"})}),s.jsx("td",{className:"py-2 px-3 text-xs",children:E.userId?s.jsxs("div",{className:"flex flex-col gap-0.5 items-start max-w-[100px]",children:[E.personSource==="vip_sync"&&s.jsx("span",{className:"text-[10px] text-purple-300/90 leading-tight",children:"已绑定超级个体"}),s.jsx("button",{type:"button",className:"text-[#38bdac] hover:underline truncate max-w-[96px] block text-left",title:`用户ID: ${E.userId}`,onClick:()=>t(`/users?search=${encodeURIComponent(E.userId||"")}`),children:E.name})]}):s.jsx("span",{className:"text-gray-600",children:"—"})}),(()=>{const V=nn[E.id]||0;return s.jsx("td",{className:`py-2 px-3 shrink-0 w-16 text-center text-xs font-bold cursor-pointer ${V>0?"text-green-400 hover:text-green-300 hover:underline":"text-gray-600"}`,title:V>0?"点击查看获客详情":"暂无获客",onClick:()=>{V>0&&Ca(E.id,E.name)},children:V})})(),s.jsx("td",{className:"py-2 px-3 text-white truncate max-w-[220px]",title:`planId: ${E.ckbPlanId??"-"}`,children:s.jsx("div",{className:"flex items-center gap-1.5",children:s.jsx("span",{className:"truncate",children:E.ckbPlanId?E.personSource==="vip_sync"?"超级个体拉群(统一计划)":`SOUL链接人与事-${E.name}`:"—"})})}),s.jsx("td",{className:"py-2 px-2 text-center",children:s.jsx(J,{type:"button",variant:"ghost",size:"sm",className:E.isPinned?"text-amber-400 hover:text-amber-300 h-7 px-2":"text-gray-500 hover:text-amber-400/90 h-7 px-2",title:E.isPinned?"取消小程序首页置顶":"设为小程序首页置顶(全局唯一)",onClick:()=>void ac(E,!E.isPinned),children:s.jsx(O1,{className:`w-3.5 h-3.5 ${E.isPinned?"fill-amber-400":""}`})})}),s.jsx("td",{className:"py-2 px-3 text-center",children:E.ckbPlanId?s.jsx("span",{className:"text-[10px] text-green-400 bg-green-400/10 px-1.5 py-0.5 rounded",children:"启用"}):s.jsx("span",{className:"text-[10px] text-gray-500 bg-gray-500/10 px-1.5 py-0.5 rounded",children:"未配置"})}),s.jsx("td",{className:"py-2 px-2",children:s.jsxs("div",{className:"flex items-center gap-0",children:[s.jsx(J,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-[#38bdac] h-6 px-2",title:"编辑",onClick:async()=>{try{const V=await uV(E.personId||"");if(V!=null&&V.success&&V.person){const ue=V.person;Ya({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 Ya(E),V!=null&&V.error&&G.error(V.error)}catch(V){console.error(V),Ya(E),G.error(V instanceof Error?V.message:"加载人物详情失败")}Yr(!0)},children:s.jsx(Ux,{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:()=>Ca(E.id,E.name),children:s.jsx(Un,{className:"w-3 h-3"})}),s.jsx(J,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",title:E.personSource==="vip_sync"?"删除本地 @人物(不删统一获客计划)":"删除(同时删除存客宝对应获客计划)",onClick:()=>Ar(E),children:s.jsx(Xn,{className:"w-3 h-3"})})]})})]},E.id))})]}):s.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无AI人物,添加后可在编辑器中 @链接"})})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"pb-3",children:[s.jsxs(ht,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(fA,{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(te,{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(te,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"pb-3",children:[s.jsxs(ht,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(Hh,{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(te,{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:ea,onChange:E=>wa(E.target.value)})]}),s.jsxs(J,{size:"sm",className:"bg-blue-500 hover:bg-blue-600 text-white h-8",onClick:async()=>{const E=ea.trim();try{const V=await kt("/api/db/config",{key:"ckb_lead_webhook_url",value:E,description:"获客线索 Webhook 通知 URL(企微/飞书)"});V!=null&&V.success?G.success(E?"Webhook 已保存":"Webhook 已清除"):G.error((V==null?void 0:V.error)??"保存失败")}catch{G.error("保存失败")}},children:[s.jsx(Cn,{className:"w-3.5 h-3.5 mr-1"}),"保存"]})]}),s.jsx("p",{className:"text-xs text-gray-500",children:"配置企业微信或飞书群机器人 Webhook URL,获客成功后自动推送通知"})]})]})]}),s.jsxs(tn,{value:"link-tag",className:"space-y-4",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"pb-3",children:[s.jsxs(ht,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(R1,{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(te,{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:qs,onChange:E=>{pr(E.target.value),Jr(1)}})]}),s.jsx(J,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 hover:bg-gray-700/50 h-8",onClick:()=>{Ir(),yr()},title:"刷新",children:s.jsx(He,{className:"w-4 h-4"})})]}),s.jsxs(J,{size:"sm",className:"bg-amber-500 hover:bg-amber-600 text-white h-8",onClick:()=>{ve(null),Nt({tagId:"",label:"",aliases:"",url:"",type:"url",appId:"",appSecret:"",pagePath:""}),er(""),tr(!1),_s(!0)},children:[s.jsx($n,{className:"w-4 h-4 mr-2"}),"添加标签"]})]}),s.jsxs("div",{className:"rounded-md border border-gray-700/50 overflow-hidden",children:[s.jsx("div",{className:"max-h-[420px] overflow-y-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{className:"bg-[#0a1628] border-b border-gray-700/50",children:s.jsxs("tr",{children:[s.jsx("th",{className:"text-left px-3 py-2 text-gray-400 w-32",children:"标签"}),s.jsx("th",{className:"text-left px-3 py-2 text-gray-400 w-28",children:"别名"}),s.jsx("th",{className:"text-left px-3 py-2 text-gray-400 w-20",children:"类型"}),s.jsx("th",{className:"text-left px-3 py-2 text-gray-400",children:"目标 / AppID"}),s.jsx("th",{className:"text-right px-3 py-2 text-gray-400 w-28",children:"操作"})]})}),s.jsx("tbody",{children:hr?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:"加载中..."})}):wn.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:"暂无链接标签,添加后可在编辑器中使用 #标签 跳转"})}):wn.map(E=>s.jsxs("tr",{className:"border-b border-gray-700/30 hover:bg-white/5",children:[s.jsx("td",{className:"px-3 py-2",children:s.jsxs("button",{type:"button",className:"text-amber-400 font-semibold hover:text-amber-300 hover:underline text-left",onClick:()=>{ve(E),Nt({tagId:E.id,label:E.label,aliases:E.aliases??"",url:E.url,type:E.type,appId:E.appId??"",appSecret:"",pagePath:E.pagePath??""}),er(E.appId??""),tr(!1),_s(!0)},title:"点击编辑标签",children:["#",E.label]})}),s.jsx("td",{className:"px-3 py-2 text-gray-500 text-xs truncate max-w-[120px]",title:E.aliases||"",children:E.aliases||"—"}),s.jsx("td",{className:"px-3 py-2",children:s.jsx(Be,{variant:"secondary",className:`text-[10px] ${E.type==="ckb"?"bg-green-500/20 text-green-300 border-green-500/30":E.type==="miniprogram"||E.type==="wxlink"?"bg-[#38bdac]/20 text-[#38bdac] border-[#38bdac]/30":"bg-gray-700 text-gray-300"}`,children:E.type==="url"?"网页":E.type==="ckb"?"存客宝":E.type==="wxlink"?"小程序链接":"小程序"})}),s.jsx("td",{className:"px-3 py-2 text-gray-300",children:E.type==="miniprogram"?s.jsxs("div",{className:"space-y-0.5",children:[(()=>{const V=Zs.find(ue=>ue.key===E.appId);return s.jsxs(s.Fragment,{children:[V&&s.jsx("div",{className:"text-xs text-white",children:V.name}),s.jsxs("div",{className:"text-xs font-mono text-[#38bdac]",children:["AppID: ",(V==null?void 0:V.appId)||E.appId||"—"]})]})})(),E.pagePath&&s.jsx("div",{className:"text-xs text-gray-500 font-mono",children:E.pagePath}),s.jsxs("div",{className:`text-xs ${E.hasAppSecret?"text-emerald-400/90":"text-amber-500/80"}`,children:["AppSecret:",E.hasAppSecret?"已保存(仅服务端)":"未配置"]})]}):E.type==="wxlink"?s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("div",{className:"text-xs text-[#38bdac] truncate max-w-[420px] font-mono",title:E.url,children:E.url||"—"}),s.jsx("div",{className:"text-[11px] text-gray-500",children:"小程序内点击 → web-view 打开 → 自动唤起目标小程序"})]}):E.url?s.jsxs("a",{href:E.url,target:"_blank",rel:"noreferrer",className:"text-blue-400 text-xs truncate max-w-[420px] hover:underline inline-flex items-center gap-1",children:[E.url," ",s.jsx(Do,{className:"w-3 h-3 shrink-0"})]}):s.jsx("span",{className:"text-gray-500 text-xs",children:"—"})}),s.jsx("td",{className:"px-3 py-2",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(J,{variant:"ghost",size:"sm",className:"text-gray-300 hover:text-white h-7 px-2",onClick:()=>{ve(E),Nt({tagId:E.id,label:E.label,aliases:E.aliases??"",url:E.url,type:E.type,appId:E.appId??"",appSecret:"",pagePath:E.pagePath??""}),er(E.appId??""),tr(!1),_s(!0)},title:"编辑",children:s.jsx(Ux,{className:"w-3 h-3"})}),s.jsx(J,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-7 px-2",onClick:async()=>{if(confirm(`确定要删除「#${E.label}」吗?`))try{const V=await Ci(`/api/db/link-tags?tagId=${encodeURIComponent(E.id)}`);V!=null&&V.success?(G.success("已删除"),Ir(),yr()):G.error((V==null?void 0:V.error)??"删除失败")}catch(V){console.error(V),G.error("删除失败")}},title:"删除",children:s.jsx(Xn,{className:"w-3 h-3"})})]})})]},E.id))})]})}),s.jsx(Us,{page:Gr,pageSize:va,total:Mr,totalPages:Qa,onPageChange:E=>Jr(E),onPageSizeChange:E=>{Tr(E),Jr(1)}})]})]})]}),s.jsx(Dt,{open:Gs,onOpenChange:_s,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg p-4 gap-3",children:[s.jsxs(_t,{className:"gap-1",children:[s.jsx($t,{className:"text-base",children:oe?"编辑链接标签":"添加链接标签"}),s.jsx(Qc,{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(te,{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:Xe.tagId,disabled:!!oe,onChange:E=>Nt(V=>({...V,tagId:E.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-300 text-sm",children:"显示文字"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"如 神仙团队",value:Xe.label,onChange:E=>Nt(V=>({...V,label:E.target.value}))})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-300 text-sm",children:"别名(多个用逗号分隔,同指向一个目标)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"如 团队招募, 团队合伙人",value:Xe.aliases,onChange:E=>Nt(V=>({...V,aliases:E.target.value}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 items-end",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-300 text-sm",children:"类型"}),s.jsxs(wo,{value:Xe.type,onValueChange:E=>Nt(V=>({...V,type:E})),children:[s.jsx(Ei,{className:"bg-[#0a1628] border-gray-700 text-white h-8",children:s.jsx(jo,{})}),s.jsxs(Ti,{className:"bg-[#0f2137] border-gray-700 text-white",children:[s.jsx(cs,{value:"url",children:"网页链接"}),s.jsx(cs,{value:"miniprogram",children:"小程序(API跳转)"}),s.jsx(cs,{value:"wxlink",children:"小程序链接(右上角复制)"}),s.jsx(cs,{value:"ckb",children:"存客宝"})]})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-300 text-sm",children:Xe.type==="url"?"URL地址":Xe.type==="ckb"?"存客宝计划URL":Xe.type==="wxlink"?"小程序链接":"小程序 mpKey / 微信 AppID"}),Xe.type==="wxlink"?s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"粘贴小程序右上角 ... → 复制链接 得到的 URL",value:Xe.url,onChange:E=>Nt(V=>({...V,url:E.target.value}))}):Xe.type==="miniprogram"&&Zs.length>0?s.jsxs("div",{ref:Ki,className:"relative",children:[s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"搜索名称或密钥",value:ns?br:Xe.appId,onChange:E=>{const V=E.target.value;er(V),tr(!0),Zs.some(ue=>ue.key===V)||Nt(ue=>({...ue,appId:V}))},onFocus:()=>{er(Xe.appId),tr(!0)},onBlur:()=>setTimeout(()=>tr(!1),150)}),ns&&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:Ta.length===0?s.jsx("div",{className:"px-3 py-2 text-gray-500 text-xs",children:"无匹配,可手动输入密钥"}):Ta.map(E=>s.jsxs("button",{type:"button",className:"w-full px-3 py-2 text-left text-sm text-white hover:bg-[#38bdac]/20 flex flex-col gap-0.5",onMouseDown:V=>{V.preventDefault(),Nt(ue=>({...ue,appId:E.key,pagePath:E.path||""})),er(""),tr(!1)},children:[s.jsx("span",{children:E.name}),s.jsx("span",{className:"text-xs text-gray-400 font-mono",children:E.key})]},E.key))})]}):s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:Xe.type==="url"?"https://...":Xe.type==="ckb"?"https://ckbapi.quwanzhi.com/...":"关联配置的 key,或直接填 wx 开头的 AppID",value:Xe.type==="url"||Xe.type==="ckb"?Xe.url:Xe.appId,onChange:E=>{Xe.type==="url"||Xe.type==="ckb"?Nt(V=>({...V,url:E.target.value})):Nt(V=>({...V,appId:E.target.value}))}})]})]}),Xe.type==="wxlink"&&s.jsx("p",{className:"text-[11px] text-amber-400/80 leading-snug px-0.5",children:"操作:打开目标小程序 → 右上角「...」→「复制链接」→ 粘贴到上面。小程序内点击此标签会在 web-view 中打开,微信自动唤起目标小程序,无需修改小程序版本。"}),Xe.type==="miniprogram"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{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:Xe.pagePath,onChange:E=>Nt(V=>({...V,pagePath:E.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{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:oe!=null&&oe.hasAppSecret?"已保存密钥,留空不改;填写则覆盖":"粘贴目标小程序 AppSecret",value:Xe.appSecret,onChange:E=>Nt(V=>({...V,appSecret:E.target.value}))}),s.jsx("p",{className:"text-[11px] text-gray-500 leading-snug",children:"与 AppID 成对落库;接口响应与小程序配置中均不会返回此字段。"})]})]})]}),s.jsxs(rn,{className:"gap-2 pt-1",children:[s.jsx(J,{variant:"outline",onClick:()=>_s(!1),className:"border-gray-600",children:"取消"}),s.jsx(J,{onClick:async()=>{const E={tagId:Xe.tagId.trim(),label:Xe.label.trim(),aliases:Xe.aliases.trim(),url:Xe.url.trim(),type:Xe.type,appId:Xe.appId.trim(),appSecret:Xe.appSecret.trim(),pagePath:Xe.pagePath.trim()};if(E.tagId){const V=E.tagId;if([...V].length>50){G.error("标签ID 最长 50 个字符");return}if(/[#,\n\r\t]/.test(V)){G.error("标签ID 不能含 #、逗号或换行");return}}if(!E.label){G.error("显示文字必填");return}E.type==="miniprogram"&&(E.url=""),E.type==="wxlink"&&(E.appId="",E.pagePath=""),Js(!0);try{const V=await kt("/api/db/link-tags",E);V!=null&&V.success?(G.success(oe?"已更新":"已添加"),_s(!1),Ir(),yr()):G.error((V==null?void 0:V.error)??"保存失败")}catch(V){console.error(V),G.error("保存失败")}finally{Js(!1)}},disabled:Zt,className:"bg-amber-500 hover:bg-amber-600 text-white",children:Zt?"保存中...":"保存"})]})]})})]})]}),s.jsx(xV,{open:Yo,onOpenChange:Yr,editingPerson:zi,onSubmit:async E=>{var ke;const V={personId:E.personId||E.name.toLowerCase().replace(/\s+/g,"_")+"_"+Date.now().toString(36),name:E.name,userId:E.boundUserId,aliases:E.aliases||void 0,label:E.label,ckbApiKey:E.ckbApiKey||void 0,greeting:E.greeting||void 0,tips:E.tips||void 0,remarkType:E.remarkType||void 0,remarkFormat:E.remarkFormat||void 0,addFriendInterval:E.addFriendInterval,startTime:E.startTime||void 0,endTime:E.endTime||void 0,deviceGroups:(ke=E.deviceGroups)!=null&&ke.trim()?E.deviceGroups.split(",").map(Ke=>parseInt(Ke.trim(),10)).filter(Ke=>!Number.isNaN(Ke)):void 0},ue=await kt("/api/db/persons",V);if(ue&&ue.success===!1){const Ke=ue;Ke.ckbResponse&&console.log("存客宝返回",Ke.ckbResponse);const mt=Ke.error||"操作失败";throw new Error(mt)}if(On(),G.success(zi?"已保存":"已添加"),ue!=null&&ue.ckbCreateResult&&Object.keys(ue.ckbCreateResult).length>0){const Ke=ue.ckbCreateResult;console.log("存客宝创建结果",Ke);const mt=Ke.planId??Ke.id,wt=mt!=null?[`planId: ${mt}`]:[];Ke.apiKey!=null&&wt.push("apiKey: ***"),G.info(wt.length?`存客宝创建结果:${wt.join(",")}`:"存客宝创建结果见控制台")}}}),s.jsx(Dt,{open:!!gs,onOpenChange:E=>{E||Ar(null)},children:s.jsxs(Ot,{showCloseButton:!0,className:"bg-[#0f2137] border-gray-700 text-white max-w-md p-4 gap-3",children:[s.jsxs(_t,{className:"gap-1",children:[s.jsx($t,{className:"text-white text-base",children:"确认删除"}),s.jsx(Qc,{className:"text-gray-400 text-sm leading-relaxed wrap-break-word",children:gs&&s.jsxs(s.Fragment,{children:[gs.personSource==="vip_sync"?s.jsxs(s.Fragment,{children:[s.jsxs("p",{children:["确定删除超级个体「",gs.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链接人与事-",gs.name,"」?将同时删除存客宝对应获客计划。"]})}),s.jsxs("p",{className:"mt-1.5",children:["二次确认:删除后无法恢复,文章中的 @",gs.name," 将无法正常跳转。"]})]})})]}),s.jsxs(rn,{className:"gap-2 sm:gap-2 pt-1",children:[s.jsx(J,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-300",onClick:()=>Ar(null),children:"取消"}),s.jsx(J,{variant:"destructive",size:"sm",className:"bg-red-600 hover:bg-red-700",onClick:async()=>{gs&&(await Ci(`/api/db/persons?personId=${gs.personId}`),Ar(null),On(),G.success("已删除"))},children:"确定删除"})]})]})}),s.jsx(Dt,{open:Fi,onOpenChange:Xr,children:s.jsxs(Ot,{className:"max-w-2xl bg-[#0f2137] border-gray-700",children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(Un,{className:"w-5 h-5 text-green-400"}),Bi," — 获客详情(共 ",qn," 条)"]})}),s.jsx("div",{className:"max-h-[450px] overflow-y-auto space-y-2",children:mr?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(He,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):$s.length===0?s.jsx("div",{className:"text-gray-500 text-sm py-8 text-center",children:"暂无获客记录"}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-[40px_1fr_90px_90px_70px_60px_110px] gap-2 px-3 py-1.5 text-xs text-gray-500 border-b border-gray-700/50",children:[s.jsx("span",{children:"#"}),s.jsx("span",{children:"昵称/姓名"}),s.jsx("span",{children:"手机"}),s.jsx("span",{children:"微信"}),s.jsx("span",{children:"来源"}),s.jsx("span",{children:"状态"}),s.jsx("span",{children:"时间"})]}),$s.map((E,V)=>s.jsxs("div",{className:"grid grid-cols-[40px_1fr_90px_90px_70px_60px_110px] gap-2 px-3 py-2 bg-[#0a1628] rounded text-sm",children:[s.jsx("span",{className:"text-gray-500 text-xs",children:(Zr-1)*20+V+1}),s.jsx("span",{className:"text-white truncate",children:E.nickname||E.name||E.userId||"-"}),s.jsx("span",{className:"text-gray-300 text-xs",children:E.phone||"-"}),s.jsx("span",{className:"text-gray-300 text-xs truncate",children:E.wechatId||"-"}),s.jsx("span",{className:"text-xs",children:E.source==="article_mention"?s.jsx("span",{className:"text-purple-400",children:"文章@"}):E.source==="index_lead"?s.jsx("span",{className:"text-blue-400",children:"首页"}):s.jsx("span",{className:"text-gray-500",children:E.source||"-"})}),s.jsx("span",{className:"text-[10px]",children:s.jsx("span",{className:"text-green-400 bg-green-400/10 px-1 py-0.5 rounded",children:"已添加"})}),s.jsx("span",{className:"text-gray-500 text-xs",children:E.createdAt?new Date(E.createdAt).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"-"})]},E.id))]})}),qn>20&&s.jsxs("div",{className:"flex items-center justify-center gap-2 pt-2",children:[s.jsx(J,{size:"sm",variant:"outline",disabled:Zr<=1,onClick:()=>Ca(Na,Bi,Zr-1),className:"border-gray-600 text-gray-300 bg-transparent h-7 px-3",children:"上一页"}),s.jsxs("span",{className:"text-gray-400 text-xs",children:[Zr," / ",Math.ceil(qn/20)]}),s.jsx(J,{size:"sm",variant:"outline",disabled:Zr>=Math.ceil(qn/20),onClick:()=>Ca(Na,Bi,Zr+1),className:"border-gray-600 text-gray-300 bg-transparent h-7 px-3",children:"下一页"})]})]})})]})}const ki={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 Nj(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):ki.stats}function wj(t){return Array.isArray(t)?t.map(e=>typeof e=="string"?e:String(e??"")).filter(Boolean):ki.highlights}function vV(){const[t,e]=y.useState(ki),[n,r]=y.useState(!0),[a,i]=y.useState(!1),[o,c]=y.useState(!1),u=y.useRef(null);y.useEffect(()=>{Oe("/api/admin/author-settings").then(k=>{const T=k==null?void 0:k.data;T&&typeof T=="object"&&e({name:String(T.name??ki.name),avatar:String(T.avatar??ki.avatar),avatarImg:String(T.avatarImg??""),title:String(T.title??ki.title),bio:String(T.bio??ki.bio),stats:Nj(T.stats).length?Nj(T.stats):ki.stats,highlights:wj(T.highlights).length?wj(T.highlights):ki.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)},T=await kt("/api/admin/author-settings",k);if(!T||T.success===!1){G.error("保存失败: "+(T&&typeof T=="object"&&"error"in T?T.error:""));return}i(!1);const C=document.createElement("div");C.className="fixed top-4 right-4 z-50 px-4 py-2 rounded-lg bg-[#38bdac] text-white text-sm shadow-lg",C.textContent="作者设置已保存",document.body.appendChild(C),setTimeout(()=>C.remove(),2e3)}catch(k){console.error(k),G.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{i(!1)}},f=async k=>{var C;const T=(C=k.target.files)==null?void 0:C[0];if(T){c(!0);try{const R=new FormData;R.append("file",T),R.append("folder","avatars");const O=$u(),U={};O&&(U.Authorization=`Bearer ${O}`);const z=await(await fetch(zl("/api/upload"),{method:"POST",body:R,credentials:"include",headers:U})).json();z!=null&&z.success&&(z!=null&&z.url)?e(L=>({...L,avatarImg:z.url})):G.error("上传失败: "+((z==null?void 0:z.error)||"未知错误"))}catch(R){console.error(R),G.error("上传失败")}finally{c(!1),u.current&&(u.current.value="")}}},m=()=>e(k=>({...k,stats:[...k.stats,{label:"",value:""}]})),g=k=>e(T=>({...T,stats:T.stats.filter((C,R)=>R!==k)})),b=(k,T,C)=>e(R=>({...R,stats:R.stats.map((O,U)=>U===k?{...O,[T]:C}:O)})),N=()=>e(k=>({...k,highlights:[...k.highlights,""]})),j=k=>e(T=>({...T,highlights:T.highlights.filter((C,R)=>R!==k)})),v=(k,T)=>e(C=>({...C,highlights:C.highlights.map((R,O)=>O===k?T: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(Si,{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(Cn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"flex items-center gap-2 text-white",children:[s.jsx(Si,{className:"w-4 h-4 text-[#38bdac]"}),"基本信息"]}),s.jsx(qt,{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(te,{className:"text-gray-300",children:"姓名"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.name,onChange:k=>e(T=>({...T,name:k.target.value})),placeholder:"卡若"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"首字母占位(无头像时显示)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white w-20",value:t.avatar,onChange:k=>e(T=>({...T,avatar:k.target.value.slice(0,1)||"K"})),placeholder:"K"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(tk,{className:"w-3 h-3 text-[#38bdac]"}),"头像图片"]}),s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:t.avatarImg,onChange:k=>e(T=>({...T,avatarImg:k.target.value})),placeholder:"上传或粘贴 URL,如 /uploads/avatars/xxx.png"}),s.jsx("input",{ref:u,type:"file",accept:"image/*",className:"hidden",onChange:f}),s.jsxs(J,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:o,onClick:()=>{var k;return(k=u.current)==null?void 0:k.click()},children:[s.jsx(Mf,{className:"w-4 h-4 mr-2"}),o?"上传中...":"上传"]})]}),t.avatarImg&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:ma(t.avatarImg.startsWith("http")?t.avatarImg:zl(t.avatarImg)),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"头衔"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.title,onChange:k=>e(T=>({...T,title:k.target.value})),placeholder:"Soul派对房主理人 · 私域运营专家"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"个人简介"}),s.jsx(ec,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[120px]",value:t.bio,onChange:k=>e(T=>({...T,bio:k.target.value})),placeholder:"每天早上6点到9点..."})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsx(ht,{className:"text-white",children:"统计数据"}),s.jsx(qt,{className:"text-gray-400",children:"展示在作者卡片中的数字指标,如「商业案例 62」「连续直播 365天」。第一个「商业案例」的值可由书籍统计自动更新。"})]}),s.jsxs(_e,{className:"space-y-3",children:[t.stats.map((k,T)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.label,onChange:C=>b(T,"label",C.target.value),placeholder:"标签"}),s.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.value,onChange:C=>b(T,"value",C.target.value),placeholder:"数值"}),s.jsx(J,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>g(T),children:s.jsx(Xn,{className:"w-4 h-4"})})]},T)),s.jsxs(J,{variant:"outline",size:"sm",onClick:m,className:"border-gray-600 text-gray-400",children:[s.jsx($n,{className:"w-4 h-4 mr-2"}),"添加统计项"]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsx(ht,{className:"text-white",children:"亮点标签"}),s.jsx(qt,{className:"text-gray-400",children:"作者优势或成就的简短描述,以标签形式展示。"})]}),s.jsxs(_e,{className:"space-y-3",children:[t.highlights.map((k,T)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k,onChange:C=>v(T,C.target.value),placeholder:"5年私域运营经验"}),s.jsx(J,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>j(T),children:s.jsx(Xn,{className:"w-4 h-4"})})]},T)),s.jsxs(J,{variant:"outline",size:"sm",onClick:N,className:"border-gray-600 text-gray-400",children:[s.jsx($n,{className:"w-4 h-4 mr-2"}),"添加亮点"]})]})]})]})]})}function NV(t){return confirm(`确定删除该${t}?此操作不可恢复。`)?window.prompt(`请输入「删除」以确认删除${t}`)==="删除":!1}function wV(){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=Hl(h,300),[g,b]=y.useState(!0),[N,j]=y.useState(null),[v,k]=y.useState(!1),[T,C]=y.useState(null),[R,O]=y.useState(""),[U,P]=y.useState(""),[z,L]=y.useState(""),[Q,se]=y.useState("admin"),[$,ie]=y.useState("active"),[le,me]=y.useState(!1);async function I(){var W;b(!0),j(null);try{const fe=new URLSearchParams({page:String(a),pageSize:String(o)});m.trim()&&fe.set("search",m.trim());const he=await Oe(`/api/admin/users?${fe}`);he!=null&&he.success?(e(he.records||[]),r(he.total??0),u(he.totalPages??0)):j(he.error||"加载失败")}catch(fe){const he=fe;j(he.status===403?"无权限访问":((W=he==null?void 0:he.data)==null?void 0:W.error)||"加载失败"),e([])}finally{b(!1)}}y.useEffect(()=>{I()},[a,o,m]);const Y=()=>{C(null),O(""),P(""),L(""),se("admin"),ie("active"),k(!0)},F=W=>{C(W),O(W.username),P(""),L(W.name||""),se(W.role==="super_admin"?"super_admin":"admin"),ie(W.status==="disabled"?"disabled":"active"),k(!0)},ge=async()=>{var W;if(!R.trim()){j("用户名不能为空");return}if(!T&&!U){j("新建时密码必填,至少 6 位");return}if(U&&U.length<6){j("密码至少 6 位");return}j(null),me(!0);try{if(T){const fe=await Xt("/api/admin/users",{id:T.id,password:U||void 0,name:z.trim(),role:Q,status:$});fe!=null&&fe.success?(k(!1),I()):j((fe==null?void 0:fe.error)||"保存失败")}else{const fe=await kt("/api/admin/users",{username:R.trim(),password:U,name:z.trim(),role:Q});fe!=null&&fe.success?(k(!1),I()):j((fe==null?void 0:fe.error)||"保存失败")}}catch(fe){const he=fe;j(((W=he==null?void 0:he.data)==null?void 0:W.error)||"保存失败")}finally{me(!1)}},X=async W=>{var fe;if(!NV("管理员")){j("已取消删除");return}try{const he=await Ci(`/api/admin/users?id=${W}`);he!=null&&he.success?I():j((he==null?void 0:he.error)||"删除失败")}catch(he){const de=he;j(((fe=de==null?void 0:de.data)==null?void 0:fe.error)||"删除失败")}},B=W=>{if(!W)return"-";try{const fe=new Date(W);return isNaN(fe.getTime())?W:fe.toLocaleString("zh-CN")}catch{return W}};return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Fc,{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:W=>f(W.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:g,className:"border-gray-600 text-gray-300",children:s.jsx(He,{className:`w-4 h-4 ${g?"animate-spin":""}`})}),s.jsxs(J,{onClick:Y,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx($n,{className:"w-4 h-4 mr-2"}),"新增管理员"]})]})]}),N&&s.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 text-sm flex justify-between items-center",children:[s.jsx("span",{children:N}),s.jsx("button",{type:"button",onClick:()=>j(null),className:"text-red-400 hover:text-red-300",children:"×"})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-0",children:g?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(s.Fragment,{children:[s.jsxs(us,{children:[s.jsx(hs,{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(fs,{children:[t.map(W=>s.jsxs(xt,{className:"border-gray-700/50",children:[s.jsx(je,{className:"text-gray-300",children:W.id}),s.jsx(je,{className:"text-white font-medium",children:W.username}),s.jsx(je,{className:"text-gray-400",children:W.name||"-"}),s.jsx(je,{children:s.jsx(Be,{variant:"outline",className:W.role==="super_admin"?"border-amber-500/50 text-amber-400":"border-gray-600 text-gray-400",children:W.role==="super_admin"?"超级管理员":"管理员"})}),s.jsx(je,{children:s.jsx(Be,{variant:"outline",className:W.status==="active"?"border-[#38bdac]/50 text-[#38bdac]":"border-gray-500 text-gray-500",children:W.status==="active"?"正常":"已禁用"})}),s.jsx(je,{className:"text-gray-500 text-sm",children:B(W.createdAt)}),s.jsxs(je,{className:"text-right",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>F(W),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(sn,{className:"w-4 h-4"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>X(W.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(Yn,{className:"w-4 h-4"})})]})]},W.id)),t.length===0&&!g&&s.jsx(xt,{children:s.jsx(je,{colSpan:7,className:"text-center py-12 text-gray-500",children:N==="无权限访问"?"仅超级管理员可查看":"暂无管理员"})})]})]}),c>1&&s.jsx("div",{className:"p-4 border-t border-gray-700/50",children:s.jsx(Us,{page:a,pageSize:o,total:n,totalPages:c,onPageChange:i})})]})})}),s.jsx(Dt,{open:v,onOpenChange:k,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(_t,{children:s.jsx($t,{className:"text-white",children:T?"编辑管理员":"新增管理员"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"用户名"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"登录用户名",value:R,onChange:W=>O(W.target.value),disabled:!!T}),T&&s.jsx("p",{className:"text-xs text-gray-500",children:"用户名不可修改"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:T?"新密码(留空不改)":"密码"}),s.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:T?"留空表示不修改":"至少 6 位",value:U,onChange:W=>P(W.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"昵称"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"显示名称",value:z,onChange:W=>L(W.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"角色"}),s.jsxs("select",{value:Q,onChange:W=>se(W.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[s.jsx("option",{value:"admin",children:"管理员"}),s.jsx("option",{value:"super_admin",children:"超级管理员"})]})]}),T&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"状态"}),s.jsxs("select",{value:$,onChange:W=>ie(W.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[s.jsx("option",{value:"active",children:"正常"}),s.jsx("option",{value:"disabled",children:"禁用"})]})]})]}),s.jsxs(rn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>k(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(Xn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:ge,disabled:le,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),le?"保存中...":"保存"]})]})]})})]})}function In({method:t,url:e,desc:n,headers:r,bodyTitle:a,body:i,response:o}){const c=t==="GET"?"text-emerald-400":t==="POST"?"text-amber-400":t==="PUT"?"text-blue-400":t==="DELETE"?"text-rose-400":"text-gray-400";return s.jsxs("div",{className:"rounded-lg bg-[#0a1628]/60 border border-gray-700/50 p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:`font-mono font-semibold ${c}`,children:t}),s.jsx("code",{className:"text-sm text-[#38bdac] break-all",children:e})]}),n&&s.jsx("p",{className:"text-gray-400 text-sm",children:n}),r&&r.length>0&&s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"Headers"}),s.jsx("pre",{className:"text-xs text-gray-300 font-mono overflow-x-auto p-2 rounded bg-black/30",children:r.join(` -`)})]}),i&&s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:a??"Request Body (JSON)"}),s.jsx("pre",{className:"text-xs text-green-400/90 font-mono overflow-x-auto p-2 rounded bg-black/30 whitespace-pre-wrap",children:i})]}),o&&s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-xs mb-1",children:"Response Example"}),s.jsx("pre",{className:"text-xs text-amber-200/80 font-mono overflow-x-auto p-2 rounded bg-black/30 whitespace-pre-wrap",children:o})]})]})}function U4(){const t=["Authorization: Bearer {token}","Content-Type: application/json"];return s.jsxs("div",{className:"p-8 w-full bg-[#0a1628] text-white",children:[s.jsxs("div",{className:"mb-8",children:[s.jsx("h1",{className:"text-2xl font-bold text-white",children:"API 接口文档"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"内容管理相关接口 · RESTful · 基础路径 /api · 管理端需 Bearer Token"})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Vx,{className:"w-5 h-5 text-[#38bdac]"}),"1. Authentication"]})}),s.jsx(_e,{className:"space-y-4",children:s.jsx(In,{method:"POST",url:"/api/admin",desc:"登录,返回 JWT token",headers:["Content-Type: application/json"],body:`{ ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - "username": "admin", - "password": "your_password" -}`,response:`{ - "success": true, - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", - "expires_at": "2026-03-16T12:00:00Z" -}`})})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(fr,{className:"w-5 h-5 text-[#38bdac]"}),"2. 章节管理 (Chapters)"]})}),s.jsxs(_e,{className:"space-y-4",children:[s.jsx(Rn,{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(Rn,{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(Rn,{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(Rn,{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(Rn,{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(Rn,{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(Rn,{method:"DELETE",url:"/api/upload?path={encodeURIComponent(文件URL)}",desc:"按 URL 删除已上传文件(本地或 OSS,需与上传返回的 url 一致)",headers:["Authorization: Bearer {token}(建议携带)"],response:`{ - "success": true, - "message": "删除成功" -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js -}`})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Ci,{className:"w-5 h-5 text-[#38bdac]"}),"3. 人物管理 (@Mentions)"]})}),s.jsxs(_e,{className:"space-y-4",children:[s.jsx(Rn,{method:"GET",url:"/api/db/persons",desc:"人物列表",headers:t,response:`{ -======== -}`})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Si,{className:"w-5 h-5 text-[#38bdac]"}),"3. 人物管理 (@Mentions)"]})}),s.jsxs(_e,{className:"space-y-4",children:[s.jsx(In,{method:"GET",url:"/api/db/persons",desc:"人物列表",headers:t,response:`{ ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - "success": true, - "data": [ - { "personId": "p1", "label": "张三", "aliases": ["老张"], ... } - ] -}`}),s.jsx(Rn,{method:"GET",url:"/api/db/person?personId={id}",desc:"人物详情",headers:t,response:`{ - "success": true, - "data": { - "personId": "p1", - "label": "张三", - "aliases": ["老张"], - "description": "..." - } -}`}),s.jsx(Rn,{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(Rn,{method:"DELETE",url:"/api/db/persons?personId={id}",desc:"删除人物",headers:t,response:`{ - "success": true, - "message": "已删除" -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js -}`})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(du,{className:"w-5 h-5 text-[#38bdac]"}),"4. 链接标签 (#LinkTags)"]})}),s.jsxs(_e,{className:"space-y-4",children:[s.jsx(Rn,{method:"GET",url:"/api/db/link-tags",desc:"标签列表",headers:t,response:`{ -======== -}`})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(cu,{className:"w-5 h-5 text-[#38bdac]"}),"4. 链接标签 (#LinkTags)"]})}),s.jsxs(_e,{className:"space-y-4",children:[s.jsx(In,{method:"GET",url:"/api/db/link-tags",desc:"标签列表",headers:t,response:`{ ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - "success": true, - "data": [ - { "tagId": "t1", "label": "官网", "aliases": [], "type": "url", "url": "https://..." } - ] -}`}),s.jsx(Rn,{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(Rn,{method:"DELETE",url:"/api/db/link-tags?tagId={id}",desc:"删除标签",headers:t,response:`{ - "success": true, - "message": "已删除" -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js -}`})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(xa,{className:"w-5 h-5 text-[#38bdac]"}),"5. 内容搜索"]})}),s.jsx(_e,{className:"space-y-4",children:s.jsx(Rn,{method:"GET",url:"/api/search?q={keyword}",desc:"搜索(标题优先 3 条 + 内容匹配)",headers:t,response:`{ -======== -}`})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(pa,{className:"w-5 h-5 text-[#38bdac]"}),"5. 内容搜索"]})}),s.jsx(_e,{className:"space-y-4",children:s.jsx(In,{method:"GET",url:"/api/search?q={keyword}",desc:"搜索(标题优先 3 条 + 内容匹配)",headers:t,response:`{ ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - "success": true, - "data": { - "titleMatches": [{ "id": "s1", "title": "...", "snippet": "..." }], - "contentMatches": [{ "id": "s2", "title": "...", "snippet": "..." }] - } -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js -}`})})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Kx,{className:"w-5 h-5 text-[#38bdac]"}),"6. 内容排行"]})}),s.jsx(_e,{className:"space-y-4",children:s.jsx(Rn,{method:"GET",url:"/api/db/book?action=ranking",desc:"排行榜数据",headers:t,response:`{ -======== -}`})})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Wx,{className:"w-5 h-5 text-[#38bdac]"}),"6. 内容排行"]})}),s.jsx(_e,{className:"space-y-4",children:s.jsx(In,{method:"GET",url:"/api/db/book?action=ranking",desc:"排行榜数据",headers:t,response:`{ ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - "success": true, - "data": [ - { "id": "s1", "title": "...", "clickCount": 100, "payCount": 50, "hotScore": 120, "hotRank": 1 } - ] -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js -}`})})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(zl,{className:"w-5 h-5 text-[#38bdac]"}),"7. 小程序接口"]})}),s.jsxs(_e,{className:"space-y-4",children:[s.jsx(Rn,{method:"GET",url:"/api/miniprogram/config/read-extras",desc:"阅读页懒加载:linkTags、linkedMiniprograms、mentionPersons(@ 自动解析:name/label/aliases + token,与 persons 表一致;inPool 表示已绑定会员即超级个体侧流量池人物)",headers:["Content-Type: application/json"],response:`{ -======== -}`})})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(ut,{className:"pb-3",children:s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx($l,{className:"w-5 h-5 text-[#38bdac]"}),"7. 小程序接口"]})}),s.jsxs(_e,{className:"space-y-4",children:[s.jsx(In,{method:"GET",url:"/api/miniprogram/config/read-extras",desc:"阅读页懒加载:linkTags、linkedMiniprograms、mentionPersons(@ 自动解析:name/label/aliases + token,与 persons 表一致;inPool 表示已绑定会员即超级个体侧流量池人物)",headers:["Content-Type: application/json"],response:`{ ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js - "linkTags": [], - "linkedMiniprograms": [], - "mentionPersons": [ - { "personId": "xxx", "token": "32位...", "name": "陈周", "aliases": "", "label": "", "inPool": true } - ] -}`}),s.jsx(Rn,{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(Rn,{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(Rn,{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(Rn,{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 } -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js -}`})]})]}),s.jsx("p",{className:"text-gray-500 text-xs mt-6",children:"管理端主要使用 /api/admin/*、/api/db/*;富文本素材上传另用公共接口 /api/upload(与后台编辑器一致)。小程序使用 /api/miniprogram/*。完整实现见 soul-api 源码。"})]})}const Ii="/pages/member-detail/member-detail",us="/pages/read/read",dn="/app/global",un={[dn]:"全局(App 多页)",[Ii]:"成员详情",[us]:"文章详情 / 阅读"},Ix=[{value:dn,label:"全局(App 多页共用)"},{value:"/pages/index/index",label:"首页"},{value:"/pages/chapters/chapters",label:"目录"},{value:"/pages/match/match",label:"找伙伴"},{value:"/pages/my/my",label:"我的"},{value:"/pages/read/read",label:"文章详情 / 阅读"},{value:"/pages/link-preview/link-preview",label:"链接预览"},{value:"/pages/agreement/agreement",label:"用户协议"},{value:"/pages/privacy/privacy",label:"隐私政策"},{value:"/pages/referral/referral",label:"邀请"},{value:"/pages/purchases/purchases",label:"购买记录"},{value:"/pages/reading-records/reading-records",label:"阅读记录"},{value:"/pages/settings/settings",label:"设置"},{value:"/pages/search/search",label:"搜索"},{value:"/pages/addresses/addresses",label:"地址列表"},{value:"/pages/addresses/edit",label:"编辑地址"},{value:"/pages/withdraw-records/withdraw-records",label:"提现记录"},{value:"/pages/wallet/wallet",label:"钱包"},{value:"/pages/vip/vip",label:"会员中心"},{value:"/pages/member-detail/member-detail",label:"成员详情"},{value:"/pages/mentors/mentors",label:"导师列表"},{value:"/pages/mentor-detail/mentor-detail",label:"导师详情"},{value:"/pages/profile-show/profile-show",label:"资料展示"},{value:"/pages/profile-edit/profile-edit",label:"编辑资料"},{value:"/pages/avatar-nickname/avatar-nickname",label:"头像昵称"},{value:"/pages/gift-pay/detail",label:"礼物支付 · 详情"},{value:"/pages/gift-pay/list",label:"礼物支付 · 列表"},{value:"/pages/gift-pay/redemption-detail",label:"礼物支付 · 兑换详情"},{value:"/pages/dev-login/dev-login",label:"开发登录"}],SV=us;function Sj(t){const e=String(t.pageName??"").trim();return e||un[t.pagePath]||"—"}function CV(t){const e=String(t??"").trim();return e==="singlePage"||e==="single_page"?"singlePage":"fullApp"}function Cj(t){return t==="singlePage"?"单页面":"多页面"}function Ao(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`pp-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function fb(t){return/^[a-zA-Z][a-zA-Z0-9_]*$/.test(t.trim())}function EV(t){if(!t||typeof t!="object"||Array.isArray(t))return[];const e=t.pagePopupItems;if(!Array.isArray(e))return[];const n=[];return e.forEach(r=>{if(!r||typeof r!="object"||Array.isArray(r))return;const a=r,i=String(a.key??"").trim();if(!fb(i))return;const o=String(a.pagePath??"").trim();o.startsWith("/")&&n.push({id:typeof a.id=="string"&&a.id.trim()?a.id.trim():Ao(),pageName:String(a.pageName??"").trim(),pagePath:o,scope:CV(a.scope),key:i,behavior:String(a.behavior??"").trim()||"—",content:String(a.content??"")})}),n}function TV(t){if(!t||typeof t!="object"||Array.isArray(t))return[];const e=t,n=[],r=e.memberDetailPage;if(r&&typeof r=="object"&&!Array.isArray(r)){const o=r;typeof o.unlockIntroTitle=="string"&&o.unlockIntroTitle.trim()&&n.push({id:Ao(),pageName:un[Ii],pagePath:Ii,scope:"fullApp",key:"unlockIntroTitle",behavior:"解锁前说明弹窗 · 标题(wx.showModal title)",content:o.unlockIntroTitle}),typeof o.unlockIntroBody=="string"&&o.unlockIntroBody.trim()&&n.push({id:Ao(),pageName:un[Ii],pagePath:Ii,scope:"fullApp",key:"unlockIntroBody",behavior:"解锁前说明弹窗 · 正文(wx.showModal content)",content:o.unlockIntroBody})}const a=e.readPage;if(a&&typeof a=="object"&&!Array.isArray(a)){const o=a,c=[["beforeLoginHint","未登录时付费墙上方说明","fullApp"],["singlePageTitle","朋友圈单页 · 付费区标题","singlePage"],["singlePagePaywallHint","朋友圈单页 · 付费墙说明","singlePage"]];for(const[u,h,f]of c)typeof o[u]=="string"&&String(o[u]).trim()&&n.push({id:Ao(),pageName:un[us],pagePath:us,scope:f,key:u,behavior:h,content:String(o[u])})}const i=e.customPagePopups;return Array.isArray(i)&&i.forEach((o,c)=>{if(!o||typeof o!="object"||Array.isArray(o))return;const u=o,h=String(u.pagePath??"").trim();if(!h.startsWith("/"))return;const f=String(u.pageName??"").trim(),m=(g,b,N,j)=>{if(typeof N!="string"||!N.trim())return;const v=`c${c}_${g}`;fb(v)&&n.push({id:Ao(),pageName:f||un[h]||"",pagePath:h,scope:j,key:v,behavior:`${b}(旧版 customPagePopups 迁移)`,content:N})};m("fullModalTitle","完整端弹窗标题",u.fullModalTitle,"fullApp"),m("fullModalBody","完整端弹窗正文",u.fullModalBody,"fullApp"),m("singlePageTitle","单页标题",u.singlePageTitle,"singlePage"),m("singlePageBody","单页说明",u.singlePageBody,"singlePage")}),n}const MV=new Set(["memberDetailPage","readPage","customPagePopups","pagePopupItems"]);function AV(t){const e={};if(!t||typeof t!="object"||Array.isArray(t))return e;const n=t;for(const r of Object.keys(n))MV.has(r)||(e[r]=n[r]);return e}function PV(t){let e=EV(t);return e.length===0&&(e=TV(t)),{extra:AV(t),pagePopupItems:IV(e)}}function IV(t){const e=new Set,n=[];for(const r of t){const a=`${r.pagePath}\0${r.key}`;e.has(a)||(e.add(a),n.push(r))}return n}function RV(t,e){const n={...e};n.pagePopupItems=t.map(a=>({id:a.id,pageName:String(a.pageName??"").trim(),pagePath:a.pagePath.trim(),scope:a.scope==="singlePage"?"singlePage":"fullApp",key:a.key.trim(),behavior:a.behavior.trim()||"—",content:a.content})),delete n.memberDetailPage,delete n.readPage,delete n.customPagePopups;const r=n.chaptersPage;if(r&&typeof r=="object"&&!Array.isArray(r)){const a=r??{};delete a.sectionNewBadgeText;const i=String(a.newBadgeText??"").trim();i?a.newBadgeText=i:delete a.newBadgeText}return n}function LV(t){const e=String(t.content||"").replace(/\s+/g," ").trim();return e.length>56?`${e.slice(0,56)}…`:e||"—"}const K0=[{pageName:un[Ii],pagePath:Ii,scope:"fullApp",key:"unlockIntroTitle",behavior:"解锁前说明弹窗 · 标题(wx.showModal title)",content:"解锁与链接说明"},{pageName:un[Ii],pagePath:Ii,scope:"fullApp",key:"unlockIntroBody",behavior:"解锁前说明弹窗 · 正文(wx.showModal content)",content:`「链接」用于提交留资,由对方通过获客计划跟进;「解锁」用于复制手机/微信号后自行添加好友。 - -请确认已了解后再登录。`},{pageName:un[us],pagePath:us,scope:"fullApp",key:"beforeLoginHint",behavior:"未登录时付费墙上方说明",content:"试读进度与下方百分比以后台配置为准;登录后可购买解锁全文。"},{pageName:un[us],pagePath:us,scope:"fullApp",key:"beforePayAvatarNicknameTitle",behavior:"支付前 · 未完善头像昵称时弹窗标题(wx.showModal)",content:"设置头像与昵称"},{pageName:un[us],pagePath:us,scope:"fullApp",key:"beforePayAvatarNicknameBody",behavior:"支付前 · 未完善头像昵称时弹窗正文(wx.showModal)",content:"支付订单会关联你的对外展示信息,请先设置头像与昵称,避免账单与对方看到默认占位。"},{pageName:un[us],pagePath:us,scope:"singlePage",key:"singlePageTitle",behavior:"朋友圈单页 · 付费区标题",content:"解锁全文"},{pageName:un[us],pagePath:us,scope:"singlePage",key:"singlePagePaywallHint",behavior:"朋友圈单页 · 付费墙说明",content:"当前为朋友圈单页预览,无法在此登录或付款。请点击底部「前往小程序」进入完整版后再解锁本章。"},{pageName:un[dn],pagePath:dn,scope:"singlePage",key:"globalSinglePageAuthTitle",behavior:"单页模式 · 拦截登录/支付前弹窗标题(app.ensureFullAppForAuth)",content:"请打开完整小程序"},{pageName:un[dn],pagePath:dn,scope:"singlePage",key:"globalSinglePageAuthBody",behavior:"单页模式 · 拦截登录/支付前弹窗正文",content:"当前是朋友圈预览,无法在这里登录或付款。请先点击屏幕底部「前往小程序」,进入完整版后再解锁本章。"},{pageName:un[dn],pagePath:dn,scope:"fullApp",key:"globalAvatarGuideTitle",behavior:"非 VIP · 每日头像昵称引导弹窗标题(app.checkAvatarNicknameAndGuide)",content:"设置头像与昵称"},{pageName:un[dn],pagePath:dn,scope:"fullApp",key:"globalAvatarGuideBody",behavior:"非 VIP · 每日头像昵称引导弹窗正文",content:"头像与昵称会出现在名片与匹配卡片上,方便伙伴认出你。"},{pageName:un[dn],pagePath:dn,scope:"fullApp",key:"globalVipProfileHintTitle",behavior:"VIP · 补全头像昵称弹窗标题(checkVipContactRequiredAndGuide)",content:"补全对外展示信息"},{pageName:un[dn],pagePath:dn,scope:"fullApp",key:"globalVipProfileHintBody",behavior:"VIP · 补全头像昵称弹窗正文",content:"VIP 名片与派对场景会展示头像与昵称,补全后对方更容易认出你。"},{pageName:un[dn],pagePath:dn,scope:"fullApp",key:"globalVipPhoneTitle",behavior:"VIP · 缺手机号弹窗标题",content:"补全手机号"},{pageName:un[dn],pagePath:dn,scope:"fullApp",key:"globalVipPhoneBody",behavior:"VIP · 缺手机号弹窗正文",content:"手机号用于找伙伴、提现验证与重要通知,仅本人可见。"},{pageName:un[dn],pagePath:dn,scope:"fullApp",key:"globalVipWechatOptionalTitle",behavior:"VIP · 可选补微信号弹窗标题",content:"补全微信号(可选)"},{pageName:un[dn],pagePath:dn,scope:"fullApp",key:"globalVipWechatOptionalBody",behavior:"VIP · 可选补微信号弹窗正文",content:"填写微信号后,对方在允许的场景下能更快加到你;不填也可继续使用。"},{pageName:un[dn],pagePath:dn,scope:"fullApp",key:"globalAppUpdateTitle",behavior:"小程序热更新就绪弹窗标题(checkUpdate)",content:"更新提示"},{pageName:un[dn],pagePath:dn,scope:"fullApp",key:"globalAppUpdateBody",behavior:"小程序热更新就绪弹窗正文",content:"新版本已准备好,重启后即可使用"},{pageName:un[us],pagePath:us,scope:"fullApp",key:"readMomentsShareGuideTitle",behavior:"阅读页 · 复制发圈文案后引导弹窗标题(shareToMoments)",content:"分享到朋友圈"},{pageName:un[us],pagePath:us,scope:"fullApp",key:"readMomentsShareGuideBody",behavior:"阅读页 · 复制发圈文案后引导弹窗正文",content:`已复制发圈文案(非分享给好友)。 - -请点击右上角「···」→「分享到朋友圈」粘贴发布。`}];function OV(){return K0.map(t=>({...t,id:Ao()}))}const Dc=10,Ej=()=>({id:Ao(),pageName:"",pagePath:SV,scope:"fullApp",key:"",behavior:"",content:""});function DV({pagePopupItems:t,setPagePopupItems:e,extraKeysCount:n}){const[r,a]=y.useState(""),[i,o]=y.useState(!1),[c,u]=y.useState("add"),[h,f]=y.useState(Ej()),[m,g]=y.useState(null),[b,N]=y.useState(1),j=y.useMemo(()=>{const I=h.pagePath.trim();return Ix.some(z=>z.value===I)?I:"__other__"},[h.pagePath]),v=y.useMemo(()=>{const I=r.trim().toLowerCase();return I?t.filter(z=>`${z.pageName} ${z.pagePath} ${Cj(z.scope)} ${z.key} ${z.behavior} ${z.content} ${Sj(z)}`.toLowerCase().includes(I)):t},[r,t]),k=y.useMemo(()=>Math.max(1,Math.ceil(v.length/Dc)),[v.length]),T=y.useMemo(()=>{const I=(b-1)*Dc;return v.slice(I,I+Dc)},[v,b]);y.useEffect(()=>{N(1)},[r]),y.useEffect(()=>{N(I=>Math.min(I,k))},[k]);const C=()=>{f(Ej()),u("add"),o(!0)},R=I=>{f({...I,scope:I.scope==="singlePage"?"singlePage":"fullApp"}),u("edit"),o(!0)},O=()=>{const I=h.pagePath.trim(),z=h.key.trim();if(!I.startsWith("/")){G.error("页面路径须以 / 开头");return}if(!fb(z)){G.error("键名须为英文:字母开头,仅字母、数字、下划线");return}if(!h.behavior.trim()){G.error("请填写行为说明");return}if(t.some(Q=>Q.pagePath===I&&Q.key===z&&Q.id!==h.id)){G.error("同一页面下键名不能重复");return}c==="add"?(e(Q=>[...Q,{...h,id:h.id||Ao()}]),G.success("已添加,请点击右上角「保存设置」提交")):(e(Q=>Q.map(se=>se.id===h.id?{...h}:se)),G.success("已更新,请点击「保存设置」提交")),o(!1)},U=()=>{m&&(e(I=>I.filter(z=>z.id!==m)),G.success("已删除,请点击「保存设置」提交"),g(null))};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(ak,{className:"w-5 h-5 text-[#38bdac]"}),"弹窗文案(按页面 + 键)"]}),s.jsxs(qt,{className:"text-gray-400",children:["先",s.jsx("strong",{className:"text-gray-300",children:"新增"}),"文案:填写",s.jsx("strong",{className:"text-gray-300",children:"页面名称"}),"、路径、",s.jsx("strong",{className:"text-gray-300",children:"类型"}),"(单页面 / 多页面)、",s.jsx("strong",{className:"text-[#38bdac]",children:"英文键名"}),"、行为说明、文案内容。 小程序通过 ",s.jsx("code",{className:"text-[#38bdac]/90",children:"pagePath + key"})," 从 ",s.jsx("code",{className:"text-[#38bdac]/90",children:"mpConfig.mpUi.pagePopupItems"})," 读取。 同一页面可配置多条(不同 key)。下方表格每页展示 ",Dc," 条;全部条目随右上角「保存设置」写入数据库,与分页无关。"]})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsx("p",{className:"text-xs text-gray-500",children:n>0?`另有 ${n} 类其它 mpUi 已保留,保存时一并写回。`:"保存后约 5 分钟内随配置缓存刷新。"}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(J,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-200",title:`用与小程序对齐的 ${K0.length} 条标准文案替换当前列表,再点「保存设置」写入数据库。迁移完成后可移除此按钮。`,onClick:()=>{e(OV()),G.info(`已填入标准 ${K0.length} 条,请点击「保存设置」写入数据库`)},children:[s.jsx(oA,{className:"w-3.5 h-3.5 mr-1.5"}),"填入默认种子"]}),s.jsxs(J,{type:"button",size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",onClick:C,children:[s.jsx(P5,{className:"w-3.5 h-3.5 mr-1.5"}),"新增文案"]})]})]}),s.jsxs("div",{className:"space-y-2 max-w-xl w-full",children:[s.jsxs(te,{className:"text-gray-400 text-xs flex items-center gap-1.5",children:[s.jsx(xa,{className:"w-3.5 h-3.5"}),"筛选(页面名称 / 类型 / 路径 / 键 / 行为 / 正文)"]}),s.jsx("div",{className:"rounded-md border border-gray-700 bg-[#0a1628] px-3 h-10 flex items-center",children:s.jsx(ce,{className:"border-0 bg-transparent text-white h-9 px-0 shadow-none focus-visible:ring-0 placeholder:text-gray-600",placeholder:"例如:read、beforeLogin、singlePage…",value:r,onChange:I=>a(I.target.value)})})]}),s.jsxs("div",{className:"rounded-lg border border-gray-700/80 overflow-x-auto w-full",children:[s.jsxs(ps,{className:"w-full min-w-[1320px] table-fixed",children:[s.jsx(ms,{children:s.jsxs(xt,{className:"border-gray-700 hover:bg-[#0a1628]/80 bg-[#0a1628]",children:[s.jsx(Se,{className:"text-gray-300 w-[11%] min-w-[108px]",children:"页面名称"}),s.jsx(Se,{className:"text-gray-300 w-[8%] min-w-[88px]",children:"类型"}),s.jsx(Se,{className:"text-gray-300 w-[19%] min-w-[200px]",children:"页面路径"}),s.jsx(Se,{className:"text-gray-300 w-[10%] min-w-[108px]",children:"键名(英文)"}),s.jsx(Se,{className:"text-gray-300 w-[13%] min-w-[108px]",children:"行为"}),s.jsx(Se,{className:"text-gray-300 w-[25%] min-w-[220px]",children:"文案摘要"}),s.jsx(Se,{className:"text-gray-300 text-right w-[14%] min-w-[200px] whitespace-nowrap",children:"操作"})]})}),s.jsx(gs,{children:T.map(I=>s.jsxs(xt,{className:"border-gray-800 hover:bg-[#0f2137]/90",children:[s.jsx(je,{className:"text-sm text-gray-200 align-top font-medium",children:Sj(I)}),s.jsx(je,{className:"align-top",children:s.jsx(Be,{variant:I.scope==="singlePage"?"outline":"secondary",className:I.scope==="singlePage"?"border-amber-500/50 text-amber-200/95 text-[11px]":"text-[11px]",children:Cj(I.scope)})}),s.jsx(je,{className:"font-mono text-xs text-[#38bdac]/95 align-top break-all",children:I.pagePath}),s.jsx(je,{className:"font-mono text-xs text-amber-200/90 align-top break-all",children:I.key}),s.jsx(je,{className:"text-xs text-gray-300 align-top",children:I.behavior}),s.jsx(je,{className:"text-xs align-top max-w-[220px] min-w-0 py-2",children:s.jsx("div",{className:"line-clamp-1 min-w-0 text-gray-400 break-all cursor-default",title:String(I.content??"").replace(/\s+/g," ").trim()||"—",children:LV(I)})}),s.jsx(je,{className:"align-middle text-right",children:s.jsxs("div",{className:"inline-flex flex-nowrap items-center justify-end gap-1 min-w-[168px]",children:[s.jsxs(J,{type:"button",variant:"ghost",size:"sm",className:"h-8 shrink-0 px-2.5 text-[#38bdac]",onClick:()=>R(I),children:[s.jsx(Wx,{className:"w-3.5 h-3.5 mr-1"}),"编辑"]}),s.jsxs(J,{type:"button",variant:"ghost",size:"sm",className:"h-8 shrink-0 px-2.5 text-gray-400 hover:text-red-400",onClick:()=>g(I.id),children:[s.jsx(Zn,{className:"w-3.5 h-3.5 mr-1"}),"删除"]})]})})]},I.id))})]}),v.length===0&&s.jsx("p",{className:"text-center text-sm text-gray-500 py-8",children:"无数据,请点击「新增文案」或「填入默认种子」"}),v.length>0&&k>1&&s.jsx(qs,{page:b,totalPages:k,total:v.length,pageSize:Dc,onPageChange:N}),v.length>0&&k<=1&&s.jsxs("div",{className:"flex items-center py-3 px-5 border-t border-gray-700/50 text-sm text-gray-400",children:["共 ",v.length," 条,每页 ",Dc," 条"]})]})]})]}),s.jsx(Dt,{open:i,onOpenChange:o,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl w-[min(100vw-2rem,42rem)] max-h-[90vh] overflow-y-auto",children:[s.jsxs(_t,{children:[s.jsx($t,{children:c==="add"?"新增弹窗文案":"编辑弹窗文案"}),s.jsxs(Yc,{className:"text-gray-400",children:["键名在小程序代码中与 ",s.jsx("code",{className:"text-[#38bdac]/90",children:"pagePath"})," 联合使用,请与开发约定后勿随意改键。"]})]}),s.jsxs("div",{className:"space-y-4 py-2",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"页面名称"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-600 text-white",placeholder:"如:文章详情 / 阅读",value:h.pageName,onChange:I=>f(z=>({...z,pageName:I.target.value}))}),s.jsx("p",{className:"text-[11px] text-gray-500",children:"便于表格识别;可与路径列对照,留空时对常见路径会自动显示默认名称。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"页面路径"}),s.jsxs(jo,{value:j,onValueChange:I=>{f(I==="__other__"?z=>{const L=z.pagePath.trim(),Q=Ix.some(se=>se.value===L);return{...z,pagePath:Q?"/pages/":z.pagePath}}:z=>({...z,pagePath:I}))},children:[s.jsx(Ti,{className:"bg-[#0a1628] border-gray-600 text-white font-mono text-sm w-full",children:s.jsx(ko,{placeholder:"选择页面路径"})}),s.jsxs(Mi,{className:"max-h-[min(60vh,320px)]",children:[Ix.map(I=>s.jsxs(hs,{value:I.value,className:"focus:bg-[#1a3a4a] focus:text-white font-mono text-xs",children:[s.jsx("span",{className:"text-gray-200",children:I.label}),s.jsx("span",{className:"text-gray-500 ml-2",children:I.value})]},I.value)),s.jsx(hs,{value:"__other__",className:"focus:bg-[#1a3a4a] focus:text-white",children:"自定义路径…"})]})]}),j==="__other__"&&s.jsx(ce,{className:"bg-[#0a1628] border-gray-600 text-white font-mono text-sm",placeholder:"/pages/xxx/xxx",value:h.pagePath,onChange:I=>f(z=>({...z,pagePath:I.target.value}))}),s.jsx("p",{className:"text-[11px] text-gray-500",children:"从列表选择常用页面;若路径未收录(如分包页),选「自定义路径」后手动填写。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"类型"}),s.jsxs(jo,{value:h.scope,onValueChange:I=>f(z=>({...z,scope:I==="singlePage"?"singlePage":"fullApp"})),children:[s.jsx(Ti,{className:"bg-[#0a1628] border-gray-600 text-white",children:s.jsx(ko,{placeholder:"选择类型"})}),s.jsxs(Mi,{children:[s.jsx(hs,{value:"fullApp",className:"focus:bg-[#1a3a4a] focus:text-white",children:"多页面(完整小程序)"}),s.jsx(hs,{value:"singlePage",className:"focus:bg-[#1a3a4a] focus:text-white",children:"单页面(朋友圈预览等)"})]})]}),s.jsx("p",{className:"text-[11px] text-gray-500",children:"单页面:微信单页场景(如 1154);多页面:用户进入完整小程序后的页面。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"键名(英文,自定义)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-600 text-white font-mono text-sm",placeholder:"beforeLoginHint",value:h.key,disabled:c==="edit",onChange:I=>f(z=>({...z,key:I.target.value.replace(/[^a-zA-Z0-9_]/g,"")}))}),c==="edit"&&s.jsx("p",{className:"text-[11px] text-gray-500",children:"编辑时不可改键名;需改键请删除后新建。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"行为说明"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-600 text-white",placeholder:"如:未登录时付费墙上方展示",value:h.behavior,onChange:I=>f(z=>({...z,behavior:I.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"文案内容"}),s.jsx(tc,{className:"bg-[#0a1628] border-gray-600 text-white min-h-[140px]",placeholder:"弹窗正文、提示语等",value:h.content,onChange:I=>f(z=>({...z,content:I.target.value}))})]})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600",onClick:()=>o(!1),children:"取消"}),s.jsx(J,{className:"bg-[#38bdac] hover:bg-[#2da396] text-white",onClick:O,children:"确定"})]})]})}),s.jsx(Dt,{open:!!m,onOpenChange:I=>!I&&g(null),children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsxs(_t,{children:[s.jsx($t,{children:"删除该条文案?"}),s.jsx(Yc,{className:"text-gray-400",children:"删除后需保存设置才会同步到小程序;若键名已被代码引用,删除后对应位置将走默认兜底。"})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600",onClick:()=>g(null),children:"取消"}),s.jsx(J,{className:"bg-red-600 hover:bg-red-700",onClick:U,children:"删除"})]})]})})]})}const _V={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},$V={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},zV={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...$V},ckbLeadApiKey:""},FV={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0},BV=["system","author","admin","api-docs"],Tj=["basic","mp","mp-copy","oss","features"];function VV(){const[t,e]=X0(),n=t.get("tab")??"system",r=BV.includes(n)?n:"system",a=t.get("section")??"basic",i=Tj.includes(a)?a:"basic",[o,c]=y.useState(zV),[u,h]=y.useState(FV),[f,m]=y.useState(_V),[g,b]=y.useState({}),[N,j]=y.useState([]),[v,k]=y.useState({}),[T,C]=y.useState(!1),[R,O]=y.useState(!0),[U,I]=y.useState(!1),[z,L]=y.useState(""),[Q,se]=y.useState(""),[$,ie]=y.useState(!1),[le,me]=y.useState(!1),P=(de,D,q=!1)=>{L(de),se(D),ie(q),I(!0)};y.useEffect(()=>{(async()=>{try{const D=await Oe("/api/admin/settings");if(!D||D.success===!1)return;if(D.featureConfig&&Object.keys(D.featureConfig).length&&h(q=>({...q,...D.featureConfig})),D.mpConfig&&typeof D.mpConfig=="object"){const q={...D.mpConfig};m(re=>({...re,...q}));const{extra:_,pagePopupItems:Z}=PV(q.mpUi);b(_),j(Z)}if(D.ossConfig&&typeof D.ossConfig=="object"&&k(q=>({...q,...D.ossConfig})),D.siteSettings&&typeof D.siteSettings=="object"){const q=D.siteSettings;c(_=>({..._,...typeof q.sectionPrice=="number"&&{sectionPrice:q.sectionPrice},...typeof q.baseBookPrice=="number"&&{baseBookPrice:q.baseBookPrice},...typeof q.distributorShare=="number"&&{distributorShare:q.distributorShare},...q.authorInfo&&typeof q.authorInfo=="object"&&{authorInfo:{..._.authorInfo,...q.authorInfo}},...typeof q.ckbLeadApiKey=="string"&&{ckbLeadApiKey:q.ckbLeadApiKey}}))}}catch(D){console.error("Load settings error:",D)}finally{O(!1)}})()},[]);const Y=async(de,D)=>{me(!0);try{const q=await kt("/api/admin/settings",{featureConfig:de});if(!q||q.success===!1){D(),P("保存失败",(q==null?void 0:q.error)??"未知错误",!0);return}P("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(q){console.error("Save feature config error:",q),D(),P("保存失败",q instanceof Error?q.message:String(q),!0)}finally{me(!1)}},F=(de,D)=>{const q=u,_={...q,[de]:D};h(_),Y(_,()=>h(q))},[ge,X]=y.useState(!1),B=async de=>{const D=f,q={...D,auditMode:de};m(q),X(!0);try{const _=await kt("/api/admin/settings",{mpConfig:q});if(!_||_.success===!1){m(D),P("保存失败",(_==null?void 0:_.error)??"未知错误",!0);return}P("已保存",de?"审核模式已开启,小程序将隐藏所有支付入口。":"审核模式已关闭,支付功能已恢复。")}catch(_){m(D),P("保存失败",_ instanceof Error?_.message:String(_),!0)}finally{X(!1)}},W=async()=>{C(!0);try{const de=RV(N,g),D=await kt("/api/admin/settings",{featureConfig:u,siteSettings:{sectionPrice:o.sectionPrice,baseBookPrice:o.baseBookPrice,distributorShare:o.distributorShare,authorInfo:o.authorInfo,ckbLeadApiKey:o.ckbLeadApiKey||void 0},mpConfig:{...f,appId:f.appId||"",withdrawSubscribeTmplId:f.withdrawSubscribeTmplId||"",mchId:f.mchId||"",minWithdraw:typeof f.minWithdraw=="number"?f.minWithdraw:10,auditMode:f.auditMode??!1,mpUi:de},ossConfig:Object.keys(v).length?{endpoint:v.endpoint??"",bucket:v.bucket??"",region:v.region??"",accessKeyId:v.accessKeyId??"",accessKeySecret:v.accessKeySecret??""}:void 0});if(!D||D.success===!1){P("保存失败",(D==null?void 0:D.error)??"未知错误",!0);return}P("已保存","设置已保存成功。")}catch(de){console.error("Save settings error:",de),P("保存失败",de instanceof Error?de.message:String(de),!0)}finally{C(!1)}},fe=de=>{if(de==="system"){const D=new URLSearchParams(t);D.delete("tab"),Tj.includes(D.get("section")||"basic")||D.set("section","basic"),e(D);return}e({tab:de})},he=de=>{const D=new URLSearchParams(t);D.delete("tab"),D.set("section",de),e(D)};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(J,{onClick:W,disabled:T,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),T?"保存中...":"保存设置"]})]}),s.jsxs(Xc,{value:r,onValueChange:fe,className:"w-full",children:[s.jsxs(Hl,{className:"mb-6 bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(en,{value:"system",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(Co,{className:"w-4 h-4 mr-2"}),"系统设置"]}),s.jsxs(en,{value:"author",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(Vh,{className:"w-4 h-4 mr-2"}),"作者详情"]}),s.jsxs(en,{value:"admin",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(Bc,{className:"w-4 h-4 mr-2"}),"管理员"]}),s.jsxs(en,{value:"api-docs",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",onClick:de=>{de.preventDefault(),window.open("/api-docs","_blank")},children:[s.jsx(tk,{className:"w-4 h-4 mr-2"}),"API 文档 ↗"]})]}),s.jsxs(tn,{value:"system",className:"mt-0",children:[s.jsxs("p",{className:"text-xs text-gray-500 mb-3",children:["MBTI 默认头像已迁至"," ",s.jsx(_l,{to:"/users",className:"text-[#38bdac] underline",children:"用户管理(用户列表点头像打开)"})]}),s.jsxs(Xc,{value:i,onValueChange:he,className:"w-full",children:[s.jsxs(Hl,{className:"mb-4 bg-[#0a1628] border border-gray-700/50 p-1 flex-wrap h-auto gap-1",children:[s.jsxs(en,{value:"basic",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(jM,{className:"w-3.5 h-3.5 mr-1"}),"基础与价格"]}),s.jsxs(en,{value:"mp",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(zl,{className:"w-3.5 h-3.5 mr-1"}),"小程序与审核"]}),s.jsxs(en,{value:"mp-copy",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(ak,{className:"w-3.5 h-3.5 mr-1"}),"弹窗文案"]}),s.jsxs(en,{value:"oss",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(R1,{className:"w-3.5 h-3.5 mr-1"}),"OSS"]}),s.jsxs(en,{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(tn,{value:"basic",className:"space-y-6 mt-0",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Vh,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),s.jsx(qt,{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(te,{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:de=>c(D=>({...D,authorInfo:{...D.authorInfo,name:de.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"start-date",className:"text-gray-300 flex items-center gap-1",children:[s.jsx($x,{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:de=>c(D=>({...D,authorInfo:{...D.authorInfo,startDate:de.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"live-time",className:"text-gray-300 flex items-center gap-1",children:[s.jsx($x,{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:de=>c(D=>({...D,authorInfo:{...D.authorInfo,liveTime:de.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"platform",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(rk,{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:de=>c(D=>({...D,authorInfo:{...D.authorInfo,platform:de.target.value}}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"description",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(fr,{className:"w-3 h-3"}),"简介描述"]}),s.jsx(ce,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:o.authorInfo.description??"",onChange:de=>c(D=>({...D,authorInfo:{...D.authorInfo,description:de.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),s.jsx(tc,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:o.authorInfo.bio??"",onChange:de=>c(D=>({...D,authorInfo:{...D.authorInfo,bio:de.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"ckb-lead-api-key",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Ai,{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:de=>c(D=>({...D,ckbLeadApiKey:de.target.value}))}),s.jsx("p",{className:"text-xs text-gray-500",children:"小程序首页「链接卡若」留资接口使用的存客宝 API Key,优先于 .env 配置"})]}),s.jsxs("div",{className:"mt-4 p-4 rounded-xl bg-[#0a1628] border border-[#38bdac]/30",children:[s.jsx("p",{className:"text-xs text-gray-500 mb-2",children:"预览效果"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-12 h-12 rounded-full bg-linear-to-br from-[#00CED1] to-[#20B2AA] flex items-center justify-center text-xl font-bold text-white",children:(o.authorInfo.name??"K").charAt(0)}),s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-semibold",children:o.authorInfo.name}),s.jsx("p",{className:"text-gray-400 text-xs",children:o.authorInfo.description}),s.jsxs("p",{className:"text-[#38bdac] text-xs mt-1",children:["每日 ",o.authorInfo.liveTime," · ",o.authorInfo.platform]})]})]})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Ef,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),s.jsx(qt,{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(te,{className:"text-gray-300",children:"单节价格 (元)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.sectionPrice,onChange:de=>c(D=>({...D,sectionPrice:Number.parseFloat(de.target.value)||1}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"整本价格 (元)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.baseBookPrice,onChange:de=>c(D=>({...D,baseBookPrice:Number.parseFloat(de.target.value)||9.9}))})]})]})})]})]}),s.jsxs(tn,{value:"mp",className:"space-y-6 mt-0",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(zl,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),s.jsx(qt,{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(te,{className:"text-gray-300",children:"小程序 AppID"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:f.appId??"",onChange:de=>m(D=>({...D,appId:de.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"提现订阅模板 ID"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"用户申请提现时需授权",value:f.withdrawSubscribeTmplId??"",onChange:de=>m(D=>({...D,withdrawSubscribeTmplId:de.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"微信支付商户号"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"1318592501",value:f.mchId??"",onChange:de=>m(D=>({...D,mchId:de.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"最低提现金额 (元)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:f.minWithdraw??10,onChange:de=>m(D=>({...D,minWithdraw:Number.parseFloat(de.target.value)||10}))})]})]}),s.jsx("p",{className:"text-xs text-gray-500 pt-2 border-t border-gray-700/50",children:"弹窗类文案在「弹窗文案」子 Tab 按页面路径 + 英文键维护(pagePopupItems);目录、Tab、首页板块等仍由其它配置决定。"})]})]}),s.jsxs(De,{className:`bg-[#0f2137] shadow-xl ${f.auditMode?"border-amber-500/50 border-2":"border-gray-700/50"}`,children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Bc,{className:"w-5 h-5 text-amber-400"}),"小程序审核模式"]}),s.jsx(qt,{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(Bc,{className:`w-4 h-4 ${f.auditMode?"text-amber-400":"text-gray-400"}`}),s.jsx(te,{htmlFor:"audit-mode",className:"text-white font-medium cursor-pointer",children:f.auditMode?"审核模式(已开启)":"审核模式(已关闭)"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:f.auditMode?"当前已隐藏所有支付、VIP、充值、收益等入口,审核员看不到任何付费内容":"关闭状态,小程序正常显示所有功能(含支付、VIP 等)"})]}),s.jsx(Ut,{id:"audit-mode",checked:f.auditMode??!1,disabled:ge,onCheckedChange:B})]})})]})]}),s.jsx(tn,{value:"mp-copy",className:"space-y-6 mt-0",children:s.jsx(DV,{pagePopupItems:N,setPagePopupItems:j,extraKeysCount:Object.keys(g).length})}),s.jsx(tn,{value:"oss",className:"space-y-6 mt-0",children:s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(R1,{className:"w-5 h-5 text-[#38bdac]"}),"OSS 配置(阿里云对象存储)"]}),s.jsx(qt,{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(te,{className:"text-gray-300",children:"Endpoint"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"oss-cn-hangzhou.aliyuncs.com",value:v.endpoint??"",onChange:de=>k(D=>({...D,endpoint:de.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"Bucket"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"bucket 名称",value:v.bucket??"",onChange:de=>k(D=>({...D,bucket:de.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"Region"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"oss-cn-hangzhou",value:v.region??"",onChange:de=>k(D=>({...D,region:de.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"AccessKey ID"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"AccessKey ID",value:v.accessKeyId??"",onChange:de=>k(D=>({...D,accessKeyId:de.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"AccessKey Secret"}),s.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"AccessKey Secret",value:v.accessKeySecret??"",onChange:de=>k(D=>({...D,accessKeySecret:de.target.value}))})]})]})})]})}),s.jsxs(tn,{value:"features",className:"space-y-6 mt-0",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Co,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),s.jsx(qt,{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(Kn,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(te,{htmlFor:"match-enabled",className:"text-white font-medium cursor-pointer",children:"找伙伴功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制小程序和Web端的找伙伴功能显示"})]}),s.jsx(Ut,{id:"match-enabled",checked:u.matchEnabled,disabled:le,onCheckedChange:de=>F("matchEnabled",de)})]}),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(Bx,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(te,{htmlFor:"referral-enabled",className:"text-white font-medium cursor-pointer",children:"推广功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制推广中心的显示(我的页面入口)"}),s.jsxs("p",{className:"text-xs text-amber-400/80 ml-6 mt-1",children:["佣金比例、绑定期、提现规则等与",s.jsx(_l,{to:"/distribution?tab=settings",className:"underline mx-1 text-[#38bdac]",children:"推广中心 → 推广设置"}),"为同一套接口,在此仅控制是否展示入口。"]})]}),s.jsx(Ut,{id:"referral-enabled",checked:u.referralEnabled,disabled:le,onCheckedChange:de=>F("referralEnabled",de)})]}),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(fr,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(te,{htmlFor:"search-enabled",className:"text-white font-medium cursor-pointer",children:"搜索功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制首页、目录页搜索栏的显示"})]}),s.jsx(Ut,{id:"search-enabled",checked:u.searchEnabled,disabled:le,onCheckedChange:de=>F("searchEnabled",de)})]}),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(te,{htmlFor:"about-enabled",className:"text-white font-medium cursor-pointer",children:"关于页面"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制关于页面的访问"})]}),s.jsx(Ut,{id:"about-enabled",checked:u.aboutEnabled,disabled:le,onCheckedChange:de=>F("aboutEnabled",de)})]})]}),s.jsx("div",{className:"p-3 rounded-lg bg-blue-500/10 border border-blue-500/30",children:s.jsx("p",{className:"text-xs text-blue-300",children:"💡 关闭功能后,相关入口会自动隐藏。建议在功能开发完成后再开启。"})})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Tf,{className:"w-5 h-5 text-[#38bdac]"}),"小程序模块显隐说明"]}),s.jsx(qt,{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(Kn,{className:"w-3 h-3"})},{mod:"推广中心 / 推荐好友",ctrl:"推广功能开关",icon:s.jsx(Bx,{className:"w-3 h-3"})},{mod:"搜索",ctrl:"搜索功能开关",icon:s.jsx(fr,{className:"w-3 h-3"})},{mod:"关于页面",ctrl:"关于页面开关",icon:s.jsx(Vh,{className:"w-3 h-3"})},{mod:"支付 / VIP / 充值 / 收益",ctrl:"审核模式",icon:s.jsx(Bc,{className:"w-3 h-3"})},{mod:"超级个体名片",ctrl:"审核模式",icon:s.jsx(wA,{className:"w-3 h-3"})},{mod:"首页获客入口",ctrl:"已移除",icon:s.jsx(q5,{className:"w-3 h-3"})}].map(de=>s.jsxs("div",{className:"flex items-center gap-2 p-2 rounded bg-[#0a1628] border border-gray-700/30",children:[de.icon,s.jsxs("div",{children:[s.jsx("span",{className:"text-white",children:de.mod}),s.jsxs("span",{className:"text-gray-500 ml-1",children:["← ",de.ctrl]})]})]},de.mod))})})]})]})]})]}),s.jsx(tn,{value:"author",className:"mt-0",children:s.jsx(wV,{})}),s.jsx(tn,{value:"admin",className:"mt-0",children:s.jsx(kV,{})}),s.jsx(tn,{value:"api-docs",className:"mt-0",children:s.jsx(K4,{})})]}),s.jsx(Dt,{open:U,onOpenChange:I,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsxs(_t,{children:[s.jsx($t,{className:$?"text-red-400":"text-[#38bdac]",children:z}),s.jsx(Yc,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:Q})]}),s.jsx(rn,{className:"mt-4",children:s.jsx(J,{onClick:()=>I(!1),className:$?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const Mj={wechat:{enabled:!0,qrCode:"/images/wechat-pay.png",account:"卡若",websiteAppId:"",merchantId:"",groupQrCode:"/images/party-group-qr.png"},alipay:{enabled:!0,qrCode:"/images/alipay.png",account:"卡若",partnerId:"",securityKey:""},usdt:{enabled:!1,network:"TRC20",address:"",exchangeRate:7.2},paypal:{enabled:!1,email:"",exchangeRate:7.2}};function HV(){const[t,e]=y.useState(!1),[n,r]=y.useState(Mj),[a,i]=y.useState(""),o=async()=>{e(!0);try{const k=await Oe("/api/config");k!=null&&k.paymentMethods&&r({...Mj,...k.paymentMethods})}catch(k){console.error(k)}finally{e(!1)}};y.useEffect(()=>{o()},[]);const c=async()=>{e(!0);try{await kt("/api/db/config",{key:"payment_methods",value:n,description:"支付方式配置"}),G.success("配置已保存!")}catch(k){console.error("保存失败:",k),G.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{e(!1)}},u=(k,T)=>{navigator.clipboard.writeText(k),i(T),setTimeout(()=>i(""),2e3)},h=(k,T)=>{r(C=>({...C,wechat:{...C.wechat,[k]:T}}))},f=(k,T)=>{r(C=>({...C,alipay:{...C.alipay,[k]:T}}))},m=(k,T)=>{r(C=>({...C,usdt:{...C.usdt,[k]:T}}))},g=(k,T)=>{r(C=>({...C,paypal:{...C.paypal,[k]:T}}))},b=n.wechat,N=n.alipay,j=n.usdt,v=n.paypal;return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold mb-2 text-white",children:"支付配置"}),s.jsx("p",{className:"text-gray-400",children:"配置微信、支付宝、USDT、PayPal等支付参数"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(J,{variant:"outline",onClick:o,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${t?"animate-spin":""}`}),"同步配置"]}),s.jsxs(J,{onClick:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{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(Xj,{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(Xc,{defaultValue:"wechat",className:"space-y-6",children:[s.jsxs(Hl,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[s.jsxs(en,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[s.jsx(zl,{className:"w-4 h-4 mr-2"}),"微信"]}),s.jsxs(en,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[s.jsx(L1,{className:"w-4 h-4 mr-2"}),"支付宝"]}),s.jsxs(en,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[s.jsx(I1,{className:"w-4 h-4 mr-2"}),"USDT"]}),s.jsxs(en,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[s.jsx(Vx,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),s.jsx(tn,{value:"wechat",className:"space-y-4",children:s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(ht,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(zl,{className:"w-5 h-5"}),"微信支付配置"]}),s.jsx(qt,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),s.jsx(Ut,{checked:!!b.enabled,onCheckedChange:k=>h("enabled",k)})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{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(te,{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(_o,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置(核心功能)"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"微信收款码/支付链接"}),s.jsx(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(te,{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(tn,{value:"alipay",className:"space-y-4",children:s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(ht,{className:"text-[#1677FF] flex items-center gap-2",children:[s.jsx(L1,{className:"w-5 h-5"}),"支付宝配置"]}),s.jsx(qt,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),s.jsx(Ut,{checked:!!N.enabled,onCheckedChange:k=>f("enabled",k)})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{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(N.partnerId??""),onChange:k=>f("partnerId",k.target.value)}),s.jsx(J,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>u(String(N.partnerId??""),"pid"),children:a==="pid"?s.jsx(Pp,{className:"w-4 h-4 text-green-500"}):s.jsx(ek,{className:"w-4 h-4 text-gray-400"})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"安全校验码 (Key)"}),s.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(N.securityKey??""),onChange:k=>f("securityKey",k.target.value)})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[s.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[s.jsx(_o,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"支付宝收款码/跳转链接"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://qr.alipay.com/... 或收款码图片URL",value:String(N.qrCode??""),onChange:k=>f("qrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户点击支付宝支付后显示的二维码"})]})]})]})]})}),s.jsx(tn,{value:"usdt",className:"space-y-4",children:s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(ht,{className:"text-[#26A17B] flex items-center gap-2",children:[s.jsx(I1,{className:"w-5 h-5"}),"USDT配置"]}),s.jsx(qt,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),s.jsx(Ut,{checked:!!j.enabled,onCheckedChange:k=>m("enabled",k)})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"网络类型"}),s.jsxs("select",{className:"w-full bg-[#0a1628] border border-gray-700 text-white rounded-md p-2",value:String(j.network??"TRC20"),onChange:k=>m("network",k.target.value),children:[s.jsx("option",{value:"TRC20",children:"TRC20 (波场)"}),s.jsx("option",{value:"ERC20",children:"ERC20 (以太坊)"}),s.jsx("option",{value:"BEP20",children:"BEP20 (币安链)"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{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(j.address??""),onChange:k=>m("address",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(j.exchangeRate)??7.2,onChange:k=>m("exchangeRate",Number.parseFloat(k.target.value)||7.2)})]})]})]})}),s.jsx(tn,{value:"paypal",className:"space-y-4",children:s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(ht,{className:"text-[#169BD7] flex items-center gap-2",children:[s.jsx(Vx,{className:"w-5 h-5"}),"PayPal配置"]}),s.jsx(qt,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),s.jsx(Ut,{checked:!!v.enabled,onCheckedChange:k=>g("enabled",k)})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"PayPal邮箱"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"your@email.com",value:String(v.email??""),onChange:k=>g("email",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(v.exchangeRate)??7.2,onChange:k=>g("exchangeRate",Number(k.target.value)||7.2)})]})]})]})})]})]})}const UV={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},WV={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},KV={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function qV(){const[t,e]=y.useState({siteConfig:{...UV},menuConfig:{...WV},pageConfig:{...KV}}),[n,r]=y.useState(!1),[a,i]=y.useState(!1);y.useEffect(()=>{Oe("/api/config").then(f=>{f!=null&&f.siteConfig&&e(m=>({...m,siteConfig:{...m.siteConfig,...f.siteConfig}})),f!=null&&f.menuConfig&&e(m=>({...m,menuConfig:{...m.menuConfig,...f.menuConfig}})),f!=null&&f.pageConfig&&e(m=>({...m,pageConfig:{...m.pageConfig,...f.pageConfig}}))}).catch(console.error)},[]);const o=async()=>{i(!0);try{await kt("/api/db/config",{key:"site_config",value:t.siteConfig,description:"网站基础配置"}),await kt("/api/db/config",{key:"menu_config",value:t.menuConfig,description:"底部菜单配置"}),await kt("/api/db/config",{key:"page_config",value:t.pageConfig,description:"页面标题配置"}),r(!0),setTimeout(()=>r(!1),2e3),G.success("配置已保存")}catch(f){console.error(f),G.error("保存失败: "+(f instanceof Error?f.message:String(f)))}finally{i(!1)}},c=t.siteConfig,u=t.menuConfig,h=t.pageConfig;return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"网站配置"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置网站名称、图标、菜单和页面标题"})]}),s.jsxs(J,{onClick:o,disabled:a,className:`${n?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),a?"保存中...":n?"已保存":"保存设置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Vx,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),s.jsx(qt,{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(te,{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(te,{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(te,{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(te,{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(te,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(UM,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),s.jsx(qt,{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(te,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(DM,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),s.jsx(qt,{className:"text-gray-400",children:"控制底部导航栏菜单的显示和名称"})]}),s.jsx(_e,{className:"space-y-4",children:Object.entries(u).map(([f,m])=>s.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[s.jsx(Ut,{checked:(m==null?void 0:m.enabled)??!0,onCheckedChange:g=>e(b=>({...b,menuConfig:{...b.menuConfig,[f]:{...m,enabled:g}}}))}),s.jsx("span",{className:"text-gray-300 w-16 capitalize",children:f}),s.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white max-w-[200px]",value:(m==null?void 0:m.label)??"",onChange:g=>e(b=>({...b,menuConfig:{...b.menuConfig,[f]:{...m,label:g.target.value}}}))})]}),s.jsx("span",{className:`text-sm ${m!=null&&m.enabled?"text-green-400":"text-gray-500"}`,children:m!=null&&m.enabled?"显示":"隐藏"})]},f))})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(tk,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),s.jsx(qt,{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(te,{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(te,{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(te,{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(te,{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(te,{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(te,{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 GV(){const[t,e]=y.useState(""),[n,r]=y.useState(""),[a,i]=y.useState(""),[o,c]=y.useState({}),u=async()=>{var b,N,j,v;try{const k=await Oe("/api/config"),T=(N=(b=k==null?void 0:k.liveQRCodes)==null?void 0:b[0])==null?void 0:N.urls;Array.isArray(T)&&e(T.join(` -`));const C=(v=(j=k==null?void 0:k.paymentMethods)==null?void 0:j.wechat)==null?void 0:v.groupQrCode;C&&r(C),c({paymentMethods:k==null?void 0:k.paymentMethods,liveQRCodes:k==null?void 0:k.liveQRCodes})}catch(k){console.error(k)}};y.useEffect(()=>{u()},[]);const h=(b,N)=>{navigator.clipboard.writeText(b),i(N),setTimeout(()=>i(""),2e3)},f=async()=>{try{const b=t.split(` -`).map(j=>j.trim()).filter(Boolean),N=[...o.liveQRCodes||[]];N[0]?N[0].urls=b:N.push({id:"live-1",name:"微信群活码",urls:b,clickCount:0}),await kt("/api/db/config",{key:"live_qr_codes",value:N,description:"群活码配置"}),G.success("群活码配置已保存!"),await u()}catch(b){console.error(b),G.error("保存失败: "+(b instanceof Error?b.message:String(b)))}},m=async()=>{var b;try{await kt("/api/db/config",{key:"payment_methods",value:{...o.paymentMethods||{},wechat:{...((b=o.paymentMethods)==null?void 0:b.wechat)||{},groupQrCode:n}},description:"支付方式配置"}),G.success("微信群链接已保存!用户支付成功后将自动跳转"),await u()}catch(N){console.error(N),G.error("保存失败: "+(N instanceof Error?N.message:String(N)))}},g=()=>{n?window.open(n,"_blank"):G.error("请先配置微信群链接")};return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"mb-8",children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"微信群活码管理"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置微信群跳转链接,用户支付后自动跳转加群"})]}),s.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Xj,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm",children:[s.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"微信群活码配置指南"}),s.jsxs("div",{className:"text-[#07C160]/80 space-y-2",children:[s.jsx("p",{className:"font-medium",children:"方法一:使用草料活码(推荐)"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[s.jsx("li",{children:"访问草料二维码创建活码"}),s.jsx("li",{children:"上传微信群二维码图片,生成永久链接"}),s.jsx("li",{children:"复制生成的短链接填入下方配置"}),s.jsx("li",{children:"群满后可直接在草料后台更换新群码,链接不变"})]}),s.jsx("p",{className:"font-medium mt-3",children:"方法二:直接使用微信群链接"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[s.jsx("li",{children:'微信打开目标群 → 右上角"..." → 群二维码'}),s.jsx("li",{children:"长按二维码 → 识别二维码 → 复制链接"})]}),s.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"注意:微信原生群二维码7天后失效,建议使用草料活码"})]})]})]})}),s.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx($1,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),s.jsx(qt,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Ux,{className:"w-4 h-4"}),"微信群链接 / 活码链接"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ce,{placeholder:"https://cli.im/xxxxx 或 https://weixin.qq.com/g/...",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",value:n,onChange:b=>r(b.target.value)}),s.jsx(J,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>h(n,"group"),children:a==="group"?s.jsx(Pp,{className:"w-4 h-4 text-green-500"}):s.jsx(ek,{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(_o,{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(Af,{className:"w-4 h-4 mr-2"}),"保存配置"]}),s.jsxs(J,{onClick:g,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[s.jsx(_o,{className:"w-4 h-4 mr-2"}),"测试跳转"]})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx($1,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),s.jsx(qt,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Ux,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),s.jsx(tc,{placeholder:"https://cli.im/group1\\nhttps://cli.im/group2",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 min-h-[120px] font-mono text-sm",value:t,onChange:b=>e(b.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"每行填写一个群链接,系统将按顺序或随机分配"})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[s.jsx("span",{className:"text-sm text-gray-400",children:"已配置群数量"}),s.jsxs("span",{className:"font-bold text-[#38bdac]",children:[t.split(` -`).filter(Boolean).length," 个"]})]}),s.jsxs(J,{onClick:f,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Af,{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 Aj={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}},JV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function QV(){const[t,e]=y.useState(Aj),[n,r]=y.useState(!0),[a,i]=y.useState(!1),[o,c]=y.useState(!1),[u,h]=y.useState(null),[f,m]=y.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),g=async()=>{r(!0);try{const C=await Oe("/api/db/config/full?key=match_config"),R=(C==null?void 0:C.data)??(C==null?void 0:C.config);R&&e({...Aj,...R})}catch(C){console.error("加载匹配配置失败:",C)}finally{r(!1)}};y.useEffect(()=>{g()},[]);const b=async()=>{i(!0);try{const C=await kt("/api/db/config",{key:"match_config",value:t,description:"匹配功能配置"});C&&C.success!==!1?G.success("配置保存成功!"):G.error("保存失败: "+(C&&typeof C=="object"&&"error"in C?C.error:"未知错误"))}catch(C){console.error("保存配置失败:",C),G.error("保存失败")}finally{i(!1)}},N=C=>{h(C),m({id:C.id,label:C.label,matchLabel:C.matchLabel,icon:C.icon,matchFromDB:C.matchFromDB,showJoinAfterMatch:C.showJoinAfterMatch,price:C.price,enabled:C.enabled}),c(!0)},j=()=>{h(null),m({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),c(!0)},v=()=>{if(!f.id||!f.label){G.error("请填写类型ID和名称");return}const C=[...t.matchTypes];if(u){const R=C.findIndex(O=>O.id===u.id);R!==-1&&(C[R]={...f})}else{if(C.some(R=>R.id===f.id)){G.error("类型ID已存在");return}C.push({...f})}e({...t,matchTypes:C}),c(!1)},k=C=>{confirm("确定要删除这个匹配类型吗?")&&e({...t,matchTypes:t.matchTypes.filter(R=>R.id!==C)})},T=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(J,{variant:"outline",onClick:g,disabled:n,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]}),s.jsxs(J,{onClick:b,disabled:a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存配置"]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx($o,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),s.jsx(qt,{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(te,{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(te,{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(te,{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(Ut,{checked:t.settings.enableFreeMatches,onCheckedChange:C=>e({...t,settings:{...t.settings,enableFreeMatches:C}})}),s.jsx(te,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:t.settings.enablePaidMatches,onCheckedChange:C=>e({...t,settings:{...t.settings,enablePaidMatches:C}})}),s.jsx(te,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Kn,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),s.jsx(qt,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(J,{onClick:j,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Fn,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),s.jsx(_e,{children:s.jsxs(ps,{children:[s.jsx(ms,{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(gs,{children:t.matchTypes.map(C=>s.jsxs(xt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(je,{children:s.jsx("span",{className:"text-2xl",children:C.icon})}),s.jsx(je,{className:"font-mono text-gray-300",children:C.id}),s.jsx(je,{className:"text-white font-medium",children:C.label}),s.jsx(je,{className:"text-gray-300",children:C.matchLabel}),s.jsx(je,{children:s.jsxs(Be,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",C.price]})}),s.jsx(je,{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(je,{children:s.jsx(Ut,{checked:C.enabled,onCheckedChange:()=>T(C.id)})}),s.jsx(je,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>N(C),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(sn,{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(Zn,{className:"w-4 h-4"})})]})})]},C.id))})]})})]}),s.jsx(Dt,{open:o,onOpenChange:c,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[u?s.jsx(sn,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(Fn,{className:"w-5 h-5 text-[#38bdac]"}),u?"编辑匹配类型":"添加匹配类型"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"类型ID(英文)"}),s.jsx(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(te,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:JV.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(te,{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(te,{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(te,{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(Ut,{checked:f.matchFromDB,onCheckedChange:C=>m({...f,matchFromDB:C})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:f.showJoinAfterMatch,onCheckedChange:C=>m({...f,showJoinAfterMatch:C})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:f.enabled,onCheckedChange:C=>m({...f,enabled:C})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(rn,{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:v,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const Pj={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function YV(){const[t,e]=y.useState([]),[n,r]=y.useState(0),[a,i]=y.useState(1),[o,c]=y.useState(10),[u,h]=y.useState(""),[f,m]=y.useState(!0),[g,b]=y.useState(null);async function N(){m(!0),b(null);try{const v=new URLSearchParams({page:String(a),pageSize:String(o)});u&&v.set("matchType",u);const k=await Oe(`/api/db/match-records?${v}`);k!=null&&k.success?(e(k.records||[]),r(k.total??0)):b("加载匹配记录失败")}catch(v){console.error("加载匹配记录失败",v),b("加载失败,请检查网络后重试")}finally{m(!1)}}y.useEffect(()=>{N()},[a,u]);const j=Math.ceil(n/o)||1;return s.jsxs("div",{className:"p-8 w-full",children:[g&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[s.jsx("span",{children:g}),s.jsx("button",{type:"button",onClick:()=>b(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"匹配记录"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["找伙伴匹配统计,共 ",n," 条记录"]})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("select",{value:u,onChange:v=>{h(v.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部类型"}),Object.entries(Pj).map(([v,k])=>s.jsx("option",{value:v,children:k},v))]}),s.jsxs("button",{type:"button",onClick:N,disabled:f,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(He,{className:`w-4 h-4 ${f?"animate-spin":""}`}),"刷新"]})]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(ps,{children:[s.jsx(ms,{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(gs,{children:[t.map(v=>s.jsxs(xt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(je,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[v.userAvatar?s.jsx("img",{src:ya(v.userAvatar),alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const T=k.currentTarget.nextElementSibling;T&&T.classList.remove("hidden")}}):null,s.jsx("span",{className:v.userAvatar?"hidden":"",children:(v.userNickname||v.userId||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white",children:v.userNickname||v.userId}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[v.userId.slice(0,16),"..."]})]})]})}),s.jsx(je,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[v.matchedUserAvatar?s.jsx("img",{src:ya(v.matchedUserAvatar),alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const T=k.currentTarget.nextElementSibling;T&&T.classList.remove("hidden")}}):null,s.jsx("span",{className:v.matchedUserAvatar?"hidden":"",children:(v.matchedNickname||v.matchedUserId||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white",children:v.matchedNickname||v.matchedUserId}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[v.matchedUserId.slice(0,16),"..."]})]})]})}),s.jsx(je,{children:s.jsx(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Pj[v.matchType]||v.matchType})}),s.jsxs(je,{className:"text-gray-400 text-sm",children:[v.phone&&s.jsxs("div",{children:["📱 ",v.phone]}),v.wechatId&&s.jsxs("div",{children:["💬 ",v.wechatId]}),!v.phone&&!v.wechatId&&"-"]}),s.jsx(je,{className:"text-gray-400",children:v.createdAt?new Date(v.createdAt).toLocaleString():"-"})]},v.id)),t.length===0&&s.jsx(xt,{children:s.jsx(je,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(qs,{page:a,totalPages:j,total:n,pageSize:o,onPageChange:i,onPageSizeChange:v=>{c(v),i(1)}})]})})})]})}function XV(){const[t,e]=y.useState([]),[n,r]=y.useState(!0);async function a(){r(!0);try{const i=await Oe("/api/db/vip-members?limit=100");if(i!=null&&i.success&&i.data){const o=[...i.data].map((c,u)=>({...c,vipSort:typeof c.vipSort=="number"?c.vipSort:u+1}));o.sort((c,u)=>(c.vipSort??999999)-(u.vipSort??999999)),e(o)}}catch(i){console.error("Load VIP members error:",i),G.error("加载 VIP 成员失败")}finally{r(!1)}}return y.useEffect(()=>{a()},[]),s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("div",{className:"flex justify-between items-center mb-8",children:s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Wc,{className:"w-5 h-5 text-amber-400"}),"用户管理 / 超级个体列表"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"这里展示所有有效超级个体用户,仅用于查看其基本信息与排序值。"})]})}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(ps,{children:[s.jsx(ms,{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(gs,{children:[t.map((i,o)=>{var c;return s.jsxs(xt,{className:"border-gray-700/50",children:[s.jsx(je,{className:"text-gray-300",children:o+1}),s.jsx(je,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[i.avatar?s.jsx("img",{src:ya(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(je,{className:"text-gray-300",children:i.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置超级个体)"})}),s.jsx(je,{className:"text-gray-300",children:i.vipSort??o+1})]},i.id)}),t.length===0&&s.jsx(xt,{children:s.jsx(je,{colSpan:5,className:"text-center py-12 text-gray-500",children:"当前没有有效的超级个体用户。"})})]})]})})})]})}function q4(t){const e=qa(),[n,r]=y.useState([]),[a,i]=y.useState(!0),[o,c]=y.useState(!1),[u,h]=y.useState(null),[f,m]=y.useState({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:0,enabled:!0,userId:""}),[g,b]=y.useState(!1),[N,j]=y.useState(!1),v=y.useRef(null),k=async L=>{var se;const Q=(se=L.target.files)==null?void 0:se[0];if(Q){j(!0);try{const $=new FormData;$.append("file",Q),$.append("folder","mentors");const ie=zu(),le={};ie&&(le.Authorization=`Bearer ${ie}`);const P=await(await fetch(Fl("/api/upload"),{method:"POST",body:$,credentials:"include",headers:le})).json();P!=null&&P.success&&(P!=null&&P.url)?m(Y=>({...Y,avatar:P.url})):G.error("上传失败: "+((P==null?void 0:P.error)||"未知错误"))}catch($){console.error($),G.error("上传失败")}finally{j(!1),v.current&&(v.current.value="")}}};async function T(){i(!0);try{const L=await Oe("/api/db/mentors");L!=null&&L.success&&L.data&&r(L.data)}catch(L){console.error("Load mentors error:",L)}finally{i(!1)}}y.useEffect(()=>{T()},[]);const C=()=>{m({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:n.length>0?Math.max(...n.map(L=>L.sort))+1:0,enabled:!0,userId:""})},R=()=>{h(null),C(),c(!0)},O=L=>{h(L),m({name:L.name,avatar:L.avatar||"",intro:L.intro||"",tags:L.tags||"",priceSingle:L.priceSingle!=null?String(L.priceSingle):"",priceHalfYear:L.priceHalfYear!=null?String(L.priceHalfYear):"",priceYear:L.priceYear!=null?String(L.priceYear):"",quote:L.quote||"",whyFind:L.whyFind||"",offering:L.offering||"",judgmentStyle:L.judgmentStyle||"",sort:L.sort,enabled:L.enabled??!0,userId:L.userId||""}),c(!0)},U=async()=>{if(!f.name.trim()){G.error("导师姓名不能为空");return}b(!0);try{const L=$=>$===""?void 0:parseFloat($),Q=f.userId.trim(),se={name:f.name.trim(),avatar:f.avatar.trim()||void 0,intro:f.intro.trim()||void 0,tags:f.tags.trim()||void 0,priceSingle:L(f.priceSingle),priceHalfYear:L(f.priceHalfYear),priceYear:L(f.priceYear),quote:f.quote.trim()||void 0,whyFind:f.whyFind.trim()||void 0,offering:f.offering.trim()||void 0,judgmentStyle:f.judgmentStyle.trim()||void 0,sort:f.sort,enabled:f.enabled};if(u){const $=await Xt("/api/db/mentors",{id:u.id,...se,userId:Q});$!=null&&$.success?(c(!1),T()):G.error("更新失败: "+($==null?void 0:$.error))}else{const $=await kt("/api/db/mentors",{...se,userId:Q||void 0});$!=null&&$.success?(c(!1),T()):G.error("新增失败: "+($==null?void 0:$.error))}}catch(L){console.error("Save error:",L),G.error("保存失败")}finally{b(!1)}},I=async L=>{if(confirm("确定删除该导师?"))try{const Q=await Ei(`/api/db/mentors?id=${L}`);Q!=null&&Q.success?T():G.error("删除失败: "+(Q==null?void 0:Q.error))}catch(Q){console.error("Delete error:",Q),G.error("删除失败")}},z=L=>L!=null?`¥${L}`:"-";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(Kn,{className:"w-5 h-5 text-[#38bdac]"}),"导师管理"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师列表;填写「绑定用户 ID」后,小程序导师详情可跳转「派对会员名片」(与超级个体同页)"})]}),s.jsxs(J,{onClick:R,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Fn,{className:"w-4 h-4 mr-2"}),"新增导师"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-0",children:a?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(ps,{children:[s.jsx(ms,{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-gray-400",children:"排序"}),s.jsx(Se,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(gs,{children:[n.map(L=>s.jsxs(xt,{className:"border-gray-700/50",children:[s.jsx(je,{className:"text-gray-300",children:L.id}),s.jsx(je,{children:s.jsxs("button",{type:"button",onClick:()=>e(`/users?search=${encodeURIComponent(L.name)}`),className:"text-[#38bdac] hover:text-[#2da396] hover:underline flex items-center gap-1",title:"在用户管理中查看",children:[L.name,s.jsx(_o,{className:"w-3 h-3"})]})}),s.jsx(je,{className:"text-gray-400 max-w-[200px] truncate",children:L.intro||"-"}),s.jsx(je,{className:"text-gray-400",children:z(L.priceSingle)}),s.jsx(je,{className:"text-gray-400",children:z(L.priceHalfYear)}),s.jsx(je,{className:"text-gray-400",children:z(L.priceYear)}),s.jsx(je,{className:"text-gray-400 font-mono text-xs max-w-[120px] truncate",title:L.userId||"",children:L.userId?s.jsx("button",{type:"button",onClick:()=>e(`/users?search=${encodeURIComponent(L.userId||"")}`),className:"text-[#38bdac] hover:underline truncate max-w-[120px] inline-block align-bottom",children:L.userId}):"—"}),s.jsx(je,{className:"text-gray-400",children:L.sort}),s.jsxs(je,{className:"text-right",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>O(L),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(sn,{className:"w-4 h-4"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>I(L.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(Zn,{className:"w-4 h-4"})})]})]},L.id)),n.length===0&&s.jsx(xt,{children:s.jsx(je,{colSpan:9,className:"text-center py-12 text-gray-500",children:"暂无导师,点击「新增导师」添加"})})]})]})})}),s.jsx(Dt,{open:o,onOpenChange:c,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg max-h-[90vh] overflow-y-auto",children:[s.jsx(_t,{children:s.jsx($t,{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(te,{className:"text-gray-300",children:"姓名 *"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:卡若",value:f.name,onChange:L=>m(Q=>({...Q,name:L.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"排序"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:f.sort,onChange:L=>m(Q=>({...Q,sort:parseInt(L.target.value,10)||0}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"头像"}),s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:f.avatar,onChange:L=>m(Q=>({...Q,avatar:L.target.value})),placeholder:"点击上传或粘贴图片地址"}),s.jsx("input",{ref:v,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:N,onClick:()=>{var L;return(L=v.current)==null?void 0:L.click()},children:[s.jsx(Af,{className:"w-4 h-4 mr-2"}),N?"上传中...":"上传"]})]}),f.avatar&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:ya(f.avatar.startsWith("http")?f.avatar:Fl(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(te,{className:"text-gray-300",children:"绑定用户 ID(可选,与名片页一致)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",placeholder:"小程序用户 id,填后导师详情显示「查看派对会员名片」",value:f.userId,onChange:L=>m(Q=>({...Q,userId:L.target.value}))}),s.jsx("p",{className:"text-xs text-gray-500",children:"留空则仅展示导师资料;填写后 C 端可跳转 member-detail 与超级个体同款名片。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"简介"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:结构判断型咨询 · Decision > Execution",value:f.intro,onChange:L=>m(Q=>({...Q,intro:L.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"技能标签(逗号分隔)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:项目结构判断、风险止损、人×项目匹配",value:f.tags,onChange:L=>m(Q=>({...Q,tags:L.target.value}))})]}),s.jsxs("div",{className:"border-t border-gray-700 pt-4",children:[s.jsx(te,{className:"text-gray-300 block mb-2",children:"价格配置(每个导师独立)"}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"单次咨询 ¥"}),s.jsx(ce,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"980",value:f.priceSingle,onChange:L=>m(Q=>({...Q,priceSingle:L.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{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:L=>m(Q=>({...Q,priceHalfYear:L.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{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:L=>m(Q=>({...Q,priceYear:L.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"引言"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:大多数人失败,不是因为不努力...",value:f.quote,onChange:L=>m(Q=>({...Q,quote:L.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"为什么找(文本)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:f.whyFind,onChange:L=>m(Q=>({...Q,whyFind:L.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"提供什么(文本)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:f.offering,onChange:L=>m(Q=>({...Q,offering:L.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"判断风格(逗号分隔)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:冷静、克制、偏风险视角",value:f.judgmentStyle,onChange:L=>m(Q=>({...Q,judgmentStyle:L.target.value}))})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",id:"enabled",checked:f.enabled,onChange:L=>m(Q=>({...Q,enabled:L.target.checked})),className:"rounded border-gray-600 bg-[#0a1628]"}),s.jsx(te,{htmlFor:"enabled",className:"text-gray-300 cursor-pointer",children:"上架(小程序可见)"})]})]}),s.jsxs(rn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>c(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(es,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:U,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),g?"保存中...":"保存"]})]})]})})]})}function ZV(){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($x,{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(He,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]})]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(ps,{children:[s.jsx(ms,{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(gs,{children:[t.map(h=>s.jsxs(xt,{className:"border-gray-700/50",children:[s.jsx(je,{className:"text-gray-300",children:h.id}),s.jsx(je,{className:"text-gray-400",children:h.userId}),s.jsx(je,{className:"text-gray-400",children:h.mentorId}),s.jsx(je,{className:"text-gray-400",children:u[h.consultationType]||h.consultationType}),s.jsxs(je,{className:"text-white",children:["¥",h.amount]}),s.jsx(je,{className:"text-gray-400",children:c[h.status]||h.status}),s.jsx(je,{className:"text-gray-500 text-sm",children:h.createdAt})]},h.id)),t.length===0&&s.jsx(xt,{children:s.jsx(je,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}const lu={poolSource:["vip"],requirePhone:!0,requireNickname:!0,requireAvatar:!1,requireBusiness:!1},Ij={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:lu},eH=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function tH(){const t=qa(),[e,n]=y.useState(Ij),[r,a]=y.useState(!0),[i,o]=y.useState(!1),[c,u]=y.useState(!1),[h,f]=y.useState(null),[m,g]=y.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),[b,N]=y.useState(null),[j,v]=y.useState(!1),k=async()=>{v(!0);try{const L=await Oe("/api/db/match-pool-counts");L!=null&&L.success&&L.data&&N(L.data)}catch(L){console.error("加载池子人数失败:",L)}finally{v(!1)}},T=async()=>{a(!0);try{const L=await Oe("/api/db/config/full?key=match_config"),Q=(L==null?void 0:L.data)??(L==null?void 0:L.config);if(Q){let se=Q.poolSettings??lu;se.poolSource&&!Array.isArray(se.poolSource)&&(se={...se,poolSource:[se.poolSource]}),n({...Ij,...Q,poolSettings:se})}}catch(L){console.error("加载匹配配置失败:",L)}finally{a(!1)}};y.useEffect(()=>{T(),k()},[]);const C=async()=>{o(!0);try{const L=await kt("/api/db/config",{key:"match_config",value:e,description:"匹配功能配置"});G.error((L==null?void 0:L.success)!==!1?"配置保存成功!":"保存失败: "+((L==null?void 0:L.error)||"未知错误"))}catch(L){console.error(L),G.error("保存失败")}finally{o(!1)}},R=L=>{f(L),g({...L}),u(!0)},O=()=>{f(null),g({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),u(!0)},U=()=>{if(!m.id||!m.label){G.error("请填写类型ID和名称");return}const L=[...e.matchTypes];if(h){const Q=L.findIndex(se=>se.id===h.id);Q!==-1&&(L[Q]={...m})}else{if(L.some(Q=>Q.id===m.id)){G.error("类型ID已存在");return}L.push({...m})}n({...e,matchTypes:L}),u(!1)},I=L=>{confirm("确定要删除这个匹配类型吗?")&&n({...e,matchTypes:e.matchTypes.filter(Q=>Q.id!==L)})},z=L=>{n({...e,matchTypes:e.matchTypes.map(Q=>Q.id===L?{...Q,enabled:!Q.enabled}:Q)})};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsxs(J,{variant:"outline",onClick:T,disabled:r,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{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(Tn,{className:"w-4 h-4 mr-2"})," ",i?"保存中...":"保存配置"]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(nk,{className:"w-5 h-5 text-blue-400"})," 匹配池选择"]}),s.jsx(qt,{className:"text-gray-400",children:"选择匹配的用户池和完善程度要求,只有满足条件的用户才可被匹配到"})]}),s.jsxs(_e,{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx(te,{className:"text-gray-300",children:"匹配来源池"}),s.jsx("p",{className:"text-gray-500 text-xs",children:"可同时勾选多个池子(取并集匹配)"}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[{value:"vip",label:"超级个体(VIP会员)",desc:"付费 ¥1980 的VIP会员",icon:"👑",countKey:"vip"},{value:"complete",label:"完善资料用户",desc:"符合下方完善度要求的用户",icon:"✅",countKey:"complete"},{value:"all",label:"全部用户",desc:"所有已注册用户",icon:"👥",countKey:"all"}].map(L=>{const Q=e.poolSettings??lu,$=(Array.isArray(Q.poolSource)?Q.poolSource:[Q.poolSource]).includes(L.value),ie=b==null?void 0:b[L.countKey],le=()=>{const me=Array.isArray(Q.poolSource)?[...Q.poolSource]:[Q.poolSource],P=$?me.filter(Y=>Y!==L.value):[...me,L.value];P.length===0&&P.push(L.value),n({...e,poolSettings:{...Q,poolSource:P}})};return s.jsxs("button",{type:"button",onClick:le,className:`p-4 rounded-lg border text-left transition-all ${$?"border-[#38bdac] bg-[#38bdac]/10":"border-gray-700 bg-[#0a1628] hover:border-gray-600"}`,children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:`w-5 h-5 rounded border-2 flex items-center justify-center text-xs ${$?"border-[#38bdac] bg-[#38bdac] text-white":"border-gray-600"}`,children:$&&"✓"}),s.jsx("span",{className:"text-xl",children:L.icon}),s.jsx("span",{className:`text-sm font-medium ${$?"text-[#38bdac]":"text-gray-300"}`,children:L.label})]}),s.jsxs("span",{className:"text-lg font-bold text-white",children:[j?"...":ie??"-",s.jsx("span",{className:"text-xs text-gray-500 font-normal ml-1",children:"人"})]})]}),s.jsx("p",{className:"text-gray-500 text-xs mt-2",children:L.desc}),s.jsx("span",{role:"link",tabIndex:0,onClick:me=>{me.stopPropagation(),t(`/users?pool=${L.value}`)},onKeyDown:me=>{me.key==="Enter"&&(me.stopPropagation(),t(`/users?pool=${L.value}`))},className:"text-[#38bdac] text-xs mt-2 inline-block hover:underline cursor-pointer",children:"查看用户列表 →"})]},L.value)})})]}),s.jsxs("div",{className:"space-y-3 pt-4 border-t border-gray-700/50",children:[s.jsx(te,{className:"text-gray-300",children:"用户资料完善要求(被匹配用户必须满足以下条件)"}),s.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[{key:"requirePhone",label:"有手机号",icon:"📱"},{key:"requireNickname",label:"有昵称",icon:"👤"},{key:"requireAvatar",label:"有头像",icon:"🖼️"},{key:"requireBusiness",label:"有业务需求",icon:"💼"}].map(L=>{const se=(e.poolSettings??lu)[L.key];return s.jsxs("div",{className:"flex items-center gap-3 bg-[#0a1628] rounded-lg p-3",children:[s.jsx(Ut,{checked:se,onCheckedChange:$=>n({...e,poolSettings:{...e.poolSettings??lu,[L.key]:$}})}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{children:L.icon}),s.jsx(te,{className:"text-gray-300 text-sm",children:L.label})]})]},L.key)})})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx($o,{className:"w-5 h-5 text-yellow-400"})," 基础设置"]}),s.jsx(qt,{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(te,{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:L=>n({...e,freeMatchLimit:parseInt(L.target.value,10)||0})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"付费匹配价格(元)"}),s.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:e.matchPrice,onChange:L=>n({...e,matchPrice:parseFloat(L.target.value)||1})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"每日最大匹配次数"}),s.jsx(ce,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.settings.maxMatchesPerDay,onChange:L=>n({...e,settings:{...e.settings,maxMatchesPerDay:parseInt(L.target.value,10)||10}})})]})]}),s.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:e.settings.enableFreeMatches,onCheckedChange:L=>n({...e,settings:{...e.settings,enableFreeMatches:L}})}),s.jsx(te,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:e.settings.enablePaidMatches,onCheckedChange:L=>n({...e,settings:{...e.settings,enablePaidMatches:L}})}),s.jsx(te,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Kn,{className:"w-5 h-5 text-[#38bdac]"})," 匹配类型管理"]}),s.jsx(qt,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(J,{onClick:O,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Fn,{className:"w-4 h-4 mr-1"})," 添加类型"]})]}),s.jsx(_e,{children:s.jsxs(ps,{children:[s.jsx(ms,{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(gs,{children:e.matchTypes.map(L=>s.jsxs(xt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(je,{children:s.jsx("span",{className:"text-2xl",children:L.icon})}),s.jsx(je,{className:"font-mono text-gray-300",children:L.id}),s.jsx(je,{className:"text-white font-medium",children:L.label}),s.jsx(je,{className:"text-gray-300",children:L.matchLabel}),s.jsx(je,{children:s.jsxs(Be,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",L.price]})}),s.jsx(je,{children:L.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(je,{children:s.jsx(Ut,{checked:L.enabled,onCheckedChange:()=>z(L.id)})}),s.jsx(je,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>R(L),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(sn,{className:"w-4 h-4"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>I(L.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(Zn,{className:"w-4 h-4"})})]})})]},L.id))})]})})]}),s.jsx(Dt,{open:c,onOpenChange:u,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[h?s.jsx(sn,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(Fn,{className:"w-5 h-5 text-[#38bdac]"}),h?"编辑匹配类型":"添加匹配类型"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"类型ID(英文)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:m.id,onChange:L=>g({...m,id:L.target.value}),disabled:!!h})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:eH.map(L=>s.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${m.icon===L?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>g({...m,icon:L}),children:L},L))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"显示名称"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.label,onChange:L=>g({...m,label:L.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"匹配标签"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.matchLabel,onChange:L=>g({...m,matchLabel:L.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"单次匹配价格(元)"}),s.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:m.price,onChange:L=>g({...m,price:parseFloat(L.target.value)||1})})]}),s.jsxs("div",{className:"flex gap-6 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:m.matchFromDB,onCheckedChange:L=>g({...m,matchFromDB:L})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:m.showJoinAfterMatch,onCheckedChange:L=>g({...m,showJoinAfterMatch:L})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:m.enabled,onCheckedChange:L=>g({...m,enabled:L})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(rn,{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:U,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"})," 保存"]})]})]})})]})}const Rj={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function nH(){const[t,e]=y.useState([]),[n,r]=y.useState(0),[a,i]=y.useState(1),[o,c]=y.useState(10),[u,h]=y.useState(""),[f,m]=y.useState(!0),[g,b]=y.useState(null),[N,j]=y.useState(null);async function v(){m(!0),b(null);try{const C=new URLSearchParams({page:String(a),pageSize:String(o)});u&&C.set("matchType",u);const 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(()=>{v()},[a,u]);const k=Math.ceil(n/o)||1,T=({userId:C,nickname:R,avatar:O})=>s.jsxs("div",{className:"flex items-center gap-3 cursor-pointer group",onClick:()=>j(C),children:[s.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[O?s.jsx("img",{src:ya(O),alt:"",className:"w-full h-full object-cover",onError:U=>{U.currentTarget.style.display="none"}}):null,s.jsx("span",{className:O?"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:[g&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[s.jsx("span",{children:g}),s.jsx("button",{type:"button",onClick:()=>b(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("p",{className:"text-gray-400",children:["共 ",n," 条匹配记录 · 点击用户名查看详情"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("select",{value:u,onChange:C=>{h(C.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部类型"}),Object.entries(Rj).map(([C,R])=>s.jsx("option",{value:C,children:R},C))]}),s.jsxs("button",{type:"button",onClick:v,disabled:f,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(He,{className:`w-4 h-4 ${f?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(ps,{children:[s.jsx(ms,{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(gs,{children:[t.map(C=>s.jsxs(xt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(je,{children:s.jsx(T,{userId:C.userId,nickname:C.userNickname,avatar:C.userAvatar})}),s.jsx(je,{children:C.matchedUserId?s.jsx(T,{userId:C.matchedUserId,nickname:C.matchedNickname,avatar:C.matchedUserAvatar}):s.jsx("span",{className:"text-gray-500",children:"—"})}),s.jsx(je,{children:s.jsx(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Rj[C.matchType]||C.matchType})}),s.jsxs(je,{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(je,{className:"text-gray-400",children:C.createdAt?new Date(C.createdAt).toLocaleString():"-"})]},C.id)),t.length===0&&s.jsx(xt,{children:s.jsx(je,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(qs,{page:a,totalPages:k,total:n,pageSize:o,onPageChange:i,onPageSizeChange:C=>{c(C),i(1)}})]})})}),s.jsx(fy,{open:!!N,onClose:()=>j(null),userId:N,onUserUpdated:v})]})}function sH(){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(nH,{}),t==="pool"&&s.jsx(tH,{})]})}const Lj={investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function rH(){const[t,e]=y.useState([]),[n,r]=y.useState(0),[a,i]=y.useState(1),[o,c]=y.useState(10),[u,h]=y.useState(!0),[f,m]=y.useState("investor"),[g,b]=y.useState(null);async function N(){h(!0);try{const T=new URLSearchParams({page:String(a),pageSize:String(o),matchType:f}),C=await Oe(`/api/db/match-records?${T}`);C!=null&&C.success&&(e(C.records||[]),r(C.total??0))}catch(T){console.error(T)}finally{h(!1)}}y.useEffect(()=>{N()},[a,f]);const j=async T=>{if(!T.phone&&!T.wechatId){G.info("该记录无联系方式,无法推送到存客宝");return}b(T.id);try{const C=await kt("/api/ckb/join",{type:T.matchType||"investor",phone:T.phone||"",wechat:T.wechatId||"",userId:T.userId,name:T.userNickname||""});G.error((C==null?void 0:C.message)||(C!=null&&C.success?"推送成功":"推送失败"))}catch(C){G.error("推送失败: "+(C instanceof Error?C.message:"网络错误"))}finally{b(null)}},v=Math.ceil(n/o)||1,k=T=>!!(T.phone||T.wechatId);return s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400",children:"点击获客:有人填写手机号/微信号的直接显示,可一键推送到存客宝"}),s.jsxs("p",{className:"text-gray-500 text-xs mt-1",children:["共 ",n," 条记录 — 有联系方式的可触发存客宝添加好友"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("select",{value:f,onChange:T=>{m(T.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:Object.entries(Lj).map(([T,C])=>s.jsx("option",{value:T,children:C},T))}),s.jsxs(J,{onClick:N,disabled:u,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${u?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(ps,{children:[s.jsx(ms,{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(gs,{children:[t.map(T=>{var C,R;return s.jsxs(xt,{className:`border-gray-700/50 ${k(T)?"hover:bg-[#0a1628]":"opacity-60"}`,children:[s.jsx(je,{className:"text-white",children:T.userNickname||((C=T.userId)==null?void 0:C.slice(0,12))}),s.jsx(je,{className:"text-white",children:T.matchedNickname||((R=T.matchedUserId)==null?void 0:R.slice(0,12))}),s.jsx(je,{children:s.jsx(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Lj[T.matchType]||T.matchType})}),s.jsxs(je,{className:"text-sm",children:[T.phone&&s.jsxs("div",{className:"text-green-400",children:["📱 ",T.phone]}),T.wechatId&&s.jsxs("div",{className:"text-blue-400",children:["💬 ",T.wechatId]}),!T.phone&&!T.wechatId&&s.jsx("span",{className:"text-gray-600",children:"无联系方式"})]}),s.jsx(je,{className:"text-gray-400 text-sm",children:T.createdAt?new Date(T.createdAt).toLocaleString():"-"}),s.jsx(je,{className:"text-right",children:k(T)?s.jsxs(J,{size:"sm",onClick:()=>j(T),disabled:g===T.id,className:"bg-[#38bdac] hover:bg-[#2da396] text-white text-xs h-7 px-3",children:[s.jsx(uA,{className:"w-3 h-3 mr-1"}),g===T.id?"推送中...":"推送CKB"]}):s.jsx("span",{className:"text-gray-600 text-xs",children:"—"})})]},T.id)}),t.length===0&&s.jsx(xt,{children:s.jsx(je,{colSpan:6,className:"text-center py-12 text-gray-500",children:"暂无记录"})})]})]}),s.jsx(qs,{page:a,totalPages:v,total:n,pageSize:o,onPageChange:i,onPageSizeChange:T=>{c(T),i(1)}})]})})})]})}const Oj={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},aH={single:"单次",half_year:"半年",year:"年度"};function iH(){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(Oj).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(He,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(ps,{children:[s.jsx(ms,{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(gs,{children:[t.map(c=>s.jsxs(xt,{className:"border-gray-700/50",children:[s.jsx(je,{className:"text-gray-300",children:c.id}),s.jsx(je,{className:"text-gray-400",children:c.userId}),s.jsx(je,{className:"text-gray-400",children:c.mentorId}),s.jsx(je,{className:"text-gray-400",children:aH[c.consultationType]||c.consultationType}),s.jsxs(je,{className:"text-white",children:["¥",c.amount]}),s.jsx(je,{className:"text-gray-400",children:Oj[c.status]||c.status}),s.jsx(je,{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(je,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}function oH(){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(iH,{}),t==="manage"&&s.jsx("div",{className:"-mx-8",children:s.jsx(q4,{embedded:!0})})]})}function lH(){const[t,e]=y.useState([]),[n,r]=y.useState(0),[a,i]=y.useState(1),[o,c]=y.useState(10),[u,h]=y.useState(!0);async function f(){h(!0);try{const g=new URLSearchParams({page:String(a),pageSize:String(o),matchType:"team"}),b=await Oe(`/api/db/match-records?${g}`);b!=null&&b.success&&(e(b.records||[]),r(b.total??0))}catch(g){console.error(g)}finally{h(!1)}}y.useEffect(()=>{f()},[a]);const m=Math.ceil(n/o)||1;return s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("div",{children:[s.jsxs("p",{className:"text-gray-400",children:["团队招募匹配记录,共 ",n," 条"]}),s.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"用户通过「团队招募」提交联系方式到存客宝"})]}),s.jsxs("button",{type:"button",onClick:f,disabled:u,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(He,{className:`w-4 h-4 ${u?"animate-spin":""}`})," 刷新"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(ps,{children:[s.jsx(ms,{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(gs,{children:[t.map(g=>s.jsxs(xt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(je,{className:"text-white",children:g.userNickname||g.userId}),s.jsx(je,{className:"text-white",children:g.matchedNickname||g.matchedUserId}),s.jsxs(je,{className:"text-gray-400 text-sm",children:[g.phone&&s.jsxs("div",{children:["📱 ",g.phone]}),g.wechatId&&s.jsxs("div",{children:["💬 ",g.wechatId]}),!g.phone&&!g.wechatId&&"-"]}),s.jsx(je,{className:"text-gray-400",children:g.createdAt?new Date(g.createdAt).toLocaleString():"-"})]},g.id)),t.length===0&&s.jsx(xt,{children:s.jsx(je,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无团队招募记录"})})]})]}),s.jsx(qs,{page:a,totalPages:m,total:n,pageSize:o,onPageChange:i,onPageSizeChange:g=>{c(g),i(1)}})]})})})]})}const cH=["partner","investor","mentor","team"],Rx=[{key:"join_partner",label:"找伙伴场景"},{key:"join_investor",label:"资源对接场景"},{key:"join_mentor",label:"导师顾问场景"},{key:"join_team",label:"团队招募场景"},{key:"match",label:"匹配上报"},{key:"lead",label:"链接卡若"}],Dj=`# 场景获客接口摘要 -======== -}`})]})]}),s.jsx("p",{className:"text-gray-500 text-xs mt-6",children:"管理端主要使用 /api/admin/*、/api/db/*;富文本素材上传另用公共接口 /api/upload(与后台编辑器一致)。小程序使用 /api/miniprogram/*。完整实现见 soul-api 源码。"})]})}const Ii="/pages/member-detail/member-detail",$a="/pages/read/read",Fa={[Ii]:"成员详情",[$a]:"文章详情 / 阅读"},Ix=[{value:"/pages/index/index",label:"首页"},{value:"/pages/chapters/chapters",label:"目录"},{value:"/pages/match/match",label:"找伙伴"},{value:"/pages/my/my",label:"我的"},{value:"/pages/read/read",label:"文章详情 / 阅读"},{value:"/pages/link-preview/link-preview",label:"链接预览"},{value:"/pages/agreement/agreement",label:"用户协议"},{value:"/pages/privacy/privacy",label:"隐私政策"},{value:"/pages/referral/referral",label:"邀请"},{value:"/pages/purchases/purchases",label:"购买记录"},{value:"/pages/reading-records/reading-records",label:"阅读记录"},{value:"/pages/settings/settings",label:"设置"},{value:"/pages/search/search",label:"搜索"},{value:"/pages/addresses/addresses",label:"地址列表"},{value:"/pages/addresses/edit",label:"编辑地址"},{value:"/pages/withdraw-records/withdraw-records",label:"提现记录"},{value:"/pages/wallet/wallet",label:"钱包"},{value:"/pages/vip/vip",label:"会员中心"},{value:"/pages/member-detail/member-detail",label:"成员详情"},{value:"/pages/mentors/mentors",label:"导师列表"},{value:"/pages/mentor-detail/mentor-detail",label:"导师详情"},{value:"/pages/profile-show/profile-show",label:"资料展示"},{value:"/pages/profile-edit/profile-edit",label:"编辑资料"},{value:"/pages/avatar-nickname/avatar-nickname",label:"头像昵称"},{value:"/pages/gift-pay/detail",label:"礼物支付 · 详情"},{value:"/pages/gift-pay/list",label:"礼物支付 · 列表"},{value:"/pages/gift-pay/redemption-detail",label:"礼物支付 · 兑换详情"},{value:"/pages/dev-login/dev-login",label:"开发登录"}],jV=$a;function jj(t){const e=String(t.pageName??"").trim();return e||Fa[t.pagePath]||"—"}function kV(t){const e=String(t??"").trim();return e==="singlePage"||e==="single_page"?"singlePage":"fullApp"}function kj(t){return t==="singlePage"?"单页面":"多页面"}function Mo(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`pp-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function ub(t){return/^[a-zA-Z][a-zA-Z0-9_]*$/.test(t.trim())}function SV(t){if(!t||typeof t!="object"||Array.isArray(t))return[];const e=t.pagePopupItems;if(!Array.isArray(e))return[];const n=[];return e.forEach(r=>{if(!r||typeof r!="object"||Array.isArray(r))return;const a=r,i=String(a.key??"").trim();if(!ub(i))return;const o=String(a.pagePath??"").trim();o.startsWith("/")&&n.push({id:typeof a.id=="string"&&a.id.trim()?a.id.trim():Mo(),pageName:String(a.pageName??"").trim(),pagePath:o,scope:kV(a.scope),key:i,behavior:String(a.behavior??"").trim()||"—",content:String(a.content??"")})}),n}function CV(t){if(!t||typeof t!="object"||Array.isArray(t))return[];const e=t,n=[],r=e.memberDetailPage;if(r&&typeof r=="object"&&!Array.isArray(r)){const o=r;typeof o.unlockIntroTitle=="string"&&o.unlockIntroTitle.trim()&&n.push({id:Mo(),pageName:Fa[Ii],pagePath:Ii,scope:"fullApp",key:"unlockIntroTitle",behavior:"解锁前说明弹窗 · 标题(wx.showModal title)",content:o.unlockIntroTitle}),typeof o.unlockIntroBody=="string"&&o.unlockIntroBody.trim()&&n.push({id:Mo(),pageName:Fa[Ii],pagePath:Ii,scope:"fullApp",key:"unlockIntroBody",behavior:"解锁前说明弹窗 · 正文(wx.showModal content)",content:o.unlockIntroBody})}const a=e.readPage;if(a&&typeof a=="object"&&!Array.isArray(a)){const o=a,c=[["beforeLoginHint","未登录时付费墙上方说明","fullApp"],["singlePageTitle","朋友圈单页 · 付费区标题","singlePage"],["singlePagePaywallHint","朋友圈单页 · 付费墙说明","singlePage"]];for(const[u,h,f]of c)typeof o[u]=="string"&&String(o[u]).trim()&&n.push({id:Mo(),pageName:Fa[$a],pagePath:$a,scope:f,key:u,behavior:h,content:String(o[u])})}const i=e.customPagePopups;return Array.isArray(i)&&i.forEach((o,c)=>{if(!o||typeof o!="object"||Array.isArray(o))return;const u=o,h=String(u.pagePath??"").trim();if(!h.startsWith("/"))return;const f=String(u.pageName??"").trim(),m=(g,b,N,j)=>{if(typeof N!="string"||!N.trim())return;const v=`c${c}_${g}`;ub(v)&&n.push({id:Mo(),pageName:f||Fa[h]||"",pagePath:h,scope:j,key:v,behavior:`${b}(旧版 customPagePopups 迁移)`,content:N})};m("fullModalTitle","完整端弹窗标题",u.fullModalTitle,"fullApp"),m("fullModalBody","完整端弹窗正文",u.fullModalBody,"fullApp"),m("singlePageTitle","单页标题",u.singlePageTitle,"singlePage"),m("singlePageBody","单页说明",u.singlePageBody,"singlePage")}),n}const EV=new Set(["memberDetailPage","readPage","customPagePopups","pagePopupItems"]);function TV(t){const e={};if(!t||typeof t!="object"||Array.isArray(t))return e;const n=t;for(const r of Object.keys(n))EV.has(r)||(e[r]=n[r]);return e}function MV(t){let e=SV(t);return e.length===0&&(e=CV(t)),{extra:TV(t),pagePopupItems:AV(e)}}function AV(t){const e=new Set,n=[];for(const r of t){const a=`${r.pagePath}\0${r.key}`;e.has(a)||(e.add(a),n.push(r))}return n}function IV(t,e){const n={...e};n.pagePopupItems=t.map(a=>({id:a.id,pageName:String(a.pageName??"").trim(),pagePath:a.pagePath.trim(),scope:a.scope==="singlePage"?"singlePage":"fullApp",key:a.key.trim(),behavior:a.behavior.trim()||"—",content:a.content})),delete n.memberDetailPage,delete n.readPage,delete n.customPagePopups;const r=n.chaptersPage;if(r&&typeof r=="object"&&!Array.isArray(r)){const a=r??{};delete a.sectionNewBadgeText;const i=String(a.newBadgeText??"").trim();i?a.newBadgeText=i:delete a.newBadgeText}return n}function PV(t){const e=String(t.content||"").replace(/\s+/g," ").trim();return e.length>56?`${e.slice(0,56)}…`:e||"—"}const RV=[{pageName:Fa[Ii],pagePath:Ii,scope:"fullApp",key:"unlockIntroTitle",behavior:"解锁前说明弹窗 · 标题(wx.showModal title)",content:"解锁与链接说明"},{pageName:Fa[Ii],pagePath:Ii,scope:"fullApp",key:"unlockIntroBody",behavior:"解锁前说明弹窗 · 正文(wx.showModal content)",content:`「链接」用于提交留资,由对方通过获客计划跟进;「解锁」用于复制手机/微信号后自行添加好友。 - -请确认已了解后再登录。`},{pageName:Fa[$a],pagePath:$a,scope:"fullApp",key:"beforeLoginHint",behavior:"未登录时付费墙上方说明",content:"试读进度与下方百分比以后台配置为准;登录后可购买解锁全文。"},{pageName:Fa[$a],pagePath:$a,scope:"singlePage",key:"singlePageTitle",behavior:"朋友圈单页 · 付费区标题",content:"解锁全文"},{pageName:Fa[$a],pagePath:$a,scope:"singlePage",key:"singlePagePaywallHint",behavior:"朋友圈单页 · 付费墙说明",content:"当前为朋友圈单页预览,无法在此登录或付款。请点击底部「前往小程序」进入完整版后再解锁本章。"}];function LV(){return RV.map(t=>({...t,id:Mo()}))}const Oc=10,Sj=()=>({id:Mo(),pageName:"",pagePath:jV,scope:"fullApp",key:"",behavior:"",content:""});function OV({pagePopupItems:t,setPagePopupItems:e,extraKeysCount:n}){const[r,a]=y.useState(""),[i,o]=y.useState(!1),[c,u]=y.useState("add"),[h,f]=y.useState(Sj()),[m,g]=y.useState(null),[b,N]=y.useState(1),j=y.useMemo(()=>{const P=h.pagePath.trim();return Ix.some(z=>z.value===P)?P:"__other__"},[h.pagePath]),v=y.useMemo(()=>{const P=r.trim().toLowerCase();return P?t.filter(z=>`${z.pageName} ${z.pagePath} ${kj(z.scope)} ${z.key} ${z.behavior} ${z.content} ${jj(z)}`.toLowerCase().includes(P)):t},[r,t]),k=y.useMemo(()=>Math.max(1,Math.ceil(v.length/Oc)),[v.length]),T=y.useMemo(()=>{const P=(b-1)*Oc;return v.slice(P,P+Oc)},[v,b]);y.useEffect(()=>{N(1)},[r]),y.useEffect(()=>{N(P=>Math.min(P,k))},[k]);const C=()=>{f(Sj()),u("add"),o(!0)},R=P=>{f({...P,scope:P.scope==="singlePage"?"singlePage":"fullApp"}),u("edit"),o(!0)},O=()=>{const P=h.pagePath.trim(),z=h.key.trim();if(!P.startsWith("/")){G.error("页面路径须以 / 开头");return}if(!ub(z)){G.error("键名须为英文:字母开头,仅字母、数字、下划线");return}if(!h.behavior.trim()){G.error("请填写行为说明");return}if(t.some(Q=>Q.pagePath===P&&Q.key===z&&Q.id!==h.id)){G.error("同一页面下键名不能重复");return}c==="add"?(e(Q=>[...Q,{...h,id:h.id||Mo()}]),G.success("已添加,请点击右上角「保存设置」提交")):(e(Q=>Q.map(se=>se.id===h.id?{...h}:se)),G.success("已更新,请点击「保存设置」提交")),o(!1)},U=()=>{m&&(e(P=>P.filter(z=>z.id!==m)),G.success("已删除,请点击「保存设置」提交"),g(null))};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(sk,{className:"w-5 h-5 text-[#38bdac]"}),"弹窗文案(按页面 + 键)"]}),s.jsxs(qt,{className:"text-gray-400",children:["先",s.jsx("strong",{className:"text-gray-300",children:"新增"}),"文案:填写",s.jsx("strong",{className:"text-gray-300",children:"页面名称"}),"、路径、",s.jsx("strong",{className:"text-gray-300",children:"类型"}),"(单页面 / 多页面)、",s.jsx("strong",{className:"text-[#38bdac]",children:"英文键名"}),"、行为说明、文案内容。 小程序通过 ",s.jsx("code",{className:"text-[#38bdac]/90",children:"pagePath + key"})," 从 ",s.jsx("code",{className:"text-[#38bdac]/90",children:"mpConfig.mpUi.pagePopupItems"})," 读取。 同一页面可配置多条(不同 key)。下方表格每页展示 ",Oc," 条;全部条目随右上角「保存设置」写入数据库,与分页无关。"]})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsx("p",{className:"text-xs text-gray-500",children:n>0?`另有 ${n} 类其它 mpUi 已保留,保存时一并写回。`:"保存后约 5 分钟内随配置缓存刷新。"}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(J,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-200",title:"用与小程序对齐的 5 条标准文案替换当前列表,再点「保存设置」写入数据库。迁移完成后可移除此按钮。",onClick:()=>{e(LV()),G.info("已填入标准 5 条,请点击「保存设置」写入数据库")},children:[s.jsx(aA,{className:"w-3.5 h-3.5 mr-1.5"}),"填入默认种子"]}),s.jsxs(J,{type:"button",size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",onClick:C,children:[s.jsx(M5,{className:"w-3.5 h-3.5 mr-1.5"}),"新增文案"]})]})]}),s.jsxs("div",{className:"space-y-2 max-w-xl w-full",children:[s.jsxs(te,{className:"text-gray-400 text-xs flex items-center gap-1.5",children:[s.jsx(pa,{className:"w-3.5 h-3.5"}),"筛选(页面名称 / 类型 / 路径 / 键 / 行为 / 正文)"]}),s.jsx("div",{className:"rounded-md border border-gray-700 bg-[#0a1628] px-3 h-10 flex items-center",children:s.jsx(ce,{className:"border-0 bg-transparent text-white h-9 px-0 shadow-none focus-visible:ring-0 placeholder:text-gray-600",placeholder:"例如:read、beforeLogin、singlePage…",value:r,onChange:P=>a(P.target.value)})})]}),s.jsxs("div",{className:"rounded-lg border border-gray-700/80 overflow-x-auto w-full",children:[s.jsxs(us,{className:"w-full min-w-[1320px] table-fixed",children:[s.jsx(hs,{children:s.jsxs(xt,{className:"border-gray-700 hover:bg-[#0a1628]/80 bg-[#0a1628]",children:[s.jsx(Se,{className:"text-gray-300 w-[11%] min-w-[108px]",children:"页面名称"}),s.jsx(Se,{className:"text-gray-300 w-[8%] min-w-[88px]",children:"类型"}),s.jsx(Se,{className:"text-gray-300 w-[19%] min-w-[200px]",children:"页面路径"}),s.jsx(Se,{className:"text-gray-300 w-[10%] min-w-[108px]",children:"键名(英文)"}),s.jsx(Se,{className:"text-gray-300 w-[13%] min-w-[108px]",children:"行为"}),s.jsx(Se,{className:"text-gray-300 w-[25%] min-w-[220px]",children:"文案摘要"}),s.jsx(Se,{className:"text-gray-300 text-right w-[14%] min-w-[200px] whitespace-nowrap",children:"操作"})]})}),s.jsx(fs,{children:T.map(P=>s.jsxs(xt,{className:"border-gray-800 hover:bg-[#0f2137]/90",children:[s.jsx(je,{className:"text-sm text-gray-200 align-top font-medium",children:jj(P)}),s.jsx(je,{className:"align-top",children:s.jsx(Be,{variant:P.scope==="singlePage"?"outline":"secondary",className:P.scope==="singlePage"?"border-amber-500/50 text-amber-200/95 text-[11px]":"text-[11px]",children:kj(P.scope)})}),s.jsx(je,{className:"font-mono text-xs text-[#38bdac]/95 align-top break-all",children:P.pagePath}),s.jsx(je,{className:"font-mono text-xs text-amber-200/90 align-top break-all",children:P.key}),s.jsx(je,{className:"text-xs text-gray-300 align-top",children:P.behavior}),s.jsx(je,{className:"text-xs align-top max-w-[220px] min-w-0 py-2",children:s.jsx("div",{className:"line-clamp-1 min-w-0 text-gray-400 break-all cursor-default",title:String(P.content??"").replace(/\s+/g," ").trim()||"—",children:PV(P)})}),s.jsx(je,{className:"align-middle text-right",children:s.jsxs("div",{className:"inline-flex flex-nowrap items-center justify-end gap-1 min-w-[168px]",children:[s.jsxs(J,{type:"button",variant:"ghost",size:"sm",className:"h-8 shrink-0 px-2.5 text-[#38bdac]",onClick:()=>R(P),children:[s.jsx(Ux,{className:"w-3.5 h-3.5 mr-1"}),"编辑"]}),s.jsxs(J,{type:"button",variant:"ghost",size:"sm",className:"h-8 shrink-0 px-2.5 text-gray-400 hover:text-red-400",onClick:()=>g(P.id),children:[s.jsx(Yn,{className:"w-3.5 h-3.5 mr-1"}),"删除"]})]})})]},P.id))})]}),v.length===0&&s.jsx("p",{className:"text-center text-sm text-gray-500 py-8",children:"无数据,请点击「新增文案」或「填入默认种子」"}),v.length>0&&k>1&&s.jsx(Us,{page:b,totalPages:k,total:v.length,pageSize:Oc,onPageChange:N}),v.length>0&&k<=1&&s.jsxs("div",{className:"flex items-center py-3 px-5 border-t border-gray-700/50 text-sm text-gray-400",children:["共 ",v.length," 条,每页 ",Oc," 条"]})]})]})]}),s.jsx(Dt,{open:i,onOpenChange:o,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl w-[min(100vw-2rem,42rem)] max-h-[90vh] overflow-y-auto",children:[s.jsxs(_t,{children:[s.jsx($t,{children:c==="add"?"新增弹窗文案":"编辑弹窗文案"}),s.jsxs(Qc,{className:"text-gray-400",children:["键名在小程序代码中与 ",s.jsx("code",{className:"text-[#38bdac]/90",children:"pagePath"})," 联合使用,请与开发约定后勿随意改键。"]})]}),s.jsxs("div",{className:"space-y-4 py-2",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"页面名称"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-600 text-white",placeholder:"如:文章详情 / 阅读",value:h.pageName,onChange:P=>f(z=>({...z,pageName:P.target.value}))}),s.jsx("p",{className:"text-[11px] text-gray-500",children:"便于表格识别;可与路径列对照,留空时对常见路径会自动显示默认名称。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"页面路径"}),s.jsxs(wo,{value:j,onValueChange:P=>{f(P==="__other__"?z=>{const L=z.pagePath.trim(),Q=Ix.some(se=>se.value===L);return{...z,pagePath:Q?"/pages/":z.pagePath}}:z=>({...z,pagePath:P}))},children:[s.jsx(Ei,{className:"bg-[#0a1628] border-gray-600 text-white font-mono text-sm w-full",children:s.jsx(jo,{placeholder:"选择页面路径"})}),s.jsxs(Ti,{className:"max-h-[min(60vh,320px)]",children:[Ix.map(P=>s.jsxs(cs,{value:P.value,className:"focus:bg-[#1a3a4a] focus:text-white font-mono text-xs",children:[s.jsx("span",{className:"text-gray-200",children:P.label}),s.jsx("span",{className:"text-gray-500 ml-2",children:P.value})]},P.value)),s.jsx(cs,{value:"__other__",className:"focus:bg-[#1a3a4a] focus:text-white",children:"自定义路径…"})]})]}),j==="__other__"&&s.jsx(ce,{className:"bg-[#0a1628] border-gray-600 text-white font-mono text-sm",placeholder:"/pages/xxx/xxx",value:h.pagePath,onChange:P=>f(z=>({...z,pagePath:P.target.value}))}),s.jsx("p",{className:"text-[11px] text-gray-500",children:"从列表选择常用页面;若路径未收录(如分包页),选「自定义路径」后手动填写。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"类型"}),s.jsxs(wo,{value:h.scope,onValueChange:P=>f(z=>({...z,scope:P==="singlePage"?"singlePage":"fullApp"})),children:[s.jsx(Ei,{className:"bg-[#0a1628] border-gray-600 text-white",children:s.jsx(jo,{placeholder:"选择类型"})}),s.jsxs(Ti,{children:[s.jsx(cs,{value:"fullApp",className:"focus:bg-[#1a3a4a] focus:text-white",children:"多页面(完整小程序)"}),s.jsx(cs,{value:"singlePage",className:"focus:bg-[#1a3a4a] focus:text-white",children:"单页面(朋友圈预览等)"})]})]}),s.jsx("p",{className:"text-[11px] text-gray-500",children:"单页面:微信单页场景(如 1154);多页面:用户进入完整小程序后的页面。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"键名(英文,自定义)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-600 text-white font-mono text-sm",placeholder:"beforeLoginHint",value:h.key,disabled:c==="edit",onChange:P=>f(z=>({...z,key:P.target.value.replace(/[^a-zA-Z0-9_]/g,"")}))}),c==="edit"&&s.jsx("p",{className:"text-[11px] text-gray-500",children:"编辑时不可改键名;需改键请删除后新建。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"行为说明"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-600 text-white",placeholder:"如:未登录时付费墙上方展示",value:h.behavior,onChange:P=>f(z=>({...z,behavior:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"文案内容"}),s.jsx(ec,{className:"bg-[#0a1628] border-gray-600 text-white min-h-[140px]",placeholder:"弹窗正文、提示语等",value:h.content,onChange:P=>f(z=>({...z,content:P.target.value}))})]})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600",onClick:()=>o(!1),children:"取消"}),s.jsx(J,{className:"bg-[#38bdac] hover:bg-[#2da396] text-white",onClick:O,children:"确定"})]})]})}),s.jsx(Dt,{open:!!m,onOpenChange:P=>!P&&g(null),children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsxs(_t,{children:[s.jsx($t,{children:"删除该条文案?"}),s.jsx(Qc,{className:"text-gray-400",children:"删除后需保存设置才会同步到小程序;若键名已被代码引用,删除后对应位置将走默认兜底。"})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600",onClick:()=>g(null),children:"取消"}),s.jsx(J,{className:"bg-red-600 hover:bg-red-700",onClick:U,children:"删除"})]})]})})]})}const DV={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},_V={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},$V={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{..._V},ckbLeadApiKey:""},zV={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0},FV=["system","author","admin","api-docs"],Cj=["basic","mp","mp-copy","oss","features"];function BV(){const[t,e]=Q0(),n=t.get("tab")??"system",r=FV.includes(n)?n:"system",a=t.get("section")??"basic",i=Cj.includes(a)?a:"basic",[o,c]=y.useState($V),[u,h]=y.useState(zV),[f,m]=y.useState(DV),[g,b]=y.useState({}),[N,j]=y.useState([]),[v,k]=y.useState({}),[T,C]=y.useState(!1),[R,O]=y.useState(!0),[U,P]=y.useState(!1),[z,L]=y.useState(""),[Q,se]=y.useState(""),[$,ie]=y.useState(!1),[le,me]=y.useState(!1),I=(de,D,q=!1)=>{L(de),se(D),ie(q),P(!0)};y.useEffect(()=>{(async()=>{try{const D=await Oe("/api/admin/settings");if(!D||D.success===!1)return;if(D.featureConfig&&Object.keys(D.featureConfig).length&&h(q=>({...q,...D.featureConfig})),D.mpConfig&&typeof D.mpConfig=="object"){const q={...D.mpConfig};m(re=>({...re,...q}));const{extra:_,pagePopupItems:Z}=MV(q.mpUi);b(_),j(Z)}if(D.ossConfig&&typeof D.ossConfig=="object"&&k(q=>({...q,...D.ossConfig})),D.siteSettings&&typeof D.siteSettings=="object"){const q=D.siteSettings;c(_=>({..._,...typeof q.sectionPrice=="number"&&{sectionPrice:q.sectionPrice},...typeof q.baseBookPrice=="number"&&{baseBookPrice:q.baseBookPrice},...typeof q.distributorShare=="number"&&{distributorShare:q.distributorShare},...q.authorInfo&&typeof q.authorInfo=="object"&&{authorInfo:{..._.authorInfo,...q.authorInfo}},...typeof q.ckbLeadApiKey=="string"&&{ckbLeadApiKey:q.ckbLeadApiKey}}))}}catch(D){console.error("Load settings error:",D)}finally{O(!1)}})()},[]);const Y=async(de,D)=>{me(!0);try{const q=await kt("/api/admin/settings",{featureConfig:de});if(!q||q.success===!1){D(),I("保存失败",(q==null?void 0:q.error)??"未知错误",!0);return}I("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(q){console.error("Save feature config error:",q),D(),I("保存失败",q instanceof Error?q.message:String(q),!0)}finally{me(!1)}},F=(de,D)=>{const q=u,_={...q,[de]:D};h(_),Y(_,()=>h(q))},[ge,X]=y.useState(!1),B=async de=>{const D=f,q={...D,auditMode:de};m(q),X(!0);try{const _=await kt("/api/admin/settings",{mpConfig:q});if(!_||_.success===!1){m(D),I("保存失败",(_==null?void 0:_.error)??"未知错误",!0);return}I("已保存",de?"审核模式已开启,小程序将隐藏所有支付入口。":"审核模式已关闭,支付功能已恢复。")}catch(_){m(D),I("保存失败",_ instanceof Error?_.message:String(_),!0)}finally{X(!1)}},W=async()=>{C(!0);try{const de=IV(N,g),D=await kt("/api/admin/settings",{featureConfig:u,siteSettings:{sectionPrice:o.sectionPrice,baseBookPrice:o.baseBookPrice,distributorShare:o.distributorShare,authorInfo:o.authorInfo,ckbLeadApiKey:o.ckbLeadApiKey||void 0},mpConfig:{...f,appId:f.appId||"",withdrawSubscribeTmplId:f.withdrawSubscribeTmplId||"",mchId:f.mchId||"",minWithdraw:typeof f.minWithdraw=="number"?f.minWithdraw:10,auditMode:f.auditMode??!1,mpUi:de},ossConfig:Object.keys(v).length?{endpoint:v.endpoint??"",bucket:v.bucket??"",region:v.region??"",accessKeyId:v.accessKeyId??"",accessKeySecret:v.accessKeySecret??""}:void 0});if(!D||D.success===!1){I("保存失败",(D==null?void 0:D.error)??"未知错误",!0);return}I("已保存","设置已保存成功。")}catch(de){console.error("Save settings error:",de),I("保存失败",de instanceof Error?de.message:String(de),!0)}finally{C(!1)}},fe=de=>{if(de==="system"){const D=new URLSearchParams(t);D.delete("tab"),Cj.includes(D.get("section")||"basic")||D.set("section","basic"),e(D);return}e({tab:de})},he=de=>{const D=new URLSearchParams(t);D.delete("tab"),D.set("section",de),e(D)};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(J,{onClick:W,disabled:T,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),T?"保存中...":"保存设置"]})]}),s.jsxs(Yc,{value:r,onValueChange:fe,className:"w-full",children:[s.jsxs(Vl,{className:"mb-6 bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(en,{value:"system",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(So,{className:"w-4 h-4 mr-2"}),"系统设置"]}),s.jsxs(en,{value:"author",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(Bh,{className:"w-4 h-4 mr-2"}),"作者详情"]}),s.jsxs(en,{value:"admin",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(Fc,{className:"w-4 h-4 mr-2"}),"管理员"]}),s.jsxs(en,{value:"api-docs",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",onClick:de=>{de.preventDefault(),window.open("/api-docs","_blank")},children:[s.jsx(Zj,{className:"w-4 h-4 mr-2"}),"API 文档 ↗"]})]}),s.jsxs(tn,{value:"system",className:"mt-0",children:[s.jsxs("p",{className:"text-xs text-gray-500 mb-3",children:["MBTI 默认头像已迁至"," ",s.jsx(Dl,{to:"/users",className:"text-[#38bdac] underline",children:"用户管理(用户列表点头像打开)"})]}),s.jsxs(Yc,{value:i,onValueChange:he,className:"w-full",children:[s.jsxs(Vl,{className:"mb-4 bg-[#0a1628] border border-gray-700/50 p-1 flex-wrap h-auto gap-1",children:[s.jsxs(en,{value:"basic",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(NM,{className:"w-3.5 h-3.5 mr-1"}),"基础与价格"]}),s.jsxs(en,{value:"mp",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx($l,{className:"w-3.5 h-3.5 mr-1"}),"小程序与审核"]}),s.jsxs(en,{value:"mp-copy",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(sk,{className:"w-3.5 h-3.5 mr-1"}),"弹窗文案"]}),s.jsxs(en,{value:"oss",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(I1,{className:"w-3.5 h-3.5 mr-1"}),"OSS"]}),s.jsxs(en,{value:"features",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(So,{className:"w-3.5 h-3.5 mr-1"}),"功能开关"]})]}),s.jsxs(tn,{value:"basic",className:"space-y-6 mt-0",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Bh,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),s.jsx(qt,{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(te,{htmlFor:"author-name",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Bh,{className:"w-3 h-3"}),"主理人名称"]}),s.jsx(ce,{id:"author-name",className:"bg-[#0a1628] border-gray-700 text-white",value:o.authorInfo.name??"",onChange:de=>c(D=>({...D,authorInfo:{...D.authorInfo,name:de.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"start-date",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(_x,{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:de=>c(D=>({...D,authorInfo:{...D.authorInfo,startDate:de.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"live-time",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(_x,{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:de=>c(D=>({...D,authorInfo:{...D.authorInfo,liveTime:de.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"platform",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(nk,{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:de=>c(D=>({...D,authorInfo:{...D.authorInfo,platform:de.target.value}}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"description",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(dr,{className:"w-3 h-3"}),"简介描述"]}),s.jsx(ce,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:o.authorInfo.description??"",onChange:de=>c(D=>({...D,authorInfo:{...D.authorInfo,description:de.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),s.jsx(ec,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:o.authorInfo.bio??"",onChange:de=>c(D=>({...D,authorInfo:{...D.authorInfo,bio:de.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"ckb-lead-api-key",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Mi,{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:de=>c(D=>({...D,ckbLeadApiKey:de.target.value}))}),s.jsx("p",{className:"text-xs text-gray-500",children:"小程序首页「链接卡若」留资接口使用的存客宝 API Key,优先于 .env 配置"})]}),s.jsxs("div",{className:"mt-4 p-4 rounded-xl bg-[#0a1628] border border-[#38bdac]/30",children:[s.jsx("p",{className:"text-xs text-gray-500 mb-2",children:"预览效果"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-12 h-12 rounded-full bg-linear-to-br from-[#00CED1] to-[#20B2AA] flex items-center justify-center text-xl font-bold text-white",children:(o.authorInfo.name??"K").charAt(0)}),s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-semibold",children:o.authorInfo.name}),s.jsx("p",{className:"text-gray-400 text-xs",children:o.authorInfo.description}),s.jsxs("p",{className:"text-[#38bdac] text-xs mt-1",children:["每日 ",o.authorInfo.liveTime," · ",o.authorInfo.platform]})]})]})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Cf,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),s.jsx(qt,{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(te,{className:"text-gray-300",children:"单节价格 (元)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.sectionPrice,onChange:de=>c(D=>({...D,sectionPrice:Number.parseFloat(de.target.value)||1}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"整本价格 (元)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.baseBookPrice,onChange:de=>c(D=>({...D,baseBookPrice:Number.parseFloat(de.target.value)||9.9}))})]})]})})]})]}),s.jsxs(tn,{value:"mp",className:"space-y-6 mt-0",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx($l,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),s.jsx(qt,{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(te,{className:"text-gray-300",children:"小程序 AppID"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:f.appId??"",onChange:de=>m(D=>({...D,appId:de.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"提现订阅模板 ID"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"用户申请提现时需授权",value:f.withdrawSubscribeTmplId??"",onChange:de=>m(D=>({...D,withdrawSubscribeTmplId:de.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"微信支付商户号"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"1318592501",value:f.mchId??"",onChange:de=>m(D=>({...D,mchId:de.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"最低提现金额 (元)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:f.minWithdraw??10,onChange:de=>m(D=>({...D,minWithdraw:Number.parseFloat(de.target.value)||10}))})]})]}),s.jsx("p",{className:"text-xs text-gray-500 pt-2 border-t border-gray-700/50",children:"弹窗类文案在「弹窗文案」子 Tab 按页面路径 + 英文键维护(pagePopupItems);目录、Tab、首页板块等仍由其它配置决定。"})]})]}),s.jsxs(De,{className:`bg-[#0f2137] shadow-xl ${f.auditMode?"border-amber-500/50 border-2":"border-gray-700/50"}`,children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Fc,{className:"w-5 h-5 text-amber-400"}),"小程序审核模式"]}),s.jsx(qt,{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(Fc,{className:`w-4 h-4 ${f.auditMode?"text-amber-400":"text-gray-400"}`}),s.jsx(te,{htmlFor:"audit-mode",className:"text-white font-medium cursor-pointer",children:f.auditMode?"审核模式(已开启)":"审核模式(已关闭)"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:f.auditMode?"当前已隐藏所有支付、VIP、充值、收益等入口,审核员看不到任何付费内容":"关闭状态,小程序正常显示所有功能(含支付、VIP 等)"})]}),s.jsx(Ut,{id:"audit-mode",checked:f.auditMode??!1,disabled:ge,onCheckedChange:B})]})})]})]}),s.jsx(tn,{value:"mp-copy",className:"space-y-6 mt-0",children:s.jsx(OV,{pagePopupItems:N,setPagePopupItems:j,extraKeysCount:Object.keys(g).length})}),s.jsx(tn,{value:"oss",className:"space-y-6 mt-0",children:s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(I1,{className:"w-5 h-5 text-[#38bdac]"}),"OSS 配置(阿里云对象存储)"]}),s.jsx(qt,{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(te,{className:"text-gray-300",children:"Endpoint"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"oss-cn-hangzhou.aliyuncs.com",value:v.endpoint??"",onChange:de=>k(D=>({...D,endpoint:de.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"Bucket"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"bucket 名称",value:v.bucket??"",onChange:de=>k(D=>({...D,bucket:de.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"Region"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"oss-cn-hangzhou",value:v.region??"",onChange:de=>k(D=>({...D,region:de.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"AccessKey ID"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"AccessKey ID",value:v.accessKeyId??"",onChange:de=>k(D=>({...D,accessKeyId:de.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"AccessKey Secret"}),s.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"AccessKey Secret",value:v.accessKeySecret??"",onChange:de=>k(D=>({...D,accessKeySecret:de.target.value}))})]})]})})]})}),s.jsxs(tn,{value:"features",className:"space-y-6 mt-0",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(So,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),s.jsx(qt,{className:"text-gray-400",children:"控制各个功能模块的显示/隐藏"})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Un,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(te,{htmlFor:"match-enabled",className:"text-white font-medium cursor-pointer",children:"找伙伴功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制小程序和Web端的找伙伴功能显示"})]}),s.jsx(Ut,{id:"match-enabled",checked:u.matchEnabled,disabled:le,onCheckedChange:de=>F("matchEnabled",de)})]}),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(Fx,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(te,{htmlFor:"referral-enabled",className:"text-white font-medium cursor-pointer",children:"推广功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制推广中心的显示(我的页面入口)"}),s.jsxs("p",{className:"text-xs text-amber-400/80 ml-6 mt-1",children:["佣金比例、绑定期、提现规则等与",s.jsx(Dl,{to:"/distribution?tab=settings",className:"underline mx-1 text-[#38bdac]",children:"推广中心 → 推广设置"}),"为同一套接口,在此仅控制是否展示入口。"]})]}),s.jsx(Ut,{id:"referral-enabled",checked:u.referralEnabled,disabled:le,onCheckedChange:de=>F("referralEnabled",de)})]}),s.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(dr,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(te,{htmlFor:"search-enabled",className:"text-white font-medium cursor-pointer",children:"搜索功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制首页、目录页搜索栏的显示"})]}),s.jsx(Ut,{id:"search-enabled",checked:u.searchEnabled,disabled:le,onCheckedChange:de=>F("searchEnabled",de)})]}),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(So,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(te,{htmlFor:"about-enabled",className:"text-white font-medium cursor-pointer",children:"关于页面"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制关于页面的访问"})]}),s.jsx(Ut,{id:"about-enabled",checked:u.aboutEnabled,disabled:le,onCheckedChange:de=>F("aboutEnabled",de)})]})]}),s.jsx("div",{className:"p-3 rounded-lg bg-blue-500/10 border border-blue-500/30",children:s.jsx("p",{className:"text-xs text-blue-300",children:"💡 关闭功能后,相关入口会自动隐藏。建议在功能开发完成后再开启。"})})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Ef,{className:"w-5 h-5 text-[#38bdac]"}),"小程序模块显隐说明"]}),s.jsx(qt,{className:"text-gray-400",children:"以下模块受上方开关和审核模式共同控制"})]}),s.jsx(_e,{children:s.jsx("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[{mod:"找伙伴",ctrl:"找伙伴功能开关",icon:s.jsx(Un,{className:"w-3 h-3"})},{mod:"推广中心 / 推荐好友",ctrl:"推广功能开关",icon:s.jsx(Fx,{className:"w-3 h-3"})},{mod:"搜索",ctrl:"搜索功能开关",icon:s.jsx(dr,{className:"w-3 h-3"})},{mod:"关于页面",ctrl:"关于页面开关",icon:s.jsx(Bh,{className:"w-3 h-3"})},{mod:"支付 / VIP / 充值 / 收益",ctrl:"审核模式",icon:s.jsx(Fc,{className:"w-3 h-3"})},{mod:"超级个体名片",ctrl:"审核模式",icon:s.jsx(vA,{className:"w-3 h-3"})},{mod:"首页获客入口",ctrl:"已移除",icon:s.jsx(W5,{className:"w-3 h-3"})}].map(de=>s.jsxs("div",{className:"flex items-center gap-2 p-2 rounded bg-[#0a1628] border border-gray-700/30",children:[de.icon,s.jsxs("div",{children:[s.jsx("span",{className:"text-white",children:de.mod}),s.jsxs("span",{className:"text-gray-500 ml-1",children:["← ",de.ctrl]})]})]},de.mod))})})]})]})]})]}),s.jsx(tn,{value:"author",className:"mt-0",children:s.jsx(vV,{})}),s.jsx(tn,{value:"admin",className:"mt-0",children:s.jsx(wV,{})}),s.jsx(tn,{value:"api-docs",className:"mt-0",children:s.jsx(U4,{})})]}),s.jsx(Dt,{open:U,onOpenChange:P,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsxs(_t,{children:[s.jsx($t,{className:$?"text-red-400":"text-[#38bdac]",children:z}),s.jsx(Qc,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:Q})]}),s.jsx(rn,{className:"mt-4",children:s.jsx(J,{onClick:()=>P(!1),className:$?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const Ej={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 VV(){const[t,e]=y.useState(!1),[n,r]=y.useState(Ej),[a,i]=y.useState(""),o=async()=>{e(!0);try{const k=await Oe("/api/config");k!=null&&k.paymentMethods&&r({...Ej,...k.paymentMethods})}catch(k){console.error(k)}finally{e(!1)}};y.useEffect(()=>{o()},[]);const c=async()=>{e(!0);try{await kt("/api/db/config",{key:"payment_methods",value:n,description:"支付方式配置"}),G.success("配置已保存!")}catch(k){console.error("保存失败:",k),G.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{e(!1)}},u=(k,T)=>{navigator.clipboard.writeText(k),i(T),setTimeout(()=>i(""),2e3)},h=(k,T)=>{r(C=>({...C,wechat:{...C.wechat,[k]:T}}))},f=(k,T)=>{r(C=>({...C,alipay:{...C.alipay,[k]:T}}))},m=(k,T)=>{r(C=>({...C,usdt:{...C.usdt,[k]:T}}))},g=(k,T)=>{r(C=>({...C,paypal:{...C.paypal,[k]:T}}))},b=n.wechat,N=n.alipay,j=n.usdt,v=n.paypal;return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold mb-2 text-white",children:"支付配置"}),s.jsx("p",{className:"text-gray-400",children:"配置微信、支付宝、USDT、PayPal等支付参数"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(J,{variant:"outline",onClick:o,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${t?"animate-spin":""}`}),"同步配置"]}),s.jsxs(J,{onClick:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),"保存配置"]})]})]}),s.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Qj,{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(Yc,{defaultValue:"wechat",className:"space-y-6",children:[s.jsxs(Vl,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[s.jsxs(en,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[s.jsx($l,{className:"w-4 h-4 mr-2"}),"微信"]}),s.jsxs(en,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[s.jsx(P1,{className:"w-4 h-4 mr-2"}),"支付宝"]}),s.jsxs(en,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[s.jsx(A1,{className:"w-4 h-4 mr-2"}),"USDT"]}),s.jsxs(en,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[s.jsx(Bx,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),s.jsx(tn,{value:"wechat",className:"space-y-4",children:s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(ht,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx($l,{className:"w-5 h-5"}),"微信支付配置"]}),s.jsx(qt,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),s.jsx(Ut,{checked:!!b.enabled,onCheckedChange:k=>h("enabled",k)})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{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(te,{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(Do,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置(核心功能)"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"微信收款码/支付链接"}),s.jsx(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(te,{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(tn,{value:"alipay",className:"space-y-4",children:s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(ht,{className:"text-[#1677FF] flex items-center gap-2",children:[s.jsx(P1,{className:"w-5 h-5"}),"支付宝配置"]}),s.jsx(qt,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),s.jsx(Ut,{checked:!!N.enabled,onCheckedChange:k=>f("enabled",k)})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{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(N.partnerId??""),onChange:k=>f("partnerId",k.target.value)}),s.jsx(J,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>u(String(N.partnerId??""),"pid"),children:a==="pid"?s.jsx(Ap,{className:"w-4 h-4 text-green-500"}):s.jsx(Xj,{className:"w-4 h-4 text-gray-400"})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"安全校验码 (Key)"}),s.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(N.securityKey??""),onChange:k=>f("securityKey",k.target.value)})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[s.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[s.jsx(Do,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"支付宝收款码/跳转链接"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://qr.alipay.com/... 或收款码图片URL",value:String(N.qrCode??""),onChange:k=>f("qrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户点击支付宝支付后显示的二维码"})]})]})]})]})}),s.jsx(tn,{value:"usdt",className:"space-y-4",children:s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(ht,{className:"text-[#26A17B] flex items-center gap-2",children:[s.jsx(A1,{className:"w-5 h-5"}),"USDT配置"]}),s.jsx(qt,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),s.jsx(Ut,{checked:!!j.enabled,onCheckedChange:k=>m("enabled",k)})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"网络类型"}),s.jsxs("select",{className:"w-full bg-[#0a1628] border border-gray-700 text-white rounded-md p-2",value:String(j.network??"TRC20"),onChange:k=>m("network",k.target.value),children:[s.jsx("option",{value:"TRC20",children:"TRC20 (波场)"}),s.jsx("option",{value:"ERC20",children:"ERC20 (以太坊)"}),s.jsx("option",{value:"BEP20",children:"BEP20 (币安链)"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{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(j.address??""),onChange:k=>m("address",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(j.exchangeRate)??7.2,onChange:k=>m("exchangeRate",Number.parseFloat(k.target.value)||7.2)})]})]})]})}),s.jsx(tn,{value:"paypal",className:"space-y-4",children:s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(ht,{className:"text-[#169BD7] flex items-center gap-2",children:[s.jsx(Bx,{className:"w-5 h-5"}),"PayPal配置"]}),s.jsx(qt,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),s.jsx(Ut,{checked:!!v.enabled,onCheckedChange:k=>g("enabled",k)})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"PayPal邮箱"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"your@email.com",value:String(v.email??""),onChange:k=>g("email",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(v.exchangeRate)??7.2,onChange:k=>g("exchangeRate",Number(k.target.value)||7.2)})]})]})]})})]})]})}const HV={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},UV={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},WV={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function KV(){const[t,e]=y.useState({siteConfig:{...HV},menuConfig:{...UV},pageConfig:{...WV}}),[n,r]=y.useState(!1),[a,i]=y.useState(!1);y.useEffect(()=>{Oe("/api/config").then(f=>{f!=null&&f.siteConfig&&e(m=>({...m,siteConfig:{...m.siteConfig,...f.siteConfig}})),f!=null&&f.menuConfig&&e(m=>({...m,menuConfig:{...m.menuConfig,...f.menuConfig}})),f!=null&&f.pageConfig&&e(m=>({...m,pageConfig:{...m.pageConfig,...f.pageConfig}}))}).catch(console.error)},[]);const o=async()=>{i(!0);try{await kt("/api/db/config",{key:"site_config",value:t.siteConfig,description:"网站基础配置"}),await kt("/api/db/config",{key:"menu_config",value:t.menuConfig,description:"底部菜单配置"}),await kt("/api/db/config",{key:"page_config",value:t.pageConfig,description:"页面标题配置"}),r(!0),setTimeout(()=>r(!1),2e3),G.success("配置已保存")}catch(f){console.error(f),G.error("保存失败: "+(f instanceof Error?f.message:String(f)))}finally{i(!1)}},c=t.siteConfig,u=t.menuConfig,h=t.pageConfig;return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"网站配置"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置网站名称、图标、菜单和页面标题"})]}),s.jsxs(J,{onClick:o,disabled:a,className:`${n?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),a?"保存中...":n?"已保存":"保存设置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Bx,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),s.jsx(qt,{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(te,{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(te,{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(te,{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(te,{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(te,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(VM,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),s.jsx(qt,{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(te,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(LM,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),s.jsx(qt,{className:"text-gray-400",children:"控制底部导航栏菜单的显示和名称"})]}),s.jsx(_e,{className:"space-y-4",children:Object.entries(u).map(([f,m])=>s.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[s.jsx(Ut,{checked:(m==null?void 0:m.enabled)??!0,onCheckedChange:g=>e(b=>({...b,menuConfig:{...b.menuConfig,[f]:{...m,enabled:g}}}))}),s.jsx("span",{className:"text-gray-300 w-16 capitalize",children:f}),s.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white max-w-[200px]",value:(m==null?void 0:m.label)??"",onChange:g=>e(b=>({...b,menuConfig:{...b.menuConfig,[f]:{...m,label:g.target.value}}}))})]}),s.jsx("span",{className:`text-sm ${m!=null&&m.enabled?"text-green-400":"text-gray-500"}`,children:m!=null&&m.enabled?"显示":"隐藏"})]},f))})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Zj,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),s.jsx(qt,{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(te,{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(te,{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(te,{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(te,{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(te,{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(te,{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 qV(){const[t,e]=y.useState(""),[n,r]=y.useState(""),[a,i]=y.useState(""),[o,c]=y.useState({}),u=async()=>{var b,N,j,v;try{const k=await Oe("/api/config"),T=(N=(b=k==null?void 0:k.liveQRCodes)==null?void 0:b[0])==null?void 0:N.urls;Array.isArray(T)&&e(T.join(` -`));const C=(v=(j=k==null?void 0:k.paymentMethods)==null?void 0:j.wechat)==null?void 0:v.groupQrCode;C&&r(C),c({paymentMethods:k==null?void 0:k.paymentMethods,liveQRCodes:k==null?void 0:k.liveQRCodes})}catch(k){console.error(k)}};y.useEffect(()=>{u()},[]);const h=(b,N)=>{navigator.clipboard.writeText(b),i(N),setTimeout(()=>i(""),2e3)},f=async()=>{try{const b=t.split(` -`).map(j=>j.trim()).filter(Boolean),N=[...o.liveQRCodes||[]];N[0]?N[0].urls=b:N.push({id:"live-1",name:"微信群活码",urls:b,clickCount:0}),await kt("/api/db/config",{key:"live_qr_codes",value:N,description:"群活码配置"}),G.success("群活码配置已保存!"),await u()}catch(b){console.error(b),G.error("保存失败: "+(b instanceof Error?b.message:String(b)))}},m=async()=>{var b;try{await kt("/api/db/config",{key:"payment_methods",value:{...o.paymentMethods||{},wechat:{...((b=o.paymentMethods)==null?void 0:b.wechat)||{},groupQrCode:n}},description:"支付方式配置"}),G.success("微信群链接已保存!用户支付成功后将自动跳转"),await u()}catch(N){console.error(N),G.error("保存失败: "+(N instanceof Error?N.message:String(N)))}},g=()=>{n?window.open(n,"_blank"):G.error("请先配置微信群链接")};return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"mb-8",children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"微信群活码管理"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置微信群跳转链接,用户支付后自动跳转加群"})]}),s.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Qj,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm",children:[s.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"微信群活码配置指南"}),s.jsxs("div",{className:"text-[#07C160]/80 space-y-2",children:[s.jsx("p",{className:"font-medium",children:"方法一:使用草料活码(推荐)"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[s.jsx("li",{children:"访问草料二维码创建活码"}),s.jsx("li",{children:"上传微信群二维码图片,生成永久链接"}),s.jsx("li",{children:"复制生成的短链接填入下方配置"}),s.jsx("li",{children:"群满后可直接在草料后台更换新群码,链接不变"})]}),s.jsx("p",{className:"font-medium mt-3",children:"方法二:直接使用微信群链接"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[s.jsx("li",{children:'微信打开目标群 → 右上角"..." → 群二维码'}),s.jsx("li",{children:"长按二维码 → 识别二维码 → 复制链接"})]}),s.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"注意:微信原生群二维码7天后失效,建议使用草料活码"})]})]})]})}),s.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(D1,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),s.jsx(qt,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Hx,{className:"w-4 h-4"}),"微信群链接 / 活码链接"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ce,{placeholder:"https://cli.im/xxxxx 或 https://weixin.qq.com/g/...",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",value:n,onChange:b=>r(b.target.value)}),s.jsx(J,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>h(n,"group"),children:a==="group"?s.jsx(Ap,{className:"w-4 h-4 text-green-500"}):s.jsx(Xj,{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(Do,{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(Mf,{className:"w-4 h-4 mr-2"}),"保存配置"]}),s.jsxs(J,{onClick:g,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[s.jsx(Do,{className:"w-4 h-4 mr-2"}),"测试跳转"]})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(D1,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),s.jsx(qt,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Hx,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),s.jsx(ec,{placeholder:"https://cli.im/group1\\nhttps://cli.im/group2",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 min-h-[120px] font-mono text-sm",value:t,onChange:b=>e(b.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"每行填写一个群链接,系统将按顺序或随机分配"})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[s.jsx("span",{className:"text-sm text-gray-400",children:"已配置群数量"}),s.jsxs("span",{className:"font-bold text-[#38bdac]",children:[t.split(` -`).filter(Boolean).length," 个"]})]}),s.jsxs(J,{onClick:f,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Mf,{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 Tj={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}},GV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function JV(){const[t,e]=y.useState(Tj),[n,r]=y.useState(!0),[a,i]=y.useState(!1),[o,c]=y.useState(!1),[u,h]=y.useState(null),[f,m]=y.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),g=async()=>{r(!0);try{const C=await Oe("/api/db/config/full?key=match_config"),R=(C==null?void 0:C.data)??(C==null?void 0:C.config);R&&e({...Tj,...R})}catch(C){console.error("加载匹配配置失败:",C)}finally{r(!1)}};y.useEffect(()=>{g()},[]);const b=async()=>{i(!0);try{const C=await kt("/api/db/config",{key:"match_config",value:t,description:"匹配功能配置"});C&&C.success!==!1?G.success("配置保存成功!"):G.error("保存失败: "+(C&&typeof C=="object"&&"error"in C?C.error:"未知错误"))}catch(C){console.error("保存配置失败:",C),G.error("保存失败")}finally{i(!1)}},N=C=>{h(C),m({id:C.id,label:C.label,matchLabel:C.matchLabel,icon:C.icon,matchFromDB:C.matchFromDB,showJoinAfterMatch:C.showJoinAfterMatch,price:C.price,enabled:C.enabled}),c(!0)},j=()=>{h(null),m({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),c(!0)},v=()=>{if(!f.id||!f.label){G.error("请填写类型ID和名称");return}const C=[...t.matchTypes];if(u){const R=C.findIndex(O=>O.id===u.id);R!==-1&&(C[R]={...f})}else{if(C.some(R=>R.id===f.id)){G.error("类型ID已存在");return}C.push({...f})}e({...t,matchTypes:C}),c(!1)},k=C=>{confirm("确定要删除这个匹配类型吗?")&&e({...t,matchTypes:t.matchTypes.filter(R=>R.id!==C)})},T=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(So,{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:g,disabled:n,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]}),s.jsxs(J,{onClick:b,disabled:a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存配置"]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(_o,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),s.jsx(qt,{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(te,{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(te,{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(te,{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(Ut,{checked:t.settings.enableFreeMatches,onCheckedChange:C=>e({...t,settings:{...t.settings,enableFreeMatches:C}})}),s.jsx(te,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:t.settings.enablePaidMatches,onCheckedChange:C=>e({...t,settings:{...t.settings,enablePaidMatches:C}})}),s.jsx(te,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Un,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),s.jsx(qt,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(J,{onClick:j,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx($n,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),s.jsx(_e,{children:s.jsxs(us,{children:[s.jsx(hs,{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(fs,{children:t.matchTypes.map(C=>s.jsxs(xt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(je,{children:s.jsx("span",{className:"text-2xl",children:C.icon})}),s.jsx(je,{className:"font-mono text-gray-300",children:C.id}),s.jsx(je,{className:"text-white font-medium",children:C.label}),s.jsx(je,{className:"text-gray-300",children:C.matchLabel}),s.jsx(je,{children:s.jsxs(Be,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",C.price]})}),s.jsx(je,{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(je,{children:s.jsx(Ut,{checked:C.enabled,onCheckedChange:()=>T(C.id)})}),s.jsx(je,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>N(C),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(sn,{className:"w-4 h-4"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>k(C.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(Yn,{className:"w-4 h-4"})})]})})]},C.id))})]})})]}),s.jsx(Dt,{open:o,onOpenChange:c,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[u?s.jsx(sn,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx($n,{className:"w-5 h-5 text-[#38bdac]"}),u?"编辑匹配类型":"添加匹配类型"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{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(te,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:GV.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(te,{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(te,{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(te,{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(Ut,{checked:f.matchFromDB,onCheckedChange:C=>m({...f,matchFromDB:C})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:f.showJoinAfterMatch,onCheckedChange:C=>m({...f,showJoinAfterMatch:C})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:f.enabled,onCheckedChange:C=>m({...f,enabled:C})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(rn,{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:v,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const Mj={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function QV(){const[t,e]=y.useState([]),[n,r]=y.useState(0),[a,i]=y.useState(1),[o,c]=y.useState(10),[u,h]=y.useState(""),[f,m]=y.useState(!0),[g,b]=y.useState(null);async function N(){m(!0),b(null);try{const v=new URLSearchParams({page:String(a),pageSize:String(o)});u&&v.set("matchType",u);const k=await Oe(`/api/db/match-records?${v}`);k!=null&&k.success?(e(k.records||[]),r(k.total??0)):b("加载匹配记录失败")}catch(v){console.error("加载匹配记录失败",v),b("加载失败,请检查网络后重试")}finally{m(!1)}}y.useEffect(()=>{N()},[a,u]);const j=Math.ceil(n/o)||1;return s.jsxs("div",{className:"p-8 w-full",children:[g&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[s.jsx("span",{children:g}),s.jsx("button",{type:"button",onClick:()=>b(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"匹配记录"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["找伙伴匹配统计,共 ",n," 条记录"]})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("select",{value:u,onChange:v=>{h(v.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部类型"}),Object.entries(Mj).map(([v,k])=>s.jsx("option",{value:v,children:k},v))]}),s.jsxs("button",{type:"button",onClick:N,disabled:f,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(He,{className:`w-4 h-4 ${f?"animate-spin":""}`}),"刷新"]})]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(us,{children:[s.jsx(hs,{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(fs,{children:[t.map(v=>s.jsxs(xt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(je,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[v.userAvatar?s.jsx("img",{src:ma(v.userAvatar),alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const T=k.currentTarget.nextElementSibling;T&&T.classList.remove("hidden")}}):null,s.jsx("span",{className:v.userAvatar?"hidden":"",children:(v.userNickname||v.userId||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white",children:v.userNickname||v.userId}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[v.userId.slice(0,16),"..."]})]})]})}),s.jsx(je,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[v.matchedUserAvatar?s.jsx("img",{src:ma(v.matchedUserAvatar),alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const T=k.currentTarget.nextElementSibling;T&&T.classList.remove("hidden")}}):null,s.jsx("span",{className:v.matchedUserAvatar?"hidden":"",children:(v.matchedNickname||v.matchedUserId||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white",children:v.matchedNickname||v.matchedUserId}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[v.matchedUserId.slice(0,16),"..."]})]})]})}),s.jsx(je,{children:s.jsx(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Mj[v.matchType]||v.matchType})}),s.jsxs(je,{className:"text-gray-400 text-sm",children:[v.phone&&s.jsxs("div",{children:["📱 ",v.phone]}),v.wechatId&&s.jsxs("div",{children:["💬 ",v.wechatId]}),!v.phone&&!v.wechatId&&"-"]}),s.jsx(je,{className:"text-gray-400",children:v.createdAt?new Date(v.createdAt).toLocaleString():"-"})]},v.id)),t.length===0&&s.jsx(xt,{children:s.jsx(je,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(Us,{page:a,totalPages:j,total:n,pageSize:o,onPageChange:i,onPageSizeChange:v=>{c(v),i(1)}})]})})})]})}function YV(){const[t,e]=y.useState([]),[n,r]=y.useState(!0);async function a(){r(!0);try{const i=await Oe("/api/db/vip-members?limit=100");if(i!=null&&i.success&&i.data){const o=[...i.data].map((c,u)=>({...c,vipSort:typeof c.vipSort=="number"?c.vipSort:u+1}));o.sort((c,u)=>(c.vipSort??999999)-(u.vipSort??999999)),e(o)}}catch(i){console.error("Load VIP members error:",i),G.error("加载 VIP 成员失败")}finally{r(!1)}}return y.useEffect(()=>{a()},[]),s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("div",{className:"flex justify-between items-center mb-8",children:s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Uc,{className:"w-5 h-5 text-amber-400"}),"用户管理 / 超级个体列表"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"这里展示所有有效超级个体用户,仅用于查看其基本信息与排序值。"})]})}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(us,{children:[s.jsx(hs,{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(fs,{children:[t.map((i,o)=>{var c;return s.jsxs(xt,{className:"border-gray-700/50",children:[s.jsx(je,{className:"text-gray-300",children:o+1}),s.jsx(je,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[i.avatar?s.jsx("img",{src:ma(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(je,{className:"text-gray-300",children:i.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置超级个体)"})}),s.jsx(je,{className:"text-gray-300",children:i.vipSort??o+1})]},i.id)}),t.length===0&&s.jsx(xt,{children:s.jsx(je,{colSpan:5,className:"text-center py-12 text-gray-500",children:"当前没有有效的超级个体用户。"})})]})]})})})]})}function W4(t){const e=Ka(),[n,r]=y.useState([]),[a,i]=y.useState(!0),[o,c]=y.useState(!1),[u,h]=y.useState(null),[f,m]=y.useState({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:0,enabled:!0,userId:""}),[g,b]=y.useState(!1),[N,j]=y.useState(!1),v=y.useRef(null),k=async L=>{var se;const Q=(se=L.target.files)==null?void 0:se[0];if(Q){j(!0);try{const $=new FormData;$.append("file",Q),$.append("folder","mentors");const ie=$u(),le={};ie&&(le.Authorization=`Bearer ${ie}`);const I=await(await fetch(zl("/api/upload"),{method:"POST",body:$,credentials:"include",headers:le})).json();I!=null&&I.success&&(I!=null&&I.url)?m(Y=>({...Y,avatar:I.url})):G.error("上传失败: "+((I==null?void 0:I.error)||"未知错误"))}catch($){console.error($),G.error("上传失败")}finally{j(!1),v.current&&(v.current.value="")}}};async function T(){i(!0);try{const L=await Oe("/api/db/mentors");L!=null&&L.success&&L.data&&r(L.data)}catch(L){console.error("Load mentors error:",L)}finally{i(!1)}}y.useEffect(()=>{T()},[]);const C=()=>{m({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:n.length>0?Math.max(...n.map(L=>L.sort))+1:0,enabled:!0,userId:""})},R=()=>{h(null),C(),c(!0)},O=L=>{h(L),m({name:L.name,avatar:L.avatar||"",intro:L.intro||"",tags:L.tags||"",priceSingle:L.priceSingle!=null?String(L.priceSingle):"",priceHalfYear:L.priceHalfYear!=null?String(L.priceHalfYear):"",priceYear:L.priceYear!=null?String(L.priceYear):"",quote:L.quote||"",whyFind:L.whyFind||"",offering:L.offering||"",judgmentStyle:L.judgmentStyle||"",sort:L.sort,enabled:L.enabled??!0,userId:L.userId||""}),c(!0)},U=async()=>{if(!f.name.trim()){G.error("导师姓名不能为空");return}b(!0);try{const L=$=>$===""?void 0:parseFloat($),Q=f.userId.trim(),se={name:f.name.trim(),avatar:f.avatar.trim()||void 0,intro:f.intro.trim()||void 0,tags:f.tags.trim()||void 0,priceSingle:L(f.priceSingle),priceHalfYear:L(f.priceHalfYear),priceYear:L(f.priceYear),quote:f.quote.trim()||void 0,whyFind:f.whyFind.trim()||void 0,offering:f.offering.trim()||void 0,judgmentStyle:f.judgmentStyle.trim()||void 0,sort:f.sort,enabled:f.enabled};if(u){const $=await Xt("/api/db/mentors",{id:u.id,...se,userId:Q});$!=null&&$.success?(c(!1),T()):G.error("更新失败: "+($==null?void 0:$.error))}else{const $=await kt("/api/db/mentors",{...se,userId:Q||void 0});$!=null&&$.success?(c(!1),T()):G.error("新增失败: "+($==null?void 0:$.error))}}catch(L){console.error("Save error:",L),G.error("保存失败")}finally{b(!1)}},P=async L=>{if(confirm("确定删除该导师?"))try{const Q=await Ci(`/api/db/mentors?id=${L}`);Q!=null&&Q.success?T():G.error("删除失败: "+(Q==null?void 0:Q.error))}catch(Q){console.error("Delete error:",Q),G.error("删除失败")}},z=L=>L!=null?`¥${L}`:"-";return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Un,{className:"w-5 h-5 text-[#38bdac]"}),"导师管理"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师列表;填写「绑定用户 ID」后,小程序导师详情可跳转「派对会员名片」(与超级个体同页)"})]}),s.jsxs(J,{onClick:R,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx($n,{className:"w-4 h-4 mr-2"}),"新增导师"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-0",children:a?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(us,{children:[s.jsx(hs,{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-gray-400",children:"排序"}),s.jsx(Se,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(fs,{children:[n.map(L=>s.jsxs(xt,{className:"border-gray-700/50",children:[s.jsx(je,{className:"text-gray-300",children:L.id}),s.jsx(je,{children:s.jsxs("button",{type:"button",onClick:()=>e(`/users?search=${encodeURIComponent(L.name)}`),className:"text-[#38bdac] hover:text-[#2da396] hover:underline flex items-center gap-1",title:"在用户管理中查看",children:[L.name,s.jsx(Do,{className:"w-3 h-3"})]})}),s.jsx(je,{className:"text-gray-400 max-w-[200px] truncate",children:L.intro||"-"}),s.jsx(je,{className:"text-gray-400",children:z(L.priceSingle)}),s.jsx(je,{className:"text-gray-400",children:z(L.priceHalfYear)}),s.jsx(je,{className:"text-gray-400",children:z(L.priceYear)}),s.jsx(je,{className:"text-gray-400 font-mono text-xs max-w-[120px] truncate",title:L.userId||"",children:L.userId?s.jsx("button",{type:"button",onClick:()=>e(`/users?search=${encodeURIComponent(L.userId||"")}`),className:"text-[#38bdac] hover:underline truncate max-w-[120px] inline-block align-bottom",children:L.userId}):"—"}),s.jsx(je,{className:"text-gray-400",children:L.sort}),s.jsxs(je,{className:"text-right",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>O(L),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(sn,{className:"w-4 h-4"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>P(L.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(Yn,{className:"w-4 h-4"})})]})]},L.id)),n.length===0&&s.jsx(xt,{children:s.jsx(je,{colSpan:9,className:"text-center py-12 text-gray-500",children:"暂无导师,点击「新增导师」添加"})})]})]})})}),s.jsx(Dt,{open:o,onOpenChange:c,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg max-h-[90vh] overflow-y-auto",children:[s.jsx(_t,{children:s.jsx($t,{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(te,{className:"text-gray-300",children:"姓名 *"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:卡若",value:f.name,onChange:L=>m(Q=>({...Q,name:L.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"排序"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:f.sort,onChange:L=>m(Q=>({...Q,sort:parseInt(L.target.value,10)||0}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"头像"}),s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:f.avatar,onChange:L=>m(Q=>({...Q,avatar:L.target.value})),placeholder:"点击上传或粘贴图片地址"}),s.jsx("input",{ref:v,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:N,onClick:()=>{var L;return(L=v.current)==null?void 0:L.click()},children:[s.jsx(Mf,{className:"w-4 h-4 mr-2"}),N?"上传中...":"上传"]})]}),f.avatar&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:ma(f.avatar.startsWith("http")?f.avatar:zl(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(te,{className:"text-gray-300",children:"绑定用户 ID(可选,与名片页一致)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",placeholder:"小程序用户 id,填后导师详情显示「查看派对会员名片」",value:f.userId,onChange:L=>m(Q=>({...Q,userId:L.target.value}))}),s.jsx("p",{className:"text-xs text-gray-500",children:"留空则仅展示导师资料;填写后 C 端可跳转 member-detail 与超级个体同款名片。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"简介"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:结构判断型咨询 · Decision > Execution",value:f.intro,onChange:L=>m(Q=>({...Q,intro:L.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"技能标签(逗号分隔)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:项目结构判断、风险止损、人×项目匹配",value:f.tags,onChange:L=>m(Q=>({...Q,tags:L.target.value}))})]}),s.jsxs("div",{className:"border-t border-gray-700 pt-4",children:[s.jsx(te,{className:"text-gray-300 block mb-2",children:"价格配置(每个导师独立)"}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"单次咨询 ¥"}),s.jsx(ce,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"980",value:f.priceSingle,onChange:L=>m(Q=>({...Q,priceSingle:L.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{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:L=>m(Q=>({...Q,priceHalfYear:L.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{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:L=>m(Q=>({...Q,priceYear:L.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"引言"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:大多数人失败,不是因为不努力...",value:f.quote,onChange:L=>m(Q=>({...Q,quote:L.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"为什么找(文本)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:f.whyFind,onChange:L=>m(Q=>({...Q,whyFind:L.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"提供什么(文本)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:f.offering,onChange:L=>m(Q=>({...Q,offering:L.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"判断风格(逗号分隔)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:冷静、克制、偏风险视角",value:f.judgmentStyle,onChange:L=>m(Q=>({...Q,judgmentStyle:L.target.value}))})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",id:"enabled",checked:f.enabled,onChange:L=>m(Q=>({...Q,enabled:L.target.checked})),className:"rounded border-gray-600 bg-[#0a1628]"}),s.jsx(te,{htmlFor:"enabled",className:"text-gray-300 cursor-pointer",children:"上架(小程序可见)"})]})]}),s.jsxs(rn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>c(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(Xn,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:U,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"}),g?"保存中...":"保存"]})]})]})})]})}function XV(){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(_x,{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(He,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]})]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(us,{children:[s.jsx(hs,{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(fs,{children:[t.map(h=>s.jsxs(xt,{className:"border-gray-700/50",children:[s.jsx(je,{className:"text-gray-300",children:h.id}),s.jsx(je,{className:"text-gray-400",children:h.userId}),s.jsx(je,{className:"text-gray-400",children:h.mentorId}),s.jsx(je,{className:"text-gray-400",children:u[h.consultationType]||h.consultationType}),s.jsxs(je,{className:"text-white",children:["¥",h.amount]}),s.jsx(je,{className:"text-gray-400",children:c[h.status]||h.status}),s.jsx(je,{className:"text-gray-500 text-sm",children:h.createdAt})]},h.id)),t.length===0&&s.jsx(xt,{children:s.jsx(je,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}const ou={poolSource:["vip"],requirePhone:!0,requireNickname:!0,requireAvatar:!1,requireBusiness:!1},Aj={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:ou},ZV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function eH(){const t=Ka(),[e,n]=y.useState(Aj),[r,a]=y.useState(!0),[i,o]=y.useState(!1),[c,u]=y.useState(!1),[h,f]=y.useState(null),[m,g]=y.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),[b,N]=y.useState(null),[j,v]=y.useState(!1),k=async()=>{v(!0);try{const L=await Oe("/api/db/match-pool-counts");L!=null&&L.success&&L.data&&N(L.data)}catch(L){console.error("加载池子人数失败:",L)}finally{v(!1)}},T=async()=>{a(!0);try{const L=await Oe("/api/db/config/full?key=match_config"),Q=(L==null?void 0:L.data)??(L==null?void 0:L.config);if(Q){let se=Q.poolSettings??ou;se.poolSource&&!Array.isArray(se.poolSource)&&(se={...se,poolSource:[se.poolSource]}),n({...Aj,...Q,poolSettings:se})}}catch(L){console.error("加载匹配配置失败:",L)}finally{a(!1)}};y.useEffect(()=>{T(),k()},[]);const C=async()=>{o(!0);try{const L=await kt("/api/db/config",{key:"match_config",value:e,description:"匹配功能配置"});G.error((L==null?void 0:L.success)!==!1?"配置保存成功!":"保存失败: "+((L==null?void 0:L.error)||"未知错误"))}catch(L){console.error(L),G.error("保存失败")}finally{o(!1)}},R=L=>{f(L),g({...L}),u(!0)},O=()=>{f(null),g({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),u(!0)},U=()=>{if(!m.id||!m.label){G.error("请填写类型ID和名称");return}const L=[...e.matchTypes];if(h){const Q=L.findIndex(se=>se.id===h.id);Q!==-1&&(L[Q]={...m})}else{if(L.some(Q=>Q.id===m.id)){G.error("类型ID已存在");return}L.push({...m})}n({...e,matchTypes:L}),u(!1)},P=L=>{confirm("确定要删除这个匹配类型吗?")&&n({...e,matchTypes:e.matchTypes.filter(Q=>Q.id!==L)})},z=L=>{n({...e,matchTypes:e.matchTypes.map(Q=>Q.id===L?{...Q,enabled:!Q.enabled}:Q)})};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsxs(J,{variant:"outline",onClick:T,disabled:r,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{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(Cn,{className:"w-4 h-4 mr-2"})," ",i?"保存中...":"保存配置"]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(ek,{className:"w-5 h-5 text-blue-400"})," 匹配池选择"]}),s.jsx(qt,{className:"text-gray-400",children:"选择匹配的用户池和完善程度要求,只有满足条件的用户才可被匹配到"})]}),s.jsxs(_e,{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx(te,{className:"text-gray-300",children:"匹配来源池"}),s.jsx("p",{className:"text-gray-500 text-xs",children:"可同时勾选多个池子(取并集匹配)"}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[{value:"vip",label:"超级个体(VIP会员)",desc:"付费 ¥1980 的VIP会员",icon:"👑",countKey:"vip"},{value:"complete",label:"完善资料用户",desc:"符合下方完善度要求的用户",icon:"✅",countKey:"complete"},{value:"all",label:"全部用户",desc:"所有已注册用户",icon:"👥",countKey:"all"}].map(L=>{const Q=e.poolSettings??ou,$=(Array.isArray(Q.poolSource)?Q.poolSource:[Q.poolSource]).includes(L.value),ie=b==null?void 0:b[L.countKey],le=()=>{const me=Array.isArray(Q.poolSource)?[...Q.poolSource]:[Q.poolSource],I=$?me.filter(Y=>Y!==L.value):[...me,L.value];I.length===0&&I.push(L.value),n({...e,poolSettings:{...Q,poolSource:I}})};return s.jsxs("button",{type:"button",onClick:le,className:`p-4 rounded-lg border text-left transition-all ${$?"border-[#38bdac] bg-[#38bdac]/10":"border-gray-700 bg-[#0a1628] hover:border-gray-600"}`,children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:`w-5 h-5 rounded border-2 flex items-center justify-center text-xs ${$?"border-[#38bdac] bg-[#38bdac] text-white":"border-gray-600"}`,children:$&&"✓"}),s.jsx("span",{className:"text-xl",children:L.icon}),s.jsx("span",{className:`text-sm font-medium ${$?"text-[#38bdac]":"text-gray-300"}`,children:L.label})]}),s.jsxs("span",{className:"text-lg font-bold text-white",children:[j?"...":ie??"-",s.jsx("span",{className:"text-xs text-gray-500 font-normal ml-1",children:"人"})]})]}),s.jsx("p",{className:"text-gray-500 text-xs mt-2",children:L.desc}),s.jsx("span",{role:"link",tabIndex:0,onClick:me=>{me.stopPropagation(),t(`/users?pool=${L.value}`)},onKeyDown:me=>{me.key==="Enter"&&(me.stopPropagation(),t(`/users?pool=${L.value}`))},className:"text-[#38bdac] text-xs mt-2 inline-block hover:underline cursor-pointer",children:"查看用户列表 →"})]},L.value)})})]}),s.jsxs("div",{className:"space-y-3 pt-4 border-t border-gray-700/50",children:[s.jsx(te,{className:"text-gray-300",children:"用户资料完善要求(被匹配用户必须满足以下条件)"}),s.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[{key:"requirePhone",label:"有手机号",icon:"📱"},{key:"requireNickname",label:"有昵称",icon:"👤"},{key:"requireAvatar",label:"有头像",icon:"🖼️"},{key:"requireBusiness",label:"有业务需求",icon:"💼"}].map(L=>{const se=(e.poolSettings??ou)[L.key];return s.jsxs("div",{className:"flex items-center gap-3 bg-[#0a1628] rounded-lg p-3",children:[s.jsx(Ut,{checked:se,onCheckedChange:$=>n({...e,poolSettings:{...e.poolSettings??ou,[L.key]:$}})}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{children:L.icon}),s.jsx(te,{className:"text-gray-300 text-sm",children:L.label})]})]},L.key)})})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(ut,{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(_o,{className:"w-5 h-5 text-yellow-400"})," 基础设置"]}),s.jsx(qt,{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(te,{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:L=>n({...e,freeMatchLimit:parseInt(L.target.value,10)||0})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"付费匹配价格(元)"}),s.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:e.matchPrice,onChange:L=>n({...e,matchPrice:parseFloat(L.target.value)||1})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"每日最大匹配次数"}),s.jsx(ce,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.settings.maxMatchesPerDay,onChange:L=>n({...e,settings:{...e.settings,maxMatchesPerDay:parseInt(L.target.value,10)||10}})})]})]}),s.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:e.settings.enableFreeMatches,onCheckedChange:L=>n({...e,settings:{...e.settings,enableFreeMatches:L}})}),s.jsx(te,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:e.settings.enablePaidMatches,onCheckedChange:L=>n({...e,settings:{...e.settings,enablePaidMatches:L}})}),s.jsx(te,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(ut,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(ht,{className:"text-white flex items-center gap-2",children:[s.jsx(Un,{className:"w-5 h-5 text-[#38bdac]"})," 匹配类型管理"]}),s.jsx(qt,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(J,{onClick:O,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx($n,{className:"w-4 h-4 mr-1"})," 添加类型"]})]}),s.jsx(_e,{children:s.jsxs(us,{children:[s.jsx(hs,{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(fs,{children:e.matchTypes.map(L=>s.jsxs(xt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(je,{children:s.jsx("span",{className:"text-2xl",children:L.icon})}),s.jsx(je,{className:"font-mono text-gray-300",children:L.id}),s.jsx(je,{className:"text-white font-medium",children:L.label}),s.jsx(je,{className:"text-gray-300",children:L.matchLabel}),s.jsx(je,{children:s.jsxs(Be,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",L.price]})}),s.jsx(je,{children:L.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(je,{children:s.jsx(Ut,{checked:L.enabled,onCheckedChange:()=>z(L.id)})}),s.jsx(je,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>R(L),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(sn,{className:"w-4 h-4"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>P(L.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(Yn,{className:"w-4 h-4"})})]})})]},L.id))})]})})]}),s.jsx(Dt,{open:c,onOpenChange:u,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[h?s.jsx(sn,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx($n,{className:"w-5 h-5 text-[#38bdac]"}),h?"编辑匹配类型":"添加匹配类型"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"类型ID(英文)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:m.id,onChange:L=>g({...m,id:L.target.value}),disabled:!!h})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:ZV.map(L=>s.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${m.icon===L?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>g({...m,icon:L}),children:L},L))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"显示名称"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.label,onChange:L=>g({...m,label:L.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"匹配标签"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.matchLabel,onChange:L=>g({...m,matchLabel:L.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"单次匹配价格(元)"}),s.jsx(ce,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:m.price,onChange:L=>g({...m,price:parseFloat(L.target.value)||1})})]}),s.jsxs("div",{className:"flex gap-6 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:m.matchFromDB,onCheckedChange:L=>g({...m,matchFromDB:L})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:m.showJoinAfterMatch,onCheckedChange:L=>g({...m,showJoinAfterMatch:L})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:m.enabled,onCheckedChange:L=>g({...m,enabled:L})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(rn,{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:U,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-4 h-4 mr-2"})," 保存"]})]})]})})]})}const Ij={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function tH(){const[t,e]=y.useState([]),[n,r]=y.useState(0),[a,i]=y.useState(1),[o,c]=y.useState(10),[u,h]=y.useState(""),[f,m]=y.useState(!0),[g,b]=y.useState(null),[N,j]=y.useState(null);async function v(){m(!0),b(null);try{const C=new URLSearchParams({page:String(a),pageSize:String(o)});u&&C.set("matchType",u);const 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(()=>{v()},[a,u]);const k=Math.ceil(n/o)||1,T=({userId:C,nickname:R,avatar:O})=>s.jsxs("div",{className:"flex items-center gap-3 cursor-pointer group",onClick:()=>j(C),children:[s.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[O?s.jsx("img",{src:ma(O),alt:"",className:"w-full h-full object-cover",onError:U=>{U.currentTarget.style.display="none"}}):null,s.jsx("span",{className:O?"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:[g&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[s.jsx("span",{children:g}),s.jsx("button",{type:"button",onClick:()=>b(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("p",{className:"text-gray-400",children:["共 ",n," 条匹配记录 · 点击用户名查看详情"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("select",{value:u,onChange:C=>{h(C.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部类型"}),Object.entries(Ij).map(([C,R])=>s.jsx("option",{value:C,children:R},C))]}),s.jsxs("button",{type:"button",onClick:v,disabled:f,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(He,{className:`w-4 h-4 ${f?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(us,{children:[s.jsx(hs,{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(fs,{children:[t.map(C=>s.jsxs(xt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(je,{children:s.jsx(T,{userId:C.userId,nickname:C.userNickname,avatar:C.userAvatar})}),s.jsx(je,{children:C.matchedUserId?s.jsx(T,{userId:C.matchedUserId,nickname:C.matchedNickname,avatar:C.matchedUserAvatar}):s.jsx("span",{className:"text-gray-500",children:"—"})}),s.jsx(je,{children:s.jsx(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Ij[C.matchType]||C.matchType})}),s.jsxs(je,{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(je,{className:"text-gray-400",children:C.createdAt?new Date(C.createdAt).toLocaleString():"-"})]},C.id)),t.length===0&&s.jsx(xt,{children:s.jsx(je,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(Us,{page:a,totalPages:k,total:n,pageSize:o,onPageChange:i,onPageSizeChange:C=>{c(C),i(1)}})]})})}),s.jsx(uy,{open:!!N,onClose:()=>j(null),userId:N,onUserUpdated:v})]})}function nH(){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(tH,{}),t==="pool"&&s.jsx(eH,{})]})}const Pj={investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function sH(){const[t,e]=y.useState([]),[n,r]=y.useState(0),[a,i]=y.useState(1),[o,c]=y.useState(10),[u,h]=y.useState(!0),[f,m]=y.useState("investor"),[g,b]=y.useState(null);async function N(){h(!0);try{const T=new URLSearchParams({page:String(a),pageSize:String(o),matchType:f}),C=await Oe(`/api/db/match-records?${T}`);C!=null&&C.success&&(e(C.records||[]),r(C.total??0))}catch(T){console.error(T)}finally{h(!1)}}y.useEffect(()=>{N()},[a,f]);const j=async T=>{if(!T.phone&&!T.wechatId){G.info("该记录无联系方式,无法推送到存客宝");return}b(T.id);try{const C=await kt("/api/ckb/join",{type:T.matchType||"investor",phone:T.phone||"",wechat:T.wechatId||"",userId:T.userId,name:T.userNickname||""});G.error((C==null?void 0:C.message)||(C!=null&&C.success?"推送成功":"推送失败"))}catch(C){G.error("推送失败: "+(C instanceof Error?C.message:"网络错误"))}finally{b(null)}},v=Math.ceil(n/o)||1,k=T=>!!(T.phone||T.wechatId);return s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400",children:"点击获客:有人填写手机号/微信号的直接显示,可一键推送到存客宝"}),s.jsxs("p",{className:"text-gray-500 text-xs mt-1",children:["共 ",n," 条记录 — 有联系方式的可触发存客宝添加好友"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("select",{value:f,onChange:T=>{m(T.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:Object.entries(Pj).map(([T,C])=>s.jsx("option",{value:T,children:C},T))}),s.jsxs(J,{onClick:N,disabled:u,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${u?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(us,{children:[s.jsx(hs,{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(fs,{children:[t.map(T=>{var C,R;return s.jsxs(xt,{className:`border-gray-700/50 ${k(T)?"hover:bg-[#0a1628]":"opacity-60"}`,children:[s.jsx(je,{className:"text-white",children:T.userNickname||((C=T.userId)==null?void 0:C.slice(0,12))}),s.jsx(je,{className:"text-white",children:T.matchedNickname||((R=T.matchedUserId)==null?void 0:R.slice(0,12))}),s.jsx(je,{children:s.jsx(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Pj[T.matchType]||T.matchType})}),s.jsxs(je,{className:"text-sm",children:[T.phone&&s.jsxs("div",{className:"text-green-400",children:["📱 ",T.phone]}),T.wechatId&&s.jsxs("div",{className:"text-blue-400",children:["💬 ",T.wechatId]}),!T.phone&&!T.wechatId&&s.jsx("span",{className:"text-gray-600",children:"无联系方式"})]}),s.jsx(je,{className:"text-gray-400 text-sm",children:T.createdAt?new Date(T.createdAt).toLocaleString():"-"}),s.jsx(je,{className:"text-right",children:k(T)?s.jsxs(J,{size:"sm",onClick:()=>j(T),disabled:g===T.id,className:"bg-[#38bdac] hover:bg-[#2da396] text-white text-xs h-7 px-3",children:[s.jsx(cA,{className:"w-3 h-3 mr-1"}),g===T.id?"推送中...":"推送CKB"]}):s.jsx("span",{className:"text-gray-600 text-xs",children:"—"})})]},T.id)}),t.length===0&&s.jsx(xt,{children:s.jsx(je,{colSpan:6,className:"text-center py-12 text-gray-500",children:"暂无记录"})})]})]}),s.jsx(Us,{page:a,totalPages:v,total:n,pageSize:o,onPageChange:i,onPageSizeChange:T=>{c(T),i(1)}})]})})})]})}const Rj={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},rH={single:"单次",half_year:"半年",year:"年度"};function aH(){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(Rj).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(He,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(us,{children:[s.jsx(hs,{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(fs,{children:[t.map(c=>s.jsxs(xt,{className:"border-gray-700/50",children:[s.jsx(je,{className:"text-gray-300",children:c.id}),s.jsx(je,{className:"text-gray-400",children:c.userId}),s.jsx(je,{className:"text-gray-400",children:c.mentorId}),s.jsx(je,{className:"text-gray-400",children:rH[c.consultationType]||c.consultationType}),s.jsxs(je,{className:"text-white",children:["¥",c.amount]}),s.jsx(je,{className:"text-gray-400",children:Rj[c.status]||c.status}),s.jsx(je,{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(je,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}function iH(){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(aH,{}),t==="manage"&&s.jsx("div",{className:"-mx-8",children:s.jsx(W4,{embedded:!0})})]})}function oH(){const[t,e]=y.useState([]),[n,r]=y.useState(0),[a,i]=y.useState(1),[o,c]=y.useState(10),[u,h]=y.useState(!0);async function f(){h(!0);try{const g=new URLSearchParams({page:String(a),pageSize:String(o),matchType:"team"}),b=await Oe(`/api/db/match-records?${g}`);b!=null&&b.success&&(e(b.records||[]),r(b.total??0))}catch(g){console.error(g)}finally{h(!1)}}y.useEffect(()=>{f()},[a]);const m=Math.ceil(n/o)||1;return s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("div",{children:[s.jsxs("p",{className:"text-gray-400",children:["团队招募匹配记录,共 ",n," 条"]}),s.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"用户通过「团队招募」提交联系方式到存客宝"})]}),s.jsxs("button",{type:"button",onClick:f,disabled:u,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(He,{className:`w-4 h-4 ${u?"animate-spin":""}`})," 刷新"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(us,{children:[s.jsx(hs,{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(fs,{children:[t.map(g=>s.jsxs(xt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(je,{className:"text-white",children:g.userNickname||g.userId}),s.jsx(je,{className:"text-white",children:g.matchedNickname||g.matchedUserId}),s.jsxs(je,{className:"text-gray-400 text-sm",children:[g.phone&&s.jsxs("div",{children:["📱 ",g.phone]}),g.wechatId&&s.jsxs("div",{children:["💬 ",g.wechatId]}),!g.phone&&!g.wechatId&&"-"]}),s.jsx(je,{className:"text-gray-400",children:g.createdAt?new Date(g.createdAt).toLocaleString():"-"})]},g.id)),t.length===0&&s.jsx(xt,{children:s.jsx(je,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无团队招募记录"})})]})]}),s.jsx(Us,{page:a,totalPages:m,total:n,pageSize:o,onPageChange:i,onPageSizeChange:g=>{c(g),i(1)}})]})})})]})}const lH=["partner","investor","mentor","team"],Px=[{key:"join_partner",label:"找伙伴场景"},{key:"join_investor",label:"资源对接场景"},{key:"join_mentor",label:"导师顾问场景"},{key:"join_team",label:"团队招募场景"},{key:"match",label:"匹配上报"},{key:"lead",label:"链接卡若"}],Lj=`# 场景获客接口摘要 ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js -- 地址:POST /v1/api/scenarios -- 必填:apiKey、sign、timestamp -- 主标识:phone 或 wechatId 至少一项 -- 可选:name、source、remark、tags、siteTags、portrait -- 签名:排除 sign/apiKey/portrait,键名升序拼接值后双重 MD5 -<<<<<<<< HEAD:soul-admin/dist/assets/index-CZFUM7K_.js -- 成功:code=200,message=新增成功 或 已存在`;function dH({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(Dj),[m,g]=y.useState(!1),[b,N]=y.useState(!1),[j,v]=y.useState([]),[k,T]=y.useState([]),[C,R]=y.useState({}),[O,U]=y.useState([{endpoint:"/api/ckb/join",label:"找伙伴",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"资源对接",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"导师顾问",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"团队招募",method:"POST",status:"idle"},{endpoint:"/api/ckb/match",label:"匹配上报",method:"POST",status:"idle"},{endpoint:"/api/miniprogram/ckb/lead",label:"链接卡若",method:"POST",status:"idle"},{endpoint:"/api/match/config",label:"匹配配置",method:"GET",status:"idle"}]),I=y.useMemo(()=>{const P={};return Rx.forEach(Y=>{P[Y.key]=C[Y.key]||{apiUrl:"https://ckbapi.quwanzhi.com/v1/api/scenarios",apiKey:"fyngh-ecy9h-qkdae-epwd5-rz6kd",source:"",tags:"",siteTags:"创业实验APP",notes:""}}),P},[C]),z=P=>{const Y=r.trim(),F=i.trim();return P<=3?{type:cH[P],phone:Y||void 0,wechat:F||void 0,userId:"admin_test",name:"后台测试"}:P===4?{matchType:"partner",phone:Y||void 0,wechat:F||void 0,userId:"admin_test",nickname:"后台测试",matchedUser:{id:"test",nickname:"测试",matchScore:88}}:P===5?{phone:Y||void 0,wechatId:F||void 0,userId:"admin_test",name:"后台测试"}:{}};async function L(){N(!0);try{const[P,Y,F]=await Promise.all([Oe("/api/db/config/full?key=ckb_config"),Oe("/api/db/ckb-leads?mode=submitted&page=1&pageSize=50"),Oe("/api/db/ckb-leads?mode=contact&page=1&pageSize=50")]),ge=P==null?void 0:P.data;ge!=null&&ge.routes&&R(ge.routes),ge!=null&&ge.docNotes&&u(ge.docNotes),ge!=null&&ge.docContent&&f(ge.docContent),Y!=null&&Y.success&&v(Y.records||[]),F!=null&&F.success&&T(F.records||[])}finally{N(!1)}}y.useEffect(()=>{n(t)},[t]),y.useEffect(()=>{L()},[]);const Q=y.useMemo(()=>{const P=B=>(B||"").replace(/\D/g,"")||"",Y=B=>{const W=P(B.phone);if(W)return`phone:${W}`;const fe=(B.userId||"").trim();if(fe)return`user:${fe}`;const he=(B.wechatId||"").trim();return he?`wechat:${he}`:`row:${B.id}`},F=[...k].sort((B,W)=>{const fe=B.createdAt?new Date(B.createdAt).getTime():0;return(W.createdAt?new Date(W.createdAt).getTime():0)-fe}),ge=new Set,X=[];for(const B of F){const W=Y(B);ge.has(W)||(ge.add(W),X.push(B))}return X},[k]);async function se(){g(!0);try{const P=await kt("/api/db/config",{key:"ckb_config",value:{routes:I,docNotes:c,docContent:h},description:"存客宝接口配置"});G.error((P==null?void 0:P.success)!==!1?"存客宝配置已保存":`保存失败: ${(P==null?void 0:P.error)||"未知错误"}`)}catch(P){G.error(`保存失败: ${P instanceof Error?P.message:"网络错误"}`)}finally{g(!1)}}const $=(P,Y)=>{R(F=>({...F,[P]:{...I[P],...Y}}))},ie=async P=>{const Y=O[P];if(Y.method==="POST"&&!r.trim()&&!i.trim()){G.error("请填写测试手机号");return}const F=[...O];F[P]={...Y,status:"testing",message:void 0,responseTime:void 0},U(F);const ge=performance.now();try{const X=Y.method==="GET"?await Oe(Y.endpoint):await kt(Y.endpoint,z(P)),B=Math.round(performance.now()-ge),W=(X==null?void 0:X.message)||"",fe=(X==null?void 0:X.success)===!0||W.includes("已存在")||W.includes("已加入")||W.includes("已提交"),he=[...O];he[P]={...Y,status:fe?"success":"error",message:W||(fe?"正常":"异常"),responseTime:B},U(he),await L()}catch(X){const B=Math.round(performance.now()-ge),W=[...O];W[P]={...Y,status:"error",message:X instanceof Error?X.message:"失败",responseTime:B},U(W)}},le=async()=>{if(!r.trim()&&!i.trim()){G.error("请填写测试手机号");return}for(let P=0;Ps.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:P.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(zl,{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:Y}),F?s.jsx("p",{className:"text-gray-500 text-sm mt-2 max-w-md mx-auto leading-relaxed",children:F}):null]})})}):P.map(ge=>s.jsxs("tr",{className:"border-t border-gray-700/30",children:[s.jsx("td",{className:"px-4 py-3 text-white",children:ge.userNickname||ge.userId}),s.jsx("td",{className:"px-4 py-3 text-gray-300",children:ge.matchType}),s.jsx("td",{className:"px-4 py-3 text-green-400",children:ge.phone||"—"}),s.jsx("td",{className:"px-4 py-3 text-blue-400",children:ge.wechatId||"—"}),s.jsx("td",{className:"px-4 py-3 text-gray-400",children:ge.createdAt?new Date(ge.createdAt).toLocaleString():"—"})]},String(ge.id)))})]})});return s.jsx(De,{className:"bg-[#0f2137] border-orange-500/30 mb-6",children:s.jsxs(_e,{className:"p-5",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("h3",{className:"text-white font-semibold",children:"存客宝工作台"}),s.jsx(Be,{className:"bg-orange-500/20 text-orange-400 border-0 text-xs",children:"CKB"}),s.jsxs("button",{type:"button",onClick:()=>n("doc"),className:"text-orange-400/60 text-xs hover:text-orange-400 flex items-center gap-1",children:[s.jsx(_o,{className:"w-3 h-3"})," API 文档"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(J,{onClick:()=>L(),variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-3.5 h-3.5 mr-1 ${b?"animate-spin":""}`})," 刷新"]}),s.jsxs(J,{onClick:se,disabled:m,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{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(([P,Y])=>s.jsx("button",{type:"button",onClick:()=>n(P),className:`px-4 py-2 rounded-lg text-sm transition-colors ${e===P?"bg-orange-500 text-white":"bg-[#0a1628] text-gray-400 hover:text-white"}`,children:Y},P))}),e==="overview"&&s.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"加入/匹配提交"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:j.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"留资线索(有联系方式,已去重)"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:Q.length}),k.length!==Q.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:Rx.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"文档备注"}),s.jsx("p",{className:"text-sm text-gray-300 line-clamp-3",children:c||"未填写"})]})]}),e==="submitted"&&me(j,"暂无加入/匹配提交记录","用户在找伙伴发起加入或匹配后会出现在这里。"),e==="contact"&&s.jsxs("div",{className:"space-y-2",children:[k.length>Q.length&&s.jsxs("p",{className:"text-xs text-gray-500",children:["已合并 ",k.length-Q.length," 条重复(同手机号或同用户 ID 仅保留最近一条)"]}),me(Q,"暂无有联系方式线索","存客宝留资同步后显示;完整列表与筛选请前往「用户管理 → 获客列表」。")]}),e==="config"&&s.jsx("div",{className:"space-y-4",children:Rx.map(P=>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:P.label}),s.jsx(Be,{className:"bg-orange-500/20 text-orange-300 border-0 text-xs",children:P.key})]}),s.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"API 地址"}),s.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:I[P.key].apiUrl,onChange:Y=>$(P.key,{apiUrl:Y.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{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[P.key].apiKey,onChange:Y=>$(P.key,{apiKey:Y.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{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[P.key].source,onChange:Y=>$(P.key,{source:Y.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{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[P.key].tags,onChange:Y=>$(P.key,{tags:Y.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{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[P.key].siteTags,onChange:Y=>$(P.key,{siteTags:Y.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"说明备注"}),s.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:I[P.key].notes,onChange:Y=>$(P.key,{notes:Y.target.value})})]})]})]},P.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(zl,{className:"w-4 h-4 text-gray-500 shrink-0"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"测试手机号"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:r,onChange:P=>a(P.target.value)})]})]}),s.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[s.jsx("span",{className:"text-gray-500 text-sm shrink-0",children:"💬"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"微信号(可选)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:i,onChange:P=>o(P.target.value)})]})]}),s.jsx("div",{className:"flex items-end",children:s.jsxs(J,{onClick:le,className:"bg-orange-500 hover:bg-orange-600 text-white",children:[s.jsx($o,{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((P,Y)=>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:[P.status==="idle"&&s.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-600 shrink-0"}),P.status==="testing"&&s.jsx(He,{className:"w-3 h-3 text-yellow-400 animate-spin shrink-0"}),P.status==="success"&&s.jsx(Yj,{className:"w-3 h-3 text-green-400 shrink-0"}),P.status==="error"&&s.jsx(Zj,{className:"w-3 h-3 text-red-400 shrink-0"}),s.jsx("span",{className:"text-white text-xs truncate",children:P.label})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[P.responseTime!==void 0&&s.jsxs("span",{className:"text-gray-600 text-[10px]",children:[P.responseTime,"ms"]}),s.jsx("button",{type:"button",onClick:()=>ie(Y),disabled:P.status==="testing",className:"text-orange-400/60 hover:text-orange-400 text-[10px] disabled:opacity-50",children:"测试"})]})]},`${P.endpoint}-${Y}`))})]}),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(_o,{className:"w-3 h-3"})," 打开外链"]})]}),s.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-400 leading-6",children:h||Dj})]}),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:P=>u(P.target.value),placeholder:"记录 Token、入口差异、回复率统计规则、对接约定等。"})]})]})]})})}const uH=[{id:"partner",label:"找伙伴",icon:Kn,desc:"匹配池与记录"},{id:"resource",label:"资源对接",icon:aM,desc:"人脉资源"},{id:"mentor",label:"导师预约",icon:nM,desc:"预约与管理"},{id:"team",label:"团队招募",icon:Hc,desc:"团队协作"}];function hH(){const[t,e]=y.useState("partner"),[n,r]=y.useState(!1);return s.jsxs("div",{className:"p-8 w-full max-w-7xl mx-auto",children:[s.jsxs("div",{className:"mb-8 flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-xl font-semibold text-white flex items-center gap-2",children:[s.jsx(Kn,{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(a=>!a),className:`border-orange-500/30 text-orange-300 hover:bg-orange-500/10 bg-transparent text-xs ${n?"bg-orange-500/10":""}`,children:[s.jsx(Ai,{className:"w-3.5 h-3.5 mr-1.5"}),"存客宝",s.jsx(El,{className:`w-3 h-3 ml-1 transition-transform ${n?"rotate-90":""}`})]})]}),n&&s.jsx(dH,{initialTab:"overview"}),s.jsx("div",{className:"flex gap-1 mb-6 bg-[#0a1628] rounded-lg p-1 border border-gray-700/40",children:uH.map(a=>{const i=t===a.id;return s.jsxs("button",{type:"button",onClick:()=>e(a.id),className:`flex-1 flex items-center justify-center gap-1.5 px-3 py-2 rounded-md text-sm transition-all ${i?"bg-[#38bdac] text-white shadow-md":"text-gray-400 hover:text-white hover:bg-gray-700/40"}`,children:[s.jsx(a.icon,{className:"w-3.5 h-3.5"}),a.label]},a.id)})}),t==="partner"&&s.jsx(sH,{}),t==="resource"&&s.jsx(rH,{}),t==="mentor"&&s.jsx(oH,{}),t==="team"&&s.jsx(lH,{})]})}function fH(){const t=Wo();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(Qj,{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(_l,{to:"/",children:[s.jsx(pM,{className:"w-4 h-4 mr-2"}),"返回首页"]})})]})})}function pH(){return s.jsxs(JT,{children:[s.jsx(cn,{path:"/login",element:s.jsx(JP,{})}),s.jsxs(cn,{path:"/",element:s.jsx(XA,{}),children:[s.jsx(cn,{index:!0,element:s.jsx(Bh,{to:"/dashboard",replace:!0})}),s.jsx(cn,{path:"dashboard",element:s.jsx(l8,{})}),s.jsx(cn,{path:"orders",element:s.jsx(c8,{})}),s.jsx(cn,{path:"users",element:s.jsx(y8,{})}),s.jsx(cn,{path:"distribution",element:s.jsx(F8,{})}),s.jsx(cn,{path:"withdrawals",element:s.jsx(B8,{})}),s.jsx(cn,{path:"content",element:s.jsx(NV,{})}),s.jsx(cn,{path:"referral-settings",element:s.jsx(H2,{})}),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(XV,{})}),s.jsx(cn,{path:"mentors",element:s.jsx(q4,{})}),s.jsx(cn,{path:"mentor-consultations",element:s.jsx(ZV,{})}),s.jsx(cn,{path:"admin-users",element:s.jsx(Bh,{to:"/settings?tab=admin",replace:!0})}),s.jsx(cn,{path:"settings",element:s.jsx(VV,{})}),s.jsx(cn,{path:"payment",element:s.jsx(HV,{})}),s.jsx(cn,{path:"site",element:s.jsx(qV,{})}),s.jsx(cn,{path:"qrcodes",element:s.jsx(GV,{})}),s.jsx(cn,{path:"find-partner",element:s.jsx(hH,{})}),s.jsx(cn,{path:"match",element:s.jsx(QV,{})}),s.jsx(cn,{path:"match-records",element:s.jsx(YV,{})}),s.jsx(cn,{path:"api-doc",element:s.jsx(Bh,{to:"/api-docs",replace:!0})}),s.jsx(cn,{path:"api-docs",element:s.jsx(K4,{})})]}),s.jsx(cn,{path:"*",element:s.jsx(fH,{})})]})}eT.createRoot(document.getElementById("root")).render(s.jsx(y.StrictMode,{children:s.jsx(s5,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:s.jsx(pH,{})})})); -======== -- 成功:code=200,message=新增成功 或 已存在`;function cH({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(Lj),[m,g]=y.useState(!1),[b,N]=y.useState(!1),[j,v]=y.useState([]),[k,T]=y.useState([]),[C,R]=y.useState({}),[O,U]=y.useState([{endpoint:"/api/ckb/join",label:"找伙伴",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"资源对接",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"导师顾问",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"团队招募",method:"POST",status:"idle"},{endpoint:"/api/ckb/match",label:"匹配上报",method:"POST",status:"idle"},{endpoint:"/api/miniprogram/ckb/lead",label:"链接卡若",method:"POST",status:"idle"},{endpoint:"/api/match/config",label:"匹配配置",method:"GET",status:"idle"}]),P=y.useMemo(()=>{const I={};return Px.forEach(Y=>{I[Y.key]=C[Y.key]||{apiUrl:"https://ckbapi.quwanzhi.com/v1/api/scenarios",apiKey:"fyngh-ecy9h-qkdae-epwd5-rz6kd",source:"",tags:"",siteTags:"创业实验APP",notes:""}}),I},[C]),z=I=>{const Y=r.trim(),F=i.trim();return I<=3?{type:lH[I],phone:Y||void 0,wechat:F||void 0,userId:"admin_test",name:"后台测试"}:I===4?{matchType:"partner",phone:Y||void 0,wechat:F||void 0,userId:"admin_test",nickname:"后台测试",matchedUser:{id:"test",nickname:"测试",matchScore:88}}:I===5?{phone:Y||void 0,wechatId:F||void 0,userId:"admin_test",name:"后台测试"}:{}};async function L(){N(!0);try{const[I,Y,F]=await Promise.all([Oe("/api/db/config/full?key=ckb_config"),Oe("/api/db/ckb-leads?mode=submitted&page=1&pageSize=50"),Oe("/api/db/ckb-leads?mode=contact&page=1&pageSize=50")]),ge=I==null?void 0:I.data;ge!=null&&ge.routes&&R(ge.routes),ge!=null&&ge.docNotes&&u(ge.docNotes),ge!=null&&ge.docContent&&f(ge.docContent),Y!=null&&Y.success&&v(Y.records||[]),F!=null&&F.success&&T(F.records||[])}finally{N(!1)}}y.useEffect(()=>{n(t)},[t]),y.useEffect(()=>{L()},[]);const Q=y.useMemo(()=>{const I=B=>(B||"").replace(/\D/g,"")||"",Y=B=>{const W=I(B.phone);if(W)return`phone:${W}`;const fe=(B.userId||"").trim();if(fe)return`user:${fe}`;const he=(B.wechatId||"").trim();return he?`wechat:${he}`:`row:${B.id}`},F=[...k].sort((B,W)=>{const fe=B.createdAt?new Date(B.createdAt).getTime():0;return(W.createdAt?new Date(W.createdAt).getTime():0)-fe}),ge=new Set,X=[];for(const B of F){const W=Y(B);ge.has(W)||(ge.add(W),X.push(B))}return X},[k]);async function se(){g(!0);try{const I=await kt("/api/db/config",{key:"ckb_config",value:{routes:P,docNotes:c,docContent:h},description:"存客宝接口配置"});G.error((I==null?void 0:I.success)!==!1?"存客宝配置已保存":`保存失败: ${(I==null?void 0:I.error)||"未知错误"}`)}catch(I){G.error(`保存失败: ${I instanceof Error?I.message:"网络错误"}`)}finally{g(!1)}}const $=(I,Y)=>{R(F=>({...F,[I]:{...P[I],...Y}}))},ie=async I=>{const Y=O[I];if(Y.method==="POST"&&!r.trim()&&!i.trim()){G.error("请填写测试手机号");return}const F=[...O];F[I]={...Y,status:"testing",message:void 0,responseTime:void 0},U(F);const ge=performance.now();try{const X=Y.method==="GET"?await Oe(Y.endpoint):await kt(Y.endpoint,z(I)),B=Math.round(performance.now()-ge),W=(X==null?void 0:X.message)||"",fe=(X==null?void 0:X.success)===!0||W.includes("已存在")||W.includes("已加入")||W.includes("已提交"),he=[...O];he[I]={...Y,status:fe?"success":"error",message:W||(fe?"正常":"异常"),responseTime:B},U(he),await L()}catch(X){const B=Math.round(performance.now()-ge),W=[...O];W[I]={...Y,status:"error",message:X instanceof Error?X.message:"失败",responseTime:B},U(W)}},le=async()=>{if(!r.trim()&&!i.trim()){G.error("请填写测试手机号");return}for(let I=0;Is.jsx("div",{className:"overflow-auto rounded-lg border border-gray-700/30",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{className:"bg-[#0a1628] text-gray-400",children:s.jsxs("tr",{children:[s.jsx("th",{className:"text-left px-4 py-3",children:"发起人"}),s.jsx("th",{className:"text-left px-4 py-3",children:"类型"}),s.jsx("th",{className:"text-left px-4 py-3",children:"手机号"}),s.jsx("th",{className:"text-left px-4 py-3",children:"微信号"}),s.jsx("th",{className:"text-left px-4 py-3",children:"时间"})]})}),s.jsx("tbody",{children:I.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"p-0 align-top",children:s.jsxs("div",{className:"py-14 px-6 text-center bg-[#0a1628]/40 border-t border-gray-700/30",children:[s.jsx($l,{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:Y}),F?s.jsx("p",{className:"text-gray-500 text-sm mt-2 max-w-md mx-auto leading-relaxed",children:F}):null]})})}):I.map(ge=>s.jsxs("tr",{className:"border-t border-gray-700/30",children:[s.jsx("td",{className:"px-4 py-3 text-white",children:ge.userNickname||ge.userId}),s.jsx("td",{className:"px-4 py-3 text-gray-300",children:ge.matchType}),s.jsx("td",{className:"px-4 py-3 text-green-400",children:ge.phone||"—"}),s.jsx("td",{className:"px-4 py-3 text-blue-400",children:ge.wechatId||"—"}),s.jsx("td",{className:"px-4 py-3 text-gray-400",children:ge.createdAt?new Date(ge.createdAt).toLocaleString():"—"})]},String(ge.id)))})]})});return s.jsx(De,{className:"bg-[#0f2137] border-orange-500/30 mb-6",children:s.jsxs(_e,{className:"p-5",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("h3",{className:"text-white font-semibold",children:"存客宝工作台"}),s.jsx(Be,{className:"bg-orange-500/20 text-orange-400 border-0 text-xs",children:"CKB"}),s.jsxs("button",{type:"button",onClick:()=>n("doc"),className:"text-orange-400/60 text-xs hover:text-orange-400 flex items-center gap-1",children:[s.jsx(Do,{className:"w-3 h-3"})," API 文档"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(J,{onClick:()=>L(),variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-3.5 h-3.5 mr-1 ${b?"animate-spin":""}`})," 刷新"]}),s.jsxs(J,{onClick:se,disabled:m,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Cn,{className:"w-3.5 h-3.5 mr-1"})," ",m?"保存中...":"保存配置"]})]})]}),s.jsx("div",{className:"flex flex-wrap gap-2 mb-5",children:[["overview","概览"],["submitted","加入/匹配提交"],["contact","留资线索(有联系方式)"],["config","场景配置"],["test","接口测试"],["doc","API 文档"]].map(([I,Y])=>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:Y},I))}),e==="overview"&&s.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"加入/匹配提交"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:j.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"留资线索(有联系方式,已去重)"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:Q.length}),k.length!==Q.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:Px.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"文档备注"}),s.jsx("p",{className:"text-sm text-gray-300 line-clamp-3",children:c||"未填写"})]})]}),e==="submitted"&&me(j,"暂无加入/匹配提交记录","用户在找伙伴发起加入或匹配后会出现在这里。"),e==="contact"&&s.jsxs("div",{className:"space-y-2",children:[k.length>Q.length&&s.jsxs("p",{className:"text-xs text-gray-500",children:["已合并 ",k.length-Q.length," 条重复(同手机号或同用户 ID 仅保留最近一条)"]}),me(Q,"暂无有联系方式线索","存客宝留资同步后显示;完整列表与筛选请前往「用户管理 → 获客列表」。")]}),e==="config"&&s.jsx("div",{className:"space-y-4",children:Px.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(te,{className:"text-gray-500 text-xs",children:"API 地址"}),s.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:P[I.key].apiUrl,onChange:Y=>$(I.key,{apiUrl:Y.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{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:P[I.key].apiKey,onChange:Y=>$(I.key,{apiKey:Y.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"Source"}),s.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:P[I.key].source,onChange:Y=>$(I.key,{source:Y.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"Tags"}),s.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:P[I.key].tags,onChange:Y=>$(I.key,{tags:Y.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"SiteTags"}),s.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:P[I.key].siteTags,onChange:Y=>$(I.key,{siteTags:Y.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"说明备注"}),s.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:P[I.key].notes,onChange:Y=>$(I.key,{notes:Y.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($l,{className:"w-4 h-4 text-gray-500 shrink-0"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"测试手机号"}),s.jsx(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(te,{className:"text-gray-500 text-xs",children:"微信号(可选)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm mt-0.5",value:i,onChange:I=>o(I.target.value)})]})]}),s.jsx("div",{className:"flex items-end",children:s.jsxs(J,{onClick:le,className:"bg-orange-500 hover:bg-orange-600 text-white",children:[s.jsx(_o,{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,Y)=>s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg px-3 py-2 border border-gray-700/30",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[I.status==="idle"&&s.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-600 shrink-0"}),I.status==="testing"&&s.jsx(He,{className:"w-3 h-3 text-yellow-400 animate-spin shrink-0"}),I.status==="success"&&s.jsx(Jj,{className:"w-3 h-3 text-green-400 shrink-0"}),I.status==="error"&&s.jsx(Yj,{className:"w-3 h-3 text-red-400 shrink-0"}),s.jsx("span",{className:"text-white text-xs truncate",children:I.label})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[I.responseTime!==void 0&&s.jsxs("span",{className:"text-gray-600 text-[10px]",children:[I.responseTime,"ms"]}),s.jsx("button",{type:"button",onClick:()=>ie(Y),disabled:I.status==="testing",className:"text-orange-400/60 hover:text-orange-400 text-[10px] disabled:opacity-50",children:"测试"})]})]},`${I.endpoint}-${Y}`))})]}),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(Do,{className:"w-3 h-3"})," 打开外链"]})]}),s.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-400 leading-6",children:h||Lj})]}),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 dH=[{id:"partner",label:"找伙伴",icon:Un,desc:"匹配池与记录"},{id:"resource",label:"资源对接",icon:sM,desc:"人脉资源"},{id:"mentor",label:"导师预约",icon:eM,desc:"预约与管理"},{id:"team",label:"团队招募",icon:Vc,desc:"团队协作"}];function uH(){const[t,e]=y.useState("partner"),[n,r]=y.useState(!1);return s.jsxs("div",{className:"p-8 w-full max-w-7xl mx-auto",children:[s.jsxs("div",{className:"mb-8 flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-xl font-semibold text-white flex items-center gap-2",children:[s.jsx(Un,{className:"w-5 h-5 text-[#38bdac]"}),"找伙伴"]}),s.jsx("p",{className:"text-gray-500 text-sm mt-0.5",children:"匹配、获客、导师与团队管理 · 汇总数据见「仪表盘」与「推广中心」"})]}),s.jsxs(J,{type:"button",variant:"outline",size:"sm",onClick:()=>r(a=>!a),className:`border-orange-500/30 text-orange-300 hover:bg-orange-500/10 bg-transparent text-xs ${n?"bg-orange-500/10":""}`,children:[s.jsx(Mi,{className:"w-3.5 h-3.5 mr-1.5"}),"存客宝",s.jsx(Cl,{className:`w-3 h-3 ml-1 transition-transform ${n?"rotate-90":""}`})]})]}),n&&s.jsx(cH,{initialTab:"overview"}),s.jsx("div",{className:"flex gap-1 mb-6 bg-[#0a1628] rounded-lg p-1 border border-gray-700/40",children:dH.map(a=>{const i=t===a.id;return s.jsxs("button",{type:"button",onClick:()=>e(a.id),className:`flex-1 flex items-center justify-center gap-1.5 px-3 py-2 rounded-md text-sm transition-all ${i?"bg-[#38bdac] text-white shadow-md":"text-gray-400 hover:text-white hover:bg-gray-700/40"}`,children:[s.jsx(a.icon,{className:"w-3.5 h-3.5"}),a.label]},a.id)})}),t==="partner"&&s.jsx(nH,{}),t==="resource"&&s.jsx(sH,{}),t==="mentor"&&s.jsx(iH,{}),t==="team"&&s.jsx(oH,{})]})}function hH(){const t=Uo();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(Gj,{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(Dl,{to:"/",children:[s.jsx(hM,{className:"w-4 h-4 mr-2"}),"返回首页"]})})]})})}function fH(){return s.jsxs(qT,{children:[s.jsx(cn,{path:"/login",element:s.jsx(qI,{})}),s.jsxs(cn,{path:"/",element:s.jsx(QA,{}),children:[s.jsx(cn,{index:!0,element:s.jsx(Fh,{to:"/dashboard",replace:!0})}),s.jsx(cn,{path:"dashboard",element:s.jsx(i8,{})}),s.jsx(cn,{path:"orders",element:s.jsx(o8,{})}),s.jsx(cn,{path:"users",element:s.jsx(g8,{})}),s.jsx(cn,{path:"distribution",element:s.jsx($8,{})}),s.jsx(cn,{path:"withdrawals",element:s.jsx(z8,{})}),s.jsx(cn,{path:"content",element:s.jsx(bV,{})}),s.jsx(cn,{path:"referral-settings",element:s.jsx(B2,{})}),s.jsx(cn,{path:"author-settings",element:s.jsx(Fh,{to:"/settings?tab=author",replace:!0})}),s.jsx(cn,{path:"vip-roles",element:s.jsx(YV,{})}),s.jsx(cn,{path:"mentors",element:s.jsx(W4,{})}),s.jsx(cn,{path:"mentor-consultations",element:s.jsx(XV,{})}),s.jsx(cn,{path:"admin-users",element:s.jsx(Fh,{to:"/settings?tab=admin",replace:!0})}),s.jsx(cn,{path:"settings",element:s.jsx(BV,{})}),s.jsx(cn,{path:"payment",element:s.jsx(VV,{})}),s.jsx(cn,{path:"site",element:s.jsx(KV,{})}),s.jsx(cn,{path:"qrcodes",element:s.jsx(qV,{})}),s.jsx(cn,{path:"find-partner",element:s.jsx(uH,{})}),s.jsx(cn,{path:"match",element:s.jsx(JV,{})}),s.jsx(cn,{path:"match-records",element:s.jsx(QV,{})}),s.jsx(cn,{path:"api-doc",element:s.jsx(Fh,{to:"/api-docs",replace:!0})}),s.jsx(cn,{path:"api-docs",element:s.jsx(U4,{})})]}),s.jsx(cn,{path:"*",element:s.jsx(hH,{})})]})}XE.createRoot(document.getElementById("root")).render(s.jsx(y.StrictMode,{children:s.jsx(t5,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:s.jsx(fH,{})})})); ->>>>>>>> devlop:soul-admin/dist/assets/index-BRyXRtx1.js diff --git a/soul-admin/dist/assets/index-BXuoM4lB.js b/soul-admin/dist/assets/index-BXuoM4lB.js new file mode 100644 index 00000000..3743e23d --- /dev/null +++ b/soul-admin/dist/assets/index-BXuoM4lB.js @@ -0,0 +1,1031 @@ +function WE(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 Dj(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ag={exports:{}},tu={},Ig={exports:{}},Mt={};/** + * @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 h1;function KE(){if(h1)return Mt;h1=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),o=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),m=Symbol.iterator;function g(V){return V===null||typeof V!="object"?null:(V=m&&V[m]||V["@@iterator"],typeof V=="function"?V:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,j={};function v(V,W,fe){this.props=V,this.context=W,this.refs=j,this.updater=fe||b}v.prototype.isReactComponent={},v.prototype.setState=function(V,W){if(typeof V!="object"&&typeof V!="function"&&V!=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,V,W,"setState")},v.prototype.forceUpdate=function(V){this.updater.enqueueForceUpdate(this,V,"forceUpdate")};function k(){}k.prototype=v.prototype;function T(V,W,fe){this.props=V,this.context=W,this.refs=j,this.updater=fe||b}var C=T.prototype=new k;C.constructor=T,N(C,v.prototype),C.isPureReactComponent=!0;var R=Array.isArray,O=Object.prototype.hasOwnProperty,U={current:null},P={key:!0,ref:!0,__self:!0,__source:!0};function z(V,W,fe){var he,de={},D=null,q=null;if(W!=null)for(he in W.ref!==void 0&&(q=W.ref),W.key!==void 0&&(D=""+W.key),W)O.call(W,he)&&!P.hasOwnProperty(he)&&(de[he]=W[he]);var _=arguments.length-2;if(_===1)de.children=fe;else if(1<_){for(var Z=Array(_),re=0;re<_;re++)Z[re]=arguments[re+2];de.children=Z}if(V&&V.defaultProps)for(he in _=V.defaultProps,_)de[he]===void 0&&(de[he]=_[he]);return{$$typeof:t,type:V,key:D,ref:q,props:de,_owner:U.current}}function L(V,W){return{$$typeof:t,type:V.type,key:W,ref:V.ref,props:V.props,_owner:V._owner}}function Q(V){return typeof V=="object"&&V!==null&&V.$$typeof===t}function se(V){var W={"=":"=0",":":"=2"};return"$"+V.replace(/[=:]/g,function(fe){return W[fe]})}var $=/\/+/g;function ie(V,W){return typeof V=="object"&&V!==null&&V.key!=null?se(""+V.key):W.toString(36)}function oe(V,W,fe,he,de){var D=typeof V;(D==="undefined"||D==="boolean")&&(V=null);var q=!1;if(V===null)q=!0;else switch(D){case"string":case"number":q=!0;break;case"object":switch(V.$$typeof){case t:case e:q=!0}}if(q)return q=V,de=de(q),V=he===""?"."+ie(q,0):he,R(de)?(fe="",V!=null&&(fe=V.replace($,"$&/")+"/"),oe(de,W,fe,"",function(re){return re})):de!=null&&(Q(de)&&(de=L(de,fe+(!de.key||q&&q.key===de.key?"":(""+de.key).replace($,"$&/")+"/")+V)),W.push(de)),1;if(q=0,he=he===""?".":he+":",R(V))for(var _=0;_>>1,W=F[V];if(0>>1;Va(de,X))Da(q,de)?(F[V]=q,F[D]=X,V=D):(F[V]=de,F[he]=X,V=he);else if(Da(q,X))F[V]=q,F[D]=X,V=D;else break e}}return ge}function a(F,ge){var X=F.sortIndex-ge.sortIndex;return X!==0?X:F.id-ge.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,c=o.now();t.unstable_now=function(){return o.now()-c}}var u=[],h=[],f=1,m=null,g=3,b=!1,N=!1,j=!1,v=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(F){for(var ge=n(h);ge!==null;){if(ge.callback===null)r(h);else if(ge.startTime<=F)r(h),ge.sortIndex=ge.expirationTime,e(u,ge);else break;ge=n(h)}}function R(F){if(j=!1,C(F),!N)if(n(u)!==null)N=!0,I(O);else{var ge=n(h);ge!==null&&Y(R,ge.startTime-F)}}function O(F,ge){N=!1,j&&(j=!1,k(z),z=-1),b=!0;var X=g;try{for(C(ge),m=n(u);m!==null&&(!(m.expirationTime>ge)||F&&!se());){var V=m.callback;if(typeof V=="function"){m.callback=null,g=m.priorityLevel;var W=V(m.expirationTime<=ge);ge=t.unstable_now(),typeof W=="function"?m.callback=W:m===n(u)&&r(u),C(ge)}else r(u);m=n(u)}if(m!==null)var fe=!0;else{var he=n(h);he!==null&&Y(R,he.startTime-ge),fe=!1}return fe}finally{m=null,g=X,b=!1}}var U=!1,P=null,z=-1,L=5,Q=-1;function se(){return!(t.unstable_now()-QF||125V?(F.sortIndex=X,e(h,F),n(u)===null&&F===n(h)&&(j?(k(z),z=-1):j=!0,Y(R,X-V))):(F.sortIndex=W,e(u,F),N||b||(N=!0,I(O))),F},t.unstable_shouldYield=se,t.unstable_wrapCallback=function(F){var ge=g;return function(){var X=g;g=ge;try{return F.apply(this,arguments)}finally{g=X}}}})(Lg)),Lg}var x1;function QE(){return x1||(x1=1,Rg.exports=JE()),Rg.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 y1;function YE(){if(y1)return cr;y1=1;var t=Uu(),e=QE();function n(l){for(var d="https://reactjs.org/docs/error-decoder.html?invariant="+l,p=1;p"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,h=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},m={};function g(l){return u.call(m,l)?!0:u.call(f,l)?!1:h.test(l)?m[l]=!0:(f[l]=!0,!1)}function b(l,d,p,x){if(p!==null&&p.type===0)return!1;switch(typeof d){case"function":case"symbol":return!0;case"boolean":return x?!1:p!==null?!p.acceptsBooleans:(l=l.toLowerCase().slice(0,5),l!=="data-"&&l!=="aria-");default:return!1}}function N(l,d,p,x){if(d===null||typeof d>"u"||b(l,d,p,x))return!0;if(x)return!1;if(p!==null)switch(p.type){case 3:return!d;case 4:return d===!1;case 5:return isNaN(d);case 6:return isNaN(d)||1>d}return!1}function j(l,d,p,x,w,S,A){this.acceptsBooleans=d===2||d===3||d===4,this.attributeName=x,this.attributeNamespace=w,this.mustUseProperty=p,this.propertyName=l,this.type=d,this.sanitizeURL=S,this.removeEmptyString=A}var v={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){v[l]=new j(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var d=l[0];v[d]=new j(d,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){v[l]=new j(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){v[l]=new j(l,2,!1,l,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(l){v[l]=new j(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){v[l]=new j(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){v[l]=new j(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){v[l]=new j(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){v[l]=new j(l,5,!1,l.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function T(l){return l[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(l){var d=l.replace(k,T);v[d]=new j(d,1,!1,l,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(l){var d=l.replace(k,T);v[d]=new j(d,1,!1,l,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(l){var d=l.replace(k,T);v[d]=new j(d,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){v[l]=new j(l,1,!1,l.toLowerCase(),null,!1,!1)}),v.xlinkHref=new j("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){v[l]=new j(l,1,!1,l.toLowerCase(),null,!0,!0)});function C(l,d,p,x){var w=v.hasOwnProperty(d)?v[d]:null;(w!==null?w.type!==0:x||!(2K||w[A]!==S[K]){var ne=` +`+w[A].replace(" at new "," at ");return l.displayName&&ne.includes("")&&(ne=ne.replace("",l.displayName)),ne}while(1<=A&&0<=K);break}}}finally{fe=!1,Error.prepareStackTrace=p}return(l=l?l.displayName||l.name:"")?W(l):""}function de(l){switch(l.tag){case 5:return W(l.type);case 16:return W("Lazy");case 13:return W("Suspense");case 19:return W("SuspenseList");case 0:case 2:case 15:return l=he(l.type,!1),l;case 11:return l=he(l.type.render,!1),l;case 1:return l=he(l.type,!0),l;default:return""}}function D(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case P:return"Fragment";case U:return"Portal";case L:return"Profiler";case z:return"StrictMode";case ie:return"Suspense";case oe:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case se:return(l.displayName||"Context")+".Consumer";case Q:return(l._context.displayName||"Context")+".Provider";case $:var d=l.render;return l=l.displayName,l||(l=d.displayName||d.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case me:return d=l.displayName||null,d!==null?d:D(l.type)||"Memo";case I:d=l._payload,l=l._init;try{return D(l(d))}catch{}}return null}function q(l){var d=l.type;switch(l.tag){case 24:return"Cache";case 9:return(d.displayName||"Context")+".Consumer";case 10:return(d._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=d.render,l=l.displayName||l.name||"",d.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return d;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return D(d);case 8:return d===z?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d}return null}function _(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function Z(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function re(l){var d=Z(l)?"checked":"value",p=Object.getOwnPropertyDescriptor(l.constructor.prototype,d),x=""+l[d];if(!l.hasOwnProperty(d)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var w=p.get,S=p.set;return Object.defineProperty(l,d,{configurable:!0,get:function(){return w.call(this)},set:function(A){x=""+A,S.call(this,A)}}),Object.defineProperty(l,d,{enumerable:p.enumerable}),{getValue:function(){return x},setValue:function(A){x=""+A},stopTracking:function(){l._valueTracker=null,delete l[d]}}}}function we(l){l._valueTracker||(l._valueTracker=re(l))}function Fe(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var p=d.getValue(),x="";return l&&(x=Z(l)?l.checked?"true":"false":l.value),l=x,l!==p?(d.setValue(l),!0):!1}function Ue(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}function wt(l,d){var p=d.checked;return X({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??l._wrapperState.initialChecked})}function jn(l,d){var p=d.defaultValue==null?"":d.defaultValue,x=d.checked!=null?d.checked:d.defaultChecked;p=_(d.value!=null?d.value:p),l._wrapperState={initialChecked:x,initialValue:p,controlled:d.type==="checkbox"||d.type==="radio"?d.checked!=null:d.value!=null}}function pt(l,d){d=d.checked,d!=null&&C(l,"checked",d,!1)}function At(l,d){pt(l,d);var p=_(d.value),x=d.type;if(p!=null)x==="number"?(p===0&&l.value===""||l.value!=p)&&(l.value=""+p):l.value!==""+p&&(l.value=""+p);else if(x==="submit"||x==="reset"){l.removeAttribute("value");return}d.hasOwnProperty("value")?Vn(l,d.type,p):d.hasOwnProperty("defaultValue")&&Vn(l,d.type,_(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(l.defaultChecked=!!d.defaultChecked)}function fn(l,d,p){if(d.hasOwnProperty("value")||d.hasOwnProperty("defaultValue")){var x=d.type;if(!(x!=="submit"&&x!=="reset"||d.value!==void 0&&d.value!==null))return;d=""+l._wrapperState.initialValue,p||d===l.value||(l.value=d),l.defaultValue=d}p=l.name,p!==""&&(l.name=""),l.defaultChecked=!!l._wrapperState.initialChecked,p!==""&&(l.name=p)}function Vn(l,d,p){(d!=="number"||Ue(l.ownerDocument)!==l)&&(p==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+p&&(l.defaultValue=""+p))}var pn=Array.isArray;function Wt(l,d,p,x){if(l=l.options,d){d={};for(var w=0;w"+d.valueOf().toString()+"",d=Ne.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;d.firstChild;)l.appendChild(d.firstChild)}});function We(l,d){if(d){var p=l.firstChild;if(p&&p===l.lastChild&&p.nodeType===3){p.nodeValue=d;return}}l.textContent=d}var 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},Lt=["Webkit","ms","Moz","O"];Object.keys(rt).forEach(function(l){Lt.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 $e(l,d){l=l.style;for(var p in d)if(d.hasOwnProperty(p)){var x=p.indexOf("--")===0,w=kt(p,d[p],x);p==="float"&&(p="cssFloat"),x?l.setProperty(p,w):l[p]=w}}var H=X({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Qe(l,d){if(d){if(H[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 bt(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 Ft=null;function yt(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var ht=null,It=null,Kt=null;function kn(l){if(l=Fd(l)){if(typeof ht!="function")throw Error(n(280));var d=l.stateNode;d&&(d=ih(d),ht(l.stateNode,l.type,d))}}function Es(l){It?Kt?Kt.push(l):Kt=[l]:It=l}function Ts(){if(It){var l=It,d=Kt;if(Kt=It=null,kn(l),d)for(l=0;l>>=0,l===0?32:31-(el(l)/Wi|0)|0}var er=64,tr=4194304;function mr(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 ti(l,d){var p=l.pendingLanes;if(p===0)return 0;var x=0,w=l.suspendedLanes,S=l.pingedLanes,A=p&268435455;if(A!==0){var K=A&~w;K!==0?x=mr(K):(S&=A,S!==0&&(x=mr(S)))}else A=p&~w,A!==0?x=mr(A):S!==0&&(x=mr(S));if(x===0)return 0;if(d!==0&&d!==x&&(d&w)===0&&(w=x&-x,S=d&-d,w>=S||w===16&&(S&4194240)!==0))return d;if((x&4)!==0&&(x|=p&16),d=l.entangledLanes,d!==0)for(l=l.entanglements,d&=x;0p;p++)d.push(l);return d}function Ea(l,d,p){l.pendingLanes|=d,d!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,d=31-ys(d),l[d]=p}function nl(l,d){var p=l.pendingLanes&~d;l.pendingLanes=d,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=d,l.mutableReadLanes&=d,l.entangledLanes&=d,d=l.entanglements;var x=l.eventTimes;for(l=l.expirationTimes;0=Qi),Td=" ",Md=!1;function Ad(l,d){switch(l){case"keyup":return Sd.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Id(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var M=!1;function ee(l,d){switch(l){case"compositionend":return Id(d);case"keypress":return d.which!==32?null:(Md=!0,Td);case"textInput":return l=d.data,l===Td&&Md?null:l;default:return null}}function be(l,d){if(M)return l==="compositionend"||!Cd&&Ad(l,d)?(l=ra(),Lr=Gi=vr=null,M=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1=d)return{node:p,offset:d-l};l=x}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=mb(p)}}function xb(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?xb(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function yb(){for(var l=window,d=Ue();d instanceof l.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)l=d.contentWindow;else break;d=Ue(l.document)}return d}function fm(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 X4(l){var d=yb(),p=l.focusedElem,x=l.selectionRange;if(d!==p&&p&&p.ownerDocument&&xb(p.ownerDocument.documentElement,p)){if(x!==null&&fm(p)){if(d=x.start,l=x.end,l===void 0&&(l=d),"selectionStart"in p)p.selectionStart=d,p.selectionEnd=Math.min(l,p.value.length);else if(l=(d=p.ownerDocument||document)&&d.defaultView||window,l.getSelection){l=l.getSelection();var w=p.textContent.length,S=Math.min(x.start,w);x=x.end===void 0?S:Math.min(x.end,w),!l.extend&&S>x&&(w=x,x=S,S=w),w=gb(p,S);var A=gb(p,x);w&&A&&(l.rangeCount!==1||l.anchorNode!==w.node||l.anchorOffset!==w.offset||l.focusNode!==A.node||l.focusOffset!==A.offset)&&(d=d.createRange(),d.setStart(w.node,w.offset),l.removeAllRanges(),S>x?(l.addRange(d),l.extend(A.node,A.offset)):(d.setEnd(A.node,A.offset),l.addRange(d)))}}for(d=[],l=p;l=l.parentNode;)l.nodeType===1&&d.push({element:l,left:l.scrollLeft,top:l.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p=document.documentMode,mc=null,pm=null,Od=null,mm=!1;function bb(l,d,p){var x=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;mm||mc==null||mc!==Ue(x)||(x=mc,"selectionStart"in x&&fm(x)?x={start:x.selectionStart,end:x.selectionEnd}:(x=(x.ownerDocument&&x.ownerDocument.defaultView||window).getSelection(),x={anchorNode:x.anchorNode,anchorOffset:x.anchorOffset,focusNode:x.focusNode,focusOffset:x.focusOffset}),Od&&Ld(Od,x)||(Od=x,x=sh(pm,"onSelect"),0vc||(l.current=Em[vc],Em[vc]=null,vc--)}function cn(l,d){vc++,Em[vc]=l.current,l.current=d}var to={},Ps=eo(to),rr=eo(!1),hl=to;function Nc(l,d){var p=l.type.contextTypes;if(!p)return to;var x=l.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===d)return x.__reactInternalMemoizedMaskedChildContext;var w={},S;for(S in p)w[S]=d[S];return x&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=d,l.__reactInternalMemoizedMaskedChildContext=w),w}function ar(l){return l=l.childContextTypes,l!=null}function oh(){xn(rr),xn(Ps)}function Lb(l,d,p){if(Ps.current!==to)throw Error(n(168));cn(Ps,d),cn(rr,p)}function Ob(l,d,p){var x=l.stateNode;if(d=d.childContextTypes,typeof x.getChildContext!="function")return p;x=x.getChildContext();for(var w in x)if(!(w in d))throw Error(n(108,q(l)||"Unknown",w));return X({},p,x)}function lh(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||to,hl=Ps.current,cn(Ps,l),cn(rr,rr.current),!0}function Db(l,d,p){var x=l.stateNode;if(!x)throw Error(n(169));p?(l=Ob(l,d,hl),x.__reactInternalMemoizedMergedChildContext=l,xn(rr),xn(Ps),cn(Ps,l)):xn(rr),cn(rr,p)}var hi=null,ch=!1,Tm=!1;function _b(l){hi===null?hi=[l]:hi.push(l)}function dE(l){ch=!0,_b(l)}function no(){if(!Tm&&hi!==null){Tm=!0;var l=0,d=vt;try{var p=hi;for(vt=1;l>=A,w-=A,fi=1<<32-ys(d)+w|p<mt?(ds=ct,ct=null):ds=ct.sibling;var Ht=Ee(pe,ct,xe[mt],Le);if(Ht===null){ct===null&&(ct=ds);break}l&&ct&&Ht.alternate===null&&d(pe,ct),ae=S(Ht,ae,mt),lt===null?nt=Ht:lt.sibling=Ht,lt=Ht,ct=ds}if(mt===xe.length)return p(pe,ct),Nn&&pl(pe,mt),nt;if(ct===null){for(;mtmt?(ds=ct,ct=null):ds=ct.sibling;var ho=Ee(pe,ct,Ht.value,Le);if(ho===null){ct===null&&(ct=ds);break}l&&ct&&ho.alternate===null&&d(pe,ct),ae=S(ho,ae,mt),lt===null?nt=ho:lt.sibling=ho,lt=ho,ct=ds}if(Ht.done)return p(pe,ct),Nn&&pl(pe,mt),nt;if(ct===null){for(;!Ht.done;mt++,Ht=xe.next())Ht=Pe(pe,Ht.value,Le),Ht!==null&&(ae=S(Ht,ae,mt),lt===null?nt=Ht:lt.sibling=Ht,lt=Ht);return Nn&&pl(pe,mt),nt}for(ct=x(pe,ct);!Ht.done;mt++,Ht=xe.next())Ht=qe(ct,pe,mt,Ht.value,Le),Ht!==null&&(l&&Ht.alternate!==null&&ct.delete(Ht.key===null?mt:Ht.key),ae=S(Ht,ae,mt),lt===null?nt=Ht:lt.sibling=Ht,lt=Ht);return l&&ct.forEach(function(UE){return d(pe,UE)}),Nn&&pl(pe,mt),nt}function $n(pe,ae,xe,Le){if(typeof xe=="object"&&xe!==null&&xe.type===P&&xe.key===null&&(xe=xe.props.children),typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case O:e:{for(var nt=xe.key,lt=ae;lt!==null;){if(lt.key===nt){if(nt=xe.type,nt===P){if(lt.tag===7){p(pe,lt.sibling),ae=w(lt,xe.props.children),ae.return=pe,pe=ae;break e}}else if(lt.elementType===nt||typeof nt=="object"&&nt!==null&&nt.$$typeof===I&&Hb(nt)===lt.type){p(pe,lt.sibling),ae=w(lt,xe.props),ae.ref=Bd(pe,lt,xe),ae.return=pe,pe=ae;break e}p(pe,lt);break}else d(pe,lt);lt=lt.sibling}xe.type===P?(ae=wl(xe.props.children,pe.mode,Le,xe.key),ae.return=pe,pe=ae):(Le=_h(xe.type,xe.key,xe.props,null,pe.mode,Le),Le.ref=Bd(pe,ae,xe),Le.return=pe,pe=Le)}return A(pe);case U:e:{for(lt=xe.key;ae!==null;){if(ae.key===lt)if(ae.tag===4&&ae.stateNode.containerInfo===xe.containerInfo&&ae.stateNode.implementation===xe.implementation){p(pe,ae.sibling),ae=w(ae,xe.children||[]),ae.return=pe,pe=ae;break e}else{p(pe,ae);break}else d(pe,ae);ae=ae.sibling}ae=Sg(xe,pe.mode,Le),ae.return=pe,pe=ae}return A(pe);case I:return lt=xe._init,$n(pe,ae,lt(xe._payload),Le)}if(pn(xe))return Xe(pe,ae,xe,Le);if(ge(xe))return tt(pe,ae,xe,Le);fh(pe,xe)}return typeof xe=="string"&&xe!==""||typeof xe=="number"?(xe=""+xe,ae!==null&&ae.tag===6?(p(pe,ae.sibling),ae=w(ae,xe),ae.return=pe,pe=ae):(p(pe,ae),ae=kg(xe,pe.mode,Le),ae.return=pe,pe=ae),A(pe)):p(pe,ae)}return $n}var Sc=Ub(!0),Wb=Ub(!1),ph=eo(null),mh=null,Cc=null,Lm=null;function Om(){Lm=Cc=mh=null}function Dm(l){var d=ph.current;xn(ph),l._currentValue=d}function _m(l,d,p){for(;l!==null;){var x=l.alternate;if((l.childLanes&d)!==d?(l.childLanes|=d,x!==null&&(x.childLanes|=d)):x!==null&&(x.childLanes&d)!==d&&(x.childLanes|=d),l===p)break;l=l.return}}function Ec(l,d){mh=l,Lm=Cc=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(ir=!0),l.firstContext=null)}function zr(l){var d=l._currentValue;if(Lm!==l)if(l={context:l,memoizedValue:d,next:null},Cc===null){if(mh===null)throw Error(n(308));Cc=l,mh.dependencies={lanes:0,firstContext:l}}else Cc=Cc.next=l;return d}var ml=null;function $m(l){ml===null?ml=[l]:ml.push(l)}function Kb(l,d,p,x){var w=d.interleaved;return w===null?(p.next=p,$m(d)):(p.next=w.next,w.next=p),d.interleaved=p,mi(l,x)}function mi(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 so=!1;function zm(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function qb(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 gi(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function ro(l,d,p){var x=l.updateQueue;if(x===null)return null;if(x=x.shared,(Bt&2)!==0){var w=x.pending;return w===null?d.next=d:(d.next=w.next,w.next=d),x.pending=d,mi(l,p)}return w=x.interleaved,w===null?(d.next=d,$m(x)):(d.next=w.next,w.next=d),x.interleaved=d,mi(l,p)}function gh(l,d,p){if(d=d.updateQueue,d!==null&&(d=d.shared,(p&4194240)!==0)){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,Ta(l,p)}}function Gb(l,d){var p=l.updateQueue,x=l.alternate;if(x!==null&&(x=x.updateQueue,p===x)){var w=null,S=null;if(p=p.firstBaseUpdate,p!==null){do{var A={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};S===null?w=S=A:S=S.next=A,p=p.next}while(p!==null);S===null?w=S=d:S=S.next=d}else w=S=d;p={baseState:x.baseState,firstBaseUpdate:w,lastBaseUpdate:S,shared:x.shared,effects:x.effects},l.updateQueue=p;return}l=p.lastBaseUpdate,l===null?p.firstBaseUpdate=d:l.next=d,p.lastBaseUpdate=d}function xh(l,d,p,x){var w=l.updateQueue;so=!1;var S=w.firstBaseUpdate,A=w.lastBaseUpdate,K=w.shared.pending;if(K!==null){w.shared.pending=null;var ne=K,ye=ne.next;ne.next=null,A===null?S=ye:A.next=ye,A=ne;var Ie=l.alternate;Ie!==null&&(Ie=Ie.updateQueue,K=Ie.lastBaseUpdate,K!==A&&(K===null?Ie.firstBaseUpdate=ye:K.next=ye,Ie.lastBaseUpdate=ne))}if(S!==null){var Pe=w.baseState;A=0,Ie=ye=ne=null,K=S;do{var Ee=K.lane,qe=K.eventTime;if((x&Ee)===Ee){Ie!==null&&(Ie=Ie.next={eventTime:qe,lane:0,tag:K.tag,payload:K.payload,callback:K.callback,next:null});e:{var Xe=l,tt=K;switch(Ee=d,qe=p,tt.tag){case 1:if(Xe=tt.payload,typeof Xe=="function"){Pe=Xe.call(qe,Pe,Ee);break e}Pe=Xe;break e;case 3:Xe.flags=Xe.flags&-65537|128;case 0:if(Xe=tt.payload,Ee=typeof Xe=="function"?Xe.call(qe,Pe,Ee):Xe,Ee==null)break e;Pe=X({},Pe,Ee);break e;case 2:so=!0}}K.callback!==null&&K.lane!==0&&(l.flags|=64,Ee=w.effects,Ee===null?w.effects=[K]:Ee.push(K))}else qe={eventTime:qe,lane:Ee,tag:K.tag,payload:K.payload,callback:K.callback,next:null},Ie===null?(ye=Ie=qe,ne=Pe):Ie=Ie.next=qe,A|=Ee;if(K=K.next,K===null){if(K=w.shared.pending,K===null)break;Ee=K,K=Ee.next,Ee.next=null,w.lastBaseUpdate=Ee,w.shared.pending=null}}while(!0);if(Ie===null&&(ne=Pe),w.baseState=ne,w.firstBaseUpdate=ye,w.lastBaseUpdate=Ie,d=w.shared.interleaved,d!==null){w=d;do A|=w.lane,w=w.next;while(w!==d)}else S===null&&(w.shared.lanes=0);yl|=A,l.lanes=A,l.memoizedState=Pe}}function Jb(l,d,p){if(l=d.effects,d.effects=null,l!==null)for(d=0;dp?p:4,l(!0);var x=Um.transition;Um.transition={};try{l(!1),d()}finally{vt=p,Um.transition=x}}function pv(){return Fr().memoizedState}function pE(l,d,p){var x=lo(l);if(p={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null},mv(l))gv(d,p);else if(p=Kb(l,d,p,x),p!==null){var w=Ws();ha(p,l,x,w),xv(p,d,x)}}function mE(l,d,p){var x=lo(l),w={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null};if(mv(l))gv(d,w);else{var S=l.alternate;if(l.lanes===0&&(S===null||S.lanes===0)&&(S=d.lastRenderedReducer,S!==null))try{var A=d.lastRenderedState,K=S(A,p);if(w.hasEagerState=!0,w.eagerState=K,oa(K,A)){var ne=d.interleaved;ne===null?(w.next=w,$m(d)):(w.next=ne.next,ne.next=w),d.interleaved=w;return}}catch{}finally{}p=Kb(l,d,w,x),p!==null&&(w=Ws(),ha(p,l,x,w),xv(p,d,x))}}function mv(l){var d=l.alternate;return l===En||d!==null&&d===En}function gv(l,d){Wd=vh=!0;var p=l.pending;p===null?d.next=d:(d.next=p.next,p.next=d),l.pending=d}function xv(l,d,p){if((p&4194240)!==0){var x=d.lanes;x&=l.pendingLanes,p|=x,d.lanes=p,Ta(l,p)}}var jh={readContext:zr,useCallback:Rs,useContext:Rs,useEffect:Rs,useImperativeHandle:Rs,useInsertionEffect:Rs,useLayoutEffect:Rs,useMemo:Rs,useReducer:Rs,useRef:Rs,useState:Rs,useDebugValue:Rs,useDeferredValue:Rs,useTransition:Rs,useMutableSource:Rs,useSyncExternalStore:Rs,useId:Rs,unstable_isNewReconciler:!1},gE={readContext:zr,useCallback:function(l,d){return _a().memoizedState=[l,d===void 0?null:d],l},useContext:zr,useEffect:iv,useImperativeHandle:function(l,d,p){return p=p!=null?p.concat([l]):null,Nh(4194308,4,cv.bind(null,d,l),p)},useLayoutEffect:function(l,d){return Nh(4194308,4,l,d)},useInsertionEffect:function(l,d){return Nh(4,2,l,d)},useMemo:function(l,d){var p=_a();return d=d===void 0?null:d,l=l(),p.memoizedState=[l,d],l},useReducer:function(l,d,p){var x=_a();return d=p!==void 0?p(d):d,x.memoizedState=x.baseState=d,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:d},x.queue=l,l=l.dispatch=pE.bind(null,En,l),[x.memoizedState,l]},useRef:function(l){var d=_a();return l={current:l},d.memoizedState=l},useState:rv,useDebugValue:Ym,useDeferredValue:function(l){return _a().memoizedState=l},useTransition:function(){var l=rv(!1),d=l[0];return l=fE.bind(null,l[1]),_a().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,p){var x=En,w=_a();if(Nn){if(p===void 0)throw Error(n(407));p=p()}else{if(p=d(),cs===null)throw Error(n(349));(xl&30)!==0||Zb(x,d,p)}w.memoizedState=p;var S={value:p,getSnapshot:d};return w.queue=S,iv(tv.bind(null,x,S,l),[l]),x.flags|=2048,Gd(9,ev.bind(null,x,S,p,d),void 0,null),p},useId:function(){var l=_a(),d=cs.identifierPrefix;if(Nn){var p=pi,x=fi;p=(x&~(1<<32-ys(x)-1)).toString(32)+p,d=":"+d+"R"+p,p=Kd++,0<\/script>",l=l.removeChild(l.firstChild)):typeof x.is=="string"?l=A.createElement(p,{is:x.is}):(l=A.createElement(p),p==="select"&&(A=l,x.multiple?A.multiple=!0:x.size&&(A.size=x.size))):l=A.createElementNS(l,p),l[Oa]=d,l[zd]=x,_v(l,d,!1,!1),d.stateNode=l;e:{switch(A=bt(p,x),p){case"dialog":gn("cancel",l),gn("close",l),w=x;break;case"iframe":case"object":case"embed":gn("load",l),w=x;break;case"video":case"audio":for(w=0;wPc&&(d.flags|=128,x=!0,Jd(S,!1),d.lanes=4194304)}else{if(!x)if(l=yh(A),l!==null){if(d.flags|=128,x=!0,p=l.updateQueue,p!==null&&(d.updateQueue=p,d.flags|=4),Jd(S,!0),S.tail===null&&S.tailMode==="hidden"&&!A.alternate&&!Nn)return Ls(d),null}else 2*mn()-S.renderingStartTime>Pc&&p!==1073741824&&(d.flags|=128,x=!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=mn(),d.sibling=null,p=Cn.current,cn(Cn,x?p&1|2:p&1),d):(Ls(d),null);case 22:case 23:return Ng(),x=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==x&&(d.flags|=8192),x&&(d.mode&1)!==0?(jr&1073741824)!==0&&(Ls(d),d.subtreeFlags&6&&(d.flags|=8192)):Ls(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function kE(l,d){switch(Am(d),d.tag){case 1:return ar(d.type)&&oh(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return Tc(),xn(rr),xn(Ps),Hm(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return Bm(d),null;case 13:if(xn(Cn),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));kc()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return xn(Cn),null;case 4:return Tc(),null;case 10:return Dm(d.type._context),null;case 22:case 23:return Ng(),null;case 24:return null;default:return null}}var Eh=!1,Os=!1,SE=typeof WeakSet=="function"?WeakSet:Set,Ye=null;function Ac(l,d){var p=l.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(x){An(l,d,x)}else p.current=null}function cg(l,d,p){try{p()}catch(x){An(l,d,x)}}var Fv=!1;function CE(l,d){if(Nm=Rr,l=yb(),fm(l)){if("selectionStart"in l)var p={start:l.selectionStart,end:l.selectionEnd};else e:{p=(p=l.ownerDocument)&&p.defaultView||window;var x=p.getSelection&&p.getSelection();if(x&&x.rangeCount!==0){p=x.anchorNode;var w=x.anchorOffset,S=x.focusNode;x=x.focusOffset;try{p.nodeType,S.nodeType}catch{p=null;break e}var A=0,K=-1,ne=-1,ye=0,Ie=0,Pe=l,Ee=null;t:for(;;){for(var qe;Pe!==p||w!==0&&Pe.nodeType!==3||(K=A+w),Pe!==S||x!==0&&Pe.nodeType!==3||(ne=A+x),Pe.nodeType===3&&(A+=Pe.nodeValue.length),(qe=Pe.firstChild)!==null;)Ee=Pe,Pe=qe;for(;;){if(Pe===l)break t;if(Ee===p&&++ye===w&&(K=A),Ee===S&&++Ie===x&&(ne=A),(qe=Pe.nextSibling)!==null)break;Pe=Ee,Ee=Pe.parentNode}Pe=qe}p=K===-1||ne===-1?null:{start:K,end:ne}}else p=null}p=p||{start:0,end:0}}else p=null;for(wm={focusedElem:l,selectionRange:p},Rr=!1,Ye=d;Ye!==null;)if(d=Ye,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,Ye=l;else for(;Ye!==null;){d=Ye;try{var Xe=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(Xe!==null){var tt=Xe.memoizedProps,$n=Xe.memoizedState,pe=d.stateNode,ae=pe.getSnapshotBeforeUpdate(d.elementType===d.type?tt:ca(d.type,tt),$n);pe.__reactInternalSnapshotBeforeUpdate=ae}break;case 3:var xe=d.stateNode.containerInfo;xe.nodeType===1?xe.textContent="":xe.nodeType===9&&xe.documentElement&&xe.removeChild(xe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Le){An(d,d.return,Le)}if(l=d.sibling,l!==null){l.return=d.return,Ye=l;break}Ye=d.return}return Xe=Fv,Fv=!1,Xe}function Qd(l,d,p){var x=d.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var w=x=x.next;do{if((w.tag&l)===l){var S=w.destroy;w.destroy=void 0,S!==void 0&&cg(d,p,S)}w=w.next}while(w!==x)}}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 x=p.create;p.destroy=x()}p=p.next}while(p!==d)}}function dg(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 Bv(l){var d=l.alternate;d!==null&&(l.alternate=null,Bv(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[Oa],delete d[zd],delete d[Cm],delete d[lE],delete d[cE])),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 Vv(l){return l.tag===5||l.tag===3||l.tag===4}function Hv(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||Vv(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 ug(l,d,p){var x=l.tag;if(x===5||x===6)l=l.stateNode,d?p.nodeType===8?p.parentNode.insertBefore(l,d):p.insertBefore(l,d):(p.nodeType===8?(d=p.parentNode,d.insertBefore(l,p)):(d=p,d.appendChild(l)),p=p._reactRootContainer,p!=null||d.onclick!==null||(d.onclick=ah));else if(x!==4&&(l=l.child,l!==null))for(ug(l,d,p),l=l.sibling;l!==null;)ug(l,d,p),l=l.sibling}function hg(l,d,p){var x=l.tag;if(x===5||x===6)l=l.stateNode,d?p.insertBefore(l,d):p.appendChild(l);else if(x!==4&&(l=l.child,l!==null))for(hg(l,d,p),l=l.sibling;l!==null;)hg(l,d,p),l=l.sibling}var Ns=null,da=!1;function ao(l,d,p){for(p=p.child;p!==null;)Uv(l,d,p),p=p.sibling}function Uv(l,d,p){if(Zs&&typeof Zs.onCommitFiberUnmount=="function")try{Zs.onCommitFiberUnmount(Xs,p)}catch{}switch(p.tag){case 5:Os||Ac(p,d);case 6:var x=Ns,w=da;Ns=null,ao(l,d,p),Ns=x,da=w,Ns!==null&&(da?(l=Ns,p=p.stateNode,l.nodeType===8?l.parentNode.removeChild(p):l.removeChild(p)):Ns.removeChild(p.stateNode));break;case 18:Ns!==null&&(da?(l=Ns,p=p.stateNode,l.nodeType===8?Sm(l.parentNode,p):l.nodeType===1&&Sm(l,p),Pa(l)):Sm(Ns,p.stateNode));break;case 4:x=Ns,w=da,Ns=p.stateNode.containerInfo,da=!0,ao(l,d,p),Ns=x,da=w;break;case 0:case 11:case 14:case 15:if(!Os&&(x=p.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){w=x=x.next;do{var S=w,A=S.destroy;S=S.tag,A!==void 0&&((S&2)!==0||(S&4)!==0)&&cg(p,d,A),w=w.next}while(w!==x)}ao(l,d,p);break;case 1:if(!Os&&(Ac(p,d),x=p.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=p.memoizedProps,x.state=p.memoizedState,x.componentWillUnmount()}catch(K){An(p,d,K)}ao(l,d,p);break;case 21:ao(l,d,p);break;case 22:p.mode&1?(Os=(x=Os)||p.memoizedState!==null,ao(l,d,p),Os=x):ao(l,d,p);break;default:ao(l,d,p)}}function Wv(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var p=l.stateNode;p===null&&(p=l.stateNode=new SE),d.forEach(function(x){var w=OE.bind(null,l,x);p.has(x)||(p.add(x),x.then(w,w))})}}function ua(l,d){var p=d.deletions;if(p!==null)for(var x=0;xw&&(w=A),x&=~S}if(x=w,x=mn()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*TE(x/1960))-x,10l?16:l,oo===null)var x=!1;else{if(l=oo,oo=null,Rh=0,(Bt&6)!==0)throw Error(n(331));var w=Bt;for(Bt|=4,Ye=l.current;Ye!==null;){var S=Ye,A=S.child;if((Ye.flags&16)!==0){var K=S.deletions;if(K!==null){for(var ne=0;nemn()-mg?vl(l,0):pg|=p),lr(l,d)}function r1(l,d){d===0&&((l.mode&1)===0?d=1:(d=tr,tr<<=1,(tr&130023424)===0&&(tr=4194304)));var p=Ws();l=mi(l,d),l!==null&&(Ea(l,d,p),lr(l,p))}function LE(l){var d=l.memoizedState,p=0;d!==null&&(p=d.retryLane),r1(l,p)}function OE(l,d){var p=0;switch(l.tag){case 13:var x=l.stateNode,w=l.memoizedState;w!==null&&(p=w.retryLane);break;case 19:x=l.stateNode;break;default:throw Error(n(314))}x!==null&&x.delete(d),r1(l,p)}var a1;a1=function(l,d,p){if(l!==null)if(l.memoizedProps!==d.pendingProps||rr.current)ir=!0;else{if((l.lanes&p)===0&&(d.flags&128)===0)return ir=!1,wE(l,d,p);ir=(l.flags&131072)!==0}else ir=!1,Nn&&(d.flags&1048576)!==0&&$b(d,uh,d.index);switch(d.lanes=0,d.tag){case 2:var x=d.type;Ch(l,d),l=d.pendingProps;var w=Nc(d,Ps.current);Ec(d,p),w=Km(null,d,x,l,w,p);var S=qm();return d.flags|=1,typeof w=="object"&&w!==null&&typeof w.render=="function"&&w.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,ar(x)?(S=!0,lh(d)):S=!1,d.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,zm(d),w.updater=kh,d.stateNode=w,w._reactInternals=d,Zm(d,x,l,p),d=sg(null,d,x,!0,S,p)):(d.tag=0,Nn&&S&&Mm(d),Us(null,d,w,p),d=d.child),d;case 16:x=d.elementType;e:{switch(Ch(l,d),l=d.pendingProps,w=x._init,x=w(x._payload),d.type=x,w=d.tag=_E(x),l=ca(x,l),w){case 0:d=ng(null,d,x,l,p);break e;case 1:d=Iv(null,d,x,l,p);break e;case 11:d=Cv(null,d,x,l,p);break e;case 14:d=Ev(null,d,x,ca(x.type,l),p);break e}throw Error(n(306,x,""))}return d;case 0:return x=d.type,w=d.pendingProps,w=d.elementType===x?w:ca(x,w),ng(l,d,x,w,p);case 1:return x=d.type,w=d.pendingProps,w=d.elementType===x?w:ca(x,w),Iv(l,d,x,w,p);case 3:e:{if(Pv(d),l===null)throw Error(n(387));x=d.pendingProps,S=d.memoizedState,w=S.element,qb(l,d),xh(d,x,null,p);var A=d.memoizedState;if(x=A.element,S.isDehydrated)if(S={element:x,isDehydrated:!1,cache:A.cache,pendingSuspenseBoundaries:A.pendingSuspenseBoundaries,transitions:A.transitions},d.updateQueue.baseState=S,d.memoizedState=S,d.flags&256){w=Mc(Error(n(423)),d),d=Rv(l,d,x,p,w);break e}else if(x!==w){w=Mc(Error(n(424)),d),d=Rv(l,d,x,p,w);break e}else for(wr=Zi(d.stateNode.containerInfo.firstChild),Nr=d,Nn=!0,la=null,p=Wb(d,null,x,p),d.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(kc(),x===w){d=xi(l,d,p);break e}Us(l,d,x,p)}d=d.child}return d;case 5:return Qb(d),l===null&&Pm(d),x=d.type,w=d.pendingProps,S=l!==null?l.memoizedProps:null,A=w.children,jm(x,w)?A=null:S!==null&&jm(x,S)&&(d.flags|=32),Av(l,d),Us(l,d,A,p),d.child;case 6:return l===null&&Pm(d),null;case 13:return Lv(l,d,p);case 4:return Fm(d,d.stateNode.containerInfo),x=d.pendingProps,l===null?d.child=Sc(d,null,x,p):Us(l,d,x,p),d.child;case 11:return x=d.type,w=d.pendingProps,w=d.elementType===x?w:ca(x,w),Cv(l,d,x,w,p);case 7:return Us(l,d,d.pendingProps,p),d.child;case 8:return Us(l,d,d.pendingProps.children,p),d.child;case 12:return Us(l,d,d.pendingProps.children,p),d.child;case 10:e:{if(x=d.type._context,w=d.pendingProps,S=d.memoizedProps,A=w.value,cn(ph,x._currentValue),x._currentValue=A,S!==null)if(oa(S.value,A)){if(S.children===w.children&&!rr.current){d=xi(l,d,p);break e}}else for(S=d.child,S!==null&&(S.return=d);S!==null;){var K=S.dependencies;if(K!==null){A=S.child;for(var ne=K.firstContext;ne!==null;){if(ne.context===x){if(S.tag===1){ne=gi(-1,p&-p),ne.tag=2;var ye=S.updateQueue;if(ye!==null){ye=ye.shared;var Ie=ye.pending;Ie===null?ne.next=ne:(ne.next=Ie.next,Ie.next=ne),ye.pending=ne}}S.lanes|=p,ne=S.alternate,ne!==null&&(ne.lanes|=p),_m(S.return,p,d),K.lanes|=p;break}ne=ne.next}}else if(S.tag===10)A=S.type===d.type?null:S.child;else if(S.tag===18){if(A=S.return,A===null)throw Error(n(341));A.lanes|=p,K=A.alternate,K!==null&&(K.lanes|=p),_m(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}Us(l,d,w.children,p),d=d.child}return d;case 9:return w=d.type,x=d.pendingProps.children,Ec(d,p),w=zr(w),x=x(w),d.flags|=1,Us(l,d,x,p),d.child;case 14:return x=d.type,w=ca(x,d.pendingProps),w=ca(x.type,w),Ev(l,d,x,w,p);case 15:return Tv(l,d,d.type,d.pendingProps,p);case 17:return x=d.type,w=d.pendingProps,w=d.elementType===x?w:ca(x,w),Ch(l,d),d.tag=1,ar(x)?(l=!0,lh(d)):l=!1,Ec(d,p),bv(d,x,w),Zm(d,x,w,p),sg(null,d,x,!0,l,p);case 19:return Dv(l,d,p);case 22:return Mv(l,d,p)}throw Error(n(156,d.tag))};function i1(l,d){return Tt(l,d)}function DE(l,d,p,x){this.tag=l,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Vr(l,d,p,x){return new DE(l,d,p,x)}function jg(l){return l=l.prototype,!(!l||!l.isReactComponent)}function _E(l){if(typeof l=="function")return jg(l)?1:0;if(l!=null){if(l=l.$$typeof,l===$)return 11;if(l===me)return 14}return 2}function uo(l,d){var p=l.alternate;return p===null?(p=Vr(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 _h(l,d,p,x,w,S){var A=2;if(x=l,typeof l=="function")jg(l)&&(A=1);else if(typeof l=="string")A=5;else e:switch(l){case P:return wl(p.children,w,S,d);case z:A=8,w|=8;break;case L:return l=Vr(12,p,d,w|2),l.elementType=L,l.lanes=S,l;case ie:return l=Vr(13,p,d,w),l.elementType=ie,l.lanes=S,l;case oe:return l=Vr(19,p,d,w),l.elementType=oe,l.lanes=S,l;case Y:return $h(p,w,S,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case Q:A=10;break e;case se:A=9;break e;case $:A=11;break e;case me:A=14;break e;case I:A=16,x=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=Vr(A,p,d,w),d.elementType=l,d.type=x,d.lanes=S,d}function wl(l,d,p,x){return l=Vr(7,l,x,d),l.lanes=p,l}function $h(l,d,p,x){return l=Vr(22,l,x,d),l.elementType=Y,l.lanes=p,l.stateNode={isHidden:!1},l}function kg(l,d,p){return l=Vr(6,l,null,d),l.lanes=p,l}function Sg(l,d,p){return d=Vr(4,l.children!==null?l.children:[],l.key,d),d.lanes=p,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function $E(l,d,p,x,w){this.tag=d,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ki(0),this.expirationTimes=Ki(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ki(0),this.identifierPrefix=x,this.onRecoverableError=w,this.mutableSourceEagerHydrationData=null}function Cg(l,d,p,x,w,S,A,K,ne){return l=new $E(l,d,p,K,ne),d===1?(d=1,S===!0&&(d|=8)):d=0,S=Vr(3,null,null,d),l.current=S,S.stateNode=l,S.memoizedState={element:x,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},zm(S),l}function zE(l,d,p){var x=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Pg.exports=YE(),Pg.exports}var v1;function XE(){if(v1)return Wh;v1=1;var t=_j();return Wh.createRoot=t.createRoot,Wh.hydrateRoot=t.hydrateRoot,Wh}var ZE=XE(),hd=_j();const $j=Dj(hd);/** + * @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 K0(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function tT(){return Math.random().toString(36).substr(2,8)}function w1(t,e){return{usr:t.state,key:t.key,idx:e}}function Lx(t,e,n,r){return n===void 0&&(n=null),Tu({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?fd(e):e,{state:n,key:e&&e.key||r||tT()})}function If(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 fd(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 nT(t,e,n,r){r===void 0&&(r={});let{window:a=document.defaultView,v5Compat:i=!1}=r,o=a.history,c=Co.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=Co.Pop;let v=f(),k=v==null?null:v-h;h=v,u&&u({action:c,location:j.location,delta:k})}function g(v,k){c=Co.Push;let T=Lx(j.location,v,k);h=f()+1;let C=w1(T,h),R=j.createHref(T);try{o.pushState(C,"",R)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;a.location.assign(R)}i&&u&&u({action:c,location:j.location,delta:1})}function b(v,k){c=Co.Replace;let T=Lx(j.location,v,k);h=f();let C=w1(T,h),R=j.createHref(T);o.replaceState(C,"",R),i&&u&&u({action:c,location:j.location,delta:0})}function N(v){let k=a.location.origin!=="null"?a.location.origin:a.location.href,T=typeof v=="string"?v:If(v);return T=T.replace(/ $/,"%20"),Fn(k,"No window.location.(origin|href) available to create URL for href: "+T),new URL(T,k)}let j={get action(){return c},get location(){return t(a,o)},listen(v){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(N1,m),u=v,()=>{a.removeEventListener(N1,m),u=null}},createHref(v){return e(a,v)},createURL:N,encodeLocation(v){let k=N(v);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:g,replace:b,go(v){return o.go(v)}};return j}var j1;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(j1||(j1={}));function sT(t,e,n){return n===void 0&&(n="/"),rT(t,e,n)}function rT(t,e,n,r){let a=typeof e=="string"?fd(e):e,i=q0(a.pathname||"/",n);if(i==null)return null;let o=zj(t);aT(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("/")&&(Fn(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&&(Fn(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+h+'".')),zj(i.children,e,f,h)),!(i.path==null&&!i.index)&&e.push({path:h,score:hT(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 Fj(i.path))a(i,o,u)}),e}function Fj(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=Fj(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 aT(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:fT(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const iT=/^:[\w-]+$/,oT=3,lT=2,cT=1,dT=10,uT=-2,k1=t=>t==="*";function hT(t,e){let n=t.split("/"),r=n.length;return n.some(k1)&&(r+=uT),e&&(r+=lT),n.filter(a=>!k1(a)).reduce((a,i)=>a+(iT.test(i)?oT:i===""?cT:dT),r)}function fT(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 pT(t,e,n){let{routesMeta:r}=t,a={},i="/",o=[];for(let c=0;c{let{paramName:g,isOptional:b}=f;if(g==="*"){let j=c[m]||"";o=i.slice(0,i.length-j.length).replace(/(.)\/+$/,"$1")}const N=c[m];return b&&!N?h[g]=void 0:h[g]=(N||"").replace(/%2F/g,"/"),h},{}),pathname:i,pathnameBase:o,pattern:t}}function gT(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),K0(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 xT(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return K0(!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 q0(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 yT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,bT=t=>yT.test(t);function vT(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:a=""}=typeof t=="string"?fd(t):t,i;if(n)if(bT(n))i=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),K0(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=S1(n.substring(1),"/"):i=S1(n,e)}else i=e;return{pathname:i,search:jT(r),hash:kT(a)}}function S1(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 Og(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 NT(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function G0(t,e){let n=NT(t);return e?n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function J0(t,e,n,r){r===void 0&&(r=!1);let a;typeof t=="string"?a=fd(t):(a=Tu({},t),Fn(!a.pathname||!a.pathname.includes("?"),Og("?","pathname","search",a)),Fn(!a.pathname||!a.pathname.includes("#"),Og("#","pathname","hash",a)),Fn(!a.search||!a.search.includes("#"),Og("#","search","hash",a)));let i=t===""||a.pathname==="",o=i?"/":a.pathname,c;if(o==null)c=n;else{let m=e.length-1;if(!r&&o.startsWith("..")){let g=o.split("/");for(;g[0]==="..";)g.shift(),m-=1;a.pathname=g.join("/")}c=m>=0?e[m]:"/"}let u=vT(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,"/"),wT=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),jT=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,kT=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function ST(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Bj=["post","put","patch","delete"];new Set(Bj);const CT=["get",...Bj];new Set(CT);/** + * 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 Mu(){return Mu=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=J0(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 AT=y.createContext(null);function IT(t){let e=y.useContext(Fi).outlet;return e&&y.createElement(AT.Provider,{value:t},e)}function Uj(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=y.useContext(Wo),{matches:a}=y.useContext(Fi),{pathname:i}=Ko(),o=JSON.stringify(G0(a,r.v7_relativeSplatPath));return y.useMemo(()=>J0(t,JSON.parse(o),i,n==="path"),[t,o,i,n])}function PT(t,e){return RT(t,e)}function RT(t,e,n,r){pd()||Fn(!1);let{navigator:a}=y.useContext(Wo),{matches:i}=y.useContext(Fi),o=i[i.length-1],c=o?o.params:{};o&&o.pathname;let u=o?o.pathnameBase:"/";o&&o.route;let h=Ko(),f;if(e){var m;let v=typeof e=="string"?fd(e):e;u==="/"||(m=v.pathname)!=null&&m.startsWith(u)||Fn(!1),f=v}else f=h;let g=f.pathname||"/",b=g;if(u!=="/"){let v=u.replace(/^\//,"").split("/");b="/"+g.replace(/^\//,"").split("/").slice(v.length).join("/")}let N=sT(t,{pathname:b}),j=$T(N&&N.map(v=>Object.assign({},v,{params:Object.assign({},c,v.params),pathname:Po([u,a.encodeLocation?a.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?u:Po([u,a.encodeLocation?a.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),i,n,r);return e&&j?y.createElement(Op.Provider,{value:{location:Mu({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:Co.Pop}},j):j}function LT(){let t=VT(),e=ST(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 OT=y.createElement(LT,null);class DT 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(Fi.Provider,{value:this.props.routeContext},y.createElement(Vj.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function _T(t){let{routeContext:e,match:n,children:r}=t,a=y.useContext(Q0);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),y.createElement(Fi.Provider,{value:e},r)}function $T(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||Fn(!1),o=o.slice(0,Math.min(o.length,f+1))}let u=!1,h=-1;if(n&&r&&r.v7_partialHydration)for(let f=0;f=0?o=o.slice(0,h+1):o=[o[0]];break}}}return o.reduceRight((f,m,g)=>{let b,N=!1,j=null,v=null;n&&(b=c&&m.route.id?c[m.route.id]:void 0,j=m.route.errorElement||OT,u&&(h<0&&g===0?(UT("route-fallback"),N=!0,v=null):h===g&&(N=!0,v=m.route.hydrateFallbackElement||null)));let k=e.concat(o.slice(0,g+1)),T=()=>{let C;return b?C=j:N?C=v:m.route.Component?C=y.createElement(m.route.Component,null):m.route.element?C=m.route.element:C=f,y.createElement(_T,{match:m,routeContext:{outlet:f,matches:k,isDataRoute:n!=null},children:C})};return n&&(m.route.ErrorBoundary||m.route.errorElement||g===0)?y.createElement(DT,{location:n.location,revalidation:n.revalidation,component:j,error:b,children:T(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):T()},null)}var Wj=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(Wj||{}),Kj=(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})(Kj||{});function zT(t){let e=y.useContext(Q0);return e||Fn(!1),e}function FT(t){let e=y.useContext(ET);return e||Fn(!1),e}function BT(t){let e=y.useContext(Fi);return e||Fn(!1),e}function qj(t){let e=BT(),n=e.matches[e.matches.length-1];return n.route.id||Fn(!1),n.route.id}function VT(){var t;let e=y.useContext(Vj),n=FT(),r=qj();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function HT(){let{router:t}=zT(Wj.UseNavigateStable),e=qj(Kj.UseNavigateStable),n=y.useRef(!1);return Hj(()=>{n.current=!0}),y.useCallback(function(a,i){i===void 0&&(i={}),n.current&&(typeof a=="number"?t.navigate(a):t.navigate(a,Mu({fromRouteId:e},i)))},[t,e])}const C1={};function UT(t,e,n){C1[t]||(C1[t]=!0)}function WT(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Kh(t){let{to:e,replace:n,state:r,relative:a}=t;pd()||Fn(!1);let{future:i,static:o}=y.useContext(Wo),{matches:c}=y.useContext(Fi),{pathname:u}=Ko(),h=Ja(),f=J0(e,G0(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 KT(t){return IT(t.context)}function dn(t){Fn(!1)}function qT(t){let{basename:e="/",children:n=null,location:r,navigationType:a=Co.Pop,navigator:i,static:o=!1,future:c}=t;pd()&&Fn(!1);let u=e.replace(/^\/*/,"/"),h=y.useMemo(()=>({basename:u,navigator:i,static:o,future:Mu({v7_relativeSplatPath:!1},c)}),[u,c,i,o]);typeof r=="string"&&(r=fd(r));let{pathname:f="/",search:m="",hash:g="",state:b=null,key:N="default"}=r,j=y.useMemo(()=>{let v=q0(f,u);return v==null?null:{location:{pathname:v,search:m,hash:g,state:b,key:N},navigationType:a}},[u,f,m,g,b,N,a]);return j==null?null:y.createElement(Wo.Provider,{value:h},y.createElement(Op.Provider,{children:n,value:j}))}function GT(t){let{children:e,location:n}=t;return PT(Ox(e),n)}new Promise(()=>{});function Ox(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,Ox(r.props.children,i));return}r.type!==dn&&Fn(!1),!r.props.index||!r.props.children||Fn(!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=Ox(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 Dx(){return Dx=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[a]=t[a]);return n}function QT(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function YT(t,e){return t.button===0&&(!e||e==="_self")&&!QT(t)}function _x(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 XT(t,e){let n=_x(t);return e&&e.forEach((r,a)=>{n.has(a)||e.getAll(a).forEach(i=>{n.append(a,i)})}),n}const ZT=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],e5="6";try{window.__reactRouterVersion=e5}catch{}const t5="startTransition",E1=Lp[t5];function n5(t){let{basename:e,children:n,future:r,window:a}=t,i=y.useRef();i.current==null&&(i.current=eT({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&&E1?E1(()=>u(m)):u(m)},[u,h]);return y.useLayoutEffect(()=>o.listen(f),[o,f]),y.useEffect(()=>WT(r),[r]),y.createElement(qT,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:o,future:r})}const s5=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",r5=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Dl=y.forwardRef(function(e,n){let{onClick:r,relative:a,reloadDocument:i,replace:o,state:c,target:u,to:h,preventScrollReset:f,viewTransition:m}=e,g=JT(e,ZT),{basename:b}=y.useContext(Wo),N,j=!1;if(typeof h=="string"&&r5.test(h)&&(N=h,s5))try{let C=new URL(window.location.href),R=h.startsWith("//")?new URL(C.protocol+h):new URL(h),O=q0(R.pathname,b);R.origin===C.origin&&O!=null?h=O+R.search+R.hash:j=!0}catch{}let v=TT(h,{relative:a}),k=a5(h,{replace:o,state:c,target:u,preventScrollReset:f,relative:a,viewTransition:m});function T(C){r&&r(C),C.defaultPrevented||k(C)}return y.createElement("a",Dx({},g,{href:N||v,onClick:j||i?r:T,ref:n,target:u}))});var T1;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(T1||(T1={}));var M1;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(M1||(M1={}));function a5(t,e){let{target:n,replace:r,state:a,preventScrollReset:i,relative:o,viewTransition:c}=e===void 0?{}:e,u=Ja(),h=Ko(),f=Uj(t,{relative:o});return y.useCallback(m=>{if(YT(m,n)){m.preventDefault();let g=r!==void 0?r:If(h)===If(f);u(t,{replace:g,state:a,preventScrollReset:i,relative:o,viewTransition:c})}},[h,u,f,r,a,n,t,i,o,c])}function Y0(t){let e=y.useRef(_x(t)),n=y.useRef(!1),r=Ko(),a=y.useMemo(()=>XT(r.search,n.current?null:e.current),[r.search]),i=Ja(),o=y.useCallback((c,u)=>{const h=_x(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 i5=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),o5=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),A1=t=>{const e=o5(t);return e.charAt(0).toUpperCase()+e.slice(1)},Gj=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),l5=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 c5={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 d5=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,...c5,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:Gj("lucide",a),...!i&&!l5(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 Te=(t,e)=>{const n=y.forwardRef(({className:r,...a},i)=>y.createElement(d5,{ref:i,iconNode:e,className:Gj(`lucide-${i5(A1(t))}`,`lucide-${t}`,r),...a}));return n.displayName=A1(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 u5=[["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"}]],Dg=Te("arrow-up-down",u5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const h5=[["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"}]],f5=Te("at-sign",h5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const p5=[["path",{d:"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"}]],I1=Te("bitcoin",p5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const m5=[["path",{d:"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"}]],g5=Te("bold",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:"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"}]],ur=Te("book-open",x5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const y5=[["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"}]],$x=Te("calendar",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:"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"}]],nu=Te("chart-column",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:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Dp=Te("check",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:"m6 9 6 6 6-6",key:"qrunsl"}]],_l=Te("chevron-down",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:"m15 18-6-6 6-6",key:"1wnfg3"}]],j5=Te("chevron-left",w5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const k5=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Cl=Te("chevron-right",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:"m18 15-6-6-6 6",key:"153udz"}]],zx=Te("chevron-up",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=[["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"}]],Jj=Te("circle-alert",C5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const E5=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],_g=Te("circle-check-big",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:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Qj=Te("circle-check",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=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],A5=Te("circle-plus",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=[["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"}]],Yj=Te("circle-question-mark",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 P5=[["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"}]],qh=Te("circle-user",P5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const R5=[["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"}]],Xj=Te("circle-x",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:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Fx=Te("clock",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:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],P1=Te("cloud",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:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],_5=Te("code",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",{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"}]],Zj=Te("copy",$5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const z5=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],R1=Te("credit-card",z5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const F5=[["path",{d:"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"}]],Qc=Te("crown",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=[["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"}]],Pf=Te("dollar-sign",B5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const V5=[["path",{d:"M12 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"}]],H5=Te("download",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=[["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"}]],$o=Te("external-link",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:"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"}]],K5=Te("eye-off",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:"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=Te("eye",q5);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const G5=[["path",{d:"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"}]],ek=Te("file-text",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 J5=[["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"}]],tk=Te("funnel",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 Q5=[["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"}]],Bx=Te("gift",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 Y5=[["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"}]],X5=Te("git-merge",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=[["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"}]],Vx=Te("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 eM=[["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"}]],tM=Te("graduation-cap",eM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nM=[["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"}]],bi=Te("grip-vertical",nM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const sM=[["path",{d:"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"}]],rM=Te("handshake",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=[["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"}]],L1=Te("hash",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:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],oM=Te("heading-1",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:"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"}]],cM=Te("heading-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 dM=[["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"}]],uM=Te("heading-3",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:"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"}]],fM=Te("house",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:"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"}]],nk=Te("image",pM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const mM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Gh=Te("info",mM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const gM=[["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"}]],xM=Te("italic",gM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yM=[["path",{d:"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"}]],Hx=Te("key",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=[["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"}]],vM=Te("layout-dashboard",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=[["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"}]],wM=Te("layout-grid",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:"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"}]],Pi=Te("link-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 kM=[["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"}]],Ux=Te("link",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 SM=[["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"}]],CM=Te("list-ordered",SM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const EM=[["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"}]],TM=Te("list",EM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const MM=[["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"}]],AM=Te("lock",MM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const IM=[["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"}]],PM=Te("log-out",IM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const RM=[["path",{d:"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"}]],sk=Te("map-pin",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:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],OM=Te("menu",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:"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"}]],_M=Te("message-circle",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:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],rk=Te("message-square",$M);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zM=[["path",{d:"M5 12h14",key:"1ays0h"}]],FM=Te("minus",zM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const BM=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],pa=Te("navigation",BM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const VM=[["path",{d:"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"}]],HM=Te("palette",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:"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"}]],WM=Te("paperclip",UM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const KM=[["path",{d:"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"}]],sn=Te("pen-line",KM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qM=[["path",{d:"M21.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"}]],Wx=Te("pencil",qM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const GM=[["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"}]],JM=Te("percent",GM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const QM=[["path",{d:"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"}]],O1=Te("phone",QM);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const YM=[["path",{d:"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"}]],D1=Te("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 XM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],zn=Te("plus",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=[["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"}]],_1=Te("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 eA=[["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"}]],tA=Te("quote",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 nA=[["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"}]],sA=Te("redo",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:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],He=Te("refresh-cw",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 aA=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],iA=Te("rotate-ccw",aA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const oA=[["path",{d:"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"}]],Tn=Te("save",oA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const lA=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],xa=Te("search",lA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const cA=[["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"}]],dA=Te("send",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:"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"}]],Eo=Te("settings",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:"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"}]],Jh=Te("settings-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=[["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"}]],pA=Te("share-2",fA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const mA=[["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=Te("shield-check",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:"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"}]],mu=Te("shopping-bag",gA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xA=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],$l=Te("smartphone",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=[["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"}]],bA=Te("smile",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 vA=[["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"}]],NA=Te("sparkles",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 wA=[["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"}]],qc=Te("star",wA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const jA=[["path",{d:"M16 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"}]],kA=Te("strikethrough",jA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const SA=[["path",{d:"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=Te("table",SA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const EA=[["path",{d:"M12.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"}]],gu=Te("tag",EA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const TA=[["path",{d:"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"}]],ts=Te("trash-2",TA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const MA=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Lf=Te("trending-up",MA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const AA=[["path",{d:"M10 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"}]],Kx=Te("trophy",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:"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"}]],ak=Te("undo-2",IA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const PA=[["path",{d:"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"}]],RA=Te("undo",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 LA=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Of=Te("upload",LA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const OA=[["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"}]],Gc=Te("user-plus",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 DA=[["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"}]],Ti=Te("user",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 _A=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Kn=Te("users",_A);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $A=[["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"}]],zA=Te("video",$A);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const FA=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],td=Te("wallet",FA);/** + * @license lucide-react v0.562.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const BA=[["path",{d:"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"}]],VA=Te("wand-sparkles",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 HA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ns=Te("x",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 UA=[["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"}]],zo=Te("zap",UA),X0="admin_token";function Wu(){try{return localStorage.getItem(X0)}catch{return null}}function WA(t){try{localStorage.setItem(X0,t)}catch{}}function $g(){try{localStorage.removeItem(X0)}catch{}}const KA="https://soulapi.quwanzhi.com",qA=15e3,$1=6e4,GA=()=>KA;function zl(t){const e=GA(),n=t.startsWith("/")?t:`/${t}`;return e?`${e}${n}`:n}async function _p(t,e={}){const{data:n,...r}=e,a=zl(t),i=new Headers(r.headers),o=Wu();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??qA,h=new AbortController,f=setTimeout(()=>h.abort(),u),m=await fetch(a,{...r,headers:i,body:c,credentials:"include",signal:h.signal}).finally(()=>clearTimeout(f)),g=m.headers.get("Content-Type")||"";let b;if(g.includes("application/json"))try{b=await m.json()}catch{throw new Error(`API 响应解析失败 (${m.status})`)}else{const j=await m.text();throw new Error(`API 返回非 JSON 响应 (${m.status}): ${j.slice(0,100)}`)}const N=j=>{const v=j,k=((v==null?void 0:v.message)||(v==null?void 0:v.error)||"").toString();(k.includes("可提现金额不足")||k.includes("可提现不足")||k.includes("余额不足"))&&window.dispatchEvent(new CustomEvent("recharge-alert",{detail:k}))};if(!m.ok){N(b);const j=new Error((b==null?void 0:b.error)||`HTTP ${m.status}`);throw j.status=m.status,j.data=b,j}return N(b),b}function Oe(t,e){return _p(t,{...e,method:"GET"})}function Nt(t,e,n){return _p(t,{...n,method:"POST",data:e})}function Zt(t,e,n){return _p(t,{...n,method:"PUT",data:e})}function Mi(t,e){return _p(t,{...e,method:"DELETE"})}function JA(){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(Jj,{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(ns,{className:"w-4 h-4"})})]}):null}const QA=[{icon:vM,label:"数据概览",href:"/dashboard"},{icon:ur,label:"内容管理",href:"/content"},{icon:Kn,label:"用户管理",href:"/users"},{icon:X5,label:"找伙伴",href:"/find-partner"},{icon:td,label:"推广中心",href:"/distribution"}];function YA(){const t=Ko(),e=y.useRef(t.pathname);e.current=t.pathname;const n=Ja(),[r,a]=y.useState(!1),[i,o]=y.useState(!1);y.useEffect(()=>{a(!0)},[]),y.useEffect(()=>{if(!r)return;let u=!1;if(!Wu()){n("/login",{replace:!0});return}return Oe("/api/admin").then(h=>{u||(h&&h.success!==!1?o(!0):($g(),n("/login",{replace:!0,state:{from:e.current}})))}).catch(()=>{u||($g(),n("/login",{replace:!0,state:{from:e.current}}))}),()=>{u=!0}},[r,n]);const c=async()=>{$g();try{await Nt("/api/admin/logout",{})}catch{}n("/login",{replace:!0})};return!r||!i?s.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[s.jsx("div",{className:"w-64 bg-[#0f2137] border-r border-gray-700/50"}),s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-[#38bdac]",children:"加载中..."})})]}):s.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[s.jsxs("div",{className:"w-64 bg-[#0f2137] flex flex-col border-r border-gray-700/50 shadow-xl",children:[s.jsxs("div",{className:"p-6 border-b border-gray-700/50",children:[s.jsx("h1",{className:"text-xl font-bold text-[#38bdac]",children:"管理后台"}),s.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Soul创业派对"})]}),s.jsxs("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:[QA.map(u=>{const h=t.pathname===u.href;return s.jsxs(Dl,{to:u.href,className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${h?"bg-[#38bdac]/20 text-[#38bdac] font-medium":"text-gray-400 hover:bg-gray-700/50 hover:text-white"}`,children:[s.jsx(u.icon,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"text-sm",children:u.label})]},u.href)}),s.jsx("div",{className:"pt-4 mt-4 border-t border-gray-700/50",children:s.jsxs(Dl,{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(Eo,{className:"w-5 h-5 shrink-0"}),s.jsx("span",{className:"text-sm",children:"系统设置"})]})})]}),s.jsx("div",{className:"p-4 border-t border-gray-700/50 space-y-1",children:s.jsxs("button",{type:"button",onClick:c,className:"w-full flex items-center gap-3 px-4 py-3 text-gray-400 hover:text-white rounded-lg hover:bg-gray-700/50 transition-colors",children:[s.jsx(PM,{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(JA,{}),s.jsx("div",{className:"w-full min-w-0 min-h-full flex-1",children:s.jsx(KT,{})})]})]})}function z1(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Z0(...t){return e=>{let n=!1;const r=t.map(a=>{const i=z1(a,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a{let{children:i,...o}=r;ik(i)&&typeof Df=="function"&&(i=Df(i._payload));const c=y.Children.toArray(i),u=c.find(nI);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 lk=ok("Slot");function eI(t){const e=y.forwardRef((n,r)=>{let{children:a,...i}=n;if(ik(a)&&typeof Df=="function"&&(a=Df(a._payload)),y.isValidElement(a)){const o=rI(a),c=sI(i,a.props);return a.type!==y.Fragment&&(c.ref=r?Z0(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 tI=Symbol("radix.slottable");function nI(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===tI}function sI(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 rI(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 ck(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,B1=dk,uk=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return B1(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:i}=e,o=Object.keys(a).map(h=>{const f=n==null?void 0:n[h],m=i==null?void 0:i[h];if(f===null)return null;const g=F1(f)||F1(m);return a[h][g]}),c=n&&Object.entries(n).reduce((h,f)=>{let[m,g]=f;return g===void 0||(h[m]=g),h},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,f)=>{let{class:m,className:g,...b}=f;return Object.entries(b).every(N=>{let[j,v]=N;return Array.isArray(v)?v.includes({...i,...c}[j]):{...i,...c}[j]===v})?[...h,m,g]:h},[]);return B1(t,o,u,n==null?void 0:n.class,n==null?void 0:n.className)},aI=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),hk=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),_f="-",V1=[],oI="arbitrary..",lI=t=>{const e=dI(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return cI(o);const c=o.split(_f),u=c[0]===""&&c.length>1?1:0;return fk(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=r[o],h=n[o];return u?h?aI(h,u):u:h||V1}return n[o]||V1}}},fk=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const a=t[e],i=n.nextPart.get(a);if(i){const h=fk(t,e+1,i);if(h)return h}const o=n.validators;if(o===null)return;const c=e===0?t.join(_f):t.slice(e).join(_f),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?oI+r:void 0})(),dI=t=>{const{theme:e,classGroups:n}=t;return uI(n,e)},uI=(t,e)=>{const n=hk();for(const r in t){const a=t[r];ey(a,n,r,e)}return n},ey=(t,e,n,r)=>{const a=t.length;for(let i=0;i{if(typeof t=="string"){fI(t,e,n);return}if(typeof t=="function"){pI(t,e,n,r);return}mI(t,e,n,r)},fI=(t,e,n)=>{const r=t===""?e:pk(e,t);r.classGroupId=n},pI=(t,e,n,r)=>{if(gI(t)){ey(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(iI(n,t))},mI=(t,e,n,r)=>{const a=Object.entries(t),i=a.length;for(let o=0;o{let n=t;const r=e.split(_f),a=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,xI=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)}}},qx="!",H1=":",yI=[],U1=(t,e,n,r,a)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),bI=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=a=>{const i=[];let o=0,c=0,u=0,h;const f=a.length;for(let j=0;ju?h-u:void 0;return U1(i,b,g,N)};if(e){const a=e+H1,i=r;r=o=>o.startsWith(a)?i(o.slice(a.length)):U1(yI,!1,o,void 0,!0)}if(n){const a=r;r=i=>n({className:i,parseClassName:a})}return r},vI=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}},NI=t=>({cache:xI(t.cacheSize),parseClassName:bI(t),sortModifiers:vI(t),...lI(t)}),wI=/\s+/,jI=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:i}=e,o=[],c=t.trim().split(wI);let u="";for(let h=c.length-1;h>=0;h-=1){const f=c[h],{isExternal:m,modifiers:g,hasImportantModifier:b,baseClassName:N,maybePostfixModifierPosition:j}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let v=!!j,k=r(v?N.substring(0,j):N);if(!k){if(!v){u=f+(u.length>0?" "+u:u);continue}if(k=r(N),!k){u=f+(u.length>0?" "+u:u);continue}v=!1}const T=g.length===0?"":g.length===1?g[0]:i(g).join(":"),C=b?T+qx:T,R=C+k;if(o.indexOf(R)>-1)continue;o.push(R);const O=a(k,v);for(let U=0;U0?" "+u:u)}return u},kI=(...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=NI(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=jI(u,n);return a(u,f),f};return i=o,(...u)=>i(kI(...u))},CI=[],es=t=>{const e=n=>n[t]||CI;return e.isThemeGetter=!0,e},gk=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,xk=/^\((?:(\w[\w-]*):)?(.+)\)$/i,EI=/^\d+\/\d+$/,TI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,MI=/\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$/,AI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,II=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,PI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Lc=t=>EI.test(t),Ct=t=>!!t&&!Number.isNaN(Number(t)),fo=t=>!!t&&Number.isInteger(Number(t)),zg=t=>t.endsWith("%")&&Ct(t.slice(0,-1)),vi=t=>TI.test(t),RI=()=>!0,LI=t=>MI.test(t)&&!AI.test(t),yk=()=>!1,OI=t=>II.test(t),DI=t=>PI.test(t),_I=t=>!Ze(t)&&!et(t),$I=t=>md(t,Nk,yk),Ze=t=>gk.test(t),jl=t=>md(t,wk,LI),Fg=t=>md(t,HI,Ct),W1=t=>md(t,bk,yk),zI=t=>md(t,vk,DI),Qh=t=>md(t,jk,OI),et=t=>xk.test(t),su=t=>gd(t,wk),FI=t=>gd(t,UI),K1=t=>gd(t,bk),BI=t=>gd(t,Nk),VI=t=>gd(t,vk),Yh=t=>gd(t,jk,!0),md=(t,e,n)=>{const r=gk.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},gd=(t,e,n=!1)=>{const r=xk.exec(t);return r?r[1]?e(r[1]):n:!1},bk=t=>t==="position"||t==="percentage",vk=t=>t==="image"||t==="url",Nk=t=>t==="length"||t==="size"||t==="bg-size",wk=t=>t==="length",HI=t=>t==="number",UI=t=>t==="family-name",jk=t=>t==="shadow",WI=()=>{const t=es("color"),e=es("font"),n=es("text"),r=es("font-weight"),a=es("tracking"),i=es("leading"),o=es("breakpoint"),c=es("container"),u=es("spacing"),h=es("radius"),f=es("shadow"),m=es("inset-shadow"),g=es("text-shadow"),b=es("drop-shadow"),N=es("blur"),j=es("perspective"),v=es("aspect"),k=es("ease"),T=es("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"],O=()=>[...R(),et,Ze],U=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto","contain","none"],z=()=>[et,Ze,u],L=()=>[Lc,"full","auto",...z()],Q=()=>[fo,"none","subgrid",et,Ze],se=()=>["auto",{span:["full",fo,et,Ze]},fo,et,Ze],$=()=>[fo,"auto",et,Ze],ie=()=>["auto","min","max","fr",et,Ze],oe=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],me=()=>["start","end","center","stretch","center-safe","end-safe"],I=()=>["auto",...z()],Y=()=>[Lc,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...z()],F=()=>[t,et,Ze],ge=()=>[...R(),K1,W1,{position:[et,Ze]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],V=()=>["auto","cover","contain",BI,$I,{size:[et,Ze]}],W=()=>[zg,su,jl],fe=()=>["","none","full",h,et,Ze],he=()=>["",Ct,su,jl],de=()=>["solid","dashed","dotted","double"],D=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],q=()=>[Ct,zg,K1,W1],_=()=>["","none",N,et,Ze],Z=()=>["none",Ct,et,Ze],re=()=>["none",Ct,et,Ze],we=()=>[Ct,et,Ze],Fe=()=>[Lc,"full",...z()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[vi],breakpoint:[vi],color:[RI],container:[vi],"drop-shadow":[vi],ease:["in","out","in-out"],font:[_I],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[vi],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[vi],shadow:[vi],spacing:["px",Ct],text:[vi],"text-shadow":[vi],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Lc,Ze,et,v]}],container:["container"],columns:[{columns:[Ct,Ze,et,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:U()}],"overflow-x":[{"overflow-x":U()}],"overflow-y":[{"overflow-y":U()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{start:L()}],end:[{end:L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[fo,"auto",et,Ze]}],basis:[{basis:[Lc,"full","auto",c,...z()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ct,Lc,"auto","initial","none",Ze]}],grow:[{grow:["",Ct,et,Ze]}],shrink:[{shrink:["",Ct,et,Ze]}],order:[{order:[fo,"first","last","none",et,Ze]}],"grid-cols":[{"grid-cols":Q()}],"col-start-end":[{col:se()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":Q()}],"row-start-end":[{row:se()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ie()}],"auto-rows":[{"auto-rows":ie()}],gap:[{gap:z()}],"gap-x":[{"gap-x":z()}],"gap-y":[{"gap-y":z()}],"justify-content":[{justify:[...oe(),"normal"]}],"justify-items":[{"justify-items":[...me(),"normal"]}],"justify-self":[{"justify-self":["auto",...me()]}],"align-content":[{content:["normal",...oe()]}],"align-items":[{items:[...me(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...me(),{baseline:["","last"]}]}],"place-content":[{"place-content":oe()}],"place-items":[{"place-items":[...me(),"baseline"]}],"place-self":[{"place-self":["auto",...me()]}],p:[{p:z()}],px:[{px:z()}],py:[{py:z()}],ps:[{ps:z()}],pe:[{pe:z()}],pt:[{pt:z()}],pr:[{pr:z()}],pb:[{pb:z()}],pl:[{pl:z()}],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":z()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":z()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],w:[{w:[c,"screen",...Y()]}],"min-w":[{"min-w":[c,"screen","none",...Y()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",n,su,jl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,et,Fg]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",zg,Ze]}],"font-family":[{font:[FI,Ze,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,et,Ze]}],"line-clamp":[{"line-clamp":[Ct,"none",et,Fg]}],leading:[{leading:[i,...z()]}],"list-image":[{"list-image":["none",et,Ze]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",et,Ze]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...de(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ct,"from-font","auto",et,jl]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[Ct,"auto",et,Ze]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:z()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",et,Ze]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",et,Ze]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ge()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:V()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},fo,et,Ze],radial:["",et,Ze],conic:[fo,et,Ze]},VI,zI]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:W()}],"gradient-via-pos":[{via:W()}],"gradient-to-pos":[{to:W()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],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:[...de(),"hidden","none"]}],"divide-style":[{divide:[...de(),"hidden","none"]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...de(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ct,et,Ze]}],"outline-w":[{outline:["",Ct,su,jl]}],"outline-color":[{outline:F()}],shadow:[{shadow:["","none",f,Yh,Qh]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":["none",m,Yh,Qh]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:he()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[Ct,jl]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":he()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":["none",g,Yh,Qh]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[Ct,et,Ze]}],"mix-blend":[{"mix-blend":[...D(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":D()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ct]}],"mask-image-linear-from-pos":[{"mask-linear-from":q()}],"mask-image-linear-to-pos":[{"mask-linear-to":q()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":q()}],"mask-image-t-to-pos":[{"mask-t-to":q()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":q()}],"mask-image-r-to-pos":[{"mask-r-to":q()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":q()}],"mask-image-b-to-pos":[{"mask-b-to":q()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":q()}],"mask-image-l-to-pos":[{"mask-l-to":q()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":q()}],"mask-image-x-to-pos":[{"mask-x-to":q()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":q()}],"mask-image-y-to-pos":[{"mask-y-to":q()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[et,Ze]}],"mask-image-radial-from-pos":[{"mask-radial-from":q()}],"mask-image-radial-to-pos":[{"mask-radial-to":q()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"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":[Ct]}],"mask-image-conic-from-pos":[{"mask-conic-from":q()}],"mask-image-conic-to-pos":[{"mask-conic-to":q()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ge()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:V()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",et,Ze]}],filter:[{filter:["","none",et,Ze]}],blur:[{blur:_()}],brightness:[{brightness:[Ct,et,Ze]}],contrast:[{contrast:[Ct,et,Ze]}],"drop-shadow":[{"drop-shadow":["","none",b,Yh,Qh]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:["",Ct,et,Ze]}],"hue-rotate":[{"hue-rotate":[Ct,et,Ze]}],invert:[{invert:["",Ct,et,Ze]}],saturate:[{saturate:[Ct,et,Ze]}],sepia:[{sepia:["",Ct,et,Ze]}],"backdrop-filter":[{"backdrop-filter":["","none",et,Ze]}],"backdrop-blur":[{"backdrop-blur":_()}],"backdrop-brightness":[{"backdrop-brightness":[Ct,et,Ze]}],"backdrop-contrast":[{"backdrop-contrast":[Ct,et,Ze]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ct,et,Ze]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ct,et,Ze]}],"backdrop-invert":[{"backdrop-invert":["",Ct,et,Ze]}],"backdrop-opacity":[{"backdrop-opacity":[Ct,et,Ze]}],"backdrop-saturate":[{"backdrop-saturate":[Ct,et,Ze]}],"backdrop-sepia":[{"backdrop-sepia":["",Ct,et,Ze]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":z()}],"border-spacing-x":[{"border-spacing-x":z()}],"border-spacing-y":[{"border-spacing-y":z()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",et,Ze]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ct,"initial",et,Ze]}],ease:[{ease:["linear","initial",k,et,Ze]}],delay:[{delay:[Ct,et,Ze]}],animate:[{animate:["none",T,et,Ze]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,et,Ze]}],"perspective-origin":[{"perspective-origin":O()}],rotate:[{rotate:Z()}],"rotate-x":[{"rotate-x":Z()}],"rotate-y":[{"rotate-y":Z()}],"rotate-z":[{"rotate-z":Z()}],scale:[{scale:re()}],"scale-x":[{"scale-x":re()}],"scale-y":[{"scale-y":re()}],"scale-z":[{"scale-z":re()}],"scale-3d":["scale-3d"],skew:[{skew:we()}],"skew-x":[{"skew-x":we()}],"skew-y":[{"skew-y":we()}],transform:[{transform:[et,Ze,"","none","gpu","cpu"]}],"transform-origin":[{origin:O()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Fe()}],"translate-x":[{"translate-x":Fe()}],"translate-y":[{"translate-y":Fe()}],"translate-z":[{"translate-z":Fe()}],"translate-none":["translate-none"],accent:[{accent:F()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:F()}],"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",et,Ze]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":z()}],"scroll-mx":[{"scroll-mx":z()}],"scroll-my":[{"scroll-my":z()}],"scroll-ms":[{"scroll-ms":z()}],"scroll-me":[{"scroll-me":z()}],"scroll-mt":[{"scroll-mt":z()}],"scroll-mr":[{"scroll-mr":z()}],"scroll-mb":[{"scroll-mb":z()}],"scroll-ml":[{"scroll-ml":z()}],"scroll-p":[{"scroll-p":z()}],"scroll-px":[{"scroll-px":z()}],"scroll-py":[{"scroll-py":z()}],"scroll-ps":[{"scroll-ps":z()}],"scroll-pe":[{"scroll-pe":z()}],"scroll-pt":[{"scroll-pt":z()}],"scroll-pr":[{"scroll-pr":z()}],"scroll-pb":[{"scroll-pb":z()}],"scroll-pl":[{"scroll-pl":z()}],"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",et,Ze]}],fill:[{fill:["none",...F()]}],"stroke-w":[{stroke:[Ct,su,jl,Fg]}],stroke:[{stroke:["none",...F()]}],"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"]}},KI=SI(WI);function zt(...t){return KI(dk(t))}function ya(t){if(!t)return"";let e=t.trim();return e?(e=e.replace(/^(https?)\/\//,"$1://"),e):""}const qI=uk("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?lk:"button";return s.jsx(i,{"data-slot":"button",className:zt(qI({variant:e,size:n,className:t})),...a})}function le({className:t,type:e,...n}){return s.jsx("input",{type:e,"data-slot":"input",className:zt("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 GI(){const t=Ja(),[e,n]=y.useState(""),[r,a]=y.useState(""),[i,o]=y.useState(""),[c,u]=y.useState(!1);y.useEffect(()=>{Wu()&&t("/dashboard",{replace:!0})},[t]);const h=async()=>{o(""),u(!0);try{const f=await Nt("/api/admin",{username:e.trim(),password:r});if((f==null?void 0:f.success)!==!1&&(f!=null&&f.token)){WA(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(Ti,{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(AM,{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 De=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:zt("rounded-xl border bg-card text-card-foreground shadow",t),...e}));De.displayName="Card";const dt=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:zt("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:zt("font-semibold leading-none tracking-tight",t),...e}));ut.displayName="CardTitle";const Gt=y.forwardRef(({className:t,...e},n)=>s.jsx("p",{ref:n,className:zt("text-sm text-muted-foreground",t),...e}));Gt.displayName="CardDescription";const _e=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:zt("p-6 pt-0",t),...e}));_e.displayName="CardContent";const JI=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:zt("flex items-center p-6 pt-0",t),...e}));JI.displayName="CardFooter";const QI={success:{bg:"#f0fdf4",border:"#22c55e",icon:"✓"},error:{bg:"#fef2f2",border:"#ef4444",icon:"✕"},info:{bg:"#eff6ff",border:"#3b82f6",icon:"ℹ"}};function Bg(t,e="info",n=3e3){const r=`toast-${Date.now()}`,a=QI[e],i=document.createElement("div");i.id=r,i.setAttribute("role","alert"),Object.assign(i.style,{position:"fixed",top:"24px",right:"24px",zIndex:"9999",display:"flex",alignItems:"center",gap:"10px",padding:"12px 18px",borderRadius:"10px",background:a.bg,border:`1.5px solid ${a.border}`,boxShadow:"0 4px 20px rgba(0,0,0,.12)",fontSize:"14px",color:"#1a1a1a",fontWeight:"500",maxWidth:"380px",lineHeight:"1.5",opacity:"0",transform:"translateY(-8px)",transition:"opacity .22s ease, transform .22s ease",pointerEvents:"none"});const o=document.createElement("span");Object.assign(o.style,{width:"20px",height:"20px",borderRadius:"50%",background:a.border,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:"700",flexShrink:"0"}),o.textContent=a.icon;const c=document.createElement("span");c.textContent=t,i.appendChild(o),i.appendChild(c),document.body.appendChild(i),requestAnimationFrame(()=>{i.style.opacity="1",i.style.transform="translateY(0)"});const u=setTimeout(()=>h(r),n);function h(f){clearTimeout(u);const m=document.getElementById(f);m&&(m.style.opacity="0",m.style.transform="translateY(-8px)",setTimeout(()=>{var g;return(g=m.parentNode)==null?void 0:g.removeChild(m)},250))}}const G={success:(t,e)=>Bg(t,"success",e),error:(t,e)=>Bg(t,"error",e),info:(t,e)=>Bg(t,"info",e)};function jt(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 YI(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 qo(t,e=[]){let n=[];function r(i,o){const c=y.createContext(o),u=n.length;n=[...n,o];const h=m=>{var k;const{scope:g,children:b,...N}=m,j=((k=g==null?void 0:g[t])==null?void 0:k[u])||c,v=y.useMemo(()=>N,Object.values(N));return s.jsx(j.Provider,{value:v,children:b})};h.displayName=i+"Provider";function f(m,g){var j;const b=((j=g==null?void 0:g[t])==null?void 0:j[u])||c,N=y.useContext(b);if(N)return N;if(o!==void 0)return o;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[h,f]}const a=()=>{const i=n.map(o=>y.createContext(o));return function(c){const u=(c==null?void 0:c[t])||i;return y.useMemo(()=>({[`__scope${t}`]:{...c,[t]:u}}),[c,u])}};return a.scopeName=t,[r,XI(a,...e)]}function XI(...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 _s=globalThis!=null&&globalThis.document?y.useLayoutEffect:()=>{},ZI=Lp[" useId ".trim().toString()]||(()=>{}),eP=0;function Ro(t){const[e,n]=y.useState(ZI());return _s(()=>{n(r=>r??String(eP++))},[t]),e?`radix-${e}`:""}var tP=Lp[" useInsertionEffect ".trim().toString()]||_s;function Fl({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[a,i,o]=nP({defaultProp:e,onChange:n}),c=t!==void 0,u=c?t:a;{const f=y.useRef(t!==void 0);y.useEffect(()=>{const m=f.current;m!==c&&console.warn(`${r} is changing from ${m?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=c},[c,r])}const h=y.useCallback(f=>{var m;if(c){const g=sP(f)?f(t):f;g!==t&&((m=o.current)==null||m.call(o,g))}else i(f)},[c,t,i,o]);return[u,h]}function nP({defaultProp:t,onChange:e}){const[n,r]=y.useState(t),a=y.useRef(n),i=y.useRef(e);return tP(()=>{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 sP(t){return typeof t=="function"}function Au(t){const e=rP(t),n=y.forwardRef((r,a)=>{const{children:i,...o}=r,c=y.Children.toArray(i),u=c.find(iP);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 rP(t){const e=y.forwardRef((n,r)=>{const{children:a,...i}=n;if(y.isValidElement(a)){const o=lP(a),c=oP(i,a.props);return a.type!==y.Fragment&&(c.ref=r?Z0(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 aP=Symbol("radix.slottable");function iP(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===aP}function oP(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 lP(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 cP=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Et=cP.reduce((t,e)=>{const n=Au(`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 dP(t,e){t&&hd.flushSync(()=>t.dispatchEvent(e))}function Fo(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 uP(t,e=globalThis==null?void 0:globalThis.document){const n=Fo(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 hP="DismissableLayer",Gx="dismissableLayer.update",fP="dismissableLayer.pointerDownOutside",pP="dismissableLayer.focusOutside",q1,kk=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ty=y.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,onDismiss:c,...u}=t,h=y.useContext(kk),[f,m]=y.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=y.useState({}),N=Qt(e,P=>m(P)),j=Array.from(h.layers),[v]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),k=j.indexOf(v),T=f?j.indexOf(f):-1,C=h.layersWithOutsidePointerEventsDisabled.size>0,R=T>=k,O=xP(P=>{const z=P.target,L=[...h.branches].some(Q=>Q.contains(z));!R||L||(a==null||a(P),o==null||o(P),P.defaultPrevented||c==null||c())},g),U=yP(P=>{const z=P.target;[...h.branches].some(Q=>Q.contains(z))||(i==null||i(P),o==null||o(P),P.defaultPrevented||c==null||c())},g);return uP(P=>{T===h.layers.size-1&&(r==null||r(P),!P.defaultPrevented&&c&&(P.preventDefault(),c()))},g),y.useEffect(()=>{if(f)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(q1=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),G1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=q1)}},[f,g,n,h]),y.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),G1())},[f,h]),y.useEffect(()=>{const P=()=>b({});return document.addEventListener(Gx,P),()=>document.removeEventListener(Gx,P)},[]),s.jsx(Et.div,{...u,ref:N,style:{pointerEvents:C?R?"auto":"none":void 0,...t.style},onFocusCapture:jt(t.onFocusCapture,U.onFocusCapture),onBlurCapture:jt(t.onBlurCapture,U.onBlurCapture),onPointerDownCapture:jt(t.onPointerDownCapture,O.onPointerDownCapture)})});ty.displayName=hP;var mP="DismissableLayerBranch",gP=y.forwardRef((t,e)=>{const n=y.useContext(kk),r=y.useRef(null),a=Qt(e,r);return y.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),s.jsx(Et.div,{...t,ref:a})});gP.displayName=mP;function xP(t,e=globalThis==null?void 0:globalThis.document){const n=Fo(t),r=y.useRef(!1),a=y.useRef(()=>{});return y.useEffect(()=>{const i=c=>{if(c.target&&!r.current){let u=function(){Sk(fP,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 yP(t,e=globalThis==null?void 0:globalThis.document){const n=Fo(t),r=y.useRef(!1);return y.useEffect(()=>{const a=i=>{i.target&&!r.current&&Sk(pP,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 G1(){const t=new CustomEvent(Gx);document.dispatchEvent(t)}function Sk(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?dP(a,i):a.dispatchEvent(i)}var Vg="focusScope.autoFocusOnMount",Hg="focusScope.autoFocusOnUnmount",J1={bubbles:!1,cancelable:!0},bP="FocusScope",ny=y.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=t,[c,u]=y.useState(null),h=Fo(a),f=Fo(i),m=y.useRef(null),g=Qt(e,j=>u(j)),b=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let j=function(C){if(b.paused||!c)return;const R=C.target;c.contains(R)?m.current=R:go(m.current,{select:!0})},v=function(C){if(b.paused||!c)return;const R=C.relatedTarget;R!==null&&(c.contains(R)||go(m.current,{select:!0}))},k=function(C){if(document.activeElement===document.body)for(const O of C)O.removedNodes.length>0&&go(c)};document.addEventListener("focusin",j),document.addEventListener("focusout",v);const T=new MutationObserver(k);return c&&T.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",v),T.disconnect()}}},[r,c,b.paused]),y.useEffect(()=>{if(c){Y1.add(b);const j=document.activeElement;if(!c.contains(j)){const k=new CustomEvent(Vg,J1);c.addEventListener(Vg,h),c.dispatchEvent(k),k.defaultPrevented||(vP(SP(Ck(c)),{select:!0}),document.activeElement===j&&go(c))}return()=>{c.removeEventListener(Vg,h),setTimeout(()=>{const k=new CustomEvent(Hg,J1);c.addEventListener(Hg,f),c.dispatchEvent(k),k.defaultPrevented||go(j??document.body,{select:!0}),c.removeEventListener(Hg,f),Y1.remove(b)},0)}}},[c,h,f,b]);const N=y.useCallback(j=>{if(!n&&!r||b.paused)return;const v=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,k=document.activeElement;if(v&&k){const T=j.currentTarget,[C,R]=NP(T);C&&R?!j.shiftKey&&k===R?(j.preventDefault(),n&&go(C,{select:!0})):j.shiftKey&&k===C&&(j.preventDefault(),n&&go(R,{select:!0})):k===T&&j.preventDefault()}},[n,r,b.paused]);return s.jsx(Et.div,{tabIndex:-1,...o,ref:g,onKeyDown:N})});ny.displayName=bP;function vP(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(go(r,{select:e}),document.activeElement!==n)return}function NP(t){const e=Ck(t),n=Q1(e,t),r=Q1(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 Q1(t,e){for(const n of t)if(!wP(n,{upTo:e}))return n}function wP(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 jP(t){return t instanceof HTMLInputElement&&"select"in t}function go(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&jP(t)&&e&&t.select()}}var Y1=kP();function kP(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=X1(t,e),t.unshift(e)},remove(e){var n;t=X1(t,e),(n=t[0])==null||n.resume()}}}function X1(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function SP(t){return t.filter(e=>e.tagName!=="A")}var CP="Portal",sy=y.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[a,i]=y.useState(!1);_s(()=>i(!0),[]);const o=n||a&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return o?$j.createPortal(s.jsx(Et.div,{...r,ref:e}),o):null});sy.displayName=CP;function EP(t,e){return y.useReducer((n,r)=>e[n][r]??n,t)}var Ku=t=>{const{present:e,children:n}=t,r=TP(e),a=typeof n=="function"?n({present:r.isPresent}):y.Children.only(n),i=Qt(r.ref,MP(a));return typeof n=="function"||r.isPresent?y.cloneElement(a,{ref:i}):null};Ku.displayName="Presence";function TP(t){const[e,n]=y.useState(),r=y.useRef(null),a=y.useRef(t),i=y.useRef("none"),o=t?"mounted":"unmounted",[c,u]=EP(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const h=Xh(r.current);i.current=c==="mounted"?h:"none"},[c]),_s(()=>{const h=r.current,f=a.current;if(f!==t){const g=i.current,b=Xh(h);t?u("MOUNT"):b==="none"||(h==null?void 0:h.display)==="none"?u("UNMOUNT"):u(f&&g!==b?"ANIMATION_OUT":"UNMOUNT"),a.current=t}},[t,u]),_s(()=>{if(e){let h;const f=e.ownerDocument.defaultView??window,m=b=>{const j=Xh(r.current).includes(CSS.escape(b.animationName));if(b.target===e&&j&&(u("ANIMATION_END"),!a.current)){const v=e.style.animationFillMode;e.style.animationFillMode="forwards",h=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=v)})}},g=b=>{b.target===e&&(i.current=Xh(r.current))};return e.addEventListener("animationstart",g),e.addEventListener("animationcancel",m),e.addEventListener("animationend",m),()=>{f.clearTimeout(h),e.removeEventListener("animationstart",g),e.removeEventListener("animationcancel",m),e.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[e,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:y.useCallback(h=>{r.current=h?getComputedStyle(h):null,n(h)},[])}}function Xh(t){return(t==null?void 0:t.animationName)||"none"}function MP(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 Ug=0;function Ek(){y.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??Z1()),document.body.insertAdjacentElement("beforeend",t[1]??Z1()),Ug++,()=>{Ug===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Ug--}},[])}function Z1(){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 Va=function(){return Va=Object.assign||function(e){for(var n,r=1,a=arguments.length;r"u")return KP;var e=qP(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])}},JP=Ik(),Yc="data-scroll-locked",QP=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(IP,` { + overflow: hidden `).concat(r,`; + padding-right: `).concat(c,"px ").concat(r,`; + } + body[`).concat(Yc,`] { + 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(Nf,` { + right: `).concat(c,"px ").concat(r,`; + } + + .`).concat(wf,` { + margin-right: `).concat(c,"px ").concat(r,`; + } + + .`).concat(Nf," .").concat(Nf,` { + right: 0 `).concat(r,`; + } + + .`).concat(wf," .").concat(wf,` { + margin-right: 0 `).concat(r,`; + } + + body[`).concat(Yc,`] { + `).concat(PP,": ").concat(c,`px; + } +`)},tN=function(){var t=parseInt(document.body.getAttribute(Yc)||"0",10);return isFinite(t)?t:0},YP=function(){y.useEffect(function(){return document.body.setAttribute(Yc,(tN()+1).toString()),function(){var t=tN()-1;t<=0?document.body.removeAttribute(Yc):document.body.setAttribute(Yc,t.toString())}},[])},XP=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,a=r===void 0?"margin":r;YP();var i=y.useMemo(function(){return GP(a)},[a]);return y.createElement(JP,{styles:QP(i,!e,a,n?"":"!important")})},Jx=!1;if(typeof window<"u")try{var Zh=Object.defineProperty({},"passive",{get:function(){return Jx=!0,!0}});window.addEventListener("test",Zh,Zh),window.removeEventListener("test",Zh,Zh)}catch{Jx=!1}var Oc=Jx?{passive:!1}:!1,ZP=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&&!ZP(t)&&n[e]==="visible")},eR=function(t){return Pk(t,"overflowY")},tR=function(t){return Pk(t,"overflowX")},nN=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=Rk(t,r);if(a){var i=Lk(t,r),o=i[1],c=i[2];if(o>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},nR=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},sR=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},Rk=function(t,e){return t==="v"?eR(e):tR(e)},Lk=function(t,e){return t==="v"?nR(e):sR(e)},rR=function(t,e){return t==="h"&&e==="rtl"?-1:1},aR=function(t,e,n,r,a){var i=rR(t,window.getComputedStyle(e).direction),o=i*r,c=n.target,u=e.contains(c),h=!1,f=o>0,m=0,g=0;do{if(!c)break;var b=Lk(t,c),N=b[0],j=b[1],v=b[2],k=j-v-i*N;(N||k)&&Rk(t,c)&&(m+=k,g+=N);var T=c.parentNode;c=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!u&&c!==document.body||u&&(e.contains(c)||e===c));return(f&&Math.abs(m)<1||!f&&Math.abs(g)<1)&&(h=!0),h},ef=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},sN=function(t){return[t.deltaX,t.deltaY]},rN=function(t){return t&&"current"in t?t.current:t},iR=function(t,e){return t[0]===e[0]&&t[1]===e[1]},oR=function(t){return` + .block-interactivity-`.concat(t,` {pointer-events: none;} + .allow-interactivity-`).concat(t,` {pointer-events: all;} +`)},lR=0,Dc=[];function cR(t){var e=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),a=y.useState(lR++)[0],i=y.useState(Ik)[0],o=y.useRef(t);y.useEffect(function(){o.current=t},[t]),y.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(a));var j=AP([t.lockRef.current],(t.shards||[]).map(rN),!0).filter(Boolean);return j.forEach(function(v){return v.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),j.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(a))})}}},[t.inert,t.lockRef.current,t.shards]);var c=y.useCallback(function(j,v){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!o.current.allowPinchZoom;var k=ef(j),T=n.current,C="deltaX"in j?j.deltaX:T[0]-k[0],R="deltaY"in j?j.deltaY:T[1]-k[1],O,U=j.target,P=Math.abs(C)>Math.abs(R)?"h":"v";if("touches"in j&&P==="h"&&U.type==="range")return!1;var z=window.getSelection(),L=z&&z.anchorNode,Q=L?L===U||L.contains(U):!1;if(Q)return!1;var se=nN(P,U);if(!se)return!0;if(se?O=P:(O=P==="v"?"h":"v",se=nN(P,U)),!se)return!1;if(!r.current&&"changedTouches"in j&&(C||R)&&(r.current=O),!O)return!0;var $=r.current||O;return aR($,v,j,$==="h"?C:R)},[]),u=y.useCallback(function(j){var v=j;if(!(!Dc.length||Dc[Dc.length-1]!==i)){var k="deltaY"in v?sN(v):ef(v),T=e.current.filter(function(O){return O.name===v.type&&(O.target===v.target||v.target===O.shadowParent)&&iR(O.delta,k)})[0];if(T&&T.should){v.cancelable&&v.preventDefault();return}if(!T){var C=(o.current.shards||[]).map(rN).filter(Boolean).filter(function(O){return O.contains(v.target)}),R=C.length>0?c(v,C[0]):!o.current.noIsolation;R&&v.cancelable&&v.preventDefault()}}},[]),h=y.useCallback(function(j,v,k,T){var C={name:j,delta:v,target:k,should:T,shadowParent:dR(k)};e.current.push(C),setTimeout(function(){e.current=e.current.filter(function(R){return R!==C})},1)},[]),f=y.useCallback(function(j){n.current=ef(j),r.current=void 0},[]),m=y.useCallback(function(j){h(j.type,sN(j),j.target,c(j,t.lockRef.current))},[]),g=y.useCallback(function(j){h(j.type,ef(j),j.target,c(j,t.lockRef.current))},[]);y.useEffect(function(){return Dc.push(i),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:g}),document.addEventListener("wheel",u,Oc),document.addEventListener("touchmove",u,Oc),document.addEventListener("touchstart",f,Oc),function(){Dc=Dc.filter(function(j){return j!==i}),document.removeEventListener("wheel",u,Oc),document.removeEventListener("touchmove",u,Oc),document.removeEventListener("touchstart",f,Oc)}},[]);var b=t.removeScrollBar,N=t.inert;return y.createElement(y.Fragment,null,N?y.createElement(i,{styles:oR(a)}):null,b?y.createElement(XP,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function dR(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const uR=zP(Ak,cR);var ry=y.forwardRef(function(t,e){return y.createElement($p,Va({},t,{ref:e,sideCar:uR}))});ry.classNames=$p.classNames;var hR=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},_c=new WeakMap,tf=new WeakMap,nf={},Gg=0,Ok=function(t){return t&&(t.host||Ok(t.parentNode))},fR=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=Ok(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})},pR=function(t,e,n,r){var a=fR(e,Array.isArray(t)?t:[t]);nf[n]||(nf[n]=new WeakMap);var i=nf[n],o=[],c=new Set,u=new Set(a),h=function(m){!m||c.has(m)||(c.add(m),h(m.parentNode))};a.forEach(h);var f=function(m){!m||u.has(m)||Array.prototype.forEach.call(m.children,function(g){if(c.has(g))f(g);else try{var b=g.getAttribute(r),N=b!==null&&b!=="false",j=(_c.get(g)||0)+1,v=(i.get(g)||0)+1;_c.set(g,j),i.set(g,v),o.push(g),j===1&&N&&tf.set(g,!0),v===1&&g.setAttribute(n,"true"),N||g.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",g,k)}})};return f(e),c.clear(),Gg++,function(){o.forEach(function(m){var g=_c.get(m)-1,b=i.get(m)-1;_c.set(m,g),i.set(m,b),g||(tf.has(m)||m.removeAttribute(r),tf.delete(m)),b||m.removeAttribute(n)}),Gg--,Gg||(_c=new WeakMap,_c=new WeakMap,tf=new WeakMap,nf={})}},Dk=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),a=hR(t);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),pR(r,a,n,"aria-hidden")):function(){return null}},zp="Dialog",[_k]=qo(zp),[mR,Na]=_k(zp),$k=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]=Fl({prop:r,defaultProp:a??!1,onChange:i,caller:zp});return s.jsx(mR,{scope:e,triggerRef:c,contentRef:u,contentId:Ro(),titleId:Ro(),descriptionId:Ro(),open:h,onOpenChange:f,onOpenToggle:y.useCallback(()=>f(m=>!m),[f]),modal:o,children:n})};$k.displayName=zp;var zk="DialogTrigger",gR=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Na(zk,n),i=Qt(e,a.triggerRef);return s.jsx(Et.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":oy(a.open),...r,ref:i,onClick:jt(t.onClick,a.onOpenToggle)})});gR.displayName=zk;var ay="DialogPortal",[xR,Fk]=_k(ay,{forceMount:void 0}),Bk=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:a}=t,i=Na(ay,e);return s.jsx(xR,{scope:e,forceMount:n,children:y.Children.map(r,o=>s.jsx(Ku,{present:n||i.open,children:s.jsx(sy,{asChild:!0,container:a,children:o})}))})};Bk.displayName=ay;var $f="DialogOverlay",Vk=y.forwardRef((t,e)=>{const n=Fk($f,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=Na($f,t.__scopeDialog);return i.modal?s.jsx(Ku,{present:r||i.open,children:s.jsx(bR,{...a,ref:e})}):null});Vk.displayName=$f;var yR=Au("DialogOverlay.RemoveScroll"),bR=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Na($f,n);return s.jsx(ry,{as:yR,allowPinchZoom:!0,shards:[a.contentRef],children:s.jsx(Et.div,{"data-state":oy(a.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Bl="DialogContent",Hk=y.forwardRef((t,e)=>{const n=Fk(Bl,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=Na(Bl,t.__scopeDialog);return s.jsx(Ku,{present:r||i.open,children:i.modal?s.jsx(vR,{...a,ref:e}):s.jsx(NR,{...a,ref:e})})});Hk.displayName=Bl;var vR=y.forwardRef((t,e)=>{const n=Na(Bl,t.__scopeDialog),r=y.useRef(null),a=Qt(e,n.contentRef,r);return y.useEffect(()=>{const i=r.current;if(i)return Dk(i)},[]),s.jsx(Uk,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:jt(t.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:jt(t.onPointerDownOutside,i=>{const o=i.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0;(o.button===2||c)&&i.preventDefault()}),onFocusOutside:jt(t.onFocusOutside,i=>i.preventDefault())})}),NR=y.forwardRef((t,e)=>{const n=Na(Bl,t.__scopeDialog),r=y.useRef(!1),a=y.useRef(!1);return s.jsx(Uk,{...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()}})}),Uk=y.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,...o}=t,c=Na(Bl,n),u=y.useRef(null),h=Qt(e,u);return Ek(),s.jsxs(s.Fragment,{children:[s.jsx(ny,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:s.jsx(ty,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":oy(c.open),...o,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(wR,{titleId:c.titleId}),s.jsx(kR,{contentRef:u,descriptionId:c.descriptionId})]})]})}),iy="DialogTitle",Wk=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Na(iy,n);return s.jsx(Et.h2,{id:a.titleId,...r,ref:e})});Wk.displayName=iy;var Kk="DialogDescription",qk=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Na(Kk,n);return s.jsx(Et.p,{id:a.descriptionId,...r,ref:e})});qk.displayName=Kk;var Gk="DialogClose",Jk=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=Na(Gk,n);return s.jsx(Et.button,{type:"button",...r,ref:e,onClick:jt(t.onClick,()=>a.onOpenChange(!1))})});Jk.displayName=Gk;function oy(t){return t?"open":"closed"}var Qk="DialogTitleWarning",[mH,Yk]=YI(Qk,{contentName:Bl,titleName:iy,docsSlug:"dialog"}),wR=({titleId:t})=>{const e=Yk(Qk),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},jR="DialogDescriptionWarning",kR=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Yk(jR).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},SR=$k,CR=Bk,ER=Vk,TR=Hk,MR=Wk,AR=qk,IR=Jk;function Dt(t){return s.jsx(SR,{"data-slot":"dialog",...t})}function PR(t){return s.jsx(CR,{...t})}const Xk=y.forwardRef(({className:t,...e},n)=>s.jsx(ER,{ref:n,className:zt("fixed inset-0 z-50 bg-black/50",t),...e}));Xk.displayName="DialogOverlay";const Ot=y.forwardRef(({className:t,children:e,showCloseButton:n=!0,...r},a)=>s.jsxs(PR,{children:[s.jsx(Xk,{}),s.jsxs(TR,{ref:a,"aria-describedby":void 0,className:zt("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(IR,{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(ns,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ot.displayName="DialogContent";function _t({className:t,...e}){return s.jsx("div",{className:zt("flex flex-col gap-2 text-center sm:text-left",t),...e})}function rn({className:t,...e}){return s.jsx("div",{className:zt("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function $t(t){return s.jsx(MR,{className:"text-lg font-semibold leading-none",...t})}function nd(t){return s.jsx(AR,{className:"text-sm text-muted-foreground",...t})}const RR=uk("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?lk:"span";return s.jsx(a,{className:zt(RR({variant:e}),t),...r})}var LR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],OR=LR.reduce((t,e)=>{const n=ok(`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}},{}),DR="Label",Zk=y.forwardRef((t,e)=>s.jsx(OR.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())}}));Zk.displayName=DR;var e2=Zk;const te=y.forwardRef(({className:t,...e},n)=>s.jsx(e2,{ref:n,className:zt("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));te.displayName=e2.displayName;function ly(t){const e=t+"CollectionProvider",[n,r]=qo(e),[a,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=j=>{const{scope:v,children:k}=j,T=Ks.useRef(null),C=Ks.useRef(new Map).current;return s.jsx(a,{scope:v,itemMap:C,collectionRef:T,children:k})};o.displayName=e;const c=t+"CollectionSlot",u=Au(c),h=Ks.forwardRef((j,v)=>{const{scope:k,children:T}=j,C=i(c,k),R=Qt(v,C.collectionRef);return s.jsx(u,{ref:R,children:T})});h.displayName=c;const f=t+"CollectionItemSlot",m="data-radix-collection-item",g=Au(f),b=Ks.forwardRef((j,v)=>{const{scope:k,children:T,...C}=j,R=Ks.useRef(null),O=Qt(v,R),U=i(f,k);return Ks.useEffect(()=>(U.itemMap.set(R,{ref:R,...C}),()=>void U.itemMap.delete(R))),s.jsx(g,{[m]:"",ref:O,children:T})});b.displayName=f;function N(j){const v=i(t+"CollectionConsumer",j);return Ks.useCallback(()=>{const T=v.collectionRef.current;if(!T)return[];const C=Array.from(T.querySelectorAll(`[${m}]`));return Array.from(v.itemMap.values()).sort((U,P)=>C.indexOf(U.ref.current)-C.indexOf(P.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:o,Slot:h,ItemSlot:b},N,r]}var _R=y.createContext(void 0);function Fp(t){const e=y.useContext(_R);return t||e||"ltr"}var Jg="rovingFocusGroup.onEntryFocus",$R={bubbles:!1,cancelable:!0},qu="RovingFocusGroup",[Qx,t2,zR]=ly(qu),[FR,n2]=qo(qu,[zR]),[BR,VR]=FR(qu),s2=y.forwardRef((t,e)=>s.jsx(Qx.Provider,{scope:t.__scopeRovingFocusGroup,children:s.jsx(Qx.Slot,{scope:t.__scopeRovingFocusGroup,children:s.jsx(HR,{...t,ref:e})})}));s2.displayName=qu;var HR=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,g=y.useRef(null),b=Qt(e,g),N=Fp(i),[j,v]=Fl({prop:o,defaultProp:c??null,onChange:u,caller:qu}),[k,T]=y.useState(!1),C=Fo(h),R=t2(n),O=y.useRef(!1),[U,P]=y.useState(0);return y.useEffect(()=>{const z=g.current;if(z)return z.addEventListener(Jg,C),()=>z.removeEventListener(Jg,C)},[C]),s.jsx(BR,{scope:n,orientation:r,dir:N,loop:a,currentTabStopId:j,onItemFocus:y.useCallback(z=>v(z),[v]),onItemShiftTab:y.useCallback(()=>T(!0),[]),onFocusableItemAdd:y.useCallback(()=>P(z=>z+1),[]),onFocusableItemRemove:y.useCallback(()=>P(z=>z-1),[]),children:s.jsx(Et.div,{tabIndex:k||U===0?-1:0,"data-orientation":r,...m,ref:b,style:{outline:"none",...t.style},onMouseDown:jt(t.onMouseDown,()=>{O.current=!0}),onFocus:jt(t.onFocus,z=>{const L=!O.current;if(z.target===z.currentTarget&&L&&!k){const Q=new CustomEvent(Jg,$R);if(z.currentTarget.dispatchEvent(Q),!Q.defaultPrevented){const se=R().filter(I=>I.focusable),$=se.find(I=>I.active),ie=se.find(I=>I.id===j),me=[$,ie,...se].filter(Boolean).map(I=>I.ref.current);i2(me,f)}}O.current=!1}),onBlur:jt(t.onBlur,()=>T(!1))})})}),r2="RovingFocusGroupItem",a2=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:i,children:o,...c}=t,u=Ro(),h=i||u,f=VR(r2,n),m=f.currentTabStopId===h,g=t2(n),{onFocusableItemAdd:b,onFocusableItemRemove:N,currentTabStopId:j}=f;return y.useEffect(()=>{if(r)return b(),()=>N()},[r,b,N]),s.jsx(Qx.ItemSlot,{scope:n,id:h,focusable:r,active:a,children:s.jsx(Et.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:jt(t.onMouseDown,v=>{r?f.onItemFocus(h):v.preventDefault()}),onFocus:jt(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:jt(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){f.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const k=KR(v,f.orientation,f.dir);if(k!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let C=g().filter(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(v.currentTarget);C=f.loop?qR(C,R+1):C.slice(R+1)}setTimeout(()=>i2(C))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:j!=null}):o})})});a2.displayName=r2;var UR={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function WR(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function KR(t,e,n){const r=WR(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return UR[r]}function i2(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function qR(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var GR=s2,JR=a2,Bp="Tabs",[QR]=qo(Bp,[n2]),o2=n2(),[YR,cy]=QR(Bp),l2=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:i,orientation:o="horizontal",dir:c,activationMode:u="automatic",...h}=t,f=Fp(c),[m,g]=Fl({prop:r,onChange:a,defaultProp:i??"",caller:Bp});return s.jsx(YR,{scope:n,baseId:Ro(),value:m,onValueChange:g,orientation:o,dir:f,activationMode:u,children:s.jsx(Et.div,{dir:f,"data-orientation":o,...h,ref:e})})});l2.displayName=Bp;var c2="TabsList",d2=y.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...a}=t,i=cy(c2,n),o=o2(n);return s.jsx(GR,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:s.jsx(Et.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:e})})});d2.displayName=c2;var u2="TabsTrigger",h2=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...i}=t,o=cy(u2,n),c=o2(n),u=m2(o.baseId,r),h=g2(o.baseId,r),f=r===o.value;return s.jsx(JR,{asChild:!0,...c,focusable:!a,active:f,children:s.jsx(Et.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:jt(t.onMouseDown,m=>{!a&&m.button===0&&m.ctrlKey===!1?o.onValueChange(r):m.preventDefault()}),onKeyDown:jt(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&o.onValueChange(r)}),onFocus:jt(t.onFocus,()=>{const m=o.activationMode!=="manual";!f&&!a&&m&&o.onValueChange(r)})})})});h2.displayName=u2;var f2="TabsContent",p2=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:a,children:i,...o}=t,c=cy(f2,n),u=m2(c.baseId,r),h=g2(c.baseId,r),f=r===c.value,m=y.useRef(f);return y.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),s.jsx(Ku,{present:a||f,children:({present:g})=>s.jsx(Et.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!g,id:h,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:g&&i})})});p2.displayName=f2;function m2(t,e){return`${t}-trigger-${e}`}function g2(t,e){return`${t}-content-${e}`}var XR=l2,x2=d2,y2=h2,b2=p2;const sd=XR,Vl=y.forwardRef(({className:t,...e},n)=>s.jsx(x2,{ref:n,className:zt("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));Vl.displayName=x2.displayName;const en=y.forwardRef(({className:t,...e},n)=>s.jsx(y2,{ref:n,className:zt("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...e}));en.displayName=y2.displayName;const tn=y.forwardRef(({className:t,...e},n)=>s.jsx(b2,{ref:n,className:zt("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));tn.displayName=b2.displayName;function dy(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 uy(t){const[e,n]=y.useState(void 0);return _s(()=>{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 Vp="Switch",[ZR]=qo(Vp),[e8,t8]=ZR(Vp),v2=y.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:i,required:o,disabled:c,value:u="on",onCheckedChange:h,form:f,...m}=t,[g,b]=y.useState(null),N=Qt(e,C=>b(C)),j=y.useRef(!1),v=g?f||!!g.closest("form"):!0,[k,T]=Fl({prop:a,defaultProp:i??!1,onChange:h,caller:Vp});return s.jsxs(e8,{scope:n,checked:k,disabled:c,children:[s.jsx(Et.button,{type:"button",role:"switch","aria-checked":k,"aria-required":o,"data-state":k2(k),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:N,onClick:jt(t.onClick,C=>{T(R=>!R),v&&(j.current=C.isPropagationStopped(),j.current||C.stopPropagation())})}),v&&s.jsx(j2,{control:g,bubbles:!j.current,name:r,value:u,checked:k,required:o,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});v2.displayName=Vp;var N2="SwitchThumb",w2=y.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,a=t8(N2,n);return s.jsx(Et.span,{"data-state":k2(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:e})});w2.displayName=N2;var n8="SwitchBubbleInput",j2=y.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...a},i)=>{const o=y.useRef(null),c=Qt(o,i),u=dy(n),h=uy(e);return y.useEffect(()=>{const f=o.current;if(!f)return;const m=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(m,"checked").set;if(u!==n&&b){const N=new Event("click",{bubbles:r});b.call(f,n),f.dispatchEvent(N)}},[u,n,r]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:c,style:{...a.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});j2.displayName=n8;function k2(t){return t?"checked":"unchecked"}var S2=v2,s8=w2;const Ut=y.forwardRef(({className:t,...e},n)=>s.jsx(S2,{className:zt("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(s8,{className:zt("pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Ut.displayName=S2.displayName;const r8={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 a8(t){return r8[t]||t||"行为"}function i8(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 hy({open:t,onClose:e,userId:n,onUserUpdated:r}){var Jr,Bs,Qs,fr,Ys,ka;const[a,i]=y.useState(null),[o,c]=y.useState([]),[u,h]=y.useState({}),[f,m]=y.useState([]),[g,b]=y.useState(null),[N,j]=y.useState(null),[v,k]=y.useState(!1),[T,C]=y.useState(!1),[R,O]=y.useState(!1),[U,P]=y.useState("info"),[z,L]=y.useState(""),[Q,se]=y.useState(""),[$,ie]=y.useState(""),[oe,me]=y.useState([]),[I,Y]=y.useState(""),[F,ge]=y.useState(""),[X,V]=y.useState(""),[W,fe]=y.useState(!1),[he,de]=y.useState({isVip:!1,vipExpireDate:"",vipRole:"",vipName:"",vipProject:"",vipContact:"",vipBio:""}),[D,q]=y.useState([]),[_,Z]=y.useState(!1),[re,we]=y.useState(""),[Fe,Ue]=y.useState(""),[wt,jn]=y.useState(!1),[pt,At]=y.useState(!1),[fn,Vn]=y.useState(null),[pn,Wt]=y.useState(null),[bn,Mn]=y.useState(""),[Hn,rs]=y.useState(""),[Rt,vn]=y.useState(""),[Ne,Me]=y.useState(!1),[We,rt]=y.useState(null),[Lt,kt]=y.useState(!1),[$e,H]=y.useState({}),[Qe,bt]=y.useState([]);y.useEffect(()=>{t&&n&&(kt(!1),P("info"),Vn(null),Wt(null),rt(null),ge(""),V(""),yt(),Oe("/api/db/vip-roles").then(ce=>{ce!=null&&ce.success&&ce.data&&q(ce.data)}).catch(()=>{}))},[t,n]),y.useEffect(()=>{t&&Oe("/api/admin/mbti-avatars").then(ce=>{ce!=null&&ce.avatars&&typeof ce.avatars=="object"?H(ce.avatars):H({})}).catch(()=>H({}))},[t]);const Ft=(ce,ve)=>{const Pt=(ce||"").trim();if(Pt)return ya(Pt);const Yt=(ve||"").trim().toUpperCase();return/^[EI][NS][FT][JP]$/.test(Yt)?($e[Yt]||"").trim():""};async function yt(){if(n){k(!0);try{const ce=await Oe(`/api/db/users?id=${encodeURIComponent(n)}`);if(ce!=null&&ce.success&&ce.user){const ve=ce.user;i(ve),L(ve.phone||""),se(ve.wechatId||""),ie(ve.nickname||""),Mn(ve.phone||""),rs(ve.wechatId||""),vn(ve.openId||"");try{me(typeof ve.tags=="string"?JSON.parse(ve.tags||"[]"):[])}catch{me([])}de({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 Pt=ve.tracks||[];c(Pt.map(Yt=>({...Yt,actionLabel:Yt.actionLabel||Yt.action,timeAgo:Yt.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?j(ve.data):j(null)}catch{j(null)}try{const ve=await Oe(`/api/orders?userId=${encodeURIComponent(n)}&status=paid&pageSize=50`);ve!=null&&ve.success&&ve.orders?bt(ve.orders):bt([])}catch{bt([])}}catch(ce){console.error("Load user detail error:",ce)}finally{k(!1)}}}async function ht(){if(!(a!=null&&a.phone)){G.info("用户未绑定手机号,无法同步");return}C(!0);try{const ce=await Nt("/api/ckb/sync",{action:"full_sync",phone:a.phone,userId:a.id});ce!=null&&ce.success?(G.success("同步成功"),yt()):G.error("同步失败: "+(ce==null?void 0:ce.error))}catch(ce){console.error("Sync CKB error:",ce),G.error("同步失败")}finally{C(!1)}}async function It(){if(a){if(he.isVip&&!he.vipExpireDate.trim()){G.error("开启 VIP 请填写有效到期日");return}O(!0);try{const ce={id:a.id,phone:z.trim()||void 0,wechatId:Q.trim(),nickname:$||void 0,tags:JSON.stringify(oe),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 Zt("/api/db/users",ce);ve!=null&&ve.success?(G.success("保存成功"),yt(),r==null||r()):G.error("保存失败: "+(ve==null?void 0:ve.error))}catch(ce){console.error("Save user error:",ce),G.error("保存失败")}finally{O(!1)}}}const Kt=()=>{I&&!oe.includes(I)&&(me([...oe,I]),Y(""))},kn=ce=>me(oe.filter(ve=>ve!==ce));async function Es(){if(a){if(!F){G.error("请输入新密码");return}if(F!==X){G.error("两次密码不一致");return}if(F.length<6){G.error("密码至少 6 位");return}fe(!0);try{const ce=await Zt("/api/db/users",{id:a.id,password:F});ce!=null&&ce.success?(G.success("修改成功"),ge(""),V("")):G.error("修改失败: "+((ce==null?void 0:ce.error)||""))}catch{G.error("修改失败")}finally{fe(!1)}}}async function Ts(){if(!a)return;const ce=parseFloat(re);if(Number.isNaN(ce)||ce===0){G.error("请输入有效金额(正数增加、负数扣减)");return}jn(!0);try{const ve=await Nt(`/api/admin/users/${a.id}/balance/adjust`,{amount:ce,remark:Fe||void 0});ve!=null&&ve.success?(G.success("余额已调整"),Z(!1),we(""),Ue(""),yt(),r==null||r()):G.error("调整失败: "+((ve==null?void 0:ve.error)||""))}catch{G.error("调整失败")}finally{jn(!1)}}async function Vi(){if(!bn&&!Rt&&!Hn){Wt("请至少输入手机号、微信号或 OpenID 中的一项");return}At(!0),Wt(null),Vn(null);try{const ce=new URLSearchParams;bn&&ce.set("phone",bn),Rt&&ce.set("openId",Rt),Hn&&ce.set("wechatId",Hn);const ve=await Oe(`/api/admin/shensheshou/query?${ce}`);ve!=null&&ve.success&&ve.data?(Vn(ve.data),a&&await ja(ve.data)):Wt((ve==null?void 0:ve.error)||"未查询到数据,该用户可能未在神射手收录")}catch(ce){console.error("SSS query error:",ce),Wt("请求失败,请检查神射手接口配置")}finally{At(!1)}}async function ja(ce){if(a)try{await Nt("/api/admin/shensheshou/enrich",{userId:a.id,phone:bn||a.phone||"",openId:Rt||a.openId||"",wechatId:Hn||a.wechatId||""}),yt()}catch(ve){console.error("SSS enrich error:",ve)}}async function Xa(){if(a){Me(!0),rt(null);try{const ce=Array.from(new Set(o.filter(as=>as.action==="view_chapter"||as.action==="purchase"||as.action==="first_pay").map(as=>(as.chapterTitle||as.target||"").trim()).filter(Boolean))).slice(0,12),ve={viewChapter:u.view_chapter||0,purchase:u.purchase||0,firstPay:u.first_pay||0},Pt=ce.length>0?`意向章节:${ce.join("、")}`:"",Yt={users:[{phone:a.phone||"",name:a.nickname||"",openId:a.openId||"",tags:oe,purchaseIntent:ve,purchaseIntentChapters:ce,remark:Pt}]},nn=await Nt("/api/admin/shensheshou/ingest",Yt);nn!=null&&nn.success&&nn.data?rt(nn.data):rt({error:(nn==null?void 0:nn.error)||"推送失败"})}catch(ce){console.error("SSS ingest error:",ce),rt({error:"请求失败"})}finally{Me(!1)}}}const Za=ce=>{const Pt={view_chapter:ur,purchase:mu,match:Kn,login:Ti,register:Ti,share:Pi,bind_phone:O1,bind_wechat:_M,fill_profile:gu,fill_avatar:Ti,visit_page:pa,first_pay:mu,vip_activate:Qc,click_super:Kn,lead_submit:O1,withdraw:Hx,referral_bind:Pi,card_click:Ti,btn_click:zo,tab_click:pa,nav_click:pa,page_view:pa,search:pa}[ce]||Fx;return s.jsx(Pt,{className:"w-4 h-4"})};function Mr(ce){const ve=String(ce||"").trim();return ve.length>22&&/^[a-zA-Z0-9_-]+$/.test(ve)}const Ar=y.useMemo(()=>i8(u,a),[u,a]);function Ir(){const ce=[...oe];for(const ve of Ar)ce.includes(ve)||ce.push(ve);me(ce),G.success("已将旅程推断标签合并到已选")}return t?s.jsxs(s.Fragment,{children:[s.jsx(Dt,{open:t,onOpenChange:()=>e(),children:s.jsxs(Ot,{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(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(Ti,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(a==null?void 0:a.phone)&&s.jsx(Be,{className:"bg-green-500/20 text-green-400 border-0 ml-2",children:"已绑定手机"}),(a==null?void 0:a.isVip)&&s.jsx(Be,{className:"bg-amber-500/20 text-amber-400 border-0",children:"VIP"})]})}),v?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):a?s.jsxs("div",{className:"flex flex-col min-h-0 flex-1 overflow-hidden",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row gap-2.5 p-2.5 bg-[#0a1628] rounded-lg mb-2 shrink-0",children:[s.jsxs("div",{className:"flex gap-2.5 min-w-0 flex-1",children:[s.jsx("div",{className:"w-11 h-11 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-lg text-[#38bdac] shrink-0",children:Ft(a.avatar,a.mbti)&&!Lt?s.jsx("img",{src:Ft(a.avatar,a.mbti),className:"w-full h-full rounded-full object-cover",alt:"",onError:()=>kt(!0)}):((Jr=a.nickname)==null?void 0:Jr.charAt(0))||"?"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.jsx("h3",{className:"text-base font-bold text-white leading-tight",children:a.nickname}),a.isAdmin&&s.jsx(Be,{className:"bg-purple-500/20 text-purple-400 border-0 text-[10px] py-0",children:"管理员"}),a.hasFullBook&&s.jsx(Be,{className:"bg-green-500/20 text-green-400 border-0 text-[10px] py-0",children:"全书已购"}),a.vipRole&&s.jsx(Be,{className:"bg-amber-500/20 text-amber-400 border-0 text-[10px] py-0",children:a.vipRole})]}),a.referralCode&&s.jsxs("p",{className:"text-[10px] text-gray-500 mt-0.5",children:["推荐码 ",s.jsx("code",{className:"text-[#38bdac]",children:a.referralCode})]}),s.jsxs("div",{className:"mt-1 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-1.5 text-[11px]",children:[s.jsxs("div",{className:"px-2 py-1 rounded bg-[#162840] border border-gray-700/50",children:[s.jsx("span",{className:"text-gray-500",children:"昵称"}),s.jsx("p",{className:"text-white truncate",children:$||a.nickname||"—"})]}),s.jsxs("div",{className:"px-2 py-1 rounded bg-[#162840] border border-gray-700/50",children:[s.jsx("span",{className:"text-gray-500",children:"手机号"}),s.jsx("p",{className:"text-white truncate",children:z||"—"})]}),s.jsxs("div",{className:"px-2 py-1 rounded bg-[#162840] border border-gray-700/50",children:[s.jsx("span",{className:"text-gray-500",children:"微信标识"}),s.jsx("p",{className:"text-white truncate",children:Q||"—"})]}),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:()=>{we(""),Ue(""),Z(!0)},children:"调整"})]}),s.jsxs("p",{className:"text-sm font-bold text-white leading-tight",children:["¥",((N==null?void 0:N.balance)??0).toFixed(2)]}),s.jsx("p",{className:"text-[9px] text-gray-600",children:"可消费/抵扣"})]}),s.jsxs("div",{className:"rounded-md bg-[#162840] px-2 py-1.5 border border-gray-700/40",children:[s.jsx("p",{className:"text-[9px] text-gray-500",children:"推荐人数"}),s.jsx("p",{className:"text-sm font-bold text-white leading-tight",children:a.referralCount??0}),s.jsx("p",{className:"text-[9px] text-gray-600",children:a.createdAt?`注册 ${new Date(a.createdAt).toLocaleDateString()}`:"—"})]})]})]}),s.jsxs(sd,{value:U,onValueChange:P,className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[s.jsxs(Vl,{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(en,{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(en,{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(pa,{className:"w-3 h-3 mr-0.5"}),"旅程与轨迹"]}),s.jsx(en,{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(en,{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(tn,{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(te,{className:"text-gray-400 text-[11px]",children:"昵称"}),s.jsx(le,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"昵称",value:$,onChange:ce=>ie(ce.target.value)})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{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:z,onChange:ce=>L(ce.target.value)})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{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:Q,onChange:ce=>se(ce.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(sk,{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(Qc,{className:"w-3.5 h-3.5 text-amber-400 shrink-0"}),s.jsx("span",{className:"text-white text-xs font-medium",children:"超级个体"}),a.isVip&&s.jsx(Be,{className:"bg-amber-500/20 text-amber-400 border-0 text-[10px] py-0 shrink-0",children:a.vipRole||"VIP"})]}),s.jsx(Ut,{className:"scale-90",checked:he.isVip,onCheckedChange:ce=>de(ve=>({...ve,isVip:ce}))})]}),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(te,{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:he.vipExpireDate,onChange:ce=>de(ve=>({...ve,vipExpireDate:ce.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(te,{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:ce=>de(ve=>({...ve,vipRole:ce.target.value})),children:[s.jsx("option",{value:"",children:"请选择"}),D.map(ce=>s.jsx("option",{value:ce.name,children:ce.name},ce.id))]})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(te,{className:"text-gray-500 text-[10px]",children:"展示名"}),s.jsx(le,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"展示名",value:he.vipName,onChange:ce=>de(ve=>({...ve,vipName:ce.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(te,{className:"text-gray-500 text-[10px]",children:"项目"}),s.jsx(le,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"项目",value:he.vipProject,onChange:ce=>de(ve=>({...ve,vipProject:ce.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(te,{className:"text-gray-500 text-[10px]",children:"联系方式"}),s.jsx(le,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"微信/手机",value:he.vipContact,onChange:ce=>de(ve=>({...ve,vipContact:ce.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5 sm:col-span-2",children:[s.jsx(te,{className:"text-gray-500 text-[10px]",children:"简介"}),s.jsx(le,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"简短介绍",value:he.vipBio,onChange:ce=>de(ve=>({...ve,vipBio:ce.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(zo,{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:bn,onChange:ce=>Mn(ce.target.value)}),s.jsx(le,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:微信号",value:Hn,onChange:ce=>rs(ce.target.value)}),s.jsx(le,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:OpenID",value:Rt,onChange:ce=>vn(ce.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:Vi,disabled:pt,children:[pt?s.jsx(He,{className:"w-3 h-3 animate-spin"}):s.jsx(xa,{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:Xa,disabled:Ne||!a.phone,children:Ne?"推送…":"推神射手"}),s.jsx(J,{size:"sm",variant:"outline",className:"h-7 text-[11px] px-2",onClick:ht,disabled:T||!a.phone,children:T?"同步…":"存客宝同步"})]}),a.ckbSyncedAt&&s.jsxs("p",{className:"text-[10px] text-gray-500 mt-1",children:["最近存客宝同步:",new Date(a.ckbSyncedAt).toLocaleString()]}),pn&&s.jsx("p",{className:"mt-1 text-red-400 text-[11px]",children:pn}),fn&&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:fn.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:fn.user_level??"—"})]})]}),We&&s.jsx("p",{className:"mt-1 text-[11px]",children:We.error?s.jsx("span",{className:"text-red-400",children:String(We.error)}):s.jsx("span",{className:"text-green-400",children:"推送成功"})})]}),s.jsxs("div",{className:"p-2 rounded-lg bg-[#0a1628] border border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[s.jsx(Hx,{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:F,onChange:ce=>ge(ce.target.value)}),s.jsx(le,{type:"password",className:"bg-[#162840] border-gray-700 text-white h-7 text-xs flex-1",placeholder:"确认密码",value:X,onChange:ce=>V(ce.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:Es,disabled:W||!F||!X,children:W?"保存中":"确认修改"})]})]})]}),s.jsxs(tn,{value:"journey",className:"flex-1 min-h-0 overflow-y-auto space-y-2 pr-0.5",children:[Qe.length>0&&s.jsxs("div",{className:"p-2 bg-[#0a1628] rounded-lg border border-amber-500/20",children:[s.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[s.jsx(mu,{className:"w-3.5 h-3.5 text-amber-400"}),s.jsxs("span",{className:"text-white text-xs font-medium",children:["购买清单(",Qe.length," 笔)"]})]}),s.jsx("div",{className:"space-y-1 max-h-[120px] overflow-y-auto",children:Qe.map((ce,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:ce.productType==="fullbook"||ce.productType==="vip"?"全书/VIP":`章节 ${ce.productId||""}`}),s.jsxs("span",{className:"text-gray-500 ml-2",children:["¥",Number(ce.amount||0).toFixed(2)]})]}),s.jsx("span",{className:"text-gray-500 text-[10px] shrink-0",children:ce.createdAt?new Date(ce.createdAt).toLocaleString("zh-CN"):""})]},ce.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(pa,{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((ce,ve)=>ve[1]-ce[1]).map(([ce,ve])=>s.jsxs(Be,{variant:"outline",className:"text-[10px] border-gray-600 text-gray-300 bg-[#162840] py-0 h-5",children:[a8(ce)," ×",ve]},ce))})]}),s.jsx("div",{className:"space-y-1.5",children:o.length>0?o.map((ce,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:Za(ce.action)}),ve0?((g==null?void 0:g.visits)||[]).map((ce,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:["第 ",ce.seq||ve+1," 次 · ",ce.referrerNickname||"微信用户",ce.referrerId?`(${ce.referrerId})`:""]}),ce.page?s.jsx("p",{className:"text-gray-500 text-[10px] truncate",children:ce.page}):null]}),s.jsx("span",{className:"text-gray-500 text-[10px] shrink-0",children:ce.visitedAt?new Date(ce.visitedAt).toLocaleString():""})]},`${ce.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(Pi,{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((ce,ve)=>{var Yt;const Pt=ce;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:((Yt=Pt.nickname)==null?void 0:Yt.charAt(0))||"?"}),s.jsx("span",{className:"text-white truncate",children:Pt.nickname})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[Pt.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:Pt.createdAt?new Date(Pt.createdAt).toLocaleDateString():""})]})]},Pt.id||ve)}):s.jsx("p",{className:"text-gray-500 text-sm text-center py-3",children:"暂无推荐用户"})})]})]}),s.jsxs(tn,{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(gu,{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(Qj,{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:Ar.length===0,onClick:Ir,children:"合并到已选"})]}),Ar.length>0?s.jsx("div",{className:"flex flex-wrap gap-1",children:Ar.map(ce=>s.jsxs(Be,{variant:"outline",className:`text-[10px] py-0 h-5 border-cyan-500/30 ${oe.includes(ce)?"bg-cyan-500/15 text-cyan-200":"text-gray-300"}`,children:[oe.includes(ce)?"✓ ":"",ce]},ce))}):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(ce=>s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-500 text-[11px] mb-1",children:ce.category}),s.jsx("div",{className:"flex flex-wrap gap-1",children:ce.tags.map(ve=>s.jsxs("button",{type:"button",onClick:()=>{oe.includes(ve)?kn(ve):me([...oe,ve])},className:`px-1.5 py-0.5 rounded text-[11px] border transition-all ${oe.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:[oe.includes(ve)?"✓ ":"",ve]},ve))})]},ce.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:[oe.map((ce,ve)=>s.jsxs(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1 text-[11px] py-0",children:[ce,s.jsx("button",{type:"button",onClick:()=>kn(ce),className:"ml-1 hover:text-red-400",children:s.jsx(ns,{className:"w-3 h-3"})})]},ve)),oe.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:ce=>Y(ce.target.value),onKeyDown:ce=>ce.key==="Enter"&&Kt()}),s.jsx(J,{onClick:Kt,className:"bg-[#38bdac] hover:bg-[#2da396] h-8 text-xs px-3",children:"添加"})]})]})]}),(()=>{const ce=a.tags||a.ckbTags||"";let ve=[];try{const Yt=typeof ce=="string"?JSON.parse(ce||"[]"):[];ve=Array.isArray(Yt)?Yt:typeof ce=="string"?ce.split(","):[]}catch{ve=typeof ce=="string"?ce.split(","):[]}const Pt=ve.map(Yt=>String(Yt).trim()).filter(Boolean);return Pt.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(gu,{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:Pt.map((Yt,nn)=>s.jsx(Be,{className:"bg-purple-500/20 text-purple-400 border-0 text-[11px] py-0",children:Yt},nn))})]})})()]})]}),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(ns,{className:"w-4 h-4 mr-2"}),"关闭"]}),s.jsxs(J,{onClick:It,disabled:R,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),R?"保存中...":"保存修改"]})]})]}):s.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}),s.jsx(Dt,{open:_,onOpenChange:Z,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsx($t,{children:"调整余额"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{children:[s.jsx(te,{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:re,onChange:ce=>we(ce.target.value)})]}),s.jsxs("div",{children:[s.jsx(te,{className:"text-gray-300 text-sm",children:"备注(可选)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"如:活动补偿",value:Fe,onChange:ce=>Ue(ce.target.value)})]})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(J,{variant:"outline",onClick:()=>Z(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(J,{onClick:Ts,disabled:wt,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:wt?"提交中...":"确认调整"})]})]})})]}):null}function o8(){const t=Ja(),[e,n]=y.useState(!0),[r,a]=y.useState(!0),[i,o]=y.useState(!0),[c,u]=y.useState([]),[h,f]=y.useState([]),[m,g]=y.useState(0),[b,N]=y.useState(0),[j,v]=y.useState(0),[k,T]=y.useState(0),[C,R]=y.useState(null),[O,U]=y.useState(null),[P,z]=y.useState(!1),[L,Q]=y.useState(0),[se,$]=y.useState(!1),[ie,oe]=y.useState(null),[me,I]=y.useState("overview"),[Y,F]=y.useState([]),[ge,X]=y.useState(!1),[V,W]=y.useState("today"),[fe,he]=y.useState(null),[de,D]=y.useState(!1),[q,_]=y.useState(!0),[Z,re]=y.useState(null),[we,Fe]=y.useState(null),[Ue,wt]=y.useState([]),jn=Ne=>{const Me=Ne;if((Me==null?void 0:Me.status)===401)R("登录已过期,请重新登录");else{if((Me==null?void 0:Me.name)==="AbortError")return;R("加载失败,请检查网络或联系管理员")}};async function pt(Ne){var Lt,kt;const Me=Ne?{signal:Ne}:void 0;n(!0),R(null);try{const $e=await Oe("/api/admin/dashboard/stats",Me);$e!=null&&$e.success&&(g($e.totalUsers??0),N($e.paidOrderCount??0),v($e.totalRevenue??0),T($e.conversionRate??0))}catch($e){if(($e==null?void 0:$e.name)!=="AbortError"){console.error("stats 失败,尝试 overview 降级",$e);try{const H=await Oe("/api/admin/dashboard/overview",Me);H!=null&&H.success&&(g(H.totalUsers??0),N(H.paidOrderCount??0),v(H.totalRevenue??0),T(H.conversionRate??0))}catch(H){jn(H)}}}finally{n(!1)}try{const $e=await Oe("/api/admin/balance/summary",Me);$e!=null&&$e.success&&$e.data&&Q($e.data.totalGifted??0)}catch{}try{const $e=await Oe("/api/db/ckb-plan-stats",Me);$e!=null&&$e.success&&$e.data?oe({ckbTotal:$e.data.ckbTotal??0,withContact:$e.data.withContact??0}):oe(null)}catch{oe(null)}_(!0);try{const[$e,H]=await Promise.allSettled([Oe("/api/db/match-records?stats=true",Me),Oe("/api/admin/distribution/overview",Me)]);$e.status==="fulfilled"&&((Lt=$e.value)!=null&&Lt.success)&&$e.value.data?re({totalMatches:$e.value.data.totalMatches??0,todayMatches:$e.value.data.todayMatches??0,uniqueUsers:$e.value.data.uniqueUsers??0,paidMatchCount:$e.value.data.paidMatchCount??0}):re(null),H.status==="fulfilled"&&((kt=H.value)!=null&&kt.success)&&H.value.overview?Fe({todayClicks:H.value.overview.todayClicks??0,todayBindings:H.value.overview.todayBindings??0,todayConversions:H.value.overview.todayConversions??0,monthClicks:H.value.overview.monthClicks??0,monthBindings:H.value.overview.monthBindings??0,monthConversions:H.value.overview.monthConversions??0,totalClicks:H.value.overview.totalClicks??0,totalBindings:H.value.overview.totalBindings??0,totalConversions:H.value.overview.totalConversions??0,conversionRate:H.value.overview.conversionRate}):Fe(null)}catch{re(null),Fe(null)}finally{_(!1)}try{const $e=await Oe("/api/db/vip-members?limit=500",Me);$e!=null&&$e.success&&Array.isArray($e.data)?wt($e.data):wt([])}catch{wt([])}a(!0),o(!0);const We=async()=>{try{const $e=await Oe("/api/admin/dashboard/recent-orders?limit=10",Me);if($e!=null&&$e.success&&$e.recentOrders)f($e.recentOrders);else throw new Error("no data")}catch($e){if(($e==null?void 0:$e.name)!=="AbortError")try{const H=await Oe("/api/admin/orders?page=1&pageSize=20&status=paid",Me),bt=((H==null?void 0:H.orders)??[]).filter(Ft=>["paid","completed","success"].includes(Ft.status||""));f(bt.slice(0,5))}catch{f([])}}finally{a(!1)}},rt=async()=>{try{const $e=await Oe("/api/admin/dashboard/new-users",Me);if($e!=null&&$e.success&&$e.newUsers)u($e.newUsers);else throw new Error("no data")}catch($e){if(($e==null?void 0:$e.name)!=="AbortError")try{const H=await Oe("/api/db/users?page=1&pageSize=10",Me);u((H==null?void 0:H.users)??[])}catch{u([])}}finally{o(!1)}};await Promise.all([We(),rt()])}async function At(Ne){const Me=Ne||V;D(!0);try{const We=await Oe(`/api/admin/track/stats?period=${Me}`);We!=null&&We.success&&he({total:We.total??0,byModule:We.byModule??{}})}catch{he(null)}finally{D(!1)}}const fn={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:"链接点击"},pn=Ne=>Ne?Ne.replace(/^part-/,"").replace(/^soulvip_/,"").replace(/^super_?/,"").replace(/^user_/,"").replace(/[_-]+/g," ").trim():"",Wt=Ne=>{if(!Ne)return"";const Me=Ne.trim().toLowerCase();if(!Me)return"";const We=Ue.find(Lt=>{const kt=String(Lt.id||"").toLowerCase();return kt===Me||kt.includes(Me)||Me.includes(kt)});if(We)return We.name||We.nickname||"";const rt=Ue.find(Lt=>{const kt=String(Lt.token||"").toLowerCase();return kt&&(kt===Me||kt.includes(Me)||Me.includes(kt))});return rt&&(rt.name||rt.nickname)||""},bn=Ne=>{if(!Ne)return"未命名点击";const Me=Ne.trim(),We=Me.toLowerCase();if(/^链接头像[_-]/.test(Me)){const Lt=pn(Me.replace(/^链接头像[_-]/,""));return Lt?`头像:${Lt}`:"头像点击"}if(/^member[_-]?detail$/i.test(We)||We.includes("member detail"))return"成员详情";if(/^giftpay$/i.test(We)||We.includes("gift pay"))return"代付入口";if(/^part[-_]/i.test(We))return`章节:${pn(Me)}`;if(We.includes("soulvip")||We.includes("super")){const Lt=Me.replace(/^超级个体[::]?/i,"").replace(/^super[_-]?/i,"").replace(/^soulvip[_-]?/i,"").replace(/^user[_-]?/i,"").trim(),kt=Wt(Lt)||Wt(pn(Lt));return kt?`超级个体:${kt}`:`超级个体:${pn(Lt)}`}if(We.includes("qgdtw")||We.includes("token")||We.includes("0000"))return`对象:${pn(Me)}`;const rt={开始匹配:"开始匹配",mentor:"导师顾问",team:"团队招募",investor:"资源对接",充值:"充值",退款:"退款",wallet:"钱包",设置:"设置",VIP:"VIP会员",推广:"推广中心",目录:"目录",搜索:"搜索",匹配:"找伙伴",settings:"设置",expired:"已过期",active:"活跃",converted:"已转化",fill_profile:"完善资料",register:"注册",purchase:"购买",链接卡若:"链接卡若",更多分享:"更多分享",分享朋友圈文案:"分享朋友圈",选择金额10:"选择金额10元",member_detail:"成员详情",giftPay:"代付入口"};return rt[Me]?rt[Me]:/^[a-z0-9_-]+$/i.test(Me)&&pn(Me)||Me},Mn=Ne=>{const Me=fn[Ne.module]||fn[Ne.page]||Ne.module||Ne.page||"其他",We=Vn[Ne.action]||Ne.action||"点击",rt=bn(Ne.target);return`${Me} · ${We} · ${rt}`};async function Hn(){X(!0);try{const Ne=await Oe("/api/admin/super-individual/stats");Ne!=null&&Ne.success&&Array.isArray(Ne.data)&&F(Ne.data)}catch{}finally{X(!1)}}y.useEffect(()=>{const Ne=new AbortController;return pt(Ne.signal),At(),Hn(),()=>{Ne.abort()}},[]);const rs=m,Rt=Ne=>{const Me=Ne.productType||"",We=Ne.description||"";if(Me==="balance_recharge")return{title:`余额充值 ¥${typeof Ne.amount=="number"?Ne.amount.toFixed(2):parseFloat(String(Ne.amount||"0")).toFixed(2)}`,subtitle:"余额充值"};if(Me==="gift_pay")return{title:`代付 ¥${typeof Ne.amount=="number"?Ne.amount.toFixed(2):parseFloat(String(Ne.amount||"0")).toFixed(2)}`,subtitle:"好友代付"};if(Me==="gift_pay_batch"){const rt=typeof Ne.amount=="number"?Ne.amount.toFixed(2):parseFloat(String(Ne.amount||"0")).toFixed(2);return{title:We||`代付分享 ¥${rt}`,subtitle:"代付分享"}}if(Me==="section"&&We.includes("代付领取"))return{title:We.replace("代付领取 - ",""),subtitle:"代付领取"};if(We){if(Me==="section"&&We.includes("章节")){if(We.includes("-")){const rt=We.split("-");if(rt.length>=3)return{title:`第${rt[1]}章 第${rt[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:We,subtitle:"章节购买"}}return Me==="fullbook"||We.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:Me==="vip"||We.includes("VIP")?{title:"超级个体开通费用",subtitle:"超级个体"}:Me==="match"||We.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:We,subtitle:Me==="section"?"单章":Me==="fullbook"?"全书":"其他"}}return Me==="section"?{title:`章节 ${Ne.productId||""}`,subtitle:"单章购买"}:Me==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:Me==="vip"?{title:"超级个体开通费用",subtitle:"超级个体"}:Me==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:Me||"其他"}},vn=[{title:"总用户数",value:e?null:rs,sub:null,icon:Kn,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:e?null:`¥${(j??0).toFixed(2)}`,sub:L>0?`含代付 ¥${L.toFixed(2)}`:null,icon:Lf,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:e?null:b,sub:null,icon:mu,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:ur,color:"text-orange-400",bg:"bg-orange-500/20",link:"/distribution"},{title:"存客宝获客",value:ie?ie.ckbTotal??0:null,sub:(ie==null?void 0:ie.withContact)!=null?`含联系方式 ${ie.withContact} 人`:null,icon:Gc,color:"text-cyan-400",bg:"bg-cyan-500/20",link:"/users?tab=leads"},{title:"伙伴&推广协同",value:q?null:((Z==null?void 0:Z.totalMatches)??0)+((we==null?void 0:we.totalClicks)??0),sub:q?null:`找伙伴 ${(Z==null?void 0:Z.totalMatches)??0} / 推广 ${(we==null?void 0:we.totalClicks)??0}`,icon:nu,color:"text-emerald-400",bg:"bg-emerald-500/20",link:"/find-partner"}];return s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("h1",{className:"text-2xl font-bold mb-8 text-white",children:"数据概览"}),C&&s.jsxs("div",{className:"mb-6 px-4 py-3 rounded-lg bg-amber-500/20 border border-amber-500/50 text-amber-200 text-sm flex items-center justify-between",children:[s.jsx("span",{children:C}),s.jsx("button",{type:"button",onClick:()=>pt(),className:"text-amber-400 hover:text-amber-300 underline",children:"重试"})]}),s.jsx("div",{className:"grid gap-6 mb-8 grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 xl:grid-cols-6",children:vn.map((Ne,Me)=>s.jsxs(De,{className:"min-w-0 bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>Ne.link&&t(Ne.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:Ne.title}),s.jsx("div",{className:`p-2 rounded-lg ${Ne.bg}`,children:s.jsx(Ne.icon,{className:`w-4 h-4 ${Ne.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:Ne.value!=null?Ne.value:s.jsxs("span",{className:"inline-flex items-center gap-2 text-gray-500",children:[s.jsx(He,{className:"w-4 h-4 animate-spin"}),"加载中"]})}),Ne.sub&&s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:Ne.sub})]}),s.jsx(Cl,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},Me))}),s.jsxs("div",{className:"flex gap-2 mb-6 mt-2",children:[s.jsx("button",{type:"button",onClick:()=>I("overview"),className:`px-5 py-2 rounded-lg text-sm font-medium transition-colors ${me==="overview"?"bg-[#38bdac] text-white":"bg-[#0f2137] text-gray-400 hover:text-white hover:bg-gray-700/50 border border-gray-700/50"}`,children:"数据概览"}),s.jsx("button",{type:"button",onClick:()=>I("tags"),className:`px-5 py-2 rounded-lg text-sm font-medium transition-colors ${me==="tags"?"bg-[#38bdac] text-white":"bg-[#0f2137] text-gray-400 hover:text-white hover:bg-gray-700/50 border border-gray-700/50"}`,children:"用户标签点击统计"}),s.jsx("button",{type:"button",onClick:()=>I("super"),className:`px-5 py-2 rounded-lg text-sm font-medium transition-colors ${me==="super"?"bg-[#38bdac] text-white":"bg-[#0f2137] text-gray-400 hover:text-white hover:bg-gray-700/50 border border-gray-700/50"}`,children:"超级个体统计"})]}),me==="overview"&&s.jsxs("div",{className:"space-y-8",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{className:"flex flex-row items-center justify-between",children:[s.jsx(ut,{className:"text-white",children:"找伙伴 × 推广中心(共统计)"}),s.jsxs("button",{type:"button",onClick:()=>pt(),disabled:q,className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1 disabled:opacity-50",title:"刷新共统计",children:[s.jsx(He,{className:`w-3.5 h-3.5 ${q?"animate-spin":""}`}),"刷新"]})]}),s.jsxs(_e,{children:[q&&!Z&&!we?s.jsxs("div",{className:"flex items-center justify-center py-10 text-gray-500",children:[s.jsx(He,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-6 gap-4",children:[s.jsxs("div",{className:"rounded-lg bg-[#0a1628] border border-gray-700/30 p-4",children:[s.jsx("p",{className:"text-xs text-gray-400",children:"找伙伴总匹配"}),s.jsx("p",{className:"text-2xl font-bold text-white mt-1",children:(Z==null?void 0:Z.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:(Z==null?void 0:Z.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:(Z==null?void 0:Z.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:(we==null?void 0:we.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:(we==null?void 0:we.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:(we==null?void 0:we.totalConversions)??0})]})]}),(we==null?void 0:we.conversionRate)&&s.jsxs("p",{className:"text-xs text-gray-500 mt-3",children:["推广转化率:",we.conversionRate]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{className:"flex flex-row items-center justify-between",children:[s.jsx(ut,{className:"text-white",children:"最近订单"}),s.jsxs("button",{type:"button",onClick:()=>pt(),disabled:r||i,className:"text-xs text-gray-400 hover:text-[#38bdac] flex items-center gap-1 disabled:opacity-50",title:"刷新",children:[r||i?s.jsx(He,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(He,{className:"w-3.5 h-3.5"}),"刷新"]})]}),s.jsx(_e,{children:s.jsx("div",{className:"space-y-3",children:r&&h.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[s.jsx(He,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[h.slice(0,se?10:4).map(Ne=>{var kt;const Me=Ne.referrerId?c.find($e=>$e.id===Ne.referrerId):void 0,We=Ne.referralCode||(Me==null?void 0:Me.referralCode)||(Me==null?void 0:Me.nickname)||(Ne.referrerId?String(Ne.referrerId).slice(0,8):""),rt=Rt(Ne),Lt=Ne.userNickname||((kt=c.find($e=>$e.id===Ne.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:[Ne.userAvatar?s.jsx("img",{src:Ne.userAvatar,alt:Lt,className:"w-9 h-9 rounded-full object-cover shrink-0 mt-0.5",onError:$e=>{$e.currentTarget.style.display="none";const H=$e.currentTarget.nextElementSibling;H&&H.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 ${Ne.userAvatar?"hidden":""}`,children:Lt.charAt(0)}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("button",{type:"button",onClick:()=>{Ne.userId&&(U(Ne.userId),z(!0))},className:"text-sm text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:Lt}),s.jsx("span",{className:"text-gray-600",children:"·"}),s.jsx("span",{className:"text-sm font-medium text-white truncate",title: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(Ne.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),We&&s.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",We]})]})]}),s.jsxs("div",{className:"text-right ml-4 shrink-0",children:[s.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(Ne.amount).toFixed(2)]}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:Ne.paymentMethod||"微信"})]})]},Ne.id)}),h.length>4&&!se&&s.jsx("button",{type:"button",onClick:()=>$(!0),className:"w-full py-2 text-sm text-[#38bdac] hover:text-[#2da396] border border-dashed border-gray-600 rounded-lg hover:border-[#38bdac]/50 transition-colors",children:"展开更多"}),h.length===0&&!r&&s.jsxs("div",{className:"text-center py-12",children:[s.jsx(mu,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(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(He,{className:"w-8 h-8 animate-spin mb-2"}),s.jsx("span",{className:"text-sm",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[c.slice(0,5).map(Ne=>{var Me;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:((Me=Ne.nickname)==null?void 0:Me.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("button",{type:"button",onClick:()=>{U(Ne.id),z(!0)},className:"text-sm font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:Ne.nickname||"匿名用户"}),s.jsx("p",{className:"text-xs text-gray-500",children:Ne.phone||"未绑定手机"})]})]}),s.jsx("p",{className:"text-xs text-gray-400",children:Ne.createdAt?new Date(Ne.createdAt).toLocaleDateString():"-"})]},Ne.id)}),c.length===0&&!i&&s.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})})]})]})]}),me==="tags"&&s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{className:"flex flex-row items-center justify-between",children:[s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(nu,{className:"w-5 h-5 text-[#38bdac]"}),"分类标签点击统计"]}),s.jsx("div",{className:"flex items-center gap-2",children:["today","week","month","all"].map(Ne=>s.jsx("button",{type:"button",onClick:()=>{W(Ne),At(Ne)},className:`px-3 py-1 text-xs rounded-full transition-colors ${V===Ne?"bg-[#38bdac] text-white":"bg-gray-700/50 text-gray-400 hover:bg-gray-700"}`,children:{today:"今日",week:"本周",month:"本月",all:"全部"}[Ne]},Ne))})]}),s.jsx(_e,{children:de&&!fe?s.jsxs("div",{className:"flex items-center justify-center py-12 text-gray-500",children:[s.jsx(He,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):fe&&Object.keys(fe.byModule).length>0?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("p",{className:"text-sm text-gray-400",children:["总点击 ",s.jsx("span",{className:"text-white font-bold text-lg",children:fe.total})," 次"]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Object.entries(fe.byModule).sort((Ne,Me)=>Me[1].reduce((We,rt)=>We+rt.count,0)-Ne[1].reduce((We,rt)=>We+rt.count,0)).slice(0,5).map(([Ne,Me])=>{const We=Me.reduce((rt,Lt)=>rt+Lt.count,0);return s.jsxs("div",{className:"bg-[#0a1628] rounded-lg border border-gray-700/30 p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-3",children:[s.jsx("span",{className:"text-sm font-medium text-[#38bdac]",children:fn[Ne]||Ne}),s.jsxs("span",{className:"text-xs text-gray-500",children:[We," 次"]})]}),s.jsx("div",{className:"space-y-2",children:Me.sort((rt,Lt)=>Lt.count-rt.count).slice(0,8).map((rt,Lt)=>{const kt=Mn(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:`${We>0?rt.count/We*100:0}%`}})}),s.jsx("span",{className:"text-gray-400 w-8 text-right",children:rt.count})]})]},Lt)})})]},Ne)})})]}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(nu,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无点击数据"}),s.jsx("p",{className:"text-gray-600 text-xs mt-1",children:"小程序端接入埋点后,数据将在此实时展示"})]})})]}),me==="super"&&s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{className:"flex flex-row items-center justify-between",children:[s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(nu,{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:Hn,disabled:ge,children:[s.jsx(He,{className:`w-3.5 h-3.5 mr-1 ${ge?"animate-spin":""}`}),"刷新"]})]}),s.jsx(_e,{children:ge&&Y.length===0?s.jsxs("div",{className:"flex items-center justify-center py-12 text-gray-500",children:[s.jsx(He,{className:"w-6 h-6 animate-spin mr-2"}),s.jsx("span",{children:"加载中..."})]}):Y.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:Y.map((Ne,Me)=>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:Me+1}),s.jsx("td",{className:"py-2 px-3",children:s.jsxs("div",{className:"flex items-center gap-2",children:[Ne.avatar?s.jsx("img",{src:Ne.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(Ne.nickname||Ne.userId)}`),title:"点击跳转用户管理",children:Ne.nickname||Ne.userId})]})}),s.jsx("td",{className:"py-2 px-3 text-center text-white font-bold",children:Ne.clicks}),s.jsx("td",{className:"py-2 px-3 text-center text-[#38bdac]",children:Ne.uniqueClicks}),s.jsx("td",{className:"py-2 px-3 text-center text-gray-400",children:Ne.uniqueClicks>0?(Ne.clicks/Ne.uniqueClicks).toFixed(1):"-"}),s.jsx("td",{className:"py-2 px-3 text-center text-green-400 text-xs font-medium",children:typeof Ne.leadCount=="number"?Ne.leadCount:0}),s.jsx("td",{className:"py-2 px-3 text-gray-400 text-xs",children:Ne.phone||"-"})]},Ne.userId))})]})}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(nu,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无超级个体点击数据"}),s.jsx("p",{className:"text-gray-600 text-xs mt-1",children:"小程序首页的超级个体被用户点击后,数据将展示在此"})]})})]}),s.jsx(hy,{open:P,onClose:()=>{z(!1),U(null)},userId:O,onUserUpdated:()=>pt()})]})}const fs=y.forwardRef(({className:t,...e},n)=>s.jsx("div",{className:"relative w-full overflow-auto",children:s.jsx("table",{ref:n,className:zt("w-full caption-bottom text-sm",t),...e})}));fs.displayName="Table";const ps=y.forwardRef(({className:t,...e},n)=>s.jsx("thead",{ref:n,className:zt("[&_tr]:border-b",t),...e}));ps.displayName="TableHeader";const ms=y.forwardRef(({className:t,...e},n)=>s.jsx("tbody",{ref:n,className:zt("[&_tr:last-child]:border-0",t),...e}));ms.displayName="TableBody";const gt=y.forwardRef(({className:t,...e},n)=>s.jsx("tr",{ref:n,className:zt("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));gt.displayName="TableRow";const Se=y.forwardRef(({className:t,...e},n)=>s.jsx("th",{ref:n,className:zt("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));Se.displayName="TableHead";const je=y.forwardRef(({className:t,...e},n)=>s.jsx("td",{ref:n,className:zt("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));je.displayName="TableCell";function Hl(t,e){const[n,r]=y.useState(t);return y.useEffect(()=>{const a=setTimeout(()=>r(t),e);return()=>clearTimeout(a)},[t,e]),n}function qs({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 l8(){const[t,e]=y.useState([]),[n,r]=y.useState([]),[a,i]=y.useState(0),[o,c]=y.useState(0),[u,h]=y.useState(0),[f,m]=y.useState(1),[g,b]=y.useState(10),[N,j]=y.useState(""),v=Hl(N,300),[k,T]=y.useState("all"),[C,R]=y.useState(!0),[O,U]=y.useState(null),[P,z]=y.useState(null),[L,Q]=y.useState(""),[se,$]=y.useState(!1);async function ie(){R(!0),U(null);try{const X=k==="all"?"":k==="completed"?"completed":k,V=new URLSearchParams({page:String(f),pageSize:String(g),...X&&{status:X},...v&&{search:v}}),[W,fe]=await Promise.all([Oe(`/api/admin/orders?${V}`),Oe("/api/db/users?page=1&pageSize=500")]);W!=null&&W.success&&(e(W.orders||[]),i(W.total??0),c(W.totalRevenue??0),h(W.todayRevenue??0)),fe!=null&&fe.success&&fe.users&&r(fe.users)}catch(X){console.error("加载订单失败",X),U("加载订单失败,请检查网络后重试")}finally{R(!1)}}y.useEffect(()=>{m(1)},[v,k]),y.useEffect(()=>{ie()},[f,g,v,k]);const oe=X=>{var V;return X.userNickname||((V=n.find(W=>W.id===X.userId))==null?void 0:V.nickname)||"匿名用户"},me=X=>{var V;return((V=n.find(W=>W.id===X))==null?void 0:V.phone)||"-"},I=X=>{const V=X.productType||X.type||"",W=X.description||"";if(V==="balance_recharge")return{name:`余额充值 ¥${Number(X.amount||0).toFixed(2)}`,type:"余额充值"};if(W){if(V==="section"&&(W.includes("章节")||W.includes("代付领取"))){if(W.includes("代付领取"))return{name:W.replace("代付领取 - ",""),type:"代付领取"};if(W.includes("-")){const fe=W.split("-");if(fe.length>=3)return{name:`第${fe[1]}章 第${fe[2]}节`,type:"《一场Soul的创业实验》"}}return{name:W,type:"章节购买"}}return V==="fullbook"||W.includes("全书")?{name:"《一场Soul的创业实验》",type:"全书购买"}:V==="vip"||W.includes("VIP")?{name:"超级个体开通费用",type:"超级个体"}:V==="match"||W.includes("伙伴")?{name:"找伙伴匹配",type:"功能服务"}:{name:W,type:"其他"}}return V==="section"?{name:`章节 ${X.productId||X.sectionId||""}`,type:"单章"}:V==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:V==="vip"?{name:"超级个体开通费用",type:"超级个体"}:V==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:V||"其他"}},Y=Math.ceil(a/g)||1;async function F(){var X;if(!(!(P!=null&&P.orderSn)&&!(P!=null&&P.id))){$(!0),U(null);try{const V=await Zt("/api/admin/orders/refund",{orderSn:P.orderSn||P.id,reason:L||void 0});V!=null&&V.success?(z(null),Q(""),ie()):U((V==null?void 0:V.error)||"退款失败")}catch(V){const W=V;U(((X=W==null?void 0:W.data)==null?void 0:X.error)||"退款失败,请检查网络后重试")}finally{$(!1)}}}function ge(){if(t.length===0){G.info("暂无数据可导出");return}const X=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],V=t.map(D=>{const q=I(D);return[D.orderSn||D.id||"",oe(D),me(D.userId),q.name,Number(D.amount||0).toFixed(2),D.paymentMethod==="wechat"?"微信支付":D.paymentMethod==="balance"?"余额支付":D.paymentMethod==="alipay"?"支付宝":D.paymentMethod||"微信支付",D.status==="refunded"?"已退款":D.status==="paid"||D.status==="completed"?"已完成":D.status==="pending"||D.status==="created"?"待支付":"已失败",D.status==="refunded"&&D.refundReason?D.refundReason:"-",D.referrerEarnings?Number(D.referrerEarnings).toFixed(2):"-",D.createdAt?new Date(D.createdAt).toLocaleString("zh-CN"):""].join(",")}),W="\uFEFF"+[X.join(","),...V].join(` +`),fe=new Blob([W],{type:"text/csv;charset=utf-8"}),he=URL.createObjectURL(fe),de=document.createElement("a");de.href=he,de.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,de.click(),URL.revokeObjectURL(he)}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:()=>U(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"订单管理"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["共 ",t.length," 笔订单"]})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs(J,{variant:"outline",onClick:ie,disabled:C,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${C?"animate-spin":""}`}),"刷新"]}),s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsx("span",{className:"text-gray-400",children:"总收入:"}),s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",o.toFixed(2)]}),s.jsx("span",{className:"text-gray-600",children:"|"}),s.jsx("span",{className:"text-gray-400",children:"今日:"}),s.jsxs("span",{className:"text-[#FFD700] font-bold",children:["¥",u.toFixed(2)]})]})]})]}),s.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[s.jsxs("div",{className:"relative flex-1 max-w-md",children:[s.jsx(xa,{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:N,onChange:X=>j(X.target.value)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(tk,{className:"w-4 h-4 text-gray-400"}),s.jsxs("select",{value:k,onChange:X=>T(X.target.value),className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"all",children:"全部状态"}),s.jsx("option",{value:"completed",children:"已完成"}),s.jsx("option",{value:"pending",children:"待支付"}),s.jsx("option",{value:"created",children:"已创建"}),s.jsx("option",{value:"failed",children:"已失败"}),s.jsx("option",{value:"refunded",children:"已退款"})]})]}),s.jsxs(J,{variant:"outline",onClick:ge,disabled:t.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(H5,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:C?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(fs,{children:[s.jsx(ps,{children:s.jsxs(gt,{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(X=>{const V=I(X);return s.jsxs(gt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsxs(je,{className:"font-mono text-xs text-gray-400",children:[(X.orderSn||X.id||"").slice(0,12),"..."]}),s.jsx(je,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[oe(X),X.paymentMethod==="gift_pay"&&s.jsx(Be,{className:"bg-emerald-500/20 text-emerald-400 hover:bg-emerald-500/20 border-0 text-xs",children:"代付领取"}),X.payerUserId&&X.paymentMethod!=="gift_pay"&&s.jsx(Be,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"代付"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:me(X.userId)}),X.payerUserId&&X.payerNickname&&s.jsxs("p",{className:"text-amber-400/80 text-xs mt-0.5",children:[X.paymentMethod==="gift_pay"?"赠送人:":"代付人:",X.payerNickname]})]})}),s.jsx(je,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[V.name,(X.productType||X.type)==="vip"&&s.jsx(Be,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0 text-xs",children:"超级个体"})]}),s.jsx("p",{className:"text-gray-500 text-xs",children:V.type})]})}),s.jsxs(je,{className:"text-[#38bdac] font-bold",children:["¥",Number(X.amount||0).toFixed(2)]}),s.jsx(je,{className:"text-gray-300",children:X.paymentMethod==="wechat"?"微信支付":X.paymentMethod==="balance"?"余额支付":X.paymentMethod==="alipay"?"支付宝":X.paymentMethod||"微信支付"}),s.jsx(je,{children:s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[X.status==="refunded"?s.jsx(Be,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):X.status==="paid"||X.status==="completed"?s.jsx(Be,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):X.status==="pending"||X.status==="created"?s.jsx(Be,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):s.jsx(Be,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"}),(X.status==="paid"||X.status==="completed")&&(X.webhookPushStatus==="sent"?s.jsx(Be,{className:"bg-emerald-500/20 text-emerald-300 hover:bg-emerald-500/20 border-0",children:"已推送"}):s.jsx(Be,{className:"bg-orange-500/20 text-orange-300 hover:bg-orange-500/20 border-0",children:"待补推"}))]})}),s.jsx(je,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:X.refundReason,children:X.status==="refunded"&&X.refundReason?X.refundReason:"-"}),s.jsx(je,{className:"text-[#FFD700]",children:X.referrerEarnings?`¥${Number(X.referrerEarnings).toFixed(2)}`:"-"}),s.jsx(je,{className:"text-gray-400 text-sm",children:new Date(X.createdAt).toLocaleString("zh-CN")}),s.jsx(je,{children:(X.status==="paid"||X.status==="completed")&&X.paymentMethod!=="balance"&&s.jsxs(J,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{z(X),Q("")},children:[s.jsx(ak,{className:"w-3 h-3 mr-1"}),"退款"]})})]},X.id)}),t.length===0&&s.jsx(gt,{children:s.jsx(je,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),s.jsx(qs,{page:f,totalPages:Y,total:a,pageSize:g,onPageChange:m,onPageSizeChange:X=>{b(X),m(1)}})]})})}),s.jsx(Dt,{open:!!P,onOpenChange:X=>!X&&z(null),children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(_t,{children:s.jsx($t,{className:"text-white",children:"订单退款"})}),P&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",P.orderSn||P.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number(P.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:L,onChange:X=>Q(X.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>z(null),disabled:se,children:"取消"}),s.jsx(J,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:F,disabled:se,children:se?"退款中...":"确认退款"})]})]})})]})}const Go=y.forwardRef(({className:t,...e},n)=>s.jsx("textarea",{className:zt("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}));Go.displayName="Textarea";const aN=["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 c8(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 d8(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 u8(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 iN(t){const e=C2[t],n=c8(e.group),r=d8(e.mood),a=u8(e.mood),i=` + + + + + + + + + + + + + + + + + + + + + + + + + +`;return`data:image/svg+xml;utf8,${encodeURIComponent(i)}`}function h8(){const[t,e]=y.useState({}),[n,r]=y.useState(!0),[a,i]=y.useState(!1),[o,c]=y.useState(!1),u=y.useCallback(async()=>{r(!0);try{const g=await Oe("/api/admin/mbti-avatars");g!=null&&g.avatars?e(g.avatars):e({})}catch{G.error("加载 MBTI 头像配置失败")}finally{r(!1)}},[]);y.useEffect(()=>{u()},[u]);const h=async()=>{i(!0);try{const g=await Nt("/api/admin/mbti-avatars",{avatars:t});if(!g||g.success===!1){G.error((g==null?void 0:g.error)||"保存失败");return}G.success("已保存,后台与小程序默认头像同步生效"),u()}catch{G.error("保存失败")}finally{i(!1)}},f=g=>{const b=iN(g);e(N=>({...N,[g]:b})),G.success(`${g} 已生成`)},m=()=>{c(!0);try{const g={...t};aN.forEach(b=>{g[b]=iN(b)}),e(g),G.success("16 型头像已生成(仅人物)")}finally{c(!1)}};return n?s.jsxs("div",{className:"flex items-center justify-center py-16 text-gray-400",children:[s.jsx(He,{className:"w-5 h-5 mr-2 animate-spin text-[#38bdac]"}),"加载配置…"]}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs(De,{className:"bg-[#0f2137] border-[#38bdac]/25 shadow-xl",children:[s.jsxs(dt,{className:"pb-2",children:[s.jsxs(ut,{className:"text-white flex items-center gap-2 text-lg",children:[s.jsx(bA,{className:"w-5 h-5 text-[#38bdac]"}),"MBTI 头像库"]}),s.jsx(Gt,{className:"text-gray-400 text-sm leading-relaxed",children:"采用人物化风格,按 MBTI 性格自动生成。头像内不显示中英文,仅显示人物形象,颜色与站点主题融合。"})]}),s.jsxs(_e,{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(VA,{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(He,{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(Tn,{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:aN.map(g=>{const b=t[g]??"",N=C2[g];return s.jsxs("div",{className:"rounded-xl border border-gray-700/60 bg-[#0a1628] p-3 flex flex-col gap-2 hover:border-[#38bdac]/35 transition-colors",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 font-mono text-xs",children:g}),s.jsx("span",{className:"text-xs text-gray-400 truncate",title:N.title,children:N.title})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-16 h-16 rounded-full shrink-0 overflow-hidden flex items-center justify-center bg-[#081322] ring-2 ring-[#38bdac]/40 ring-offset-2 ring-offset-[#0a1628]",children:b?s.jsx("img",{src:b,alt:g,className:"w-full h-full object-cover scale-110"}):s.jsx("span",{className:"text-gray-600 text-[10px]",children:"未配"})}),s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx(le,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"https://... 或 data:image/...",value:b,onChange:j=>e(v=>({...v,[g]:j.target.value}))})})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(J,{type:"button",size:"sm",variant:"outline",className:"h-7 text-[11px] border-[#38bdac]/40 text-[#38bdac]",onClick:()=>f(g),children:"生成这张"}),s.jsx(J,{type:"button",size:"sm",variant:"ghost",className:"h-7 text-[11px] text-gray-400",onClick:()=>e(j=>({...j,[g]:""})),children:"清空"})]})]},g)})})]})}const oN=[{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:"用户状态"}],lN=[{value:"popup",label:"弹窗提示",desc:"在小程序内弹窗引导用户完成下一步"},{value:"navigate",label:"跳转页面",desc:"引导用户跳转到指定页面"},{value:"webhook",label:"推送飞书群",desc:"触发后推送消息到飞书群Webhook"},{value:"tag",label:"自动打标签",desc:"触发后自动给用户打上指定标签"}];function E2(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 f8(t){return{...t,triggerConditions:E2(t.triggerConditions)}}const p8=[{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:"待激活"}],$c=[{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 cN(t){return confirm(`确定删除该${t}?此操作不可恢复。`)?window.prompt(`请输入「删除」以确认删除${t}`)==="删除":!1}function m8({userId:t,userAvatar:e,nickname:n,name:r,onOpenDetail:a}){const[i,o]=y.useState(!1),c=n||r||"-",u=(c==="-"?"?":c).charAt(0),h=!!(e!=null&&e.trim())&&!i;return s.jsxs("div",{className:"flex items-center gap-2 min-w-0 max-w-[220px]",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/15 flex items-center justify-center text-xs font-medium text-[#38bdac] flex-shrink-0 overflow-hidden border border-gray-600/50","aria-hidden":!0,children:h?s.jsx("img",{src:ya(e),alt:"",className:"w-full h-full object-cover",onError:()=>o(!0)}):s.jsx("span",{children:u})}),s.jsx("button",{type:"button",className:`text-left truncate min-w-0 ${t?"hover:text-[#38bdac] cursor-pointer":"cursor-default text-gray-300"}`,disabled:!t,title:t?"查看用户详情":void 0,onClick:()=>{t&&a(t)},children:c})]})}function g8(t){const e=(t||"").trim();if(!e)return"";try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function x8(){var Qi,Zu,Ed,Td,Md,Ad,Id;const[t,e]=Y0(),n=t.get("pool"),r=t.get("tab")||"users",a=["users","journey","rules","vip-roles","leads"].includes(r)?r:"users",i=(t.get("leadAction")||"").trim(),[o,c]=y.useState([]),[u,h]=y.useState(0),[f,m]=y.useState(1),[g,b]=y.useState(10),[N,j]=y.useState(""),v=Hl(N,300),k=n==="vip"?"vip":n==="complete"?"complete":"all",[T,C]=y.useState(k),[R,O]=y.useState(!0),[U,P]=y.useState(!1),[z,L]=y.useState(null),[Q,se]=y.useState(!1),[$,ie]=y.useState(!1),[oe,me]=y.useState("desc");y.useEffect(()=>{n==="vip"?C("vip"):n==="complete"?C("complete"):n==="all"&&C("all")},[n]);const[I,Y]=y.useState(!1),[F,ge]=y.useState(null),[X,V]=y.useState(!1),[W,fe]=y.useState(!1),[he,de]=y.useState({referrals:[],stats:{}}),[D,q]=y.useState(!1),[_,Z]=y.useState(null),[re,we]=y.useState(!1),[Fe,Ue]=y.useState(null),[wt,jn]=y.useState(!1),[pt,At]=y.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),[fn,Vn]=y.useState([]),[pn,Wt]=y.useState(!1),[bn,Mn]=y.useState(!1),[Hn,rs]=y.useState(null),[Rt,vn]=y.useState({title:"",description:"",trigger:"",triggerConditions:[],actionType:"popup",sort:0,enabled:!0}),[Ne,Me]=y.useState([]),[We,rt]=y.useState(!1),[Lt,kt]=y.useState(null),[$e,H]=y.useState(null),[Qe,bt]=y.useState({}),[Ft,yt]=y.useState(!1),[ht,It]=y.useState(null),[Kt,kn]=y.useState([]),[Es,Ts]=y.useState(!1),[Vi,ja]=y.useState(null),[Xa,Za]=y.useState(""),[Mr,Ar]=y.useState([]),[Ir,Jr]=y.useState(!1),[Bs,Qs]=y.useState({}),[fr,Ys]=y.useState([]),[ka,ce]=y.useState(0),[ve,Pt]=y.useState(1),[Yt]=y.useState(10),[nn,as]=y.useState(!1),[Pr,Qr]=y.useState(null),[Tt,Jn]=y.useState(""),Yr=Hl(Tt,300),[Sa,mn]=y.useState(""),[Xr,ei]=y.useState(""),[pr,Ms]=y.useState(""),[Ca,Hi]=y.useState(!1),[Xs,Zs]=y.useState({}),[Ui,ys]=y.useState(null),[el,Wi]=y.useState(null),[bs,er]=y.useState([]),[tr,mr]=y.useState(!1),ti=y.useRef(null),[Zr,sc]=y.useState(!1),[tl,ni]=y.useState(!1),[Ki,Ea]=y.useState("存客宝返回 data"),[nl,Ta]=y.useState(""),vt=y.useCallback(async(M,ee)=>{as(!0),Qr(null);try{const be=new URLSearchParams({mode:"contact",page:String(ve),pageSize:String(Yt)}),Ae=M??Yr;Ae&&be.set("search",Ae);const Ge=ee??Sa;Ge&&be.set("source",Ge),Xr&&be.set("action",Xr),pr&&be.set("pushStatus",pr);const Je=await Oe(`/api/db/ckb-leads?${be}`);if(Je!=null&&Je.success)Ys(Je.records||[]),ce(Je.total??0),Je.stats&&Zs(Je.stats);else{const Vt=(Je==null?void 0:Je.error)||"加载获客列表失败";Qr(Vt),G.error(Vt),Ys([]),ce(0)}}catch(be){const Ae=be instanceof Error?be.message:"网络错误";Qr(Ae),G.error("加载获客列表失败: "+Ae),Ys([]),ce(0)}finally{as(!1)}},[ve,Yt,Yr,Sa,Xr,pr]);y.useEffect(()=>{er([])},[Yr,Sa,Xr,pr]),y.useEffect(()=>{a==="leads"&&ei(i)},[a,i]);function qi(M,ee){return{...M,...ee.pushStatus!==void 0?{pushStatus:ee.pushStatus}:{},...typeof ee.retryCount=="number"?{retryCount:ee.retryCount}:{},...typeof ee.ckbCode=="number"?{ckbCode:ee.ckbCode}:{},...ee.ckbMessage!==void 0?{ckbMessage:ee.ckbMessage}:{},...ee.ckbData!==void 0?{ckbData:ee.ckbData}:{},...ee.ckbError!==void 0?{ckbError:ee.ckbError}:{},...ee.lastPushAt!==void 0?{lastPushAt:ee.lastPushAt??void 0}:{},...ee.nextRetryAt!==void 0?{nextRetryAt:ee.nextRetryAt??void 0}:{}}}async function sl(M){if(M){ys(M);try{const ee=await Nt("/api/db/ckb-leads/retry",{id:M});ee!=null&&ee.success?(G.success(ee.pushed?"重推成功":"已发起重推,请刷新查看状态"),ee.record&&Ys(be=>be.map(Ae=>Ae.id===M?qi(Ae,ee.record):Ae))):G.error((ee==null?void 0:ee.error)||"重推失败")}catch(ee){G.error(ee instanceof Error?ee.message:"重推请求失败")}finally{ys(null)}}}async function si(M){if(M&&confirm("确定删除该条获客记录?删除后不可恢复。")){Wi(M);try{const ee=await Nt("/api/db/ckb-leads/delete",{id:M});ee!=null&&ee.success?G.success("已删除"):G.error((ee==null?void 0:ee.error)||"删除失败")}catch(ee){G.error(ee instanceof Error?ee.message:"删除请求失败")}finally{Wi(null),vt()}}}async function ri(){const M=at.filter(Ae=>Ae.pushStatus==="failed");if(M.length===0){G.info("当前页无失败记录");return}sc(!0);let ee=0;for(const Ae of M)try{const Ge=await Nt("/api/db/ckb-leads/retry",{id:Ae.id});if(Ge!=null&&Ge.success&&Ge.pushed&&ee++,Ge!=null&&Ge.success&&Ge.record){const Je=Ge.record;Ys(Vt=>Vt.map(Ve=>Ve.id===Ae.id?qi(Ve,Je):Ve))}}catch{}sc(!1);const be=M.length;G.success(`批量重推完成:成功 ${ee} / ${be}`)}function rc(){const M=at.filter(Ve=>Ve.pushStatus==="failed");if(M.length===0){G.info("当前筛选下无失败记录可导出");return}const ee=Ve=>`"${String(Ve??"").replace(/"/g,'""')}"`,Ae=[["ID","昵称","手机号","微信号","对应@人","计划Key","来源","推送状态","重试次数","失败原因","下次重试时间","创建时间"].join(",")];for(const Ve of M)Ae.push([ee(Ve.id),ee(Ve.userNickname||Ve.name||""),ee(Ve.phone||""),ee(Ve.wechatId||""),ee(Ve.personName||""),ee(Ve.planApiKey||""),ee(Ve.source||""),ee(Ve.pushStatus||""),ee(typeof Ve.retryCount=="number"?Ve.retryCount:""),ee(Ve.ckbError||""),ee(Ve.nextRetryAt?new Date(Ve.nextRetryAt).toLocaleString():""),ee(Ve.createdAt?new Date(Ve.createdAt).toLocaleString():"")].join(","));const Ge=new Blob(["\uFEFF"+Ae.join(` +`)],{type:"text/csv;charset=utf-8;"}),Je=URL.createObjectURL(Ge),Vt=document.createElement("a");Vt.href=Je,Vt.download=`获客失败清单-${new Date().toISOString().slice(0,19).replace(/[:T]/g,"-")}.csv`,document.body.appendChild(Vt),Vt.click(),document.body.removeChild(Vt),URL.revokeObjectURL(Je),G.success(`已导出失败清单(${M.length} 条)`)}const Qn=y.useCallback(async()=>{try{const M=await Oe("/api/admin/mbti-avatars"),ee=M!=null&&M.avatars&&typeof M.avatars=="object"?M.avatars:{};Qs(ee)}catch{Qs({})}},[]);y.useEffect(()=>{t.get("tab")==="leads"&&vt()},[t.get("tab"),ve,vt]),y.useEffect(()=>{if(a!=="leads")return;const M=window.setInterval(()=>{vt()},3e4);return()=>window.clearInterval(M)},[a,vt]),y.useEffect(()=>{Qn()},[Qn]);const Ma=y.useCallback((M,ee)=>{const be=(M||"").trim();if(be)return be;const Ae=(ee||"").trim().toUpperCase();return/^[EI][NS][FT][JP]$/.test(Ae)?(Bs[Ae]||"").trim():""},[Bs]),ea=y.useCallback(M=>{const ee=!!M.hasFullBook,be=Number(M.purchasedSectionCount||0);return ee?{tone:"vip",main:"已购全书",sub:be>0?`另购单章 ${be} 章`:"购买项:VIP / 全书"}:be>0?{tone:"paid",main:`已购 ${be} 章`,sub:"购买项:章节"}:{tone:"free",main:"未购买",sub:""}},[]),[Vs,Hs]=y.useState(null),ln=y.useCallback(async()=>{try{const M=await Oe("/api/admin/users/online-stats");M!=null&&M.success&&typeof M.onlineCount=="number"?Hs(M.onlineCount):Hs(0)}catch{Hs(null)}},[]);y.useEffect(()=>{ln();const M=setInterval(ln,1e4);return()=>clearInterval(M)},[ln]);async function nr(M=!1){var ee;O(!0),M&&P(!0),L(null);try{if(Q){const be=new URLSearchParams({search:v,limit:String(g*5)}),Ae=await Oe(`/api/db/users/rfm?${be}`);if(Ae!=null&&Ae.success){let Ge=Ae.users||[];oe==="asc"&&(Ge=[...Ge].reverse());const Je=(f-1)*g;c(Ge.slice(Je,Je+g)),h(((ee=Ae.users)==null?void 0:ee.length)??0),Ge.length===0&&(se(!1),L("暂无订单数据,RFM 排序需要用户有购买记录后才能生效"))}else se(!1),L((Ae==null?void 0:Ae.error)||"RFM 加载失败,已切回普通模式")}else{const be=new URLSearchParams({page:String(f),pageSize:String(g),search:v,...T==="vip"&&{vip:"true"},...T==="complete"&&{pool:"complete"}}),Ae=await Oe(`/api/db/users?${be}`);Ae!=null&&Ae.success?(c(Ae.users||[]),h(Ae.total??0)):L((Ae==null?void 0:Ae.error)||"加载失败")}}catch(be){console.error("Load users error:",be),L("网络错误")}finally{O(!1),M&&P(!1)}}y.useEffect(()=>{m(1)},[v,T,Q]),y.useEffect(()=>{nr()},[f,g,v,T,Q,oe]);const gr=Math.ceil(u/g)||1,xr=()=>{Q?oe==="desc"?me("asc"):(se(!1),me("desc")):(se(!0),me("desc"))},ac=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 ic(M){var ee;if(!cN("用户")){G.info("已取消删除");return}try{const be=await Mi(`/api/db/users?id=${encodeURIComponent(M)}`);be!=null&&be.success?(G.success("已删除"),nr()):G.error("删除失败: "+((be==null?void 0:be.error)||"未知错误"))}catch(be){const Ae=be,Ge=((ee=Ae==null?void 0:Ae.data)==null?void 0:ee.error)||(Ae==null?void 0:Ae.message)||"网络错误";G.error("删除失败: "+Ge)}}const Aa=M=>{ge(M),At({phone:M.phone||"",nickname:M.nickname||"",password:"",isAdmin:!!(M.isAdmin??!1),hasFullBook:!!(M.hasFullBook??!1)}),Y(!0)},wd=()=>{ge(null),At({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),Y(!0)};async function rl(){if(!pt.phone||!pt.nickname){G.error("请填写手机号和昵称");return}V(!0);try{if(F){const M=await Zt("/api/db/users",{id:F.id,phone:pt.phone||void 0,nickname:pt.nickname,isAdmin:pt.isAdmin,hasFullBook:pt.hasFullBook,...pt.password&&{password:pt.password}});if(!(M!=null&&M.success)){G.error("更新失败: "+((M==null?void 0:M.error)||""));return}}else{const M=await Nt("/api/db/users",{phone:pt.phone,nickname:pt.nickname,password:pt.password,isAdmin:pt.isAdmin});if(!(M!=null&&M.success)){G.error("创建失败: "+((M==null?void 0:M.error)||""));return}}Y(!1),nr()}catch{G.error("保存失败")}finally{V(!1)}}async function vs(M){Z(M),fe(!0),q(!0);try{const ee=await Oe(`/api/db/users/referrals?userId=${encodeURIComponent(M.id)}`);ee!=null&&ee.success?de({referrals:ee.referrals||[],stats:ee.stats||{}}):de({referrals:[],stats:{}})}catch{de({referrals:[],stats:{}})}finally{q(!1)}}const ta=y.useCallback(async()=>{Wt(!0);try{const M=await Oe("/api/db/user-rules");M!=null&&M.success&&Vn((M.rules||[]).map(ee=>f8(ee)))}catch{}finally{Wt(!1)}},[]);async function na(){if(!Rt.title){G.error("请填写规则标题");return}V(!0);try{if(Hn){const M=await Zt("/api/db/user-rules",{id:Hn.id,...Rt});if(!(M!=null&&M.success)){G.error("更新失败: "+((M==null?void 0:M.error)||""));return}}else{const M=await Nt("/api/db/user-rules",Rt);if(!(M!=null&&M.success)){G.error("创建失败: "+((M==null?void 0:M.error)||""));return}}Mn(!1),ta()}catch{G.error("保存失败")}finally{V(!1)}}async function Ia(M){if(!cN("规则")){G.info("已取消删除");return}try{const ee=await Mi(`/api/db/user-rules?id=${M}`);ee!=null&&ee.success&&ta()}catch{}}async function Pa(M){try{await Zt("/api/db/user-rules",{id:M.id,enabled:!M.enabled}),ta()}catch{}}const Dn=y.useCallback(async()=>{rt(!0);try{const M=await Oe("/api/db/vip-members?limit=500");if(M!=null&&M.success&&M.data){const ee=[...M.data].map((be,Ae)=>({...be,vipSort:typeof be.vipSort=="number"?be.vipSort:Ae+1}));ee.sort((be,Ae)=>(be.vipSort??999999)-(Ae.vipSort??999999)),Me(ee)}else M&&M.error&&G.error(M.error)}catch{G.error("加载超级个体列表失败")}finally{rt(!1)}},[]),[Rr,sa]=y.useState(!1),[ai,yr]=y.useState(null),[As,Ra]=y.useState(""),[br,vr]=y.useState(!1),[Gi,Lr]=y.useState(!1),[ra,aa]=y.useState(null),[ii,oi]=y.useState(""),[is,Or]=y.useState(!1),li=["创业者","资源整合者","技术达人","投资人","产品经理","流量操盘手"],ci=M=>{yr(M),Ra(M.vipRole||""),sa(!0)},jd=M=>{aa(M),oi((M.webhookUrl||"").trim()),Lr(!0)},al=async M=>{const ee=M.trim();if(ai){if(!ee){G.error("请选择或输入标签");return}vr(!0);try{const be=await Zt("/api/db/users",{id:ai.id,vipRole:ee});if(!(be!=null&&be.success)){G.error((be==null?void 0:be.error)||"更新超级个体标签失败");return}G.success("已更新超级个体标签"),sa(!1),yr(null),await Dn()}catch{G.error("更新超级个体标签失败")}finally{vr(!1)}}},il=async()=>{if(!ra)return;const M=ii.trim();if(M&&!/^https?:\/\//i.test(M)){G.error("Webhook 地址需以 http/https 开头");return}Or(!0);try{const ee=await Zt("/api/db/vip-members/webhook",{userId:ra.id,webhookUrl:M});if(!(ee!=null&&ee.success)){G.error((ee==null?void 0:ee.error)||"保存飞书群 Webhook 失败");return}G.success(M?"已保存该超级个体的飞书群 Webhook":"已清空该超级个体的飞书群 Webhook"),Lr(!1),aa(null),await Dn()}catch{G.error("保存飞书群 Webhook 失败")}finally{Or(!1)}},[di,ia]=y.useState(!1),[La,ol]=y.useState(null),[oc,lc]=y.useState(""),[Ji,cc]=y.useState(!1),kd=M=>{ol(M),lc(M.vipSort!=null?String(M.vipSort):""),ia(!0)},dc=async()=>{if(!La)return;const M=Number(oc);if(!Number.isFinite(M)){G.error("请输入有效的数字序号");return}cc(!0);try{const ee=await Zt("/api/db/users",{id:La.id,vipSort:M});if(!(ee!=null&&ee.success)){G.error((ee==null?void 0:ee.error)||"更新排序序号失败");return}G.success("已更新排序序号"),ia(!1),ol(null),await Dn()}catch{G.error("更新排序序号失败")}finally{cc(!1)}},ll=(M,ee)=>{M.dataTransfer.effectAllowed="move",M.dataTransfer.setData("text/plain",ee),kt(ee)},uc=(M,ee)=>{M.preventDefault(),$e!==ee&&H(ee)},cl=()=>{kt(null),H(null)},hc=async(M,ee)=>{M.preventDefault();const be=M.dataTransfer.getData("text/plain")||Lt;if(kt(null),H(null),!be||be===ee)return;const Ae=Ne.find(Ve=>Ve.id===be),Ge=Ne.find(Ve=>Ve.id===ee);if(!Ae||!Ge)return;const Je=Ae.vipSort??Ne.findIndex(Ve=>Ve.id===be)+1,Vt=Ge.vipSort??Ne.findIndex(Ve=>Ve.id===ee)+1;Me(Ve=>{const Xt=[...Ve],Is=Xt.findIndex(pc=>pc.id===be),Dr=Xt.findIndex(pc=>pc.id===ee);if(Is===-1||Dr===-1)return Ve;const Yi=[...Xt],[Pd,Rd]=[Yi[Is],Yi[Dr]];return Yi[Is]={...Rd,vipSort:Je},Yi[Dr]={...Pd,vipSort:Vt},Yi});try{const[Ve,Xt]=await Promise.all([Zt("/api/db/users",{id:be,vipSort:Vt}),Zt("/api/db/users",{id:ee,vipSort:Je})]);if(!(Ve!=null&&Ve.success)||!(Xt!=null&&Xt.success)){G.error((Ve==null?void 0:Ve.error)||(Xt==null?void 0:Xt.error)||"更新排序失败"),await Dn();return}G.success("已更新排序"),await Dn()}catch{G.error("更新排序失败"),await Dn()}},dl=y.useCallback(async()=>{yt(!0);try{const M=await Oe("/api/db/users/journey-stats");M!=null&&M.success&&M.stats&&bt(M.stats)}catch{}finally{yt(!1)}},[]),E=y.useCallback(async M=>{It(M),Ts(!0);try{const ee=await Oe(`/api/db/users/journey-users?stage=${M}&limit=50`);ee!=null&&ee.success&&ee.users&&kn(ee.users)}catch{}finally{Ts(!1)}},[]),B=y.useCallback(async(M,ee)=>{ja(M),Za(ee),Jr(!0);try{const be=await Oe(`/api/db/users/tracks?userId=${M}&limit=50`);be!=null&&be.success&&be.tracks&&Ar(be.tracks)}catch{}finally{Jr(!1)}},[]),[ue,ke]=y.useState(!1),Ke=async()=>{ke(!0);try{const M=await Nt("/api/admin/shensheshou/batch-enrich",{limit:20});M!=null&&M.success?(G.success(`批量补全完成:${M.enriched} 人已补全,${M.skipped} 人跳过`),nr()):G.error((M==null?void 0:M.error)||"批量补全失败")}catch{G.error("批量补全请求失败")}finally{ke(!1)}},xt=M=>{const ee=[M.phone,M.nickname,M.avatar,M.wechatId,M.mbti,M.industry,M.region,M.position],be=ee.filter(Ae=>Ae!=null&&Ae!=="").length;return Math.round(be/ee.length*100)},{leadsRows:at,leadsRawCount:_n,leadsDeduped:Yn}=y.useMemo(()=>{const M=Ve=>(Ve||"").replace(/\D/g,"")||"",ee=Ve=>{const Xt=M(Ve.phone);if(Xt)return`phone:${Xt}`;const Is=(Ve.userId||"").trim();if(Is)return`user:${Is}`;const Dr=(Ve.wechatId||"").trim();return Dr?`wechat:${Dr}`:`row:${Ve.id}`},be=Yr.trim().toLowerCase();let Ae=fr;be&&(Ae=fr.filter(Ve=>[Ve.userNickname,Ve.name,Ve.phone,Ve.wechatId,Ve.personName,Ve.source,Ve.planApiKey].filter(Boolean).join(" ").toLowerCase().includes(be)));const Ge=[...Ae].sort((Ve,Xt)=>{const Is=Ve.createdAt?new Date(Ve.createdAt).getTime():0;return(Xt.createdAt?new Date(Xt.createdAt).getTime():0)-Is});if(!Ca)return{leadsRows:Ge,leadsRawCount:Ae.length,leadsDeduped:0};const Je=new Set,Vt=[];for(const Ve of Ge){const Xt=ee(Ve);Je.has(Xt)||(Je.add(Xt),Vt.push(Ve))}return{leadsRows:Vt,leadsRawCount:Ae.length,leadsDeduped:Ae.length-Vt.length}},[fr,Yr,Ca]);y.useEffect(()=>{const M=at.map(Ae=>Ae.id),ee=M.filter(Ae=>bs.includes(Ae)).length,be=ti.current;be&&(be.indeterminate=ee>0&&eebe.id),ee=M.length>0&&M.every(be=>bs.includes(be));er(ee?be=>be.filter(Ae=>!M.includes(Ae)):be=>[...new Set([...be,...M])])}function sr(M){er(ee=>ee.includes(M)?ee.filter(be=>be!==M):[...ee,M])}async function Un(){if(bs.length===0){G.info("请先勾选要删除的记录");return}const M=bs.length;if(!confirm(`确定批量删除选中的 ${M} 条获客记录?删除后不可恢复。`))return;const ee=500;mr(!0);try{let be=0;for(let Ae=0;Ae{const ee=M||"";return ee==="success"?s.jsx(Be,{className:"bg-emerald-500/20 text-emerald-300 border-0 text-xs",children:"已推送(存客宝已接收)"}):ee==="pending_verify"?s.jsx(Be,{className:"bg-sky-500/20 text-sky-300 border-0 text-xs",children:"待通过 / 处理中"}):ee==="expired"?s.jsx(Be,{className:"bg-gray-500/20 text-gray-300 border-0 text-xs",children:"已过期"}):ee==="failed"?s.jsx(Be,{className:"bg-red-500/20 text-red-300 border-0 text-xs",children:"失败"}):ee==="pending"?s.jsx(Be,{className:"bg-amber-500/20 text-amber-300 border-0 text-xs",children:"待推送"}):ee?s.jsx(Be,{className:"bg-violet-500/20 text-violet-300 border-0 text-xs",title:ee,children:ee}):s.jsx(Be,{className:"bg-amber-500/20 text-amber-300 border-0 text-xs",children:"待推送"})},Sd=y.useMemo(()=>{const M=new Map;for(const ee of at){if(ee.pushStatus!=="failed")continue;const be=(ee.ckbError||"未知错误").trim()||"未知错误";M.set(be,(M.get(be)||0)+1)}return Array.from(M.entries()).map(([ee,be])=>({reason:ee,count:be})).sort((ee,be)=>be.count-ee.count)},[at]);async function Cd(){const M=at.filter(Je=>Je.pushStatus==="failed");if(M.length===0){G.info("当前页无失败记录");return}const ee=Sd.slice(0,8).map(Je=>`- ${Je.reason}:${Je.count} 条`).join(` +`),be=M.slice(0,30).map(Je=>Je.id).join(", "),Ae=M.slice(0,20).map(Je=>`#${Je.id} | ${Je.userNickname||Je.name||"-"} | 手机:${Je.phone||"-"} | 来源:${Je.source||"-"} | 重试:${Je.retryCount??0} | 错误:${Je.ckbError||"-"}`).join(` +`),Ge=["【获客失败排障信息】",`时间:${new Date().toLocaleString()}`,`当前页失败总数:${M.length}`,"主要失败原因:",ee||"- 无",`最近失败记录ID(最多30条):${be||"无"}`,"","失败记录明细(最多20条):",Ae||"无"].join(` +`);try{await navigator.clipboard.writeText(Ge),G.success("已复制排障信息")}catch{G.error("复制失败,请检查浏览器剪贴板权限")}}return s.jsxs("div",{className:"p-8 w-full",children:[z&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[s.jsx("span",{children:z}),s.jsx("button",{type:"button",onClick:()=>L(null),children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-start gap-6 mb-6 flex-wrap",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"用户管理"}),s.jsxs("p",{className:"text-gray-400 mt-1 text-sm",children:["共 ",u," 位注册用户",Vs!==null&&s.jsxs("span",{className:"text-[#38bdac] ml-1",children:["· 在线 ",Vs," 人"]}),Q&&" · RFM 排序中"]})]}),s.jsx(De,{className:"shrink-0 w-full max-w-md border-[#38bdac]/35 bg-[#0f2137]/90",children:s.jsxs(_e,{className:"p-3 sm:p-4 space-y-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsxs("button",{type:"button",onClick:()=>ie(M=>!M),className:"flex items-center gap-2 min-w-0 flex-1 text-left rounded-lg px-1 py-0.5 hover:bg-white/5 transition-colors","aria-expanded":$,children:[s.jsx(Lf,{className:"w-5 h-5 text-[#38bdac] shrink-0"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-semibold text-white",children:"算法配置"}),s.jsx("div",{className:"text-xs text-gray-500 truncate",children:$?"RFM · Are you good(用户价值分层)":"RFM · 点击展开说明"})]}),$?s.jsx(zx,{className:"w-4 h-4 text-gray-400 shrink-0"}):s.jsx(_l,{className:"w-4 h-4 text-gray-400 shrink-0"})]}),s.jsx(J,{type:"button",variant:"outline",size:"sm",onClick:xr,className:"border-[#38bdac]/50 text-[#38bdac] hover:bg-[#38bdac]/10 bg-transparent shrink-0",children:Q?oe==="desc"?"RFM 降序":"RFM 升序":"按 RFM 排序"})]}),$&&s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-xs text-gray-400 leading-relaxed",children:["综合分 0–100(六维度):最近消费 R(25%)+ 订单频次 F(20%)+ 累计金额 M(20%)+ 推荐人数(15%)+ 行为轨迹(10%)+ 资料完善(10%)。各维度在全量用户中归一化,与后端"," ",s.jsx("code",{className:"text-gray-500",children:"/api/db/users/rfm"})," 一致。"]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:p8.map(({level:M,range:ee,label:be})=>s.jsxs(Be,{variant:"outline",className:`text-[10px] border-0 ${ac(M)}`,children:[M," ",ee," · ",be]},M))})]})]})})]}),s.jsxs(sd,{value:a,onValueChange:M=>{const ee=new URLSearchParams(t);M==="users"?ee.delete("tab"):ee.set("tab",M),e(ee)},className:"w-full",children:[s.jsxs(Vl,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-6 flex-wrap h-auto gap-1",children:[s.jsxs(en,{value:"users",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",children:[s.jsx(Kn,{className:"w-4 h-4"})," 用户列表"]}),s.jsxs(en,{value:"leads",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:()=>vt(),children:[s.jsx(Gc,{className:"w-4 h-4"})," 获客列表"]}),s.jsxs(en,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:dl,children:[s.jsx(pa,{className:"w-4 h-4"})," 用户旅程总览"]}),s.jsxs(en,{value:"rules",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:ta,children:[s.jsx(Eo,{className:"w-4 h-4"})," 规则配置"]}),s.jsxs(en,{value:"vip-roles",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Dn,children:[s.jsx(Qc,{className:"w-4 h-4"})," 超级个体列表"]})]}),s.jsxs(tn,{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:Ke,disabled:ue,className:"border-purple-500/50 text-purple-400 hover:bg-purple-500/10 bg-transparent",title:"批量调用神射手补全有手机号用户的资料",children:[ue?s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(zo,{className:"w-4 h-4 mr-2"}),"批量补全"]}),s.jsxs(J,{variant:"outline",onClick:()=>nr(!0),disabled:U,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${U?"animate-spin":""}`})," 刷新"]}),s.jsxs("select",{value:T,onChange:M=>{const ee=M.target.value;C(ee),m(1),n&&(t.delete("pool"),e(t))},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",disabled:Q,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(xa,{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:N,onChange:M=>j(M.target.value)})]}),s.jsxs(J,{onClick:wd,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Gc,{className:"w-4 h-4 mr-2"})," 添加用户"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:R?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(fs,{children:[s.jsx(ps,{children:s.jsxs(gt,{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:xr,children:[s.jsxs("div",{className:"flex items-center gap-1 group",children:[s.jsx(Lf,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"RFM分值"}),Q?oe==="desc"?s.jsx(_l,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(zx,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(Dg,{className:"w-3.5 h-3.5 text-gray-600 group-hover:text-gray-400"})]}),Q&&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:[o.map(M=>{var ee,be,Ae;return s.jsxs(gt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(je,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[(()=>{var Vt;const Ge=Ma(M.avatar,M.mbti),Je=((Vt=M.nickname)==null?void 0:Vt.charAt(0))||"?";return s.jsx("button",{type:"button",title:"点击管理 MBTI 默认头像库",onClick:()=>jn(!0),className:"w-10 h-10 shrink-0 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] overflow-hidden ring-1 ring-transparent hover:ring-[#38bdac]/60 transition",children:Ge?s.jsx("img",{src:Ge,className:"w-full h-full rounded-full object-cover",alt:"",onError:Ve=>{var Dr;const Xt=Ve.target;if(Xt.style.display="none",Xt.nextElementSibling)return;const Is=document.createElement("span");Is.textContent=Je,(Dr=Xt.parentElement)==null||Dr.appendChild(Is)}}):Je})})(),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("button",{type:"button",onClick:()=>{Ue(M.id),we(!0)},className:"font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left truncate max-w-[120px]",children:M.nickname}),M.isAdmin&&s.jsx(Be,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),M.openId&&!((ee=M.id)!=null&&ee.startsWith("user_"))&&s.jsx(Be,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0 text-xs",children:"微信"})]}),s.jsxs("p",{className:"text-xs text-gray-500 font-mono truncate max-w-[140px]",title:M.id,children:[(be=M.id)==null?void 0:be.slice(0,16),(((Ae=M.id)==null?void 0:Ae.length)??0)>16?"…":""]})]})]})}),s.jsx(je,{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(je,{children:(()=>{const Ge=ea(M);return Ge.tone==="vip"?s.jsxs("div",{className:"space-y-1",children:[s.jsx(Be,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:Ge.main}),Ge.sub&&s.jsx("p",{className:"text-[11px] text-amber-300/80",children:Ge.sub})]}):Ge.tone==="paid"?s.jsxs("div",{className:"space-y-1",children:[s.jsx(Be,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:Ge.main}),Ge.sub&&s.jsx("p",{className:"text-[11px] text-blue-300/80",children:Ge.sub})]}):s.jsx(Be,{variant:"outline",className:"text-gray-500 border-gray-600",children:Ge.main})})()}),s.jsx(je,{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:()=>vs(M),role:"button",tabIndex:0,onKeyDown:Ge=>Ge.key==="Enter"&&vs(M),children:[s.jsx(Kn,{className:"w-3 h-3"})," 绑定",M.referralCount||0,"人"]})]})}),s.jsx(je,{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 ${ac(M.rfmLevel)}`,children:M.rfmLevel})]}):s.jsx("span",{className:"text-gray-600 text-xs",children:"无订单"})}),s.jsx(je,{children:(()=>{const Ge=xt(M),Je=Ge>=75?"text-green-400":Ge>=50?"text-yellow-400":"text-gray-500";return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-12 h-1.5 bg-gray-700 rounded-full overflow-hidden",children:s.jsx("div",{className:`h-full rounded-full ${Ge>=75?"bg-green-500":Ge>=50?"bg-yellow-500":"bg-gray-500"}`,style:{width:`${Ge}%`}})}),s.jsxs("span",{className:`text-xs ${Je}`,children:[Ge,"%"]})]})})()}),s.jsx(je,{className:"text-gray-400",children:M.createdAt?new Date(M.createdAt).toLocaleDateString():"-"}),s.jsx(je,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>{Ue(M.id),we(!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:()=>Aa(M),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑用户",children:s.jsx(sn,{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:()=>ic(M.id),title:"删除",children:s.jsx(ts,{className:"w-4 h-4"})})]})})]},M.id)}),o.length===0&&s.jsx(gt,{children:s.jsx(je,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),s.jsx(qs,{page:f,totalPages:gr,total:u,pageSize:g,onPageChange:m,onPageSizeChange:M=>{b(M),m(1)}})]})})})]}),s.jsxs(tn,{value:"leads",children:[Pr&&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:Pr}),s.jsx("button",{type:"button",className:"shrink-0 ml-2",onClick:()=>Qr(null),"aria-label":"关闭",children:"×"})]}),!nn&&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:ka})]}),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:Xs.uniqueUsers??0})]}),(Xs.sourceStats&&Xs.sourceStats.length>0?Xs.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))]}),!nn&&Sd.length>0&&s.jsx(De,{className:"bg-[#3a1010]/35 border-red-900/60 shadow-lg mb-4",children:s.jsxs(_e,{className:"p-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 mb-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-red-200 font-medium",children:"失败原因聚合"}),s.jsx("p",{className:"text-red-300/70 text-xs",children:"基于当前页筛选结果,按失败原因聚合统计"})]}),s.jsx(J,{type:"button",variant:"outline",onClick:Cd,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:Sd.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(xa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(le,{placeholder:"搜索昵称/手机/微信/@人/来源/类型…",value:Tt,onChange:M=>Jn(M.target.value),className:"pl-9 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"})]}),Xs.sourceStats&&Xs.sourceStats.length>0&&s.jsxs("select",{value:Sa,onChange:M=>{mn(M.target.value),Pt(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部来源"}),Xs.sourceStats.map(M=>s.jsxs("option",{value:M.source,children:[M.source,"(",M.cnt,")"]},M.source))]}),s.jsxs("select",{value:Xr,onChange:M=>{const ee=M.target.value;ei(ee),Pt(1),e(be=>{const Ae=new URLSearchParams(be);return Ae.set("tab","leads"),ee?Ae.set("leadAction",ee):Ae.delete("leadAction"),Ae})},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",title:"按业务类型筛选",children:[s.jsx("option",{value:"",children:"全部类型"}),s.jsx("option",{value:"lead",children:"留资线索(文章@ / 首页链接)"}),s.jsx("option",{value:"join",children:"加入报名(导师 / 资源对接 / 团队)"}),s.jsx("option",{value:"match",children:"匹配上报(找伙伴匹配)"})]}),s.jsxs("label",{className:"flex items-center gap-2 text-xs text-gray-400 select-none bg-[#0f2137] border border-gray-700 rounded-lg px-3 py-2",children:[s.jsx("input",{type:"checkbox",checked:Ca,onChange:M=>Hi(M.target.checked),className:"w-4 h-4 rounded border-gray-600 bg-[#0f2137] accent-[#38bdac] cursor-pointer"}),"去重展示"]}),s.jsxs("select",{value:pr,onChange:M=>{Ms(M.target.value),Pt(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部状态"}),s.jsx("option",{value:"pending",children:"待推送"}),s.jsx("option",{value:"success",children:"已推送(存客宝已接收)"}),s.jsx("option",{value:"pending_verify",children:"待通过 / 处理中"}),s.jsx("option",{value:"expired",children:"已过期"}),s.jsx("option",{value:"failed",children:"推送失败"})]}),s.jsx(J,{type:"button",variant:"outline",onClick:()=>{Ms("failed"),Pt(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:["本页 ",_n," 条",Yn>0?` · 已合并 ${Yn} 条重复`:""]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx(J,{variant:"outline",onClick:rc,disabled:nn,className:"border-cyan-600/60 text-cyan-300 hover:bg-cyan-500/10 bg-transparent",children:"导出失败清单"}),s.jsxs(J,{variant:"outline",onClick:ri,disabled:Zr||tr||nn,className:"border-amber-600/60 text-amber-300 hover:bg-amber-500/10 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${Zr?"animate-spin":""}`}),"重推本页失败项"]}),s.jsxs(J,{variant:"outline",onClick:()=>void Un(),disabled:tr||bs.length===0||nn,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-2 ${tr?"animate-pulse":""}`}),tr?"删除中…":`批量删除(${bs.length})`]}),s.jsxs(J,{variant:"outline",onClick:()=>vt(),disabled:nn,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${nn?"animate-spin":""}`})," 刷新"]})]})]}),!nn&&at.length>0&&s.jsxs("p",{className:"text-xs text-gray-500 mb-2",children:["已选 ",s.jsx("span",{className:"text-[#38bdac]",children:bs.length})," 条 · 可翻页继续勾选 · 改搜索/筛选会清空选择",bs.length>0&&s.jsx("button",{type:"button",className:"ml-2 text-gray-400 hover:text-gray-200 underline",onClick:()=>er([]),children:"清空"})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:nn?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs("div",{children:[s.jsxs(fs,{children:[s.jsx(ps,{children:s.jsxs(gt,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(Se,{className:"text-gray-400 w-10 text-center",children:s.jsx("input",{ref:ti,type:"checkbox",checked:at.length>0&&at.every(M=>bs.includes(M.id)),onChange:Sn,className:"w-4 h-4 rounded border-gray-600 bg-[#0f2137] accent-[#38bdac] cursor-pointer",title:"全选本页(展示行)"})}),s.jsx(Se,{className:"text-gray-400",children:"昵称"}),s.jsx(Se,{className:"text-gray-400",children:"手机号"}),s.jsx(Se,{className:"text-gray-400",children:"微信号"}),s.jsx(Se,{className:"text-gray-400",children:"对应 @人"}),s.jsx(Se,{className:"text-gray-400",children:"获客计划(Key)"}),s.jsx(Se,{className:"text-gray-400",children:"推送状态"}),s.jsx(Se,{className:"text-gray-400",children:"时间"}),s.jsx(Se,{className:"text-gray-400",children:"重试"})]})}),s.jsxs(ms,{children:[at.map(M=>s.jsxs(gt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(je,{className:"text-center align-middle w-10",children:s.jsx("input",{type:"checkbox",checked:bs.includes(M.id),onChange:()=>sr(M.id),disabled:tr,className:"w-4 h-4 rounded border-gray-600 bg-[#0f2137] accent-[#38bdac] cursor-pointer"})}),s.jsx(je,{className:"text-gray-300 align-middle",children:s.jsx(m8,{userId:M.userId,userAvatar:M.userAvatar,nickname:M.userNickname,name:M.name,onOpenDetail:ee=>{Ue(ee),we(!0)}})}),s.jsx(je,{className:"text-gray-300",children:M.phone||"-"}),s.jsx(je,{className:"text-gray-300",children:M.wechatId||"-"}),s.jsx(je,{className:"text-[#38bdac]",children:M.personName||"-"}),s.jsx(je,{className:"text-gray-400 text-xs",children:(()=>{const ee=(M.planApiKey||"").trim();if(!ee)return"-";const be=ee.length<=10?ee:`${ee.slice(0,6)}…${ee.slice(-4)}`;return s.jsx("button",{type:"button",className:"font-mono text-gray-400 hover:text-gray-200 underline decoration-dotted",title:ee,onClick:async()=>{try{await navigator.clipboard.writeText(ee),G.success("已复制计划Key")}catch{G.error("复制失败,请手动复制")}},children:be})})()}),s.jsx(je,{children:s.jsxs("div",{className:"space-y-1",children:[fc(M.pushStatus),(typeof M.ckbCode=="number"||(M.ckbMessage||"").trim())&&s.jsx("p",{className:"text-[11px] text-gray-500 max-w-[260px] truncate",title:[typeof M.ckbCode=="number"?`code=${M.ckbCode}`:"",(M.ckbMessage||"").trim()?`message=${String(M.ckbMessage).trim()}`:"",(M.ckbData||"").trim()?`data=${String(M.ckbData).trim()}`:""].filter(Boolean).join(" | "),children:[typeof M.ckbCode=="number"?`code=${M.ckbCode}`:"",(M.ckbMessage||"").trim()?String(M.ckbMessage).trim():""].filter(Boolean).join(" · ")}),!!(M.ckbData||"").trim()&&s.jsx("button",{type:"button",className:"text-[11px] text-sky-300/90 hover:text-sky-200 underline decoration-dotted",onClick:()=>{const ee=String(M.ckbData||"").trim();Ea(`存客宝返回 data(#${M.id})`),Ta(g8(ee)),ni(!0)},children:"查看 data"}),!!M.ckbError&&s.jsx("p",{className:"text-[11px] text-red-300 max-w-[220px] truncate",title:M.ckbError,children:M.ckbError})]})}),s.jsx(je,{className:"text-gray-400 whitespace-nowrap",children:M.createdAt?new Date(M.createdAt).toLocaleString():"-"}),s.jsx(je,{className:"text-gray-400 text-xs align-top py-3 min-w-[148px]",children:s.jsxs("div",{className:"flex flex-col gap-3",children:[s.jsx("p",{className:"text-gray-400 leading-snug",children:typeof M.retryCount=="number"?`第 ${M.retryCount} 次`:"-"}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs(J,{size:"sm",variant:"outline",disabled:tr||Ui===M.id||el===M.id,onClick:()=>sl(M.id),className:"h-8 px-2.5 text-[11px] border-gray-600 text-gray-200 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(He,{className:`w-3 h-3 mr-1 ${Ui===M.id?"animate-spin":""}`}),"重推"]}),s.jsxs(J,{size:"sm",variant:"outline",disabled:tr||el===M.id||Ui===M.id,onClick:()=>si(M.id),className:"h-8 px-2.5 text-[11px] border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent shrink-0",children:[s.jsx(ts,{className:`w-3 h-3 mr-1 ${el===M.id?"animate-pulse":""}`}),"删除"]})]})]})})]},M.id)),at.length===0&&s.jsx(gt,{children:s.jsx(je,{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(Gc,{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:Yr.trim()||Sa?"当前搜索或来源筛选下没有匹配记录,可清空条件后重试。":"存客宝场景产生的手机号 / 微信留资会出现在此列表。请确认获客计划已开启,并有用户完成留资。"}),s.jsxs(J,{type:"button",variant:"outline",onClick:()=>vt(),disabled:nn,className:"border-[#38bdac]/40 text-[#38bdac] hover:bg-[#38bdac]/10 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${nn?"animate-spin":""}`}),"重新加载"]})]})})})]})]}),s.jsx(qs,{page:ve,totalPages:Math.ceil(ka/Yt)||1,total:ka,pageSize:Yt,onPageChange:Pt,onPageSizeChange:()=>{}})]})})})]}),s.jsxs(tn,{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:dl,disabled:Ft,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${Ft?"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:$c.map((M,ee)=>s.jsxs("div",{className:"relative flex flex-col items-center",children:[s.jsxs("div",{className:`relative w-full p-3 rounded-xl border ${M.color} text-center cursor-pointer hover:opacity-80 transition-opacity ${ht===M.id?"ring-2 ring-[#38bdac]":""}`,onClick:()=>E(M.id),title:`点击查看「${M.label}」阶段的用户`,children:[s.jsx("div",{className:"text-2xl mb-1",children:M.icon}),s.jsx("div",{className:`text-xs font-medium ${M.color.split(" ").find(be=>be.startsWith("text-"))}`,children:M.label}),Qe[M.id]!==void 0&&s.jsxs("div",{className:"mt-1.5 text-xs text-gray-400",children:[s.jsx("span",{className:"font-bold text-white",children:Qe[M.id]})," 人"]}),s.jsx("div",{className:"absolute -top-2.5 -left-2.5 w-5 h-5 rounded-full bg-[#0a1628] border border-gray-700 flex items-center justify-center text-[10px] text-gray-500",children:ee+1})]}),ee<$c.length-1&&s.jsx("div",{className:"hidden lg:block absolute right-0 top-1/2 -translate-y-1/2 translate-x-1/2 z-10",children:s.jsx("svg",{width:"20",height:"12",viewBox:"0 0 20 12",fill:"none",children:s.jsx("path",{d:"M0 6H16M16 6L11 1M16 6L11 11",stroke:"#374151",strokeWidth:"1.5",strokeLinecap:"round"})})}),s.jsx("p",{className:"text-[10px] text-gray-600 text-center mt-2 leading-tight",children:M.desc})]},M.id))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"bg-[#0f2137] border border-gray-700/50 rounded-lg p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(pa,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-white font-medium",children:"旅程关键节点"})]}),s.jsx("div",{className:"space-y-2 text-sm",children:[{step:"① 注册",action:"微信 OAuth 或手机号注册",next:"提示设置头像与昵称"},{step:"② 浏览",action:"点击章节/阅读免费内容",next:"触发绑定手机"},{step:"③ 首付",action:"购买单章或全书",next:"推送分销功能"},{step:"④ VIP",action:"¥1980 购买全书",next:"进入 VIP 私域群"},{step:"⑤ 分销",action:"推广好友购买",next:"提现分销收益"}].map(M=>s.jsxs("div",{className:"flex items-start gap-3 p-2 bg-[#0a1628] rounded",children:[s.jsx("span",{className:"text-[#38bdac] font-mono text-xs shrink-0 mt-0.5",children: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(ur,{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:"实时更新"})]}),Ft?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(He,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Object.keys(Qe).length>0?s.jsx("div",{className:"space-y-2",children:(()=>{const M=$c.reduce((ee,be)=>ee+(Qe[be.id]||0),0);return $c.map(ee=>{const be=Qe[ee.id]||0,Ae=M>0?Math.round(be/M*100):0,Ge=be>0?Math.max(Ae,6):0;return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-gray-500 text-xs w-[5.5rem] shrink-0 leading-tight",children:[ee.icon," ",ee.label]}),s.jsx("div",{className:"flex-1 h-2.5 bg-[#0a1628] rounded-full overflow-hidden border border-gray-700/40",children:s.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-[#38bdac]/50 to-[#38bdac] transition-all",style:{width:`${Ge}%`}})}),s.jsx("span",{className:"text-gray-400 text-xs w-14 text-right tabular-nums",children:be}),s.jsx("span",{className:"text-gray-600 text-[10px] w-8 text-right tabular-nums",children:M>0?`${Ae}%`:"—"})]},ee.id)})})()}):s.jsx("div",{className:"text-center py-8",children:s.jsx("p",{className:"text-gray-500 text-sm",children:"点击「刷新数据」加载统计"})})]})]}),ht&&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(Kn,{className:"w-4 h-4 text-[#38bdac]"}),s.jsxs("span",{className:"text-white font-medium",children:[(Qi=$c.find(M=>M.id===ht))==null?void 0:Qi.icon," ",(Zu=$c.find(M=>M.id===ht))==null?void 0:Zu.label," 阶段用户"]}),s.jsxs(Be,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-xs",children:[Kt.length," 人"]})]}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>It(null),className:"text-gray-400 hover:text-white",children:s.jsx(ns,{className:"w-4 h-4"})})]}),Es?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(He,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Kt.length===0?s.jsx("p",{className:"text-gray-500 text-center py-6",children:"该阶段暂无用户"}):s.jsxs(fs,{children:[s.jsx(ps,{children:s.jsxs(gt,{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:Kt.map(M=>s.jsxs(gt,{className:"border-gray-700/50 hover:bg-[#0a1628]",children:[s.jsx(je,{className:"text-white",children:M.nickname||"微信用户"}),s.jsx(je,{className:"text-gray-300",children:M.phone||"-"}),s.jsx(je,{className:"text-gray-400 text-xs",children:M.createdAt?new Date(M.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx(je,{className:"text-right",children:s.jsxs(J,{variant:"ghost",size:"sm",className:"text-[#38bdac] hover:bg-[#38bdac]/10",onClick:()=>B(M.id,M.nickname||"微信用户"),children:[s.jsx(Rf,{className:"w-4 h-4 mr-1"})," 行为轨迹"]})})]},M.id))})]})]}),s.jsx(Dt,{open:!!Vi,onOpenChange:M=>{M||ja(null)},children:s.jsxs(Ot,{className:"sm:max-w-[600px] bg-[#0f2137] border-gray-700 text-white max-h-[80vh] overflow-y-auto",children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(pa,{className:"w-5 h-5 text-[#38bdac]"}),Xa," 的行为轨迹"]})}),Ir?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):Mr.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"}),Mr.map((M,ee)=>s.jsxs("div",{className:"relative flex items-start gap-3 py-2",children:[s.jsx("div",{className:"absolute left-[-13px] top-3 w-2.5 h-2.5 rounded-full bg-[#38bdac] border-2 border-[#0f2137] z-10"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"text-white text-sm font-medium",children:M.actionLabel}),M.module&&s.jsx(Be,{className:"bg-purple-500/10 text-purple-400 border border-purple-500/30 text-[10px]",children:M.module})]}),(M.chapterTitle||M.target)&&s.jsx("p",{className:"text-gray-400 text-xs mt-0.5 truncate",children:M.chapterTitle||M.target}),s.jsxs("p",{className:"text-gray-600 text-[10px] mt-0.5",children:[M.timeAgo," · ",M.createdAt?new Date(M.createdAt).toLocaleString("zh-CN"):""]})]})]},M.id||ee))]})]})})]}),s.jsxs(tn,{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:ta,disabled:pn,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${pn?"animate-spin":""}`})," 刷新"]}),s.jsxs(J,{onClick:()=>{rs(null),vn({title:"",description:"",trigger:"",triggerConditions:[],actionType:"popup",sort:0,enabled:!0}),Mn(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(zn,{className:"w-4 h-4 mr-2"})," 添加规则"]})]})]}),pn?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):fn.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(ur,{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:ta,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(He,{className:"w-4 h-4 mr-2"})," 重新加载"]})]}):s.jsx("div",{className:"space-y-2",children:fn.map(M=>{var be;const ee=E2(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(sn,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0"}),s.jsx("span",{className:"text-white font-medium text-sm truncate",children:M.title}),M.trigger&&s.jsx(Be,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-[10px] shrink-0",children:M.trigger}),ee.length>0&&s.jsxs("div",{className:"flex flex-wrap gap-0.5 ml-1",children:[ee.slice(0,3).map(Ae=>{const Ge=oN.find(Je=>Je.value===Ae);return s.jsx(Be,{className:"bg-purple-500/10 text-purple-400 border border-purple-500/30 text-[9px]",children:(Ge==null?void 0:Ge.label)||Ae},Ae)}),ee.length>3&&s.jsxs("span",{className:"text-gray-500 text-[9px]",children:["+",ee.length-3]})]}),M.actionType&&M.actionType!=="popup"&&s.jsx(Be,{className:"bg-amber-500/10 text-amber-400 border border-amber-500/30 text-[9px] shrink-0",children:((be=lN.find(Ae=>Ae.value===M.actionType))==null?void 0:be.label)||M.actionType})]}),s.jsxs("div",{className:"flex items-center gap-1.5 ml-3 shrink-0",children:[s.jsx(Ut,{checked:M.enabled,onCheckedChange:()=>Pa(M)}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>{rs(M),vn({title:M.title,description:M.description,trigger:M.trigger,triggerConditions:ee,actionType:M.actionType||"popup",sort:M.sort,enabled:M.enabled}),Mn(!0)},className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10 h-7 w-7 p-0",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>Ia(M.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10 h-7 w-7 p-0",children:s.jsx(ts,{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(tn,{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:Dn,disabled:We,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${We?"animate-spin":""}`})," ","刷新"]})})]}),We?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):Ne.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(Qc,{className:"w-12 h-12 text-amber-400/30 mx-auto mb-4"}),s.jsx("p",{className:"text-gray-400 mb-4",children:"当前没有有效的超级个体用户。"})]}):s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:s.jsxs(fs,{children:[s.jsx(ps,{children:s.jsxs(gt,{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:Ne.map((M,ee)=>{var Ge;const be=Lt===M.id,Ae=$e===M.id;return s.jsxs(gt,{draggable:!0,onDragStart:Je=>ll(Je,M.id),onDragOver:Je=>uc(Je,M.id),onDrop:Je=>hc(Je,M.id),onDragEnd:cl,className:`border-gray-700/50 cursor-grab active:cursor-grabbing select-none ${be?"opacity-60":""} ${Ae?"bg-[#38bdac]/10":""}`,children:[s.jsx(je,{className:"text-gray-300",children:ee+1}),s.jsx(je,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[Ma(M.avatar,M.mbti)?s.jsx("img",{src:Ma(M.avatar,M.mbti),className:"w-8 h-8 rounded-full object-cover border border-amber-400/60",alt:"",onError:Je=>{var Ve,Xt;Je.target.style.display="none";const Vt=document.createElement("div");Vt.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",Vt.textContent=((Ve=M.name)==null?void 0:Ve[0])||"创",(Xt=Je.target.parentElement)==null||Xt.appendChild(Vt)}}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/20 border border-amber-400/60 flex items-center justify-center text-amber-300 text-sm",children:((Ge=M.name)==null?void 0:Ge[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:M.name})})]})}),s.jsx(je,{className:"text-gray-300 whitespace-nowrap",children:M.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置)"})}),s.jsx(je,{className:"text-center text-blue-400 text-xs font-mono",children:M.clickCount!=null?String(M.clickCount):"-"}),s.jsx(je,{className:"text-center text-green-400 text-xs font-mono",children:M.leadCount!=null?String(M.leadCount):"-"}),s.jsx(je,{className:"text-gray-300",children:M.vipSort??ee+1}),s.jsx(je,{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(je,{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:()=>ci(M),title:"设置超级个体标签",children:s.jsx(gu,{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:()=>jd(M),title:"编辑飞书群Webhook",children:s.jsx(sn,{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:()=>kd(M),title:"设置排序序号",children:s.jsx(Dg,{className:"w-3.5 h-3.5"})})]})})]},M.id)})})]})})})]})]}),s.jsx(Dt,{open:wt,onOpenChange:jn,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-6xl",children:[s.jsx(_t,{children:s.jsx($t,{className:"text-white",children:"MBTI 默认头像库"})}),s.jsx(h8,{})]})}),s.jsx(Dt,{open:di,onOpenChange:M=>{ia(M),M||ol(null)},children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(Dg,{className:"w-5 h-5 text-[#38bdac]"}),"设置排序 — ",La==null?void 0:La.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(te,{className:"text-gray-300 text-sm",children:"排序序号(数字越小越靠前)"}),s.jsx(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:1",value:oc,onChange:M=>lc(M.target.value)})]}),s.jsxs(rn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>ia(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(ns,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:dc,disabled:Ji,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),Ji?"保存中...":"保存"]})]})]})}),s.jsx(Dt,{open:Rr,onOpenChange:M=>{sa(M),M||yr(null)},children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(Qc,{className:"w-5 h-5 text-amber-400"}),"设置超级个体标签 — ",ai==null?void 0:ai.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(te,{className:"text-gray-300 text-sm",children:"选择或输入标签"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:li.map(M=>s.jsx(J,{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:()=>Ra(M),children:M},M))}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"或手动输入"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创业者、资源整合者等",value:As,onChange:M=>Ra(M.target.value)})]})]}),s.jsxs(rn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>sa(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(ns,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:()=>al(As),disabled:br,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),br?"保存中...":"保存"]})]})]})}),s.jsx(Dt,{open:Gi,onOpenChange:M=>{Lr(M),M||aa(null)},children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-xl",children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(sn,{className:"w-5 h-5 text-[#38bdac]"}),"设置飞书群 Webhook — ",ra==null?void 0:ra.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(te,{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:ii,onChange:M=>oi(M.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"当用户点击该超级个体头像并提交链接时,线索将优先推送到这里配置的飞书群。"})]}),s.jsxs(rn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>Lr(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(ns,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:il,disabled:is,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),is?"保存中...":"保存"]})]})]})}),s.jsx(Dt,{open:I,onOpenChange:Y,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[F?s.jsx(sn,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(Gc,{className:"w-5 h-5 text-[#38bdac]"}),F?"编辑用户":"添加用户"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"手机号"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:pt.phone,onChange:M=>At({...pt,phone:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"昵称"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:pt.nickname,onChange:M=>At({...pt,nickname:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:F?"新密码 (留空则不修改)":"密码"}),s.jsx(le,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:F?"留空则不修改":"请输入密码",value:pt.password,onChange:M=>At({...pt,password:M.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(te,{className:"text-gray-300",children:"管理员权限"}),s.jsx(Ut,{checked:pt.isAdmin,onCheckedChange:M=>At({...pt,isAdmin:M})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(te,{className:"text-gray-300",children:"已购全书"}),s.jsx(Ut,{checked:pt.hasFullBook,onCheckedChange:M=>At({...pt,hasFullBook:M})})]})]}),s.jsxs(rn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>Y(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(ns,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:rl,disabled:X,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),X?"保存中...":"保存"]})]})]})}),s.jsx(Dt,{open:bn,onOpenChange:Mn,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[90vh] overflow-y-auto",children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(sn,{className:"w-5 h-5 text-[#38bdac]"}),Hn?"编辑规则":"添加规则"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"规则标题 *"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:匹配后填写头像、付款1980需填写信息",value:Rt.title,onChange:M=>vn({...Rt,title:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"规则描述"}),s.jsx(Go,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[60px] resize-none",placeholder:"弹窗内容/推送文案...",value:Rt.description,onChange:M=>vn({...Rt,description:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"触发条件(可多选)"}),s.jsx("div",{className:"space-y-2",children:["用户状态","阅读行为","付费行为","社交行为","分销行为"].map(M=>{const ee=oN.filter(be=>be.group===M);return ee.length===0?null:s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] text-gray-500 mb-1",children:M}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:ee.map(be=>{const Ae=(Rt.triggerConditions||[]).includes(be.value);return s.jsx("button",{type:"button",className:`px-2.5 py-1 rounded-md text-xs border transition-colors ${Ae?"bg-[#38bdac]/20 border-[#38bdac]/50 text-[#38bdac]":"bg-[#0a1628] border-gray-700 text-gray-400 hover:border-gray-500"}`,onClick:()=>{const Ge=Rt.triggerConditions||[],Je=Ae?Ge.filter(Vt=>Vt!==be.value):[...Ge,be.value];vn({...Rt,triggerConditions:Je})},children:be.label},be.value)})})]},M)})}),(Rt.triggerConditions||[]).length>0&&s.jsxs("p",{className:"text-[10px] text-[#38bdac]",children:["已选 ",(Rt.triggerConditions||[]).length," 个触发条件(满足任一即触发)"]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{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:Rt.trigger,onChange:M=>vn({...Rt,trigger:M.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"推送动作"}),s.jsx("div",{className:"grid grid-cols-2 gap-2",children:lN.map(M=>s.jsxs("button",{type:"button",className:`p-2 rounded-lg border text-left transition-colors ${Rt.actionType===M.value?"bg-[#38bdac]/15 border-[#38bdac]/50":"bg-[#0a1628] border-gray-700 hover:border-gray-500"}`,onClick:()=>vn({...Rt,actionType:M.value}),children:[s.jsx("span",{className:`text-xs font-medium ${Rt.actionType===M.value?"text-[#38bdac]":"text-gray-300"}`,children:M.label}),s.jsx("p",{className:"text-[10px] text-gray-500 mt-0.5",children:M.desc})]},M.value))})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{children:s.jsx(te,{className:"text-gray-300",children:"启用状态"})}),s.jsx(Ut,{checked:Rt.enabled,onCheckedChange:M=>vn({...Rt,enabled:M})})]})]}),s.jsxs(rn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>Mn(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(ns,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:na,disabled:X,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),X?"保存中...":"保存"]})]})]})}),s.jsx(Dt,{open:W,onOpenChange:fe,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[80vh] overflow-auto",children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(Kn,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系 - ",_==null?void 0:_.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:((Ed=he.stats)==null?void 0:Ed.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:((Td=he.stats)==null?void 0:Td.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:["¥",(((Md=he.stats)==null?void 0:Md.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:["¥",(((Ad=he.stats)==null?void 0:Ad.pendingEarnings)||0).toFixed(2)]}),s.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),D?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(He,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):(((Id=he.referrals)==null?void 0:Id.length)??0)>0?s.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(he.referrals??[]).map((M,ee)=>{var Ae;const be=M;return s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg p-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:((Ae=be.nickname)==null?void 0:Ae.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white text-sm",children:be.nickname}),s.jsx("div",{className:"text-xs text-gray-500",children:be.phone||(be.hasOpenId?"微信用户":"未绑定")})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[be.status==="vip"&&s.jsx(Be,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),be.status==="paid"&&s.jsxs(Be,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",be.purchasedSections,"章"]}),be.status==="free"&&s.jsx(Be,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),s.jsx("span",{className:"text-xs text-gray-500",children:be.createdAt?new Date(be.createdAt).toLocaleDateString():""})]})]},be.id||ee)})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),s.jsx(rn,{children:s.jsx(J,{variant:"outline",onClick:()=>fe(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),s.jsx(hy,{open:re,onClose:()=>we(!1),userId:Fe,onUserUpdated:nr}),s.jsx(Dt,{open:tl,onOpenChange:ni,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700/60 text-white max-w-2xl",children:[s.jsx(_t,{children:s.jsx($t,{className:"text-white",children:Ki})}),s.jsx("div",{className:"mt-2",children:s.jsx("pre",{className:"text-xs text-gray-200 bg-[#0a1628] border border-gray-700/60 rounded-lg p-3 max-h-[520px] overflow-auto whitespace-pre-wrap break-words",children:nl||"—"})}),s.jsxs(rn,{children:[s.jsx(J,{type:"button",variant:"outline",className:"border-gray-600 text-gray-200 hover:bg-gray-700/50 bg-transparent",onClick:async()=>{try{await navigator.clipboard.writeText(nl||""),G.success("已复制 data")}catch{G.error("复制失败,请手动复制")}},disabled:!nl,children:"复制 data"}),s.jsx(J,{type:"button",className:"bg-[#38bdac] hover:bg-[#2aa896] text-white",onClick:()=>ni(!1),children:"关闭"})]})]})})]})}function zf(t,[e,n]){return Math.min(n,Math.max(e,t))}var T2=["PageUp","PageDown"],M2=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],A2={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},xd="Slider",[Yx,y8,b8]=ly(xd),[I2]=qo(xd,[b8]),[v8,Hp]=I2(xd),P2=y.forwardRef((t,e)=>{const{name:n,min:r=0,max:a=100,step:i=1,orientation:o="horizontal",disabled:c=!1,minStepsBetweenThumbs:u=0,defaultValue:h=[r],value:f,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:b=!1,form:N,...j}=t,v=y.useRef(new Set),k=y.useRef(0),C=o==="horizontal"?N8:w8,[R=[],O]=Fl({prop:f,defaultProp:h,onChange:se=>{var ie;(ie=[...v.current][k.current])==null||ie.focus(),m(se)}}),U=y.useRef(R);function P(se){const $=E8(R,se);Q(se,$)}function z(se){Q(se,k.current)}function L(){const se=U.current[k.current];R[k.current]!==se&&g(R)}function Q(se,$,{commit:ie}={commit:!1}){const oe=I8(i),me=P8(Math.round((se-r)/i)*i+r,oe),I=zf(me,[r,a]);O((Y=[])=>{const F=S8(Y,I,$);if(A8(F,u*i)){k.current=F.indexOf(I);const ge=String(F)!==String(Y);return ge&&ie&&g(F),ge?F:Y}else return Y})}return s.jsx(v8,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:a,valueIndexToChangeRef:k,thumbs:v.current,values:R,orientation:o,form:N,children:s.jsx(Yx.Provider,{scope:t.__scopeSlider,children:s.jsx(Yx.Slot,{scope:t.__scopeSlider,children:s.jsx(C,{"aria-disabled":c,"data-disabled":c?"":void 0,...j,ref:e,onPointerDown:jt(j.onPointerDown,()=>{c||(U.current=R)}),min:r,max:a,inverted:b,onSlideStart:c?void 0:P,onSlideMove:c?void 0:z,onSlideEnd:c?void 0:L,onHomeKeyDown:()=>!c&&Q(r,0,{commit:!0}),onEndKeyDown:()=>!c&&Q(a,R.length-1,{commit:!0}),onStepKeyDown:({event:se,direction:$})=>{if(!c){const me=T2.includes(se.key)||se.shiftKey&&M2.includes(se.key)?10:1,I=k.current,Y=R[I],F=i*me*$;Q(Y+F,I,{commit:!0})}}})})})})});P2.displayName=xd;var[R2,L2]=I2(xd,{startEdge:"left",endEdge:"right",size:"width",direction:1}),N8=y.forwardRef((t,e)=>{const{min:n,max:r,dir:a,inverted:i,onSlideStart:o,onSlideMove:c,onSlideEnd:u,onStepKeyDown:h,...f}=t,[m,g]=y.useState(null),b=Qt(e,C=>g(C)),N=y.useRef(void 0),j=Fp(a),v=j==="ltr",k=v&&!i||!v&&i;function T(C){const R=N.current||m.getBoundingClientRect(),O=[0,R.width],P=fy(O,k?[n,r]:[r,n]);return N.current=R,P(C-R.left)}return s.jsx(R2,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:s.jsx(O2,{dir:j,"data-orientation":"horizontal",...f,ref:b,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:C=>{const R=T(C.clientX);o==null||o(R)},onSlideMove:C=>{const R=T(C.clientX);c==null||c(R)},onSlideEnd:()=>{N.current=void 0,u==null||u()},onStepKeyDown:C=>{const O=A2[k?"from-left":"from-right"].includes(C.key);h==null||h({event:C,direction:O?-1:1})}})})}),w8=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=Qt(e,f),g=y.useRef(void 0),b=!a;function N(j){const v=g.current||f.current.getBoundingClientRect(),k=[0,v.height],C=fy(k,b?[r,n]:[n,r]);return g.current=v,C(j-v.top)}return s.jsx(R2,{scope:t.__scopeSlider,startEdge:b?"bottom":"top",endEdge:b?"top":"bottom",size:"height",direction:b?1:-1,children:s.jsx(O2,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:j=>{const v=N(j.clientY);i==null||i(v)},onSlideMove:j=>{const v=N(j.clientY);o==null||o(v)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:j=>{const k=A2[b?"from-bottom":"from-top"].includes(j.key);u==null||u({event:j,direction:k?-1:1})}})})}),O2=y.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:a,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:c,onStepKeyDown:u,...h}=t,f=Hp(xd,n);return s.jsx(Et.span,{...h,ref:e,onKeyDown:jt(t.onKeyDown,m=>{m.key==="Home"?(o(m),m.preventDefault()):m.key==="End"?(c(m),m.preventDefault()):T2.concat(M2).includes(m.key)&&(u(m),m.preventDefault())}),onPointerDown:jt(t.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(g)?g.focus():r(m)}),onPointerMove:jt(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&a(m)}),onPointerUp:jt(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),i(m))})})}),D2="SliderTrack",_2=y.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=Hp(D2,n);return s.jsx(Et.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...r,ref:e})});_2.displayName=D2;var Xx="SliderRange",$2=y.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=Hp(Xx,n),i=L2(Xx,n),o=y.useRef(null),c=Qt(e,o),u=a.values.length,h=a.values.map(g=>B2(g,a.min,a.max)),f=u>1?Math.min(...h):0,m=100-Math.max(...h);return s.jsx(Et.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...r,ref:c,style:{...t.style,[i.startEdge]:f+"%",[i.endEdge]:m+"%"}})});$2.displayName=Xx;var Zx="SliderThumb",z2=y.forwardRef((t,e)=>{const n=y8(t.__scopeSlider),[r,a]=y.useState(null),i=Qt(e,c=>a(c)),o=y.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return s.jsx(j8,{...t,ref:i,index:o})}),j8=y.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:a,...i}=t,o=Hp(Zx,n),c=L2(Zx,n),[u,h]=y.useState(null),f=Qt(e,T=>h(T)),m=u?o.form||!!u.closest("form"):!0,g=uy(u),b=o.values[r],N=b===void 0?0:B2(b,o.min,o.max),j=C8(r,o.values.length),v=g==null?void 0:g[c.size],k=v?T8(v,N,c.direction):0;return y.useEffect(()=>{if(u)return o.thumbs.add(u),()=>{o.thumbs.delete(u)}},[u,o.thumbs]),s.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${N}% + ${k}px)`},children:[s.jsx(Yx.ItemSlot,{scope:t.__scopeSlider,children:s.jsx(Et.span,{role:"slider","aria-label":t["aria-label"]||j,"aria-valuemin":o.min,"aria-valuenow":b,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...i,ref:f,style:b===void 0?{display:"none"}:t.style,onFocus:jt(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),m&&s.jsx(F2,{name:a??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:b},r)]})});z2.displayName=Zx;var k8="RadioBubbleInput",F2=y.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const a=y.useRef(null),i=Qt(a,r),o=dy(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(Et.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});F2.displayName=k8;function S8(t=[],e,n){const r=[...t];return r[n]=e,r.sort((a,i)=>a-i)}function B2(t,e,n){const i=100/(n-e)*(t-e);return zf(i,[0,100])}function C8(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function E8(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 T8(t,e,n){const r=t/2,i=fy([0,50],[0,r]);return(r-i(e)*n)*n}function M8(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function A8(t,e){if(e>0){const n=M8(t);return Math.min(...n)>=e}return!0}function fy(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 I8(t){return(String(t).split(".")[1]||"").length}function P8(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var R8=P2,L8=_2,O8=$2,D8=z2;function _8({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(R8,{defaultValue:e,value:n,min:r,max:a,className:zt("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50",t),...i,children:[s.jsx(L8,{className:"bg-gray-600 relative grow overflow-hidden rounded-full h-1.5 w-full",children:s.jsx(O8,{className:"bg-[#38bdac] absolute h-full rounded-full"})}),Array.from({length:o.length},(c,u)=>s.jsx(D8,{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 $8={distributorShare:90,minWithdrawAmount:10,bindingDays:30,userDiscount:5,withdrawFee:5,enableAutoWithdraw:!1,vipOrderShareVip:20,vipOrderShareNonVip:10};function V2(t){const e=!!(t!=null&&t.embedded),[n,r]=y.useState($8),[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 Nt("/api/admin/referral-settings",f);if(!m||m.success===!1){G.error("保存失败: "+(m&&typeof m=="object"&&"error"in m?m.error:""));return}G.success(`✅ 分销配置已保存成功! + +• 小程序与网站的推广规则会一起生效 +• 绑定关系会使用新的天数配置 +• 佣金比例会立即应用到新订单 + +如有缓存,请刷新前台/小程序页面。`)}catch(f){console.error(f),G.error("保存失败: "+(f instanceof Error?f.message:String(f)))}finally{c(!1)}},h=f=>m=>{const g=parseFloat(m.target.value||"0");r(b=>({...b,[f]:isNaN(g)?0:g}))};return a?s.jsx("div",{className:"p-8 text-gray-500",children:"加载中..."}):s.jsxs("div",{className:e?"p-4 w-full":"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(td,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置(与系统设置中的「推广功能」开关配合:开关在"," ",s.jsx(Dl,{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(Tn,{className:"w-4 h-4 mr-2"}),o?"保存中...":"保存配置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{children:[s.jsxs(ut,{className:"flex items-center gap-2 text-white",children:[s.jsx(JM,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),s.jsx(Gt,{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(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Gh,{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(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Kn,{className:"w-3 h-3 text-[#38bdac]"}),"推广者分成(%)"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(_8,{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(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Gh,{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(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Gh,{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(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Kn,{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(De,{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(td,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),s.jsx(Gt,{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(te,{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(te,{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(te,{className:"text-gray-300 flex items-center gap-2",children:["自动提现开关",s.jsx(Be,{variant:"outline",className:"border-[#38bdac]/40 text-[#38bdac] text-[10px]",children:"预留"})]}),s.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[s.jsx(Ut,{checked:n.enableAutoWithdraw,onCheckedChange:f=>r(m=>({...m,enableAutoWithdraw:f}))}),s.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(dt,{children:s.jsxs(ut,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[s.jsx(Gh,{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 z8(){const[t]=Y0(),e=Ja(),[n,r]=y.useState("overview"),[a,i]=y.useState("orders"),[o,c]=y.useState([]),[u,h]=y.useState(null),[f,m]=y.useState([]),[g,b]=y.useState([]),[N,j]=y.useState([]),[v,k]=y.useState(!0),[T,C]=y.useState(null),[R,O]=y.useState(""),[U,P]=y.useState("all"),[z,L]=y.useState(1),[Q,se]=y.useState(10),[$,ie]=y.useState(0),[oe,me]=y.useState(new Set),[I,Y]=y.useState(null),[F,ge]=y.useState(""),[X,V]=y.useState(!1),[W,fe]=y.useState(null),[he,de]=y.useState(""),[D,q]=y.useState(!1),[_,Z]=y.useState(!1),[re,we]=y.useState(!1),[Fe,Ue]=y.useState([]),[wt,jn]=y.useState(1),[pt,At]=y.useState(0),[fn,Vn]=y.useState("");y.useEffect(()=>{t.get("tab")==="leads"&&e("/users?tab=leads",{replace:!0})},[t,e]),y.useEffect(()=>{pn()},[]),y.useEffect(()=>{const H=t.get("tab");(H==="overview"||H==="orders"||H==="bindings"||H==="withdrawals"||H==="settings")&&r(H)},[t]),y.useEffect(()=>{L(1)},[n,U]),y.useEffect(()=>{Wt(n)},[n]),y.useEffect(()=>{if(n==="orders"&&a==="giftpay"){Wt("giftPay",!0);return}["orders","bindings","withdrawals"].includes(n)&&Wt(n,!0)},[z,Q,U,R,n,a,wt,fn]),y.useEffect(()=>{n==="withdrawals"&&Rt()},[n]);async function pn(){C(null);try{const H=await Oe("/api/admin/distribution/overview");H!=null&&H.success&&H.overview&&h(H.overview)}catch(H){console.error("[Admin] 概览接口异常:",H),C("加载概览失败")}try{const H=await Oe("/api/db/users");j((H==null?void 0:H.users)||[])}catch(H){console.error("[Admin] 用户数据加载失败:",H)}}async function Wt(H,Qe=!1){var bt;if(!(!Qe&&oe.has(H))){k(!0);try{const Ft=N;switch(H){case"overview":break;case"orders":{try{const yt=new URLSearchParams({page:String(z),pageSize:String(Q),...U!=="all"&&{status:U},...R&&{search:R}}),ht=await Oe(`/api/admin/orders?${yt}`);if(ht!=null&&ht.success&&ht.orders){const It=ht.orders.map(Kt=>{const kn=Ft.find(Ts=>Ts.id===Kt.userId),Es=Kt.referrerId?Ft.find(Ts=>Ts.id===Kt.referrerId):null;return{...Kt,amount:parseFloat(String(Kt.amount))||0,userNickname:(kn==null?void 0:kn.nickname)||Kt.userNickname||"未知用户",userPhone:(kn==null?void 0:kn.phone)||Kt.userPhone||"-",referrerNickname:(Es==null?void 0:Es.nickname)||null,referrerCode:(Es==null?void 0:Es.referralCode)??null,type:Kt.productType||Kt.type}});c(It),ie(ht.total??It.length)}else c([]),ie(0)}catch(yt){console.error(yt),C("加载订单失败"),c([])}break}case"bindings":{try{const yt=new URLSearchParams({page:String(z),pageSize:String(Q),...U!=="all"&&{status:U}}),ht=await Oe(`/api/db/distribution?${yt}`);m((ht==null?void 0:ht.bindings)||[]),ie((ht==null?void 0:ht.total)??((bt=ht==null?void 0:ht.bindings)==null?void 0:bt.length)??0)}catch(yt){console.error(yt),C("加载绑定数据失败"),m([])}break}case"withdrawals":{try{const yt=U==="completed"?"success":U==="rejected"?"failed":U,ht=new URLSearchParams({...yt&&yt!=="all"&&{status:yt},page:String(z),pageSize:String(Q)}),It=await Oe(`/api/admin/withdrawals?${ht}`);if(It!=null&&It.success&&It.withdrawals){const Kt=It.withdrawals.map(kn=>({...kn,account:kn.account??"未绑定微信号",status:kn.status==="success"?"completed":kn.status==="failed"?"rejected":kn.status}));b(Kt),ie((It==null?void 0:It.total)??Kt.length)}else It!=null&&It.success||C(`获取提现记录失败: ${(It==null?void 0:It.error)||"未知错误"}`),b([])}catch(yt){console.error(yt),C("加载提现数据失败"),b([])}break}case"giftPay":{try{const yt=new URLSearchParams({page:String(wt),pageSize:"20",...fn&&{status:fn}}),ht=await Oe(`/api/admin/gift-pay-requests?${yt}`);ht!=null&&ht.success&&ht.data?(Ue(ht.data),At(ht.total??ht.data.length)):(Ue([]),At(0))}catch(yt){console.error(yt),C("加载代付请求失败"),Ue([])}break}}me(yt=>new Set(yt).add(H))}catch(Ft){console.error(Ft)}finally{k(!1)}}}async function bn(){C(null),me(H=>{const Qe=new Set(H);return Qe.delete(n),n==="orders"&&a==="giftpay"&&Qe.delete("giftPay"),Qe}),n==="overview"&&pn(),n==="orders"&&a==="giftpay"?await Wt("giftPay",!0):await Wt(n,!0)}async function Mn(H){if(confirm("确认审核通过并打款?"))try{const Qe=await Zt("/api/admin/withdrawals",{id:H,action:"approve"});if(!(Qe!=null&&Qe.success)){const bt=(Qe==null?void 0:Qe.message)||(Qe==null?void 0:Qe.error)||"操作失败";G.error(bt);return}await bn()}catch(Qe){console.error(Qe),G.error("操作失败")}}function Hn(H){fe(H),de("")}async function rs(){const H=W;if(!H)return;const Qe=he.trim();if(!Qe){G.error("请填写拒绝原因");return}q(!0);try{const bt=await Zt("/api/admin/withdrawals",{id:H,action:"reject",errorMessage:Qe});if(!(bt!=null&&bt.success)){G.error((bt==null?void 0:bt.error)||"操作失败");return}G.success("已拒绝该提现申请"),fe(null),de(""),await bn()}catch(bt){console.error(bt),G.error("操作失败")}finally{q(!1)}}async function Rt(){try{const H=await Oe("/api/admin/withdrawals/auto-approve");H!=null&&H.success&&typeof H.enableAutoApprove=="boolean"&&Z(H.enableAutoApprove)}catch{}}async function vn(H){we(!0);try{const Qe=await Zt("/api/admin/withdrawals/auto-approve",{enableAutoApprove:H});Qe!=null&&Qe.success?(Z(H),G.success(H?"已开启自动审批,新提现将自动打款":"已关闭自动审批")):G.error("更新失败: "+((Qe==null?void 0:Qe.error)??""))}catch{G.error("更新失败")}finally{we(!1)}}function Ne(){W&&G.info("已取消操作"),fe(null),de("")}async function Me(){var H;if(!(!(I!=null&&I.orderSn)&&!(I!=null&&I.id))){V(!0),C(null);try{const Qe=await Zt("/api/admin/orders/refund",{orderSn:I.orderSn||I.id,reason:F||void 0});Qe!=null&&Qe.success?(Y(null),ge(""),await Wt("orders",!0)):C((Qe==null?void 0:Qe.error)||"退款失败")}catch(Qe){const bt=Qe;C(((H=bt==null?void 0:bt.data)==null?void 0:H.error)||"退款失败,请检查网络后重试")}finally{V(!1)}}}function We(H){const Qe={active:"bg-green-500/20 text-green-400",converted:"bg-blue-500/20 text-blue-400",expired:"bg-gray-500/20 text-gray-400",cancelled:"bg-red-500/20 text-red-400",pending:"bg-orange-500/20 text-orange-400",pending_confirm:"bg-orange-500/20 text-orange-400",processing:"bg-blue-500/20 text-blue-400",completed:"bg-green-500/20 text-green-400",rejected:"bg-red-500/20 text-red-400"},bt={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return s.jsx(Be,{className:`${Qe[H]||"bg-gray-500/20 text-gray-400"} border-0`,children:bt[H]||H})}const rt=Math.ceil($/Q)||1,Lt=o,kt=f.filter(H=>{var bt,Ft,yt,ht;if(!R)return!0;const Qe=R.toLowerCase();return((bt=H.refereeNickname)==null?void 0:bt.toLowerCase().includes(Qe))||((Ft=H.refereePhone)==null?void 0:Ft.includes(Qe))||((yt=H.referrerName)==null?void 0:yt.toLowerCase().includes(Qe))||((ht=H.referrerCode)==null?void 0:ht.toLowerCase().includes(Qe))}),$e=g.filter(H=>{var bt;if(!R)return!0;const Qe=R.toLowerCase();return((bt=H.userName)==null?void 0:bt.toLowerCase().includes(Qe))||H.account&&H.account.toLowerCase().includes(Qe)});return s.jsxs("div",{className:"p-8 w-full",children:[T&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[s.jsx("span",{children:T}),s.jsx("button",{type:"button",onClick:()=>C(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex items-center justify-between mb-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-semibold text-white",children:"推广中心"}),s.jsx("p",{className:"text-gray-500 text-sm mt-0.5",children:"分销绑定、提现审核、推广设置"})]}),s.jsxs(J,{onClick:bn,disabled:v,variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-800",children:[s.jsx(He,{className:`w-3.5 h-3.5 mr-1.5 ${v?"animate-spin":""}`}),"刷新"]})]}),s.jsx("div",{className:"flex gap-1 mb-6 bg-[#0a1628] rounded-lg p-1 border border-gray-700/40",children:[{key:"overview",label:"数据概览",icon:Lf},{key:"orders",label:"订单与代付",icon:Pf},{key:"bindings",label:"绑定管理",icon:Pi},{key:"withdrawals",label:"提现审核",icon:td},{key:"settings",label:"推广设置",icon:Eo}].map(H=>s.jsxs("button",{type:"button",onClick:()=>{r(H.key),P("all"),O(""),H.key!=="orders"&&i("orders")},className:`flex-1 flex items-center justify-center gap-1.5 px-3 py-2 rounded-md text-sm transition-all ${n===H.key?"bg-[#38bdac] text-white shadow-md":"text-gray-400 hover:text-white hover:bg-gray-700/40"}`,children:[s.jsx(H.icon,{className:"w-3.5 h-3.5"}),H.label]},H.key))}),v?s.jsxs("div",{className:"flex items-center justify-center py-20",children:[s.jsx(He,{className:"w-8 h-8 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[n==="overview"&&u&&s.jsxs("div",{className:"space-y-6",children:[s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("span",{className:"text-sm font-medium text-gray-300 flex items-center gap-2",children:[s.jsx(zo,{className:"w-4 h-4 text-amber-400"}),"推广转化漏斗"]}),s.jsx(J,{type:"button",size:"sm",variant:"ghost",onClick:()=>void bn(),disabled:v,className:"text-gray-400 h-7",children:s.jsx(He,{className:`w-3.5 h-3.5 ${v?"animate-spin":""}`})})]}),s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"text-gray-500 text-xs border-b border-gray-700/50",children:[s.jsx("th",{className:"pb-2 text-left font-normal",children:"指标"}),s.jsx("th",{className:"pb-2 text-right font-normal",children:"今日"}),s.jsx("th",{className:"pb-2 text-right font-normal",children:"本月"}),s.jsx("th",{className:"pb-2 text-right font-normal",children:"累计"})]})}),s.jsxs("tbody",{className:"text-white",children:[s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(Rf,{className:"w-4 h-4 text-blue-400"}),"点击数"]}),s.jsx("td",{className:"py-2.5 text-right font-bold",children:u.todayClicks}),s.jsx("td",{className:"py-2.5 text-right",children:u.monthClicks}),s.jsx("td",{className:"py-2.5 text-right",children:u.totalClicks})]}),s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(Pi,{className:"w-4 h-4 text-green-400"}),"绑定关系"]}),s.jsx("td",{className:"py-2.5 text-right font-bold",children:u.todayBindings}),s.jsx("td",{className:"py-2.5 text-right",children:u.monthBindings}),s.jsx("td",{className:"py-2.5 text-right",children:u.totalBindings})]}),s.jsxs("tr",{className:"border-b border-gray-700/30",children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(_g,{className:"w-4 h-4 text-purple-400"}),"付款转化"]}),s.jsx("td",{className:"py-2.5 text-right font-bold",children:u.todayConversions}),s.jsx("td",{className:"py-2.5 text-right",children:u.monthConversions}),s.jsx("td",{className:"py-2.5 text-right",children:u.totalConversions})]}),s.jsxs("tr",{children:[s.jsxs("td",{className:"py-2.5 flex items-center gap-2",children:[s.jsx(Pf,{className:"w-4 h-4 text-[#38bdac]"}),"佣金收入"]}),s.jsxs("td",{className:"py-2.5 text-right font-bold text-[#38bdac]",children:["¥",(u.todayEarnings??0).toFixed(0)]}),s.jsxs("td",{className:"py-2.5 text-right text-[#38bdac]",children:["¥",(u.monthEarnings??0).toFixed(0)]}),s.jsxs("td",{className:"py-2.5 text-right text-[#38bdac]",children:["¥",(u.totalEarnings??0).toFixed(0)]})]})]})]})}),u.conversionRate&&s.jsxs("p",{className:"text-xs text-gray-500 mt-3 text-right",children:["综合转化率 ",u.conversionRate]})]})}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsx(De,{className:"bg-orange-500/10 border-orange-500/30",children:s.jsx(_e,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Fx,{className:"w-5 h-5 text-orange-400 shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-orange-300 font-medium text-sm",children:"即将过期绑定"}),s.jsxs("p",{className:"text-xl font-bold text-white",children:[u.expiringBindings," ",s.jsx("span",{className:"text-sm font-normal text-orange-300/60",children:"个 · 7天内"})]})]})]})})}),s.jsx(De,{className:"bg-blue-500/10 border-blue-500/30",children:s.jsx(_e,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(td,{className:"w-5 h-5 text-blue-400 shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-blue-300 font-medium text-sm",children:"待审核提现"}),s.jsxs("p",{className:"text-xl font-bold text-white",children:[u.pendingWithdrawals," ",s.jsxs("span",{className:"text-sm font-normal text-blue-300/60",children:["笔 · ¥",(u.pendingWithdrawAmount??0).toFixed(0)]})]})]}),s.jsx(J,{onClick:()=>r("withdrawals"),variant:"outline",size:"sm",className:"border-blue-500/50 text-blue-400 hover:bg-blue-500/20 shrink-0",children:"去审核"})]})})})]}),s.jsx(De,{className:"bg-emerald-500/10 border-emerald-500/30",children:s.jsxs(_e,{className:"p-4 flex flex-wrap items-center justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-emerald-300 font-medium text-sm",children:"获客线索(存客宝)"}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"留资列表、推送状态与重试已统一至「用户管理 → 获客列表」,避免与推广中心重复维护。"})]}),s.jsx(Dl,{to:"/users?tab=leads",className:"shrink-0",children:s.jsx(J,{type:"button",variant:"outline",size:"sm",className:"border-emerald-500/50 text-emerald-400 hover:bg-emerald-500/15 bg-transparent",children:"打开获客列表"})})]})}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-4",children:s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-white/5",children:[s.jsx(Kn,{className:"w-5 h-5 text-gray-400 shrink-0"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-lg font-bold text-white",children:u.totalDistributors}),s.jsx("p",{className:"text-[10px] text-gray-500",children:"推广用户"})]})]}),s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-white/5",children:[s.jsx(_g,{className:"w-5 h-5 text-green-400 shrink-0"}),s.jsxs("div",{children:[s.jsx("p",{className:"text-lg font-bold text-green-400",children:u.activeDistributors}),s.jsx("p",{className:"text-[10px] text-gray-500",children:"有收益用户"})]})]})]})})})]}),n==="orders"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex gap-2 mb-2",children:[s.jsx("button",{type:"button",className:`px-3 py-1.5 rounded-md text-xs font-medium transition-all ${a==="orders"?"bg-[#38bdac]/20 text-[#38bdac] border border-[#38bdac]/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,onClick:()=>i("orders"),children:"普通订单"}),s.jsxs("button",{type:"button",className:`px-3 py-1.5 rounded-md text-xs font-medium transition-all ${a==="giftpay"?"bg-amber-500/20 text-amber-400 border border-amber-500/50":"bg-[#0a1628] text-gray-400 border border-gray-700 hover:text-white"}`,onClick:()=>{i("giftpay"),Wt("giftPay",!0)},children:[s.jsx(Bx,{className:"w-3 h-3 inline mr-1"}),"代付请求"]})]}),a==="orders"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(xa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(le,{value:R,onChange:H=>O(H.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:U,onChange:H=>P(H.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 bn(),disabled:v,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${v?"animate-spin":""}`}),"刷新"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-0",children:[o.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无订单数据"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"订单号"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"用户"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"商品"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"支付方式"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"退款原因"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"推荐人/邀请码"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"分销佣金"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"下单时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Lt.map(H=>{var Qe,bt;return s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsxs("td",{className:"p-4 font-mono text-xs text-gray-400",children:[(Qe=H.id)==null?void 0:Qe.slice(0,12),"..."]}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:H.userNickname}),s.jsx("p",{className:"text-gray-500 text-xs",children:H.userPhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:(()=>{const Ft=H.productType||H.type,yt=H.description||"",ht=String(H.productId||H.sectionId||""),It=Ft==="vip"||yt.includes("VIP")||yt.toLowerCase().includes("vip")||ht.toLowerCase().includes("vip");return Ft==="balance_recharge"?`余额充值 ¥${typeof H.amount=="number"?H.amount.toFixed(2):parseFloat(String(H.amount||"0")).toFixed(2)}`:It?"超级个体开通费用":Ft==="fullbook"?`${H.bookName||"《底层逻辑》"} - 全本`:Ft==="match"?"匹配次数购买":`${H.bookName||"《底层逻辑》"} - ${H.sectionTitle||H.chapterTitle||`章节${H.productId||H.sectionId||""}`}`})()}),s.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const Ft=H.productType||H.type,yt=H.description||"",ht=String(H.productId||H.sectionId||""),It=Ft==="vip"||yt.includes("VIP")||yt.toLowerCase().includes("vip")||ht.toLowerCase().includes("vip");return Ft==="balance_recharge"?"余额充值":It?"超级个体":Ft==="fullbook"?"全书解锁":Ft==="match"?"功能权益":H.chapterTitle||"单章购买"})()})]})}),s.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof H.amount=="number"?H.amount.toFixed(2):parseFloat(String(H.amount||"0")).toFixed(2)]}),s.jsx("td",{className:"p-4 text-gray-300",children:H.paymentMethod==="wechat"?"微信支付":H.paymentMethod==="balance"?"余额支付":H.paymentMethod==="alipay"?"支付宝":H.paymentMethod||"微信支付"}),s.jsx("td",{className:"p-4",children:H.status==="refunded"?s.jsx(Be,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):H.status==="completed"||H.status==="paid"?s.jsx(Be,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):H.status==="pending"||H.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:H.refundReason,children:H.status==="refunded"&&H.refundReason?H.refundReason:"-"}),s.jsx("td",{className:"p-4 text-gray-300 text-sm",children:H.referrerId||H.referralCode?s.jsxs("span",{title:H.referralCode||H.referrerCode||H.referrerId||"",children:[H.referrerNickname||H.referralCode||H.referrerCode||((bt=H.referrerId)==null?void 0:bt.slice(0,8)),(H.referralCode||H.referrerCode)&&` (${H.referralCode||H.referrerCode})`]}):"-"}),s.jsx("td",{className:"p-4 text-[#FFD700]",children:H.referrerEarnings?`¥${(typeof H.referrerEarnings=="number"?H.referrerEarnings:parseFloat(String(H.referrerEarnings))).toFixed(2)}`:"-"}),s.jsx("td",{className:"p-4 text-gray-400 text-sm",children:H.createdAt?new Date(H.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:(H.status==="paid"||H.status==="completed")&&s.jsxs(J,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{Y(H),ge("")},children:[s.jsx(ak,{className:"w-3 h-3 mr-1"}),"退款"]})})]},H.id)})})]})}),n==="orders"&&s.jsx(qs,{page:z,totalPages:rt,total:$,pageSize:Q,onPageChange:L,onPageSizeChange:H=>{se(H),L(1)}})]})})]}),a==="giftpay"&&s.jsxs(De,{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:fn,onChange:H=>{Vn(H.target.value),jn(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 Wt("giftPay",!0),disabled:v,className:"border-gray-600 text-gray-300",children:[s.jsx(He,{className:`w-3.5 h-3.5 mr-1 ${v?"animate-spin":""}`}),"刷新"]})]})]})}),s.jsxs(_e,{children:[s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"请求号"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"发起人"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"商品/金额"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"份数/已领"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"付款人"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"状态"}),s.jsx("th",{className:"p-3 text-left font-normal text-gray-400 text-xs",children:"创建时间"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:Fe.map(H=>s.jsxs("tr",{className:"hover:bg-[#0a1628]",children:[s.jsx("td",{className:"p-3 font-mono text-xs text-gray-400",children:H.requestSn}),s.jsx("td",{className:"p-3 text-white text-sm",children:H.initiatorNick||H.initiatorUserId}),s.jsxs("td",{className:"p-3",children:[s.jsxs("p",{className:"text-white",children:[H.productType," · ¥",H.amount.toFixed(2)]}),H.description&&s.jsx("p",{className:"text-gray-500 text-xs",children:H.description})]}),s.jsx("td",{className:"p-3 text-gray-400",children:(H.quantity??1)>1?`${H.quantity}份 / 已领${H.redeemedCount??0}`:"-"}),s.jsx("td",{className:"p-3 text-gray-400",children:H.payerNick||(H.payerUserId?H.payerUserId:"-")}),s.jsx("td",{className:"p-3",children:s.jsx(Be,{className:H.status==="paid"?"bg-green-500/20 text-green-400 border-0":H.status==="pending"||H.status==="pending_pay"?"bg-amber-500/20 text-amber-400 border-0":H.status==="refunded"?"bg-red-500/20 text-red-400 border-0":"bg-gray-500/20 text-gray-400 border-0",children:H.status==="paid"?"已支付":H.status==="pending"||H.status==="pending_pay"?"待支付":H.status==="refunded"?"已退款":H.status==="cancelled"?"已取消":"已过期"})}),s.jsx("td",{className:"p-3 text-gray-400 text-xs",children:H.createdAt?new Date(H.createdAt).toLocaleString("zh-CN"):"-"})]},H.id))})]})}),Fe.length===0&&!v&&s.jsx("p",{className:"text-center py-8 text-gray-500",children:"暂无代付请求"}),pt>20&&s.jsx("div",{className:"mt-4 flex justify-center",children:s.jsx(qs,{page:wt,totalPages:Math.ceil(pt/20),total:pt,pageSize:20,onPageChange:jn,onPageSizeChange:()=>{}})})]})]})]}),n==="bindings"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(xa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(le,{value:R,onChange:H=>O(H.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:U,onChange:H=>P(H.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 bn(),disabled:v,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${v?"animate-spin":""}`}),"刷新"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-0",children:[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("tbody",{className:"divide-y divide-gray-700/50",children:kt.map(H=>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:H.refereeNickname||"匿名用户"}),s.jsx("p",{className:"text-gray-500 text-xs",children:H.refereePhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white",children:H.referrerName||"-"}),s.jsx("p",{className:"text-gray-500 text-xs font-mono",children:H.referrerCode})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:H.boundAt?new Date(H.boundAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:H.expiresAt?new Date(H.expiresAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:We(H.status)}),s.jsx("td",{className:"p-4",children:H.commission?s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",H.commission.toFixed(2)]}):s.jsx("span",{className:"text-gray-500",children:"-"})})]},H.id))})]})}),n==="bindings"&&s.jsx(qs,{page:z,totalPages:rt,total:$,pageSize:Q,onPageChange:L,onPageSizeChange:H=>{se(H),L(1)}})]})})]}),n==="withdrawals"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(xa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(le,{value:R,onChange:H=>O(H.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:U,onChange:H=>P(H.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(zo,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-sm text-gray-300",children:"自动审批"}),s.jsx(Ut,{checked:_,onCheckedChange:vn,disabled:re,className:"data-[state=checked]:bg-[#38bdac]"})]}),s.jsxs(J,{type:"button",variant:"outline",onClick:()=>void bn(),disabled:v,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent shrink-0",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${v?"animate-spin":""}`}),"刷新"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-0",children:[$e.length===0?s.jsx("div",{className:"py-12 text-center text-gray-500",children:"暂无提现记录"}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-[#0a1628] text-gray-400",children:[s.jsx("th",{className:"p-4 text-left font-medium",children:"申请人"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"金额"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"收款方式"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"收款账号"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"申请时间"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"状态"}),s.jsx("th",{className:"p-4 text-left font-medium",children:"备注"}),s.jsx("th",{className:"p-4 text-right font-medium",children:"操作"})]})}),s.jsx("tbody",{className:"divide-y divide-gray-700/50",children:$e.map(H=>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:[H.userAvatar?s.jsx("img",{src:H.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:(H.userName||H.name||"?").slice(0,1)}),s.jsx("p",{className:"text-white font-medium",children:H.userName||H.name})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",H.amount.toFixed(2)]})}),s.jsx("td",{className:"p-4",children:s.jsx(Be,{className:H.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:H.method==="wechat"?"微信":"支付宝"})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-mono text-xs",children:H.account}),s.jsx("p",{className:"text-gray-500 text-xs",children:H.name})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:H.createdAt?new Date(H.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:We(H.status)}),s.jsx("td",{className:"p-4 max-w-[160px]",children:s.jsx("span",{className:`text-xs ${H.status==="rejected"||H.status==="failed"?"text-red-400":"text-gray-400"}`,title:H.remark,children:H.remark||"-"})}),s.jsx("td",{className:"p-4 text-right",children:H.status==="pending"&&s.jsxs("div",{className:"flex gap-2 justify-end",children:[s.jsxs(J,{size:"sm",onClick:()=>Mn(H.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(_g,{className:"w-4 h-4 mr-1"}),"通过"]}),s.jsxs(J,{size:"sm",variant:"outline",onClick:()=>Hn(H.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[s.jsx(Xj,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},H.id))})]})}),n==="withdrawals"&&s.jsx(qs,{page:z,totalPages:rt,total:$,pageSize:Q,onPageChange:L,onPageSizeChange:H=>{se(H),L(1)}})]})})]})]}),s.jsx(Dt,{open:!!I,onOpenChange:H=>!H&&Y(null),children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(_t,{children:s.jsx($t,{className:"text-white",children:"订单退款"})}),I&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",I.orderSn||I.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof I.amount=="number"?I.amount.toFixed(2):parseFloat(String(I.amount||"0")).toFixed(2)]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),s.jsx("div",{className:"form-input",children:s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:F,onChange:H=>ge(H.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>Y(null),disabled:X,children:"取消"}),s.jsx(J,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:Me,disabled:X,children:X?"退款中...":"确认退款"})]})]})}),s.jsx(Dt,{open:!!W,onOpenChange:H=>!H&&Ne(),children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(_t,{children:s.jsx($t,{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:he,onChange:H=>de(H.target.value)})})]})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:Ne,disabled:D,children:"取消"}),s.jsx(J,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:rs,disabled:D||!he.trim(),children:D?"提交中...":"确认拒绝"})]})]})}),n==="settings"&&s.jsx("div",{className:"-mx-8 -mt-6",children:s.jsx(V2,{embedded:!0})})]})}function F8(){const[t,e]=y.useState([]),[n,r]=y.useState({total:0,pendingCount:0,pendingAmount:0,successCount:0,successAmount:0,failedCount:0}),[a,i]=y.useState(!0),[o,c]=y.useState(null),[u,h]=y.useState("all"),[f,m]=y.useState(1),[g,b]=y.useState(10),[N,j]=y.useState(0),[v,k]=y.useState(null),[T,C]=y.useState(null),[R,O]=y.useState(""),[U,P]=y.useState(!1);async function z(){var I,Y,F,ge,X,V,W;i(!0),c(null);try{const fe=new URLSearchParams({status:u,page:String(f),pageSize:String(g)}),he=await Oe(`/api/admin/withdrawals?${fe}`);if(he!=null&&he.success){const de=he.withdrawals||[];e(de),j(he.total??((I=he.stats)==null?void 0:I.total)??de.length),r({total:((Y=he.stats)==null?void 0:Y.total)??he.total??de.length,pendingCount:((F=he.stats)==null?void 0:F.pendingCount)??0,pendingAmount:((ge=he.stats)==null?void 0:ge.pendingAmount)??0,successCount:((X=he.stats)==null?void 0:X.successCount)??0,successAmount:((V=he.stats)==null?void 0:V.successAmount)??0,failedCount:((W=he.stats)==null?void 0:W.failedCount)??0})}else c("加载提现记录失败")}catch(fe){console.error("Load withdrawals error:",fe),c("加载失败,请检查网络后重试")}finally{i(!1)}}y.useEffect(()=>{m(1)},[u]),y.useEffect(()=>{z()},[u,f,g]);const L=Math.ceil(N/g)||1;async function Q(I){const Y=t.find(F=>F.id===I);if(Y!=null&&Y.userCommissionInfo&&Y.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${Y.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。 + +确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;k(I);try{const F=await Zt("/api/admin/withdrawals",{id:I,action:"approve"});F!=null&&F.success?z():G.error("操作失败: "+((F==null?void 0:F.error)??""))}catch{G.error("操作失败")}finally{k(null)}}async function se(I){if(confirm("确认撤回该笔打款?仅在用户未确认收款前可撤回。")){k(I);try{const Y=await Nt("/api/admin/withdrawals/cancel",{id:I});Y!=null&&Y.success?(G.success("已撤回打款"),z()):G.error("撤回失败: "+((Y==null?void 0:Y.error)??"未知错误"))}catch{G.error("撤回失败")}finally{k(null)}}}function $(I){C(I),O("")}async function ie(){const I=T;if(!I)return;const Y=R.trim();if(!Y){G.error("请填写拒绝原因");return}P(!0);try{const F=await Zt("/api/admin/withdrawals",{id:I,action:"reject",errorMessage:Y});F!=null&&F.success?(G.success("已拒绝该提现申请"),C(null),O(""),z()):G.error("操作失败: "+((F==null?void 0:F.error)??""))}catch{G.error("操作失败")}finally{P(!1)}}function oe(){T&&G.info("已取消操作"),C(null),O("")}function me(I){switch(I){case"pending":return s.jsx(Be,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待处理"});case"pending_confirm":return s.jsx(Be,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待用户确认"});case"processing":return s.jsx(Be,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:"已审批等待打款"});case"success":case"completed":return s.jsx(Be,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"});case"failed":case"rejected":return s.jsx(Be,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已拒绝"});default:return s.jsx(Be,{className:"bg-gray-500/20 text-gray-400 border-0",children:I})}}return s.jsxs("div",{className:"p-8 w-full",children:[o&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[s.jsx("span",{children:o}),s.jsx("button",{type:"button",onClick:()=>c(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-start mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold text-white",children:"分账提现管理"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"管理用户分销收益的提现申请"})]}),s.jsxs(J,{variant:"outline",onClick:z,disabled:a,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${a?"animate-spin":""}`}),"刷新"]})]}),s.jsx(De,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:s.jsx(_e,{className:"p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Pf,{className:"w-5 h-5 text-[#38bdac] mt-0.5"}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-white font-medium mb-2",children:"自动分账规则"}),s.jsxs("div",{className:"text-sm text-gray-400 space-y-1",children:[s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"分销比例"}),":推广者获得订单金额的"," ",s.jsx("span",{className:"text-white font-medium",children:"90%"})]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"结算方式"}),":用户付款后,分销收益自动计入推广者账户"]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"提现方式"}),":用户在小程序端点击提现,系统自动转账到微信零钱"]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"审批流程"}),":待处理的提现需管理员手动确认打款后批准(自动审批开关在推广中心-提现审核)"]})]})]})]})})}),s.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-[#38bdac]",children:n.total}),s.jsx("div",{className:"text-sm text-gray-400",children:"总申请"})]})}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-orange-400",children:n.pendingCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"待处理"}),s.jsxs("div",{className:"text-xs text-orange-400 mt-1",children:["¥",n.pendingAmount.toFixed(2)]})]})}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-green-400",children:n.successCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"已完成"}),s.jsxs("div",{className:"text-xs text-green-400 mt-1",children:["¥",n.successAmount.toFixed(2)]})]})}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-red-400",children:n.failedCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"已拒绝"})]})})]}),s.jsx("div",{className:"flex gap-2 mb-4",children:["all","pending","processing","pending_confirm","success","failed"].map(I=>s.jsx(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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:a?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):t.length===0?s.jsxs("div",{className:"text-center py-12",children:[s.jsx(td,{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:ya(I.userAvatar),alt:I.userName??"",className:"w-8 h-8 rounded-full object-cover"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm text-[#38bdac]",children:(I.userName??"?").charAt(0)}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-white",children:I.userName??"未知"}),s.jsx("p",{className:"text-xs text-gray-500",children:I.userPhone??I.referralCode??(I.userId??"").slice(0,10)})]})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(I.amount).toFixed(2)]})}),s.jsx("td",{className:"p-4",children:I.userCommissionInfo?s.jsxs("div",{className:"text-xs space-y-1",children:[s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"累计佣金:"}),s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",I.userCommissionInfo.totalCommission.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"已提现:"}),s.jsxs("span",{className:"text-gray-400",children:["¥",I.userCommissionInfo.withdrawnEarnings.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4",children:[s.jsx("span",{className:"text-gray-500",children:"待审核:"}),s.jsxs("span",{className:"text-orange-400",children:["¥",I.userCommissionInfo.pendingWithdrawals.toFixed(2)]})]}),s.jsxs("div",{className:"flex justify-between gap-4 pt-1 border-t border-gray-700/30",children:[s.jsx("span",{className:"text-gray-500",children:"审核后余额:"}),s.jsxs("span",{className:I.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",I.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):s.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),s.jsx("td",{className:"p-4",children:me(I.status)}),s.jsx("td",{className:"p-4 max-w-[180px]",children:s.jsx("span",{className:`text-xs ${I.status==="rejected"||I.status==="failed"?"text-red-400":"text-gray-400"}`,title:I.remark,children:I.remark||"-"})}),s.jsx("td",{className:"p-4 text-gray-400",children:I.processedAt?new Date(I.processedAt).toLocaleString():"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:I.userConfirmedAt?s.jsxs("span",{className:"text-green-400",title:I.userConfirmedAt,children:["已确认 ",new Date(I.userConfirmedAt).toLocaleString()]}):"-"}),s.jsxs("td",{className:"p-4 text-right",children:[(I.status==="pending"||I.status==="pending_confirm")&&s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsxs(J,{size:"sm",onClick:()=>Q(I.id),disabled:v===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:()=>$(I.id),disabled:v===I.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[s.jsx(ns,{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:()=>se(I.id),disabled:v===I.id,className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:"撤回打款"})}),(I.status==="success"||I.status==="completed")&&I.transactionId&&s.jsx("span",{className:"text-xs text-gray-500 font-mono",children:I.transactionId})]})]},I.id))})]})}),s.jsx(qs,{page:f,totalPages:L,total:N,pageSize:g,onPageChange:m,onPageSizeChange:I=>{b(I),m(1)}})]})})}),s.jsx(Dt,{open:!!T,onOpenChange:I=>!I&&oe(),children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(_t,{children:s.jsx($t,{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:R,onChange:I=>O(I.target.value)})})]})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:oe,disabled:U,children:"取消"}),s.jsx(J,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:ie,disabled:U||!R.trim(),children:U?"提交中...":"确认拒绝"})]})]})})]})}var Qg={exports:{}},Yg={};/** + * @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 dN;function B8(){if(dN)return Yg;dN=1;var t=Uu();function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,a=t.useEffect,i=t.useLayoutEffect,o=t.useDebugValue;function c(m,g){var b=g(),N=r({inst:{value:b,getSnapshot:g}}),j=N[0].inst,v=N[1];return i(function(){j.value=b,j.getSnapshot=g,u(j)&&v({inst:j})},[m,b,g]),a(function(){return u(j)&&v({inst:j}),m(function(){u(j)&&v({inst:j})})},[m]),o(b),b}function u(m){var g=m.getSnapshot;m=m.value;try{var b=g();return!n(m,b)}catch{return!0}}function h(m,g){return g()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:c;return Yg.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,Yg}var uN;function H2(){return uN||(uN=1,Qg.exports=B8()),Qg.exports}var U2=H2();function js(t){this.content=t}js.prototype={constructor:js,find:function(t){for(var e=0;e>1}};js.from=function(t){if(t instanceof js)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new js(e)};function W2(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=W2(a.content,i.content,n+1);if(o!=null)return o}n+=a.nodeSize}}function K2(t,e,n,r){for(let a=t.childCount,i=e.childCount;;){if(a==0||i==0)return a==i?null:{a:n,b:r};let o=t.child(--a),c=e.child(--i),u=o.nodeSize;if(o==c){n-=u,r-=u;continue}if(!o.sameMarkup(c))return{a:n,b:r};if(o.isText&&o.text!=c.text){let h=0,f=Math.min(o.text.length,c.text.length);for(;he&&r(u,a+c,i||null,o)!==!1&&u.content.size){let f=c+1;u.nodesBetween(Math.max(0,e-f),Math.min(u.content.size,n-f),r,a+f)}c=h}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,a){let i="",o=!0;return this.nodesBetween(e,n,(c,u)=>{let h=c.isText?c.text.slice(Math.max(e,u)-u,n-u):c.isLeaf?a?typeof a=="function"?a(c):a:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&h||c.isTextblock)&&r&&(o?o=!1:i+=r),i+=h},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,a=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(a[a.length-1]=n.withText(n.text+r.text),i=1);ie)for(let i=0,o=0;oe&&((on)&&(c.isText?c=c.cut(Math.max(0,e-o),Math.min(c.text.length,n-o)):c=c.cut(Math.max(0,e-o-1),Math.min(c.content.size,n-o-1))),r.push(c),a+=c.nodeSize),o=u}return new Ce(r,a)}cutByIndex(e,n){return e==n?Ce.empty:e==0&&n==this.content.length?this:new Ce(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let a=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return a[e]=n,new Ce(a,i)}addToStart(e){return new Ce([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Ce(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let a=this.child(n),i=r+a.nodeSize;if(i>=e)return i==e?sf(n+1,i):sf(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return Ce.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Ce(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Ce.empty;let n,r=0;for(let a=0;athis.type.rank&&(n||(n=e.slice(0,a)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-a.type.rank),n}};on.none=[];class Bf extends Error{}class ze{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=G2(this.content,e+this.openStart,n);return r&&new ze(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ze(q2(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 ze.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 ze(Ce.fromJSON(e,n.content),r,a)}static maxOpen(e,n=!0){let r=0,a=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)a++;return new ze(e,r,a)}}ze.empty=new ze(Ce.empty,0,0);function q2(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(q2(i.content,e-a-1,n-a-1)))}function G2(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=G2(o.content,e-i-1,n,o);return c&&t.replaceChild(a,o.copy(c))}function V8(t,e,n){if(n.openStart>t.depth)throw new Bf("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Bf("Inconsistent open depths");return J2(t,e,n,0)}function J2(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 xu(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&&(Il(t.nodeAfter,r),i++));for(let c=i;ca&&t0(t,e,a+1),o=r.depth>a&&t0(n,r,a+1),c=[];return xu(null,t,a,c),i&&o&&e.index(a)==n.index(a)?(Q2(i,o),Il(Pl(i,Y2(t,e,n,r,a+1)),c)):(i&&Il(Pl(i,Vf(t,e,a+1)),c),xu(e,n,a,c),o&&Il(Pl(o,Vf(n,r,a+1)),c)),xu(r,null,a,c),new Ce(c)}function Vf(t,e,n){let r=[];if(xu(null,t,n,r),t.depth>n){let a=t0(t,e,n+1);Il(Pl(a,Vf(t,e,n+1)),r)}return xu(e,null,n,r),new Ce(r)}function H8(t,e){let n=e.depth-t.openStart,a=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)a=e.node(i).copy(Ce.from(a));return{start:a.resolveNoCache(t.openStart+n),end:a.resolveNoCache(a.content.size-t.openEnd-n)}}class Iu{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 Hf(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 Iu(n,r,i)}static resolveCached(e,n){let r=hN.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()+")"),X2(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=Ce.empty,a=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,a,i),c=o&&o.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let u=a;un.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let a=Ce.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,a,r);return i.type.checkAttrs(i.attrs),i}};Oi.prototype.text=void 0;class Uf extends Oi{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):X2(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 Uf(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Uf(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 X2(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Ul{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new q8(e,n);if(r.next==null)return Ul.empty;let a=Z2(r);r.next&&r.err("Unexpected trailing text");let i=e6(Z8(a));return t6(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(` +`)}}Ul.empty=new Ul(!0);class q8{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 Z2(t){let e=[];do e.push(G8(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function G8(t){let e=[];do e.push(J8(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function J8(t){let e=X8(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=Q8(t,e);else break;return e}function fN(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Q8(t,e){let n=fN(t),r=n;return t.eat(",")&&(t.next!="}"?r=fN(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Y8(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 X8(t){if(t.eat("(")){let e=Z2(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=Y8(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 Z8(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 Ul(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:nS(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Oi(this,this.computeAttrs(e),Ce.from(n),on.setFrom(r))}createChecked(e=null,n,r){return n=Ce.from(n),this.checkContent(n),new Oi(this,this.computeAttrs(e),n,on.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=Ce.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let a=this.contentMatch.matchFragment(n),i=a&&a.fillBefore(Ce.empty,!0);return i?new Oi(this,e,n.append(i),on.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 aS(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 n6(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 s6{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?n6(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Up{constructor(e,n,r,a){this.name=e,this.rank=n,this.schema=r,this.spec=a,this.attrs=rS(e,a.attrs),this.excluded=null;let i=tS(this.attrs);this.instance=i?new on(this,i):null}create(e=null){return!e&&this.instance?this.instance:new on(this,nS(this.attrs,e))}static compile(e,n){let r=Object.create(null),a=0;return e.forEach((i,o)=>r[i]=new Up(i,a++,n,o)),r}removeFromSet(e){for(var n=0;n-1}}class iS{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=js.from(e.nodes),n.marks=js.from(e.marks||{}),this.nodes=mN.compile(this.spec.nodes,this),this.marks=Up.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]=Ul.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?gN(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==""?[]:gN(this,o.split(" "))}this.nodeFromJSON=a=>Oi.fromJSON(this,a),this.markFromJSON=a=>on.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 mN){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 Uf(r,r.defaultAttrs,e,on.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 gN(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 r6(t){return t.tag!=null}function a6(t){return t.style!=null}class Lo{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(a=>{if(r6(a))this.tags.push(a);else if(a6(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 yN(this,n,!1);return r.addAll(e,on.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new yN(this,n,!0);return r.addAll(e,on.none,n.from,n.to),ze.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=bN(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=bN(o)),o.node||o.ignore||o.mark||(o.node=a)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Lo(e,Lo.schemaRules(e)))}}const oS={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},i6={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},lS={ol:!0,ul:!0},Pu=1,s0=2,yu=4;function xN(t,e,n){return e!=null?(e?Pu:0)|(e==="full"?s0:0):t&&t.whitespace=="pre"?Pu|s0:n&~yu}class rf{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=on.none,this.match=i||(o&yu?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Ce.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,a;return(a=r.findWrapping(e.type))?(this.match=r,a):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Pu)){let r=this.content[this.content.length-1],a;if(r&&r.isText&&(a=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==a[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-a[0].length))}}let n=Ce.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(Ce.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!oS.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class yN{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=xN(null,n.preserveWhitespace,0)|(r?yu:0);a?i=new rf(a.type,a.attrs,on.none,!0,n.topMatch||a.type.contentMatch,o):r?i=new rf(null,null,on.none,!0,null,o):i=new rf(e.schema.topNodeType,null,on.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&s0?"full":this.localPreserveWS||(a.options&Pu)>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):vN(h.type,e))?(u=h.addToSet(u),!1):!0),this.nodes.push(new rf(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|=Pu)}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 o6(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&lS.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function l6(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function bN(t){let e={};for(let n in t)e[n]=t[n];return e}function vN(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&&jf(Zg(r),a(e,n),null,e.attrs)}static renderSpec(e,n,r=null,a){return jf(e,n,r,a)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ec(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=NN(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return NN(e.marks)}}function NN(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Zg(t){return t.document||window.document}const wN=new WeakMap;function c6(t){let e=wN.get(t);return e===void 0&&wN.set(t,e=d6(t)),e}function d6(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let a=0;a-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=a.indexOf(" ");o>0&&(n=a.slice(0,o),a=a.slice(o+1));let c,u=n?t.createElementNS(n,a):t.createElement(a),h=e[1],f=1;if(h&&typeof h=="object"&&h.nodeType==null&&!Array.isArray(h)){f=2;for(let m in h)if(h[m]!=null){let g=m.indexOf(" ");g>0?u.setAttributeNS(m.slice(0,g),m.slice(g+1),h[m]):m=="style"&&u.style?u.style.cssText=h[m]:u.setAttribute(m,h[m])}}for(let m=f;mf)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:b,contentDOM:N}=jf(t,g,n,r);if(u.appendChild(b),N){if(c)throw new RangeError("Multiple content holes");c=N}}}return{dom:u,contentDOM:c}}const cS=65535,dS=Math.pow(2,16);function u6(t,e){return t+e*dS}function jN(t){return t&cS}function h6(t){return(t-(t&cS))/dS}const uS=1,hS=2,kf=4,fS=8;class r0{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&fS)>0}get deletedBefore(){return(this.delInfo&(uS|kf))>0}get deletedAfter(){return(this.delInfo&(hS|kf))>0}get deletedAcross(){return(this.delInfo&kf)>0}}class Sr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Sr.empty)return Sr.empty}recover(e){let n=0,r=jN(e);if(!this.inverted)for(let a=0;ae)break;let h=this.ranges[c+i],f=this.ranges[c+o],m=u+h;if(e<=m){let g=h?e==u?-1:e==m?1:n:n,b=u+a+(g<0?0:f);if(r)return b;let N=e==(n<0?u:m)?null:u6(c/3,e-u),j=e==u?hS:e==m?uS:kf;return(n<0?e!=u:e!=m)&&(j|=fS),new r0(b,j,N)}a+=f-h}return r?e+a:new r0(e+a,0,null)}touches(e,n){let r=0,a=jN(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 qn.fromReplace(e,this.from,this.to,i)}invert(){return new ga(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 To(n.pos,r.pos,this.mark)}merge(e){return e instanceof To&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new To(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 To(n.from,n.to,e.markFromJSON(n.mark))}}Fs.jsonID("addMark",To);class ga extends Fs{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 ze(py(n.content,a=>a.mark(this.mark.removeFromSet(a.marks)),e),n.openStart,n.openEnd);return qn.fromReplace(e,this.from,this.to,r)}invert(){return new To(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 ga(n.pos,r.pos,this.mark)}merge(e){return e instanceof ga&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ga(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 ga(n.from,n.to,e.markFromJSON(n.mark))}}Fs.jsonID("removeMark",ga);class Mo extends Fs{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return qn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return qn.fromReplace(e,this.pos,this.pos+1,new ze(Ce.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let a=0;ar.pos?null:new gs(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 gs(n.from,n.to,n.gapFrom,n.gapTo,ze.fromJSON(e,n.slice),n.insert,!!n.structure)}}Fs.jsonID("replaceAround",gs);function a0(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 f6(t,e,n,r){let a=[],i=[],o,c;t.doc.nodesBetween(e,n,(u,h,f)=>{if(!u.isInline)return;let m=u.marks;if(!r.isInSet(m)&&f.type.allowsMarkType(r.type)){let g=Math.max(h,e),b=Math.min(h+u.nodeSize,n),N=r.addToSet(m);for(let j=0;jt.step(u)),i.forEach(u=>t.step(u))}function p6(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 Up){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 ga(o.from,o.to,o.style)))}function my(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 m6(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function yd(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,a=0,i=0;;--r){let o=t.$from.node(r),c=t.$from.index(r)+a,u=t.$to.indexAfter(r)-i;if(rn;N--)j||r.index(N)>0?(j=!0,f=Ce.from(r.node(N).copy(f)),m++):u--;let g=Ce.empty,b=0;for(let N=i,j=!1;N>n;N--)j||a.after(N+1)=0;o--){if(r.size){let c=n[o].type.contentMatch.matchFragment(r);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Ce.from(n[o].type.create(n[o].attrs,r))}let a=e.start,i=e.end;t.step(new gs(a,i,a,i,new ze(r,0,0),n.length,!0))}function v6(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)&&N6(t.doc,t.mapping.slice(i).map(c),r)){let h=null;if(r.schema.linebreakReplacement){let b=r.whitespace=="pre",N=!!r.contentMatch.matchType(r.schema.linebreakReplacement);b&&!N?h=!1:!b&&N&&(h=!0)}h===!1&&mS(t,o,c,i),my(t,t.mapping.slice(i).map(c,1),r,void 0,h===null);let f=t.mapping.slice(i),m=f.map(c,1),g=f.map(c+o.nodeSize,1);return t.step(new gs(m,g,m+1,g-1,new ze(Ce.from(r.create(u,null,o.marks)),0,0),1,!0)),h===!0&&pS(t,o,c,i),!1}})}function pS(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 mS(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 N6(t,e,n){let r=t.resolve(e),a=r.index();return r.parent.canReplaceWith(a,a+1,n)}function w6(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 gs(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new ze(Ce.from(o),0,0),1,!0))}function Di(t,e,n=1,r){let a=t.resolve(e),i=a.depth-n,o=r&&r[r.length-1]||a.parent;if(i<0||a.parent.type.spec.isolating||!a.parent.canReplace(a.index(),a.parent.childCount)||!o.type.validContent(a.parent.content.cutByIndex(a.index(),a.parent.childCount)))return!1;for(let h=a.depth-1,f=n-2;h>i;h--,f--){let m=a.node(h),g=a.index(h);if(m.type.spec.isolating)return!1;let b=m.content.cutByIndex(g,m.childCount),N=r&&r[f+1];N&&(b=b.replaceChild(0,N.type.create(N.attrs)));let j=r&&r[f]||m;if(!m.canReplace(g+1,m.childCount)||!j.type.validContent(b))return!1}let c=a.indexAfter(i),u=r&&r[0];return a.node(i).canReplaceWith(c,c,u?u.type:a.node(i+1).type)}function j6(t,e,n=1,r){let a=t.doc.resolve(e),i=Ce.empty,o=Ce.empty;for(let c=a.depth,u=a.depth-n,h=n-1;c>u;c--,h--){i=Ce.from(a.node(c).copy(i));let f=r&&r[h];o=Ce.from(f?f.type.create(f.attrs,o):a.node(c).copy(o))}t.step(new hs(e,e,new ze(i.append(o),n,n),!0))}function Jo(t,e){let n=t.resolve(e),r=n.index();return gS(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function k6(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&&gS(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 S6(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);mS(t,f.node(),f.before(),c)}o.inlineContent&&my(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 hs(h,u.map(e+n,-1),ze.empty,!0)),r===!0){let f=t.doc.resolve(h);pS(t,f.node(),f.before(),t.steps.length)}return t}function C6(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 Kp(t,e,n=e,r=ze.empty){if(e==n&&!r.size)return null;let a=t.resolve(e),i=t.resolve(n);return yS(a,i,r)?new hs(e,n,r):new E6(a,i,r).fit()}function yS(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class E6{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=Ce.empty;for(let a=0;a<=e.depth;a++){let i=e.node(a);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(a))})}for(let a=e.depth;a>0;a--)this.placed=Ce.from(e.node(a).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let h=this.findFittable();h?this.placeNodes(h):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,a=this.close(e<0?this.$to:r.doc.resolve(e));if(!a)return null;let i=this.placed,o=r.depth,c=a.depth;for(;o&&c&&i.childCount==1;)i=i.firstChild.content,o--,c--;let u=new ze(i,o,c);return e>-1?new gs(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new hs(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=tx(this.unplaced.content,r-1).firstChild,a=i.content):a=this.unplaced.content;let o=a.firstChild;for(let c=this.depth;c>=0;c--){let{type:u,match:h}=this.frontier[c],f,m=null;if(n==1&&(o?h.matchType(o.type)||(m=h.fillBefore(Ce.from(o),!1)):i&&u.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:c,parent:i,inject:m};if(n==2&&o&&(f=h.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:c,parent:i,wrap:f};if(i&&h.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,a=tx(e,n);return!a.childCount||a.firstChild.isLeaf?!1:(this.unplaced=new ze(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=tx(e,n);if(a.childCount<=1&&n>0){let i=e.size-n<=n+a.size;this.unplaced=new ze(lu(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new ze(lu(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:a,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let j=0;j1||u==0||j.content.size)&&(m=v,f.push(bS(j.mark(g.allowedMarks(j.marks)),h==1?u:0,h==c.childCount?b:-1)))}let N=h==c.childCount;N||(b=-1),this.placed=cu(this.placed,n,Ce.from(f)),this.frontier[n].match=m,N&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let j=0,v=c;j1&&a==this.$to.end(--r);)++a;return a}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:a}=this.frontier[n],i=n=0;c--){let{match:u,type:h}=this.frontier[c],f=nx(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=cu(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=cu(this.placed,this.depth,Ce.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(Ce.empty,!0);n.childCount&&(this.placed=cu(this.placed,this.frontier.length,n))}}function lu(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(lu(t.firstChild.content,e-1,n)))}function cu(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(cu(t.lastChild.content,e-1,n)))}function tx(t,e){for(let n=0;n1&&(r=r.replaceChild(0,bS(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(Ce.empty,!0)))),t.copy(r)}function nx(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&&!T6(n,i.content,o)?c:null}function T6(t,e,n){for(let r=n;r0;g--,b--){let N=a.node(g).type.spec;if(N.defining||N.definingAsContext||N.isolating)break;o.indexOf(g)>-1?c=g:a.before(g)==b&&o.splice(1,0,-g)}let u=o.indexOf(c),h=[],f=r.openStart;for(let g=r.content,b=0;;b++){let N=g.firstChild;if(h.push(N),b==r.openStart)break;g=N.content}for(let g=f-1;g>=0;g--){let b=h[g],N=M6(b.type);if(N&&!b.sameMarkup(a.node(Math.abs(c)-1)))f=g;else if(N||!b.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let b=(g+f+1)%(r.openStart+1),N=h[b];if(N)for(let j=0;j=0&&(t.replace(e,n,r),!(t.steps.length>m));g--){let b=o[g];b<0||(e=a.before(b),n=i.after(b))}}function vS(t,e,n,r,a){if(er){let i=a.contentMatchAt(0),o=i.fillBefore(t).append(t);t=o.append(i.matchFragment(o).fillBefore(Ce.empty,!0))}return t}function I6(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let a=C6(t.doc,e,r.type);a!=null&&(e=n=a)}t.replaceRange(e,n,new ze(Ce.from(r),0,0))}function P6(t,e,n){let r=t.doc.resolve(e),a=t.doc.resolve(n),i=NS(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 NS(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 Xc extends Fs{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 qn.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 qn.fromReplace(e,this.pos,this.pos+1,new ze(Ce.from(a),0,n.isLeaf?0:1))}getMap(){return Sr.empty}invert(e){return new Xc(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 Xc(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 Xc(n.pos,n.attr,n.value)}}Fs.jsonID("attr",Xc);class Lu extends Fs{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 qn.ok(r)}getMap(){return Sr.empty}invert(e){return new Lu(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 Lu(n.attr,n.value)}}Fs.jsonID("docAttr",Lu);let rd=class extends Error{};rd=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};rd.prototype=Object.create(Error.prototype);rd.prototype.constructor=rd;rd.prototype.name="TransformError";class xy{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 rd(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=ze.empty){let a=Kp(this.doc,e,n,r);return a&&this.step(a),this}replaceWith(e,n,r){return this.replace(e,n,new ze(Ce.from(r),0,0))}delete(e,n){return this.replace(e,n,ze.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return A6(this,e,n,r),this}replaceRangeWith(e,n,r){return I6(this,e,n,r),this}deleteRange(e,n){return P6(this,e,n),this}lift(e,n){return g6(this,e,n),this}join(e,n=1){return S6(this,e,n),this}wrap(e,n){return b6(this,e,n),this}setBlockType(e,n=e,r,a=null){return v6(this,e,n,r,a),this}setNodeMarkup(e,n,r=null,a){return w6(this,e,n,r,a),this}setNodeAttribute(e,n,r){return this.step(new Xc(e,n,r)),this}setDocAttribute(e,n){return this.step(new Lu(e,n)),this}addNodeMark(e,n){return this.step(new Mo(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 on)n.isInSet(r.marks)&&this.step(new Wl(e,n));else{let a=r.marks,i,o=[];for(;i=n.isInSet(a);)o.push(new Wl(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 j6(this,e,n,r),this}addMark(e,n,r){return f6(this,e,n,r),this}removeMark(e,n,r){return p6(this,e,n,r),this}clearIncompatible(e,n,r){return my(this,e,n,r),this}}const sx=Object.create(null);class ft{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new wS(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?Vc(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):Vc(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 Er(e.node(0))}static atStart(e){return Vc(e,e,0,0,1)||new Er(e)}static atEnd(e){return Vc(e,e,e.content.size,e.childCount,-1)||new Er(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=sx[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 sx)throw new RangeError("Duplicate use of selection JSON ID "+e);return sx[e]=n,n.prototype.jsonID=e,n}getBookmark(){return ot.between(this.$anchor,this.$head).getBookmark()}}ft.prototype.visible=!0;class wS{constructor(e,n){this.$from=e,this.$to=n}}let SN=!1;function CN(t){!SN&&!t.parent.inlineContent&&(SN=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class ot extends ft{constructor(e,n=e){CN(e),CN(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return ft.near(r);let a=e.resolve(n.map(this.anchor));return new ot(a.parent.inlineContent?a:r,r)}replace(e,n=ze.empty){if(super.replace(e,n),n==ze.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ot&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new qp(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new ot(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let a=e.resolve(n);return new this(a,r==n?a:e.resolve(r))}static between(e,n,r){let a=e.pos-n.pos;if((!r||a)&&(r=a>=0?1:-1),!n.parent.inlineContent){let i=ft.findFrom(n,r,!0)||ft.findFrom(n,-r,!0);if(i)n=i.$head;else return ft.near(n,r)}return e.parent.inlineContent||(a==0?e=n:(e=(ft.findFrom(e,-r,!0)||ft.findFrom(e,r,!0)).$anchor,e.pos0?0:1);a>0?o=0;o+=a){let c=e.child(o);if(c.isAtom){if(!i&&it.isSelectable(c))return it.create(t,n-(a<0?c.nodeSize:0))}else{let u=Vc(t,c,n+a,a<0?c.childCount:0,a,i);if(u)return u}n+=c.nodeSize*a}return null}function EN(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 TN=1,af=2,MN=4;class L6 extends xy{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|=af,this}ensureMarks(e){return on.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&af)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~af,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)||on.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|=MN,this}get scrolledIntoView(){return(this.updated&MN)>0}}function AN(t,e){return!e||!t?t:t.bind(e)}class du{constructor(e,n,r){this.name=e,this.init=AN(n.init,r),this.apply=AN(n.apply,r)}}const O6=[new du("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new du("selection",{init(t,e){return t.selection||ft.atStart(e.doc)},apply(t){return t.selection}}),new du("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new du("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class rx{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=O6.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 du(r.key,r.spec.state,r))})}}class Jc{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 rx(e.schema,e.plugins),i=new Jc(a);return a.fields.forEach(o=>{if(o.name=="doc")i.doc=Oi.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 jS(t,e,n){for(let r in t){let a=t[r];a instanceof Function?a=a.bind(e):r=="handleDOMEvents"&&(a=jS(a,e,{})),n[r]=a}return n}class hn{constructor(e){this.spec=e,this.props={},e.props&&jS(e.props,this,this.props),this.key=e.key?e.key.key:kS("plugin")}getState(e){return e[this.key]}}const ax=Object.create(null);function kS(t){return t in ax?t+"$"+ ++ax[t]:(ax[t]=0,t+"$")}class wn{constructor(e="key"){this.key=kS(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const by=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function SS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const CS=(t,e,n)=>{let r=SS(t,n);if(!r)return!1;let a=vy(r);if(!a){let o=r.blockRange(),c=o&&yd(o);return c==null?!1:(e&&e(t.tr.lift(o,c).scrollIntoView()),!0)}let i=a.nodeBefore;if(OS(t,a,e,-1))return!0;if(r.parent.content.size==0&&(ad(i,"end")||it.isSelectable(i)))for(let o=r.depth;;o--){let c=Kp(t.doc,r.before(o),r.after(o),ze.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},D6=(t,e,n)=>{let r=SS(t,n);if(!r)return!1;let a=vy(r);return a?ES(t,a,e):!1},_6=(t,e,n)=>{let r=MS(t,n);if(!r)return!1;let a=Ny(r);return a?ES(t,a,e):!1};function ES(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=Kp(t.doc,i,u,ze.empty);if(!h||h.from!=i||h instanceof hs&&h.slice.size>=u-i)return!1;if(n){let f=t.tr.step(h);f.setSelection(ot.create(f.doc,i)),n(f.scrollIntoView())}return!0}function ad(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 TS=(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=vy(r)}let o=i&&i.nodeBefore;return!o||!it.isSelectable(o)?!1:(e&&e(t.tr.setSelection(it.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function vy(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 MS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=MS(t,n);if(!r)return!1;let a=Ny(r);if(!a)return!1;let i=a.nodeAfter;if(OS(t,a,e,1))return!0;if(r.parent.content.size==0&&(ad(i,"start")||it.isSelectable(i))){let o=Kp(t.doc,r.before(),r.after(),ze.empty);if(o&&o.slice.size{let{$head:r,empty:a}=t.selection,i=r;if(!a)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let n=t.selection,r=n instanceof it,a;if(r){if(n.node.isTextblock||!Jo(t.doc,n.from))return!1;a=n.from}else if(a=Wp(t.doc,n.from,-1),a==null)return!1;if(e){let i=t.tr.join(a);r&&i.setSelection(it.create(i.doc,a-t.doc.resolve(a).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},z6=(t,e)=>{let n=t.selection,r;if(n instanceof it){if(n.node.isTextblock||!Jo(t.doc,n.to))return!1;r=n.to}else if(r=Wp(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},F6=(t,e)=>{let{$from:n,$to:r}=t.selection,a=n.blockRange(r),i=a&&yd(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 wy(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=wy(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},RS=(t,e)=>{let n=t.selection,{$from:r,$to:a}=n;if(n instanceof Er||r.parent.inlineContent||a.parent.inlineContent)return!1;let i=wy(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(Di(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),a=r&&yd(r);return a==null?!1:(e&&e(t.tr.lift(r,a).scrollIntoView()),!0)};function V6(t){return(e,n)=>{let{$from:r,$to:a}=e.selection;if(e.selection instanceof it&&e.selection.node.isBlock)return!r.parentOffset||!Di(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=wy(r.node(b-1).contentMatchAt(r.indexAfter(b-1))),i.unshift(u&&c?{type:c}:null),o=b;break}else{if(b==1)return!1;i.unshift(null)}let f=e.tr;(e.selection instanceof ot||e.selection instanceof Er)&&f.deleteSelection();let m=f.mapping.map(r.pos),g=Di(f.doc,m,i.length,i);if(g||(i[0]=c?{type:c}:null,g=Di(f.doc,m,i.length,i)),!g)return!1;if(f.split(m,i.length,i),!u&&h&&r.node(o).type!=c){let b=f.mapping.map(r.before(o)),N=f.doc.resolve(b);c&&r.node(o-1).canReplaceWith(N.index(),N.index()+1,c)&&f.setNodeMarkup(f.mapping.map(r.before(o)),c)}return n&&n(f.scrollIntoView()),!0}}const H6=V6(),U6=(t,e)=>{let{$from:n,to:r}=t.selection,a,i=n.sharedDepth(r);return i==0?!1:(a=n.before(i),e&&e(t.tr.setSelection(it.create(t.doc,a))),!0)};function W6(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||Jo(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function OS(t,e,n,r){let a=e.nodeBefore,i=e.nodeAfter,o,c,u=a.type.spec.isolating||i.type.spec.isolating;if(!u&&W6(t,e,n))return!0;let h=!u&&e.parent.canReplace(e.index(),e.index()+1);if(h&&(o=(c=a.contentMatchAt(a.childCount)).findWrapping(i.type))&&c.matchType(o[0]||i.type).validEnd){if(n){let b=e.pos+i.nodeSize,N=Ce.empty;for(let k=o.length-1;k>=0;k--)N=Ce.from(o[k].create(null,N));N=Ce.from(a.copy(N));let j=t.tr.step(new gs(e.pos-1,b,e.pos,b,new ze(N,1,0),o.length,!0)),v=j.doc.resolve(b+2*o.length);v.nodeAfter&&v.nodeAfter.type==a.type&&Jo(j.doc,v.pos)&&j.join(v.pos),n(j.scrollIntoView())}return!0}let f=i.type.spec.isolating||r>0&&u?null:ft.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),g=m&&yd(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(h&&ad(i,"start",!0)&&ad(a,"end")){let b=a,N=[];for(;N.push(b),!b.isTextblock;)b=b.lastChild;let j=i,v=1;for(;!j.isTextblock;j=j.firstChild)v++;if(b.canReplace(b.childCount,b.childCount,j.content)){if(n){let k=Ce.empty;for(let C=N.length-1;C>=0;C--)k=Ce.from(N[C].copy(k));let T=t.tr.step(new gs(e.pos-N.length,e.pos+i.nodeSize,e.pos+v,e.pos+i.nodeSize-v,new ze(k,N.length,0),0,!0));n(T.scrollIntoView())}return!0}}return!1}function DS(t){return function(e,n){let r=e.selection,a=t<0?r.$from:r.$to,i=a.depth;for(;a.node(i).isInline;){if(!i)return!1;i--}return a.node(i).isTextblock?(n&&n(e.tr.setSelection(ot.create(e.doc,t<0?a.start(i):a.end(i)))),!0):!1}}const K6=DS(-1),q6=DS(1);function G6(t,e=null){return function(n,r){let{$from:a,$to:i}=n.selection,o=a.blockRange(i),c=o&&gy(o,t,e);return c?(r&&r(n.tr.wrap(o,c).scrollIntoView()),!0):!1}}function IN(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 Hf(u,u,e.depth),e.endIndex=0;f--)i=Ce.from(n[f].type.create(n[f].attrs,i));t.step(new gs(e.start-(r?2:0),e.end,e.start,e.end,new ze(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?Z6(e,n,t,i):eL(e,n,i):!0:!1}}function Z6(t,e,n,r){let a=t.tr,i=r.end,o=r.$to.end(r.depth);ij;N--)b-=a.child(N).nodeSize,r.delete(b-1,b+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,u=n.endIndex==a.childCount,h=i.node(-1),f=i.index(-1);if(!h.canReplace(f+(c?0:1),f+1,o.content.append(u?Ce.empty:Ce.from(a))))return!1;let m=i.pos,g=m+o.nodeSize;return r.step(new gs(m-(c?1:0),g+(u?1:0),m+1,g-1,new ze((c?Ce.empty:Ce.from(a.copy(Ce.empty))).append(u?Ce.empty:Ce.from(a.copy(Ce.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function tL(t){return function(e,n){let{$from:r,$to:a}=e.selection,i=r.blockRange(a,h=>h.childCount>0&&h.firstChild.type==t);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let c=i.parent,u=c.child(o-1);if(u.type!=t)return!1;if(n){let h=u.lastChild&&u.lastChild.type==c.type,f=Ce.from(h?t.create():null),m=new ze(Ce.from(t.create(null,Ce.from(c.type.create(null,f)))),h?3:1,0),g=i.start,b=i.end;n(e.tr.step(new gs(g-(h?3:1),b,g,b,m,1,!0)).scrollIntoView())}return!0}}const ks=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},id=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let i0=null;const Ci=function(t,e,n){let r=i0||(i0=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},nL=function(){i0=null},Kl=function(t,e,n,r){return n&&(PN(t,e,n,r,-1)||PN(t,e,n,r,1))},sL=/^(img|br|input|textarea|hr)$/i;function PN(t,e,n,r,a){for(var i;;){if(t==n&&e==r)return!0;if(e==(a<0?0:Kr(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Gu(t)||sL.test(t.nodeName)||t.contentEditable=="false")return!1;e=ks(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?Kr(t):0}else return!1}}function Kr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function rL(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=Kr(t)}else if(t.parentNode&&!Gu(t))e=ks(t),t=t.parentNode;else return null}}function aL(t,e){for(;;){if(t.nodeType==3&&e2),Wr=od||(Ka?/Mac/.test(Ka.platform):!1),zS=Ka?/Win/.test(Ka.platform):!1,Ri=/Android \d/.test(Qo),Ju=!!RN&&"webkitFontSmoothing"in RN.documentElement.style,cL=Ju?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function dL(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 uL(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 LN(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=id(o);continue}let c=o,u=c==i.body,h=u?dL(i):uL(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 b=c.scrollLeft,N=c.scrollTop;m&&(c.scrollTop+=m),f&&(c.scrollLeft+=f);let j=c.scrollLeft-b,v=c.scrollTop-N;e={left:e.left-j,top:e.top-v,right:e.right-j,bottom:e.bottom-v}}let g=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(g))break;o=g=="absolute"?o.offsetParent:id(o)}}function hL(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:FS(t.dom)}}function FS(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=id(r));return e}function fL({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;BS(n,r==0?0:r-e)}function BS(t,e){for(let n=0;n=c){o=Math.max(N.bottom,o),c=Math.min(N.top,c);let j=N.left>e.left?N.left-e.left:N.right=(N.left+N.right)/2?1:0));continue}}else N.top>e.top&&!u&&N.left<=e.left&&N.right>=e.left&&(u=f,h={left:Math.max(N.left,Math.min(N.right,e.left)),top:N.top});!n&&(e.left>=N.right&&e.top>=N.top||e.left>=N.left&&e.top>=N.bottom)&&(i=m+1)}}return!n&&u&&(n=u,a=h,r=0),n&&n.nodeType==3?mL(n,a):!n||r&&n.nodeType==1?{node:t,offset:i}:VS(n,a)}function mL(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 ky(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function gL(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 yL(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 HS(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&a++}let h;Ju&&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=yL(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 ON(t){return t.top=0&&a==r.nodeValue.length?(u--,f=1):n<0?u--:h++,ru(xo(Ci(r,u,h),f),f<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&a&&(n<0||a==Kr(r))){let u=r.childNodes[a-1];if(u.nodeType==1)return ix(u.getBoundingClientRect(),!1)}if(i==null&&a=0)}if(i==null&&a&&(n<0||a==Kr(r))){let u=r.childNodes[a-1],h=u.nodeType==3?Ci(u,Kr(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(h)return ru(xo(h,1),!1)}if(i==null&&a=0)}function ru(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 ix(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 WS(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 NL(t,e,n){let r=e.selection,a=n=="up"?r.$from:r.$to;return WS(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=US(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=Ci(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 wL=/[\u0590-\u08ac]/;function jL(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?!wL.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?i:o:WS(t,e,()=>{let{focusNode:u,focusOffset:h,anchorNode:f,anchorOffset:m}=t.domSelectionRange(),g=c.caretBidiLevel;c.modify("move",n,"character");let b=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:N,focusOffset:j}=t.domSelectionRange(),v=N&&!b.contains(N.nodeType==1?N:N.parentNode)||u==N&&h==j;try{c.collapse(f,m),u&&(u!=f||h!=m)&&c.extend&&c.extend(u,h)}catch{}return g!=null&&(c.caretBidiLevel=g),v}):r.pos==r.start()||r.pos==r.end()}let DN=null,_N=null,$N=!1;function kL(t,e,n){return DN==e&&_N==n?$N:(DN=e,_N=n,$N=n=="up"||n=="down"?NL(t,e,n):jL(t,e,n))}const Gr=0,zN=1,El=2,qa=3;class Qu{constructor(e,n,r,a){this.parent=e,this.children=n,this.dom=r,this.contentDOM=a,this.dirty=Gr,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;nks(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 qS){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 KS&&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?ks(i.dom)+1:0}}else{let i,o=!0;for(;i=r=f&&n<=h-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,f);e=o;for(let m=c;m>0;m--){let g=this.children[m-1];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(1)){a=ks(g.dom)+1;break}e-=g.size}a==-1&&(a=0)}if(a>-1&&(h>n||c==this.children.length-1)){n=h;for(let f=c+1;fN&&on){let N=c;c=u,u=N}let b=document.createRange();b.setEnd(u.node,u.offset),b.setStart(c.node,c.offset),h.removeAllRanges(),h.addRange(b)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,a=0;a=r:er){let c=r+i.border,u=o-i.border;if(e>=c&&n<=u){this.dirty=e==r||n==o?El:zN,e==c&&n==u&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=qa:i.markDirty(e-c,n-c);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?El:qa}r=o}this.dirty=El}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?El:zN;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==Gr&&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 SL extends Qu{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 ql extends Qu{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=ec.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ql(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&qa||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=qa&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Gr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(i=u0(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}=ec.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!m&&!n.isText&&f.nodeName!="BR"&&(f.hasAttribute("contenteditable")||(f.contentEditable="false"),n.type.spec.draggable&&(f.draggable=!0));let g=f;return f=QS(f,r,n),h?u=new CL(e,n,r,a,f,m||null,g,h,i,o+1):n.isText?new Jp(e,n,r,a,f,g,i):new Do(e,n,r,a,f,m||null,g,i,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Ce.empty)}return e}matchesNode(e,n,r){return this.dirty==Gr&&e.eq(this.node)&&Wf(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 TL(this,o&&o.node,e);IL(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?on.none:this.node.child(f).marks,r,e,f),u.placeWidget(h,e,a)},(h,f,m,g)=>{u.syncToMarks(h.marks,r,e,g);let b;u.findNodeMatch(h,f,m,g)||c&&e.state.selection.from>a&&e.state.selection.to-1&&u.updateNodeAt(h,f,m,b,e)||u.updateNextNode(h,f,m,e,g,a)||u.addNode(h,f,m,e,a),a+=h.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==El)&&(o&&this.protectLocalComposition(e,o),GS(this.contentDOM,this.children,e),od&&PL(this.dom))}localCompositionInfo(e,n){let{from:r,to:a}=e.state.selection;if(!(e.state.selection instanceof ot)||rn+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,c=RL(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 SL(this,i,n,a);e.input.compositionNodes.push(o),this.children=u0(this.children,r,r+a.length,e,o)}update(e,n,r,a){return this.dirty==qa||!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=Gr}updateOuterDeco(e){if(Wf(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=JS(this.dom,this.nodeDOM,d0(this.outerDeco,this.node,n),d0(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 FN(t,e,n,r,a){QS(r,e,t);let i=new Do(void 0,t,e,n,r,r,r,a,0);return i.contentDOM&&i.updateChildren(a,0),i}class Jp extends Do{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==qa||this.dirty!=Gr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Gr||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=Gr,!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=qa)}get domAtom(){return!1}isText(e){return this.node.text==e}}class qS extends Qu{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Gr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class CL extends Do{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==qa)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 GS(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=ql.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 ql)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 AL(t,e){return t.type.side-e.type.side}function IL(t,e,n,r){let a=e.locals(t),i=0;if(a.length==0){for(let h=0;hi;)c.push(a[o++]);let N=i+g.nodeSize;if(g.isText){let v=N;o!v.inline):c.slice();r(g,j,e.forChild(i,g),b),i=N}}function PL(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 RL(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 u0(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 Sy(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(Gp(n)){for(u=o;a&&!a.node;)a=a.parent;let m=a.node;if(a&&m.isAtom&&it.isSelectable(m)&&a.parent&&!(m.isInline&&iL(n.focusNode,n.focusOffset,a.dom))){let g=a.posBefore;h=new it(o==g?c:r.resolve(g))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let m=o,g=o;for(let b=0;b{(n.anchorNode!=r||n.anchorOffset!=a)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!YS(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function OL(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,ks(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&hr&&Oo<=11&&(n.disabled=!0,n.disabled=!1)}function XS(t,e){if(e instanceof it){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(WN(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else WN(t)}function WN(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Cy(t,e,n,r){return t.someProp("createSelectionBetween",a=>a(t,e,n))||ot.between(e,n,r)}function KN(t){return t.editable&&!t.hasFocus()?!1:ZS(t)}function ZS(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 DL(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Kl(e.node,e.offset,n.anchorNode,n.anchorOffset)}function h0(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 yo(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function qN(t,e,n){let r=t.state.selection;if(r instanceof ot)if(n.indexOf("s")>-1){let{$head:a}=r,i=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(a.pos+i.nodeSize*(e<0?-1:1));return yo(t,new ot(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let a=h0(t.state,e);return a&&a instanceof it?yo(t,a):!1}else if(!(Wr&&n.indexOf("m")>-1)){let a=r.$head,i=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter,o;if(!i||i.isText)return!1;let c=e<0?a.pos-i.nodeSize:a.pos;return i.isAtom||(o=t.docView.descAt(c))&&!o.contentDOM?it.isSelectable(i)?yo(t,new it(e<0?t.state.doc.resolve(a.pos-i.nodeSize):a)):Ju?yo(t,new ot(t.state.doc.resolve(e<0?c:c+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof it&&r.node.isInline)return yo(t,new ot(e>0?r.$to:r.$from));{let a=h0(t.state,e);return a?yo(t,a):!1}}}function Kf(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function vu(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Fc(t,e){return e<0?_L(t):$L(t)}function _L(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a,i,o=!1;for(qr&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(vu(c,-1))a=n,i=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(eC(n))break;{let c=n.previousSibling;for(;c&&vu(c,-1);)a=n.parentNode,i=ks(c),c=c.previousSibling;if(c)n=c,r=Kf(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?f0(t,n,r):a&&f0(t,a,i)}function $L(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a=Kf(n),i,o;for(;;)if(r{t.state==a&&_i(t)},50)}function GN(t,e){let n=t.state.doc.resolve(e);if(!(Cs||zS)&&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 JN(t,e,n){let r=t.state.selection;if(r instanceof ot&&!r.empty||n.indexOf("s")>-1||Wr&&n.indexOf("m")>-1)return!1;let{$from:a,$to:i}=r;if(!a.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=h0(t.state,e);if(o&&o instanceof it)return yo(t,o)}if(!a.parent.inlineContent){let o=e<0?a:i,c=r instanceof Er?ft.near(o,e):ft.findFrom(o,e);return c?yo(t,c):!1}return!1}function QN(t,e){if(!(t.state.selection instanceof ot))return!0;let{$head:n,$anchor:r,empty:a}=t.state.selection;if(!n.sameParent(r))return!0;if(!a)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function YN(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function BL(t){if(!$s||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;YN(t,r,"true"),setTimeout(()=>YN(t,r,"false"),20)}return!1}function VL(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function HL(t,e){let n=e.keyCode,r=VL(e);if(n==8||Wr&&n==72&&r=="c")return QN(t,-1)||Fc(t,-1);if(n==46&&!e.shiftKey||Wr&&n==68&&r=="c")return QN(t,1)||Fc(t,1);if(n==13||n==27)return!0;if(n==37||Wr&&n==66&&r=="c"){let a=n==37?GN(t,t.state.selection.from)=="ltr"?-1:1:-1;return qN(t,a,r)||Fc(t,a)}else if(n==39||Wr&&n==70&&r=="c"){let a=n==39?GN(t,t.state.selection.from)=="ltr"?1:-1:1;return qN(t,a,r)||Fc(t,a)}else{if(n==38||Wr&&n==80&&r=="c")return JN(t,-1,r)||Fc(t,-1);if(n==40||Wr&&n==78&&r=="c")return BL(t)||JN(t,1,r)||Fc(t,1);if(r==(Wr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Ey(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")||ec.fromSchema(t.state.schema),c=iC(),u=c.createElement("div");u.appendChild(o.serializeFragment(r,{document:c}));let h=u.firstChild,f,m=0;for(;h&&h.nodeType==1&&(f=aC[h.nodeName.toLowerCase()]);){for(let b=f.length-1;b>=0;b--){let N=c.createElement(f[b]);for(;u.firstChild;)N.appendChild(u.firstChild);u.appendChild(N),m++}h=u.firstChild}h&&h.nodeType==1&&h.setAttribute("data-pm-slice",`${a} ${i}${m?` -${m}`:""} ${JSON.stringify(n)}`);let g=t.someProp("clipboardTextSerializer",b=>b(e,t))||e.content.textBetween(0,e.content.size,` + +`);return{dom:u,text:g,slice:e}}function tC(t,e,n,r,a){let i=a.parent.type.spec.code,o,c;if(!n&&!e)return null;let u=!!e&&(r||i||!n);if(u){if(t.someProp("transformPastedText",g=>{e=g(e,i||r,t)}),i)return c=new ze(Ce.from(t.state.schema.text(e.replace(/\r\n?/g,` +`))),0,0),t.someProp("transformPasted",g=>{c=g(c,t,!0)}),c;let m=t.someProp("clipboardTextParser",g=>g(e,a,r,t));if(m)c=m;else{let g=a.marks(),{schema:b}=t.state,N=ec.fromSchema(b);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(j=>{let v=o.appendChild(document.createElement("p"));j&&v.appendChild(N.serializeNode(b.text(j,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),o=qL(n),Ju&&GL(o);let h=o&&o.querySelector("[data-pm-slice]"),f=h&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(h.getAttribute("data-pm-slice")||"");if(f&&f[3])for(let m=+f[3];m>0;m--){let g=o.firstChild;for(;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;o=g}if(c||(c=(t.someProp("clipboardParser")||t.someProp("domParser")||Lo.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||f),context:a,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!UL.test(g.parentNode.nodeName)?{ignore:!0}:null}})),f)c=JL(XN(c,+f[1],+f[2]),f[4]);else if(c=ze.maxOpen(WL(c.content,a),!0),c.openStart||c.openEnd){let m=0,g=0;for(let b=c.content.firstChild;m{c=m(c,t,u)}),c}const UL=/^(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 WL(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&&sC(u,i,c,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=rC(o[o.length-1],i.length));let f=nC(c,u);o.push(f),a=a.matchType(f.type),i=u}}),o)return Ce.from(o)}return t}function nC(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,Ce.from(t));return t}function sC(t,e,n,r,a){if(a1&&(i=0),a=n&&(c=e<0?o.contentMatchAt(0).fillBefore(c,i<=a).append(c):c.append(o.contentMatchAt(o.childCount).fillBefore(Ce.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(c))}function XN(t,e,n){return en})),lx.createHTML(t)):t}function qL(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=iC().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),a;if((a=r&&aC[r[1].toLowerCase()])&&(t=a.map(i=>"<"+i+">").join("")+t+a.map(i=>"").reverse().join("")),n.innerHTML=KL(t),a)for(let i=0;i=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;a=Ce.from(u.create(r[c+1],a)),i++,o++}return new ze(a,i,o)}const Gs={},Js={},QL={touchstart:!0,touchmove:!0};class YL{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 XL(t){for(let e in Gs){let n=Gs[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{eO(t,r)&&!Ty(t,r)&&(t.editable||!(r.type in Js))&&n(t,r)},QL[e]?{passive:!0}:void 0)}$s&&t.dom.addEventListener("input",()=>null),m0(t)}function Ao(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function ZL(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 m0(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Ty(t,r))})}function Ty(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function eO(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 tO(t,e){!Ty(t,e)&&Gs[e.type]&&(t.editable||!(e.type in Js))&&Gs[e.type](t,e)}Js.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!lC(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Ri&&Cs&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),od&&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,Sl(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||HL(t,n)?n.preventDefault():Ao(t,"key")};Js.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Js.keypress=(t,e)=>{let n=e;if(lC(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Wr&&n.metaKey)return;if(t.someProp("handleKeyPress",a=>a(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof ot)||!r.$from.sameParent(r.$to)){let a=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(a).scrollIntoView();!/[\r\n]/.test(a)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,a,i))&&t.dispatch(i()),n.preventDefault()}};function Qp(t){return{left:t.clientX,top:t.clientY}}function nO(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function My(t,e,n,r,a){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,c=>o>i.depth?c(t,n,i.nodeAfter,i.before(o),a,!0):c(t,n,i.node(o),i.before(o),a,!1)))return!0;return!1}function Zc(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function sO(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&it.isSelectable(r)?(Zc(t,new it(n)),!0):!1}function rO(t,e){if(e==-1)return!1;let n=t.state.selection,r,a;n instanceof it&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let c=o>i.depth?i.nodeAfter:i.node(o);if(it.isSelectable(c)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?a=i.before(n.$from.depth):a=i.before(o);break}}return a!=null?(Zc(t,it.create(t.state.doc,a)),!0):!1}function aO(t,e,n,r,a){return My(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(a?rO(t,n):sO(t,n))}function iO(t,e,n,r){return My(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",a=>a(t,e,r))}function oO(t,e,n,r){return My(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",a=>a(t,e,r))||lO(t,n,r)}function lO(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Zc(t,ot.create(r,0,r.content.size)),!0):!1;let a=r.resolve(e);for(let i=a.depth+1;i>0;i--){let o=i>a.depth?a.nodeAfter:a.node(i),c=a.before(i);if(o.inlineContent)Zc(t,ot.create(r,c+1,c+1+o.content.size));else if(it.isSelectable(o))Zc(t,it.create(r,c));else continue;return!0}}function Ay(t){return qf(t)}const oC=Wr?"metaKey":"ctrlKey";Gs.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Ay(t),a=Date.now(),i="singleClick";a-t.input.lastClick.time<500&&nO(n,t.input.lastClick)&&!n[oC]&&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(Qp(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new cO(t,o,n,!!r)):(i=="doubleClick"?iO:oO)(t,o.pos,o.inside,n)?n.preventDefault():Ao(t,"pointer"))};class cO{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[oC],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let f=e.state.doc.resolve(n.pos);i=f.parent,o=f.depth?f.before():0}const c=a?null:r.target,u=c?e.docView.nearestDesc(c,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:h}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||h instanceof it&&h.from<=o&&h.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&qr&&!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)),Ao(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(()=>_i(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(Qp(e))),this.updateAllowDefault(e),this.allowDefault||!n?Ao(this.view,"pointer"):aO(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||$s&&this.mightDrag&&!this.mightDrag.node.isAtom||Cs&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Zc(this.view,ft.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Ao(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ao(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)}}Gs.touchstart=t=>{t.input.lastTouch=Date.now(),Ay(t),Ao(t,"pointer")};Gs.touchmove=t=>{t.input.lastTouch=Date.now(),Ao(t,"pointer")};Gs.contextmenu=t=>Ay(t);function lC(t,e){return t.composing?!0:$s&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const dO=Ri?5e3:-1;Js.compositionstart=Js.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof ot&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Cs&&zS&&uO(t)))t.markCursor=t.state.storedMarks||n.marks(),qf(t,!0),t.markCursor=null;else if(qf(t,!e.selection.empty),qr&&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}cC(t,dO)};function uO(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"}Js.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++,cC(t,20))};function cC(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>qf(t),e))}function dC(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=fO());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function hO(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=rL(e.focusNode,e.focusOffset),r=aL(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 fO(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function qf(t,e=!1){if(!(Ri&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),dC(t),e||t.docView&&t.docView.dirty){let n=Sy(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 pO(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 Ou=hr&&Oo<15||od&&cL<604;Gs.copy=Js.cut=(t,e)=>{let n=e,r=t.state.selection,a=n.type=="cut";if(r.empty)return;let i=Ou?null:n.clipboardData,o=r.content(),{dom:c,text:u}=Ey(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",c.innerHTML),i.setData("text/plain",u)):pO(t,c),a&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function mO(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function gO(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?Du(t,r.value,null,a,e):Du(t,r.textContent,r.innerHTML,a,e)},50)}function Du(t,e,n,r,a){let i=tC(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,a,i||ze.empty)))return!0;if(!i)return!1;let o=mO(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 uC(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," "):""}Js.paste=(t,e)=>{let n=e;if(t.composing&&!Ri)return;let r=Ou?null:n.clipboardData,a=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Du(t,uC(r),r.getData("text/html"),a,n)?n.preventDefault():gO(t,n)};class hC{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const xO=Wr?"altKey":"ctrlKey";function fC(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[xO]}Gs.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(Qp(n)),o;if(!(i&&i.pos>=a.from&&i.pos<=(a instanceof it?a.to-1:a.to))){if(r&&r.mightDrag)o=it.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let m=t.docView.nearestDesc(n.target,!0);m&&m.node.type.spec.draggable&&m!=t.docView&&(o=it.create(t.state.doc,m.posBefore))}}let c=(o||t.state.selection).content(),{dom:u,text:h,slice:f}=Ey(t,c);(!n.dataTransfer.files.length||!Cs||$S>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Ou?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",Ou||n.dataTransfer.setData("text/plain",h),t.dragging=new hC(f,fC(t,n),o)};Gs.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Js.dragover=Js.dragenter=(t,e)=>e.preventDefault();Js.drop=(t,e)=>{try{yO(t,e,t.dragging)}finally{t.dragging=null}};function yO(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Qp(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=tC(t,uC(e.dataTransfer),Ou?null:e.dataTransfer.getData("text/html"),!1,a);let o=!!(n&&fC(t,e));if(t.someProp("handleDrop",b=>b(t,e,i||ze.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let c=i?xS(t.state.doc,a.pos,i):a.pos;c==null&&(c=a.pos);let u=t.state.tr;if(o){let{node:b}=n;b?b.replace(u):u.deleteSelection()}let h=u.mapping.map(c),f=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,m=u.doc;if(f?u.replaceRangeWith(h,h,i.content.firstChild):u.replaceRange(h,h,i),u.doc.eq(m))return;let g=u.doc.resolve(h);if(f&&it.isSelectable(i.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(i.content.firstChild))u.setSelection(new it(g));else{let b=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((N,j,v,k)=>b=k),u.setSelection(Cy(t,g,u.doc.resolve(b)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}Gs.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())&&_i(t)},20))};Gs.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)};Gs.beforeinput=(t,e)=>{if(Cs&&Ri&&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,Sl(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 Js)Gs[t]=Js[t];function _u(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 Gf{constructor(e,n){this.toDOM=e,this.spec=n||Rl,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 ss(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Gf&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&_u(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class _o{constructor(e,n){this.attrs=e,this.spec=n||Rl}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 ss(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==Ds||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Rl)}mapInner(e,n,r,a,i){let o;for(let c=0;c{let h=u+r,f;if(f=mC(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 _o){let h=Math.max(i,u.from)-i,f=Math.min(o,u.to)-i;ha.map(e,n,Rl));return No.from(r)}forChild(e,n){if(n.isLeaf)return an.empty;let r=[];for(let a=0;an instanceof an)?e:e.reduce((n,r)=>n.concat(r instanceof an?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let v=j-N-(b-g);for(let k=0;kT+f-m)continue;let C=c[k]+f-m;b>=C?c[k+1]=g<=C?-2:-1:g>=f&&v&&(c[k]+=v,c[k+1]+=v)}m+=v}),f=n.maps[h].map(f,-1)}let u=!1;for(let h=0;h=r.content.size){u=!0;continue}let g=n.map(t[h+1]+i,-1),b=g-a,{index:N,offset:j}=r.content.findIndex(m),v=r.maybeChild(N);if(v&&j==m&&j+v.nodeSize==b){let k=c[h+2].mapInner(n,v,f+1,t[h]+i+1,o);k!=Ds?(c[h]=m,c[h+1]=b,c[h+2]=k):(c[h+1]=-2,u=!0)}else u=!0}if(u){let h=vO(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=mC(t,c,u+n);if(h){i=!0;let f=Jf(h,c,n+u+1,r);f!=Ds&&a.push(u,u+c.nodeSize,f)}});let o=pC(i?gC(t):t,-n).sort(Ll);for(let c=0;c0;)e++;t.splice(e,0,n)}function cx(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Ds&&e.push(r)}),t.cursorWrapper&&e.push(an.create(t.state.doc,[t.cursorWrapper.deco])),No.from(e)}const NO={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},wO=hr&&Oo<=11;class jO{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 kO{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new jO,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():$s&&e.composing&&r.some(a=>a.type=="childList"&&a.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),wO&&(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,NO)),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(KN(this.view)){if(this.suppressingSelectionUpdates)return _i(this.view);if(hr&&Oo<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Kl(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=id(i))n.add(i);for(let i=e.anchorNode;i;i=id(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)&&KN(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(qr&&u.length){let f=u.filter(m=>m.nodeName=="BR");if(f.length==2){let[m,g]=f;m.parentNode&&m.parentNode.parentNode==g.parentNode?g.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let g of f){let b=g.parentNode;b&&b.nodeName=="LI"&&(!m||EO(e,m)!=b)&&g.remove()}}}let h=null;i<0&&a&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||a)&&(i>-1&&(e.docView.markDirty(i,o),SO(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,TO(e,u)),this.handleDOMChange(i,o,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||_i(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let f=0;fa;v--){let k=r.childNodes[v-1],T=k.pmViewDesc;if(k.nodeName=="BR"&&!T){i=v;break}if(!T||T.size)break}let m=t.state.doc,g=t.someProp("domParser")||Lo.fromSchema(t.state.schema),b=m.resolve(o),N=null,j=g.parse(r,{topNode:b.parent,topMatch:b.parent.contentMatchAt(b.index()),topOpen:!0,from:a,to:i,preserveWhitespace:b.parent.type.whitespace=="pre"?"full":!0,findPositions:h,ruleFromNode:AO,context:b});if(h&&h[0].pos!=null){let v=h[0].pos,k=h[1]&&h[1].pos;k==null&&(k=v),N={anchor:v+o,head:k+o}}return{doc:j,sel:N,from:o,to:c}}function AO(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if($s&&/^(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||$s&&/^(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 IO=/^(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 P=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,z=Sy(t,P);if(z&&!t.state.selection.eq(z)){if(Cs&&Ri&&t.input.lastKeyCode===13&&Date.now()-100Q(t,Sl(13,"Enter"))))return;let L=t.state.tr.setSelection(z);P=="pointer"?L.setMeta("pointer",!0):P=="key"&&L.scrollIntoView(),i&&L.setMeta("composition",i),t.dispatch(L)}return}let o=t.state.doc.resolve(e),c=o.sharedDepth(n);e=o.before(c+1),n=t.state.doc.resolve(n).after(c+1);let u=t.state.selection,h=MO(t,e,n),f=t.state.doc,m=f.slice(h.from,h.to),g,b;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||Ri)&&a.some(P=>P.nodeType==1&&!IO.test(P.nodeName))&&(!N||N.endA>=N.endB)&&t.someProp("handleKeyDown",P=>P(t,Sl(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!N)if(r&&u instanceof ot&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(h.sel&&h.sel.anchor!=h.sel.head))N={start:u.from,endA:u.to,endB:u.to};else{if(h.sel){let P=rw(t,t.state.doc,h.sel);if(P&&!P.eq(t.state.selection)){let z=t.state.tr.setSelection(P);i&&z.setMeta("composition",i),t.dispatch(z)}}return}t.state.selection.fromt.state.selection.from&&N.start<=t.state.selection.from+2&&t.state.selection.from>=h.from?N.start=t.state.selection.from:N.endA=t.state.selection.to-2&&t.state.selection.to<=h.to&&(N.endB+=t.state.selection.to-N.endA,N.endA=t.state.selection.to)),hr&&Oo<=11&&N.endB==N.start+1&&N.endA==N.start&&N.start>h.from&&h.doc.textBetween(N.start-h.from-1,N.start-h.from+1)=="  "&&(N.start--,N.endA--,N.endB--);let j=h.doc.resolveNoCache(N.start-h.from),v=h.doc.resolveNoCache(N.endB-h.from),k=f.resolve(N.start),T=j.sameParent(v)&&j.parent.inlineContent&&k.end()>=N.endA;if((od&&t.input.lastIOSEnter>Date.now()-225&&(!T||a.some(P=>P.nodeName=="DIV"||P.nodeName=="P"))||!T&&j.posP(t,Sl(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>N.start&&LO(f,N.start,N.endA,j,v)&&t.someProp("handleKeyDown",P=>P(t,Sl(8,"Backspace")))){Ri&&Cs&&t.domObserver.suppressSelectionUpdates();return}Cs&&N.endB==N.start&&(t.input.lastChromeDelete=Date.now()),Ri&&!T&&j.start()!=v.start()&&v.parentOffset==0&&j.depth==v.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==N.endA&&(N.endB-=2,v=h.doc.resolveNoCache(N.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function(P){return P(t,Sl(13,"Enter"))})},20));let C=N.start,R=N.endA,O=P=>{let z=P||t.state.tr.replace(C,R,h.doc.slice(N.start-h.from,N.endB-h.from));if(h.sel){let L=rw(t,z.doc,h.sel);L&&!(Cs&&t.composing&&L.empty&&(N.start!=N.endB||t.input.lastChromeDelete_i(t),20));let P=O(t.state.tr.delete(C,R)),z=f.resolve(N.start).marksAcross(f.resolve(N.endA));z&&P.ensureMarks(z),t.dispatch(P)}else if(N.endA==N.endB&&(U=RO(j.parent.content.cut(j.parentOffset,v.parentOffset),k.parent.content.cut(k.parentOffset,N.endA-k.start())))){let P=O(t.state.tr);U.type=="add"?P.addMark(C,R,U.mark):P.removeMark(C,R,U.mark),t.dispatch(P)}else if(j.parent.child(j.index()).isText&&j.index()==v.index()-(v.textOffset?0:1)){let P=j.parent.textBetween(j.parentOffset,v.parentOffset),z=()=>O(t.state.tr.insertText(P,C,R));t.someProp("handleTextInput",L=>L(t,C,R,P,z))||t.dispatch(z())}else t.dispatch(O());else t.dispatch(O())}function rw(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Cy(t,e.resolve(n.anchor),e.resolve(n.head))}function RO(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||dx(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 OO(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 xC{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 YL,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(dw),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=lw(this),ow(this),this.nodeViews=cw(this),this.docView=FN(this.state.doc,iw(this),cx(this),this.dom,this),this.domObserver=new kO(this,(r,a,i,o)=>PO(this,r,a,i,o)),this.domObserver.start(),XL(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&&m0(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(dw),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&&(dC(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=cw(this);_O(b,this.nodeViews)&&(this.nodeViews=b,i=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&m0(this),this.editable=lw(this),ow(this);let u=cx(this),h=iw(this),f=a.plugins!=e.plugins&&!a.doc.eq(e.doc)?"reset":e.scrollToSelection>a.scrollToSelection?"to selection":"preserve",m=i||!this.docView.matchesNode(e.doc,h,u);(m||!e.selection.eq(a.selection))&&(o=!0);let g=f=="preserve"&&o&&this.dom.style.overflowAnchor==null&&hL(this);if(o){this.domObserver.stop();let b=m&&(hr||Cs)&&!this.composing&&!a.selection.empty&&!e.selection.empty&&DO(a.selection,e.selection);if(m){let N=Cs?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=hO(this)),(i||!this.docView.update(e.doc,h,u,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=FN(e.doc,h,u,this.dom,this)),N&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(b=!0)}b||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&DL(this))?_i(this,b):(XS(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(a),!((r=this.dragging)===null||r===void 0)&&r.node&&!a.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,a),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():g&&fL(g)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof it){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&LN(this,n.getBoundingClientRect(),e)}else LN(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 hC(e.slice,e.move,a<0?void 0:it.create(this.state.doc,a))}someProp(e,n){let r=this._props&&this._props[e],a;if(r!=null&&(a=n?n(r):r))return a;for(let o=0;on.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return bL(this,e)}coordsAtPos(e,n=1){return US(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 kL(this,n||this.state,e)}pasteHTML(e,n){return Du(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Du(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Ey(this,e)}destroy(){this.docView&&(ZL(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],cx(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,nL())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return tO(this,e)}domSelectionRange(){let e=this.domSelection();return e?$s&&this.root.nodeType===11&&oL(this.dom.ownerDocument)==this.dom&&CO(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}xC.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function iw(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"),[ss.node(0,t.state.doc.content.size,e)]}function ow(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:ss.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function lw(t){return!t.someProp("editable",e=>e(t.state)===!1)}function DO(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 cw(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 _O(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 dw(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 Bo={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:"'"},Qf={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},$O=typeof navigator<"u"&&/Mac/.test(navigator.platform),zO=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ss=0;Ss<10;Ss++)Bo[48+Ss]=Bo[96+Ss]=String(Ss);for(var Ss=1;Ss<=24;Ss++)Bo[Ss+111]="F"+Ss;for(var Ss=65;Ss<=90;Ss++)Bo[Ss]=String.fromCharCode(Ss+32),Qf[Ss]=String.fromCharCode(Ss);for(var ux in Bo)Qf.hasOwnProperty(ux)||(Qf[ux]=Bo[ux]);function FO(t){var e=$O&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||zO&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Qf:Bo)[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 BO=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),VO=typeof navigator<"u"&&/Win/.test(navigator.platform);function HO(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)KO(t,n,{get:e[n],enumerable:!0})};function Yp(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 Xp=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:a}=n,i=this.buildProps(a);return Object.fromEntries(Object.entries(t).map(([o,c])=>[o,(...h)=>{const f=c(...h)(i);return!a.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(a),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:a}=this,{view:i}=r,o=[],c=!!t,u=t||a.tr,h=()=>(!c&&e&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(u),o.every(m=>m===!0)),f={...Object.fromEntries(Object.entries(n).map(([m,g])=>[m,(...N)=>{const j=this.buildProps(u,e),v=g(...N)(j);return o.push(v),f}])),run:h};return f}createCan(t){const{rawCommands:e,state:n}=this,r=!1,a=t||n.tr,i=this.buildProps(a,r);return{...Object.fromEntries(Object.entries(e).map(([c,u])=>[c,(...h)=>u(...h)({...i,dispatch:void 0})])),chain:()=>this.createChain(a,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:a}=this,{view:i}=r,o={tr:t,editor:r,view:i,state:Yp({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}},yC={};Ly(yC,{blur:()=>qO,clearContent:()=>GO,clearNodes:()=>JO,command:()=>QO,createParagraphNear:()=>YO,cut:()=>XO,deleteCurrentNode:()=>ZO,deleteNode:()=>eD,deleteRange:()=>tD,deleteSelection:()=>nD,enter:()=>sD,exitCode:()=>rD,extendMarkRange:()=>aD,first:()=>iD,focus:()=>lD,forEach:()=>cD,insertContent:()=>dD,insertContentAt:()=>fD,joinBackward:()=>gD,joinDown:()=>mD,joinForward:()=>xD,joinItemBackward:()=>yD,joinItemForward:()=>bD,joinTextblockBackward:()=>vD,joinTextblockForward:()=>ND,joinUp:()=>pD,keyboardShortcut:()=>jD,lift:()=>kD,liftEmptyBlock:()=>SD,liftListItem:()=>CD,newlineInCode:()=>ED,resetAttributes:()=>TD,scrollIntoView:()=>MD,selectAll:()=>AD,selectNodeBackward:()=>ID,selectNodeForward:()=>PD,selectParentNode:()=>RD,selectTextblockEnd:()=>LD,selectTextblockStart:()=>OD,setContent:()=>DD,setMark:()=>n_,setMeta:()=>s_,setNode:()=>r_,setNodeSelection:()=>a_,setTextDirection:()=>i_,setTextSelection:()=>o_,sinkListItem:()=>l_,splitBlock:()=>c_,splitListItem:()=>d_,toggleList:()=>u_,toggleMark:()=>h_,toggleNode:()=>f_,toggleWrap:()=>p_,undoInputRule:()=>m_,unsetAllMarks:()=>g_,unsetMark:()=>x_,unsetTextDirection:()=>y_,updateAttributes:()=>b_,wrapIn:()=>v_,wrapInList:()=>N_});var qO=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),GO=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),JO=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:a}=r;return n&&a.forEach(({$from:i,$to:o})=>{t.doc.nodesBetween(i.pos,o.pos,(c,u)=>{if(c.type.isText)return;const{doc:h,mapping:f}=e,m=h.resolve(f.map(u)),g=h.resolve(f.map(u+c.nodeSize)),b=m.blockRange(g);if(!b)return;const N=yd(b);if(c.type.isTextblock){const{defaultType:j}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(b.start,j)}(N||N===0)&&e.lift(b,N)})}),!0},QO=t=>e=>t(e),YO=()=>({state:t,dispatch:e})=>RS(t,e),XO=(t,e)=>({editor:n,tr:r})=>{const{state:a}=n,i=a.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new ot(r.doc.resolve(Math.max(o-1,0)))),!0},ZO=()=>({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 Gn(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 eD=t=>({tr:e,state:n,dispatch:r})=>{const a=Gn(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},tD=t=>({tr:e,dispatch:n})=>{const{from:r,to:a}=t;return n&&e.delete(r,a),!0},nD=()=>({state:t,dispatch:e})=>by(t,e),sD=()=>({commands:t})=>t.keyboardShortcut("Enter"),rD=()=>({state:t,dispatch:e})=>B6(t,e);function Oy(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Yf(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(a=>n.strict?e[a]===t[a]:Oy(e[a])?e[a].test(t[a]):e[a]===t[a]):!0}function bC(t,e,n={}){return t.find(r=>r.type===e&&Yf(Object.fromEntries(Object.keys(n).map(a=>[a,r.attrs[a]])),n))}function uw(t,e,n={}){return!!bC(t,e,n)}function Dy(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),!bC([...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&&uw([...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=Bi(t,r.schema),{doc:o,selection:c}=n,{$from:u,from:h,to:f}=c;if(a){const m=Dy(u,i,e);if(m&&m.from<=h&&m.to>=f){const g=ot.create(o,m.from,m.to);n.setSelection(g)}}return!0},iD=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=()=>{(Xf()||hw())&&r.dom.focus(),oD()&&!Xf()&&!hw()&&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&&!vC(n.state.selection))return o(),!0;const c=NC(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},cD=(t,e)=>n=>t.every((r,a)=>e(r,{...n,index:a})),dD=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),wC=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&&wC(r)}return t};function of(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 wC(n)}function $u(t,e,n){if(t instanceof Oi||t instanceof Ce)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,a=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return Ce.fromArray(t.map(c=>e.nodeFromJSON(c)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),$u("",e,n)}if(a){if(n.errorOnInvalidContent){let o=!1,c="";const u=new iS({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?Lo.fromSchema(u).parseSlice(of(t),n.parseOptions):Lo.fromSchema(u).parse(of(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const i=Lo.fromSchema(e);return n.slice?i.parseSlice(of(t),n.parseOptions).content:i.parse(of(t),n.parseOptions)}return $u("",e,n)}function uD(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 hD=t=>!("type"in t),fD=(t,e,n)=>({tr:r,dispatch:a,editor:i})=>{var o;if(a){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const u=v=>{i.emit("contentError",{editor:i,error:v,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},h={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{$u(e,i.schema,{parseOptions:h,errorOnInvalidContent:!0})}catch(v){u(v)}try{c=$u(e,i.schema,{parseOptions:h,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(v){return u(v),!1}let{from:f,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,b=!0;if((hD(c)?c:[c]).forEach(v=>{v.check(),g=g?v.isText&&v.marks.length===0:!1,b=b?v.isBlock:!1}),f===m&&b){const{parent:v}=r.doc.resolve(f);v.isTextblock&&!v.type.spec.code&&!v.childCount&&(f-=1,m+=1)}let j;if(g){if(Array.isArray(e))j=e.map(v=>v.text||"").join("");else if(e instanceof Ce){let v="";e.forEach(k=>{k.text&&(v+=k.text)}),j=v}else typeof e=="object"&&e&&e.text?j=e.text:j=e;r.insertText(j,f,m)}else{j=c;const v=r.doc.resolve(f),k=v.node(),T=v.parentOffset===0,C=k.isText||k.isTextblock,R=k.content.size>0;T&&C&&R&&(f=Math.max(0,f-1)),r.replaceWith(f,m,j)}n.updateSelection&&uD(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:f,text:j}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:f,text:j})}return!0},pD=()=>({state:t,dispatch:e})=>$6(t,e),mD=()=>({state:t,dispatch:e})=>z6(t,e),gD=()=>({state:t,dispatch:e})=>CS(t,e),xD=()=>({state:t,dispatch:e})=>AS(t,e),yD=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Wp(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},bD=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Wp(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},vD=()=>({state:t,dispatch:e})=>D6(t,e),ND=()=>({state:t,dispatch:e})=>_6(t,e);function jC(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function wD(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=wD(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 Vo(t,e,n={}){const{from:r,to:a,empty:i}=t.selection,o=e?Gn(e,t.schema):null,c=[];t.doc.nodesBetween(r,a,(m,g)=>{if(m.isText)return;const b=Math.max(r,g),N=Math.min(a,g+m.nodeSize);c.push({node:m,from:b,to:N})});const u=a-r,h=c.filter(m=>o?o.name===m.node.type.name:!0).filter(m=>Yf(m.node.attrs,n,{strict:!1}));return i?!!h.length:h.reduce((m,g)=>m+g.to-g.from,0)>=u}var kD=(t,e={})=>({state:n,dispatch:r})=>{const a=Gn(t,n.schema);return Vo(n,a,e)?F6(n,r):!1},SD=()=>({state:t,dispatch:e})=>LS(t,e),CD=t=>({state:e,dispatch:n})=>{const r=Gn(t,e.schema);return X6(r)(e,n)},ED=()=>({state:t,dispatch:e})=>PS(t,e);function Zp(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function fw(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 TD=(t,e)=>({tr:n,state:r,dispatch:a})=>{let i=null,o=null;const c=Zp(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(i=Gn(t,r.schema)),c==="mark"&&(o=Bi(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,fw(f.attrs,e))),o&&f.marks.length&&f.marks.forEach(g=>{o===g.type&&(u=!0,a&&n.addMark(m,m+f.nodeSize,o.create(fw(g.attrs,e))))})})}),u},MD=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),AD=()=>({tr:t,dispatch:e})=>{if(e){const n=new Er(t.doc);t.setSelection(n)}return!0},ID=()=>({state:t,dispatch:e})=>TS(t,e),PD=()=>({state:t,dispatch:e})=>IS(t,e),RD=()=>({state:t,dispatch:e})=>U6(t,e),LD=()=>({state:t,dispatch:e})=>q6(t,e),OD=()=>({state:t,dispatch:e})=>K6(t,e);function g0(t,e,n={},r={}){return $u(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var DD=(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=g0(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 kC(t,e){const n=Bi(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 SC(t,e){const n=new xy(t);return e.forEach(r=>{r.steps.forEach(a=>{n.step(a)})}),n}function _D(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 em(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 _y(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=st(e,"addExtensions",n);return r?[e,..._y(r())]:e}).flat(10)}function $y(t,e){const n=ec.fromSchema(e).serializeFragment(t),a=document.implementation.createHTMLDocument().createElement("div");return a.appendChild(n),a.innerHTML}function EC(t){return typeof t=="function"}function qt(t,e=void 0,...n){return EC(t)?e?t.bind(e)(...n):t(...n):t}function zD(t={}){return Object.keys(t).length===0&&t.constructor===Object}function ld(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 TC(t){const e=[],{nodeExtensions:n,markExtensions:r}=ld(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 N;Array.isArray(b.types)?N=b.types:b.types==="*"?N=u:b.types==="nodes"?N=o:b.types==="marks"?N=c:N=[],N.forEach(j=>{Object.entries(b.attributes).forEach(([v,k])=>{e.push({type:j,name:v,attribute:{...i,...k}})})})})}),a.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage},m=st(h,"addAttributes",f);if(!m)return;const g=m();Object.entries(g).forEach(([b,N])=>{const j={...i,...N};typeof(j==null?void 0:j.default)=="function"&&(j.default=j.default()),j!=null&&j.isRequired&&(j==null?void 0:j.default)===void 0&&delete j.default,e.push({type:h.name,name:b,attribute:j})})}),e}function FD(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 pw(t){const e=[],n=FD(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([...pw(r[a]),...pw(i)]);r[a]=Array.from(c.entries()).map(([u,h])=>`${u}: ${h}`).join("; ")}else r[a]=i}),r},{})}function zu(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)=>Jt(n,r),{})}function BD(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function mw(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):BD(n.getAttribute(o.name));return c==null?i:{...i,[o.name]:c}},{});return{...r,...a}}}}function gw(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&zD(n)?!1:n!=null))}function xw(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 VD(t,e){var n;const r=TC(t),{nodeExtensions:a,markExtensions:i}=ld(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},g=t.reduce((k,T)=>{const C=st(T,"extendNodeSchema",m);return{...k,...C?C(h):{}}},{}),b=gw({...g,content:qt(st(h,"content",m)),marks:qt(st(h,"marks",m)),group:qt(st(h,"group",m)),inline:qt(st(h,"inline",m)),atom:qt(st(h,"atom",m)),selectable:qt(st(h,"selectable",m)),draggable:qt(st(h,"draggable",m)),code:qt(st(h,"code",m)),whitespace:qt(st(h,"whitespace",m)),linebreakReplacement:qt(st(h,"linebreakReplacement",m)),defining:qt(st(h,"defining",m)),isolating:qt(st(h,"isolating",m)),attrs:Object.fromEntries(f.map(xw))}),N=qt(st(h,"parseHTML",m));N&&(b.parseDOM=N.map(k=>mw(k,f)));const j=st(h,"renderHTML",m);j&&(b.toDOM=k=>j({node:k,HTMLAttributes:zu(k,f)}));const v=st(h,"renderText",m);return v&&(b.toText=v),[h.name,b]})),u=Object.fromEntries(i.map(h=>{const f=r.filter(v=>v.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},g=t.reduce((v,k)=>{const T=st(k,"extendMarkSchema",m);return{...v,...T?T(h):{}}},{}),b=gw({...g,inclusive:qt(st(h,"inclusive",m)),excludes:qt(st(h,"excludes",m)),group:qt(st(h,"group",m)),spanning:qt(st(h,"spanning",m)),code:qt(st(h,"code",m)),attrs:Object.fromEntries(f.map(xw))}),N=qt(st(h,"parseHTML",m));N&&(b.parseDOM=N.map(v=>mw(v,f)));const j=st(h,"renderHTML",m);return j&&(b.toDOM=v=>j({mark:v,HTMLAttributes:zu(v,f)})),[h.name,b]}));return new iS({topNode:o,nodes:c,marks:u})}function HD(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Nu(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 AC(t,e,n){const{from:r,to:a}=e,{blockSeparator:i=` + +`,textSerializers:o={}}=n||{};let c="";return t.nodesBetween(r,a,(u,h,f,m)=>{var g;u.isBlock&&h>r&&(c+=i);const b=o==null?void 0:o[u.type.name];if(b)return f&&(c+=b({node:u,pos:h,parent:f,index:m,range:e})),!1;u.isText&&(c+=(g=u==null?void 0:u.text)==null?void 0:g.slice(Math.max(r,h)-h,a-h))}),c}function UD(t,e){const n={from:0,to:t.content.size};return AC(t,n,e)}function IC(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function WD(t,e){const n=Gn(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=Zp(typeof e=="string"?e:e.name,t.schema);return n==="node"?WD(t,e):n==="mark"?kC(t,e):{}}function KD(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 qD(t){const e=KD(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 RC(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((a,i)=>{const o=[];if(a.ranges.length)a.forEach((c,u)=>{o.push({from:c,to:u})});else{const{from:c,to:u}=n[i];if(c===void 0||u===void 0)return;o.push({from:c,to:u})}o.forEach(({from:c,to:u})=>{const h=e.slice(i).map(c,-1),f=e.slice(i).map(u),m=e.invert().map(h,-1),g=e.invert().map(f);r.push({oldRange:{from:m,to:g},newRange:{from:h,to:f}})})}),qD(r)}function zy(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(a=>{const i=n.resolve(t),o=Dy(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 GD=(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 au(t,e){return e.nodes[t]||e.marks[t]||null}function Sf(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 JD=(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 x0(t,e,n={}){const{empty:r,ranges:a}=t.selection,i=e?Bi(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>i?i.name===m.type.name:!0).find(m=>Yf(m.attrs,n,{strict:!1}));let o=0;const c=[];if(a.forEach(({$from:m,$to:g})=>{const b=m.pos,N=g.pos;t.doc.nodesBetween(b,N,(j,v)=>{if(i&&j.inlineContent&&!j.type.allowsMarkType(i))return!1;if(!j.isText&&!j.marks.length)return;const k=Math.max(b,v),T=Math.min(N,v+j.nodeSize),C=T-k;o+=C,c.push(...j.marks.map(R=>({mark:R,from:k,to:T})))})}),o===0)return!1;const u=c.filter(m=>i?i.name===m.mark.type.name:!0).filter(m=>Yf(m.mark.attrs,n,{strict:!1})).reduce((m,g)=>m+g.to-g.from,0),h=c.filter(m=>i?m.mark.type!==i&&m.mark.type.excludes(i):!0).reduce((m,g)=>m+g.to-g.from,0);return(u>0?u+h:u)>=o}function QD(t,e,n={}){if(!e)return Vo(t,null,n)||x0(t,null,n);const r=Zp(e,t.schema);return r==="node"?Vo(t,e,n):r==="mark"?x0(t,e,n):!1}var YD=(t,e)=>{const{$from:n,$to:r,$anchor:a}=t.selection;if(e){const i=em(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 yw(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function bw(t,e){const{nodeExtensions:n}=ld(e),r=n.find(o=>o.name===t);if(!r)return!1;const a={name:r.name,options:r.options,storage:r.storage},i=qt(st(r,"group",a));return typeof i!="string"?!1:i.split(" ").includes("list")}function tm(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&&(tm(i,{ignoreWhitespace:n,checkChildren:e})||(a=!1))}),a}return!1}function LC(t){return t instanceof it}var OC=class DC{constructor(e){this.position=e}static fromJSON(e){return new DC(e.position)}toJSON(){return{position:this.position}}};function ZD(t,e){const n=e.mapping.mapResult(t.position);return{position:new OC(n.pos),mapResult:n}}function e_(t){return new OC(t)}function t_(t,e,n){var r;const{selection:a}=e;let i=null;if(vC(a)&&(i=a.$cursor),i){const c=(r=t.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(c)||!c.some(h=>h.type.excludes(n)))}const{ranges:o}=a;return o.some(({$from:c,$to:u})=>{let h=c.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(c.pos,u.pos,(f,m,g)=>{if(h)return!1;if(f.isInline){const b=!g||g.type.allowsMarkType(n),N=!!n.isInSet(f.marks)||!f.marks.some(j=>j.type.excludes(n));h=b&&N}return!h}),h})}var n_=(t,e={})=>({tr:n,state:r,dispatch:a})=>{const{selection:i}=n,{empty:o,ranges:c}=i,u=Bi(t,r.schema);if(a)if(o){const h=kC(r,u);n.addStoredMark(u.create({...h,...e}))}else c.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;r.doc.nodesBetween(f,m,(g,b)=>{const N=Math.max(b,f),j=Math.min(b+g.nodeSize,m);g.marks.find(k=>k.type===u)?g.marks.forEach(k=>{u===k.type&&n.addMark(N,j,u.create({...k.attrs,...e}))}):n.addMark(N,j,u.create(e))})});return t_(r,n,u)},s_=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),r_=(t,e={})=>({state:n,dispatch:r,chain:a})=>{const i=Gn(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})=>IN(i,{...o,...e})(n)?!0:c.clearNodes()).command(({state:c})=>IN(i,{...o,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},a_=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,a=Ml(t,0,r.content.size),i=it.create(r,a);e.setSelection(i)}return!0},i_=(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},o_=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:a,to:i}=typeof t=="number"?{from:t,to:t}:t,o=ot.atStart(r).from,c=ot.atEnd(r).to,u=Ml(a,o,c),h=Ml(i,o,c),f=ot.create(r,u,h);e.setSelection(f)}return!0},l_=t=>({state:e,dispatch:n})=>{const r=Gn(t,e.schema);return tL(r)(e,n)};function vw(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 c_=({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=Sf(h,c.node().type.name,c.node().attrs);if(i instanceof it&&i.node.isBlock)return!c.parentOffset||!Di(o,c.pos)?!1:(r&&(t&&vw(n,a.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const m=u.parentOffset===u.parent.content.size,g=c.depth===0?void 0:_D(c.node(-1).contentMatchAt(c.indexAfter(-1)));let b=m&&g?[{type:g,attrs:f}]:void 0,N=Di(e.doc,e.mapping.map(c.pos),1,b);if(!b&&!N&&Di(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(N=!0,b=g?[{type:g,attrs:f}]:void 0),r){if(N&&(i instanceof ot&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,b),g&&!m&&!c.parentOffset&&c.parent.type!==g)){const j=e.mapping.map(c.before()),v=e.doc.resolve(j);c.node(-1).canReplaceWith(v.index(),v.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}t&&vw(n,a.extensionManager.splittableMarks),e.scrollIntoView()}return N},d_=(t,e={})=>({tr:n,state:r,dispatch:a,editor:i})=>{var o;const c=Gn(t,r.schema),{$from:u,$to:h}=r.selection,f=r.selection.node;if(f&&f.isBlock||u.depth<2||!u.sameParent(h))return!1;const m=u.node(-1);if(m.type!==c)return!1;const g=i.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==c||u.index(-2)!==u.node(-2).childCount-1)return!1;if(a){let k=Ce.empty;const T=u.index(-1)?1:u.index(-2)?2:3;for(let z=u.depth-T;z>=u.depth-3;z-=1)k=Ce.from(u.node(z).copy(k));const C=u.indexAfter(-1){if(P>-1)return!1;z.isTextblock&&z.content.size===0&&(P=L+1)}),P>-1&&n.setSelection(ot.near(n.doc.resolve(P))),n.scrollIntoView()}return!0}const b=h.pos===u.end()?m.contentMatchAt(0).defaultType:null,N={...Sf(g,m.type.name,m.attrs),...e},j={...Sf(g,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,h.pos);const v=b?[{type:c,attrs:N},{type:b,attrs:j}]:[{type:c,attrs:N}];if(!Di(n.doc,u.pos,2))return!1;if(a){const{selection:k,storedMarks:T}=r,{splittableMarks:C}=i.extensionManager,R=T||k.$to.parentOffset&&k.$from.marks();if(n.split(u.pos,2,v).scrollIntoView(),!R||!a)return!0;const O=R.filter(U=>C.includes(U.type.name));n.ensureMarks(O)}return!0},fx=(t,e)=>{const n=em(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)&&Jo(t.doc,n.pos)&&t.join(n.pos),!0},px=(t,e)=>{const n=em(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)&&Jo(t.doc,r)&&t.join(r),!0},u_=(t,e,n,r={})=>({editor:a,tr:i,state:o,dispatch:c,chain:u,commands:h,can:f})=>{const{extensions:m,splittableMarks:g}=a.extensionManager,b=Gn(t,o.schema),N=Gn(e,o.schema),{selection:j,storedMarks:v}=o,{$from:k,$to:T}=j,C=k.blockRange(T),R=v||j.$to.parentOffset&&j.$from.marks();if(!C)return!1;const O=em(U=>bw(U.type.name,m))(j);if(C.depth>=1&&O&&C.depth-O.depth<=1){if(O.node.type===b)return h.liftListItem(N);if(bw(O.node.type.name,m)&&b.validContent(O.node.content)&&c)return u().command(()=>(i.setNodeMarkup(O.pos,b),!0)).command(()=>fx(i,b)).command(()=>px(i,b)).run()}return!n||!R||!c?u().command(()=>f().wrapInList(b,r)?!0:h.clearNodes()).wrapInList(b,r).command(()=>fx(i,b)).command(()=>px(i,b)).run():u().command(()=>{const U=f().wrapInList(b,r),P=R.filter(z=>g.includes(z.type.name));return i.ensureMarks(P),U?!0:h.clearNodes()}).wrapInList(b,r).command(()=>fx(i,b)).command(()=>px(i,b)).run()},h_=(t,e={},n={})=>({state:r,commands:a})=>{const{extendEmptyMarkRange:i=!1}=n,o=Bi(t,r.schema);return x0(r,o,e)?a.unsetMark(o,{extendEmptyMarkRange:i}):a.setMark(o,e)},f_=(t,e,n={})=>({state:r,commands:a})=>{const i=Gn(t,r.schema),o=Gn(e,r.schema),c=Vo(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})},p_=(t,e={})=>({state:n,commands:r})=>{const a=Gn(t,n.schema);return Vo(n,a,e)?r.lift(a):r.wrapIn(a,e)},m_=()=>({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},g_=()=>({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},x_=(t,e={})=>({tr:n,state:r,dispatch:a})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:c}=n,u=Bi(t,r.schema),{$from:h,empty:f,ranges:m}=c;if(!a)return!0;if(f&&o){let{from:g,to:b}=c;const N=(i=h.marks().find(v=>v.type===u))==null?void 0:i.attrs,j=Dy(h,u,N);j&&(g=j.from,b=j.to),n.removeMark(g,b,u)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,u)});return n.removeStoredMark(u),!0},y_=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},b_=(t,e={})=>({tr:n,state:r,dispatch:a})=>{let i=null,o=null;const c=Zp(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(i=Gn(t,r.schema)),c==="mark"&&(o=Bi(t,r.schema));let u=!1;return n.selection.ranges.forEach(h=>{const f=h.$from.pos,m=h.$to.pos;let g,b,N,j;n.selection.empty?r.doc.nodesBetween(f,m,(v,k)=>{i&&i===v.type&&(u=!0,N=Math.max(k,f),j=Math.min(k+v.nodeSize,m),g=k,b=v)}):r.doc.nodesBetween(f,m,(v,k)=>{k=f&&k<=m&&(i&&i===v.type&&(u=!0,a&&n.setNodeMarkup(k,void 0,{...v.attrs,...e})),o&&v.marks.length&&v.marks.forEach(T=>{if(o===T.type&&(u=!0,a)){const C=Math.max(k,f),R=Math.min(k+v.nodeSize,m);n.addMark(C,R,o.create({...T.attrs,...e}))}}))}),b&&(g!==void 0&&a&&n.setNodeMarkup(g,void 0,{...b.attrs,...e}),o&&b.marks.length&&b.marks.forEach(v=>{o===v.type&&a&&n.addMark(N,j,o.create({...v.attrs,...e}))}))}),u},v_=(t,e={})=>({state:n,dispatch:r})=>{const a=Gn(t,n.schema);return G6(a,e)(n,r)},N_=(t,e={})=>({state:n,dispatch:r})=>{const a=Gn(t,n.schema);return J6(a,e)(n,r)},w_=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={}}},nm=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},j_=(t,e)=>{if(Oy(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 lf(t){var e;const{editor:n,from:r,to:a,text:i,rules:o,plugin:c}=t,{view:u}=n;if(u.composing)return!1;const h=u.state.doc.resolve(r);if(h.parent.type.spec.code||(e=h.nodeBefore||h.nodeAfter)!=null&&e.marks.find(g=>g.type.spec.code))return!1;let f=!1;const m=JD(h)+i;return o.forEach(g=>{if(f)return;const b=j_(m,g.find);if(!b)return;const N=u.state.tr,j=Yp({state:u.state,transaction:N}),v={from:r-(b[0].length-i.length),to:a},{commands:k,chain:T,can:C}=new Xp({editor:n,state:j});g.handler({state:j,range:v,match:b,commands:k,chain:T,can:C})===null||!N.steps.length||(g.undoable&&N.setMeta(c,{transform:N,from:r,to:a,text:i}),u.dispatch(N),f=!0)}),f}function k_(t){const{editor:e,rules:n}=t,r=new hn({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=$y(Ce.from(f),o.schema);const{from:m}=u,g=m+f.length;lf({editor:e,from:m,to:g,text:f,rules:n,plugin:r})}),a.selectionSet||a.docChanged?null:i}},props:{handleTextInput(a,i,o,c){return lf({editor:e,from:i,to:o,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:a=>(setTimeout(()=>{const{$cursor:i}=a.state.selection;i&&lf({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?lf({editor:e,from:o.pos,to:o.pos,text:` +`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function S_(t){return Object.prototype.toString.call(t).slice(8,-1)}function cf(t){return S_(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function _C(t,e){const n={...t};return cf(t)&&cf(e)&&Object.keys(e).forEach(r=>{cf(e[r])&&cf(t[r])?n[r]=_C(t[r],e[r]):n[r]=e[r]}),n}var Fy=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{...qt(st(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...qt(st(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>_C(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}},tc=class $C extends Fy{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new $C(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,a=e.state.selection.$from;if(a.pos===a.end()){const o=a.marks();if(!!!o.find(h=>(h==null?void 0:h.type.name)===n.name))return!1;const u=o.find(h=>(h==null?void 0:h.type.name)===n.name);return u&&r.removeStoredMark(u),r.insertText(" ",a.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function C_(t){return typeof t=="number"}var E_=class{constructor(t){this.find=t.find,this.handler=t.handler}},T_=(t,e,n)=>{if(Oy(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 M_(t){const{editor:e,state:n,from:r,to:a,rule:i,pasteEvent:o,dropEvent:c}=t,{commands:u,chain:h,can:f}=new Xp({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,a,(b,N)=>{var j,v,k,T,C;if((v=(j=b.type)==null?void 0:j.spec)!=null&&v.code||!(b.isText||b.isTextblock||b.isInline))return;const R=(C=(T=(k=b.content)==null?void 0:k.size)!=null?T:b.nodeSize)!=null?C:0,O=Math.max(r,N),U=Math.min(a,N+R);if(O>=U)return;const P=b.isText?b.text||"":b.textBetween(O-N,U-N,void 0,"");T_(P,i.find,o).forEach(L=>{if(L.index===void 0)return;const Q=O+L.index+1,se=Q+L[0].length,$={from:n.tr.mapping.map(Q),to:n.tr.mapping.map(se)},ie=i.handler({state:n,range:$,match:L,commands:u,chain:h,can:f,pasteEvent:o,dropEvent:c});m.push(ie)})}),m.every(b=>b!==null)}var df=null,A_=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function I_(t){const{editor:e,rules:n}=t;let r=null,a=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const u=({state:f,from:m,to:g,rule:b,pasteEvt:N})=>{const j=f.tr,v=Yp({state:f,transaction:j});if(!(!M_({editor:e,state:v,from:Math.max(m-1,0),to:g.b-1,rule:b,pasteEvent:N,dropEvent:c})||!j.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,j}};return n.map(f=>new hn({view(m){const g=N=>{var j;r=(j=m.dom.parentElement)!=null&&j.contains(N.target)?m.dom.parentElement:null,r&&(df=e)},b=()=>{df&&(df=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",b),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",b)}}},props:{handleDOMEvents:{drop:(m,g)=>{if(i=r===m.dom.parentElement,c=g,!i){const b=df;b!=null&&b.isEditable&&setTimeout(()=>{const N=b.state.selection;N&&b.commands.deleteRange({from:N.from,to:N.to})},10)}return!1},paste:(m,g)=>{var b;const N=(b=g.clipboardData)==null?void 0:b.getData("text/html");return o=g,a=!!(N!=null&&N.includes("data-pm-slice")),!1}}},appendTransaction:(m,g,b)=>{const N=m[0],j=N.getMeta("uiEvent")==="paste"&&!a,v=N.getMeta("uiEvent")==="drop"&&!i,k=N.getMeta("applyPasteRules"),T=!!k;if(!j&&!v&&!T)return;if(T){let{text:O}=k;typeof O=="string"?O=O:O=$y(Ce.from(O),b.schema);const{from:U}=k,P=U+O.length,z=A_(O);return u({rule:f,state:b,from:U,to:{b:P},pasteEvt:z})}const C=g.doc.content.findDiffStart(b.doc.content),R=g.doc.content.findDiffEnd(b.doc.content);if(!(!C_(C)||!R||C===R.b))return u({rule:f,state:b,from:C,to:R,pasteEvt:o})}}))}var sm=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=MC(t),this.schema=VD(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:au(e.name,this.schema)},r=st(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return Nu([...this.extensions].reverse()).flatMap(r=>{const a={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:au(r.name,this.schema)},i=[],o=st(r,"addKeyboardShortcuts",a);let c={};if(r.type==="mark"&&st(r,"exitable",a)&&(c.ArrowRight=()=>tc.handleExit({editor:t,mark:r})),o){const g=Object.fromEntries(Object.entries(o()).map(([b,N])=>[b,()=>N({editor:t})]));c={...c,...g}}const u=WO(c);i.push(u);const h=st(r,"addInputRules",a);if(yw(r,t.options.enableInputRules)&&h){const g=h();if(g&&g.length){const b=k_({editor:t,rules:g}),N=Array.isArray(b)?b:[b];i.push(...N)}}const f=st(r,"addPasteRules",a);if(yw(r,t.options.enablePasteRules)&&f){const g=f();if(g&&g.length){const b=I_({editor:t,rules:g});i.push(...b)}}const m=st(r,"addProseMirrorPlugins",a);if(m){const g=m();i.push(...g)}return i})}get attributes(){return TC(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=ld(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:Gn(n.name,this.schema)},i=st(n,"addNodeView",a);if(!i)return[];const o=i();if(!o)return[];const c=(u,h,f,m,g)=>{const b=zu(u,r);return o({node:u,view:h,getPos:f,decorations:m,innerDecorations:g,editor:t,extension:n,HTMLAttributes:b})};return[n.name,c]}))}dispatchTransaction(t){const{editor:e}=this;return Nu([...this.extensions].reverse()).reduceRight((r,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:au(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 Nu([...this.extensions]).reduce((r,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:au(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}=ld(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:Bi(n.name,this.schema)},i=st(n,"addMarkView",a);if(!i)return[];const o=(c,u,h)=>{const f=zu(c,r);return i()({mark:c,view:u,inline:h,editor:t,extension:n,HTMLAttributes:f,updateAttributes:m=>{K_(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:au(e.name,this.schema)};e.type==="mark"&&((n=qt(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)})}};sm.resolve=MC;sm.sort=Nu;sm.flatten=_y;var P_={};Ly(P_,{ClipboardTextSerializer:()=>FC,Commands:()=>BC,Delete:()=>VC,Drop:()=>HC,Editable:()=>UC,FocusEvents:()=>KC,Keymap:()=>qC,Paste:()=>GC,Tabindex:()=>JC,TextDirection:()=>QC,focusEventsPluginKey:()=>WC});var On=class zC extends Fy{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new zC(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},FC=On.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new hn({key:new wn("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=IC(n);return AC(r,{from:o,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),BC=On.create({name:"commands",addCommands(){return{...yC}}}),VC=On.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=SC(t.before,[t,...e]);RC(f).forEach(b=>{f.mapping.mapResult(b.oldRange.from).deletedAfter&&f.mapping.mapResult(b.oldRange.to).deletedBefore&&f.before.nodesBetween(b.oldRange.from,b.oldRange.to,(N,j)=>{const v=j+N.nodeSize-2,k=b.oldRange.from<=j&&v<=b.oldRange.to;this.editor.emit("delete",{type:"node",node:N,from:j,to:v,newFrom:f.mapping.map(j),newTo:f.mapping.map(v),deletedRange:b.oldRange,newRange:b.newRange,partial:!k,editor:this.editor,transaction:t,combinedTransform:f})})});const g=f.mapping;f.steps.forEach((b,N)=>{var j,v;if(b instanceof ga){const k=g.slice(N).map(b.from,-1),T=g.slice(N).map(b.to),C=g.invert().map(k,-1),R=g.invert().map(T),O=(j=f.doc.nodeAt(k-1))==null?void 0:j.marks.some(P=>P.eq(b.mark)),U=(v=f.doc.nodeAt(T))==null?void 0:v.marks.some(P=>P.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:T},partial:!!(U||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()}}),HC=On.create({name:"drop",addProseMirrorPlugins(){return[new hn({key:new wn("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),UC=On.create({name:"editable",addProseMirrorPlugins(){return[new hn({key:new wn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),WC=new wn("focusEvents"),KC=On.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new hn({key:WC,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}}}})]}}),qC=On.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:c})=>{const{selection:u,doc:h}=c,{empty:f,$anchor:m}=u,{pos:g,parent:b}=m,N=m.parent.isTextblock&&g>0?c.doc.resolve(g-1):m,j=N.parent.type.spec.isolating,v=m.pos-m.parentOffset,k=j&&N.parent.childCount===1?v===m.pos:ft.atStart(h).from===g;return!f||!b.type.isTextblock||b.textContent.length||!k||k&&m.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},a={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Xf()||jC()?i:a},addProseMirrorPlugins(){return[new hn({key:new wn("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(j=>j.getMeta("composition")))return;const r=t.some(j=>j.docChanged)&&!e.doc.eq(n.doc),a=t.some(j=>j.getMeta("preventClearDocument"));if(!r||a)return;const{empty:i,from:o,to:c}=e.selection,u=ft.atStart(e.doc).from,h=ft.atEnd(e.doc).to;if(i||!(o===u&&c===h)||!tm(n.doc))return;const g=n.tr,b=Yp({state:n,transaction:g}),{commands:N}=new Xp({editor:this.editor,state:b});if(N.clearNodes(),!!g.steps.length)return g}})]}}),GC=On.create({name:"paste",addProseMirrorPlugins(){return[new hn({key:new wn("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),JC=On.create({name:"tabindex",addProseMirrorPlugins(){return[new hn({key:new wn("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),QC=On.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=ld(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 hn({key:new wn("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),R_=class uu{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 uu(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 uu(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 uu(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 uu(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)}},L_=`.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 O_(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 D_=class extends w_{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:ZD,createMappablePosition:e_},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=NC(e,this.options.autofocus);this.editorState=Jc.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=O_(L_,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=EC(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?[UC,FC.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),BC,KC,qC,JC,HC,GC,VC,QC.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 sm(r,this)}createCommandManager(){this.commandManager=new Xp({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=g0(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=g0(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 xC(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 QD(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return $y(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=` + +`,textSerializers:n={}}=t||{};return UD(this.state.doc,{blockSeparator:e,textSerializers:{...IC(this.schema),...n}})}get isEmpty(){return tm(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 R_(e,this)}get $doc(){return this.$pos(0)}};function cd(t){return new nm({find:t.find,handler:({state:e,range:n,match:r})=>{const a=qt(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(zy(n.from,n.to,e.doc).filter(b=>b.mark.type.excluded.find(j=>j===t.type&&j!==b.mark.type)).filter(b=>b.to>h).length)return null;fn.from&&i.delete(n.from+u,h);const g=n.from+u+o.length;i.addMark(n.from+u,g,t.type.create(a||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function YC(t){return new nm({find:t.find,handler:({state:e,range:n,match:r})=>{const a=qt(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 y0(t){return new nm({find:t.find,handler:({state:e,range:n,match:r})=>{const a=e.doc.resolve(n.from),i=qt(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 dd(t){return new nm({find:t.find,handler:({state:e,range:n,match:r,chain:a})=>{const i=qt(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),u=o.doc.resolve(n.from).blockRange(),h=u&&gy(u,t.type,i);if(!h)return null;if(o.wrap(u,h),t.keepMarks&&t.editor){const{selection:m,storedMarks:g}=e,{splittableMarks:b}=t.editor.extensionManager,N=g||m.$to.parentOffset&&m.$from.marks();if(N){const j=N.filter(v=>b.includes(v.type.name));o.ensureMarks(j)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";a().updateAttributes(m,i).run()}const f=o.doc.resolve(n.from-1).nodeBefore;f&&f.type===t.type&&Jo(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,f))&&o.join(n.from-1)},undoable:t.undoable})}var __=t=>"touches"in t,$_=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,__(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 z_(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof it){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let a=r.depth;for(;a>=0;){const i=r.index(a);if(r.node(a).contentMatchAt(i).matchType(e))return!0;a-=1}return!1}function F_(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var B_={};Ly(B_,{createAtomBlockMarkdownSpec:()=>V_,createBlockMarkdownSpec:()=>H_,createInlineMarkdownSpec:()=>XC,parseAttributes:()=>By,parseIndentedBlocks:()=>b0,renderNestedMarkdownContent:()=>Hy,serializeAttributes:()=>Vy});function By(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,h=>(n.push(h),`__QUOTED_${n.length-1}__`)),a=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(a){const h=a.map(f=>f.trim().slice(1));e.class=h.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,h,f])=>{var m;const g=parseInt(((m=f.match(/__QUOTED_(\d+)__/))==null?void 0:m[1])||"0",10),b=n[g];b&&(e[h]=b.slice(1,-1))});const u=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return u&&u.split(/\s+/).filter(Boolean).forEach(f=>{f.match(/^[a-zA-Z][\w-]*$/)&&(e[f]=!0)}),e}function Vy(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 V_(t){const{nodeName:e,name:n,parseAttributes:r=By,serializeAttributes:a=Vy,defaultAttributes:i={},requiredAttributes:o=[],allowedAttributes:c}=t,u=n||e,h=f=>{if(!c)return f;const m={};return c.forEach(g=>{g in f&&(m[g]=f[g])}),m};return{parseMarkdown:(f,m)=>{const g={...i,...f.attributes};return m.createNode(e,g,[])},markdownTokenizer:{name:e,level:"block",start(f){var m;const g=new RegExp(`^:::${u}(?:\\s|$)`,"m"),b=(m=f.match(g))==null?void 0:m.index;return b!==void 0?b:-1},tokenize(f,m,g){const b=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),N=f.match(b);if(!N)return;const j=N[1]||"",v=r(j);if(!o.find(T=>!(T in v)))return{type:e,raw:N[0],attributes:v}}},renderMarkdown:f=>{const m=h(f.attrs||{}),g=a(m),b=g?` {${g}}`:"";return`:::${u}${b} :::`}}}function H_(t){const{nodeName:e,name:n,getContent:r,parseAttributes:a=By,serializeAttributes:i=Vy,defaultAttributes:o={},content:c="block",allowedAttributes:u}=t,h=n||e,f=m=>{if(!u)return m;const g={};return u.forEach(b=>{b in m&&(g[b]=m[b])}),g};return{parseMarkdown:(m,g)=>{let b;if(r){const j=r(m);b=typeof j=="string"?[{type:"text",text:j}]:j}else c==="block"?b=g.parseChildren(m.tokens||[]):b=g.parseInline(m.tokens||[]);const N={...o,...m.attributes};return g.createNode(e,N,b)},markdownTokenizer:{name:e,level:"block",start(m){var g;const b=new RegExp(`^:::${h}`,"m"),N=(g=m.match(b))==null?void 0:g.index;return N!==void 0?N:-1},tokenize(m,g,b){var N;const j=new RegExp(`^:::${h}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),v=m.match(j);if(!v)return;const[k,T=""]=v,C=a(T);let R=1;const O=k.length;let U="";const P=/^:::([\w-]*)(\s.*)?/gm,z=m.slice(O);for(P.lastIndex=0;;){const L=P.exec(z);if(L===null)break;const Q=L.index,se=L[1];if(!((N=L[2])!=null&&N.endsWith(":::"))){if(se)R+=1;else if(R-=1,R===0){const $=z.slice(0,Q);U=$.trim();const ie=m.slice(0,O+Q+L[0].length);let oe=[];if(U)if(c==="block")for(oe=b.blockTokens($),oe.forEach(me=>{me.text&&(!me.tokens||me.tokens.length===0)&&(me.tokens=b.inlineTokens(me.text))});oe.length>0;){const me=oe[oe.length-1];if(me.type==="paragraph"&&(!me.text||me.text.trim()===""))oe.pop();else break}else oe=b.inlineTokens(U);return{type:e,raw:ie,attributes:C,content:U,tokens:oe}}}}}},renderMarkdown:(m,g)=>{const b=f(m.attrs||{}),N=i(b),j=N?` {${N}}`:"",v=g.renderChildren(m.content||[],` + +`);return`:::${h}${j} + +${v} + +:::`}}}function U_(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 W_(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function XC(t){const{nodeName:e,name:n,getContent:r,parseAttributes:a=U_,serializeAttributes:i=W_,defaultAttributes:o={},selfClosing:c=!1,allowedAttributes:u}=t,h=n||e,f=g=>{if(!u)return g;const b={};return u.forEach(N=>{const j=typeof N=="string"?N:N.name,v=typeof N=="string"?void 0:N.skipIfDefault;if(j in g){const k=g[j];if(v!==void 0&&k===v)return;b[j]=k}}),b},m=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(g,b)=>{const N={...o,...g.attributes};if(c)return b.createNode(e,N);const j=r?r(g):g.content||"";return j?b.createNode(e,N,[b.createTextNode(j)]):b.createNode(e,N,[])},markdownTokenizer:{name:e,level:"inline",start(g){const b=c?new RegExp(`\\[${m}\\s*[^\\]]*\\]`):new RegExp(`\\[${m}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${m}\\]`),N=g.match(b),j=N==null?void 0:N.index;return j!==void 0?j:-1},tokenize(g,b,N){const j=c?new RegExp(`^\\[${m}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${m}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${m}\\]`),v=g.match(j);if(!v)return;let k="",T="";if(c){const[,R]=v;T=R}else{const[,R,O]=v;T=R,k=O||""}const C=a(T.trim());return{type:e,raw:v[0],content:k.trim(),attributes:C}}},renderMarkdown:g=>{let b="";r?b=r(g):g.content&&g.content.length>0&&(b=g.content.filter(k=>k.type==="text").map(k=>k.text).join(""));const N=f(g.attrs||{}),j=i(N),v=j?` ${j}`:"";return c?`[${h}${v}]`:`[${h}${v}]${b}[/${h}]`}}}function b0(t,e,n){var r,a,i,o;const c=t.split(` +`),u=[];let h="",f=0;const m=e.baseIndentSize||2;for(;f0)break;if(g.trim()===""){f+=1,h=`${h}${g} +`;continue}else return}const N=e.extractItemData(b),{indentLevel:j,mainContent:v}=N;h=`${h}${g} +`;const k=[v];for(f+=1;fQ.trim()!=="");if(P===-1)break;if((((a=(r=c[f+1+P].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:a.length)||0)>j){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)>j)k.push(O),h=`${h}${O} +`,f+=1;else break}let T;const C=k.slice(1);if(C.length>0){const O=C.map(U=>U.slice(j+m)).join(` +`);O.trim()&&(e.customNestedParser?T=e.customNestedParser(O):T=n.blockTokens(O))}const R=e.createToken(N,T);u.push(R)}if(u.length!==0)return{items:u,raw:h}}function Hy(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const a=typeof n=="function"?n(r):n,[i,...o]=t.content,c=e.renderChildren([i]),u=[`${a}${c}`];return o&&o.length>0&&o.forEach(h=>{const f=e.renderChildren([h]);if(f){const m=f.split(` +`).map(g=>g?e.indent(g):"").join(` +`);u.push(m)}}),u.join(` +`)}function K_(t,e,n={}){const{state:r}=e,{doc:a,tr:i}=r,o=t;a.descendants((c,u)=>{const h=i.mapping.map(u),f=i.mapping.map(u)+c.nodeSize;let m=null;if(c.marks.forEach(b=>{if(b!==o)return!1;m=b}),!m)return;let g=!1;if(Object.keys(n).forEach(b=>{n[b]!==m.attrs[b]&&(g=!0)}),g){const b=t.type.create({...t.attrs,...n});i.removeMark(h,f,t.type),i.addMark(h,f,b)}}),i.docChanged&&e.view.dispatch(i)}var Bn=class ZC extends Fy{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new ZC(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Gl(t){return new E_({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:a})=>{const i=qt(t.getAttributes,void 0,r,a);if(i===!1||i===null)return null;const{tr:o}=e,c=r[r.length-1],u=r[0];let h=n.to;if(c){const f=u.search(/\S/),m=n.from+u.indexOf(c),g=m+c.length;if(zy(n.from,n.to,e.doc).filter(N=>N.mark.type.excluded.find(v=>v===t.type&&v!==N.mark.type)).filter(N=>N.to>m).length)return null;gn.from&&o.delete(n.from+f,m),h=n.from+f+c.length,o.addMark(n.from+f,h,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:q_,getOwnPropertySymbols:G_}=Object,{hasOwnProperty:J_}=Object.prototype;function mx(t,e){return function(r,a,i){return t(r,a,i)&&e(r,a,i)}}function uf(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 Q_(t){return t!=null?t[Symbol.toStringTag]:void 0}function Nw(t){return q_(t).concat(G_(t))}const Y_=Object.hasOwn||((t,e)=>J_.call(t,e));function nc(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const X_="__v",Z_="__o",e7="_owner",{getOwnPropertyDescriptor:ww,keys:jw}=Object;function t7(t,e){return t.byteLength===e.byteLength&&Zf(new Uint8Array(t),new Uint8Array(e))}function n7(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 s7(t,e){return t.byteLength===e.byteLength&&Zf(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function r7(t,e){return nc(t.getTime(),e.getTime())}function a7(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function i7(t,e){return t===e}function kw(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const a=new Array(r),i=t.entries();let o,c,u=0;for(;(o=i.next())&&!o.done;){const h=e.entries();let f=!1,m=0;for(;(c=h.next())&&!c.done;){if(a[m]){m++;continue}const g=o.value,b=c.value;if(n.equals(g[0],b[0],u,m,t,e,n)&&n.equals(g[1],b[1],g[0],b[0],t,e,n)){f=a[m]=!0;break}m++}if(!f)return!1;u++}return!0}const o7=nc;function l7(t,e,n){const r=jw(t);let a=r.length;if(jw(e).length!==a)return!1;for(;a-- >0;)if(!e3(t,e,n,r[a]))return!1;return!0}function iu(t,e,n){const r=Nw(t);let a=r.length;if(Nw(e).length!==a)return!1;let i,o,c;for(;a-- >0;)if(i=r[a],!e3(t,e,n,i)||(o=ww(t,i),c=ww(e,i),(o||c)&&(!o||!c||o.configurable!==c.configurable||o.enumerable!==c.enumerable||o.writable!==c.writable)))return!1;return!0}function c7(t,e){return nc(t.valueOf(),e.valueOf())}function d7(t,e){return t.source===e.source&&t.flags===e.flags}function Sw(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const a=new Array(r),i=t.values();let o,c;for(;(o=i.next())&&!o.done;){const u=e.values();let h=!1,f=0;for(;(c=u.next())&&!c.done;){if(!a[f]&&n.equals(o.value,c.value,o.value,c.value,t,e,n)){h=a[f]=!0;break}f++}if(!h)return!1}return!0}function Zf(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function u7(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 e3(t,e,n,r){return(r===e7||r===Z_||r===X_)&&(t.$$typeof||e.$$typeof)?!0:Y_(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const h7="[object ArrayBuffer]",f7="[object Arguments]",p7="[object Boolean]",m7="[object DataView]",g7="[object Date]",x7="[object Error]",y7="[object Map]",b7="[object Number]",v7="[object Object]",N7="[object RegExp]",w7="[object Set]",j7="[object String]",k7={"[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},S7="[object URL]",C7=Object.prototype.toString;function E7({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:a,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:c,areObjectsEqual:u,arePrimitiveWrappersEqual:h,areRegExpsEqual:f,areSetsEqual:m,areTypedArraysEqual:g,areUrlsEqual:b,unknownTagComparators:N}){return function(v,k,T){if(v===k)return!0;if(v==null||k==null)return!1;const C=typeof v;if(C!==typeof k)return!1;if(C!=="object")return C==="number"?c(v,k,T):C==="function"?i(v,k,T):!1;const R=v.constructor;if(R!==k.constructor)return!1;if(R===Object)return u(v,k,T);if(Array.isArray(v))return e(v,k,T);if(R===Date)return r(v,k,T);if(R===RegExp)return f(v,k,T);if(R===Map)return o(v,k,T);if(R===Set)return m(v,k,T);const O=C7.call(v);if(O===g7)return r(v,k,T);if(O===N7)return f(v,k,T);if(O===y7)return o(v,k,T);if(O===w7)return m(v,k,T);if(O===v7)return typeof v.then!="function"&&typeof k.then!="function"&&u(v,k,T);if(O===S7)return b(v,k,T);if(O===x7)return a(v,k,T);if(O===f7)return u(v,k,T);if(k7[O])return g(v,k,T);if(O===h7)return t(v,k,T);if(O===m7)return n(v,k,T);if(O===p7||O===b7||O===j7)return h(v,k,T);if(N){let U=N[O];if(!U){const P=Q_(v);P&&(U=N[P])}if(U)return U(v,k,T)}return!1}}function T7({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:t7,areArraysEqual:n?iu:n7,areDataViewsEqual:s7,areDatesEqual:r7,areErrorsEqual:a7,areFunctionsEqual:i7,areMapsEqual:n?mx(kw,iu):kw,areNumbersEqual:o7,areObjectsEqual:n?iu:l7,arePrimitiveWrappersEqual:c7,areRegExpsEqual:d7,areSetsEqual:n?mx(Sw,iu):Sw,areTypedArraysEqual:n?mx(Zf,iu):Zf,areUrlsEqual:u7,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const a=uf(r.areArraysEqual),i=uf(r.areMapsEqual),o=uf(r.areObjectsEqual),c=uf(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:a,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:c})}return r}function M7(t){return function(e,n,r,a,i,o,c){return t(e,n,c)}}function A7({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 I7=Yo();Yo({strict:!0});Yo({circular:!0});Yo({circular:!0,strict:!0});Yo({createInternalComparator:()=>nc});Yo({strict:!0,createInternalComparator:()=>nc});Yo({circular:!0,createInternalComparator:()=>nc});Yo({circular:!0,createInternalComparator:()=>nc,strict:!0});function Yo(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:a=!1}=t,i=T7(t),o=E7(i),c=n?n(o):M7(o);return A7({circular:e,comparator:o,createState:r,equals:c,strict:a})}var gx={exports:{}},xx={};/** + * @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 Cw;function P7(){if(Cw)return xx;Cw=1;var t=Uu(),e=H2();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 xx.useSyncExternalStoreWithSelector=function(h,f,m,g,b){var N=i(null);if(N.current===null){var j={hasValue:!1,value:null};N.current=j}else j=N.current;N=c(function(){function k(U){if(!T){if(T=!0,C=U,U=g(U),b!==void 0&&j.hasValue){var P=j.value;if(b(P,U))return R=P}return R=U}if(P=R,r(C,U))return P;var z=g(U);return b!==void 0&&b(P,z)?(C=U,P):(C=U,R=z)}var T=!1,C,R,O=m===void 0?null:m;return[function(){return k(f())},O===null?void 0:function(){return k(O())}]},[f,m,g,b]);var v=a(h,N[0],N[1]);return o(function(){j.hasValue=!0,j.value=v},[v]),u(v),v},xx}var Ew;function R7(){return Ew||(Ew=1,gx.exports=P7()),gx.exports}var L7=R7(),O7=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},D7=({contentComponent:t})=>{const e=U2.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return s.jsx(s.Fragment,{children:Object.values(e)})};function _7(){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]:$j.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 $7=class extends Ks.Component{constructor(t){var e;super(t),this.editorContentRef=Ks.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=_7(),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:O7(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&s.jsx(D7,{contentComponent:t.contentComponent})]})}},z7=y.forwardRef((t,e)=>{const n=Ks.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Ks.createElement($7,{key:n,innerRef:e,...t})}),t3=Ks.memo(z7),F7=typeof window<"u"?y.useLayoutEffect:y.useEffect,B7=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 V7(t){var e;const[n]=y.useState(()=>new B7(t.editor)),r=L7.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:I7);return F7(()=>n.watch(t.editor),[t.editor,n]),y.useDebugValue(r),r}var H7=!1,v0=typeof window>"u",U7=v0||!!(typeof window<"u"&&window.next),W7=class n3{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?v0||U7?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 D_(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?n3.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 K7(t={},e=[]){const n=y.useRef(t);n.current=t;const[r]=y.useState(()=>new W7(n)),a=U2.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return y.useDebugValue(a),y.useEffect(r.onRender(e)),V7({editor:a,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),a}var s3=y.createContext({editor:null});s3.Consumer;var q7=y.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),G7=()=>y.useContext(q7);Ks.forwardRef((t,e)=>{const{onDragStart:n}=G7(),r=t.as||"div";return s.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});Ks.createContext({markViewContentRef:()=>{}});var Uy=y.createContext({get editor(){throw new Error("useTiptap must be used within a provider")}});Uy.displayName="TiptapContext";var J7=()=>y.useContext(Uy);function r3({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(s3.Provider,{value:i,children:s.jsx(Uy.Provider,{value:a,children:n})})}r3.displayName="Tiptap";function a3({...t}){const{editor:e}=J7();return s.jsx(t3,{editor:e,...t})}a3.displayName="Tiptap.Content";Object.assign(r3,{Content:a3});var ep=(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]},Q7=/^\s*>\s$/,Y7=Bn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return ep("blockquote",{...Jt(this.options.HTMLAttributes,t),children:ep("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[dd({find:Q7,type:this.type})]}}),X7=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Z7=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,e$=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,t$=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,n$=tc.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 ep("strong",{...Jt(this.options.HTMLAttributes,t),children:ep("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[cd({find:X7,type:this.type}),cd({find:e$,type:this.type})]},addPasteRules(){return[Gl({find:Z7,type:this.type}),Gl({find:t$,type:this.type})]}}),s$=/(^|[^`])`([^`]+)`(?!`)$/,r$=/(^|[^`])`([^`]+)`(?!`)/g,a$=tc.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Jt(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[cd({find:s$,type:this.type})]},addPasteRules(){return[Gl({find:r$,type:this.type})]}}),yx=4,i$=/^```([a-z]+)?[\s\n]$/,o$=/^~~~([a-z]+)?[\s\n]$/,l$=Bn.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",Jt(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(N=>c+N).join(` +`);return u.replaceWith(h,f,r.schema.text(b)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e: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 N=0,j=0;const v=h-f;for(let U=0;U=v){N=U;break}j+=b[U].length+1}const T=((u=b[N].match(/^ */))==null?void 0:u[0])||"",C=Math.min(T.length,n);if(C===0)return!0;let R=f;for(let U=0;U{const{from:u,to:h}=a,g=r.doc.textBetween(u,h,` +`,` +`).split(` +`).map(b=>{var N;const j=((N=b.match(/^ */))==null?void 0:N[0])||"",v=Math.min(j.length,n);return b.slice(v)}).join(` +`);return c.replaceWith(u,h,r.schema.text(g)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:a}=n;if(!a||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(` + +`);return!i||!o?!1:t.chain().command(({tr:c})=>(c.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:a,empty:i}=n;if(!i||a.parent.type!==this.type||!(a.parentOffset===a.parent.nodeSize-2))return!1;const c=a.after();return c===void 0?!1:r.nodeAt(c)?t.commands.command(({tr:h})=>(h.setSelection(ft.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[y0({find:i$,type:this.type,getAttributes:t=>({language:t[1]})}),y0({find:o$,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new hn({key:new wn("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),a=r?JSON.parse(r):void 0,i=a==null?void 0:a.mode;if(!n||!i)return!1;const{tr:o,schema:c}=t.state,u=c.text(n.replace(/\r\n?/g,` +`));return o.replaceSelectionWith(this.type.create({language:i},u)),o.selection.$from.parent.type!==this.type&&o.setSelection(ot.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),c$=Bn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` + +`):""}),d$=Bn.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",Jt(this.options.HTMLAttributes,t)]},renderText(){return` +`},renderMarkdown:()=>` +`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:a,storedMarks:i}=n;if(a.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:c}=r.extensionManager,u=i||a.$to.parentOffset&&a.$from.marks();return e().insertContent({type:this.name}).command(({tr:h,dispatch:f})=>{if(f&&u&&o){const m=u.filter(g=>c.includes(g.type.name));h.ensureMarks(m)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),u$=Bn.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]}`,Jt(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=>y0({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),h$=Bn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Jt(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!z_(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,a=t();return LC(n)?a.insertContentAt(r.pos,{type:this.name}):a.insertContent({type:this.name}),a.command(({state:i,tr:o,dispatch:c})=>{if(c){const{$to:u}=o.selection,h=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?o.setSelection(ot.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(it.create(o.doc,u.pos)):o.setSelection(ot.create(o.doc,u.pos));else{const f=i.schema.nodes[this.options.nextNodeType]||u.parent.type.contentMatch.defaultType,m=f==null?void 0:f.create();m&&(o.insert(h,m),o.setSelection(ot.create(o.doc,h+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[YC({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),f$=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,p$=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,m$=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,g$=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,x$=tc.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",Jt(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[cd({find:f$,type:this.type}),cd({find:m$,type:this.type})]},addPasteRules(){return[Gl({find:p$,type:this.type}),Gl({find:g$,type:this.type})]}});const y$="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",b$="ελ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",N0="numeric",w0="ascii",j0="alpha",wu="asciinumeric",hu="alphanumeric",k0="domain",i3="emoji",v$="scheme",N$="slashscheme",bx="whitespace";function w$(t,e){return t in e||(e[t]=[]),e[t]}function Al(t,e,n){e[N0]&&(e[wu]=!0,e[hu]=!0),e[w0]&&(e[wu]=!0,e[j0]=!0),e[wu]&&(e[hu]=!0),e[j0]&&(e[hu]=!0),e[hu]&&(e[k0]=!0),e[i3]&&(e[k0]=!0);for(const r in e){const a=w$(r,n);a.indexOf(t)<0&&a.push(t)}}function j$(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function dr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}dr.groups={};dr.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;rt.ta(e,n,r,a),In=(t,e,n,r,a)=>t.tr(e,n,r,a),Tw=(t,e,n,r,a)=>t.ts(e,n,r,a),Re=(t,e,n,r,a)=>t.tt(e,n,r,a),ki="WORD",S0="UWORD",o3="ASCIINUMERICAL",l3="ALPHANUMERICAL",Fu="LOCALHOST",C0="TLD",E0="UTLD",Cf="SCHEME",Uc="SLASH_SCHEME",Wy="NUM",T0="WS",Ky="NL",ju="OPENBRACE",ku="CLOSEBRACE",tp="OPENBRACKET",np="CLOSEBRACKET",sp="OPENPAREN",rp="CLOSEPAREN",ap="OPENANGLEBRACKET",ip="CLOSEANGLEBRACKET",op="FULLWIDTHLEFTPAREN",lp="FULLWIDTHRIGHTPAREN",cp="LEFTCORNERBRACKET",dp="RIGHTCORNERBRACKET",up="LEFTWHITECORNERBRACKET",hp="RIGHTWHITECORNERBRACKET",fp="FULLWIDTHLESSTHAN",pp="FULLWIDTHGREATERTHAN",mp="AMPERSAND",gp="APOSTROPHE",xp="ASTERISK",bo="AT",yp="BACKSLASH",bp="BACKTICK",vp="CARET",wo="COLON",qy="COMMA",Np="DOLLAR",za="DOT",wp="EQUALS",Gy="EXCLAMATION",Ur="HYPHEN",Su="PERCENT",jp="PIPE",kp="PLUS",Sp="POUND",Cu="QUERY",Jy="QUOTE",c3="FULLWIDTHMIDDLEDOT",Qy="SEMI",Fa="SLASH",Eu="TILDE",Cp="UNDERSCORE",d3="EMOJI",Ep="SYM";var u3=Object.freeze({__proto__:null,ALPHANUMERICAL:l3,AMPERSAND:mp,APOSTROPHE:gp,ASCIINUMERICAL:o3,ASTERISK:xp,AT:bo,BACKSLASH:yp,BACKTICK:bp,CARET:vp,CLOSEANGLEBRACKET:ip,CLOSEBRACE:ku,CLOSEBRACKET:np,CLOSEPAREN:rp,COLON:wo,COMMA:qy,DOLLAR:Np,DOT:za,EMOJI:d3,EQUALS:wp,EXCLAMATION:Gy,FULLWIDTHGREATERTHAN:pp,FULLWIDTHLEFTPAREN:op,FULLWIDTHLESSTHAN:fp,FULLWIDTHMIDDLEDOT:c3,FULLWIDTHRIGHTPAREN:lp,HYPHEN:Ur,LEFTCORNERBRACKET:cp,LEFTWHITECORNERBRACKET:up,LOCALHOST:Fu,NL:Ky,NUM:Wy,OPENANGLEBRACKET:ap,OPENBRACE:ju,OPENBRACKET:tp,OPENPAREN:sp,PERCENT:Su,PIPE:jp,PLUS:kp,POUND:Sp,QUERY:Cu,QUOTE:Jy,RIGHTCORNERBRACKET:dp,RIGHTWHITECORNERBRACKET:hp,SCHEME:Cf,SEMI:Qy,SLASH:Fa,SLASH_SCHEME:Uc,SYM:Ep,TILDE:Eu,TLD:C0,UNDERSCORE:Cp,UTLD:E0,UWORD:S0,WORD:ki,WS:T0});const wi=/[a-z]/,ou=new RegExp("\\p{L}","u"),vx=new RegExp("\\p{Emoji}","u"),ji=/\d/,Nx=/\s/,Mw="\r",wx=` +`,k$="️",S$="‍",jx="";let hf=null,ff=null;function C$(t=[]){const e={};dr.groups=e;const n=new dr;hf==null&&(hf=Aw(y$)),ff==null&&(ff=Aw(b$)),Re(n,"'",gp),Re(n,"{",ju),Re(n,"}",ku),Re(n,"[",tp),Re(n,"]",np),Re(n,"(",sp),Re(n,")",rp),Re(n,"<",ap),Re(n,">",ip),Re(n,"(",op),Re(n,")",lp),Re(n,"「",cp),Re(n,"」",dp),Re(n,"『",up),Re(n,"』",hp),Re(n,"<",fp),Re(n,">",pp),Re(n,"&",mp),Re(n,"*",xp),Re(n,"@",bo),Re(n,"`",bp),Re(n,"^",vp),Re(n,":",wo),Re(n,",",qy),Re(n,"$",Np),Re(n,".",za),Re(n,"=",wp),Re(n,"!",Gy),Re(n,"-",Ur),Re(n,"%",Su),Re(n,"|",jp),Re(n,"+",kp),Re(n,"#",Sp),Re(n,"?",Cu),Re(n,'"',Jy),Re(n,"/",Fa),Re(n,";",Qy),Re(n,"~",Eu),Re(n,"_",Cp),Re(n,"\\",yp),Re(n,"・",c3);const r=In(n,ji,Wy,{[N0]:!0});In(r,ji,r);const a=In(r,wi,o3,{[wu]:!0}),i=In(r,ou,l3,{[hu]:!0}),o=In(n,wi,ki,{[w0]:!0});In(o,ji,a),In(o,wi,o),In(a,ji,a),In(a,wi,a);const c=In(n,ou,S0,{[j0]:!0});In(c,wi),In(c,ji,i),In(c,ou,c),In(i,ji,i),In(i,wi),In(i,ou,i);const u=Re(n,wx,Ky,{[bx]:!0}),h=Re(n,Mw,T0,{[bx]:!0}),f=In(n,Nx,T0,{[bx]:!0});Re(n,jx,f),Re(h,wx,u),Re(h,jx,f),In(h,Nx,f),Re(f,Mw),Re(f,wx),In(f,Nx,f),Re(f,jx,f);const m=In(n,vx,d3,{[i3]:!0});Re(m,"#"),In(m,vx,m),Re(m,k$,m);const g=Re(m,S$);Re(g,"#"),In(g,vx,m);const b=[[wi,o],[ji,a]],N=[[wi,null],[ou,c],[ji,i]];for(let j=0;jj[0]>v[0]?1:-1);for(let j=0;j=0?T[k0]=!0:wi.test(v)?ji.test(v)?T[wu]=!0:T[w0]=!0:T[N0]=!0,Tw(n,v,v,T)}return Tw(n,"localhost",Fu,{ascii:!0}),n.jd=new dr(Ep),{start:n,tokens:Object.assign({groups:e},u3)}}function h3(t,e){const n=E$(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,a=[];let i=0,o=0;for(;o=0&&(m+=n[o].length,g++),h+=n[o].length,i+=n[o].length,o++;i-=m,o-=g,h-=m,a.push({t:f.t,v:e.slice(i-h,i),s:i-h,e:i})}return a}function E$(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 po(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 Bu={defaultProtocol:"http",events:null,format:Iw,formatHref:Iw,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Yy(t,e=null){let n=Object.assign({},Bu);t&&(n=Object.assign(n,t instanceof Yy?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=Bu.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 rm(t,e){class n extends f3{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 Pw=rm("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Rw=rm("text"),T$=rm("nl"),pf=rm("url",{isLink:!0,toHref(t=Bu.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===wo}}),Hr=t=>new dr(t);function M$({groups:t}){const e=t.domain.concat([mp,xp,bo,yp,bp,vp,Np,wp,Ur,Wy,Su,jp,kp,Sp,Fa,Ep,Eu,Cp]),n=[gp,wo,qy,za,Gy,Su,Cu,Jy,Qy,ap,ip,ju,ku,np,tp,sp,rp,op,lp,cp,dp,up,hp,fp,pp],r=[mp,gp,xp,yp,bp,vp,Np,wp,Ur,ju,ku,Su,jp,kp,Sp,Cu,Fa,Ep,Eu,Cp],a=Hr(),i=Re(a,Eu);St(i,r,i),St(i,t.domain,i);const o=Hr(),c=Hr(),u=Hr();St(a,t.domain,o),St(a,t.scheme,c),St(a,t.slashscheme,u),St(o,r,i),St(o,t.domain,o);const h=Re(o,bo);Re(i,bo,h),Re(c,bo,h),Re(u,bo,h);const f=Re(i,za);St(f,r,i),St(f,t.domain,i);const m=Hr();St(h,t.domain,m),St(m,t.domain,m);const g=Re(m,za);St(g,t.domain,m);const b=Hr(Pw);St(g,t.tld,b),St(g,t.utld,b),Re(h,Fu,b);const N=Re(m,Ur);Re(N,Ur,N),St(N,t.domain,m),St(b,t.domain,m),Re(b,za,g),Re(b,Ur,N);const j=Re(b,wo);St(j,t.numeric,Pw);const v=Re(o,Ur),k=Re(o,za);Re(v,Ur,v),St(v,t.domain,o),St(k,r,i),St(k,t.domain,o);const T=Hr(pf);St(k,t.tld,T),St(k,t.utld,T),St(T,t.domain,o),St(T,r,i),Re(T,za,k),Re(T,Ur,v),Re(T,bo,h);const C=Re(T,wo),R=Hr(pf);St(C,t.numeric,R);const O=Hr(pf),U=Hr();St(O,e,O),St(O,n,U),St(U,e,O),St(U,n,U),Re(T,Fa,O),Re(R,Fa,O);const P=Re(c,wo),z=Re(u,wo),L=Re(z,Fa),Q=Re(L,Fa);St(c,t.domain,o),Re(c,za,k),Re(c,Ur,v),St(u,t.domain,o),Re(u,za,k),Re(u,Ur,v),St(P,t.domain,O),Re(P,Fa,O),Re(P,Cu,O),St(Q,t.domain,O),St(Q,e,O),Re(Q,Fa,O);const se=[[ju,ku],[tp,np],[sp,rp],[ap,ip],[op,lp],[cp,dp],[up,hp],[fp,pp]];for(let $=0;$=0&&g++,a++,f++;if(g<0)a-=f,a0&&(i.push(kx(Rw,e,o)),o=[]),a-=g,f-=g;const b=m.t,N=n.slice(a-f,a);i.push(kx(b,e,N))}}return o.length>0&&i.push(kx(Rw,e,o)),i}function kx(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 I$=typeof console<"u"&&console&&console.warn||(()=>{}),P$="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",yn={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function R$(){return dr.groups={},yn.scanner=null,yn.parser=null,yn.tokenQueue=[],yn.pluginQueue=[],yn.customSchemes=[],yn.initialized=!1,yn}function Lw(t,e=!1){if(yn.initialized&&I$(`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`);yn.customSchemes.push([t,e])}function L$(){yn.scanner=C$(yn.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=SC(n.doc,[...e]);if(RC(c).forEach(({newRange:h})=>{const f=$D(r.doc,h,b=>b.isTextblock);let m,g;if(f.length>1)m=f[0],g=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(f.length){const b=r.doc.textBetween(h.from,h.to," "," ");if(!D$.test(b))return;m=f[0],g=r.doc.textBetween(m.pos,h.to,void 0," ")}if(m&&g){const b=g.split(O$).filter(Boolean);if(b.length<=0)return!1;const N=b[b.length-1],j=m.pos+g.lastIndexOf(N);if(!N)return!1;const v=Xy(N).map(k=>k.toObject(t.defaultProtocol));if(!$$(v))return!1;v.filter(k=>k.isLink).map(k=>({...k,from:j+k.start+1,to:j+k.end+1})).filter(k=>r.schema.marks.code?!r.doc.rangeHasMark(k.from,k.to,r.schema.marks.code):!0).filter(k=>t.validate(k.value)).filter(k=>t.shouldAutoLink(k.value)).forEach(k=>{zy(k.from,k.to,r.doc).some(T=>T.mark.type===t.type)||o.addMark(k.from,k.to,t.type.create({href:k.href}))})}}),!!o.steps.length)return o}})}function F$(t){return new hn({key:new wn("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 B$(t){return new hn({key:new wn("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=p3(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 kl(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(_$,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var V$=tc.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"){Lw(t);return}Lw(t.scheme,t.optionalSlashes)})},onDestroy(){R$()},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)=>!!kl(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=>!!kl(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=>!!kl(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Jt(this.options.HTMLAttributes,t),0]:["a",Jt(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=>!!kl(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=>!!kl(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[Gl({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,a=p3(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!kl(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(z$({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:a=>!!kl(a,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(F$({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(B$({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),H$=Object.defineProperty,U$=(t,e)=>{for(var n in e)H$(t,n,{get:e[n],enumerable:!0})},W$="listItem",Ow="textStyle",Dw=/^\s*([-+*])\s$/,m3=Bn.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",Jt(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(W$,this.editor.getAttributes(Ow)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=dd({find:Dw,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=dd({find:Dw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Ow),editor:this.editor})),[t]}}),g3=Bn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Jt(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)=>Hy(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)}}}),K$={};U$(K$,{findListItemPos:()=>Yu,getNextListDepth:()=>eb,handleBackspace:()=>M0,handleDelete:()=>A0,hasListBefore:()=>x3,hasListItemAfter:()=>q$,hasListItemBefore:()=>y3,listItemHasSubList:()=>b3,nextListIsDeeper:()=>v3,nextListIsHigher:()=>N3});var Yu=(t,e)=>{const{$from:n}=e.selection,r=Gn(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}},eb=(t,e)=>{const n=Yu(t,e);if(!n)return!1;const[,r]=GD(e,t,n.$pos.pos+4);return r},x3=(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))},y3=(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)},b3=(t,e,n)=>{if(!n)return!1;const r=Gn(t,e.schema);let a=!1;return n.descendants(i=>{i.type===r&&(a=!0)}),a},M0=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Vo(t.state,e)&&x3(t.state,e,n)){const{$anchor:c}=t.state.selection,u=t.state.doc.resolve(c.before()-1),h=[];u.node().descendants((g,b)=>{g.type.name===e&&h.push({node:g,pos:b})});const f=h.at(-1);if(!f)return!1;const m=t.state.doc.resolve(u.start()+f.pos+1);return t.chain().cut({from:c.start()-1,to:c.end()+1},m.end()).joinForward().run()}if(!Vo(t.state,e)||!XD(t.state))return!1;const r=Yu(e,t.state);if(!r)return!1;const i=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=b3(e,t.state,i);return y3(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},v3=(t,e)=>{const n=eb(t,e),r=Yu(t,e);return!r||!n?!1:n>r.depth},N3=(t,e)=>{const n=eb(t,e),r=Yu(t,e);return!r||!n?!1:n{if(!Vo(t.state,e)||!YD(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:a}=n;return!n.empty&&r.sameParent(a)?!1:v3(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():N3(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},q$=(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)},w3=On.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&&A0(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&&A0(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&M0(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&M0(t,n,r)&&(e=!0)}),e}}}}),_w=/^(\s*)(\d+)\.\s+(.*)$/,G$=/^\s/;function J$(t){const e=[];let n=0,r=0;for(;ne;)g.push(t[m]),m+=1;if(g.length>0){const b=Math.min(...g.map(j=>j.indent)),N=j3(g,b,n);h.push({type:"list",ordered:!0,start:g[0].number,items:N,raw:g.map(j=>j.raw).join(` +`)})}a.push({type:"list_item",raw:o.raw,tokens:h}),i=m}else i+=1}return a}function Q$(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 Y$="listItem",$w="textStyle",zw=/^(\d+)\.\s$/,k3=Bn.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",Jt(this.options.HTMLAttributes,n),0]:["ol",Jt(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?Q$(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]=J$(a);if(i.length===0)return;const c=j3(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(Y$,this.editor.getAttributes($w)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=dd({find:zw,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=dd({find:zw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes($w)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),X$=/^\s*(\[([( |x])?\])\s$/,Z$=Bn.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",Jt(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 Hy(t,e,a)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const a=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),c=document.createElement("input"),u=document.createElement("div"),h=m=>{var g,b;c.ariaLabel=((b=(g=this.options.a11y)==null?void 0:g.checkboxLabel)==null?void 0:b.call(g,m,c.checked))||`Task item checkbox for ${m.textContent||"empty task item"}`};h(t),i.contentEditable="false",c.type="checkbox",c.addEventListener("mousedown",m=>m.preventDefault()),c.addEventListener("change",m=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){c.checked=!c.checked;return}const{checked:g}=m.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:b})=>{const N=n();if(typeof N!="number")return!1;const j=b.doc.nodeAt(N);return b.setNodeMarkup(N,void 0,{...j==null?void 0:j.attrs,checked:g}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,g)||(c.checked=!c.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([m,g])=>{a.setAttribute(m,g)}),a.dataset.checked=t.attrs.checked,c.checked=t.attrs.checked,i.append(c,o),a.append(i,u),Object.entries(e).forEach(([m,g])=>{a.setAttribute(m,g)});let f=new Set(Object.keys(e));return{dom:a,contentDOM:u,update:m=>{if(m.type!==this.type)return!1;a.dataset.checked=m.attrs.checked,c.checked=m.attrs.checked,h(m);const g=r.extensionManager.attributes,b=zu(m,g),N=new Set(Object.keys(b)),j=this.options.HTMLAttributes;return f.forEach(v=>{N.has(v)||(v in j?a.setAttribute(v,j[v]):a.removeAttribute(v))}),Object.entries(b).forEach(([v,k])=>{k==null?v in j?a.setAttribute(v,j[v]):a.removeAttribute(v):a.setAttribute(v,k)}),f=N,!0}}}},addInputRules(){return[dd({find:X$,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),ez=Bn.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",Jt(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=b0(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=b0(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()}}});On.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(m3.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(g3.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(w3.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(k3.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Z$.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(ez.configure(this.options.taskList)),t}});var Fw=" ",tz=" ",nz=Bn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Jt(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===Fw||r[0].text===tz)?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?Fw:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),sz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,rz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,az=tc.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",Jt(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[cd({find:sz,type:this.type})]},addPasteRules(){return[Gl({find:rz,type:this.type})]}}),iz=Bn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),oz=tc.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",Jt(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 lz(t={}){return new hn({view(e){return new cz(e,t)}})}class cz{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(a=>{let i=o=>{this[a](o)};return e.dom.addEventListener(a,i),{name:a,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,a=this.editorView.dom,i=a.getBoundingClientRect(),o=i.width/a.offsetWidth,c=i.height/a.offsetHeight;if(n){let m=e.nodeBefore,g=e.nodeAfter;if(m||g){let b=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(b){let N=b.getBoundingClientRect(),j=m?N.bottom:N.top;m&&g&&(j=(j+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let v=this.width/2*c;r={left:N.left,right:N.right,top:j-v,bottom:j+v}}}}if(!r){let m=this.editorView.coordsAtPos(this.cursorPos),g=this.width/2*o;r={left:m.left-g,right:m.left+g,top:m.top,bottom:m.bottom}}let u=this.editorView.dom.offsetParent;this.element||(this.element=u.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let h,f;if(!u||u==document.body&&getComputedStyle(u).position=="static")h=-pageXOffset,f=-pageYOffset;else{let m=u.getBoundingClientRect(),g=m.width/u.offsetWidth,b=m.height/u.offsetHeight;h=m.left-u.scrollLeft*g,f=m.top-u.scrollTop*b}this.element.style.left=(r.left-h)/o+"px",this.element.style.top=(r.top-f)/c+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/c+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),a=r&&r.type.spec.disableDropCursor,i=typeof a=="function"?a(this.editorView,n,e):a;if(n&&!i){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=xS(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 Rn extends ft{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Rn.valid(r)?new Rn(r):ft.near(r)}content(){return ze.empty}eq(e){return e instanceof Rn&&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 Rn(e.resolve(n.pos))}getBookmark(){return new tb(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!dz(e)||!uz(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&&Rn.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(Rn.valid(u))return u}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!it.isSelectable(i)){e=e.doc.resolve(a+i.nodeSize*n),r=!1;continue e}break}i=o,a+=n;let c=e.doc.resolve(a);if(Rn.valid(c))return c}return null}}}Rn.prototype.visible=!1;Rn.findFrom=Rn.findGapCursorFrom;ft.jsonID("gapcursor",Rn);class tb{constructor(e){this.pos=e}map(e){return new tb(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Rn.valid(n)?new Rn(n):ft.near(n)}}function S3(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function dz(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||S3(a.type))return!0;if(a.inlineContent)return!1}}return!0}function uz(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||S3(a.type))return!0;if(a.inlineContent)return!1}}return!0}function hz(){return new hn({props:{decorations:gz,createSelectionBetween(t,e,n){return e.pos==n.pos&&Rn.valid(n)?new Rn(n):null},handleClick:pz,handleKeyDown:fz,handleDOMEvents:{beforeinput:mz}}})}const fz=Ry({ArrowLeft:mf("horiz",-1),ArrowRight:mf("horiz",1),ArrowUp:mf("vert",-1),ArrowDown:mf("vert",1)});function mf(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,a,i){let o=r.selection,c=e>0?o.$to:o.$from,u=o.empty;if(o instanceof ot){if(!i.endOfTextblock(n)||c.depth==0)return!1;u=!1,c=r.doc.resolve(e>0?c.after():c.before())}let h=Rn.findGapCursorFrom(c,e,u);return h?(a&&a(r.tr.setSelection(new Rn(h))),!0):!1}}function pz(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Rn.valid(r))return!1;let a=t.posAtCoords({left:n.clientX,top:n.clientY});return a&&a.inside>-1&&it.isSelectable(t.state.doc.nodeAt(a.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Rn(r))),!0)}function mz(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Rn))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let a=Ce.empty;for(let o=r.length-1;o>=0;o--)a=Ce.from(r[o].createAndFill(null,a));let i=t.state.tr.replace(n.pos,n.pos,new ze(a,0,0));return i.setSelection(ot.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function gz(t){if(!(t.selection instanceof Rn))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",an.create(t.doc,[ss.widget(t.selection.head,e,{key:"gapcursor"})])}var Tp=200,xs=function(){};xs.prototype.append=function(e){return e.length?(e=xs.from(e),!this.length&&e||e.length=n?xs.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};xs.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};xs.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)};xs.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};xs.from=function(e){return e instanceof xs?e:e&&e.length?new C3(e):xs.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<=Tp)return new e(this.values.concat(a.flatten()))},e.prototype.leafPrepend=function(a){if(this.length+a.length<=Tp)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})(xs);xs.empty=new C3([]);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})(xs);const yz=500;class ma{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let a,i;n&&(a=this.remapping(r,this.items.length),i=a.maps.length);let o=e.tr,c,u,h=[],f=[];return this.items.forEach((m,g)=>{if(!m.step){a||(a=this.remapping(r,g+1),i=a.maps.length),i--,f.push(m);return}if(a){f.push(new mo(m.map));let b=m.step.map(a.slice(i)),N;b&&o.maybeStep(b).doc&&(N=o.mapping.maps[o.mapping.maps.length-1],h.push(new mo(N,void 0,void 0,h.length+f.length))),i--,N&&a.appendMap(N,i)}else o.maybeStep(m.step);if(m.selection)return c=a?m.selection.map(a.slice(i)):m.selection,u=new ma(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;fvz&&(c=bz(c,h),o-=h),new ma(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 ma(this.items.append(e.map(n=>new mo(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],a=Math.max(0,this.items.length-n),i=e.mapping,o=e.steps.length,c=this.eventCount;this.items.forEach(g=>{g.selection&&c--},a);let u=n;this.items.forEach(g=>{let b=i.getMirror(--u);if(b==null)return;o=Math.min(o,b);let N=i.maps[b];if(g.step){let j=e.steps[b].invert(e.docs[b]),v=g.selection&&g.selection.map(i.slice(u+1,b));v&&c++,r.push(new mo(N,j,v))}else r.push(new mo(N))},a);let h=[];for(let g=n;gyz&&(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 mo(h.invert(),u,f),g,b=a.length-1;(g=a.length&&a[b].merge(m))?a[b]=g:a.push(m)}}else o.map&&r--},this.items.length,0),new ma(xs.from(a.reverse()),i)}}ma.empty=new ma(xs.empty,0);function bz(t,e){let n;return t.forEach((r,a)=>{if(r.selection&&e--==0)return n=a,!1}),t.slice(n)}let mo=class E3{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 E3(n.getMap().invert(),n,this.selection)}}};class vo{constructor(e,n,r,a,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=a,this.prevComposition=i}}const vz=20;function Nz(t,e,n,r){let a=n.getMeta(Ol),i;if(a)return a.historyState;n.getMeta(kz)&&(t=new vo(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(Ol))return o.getMeta(Ol).redo?new vo(t.done.addTransform(n,void 0,r,Ef(e)),t.undone,Bw(n.mapping.maps),t.prevTime,t.prevComposition):new vo(t.done,t.undone.addTransform(n,void 0,r,Ef(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||!wz(n,t.prevRanges)),h=o?Sx(t.prevRanges,n.mapping):Bw(n.mapping.maps);return new vo(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,Ef(e)),ma.empty,h,n.time,c??t.prevComposition)}else return(i=n.getMeta("rebased"))?new vo(t.done.rebased(n,i),t.undone.rebased(n,i),Sx(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new vo(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Sx(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function wz(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 Bw(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 Sx(t,e){if(!t)return null;let n=[];for(let r=0;r{let a=Ol.getState(n);if(!a||(t?a.undone:a.done).eventCount==0)return!1;if(r){let i=jz(a,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const M3=T3(!1,!0),A3=T3(!0,!0);On.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 hn({key:new wn("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const a=this.options.limit;if(a==null||a===0){t=!0;return}const i=this.storage.characters({node:r.doc});if(i>a){const o=i-a,c=0,u=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${a} characters. Content was automatically trimmed.`);const h=r.tr.deleteRange(c,u);return t=!0,h}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const a=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||a>r&&i>r&&i<=a)return!0;if(a>r&&i>r&&i>a||!e.getMeta("paste"))return!1;const c=e.selection.$head.pos,u=i-r,h=c-u,f=c;return e.deleteRange(h,f),!(this.storage.characters({node:e.doc})>r)}})]}});var Cz=On.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[lz(this.options)]}});On.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new hn({key:new wn("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:a}=e,i=[];if(!n||!r)return an.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(ss.node(h,h+u.nodeSize,{class:this.options.className}))}),an.create(t,i)}}})]}});var Ez=On.create({name:"gapCursor",addProseMirrorPlugins(){return[hz()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=qt(st(t,"allowGapCursor",n)))!=null?e:null}}}),Hw="placeholder";function Tz(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var Mz=On.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Hw,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${Tz(this.options.dataAttribute)}`:`data-${Hw}`;return[new hn({key:new wn("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&&tm(c);if((h||!this.options.showOnlyCurrent)&&f){const m=[this.options.emptyNodeClass];o&&m.push(this.options.emptyEditorClass);const g=ss.node(u,u+c.nodeSize,{class:m.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:c,pos:u,hasAnchor:h}):this.options.placeholder});i.push(g)}return this.options.includeChildren}),an.create(e,i)}}})]}});On.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new hn({key:new wn("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||LC(n.selection)||t.view.dragging?null:an.create(n.doc,[ss.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function Uw({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var Az=On.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new wn(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 hn({key:e,appendTransaction:(a,i,o)=>{const{doc:c,tr:u,schema:h}=o,f=e.getState(o),m=c.content.size,g=h.nodes[n];if(f)return u.insert(m,g.create())},state:{init:(a,i)=>{const o=i.tr.doc.lastChild;return!Uw({node:o,types:r})},apply:(a,i)=>{if(!a.docChanged||a.getMeta("__uniqueIDTransaction"))return i;const o=a.doc.lastChild;return!Uw({node:o,types:r})}}})]}}),Iz=On.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>M3(t,e),redo:()=>({state:t,dispatch:e})=>A3(t,e)}},addProseMirrorPlugins(){return[Sz(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=On.create({name:"starterKit",addExtensions(){var t,e,n,r;const a=[];return this.options.bold!==!1&&a.push(n$.configure(this.options.bold)),this.options.blockquote!==!1&&a.push(Y7.configure(this.options.blockquote)),this.options.bulletList!==!1&&a.push(m3.configure(this.options.bulletList)),this.options.code!==!1&&a.push(a$.configure(this.options.code)),this.options.codeBlock!==!1&&a.push(l$.configure(this.options.codeBlock)),this.options.document!==!1&&a.push(c$.configure(this.options.document)),this.options.dropcursor!==!1&&a.push(Cz.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&a.push(Ez.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&a.push(d$.configure(this.options.hardBreak)),this.options.heading!==!1&&a.push(u$.configure(this.options.heading)),this.options.undoRedo!==!1&&a.push(Iz.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&a.push(h$.configure(this.options.horizontalRule)),this.options.italic!==!1&&a.push(x$.configure(this.options.italic)),this.options.listItem!==!1&&a.push(g3.configure(this.options.listItem)),this.options.listKeymap!==!1&&a.push(w3.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&a.push(V$.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&a.push(k3.configure(this.options.orderedList)),this.options.paragraph!==!1&&a.push(nz.configure(this.options.paragraph)),this.options.strike!==!1&&a.push(az.configure(this.options.strike)),this.options.text!==!1&&a.push(iz.configure(this.options.text)),this.options.underline!==!1&&a.push(oz.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&a.push(Az.configure((r=this.options)==null?void 0:r.trailingNode)),a}}),Rz=Pz,Lz=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Oz=Bn.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",Jt(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,a,i,o;const c=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",u=(a=(r=t.attrs)==null?void 0:r.alt)!=null?a:"",h=(o=(i=t.attrs)==null?void 0:i.title)!=null?o:"";return h?`![${u}](${c} "${h}")`:`![${u}](${c})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:a,getPos:i,HTMLAttributes:o,editor:c})=>{const u=document.createElement("img");Object.entries(o).forEach(([m,g])=>{if(g!=null)switch(m){case"width":case"height":break;default:u.setAttribute(m,g);break}}),u.src=o.src;const h=new $_({element:u,editor:c,node:a,getPos:i,onResize:(m,g)=>{u.style.width=`${m}px`,u.style.height=`${g}px`},onCommit:(m,g)=>{const b=i();b!==void 0&&this.editor.chain().setNodeSelection(b).updateAttributes(this.name,{width:m,height:g}).run()},onUpdate:(m,g,b)=>m.type===a.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),f=h.dom;return f.style.visibility="hidden",f.style.pointerEvents="none",u.onload=()=>{f.style.visibility="",f.style.pointerEvents=""},h}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[YC({find:Lz,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),Dz=Oz;function _z(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:o,$position:c}=t,u=r&&!a,h=F_(n),f=new RegExp(`\\s${h}$`),m=o?"^":"",g=a?"":h,b=u?new RegExp(`${m}${h}.*?(?=\\s${g}|$)`,"gm"):new RegExp(`${m}(?:^)?${h}[^\\s${g}]*`,"gm"),N=((e=c.nodeBefore)==null?void 0:e.isText)&&c.nodeBefore.text;if(!N)return null;const j=c.pos-N.length,v=Array.from(N.matchAll(b)).pop();if(!v||v.input===void 0||v.index===void 0)return null;const k=v.input.slice(Math.max(0,v.index-1),v.index),T=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(k);if(i!==null&&!T)return null;const C=j+v.index;let R=C+v[0].length;return u&&f.test(N.slice(R-1,R+1))&&(v[0]+=" ",R+=1),C=c.pos?{range:{from:C,to:R},query:v[0].slice(n.length),text:v[0]}:null}var $z=new wn("suggestion");function zz({pluginKey:t=$z,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:a=!1,allowedPrefixes:i=[" "],startOfLine:o=!1,decorationTag:c="span",decorationClass:u="suggestion",decorationContent:h="",decorationEmptyClass:f="is-empty",command:m=()=>null,items:g=()=>[],render:b=()=>({}),allow:N=()=>!0,findSuggestionMatch:j=_z,shouldShow:v}){let k;const T=b==null?void 0:b(),C=()=>{const P=e.state.selection.$anchor.pos,z=e.view.coordsAtPos(P),{top:L,right:Q,bottom:se,left:$}=z;try{return new DOMRect($,L,Q-$,se-L)}catch{return null}},R=(P,z)=>z?()=>{const L=t.getState(e.state),Q=L==null?void 0:L.decorationId,se=P.dom.querySelector(`[data-decoration-id="${Q}"]`);return(se==null?void 0:se.getBoundingClientRect())||null}:C;function O(P,z){var L;try{const se=t.getState(P.state),$=se!=null&&se.decorationId?P.dom.querySelector(`[data-decoration-id="${se.decorationId}"]`):null,ie={editor:e,range:(se==null?void 0:se.range)||{from:0,to:0},query:(se==null?void 0:se.query)||null,text:(se==null?void 0:se.text)||null,items:[],command:oe=>m({editor:e,range:(se==null?void 0:se.range)||{from:0,to:0},props:oe}),decorationNode:$,clientRect:R(P,$)};(L=T==null?void 0:T.onExit)==null||L.call(T,ie)}catch{}const Q=P.state.tr.setMeta(z,{exit:!0});P.dispatch(Q)}const U=new hn({key:t,view(){return{update:async(P,z)=>{var L,Q,se,$,ie,oe,me;const I=(L=this.key)==null?void 0:L.getState(z),Y=(Q=this.key)==null?void 0:Q.getState(P.state),F=I.active&&Y.active&&I.range.from!==Y.range.from,ge=!I.active&&Y.active,X=I.active&&!Y.active,V=!ge&&!X&&I.query!==Y.query,W=ge||F&&V,fe=V||F,he=X||F&&V;if(!W&&!fe&&!he)return;const de=he&&!W?I:Y,D=P.dom.querySelector(`[data-decoration-id="${de.decorationId}"]`);k={editor:e,range:de.range,query:de.query,text:de.text,items:[],command:q=>m({editor:e,range:de.range,props:q}),decorationNode:D,clientRect:R(P,D)},W&&((se=T==null?void 0:T.onBeforeStart)==null||se.call(T,k)),fe&&(($=T==null?void 0:T.onBeforeUpdate)==null||$.call(T,k)),(fe||W)&&(k.items=await g({editor:e,query:de.query})),he&&((ie=T==null?void 0:T.onExit)==null||ie.call(T,k)),fe&&((oe=T==null?void 0:T.onUpdate)==null||oe.call(T,k)),W&&((me=T==null?void 0:T.onStart)==null||me.call(T,k))},destroy:()=>{var P;k&&((P=T==null?void 0:T.onExit)==null||P.call(T,k))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(P,z,L,Q){const{isEditable:se}=e,{composing:$}=e.view,{selection:ie}=P,{empty:oe,from:me}=ie,I={...z},Y=P.getMeta(t);if(Y&&Y.exit)return I.active=!1,I.decorationId=null,I.range={from:0,to:0},I.query=null,I.text=null,I;if(I.composing=$,se&&(oe||e.view.composing)){(mez.range.to)&&!$&&!z.composing&&(I.active=!1);const F=j({char:n,allowSpaces:r,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:o,$position:ie.$from}),ge=`id_${Math.floor(Math.random()*4294967295)}`;F&&N({editor:e,state:Q,range:F.range,isActive:z.active})&&(!v||v({editor:e,range:F.range,query:F.query,text:F.text,transaction:P}))?(I.active=!0,I.decorationId=z.decorationId?z.decorationId:ge,I.range=F.range,I.query=F.query,I.text=F.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(P,z){var L,Q,se,$;const{active:ie,range:oe}=U.getState(P.state);if(!ie)return!1;if(z.key==="Escape"||z.key==="Esc"){const I=U.getState(P.state),Y=(L=k==null?void 0:k.decorationNode)!=null?L:null,F=Y??(I!=null&&I.decorationId?P.dom.querySelector(`[data-decoration-id="${I.decorationId}"]`):null);if(((Q=T==null?void 0:T.onKeyDown)==null?void 0:Q.call(T,{view:P,event:z,range:I.range}))||!1)return!0;const X={editor:e,range:I.range,query:I.query,text:I.text,items:[],command:V=>m({editor:e,range:I.range,props:V}),decorationNode:F,clientRect:F?()=>F.getBoundingClientRect()||null:null};return(se=T==null?void 0:T.onExit)==null||se.call(T,X),O(P,t),!0}return(($=T==null?void 0:T.onKeyDown)==null?void 0:$.call(T,{view:P,event:z,range:oe}))||!1},decorations(P){const{active:z,range:L,decorationId:Q,query:se}=U.getState(P);if(!z)return null;const $=!(se!=null&&se.length),ie=[u];return $&&ie.push(f),an.create(P.doc,[ss.inline(L.from,L.to,{nodeName:c,class:ie.join(" "),"data-decoration-id":Q,"data-decoration-content":h})])}}});return U}function Fz({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const a=new wn;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 I3(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>Fz({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function Ww(t,e){const n=I3(t),r=n.find(a=>a.char===e);return r||(n.length?n[0]:null)}var Bz=Bn.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",Jt(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=Ww(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Jt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=Jt({"data-type":this.name},this.options.HTMLAttributes,e);const a=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof a=="string"?["span",Jt({"data-type":this.name},this.options.HTMLAttributes,e),a]:a},...XC({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:Ww(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 Oi,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 I3(this).map(zz)}}),Vz=Bz,Hz=Mz;let I0,P0;if(typeof WeakMap<"u"){let t=new WeakMap;I0=e=>t.get(e),P0=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;I0=r=>{for(let a=0;a(n==10&&(n=0),t[n++]=r,t[n++]=a)}var Ln=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 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 Kz(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 Gz(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 wa(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 am(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=Jl(e.$head)||Jz(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Jz(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 R0(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function Qz(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function nb(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=Ln.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 Ql(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 R3(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let a=0;af!=n.pos-i);u.unshift(n.pos-i);const h=u.map(f=>{const m=r.nodeAt(f);if(!m)throw new RangeError(`No cell with offset ${f} found`);const g=i+f+1;return new wS(c.resolve(g),c.resolve(g+m.content.size))});super(h[0].$from,h[0].$to,h),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),a=e.resolve(n.map(this.$headCell.pos));if(R0(r)&&R0(a)&&nb(r,a)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?Si.rowSelection(r,a):i&&this.isColSelection()?Si.colSelection(r,a):new Si(r,a)}return ot.between(r,a)}content(){const e=this.$anchorCell.node(-1),n=Ln.get(e),r=this.$anchorCell.start(-1),a=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},o=[];for(let u=a.top;u0||v>0){let k=N.attrs;if(j>0&&(k=Ql(k,0,j)),v>0&&(k=Ql(k,k.colspan-v,v)),b.lefta.bottom){const k={...N.attrs,rowspan:Math.min(b.bottom,a.bottom)-Math.max(b.top,a.top)};b.top0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,a=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,a)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),a=Ln.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 Si&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),a=Ln.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(ss.node(r,r+n.nodeSize,{class:"selectedCell"}))}),an.create(t.doc,e)}function eF({$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 tF({$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 nF(t,e,n){const r=(e||t).selection,a=(e||t).doc;let i,o;if(r instanceof it&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")i=un.create(a,r.from);else if(o=="row"){const c=a.resolve(r.from+1);i=un.rowSelection(c,c)}else if(!n){const c=Ln.get(r.node),u=r.from+1,h=u+c.map[c.width*c.height-1];i=un.create(a,u+1,h)}}else r instanceof ot&&eF(r)?i=ot.create(a,r.from):r instanceof ot&&tF(r)&&(i=ot.create(a,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}const sF=new wn("fix-tables");function O3(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=rF(t,a,i,n))};return e?e.doc!=t.doc&&O3(e.doc,t.doc,0,r):t.doc.descendants(r),n}function rF(t,e,n,r){const a=Ln.get(e);if(!a.problems)return r;r||(r=t.tr);const i=[];for(let u=0;u0){let b="cell";f.firstChild&&(b=f.firstChild.type.spec.tableRole);const N=[];for(let v=0;v0?-1:0;Yz(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;cF(e,r,a+c)&&(c=a==0||a==e.height?null:0);for(let h=0,f=e.width*a;h0&&a0&&m==e.map[f-e.width]){const g=n.nodeAt(m).attrs;t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...g,rowspan:g.rowspan-1}),h+=g.colspan-1}else if(a0&&n[i]==n[i-1]||r.right0&&n[a]==n[a-t]||r.bottom0){const f=u+1+h.content.size,m=Kw(h)?u+1:f;i.replaceWith(m+r.tableStart,f+r.tableStart,c)}i.setSelection(new un(i.doc.resolve(u+r.tableStart))),e(i)}return!0}function Gw(t,e){const n=zs(t.schema);return mF(({node:r})=>n[r.type.spec.tableRole])(t,e)}function mF(t){return(e,n)=>{const r=e.selection;let a,i;if(r instanceof un){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;a=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{var o;if(a=Gz(r.$from),!a)return!1;i=(o=Jl(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=Qa(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 xF(t){return function(e,n){if(!wa(e))return!1;if(n){const r=zs(e.schema),a=Qa(e),i=e.tr,o=a.map.cellsInRect(t=="column"?{left:a.left,top:0,right:a.right,bottom:a.map.height}:t=="row"?{left:0,top:a.top,right:a.map.width,bottom:a.bottom}:a),c=o.map(u=>a.table.nodeAt(u));for(let u=0;u{const b=g+i.tableStart,N=o.doc.nodeAt(b);N&&o.setNodeMarkup(b,m,N.attrs)}),r(o)}return!0}}Vu("row",{useDeprecatedLogic:!0});Vu("column",{useDeprecatedLogic:!0});const yF=Vu("cell",{useDeprecatedLogic:!0});function bF(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 gf(t,e){const n=t.selection;if(!(n instanceof un))return!1;if(e){const r=t.tr,a=zs(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 ze(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(Ce.empty),n[a]r&&(g=g.type.createChecked(Ql(g.attrs,g.attrs.colspan,f+g.attrs.colspan-r),g.content)),h.push(g),f+=g.attrs.colspan;for(let b=1;ba&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,a-m.attrs.rowspan)},m.content)),u.push(m)}i.push(Ce.from(u))}n=i,e=a}return{width:t,height:e,rows:n}}function kF(t,e,n,r,a,i,o){const c=t.doc.type.schema,u=zs(c);let h,f;if(a>e.width)for(let m=0,g=0;me.height){const m=[];for(let N=0,j=(e.height-1)*e.width;N=e.width?!1:n.nodeAt(e.map[j+N]).type==u.header_cell;m.push(v?f||(f=u.header_cell.createAndFill()):h||(h=u.cell.createAndFill()))}const g=u.row.create(null,Ce.from(m)),b=[];for(let N=e.height;N{if(!a)return!1;const i=n.selection;if(i instanceof un)return Tf(n,r,ft.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const o=z3(a,t,e);if(o==null)return!1;if(t=="horiz")return Tf(n,r,ft.near(n.doc.resolve(i.head+e),e));{const c=n.doc.resolve(o),u=P3(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),Tf(n,r,h)}}}function yf(t,e){return(n,r,a)=>{if(!a)return!1;const i=n.selection;let o;if(i instanceof un)o=i;else{const u=z3(a,t,e);if(u==null)return!1;o=new un(n.doc.resolve(u))}const c=P3(o.$headCell,t,e);return c?Tf(n,r,new un(o.$anchorCell,c)):!1}}function CF(t,e){const n=t.state.doc,r=Jl(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new un(r))),!0):!1}function EF(t,e,n){if(!wa(t.state))return!1;let r=NF(n);const a=t.state.selection;if(a instanceof un){r||(r={width:1,height:1,rows:[Ce.from(L0(zs(t.state.schema).cell,n))]});const i=a.$anchorCell.node(-1),o=a.$anchorCell.start(-1),c=Ln.get(i).rectBetween(a.$anchorCell.pos-o,a.$headCell.pos-o);return r=jF(r,c.right-c.left,c.bottom-c.top),Zw(t.state,t.dispatch,o,c,r),!0}else if(r){const i=am(t.state),o=i.start(-1);return Zw(t.state,t.dispatch,o,Ln.get(i.node(-1)).findCell(i.pos-o),r),!0}else return!1}function TF(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=ej(t,e.target);let a;if(e.shiftKey&&t.state.selection instanceof un)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(a=Jl(t.state.selection.$anchor))!=null&&((n=Ex(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=Ex(t,h);const m=jo.getState(t.state)==null;if(!f||!nb(u,f))if(m)f=u;else return;const g=new un(u,f);if(m||!t.state.selection.eq(g)){const b=t.state.tr.setSelection(g);m&&b.setMeta(jo,u.pos),t.dispatch(b)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",c),jo.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(jo,-1))}function c(u){const h=u,f=jo.getState(t.state);let m;if(f!=null)m=t.state.doc.resolve(f);else if(ej(t,h.target)!=r&&(m=Ex(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 z3(t,e,n){if(!(t.state.selection instanceof ot))return null;const{$head:r}=t.state.selection;for(let a=r.depth-1;a>=0;a--){const i=r.node(a);if((n<0?r.index(a):r.indexAfter(a))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const o=r.before(a),c=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?o:null}}return null}function ej(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Ex(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&&Jl(t.state.doc.resolve(r))||Jl(t.state.doc.resolve(a))}var MF=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")),O0(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,O0(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function O0(t,e,n,r,a,i){let o=0,c=!0,u=e.firstChild;const h=t.firstChild;if(h){for(let m=0,g=0;mnew r(m,n,g)),new IF(-1,!1)},apply(o,c){return c.apply(o)}},props:{attributes:o=>{const c=Cr.getState(o);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,c)=>{PF(o,c,t,a)},mouseleave:o=>{RF(o)},mousedown:(o,c)=>{LF(o,c,e,n)}},decorations:o=>{const c=Cr.getState(o);if(c&&c.activeHandle>-1)return zF(o,c.activeHandle)},nodeViews:{}}});return i}var IF=class Mf{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Cr);if(r&&r.setHandle!=null)return new Mf(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Mf(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let a=e.mapping.map(n.activeHandle,-1);return R0(e.doc.resolve(a))||(a=-1),new Mf(a,n.dragging)}return n}};function PF(t,e,n,r){if(!t.editable)return;const a=Cr.getState(t.state);if(a&&!a.dragging){const i=DF(e.target);let o=-1;if(i){const{left:c,right:u}=i.getBoundingClientRect();e.clientX-c<=n?o=tj(t,e,"left",n):u-e.clientX<=n&&(o=tj(t,e,"right",n))}if(o!=a.activeHandle){if(!r&&o!==-1){const c=t.state.doc.resolve(o),u=c.node(-1),h=Ln.get(u),f=c.start(-1);if(h.colCount(c.pos-f)+c.nodeAfter.attrs.colspan-1==h.width-1)return}F3(t,o)}}}function RF(t){if(!t.editable)return;const e=Cr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&F3(t,-1)}function LF(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=Cr.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const c=t.state.doc.nodeAt(o.activeHandle),u=OF(t,o.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta(Cr,{setDragging:{startX:e.clientX,startWidth:u}}));function h(m){i.removeEventListener("mouseup",h),i.removeEventListener("mousemove",f);const g=Cr.getState(t.state);g!=null&&g.dragging&&(_F(t,g.activeHandle,nj(g.dragging,m,n)),t.dispatch(t.state.tr.setMeta(Cr,{setDragging:null})))}function f(m){if(!m.which)return h(m);const g=Cr.getState(t.state);if(g&&g.dragging){const b=nj(g.dragging,m,n);sj(t,g.activeHandle,b,r)}}return sj(t,o.activeHandle,u,r),i.addEventListener("mouseup",h),i.addEventListener("mousemove",f),e.preventDefault(),!0}function OF(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",Jt(this.options.HTMLAttributes,t),0]}}),V3=Bn.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",Jt(this.options.HTMLAttributes,t),0]}}),H3=Bn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Jt(this.options.HTMLAttributes,t),0]}});function D0(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function rj(t,e,n,r,a,i){var o;let c=0,u=!0,h=e.firstChild;const f=t.firstChild;if(f!==null)for(let g=0,b=0;g{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function UF(t,e,n,r,a){const i=HF(t),o=[],c=[];for(let h=0;h{const{selection:e}=t.state;if(!WF(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},KF="";function qF(t){return(t||"").replace(/\s+/g," ").trim()}function GF(t,e,n={}){var r;const a=(r=n.cellLineSeparator)!=null?r:KF;if(!t||!t.content||t.content.length===0)return"";const i=[];t.content.forEach(N=>{const j=[];N.content&&N.content.forEach(v=>{let k="";v.content&&Array.isArray(v.content)&&v.content.length>1?k=v.content.map(O=>e.renderChildren(O)).join(a):k=v.content?e.renderChildren(v.content):"";const T=qF(k),C=v.type==="tableHeader";j.push({text:T,isHeader:C})}),i.push(j)});const o=i.reduce((N,j)=>Math.max(N,j.length),0);if(o===0)return"";const c=new Array(o).fill(0);i.forEach(N=>{var j;for(let v=0;vc[v]&&(c[v]=T),c[v]<3&&(c[v]=3)}});const u=(N,j)=>N+" ".repeat(Math.max(0,j-N.length)),h=i[0],f=h.some(N=>N.isHeader);let m=` +`;const g=new Array(o).fill(0).map((N,j)=>f&&h[j]&&h[j].text||"");return m+=`| ${g.map((N,j)=>u(N,c[j])).join(" | ")} | +`,m+=`| ${c.map(N=>"-".repeat(Math.max(3,N))).join(" | ")} | +`,(f?i.slice(1):i).forEach(N=>{m+=`| ${new Array(o).fill(0).map((j,v)=>u(N[v]&&N[v].text||"",c[v])).join(" | ")} | +`}),m}var JF=GF,U3=Bn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:BF,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}=VF(t,this.options.cellMinWidth),i=e.style;function o(){return i||(r?`width: ${r}`:`min-width: ${a}`)}const c=["table",Jt(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)=>JF(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:a,editor:i})=>{const o=UF(i.schema,t,e,n);if(a){const c=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(ot.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>aF(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>iF(t,e),deleteColumn:()=>({state:t,dispatch:e})=>lF(t,e),addRowBefore:()=>({state:t,dispatch:e})=>dF(t,e),addRowAfter:()=>({state:t,dispatch:e})=>uF(t,e),deleteRow:()=>({state:t,dispatch:e})=>fF(t,e),deleteTable:()=>({state:t,dispatch:e})=>vF(t,e),mergeCells:()=>({state:t,dispatch:e})=>qw(t,e),splitCell:()=>({state:t,dispatch:e})=>Gw(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Vu("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Vu("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>yF(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>qw(t,e)?!0:Gw(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>gF(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Qw(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Qw(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&D3(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=un.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:bf,"Mod-Backspace":bf,Delete:bf,"Mod-Delete":bf}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[AF({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],FF({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:qt(st(t,"tableRole",e))}}});On.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(U3.configure(this.options.table)),this.options.tableCell!==!1&&t.push(B3.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(V3.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(H3.configure(this.options.tableRow)),t}});function QF(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function YF(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}function XF(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 ij(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 ZF=Bn.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 端全宽播放)"]]}}),eB=Bn.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",Jt(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 oj(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}const tB=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)=>`
    + @${oj(o.name)} + ${oj(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 nB(t){var r;const e=[],n=(r=t.clipboardData)==null?void 0:r.items;if(!n)return e;for(let a=0;a{const h=y.useRef(null),f=y.useRef(null),m=y.useRef(null),g=y.useRef(null),[b,N]=y.useState(""),[j,v]=y.useState(!1),k=y.useRef(ij(t)),T=y.useCallback((se,$)=>{var I;const ie=g.current;if(!ie||!n)return!1;const oe=nB($);if(oe.length>0)return $.preventDefault(),(async()=>{for(const Y of oe)try{const F=await n(Y);F&&ie.chain().focus().setImage({src:F}).run()}catch(F){console.error("粘贴图片上传失败",F)}})(),!0;const me=(I=$.clipboardData)==null?void 0:I.getData("text/html");if(me&&/data:image\/[^;"']+;base64,/i.test(me)){$.preventDefault();const{from:Y,to:F}=ie.state.selection;return(async()=>{try{const ge=await aB(me,n);ie.chain().focus().insertContentAt({from:Y,to:F},ge).run()}catch(ge){console.error("粘贴 HTML 内 base64 转换失败",ge)}})(),!0}return!1},[n]),C=K7({extensions:[Rz.configure({link:{openOnClick:!1,HTMLAttributes:{class:"rich-link"}}}),Dz.configure({inline:!0,allowBase64:!0,HTMLAttributes:{class:"rich-editor-img-thumb"}}),ZF,Vz.configure({HTMLAttributes:{class:"mention-tag"},suggestion:tB(a)}),eB,Hz.configure({placeholder:o}),U3.configure({resizable:!0}),H3,B3,V3],content:k.current,onUpdate:({editor:se})=>{e(se.getHTML())},editorProps:{attributes:{class:"rich-editor-content"},handlePaste:T}});y.useEffect(()=>{g.current=C??null},[C]),y.useImperativeHandle(u,()=>({getHTML:()=>(C==null?void 0:C.getHTML())||"",getMarkdown:()=>XF((C==null?void 0:C.getHTML())||"")})),y.useEffect(()=>{if(C&&t!==C.getHTML()){const se=ij(t);se!==C.getHTML()&&C.commands.setContent(se)}},[t]);const R=y.useCallback(async se=>{if(r)return r(se);if(n)return n(se);throw new Error("未配置上传")},[n,r]),O=y.useCallback(async se=>{var ie;const $=(ie=se.target.files)==null?void 0:ie[0];if(!(!$||!C)){if(n){const oe=await n($);oe&&C.chain().focus().setImage({src:oe}).run()}else{const oe=new FileReader;oe.onload=()=>{typeof oe.result=="string"&&C.chain().focus().setImage({src:oe.result}).run()},oe.readAsDataURL($)}se.target.value=""}},[C,n]),U=y.useCallback(async se=>{var ie;const $=(ie=se.target.files)==null?void 0:ie[0];if(!(!$||!C)){try{const oe=await R($);oe&&C.chain().focus().insertContent({type:"videoEmbed",attrs:{src:oe}}).run()}catch(oe){console.error(oe)}se.target.value=""}},[C,R]),P=y.useCallback(async se=>{var ie;const $=(ie=se.target.files)==null?void 0:ie[0];if(!(!$||!C)){try{const oe=await R($);if(!oe)return;const me=$.name||"附件";C.chain().focus().insertContent(`

    附件 ${QF(me)}

    `).run()}catch(oe){console.error(oe)}se.target.value=""}},[C,R]),z=y.useCallback(()=>{C&&C.chain().focus().insertContent("@").run()},[C]),L=y.useCallback(se=>{C&&C.chain().focus().insertContent([{type:"linkTag",attrs:{label:se.label,url:se.url||"",tagType:se.type||"url",tagId:se.id||"",pagePath:se.pagePath||"",appId:se.appId||"",mpKey:se.type==="miniprogram"&&se.appId||""}},{type:"text",text:" "}]).run()},[C]),Q=y.useCallback(()=>{!C||!b||(C.chain().focus().setLink({href:b}).run(),N(""),v(!1))},[C,b]);return C?s.jsxs("div",{className:`rich-editor-wrapper ${c||""}`,children:[s.jsxs("div",{className:"rich-editor-toolbar",children:[s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>C.chain().focus().toggleBold().run(),className:C.isActive("bold")?"is-active":"",type:"button",children:s.jsx(g5,{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(xM,{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(kA,{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(_5,{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(oM,{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(cM,{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(uM,{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(TM,{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(CM,{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(tA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().setHorizontalRule().run(),type:"button",children:s.jsx(FM,{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:U,className:"hidden"}),s.jsx("input",{ref:m,type:"file",onChange:P,className:"hidden"}),s.jsx("button",{onClick:()=>{var se;return(se=h.current)==null?void 0:se.click()},type:"button",title:"上传图片",children:s.jsx(nk,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>{var se;return(se=f.current)==null?void 0:se.click()},type:"button",title:"上传视频",disabled:!r&&!n,children:s.jsx(zA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>{var se;return(se=m.current)==null?void 0:se.click()},type:"button",title:"上传附件(生成下载链接)",disabled:!r&&!n,children:s.jsx(WM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:z,type:"button",title:"插入 @ 并选择人物",className:a.length?"mention-trigger-btn":"",disabled:a.length===0,children:s.jsx(f5,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>v(!j),className:C.isActive("link")?"is-active":"",type:"button",title:"链接",children:s.jsx(Ux,{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(RA,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().redo().run(),disabled:!C.can().redo(),type:"button",children:s.jsx(sA,{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:se=>{const $=i.find(ie=>ie.id===se.target.value);$&&L($),se.target.value=""},defaultValue:"",children:[s.jsx("option",{value:"",disabled:!0,children:"# 插入链接标签"}),i.map(se=>s.jsx("option",{value:se.id,children:se.label},se.id))]})})]})]}),j&&s.jsxs("div",{className:"link-input-bar",children:[s.jsx("input",{type:"url",placeholder:"输入链接地址...",value:b,onChange:se=>N(se.target.value),onKeyDown:se=>se.key==="Enter"&&Q(),className:"link-input"}),s.jsx("button",{onClick:Q,className:"link-confirm",type:"button",children:"确定"}),s.jsx("button",{onClick:()=>{C.chain().focus().unsetLink().run(),v(!1)},className:"link-remove",type:"button",children:"移除"})]}),s.jsx(t3,{editor:C})]}):null});_0.displayName="RichEditor";const iB=["top","right","bottom","left"],Ho=Math.min,kr=Math.max,Mp=Math.round,vf=Math.floor,Wa=t=>({x:t,y:t}),oB={left:"right",right:"left",bottom:"top",top:"bottom"},lB={start:"end",end:"start"};function $0(t,e,n){return kr(t,Ho(e,n))}function $i(t,e){return typeof t=="function"?t(e):t}function zi(t){return t.split("-")[0]}function bd(t){return t.split("-")[1]}function sb(t){return t==="x"?"y":"x"}function rb(t){return t==="y"?"height":"width"}const cB=new Set(["top","bottom"]);function Ua(t){return cB.has(zi(t))?"y":"x"}function ab(t){return sb(Ua(t))}function dB(t,e,n){n===void 0&&(n=!1);const r=bd(t),a=ab(t),i=rb(a);let o=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=Ap(o)),[o,Ap(o)]}function uB(t){const e=Ap(t);return[z0(t),e,z0(e)]}function z0(t){return t.replace(/start|end/g,e=>lB[e])}const lj=["left","right"],cj=["right","left"],hB=["top","bottom"],fB=["bottom","top"];function pB(t,e,n){switch(t){case"top":case"bottom":return n?e?cj:lj:e?lj:cj;case"left":case"right":return e?hB:fB;default:return[]}}function mB(t,e,n,r){const a=bd(t);let i=pB(zi(t),n==="start",r);return a&&(i=i.map(o=>o+"-"+a),e&&(i=i.concat(i.map(z0)))),i}function Ap(t){return t.replace(/left|right|bottom|top/g,e=>oB[e])}function gB(t){return{top:0,right:0,bottom:0,left:0,...t}}function W3(t){return typeof t!="number"?gB(t):{top:t,right:t,bottom:t,left:t}}function Ip(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 dj(t,e,n){let{reference:r,floating:a}=t;const i=Ua(e),o=ab(e),c=rb(o),u=zi(e),h=i==="y",f=r.x+r.width/2-a.width/2,m=r.y+r.height/2-a.height/2,g=r[c]/2-a[c]/2;let b;switch(u){case"top":b={x:f,y:r.y-a.height};break;case"bottom":b={x:f,y:r.y+r.height};break;case"right":b={x:r.x+r.width,y:m};break;case"left":b={x:r.x-a.width,y:m};break;default:b={x:r.x,y:r.y}}switch(bd(e)){case"start":b[o]-=g*(n&&h?-1:1);break;case"end":b[o]+=g*(n&&h?-1:1);break}return b}async function xB(t,e){var n;e===void 0&&(e={});const{x:r,y:a,platform:i,rects:o,elements:c,strategy:u}=t,{boundary:h="clippingAncestors",rootBoundary:f="viewport",elementContext:m="floating",altBoundary:g=!1,padding:b=0}=$i(e,t),N=W3(b),v=c[g?m==="floating"?"reference":"floating":m],k=Ip(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:h,rootBoundary:f,strategy:u})),T=m==="floating"?{x:r,y:a,width:o.floating.width,height:o.floating.height}:o.reference,C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),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},O=Ip(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:T,offsetParent:C,strategy:u}):T);return{top:(k.top-O.top+N.top)/R.y,bottom:(O.bottom-k.bottom+N.bottom)/R.y,left:(k.left-O.left+N.left)/R.x,right:(O.right-k.right+N.right)/R.x}}const yB=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}=dj(h,r,u),g=r,b={},N=0;for(let v=0;v({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:a,rects:i,platform:o,elements:c,middlewareData:u}=e,{element:h,padding:f=0}=$i(t,e)||{};if(h==null)return{};const m=W3(f),g={x:n,y:r},b=ab(a),N=rb(b),j=await o.getDimensions(h),v=b==="y",k=v?"top":"left",T=v?"bottom":"right",C=v?"clientHeight":"clientWidth",R=i.reference[N]+i.reference[b]-g[b]-i.floating[N],O=g[b]-i.reference[b],U=await(o.getOffsetParent==null?void 0:o.getOffsetParent(h));let P=U?U[C]:0;(!P||!await(o.isElement==null?void 0:o.isElement(U)))&&(P=c.floating[C]||i.floating[N]);const z=R/2-O/2,L=P/2-j[N]/2-1,Q=Ho(m[k],L),se=Ho(m[T],L),$=Q,ie=P-j[N]-se,oe=P/2-j[N]/2+z,me=$0($,oe,ie),I=!u.arrow&&bd(a)!=null&&oe!==me&&i.reference[N]/2-(oe<$?Q:se)-j[N]/2<0,Y=I?oe<$?oe-$:oe-ie:0;return{[b]:g[b]+Y,data:{[b]:me,centerOffset:oe-me-Y,...I&&{alignmentOffset:Y}},reset:I}}}),vB=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:a,middlewareData:i,rects:o,initialPlacement:c,platform:u,elements:h}=e,{mainAxis:f=!0,crossAxis:m=!0,fallbackPlacements:g,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:N="none",flipAlignment:j=!0,...v}=$i(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const k=zi(a),T=Ua(c),C=zi(c)===c,R=await(u.isRTL==null?void 0:u.isRTL(h.floating)),O=g||(C||!j?[Ap(c)]:uB(c)),U=N!=="none";!g&&U&&O.push(...mB(c,j,N,R));const P=[c,...O],z=await u.detectOverflow(e,v),L=[];let Q=((r=i.flip)==null?void 0:r.overflows)||[];if(f&&L.push(z[k]),m){const oe=dB(a,o,R);L.push(z[oe[0]],z[oe[1]])}if(Q=[...Q,{placement:a,overflows:L}],!L.every(oe=>oe<=0)){var se,$;const oe=(((se=i.flip)==null?void 0:se.index)||0)+1,me=P[oe];if(me&&(!(m==="alignment"?T!==Ua(me):!1)||Q.every(F=>Ua(F.placement)===T?F.overflows[0]>0:!0)))return{data:{index:oe,overflows:Q},reset:{placement:me}};let I=($=Q.filter(Y=>Y.overflows[0]<=0).sort((Y,F)=>Y.overflows[1]-F.overflows[1])[0])==null?void 0:$.placement;if(!I)switch(b){case"bestFit":{var ie;const Y=(ie=Q.filter(F=>{if(U){const ge=Ua(F.placement);return ge===T||ge==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(ge=>ge>0).reduce((ge,X)=>ge+X,0)]).sort((F,ge)=>F[1]-ge[1])[0])==null?void 0:ie[0];Y&&(I=Y);break}case"initialPlacement":I=c;break}if(a!==I)return{reset:{placement:I}}}return{}}}};function uj(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function hj(t){return iB.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}=$i(t,e);switch(a){case"referenceHidden":{const o=await r.detectOverflow(e,{...i,elementContext:"reference"}),c=uj(o,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:hj(c)}}}case"escaped":{const o=await r.detectOverflow(e,{...i,altBoundary:!0}),c=uj(o,n.floating);return{data:{escapedOffsets:c,escaped:hj(c)}}}default:return{}}}}},K3=new Set(["left","top"]);async function wB(t,e){const{placement:n,platform:r,elements:a}=t,i=await(r.isRTL==null?void 0:r.isRTL(a.floating)),o=zi(n),c=bd(n),u=Ua(n)==="y",h=K3.has(o)?-1:1,f=i&&u?-1:1,m=$i(e,t);let{mainAxis:g,crossAxis:b,alignmentAxis:N}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof N=="number"&&(b=c==="end"?N*-1:N),u?{x:b*f,y:g*h}:{x:g*h,y:b*f}}const jB=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 wB(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}}}}},kB=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:a,platform:i}=e,{mainAxis:o=!0,crossAxis:c=!1,limiter:u={fn:k=>{let{x:T,y:C}=k;return{x:T,y:C}}},...h}=$i(t,e),f={x:n,y:r},m=await i.detectOverflow(e,h),g=Ua(zi(a)),b=sb(g);let N=f[b],j=f[g];if(o){const k=b==="y"?"top":"left",T=b==="y"?"bottom":"right",C=N+m[k],R=N-m[T];N=$0(C,N,R)}if(c){const k=g==="y"?"top":"left",T=g==="y"?"bottom":"right",C=j+m[k],R=j-m[T];j=$0(C,j,R)}const v=u.fn({...e,[b]:N,[g]:j});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[b]:o,[g]:c}}}}}},SB=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}=$i(t,e),f={x:n,y:r},m=Ua(a),g=sb(m);let b=f[g],N=f[m];const j=$i(c,e),v=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(u){const C=g==="y"?"height":"width",R=i.reference[g]-i.floating[C]+v.mainAxis,O=i.reference[g]+i.reference[C]-v.mainAxis;bO&&(b=O)}if(h){var k,T;const C=g==="y"?"width":"height",R=K3.has(zi(a)),O=i.reference[m]-i.floating[C]+(R&&((k=o.offset)==null?void 0:k[m])||0)+(R?0:v.crossAxis),U=i.reference[m]+i.reference[C]+(R?0:((T=o.offset)==null?void 0:T[m])||0)-(R?v.crossAxis:0);NU&&(N=U)}return{[g]:b,[m]:N}}}},CB=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:a,rects:i,platform:o,elements:c}=e,{apply:u=()=>{},...h}=$i(t,e),f=await o.detectOverflow(e,h),m=zi(a),g=bd(a),b=Ua(a)==="y",{width:N,height:j}=i.floating;let v,k;m==="top"||m==="bottom"?(v=m,k=g===(await(o.isRTL==null?void 0:o.isRTL(c.floating))?"start":"end")?"left":"right"):(k=m,v=g==="end"?"top":"bottom");const T=j-f.top-f.bottom,C=N-f.left-f.right,R=Ho(j-f[v],T),O=Ho(N-f[k],C),U=!e.middlewareData.shift;let P=R,z=O;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(z=C),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(P=T),U&&!g){const Q=kr(f.left,0),se=kr(f.right,0),$=kr(f.top,0),ie=kr(f.bottom,0);b?z=N-2*(Q!==0||se!==0?Q+se:kr(f.left,f.right)):P=j-2*($!==0||ie!==0?$+ie:kr(f.top,f.bottom))}await u({...e,availableWidth:z,availableHeight:P});const L=await o.getDimensions(c.floating);return N!==L.width||j!==L.height?{reset:{rects:!0}}:{}}}};function im(){return typeof window<"u"}function vd(t){return q3(t)?(t.nodeName||"").toLowerCase():"#document"}function Tr(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Ya(t){var e;return(e=(q3(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function q3(t){return im()?t instanceof Node||t instanceof Tr(t).Node:!1}function ba(t){return im()?t instanceof Element||t instanceof Tr(t).Element:!1}function Ga(t){return im()?t instanceof HTMLElement||t instanceof Tr(t).HTMLElement:!1}function fj(t){return!im()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Tr(t).ShadowRoot}const EB=new Set(["inline","contents"]);function Xu(t){const{overflow:e,overflowX:n,overflowY:r,display:a}=va(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!EB.has(a)}const TB=new Set(["table","td","th"]);function MB(t){return TB.has(vd(t))}const AB=[":popover-open",":modal"];function om(t){return AB.some(e=>{try{return t.matches(e)}catch{return!1}})}const IB=["transform","translate","scale","rotate","perspective"],PB=["transform","translate","scale","rotate","perspective","filter"],RB=["paint","layout","strict","content"];function ib(t){const e=ob(),n=ba(t)?va(t):t;return IB.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))||RB.some(r=>(n.contain||"").includes(r))}function LB(t){let e=Uo(t);for(;Ga(e)&&!ud(e);){if(ib(e))return e;if(om(e))return null;e=Uo(e)}return null}function ob(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const OB=new Set(["html","body","#document"]);function ud(t){return OB.has(vd(t))}function va(t){return Tr(t).getComputedStyle(t)}function lm(t){return ba(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Uo(t){if(vd(t)==="html")return t;const e=t.assignedSlot||t.parentNode||fj(t)&&t.host||Ya(t);return fj(e)?e.host:e}function G3(t){const e=Uo(t);return ud(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ga(e)&&Xu(e)?e:G3(e)}function Hu(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const a=G3(t),i=a===((r=t.ownerDocument)==null?void 0:r.body),o=Tr(a);if(i){const c=F0(o);return e.concat(o,o.visualViewport||[],Xu(a)?a:[],c&&n?Hu(c):[])}return e.concat(a,Hu(a,[],n))}function F0(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function J3(t){const e=va(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const a=Ga(t),i=a?t.offsetWidth:n,o=a?t.offsetHeight:r,c=Mp(n)!==i||Mp(r)!==o;return c&&(n=i,r=o),{width:n,height:r,$:c}}function lb(t){return ba(t)?t:t.contextElement}function ed(t){const e=lb(t);if(!Ga(e))return Wa(1);const n=e.getBoundingClientRect(),{width:r,height:a,$:i}=J3(e);let o=(i?Mp(n.width):n.width)/r,c=(i?Mp(n.height):n.height)/a;return(!o||!Number.isFinite(o))&&(o=1),(!c||!Number.isFinite(c))&&(c=1),{x:o,y:c}}const DB=Wa(0);function Q3(t){const e=Tr(t);return!ob()||!e.visualViewport?DB:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function _B(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Tr(t)?!1:e}function Yl(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const a=t.getBoundingClientRect(),i=lb(t);let o=Wa(1);e&&(r?ba(r)&&(o=ed(r)):o=ed(t));const c=_B(i,n,r)?Q3(i):Wa(0);let u=(a.left+c.x)/o.x,h=(a.top+c.y)/o.y,f=a.width/o.x,m=a.height/o.y;if(i){const g=Tr(i),b=r&&ba(r)?Tr(r):r;let N=g,j=F0(N);for(;j&&r&&b!==N;){const v=ed(j),k=j.getBoundingClientRect(),T=va(j),C=k.left+(j.clientLeft+parseFloat(T.paddingLeft))*v.x,R=k.top+(j.clientTop+parseFloat(T.paddingTop))*v.y;u*=v.x,h*=v.y,f*=v.x,m*=v.y,u+=C,h+=R,N=Tr(j),j=F0(N)}}return Ip({width:f,height:m,x:u,y:h})}function cm(t,e){const n=lm(t).scrollLeft;return e?e.left+n:Yl(Ya(t)).left+n}function Y3(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-cm(t,n),a=n.top+e.scrollTop;return{x:r,y:a}}function $B(t){let{elements:e,rect:n,offsetParent:r,strategy:a}=t;const i=a==="fixed",o=Ya(r),c=e?om(e.floating):!1;if(r===o||c&&i)return n;let u={scrollLeft:0,scrollTop:0},h=Wa(1);const f=Wa(0),m=Ga(r);if((m||!m&&!i)&&((vd(r)!=="body"||Xu(o))&&(u=lm(r)),Ga(r))){const b=Yl(r);h=ed(r),f.x=b.x+r.clientLeft,f.y=b.y+r.clientTop}const g=o&&!m&&!i?Y3(o,u):Wa(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-u.scrollLeft*h.x+f.x+g.x,y:n.y*h.y-u.scrollTop*h.y+f.y+g.y}}function zB(t){return Array.from(t.getClientRects())}function FB(t){const e=Ya(t),n=lm(t),r=t.ownerDocument.body,a=kr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=kr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+cm(t);const c=-n.scrollTop;return va(r).direction==="rtl"&&(o+=kr(e.clientWidth,r.clientWidth)-a),{width:a,height:i,x:o,y:c}}const pj=25;function BB(t,e){const n=Tr(t),r=Ya(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=ob();(!f||f&&e==="fixed")&&(c=a.offsetLeft,u=a.offsetTop)}const h=cm(r);if(h<=0){const f=r.ownerDocument,m=f.body,g=getComputedStyle(m),b=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,N=Math.abs(r.clientWidth-m.clientWidth-b);N<=pj&&(i-=N)}else h<=pj&&(i+=h);return{width:i,height:o,x:c,y:u}}const VB=new Set(["absolute","fixed"]);function HB(t,e){const n=Yl(t,!0,e==="fixed"),r=n.top+t.clientTop,a=n.left+t.clientLeft,i=Ga(t)?ed(t):Wa(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 mj(t,e,n){let r;if(e==="viewport")r=BB(t,n);else if(e==="document")r=FB(Ya(t));else if(ba(e))r=HB(e,n);else{const a=Q3(t);r={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return Ip(r)}function X3(t,e){const n=Uo(t);return n===e||!ba(n)||ud(n)?!1:va(n).position==="fixed"||X3(n,e)}function UB(t,e){const n=e.get(t);if(n)return n;let r=Hu(t,[],!1).filter(c=>ba(c)&&vd(c)!=="body"),a=null;const i=va(t).position==="fixed";let o=i?Uo(t):t;for(;ba(o)&&!ud(o);){const c=va(o),u=ib(o);!u&&c.position==="fixed"&&(a=null),(i?!u&&!a:!u&&c.position==="static"&&!!a&&VB.has(a.position)||Xu(o)&&!u&&X3(t,o))?r=r.filter(f=>f!==o):a=c,o=Uo(o)}return e.set(t,r),r}function WB(t){let{element:e,boundary:n,rootBoundary:r,strategy:a}=t;const o=[...n==="clippingAncestors"?om(e)?[]:UB(e,this._c):[].concat(n),r],c=o[0],u=o.reduce((h,f)=>{const m=mj(e,f,a);return h.top=kr(m.top,h.top),h.right=Ho(m.right,h.right),h.bottom=Ho(m.bottom,h.bottom),h.left=kr(m.left,h.left),h},mj(e,c,a));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function KB(t){const{width:e,height:n}=J3(t);return{width:e,height:n}}function qB(t,e,n){const r=Ga(e),a=Ya(e),i=n==="fixed",o=Yl(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const u=Wa(0);function h(){u.x=cm(a)}if(r||!r&&!i)if((vd(e)!=="body"||Xu(a))&&(c=lm(e)),r){const b=Yl(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?Y3(a,c):Wa(0),m=o.left+c.scrollLeft-u.x-f.x,g=o.top+c.scrollTop-u.y-f.y;return{x:m,y:g,width:o.width,height:o.height}}function Tx(t){return va(t).position==="static"}function gj(t,e){if(!Ga(t)||va(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Ya(t)===n&&(n=n.ownerDocument.body),n}function Z3(t,e){const n=Tr(t);if(om(t))return n;if(!Ga(t)){let a=Uo(t);for(;a&&!ud(a);){if(ba(a)&&!Tx(a))return a;a=Uo(a)}return n}let r=gj(t,e);for(;r&&MB(r)&&Tx(r);)r=gj(r,e);return r&&ud(r)&&Tx(r)&&!ib(r)?n:r||LB(t)||n}const GB=async function(t){const e=this.getOffsetParent||Z3,n=this.getDimensions,r=await n(t.floating);return{reference:qB(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function JB(t){return va(t).direction==="rtl"}const QB={convertOffsetParentRelativeRectToViewportRelativeRect:$B,getDocumentElement:Ya,getClippingRect:WB,getOffsetParent:Z3,getElementRects:GB,getClientRects:zB,getDimensions:KB,getScale:ed,isElement:ba,isRTL:JB};function e4(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function YB(t,e){let n=null,r;const a=Ya(t);function i(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function o(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),i();const h=t.getBoundingClientRect(),{left:f,top:m,width:g,height:b}=h;if(c||e(),!g||!b)return;const N=vf(m),j=vf(a.clientWidth-(f+g)),v=vf(a.clientHeight-(m+b)),k=vf(f),C={rootMargin:-N+"px "+-j+"px "+-v+"px "+-k+"px",threshold:kr(0,Ho(1,u))||1};let R=!0;function O(U){const P=U[0].intersectionRatio;if(P!==u){if(!R)return o();P?o(!1,P):r=setTimeout(()=>{o(!1,1e-7)},1e3)}P===1&&!e4(h,t.getBoundingClientRect())&&o(),R=!1}try{n=new IntersectionObserver(O,{...C,root:a.ownerDocument})}catch{n=new IntersectionObserver(O,C)}n.observe(t)}return o(!0),i}function XB(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=lb(t),f=a||i?[...h?Hu(h):[],...Hu(e)]:[];f.forEach(k=>{a&&k.addEventListener("scroll",n,{passive:!0}),i&&k.addEventListener("resize",n)});const m=h&&c?YB(h,n):null;let g=-1,b=null;o&&(b=new ResizeObserver(k=>{let[T]=k;T&&T.target===h&&b&&(b.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var C;(C=b)==null||C.observe(e)})),n()}),h&&!u&&b.observe(h),b.observe(e));let N,j=u?Yl(t):null;u&&v();function v(){const k=Yl(t);j&&!e4(j,k)&&n(),j=k,N=requestAnimationFrame(v)}return n(),()=>{var k;f.forEach(T=>{a&&T.removeEventListener("scroll",n),i&&T.removeEventListener("resize",n)}),m==null||m(),(k=b)==null||k.disconnect(),b=null,u&&cancelAnimationFrame(N)}}const ZB=jB,e9=kB,t9=vB,n9=CB,s9=NB,xj=bB,r9=SB,a9=(t,e,n)=>{const r=new Map,a={platform:QB,...n},i={...a.platform,_c:r};return yB(t,e,{...a,platform:i})};var i9=typeof document<"u",o9=function(){},Af=i9?y.useLayoutEffect:o9;function Pp(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(!Pp(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)&&!Pp(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function t4(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function yj(t,e){const n=t4(t);return Math.round(e*n)/n}function Mx(t){const e=y.useRef(t);return Af(()=>{e.current=t}),e}function l9(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:i,floating:o}={},transform:c=!0,whileElementsMounted:u,open:h}=t,[f,m]=y.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[g,b]=y.useState(r);Pp(g,r)||b(r);const[N,j]=y.useState(null),[v,k]=y.useState(null),T=y.useCallback(F=>{F!==U.current&&(U.current=F,j(F))},[]),C=y.useCallback(F=>{F!==P.current&&(P.current=F,k(F))},[]),R=i||N,O=o||v,U=y.useRef(null),P=y.useRef(null),z=y.useRef(f),L=u!=null,Q=Mx(u),se=Mx(a),$=Mx(h),ie=y.useCallback(()=>{if(!U.current||!P.current)return;const F={placement:e,strategy:n,middleware:g};se.current&&(F.platform=se.current),a9(U.current,P.current,F).then(ge=>{const X={...ge,isPositioned:$.current!==!1};oe.current&&!Pp(z.current,X)&&(z.current=X,hd.flushSync(()=>{m(X)}))})},[g,e,n,se,$]);Af(()=>{h===!1&&z.current.isPositioned&&(z.current.isPositioned=!1,m(F=>({...F,isPositioned:!1})))},[h]);const oe=y.useRef(!1);Af(()=>(oe.current=!0,()=>{oe.current=!1}),[]),Af(()=>{if(R&&(U.current=R),O&&(P.current=O),R&&O){if(Q.current)return Q.current(R,O,ie);ie()}},[R,O,ie,Q,L]);const me=y.useMemo(()=>({reference:U,floating:P,setReference:T,setFloating:C}),[T,C]),I=y.useMemo(()=>({reference:R,floating:O}),[R,O]),Y=y.useMemo(()=>{const F={position:n,left:0,top:0};if(!I.floating)return F;const ge=yj(I.floating,f.x),X=yj(I.floating,f.y);return c?{...F,transform:"translate("+ge+"px, "+X+"px)",...t4(I.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ge,top:X}},[n,c,I.floating,f.x,f.y]);return y.useMemo(()=>({...f,update:ie,refs:me,elements:I,floatingStyles:Y}),[f,ie,me,I,Y])}const c9=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?xj({element:r.current,padding:a}).fn(n):{}:r?xj({element:r,padding:a}).fn(n):{}}}},d9=(t,e)=>({...ZB(t),options:[t,e]}),u9=(t,e)=>({...e9(t),options:[t,e]}),h9=(t,e)=>({...r9(t),options:[t,e]}),f9=(t,e)=>({...t9(t),options:[t,e]}),p9=(t,e)=>({...n9(t),options:[t,e]}),m9=(t,e)=>({...s9(t),options:[t,e]}),g9=(t,e)=>({...c9(t),options:[t,e]});var x9="Arrow",n4=y.forwardRef((t,e)=>{const{children:n,width:r=10,height:a=5,...i}=t;return s.jsx(Et.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"})})});n4.displayName=x9;var y9=n4,cb="Popper",[s4,r4]=qo(cb),[b9,a4]=s4(cb),i4=t=>{const{__scopePopper:e,children:n}=t,[r,a]=y.useState(null);return s.jsx(b9,{scope:e,anchor:r,onAnchorChange:a,children:n})};i4.displayName=cb;var o4="PopperAnchor",l4=y.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...a}=t,i=a4(o4,n),o=y.useRef(null),c=Qt(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(Et.div,{...a,ref:c})});l4.displayName=o4;var db="PopperContent",[v9,N9]=s4(db),c4=y.forwardRef((t,e)=>{var q,_,Z,re,we,Fe;const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:i="center",alignOffset:o=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:h=[],collisionPadding:f=0,sticky:m="partial",hideWhenDetached:g=!1,updatePositionStrategy:b="optimized",onPlaced:N,...j}=t,v=a4(db,n),[k,T]=y.useState(null),C=Qt(e,Ue=>T(Ue)),[R,O]=y.useState(null),U=uy(R),P=(U==null?void 0:U.width)??0,z=(U==null?void 0:U.height)??0,L=r+(i!=="center"?"-"+i:""),Q=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},se=Array.isArray(h)?h:[h],$=se.length>0,ie={padding:Q,boundary:se.filter(j9),altBoundary:$},{refs:oe,floatingStyles:me,placement:I,isPositioned:Y,middlewareData:F}=l9({strategy:"fixed",placement:L,whileElementsMounted:(...Ue)=>XB(...Ue,{animationFrame:b==="always"}),elements:{reference:v.anchor},middleware:[d9({mainAxis:a+z,alignmentAxis:o}),u&&u9({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?h9():void 0,...ie}),u&&f9({...ie}),p9({...ie,apply:({elements:Ue,rects:wt,availableWidth:jn,availableHeight:pt})=>{const{width:At,height:fn}=wt.reference,Vn=Ue.floating.style;Vn.setProperty("--radix-popper-available-width",`${jn}px`),Vn.setProperty("--radix-popper-available-height",`${pt}px`),Vn.setProperty("--radix-popper-anchor-width",`${At}px`),Vn.setProperty("--radix-popper-anchor-height",`${fn}px`)}}),R&&g9({element:R,padding:c}),k9({arrowWidth:P,arrowHeight:z}),g&&m9({strategy:"referenceHidden",...ie})]}),[ge,X]=h4(I),V=Fo(N);_s(()=>{Y&&(V==null||V())},[Y,V]);const W=(q=F.arrow)==null?void 0:q.x,fe=(_=F.arrow)==null?void 0:_.y,he=((Z=F.arrow)==null?void 0:Z.centerOffset)!==0,[de,D]=y.useState();return _s(()=>{k&&D(window.getComputedStyle(k).zIndex)},[k]),s.jsx("div",{ref:oe.setFloating,"data-radix-popper-content-wrapper":"",style:{...me,transform:Y?me.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:de,"--radix-popper-transform-origin":[(re=F.transformOrigin)==null?void 0:re.x,(we=F.transformOrigin)==null?void 0:we.y].join(" "),...((Fe=F.hide)==null?void 0:Fe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:s.jsx(v9,{scope:n,placedSide:ge,onArrowChange:O,arrowX:W,arrowY:fe,shouldHideArrow:he,children:s.jsx(Et.div,{"data-side":ge,"data-align":X,...j,ref:C,style:{...j.style,animation:Y?void 0:"none"}})})})});c4.displayName=db;var d4="PopperArrow",w9={top:"bottom",right:"left",bottom:"top",left:"right"},u4=y.forwardRef(function(e,n){const{__scopePopper:r,...a}=e,i=N9(d4,r),o=w9[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(y9,{...a,ref:n,style:{...a.style,display:"block"}})})});u4.displayName=d4;function j9(t){return t!==null}var k9=t=>({name:"transformOrigin",options:t,fn(e){var v,k,T;const{placement:n,rects:r,middlewareData:a}=e,o=((v=a.arrow)==null?void 0:v.centerOffset)!==0,c=o?0:t.arrowWidth,u=o?0:t.arrowHeight,[h,f]=h4(n),m={start:"0%",center:"50%",end:"100%"}[f],g=(((k=a.arrow)==null?void 0:k.x)??0)+c/2,b=(((T=a.arrow)==null?void 0:T.y)??0)+u/2;let N="",j="";return h==="bottom"?(N=o?m:`${g}px`,j=`${-u}px`):h==="top"?(N=o?m:`${g}px`,j=`${r.floating.height+u}px`):h==="right"?(N=`${-u}px`,j=o?m:`${b}px`):h==="left"&&(N=`${r.floating.width+u}px`,j=o?m:`${b}px`),{data:{x:N,y:j}}}});function h4(t){const[e,n="center"]=t.split("-");return[e,n]}var S9=i4,C9=l4,E9=c4,T9=u4,f4=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"}),M9="VisuallyHidden",A9=y.forwardRef((t,e)=>s.jsx(Et.span,{...t,ref:e,style:{...f4,...t.style}}));A9.displayName=M9;var I9=[" ","Enter","ArrowUp","ArrowDown"],P9=[" ","Enter"],Xl="Select",[dm,um,R9]=ly(Xl),[Nd]=qo(Xl,[R9,r4]),hm=r4(),[L9,Xo]=Nd(Xl),[O9,D9]=Nd(Xl),p4=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:a,onOpenChange:i,value:o,defaultValue:c,onValueChange:u,dir:h,name:f,autoComplete:m,disabled:g,required:b,form:N}=t,j=hm(e),[v,k]=y.useState(null),[T,C]=y.useState(null),[R,O]=y.useState(!1),U=Fp(h),[P,z]=Fl({prop:r,defaultProp:a??!1,onChange:i,caller:Xl}),[L,Q]=Fl({prop:o,defaultProp:c,onChange:u,caller:Xl}),se=y.useRef(null),$=v?N||!!v.closest("form"):!0,[ie,oe]=y.useState(new Set),me=Array.from(ie).map(I=>I.props.value).join(";");return s.jsx(S9,{...j,children:s.jsxs(L9,{required:b,scope:e,trigger:v,onTriggerChange:k,valueNode:T,onValueNodeChange:C,valueNodeHasChildren:R,onValueNodeHasChildrenChange:O,contentId:Ro(),value:L,onValueChange:Q,open:P,onOpenChange:z,dir:U,triggerPointerDownPosRef:se,disabled:g,children:[s.jsx(dm.Provider,{scope:e,children:s.jsx(O9,{scope:t.__scopeSelect,onNativeOptionAdd:y.useCallback(I=>{oe(Y=>new Set(Y).add(I))},[]),onNativeOptionRemove:y.useCallback(I=>{oe(Y=>{const F=new Set(Y);return F.delete(I),F})},[]),children:n})}),$?s.jsxs(D4,{"aria-hidden":!0,required:b,tabIndex:-1,name:f,autoComplete:m,value:L,onChange:I=>Q(I.target.value),disabled:g,form:N,children:[L===void 0?s.jsx("option",{value:""}):null,Array.from(ie)]},me):null]})})};p4.displayName=Xl;var m4="SelectTrigger",g4=y.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...a}=t,i=hm(n),o=Xo(m4,n),c=o.disabled||r,u=Qt(e,o.onTriggerChange),h=um(n),f=y.useRef("touch"),[m,g,b]=$4(j=>{const v=h().filter(C=>!C.disabled),k=v.find(C=>C.value===o.value),T=z4(v,j,k);T!==void 0&&o.onValueChange(T.value)}),N=j=>{c||(o.onOpenChange(!0),b()),j&&(o.triggerPointerDownPosRef.current={x:Math.round(j.pageX),y:Math.round(j.pageY)})};return s.jsx(C9,{asChild:!0,...i,children:s.jsx(Et.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":_4(o.value)?"":void 0,...a,ref:u,onClick:jt(a.onClick,j=>{j.currentTarget.focus(),f.current!=="mouse"&&N(j)}),onPointerDown:jt(a.onPointerDown,j=>{f.current=j.pointerType;const v=j.target;v.hasPointerCapture(j.pointerId)&&v.releasePointerCapture(j.pointerId),j.button===0&&j.ctrlKey===!1&&j.pointerType==="mouse"&&(N(j),j.preventDefault())}),onKeyDown:jt(a.onKeyDown,j=>{const v=m.current!=="";!(j.ctrlKey||j.altKey||j.metaKey)&&j.key.length===1&&g(j.key),!(v&&j.key===" ")&&I9.includes(j.key)&&(N(),j.preventDefault())})})})});g4.displayName=m4;var x4="SelectValue",y4=y.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,children:i,placeholder:o="",...c}=t,u=Xo(x4,n),{onValueNodeHasChildrenChange:h}=u,f=i!==void 0,m=Qt(e,u.onValueNodeChange);return _s(()=>{h(f)},[h,f]),s.jsx(Et.span,{...c,ref:m,style:{pointerEvents:"none"},children:_4(u.value)?s.jsx(s.Fragment,{children:o}):i})});y4.displayName=x4;var _9="SelectIcon",b4=y.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...a}=t;return s.jsx(Et.span,{"aria-hidden":!0,...a,ref:e,children:r||"▼"})});b4.displayName=_9;var $9="SelectPortal",v4=t=>s.jsx(sy,{asChild:!0,...t});v4.displayName=$9;var Zl="SelectContent",N4=y.forwardRef((t,e)=>{const n=Xo(Zl,t.__scopeSelect),[r,a]=y.useState();if(_s(()=>{a(new DocumentFragment)},[]),!n.open){const i=r;return i?hd.createPortal(s.jsx(w4,{scope:t.__scopeSelect,children:s.jsx(dm.Slot,{scope:t.__scopeSelect,children:s.jsx("div",{children:t.children})})}),i):null}return s.jsx(j4,{...t,ref:e})});N4.displayName=Zl;var fa=10,[w4,Zo]=Nd(Zl),z9="SelectContentImpl",F9=Au("SelectContent.RemoveScroll"),j4=y.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:i,onPointerDownOutside:o,side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:b,sticky:N,hideWhenDetached:j,avoidCollisions:v,...k}=t,T=Xo(Zl,n),[C,R]=y.useState(null),[O,U]=y.useState(null),P=Qt(e,q=>R(q)),[z,L]=y.useState(null),[Q,se]=y.useState(null),$=um(n),[ie,oe]=y.useState(!1),me=y.useRef(!1);y.useEffect(()=>{if(C)return Dk(C)},[C]),Ek();const I=y.useCallback(q=>{const[_,...Z]=$().map(Fe=>Fe.ref.current),[re]=Z.slice(-1),we=document.activeElement;for(const Fe of q)if(Fe===we||(Fe==null||Fe.scrollIntoView({block:"nearest"}),Fe===_&&O&&(O.scrollTop=0),Fe===re&&O&&(O.scrollTop=O.scrollHeight),Fe==null||Fe.focus(),document.activeElement!==we))return},[$,O]),Y=y.useCallback(()=>I([z,C]),[I,z,C]);y.useEffect(()=>{ie&&Y()},[ie,Y]);const{onOpenChange:F,triggerPointerDownPosRef:ge}=T;y.useEffect(()=>{if(C){let q={x:0,y:0};const _=re=>{var we,Fe;q={x:Math.abs(Math.round(re.pageX)-(((we=ge.current)==null?void 0:we.x)??0)),y:Math.abs(Math.round(re.pageY)-(((Fe=ge.current)==null?void 0:Fe.y)??0))}},Z=re=>{q.x<=10&&q.y<=10?re.preventDefault():C.contains(re.target)||F(!1),document.removeEventListener("pointermove",_),ge.current=null};return ge.current!==null&&(document.addEventListener("pointermove",_),document.addEventListener("pointerup",Z,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",_),document.removeEventListener("pointerup",Z,{capture:!0})}}},[C,F,ge]),y.useEffect(()=>{const q=()=>F(!1);return window.addEventListener("blur",q),window.addEventListener("resize",q),()=>{window.removeEventListener("blur",q),window.removeEventListener("resize",q)}},[F]);const[X,V]=$4(q=>{const _=$().filter(we=>!we.disabled),Z=_.find(we=>we.ref.current===document.activeElement),re=z4(_,q,Z);re&&setTimeout(()=>re.ref.current.focus())}),W=y.useCallback((q,_,Z)=>{const re=!me.current&&!Z;(T.value!==void 0&&T.value===_||re)&&(L(q),re&&(me.current=!0))},[T.value]),fe=y.useCallback(()=>C==null?void 0:C.focus(),[C]),he=y.useCallback((q,_,Z)=>{const re=!me.current&&!Z;(T.value!==void 0&&T.value===_||re)&&se(q)},[T.value]),de=r==="popper"?B0:k4,D=de===B0?{side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:g,collisionPadding:b,sticky:N,hideWhenDetached:j,avoidCollisions:v}:{};return s.jsx(w4,{scope:n,content:C,viewport:O,onViewportChange:U,itemRefCallback:W,selectedItem:z,onItemLeave:fe,itemTextRefCallback:he,focusSelectedItem:Y,selectedItemText:Q,position:r,isPositioned:ie,searchRef:X,children:s.jsx(ry,{as:F9,allowPinchZoom:!0,children:s.jsx(ny,{asChild:!0,trapped:T.open,onMountAutoFocus:q=>{q.preventDefault()},onUnmountAutoFocus:jt(a,q=>{var _;(_=T.trigger)==null||_.focus({preventScroll:!0}),q.preventDefault()}),children:s.jsx(ty,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:q=>q.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:s.jsx(de,{role:"listbox",id:T.contentId,"data-state":T.open?"open":"closed",dir:T.dir,onContextMenu:q=>q.preventDefault(),...k,...D,onPlaced:()=>oe(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:jt(k.onKeyDown,q=>{const _=q.ctrlKey||q.altKey||q.metaKey;if(q.key==="Tab"&&q.preventDefault(),!_&&q.key.length===1&&V(q.key),["ArrowUp","ArrowDown","Home","End"].includes(q.key)){let re=$().filter(we=>!we.disabled).map(we=>we.ref.current);if(["ArrowUp","End"].includes(q.key)&&(re=re.slice().reverse()),["ArrowUp","ArrowDown"].includes(q.key)){const we=q.target,Fe=re.indexOf(we);re=re.slice(Fe+1)}setTimeout(()=>I(re)),q.preventDefault()}})})})})})})});j4.displayName=z9;var B9="SelectItemAlignedPosition",k4=y.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...a}=t,i=Xo(Zl,n),o=Zo(Zl,n),[c,u]=y.useState(null),[h,f]=y.useState(null),m=Qt(e,P=>f(P)),g=um(n),b=y.useRef(!1),N=y.useRef(!0),{viewport:j,selectedItem:v,selectedItemText:k,focusSelectedItem:T}=o,C=y.useCallback(()=>{if(i.trigger&&i.valueNode&&c&&h&&j&&v&&k){const P=i.trigger.getBoundingClientRect(),z=h.getBoundingClientRect(),L=i.valueNode.getBoundingClientRect(),Q=k.getBoundingClientRect();if(i.dir!=="rtl"){const we=Q.left-z.left,Fe=L.left-we,Ue=P.left-Fe,wt=P.width+Ue,jn=Math.max(wt,z.width),pt=window.innerWidth-fa,At=zf(Fe,[fa,Math.max(fa,pt-jn)]);c.style.minWidth=wt+"px",c.style.left=At+"px"}else{const we=z.right-Q.right,Fe=window.innerWidth-L.right-we,Ue=window.innerWidth-P.right-Fe,wt=P.width+Ue,jn=Math.max(wt,z.width),pt=window.innerWidth-fa,At=zf(Fe,[fa,Math.max(fa,pt-jn)]);c.style.minWidth=wt+"px",c.style.right=At+"px"}const se=g(),$=window.innerHeight-fa*2,ie=j.scrollHeight,oe=window.getComputedStyle(h),me=parseInt(oe.borderTopWidth,10),I=parseInt(oe.paddingTop,10),Y=parseInt(oe.borderBottomWidth,10),F=parseInt(oe.paddingBottom,10),ge=me+I+ie+F+Y,X=Math.min(v.offsetHeight*5,ge),V=window.getComputedStyle(j),W=parseInt(V.paddingTop,10),fe=parseInt(V.paddingBottom,10),he=P.top+P.height/2-fa,de=$-he,D=v.offsetHeight/2,q=v.offsetTop+D,_=me+I+q,Z=ge-_;if(_<=he){const we=se.length>0&&v===se[se.length-1].ref.current;c.style.bottom="0px";const Fe=h.clientHeight-j.offsetTop-j.offsetHeight,Ue=Math.max(de,D+(we?fe:0)+Fe+Y),wt=_+Ue;c.style.height=wt+"px"}else{const we=se.length>0&&v===se[0].ref.current;c.style.top="0px";const Ue=Math.max(he,me+j.offsetTop+(we?W:0)+D)+Z;c.style.height=Ue+"px",j.scrollTop=_-he+j.offsetTop}c.style.margin=`${fa}px 0`,c.style.minHeight=X+"px",c.style.maxHeight=$+"px",r==null||r(),requestAnimationFrame(()=>b.current=!0)}},[g,i.trigger,i.valueNode,c,h,j,v,k,i.dir,r]);_s(()=>C(),[C]);const[R,O]=y.useState();_s(()=>{h&&O(window.getComputedStyle(h).zIndex)},[h]);const U=y.useCallback(P=>{P&&N.current===!0&&(C(),T==null||T(),N.current=!1)},[C,T]);return s.jsx(H9,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:b,onScrollButtonChange:U,children:s.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:R},children:s.jsx(Et.div,{...a,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});k4.displayName=B9;var V9="SelectPopperPosition",B0=y.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=fa,...i}=t,o=hm(n);return s.jsx(E9,{...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)"}})});B0.displayName=V9;var[H9,ub]=Nd(Zl,{}),V0="SelectViewport",S4=y.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...a}=t,i=Zo(V0,n),o=ub(V0,n),c=Qt(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(dm.Slot,{scope:n,children:s.jsx(Et.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:jt(a.onScroll,h=>{const f=h.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:g}=o;if(g!=null&&g.current&&m){const b=Math.abs(u.current-f.scrollTop);if(b>0){const N=window.innerHeight-fa*2,j=parseFloat(m.style.minHeight),v=parseFloat(m.style.height),k=Math.max(j,v);if(k0?R:0,m.style.justifyContent="flex-end")}}}u.current=f.scrollTop})})})]})});S4.displayName=V0;var C4="SelectGroup",[U9,W9]=Nd(C4),K9=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=Ro();return s.jsx(U9,{scope:n,id:a,children:s.jsx(Et.div,{role:"group","aria-labelledby":a,...r,ref:e})})});K9.displayName=C4;var E4="SelectLabel",q9=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=W9(E4,n);return s.jsx(Et.div,{id:a.id,...r,ref:e})});q9.displayName=E4;var Rp="SelectItem",[G9,T4]=Nd(Rp),M4=y.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:i,...o}=t,c=Xo(Rp,n),u=Zo(Rp,n),h=c.value===r,[f,m]=y.useState(i??""),[g,b]=y.useState(!1),N=Qt(e,T=>{var C;return(C=u.itemRefCallback)==null?void 0:C.call(u,T,r,a)}),j=Ro(),v=y.useRef("touch"),k=()=>{a||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return s.jsx(G9,{scope:n,value:r,disabled:a,textId:j,isSelected:h,onItemTextChange:y.useCallback(T=>{m(C=>C||((T==null?void 0:T.textContent)??"").trim())},[]),children:s.jsx(dm.ItemSlot,{scope:n,value:r,disabled:a,textValue:f,children:s.jsx(Et.div,{role:"option","aria-labelledby":j,"data-highlighted":g?"":void 0,"aria-selected":h&&g,"data-state":h?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...o,ref:N,onFocus:jt(o.onFocus,()=>b(!0)),onBlur:jt(o.onBlur,()=>b(!1)),onClick:jt(o.onClick,()=>{v.current!=="mouse"&&k()}),onPointerUp:jt(o.onPointerUp,()=>{v.current==="mouse"&&k()}),onPointerDown:jt(o.onPointerDown,T=>{v.current=T.pointerType}),onPointerMove:jt(o.onPointerMove,T=>{var C;v.current=T.pointerType,a?(C=u.onItemLeave)==null||C.call(u):v.current==="mouse"&&T.currentTarget.focus({preventScroll:!0})}),onPointerLeave:jt(o.onPointerLeave,T=>{var C;T.currentTarget===document.activeElement&&((C=u.onItemLeave)==null||C.call(u))}),onKeyDown:jt(o.onKeyDown,T=>{var R;((R=u.searchRef)==null?void 0:R.current)!==""&&T.key===" "||(P9.includes(T.key)&&k(),T.key===" "&&T.preventDefault())})})})})});M4.displayName=Rp;var fu="SelectItemText",A4=y.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,...i}=t,o=Xo(fu,n),c=Zo(fu,n),u=T4(fu,n),h=D9(fu,n),[f,m]=y.useState(null),g=Qt(e,k=>m(k),u.onItemTextChange,k=>{var T;return(T=c.itemTextRefCallback)==null?void 0:T.call(c,k,u.value,u.disabled)}),b=f==null?void 0:f.textContent,N=y.useMemo(()=>s.jsx("option",{value:u.value,disabled:u.disabled,children:b},u.value),[u.disabled,u.value,b]),{onNativeOptionAdd:j,onNativeOptionRemove:v}=h;return _s(()=>(j(N),()=>v(N)),[j,v,N]),s.jsxs(s.Fragment,{children:[s.jsx(Et.span,{id:u.textId,...i,ref:g}),u.isSelected&&o.valueNode&&!o.valueNodeHasChildren?hd.createPortal(i.children,o.valueNode):null]})});A4.displayName=fu;var I4="SelectItemIndicator",P4=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return T4(I4,n).isSelected?s.jsx(Et.span,{"aria-hidden":!0,...r,ref:e}):null});P4.displayName=I4;var H0="SelectScrollUpButton",R4=y.forwardRef((t,e)=>{const n=Zo(H0,t.__scopeSelect),r=ub(H0,t.__scopeSelect),[a,i]=y.useState(!1),o=Qt(e,r.onScrollButtonChange);return _s(()=>{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(O4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});R4.displayName=H0;var U0="SelectScrollDownButton",L4=y.forwardRef((t,e)=>{const n=Zo(U0,t.__scopeSelect),r=ub(U0,t.__scopeSelect),[a,i]=y.useState(!1),o=Qt(e,r.onScrollButtonChange);return _s(()=>{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(O4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});L4.displayName=U0;var O4=y.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=t,i=Zo("SelectScrollButton",n),o=y.useRef(null),c=um(n),u=y.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return y.useEffect(()=>()=>u(),[u]),_s(()=>{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(Et.div,{"aria-hidden":!0,...a,ref:e,style:{flexShrink:0,...a.style},onPointerDown:jt(a.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:jt(a.onPointerMove,()=>{var h;(h=i.onItemLeave)==null||h.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:jt(a.onPointerLeave,()=>{u()})})}),J9="SelectSeparator",Q9=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return s.jsx(Et.div,{"aria-hidden":!0,...r,ref:e})});Q9.displayName=J9;var W0="SelectArrow",Y9=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=hm(n),i=Xo(W0,n),o=Zo(W0,n);return i.open&&o.position==="popper"?s.jsx(T9,{...a,...r,ref:e}):null});Y9.displayName=W0;var X9="SelectBubbleInput",D4=y.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const a=y.useRef(null),i=Qt(r,a),o=dy(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(Et.select,{...n,style:{...f4,...n.style},ref:i,defaultValue:e})});D4.displayName=X9;function _4(t){return t===""||t===void 0}function $4(t){const e=Fo(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 z4(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=Z9(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 Z9(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var eV=p4,F4=g4,tV=y4,nV=b4,sV=v4,B4=N4,rV=S4,V4=M4,aV=A4,iV=P4,oV=R4,lV=L4;const ko=eV,So=tV,Ai=y.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(F4,{ref:r,className:zt("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(nV,{asChild:!0,children:s.jsx(_l,{className:"h-4 w-4 opacity-50"})})]}));Ai.displayName=F4.displayName;const Ii=y.forwardRef(({className:t,children:e,position:n="popper",...r},a)=>s.jsx(sV,{children:s.jsxs(B4,{ref:a,className:zt("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(oV,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(zx,{className:"h-4 w-4"})}),s.jsx(rV,{className:"p-1",children:e}),s.jsx(lV,{className:"flex cursor-default items-center justify-center py-1",children:s.jsx(_l,{className:"h-4 w-4"})})]})}));Ii.displayName=B4.displayName;const us=y.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(V4,{ref:r,className:zt("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(iV,{children:s.jsx(Dp,{className:"h-4 w-4"})})}),s.jsx(aV,{children:e})]}));us.displayName=V4.displayName;const bj=["📖","📕","📗","📘","📙","📓","📔","📒","📚","📖"];function cV(t){return t.title==="序言"||t.title.includes("序言")}function vj(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 Ax(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 dV({parts:t,expandedParts:e,onTogglePart:n,onReorder:r,onReadSection:a,onDeleteSection:i,onAddSectionInPart:o,onAddChapterInPart:c,onDeleteChapter:u,onEditPart:h,onDeletePart:f,onEditChapter:m,selectedSectionIds:g=[],onToggleSectionSelect:b,onShowSectionOrders:N,pinnedSectionIds:j=[]}){const[v,k]=y.useState(null),[T,C]=y.useState(null),R=($,ie)=>(v==null?void 0:v.type)===$&&(v==null?void 0:v.id)===ie,O=($,ie)=>(T==null?void 0:T.type)===$&&(T==null?void 0:T.id)===ie,U=y.useCallback(()=>{const $=[];for(const ie of t)for(const oe of ie.chapters)for(const me of oe.sections)$.push({id:me.id,partId:ie.id,partTitle:ie.title,chapterId:oe.id,chapterTitle:oe.title});return $},[t]),P=y.useCallback(async($,ie,oe,me)=>{var X;$.preventDefault(),$.stopPropagation();const I=$.dataTransfer.getData("text/plain"),Y=Ax(I);if(!Y||Y.type===ie&&Y.id===oe)return;const F=U(),ge=new Map(F.map(V=>[V.id,V]));if(Y.type==="part"&&ie==="part"){const V=t.map(D=>D.id),W=V.indexOf(Y.id),fe=V.indexOf(oe);if(W===-1||fe===-1)return;const he=[...V];he.splice(W,1),he.splice(W_.id===D);if(q)for(const _ of q.chapters)for(const Z of _.sections){const re=ge.get(Z.id);re&&de.push(re)}}await r(de);return}if(Y.type==="chapter"&&(ie==="chapter"||ie==="section"||ie==="part")){const V=t.find(re=>re.chapters.some(we=>we.id===Y.id)),W=V==null?void 0:V.chapters.find(re=>re.id===Y.id);if(!V||!W)return;let fe,he,de=null;if(ie==="section"){const re=ge.get(oe);if(!re)return;fe=re.partId,he=re.partTitle,de=oe}else if(ie==="chapter"){const re=t.find(Ue=>Ue.chapters.some(wt=>wt.id===oe)),we=re==null?void 0:re.chapters.find(Ue=>Ue.id===oe);if(!re||!we)return;fe=re.id,he=re.title;const Fe=F.filter(Ue=>Ue.chapterId===oe).pop();de=(Fe==null?void 0:Fe.id)??null}else{const re=t.find(we=>we.id===oe);if(!re)return;if(fe=re.id,he=re.title,re.chapters[0]){const we=F.filter(Fe=>Fe.partId===re.id&&Fe.chapterId===re.chapters[0].id);de=((X=we[we.length-1])==null?void 0:X.id)??null}}const D=W.sections.map(re=>re.id),q=F.filter(re=>!D.includes(re.id));let _=q.length;if(de){const re=q.findIndex(we=>we.id===de);re>=0&&(_=re+1)}const Z=D.map(re=>({...ge.get(re),partId:fe,partTitle:he,chapterId:W.id,chapterTitle:W.title}));await r([...q.slice(0,_),...Z,...q.slice(_)]);return}if(Y.type==="section"&&(ie==="section"||ie==="chapter"||ie==="part")){if(!me)return;const{partId:V,partTitle:W,chapterId:fe,chapterTitle:he}=me,de=F.findIndex(re=>re.id===Y.id);if(de===-1)return;const D=F.filter(re=>re.id!==Y.id);let q;if(ie==="section"){const re=D.findIndex(we=>we.id===oe);q=re>=0?re+1:D.length}else if(ie==="chapter"){const re=D.filter(we=>we.chapterId===oe).pop();q=re?D.findIndex(we=>we.id===re.id)+1:D.length}else{const re=t.find(we=>we.id===oe);if(re!=null&&re.chapters[0]){const we=D.filter(Ue=>Ue.partId===re.id&&Ue.chapterId===re.chapters[0].id),Fe=we[we.length-1];q=Fe?D.findIndex(Ue=>Ue.id===Fe.id)+1:D.length}else q=D.length}const Z={...F[de],partId:V,partTitle:W,chapterId:fe,chapterTitle:he};D.splice(q,0,Z),await r(D)}},[t,U,r]),z=($,ie,oe)=>({onDragEnter:me=>{me.preventDefault(),me.stopPropagation(),me.dataTransfer.dropEffect="move",C({type:$,id:ie})},onDragOver:me=>{me.preventDefault(),me.stopPropagation(),me.dataTransfer.dropEffect="move",C({type:$,id:ie})},onDragLeave:()=>C(null),onDrop:me=>{C(null);const I=Ax(me.dataTransfer.getData("text/plain"));I&&($==="section"&&I.type==="section"&&I.id===ie||($==="part"?I.type==="part"?P(me,"part",ie):oe&&P(me,"part",ie,oe):$==="chapter"&&oe?(I.type==="section"||I.type==="chapter")&&P(me,"chapter",ie,oe):$==="section"&&oe&&P(me,"section",ie,oe)))}}),L=$=>bj[$%bj.length],Q=$=>t.slice(0,$).filter(ie=>!cV(ie)).length,se=$=>s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-gray-500 font-mono text-xs tabular-nums shrink-0 mr-1.5 max-w-[72px] truncate",title:`章节ID: ${$.id}`,children:$.id}),s.jsx("span",{className:"truncate",children:$.title})]});return s.jsx("div",{className:"space-y-3",children:t.map(($,ie)=>{var W,fe,he,de;const oe=$.title==="序言"||$.title.includes("序言"),me=$.title==="尾声"||$.title.includes("尾声"),I=$.title==="附录"||$.title.includes("附录"),Y=O("part",$.id),F=e.includes($.id),ge=$.chapters.length,X=$.chapters.reduce((D,q)=>D+q.sections.length,0);if(oe&&$.chapters.length===1&&$.chapters[0].sections.length===1){const D=$.chapters[0].sections[0],q=O("section",D.id),_={partId:$.id,partTitle:$.title,chapterId:$.chapters[0].id,chapterTitle:$.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:Z=>{Z.stopPropagation(),Z.dataTransfer.setData("text/plain","section:"+D.id),Z.dataTransfer.effectAllowed="move",k({type:"section",id:D.id})},onDragEnd:()=>{k(null),C(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${q?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${R("section",D.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...z("section",D.id,_),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(bi,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:Z=>Z.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(D.id),onChange:()=>b(D.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:s.jsx(ur,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[$.chapters[0].title," | ",D.title]}),j.includes(D.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(qc,{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:Z=>Z.stopPropagation(),onClick:Z=>Z.stopPropagation(),children:[D.price===0||D.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",D.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",D.clickCount??0," · 付款 ",D.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(D.hotScore??0).toFixed(1)," · 第",D.hotRank&&D.hotRank>0?D.hotRank:"-","名"]}),N&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>N(D),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(D),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(D),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(ts,{className:"w-3.5 h-3.5"})})]})]})]},$.id)}if($.title==="2026每日派对干货"||$.title.includes("2026每日派对干货")){const D=O("part",$.id);return s.jsxs("div",{className:`rounded-xl border overflow-hidden transition-all duration-200 ${D?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50 bg-[#1C1C1E]"}`,...z("part",$.id,{partId:$.id,partTitle:$.title,chapterId:((W=$.chapters[0])==null?void 0:W.id)??"",chapterTitle:((fe=$.chapters[0])==null?void 0:fe.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:q=>{q.stopPropagation(),q.dataTransfer.setData("text/plain","part:"+$.id),q.dataTransfer.effectAllowed="move",k({type:"part",id:$.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${R("part",$.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/50"}`,children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(bi,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),s.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac]/80 flex items-center justify-center text-white font-bold shrink-0",children:$.badgeText||"派"}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:$.title}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:vj($)})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:q=>q.stopPropagation(),onClick:q=>q.stopPropagation(),children:[o&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o($),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx(zn,{className:"w-3.5 h-3.5"})}),h&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h($),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),f&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f($),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(ts,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",title:"本篇章数与节数",children:[ge," 章 · ",X," 节"]}),s.jsx("button",{type:"button",draggable:!1,className:"p-1 rounded-md hover:bg-white/10 text-gray-500",title:F?"收起":"展开",onMouseDown:q=>q.stopPropagation(),onClick:q=>{q.stopPropagation(),n($.id)},children:F?s.jsx(_l,{className:"w-5 h-5"}):s.jsx(Cl,{className:"w-5 h-5"})})]})]}),F&&$.chapters.length>0&&s.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:$.chapters.map(q=>s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[s.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:q.title}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:_=>_.stopPropagation(),children:[m&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>m($,q),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),c&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>c($),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx(zn,{className:"w-3.5 h-3.5"})}),u&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>u($,q),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(ts,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:q.sections.map(_=>{const Z=O("section",_.id);return s.jsxs("div",{draggable:!0,onDragStart:re=>{re.stopPropagation(),re.dataTransfer.setData("text/plain","section:"+_.id),re.dataTransfer.effectAllowed="move",k({type:"section",id:_.id})},onDragEnd:()=>{k(null),C(null)},onClick:()=>a(_),className:`flex items-center justify-between py-2 px-3 rounded-lg min-h-[40px] cursor-pointer select-none transition-all duration-200 ${Z?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${R("section",_.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...z("section",_.id,{partId:$.id,partTitle:$.title,chapterId:q.id,chapterTitle:q.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(bi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:re=>re.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(_.id),onChange:()=>b(_.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx("span",{className:"text-sm text-gray-200 truncate flex items-center min-w-0",children:se(_)}),j.includes(_.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(qc,{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:re=>re.stopPropagation(),children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",_.clickCount??0," · 付款 ",_.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(_.hotScore??0).toFixed(1)," · 第",_.hotRank&&_.hotRank>0?_.hotRank:"-","名"]}),N&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>N(_),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(_),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(ts,{className:"w-3.5 h-3.5"})})]})]},_.id)})})]},q.id))})]},$.id)}if(I)return s.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"附录"}),s.jsx("div",{className:"space-y-3",children:$.chapters.map((D,q)=>D.sections.length>0?D.sections.map(_=>{const Z=O("section",_.id);return s.jsxs("div",{draggable:!0,onDragStart:re=>{re.stopPropagation(),re.dataTransfer.setData("text/plain","section:"+_.id),re.dataTransfer.effectAllowed="move",k({type:"section",id:_.id})},onDragEnd:()=>{k(null),C(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 group cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${Z?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${R("section",_.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...z("section",_.id,{partId:$.id,partTitle:$.title,chapterId:D.id,chapterTitle:D.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(bi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:re=>re.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(_.id),onChange:()=>b(_.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-300 truncate",children:["附录",q+1," | ",D.title," | ",_.title]}),j.includes(_.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(qc,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",_.clickCount??0," · 付款 ",_.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(_.hotScore??0).toFixed(1)," · 第",_.hotRank&&_.hotRank>0?_.hotRank:"-","名"]}),N&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>N(_),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>a(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>i(_),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(ts,{className:"w-3.5 h-3.5"})})]})]}),s.jsx(Cl,{className:"w-4 h-4 text-gray-500 shrink-0"})]},_.id)}):s.jsxs("div",{className:"flex justify-between items-center py-2 select-none hover:bg-[#162840]/50 rounded px-2 -mx-2",children:[s.jsxs("span",{className:"text-sm text-gray-500",children:["附录",q+1," | ",D.title,"(空)"]}),s.jsx(Cl,{className:"w-4 h-4 text-gray-500 shrink-0"})]},D.id))})]},$.id);if(me&&$.chapters.length===1&&$.chapters[0].sections.length===1){const D=$.chapters[0].sections[0],q=O("section",D.id),_={partId:$.id,partTitle:$.title,chapterId:$.chapters[0].id,chapterTitle:$.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:Z=>{Z.stopPropagation(),Z.dataTransfer.setData("text/plain","section:"+D.id),Z.dataTransfer.effectAllowed="move",k({type:"section",id:D.id})},onDragEnd:()=>{k(null),C(null)},className:`rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between hover:border-[#38bdac]/30 transition-colors cursor-grab active:cursor-grabbing select-none min-h-[40px] ${q?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${R("section",D.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...z("section",D.id,_),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(bi,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:Z=>Z.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(D.id),onChange:()=>b(D.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx("div",{className:"w-8 h-8 rounded-lg bg-gray-600/50 flex items-center justify-center shrink-0",children:s.jsx(ur,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[$.chapters[0].title," | ",D.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:Z=>Z.stopPropagation(),onClick:Z=>Z.stopPropagation(),children:[D.price===0||D.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",D.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",D.clickCount??0," · 付款 ",D.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(D.hotScore??0).toFixed(1)," · 第",D.hotRank&&D.hotRank>0?D.hotRank:"-","名"]}),N&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>N(D),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(D),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(D),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(ts,{className:"w-3.5 h-3.5"})})]})]})]},$.id)}return me?s.jsxs("div",{className:"rounded-xl border border-gray-700/50 bg-[#1C1C1E] p-5",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-400 mb-4",children:"尾声"}),s.jsx("div",{className:"space-y-3",children:$.chapters.map(D=>D.sections.map(q=>{const _=O("section",q.id);return s.jsxs("div",{draggable:!0,onDragStart:Z=>{Z.stopPropagation(),Z.dataTransfer.setData("text/plain","section:"+q.id),Z.dataTransfer.effectAllowed="move",k({type:"section",id:q.id})},onDragEnd:()=>{k(null),C(null)},className:`flex justify-between items-center py-2 select-none rounded px-2 -mx-2 cursor-grab active:cursor-grabbing min-h-[40px] transition-all duration-200 ${_?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${R("section",q.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...z("section",q.id,{partId:$.id,partTitle:$.title,chapterId:D.id,chapterTitle:D.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(bi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:Z=>Z.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(q.id),onChange:()=>b(q.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsxs("span",{className:"text-sm text-gray-300",children:[D.title," | ",q.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",q.clickCount??0," · 付款 ",q.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(q.hotScore??0).toFixed(1)," · 第",q.hotRank&&q.hotRank>0?q.hotRank:"-","名"]}),N&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>N(q),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(q),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(q),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(ts,{className:"w-3.5 h-3.5"})})]})]})]},q.id)}))})]},$.id):s.jsxs("div",{className:`rounded-xl border bg-[#1C1C1E] overflow-hidden transition-all duration-200 ${Y?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50"}`,...z("part",$.id,{partId:$.id,partTitle:$.title,chapterId:((he=$.chapters[0])==null?void 0:he.id)??"",chapterTitle:((de=$.chapters[0])==null?void 0:de.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:D=>{D.stopPropagation(),D.dataTransfer.setData("text/plain","part:"+$.id),D.dataTransfer.effectAllowed="move",k({type:"part",id:$.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between p-4 cursor-grab active:cursor-grabbing select-none transition-all duration-200 ${R("part",$.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] rounded-xl shadow-xl shadow-[#38bdac]/20":"hover:bg-[#162840]/50"}`,children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx(bi,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),s.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac] flex items-center justify-center text-lg shadow-lg shadow-[#38bdac]/30 shrink-0",children:$.badgeText||L(Q(ie))}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:$.title}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:vj($)})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:D=>D.stopPropagation(),onClick:D=>D.stopPropagation(),children:[o&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o($),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"在本篇下新增章节",children:s.jsx(zn,{className:"w-3.5 h-3.5"})}),h&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h($),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),f&&s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f($),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(ts,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",title:"本篇章数与节数",children:[ge," 章 · ",X," 节"]}),s.jsx("button",{type:"button",draggable:!1,className:"p-1 rounded-md hover:bg-white/10 text-gray-500",title:F?"收起":"展开",onMouseDown:D=>D.stopPropagation(),onClick:D=>{D.stopPropagation(),n($.id)},children:F?s.jsx(_l,{className:"w-5 h-5"}):s.jsx(Cl,{className:"w-5 h-5"})})]})]}),F&&s.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:$.chapters.map(D=>{const q=O("chapter",D.id);return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[s.jsxs("div",{draggable:!0,onDragStart:_=>{_.stopPropagation(),_.dataTransfer.setData("text/plain","chapter:"+D.id),_.dataTransfer.effectAllowed="move",k({type:"chapter",id:D.id})},onDragEnd:()=>{k(null),C(null)},onDragEnter:_=>{_.preventDefault(),_.stopPropagation(),_.dataTransfer.dropEffect="move",C({type:"chapter",id:D.id})},onDragOver:_=>{_.preventDefault(),_.stopPropagation(),_.dataTransfer.dropEffect="move",C({type:"chapter",id:D.id})},onDragLeave:()=>C(null),onDrop:_=>{C(null);const Z=Ax(_.dataTransfer.getData("text/plain"));if(!Z)return;const re={partId:$.id,partTitle:$.title,chapterId:D.id,chapterTitle:D.title};(Z.type==="section"||Z.type==="chapter")&&P(_,"chapter",D.id,re)},className:`flex-1 min-w-0 py-2 px-2 rounded cursor-grab active:cursor-grabbing select-none -mx-2 transition-all duration-200 flex items-center gap-2 ${q?"bg-[#38bdac]/15 ring-1 ring-[#38bdac]/50":""} ${R("chapter",D.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/30"}`,children:[s.jsx(bi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),s.jsx("p",{className:"text-xs text-gray-500 pb-1 flex-1",children:D.title})]}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:_=>_.stopPropagation(),children:[m&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>m($,D),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),c&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>c($),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"新增第X章",children:s.jsx(zn,{className:"w-3.5 h-3.5"})}),u&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>u($,D),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(ts,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:D.sections.map(_=>{const Z=O("section",_.id);return s.jsxs("div",{draggable:!0,onDragStart:re=>{re.stopPropagation(),re.dataTransfer.setData("text/plain","section:"+_.id),re.dataTransfer.effectAllowed="move",k({type:"section",id:_.id})},onDragEnd:()=>{k(null),C(null)},className:`flex items-center justify-between py-2 px-3 rounded-lg group cursor-grab active:cursor-grabbing select-none min-h-[40px] transition-all duration-200 ${Z?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${R("section",_.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] shadow-lg":"hover:bg-[#162840]/50"}`,...z("section",_.id,{partId:$.id,partTitle:$.title,chapterId:D.id,chapterTitle:D.title}),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[b&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:re=>re.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:g.includes(_.id),onChange:()=>b(_.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx(bi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),s.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${_.price===0||_.isFree?"border-2 border-[#38bdac] bg-transparent":"bg-gray-500"}`}),s.jsx("span",{className:"text-sm text-gray-200 truncate flex items-center min-w-0",children:se(_)}),j.includes(_.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(qc,{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:re=>re.stopPropagation(),onClick:re=>re.stopPropagation(),children:[_.isNew&&s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"NEW"}),_.price===0||_.isFree?s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"免费"}):s.jsxs("span",{className:"text-xs text-gray-500",children:["¥",_.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",title:"点击次数 · 付款笔数",children:["点击 ",_.clickCount??0," · 付款 ",_.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(_.hotScore??0).toFixed(1)," · 第",_.hotRank&&_.hotRank>0?_.hotRank:"-","名"]}),N&&s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>N(_),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5 shrink-0",children:"付款记录"}),s.jsxs("div",{className:"flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(_),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(sn,{className:"w-3.5 h-3.5"})}),s.jsx(J,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(_),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(ts,{className:"w-3.5 h-3.5"})})]})]})]},_.id)})})]},D.id)})})]},$.id)})})}function uV(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 hV(t){return Oe(`/api/db/person?personId=${encodeURIComponent(t)}`)}function fV(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 pV=10;function H4(t){const e=(t??"").trim();if(!e)return"";if(/^https?:\/\//i.test(e))return ya(e);const n=e.startsWith("/")?e:`/${e}`;return ya(zl(n))}function mV(t){const{nickname:e,avatar:n}=t,r=H4(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 gV(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 xV({id:t,label:e,value:n,preview:r,previewLoading:a=!1,onSelect:i,onClear:o,containerOpen:c,disabled:u=!1,hint:h,className:f,portalMountRef:m,positionContainerRef:g}){const[b,N]=y.useState(!1),[j,v]=y.useState(""),k=Hl(j,300),[T,C]=y.useState([]),[R,O]=y.useState(!1),[U,P]=y.useState(!1),[z,L]=y.useState(0),Q=y.useRef(1),se=y.useRef(!1),$=y.useRef(!1),ie=y.useRef(null),oe=y.useRef(null),[me,I]=y.useState({top:0,left:0,width:320,maxH:360}),Y=y.useCallback(()=>{const D=oe.current;if(!D||typeof window>"u")return;const q=D.getBoundingClientRect(),_=Math.min(400,Math.max(200,window.innerHeight-q.bottom-16)),Z=g==null?void 0:g.current;if(Z){const re=Z.getBoundingClientRect();I({top:q.bottom-re.top+6,left:q.left-re.left,width:Math.max(q.width,300),maxH:_})}else I({top:q.bottom+6,left:q.left,width:Math.max(q.width,300),maxH:_})},[g]);y.useEffect(()=>{c||(N(!1),v(""))},[c]),y.useLayoutEffect(()=>{if(b)return Y(),window.addEventListener("scroll",Y,!0),window.addEventListener("resize",Y),()=>{window.removeEventListener("scroll",Y,!0),window.removeEventListener("resize",Y)}},[b,Y]);const F=y.useCallback(async(D,q,_)=>{if(!se.current){se.current=!0,_?P(!0):O(!0);try{const Z=new URLSearchParams({page:String(D),pageSize:String(pV),search:q.trim()}),re=await Oe(`/api/db/users?${Z}`);if(re!=null&&re.success&&Array.isArray(re.users)){const we=re.users,Fe=typeof re.total=="number"?re.total:0;L(Fe),_?we.length===0?$.current=!0:C(Ue=>{const wt=gV(Ue,we);return wt.length===Ue.length?$.current=!0:Q.current=D,wt}):(C(we),Q.current=D)}else re!=null&&re.error&&G.error(re.error)}catch(Z){G.error(Z instanceof Error?Z.message:"加载用户列表失败")}finally{se.current=!1,O(!1),P(!1)}}},[]);y.useEffect(()=>{b&&(Q.current=1,$.current=!1,F(1,k,!1))},[b,k,F]);const ge=y.useCallback(()=>{R||U||se.current||$.current||z>0&&T.length>=z||F(Q.current+1,k,!0)},[k,F,R,U,z,T.length]);y.useLayoutEffect(()=>{if(!b||R||U||$.current||z>0&&T.length>=z||T.length===0)return;const D=ie.current;D&&(D.scrollHeight>D.clientHeight+12||ge())},[b,T.length,R,U,z,ge]);const X=D=>{(D.id||"").trim()&&(i(D),N(!1),v(""))},V=D=>{D.preventDefault(),D.stopPropagation(),!(u||a)&&o()},W=!!n.trim(),fe=z>0,he=typeof document>"u"?null:(m==null?void 0:m.current)??document.body,de=b&&he&&hd.createPortal(s.jsxs("div",{"data-member-user-select-portal":"",children:[s.jsx("div",{className:"fixed inset-0 z-40 bg-transparent","aria-hidden":!0,onMouseDown:D=>{D.preventDefault(),N(!1)}}),s.jsxs("div",{role:"listbox",className:"fixed z-50 overflow-hidden rounded-lg border border-gray-700 bg-[#0b1828] shadow-xl",style:{top:me.top,left:me.left,width:me.width,height:me.maxH,maxHeight:me.maxH,display:"grid",gridTemplateRows:fe?"auto auto minmax(0, 1fr) auto":"auto minmax(0, 1fr) auto"},children:[s.jsx("div",{className:"border-b border-gray-700/60 p-2 min-h-0",children:s.jsx(le,{className:"bg-[#050c18] border-gray-700 text-white h-9 text-sm",placeholder:"搜索昵称、手机号、用户 id…",value:j,onChange:D=>v(D.target.value),onMouseDown:D=>D.stopPropagation(),autoFocus:!0})}),fe?s.jsxs("p",{className:"text-[11px] text-gray-500 px-3 pt-1.5 min-h-0 leading-snug",children:["已加载 ",T.length," / ",z," 条",T.length{const q=D.currentTarget;R||U||$.current||z>0&&T.length>=z||q.scrollHeight-q.scrollTop-q.clientHeight<100&&ge()},children:R&&T.length===0?s.jsx("div",{className:"flex h-40 items-center justify-center text-gray-400 text-sm",children:"正在加载…"}):T.length===0?s.jsx("div",{className:"flex h-40 items-center justify-center text-gray-500 text-sm px-3 text-center",children:"暂无用户,请调整搜索条件"}):s.jsxs("div",{className:"p-1.5 space-y-0.5",children:[T.map(D=>{const q=D.id||"",_=n===q,Z=H4(D.avatar),re=D.nickname&&String(D.nickname).trim()||"(无昵称)";return s.jsxs("button",{type:"button",role:"option","aria-selected":_,className:zt("flex w-full items-center gap-2 rounded-md border px-2.5 py-2 text-left text-sm transition-colors",_?"border-[#38bdac] bg-[#38bdac]/15 text-white":"border-transparent bg-[#050c18] hover:border-[#38bdac]/40 hover:bg-[#0a1628]"),onMouseDown:we=>we.preventDefault(),onClick:()=>X(D),children:[s.jsx("span",{className:"h-9 w-9 shrink-0 overflow-hidden rounded-full bg-gray-800",children:Z?s.jsx("img",{src:Z,alt:"",className:"h-full w-full object-cover",onError:we=>{we.currentTarget.style.display="none"}}):s.jsx("span",{className:"flex h-full w-full items-center justify-center text-[11px] text-gray-500",children:re.slice(0,1)})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"font-medium truncate",children:re}),s.jsxs("div",{className:"text-[11px] text-gray-500 font-mono truncate mt-0.5",children:[D.phone?`${D.phone} · `:"",q]})]})]},q)}),U&&s.jsx("div",{className:"py-2 text-center text-gray-500 text-xs",children:"加载更多…"})]})}),s.jsx("div",{className:"flex justify-end gap-2 border-t border-gray-700/60 px-2 py-1.5 min-h-0",children:s.jsx(J,{type:"button",variant:"ghost",size:"sm",className:"text-gray-400 h-8 text-xs",onMouseDown:D=>D.preventDefault(),onClick:()=>{o(),N(!1)},children:"清除绑定"})})]})]}),he);return s.jsxs("div",{className:zt("space-y-1.5",f),children:[typeof e=="string"?s.jsx(te,{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:oe,id:t,type:"button",disabled:u,"aria-haspopup":"listbox","aria-expanded":b,className:zt("flex h-10 min-w-0 flex-1 items-center gap-2 rounded-md border bg-[#0a1628] px-3 text-left text-sm transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-[#38bdac]/50 focus-visible:ring-offset-0",u&&"cursor-not-allowed opacity-50",b?"border-[#38bdac] ring-1 ring-[#38bdac]/35":"border-gray-700 hover:border-gray-600"),onClick:()=>{u||(b||(v(""),Y()),N(D=>!D))},children:[s.jsx("span",{className:"flex min-w-0 flex-1 items-center gap-2 truncate",children:a?s.jsx("span",{className:"text-gray-500",children:"正在加载已绑定用户…"}):W?s.jsx(mV,{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(_l,{className:zt("h-4 w-4 shrink-0 text-gray-400 transition-transform",b&&"rotate-180")})]}),W&&s.jsx(J,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0 border-gray-600 text-gray-400 hover:text-white",disabled:u||a,"aria-label":"清除已选用户",onClick:V,children:s.jsx(ns,{className:"h-4 w-4"})})]}),h&&s.jsx("div",{className:"text-[11px] text-gray-500",children:h}),de]})}const U4=11,Nj={personId:"",name:"",boundUserId:"",aliases:"",label:"",sceneId:U4,ckbApiKey:"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:"phone",remarkFormat:"",addFriendInterval:1,startTime:"06:00",endTime:"22:00",deviceGroups:""};function yV({open:t,onOpenChange:e,editingPerson:n,onSubmit:r}){var q;const a=!!n,i=y.useRef(null),o=y.useRef(null),[c,u]=y.useState(Nj),[h,f]=y.useState(!1),[m,g]=y.useState(!1),[b,N]=y.useState([]),[j,v]=y.useState(!1),[k,T]=y.useState(""),[C,R]=y.useState([]),[O,U]=y.useState(!1),[P,z]=y.useState(""),[L,Q]=y.useState(!1),[se,$]=y.useState(null),[ie,oe]=y.useState(!1),[me,I]=y.useState({}),[Y,F]=y.useState({loading:!1,messages:[]}),ge=Hl(c.name,400),X=Hl(c.aliases,400);y.useEffect(()=>{if(!t){F({loading:!1,messages:[]});return}const _=ge.trim(),Z=X.trim();if(!_&&!Z){F({loading:!1,messages:[]});return}let re=!1;F(Ue=>({...Ue,loading:!0}));const we=a?((n==null?void 0:n.personId)??"").trim():"",Fe=new URLSearchParams;return _&&Fe.set("name",ge.trim()),Fe.set("aliases",X),we&&Fe.set("excludePersonId",we),Oe(`/api/db/persons/check-unique?${Fe.toString()}`).then(Ue=>{if(!re){if((Ue==null?void 0:Ue.success)===!1&&(Ue!=null&&Ue.error)){F({loading:!1,messages:[Ue.error]});return}if((Ue==null?void 0:Ue.ok)===!1&&Array.isArray(Ue.messages)&&Ue.messages.length>0){F({loading:!1,messages:Ue.messages});return}F({loading:!1,messages:[]})}}).catch(()=>{re||F({loading:!1,messages:[]})}),()=>{re=!0}},[t,ge,X,a,n==null?void 0:n.personId]),y.useEffect(()=>{if(t){if(T(""),$(null),oe(!1),n){u({personId:n.personId??n.name??"",name:n.name??"",boundUserId:n.userId??"",aliases:n.aliases??"",label:n.label??"",sceneId:U4,ckbApiKey:n.ckbApiKey??"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:n.remarkType??"phone",remarkFormat:n.remarkFormat??"",addFriendInterval:n.addFriendInterval??1,startTime:n.startTime??"06:00",endTime:n.endTime??"22:00",deviceGroups:n.deviceGroups??""});const _=(n.userId??"").trim();_&&(oe(!0),Oe(`/api/db/users?id=${encodeURIComponent(_)}`).then(Z=>{const re=Z==null?void 0:Z.user;re!=null&&re.id?$({id:re.id,nickname:re.nickname&&String(re.nickname).trim()||re.id,phone:re.phone,avatar:re.avatar??void 0}):$({id:_,nickname:_,phone:void 0,avatar:void 0})}).catch(()=>{$({id:_,nickname:_,phone:void 0,avatar:void 0})}).finally(()=>oe(!1)))}else u({...Nj});I({}),b.length===0&&V(""),C.length===0&&W("")}},[t,n]);const V=async _=>{v(!0);try{const Z=await uV({page:1,limit:50,keyword:_});Z!=null&&Z.success&&Array.isArray(Z.devices)?N(Z.devices):Z!=null&&Z.error&&G.error(Z.error)}catch(Z){G.error(Z instanceof Error?Z.message:"加载设备列表失败")}finally{v(!1)}},W=async _=>{U(!0);try{const Z=await fV({page:1,limit:100,keyword:_});Z!=null&&Z.success&&Array.isArray(Z.plans)?R(Z.plans):Z!=null&&Z.error&&G.error(Z.error)}catch{G.error("加载计划列表失败")}finally{U(!1)}},fe=()=>{u(_=>{const Z=(_.boundUserId||"").trim(),re={..._,boundUserId:""};return!a&&Z&&(_.personId||"").trim()===Z&&(re.personId=""),re}),$(null)},he=_=>{const Z=Array.isArray(_.deviceGroups)?_.deviceGroups.map(String).join(","):"";u(re=>({...re,ckbApiKey:_.apiKey||"",greeting:_.greeting||re.greeting,tips:_.tips||re.tips,remarkType:_.remarkType||re.remarkType,remarkFormat:_.remarkFormat||re.remarkFormat,addFriendInterval:_.addInterval||re.addFriendInterval,startTime:_.startTime||re.startTime,endTime:_.endTime||re.endTime,deviceGroups:Z||re.deviceGroups})),Q(!1),G.success(`已选择计划「${_.name}」,参数已覆盖`)},de=P.trim()?C.filter(_=>(_.name||"").includes(P.trim())||String(_.id).includes(P.trim())):C,D=async()=>{var we;const _={};(!c.name||!String(c.name).trim())&&(_.name="请填写名称");const Z=c.addFriendInterval;if((typeof Z!="number"||Z<1)&&(_.addFriendInterval="添加间隔至少为 1 分钟"),(((we=c.deviceGroups)==null?void 0:we.split(",").map(Fe=>Fe.trim()).filter(Boolean))??[]).length===0&&(_.deviceGroups="请至少选择 1 台设备"),I(_),Object.keys(_).length>0){G.error(_.name||_.addFriendInterval||_.deviceGroups||"请完善必填项");return}if(Y.messages.length>0){G.error(Y.messages[0]??"名称或别名与他人重复");return}f(!0);try{await r(c),e(!1)}catch(Fe){G.error(Fe instanceof Error?Fe.message:"保存失败")}finally{f(!1)}};return s.jsx(Dt,{open:t,onOpenChange:e,children:s.jsxs(Ot,{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(_t,{children:[s.jsx($t,{className:"text-[#38bdac]",children:a?"编辑人物":"添加人物 — 存客宝 API 获客"}),s.jsx(nd,{className:"text-gray-400 text-sm",children:a?"修改后同步到存客宝计划":"添加时自动生成 token,并同步创建存客宝场景获客计划"})]}),s.jsxs("div",{className:"space-y-6 py-2",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-medium text-gray-400 uppercase tracking-wider mb-3",children:"基础信息"}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(te,{className:"text-gray-400 text-xs",children:["名称 ",s.jsx("span",{className:"text-red-400",children:"*"})]}),s.jsx(le,{className:`bg-[#0a1628] text-white ${me.name?"border-red-500 focus-visible:ring-red-500":Y.messages.length>0?"border-amber-600 focus-visible:ring-amber-600/50":"border-gray-700"}`,placeholder:"如 卡若",value:c.name,onChange:_=>{u(Z=>({...Z,name:_.target.value})),me.name&&I(Z=>({...Z,name:void 0}))}}),me.name&&s.jsx("p",{className:"text-xs text-red-400",children:me.name})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"人物ID(可选)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"自动生成",value:(c.boundUserId||"").trim()?c.boundUserId:c.personId,onChange:_=>u(Z=>({...Z,personId:_.target.value})),disabled:a||!!(c.boundUserId||"").trim()})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"标签(身份/角色)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 超级个体",value:c.label,onChange:_=>u(Z=>({...Z,label:_.target.value}))})]}),s.jsx(xV,{className:"col-span-3",id:"person-bound-member-user",label:"绑定会员用户(可选,与「用户管理」中用户一致)",containerOpen:t,portalMountRef:o,positionContainerRef:i,value:c.boundUserId,preview:se,previewLoading:ie,onSelect:_=>{const Z=(_.id||"").trim();Z&&(u(re=>({...re,boundUserId:Z,...a?{}:{personId:Z}})),$({id:Z,nickname:_.nickname&&String(_.nickname).trim()||Z,phone:_.phone,avatar:_.avatar??void 0}))},onClear:fe,hint:s.jsx("span",{children:"单选;保存时后端校验用户是否存在。同一会员只能绑定一个 @人物;绑定后获客统计可与超级个体对齐。"})}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"别名(逗号分隔,@ 可匹配)"}),s.jsx(le,{className:`bg-[#0a1628] text-white ${Y.messages.length>0?"border-amber-600 focus-visible:ring-amber-600/50":"border-gray-700"}`,placeholder:"如 卡卡, 若若",value:c.aliases,onChange:_=>u(Z=>({...Z,aliases:_.target.value}))})]}),s.jsx("div",{className:"col-span-3 space-y-1",children:Y.loading?s.jsx("p",{className:"text-xs text-gray-500",children:"正在检测名称与别名是否与他人重复…"}):Y.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:Y.messages.map((_,Z)=>s.jsx("p",{children:_},`${Z}-${_.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(te,{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:()=>Q(!L),children:c.ckbApiKey?s.jsx("span",{className:"text-white truncate",children:((q=C.find(_=>_.apiKey===c.ckbApiKey))==null?void 0:q.name)||`获客计划 (${c.ckbApiKey.slice(0,8)}…)`}):s.jsx("span",{className:"text-gray-500",children:"点击选择已有计划 / 新建时自动创建"})}),s.jsx(J,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-200 shrink-0",onClick:()=>{W(P),Q(!0)},disabled:O,children:O?"加载...":"刷新"})]}),L&&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:P,onChange:_=>z(_.target.value),onKeyDown:_=>{_.key==="Enter"&&W(P)},autoFocus:!0})}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:de.length===0?s.jsx("div",{className:"text-center py-4 text-gray-500 text-xs",children:O?"加载中...":"暂无计划"}):de.map(_=>s.jsxs("div",{className:`px-3 py-2 cursor-pointer hover:bg-[#38bdac]/10 text-sm flex items-center justify-between ${c.ckbApiKey===_.apiKey?"bg-[#38bdac]/20 text-[#38bdac]":"text-white"}`,onClick:()=>he(_),children:[s.jsxs("div",{className:"truncate",children:[s.jsx("span",{className:"font-medium",children:_.name}),s.jsxs("span",{className:"text-xs text-gray-500 ml-2",children:["ID:",String(_.id)]})]}),_.enabled?s.jsx("span",{className:"text-[10px] text-green-400 bg-green-400/10 px-1.5 rounded shrink-0 ml-2",children:"启用"}):s.jsx("span",{className:"text-[10px] text-gray-500 bg-gray-500/10 px-1.5 rounded shrink-0 ml-2",children:"停用"})]},String(_.id)))}),s.jsx("div",{className:"p-2 border-t border-gray-700/60 flex justify-end",children:s.jsx(J,{type:"button",size:"sm",variant:"ghost",className:"text-gray-400 h-7 text-xs",onClick:()=>Q(!1),children:"关闭"})})]}),s.jsx("p",{className:"text-xs text-gray-500",children:"选择计划后自动覆盖下方参数。新建人物时若不选择则自动创建新计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(te,{className:"text-gray-400 text-xs",children:["选择设备 ",s.jsx("span",{className:"text-red-400",children:"*"})]}),s.jsxs("div",{className:`flex gap-2 rounded-md border ${me.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:c.deviceGroups?`已选择 ${c.deviceGroups.split(",").filter(Boolean).length} 个设备`:"",onClick:()=>g(!0)}),s.jsx(J,{type:"button",variant:"outline",className:"border-0 border-l border-inherit rounded-r-md text-gray-200",onClick:()=>g(!0),children:"选择"})]}),me.deviceGroups?s.jsx("p",{className:"text-xs text-red-400",children:me.deviceGroups}):s.jsx("p",{className:"text-xs text-gray-500",children:"从存客宝设备列表中选择,至少选择 1 台设备参与获客计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"好友备注"}),s.jsxs(ko,{value:c.remarkType,onValueChange:_=>u(Z=>({...Z,remarkType:_})),children:[s.jsx(Ai,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(So,{placeholder:"选择备注类型"})}),s.jsxs(Ii,{children:[s.jsx(us,{value:"phone",children:"手机号"}),s.jsx(us,{value:"nickname",children:"昵称"}),s.jsx(us,{value:"source",children:"来源"})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"备注格式(手机号+标签,标签不超过6字)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 {手机号}-{来源标签},总长不超过10字",value:c.remarkFormat,onChange:_=>u(Z=>({...Z,remarkFormat:_.target.value}))}),s.jsx("p",{className:"text-xs text-gray-500",children:"格式:手机号+来源标签(标签≤6字,总长≤10字)"})]})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"打招呼语"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"你好,请通过",value:c.greeting,onChange:_=>u(Z=>({...Z,greeting:_.target.value}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"添加间隔(分钟)"}),s.jsx(le,{type:"number",min:1,className:`bg-[#0a1628] text-white ${me.addFriendInterval?"border-red-500 focus-visible:ring-red-500":"border-gray-700"}`,value:c.addFriendInterval,onChange:_=>{u(Z=>({...Z,addFriendInterval:Number(_.target.value)||1})),me.addFriendInterval&&I(Z=>({...Z,addFriendInterval:void 0}))}}),me.addFriendInterval&&s.jsx("p",{className:"text-xs text-red-400",children:me.addFriendInterval})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{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:c.startTime,onChange:_=>u(Z=>({...Z,startTime:_.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:c.endTime,onChange:_=>u(Z=>({...Z,endTime:_.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(te,{className:"text-gray-400 text-xs",children:"获客成功提示"}),s.jsx(Go,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[72px] resize-none",placeholder:"请注意消息,稍后加你微信",value:c.tips,onChange:_=>u(Z=>({...Z,tips:_.target.value}))})]})]})]})]})]})]}),s.jsxs(rn,{className:"gap-3 border-t border-gray-700/40 px-6 py-4 shrink-0",children:[s.jsx(J,{variant:"outline",onClick:()=>e(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(J,{onClick:D,disabled:h||Y.messages.length>0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:h?"保存中...":a?"保存":"添加"})]})]}),m&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",children:s.jsxs("div",{className:"w-full max-w-3xl max-h-[80vh] bg-[#0b1828] border border-gray-700 rounded-xl shadow-xl flex flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-gray-700/60",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-medium text-white",children:"选择设备"}),s.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"勾选需要参与本计划的设备,可多选"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(J,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-200 h-8",onClick:()=>{const _=b.map(we=>String(we.id??"")),Z=c.deviceGroups?c.deviceGroups.split(",").map(we=>we.trim()).filter(Boolean):[],re=_.length>0&&_.every(we=>Z.includes(we));u(we=>({...we,deviceGroups:re?"":_.join(",")})),!re&&_.length>0&&I(we=>({...we,deviceGroups:void 0}))},children:(()=>{const _=b.map(re=>String(re.id??"")),Z=c.deviceGroups?c.deviceGroups.split(",").map(re=>re.trim()).filter(Boolean):[];return _.length>0&&_.every(re=>Z.includes(re))?"取消全选":"全选"})()}),s.jsx(le,{className:"bg-[#050c18] border-gray-700 text-white h-8 w-52",placeholder:"搜索备注/微信号/IMEI",value:k,onChange:_=>T(_.target.value),onKeyDown:_=>{_.key==="Enter"&&V(k)}}),s.jsx(J,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-200 h-8",onClick:()=>V(k),disabled:j,children:"刷新"}),s.jsx(J,{type:"button",size:"icon",variant:"outline",className:"border-gray-600 text-gray-300 h-8 w-8",onClick:()=>g(!1),children:"✕"})]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:j?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-400 text-sm",children:"正在加载设备列表…"}):b.length===0?s.jsx("div",{className:"flex h-full items-center justify-center text-gray-500 text-sm",children:"暂无设备数据,请检查存客宝账号与开放 API 配置"}):s.jsx("div",{className:"p-4 space-y-2",children:b.map(_=>{const Z=String(_.id??""),re=c.deviceGroups?c.deviceGroups.split(",").map(Ue=>Ue.trim()).filter(Boolean):[],we=re.includes(Z),Fe=()=>{let Ue;we?Ue=re.filter(wt=>wt!==Z):Ue=[...re,Z],u(wt=>({...wt,deviceGroups:Ue.join(",")})),Ue.length>0&&I(wt=>({...wt,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:we,onChange:Fe}),s.jsxs("div",{className:"flex flex-col min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-white truncate max-w-xs",children:_.memo||_.wechatId||`设备 ${Z}`}),_.status==="online"&&s.jsx("span",{className:"rounded-full bg-emerald-500/20 text-emerald-400 text-[11px] px-2 py-0.5",children:"在线"}),_.status==="offline"&&s.jsx("span",{className:"rounded-full bg-gray-600/20 text-gray-400 text-[11px] px-2 py-0.5",children:"离线"})]}),s.jsxs("div",{className:"text-[11px] text-gray-400 mt-0.5",children:[s.jsxs("span",{className:"mr-3",children:["ID: ",Z]}),_.wechatId&&s.jsxs("span",{className:"mr-3",children:["微信号: ",_.wechatId]}),typeof _.totalFriend=="number"&&s.jsxs("span",{children:["好友数: ",_.totalFriend]})]})]})]},Z)})})}),s.jsxs("div",{className:"flex justify-between items-center px-5 py-3 border-t border-gray-700/60",children:[s.jsxs("span",{className:"text-xs text-gray-400",children:["已选择"," ",c.deviceGroups?c.deviceGroups.split(",").filter(Boolean).length:0," ","台设备"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(J,{type:"button",variant:"outline",className:"border-gray-600 text-gray-200 h-8 px-4",onClick:()=>g(!1),children:"取消"}),s.jsx(J,{type:"button",className:"bg-[#38bdac] hover:bg-[#2da396] text-white h-8 px-4",onClick:()=>g(!1),children:"确定"})]})]})]})})]})})}const Ix=JSON.stringify({singlePageUnlockTitle:"解锁完整内容",singlePagePayButtonText:"支付 ¥{price} 解锁全文",singlePageExpandedHint:"预览页不能直接付款,务必先点底栏「前往小程序」。",payTapModalTitle:"解锁说明",payTapModalContent:"全文 ¥{price}。预览里无法完成支付:请先点屏幕底部「前往小程序」进入完整版,登录后再付款解锁。",fullUnlockTitle:"解锁完整内容",fullUnlockDesc:"可先上滑阅读预览;需要全文时,点下方「支付¥{price}」查看说明",fullLockedProgressText:"已阅读约 {percent}% ,购买后继续阅读",fullPaywallTip:"转发给需要的人,一起学习还能赚佣金",notLoginUnlockDesc:"已预览约 {percent}% 内容,登录并支付 ¥{price} 后阅读全文",notLoginPaywallTip:"分享给好友一起学习,还能赚取佣金",shareTipLine:"好友经你分享购买,你可获得约 90% 收益",momentsModalTitle:"分享到朋友圈",momentsModalContent:`已复制发圈文案(非分享给好友)。 + +请点击右上角「···」→「分享到朋友圈」粘贴发布。`,momentsClipboardFooter:` + +—— 以上为正文预览约 {percent}% ,搜「卡若创业派对」小程序阅读全文 ——`,timelineTitleSuffix:"(预览{percent}%)"},null,2);function Wc(t){if(t!=null){if(typeof t=="number"&&Number.isFinite(t))return Math.round(t);if(typeof t=="string"&&t.trim()!==""){const e=Number(t.trim().replace(/%/g,""));if(Number.isFinite(e))return Math.round(e)}}}function bV(t,e,n){const r=new Map;for(const o of t){const c=o.partId||"part-1",u=o.partTitle||"未分类",h=o.chapterId||"chapter-1",f=o.chapterTitle||"未分类";r.has(c)||r.set(c,{id:c,title:u,badgeText:n[c]||"",chapters:new Map});const m=r.get(c);m.chapters.has(h)||m.chapters.set(h,{id:h,title:f,sections:[]}),m.chapters.get(h).sections.push({id:o.id,mid:o.mid,title:o.title,price:o.price??1,filePath:o.filePath,isFree:o.isFree,isNew:o.isNew,clickCount:o.clickCount??0,payCount:o.payCount??0,hotScore:o.hotScore??0,hotRank:e.get(o.id)??0,previewPercent:Wc(o.previewPercent)})}const a=Array.from(r.values()).map(o=>({...o,chapters:Array.from(o.chapters.values())})),i=new Map;for(let o=0;o{const u=i.get(o.id),h=i.get(c.id);return u!==void 0&&h!==void 0&&u!==h?u-h:u!==void 0&&h===void 0?-1:u===void 0&&h!==void 0?1:o.id.localeCompare(c.id)})}function vV(){var cl,hc,dl;const t=Ja(),[e,n]=y.useState([]),[r,a]=y.useState(!0),[i,o]=y.useState([]),[c,u]=y.useState(null),[h,f]=y.useState(!1),[m,g]=y.useState(!1),[b,N]=y.useState(!1),[j,v]=y.useState(""),[k,T]=y.useState([]),[C,R]=y.useState(!1),[O,U]=y.useState({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),[P,z]=y.useState(null),[L,Q]=y.useState(!1),[se,$]=y.useState(!1),[ie,oe]=y.useState(null),[me,I]=y.useState(!1),[Y,F]=y.useState([]),[ge,X]=y.useState(!1),[V,W]=y.useState(""),[fe,he]=y.useState(""),[de,D]=y.useState(!1),[q,_]=y.useState(""),[Z,re]=y.useState(!1),[we,Fe]=y.useState(null),[Ue,wt]=y.useState(!1),[jn,pt]=y.useState(!1),[At,fn]=y.useState({readWeight:.5,recencyWeight:.3,payWeight:.2}),[Vn,pn]=y.useState(!1),[Wt,bn]=y.useState(!1),[Mn,Hn]=y.useState(1),[rs,Rt]=y.useState([]),[vn,Ne]=y.useState(!1),[Me,We]=y.useState([]),[rt,Lt]=y.useState(!1),[kt,$e]=y.useState(20),[H,Qe]=y.useState(!1),[bt,Ft]=y.useState(!1),[yt,ht]=y.useState(Ix),[It,Kt]=y.useState(!1),[kn,Es]=y.useState(!1),[Ts,Vi]=y.useState([]),[ja,Xa]=y.useState([]),[Za,Mr]=y.useState([]),[Ar,Ir]=y.useState(!1),[Jr,Bs]=y.useState(1),[Qs,fr]=y.useState(20),[Ys,ka]=y.useState(0),[ce,ve]=y.useState(1),[Pt,Yt]=y.useState(""),[nn,as]=y.useState(!1),[Pr,Qr]=y.useState(null),[Tt,Jn]=y.useState({tagId:"",label:"",aliases:"",url:"",type:"url",appId:"",appSecret:"",pagePath:""}),[Yr,Sa]=y.useState(!1),[mn,Xr]=y.useState(!1),[ei,pr]=y.useState(null),[Ms,Ca]=y.useState(null),[Hi,Xs]=y.useState({}),[Zs,Ui]=y.useState(!1),[ys,el]=y.useState(""),[Wi,bs]=y.useState(""),[er,tr]=y.useState([]),[mr,ti]=y.useState(0),[Zr,sc]=y.useState(1),[tl,ni]=y.useState(!1),[Ki,Ea]=y.useState(""),nl=y.useRef(null),Ta=y.useCallback(async(E,B)=>{var xt;const ue=new FormData;ue.append("file",E),ue.append("folder",B);const Ke=await(await fetch(zl("/api/upload"),{method:"POST",body:ue,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((xt=Ke==null?void 0:Ke.data)==null?void 0:xt.url)||(Ke==null?void 0:Ke.url)||""},[]),vt=y.useCallback(E=>Ta(E,"book-images"),[Ta]),qi=y.useCallback(E=>{const B=E.type.startsWith("video/")?"book-videos":"book-attachments";return Ta(E,B)},[Ta]),[sl,si]=y.useState({}),ri=E=>String(E||"").trim().slice(0,8),rc=y.useMemo(()=>{const E=new Map;return rs.forEach((B,ue)=>{E.set(B.id,ue+1)}),E},[rs]),Qn=bV(e,rc,sl),Ma=e.length,ea=10,Vs=Math.max(1,Math.ceil(rs.length/ea)),Hs=rs.slice((Mn-1)*ea,Mn*ea),ln=async()=>{a(!0);try{const E=await Oe("/api/db/book?action=list",{cache:"no-store"});n(Array.isArray(E==null?void 0:E.sections)?E.sections:[])}catch(E){console.error(E),n([])}finally{a(!1)}},nr=async()=>{try{const E=await Oe("/api/db/config?key=book_part_badges",{cache:"no-store"});let B={};if(E&&Array.isArray(E.data)){const ke=E.data.find(Ke=>Ke&&Ke.configKey==="book_part_badges");ke&&ke.configValue&&typeof ke.configValue=="object"&&!Array.isArray(ke.configValue)&&(B=ke.configValue)}else E&&E.data&&typeof E.data=="object"&&!Array.isArray(E.data)&&(B=E.data);const ue={};Object.keys(B).forEach(ke=>{const Ke=ri(B[ke]);Ke&&(ue[ke]=Ke)}),si(ue)}catch(E){console.error(E),si({})}},gr=async()=>{Ne(!0);try{const E=await Oe("/api/db/book?action=ranking",{cache:"no-store"}),B=Array.isArray(E==null?void 0:E.sections)?E.sections:[];Rt(B);const ue=B.filter(ke=>ke.isPinned).map(ke=>ke.id);We(ue)}catch(E){console.error(E),Rt([])}finally{Ne(!1)}};y.useEffect(()=>{ln(),gr(),nr()},[]);const xr=E=>{o(B=>B.includes(E)?B.filter(ue=>ue!==E):[...B,E])},ac=y.useCallback(E=>{const B=e,ue=E.flatMap(ke=>{const Ke=B.find(xt=>xt.id===ke.id);return Ke?[{...Ke,partId:ke.partId,partTitle:ke.partTitle,chapterId:ke.chapterId,chapterTitle:ke.chapterTitle}]:[]});return n(ue),Zt("/api/db/book",{action:"reorder",items:E}).then(ke=>{ke&&ke.success===!1&&(n(B),G.error("排序失败: "+(ke&&typeof ke=="object"&&"error"in ke?ke.error:"未知错误")))}).catch(ke=>{n(B),console.error("排序失败:",ke),G.error("排序失败: "+(ke instanceof Error?ke.message:"网络或服务异常"))}),Promise.resolve()},[e]),ic=async E=>{if(confirm(`确定要删除章节「${E.title}」吗?此操作不可恢复。`))try{const B=await Mi(`/api/db/book?id=${encodeURIComponent(E.id)}`);B&&B.success!==!1?(G.success("已删除"),ln(),gr()):G.error("删除失败: "+(B&&typeof B=="object"&&"error"in B?B.error:"未知错误"))}catch(B){console.error(B),G.error("删除失败")}},Aa=y.useCallback(async()=>{pn(!0);try{const E=await Oe("/api/db/config/full?key=article_ranking_weights",{cache:"no-store"}),B=E&&E.data;B&&typeof B.readWeight=="number"&&typeof B.recencyWeight=="number"&&typeof B.payWeight=="number"&&fn({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{pn(!1)}},[]);y.useEffect(()=>{jn&&Aa()},[jn,Aa]);const wd=async()=>{const{readWeight:E,recencyWeight:B,payWeight:ue}=At,ke=E+B+ue;if(Math.abs(ke-1)>.001){G.error("三个权重之和必须等于 1");return}bn(!0);try{const Ke=await Nt("/api/db/config",{key:"article_ranking_weights",value:{readWeight:E,recencyWeight:B,payWeight:ue},description:"文章排名算法权重"});Ke&&Ke.success!==!1?(G.success("排名权重已保存"),pt(!1),ln(),gr()):G.error("保存失败: "+(Ke&&typeof Ke=="object"&&"error"in Ke?Ke.error:""))}catch(Ke){console.error(Ke),G.error("保存失败")}finally{bn(!1)}},rl=y.useCallback(async()=>{Lt(!0);try{const E=await Oe("/api/db/config/full?key=pinned_section_ids",{cache:"no-store"}),B=E&&E.data;Array.isArray(B)&&We(B)}catch{}finally{Lt(!1)}},[]),vs=y.useCallback(async()=>{try{const E=await Oe("/api/db/persons");E!=null&&E.success&&E.persons&&Vi(E.persons.map(B=>{const ue=B.deviceGroups,ke=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:ke,isPinned:!!B.isPinned}}))}catch{}},[]),ta=y.useCallback(async(E,B)=>{const ue=(E.personId||E.id||"").trim();if(!ue){G.error("缺少 personId");return}B&&!(E.userId||"").trim()&&G.info("未绑定会员时,小程序仍显示 @ 名称,头像可能为默认图");try{const ke=await Zt("/api/db/persons/pin",{personId:ue,isPinned:B});if(!(ke!=null&&ke.success)){G.error((ke==null?void 0:ke.error)||"置顶失败");return}G.success(B?"已设为小程序首页置顶(全局仅一条)":"已取消置顶"),await vs()}catch(ke){G.error(ke instanceof Error?ke.message:"操作失败")}},[vs]),na=y.useCallback(async()=>{try{const E=await Oe("/api/db/link-tags");E!=null&&E.success&&E.linkTags&&Xa(E.linkTags.map(B=>({id:B.tagId,label:B.label,url:B.url,type:B.type||"url",appId:B.appId||"",pagePath:B.pagePath||"",hasAppSecret:!!B.hasAppSecret})))}catch{}},[]),Ia=y.useCallback(async()=>{try{const E=await Oe("/api/db/config/full?key=ckb_lead_webhook_url",{cache:"no-store"});E!=null&&E.success&&typeof E.data=="string"&&Ea(E.data)}catch{}},[]),Pa=y.useCallback(async()=>{try{const E=await Oe("/api/db/ckb-person-leads");if(E!=null&&E.success&&E.byPerson){const B={};for(const ue of E.byPerson)B[ue.token]=ue.total;Xs(B)}}catch{}},[]),Dn=y.useCallback(async(E,B,ue=1)=>{el(E),bs(B),Ui(!0),sc(ue),ni(!0);try{const ke=await Oe(`/api/db/ckb-person-leads?token=${encodeURIComponent(E)}&page=${ue}&pageSize=20`);ke!=null&&ke.success?(tr(ke.records||[]),ti(ke.total||0)):G.error((ke==null?void 0:ke.error)||"加载获客详情失败")}catch(ke){G.error(ke instanceof Error?ke.message:"加载获客详情失败")}finally{ni(!1)}},[]),Rr=y.useCallback(async()=>{Ir(!0);try{const E=new URLSearchParams({page:String(Jr),pageSize:String(Qs)}),B=Pt.trim();B&&E.set("search",B);const ue=await Oe(`/api/db/link-tags?${E.toString()}`);if(ue!=null&&ue.success){const ke=Array.isArray(ue.linkTags)?ue.linkTags:[];Mr(ke.map(Ke=>({id:Ke.tagId,label:Ke.label,aliases:Ke.aliases||"",url:Ke.url,type:Ke.type||"url",appId:Ke.appId||"",pagePath:Ke.pagePath||"",hasAppSecret:!!Ke.hasAppSecret}))),ka(typeof ue.total=="number"?ue.total:0),ve(typeof ue.totalPages=="number"&&ue.totalPages>0?ue.totalPages:1)}}catch(E){console.error(E),G.error("加载链接标签失败")}finally{Ir(!1)}},[Jr,Qs,Pt]),[sa,ai]=y.useState([]),[yr,As]=y.useState(""),[Ra,br]=y.useState(!1),vr=y.useRef(null),Gi=y.useCallback(async()=>{try{const E=await Oe("/api/admin/linked-miniprograms");E!=null&&E.success&&Array.isArray(E.data)&&ai(E.data.map(B=>({...B,key:B.key})))}catch{}},[]),Lr=sa.filter(E=>!yr.trim()||E.name.toLowerCase().includes(yr.toLowerCase())||E.key&&E.key.toLowerCase().includes(yr.toLowerCase())||E.appId.toLowerCase().includes(yr.toLowerCase())),ra=async E=>{const B=Me.includes(E)?Me.filter(ue=>ue!==E):[...Me,E];We(B);try{await Nt("/api/db/config",{key:"pinned_section_ids",value:B,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"}),gr()}catch{We(Me)}},aa=y.useCallback(async()=>{Qe(!0);try{const E=await Oe("/api/db/config/full?key=unpaid_preview_percent",{cache:"no-store"}),B=E&&E.data;typeof B=="number"&&B>0&&B<=100&&$e(B)}catch{}finally{Qe(!1)}},[]),ii=async()=>{if(kt<1||kt>100){G.error("预览比例需在 1~100 之间");return}Ft(!0);try{const E=await Nt("/api/db/config",{key:"unpaid_preview_percent",value:kt,description:"小程序未付费内容默认预览比例(%)"});E&&E.success!==!1?G.success("预览比例已保存"):G.error("保存失败: "+(E.error||""))}catch{G.error("保存失败")}finally{Ft(!1)}},oi=y.useCallback(async()=>{Kt(!0);try{const E=await Oe("/api/db/config/full?key=read_preview_ui",{cache:"no-store"}),B=E&&E.data;B!=null&&typeof B=="object"&&!Array.isArray(B)&&Object.keys(B).length>0?ht(JSON.stringify(B,null,2)):ht(Ix)}catch{ht(Ix)}finally{Kt(!1)}},[]),is=async()=>{let E;try{E=JSON.parse(yt)}catch{G.error("JSON 格式错误,请检查括号与引号");return}Es(!0);try{const B=await Nt("/api/db/config",{key:"read_preview_ui",value:E,description:"阅读页/朋友圈付费墙与分享文案(占位符 {percent} {price})"});B&&B.success!==!1?G.success("阅读页文案已保存"):G.error("保存失败: "+(B.error||""))}catch{G.error("保存失败")}finally{Es(!1)}};y.useEffect(()=>{rl(),aa(),oi(),vs(),na(),Pa(),Gi(),Ia()},[rl,aa,oi,vs,na,Pa,Gi,Ia]),y.useEffect(()=>{Rr()},[Rr]);const Or=async E=>{Fe({section:E,orders:[]}),wt(!0);try{const B=await Oe(`/api/db/book?action=section-orders&id=${encodeURIComponent(E.id)}`),ue=B!=null&&B.success&&Array.isArray(B.orders)?B.orders:[];Fe(ke=>ke?{...ke,orders:ue}:null)}catch(B){console.error(B),Fe(ue=>ue?{...ue,orders:[]}:null)}finally{wt(!1)}},li=async E=>{g(!0);try{const B=E.mid!=null&&E.mid>0?`/api/db/book?action=read&mid=${E.mid}`:`/api/db/book?action=read&id=${encodeURIComponent(E.id)}`,ue=await Oe(B);if(ue!=null&&ue.success&&ue.section){const ke=ue.section,Ke=ke.editionPremium===!0,xt=Wc(ke.previewPercent)??Wc(ke.preview_percent),at=Wc(E.previewPercent);u({id:E.id,originalId:E.id,title:ue.section.title??E.title,price:ue.section.price??E.price,content:ue.section.content??"",filePath:E.filePath,isFree:E.isFree||E.price===0,isNew:ke.isNew??E.isNew,isPinned:Me.includes(E.id),hotScore:E.hotScore??0,previewPercent:xt??at??void 0,editionStandard:Ke?!1:ke.editionStandard??!0,editionPremium:Ke})}else u({id:E.id,originalId:E.id,title:E.title,price:E.price,content:"",filePath:E.filePath,isFree:E.isFree,isNew:E.isNew,isPinned:Me.includes(E.id),hotScore:E.hotScore??0,previewPercent:Wc(E.previewPercent),editionStandard:!0,editionPremium:!1}),ue&&!ue.success&&G.error("无法读取文件内容: "+(ue.error||"未知错误"))}catch(B){console.error(B),u({id:E.id,title:E.title,price:E.price,content:"",filePath:E.filePath,isFree:E.isFree,previewPercent:Wc(E.previewPercent)})}finally{g(!1)}},ci=async()=>{var E;if(c){N(!0);try{let B=c.content||"";const ue=[new RegExp(`^#+\\s*${c.id.replace(".","\\.")}\\s+.*$`,"gm"),new RegExp(`^#+\\s*${c.id.replace(".","\\.")}[::].*$`,"gm"),new RegExp(`^#\\s+.*${(E=c.title)==null?void 0:E.slice(0,10).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*$`,"gm")];for(const Yn of ue)B=B.replace(Yn,"");B=B.replace(/^\s*\n+/,"").trim();const ke=c.originalId||c.id,Ke=c.id!==ke,xt={id:ke,...Ke?{newId:c.id}:{},title:c.title,price:c.isFree?0:c.price,content:B,isFree:c.isFree||c.price===0,isNew:c.isNew,hotScore:c.hotScore,editionStandard:c.editionPremium?!1:c.editionStandard??!0,editionPremium:c.editionPremium??!1,saveToFile:!0};c.previewPercent===null?xt.previewPercent=null:typeof c.previewPercent=="number"&&Number.isFinite(c.previewPercent)&&(xt.previewPercent=c.previewPercent);const at=await Zt("/api/db/book",xt,{timeout:$1}),_n=Ke?c.id:ke;c.isPinned!==Me.includes(_n)&&await ra(_n),at&&at.success!==!1?(G.success(`已保存:${c.title}`),u(null),ln(),vs(),na()):G.error("保存失败: "+(at&&typeof at=="object"&&"error"in at?at.error:"未知错误"))}catch(B){console.error(B);const ue=B instanceof Error&&B.name==="AbortError"?"保存超时,请检查网络或稍后重试":"保存失败";G.error(ue)}finally{N(!1)}}},jd=async()=>{if(!O.id||!O.title){G.error("请填写章节ID和标题");return}N(!0);try{const E=Qn.find(ke=>ke.id===O.partId),B=E==null?void 0:E.chapters.find(ke=>ke.id===O.chapterId),ue=await Zt("/api/db/book",{id:O.id,title:O.title,price:O.isFree?0:O.price,content:O.content||"",partId:O.partId,partTitle:(E==null?void 0:E.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:$1});if(ue&&ue.success!==!1){if(O.isPinned){const ke=[...Me,O.id];We(ke);try{await Nt("/api/db/config",{key:"pinned_section_ids",value:ke,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"})}catch{}}G.success(`章节创建成功:${O.title}`),f(!1),U({id:"",title:"",price:1,partId:"part-1",chapterId:"chapter-1",content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),ln(),vs(),na()}else G.error("创建失败: "+(ue&&typeof ue=="object"&&"error"in ue?ue.error:"未知错误"))}catch(E){console.error(E),G.error("创建失败")}finally{N(!1)}},al=E=>{U(B=>{var ue;return{...B,partId:E.id,chapterId:((ue=E.chapters[0])==null?void 0:ue.id)??"chapter-1"}}),f(!0)},il=E=>{z({id:E.id,title:E.title,badgeText:ri(E.badgeText)})},di=async()=>{var E;if((E=P==null?void 0:P.title)!=null&&E.trim()){Q(!0);try{const B=e.map(ke=>({id:ke.id,partId:ke.partId||"part-1",partTitle:ke.partId===P.id?P.title.trim():ke.partTitle||"",chapterId:ke.chapterId||"chapter-1",chapterTitle:ke.chapterTitle||""})),ue=await Zt("/api/db/book",{action:"reorder",items:B});if(ue&&ue.success!==!1){const ke=P.title.trim(),Ke={...sl},xt=ri(P.badgeText);xt?Ke[P.id]=xt:delete Ke[P.id];const at=await Nt("/api/db/config",{key:"book_part_badges",value:Ke,description:"目录篇名角标(key=part_id, value=角标文案)"});if(at&&at.success===!1){G.error("更新篇名角标失败: "+(at.error||"未知错误"));return}si(Ke),n(_n=>_n.map(Yn=>Yn.partId===P.id?{...Yn,partTitle:ke}:Yn)),z(null),ln()}else G.error("更新篇名失败: "+(ue&&typeof ue=="object"&&"error"in ue?ue.error:"未知错误"))}catch(B){console.error(B),G.error("更新篇名失败")}finally{Q(!1)}}},ia=E=>{const B=E.chapters.length+1,ue=`chapter-${E.id}-${B}-${Date.now()}`;U({id:`${B}.1`,title:"新章节",price:1,partId:E.id,chapterId:ue,content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),f(!0)},La=(E,B)=>{const ue=B.sections;let ke=1,Ke=!1,xt=!1;if(ue.length>0){const at=typeof ue[0].price=="number"?ue[0].price:Number(ue[0].price)||1,_n=!!(ue[0].isFree||at===0);xt=ue.some(Yn=>{const Sn=typeof Yn.price=="number"?Yn.price:Number(Yn.price)||1,sr=!!(Yn.isFree||Sn===0);return Sn!==at||sr!==_n}),ke=_n?0:at,Ke=_n}oe({part:E,chapter:B,title:B.title,price:ke,isFree:Ke,priceMixed:xt,initialTitle:B.title,initialPrice:ke,initialIsFree:Ke})},ol=async()=>{var Ke;if(!((Ke=ie==null?void 0:ie.title)!=null&&Ke.trim()))return;const E=ie,B=E.title.trim(),ue=B!==E.initialTitle,ke=E.isFree!==E.initialIsFree||!E.isFree&&Number(E.price)!==Number(E.initialPrice);if(!ue&&!ke){G.info("未修改任何内容"),oe(null);return}if(E.priceMixed&&ke){const xt=E.chapter.sections.length,at=E.isFree?"全部设为免费":`全部设为 ¥${E.price}`;if(!confirm(`本章 ${xt} 节当前定价不一致,保存后将${at},确定?`))return}I(!0);try{if(ue){const xt=e.map(Sn=>({id:Sn.id,partId:Sn.partId||E.part.id,partTitle:Sn.partId===E.part.id?E.part.title:Sn.partTitle||"",chapterId:Sn.chapterId||E.chapter.id,chapterTitle:Sn.partId===E.part.id&&Sn.chapterId===E.chapter.id?B:Sn.chapterTitle||""})),at=await Zt("/api/db/book",{action:"reorder",items:xt});if(at&&at.success===!1){G.error("保存章节名失败: "+(at&&typeof at=="object"&&"error"in at?at.error:"未知错误"));return}const _n=E.part.id,Yn=E.chapter.id;n(Sn=>Sn.map(sr=>sr.partId===_n&&sr.chapterId===Yn?{...sr,chapterTitle:B}:sr))}if(ke){const xt=await Zt("/api/db/book",{action:"update-chapter-pricing",partId:E.part.id,chapterId:E.chapter.id,price:E.isFree?0:Number(E.price)||0,isFree:E.isFree});if(xt&&xt.success===!1){G.error("保存定价失败: "+(xt&&typeof xt=="object"&&"error"in xt?xt.error:"未知错误")),ue&&ln();return}}oe(null),ln(),G.success("已保存")}catch(xt){console.error(xt),G.error("保存失败")}finally{I(!1)}},oc=async(E,B)=>{const ue=B.sections.map(ke=>ke.id);if(ue.length===0){G.info("该章下无小节,无需删除");return}if(confirm(`确定要删除「第${E.chapters.indexOf(B)+1}章 | ${B.title}」吗?将删除共 ${ue.length} 节,此操作不可恢复。`))try{for(const ke of ue)await Mi(`/api/db/book?id=${encodeURIComponent(ke)}`);ln()}catch(ke){console.error(ke),G.error("删除失败")}},lc=async()=>{if(!q.trim()){G.error("请输入篇名");return}re(!0);try{const E=`part-new-${Date.now()}`,B="chapter-1",ue=`part-placeholder-${Date.now()}`,ke=await Zt("/api/db/book",{id:ue,title:"占位节(可编辑)",price:0,content:"",partId:E,partTitle:q.trim(),chapterId:B,chapterTitle:"第1章 | 待编辑",saveToFile:!1});ke&&ke.success!==!1?(G.success(`篇「${q}」创建成功`),$(!1),_(""),ln()):G.error("创建失败: "+(ke&&typeof ke=="object"&&"error"in ke?ke.error:"未知错误"))}catch(E){console.error(E),G.error("创建失败")}finally{re(!1)}},Ji=async()=>{if(Y.length===0){G.error("请先勾选要移动的章节");return}const E=Qn.find(ue=>ue.id===V),B=E==null?void 0:E.chapters.find(ue=>ue.id===fe);if(!E||!B||!V||!fe){G.error("请选择目标篇和章");return}D(!0);try{const ue=()=>{const at=new Set(Y),_n=e.map(Un=>({id:Un.id,partId:Un.partId||"",partTitle:Un.partTitle||"",chapterId:Un.chapterId||"",chapterTitle:Un.chapterTitle||""})),Yn=_n.filter(Un=>at.has(Un.id)).map(Un=>({...Un,partId:V,partTitle:E.title||V,chapterId:fe,chapterTitle:B.title||fe})),Sn=_n.filter(Un=>!at.has(Un.id));let sr=Sn.length;for(let Un=Sn.length-1;Un>=0;Un-=1){const fc=Sn[Un];if(fc.partId===V&&fc.chapterId===fe){sr=Un+1;break}}return[...Sn.slice(0,sr),...Yn,...Sn.slice(sr)]},ke=async()=>{const at=ue(),_n=await Zt("/api/db/book",{action:"reorder",items:at});return _n&&_n.success!==!1?(G.success(`已移动 ${Y.length} 节到「${E.title}」-「${B.title}」`),X(!1),F([]),await ln(),!0):!1},Ke={action:"move-sections",sectionIds:Y,targetPartId:V,targetChapterId:fe,targetPartTitle:E.title||V,targetChapterTitle:B.title||fe},xt=await Zt("/api/db/book",Ke);if(xt&&xt.success!==!1)G.success(`已移动 ${xt.count??Y.length} 节到「${E.title}」-「${B.title}」`),X(!1),F([]),await ln();else{const at=xt&&typeof xt=="object"&&"error"in xt?xt.error||"":"未知错误";if((at.includes("缺少 id")||at.includes("无效的 action"))&&await ke())return;G.error("移动失败: "+at)}}catch(ue){console.error(ue),G.error("移动失败: "+(ue instanceof Error?ue.message:"网络或服务异常"))}finally{D(!1)}},cc=E=>{F(B=>B.includes(E)?B.filter(ue=>ue!==E):[...B,E])},kd=async E=>{const B=e.filter(ue=>ue.partId===E.id).map(ue=>ue.id);if(B.length===0){G.info("该篇下暂无小节可删除");return}if(confirm(`确定要删除「${E.title}」整篇吗?将删除共 ${B.length} 节内容,此操作不可恢复。`))try{for(const ue of B)await Mi(`/api/db/book?id=${encodeURIComponent(ue)}`);ln()}catch(ue){console.error(ue),G.error("删除失败")}},dc=async()=>{var E;if(j.trim()){R(!0);try{const B=await Oe(`/api/search?q=${encodeURIComponent(j)}`);B!=null&&B.success&&((E=B.data)!=null&&E.results)?T(B.data.results):(T([]),B&&!B.success&&G.error("搜索失败: "+B.error))}catch(B){console.error(B),T([]),G.error("搜索失败")}finally{R(!1)}}},ll=Qn.find(E=>E.id===O.partId),uc=(ll==null?void 0:ll.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:["共 ",Qn.length," 篇 · ",Ma," 节内容"]})]}),s.jsx("div",{className:"flex gap-2",children:s.jsxs(J,{onClick:()=>pt(!0),variant:"outline",className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:[s.jsx(Jh,{className:"w-4 h-4 mr-2"}),"排名算法"]})})]}),s.jsx(Dt,{open:h,onOpenChange:f,children:s.jsxs(Ot,{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(_t,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(zn,{className:"w-5 h-5 text-[#38bdac]"}),"新建章节"]})}),s.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"章节ID *"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 9.15",value:O.id,onChange:E=>U({...O,id:E.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{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:E=>U({...O,price:Number(E.target.value),isFree:Number(E.target.value)===0}),disabled:O.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"免费"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:O.isFree,onChange:E=>U({...O,isFree:E.target.checked,price:E.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"最新新增"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:O.isNew,onChange:E=>U({...O,isNew:E.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"小程序直推"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:O.isPinned,onChange:E=>U({...O,isPinned:E.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"文章类型"}),s.jsxs("div",{className:"flex items-center gap-4 h-10",children:[s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"new-edition-type",checked:O.editionPremium!==!0,onChange:()=>U({...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:()=>U({...O,editionStandard:!1,editionPremium:!0}),className:"w-4 h-4 border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"增值版"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"热度分"}),s.jsx(le,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:O.hotScore??0,onChange:E=>U({...O,hotScore:Math.max(0,parseFloat(E.target.value)||0)})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"章节标题 *"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入章节标题",value:O.title,onChange:E=>U({...O,title:E.target.value})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"所属篇"}),s.jsxs(ko,{value:O.partId,onValueChange:E=>{var ue;const B=Qn.find(ke=>ke.id===E);U({...O,partId:E,chapterId:((ue=B==null?void 0:B.chapters[0])==null?void 0:ue.id)??"chapter-1"})},children:[s.jsx(Ai,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(So,{})}),s.jsxs(Ii,{className:"bg-[#0f2137] border-gray-700",children:[Qn.map(E=>s.jsx(us,{value:E.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:E.title},E.id)),Qn.length===0&&s.jsx(us,{value:"part-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认篇"})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"所属章"}),s.jsxs(ko,{value:O.chapterId,onValueChange:E=>U({...O,chapterId:E}),children:[s.jsx(Ai,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(So,{})}),s.jsxs(Ii,{className:"bg-[#0f2137] border-gray-700",children:[uc.map(E=>s.jsx(us,{value:E.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:E.title},E.id)),uc.length===0&&s.jsx(us,{value:"chapter-1",className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:"默认章"})]})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),s.jsx(_0,{content:O.content||"",onChange:E=>U({...O,content:E}),onImageUpload:vt,onMediaUpload:qi,persons:Ts,linkTags:ja,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(rn,{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:jd,disabled:b||!O.id||!O.title,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:b?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(zn,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),s.jsx(Dt,{open:!!P,onOpenChange:E=>!E&&z(null),children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(sn,{className:"w-5 h-5 text-[#38bdac]"}),"编辑篇名"]})}),P&&s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"篇名"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:P.title,onChange:E=>z({...P,title:E.target.value}),placeholder:"输入篇名"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"左侧图标文字(可选)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:P.badgeText||"",onChange:E=>z({...P,badgeText:ri(E.target.value)}),placeholder:"例如:派 / 新 / 热",maxLength:8}),s.jsx("p",{className:"text-xs text-gray-500",children:"保存后会同步到目录左侧图标文字(小程序与管理端目录树)。"})]})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",onClick:()=>z(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(J,{onClick:di,disabled:L||!((cl=P==null?void 0:P.title)!=null&&cl.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:L?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Dt,{open:!!ie,onOpenChange:E=>!E&&oe(null),children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsxs(_t,{children:[s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(sn,{className:"w-5 h-5 text-[#38bdac]"}),"章节设置"]}),s.jsx("p",{className:"text-gray-400 text-sm font-normal pt-1",children:"修改本章显示名称,或为本章下全部节设置统一金额(仍可在单节编辑里单独改某一节)。"})]}),ie&&s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"章节名称(如:第8章|底层结构)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:ie.title,onChange:E=>oe({...ie,title:E.target.value}),placeholder:"输入章节名称"})]}),s.jsxs("div",{className:"space-y-2 border-t border-gray-700/60 pt-4",children:[s.jsxs(te,{className:"text-gray-300",children:["本章统一定价(应用于本章全部 ",ie.chapter.sections.length," 节)"]}),ie.priceMixed&&s.jsx("p",{className:"text-amber-400/90 text-xs",children:"当前各节定价不一致,保存后将按下方设置全部统一。"}),s.jsxs("div",{className:"flex flex-wrap items-end gap-4",children:[s.jsxs("div",{className:"space-y-1 flex-1 min-w-[120px]",children:[s.jsx("span",{className:"text-gray-500 text-xs",children:"价格 (元)"}),s.jsx(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:ie.isFree?0:ie.price,onChange:E=>oe({...ie,price:Number(E.target.value),isFree:Number(E.target.value)===0}),disabled:ie.isFree,min:0,step:.01})]}),s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer pb-2",children:[s.jsx("input",{type:"checkbox",checked:ie.isFree||ie.price===0,onChange:E=>oe({...ie,isFree:E.target.checked,price:E.target.checked?0:ie.initialPrice>0?ie.initialPrice:1}),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac]"}),s.jsx("span",{className:"text-gray-400 text-sm",children:"本章全部免费"})]})]})]})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",onClick:()=>oe(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(J,{onClick:ol,disabled:me||!((hc=ie==null?void 0:ie.title)!=null&&hc.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:me?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Dt,{open:ge,onOpenChange:E=>{var B;if(X(E),E&&Qn.length>0){const ue=Qn[0];W(ue.id),he(((B=ue.chapters[0])==null?void 0:B.id)??"")}},children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsx($t,{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:Y.length})," 节,请选择目标篇与章。"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"目标篇"}),s.jsxs(ko,{value:V,onValueChange:E=>{var ue;W(E);const B=Qn.find(ke=>ke.id===E);he(((ue=B==null?void 0:B.chapters[0])==null?void 0:ue.id)??"")},children:[s.jsx(Ai,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(So,{placeholder:"选择篇"})}),s.jsx(Ii,{className:"bg-[#0f2137] border-gray-700",children:Qn.map(E=>s.jsx(us,{value:E.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:E.title},E.id))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"目标章"}),s.jsxs(ko,{value:fe,onValueChange:he,children:[s.jsx(Ai,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(So,{placeholder:"选择章"})}),s.jsx(Ii,{className:"bg-[#0f2137] border-gray-700",children:(((dl=Qn.find(E=>E.id===V))==null?void 0:dl.chapters)??[]).map(E=>s.jsx(us,{value:E.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:E.title},E.id))})]})]})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",onClick:()=>X(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(J,{onClick:Ji,disabled:de||Y.length===0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:de?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"移动中..."]}):"确认移动"})]})]})}),s.jsx(Dt,{open:!!we,onOpenChange:E=>!E&&Fe(null),children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white",children:["付款记录 — ",(we==null?void 0:we.section.title)??""]})}),s.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:Ue?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):we&&we.orders.length===0?s.jsx("p",{className:"text-gray-500 text-center py-6",children:"暂无付款记录"}):we?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:we.orders.map(E=>s.jsxs("tr",{className:"border-b border-gray-700/50",children:[s.jsx("td",{className:"py-2 pr-2",children:s.jsx("button",{className:"text-blue-400 hover:text-blue-300 hover:underline text-left truncate max-w-[180px] block",title:`查看订单 ${E.orderSn}`,onClick:()=>window.open(`/orders?search=${E.orderSn??E.id??""}`,"_blank"),children:E.orderSn?E.orderSn.length>16?E.orderSn.slice(0,8)+"..."+E.orderSn.slice(-6):E.orderSn:"-"})}),s.jsx("td",{className:"py-2 pr-2",children:s.jsx("button",{className:"text-[#38bdac] hover:text-[#2da396] hover:underline text-left truncate max-w-[140px] block",title:`查看用户 ${E.userId??E.openId??""}`,onClick:()=>window.open(`/users?search=${E.userId??E.openId??""}`,"_blank"),children:(()=>{const B=E.userId??E.openId??"-";return B.length>12?B.slice(0,6)+"..."+B.slice(-4):B})()})}),s.jsxs("td",{className:"py-2 pr-2 text-gray-300",children:["¥",E.amount??0]}),s.jsx("td",{className:"py-2 pr-2 text-gray-300",children:E.status??"-"}),s.jsx("td",{className:"py-2 pr-2 text-gray-500",children:E.payTime??E.createdAt??"-"})]},E.id??E.orderSn??""))})]}):null})]})}),s.jsx(Dt,{open:jn,onOpenChange:pt,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(Jh,{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(te,{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:At.readWeight,onChange:E=>fn(B=>({...B,readWeight:Math.max(0,Math.min(1,parseFloat(E.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{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:At.recencyWeight,onChange:E=>fn(B=>({...B,recencyWeight:Math.max(0,Math.min(1,parseFloat(E.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{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:At.payWeight,onChange:E=>fn(B=>({...B,payWeight:Math.max(0,Math.min(1,parseFloat(E.target.value)||0))}))})]})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["当前之和: ",(At.readWeight+At.recencyWeight+At.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:wd,disabled:Wt||Math.abs(At.readWeight+At.recencyWeight+At.payWeight-1)>.001,className:"w-full bg-amber-500 hover:bg-amber-600 text-white",children:Wt?"保存中...":"保存权重"})]})]})]})}),s.jsx(Dt,{open:se,onOpenChange:$,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(zn,{className:"w-5 h-5 text-amber-400"}),"新建篇"]})}),s.jsx("div",{className:"space-y-4 py-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"篇名(如:第六篇|真实的社会)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:q,onChange:E=>_(E.target.value),placeholder:"输入篇名"})]})}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",onClick:()=>{$(!1),_("")},className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(J,{onClick:lc,disabled:Z||!q.trim(),className:"bg-amber-500 hover:bg-amber-600 text-white",children:Z?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(zn,{className:"w-4 h-4 mr-2"}),"创建篇"]})})]})]})}),s.jsx(Dt,{open:!!c,onOpenChange:()=>u(null),children:s.jsxs(Ot,{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(_t,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(sn,{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(te,{className:"text-gray-300",children:"章节ID"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:c.id,onChange:E=>u({...c,id:E.target.value}),placeholder:"如: 9.15"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{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:E=>u({...c,price:Number(E.target.value),isFree:Number(E.target.value)===0}),disabled:c.isFree})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"免费"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:c.isFree||c.price===0,onChange:E=>u({...c,isFree:E.target.checked,price:E.target.checked?0:1}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"设为免费"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"预览%"}),s.jsx(le,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",placeholder:`全局 ${kt}%`,value:c.previewPercent!=null?String(c.previewPercent):"",onChange:E=>{const B=E.target.value.trim();if(B===""){u({...c,previewPercent:null});return}const ue=Number(B);Number.isFinite(ue)&&u({...c,previewPercent:Math.min(100,Math.max(1,Math.round(ue)))})}})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"最新新增"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:c.isNew??!1,onChange:E=>u({...c,isNew:E.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"标记 NEW"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"小程序直推"}),s.jsx("div",{className:"flex items-center h-10",children:s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:c.isPinned??!1,onChange:E=>u({...c,isPinned:E.target.checked}),className:"w-5 h-5 rounded border-gray-600 bg-[#0a1628] text-amber-400 focus:ring-amber-400"}),s.jsx("span",{className:"ml-2 text-gray-400 text-sm",children:"强制置顶到小程序首页"})]})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"文章类型"}),s.jsxs("div",{className:"flex items-center gap-4 h-10",children:[s.jsxs("label",{className:"flex items-center cursor-pointer",children:[s.jsx("input",{type:"radio",name:"edition-type",checked: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(te,{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:E=>u({...c,hotScore:Math.max(0,parseFloat(E.target.value)||0)})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"章节标题"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:c.title,onChange:E=>u({...c,title:E.target.value})})]}),c.filePath&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{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(te,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),m?s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700 rounded-md min-h-[400px] flex items-center justify-center",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(_0,{ref:nl,content:c.content||"",onChange:E=>u({...c,content:E}),onImageUpload:vt,onMediaUpload:qi,persons:Ts,linkTags:ja,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(rn,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[c&&s.jsxs(J,{variant:"outline",onClick:()=>Or({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(ur,{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(ns,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsx(J,{onClick:ci,disabled:b,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:b?s.jsxs(s.Fragment,{children:[s.jsx(He,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),s.jsxs(sd,{defaultValue:"chapters",className:"space-y-6",children:[s.jsxs(Vl,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(en,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(ur,{className:"w-4 h-4 mr-2"}),"章节管理"]}),s.jsxs(en,{value:"ranking",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(Kx,{className:"w-4 h-4 mr-2"}),"内容排行榜"]}),s.jsxs(en,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(xa,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),s.jsxs(en,{value:"link-person",className:"data-[state=active]:bg-purple-500/20 data-[state=active]:text-purple-400 text-gray-400",children:[s.jsx(Pi,{className:"w-4 h-4 mr-2"}),"@列表"]}),s.jsxs(en,{value:"link-tag",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(L1,{className:"w-4 h-4 mr-2"}),"链接标签"]})]}),s.jsxs(tn,{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(ur,{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:Ma}),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(zn,{className:"w-4 h-4 mr-2"}),"新建章节"]}),s.jsxs(J,{onClick:()=>$(!0),className:"flex-1 min-w-[120px] bg-amber-500/10 hover:bg-amber-500/20 text-amber-400 border border-amber-500/30",children:[s.jsx(zn,{className:"w-4 h-4 mr-2"}),"新建篇"]}),s.jsxs(J,{variant:"outline",onClick:()=>X(!0),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:["批量移动(已选 ",Y.length," 节)"]})]}),r?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsx(dV,{parts:Qn,expandedParts:i,onTogglePart:xr,onReorder:ac,onReadSection:li,onDeleteSection:ic,onAddSectionInPart:al,onAddChapterInPart:ia,onDeleteChapter:oc,onEditPart:il,onDeletePart:kd,onEditChapter:La,selectedSectionIds:Y,onToggleSectionSelect:cc,onShowSectionOrders:Or,pinnedSectionIds:Me})]}),s.jsx(tn,{value:"search",className:"space-y-4",children:s.jsxs(De,{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(le,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 flex-1",placeholder:"搜索标题或内容...",value:j,onChange:E=>v(E.target.value),onKeyDown:E=>E.key==="Enter"&&dc()}),s.jsx(J,{onClick:dc,disabled:C||!j.trim(),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:C?s.jsx(He,{className:"w-4 h-4 animate-spin"}):s.jsx(xa,{className:"w-4 h-4"})})]}),k.length>0&&s.jsxs("div",{className:"space-y-2 mt-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["找到 ",k.length," 个结果"]}),k.map(E=>s.jsxs("div",{className:"p-3 rounded-lg bg-[#162840] hover:bg-[#1a3050] cursor-pointer transition-colors",onClick:()=>{const B=e.find(ue=>ue.id===E.id);li({id:E.id,mid:E.mid,title:E.title,price:E.price??1,filePath:"",previewPercent:B==null?void 0:B.previewPercent})},children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[#38bdac] font-mono text-xs",children:E.id}),s.jsx("span",{className:"text-white",children:E.title}),Me.includes(E.id)&&s.jsx(qc,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})]}),s.jsx(Be,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:E.matchType==="title"?"标题匹配":"内容匹配"})]}),E.snippet&&s.jsx("p",{className:"text-gray-500 text-xs mt-2 line-clamp-2",children:E.snippet}),(E.partTitle||E.chapterTitle)&&s.jsxs("p",{className:"text-gray-600 text-xs mt-1",children:[E.partTitle," · ",E.chapterTitle]})]},E.id))]})]})]})}),s.jsxs(tn,{value:"ranking",className:"space-y-4",children:[s.jsxs(De,{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(Jh,{className:"w-4 h-4 text-[#38bdac]"}),"内容显示规则"]})}),s.jsxs(_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(te,{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:kt,onChange:E=>$e(Math.max(1,Math.min(100,Number(E.target.value)||20))),disabled:H}),s.jsx("span",{className:"text-gray-500 text-sm",children:"%"})]}),s.jsx(J,{size:"sm",onClick:ii,disabled:bt,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:bt?"保存中...":"保存"}),s.jsxs("span",{className:"text-xs text-gray-500",children:["小程序未付费用户默认显示文章前 ",kt,"% 内容;章节「预览%」可单独覆盖"]})]}),s.jsxs("div",{className:"mt-6 space-y-2",children:[s.jsx(te,{className:"text-gray-400 text-sm",children:"阅读页 / 朋友圈文案(JSON)"}),s.jsxs("p",{className:"text-xs text-gray-500",children:["占位符:",s.jsx("code",{className:"text-gray-400",children:"{percent}"})," 为预览比例、",s.jsx("code",{className:"text-gray-400",children:"{price}"})," 为章节价;与小程序付费墙、复制发圈、单页模式弹窗一致。"]}),s.jsx(Go,{className:"bg-[#0a1628] border-gray-700 text-gray-200 font-mono text-xs min-h-[280px]",value:yt,onChange:E=>ht(E.target.value),disabled:It,spellCheck:!1}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx(J,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-300",onClick:()=>oi(),disabled:It,children:"重新加载"}),s.jsx(J,{type:"button",size:"sm",onClick:is,disabled:kn||It,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:kn?"保存中...":"保存文案配置"})]})]})]})]}),s.jsxs(De,{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(Kx,{className:"w-4 h-4 text-amber-400"}),"内容排行榜",s.jsxs("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["按热度排行 · 共 ",rs.length," 节"]})]}),s.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>gr(),disabled:vn,className:"text-gray-400 hover:text-white h-7 w-7 p-0",title:"刷新排行榜",children:s.jsx(He,{className:`w-4 h-4 ${vn?"animate-spin":""}`})}),s.jsx(J,{variant:"ghost",size:"sm",disabled:Mn<=1||vn,onClick:()=>Hn(E=>Math.max(1,E-1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(j5,{className:"w-4 h-4"})}),s.jsxs("span",{className:"text-gray-400 min-w-[60px] text-center",children:[Mn," / ",Vs]}),s.jsx(J,{variant:"ghost",size:"sm",disabled:Mn>=Vs||vn,onClick:()=>Hn(E=>Math.min(Vs,E+1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(Cl,{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:"编辑"})]}),Hs.map((E,B)=>{const ue=(Mn-1)*ea+B+1,ke=E.isPinned??Me.includes(E.id);return s.jsxs("div",{className:`grid grid-cols-[40px_40px_1fr_80px_80px_80px_60px] gap-2 px-3 py-2.5 items-center border-b border-gray-700/30 hover:bg-[#162840] transition-colors ${ke?"bg-amber-500/5":""}`,children:[s.jsx("span",{className:`text-sm font-bold ${ue<=3?"text-amber-400":"text-gray-500"}`,children:ue<=3?["🥇","🥈","🥉"][ue-1]:`#${ue}`}),s.jsx(J,{variant:"ghost",size:"sm",className:`h-6 w-6 p-0 ${ke?"text-amber-400":"text-gray-600 hover:text-amber-400"}`,onClick:()=>ra(E.id),disabled:rt,title:ke?"取消置顶":"强制置顶(精选推荐/首页最新更新)",children:ke?s.jsx(qc,{className:"w-3.5 h-3.5 fill-current"}):s.jsx(D1,{className:"w-3.5 h-3.5"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"text-white text-sm truncate block",children:E.title}),s.jsxs("span",{className:"text-gray-600 text-xs",children:[E.partTitle," · ",E.chapterTitle]})]}),s.jsx("span",{className:"text-right text-sm text-blue-400 font-mono",children:E.clickCount??0}),s.jsx("span",{className:"text-right text-sm text-green-400 font-mono",children:E.payCount??0}),s.jsx("span",{className:"text-right text-sm text-amber-400 font-mono",children:(E.hotScore??0).toFixed(1)}),s.jsx("div",{className:"text-right",children:s.jsx(J,{variant:"ghost",size:"sm",className:"text-gray-500 hover:text-[#38bdac] h-6 px-1",onClick:()=>li({id:E.id,mid:E.mid,title:E.title,price:E.price,filePath:"",previewPercent:E.previewPercent}),title:"编辑文章",children:s.jsx(sn,{className:"w-3 h-3"})})})]},E.id)}),Hs.length===0&&s.jsx("div",{className:"py-8 text-center text-gray-500",children:"暂无数据"})]})})]})]}),s.jsxs(tn,{value:"link-person",className:"space-y-4",children:[s.jsxs(De,{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(J,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 hover:bg-gray-700/50",onClick:()=>{vs()},title:"刷新",children:s.jsx(He,{className:"w-4 h-4"})}),s.jsxs(J,{size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",onClick:()=>{pr(null),Xr(!0)},children:[s.jsx(zn,{className:"w-4 h-4 mr-2"}),"添加"]})]})]}),s.jsx("div",{className:"max-h-[400px] overflow-y-auto",children:Ts.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:Ts.map(E=>s.jsxs("tr",{className:"border-b border-gray-700/30 hover:bg-[#0a1628]/80",children:[s.jsx("td",{className:"py-2 px-3 text-gray-400 text-xs font-mono",title:"32位token",children:E.id}),s.jsx("td",{className:"py-2 px-3 truncate max-w-[96px]",children:s.jsx("button",{type:"button",className:"text-amber-400 hover:text-amber-300 hover:underline text-left",onClick:()=>{Hi[E.id]&&Dn(E.id,E.name)},title:Hi[E.id]?"点击查看获客详情":E.name,children:E.name})}),s.jsx("td",{className:"py-2 px-3",children:E.personSource==="vip_sync"?s.jsx("span",{className:"text-[10px] text-purple-300 bg-purple-500/15 px-1.5 py-0.5 rounded whitespace-nowrap",children:"超级个体"}):s.jsx("span",{className:"text-[10px] text-gray-500 bg-gray-500/10 px-1.5 py-0.5 rounded whitespace-nowrap",children:"手工"})}),s.jsx("td",{className:"py-2 px-3 text-xs",children:E.userId?s.jsxs("div",{className:"flex flex-col gap-0.5 items-start max-w-[100px]",children:[E.personSource==="vip_sync"&&s.jsx("span",{className:"text-[10px] text-purple-300/90 leading-tight",children:"已绑定超级个体"}),s.jsx("button",{type:"button",className:"text-[#38bdac] hover:underline truncate max-w-[96px] block text-left",title:`用户ID: ${E.userId}`,onClick:()=>t(`/users?search=${encodeURIComponent(E.userId||"")}`),children:E.name})]}):s.jsx("span",{className:"text-gray-600",children:"—"})}),(()=>{const B=Hi[E.id]||0;return s.jsx("td",{className:`py-2 px-3 shrink-0 w-16 text-center text-xs font-bold cursor-pointer ${B>0?"text-green-400 hover:text-green-300 hover:underline":"text-gray-600"}`,title:B>0?"点击查看获客详情":"暂无获客",onClick:()=>{B>0&&Dn(E.id,E.name)},children:B})})(),s.jsx("td",{className:"py-2 px-3 text-white truncate max-w-[220px]",title:`planId: ${E.ckbPlanId??"-"}`,children:s.jsx("div",{className:"flex items-center gap-1.5",children:s.jsx("span",{className:"truncate",children:E.ckbPlanId?E.personSource==="vip_sync"?"超级个体拉群(统一计划)":`SOUL链接人与事-${E.name}`:"—"})})}),s.jsx("td",{className:"py-2 px-2 text-center",children:s.jsx(J,{type:"button",variant:"ghost",size:"sm",className:E.isPinned?"text-amber-400 hover:text-amber-300 h-7 px-2":"text-gray-500 hover:text-amber-400/90 h-7 px-2",title:E.isPinned?"取消小程序首页置顶":"设为小程序首页置顶(全局唯一)",onClick:()=>void ta(E,!E.isPinned),children:s.jsx(D1,{className:`w-3.5 h-3.5 ${E.isPinned?"fill-amber-400":""}`})})}),s.jsx("td",{className:"py-2 px-3 text-center",children:E.ckbPlanId?s.jsx("span",{className:"text-[10px] text-green-400 bg-green-400/10 px-1.5 py-0.5 rounded",children:"启用"}):s.jsx("span",{className:"text-[10px] text-gray-500 bg-gray-500/10 px-1.5 py-0.5 rounded",children:"未配置"})}),s.jsx("td",{className:"py-2 px-2",children:s.jsxs("div",{className:"flex items-center gap-0",children:[s.jsx(J,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-[#38bdac] h-6 px-2",title:"编辑",onClick:async()=>{try{const B=await hV(E.personId||"");if(B!=null&&B.success&&B.person){const ue=B.person;pr({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 pr(E),B!=null&&B.error&&G.error(B.error)}catch(B){console.error(B),pr(E),G.error(B instanceof Error?B.message:"加载人物详情失败")}Xr(!0)},children:s.jsx(Wx,{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:()=>Dn(E.id,E.name),children:s.jsx(Kn,{className:"w-3 h-3"})}),s.jsx(J,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",title:E.personSource==="vip_sync"?"删除本地 @人物(不删统一获客计划)":"删除(同时删除存客宝对应获客计划)",onClick:()=>Ca(E),children:s.jsx(ns,{className:"w-3 h-3"})})]})})]},E.id))})]}):s.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无AI人物,添加后可在编辑器中 @链接"})})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{className:"pb-3",children:[s.jsxs(ut,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(pA,{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(te,{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(te,{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(De,{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(Jh,{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(te,{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:Ki,onChange:E=>Ea(E.target.value)})]}),s.jsxs(J,{size:"sm",className:"bg-blue-500 hover:bg-blue-600 text-white h-8",onClick:async()=>{const E=Ki.trim();try{const B=await Nt("/api/db/config",{key:"ckb_lead_webhook_url",value:E,description:"获客线索 Webhook 通知 URL(企微/飞书)"});B!=null&&B.success?G.success(E?"Webhook 已保存":"Webhook 已清除"):G.error((B==null?void 0:B.error)??"保存失败")}catch{G.error("保存失败")}},children:[s.jsx(Tn,{className:"w-3.5 h-3.5 mr-1"}),"保存"]})]}),s.jsx("p",{className:"text-xs text-gray-500",children:"配置企业微信或飞书群机器人 Webhook URL,获客成功后自动推送通知"})]})]})]}),s.jsxs(tn,{value:"link-tag",className:"space-y-4",children:[s.jsxs(De,{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(L1,{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(te,{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:Pt,onChange:E=>{Yt(E.target.value),Bs(1)}})]}),s.jsx(J,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 hover:bg-gray-700/50 h-8",onClick:()=>{na(),Rr()},title:"刷新",children:s.jsx(He,{className:"w-4 h-4"})})]}),s.jsxs(J,{size:"sm",className:"bg-amber-500 hover:bg-amber-600 text-white h-8",onClick:()=>{Qr(null),Jn({tagId:"",label:"",aliases:"",url:"",type:"url",appId:"",appSecret:"",pagePath:""}),As(""),br(!1),as(!0)},children:[s.jsx(zn,{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:Ar?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:"加载中..."})}):Za.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:"暂无链接标签,添加后可在编辑器中使用 #标签 跳转"})}):Za.map(E=>s.jsxs("tr",{className:"border-b border-gray-700/30 hover:bg-white/5",children:[s.jsx("td",{className:"px-3 py-2",children:s.jsxs("button",{type:"button",className:"text-amber-400 font-semibold hover:text-amber-300 hover:underline text-left",onClick:()=>{Qr(E),Jn({tagId:E.id,label:E.label,aliases:E.aliases??"",url:E.url,type:E.type,appId:E.appId??"",appSecret:"",pagePath:E.pagePath??""}),As(E.appId??""),br(!1),as(!0)},title:"点击编辑标签",children:["#",E.label]})}),s.jsx("td",{className:"px-3 py-2 text-gray-500 text-xs truncate max-w-[120px]",title:E.aliases||"",children:E.aliases||"—"}),s.jsx("td",{className:"px-3 py-2",children:s.jsx(Be,{variant:"secondary",className:`text-[10px] ${E.type==="ckb"?"bg-green-500/20 text-green-300 border-green-500/30":E.type==="miniprogram"||E.type==="wxlink"?"bg-[#38bdac]/20 text-[#38bdac] border-[#38bdac]/30":"bg-gray-700 text-gray-300"}`,children:E.type==="url"?"网页":E.type==="ckb"?"存客宝":E.type==="wxlink"?"小程序链接":"小程序"})}),s.jsx("td",{className:"px-3 py-2 text-gray-300",children:E.type==="miniprogram"?s.jsxs("div",{className:"space-y-0.5",children:[(()=>{const B=sa.find(ue=>ue.key===E.appId);return s.jsxs(s.Fragment,{children:[B&&s.jsx("div",{className:"text-xs text-white",children:B.name}),s.jsxs("div",{className:"text-xs font-mono text-[#38bdac]",children:["AppID: ",(B==null?void 0:B.appId)||E.appId||"—"]})]})})(),E.pagePath&&s.jsx("div",{className:"text-xs text-gray-500 font-mono",children:E.pagePath}),s.jsxs("div",{className:`text-xs ${E.hasAppSecret?"text-emerald-400/90":"text-amber-500/80"}`,children:["AppSecret:",E.hasAppSecret?"已保存(仅服务端)":"未配置"]})]}):E.type==="wxlink"?s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("div",{className:"text-xs text-[#38bdac] truncate max-w-[420px] font-mono",title:E.url,children:E.url||"—"}),s.jsx("div",{className:"text-[11px] text-gray-500",children:"小程序内点击 → web-view 打开 → 自动唤起目标小程序"})]}):E.url?s.jsxs("a",{href:E.url,target:"_blank",rel:"noreferrer",className:"text-blue-400 text-xs truncate max-w-[420px] hover:underline inline-flex items-center gap-1",children:[E.url," ",s.jsx($o,{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:()=>{Qr(E),Jn({tagId:E.id,label:E.label,aliases:E.aliases??"",url:E.url,type:E.type,appId:E.appId??"",appSecret:"",pagePath:E.pagePath??""}),As(E.appId??""),br(!1),as(!0)},title:"编辑",children:s.jsx(Wx,{className:"w-3 h-3"})}),s.jsx(J,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-7 px-2",onClick:async()=>{if(confirm(`确定要删除「#${E.label}」吗?`))try{const B=await Mi(`/api/db/link-tags?tagId=${encodeURIComponent(E.id)}`);B!=null&&B.success?(G.success("已删除"),na(),Rr()):G.error((B==null?void 0:B.error)??"删除失败")}catch(B){console.error(B),G.error("删除失败")}},title:"删除",children:s.jsx(ns,{className:"w-3 h-3"})})]})})]},E.id))})]})}),s.jsx(qs,{page:Jr,pageSize:Qs,total:Ys,totalPages:ce,onPageChange:E=>Bs(E),onPageSizeChange:E=>{fr(E),Bs(1)}})]})]})]}),s.jsx(Dt,{open:nn,onOpenChange:as,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg p-4 gap-3",children:[s.jsxs(_t,{className:"gap-1",children:[s.jsx($t,{className:"text-base",children:Pr?"编辑链接标签":"添加链接标签"}),s.jsx(nd,{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(te,{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:Tt.tagId,disabled:!!Pr,onChange:E=>Jn(B=>({...B,tagId:E.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-300 text-sm",children:"显示文字"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"如 神仙团队",value:Tt.label,onChange:E=>Jn(B=>({...B,label:E.target.value}))})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-300 text-sm",children:"别名(多个用逗号分隔,同指向一个目标)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"如 团队招募, 团队合伙人",value:Tt.aliases,onChange:E=>Jn(B=>({...B,aliases:E.target.value}))})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 items-end",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-300 text-sm",children:"类型"}),s.jsxs(ko,{value:Tt.type,onValueChange:E=>Jn(B=>({...B,type:E})),children:[s.jsx(Ai,{className:"bg-[#0a1628] border-gray-700 text-white h-8",children:s.jsx(So,{})}),s.jsxs(Ii,{className:"bg-[#0f2137] border-gray-700 text-white",children:[s.jsx(us,{value:"url",children:"网页链接"}),s.jsx(us,{value:"miniprogram",children:"小程序(API跳转)"}),s.jsx(us,{value:"wxlink",children:"小程序链接(右上角复制)"}),s.jsx(us,{value:"ckb",children:"存客宝"})]})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-300 text-sm",children:Tt.type==="url"?"URL地址":Tt.type==="ckb"?"存客宝计划URL":Tt.type==="wxlink"?"小程序链接":"小程序 mpKey / 微信 AppID"}),Tt.type==="wxlink"?s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"粘贴小程序右上角 ... → 复制链接 得到的 URL",value:Tt.url,onChange:E=>Jn(B=>({...B,url:E.target.value}))}):Tt.type==="miniprogram"&&sa.length>0?s.jsxs("div",{ref:vr,className:"relative",children:[s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"搜索名称或密钥",value:Ra?yr:Tt.appId,onChange:E=>{const B=E.target.value;As(B),br(!0),sa.some(ue=>ue.key===B)||Jn(ue=>({...ue,appId:B}))},onFocus:()=>{As(Tt.appId),br(!0)},onBlur:()=>setTimeout(()=>br(!1),150)}),Ra&&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:Lr.length===0?s.jsx("div",{className:"px-3 py-2 text-gray-500 text-xs",children:"无匹配,可手动输入密钥"}):Lr.map(E=>s.jsxs("button",{type:"button",className:"w-full px-3 py-2 text-left text-sm text-white hover:bg-[#38bdac]/20 flex flex-col gap-0.5",onMouseDown:B=>{B.preventDefault(),Jn(ue=>({...ue,appId:E.key,pagePath:E.path||""})),As(""),br(!1)},children:[s.jsx("span",{children:E.name}),s.jsx("span",{className:"text-xs text-gray-400 font-mono",children:E.key})]},E.key))})]}):s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:Tt.type==="url"?"https://...":Tt.type==="ckb"?"https://ckbapi.quwanzhi.com/...":"关联配置的 key,或直接填 wx 开头的 AppID",value:Tt.type==="url"||Tt.type==="ckb"?Tt.url:Tt.appId,onChange:E=>{Tt.type==="url"||Tt.type==="ckb"?Jn(B=>({...B,url:E.target.value})):Jn(B=>({...B,appId:E.target.value}))}})]})]}),Tt.type==="wxlink"&&s.jsx("p",{className:"text-[11px] text-amber-400/80 leading-snug px-0.5",children:"操作:打开目标小程序 → 右上角「...」→「复制链接」→ 粘贴到上面。小程序内点击此标签会在 web-view 中打开,微信自动唤起目标小程序,无需修改小程序版本。"}),Tt.type==="miniprogram"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{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:Tt.pagePath,onChange:E=>Jn(B=>({...B,pagePath:E.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{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:Pr!=null&&Pr.hasAppSecret?"已保存密钥,留空不改;填写则覆盖":"粘贴目标小程序 AppSecret",value:Tt.appSecret,onChange:E=>Jn(B=>({...B,appSecret:E.target.value}))}),s.jsx("p",{className:"text-[11px] text-gray-500 leading-snug",children:"与 AppID 成对落库;接口响应与小程序配置中均不会返回此字段。"})]})]})]}),s.jsxs(rn,{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 E={tagId:Tt.tagId.trim(),label:Tt.label.trim(),aliases:Tt.aliases.trim(),url:Tt.url.trim(),type:Tt.type,appId:Tt.appId.trim(),appSecret:Tt.appSecret.trim(),pagePath:Tt.pagePath.trim()};if(E.tagId){const B=E.tagId;if([...B].length>50){G.error("标签ID 最长 50 个字符");return}if(/[#,\n\r\t]/.test(B)){G.error("标签ID 不能含 #、逗号或换行");return}}if(!E.label){G.error("显示文字必填");return}E.type==="miniprogram"&&(E.url=""),E.type==="wxlink"&&(E.appId="",E.pagePath=""),Sa(!0);try{const B=await Nt("/api/db/link-tags",E);B!=null&&B.success?(G.success(Pr?"已更新":"已添加"),as(!1),na(),Rr()):G.error((B==null?void 0:B.error)??"保存失败")}catch(B){console.error(B),G.error("保存失败")}finally{Sa(!1)}},disabled:Yr,className:"bg-amber-500 hover:bg-amber-600 text-white",children:Yr?"保存中...":"保存"})]})]})})]})]}),s.jsx(yV,{open:mn,onOpenChange:Xr,editingPerson:ei,onSubmit:async E=>{var ke;const B={personId:E.personId||E.name.toLowerCase().replace(/\s+/g,"_")+"_"+Date.now().toString(36),name:E.name,userId:E.boundUserId,aliases:E.aliases||void 0,label:E.label,ckbApiKey:E.ckbApiKey||void 0,greeting:E.greeting||void 0,tips:E.tips||void 0,remarkType:E.remarkType||void 0,remarkFormat:E.remarkFormat||void 0,addFriendInterval:E.addFriendInterval,startTime:E.startTime||void 0,endTime:E.endTime||void 0,deviceGroups:(ke=E.deviceGroups)!=null&&ke.trim()?E.deviceGroups.split(",").map(Ke=>parseInt(Ke.trim(),10)).filter(Ke=>!Number.isNaN(Ke)):void 0},ue=await Nt("/api/db/persons",B);if(ue&&ue.success===!1){const Ke=ue;Ke.ckbResponse&&console.log("存客宝返回",Ke.ckbResponse);const xt=Ke.error||"操作失败";throw new Error(xt)}if(vs(),G.success(ei?"已保存":"已添加"),ue!=null&&ue.ckbCreateResult&&Object.keys(ue.ckbCreateResult).length>0){const Ke=ue.ckbCreateResult;console.log("存客宝创建结果",Ke);const xt=Ke.planId??Ke.id,at=xt!=null?[`planId: ${xt}`]:[];Ke.apiKey!=null&&at.push("apiKey: ***"),G.info(at.length?`存客宝创建结果:${at.join(",")}`:"存客宝创建结果见控制台")}}}),s.jsx(Dt,{open:!!Ms,onOpenChange:E=>{E||Ca(null)},children:s.jsxs(Ot,{showCloseButton:!0,className:"bg-[#0f2137] border-gray-700 text-white max-w-md p-4 gap-3",children:[s.jsxs(_t,{className:"gap-1",children:[s.jsx($t,{className:"text-white text-base",children:"确认删除"}),s.jsx(nd,{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(rn,{className:"gap-2 sm:gap-2 pt-1",children:[s.jsx(J,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-300",onClick:()=>Ca(null),children:"取消"}),s.jsx(J,{variant:"destructive",size:"sm",className:"bg-red-600 hover:bg-red-700",onClick:async()=>{Ms&&(await Mi(`/api/db/persons?personId=${Ms.personId}`),Ca(null),vs(),G.success("已删除"))},children:"确定删除"})]})]})}),s.jsx(Dt,{open:Zs,onOpenChange:Ui,children:s.jsxs(Ot,{className:"max-w-2xl bg-[#0f2137] border-gray-700",children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[s.jsx(Kn,{className:"w-5 h-5 text-green-400"}),Wi," — 获客详情(共 ",mr," 条)"]})}),s.jsx("div",{className:"max-h-[450px] overflow-y-auto space-y-2",children:tl?s.jsxs("div",{className:"flex items-center justify-center py-8",children:[s.jsx(He,{className:"w-5 h-5 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):er.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:"时间"})]}),er.map((E,B)=>s.jsxs("div",{className:"grid grid-cols-[40px_1fr_90px_90px_70px_60px_110px] gap-2 px-3 py-2 bg-[#0a1628] rounded text-sm",children:[s.jsx("span",{className:"text-gray-500 text-xs",children:(Zr-1)*20+B+1}),s.jsx("span",{className:"text-white truncate",children:E.nickname||E.name||E.userId||"-"}),s.jsx("span",{className:"text-gray-300 text-xs",children:E.phone||"-"}),s.jsx("span",{className:"text-gray-300 text-xs truncate",children:E.wechatId||"-"}),s.jsx("span",{className:"text-xs",children:E.source==="article_mention"?s.jsx("span",{className:"text-purple-400",children:"文章@"}):E.source==="index_lead"?s.jsx("span",{className:"text-blue-400",children:"首页"}):s.jsx("span",{className:"text-gray-500",children:E.source||"-"})}),s.jsx("span",{className:"text-[10px]",children:s.jsx("span",{className:"text-green-400 bg-green-400/10 px-1 py-0.5 rounded",children:"已添加"})}),s.jsx("span",{className:"text-gray-500 text-xs",children:E.createdAt?new Date(E.createdAt).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"-"})]},E.id))]})}),mr>20&&s.jsxs("div",{className:"flex items-center justify-center gap-2 pt-2",children:[s.jsx(J,{size:"sm",variant:"outline",disabled:Zr<=1,onClick:()=>Dn(ys,Wi,Zr-1),className:"border-gray-600 text-gray-300 bg-transparent h-7 px-3",children:"上一页"}),s.jsxs("span",{className:"text-gray-400 text-xs",children:[Zr," / ",Math.ceil(mr/20)]}),s.jsx(J,{size:"sm",variant:"outline",disabled:Zr>=Math.ceil(mr/20),onClick:()=>Dn(ys,Wi,Zr+1),className:"border-gray-600 text-gray-300 bg-transparent h-7 px-3",children:"下一页"})]})]})})]})}const Ei={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 wj(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):Ei.stats}function jj(t){return Array.isArray(t)?t.map(e=>typeof e=="string"?e:String(e??"")).filter(Boolean):Ei.highlights}function NV(){const[t,e]=y.useState(Ei),[n,r]=y.useState(!0),[a,i]=y.useState(!1),[o,c]=y.useState(!1),u=y.useRef(null);y.useEffect(()=>{Oe("/api/admin/author-settings").then(k=>{const T=k==null?void 0:k.data;T&&typeof T=="object"&&e({name:String(T.name??Ei.name),avatar:String(T.avatar??Ei.avatar),avatarImg:String(T.avatarImg??""),title:String(T.title??Ei.title),bio:String(T.bio??Ei.bio),stats:wj(T.stats).length?wj(T.stats):Ei.stats,highlights:jj(T.highlights).length?jj(T.highlights):Ei.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)},T=await Nt("/api/admin/author-settings",k);if(!T||T.success===!1){G.error("保存失败: "+(T&&typeof T=="object"&&"error"in T?T.error:""));return}i(!1);const C=document.createElement("div");C.className="fixed top-4 right-4 z-50 px-4 py-2 rounded-lg bg-[#38bdac] text-white text-sm shadow-lg",C.textContent="作者设置已保存",document.body.appendChild(C),setTimeout(()=>C.remove(),2e3)}catch(k){console.error(k),G.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{i(!1)}},f=async k=>{var C;const T=(C=k.target.files)==null?void 0:C[0];if(T){c(!0);try{const R=new FormData;R.append("file",T),R.append("folder","avatars");const O=Wu(),U={};O&&(U.Authorization=`Bearer ${O}`);const z=await(await fetch(zl("/api/upload"),{method:"POST",body:R,credentials:"include",headers:U})).json();z!=null&&z.success&&(z!=null&&z.url)?e(L=>({...L,avatarImg:z.url})):G.error("上传失败: "+((z==null?void 0:z.error)||"未知错误"))}catch(R){console.error(R),G.error("上传失败")}finally{c(!1),u.current&&(u.current.value="")}}},m=()=>e(k=>({...k,stats:[...k.stats,{label:"",value:""}]})),g=k=>e(T=>({...T,stats:T.stats.filter((C,R)=>R!==k)})),b=(k,T,C)=>e(R=>({...R,stats:R.stats.map((O,U)=>U===k?{...O,[T]:C}:O)})),N=()=>e(k=>({...k,highlights:[...k.highlights,""]})),j=k=>e(T=>({...T,highlights:T.highlights.filter((C,R)=>R!==k)})),v=(k,T)=>e(C=>({...C,highlights:C.highlights.map((R,O)=>O===k?T: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(Ti,{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(Tn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{children:[s.jsxs(ut,{className:"flex items-center gap-2 text-white",children:[s.jsx(Ti,{className:"w-4 h-4 text-[#38bdac]"}),"基本信息"]}),s.jsx(Gt,{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(te,{className:"text-gray-300",children:"姓名"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.name,onChange:k=>e(T=>({...T,name:k.target.value})),placeholder:"卡若"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"首字母占位(无头像时显示)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white w-20",value:t.avatar,onChange:k=>e(T=>({...T,avatar:k.target.value.slice(0,1)||"K"})),placeholder:"K"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(nk,{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(T=>({...T,avatarImg:k.target.value})),placeholder:"上传或粘贴 URL,如 /uploads/avatars/xxx.png"}),s.jsx("input",{ref:u,type:"file",accept:"image/*",className:"hidden",onChange:f}),s.jsxs(J,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:o,onClick:()=>{var k;return(k=u.current)==null?void 0:k.click()},children:[s.jsx(Of,{className:"w-4 h-4 mr-2"}),o?"上传中...":"上传"]})]}),t.avatarImg&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:ya(t.avatarImg.startsWith("http")?t.avatarImg:zl(t.avatarImg)),alt:"头像预览",className:"w-20 h-20 rounded-full object-cover border border-gray-600"})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"头衔"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",value:t.title,onChange:k=>e(T=>({...T,title:k.target.value})),placeholder:"Soul派对房主理人 · 私域运营专家"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"个人简介"}),s.jsx(Go,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[120px]",value:t.bio,onChange:k=>e(T=>({...T,bio:k.target.value})),placeholder:"每天早上6点到9点..."})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{children:[s.jsx(ut,{className:"text-white",children:"统计数据"}),s.jsx(Gt,{className:"text-gray-400",children:"展示在作者卡片中的数字指标,如「商业案例 62」「连续直播 365天」。第一个「商业案例」的值可由书籍统计自动更新。"})]}),s.jsxs(_e,{className:"space-y-3",children:[t.stats.map((k,T)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(le,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.label,onChange:C=>b(T,"label",C.target.value),placeholder:"标签"}),s.jsx(le,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.value,onChange:C=>b(T,"value",C.target.value),placeholder:"数值"}),s.jsx(J,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>g(T),children:s.jsx(ns,{className:"w-4 h-4"})})]},T)),s.jsxs(J,{variant:"outline",size:"sm",onClick:m,className:"border-gray-600 text-gray-400",children:[s.jsx(zn,{className:"w-4 h-4 mr-2"}),"添加统计项"]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{children:[s.jsx(ut,{className:"text-white",children:"亮点标签"}),s.jsx(Gt,{className:"text-gray-400",children:"作者优势或成就的简短描述,以标签形式展示。"})]}),s.jsxs(_e,{className:"space-y-3",children:[t.highlights.map((k,T)=>s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(le,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k,onChange:C=>v(T,C.target.value),placeholder:"5年私域运营经验"}),s.jsx(J,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>j(T),children:s.jsx(ns,{className:"w-4 h-4"})})]},T)),s.jsxs(J,{variant:"outline",size:"sm",onClick:N,className:"border-gray-600 text-gray-400",children:[s.jsx(zn,{className:"w-4 h-4 mr-2"}),"添加亮点"]})]})]})]})]})}function wV(t){return confirm(`确定删除该${t}?此操作不可恢复。`)?window.prompt(`请输入「删除」以确认删除${t}`)==="删除":!1}function jV(){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=Hl(h,300),[g,b]=y.useState(!0),[N,j]=y.useState(null),[v,k]=y.useState(!1),[T,C]=y.useState(null),[R,O]=y.useState(""),[U,P]=y.useState(""),[z,L]=y.useState(""),[Q,se]=y.useState("admin"),[$,ie]=y.useState("active"),[oe,me]=y.useState(!1);async function I(){var W;b(!0),j(null);try{const fe=new URLSearchParams({page:String(a),pageSize:String(o)});m.trim()&&fe.set("search",m.trim());const he=await Oe(`/api/admin/users?${fe}`);he!=null&&he.success?(e(he.records||[]),r(he.total??0),u(he.totalPages??0)):j(he.error||"加载失败")}catch(fe){const he=fe;j(he.status===403?"无权限访问":((W=he==null?void 0:he.data)==null?void 0:W.error)||"加载失败"),e([])}finally{b(!1)}}y.useEffect(()=>{I()},[a,o,m]);const Y=()=>{C(null),O(""),P(""),L(""),se("admin"),ie("active"),k(!0)},F=W=>{C(W),O(W.username),P(""),L(W.name||""),se(W.role==="super_admin"?"super_admin":"admin"),ie(W.status==="disabled"?"disabled":"active"),k(!0)},ge=async()=>{var W;if(!R.trim()){j("用户名不能为空");return}if(!T&&!U){j("新建时密码必填,至少 6 位");return}if(U&&U.length<6){j("密码至少 6 位");return}j(null),me(!0);try{if(T){const fe=await Zt("/api/admin/users",{id:T.id,password:U||void 0,name:z.trim(),role:Q,status:$});fe!=null&&fe.success?(k(!1),I()):j((fe==null?void 0:fe.error)||"保存失败")}else{const fe=await Nt("/api/admin/users",{username:R.trim(),password:U,name:z.trim(),role:Q});fe!=null&&fe.success?(k(!1),I()):j((fe==null?void 0:fe.error)||"保存失败")}}catch(fe){const he=fe;j(((W=he==null?void 0:he.data)==null?void 0:W.error)||"保存失败")}finally{me(!1)}},X=async W=>{var fe;if(!wV("管理员")){j("已取消删除");return}try{const he=await Mi(`/api/admin/users?id=${W}`);he!=null&&he.success?I():j((he==null?void 0:he.error)||"删除失败")}catch(he){const de=he;j(((fe=de==null?void 0:de.data)==null?void 0:fe.error)||"删除失败")}},V=W=>{if(!W)return"-";try{const fe=new Date(W);return isNaN(fe.getTime())?W:fe.toLocaleString("zh-CN")}catch{return W}};return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(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(le,{placeholder:"搜索用户名/昵称",value:h,onChange:W=>f(W.target.value),className:"w-48 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"}),s.jsx(J,{variant:"outline",size:"sm",onClick:I,disabled:g,className:"border-gray-600 text-gray-300",children:s.jsx(He,{className:`w-4 h-4 ${g?"animate-spin":""}`})}),s.jsxs(J,{onClick:Y,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(zn,{className:"w-4 h-4 mr-2"}),"新增管理员"]})]})]}),N&&s.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 text-sm flex justify-between items-center",children:[s.jsx("span",{children:N}),s.jsx("button",{type:"button",onClick:()=>j(null),className:"text-red-400 hover:text-red-300",children:"×"})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-0",children:g?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(s.Fragment,{children:[s.jsxs(fs,{children:[s.jsx(ps,{children:s.jsxs(gt,{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(W=>s.jsxs(gt,{className:"border-gray-700/50",children:[s.jsx(je,{className:"text-gray-300",children:W.id}),s.jsx(je,{className:"text-white font-medium",children:W.username}),s.jsx(je,{className:"text-gray-400",children:W.name||"-"}),s.jsx(je,{children:s.jsx(Be,{variant:"outline",className:W.role==="super_admin"?"border-amber-500/50 text-amber-400":"border-gray-600 text-gray-400",children:W.role==="super_admin"?"超级管理员":"管理员"})}),s.jsx(je,{children:s.jsx(Be,{variant:"outline",className:W.status==="active"?"border-[#38bdac]/50 text-[#38bdac]":"border-gray-500 text-gray-500",children:W.status==="active"?"正常":"已禁用"})}),s.jsx(je,{className:"text-gray-500 text-sm",children:V(W.createdAt)}),s.jsxs(je,{className:"text-right",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>F(W),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(sn,{className:"w-4 h-4"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>X(W.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(ts,{className:"w-4 h-4"})})]})]},W.id)),t.length===0&&!g&&s.jsx(gt,{children:s.jsx(je,{colSpan:7,className:"text-center py-12 text-gray-500",children:N==="无权限访问"?"仅超级管理员可查看":"暂无管理员"})})]})]}),c>1&&s.jsx("div",{className:"p-4 border-t border-gray-700/50",children:s.jsx(qs,{page:a,pageSize:o,total:n,totalPages:c,onPageChange:i})})]})})}),s.jsx(Dt,{open:v,onOpenChange:k,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(_t,{children:s.jsx($t,{className:"text-white",children:T?"编辑管理员":"新增管理员"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"用户名"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"登录用户名",value:R,onChange:W=>O(W.target.value),disabled:!!T}),T&&s.jsx("p",{className:"text-xs text-gray-500",children:"用户名不可修改"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:T?"新密码(留空不改)":"密码"}),s.jsx(le,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:T?"留空表示不修改":"至少 6 位",value:U,onChange:W=>P(W.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"昵称"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"显示名称",value:z,onChange:W=>L(W.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"角色"}),s.jsxs("select",{value:Q,onChange:W=>se(W.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[s.jsx("option",{value:"admin",children:"管理员"}),s.jsx("option",{value:"super_admin",children:"超级管理员"})]})]}),T&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"状态"}),s.jsxs("select",{value:$,onChange:W=>ie(W.target.value),className:"w-full h-10 px-3 rounded-md bg-[#0a1628] border border-gray-700 text-white",children:[s.jsx("option",{value:"active",children:"正常"}),s.jsx("option",{value:"disabled",children:"禁用"})]})]})]}),s.jsxs(rn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>k(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(ns,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:ge,disabled:oe,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),oe?"保存中...":"保存"]})]})]})})]})}function Pn({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 W4(){const t=["Authorization: Bearer {token}","Content-Type: application/json"];return s.jsxs("div",{className:"p-8 w-full bg-[#0a1628] text-white",children:[s.jsxs("div",{className:"mb-8",children:[s.jsx("h1",{className:"text-2xl font-bold text-white",children:"API 接口文档"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"内容管理相关接口 · RESTful · 基础路径 /api · 管理端需 Bearer Token"})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(dt,{className:"pb-3",children:s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(Hx,{className:"w-5 h-5 text-[#38bdac]"}),"1. Authentication"]})}),s.jsx(_e,{className:"space-y-4",children:s.jsx(Pn,{method:"POST",url:"/api/admin",desc:"登录,返回 JWT token",headers:["Content-Type: application/json"],body:`{ + "username": "admin", + "password": "your_password" +}`,response:`{ + "success": true, + "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", + "expires_at": "2026-03-16T12:00:00Z" +}`})})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(dt,{className:"pb-3",children:s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(ur,{className:"w-5 h-5 text-[#38bdac]"}),"2. 章节管理 (Chapters)"]})}),s.jsxs(_e,{className:"space-y-4",children:[s.jsx(Pn,{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(Pn,{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(Pn,{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(Pn,{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(Pn,{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(Pn,{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(Pn,{method:"DELETE",url:"/api/upload?path={encodeURIComponent(文件URL)}",desc:"按 URL 删除已上传文件(本地或 OSS,需与上传返回的 url 一致)",headers:["Authorization: Bearer {token}(建议携带)"],response:`{ + "success": true, + "message": "删除成功" +}`})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(dt,{className:"pb-3",children:s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(Ti,{className:"w-5 h-5 text-[#38bdac]"}),"3. 人物管理 (@Mentions)"]})}),s.jsxs(_e,{className:"space-y-4",children:[s.jsx(Pn,{method:"GET",url:"/api/db/persons",desc:"人物列表",headers:t,response:`{ + "success": true, + "data": [ + { "personId": "p1", "label": "张三", "aliases": ["老张"], ... } + ] +}`}),s.jsx(Pn,{method:"GET",url:"/api/db/person?personId={id}",desc:"人物详情",headers:t,response:`{ + "success": true, + "data": { + "personId": "p1", + "label": "张三", + "aliases": ["老张"], + "description": "..." + } +}`}),s.jsx(Pn,{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(Pn,{method:"DELETE",url:"/api/db/persons?personId={id}",desc:"删除人物",headers:t,response:`{ + "success": true, + "message": "已删除" +}`})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(dt,{className:"pb-3",children:s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(gu,{className:"w-5 h-5 text-[#38bdac]"}),"4. 链接标签 (#LinkTags)"]})}),s.jsxs(_e,{className:"space-y-4",children:[s.jsx(Pn,{method:"GET",url:"/api/db/link-tags",desc:"标签列表",headers:t,response:`{ + "success": true, + "data": [ + { "tagId": "t1", "label": "官网", "aliases": [], "type": "url", "url": "https://..." } + ] +}`}),s.jsx(Pn,{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(Pn,{method:"DELETE",url:"/api/db/link-tags?tagId={id}",desc:"删除标签",headers:t,response:`{ + "success": true, + "message": "已删除" +}`})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(dt,{className:"pb-3",children:s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(xa,{className:"w-5 h-5 text-[#38bdac]"}),"5. 内容搜索"]})}),s.jsx(_e,{className:"space-y-4",children:s.jsx(Pn,{method:"GET",url:"/api/search?q={keyword}",desc:"搜索(标题优先 3 条 + 内容匹配)",headers:t,response:`{ + "success": true, + "data": { + "titleMatches": [{ "id": "s1", "title": "...", "snippet": "..." }], + "contentMatches": [{ "id": "s2", "title": "...", "snippet": "..." }] + } +}`})})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(dt,{className:"pb-3",children:s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(Kx,{className:"w-5 h-5 text-[#38bdac]"}),"6. 内容排行"]})}),s.jsx(_e,{className:"space-y-4",children:s.jsx(Pn,{method:"GET",url:"/api/db/book?action=ranking",desc:"排行榜数据",headers:t,response:`{ + "success": true, + "data": [ + { "id": "s1", "title": "...", "clickCount": 100, "payCount": 50, "hotScore": 120, "hotRank": 1 } + ] +}`})})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(dt,{className:"pb-3",children:s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx($l,{className:"w-5 h-5 text-[#38bdac]"}),"7. 小程序接口"]})}),s.jsxs(_e,{className:"space-y-4",children:[s.jsx(Pn,{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(Pn,{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(Pn,{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(Pn,{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(Pn,{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 Li="/pages/member-detail/member-detail",Ba="/pages/read/read",Ha={[Li]:"成员详情",[Ba]:"文章详情 / 阅读"},Px=[{value:"/pages/index/index",label:"首页"},{value:"/pages/chapters/chapters",label:"目录"},{value:"/pages/match/match",label:"找伙伴"},{value:"/pages/my/my",label:"我的"},{value:"/pages/read/read",label:"文章详情 / 阅读"},{value:"/pages/link-preview/link-preview",label:"链接预览"},{value:"/pages/agreement/agreement",label:"用户协议"},{value:"/pages/privacy/privacy",label:"隐私政策"},{value:"/pages/referral/referral",label:"邀请"},{value:"/pages/purchases/purchases",label:"购买记录"},{value:"/pages/reading-records/reading-records",label:"阅读记录"},{value:"/pages/settings/settings",label:"设置"},{value:"/pages/search/search",label:"搜索"},{value:"/pages/addresses/addresses",label:"地址列表"},{value:"/pages/addresses/edit",label:"编辑地址"},{value:"/pages/withdraw-records/withdraw-records",label:"提现记录"},{value:"/pages/wallet/wallet",label:"钱包"},{value:"/pages/vip/vip",label:"会员中心"},{value:"/pages/member-detail/member-detail",label:"成员详情"},{value:"/pages/mentors/mentors",label:"导师列表"},{value:"/pages/mentor-detail/mentor-detail",label:"导师详情"},{value:"/pages/profile-show/profile-show",label:"资料展示"},{value:"/pages/profile-edit/profile-edit",label:"编辑资料"},{value:"/pages/avatar-nickname/avatar-nickname",label:"头像昵称"},{value:"/pages/gift-pay/detail",label:"礼物支付 · 详情"},{value:"/pages/gift-pay/list",label:"礼物支付 · 列表"},{value:"/pages/gift-pay/redemption-detail",label:"礼物支付 · 兑换详情"},{value:"/pages/dev-login/dev-login",label:"开发登录"}],kV=Ba;function kj(t){const e=String(t.pageName??"").trim();return e||Ha[t.pagePath]||"—"}function SV(t){const e=String(t??"").trim();return e==="singlePage"||e==="single_page"?"singlePage":"fullApp"}function Sj(t){return t==="singlePage"?"单页面":"多页面"}function Io(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`pp-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function hb(t){return/^[a-zA-Z][a-zA-Z0-9_]*$/.test(t.trim())}function CV(t){if(!t||typeof t!="object"||Array.isArray(t))return[];const e=t.pagePopupItems;if(!Array.isArray(e))return[];const n=[];return e.forEach(r=>{if(!r||typeof r!="object"||Array.isArray(r))return;const a=r,i=String(a.key??"").trim();if(!hb(i))return;const o=String(a.pagePath??"").trim();o.startsWith("/")&&n.push({id:typeof a.id=="string"&&a.id.trim()?a.id.trim():Io(),pageName:String(a.pageName??"").trim(),pagePath:o,scope:SV(a.scope),key:i,behavior:String(a.behavior??"").trim()||"—",content:String(a.content??"")})}),n}function EV(t){if(!t||typeof t!="object"||Array.isArray(t))return[];const e=t,n=[],r=e.memberDetailPage;if(r&&typeof r=="object"&&!Array.isArray(r)){const o=r;typeof o.unlockIntroTitle=="string"&&o.unlockIntroTitle.trim()&&n.push({id:Io(),pageName:Ha[Li],pagePath:Li,scope:"fullApp",key:"unlockIntroTitle",behavior:"解锁前说明弹窗 · 标题(wx.showModal title)",content:o.unlockIntroTitle}),typeof o.unlockIntroBody=="string"&&o.unlockIntroBody.trim()&&n.push({id:Io(),pageName:Ha[Li],pagePath:Li,scope:"fullApp",key:"unlockIntroBody",behavior:"解锁前说明弹窗 · 正文(wx.showModal content)",content:o.unlockIntroBody})}const a=e.readPage;if(a&&typeof a=="object"&&!Array.isArray(a)){const o=a,c=[["beforeLoginHint","未登录时付费墙上方说明","fullApp"],["singlePageTitle","朋友圈单页 · 付费区标题","singlePage"],["singlePagePaywallHint","朋友圈单页 · 付费墙说明","singlePage"]];for(const[u,h,f]of c)typeof o[u]=="string"&&String(o[u]).trim()&&n.push({id:Io(),pageName:Ha[Ba],pagePath:Ba,scope:f,key:u,behavior:h,content:String(o[u])})}const i=e.customPagePopups;return Array.isArray(i)&&i.forEach((o,c)=>{if(!o||typeof o!="object"||Array.isArray(o))return;const u=o,h=String(u.pagePath??"").trim();if(!h.startsWith("/"))return;const f=String(u.pageName??"").trim(),m=(g,b,N,j)=>{if(typeof N!="string"||!N.trim())return;const v=`c${c}_${g}`;hb(v)&&n.push({id:Io(),pageName:f||Ha[h]||"",pagePath:h,scope:j,key:v,behavior:`${b}(旧版 customPagePopups 迁移)`,content:N})};m("fullModalTitle","完整端弹窗标题",u.fullModalTitle,"fullApp"),m("fullModalBody","完整端弹窗正文",u.fullModalBody,"fullApp"),m("singlePageTitle","单页标题",u.singlePageTitle,"singlePage"),m("singlePageBody","单页说明",u.singlePageBody,"singlePage")}),n}const TV=new Set(["memberDetailPage","readPage","customPagePopups","pagePopupItems"]);function MV(t){const e={};if(!t||typeof t!="object"||Array.isArray(t))return e;const n=t;for(const r of Object.keys(n))TV.has(r)||(e[r]=n[r]);return e}function AV(t){let e=CV(t);return e.length===0&&(e=EV(t)),{extra:MV(t),pagePopupItems:IV(e)}}function IV(t){const e=new Set,n=[];for(const r of t){const a=`${r.pagePath}\0${r.key}`;e.has(a)||(e.add(a),n.push(r))}return n}function PV(t,e){const n={...e};n.pagePopupItems=t.map(a=>({id:a.id,pageName:String(a.pageName??"").trim(),pagePath:a.pagePath.trim(),scope:a.scope==="singlePage"?"singlePage":"fullApp",key:a.key.trim(),behavior:a.behavior.trim()||"—",content:a.content})),delete n.memberDetailPage,delete n.readPage,delete n.customPagePopups;const r=n.chaptersPage;if(r&&typeof r=="object"&&!Array.isArray(r)){const a=r??{};delete a.sectionNewBadgeText;const i=String(a.newBadgeText??"").trim();i?a.newBadgeText=i:delete a.newBadgeText}return n}function RV(t){const e=String(t.content||"").replace(/\s+/g," ").trim();return e.length>56?`${e.slice(0,56)}…`:e||"—"}const LV=[{pageName:Ha[Li],pagePath:Li,scope:"fullApp",key:"unlockIntroTitle",behavior:"解锁前说明弹窗 · 标题(wx.showModal title)",content:"解锁与链接说明"},{pageName:Ha[Li],pagePath:Li,scope:"fullApp",key:"unlockIntroBody",behavior:"解锁前说明弹窗 · 正文(wx.showModal content)",content:`「链接」用于提交留资,由对方通过获客计划跟进;「解锁」用于复制手机/微信号后自行添加好友。 + +请确认已了解后再登录。`},{pageName:Ha[Ba],pagePath:Ba,scope:"fullApp",key:"beforeLoginHint",behavior:"未登录时付费墙上方说明",content:"试读进度与下方百分比以后台配置为准;登录后可购买解锁全文。"},{pageName:Ha[Ba],pagePath:Ba,scope:"singlePage",key:"singlePageTitle",behavior:"朋友圈单页 · 付费区标题",content:"解锁全文"},{pageName:Ha[Ba],pagePath:Ba,scope:"singlePage",key:"singlePagePaywallHint",behavior:"朋友圈单页 · 付费墙说明",content:"当前为朋友圈单页预览,无法在此登录或付款。请点击底部「前往小程序」进入完整版后再解锁本章。"}];function OV(){return LV.map(t=>({...t,id:Io()}))}const Bc=10,Cj=()=>({id:Io(),pageName:"",pagePath:kV,scope:"fullApp",key:"",behavior:"",content:""});function DV({pagePopupItems:t,setPagePopupItems:e,extraKeysCount:n}){const[r,a]=y.useState(""),[i,o]=y.useState(!1),[c,u]=y.useState("add"),[h,f]=y.useState(Cj()),[m,g]=y.useState(null),[b,N]=y.useState(1),j=y.useMemo(()=>{const P=h.pagePath.trim();return Px.some(z=>z.value===P)?P:"__other__"},[h.pagePath]),v=y.useMemo(()=>{const P=r.trim().toLowerCase();return P?t.filter(z=>`${z.pageName} ${z.pagePath} ${Sj(z.scope)} ${z.key} ${z.behavior} ${z.content} ${kj(z)}`.toLowerCase().includes(P)):t},[r,t]),k=y.useMemo(()=>Math.max(1,Math.ceil(v.length/Bc)),[v.length]),T=y.useMemo(()=>{const P=(b-1)*Bc;return v.slice(P,P+Bc)},[v,b]);y.useEffect(()=>{N(1)},[r]),y.useEffect(()=>{N(P=>Math.min(P,k))},[k]);const C=()=>{f(Cj()),u("add"),o(!0)},R=P=>{f({...P,scope:P.scope==="singlePage"?"singlePage":"fullApp"}),u("edit"),o(!0)},O=()=>{const P=h.pagePath.trim(),z=h.key.trim();if(!P.startsWith("/")){G.error("页面路径须以 / 开头");return}if(!hb(z)){G.error("键名须为英文:字母开头,仅字母、数字、下划线");return}if(!h.behavior.trim()){G.error("请填写行为说明");return}if(t.some(Q=>Q.pagePath===P&&Q.key===z&&Q.id!==h.id)){G.error("同一页面下键名不能重复");return}c==="add"?(e(Q=>[...Q,{...h,id:h.id||Io()}]),G.success("已添加,请点击右上角「保存设置」提交")):(e(Q=>Q.map(se=>se.id===h.id?{...h}:se)),G.success("已更新,请点击「保存设置」提交")),o(!1)},U=()=>{m&&(e(P=>P.filter(z=>z.id!==m)),G.success("已删除,请点击「保存设置」提交"),g(null))};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs(De,{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(rk,{className:"w-5 h-5 text-[#38bdac]"}),"弹窗文案(按页面 + 键)"]}),s.jsxs(Gt,{className:"text-gray-400",children:["先",s.jsx("strong",{className:"text-gray-300",children:"新增"}),"文案:填写",s.jsx("strong",{className:"text-gray-300",children:"页面名称"}),"、路径、",s.jsx("strong",{className:"text-gray-300",children:"类型"}),"(单页面 / 多页面)、",s.jsx("strong",{className:"text-[#38bdac]",children:"英文键名"}),"、行为说明、文案内容。 小程序通过 ",s.jsx("code",{className:"text-[#38bdac]/90",children:"pagePath + key"})," 从 ",s.jsx("code",{className:"text-[#38bdac]/90",children:"mpConfig.mpUi.pagePopupItems"})," 读取。 同一页面可配置多条(不同 key)。下方表格每页展示 ",Bc," 条;全部条目随右上角「保存设置」写入数据库,与分页无关。"]})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsx("p",{className:"text-xs text-gray-500",children:n>0?`另有 ${n} 类其它 mpUi 已保留,保存时一并写回。`:"保存后约 5 分钟内随配置缓存刷新。"}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(J,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-200",title:"用与小程序对齐的 5 条标准文案替换当前列表,再点「保存设置」写入数据库。迁移完成后可移除此按钮。",onClick:()=>{e(OV()),G.info("已填入标准 5 条,请点击「保存设置」写入数据库")},children:[s.jsx(iA,{className:"w-3.5 h-3.5 mr-1.5"}),"填入默认种子"]}),s.jsxs(J,{type:"button",size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",onClick:C,children:[s.jsx(A5,{className:"w-3.5 h-3.5 mr-1.5"}),"新增文案"]})]})]}),s.jsxs("div",{className:"space-y-2 max-w-xl w-full",children:[s.jsxs(te,{className:"text-gray-400 text-xs flex items-center gap-1.5",children:[s.jsx(xa,{className:"w-3.5 h-3.5"}),"筛选(页面名称 / 类型 / 路径 / 键 / 行为 / 正文)"]}),s.jsx("div",{className:"rounded-md border border-gray-700 bg-[#0a1628] px-3 h-10 flex items-center",children:s.jsx(le,{className:"border-0 bg-transparent text-white h-9 px-0 shadow-none focus-visible:ring-0 placeholder:text-gray-600",placeholder:"例如:read、beforeLogin、singlePage…",value:r,onChange:P=>a(P.target.value)})})]}),s.jsxs("div",{className:"rounded-lg border border-gray-700/80 overflow-x-auto w-full",children:[s.jsxs(fs,{className:"w-full min-w-[1320px] table-fixed",children:[s.jsx(ps,{children:s.jsxs(gt,{className:"border-gray-700 hover:bg-[#0a1628]/80 bg-[#0a1628]",children:[s.jsx(Se,{className:"text-gray-300 w-[11%] min-w-[108px]",children:"页面名称"}),s.jsx(Se,{className:"text-gray-300 w-[8%] min-w-[88px]",children:"类型"}),s.jsx(Se,{className:"text-gray-300 w-[19%] min-w-[200px]",children:"页面路径"}),s.jsx(Se,{className:"text-gray-300 w-[10%] min-w-[108px]",children:"键名(英文)"}),s.jsx(Se,{className:"text-gray-300 w-[13%] min-w-[108px]",children:"行为"}),s.jsx(Se,{className:"text-gray-300 w-[25%] min-w-[220px]",children:"文案摘要"}),s.jsx(Se,{className:"text-gray-300 text-right w-[14%] min-w-[200px] whitespace-nowrap",children:"操作"})]})}),s.jsx(ms,{children:T.map(P=>s.jsxs(gt,{className:"border-gray-800 hover:bg-[#0f2137]/90",children:[s.jsx(je,{className:"text-sm text-gray-200 align-top font-medium",children:kj(P)}),s.jsx(je,{className:"align-top",children:s.jsx(Be,{variant:P.scope==="singlePage"?"outline":"secondary",className:P.scope==="singlePage"?"border-amber-500/50 text-amber-200/95 text-[11px]":"text-[11px]",children:Sj(P.scope)})}),s.jsx(je,{className:"font-mono text-xs text-[#38bdac]/95 align-top break-all",children:P.pagePath}),s.jsx(je,{className:"font-mono text-xs text-amber-200/90 align-top break-all",children:P.key}),s.jsx(je,{className:"text-xs text-gray-300 align-top",children:P.behavior}),s.jsx(je,{className:"text-xs align-top max-w-[220px] min-w-0 py-2",children:s.jsx("div",{className:"line-clamp-1 min-w-0 text-gray-400 break-all cursor-default",title:String(P.content??"").replace(/\s+/g," ").trim()||"—",children:RV(P)})}),s.jsx(je,{className:"align-middle text-right",children:s.jsxs("div",{className:"inline-flex flex-nowrap items-center justify-end gap-1 min-w-[168px]",children:[s.jsxs(J,{type:"button",variant:"ghost",size:"sm",className:"h-8 shrink-0 px-2.5 text-[#38bdac]",onClick:()=>R(P),children:[s.jsx(Wx,{className:"w-3.5 h-3.5 mr-1"}),"编辑"]}),s.jsxs(J,{type:"button",variant:"ghost",size:"sm",className:"h-8 shrink-0 px-2.5 text-gray-400 hover:text-red-400",onClick:()=>g(P.id),children:[s.jsx(ts,{className:"w-3.5 h-3.5 mr-1"}),"删除"]})]})})]},P.id))})]}),v.length===0&&s.jsx("p",{className:"text-center text-sm text-gray-500 py-8",children:"无数据,请点击「新增文案」或「填入默认种子」"}),v.length>0&&k>1&&s.jsx(qs,{page:b,totalPages:k,total:v.length,pageSize:Bc,onPageChange:N}),v.length>0&&k<=1&&s.jsxs("div",{className:"flex items-center py-3 px-5 border-t border-gray-700/50 text-sm text-gray-400",children:["共 ",v.length," 条,每页 ",Bc," 条"]})]})]})]}),s.jsx(Dt,{open:i,onOpenChange:o,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl w-[min(100vw-2rem,42rem)] max-h-[90vh] overflow-y-auto",children:[s.jsxs(_t,{children:[s.jsx($t,{children:c==="add"?"新增弹窗文案":"编辑弹窗文案"}),s.jsxs(nd,{className:"text-gray-400",children:["键名在小程序代码中与 ",s.jsx("code",{className:"text-[#38bdac]/90",children:"pagePath"})," 联合使用,请与开发约定后勿随意改键。"]})]}),s.jsxs("div",{className:"space-y-4 py-2",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"页面名称"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-600 text-white",placeholder:"如:文章详情 / 阅读",value:h.pageName,onChange:P=>f(z=>({...z,pageName:P.target.value}))}),s.jsx("p",{className:"text-[11px] text-gray-500",children:"便于表格识别;可与路径列对照,留空时对常见路径会自动显示默认名称。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"页面路径"}),s.jsxs(ko,{value:j,onValueChange:P=>{f(P==="__other__"?z=>{const L=z.pagePath.trim(),Q=Px.some(se=>se.value===L);return{...z,pagePath:Q?"/pages/":z.pagePath}}:z=>({...z,pagePath:P}))},children:[s.jsx(Ai,{className:"bg-[#0a1628] border-gray-600 text-white font-mono text-sm w-full",children:s.jsx(So,{placeholder:"选择页面路径"})}),s.jsxs(Ii,{className:"max-h-[min(60vh,320px)]",children:[Px.map(P=>s.jsxs(us,{value:P.value,className:"focus:bg-[#1a3a4a] focus:text-white font-mono text-xs",children:[s.jsx("span",{className:"text-gray-200",children:P.label}),s.jsx("span",{className:"text-gray-500 ml-2",children:P.value})]},P.value)),s.jsx(us,{value:"__other__",className:"focus:bg-[#1a3a4a] focus:text-white",children:"自定义路径…"})]})]}),j==="__other__"&&s.jsx(le,{className:"bg-[#0a1628] border-gray-600 text-white font-mono text-sm",placeholder:"/pages/xxx/xxx",value:h.pagePath,onChange:P=>f(z=>({...z,pagePath:P.target.value}))}),s.jsx("p",{className:"text-[11px] text-gray-500",children:"从列表选择常用页面;若路径未收录(如分包页),选「自定义路径」后手动填写。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"类型"}),s.jsxs(ko,{value:h.scope,onValueChange:P=>f(z=>({...z,scope:P==="singlePage"?"singlePage":"fullApp"})),children:[s.jsx(Ai,{className:"bg-[#0a1628] border-gray-600 text-white",children:s.jsx(So,{placeholder:"选择类型"})}),s.jsxs(Ii,{children:[s.jsx(us,{value:"fullApp",className:"focus:bg-[#1a3a4a] focus:text-white",children:"多页面(完整小程序)"}),s.jsx(us,{value:"singlePage",className:"focus:bg-[#1a3a4a] focus:text-white",children:"单页面(朋友圈预览等)"})]})]}),s.jsx("p",{className:"text-[11px] text-gray-500",children:"单页面:微信单页场景(如 1154);多页面:用户进入完整小程序后的页面。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"键名(英文,自定义)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-600 text-white font-mono text-sm",placeholder:"beforeLoginHint",value:h.key,disabled:c==="edit",onChange:P=>f(z=>({...z,key:P.target.value.replace(/[^a-zA-Z0-9_]/g,"")}))}),c==="edit"&&s.jsx("p",{className:"text-[11px] text-gray-500",children:"编辑时不可改键名;需改键请删除后新建。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"行为说明"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-600 text-white",placeholder:"如:未登录时付费墙上方展示",value:h.behavior,onChange:P=>f(z=>({...z,behavior:P.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"文案内容"}),s.jsx(Go,{className:"bg-[#0a1628] border-gray-600 text-white min-h-[140px]",placeholder:"弹窗正文、提示语等",value:h.content,onChange:P=>f(z=>({...z,content:P.target.value}))})]})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600",onClick:()=>o(!1),children:"取消"}),s.jsx(J,{className:"bg-[#38bdac] hover:bg-[#2da396] text-white",onClick:O,children:"确定"})]})]})}),s.jsx(Dt,{open:!!m,onOpenChange:P=>!P&&g(null),children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsxs(_t,{children:[s.jsx($t,{children:"删除该条文案?"}),s.jsx(nd,{className:"text-gray-400",children:"删除后需保存设置才会同步到小程序;若键名已被代码引用,删除后对应位置将走默认兜底。"})]}),s.jsxs(rn,{children:[s.jsx(J,{variant:"outline",className:"border-gray-600",onClick:()=>g(null),children:"取消"}),s.jsx(J,{className:"bg-red-600 hover:bg-red-700",onClick:U,children:"删除"})]})]})})]})}const _V={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},$V={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},zV={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...$V},ckbLeadApiKey:""},FV={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0},BV=["system","author","admin","api-docs"],Ej=["basic","mp","mp-copy","oss","features"];function VV(){const[t,e]=Y0(),n=t.get("tab")??"system",r=BV.includes(n)?n:"system",a=t.get("section")??"basic",i=Ej.includes(a)?a:"basic",[o,c]=y.useState(zV),[u,h]=y.useState(FV),[f,m]=y.useState(_V),[g,b]=y.useState({}),[N,j]=y.useState([]),[v,k]=y.useState({}),[T,C]=y.useState(!1),[R,O]=y.useState(!0),[U,P]=y.useState(!1),[z,L]=y.useState(""),[Q,se]=y.useState(""),[$,ie]=y.useState(!1),[oe,me]=y.useState(!1),I=(de,D,q=!1)=>{L(de),se(D),ie(q),P(!0)};y.useEffect(()=>{(async()=>{try{const D=await Oe("/api/admin/settings");if(!D||D.success===!1)return;if(D.featureConfig&&Object.keys(D.featureConfig).length&&h(q=>({...q,...D.featureConfig})),D.mpConfig&&typeof D.mpConfig=="object"){const q={...D.mpConfig};m(re=>({...re,...q}));const{extra:_,pagePopupItems:Z}=AV(q.mpUi);b(_),j(Z)}if(D.ossConfig&&typeof D.ossConfig=="object"&&k(q=>({...q,...D.ossConfig})),D.siteSettings&&typeof D.siteSettings=="object"){const q=D.siteSettings;c(_=>({..._,...typeof q.sectionPrice=="number"&&{sectionPrice:q.sectionPrice},...typeof q.baseBookPrice=="number"&&{baseBookPrice:q.baseBookPrice},...typeof q.distributorShare=="number"&&{distributorShare:q.distributorShare},...q.authorInfo&&typeof q.authorInfo=="object"&&{authorInfo:{..._.authorInfo,...q.authorInfo}},...typeof q.ckbLeadApiKey=="string"&&{ckbLeadApiKey:q.ckbLeadApiKey}}))}}catch(D){console.error("Load settings error:",D)}finally{O(!1)}})()},[]);const Y=async(de,D)=>{me(!0);try{const q=await Nt("/api/admin/settings",{featureConfig:de});if(!q||q.success===!1){D(),I("保存失败",(q==null?void 0:q.error)??"未知错误",!0);return}I("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(q){console.error("Save feature config error:",q),D(),I("保存失败",q instanceof Error?q.message:String(q),!0)}finally{me(!1)}},F=(de,D)=>{const q=u,_={...q,[de]:D};h(_),Y(_,()=>h(q))},[ge,X]=y.useState(!1),V=async de=>{const D=f,q={...D,auditMode:de};m(q),X(!0);try{const _=await Nt("/api/admin/settings",{mpConfig:q});if(!_||_.success===!1){m(D),I("保存失败",(_==null?void 0:_.error)??"未知错误",!0);return}I("已保存",de?"审核模式已开启,小程序将隐藏所有支付入口。":"审核模式已关闭,支付功能已恢复。")}catch(_){m(D),I("保存失败",_ instanceof Error?_.message:String(_),!0)}finally{X(!1)}},W=async()=>{C(!0);try{const de=PV(N,g),D=await Nt("/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:de},ossConfig:Object.keys(v).length?{endpoint:v.endpoint??"",bucket:v.bucket??"",region:v.region??"",accessKeyId:v.accessKeyId??"",accessKeySecret:v.accessKeySecret??""}:void 0});if(!D||D.success===!1){I("保存失败",(D==null?void 0:D.error)??"未知错误",!0);return}I("已保存","设置已保存成功。")}catch(de){console.error("Save settings error:",de),I("保存失败",de instanceof Error?de.message:String(de),!0)}finally{C(!1)}},fe=de=>{if(de==="system"){const D=new URLSearchParams(t);D.delete("tab"),Ej.includes(D.get("section")||"basic")||D.set("section","basic"),e(D);return}e({tab:de})},he=de=>{const D=new URLSearchParams(t);D.delete("tab"),D.set("section",de),e(D)};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(J,{onClick:W,disabled:T,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),T?"保存中...":"保存设置"]})]}),s.jsxs(sd,{value:r,onValueChange:fe,className:"w-full",children:[s.jsxs(Vl,{className:"mb-6 bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(en,{value:"system",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(Eo,{className:"w-4 h-4 mr-2"}),"系统设置"]}),s.jsxs(en,{value:"author",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(qh,{className:"w-4 h-4 mr-2"}),"作者详情"]}),s.jsxs(en,{value:"admin",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(Kc,{className:"w-4 h-4 mr-2"}),"管理员"]}),s.jsxs(en,{value:"api-docs",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",onClick:de=>{de.preventDefault(),window.open("/api-docs","_blank")},children:[s.jsx(ek,{className:"w-4 h-4 mr-2"}),"API 文档 ↗"]})]}),s.jsxs(tn,{value:"system",className:"mt-0",children:[s.jsxs("p",{className:"text-xs text-gray-500 mb-3",children:["MBTI 默认头像已迁至"," ",s.jsx(Dl,{to:"/users",className:"text-[#38bdac] underline",children:"用户管理(用户列表点头像打开)"})]}),s.jsxs(sd,{value:i,onValueChange:he,className:"w-full",children:[s.jsxs(Vl,{className:"mb-4 bg-[#0a1628] border border-gray-700/50 p-1 flex-wrap h-auto gap-1",children:[s.jsxs(en,{value:"basic",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(wM,{className:"w-3.5 h-3.5 mr-1"}),"基础与价格"]}),s.jsxs(en,{value:"mp",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx($l,{className:"w-3.5 h-3.5 mr-1"}),"小程序与审核"]}),s.jsxs(en,{value:"mp-copy",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(rk,{className:"w-3.5 h-3.5 mr-1"}),"弹窗文案"]}),s.jsxs(en,{value:"oss",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(P1,{className:"w-3.5 h-3.5 mr-1"}),"OSS"]}),s.jsxs(en,{value:"features",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(Eo,{className:"w-3.5 h-3.5 mr-1"}),"功能开关"]})]}),s.jsxs(tn,{value:"basic",className:"space-y-6 mt-0",children:[s.jsxs(De,{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(qh,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),s.jsx(Gt,{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(te,{htmlFor:"author-name",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(qh,{className:"w-3 h-3"}),"主理人名称"]}),s.jsx(le,{id:"author-name",className:"bg-[#0a1628] border-gray-700 text-white",value:o.authorInfo.name??"",onChange:de=>c(D=>({...D,authorInfo:{...D.authorInfo,name:de.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"start-date",className:"text-gray-300 flex items-center gap-1",children:[s.jsx($x,{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:de=>c(D=>({...D,authorInfo:{...D.authorInfo,startDate:de.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"live-time",className:"text-gray-300 flex items-center gap-1",children:[s.jsx($x,{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:de=>c(D=>({...D,authorInfo:{...D.authorInfo,liveTime:de.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"platform",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(sk,{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:de=>c(D=>({...D,authorInfo:{...D.authorInfo,platform:de.target.value}}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"description",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(ur,{className:"w-3 h-3"}),"简介描述"]}),s.jsx(le,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:o.authorInfo.description??"",onChange:de=>c(D=>({...D,authorInfo:{...D.authorInfo,description:de.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),s.jsx(Go,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:o.authorInfo.bio??"",onChange:de=>c(D=>({...D,authorInfo:{...D.authorInfo,bio:de.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{htmlFor:"ckb-lead-api-key",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Pi,{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:de=>c(D=>({...D,ckbLeadApiKey:de.target.value}))}),s.jsx("p",{className:"text-xs text-gray-500",children:"小程序首页「链接卡若」留资接口使用的存客宝 API Key,优先于 .env 配置"})]}),s.jsxs("div",{className:"mt-4 p-4 rounded-xl bg-[#0a1628] border border-[#38bdac]/30",children:[s.jsx("p",{className:"text-xs text-gray-500 mb-2",children:"预览效果"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-12 h-12 rounded-full bg-linear-to-br from-[#00CED1] to-[#20B2AA] flex items-center justify-center text-xl font-bold text-white",children:(o.authorInfo.name??"K").charAt(0)}),s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-semibold",children:o.authorInfo.name}),s.jsx("p",{className:"text-gray-400 text-xs",children:o.authorInfo.description}),s.jsxs("p",{className:"text-[#38bdac] text-xs mt-1",children:["每日 ",o.authorInfo.liveTime," · ",o.authorInfo.platform]})]})]})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{children:[s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(Pf,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),s.jsx(Gt,{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(te,{className:"text-gray-300",children:"单节价格 (元)"}),s.jsx(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.sectionPrice,onChange:de=>c(D=>({...D,sectionPrice:Number.parseFloat(de.target.value)||1}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"整本价格 (元)"}),s.jsx(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.baseBookPrice,onChange:de=>c(D=>({...D,baseBookPrice:Number.parseFloat(de.target.value)||9.9}))})]})]})})]})]}),s.jsxs(tn,{value:"mp",className:"space-y-6 mt-0",children:[s.jsxs(De,{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($l,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),s.jsx(Gt,{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(te,{className:"text-gray-300",children:"小程序 AppID"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:f.appId??"",onChange:de=>m(D=>({...D,appId:de.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"提现订阅模板 ID"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"用户申请提现时需授权",value:f.withdrawSubscribeTmplId??"",onChange:de=>m(D=>({...D,withdrawSubscribeTmplId:de.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"微信支付商户号"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"1318592501",value:f.mchId??"",onChange:de=>m(D=>({...D,mchId:de.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"最低提现金额 (元)"}),s.jsx(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:f.minWithdraw??10,onChange:de=>m(D=>({...D,minWithdraw:Number.parseFloat(de.target.value)||10}))})]})]}),s.jsx("p",{className:"text-xs text-gray-500 pt-2 border-t border-gray-700/50",children:"弹窗类文案在「弹窗文案」子 Tab 按页面路径 + 英文键维护(pagePopupItems);目录、Tab、首页板块等仍由其它配置决定。"})]})]}),s.jsxs(De,{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(Gt,{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(te,{htmlFor:"audit-mode",className:"text-white font-medium cursor-pointer",children:f.auditMode?"审核模式(已开启)":"审核模式(已关闭)"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:f.auditMode?"当前已隐藏所有支付、VIP、充值、收益等入口,审核员看不到任何付费内容":"关闭状态,小程序正常显示所有功能(含支付、VIP 等)"})]}),s.jsx(Ut,{id:"audit-mode",checked:f.auditMode??!1,disabled:ge,onCheckedChange:V})]})})]})]}),s.jsx(tn,{value:"mp-copy",className:"space-y-6 mt-0",children:s.jsx(DV,{pagePopupItems:N,setPagePopupItems:j,extraKeysCount:Object.keys(g).length})}),s.jsx(tn,{value:"oss",className:"space-y-6 mt-0",children:s.jsxs(De,{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(P1,{className:"w-5 h-5 text-[#38bdac]"}),"OSS 配置(阿里云对象存储)"]}),s.jsx(Gt,{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(te,{className:"text-gray-300",children:"Endpoint"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"oss-cn-hangzhou.aliyuncs.com",value:v.endpoint??"",onChange:de=>k(D=>({...D,endpoint:de.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"Bucket"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"bucket 名称",value:v.bucket??"",onChange:de=>k(D=>({...D,bucket:de.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"Region"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"oss-cn-hangzhou",value:v.region??"",onChange:de=>k(D=>({...D,region:de.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"AccessKey ID"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"AccessKey ID",value:v.accessKeyId??"",onChange:de=>k(D=>({...D,accessKeyId:de.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"AccessKey Secret"}),s.jsx(le,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"AccessKey Secret",value:v.accessKeySecret??"",onChange:de=>k(D=>({...D,accessKeySecret:de.target.value}))})]})]})})]})}),s.jsxs(tn,{value:"features",className:"space-y-6 mt-0",children:[s.jsxs(De,{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(Eo,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),s.jsx(Gt,{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(Kn,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(te,{htmlFor:"match-enabled",className:"text-white font-medium cursor-pointer",children:"找伙伴功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制小程序和Web端的找伙伴功能显示"})]}),s.jsx(Ut,{id:"match-enabled",checked:u.matchEnabled,disabled:oe,onCheckedChange:de=>F("matchEnabled",de)})]}),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(Bx,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(te,{htmlFor:"referral-enabled",className:"text-white font-medium cursor-pointer",children:"推广功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制推广中心的显示(我的页面入口)"}),s.jsxs("p",{className:"text-xs text-amber-400/80 ml-6 mt-1",children:["佣金比例、绑定期、提现规则等与",s.jsx(Dl,{to:"/distribution?tab=settings",className:"underline mx-1 text-[#38bdac]",children:"推广中心 → 推广设置"}),"为同一套接口,在此仅控制是否展示入口。"]})]}),s.jsx(Ut,{id:"referral-enabled",checked:u.referralEnabled,disabled:oe,onCheckedChange:de=>F("referralEnabled",de)})]}),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(ur,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(te,{htmlFor:"search-enabled",className:"text-white font-medium cursor-pointer",children:"搜索功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制首页、目录页搜索栏的显示"})]}),s.jsx(Ut,{id:"search-enabled",checked:u.searchEnabled,disabled:oe,onCheckedChange:de=>F("searchEnabled",de)})]}),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(Eo,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(te,{htmlFor:"about-enabled",className:"text-white font-medium cursor-pointer",children:"关于页面"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制关于页面的访问"})]}),s.jsx(Ut,{id:"about-enabled",checked:u.aboutEnabled,disabled:oe,onCheckedChange:de=>F("aboutEnabled",de)})]})]}),s.jsx("div",{className:"p-3 rounded-lg bg-blue-500/10 border border-blue-500/30",children:s.jsx("p",{className:"text-xs text-blue-300",children:"💡 关闭功能后,相关入口会自动隐藏。建议在功能开发完成后再开启。"})})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(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(Gt,{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(Kn,{className:"w-3 h-3"})},{mod:"推广中心 / 推荐好友",ctrl:"推广功能开关",icon:s.jsx(Bx,{className:"w-3 h-3"})},{mod:"搜索",ctrl:"搜索功能开关",icon:s.jsx(ur,{className:"w-3 h-3"})},{mod:"关于页面",ctrl:"关于页面开关",icon:s.jsx(qh,{className:"w-3 h-3"})},{mod:"支付 / VIP / 充值 / 收益",ctrl:"审核模式",icon:s.jsx(Kc,{className:"w-3 h-3"})},{mod:"超级个体名片",ctrl:"审核模式",icon:s.jsx(NA,{className:"w-3 h-3"})},{mod:"首页获客入口",ctrl:"已移除",icon:s.jsx(K5,{className:"w-3 h-3"})}].map(de=>s.jsxs("div",{className:"flex items-center gap-2 p-2 rounded bg-[#0a1628] border border-gray-700/30",children:[de.icon,s.jsxs("div",{children:[s.jsx("span",{className:"text-white",children:de.mod}),s.jsxs("span",{className:"text-gray-500 ml-1",children:["← ",de.ctrl]})]})]},de.mod))})})]})]})]})]}),s.jsx(tn,{value:"author",className:"mt-0",children:s.jsx(NV,{})}),s.jsx(tn,{value:"admin",className:"mt-0",children:s.jsx(jV,{})}),s.jsx(tn,{value:"api-docs",className:"mt-0",children:s.jsx(W4,{})})]}),s.jsx(Dt,{open:U,onOpenChange:P,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsxs(_t,{children:[s.jsx($t,{className:$?"text-red-400":"text-[#38bdac]",children:z}),s.jsx(nd,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:Q})]}),s.jsx(rn,{className:"mt-4",children:s.jsx(J,{onClick:()=>P(!1),className:$?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const Tj={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 HV(){const[t,e]=y.useState(!1),[n,r]=y.useState(Tj),[a,i]=y.useState(""),o=async()=>{e(!0);try{const k=await Oe("/api/config");k!=null&&k.paymentMethods&&r({...Tj,...k.paymentMethods})}catch(k){console.error(k)}finally{e(!1)}};y.useEffect(()=>{o()},[]);const c=async()=>{e(!0);try{await Nt("/api/db/config",{key:"payment_methods",value:n,description:"支付方式配置"}),G.success("配置已保存!")}catch(k){console.error("保存失败:",k),G.error("保存失败: "+(k instanceof Error?k.message:String(k)))}finally{e(!1)}},u=(k,T)=>{navigator.clipboard.writeText(k),i(T),setTimeout(()=>i(""),2e3)},h=(k,T)=>{r(C=>({...C,wechat:{...C.wechat,[k]:T}}))},f=(k,T)=>{r(C=>({...C,alipay:{...C.alipay,[k]:T}}))},m=(k,T)=>{r(C=>({...C,usdt:{...C.usdt,[k]:T}}))},g=(k,T)=>{r(C=>({...C,paypal:{...C.paypal,[k]:T}}))},b=n.wechat,N=n.alipay,j=n.usdt,v=n.paypal;return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold mb-2 text-white",children:"支付配置"}),s.jsx("p",{className:"text-gray-400",children:"配置微信、支付宝、USDT、PayPal等支付参数"})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(J,{variant:"outline",onClick:o,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${t?"animate-spin":""}`}),"同步配置"]}),s.jsxs(J,{onClick:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{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(Yj,{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(sd,{defaultValue:"wechat",className:"space-y-6",children:[s.jsxs(Vl,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[s.jsxs(en,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[s.jsx($l,{className:"w-4 h-4 mr-2"}),"微信"]}),s.jsxs(en,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[s.jsx(R1,{className:"w-4 h-4 mr-2"}),"支付宝"]}),s.jsxs(en,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[s.jsx(I1,{className:"w-4 h-4 mr-2"}),"USDT"]}),s.jsxs(en,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[s.jsx(Vx,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),s.jsx(tn,{value:"wechat",className:"space-y-4",children:s.jsxs(De,{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($l,{className:"w-5 h-5"}),"微信支付配置"]}),s.jsx(Gt,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),s.jsx(Ut,{checked:!!b.enabled,onCheckedChange:k=>h("enabled",k)})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"网站AppID"}),s.jsx(le,{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(te,{className:"text-gray-300",children:"商户号"}),s.jsx(le,{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($o,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置(核心功能)"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"微信收款码/支付链接"}),s.jsx(le,{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(te,{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(b.groupQrCode??""),onChange:k=>h("groupQrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-[#07C160]/70",children:"用户支付成功后将自动跳转到此链接,进入指定微信群"})]})]})]})]})}),s.jsx(tn,{value:"alipay",className:"space-y-4",children:s.jsxs(De,{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(R1,{className:"w-5 h-5"}),"支付宝配置"]}),s.jsx(Gt,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),s.jsx(Ut,{checked:!!N.enabled,onCheckedChange:k=>f("enabled",k)})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{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(N.partnerId??""),onChange:k=>f("partnerId",k.target.value)}),s.jsx(J,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>u(String(N.partnerId??""),"pid"),children:a==="pid"?s.jsx(Dp,{className:"w-4 h-4 text-green-500"}):s.jsx(Zj,{className:"w-4 h-4 text-gray-400"})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"安全校验码 (Key)"}),s.jsx(le,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(N.securityKey??""),onChange:k=>f("securityKey",k.target.value)})]})]}),s.jsxs("div",{className:"border-t border-gray-700/50 pt-4 space-y-4",children:[s.jsxs("h4",{className:"text-white font-medium flex items-center gap-2",children:[s.jsx($o,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"支付宝收款码/跳转链接"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"https://qr.alipay.com/... 或收款码图片URL",value:String(N.qrCode??""),onChange:k=>f("qrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"用户点击支付宝支付后显示的二维码"})]})]})]})]})}),s.jsx(tn,{value:"usdt",className:"space-y-4",children:s.jsxs(De,{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(I1,{className:"w-5 h-5"}),"USDT配置"]}),s.jsx(Gt,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),s.jsx(Ut,{checked:!!j.enabled,onCheckedChange:k=>m("enabled",k)})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"网络类型"}),s.jsxs("select",{className:"w-full bg-[#0a1628] border border-gray-700 text-white rounded-md p-2",value:String(j.network??"TRC20"),onChange:k=>m("network",k.target.value),children:[s.jsx("option",{value:"TRC20",children:"TRC20 (波场)"}),s.jsx("option",{value:"ERC20",children:"ERC20 (以太坊)"}),s.jsx("option",{value:"BEP20",children:"BEP20 (币安链)"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{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(j.address??""),onChange:k=>m("address",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(j.exchangeRate)??7.2,onChange:k=>m("exchangeRate",Number.parseFloat(k.target.value)||7.2)})]})]})]})}),s.jsx(tn,{value:"paypal",className:"space-y-4",children:s.jsxs(De,{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(Vx,{className:"w-5 h-5"}),"PayPal配置"]}),s.jsx(Gt,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),s.jsx(Ut,{checked:!!v.enabled,onCheckedChange:k=>g("enabled",k)})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"PayPal邮箱"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"your@email.com",value:String(v.email??""),onChange:k=>g("email",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"汇率 (1 USD = ? CNY)"}),s.jsx(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:Number(v.exchangeRate)??7.2,onChange:k=>g("exchangeRate",Number(k.target.value)||7.2)})]})]})]})})]})]})}const UV={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},WV={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},KV={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function qV(){const[t,e]=y.useState({siteConfig:{...UV},menuConfig:{...WV},pageConfig:{...KV}}),[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 Nt("/api/db/config",{key:"site_config",value:t.siteConfig,description:"网站基础配置"}),await Nt("/api/db/config",{key:"menu_config",value:t.menuConfig,description:"底部菜单配置"}),await Nt("/api/db/config",{key:"page_config",value:t.pageConfig,description:"页面标题配置"}),r(!0),setTimeout(()=>r(!1),2e3),G.success("配置已保存")}catch(f){console.error(f),G.error("保存失败: "+(f instanceof Error?f.message:String(f)))}finally{i(!1)}},c=t.siteConfig,u=t.menuConfig,h=t.pageConfig;return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"网站配置"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置网站名称、图标、菜单和页面标题"})]}),s.jsxs(J,{onClick:o,disabled:a,className:`${n?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),a?"保存中...":n?"已保存":"保存设置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{children:[s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(Vx,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),s.jsx(Gt,{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(te,{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(te,{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(te,{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(te,{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(te,{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(De,{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(HM,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),s.jsx(Gt,{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(te,{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(De,{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(OM,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),s.jsx(Gt,{className:"text-gray-400",children:"控制底部导航栏菜单的显示和名称"})]}),s.jsx(_e,{className:"space-y-4",children:Object.entries(u).map(([f,m])=>s.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[s.jsx(Ut,{checked:(m==null?void 0:m.enabled)??!0,onCheckedChange:g=>e(b=>({...b,menuConfig:{...b.menuConfig,[f]:{...m,enabled:g}}}))}),s.jsx("span",{className:"text-gray-300 w-16 capitalize",children:f}),s.jsx(le,{className:"bg-[#0f2137] border-gray-700 text-white max-w-[200px]",value:(m==null?void 0:m.label)??"",onChange:g=>e(b=>({...b,menuConfig:{...b.menuConfig,[f]:{...m,label:g.target.value}}}))})]}),s.jsx("span",{className:`text-sm ${m!=null&&m.enabled?"text-green-400":"text-gray-500"}`,children:m!=null&&m.enabled?"显示":"隐藏"})]},f))})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(dt,{children:[s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(ek,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),s.jsx(Gt,{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(te,{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(te,{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(te,{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(te,{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(te,{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(te,{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 GV(){const[t,e]=y.useState(""),[n,r]=y.useState(""),[a,i]=y.useState(""),[o,c]=y.useState({}),u=async()=>{var b,N,j,v;try{const k=await Oe("/api/config"),T=(N=(b=k==null?void 0:k.liveQRCodes)==null?void 0:b[0])==null?void 0:N.urls;Array.isArray(T)&&e(T.join(` +`));const C=(v=(j=k==null?void 0:k.paymentMethods)==null?void 0:j.wechat)==null?void 0:v.groupQrCode;C&&r(C),c({paymentMethods:k==null?void 0:k.paymentMethods,liveQRCodes:k==null?void 0:k.liveQRCodes})}catch(k){console.error(k)}};y.useEffect(()=>{u()},[]);const h=(b,N)=>{navigator.clipboard.writeText(b),i(N),setTimeout(()=>i(""),2e3)},f=async()=>{try{const b=t.split(` +`).map(j=>j.trim()).filter(Boolean),N=[...o.liveQRCodes||[]];N[0]?N[0].urls=b:N.push({id:"live-1",name:"微信群活码",urls:b,clickCount:0}),await Nt("/api/db/config",{key:"live_qr_codes",value:N,description:"群活码配置"}),G.success("群活码配置已保存!"),await u()}catch(b){console.error(b),G.error("保存失败: "+(b instanceof Error?b.message:String(b)))}},m=async()=>{var b;try{await Nt("/api/db/config",{key:"payment_methods",value:{...o.paymentMethods||{},wechat:{...((b=o.paymentMethods)==null?void 0:b.wechat)||{},groupQrCode:n}},description:"支付方式配置"}),G.success("微信群链接已保存!用户支付成功后将自动跳转"),await u()}catch(N){console.error(N),G.error("保存失败: "+(N instanceof Error?N.message:String(N)))}},g=()=>{n?window.open(n,"_blank"):G.error("请先配置微信群链接")};return s.jsxs("div",{className:"p-8 w-full",children:[s.jsxs("div",{className:"mb-8",children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"微信群活码管理"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置微信群跳转链接,用户支付后自动跳转加群"})]}),s.jsx("div",{className:"mb-6 bg-[#07C160]/10 border border-[#07C160]/30 rounded-xl p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Yj,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm",children:[s.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"微信群活码配置指南"}),s.jsxs("div",{className:"text-[#07C160]/80 space-y-2",children:[s.jsx("p",{className:"font-medium",children:"方法一:使用草料活码(推荐)"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[s.jsx("li",{children:"访问草料二维码创建活码"}),s.jsx("li",{children:"上传微信群二维码图片,生成永久链接"}),s.jsx("li",{children:"复制生成的短链接填入下方配置"}),s.jsx("li",{children:"群满后可直接在草料后台更换新群码,链接不变"})]}),s.jsx("p",{className:"font-medium mt-3",children:"方法二:直接使用微信群链接"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[s.jsx("li",{children:'微信打开目标群 → 右上角"..." → 群二维码'}),s.jsx("li",{children:"长按二维码 → 识别二维码 → 复制链接"})]}),s.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"注意:微信原生群二维码7天后失效,建议使用草料活码"})]})]})]})}),s.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(dt,{children:[s.jsxs(ut,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(_1,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),s.jsx(Gt,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Ux,{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:b=>r(b.target.value)}),s.jsx(J,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>h(n,"group"),children:a==="group"?s.jsx(Dp,{className:"w-4 h-4 text-green-500"}):s.jsx(Zj,{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($o,{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:g,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[s.jsx($o,{className:"w-4 h-4 mr-2"}),"测试跳转"]})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(dt,{children:[s.jsxs(ut,{className:"text-white flex items-center gap-2",children:[s.jsx(_1,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),s.jsx(Gt,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(te,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Ux,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),s.jsx(Go,{placeholder:"https://cli.im/group1\\nhttps://cli.im/group2",className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500 min-h-[120px] font-mono text-sm",value:t,onChange:b=>e(b.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"每行填写一个群链接,系统将按顺序或随机分配"})]}),s.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a1628] rounded-lg border border-gray-700/50",children:[s.jsx("span",{className:"text-sm text-gray-400",children:"已配置群数量"}),s.jsxs("span",{className:"font-bold text-[#38bdac]",children:[t.split(` +`).filter(Boolean).length," 个"]})]}),s.jsxs(J,{onClick:f,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(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 Mj={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}},JV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function QV(){const[t,e]=y.useState(Mj),[n,r]=y.useState(!0),[a,i]=y.useState(!1),[o,c]=y.useState(!1),[u,h]=y.useState(null),[f,m]=y.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),g=async()=>{r(!0);try{const C=await Oe("/api/db/config/full?key=match_config"),R=(C==null?void 0:C.data)??(C==null?void 0:C.config);R&&e({...Mj,...R})}catch(C){console.error("加载匹配配置失败:",C)}finally{r(!1)}};y.useEffect(()=>{g()},[]);const b=async()=>{i(!0);try{const C=await Nt("/api/db/config",{key:"match_config",value:t,description:"匹配功能配置"});C&&C.success!==!1?G.success("配置保存成功!"):G.error("保存失败: "+(C&&typeof C=="object"&&"error"in C?C.error:"未知错误"))}catch(C){console.error("保存配置失败:",C),G.error("保存失败")}finally{i(!1)}},N=C=>{h(C),m({id:C.id,label:C.label,matchLabel:C.matchLabel,icon:C.icon,matchFromDB:C.matchFromDB,showJoinAfterMatch:C.showJoinAfterMatch,price:C.price,enabled:C.enabled}),c(!0)},j=()=>{h(null),m({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),c(!0)},v=()=>{if(!f.id||!f.label){G.error("请填写类型ID和名称");return}const C=[...t.matchTypes];if(u){const R=C.findIndex(O=>O.id===u.id);R!==-1&&(C[R]={...f})}else{if(C.some(R=>R.id===f.id)){G.error("类型ID已存在");return}C.push({...f})}e({...t,matchTypes:C}),c(!1)},k=C=>{confirm("确定要删除这个匹配类型吗?")&&e({...t,matchTypes:t.matchTypes.filter(R=>R.id!==C)})},T=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(Eo,{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:g,disabled:n,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]}),s.jsxs(J,{onClick:b,disabled:a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存配置"]})]})]}),s.jsxs(De,{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(zo,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),s.jsx(Gt,{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(te,{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(te,{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(te,{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(Ut,{checked:t.settings.enableFreeMatches,onCheckedChange:C=>e({...t,settings:{...t.settings,enableFreeMatches:C}})}),s.jsx(te,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:t.settings.enablePaidMatches,onCheckedChange:C=>e({...t,settings:{...t.settings,enablePaidMatches:C}})}),s.jsx(te,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(De,{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(Kn,{className:"w-5 h-5 text-[#38bdac]"}),"匹配类型管理"]}),s.jsx(Gt,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(J,{onClick:j,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(zn,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),s.jsx(_e,{children:s.jsxs(fs,{children:[s.jsx(ps,{children:s.jsxs(gt,{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(gt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(je,{children:s.jsx("span",{className:"text-2xl",children:C.icon})}),s.jsx(je,{className:"font-mono text-gray-300",children:C.id}),s.jsx(je,{className:"text-white font-medium",children:C.label}),s.jsx(je,{className:"text-gray-300",children:C.matchLabel}),s.jsx(je,{children:s.jsxs(Be,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",C.price]})}),s.jsx(je,{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(je,{children:s.jsx(Ut,{checked:C.enabled,onCheckedChange:()=>T(C.id)})}),s.jsx(je,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>N(C),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(sn,{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(ts,{className:"w-4 h-4"})})]})})]},C.id))})]})})]}),s.jsx(Dt,{open:o,onOpenChange:c,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[u?s.jsx(sn,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(zn,{className:"w-5 h-5 text-[#38bdac]"}),u?"编辑匹配类型":"添加匹配类型"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"类型ID(英文)"}),s.jsx(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(te,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:JV.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(te,{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(te,{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(te,{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(Ut,{checked:f.matchFromDB,onCheckedChange:C=>m({...f,matchFromDB:C})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:f.showJoinAfterMatch,onCheckedChange:C=>m({...f,showJoinAfterMatch:C})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:f.enabled,onCheckedChange:C=>m({...f,enabled:C})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(rn,{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:v,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const Aj={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function YV(){const[t,e]=y.useState([]),[n,r]=y.useState(0),[a,i]=y.useState(1),[o,c]=y.useState(10),[u,h]=y.useState(""),[f,m]=y.useState(!0),[g,b]=y.useState(null);async function N(){m(!0),b(null);try{const v=new URLSearchParams({page:String(a),pageSize:String(o)});u&&v.set("matchType",u);const k=await Oe(`/api/db/match-records?${v}`);k!=null&&k.success?(e(k.records||[]),r(k.total??0)):b("加载匹配记录失败")}catch(v){console.error("加载匹配记录失败",v),b("加载失败,请检查网络后重试")}finally{m(!1)}}y.useEffect(()=>{N()},[a,u]);const j=Math.ceil(n/o)||1;return s.jsxs("div",{className:"p-8 w-full",children:[g&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[s.jsx("span",{children:g}),s.jsx("button",{type:"button",onClick:()=>b(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-8",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-2xl font-bold text-white",children:"匹配记录"}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["找伙伴匹配统计,共 ",n," 条记录"]})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("select",{value:u,onChange:v=>{h(v.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部类型"}),Object.entries(Aj).map(([v,k])=>s.jsx("option",{value:v,children:k},v))]}),s.jsxs("button",{type:"button",onClick:N,disabled:f,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(He,{className:`w-4 h-4 ${f?"animate-spin":""}`}),"刷新"]})]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(fs,{children:[s.jsx(ps,{children:s.jsxs(gt,{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(v=>s.jsxs(gt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(je,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[v.userAvatar?s.jsx("img",{src:ya(v.userAvatar),alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const T=k.currentTarget.nextElementSibling;T&&T.classList.remove("hidden")}}):null,s.jsx("span",{className:v.userAvatar?"hidden":"",children:(v.userNickname||v.userId||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white",children:v.userNickname||v.userId}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[v.userId.slice(0,16),"..."]})]})]})}),s.jsx(je,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[v.matchedUserAvatar?s.jsx("img",{src:ya(v.matchedUserAvatar),alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const T=k.currentTarget.nextElementSibling;T&&T.classList.remove("hidden")}}):null,s.jsx("span",{className:v.matchedUserAvatar?"hidden":"",children:(v.matchedNickname||v.matchedUserId||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white",children:v.matchedNickname||v.matchedUserId}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[v.matchedUserId.slice(0,16),"..."]})]})]})}),s.jsx(je,{children:s.jsx(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Aj[v.matchType]||v.matchType})}),s.jsxs(je,{className:"text-gray-400 text-sm",children:[v.phone&&s.jsxs("div",{children:["📱 ",v.phone]}),v.wechatId&&s.jsxs("div",{children:["💬 ",v.wechatId]}),!v.phone&&!v.wechatId&&"-"]}),s.jsx(je,{className:"text-gray-400",children:v.createdAt?new Date(v.createdAt).toLocaleString():"-"})]},v.id)),t.length===0&&s.jsx(gt,{children:s.jsx(je,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(qs,{page:a,totalPages:j,total:n,pageSize:o,onPageChange:i,onPageSizeChange:v=>{c(v),i(1)}})]})})})]})}function XV(){const[t,e]=y.useState([]),[n,r]=y.useState(!0);async function a(){r(!0);try{const i=await Oe("/api/db/vip-members?limit=100");if(i!=null&&i.success&&i.data){const o=[...i.data].map((c,u)=>({...c,vipSort:typeof c.vipSort=="number"?c.vipSort:u+1}));o.sort((c,u)=>(c.vipSort??999999)-(u.vipSort??999999)),e(o)}}catch(i){console.error("Load VIP members error:",i),G.error("加载 VIP 成员失败")}finally{r(!1)}}return y.useEffect(()=>{a()},[]),s.jsxs("div",{className:"p-8 w-full",children:[s.jsx("div",{className:"flex justify-between items-center mb-8",children:s.jsxs("div",{children:[s.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-2",children:[s.jsx(Qc,{className:"w-5 h-5 text-amber-400"}),"用户管理 / 超级个体列表"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"这里展示所有有效超级个体用户,仅用于查看其基本信息与排序值。"})]})}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(fs,{children:[s.jsx(ps,{children:s.jsxs(gt,{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(gt,{className:"border-gray-700/50",children:[s.jsx(je,{className:"text-gray-300",children:o+1}),s.jsx(je,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[i.avatar?s.jsx("img",{src:ya(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(je,{className:"text-gray-300",children:i.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置超级个体)"})}),s.jsx(je,{className:"text-gray-300",children:i.vipSort??o+1})]},i.id)}),t.length===0&&s.jsx(gt,{children:s.jsx(je,{colSpan:5,className:"text-center py-12 text-gray-500",children:"当前没有有效的超级个体用户。"})})]})]})})})]})}function K4(t){const e=Ja(),[n,r]=y.useState([]),[a,i]=y.useState(!0),[o,c]=y.useState(!1),[u,h]=y.useState(null),[f,m]=y.useState({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:0,enabled:!0,userId:""}),[g,b]=y.useState(!1),[N,j]=y.useState(!1),v=y.useRef(null),k=async L=>{var se;const Q=(se=L.target.files)==null?void 0:se[0];if(Q){j(!0);try{const $=new FormData;$.append("file",Q),$.append("folder","mentors");const ie=Wu(),oe={};ie&&(oe.Authorization=`Bearer ${ie}`);const I=await(await fetch(zl("/api/upload"),{method:"POST",body:$,credentials:"include",headers:oe})).json();I!=null&&I.success&&(I!=null&&I.url)?m(Y=>({...Y,avatar:I.url})):G.error("上传失败: "+((I==null?void 0:I.error)||"未知错误"))}catch($){console.error($),G.error("上传失败")}finally{j(!1),v.current&&(v.current.value="")}}};async function T(){i(!0);try{const L=await Oe("/api/db/mentors");L!=null&&L.success&&L.data&&r(L.data)}catch(L){console.error("Load mentors error:",L)}finally{i(!1)}}y.useEffect(()=>{T()},[]);const C=()=>{m({name:"",avatar:"",intro:"",tags:"",priceSingle:"",priceHalfYear:"",priceYear:"",quote:"",whyFind:"",offering:"",judgmentStyle:"",sort:n.length>0?Math.max(...n.map(L=>L.sort))+1:0,enabled:!0,userId:""})},R=()=>{h(null),C(),c(!0)},O=L=>{h(L),m({name:L.name,avatar:L.avatar||"",intro:L.intro||"",tags:L.tags||"",priceSingle:L.priceSingle!=null?String(L.priceSingle):"",priceHalfYear:L.priceHalfYear!=null?String(L.priceHalfYear):"",priceYear:L.priceYear!=null?String(L.priceYear):"",quote:L.quote||"",whyFind:L.whyFind||"",offering:L.offering||"",judgmentStyle:L.judgmentStyle||"",sort:L.sort,enabled:L.enabled??!0,userId:L.userId||""}),c(!0)},U=async()=>{if(!f.name.trim()){G.error("导师姓名不能为空");return}b(!0);try{const L=$=>$===""?void 0:parseFloat($),Q=f.userId.trim(),se={name:f.name.trim(),avatar:f.avatar.trim()||void 0,intro:f.intro.trim()||void 0,tags:f.tags.trim()||void 0,priceSingle:L(f.priceSingle),priceHalfYear:L(f.priceHalfYear),priceYear:L(f.priceYear),quote:f.quote.trim()||void 0,whyFind:f.whyFind.trim()||void 0,offering:f.offering.trim()||void 0,judgmentStyle:f.judgmentStyle.trim()||void 0,sort:f.sort,enabled:f.enabled};if(u){const $=await Zt("/api/db/mentors",{id:u.id,...se,userId:Q});$!=null&&$.success?(c(!1),T()):G.error("更新失败: "+($==null?void 0:$.error))}else{const $=await Nt("/api/db/mentors",{...se,userId:Q||void 0});$!=null&&$.success?(c(!1),T()):G.error("新增失败: "+($==null?void 0:$.error))}}catch(L){console.error("Save error:",L),G.error("保存失败")}finally{b(!1)}},P=async L=>{if(confirm("确定删除该导师?"))try{const Q=await Mi(`/api/db/mentors?id=${L}`);Q!=null&&Q.success?T():G.error("删除失败: "+(Q==null?void 0:Q.error))}catch(Q){console.error("Delete error:",Q),G.error("删除失败")}},z=L=>L!=null?`¥${L}`:"-";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(Kn,{className:"w-5 h-5 text-[#38bdac]"}),"导师管理"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"stitch_soul 导师列表;填写「绑定用户 ID」后,小程序导师详情可跳转「派对会员名片」(与超级个体同页)"})]}),s.jsxs(J,{onClick:R,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(zn,{className:"w-4 h-4 mr-2"}),"新增导师"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-0",children:a?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(fs,{children:[s.jsx(ps,{children:s.jsxs(gt,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(Se,{className:"text-gray-400",children:"ID"}),s.jsx(Se,{className:"text-gray-400",children:"姓名"}),s.jsx(Se,{className:"text-gray-400",children:"简介"}),s.jsx(Se,{className:"text-gray-400",children:"单次"}),s.jsx(Se,{className:"text-gray-400",children:"半年"}),s.jsx(Se,{className:"text-gray-400",children:"年度"}),s.jsx(Se,{className:"text-gray-400",children:"绑定用户"}),s.jsx(Se,{className:"text-gray-400",children:"排序"}),s.jsx(Se,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(ms,{children:[n.map(L=>s.jsxs(gt,{className:"border-gray-700/50",children:[s.jsx(je,{className:"text-gray-300",children:L.id}),s.jsx(je,{children:s.jsxs("button",{type:"button",onClick:()=>e(`/users?search=${encodeURIComponent(L.name)}`),className:"text-[#38bdac] hover:text-[#2da396] hover:underline flex items-center gap-1",title:"在用户管理中查看",children:[L.name,s.jsx($o,{className:"w-3 h-3"})]})}),s.jsx(je,{className:"text-gray-400 max-w-[200px] truncate",children:L.intro||"-"}),s.jsx(je,{className:"text-gray-400",children:z(L.priceSingle)}),s.jsx(je,{className:"text-gray-400",children:z(L.priceHalfYear)}),s.jsx(je,{className:"text-gray-400",children:z(L.priceYear)}),s.jsx(je,{className:"text-gray-400 font-mono text-xs max-w-[120px] truncate",title:L.userId||"",children:L.userId?s.jsx("button",{type:"button",onClick:()=>e(`/users?search=${encodeURIComponent(L.userId||"")}`),className:"text-[#38bdac] hover:underline truncate max-w-[120px] inline-block align-bottom",children:L.userId}):"—"}),s.jsx(je,{className:"text-gray-400",children:L.sort}),s.jsxs(je,{className:"text-right",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>O(L),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(sn,{className:"w-4 h-4"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>P(L.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(ts,{className:"w-4 h-4"})})]})]},L.id)),n.length===0&&s.jsx(gt,{children:s.jsx(je,{colSpan:9,className:"text-center py-12 text-gray-500",children:"暂无导师,点击「新增导师」添加"})})]})]})})}),s.jsx(Dt,{open:o,onOpenChange:c,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg max-h-[90vh] overflow-y-auto",children:[s.jsx(_t,{children:s.jsx($t,{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(te,{className:"text-gray-300",children:"姓名 *"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:卡若",value:f.name,onChange:L=>m(Q=>({...Q,name:L.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"排序"}),s.jsx(le,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:f.sort,onChange:L=>m(Q=>({...Q,sort:parseInt(L.target.value,10)||0}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"头像"}),s.jsxs("div",{className:"flex gap-3 items-center",children:[s.jsx(le,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:f.avatar,onChange:L=>m(Q=>({...Q,avatar:L.target.value})),placeholder:"点击上传或粘贴图片地址"}),s.jsx("input",{ref:v,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:N,onClick:()=>{var L;return(L=v.current)==null?void 0:L.click()},children:[s.jsx(Of,{className:"w-4 h-4 mr-2"}),N?"上传中...":"上传"]})]}),f.avatar&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:ya(f.avatar.startsWith("http")?f.avatar:zl(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(te,{className:"text-gray-300",children:"绑定用户 ID(可选,与名片页一致)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",placeholder:"小程序用户 id,填后导师详情显示「查看派对会员名片」",value:f.userId,onChange:L=>m(Q=>({...Q,userId:L.target.value}))}),s.jsx("p",{className:"text-xs text-gray-500",children:"留空则仅展示导师资料;填写后 C 端可跳转 member-detail 与超级个体同款名片。"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"简介"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:结构判断型咨询 · Decision > Execution",value:f.intro,onChange:L=>m(Q=>({...Q,intro:L.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"技能标签(逗号分隔)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:项目结构判断、风险止损、人×项目匹配",value:f.tags,onChange:L=>m(Q=>({...Q,tags:L.target.value}))})]}),s.jsxs("div",{className:"border-t border-gray-700 pt-4",children:[s.jsx(te,{className:"text-gray-300 block mb-2",children:"价格配置(每个导师独立)"}),s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"单次咨询 ¥"}),s.jsx(le,{type:"number",step:"0.01",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"980",value:f.priceSingle,onChange:L=>m(Q=>({...Q,priceSingle:L.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{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:L=>m(Q=>({...Q,priceHalfYear:L.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{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:L=>m(Q=>({...Q,priceYear:L.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"引言"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:大多数人失败,不是因为不努力...",value:f.quote,onChange:L=>m(Q=>({...Q,quote:L.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"为什么找(文本)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:f.whyFind,onChange:L=>m(Q=>({...Q,whyFind:L.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"提供什么(文本)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:f.offering,onChange:L=>m(Q=>({...Q,offering:L.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"判断风格(逗号分隔)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:冷静、克制、偏风险视角",value:f.judgmentStyle,onChange:L=>m(Q=>({...Q,judgmentStyle:L.target.value}))})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",id:"enabled",checked:f.enabled,onChange:L=>m(Q=>({...Q,enabled:L.target.checked})),className:"rounded border-gray-600 bg-[#0a1628]"}),s.jsx(te,{htmlFor:"enabled",className:"text-gray-300 cursor-pointer",children:"上架(小程序可见)"})]})]}),s.jsxs(rn,{children:[s.jsxs(J,{variant:"outline",onClick:()=>c(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(ns,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(J,{onClick:U,disabled:g,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"}),g?"保存中...":"保存"]})]})]})})]})}function ZV(){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($x,{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(He,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]})]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(fs,{children:[s.jsx(ps,{children:s.jsxs(gt,{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(gt,{className:"border-gray-700/50",children:[s.jsx(je,{className:"text-gray-300",children:h.id}),s.jsx(je,{className:"text-gray-400",children:h.userId}),s.jsx(je,{className:"text-gray-400",children:h.mentorId}),s.jsx(je,{className:"text-gray-400",children:u[h.consultationType]||h.consultationType}),s.jsxs(je,{className:"text-white",children:["¥",h.amount]}),s.jsx(je,{className:"text-gray-400",children:c[h.status]||h.status}),s.jsx(je,{className:"text-gray-500 text-sm",children:h.createdAt})]},h.id)),t.length===0&&s.jsx(gt,{children:s.jsx(je,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}const pu={poolSource:["vip"],requirePhone:!0,requireNickname:!0,requireAvatar:!1,requireBusiness:!1},Ij={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:pu},eH=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function tH(){const t=Ja(),[e,n]=y.useState(Ij),[r,a]=y.useState(!0),[i,o]=y.useState(!1),[c,u]=y.useState(!1),[h,f]=y.useState(null),[m,g]=y.useState({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),[b,N]=y.useState(null),[j,v]=y.useState(!1),k=async()=>{v(!0);try{const L=await Oe("/api/db/match-pool-counts");L!=null&&L.success&&L.data&&N(L.data)}catch(L){console.error("加载池子人数失败:",L)}finally{v(!1)}},T=async()=>{a(!0);try{const L=await Oe("/api/db/config/full?key=match_config"),Q=(L==null?void 0:L.data)??(L==null?void 0:L.config);if(Q){let se=Q.poolSettings??pu;se.poolSource&&!Array.isArray(se.poolSource)&&(se={...se,poolSource:[se.poolSource]}),n({...Ij,...Q,poolSettings:se})}}catch(L){console.error("加载匹配配置失败:",L)}finally{a(!1)}};y.useEffect(()=>{T(),k()},[]);const C=async()=>{o(!0);try{const L=await Nt("/api/db/config",{key:"match_config",value:e,description:"匹配功能配置"});G.error((L==null?void 0:L.success)!==!1?"配置保存成功!":"保存失败: "+((L==null?void 0:L.error)||"未知错误"))}catch(L){console.error(L),G.error("保存失败")}finally{o(!1)}},R=L=>{f(L),g({...L}),u(!0)},O=()=>{f(null),g({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),u(!0)},U=()=>{if(!m.id||!m.label){G.error("请填写类型ID和名称");return}const L=[...e.matchTypes];if(h){const Q=L.findIndex(se=>se.id===h.id);Q!==-1&&(L[Q]={...m})}else{if(L.some(Q=>Q.id===m.id)){G.error("类型ID已存在");return}L.push({...m})}n({...e,matchTypes:L}),u(!1)},P=L=>{confirm("确定要删除这个匹配类型吗?")&&n({...e,matchTypes:e.matchTypes.filter(Q=>Q.id!==L)})},z=L=>{n({...e,matchTypes:e.matchTypes.map(Q=>Q.id===L?{...Q,enabled:!Q.enabled}:Q)})};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsxs(J,{variant:"outline",onClick:T,disabled:r,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{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(Tn,{className:"w-4 h-4 mr-2"})," ",i?"保存中...":"保存配置"]})]}),s.jsxs(De,{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(tk,{className:"w-5 h-5 text-blue-400"})," 匹配池选择"]}),s.jsx(Gt,{className:"text-gray-400",children:"选择匹配的用户池和完善程度要求,只有满足条件的用户才可被匹配到"})]}),s.jsxs(_e,{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx(te,{className:"text-gray-300",children:"匹配来源池"}),s.jsx("p",{className:"text-gray-500 text-xs",children:"可同时勾选多个池子(取并集匹配)"}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[{value:"vip",label:"超级个体(VIP会员)",desc:"付费 ¥1980 的VIP会员",icon:"👑",countKey:"vip"},{value:"complete",label:"完善资料用户",desc:"符合下方完善度要求的用户",icon:"✅",countKey:"complete"},{value:"all",label:"全部用户",desc:"所有已注册用户",icon:"👥",countKey:"all"}].map(L=>{const Q=e.poolSettings??pu,$=(Array.isArray(Q.poolSource)?Q.poolSource:[Q.poolSource]).includes(L.value),ie=b==null?void 0:b[L.countKey],oe=()=>{const me=Array.isArray(Q.poolSource)?[...Q.poolSource]:[Q.poolSource],I=$?me.filter(Y=>Y!==L.value):[...me,L.value];I.length===0&&I.push(L.value),n({...e,poolSettings:{...Q,poolSource:I}})};return s.jsxs("button",{type:"button",onClick:oe,className:`p-4 rounded-lg border text-left transition-all ${$?"border-[#38bdac] bg-[#38bdac]/10":"border-gray-700 bg-[#0a1628] hover:border-gray-600"}`,children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:`w-5 h-5 rounded border-2 flex items-center justify-center text-xs ${$?"border-[#38bdac] bg-[#38bdac] text-white":"border-gray-600"}`,children:$&&"✓"}),s.jsx("span",{className:"text-xl",children:L.icon}),s.jsx("span",{className:`text-sm font-medium ${$?"text-[#38bdac]":"text-gray-300"}`,children:L.label})]}),s.jsxs("span",{className:"text-lg font-bold text-white",children:[j?"...":ie??"-",s.jsx("span",{className:"text-xs text-gray-500 font-normal ml-1",children:"人"})]})]}),s.jsx("p",{className:"text-gray-500 text-xs mt-2",children:L.desc}),s.jsx("span",{role:"link",tabIndex:0,onClick:me=>{me.stopPropagation(),t(`/users?pool=${L.value}`)},onKeyDown:me=>{me.key==="Enter"&&(me.stopPropagation(),t(`/users?pool=${L.value}`))},className:"text-[#38bdac] text-xs mt-2 inline-block hover:underline cursor-pointer",children:"查看用户列表 →"})]},L.value)})})]}),s.jsxs("div",{className:"space-y-3 pt-4 border-t border-gray-700/50",children:[s.jsx(te,{className:"text-gray-300",children:"用户资料完善要求(被匹配用户必须满足以下条件)"}),s.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[{key:"requirePhone",label:"有手机号",icon:"📱"},{key:"requireNickname",label:"有昵称",icon:"👤"},{key:"requireAvatar",label:"有头像",icon:"🖼️"},{key:"requireBusiness",label:"有业务需求",icon:"💼"}].map(L=>{const se=(e.poolSettings??pu)[L.key];return s.jsxs("div",{className:"flex items-center gap-3 bg-[#0a1628] rounded-lg p-3",children:[s.jsx(Ut,{checked:se,onCheckedChange:$=>n({...e,poolSettings:{...e.poolSettings??pu,[L.key]:$}})}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{children:L.icon}),s.jsx(te,{className:"text-gray-300 text-sm",children:L.label})]})]},L.key)})})]})]})]}),s.jsxs(De,{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(zo,{className:"w-5 h-5 text-yellow-400"})," 基础设置"]}),s.jsx(Gt,{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(te,{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:L=>n({...e,freeMatchLimit:parseInt(L.target.value,10)||0})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"付费匹配价格(元)"}),s.jsx(le,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:e.matchPrice,onChange:L=>n({...e,matchPrice:parseFloat(L.target.value)||1})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"每日最大匹配次数"}),s.jsx(le,{type:"number",min:1,max:100,className:"bg-[#0a1628] border-gray-700 text-white",value:e.settings.maxMatchesPerDay,onChange:L=>n({...e,settings:{...e.settings,maxMatchesPerDay:parseInt(L.target.value,10)||10}})})]})]}),s.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:e.settings.enableFreeMatches,onCheckedChange:L=>n({...e,settings:{...e.settings,enableFreeMatches:L}})}),s.jsx(te,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:e.settings.enablePaidMatches,onCheckedChange:L=>n({...e,settings:{...e.settings,enablePaidMatches:L}})}),s.jsx(te,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(De,{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(Kn,{className:"w-5 h-5 text-[#38bdac]"})," 匹配类型管理"]}),s.jsx(Gt,{className:"text-gray-400",children:"配置不同的匹配类型及其价格"})]}),s.jsxs(J,{onClick:O,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(zn,{className:"w-4 h-4 mr-1"})," 添加类型"]})]}),s.jsx(_e,{children:s.jsxs(fs,{children:[s.jsx(ps,{children:s.jsxs(gt,{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(L=>s.jsxs(gt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(je,{children:s.jsx("span",{className:"text-2xl",children:L.icon})}),s.jsx(je,{className:"font-mono text-gray-300",children:L.id}),s.jsx(je,{className:"text-white font-medium",children:L.label}),s.jsx(je,{className:"text-gray-300",children:L.matchLabel}),s.jsx(je,{children:s.jsxs(Be,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",L.price]})}),s.jsx(je,{children:L.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(je,{children:s.jsx(Ut,{checked:L.enabled,onCheckedChange:()=>z(L.id)})}),s.jsx(je,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>R(L),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(sn,{className:"w-4 h-4"})}),s.jsx(J,{variant:"ghost",size:"sm",onClick:()=>P(L.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(ts,{className:"w-4 h-4"})})]})})]},L.id))})]})})]}),s.jsx(Dt,{open:c,onOpenChange:u,children:s.jsxs(Ot,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(_t,{children:s.jsxs($t,{className:"text-white flex items-center gap-2",children:[h?s.jsx(sn,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(zn,{className:"w-5 h-5 text-[#38bdac]"}),h?"编辑匹配类型":"添加匹配类型"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"类型ID(英文)"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:m.id,onChange:L=>g({...m,id:L.target.value}),disabled:!!h})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:eH.map(L=>s.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${m.icon===L?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>g({...m,icon:L}),children:L},L))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"显示名称"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.label,onChange:L=>g({...m,label:L.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"匹配标签"}),s.jsx(le,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.matchLabel,onChange:L=>g({...m,matchLabel:L.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(te,{className:"text-gray-300",children:"单次匹配价格(元)"}),s.jsx(le,{type:"number",min:.01,step:.01,className:"bg-[#0a1628] border-gray-700 text-white",value:m.price,onChange:L=>g({...m,price:parseFloat(L.target.value)||1})})]}),s.jsxs("div",{className:"flex gap-6 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:m.matchFromDB,onCheckedChange:L=>g({...m,matchFromDB:L})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:m.showJoinAfterMatch,onCheckedChange:L=>g({...m,showJoinAfterMatch:L})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:m.enabled,onCheckedChange:L=>g({...m,enabled:L})}),s.jsx(te,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(rn,{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:U,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{className:"w-4 h-4 mr-2"})," 保存"]})]})]})})]})}const Pj={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function nH(){const[t,e]=y.useState([]),[n,r]=y.useState(0),[a,i]=y.useState(1),[o,c]=y.useState(10),[u,h]=y.useState(""),[f,m]=y.useState(!0),[g,b]=y.useState(null),[N,j]=y.useState(null);async function v(){m(!0),b(null);try{const C=new URLSearchParams({page:String(a),pageSize:String(o)});u&&C.set("matchType",u);const 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(()=>{v()},[a,u]);const k=Math.ceil(n/o)||1,T=({userId:C,nickname:R,avatar:O})=>s.jsxs("div",{className:"flex items-center gap-3 cursor-pointer group",onClick:()=>j(C),children:[s.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[O?s.jsx("img",{src:ya(O),alt:"",className:"w-full h-full object-cover",onError:U=>{U.currentTarget.style.display="none"}}):null,s.jsx("span",{className:O?"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:[g&&s.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg bg-red-500/20 border border-red-500/50 text-red-400 text-sm flex items-center justify-between",children:[s.jsx("span",{children:g}),s.jsx("button",{type:"button",onClick:()=>b(null),className:"hover:text-red-300",children:"×"})]}),s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("p",{className:"text-gray-400",children:["共 ",n," 条匹配记录 · 点击用户名查看详情"]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsxs("select",{value:u,onChange:C=>{h(C.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部类型"}),Object.entries(Pj).map(([C,R])=>s.jsx("option",{value:C,children:R},C))]}),s.jsxs("button",{type:"button",onClick:v,disabled:f,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(He,{className:`w-4 h-4 ${f?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(fs,{children:[s.jsx(ps,{children:s.jsxs(gt,{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(gt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(je,{children:s.jsx(T,{userId:C.userId,nickname:C.userNickname,avatar:C.userAvatar})}),s.jsx(je,{children:C.matchedUserId?s.jsx(T,{userId:C.matchedUserId,nickname:C.matchedNickname,avatar:C.matchedUserAvatar}):s.jsx("span",{className:"text-gray-500",children:"—"})}),s.jsx(je,{children:s.jsx(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Pj[C.matchType]||C.matchType})}),s.jsxs(je,{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(je,{className:"text-gray-400",children:C.createdAt?new Date(C.createdAt).toLocaleString():"-"})]},C.id)),t.length===0&&s.jsx(gt,{children:s.jsx(je,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(qs,{page:a,totalPages:k,total:n,pageSize:o,onPageChange:i,onPageSizeChange:C=>{c(C),i(1)}})]})})}),s.jsx(hy,{open:!!N,onClose:()=>j(null),userId:N,onUserUpdated:v})]})}function sH(){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(nH,{}),t==="pool"&&s.jsx(tH,{})]})}const Rj={investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function rH(){const[t,e]=y.useState([]),[n,r]=y.useState(0),[a,i]=y.useState(1),[o,c]=y.useState(10),[u,h]=y.useState(!0),[f,m]=y.useState("investor"),[g,b]=y.useState(null);async function N(){h(!0);try{const T=new URLSearchParams({page:String(a),pageSize:String(o),matchType:f}),C=await Oe(`/api/db/match-records?${T}`);C!=null&&C.success&&(e(C.records||[]),r(C.total??0))}catch(T){console.error(T)}finally{h(!1)}}y.useEffect(()=>{N()},[a,f]);const j=async T=>{if(!T.phone&&!T.wechatId){G.info("该记录无联系方式,无法推送到存客宝");return}b(T.id);try{const C=await Nt("/api/ckb/join",{type:T.matchType||"investor",phone:T.phone||"",wechat:T.wechatId||"",userId:T.userId,name:T.userNickname||""});G.error((C==null?void 0:C.message)||(C!=null&&C.success?"推送成功":"推送失败"))}catch(C){G.error("推送失败: "+(C instanceof Error?C.message:"网络错误"))}finally{b(null)}},v=Math.ceil(n/o)||1,k=T=>!!(T.phone||T.wechatId);return s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-400",children:"点击获客:有人填写手机号/微信号的直接显示,可一键推送到存客宝"}),s.jsxs("p",{className:"text-gray-500 text-xs mt-1",children:["共 ",n," 条记录 — 有联系方式的可触发存客宝添加好友"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("select",{value:f,onChange:T=>{m(T.target.value),i(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:Object.entries(Rj).map(([T,C])=>s.jsx("option",{value:T,children:C},T))}),s.jsxs(J,{onClick:N,disabled:u,variant:"outline",className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-4 h-4 mr-2 ${u?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(fs,{children:[s.jsx(ps,{children:s.jsxs(gt,{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(T=>{var C,R;return s.jsxs(gt,{className:`border-gray-700/50 ${k(T)?"hover:bg-[#0a1628]":"opacity-60"}`,children:[s.jsx(je,{className:"text-white",children:T.userNickname||((C=T.userId)==null?void 0:C.slice(0,12))}),s.jsx(je,{className:"text-white",children:T.matchedNickname||((R=T.matchedUserId)==null?void 0:R.slice(0,12))}),s.jsx(je,{children:s.jsx(Be,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:Rj[T.matchType]||T.matchType})}),s.jsxs(je,{className:"text-sm",children:[T.phone&&s.jsxs("div",{className:"text-green-400",children:["📱 ",T.phone]}),T.wechatId&&s.jsxs("div",{className:"text-blue-400",children:["💬 ",T.wechatId]}),!T.phone&&!T.wechatId&&s.jsx("span",{className:"text-gray-600",children:"无联系方式"})]}),s.jsx(je,{className:"text-gray-400 text-sm",children:T.createdAt?new Date(T.createdAt).toLocaleString():"-"}),s.jsx(je,{className:"text-right",children:k(T)?s.jsxs(J,{size:"sm",onClick:()=>j(T),disabled:g===T.id,className:"bg-[#38bdac] hover:bg-[#2da396] text-white text-xs h-7 px-3",children:[s.jsx(dA,{className:"w-3 h-3 mr-1"}),g===T.id?"推送中...":"推送CKB"]}):s.jsx("span",{className:"text-gray-600 text-xs",children:"—"})})]},T.id)}),t.length===0&&s.jsx(gt,{children:s.jsx(je,{colSpan:6,className:"text-center py-12 text-gray-500",children:"暂无记录"})})]})]}),s.jsx(qs,{page:a,totalPages:v,total:n,pageSize:o,onPageChange:i,onPageSizeChange:T=>{c(T),i(1)}})]})})})]})}const Lj={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},aH={single:"单次",half_year:"半年",year:"年度"};function iH(){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(Lj).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(He,{className:`w-4 h-4 mr-2 ${n?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(fs,{children:[s.jsx(ps,{children:s.jsxs(gt,{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(gt,{className:"border-gray-700/50",children:[s.jsx(je,{className:"text-gray-300",children:c.id}),s.jsx(je,{className:"text-gray-400",children:c.userId}),s.jsx(je,{className:"text-gray-400",children:c.mentorId}),s.jsx(je,{className:"text-gray-400",children:aH[c.consultationType]||c.consultationType}),s.jsxs(je,{className:"text-white",children:["¥",c.amount]}),s.jsx(je,{className:"text-gray-400",children:Lj[c.status]||c.status}),s.jsx(je,{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(je,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}function oH(){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(iH,{}),t==="manage"&&s.jsx("div",{className:"-mx-8",children:s.jsx(K4,{embedded:!0})})]})}function lH(){const[t,e]=y.useState([]),[n,r]=y.useState(0),[a,i]=y.useState(1),[o,c]=y.useState(10),[u,h]=y.useState(!0);async function f(){h(!0);try{const g=new URLSearchParams({page:String(a),pageSize:String(o),matchType:"team"}),b=await Oe(`/api/db/match-records?${g}`);b!=null&&b.success&&(e(b.records||[]),r(b.total??0))}catch(g){console.error(g)}finally{h(!1)}}y.useEffect(()=>{f()},[a]);const m=Math.ceil(n/o)||1;return s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-4",children:[s.jsxs("div",{children:[s.jsxs("p",{className:"text-gray-400",children:["团队招募匹配记录,共 ",n," 条"]}),s.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"用户通过「团队招募」提交联系方式到存客宝"})]}),s.jsxs("button",{type:"button",onClick:f,disabled:u,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(He,{className:`w-4 h-4 ${u?"animate-spin":""}`})," 刷新"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(He,{className:"w-6 h-6 text-[#38bdac] animate-spin"}),s.jsx("span",{className:"ml-2 text-gray-400",children:"加载中..."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(fs,{children:[s.jsx(ps,{children:s.jsxs(gt,{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(g=>s.jsxs(gt,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(je,{className:"text-white",children:g.userNickname||g.userId}),s.jsx(je,{className:"text-white",children:g.matchedNickname||g.matchedUserId}),s.jsxs(je,{className:"text-gray-400 text-sm",children:[g.phone&&s.jsxs("div",{children:["📱 ",g.phone]}),g.wechatId&&s.jsxs("div",{children:["💬 ",g.wechatId]}),!g.phone&&!g.wechatId&&"-"]}),s.jsx(je,{className:"text-gray-400",children:g.createdAt?new Date(g.createdAt).toLocaleString():"-"})]},g.id)),t.length===0&&s.jsx(gt,{children:s.jsx(je,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无团队招募记录"})})]})]}),s.jsx(qs,{page:a,totalPages:m,total:n,pageSize:o,onPageChange:i,onPageSizeChange:g=>{c(g),i(1)}})]})})})]})}const cH=["partner","investor","mentor","team"],Rx=[{key:"join_partner",label:"找伙伴场景"},{key:"join_investor",label:"资源对接场景"},{key:"join_mentor",label:"导师顾问场景"},{key:"join_team",label:"团队招募场景"},{key:"match",label:"匹配上报"},{key:"lead",label:"链接卡若"}],Oj=`# 场景获客接口摘要 +- 地址:POST /v1/api/scenarios +- 必填:apiKey、sign、timestamp +- 主标识:phone 或 wechatId 至少一项 +- 可选:name、source、remark、tags、siteTags、portrait +- 签名:排除 sign/apiKey/portrait,键名升序拼接值后双重 MD5 +- 成功:code=200,message=新增成功 或 已存在`;function dH({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(Oj),[m,g]=y.useState(!1),[b,N]=y.useState(!1),[j,v]=y.useState([]),[k,T]=y.useState([]),[C,R]=y.useState({}),[O,U]=y.useState([{endpoint:"/api/ckb/join",label:"找伙伴",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"资源对接",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"导师顾问",method:"POST",status:"idle"},{endpoint:"/api/ckb/join",label:"团队招募",method:"POST",status:"idle"},{endpoint:"/api/ckb/match",label:"匹配上报",method:"POST",status:"idle"},{endpoint:"/api/miniprogram/ckb/lead",label:"链接卡若",method:"POST",status:"idle"},{endpoint:"/api/match/config",label:"匹配配置",method:"GET",status:"idle"}]),P=y.useMemo(()=>{const I={};return Rx.forEach(Y=>{I[Y.key]=C[Y.key]||{apiUrl:"https://ckbapi.quwanzhi.com/v1/api/scenarios",apiKey:"fyngh-ecy9h-qkdae-epwd5-rz6kd",source:"",tags:"",siteTags:"创业实验APP",notes:""}}),I},[C]),z=I=>{const Y=r.trim(),F=i.trim();return I<=3?{type:cH[I],phone:Y||void 0,wechat:F||void 0,userId:"admin_test",name:"后台测试"}:I===4?{matchType:"partner",phone:Y||void 0,wechat:F||void 0,userId:"admin_test",nickname:"后台测试",matchedUser:{id:"test",nickname:"测试",matchScore:88}}:I===5?{phone:Y||void 0,wechatId:F||void 0,userId:"admin_test",name:"后台测试"}:{}};async function L(){N(!0);try{const[I,Y,F]=await Promise.all([Oe("/api/db/config/full?key=ckb_config"),Oe("/api/db/ckb-leads?mode=submitted&page=1&pageSize=50"),Oe("/api/db/ckb-leads?mode=contact&page=1&pageSize=50")]),ge=I==null?void 0:I.data;ge!=null&&ge.routes&&R(ge.routes),ge!=null&&ge.docNotes&&u(ge.docNotes),ge!=null&&ge.docContent&&f(ge.docContent),Y!=null&&Y.success&&v(Y.records||[]),F!=null&&F.success&&T(F.records||[])}finally{N(!1)}}y.useEffect(()=>{n(t)},[t]),y.useEffect(()=>{L()},[]);const Q=y.useMemo(()=>{const I=V=>(V||"").replace(/\D/g,"")||"",Y=V=>{const W=I(V.phone);if(W)return`phone:${W}`;const fe=(V.userId||"").trim();if(fe)return`user:${fe}`;const he=(V.wechatId||"").trim();return he?`wechat:${he}`:`row:${V.id}`},F=[...k].sort((V,W)=>{const fe=V.createdAt?new Date(V.createdAt).getTime():0;return(W.createdAt?new Date(W.createdAt).getTime():0)-fe}),ge=new Set,X=[];for(const V of F){const W=Y(V);ge.has(W)||(ge.add(W),X.push(V))}return X},[k]);async function se(){g(!0);try{const I=await Nt("/api/db/config",{key:"ckb_config",value:{routes:P,docNotes:c,docContent:h},description:"存客宝接口配置"});G.error((I==null?void 0:I.success)!==!1?"存客宝配置已保存":`保存失败: ${(I==null?void 0:I.error)||"未知错误"}`)}catch(I){G.error(`保存失败: ${I instanceof Error?I.message:"网络错误"}`)}finally{g(!1)}}const $=(I,Y)=>{R(F=>({...F,[I]:{...P[I],...Y}}))},ie=async I=>{const Y=O[I];if(Y.method==="POST"&&!r.trim()&&!i.trim()){G.error("请填写测试手机号");return}const F=[...O];F[I]={...Y,status:"testing",message:void 0,responseTime:void 0},U(F);const ge=performance.now();try{const X=Y.method==="GET"?await Oe(Y.endpoint):await Nt(Y.endpoint,z(I)),V=Math.round(performance.now()-ge),W=(X==null?void 0:X.message)||"",fe=(X==null?void 0:X.success)===!0||W.includes("已存在")||W.includes("已加入")||W.includes("已提交"),he=[...O];he[I]={...Y,status:fe?"success":"error",message:W||(fe?"正常":"异常"),responseTime:V},U(he),await L()}catch(X){const V=Math.round(performance.now()-ge),W=[...O];W[I]={...Y,status:"error",message:X instanceof Error?X.message:"失败",responseTime:V},U(W)}},oe=async()=>{if(!r.trim()&&!i.trim()){G.error("请填写测试手机号");return}for(let I=0;Is.jsx("div",{className:"overflow-auto rounded-lg border border-gray-700/30",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{className:"bg-[#0a1628] text-gray-400",children:s.jsxs("tr",{children:[s.jsx("th",{className:"text-left px-4 py-3",children:"发起人"}),s.jsx("th",{className:"text-left px-4 py-3",children:"类型"}),s.jsx("th",{className:"text-left px-4 py-3",children:"手机号"}),s.jsx("th",{className:"text-left px-4 py-3",children:"微信号"}),s.jsx("th",{className:"text-left px-4 py-3",children:"时间"})]})}),s.jsx("tbody",{children:I.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"p-0 align-top",children:s.jsxs("div",{className:"py-14 px-6 text-center bg-[#0a1628]/40 border-t border-gray-700/30",children:[s.jsx($l,{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:Y}),F?s.jsx("p",{className:"text-gray-500 text-sm mt-2 max-w-md mx-auto leading-relaxed",children:F}):null]})})}):I.map(ge=>s.jsxs("tr",{className:"border-t border-gray-700/30",children:[s.jsx("td",{className:"px-4 py-3 text-white",children:ge.userNickname||ge.userId}),s.jsx("td",{className:"px-4 py-3 text-gray-300",children:ge.matchType}),s.jsx("td",{className:"px-4 py-3 text-green-400",children:ge.phone||"—"}),s.jsx("td",{className:"px-4 py-3 text-blue-400",children:ge.wechatId||"—"}),s.jsx("td",{className:"px-4 py-3 text-gray-400",children:ge.createdAt?new Date(ge.createdAt).toLocaleString():"—"})]},String(ge.id)))})]})});return s.jsx(De,{className:"bg-[#0f2137] border-orange-500/30 mb-6",children:s.jsxs(_e,{className:"p-5",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("h3",{className:"text-white font-semibold",children:"存客宝工作台"}),s.jsx(Be,{className:"bg-orange-500/20 text-orange-400 border-0 text-xs",children:"CKB"}),s.jsxs("button",{type:"button",onClick:()=>n("doc"),className:"text-orange-400/60 text-xs hover:text-orange-400 flex items-center gap-1",children:[s.jsx($o,{className:"w-3 h-3"})," API 文档"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(J,{onClick:()=>L(),variant:"outline",size:"sm",className:"border-gray-700 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(He,{className:`w-3.5 h-3.5 mr-1 ${b?"animate-spin":""}`})," 刷新"]}),s.jsxs(J,{onClick:se,disabled:m,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Tn,{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,Y])=>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:Y},I))}),e==="overview"&&s.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"加入/匹配提交"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:j.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"留资线索(有联系方式,已去重)"}),s.jsx("p",{className:"text-3xl font-bold text-white",children:Q.length}),k.length!==Q.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:Rx.length})]}),s.jsxs("div",{className:"bg-[#0a1628] border border-gray-700/30 rounded-xl p-5",children:[s.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"文档备注"}),s.jsx("p",{className:"text-sm text-gray-300 line-clamp-3",children:c||"未填写"})]})]}),e==="submitted"&&me(j,"暂无加入/匹配提交记录","用户在找伙伴发起加入或匹配后会出现在这里。"),e==="contact"&&s.jsxs("div",{className:"space-y-2",children:[k.length>Q.length&&s.jsxs("p",{className:"text-xs text-gray-500",children:["已合并 ",k.length-Q.length," 条重复(同手机号或同用户 ID 仅保留最近一条)"]}),me(Q,"暂无有联系方式线索","存客宝留资同步后显示;完整列表与筛选请前往「用户管理 → 获客列表」。")]}),e==="config"&&s.jsx("div",{className:"space-y-4",children:Rx.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(te,{className:"text-gray-500 text-xs",children:"API 地址"}),s.jsx(le,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:P[I.key].apiUrl,onChange:Y=>$(I.key,{apiUrl:Y.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{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:P[I.key].apiKey,onChange:Y=>$(I.key,{apiKey:Y.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"Source"}),s.jsx(le,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:P[I.key].source,onChange:Y=>$(I.key,{source:Y.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"Tags"}),s.jsx(le,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:P[I.key].tags,onChange:Y=>$(I.key,{tags:Y.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"SiteTags"}),s.jsx(le,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:P[I.key].siteTags,onChange:Y=>$(I.key,{siteTags:Y.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"说明备注"}),s.jsx(le,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:P[I.key].notes,onChange:Y=>$(I.key,{notes:Y.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($l,{className:"w-4 h-4 text-gray-500 shrink-0"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(te,{className:"text-gray-500 text-xs",children:"测试手机号"}),s.jsx(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(te,{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:oe,className:"bg-orange-500 hover:bg-orange-600 text-white",children:[s.jsx(zo,{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,Y)=>s.jsxs("div",{className:"flex items-center justify-between bg-[#0a1628] rounded-lg px-3 py-2 border border-gray-700/30",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[I.status==="idle"&&s.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-600 shrink-0"}),I.status==="testing"&&s.jsx(He,{className:"w-3 h-3 text-yellow-400 animate-spin shrink-0"}),I.status==="success"&&s.jsx(Qj,{className:"w-3 h-3 text-green-400 shrink-0"}),I.status==="error"&&s.jsx(Xj,{className:"w-3 h-3 text-red-400 shrink-0"}),s.jsx("span",{className:"text-white text-xs truncate",children:I.label})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[I.responseTime!==void 0&&s.jsxs("span",{className:"text-gray-600 text-[10px]",children:[I.responseTime,"ms"]}),s.jsx("button",{type:"button",onClick:()=>ie(Y),disabled:I.status==="testing",className:"text-orange-400/60 hover:text-orange-400 text-[10px] disabled:opacity-50",children:"测试"})]})]},`${I.endpoint}-${Y}`))})]}),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($o,{className:"w-3 h-3"})," 打开外链"]})]}),s.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-400 leading-6",children:h||Oj})]}),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 uH=[{id:"partner",label:"找伙伴",icon:Kn,desc:"匹配池与记录"},{id:"resource",label:"资源对接",icon:rM,desc:"人脉资源"},{id:"mentor",label:"导师预约",icon:tM,desc:"预约与管理"},{id:"team",label:"团队招募",icon:Gc,desc:"团队协作"}];function hH(){const[t,e]=y.useState("partner"),[n,r]=y.useState(!1);return s.jsxs("div",{className:"p-8 w-full max-w-7xl mx-auto",children:[s.jsxs("div",{className:"mb-8 flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-xl font-semibold text-white flex items-center gap-2",children:[s.jsx(Kn,{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(a=>!a),className:`border-orange-500/30 text-orange-300 hover:bg-orange-500/10 bg-transparent text-xs ${n?"bg-orange-500/10":""}`,children:[s.jsx(Pi,{className:"w-3.5 h-3.5 mr-1.5"}),"存客宝",s.jsx(Cl,{className:`w-3 h-3 ml-1 transition-transform ${n?"rotate-90":""}`})]})]}),n&&s.jsx(dH,{initialTab:"overview"}),s.jsx("div",{className:"flex gap-1 mb-6 bg-[#0a1628] rounded-lg p-1 border border-gray-700/40",children:uH.map(a=>{const i=t===a.id;return s.jsxs("button",{type:"button",onClick:()=>e(a.id),className:`flex-1 flex items-center justify-center gap-1.5 px-3 py-2 rounded-md text-sm transition-all ${i?"bg-[#38bdac] text-white shadow-md":"text-gray-400 hover:text-white hover:bg-gray-700/40"}`,children:[s.jsx(a.icon,{className:"w-3.5 h-3.5"}),a.label]},a.id)})}),t==="partner"&&s.jsx(sH,{}),t==="resource"&&s.jsx(rH,{}),t==="mentor"&&s.jsx(oH,{}),t==="team"&&s.jsx(lH,{})]})}function fH(){const t=Ko();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(Jj,{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(Dl,{to:"/",children:[s.jsx(fM,{className:"w-4 h-4 mr-2"}),"返回首页"]})})]})})}function pH(){return s.jsxs(GT,{children:[s.jsx(dn,{path:"/login",element:s.jsx(GI,{})}),s.jsxs(dn,{path:"/",element:s.jsx(YA,{}),children:[s.jsx(dn,{index:!0,element:s.jsx(Kh,{to:"/dashboard",replace:!0})}),s.jsx(dn,{path:"dashboard",element:s.jsx(o8,{})}),s.jsx(dn,{path:"orders",element:s.jsx(l8,{})}),s.jsx(dn,{path:"users",element:s.jsx(x8,{})}),s.jsx(dn,{path:"distribution",element:s.jsx(z8,{})}),s.jsx(dn,{path:"withdrawals",element:s.jsx(F8,{})}),s.jsx(dn,{path:"content",element:s.jsx(vV,{})}),s.jsx(dn,{path:"referral-settings",element:s.jsx(V2,{})}),s.jsx(dn,{path:"author-settings",element:s.jsx(Kh,{to:"/settings?tab=author",replace:!0})}),s.jsx(dn,{path:"vip-roles",element:s.jsx(XV,{})}),s.jsx(dn,{path:"mentors",element:s.jsx(K4,{})}),s.jsx(dn,{path:"mentor-consultations",element:s.jsx(ZV,{})}),s.jsx(dn,{path:"admin-users",element:s.jsx(Kh,{to:"/settings?tab=admin",replace:!0})}),s.jsx(dn,{path:"settings",element:s.jsx(VV,{})}),s.jsx(dn,{path:"payment",element:s.jsx(HV,{})}),s.jsx(dn,{path:"site",element:s.jsx(qV,{})}),s.jsx(dn,{path:"qrcodes",element:s.jsx(GV,{})}),s.jsx(dn,{path:"find-partner",element:s.jsx(hH,{})}),s.jsx(dn,{path:"match",element:s.jsx(QV,{})}),s.jsx(dn,{path:"match-records",element:s.jsx(YV,{})}),s.jsx(dn,{path:"api-doc",element:s.jsx(Kh,{to:"/api-docs",replace:!0})}),s.jsx(dn,{path:"api-docs",element:s.jsx(W4,{})})]}),s.jsx(dn,{path:"*",element:s.jsx(fH,{})})]})}ZE.createRoot(document.getElementById("root")).render(s.jsx(y.StrictMode,{children:s.jsx(n5,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:s.jsx(pH,{})})})); diff --git a/soul-admin/dist/assets/index-BfljfNs2.css b/soul-admin/dist/assets/index-BfljfNs2.css deleted file mode 100644 index 5c10aaf8..00000000 --- a/soul-admin/dist/assets/index-BfljfNs2.css +++ /dev/null @@ -1 +0,0 @@ -.rich-editor-wrapper{border:1px solid #374151;border-radius:.5rem;background:#0a1628;overflow:hidden}.rich-editor-toolbar{display:flex;align-items:center;gap:2px;padding:6px 8px;border-bottom:1px solid #374151;background:#0f1d32;flex-wrap:wrap}.toolbar-group{display:flex;align-items:center;gap:1px}.toolbar-divider{width:1px;height:20px;background:#374151;margin:0 4px}.rich-editor-toolbar button{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:4px;border:none;background:transparent;color:#9ca3af;cursor:pointer;transition:all .15s}.rich-editor-toolbar button:hover{background:#1f2937;color:#d1d5db}.rich-editor-toolbar button.is-active{background:#38bdac33;color:#38bdac}.rich-editor-toolbar button:disabled{opacity:.3;cursor:not-allowed}.link-tag-select{background:#0a1628;border:1px solid #374151;color:#d1d5db;font-size:12px;padding:2px 6px;border-radius:4px;cursor:pointer;max-width:160px}.link-input-bar{display:flex;align-items:center;gap:4px;padding:4px 8px;border-bottom:1px solid #374151;background:#0f1d32}.link-input{flex:1;background:#0a1628;border:1px solid #374151;color:#fff;padding:4px 8px;border-radius:4px;font-size:13px}.link-confirm,.link-remove{padding:4px 10px;border-radius:4px;border:none;font-size:12px;cursor:pointer}.link-confirm{background:#38bdac;color:#fff}.link-remove{background:#374151;color:#9ca3af}.rich-editor-content{min-height:450px;max-height:720px;overflow-y:auto;padding:12px 16px;color:#e5e7eb;font-size:14px;line-height:1.7}.rich-editor-content:focus{outline:none}.rich-editor-content h1{font-size:1.5em;font-weight:700;margin:.8em 0 .4em;color:#fff}.rich-editor-content h2{font-size:1.3em;font-weight:600;margin:.7em 0 .3em;color:#fff}.rich-editor-content h3{font-size:1.15em;font-weight:600;margin:.6em 0 .3em;color:#fff}.rich-editor-content p{margin:.4em 0}.rich-editor-content strong{color:#fff}.rich-editor-content code{background:#1f2937;padding:2px 6px;border-radius:3px;font-size:.9em;color:#38bdac}.rich-editor-content pre{background:#1f2937;padding:12px;border-radius:6px;overflow-x:auto;margin:.6em 0}.rich-editor-content blockquote{border-left:3px solid #38bdac;padding-left:12px;margin:.6em 0;color:#9ca3af}.rich-editor-content ul,.rich-editor-content ol{padding-left:1.5em;margin:.4em 0}.rich-editor-content li{margin:.2em 0}.rich-editor-content hr{border:none;border-top:1px solid #374151;margin:1em 0}.rich-editor-content img,.rich-editor-content .ProseMirror img,.rich-editor-content img.rich-editor-img-thumb{max-width:240px!important;max-height:140px!important;width:auto!important;height:auto!important;object-fit:contain;display:inline-block;vertical-align:middle;border-radius:6px;margin:.35em .25em .35em 0;border:1px dashed rgba(56,189,172,.45);background:#0f172a99;box-sizing:border-box}.rich-editor-content .rich-attachment-line{margin:.5em 0;padding:8px 12px;border-radius:8px;border:1px dashed rgba(125,211,252,.35);background:#0f172a8c;font-size:13px;line-height:1.5}.rich-editor-content .rich-attachment-badge{display:inline-block;font-size:10px;font-weight:600;letter-spacing:.02em;padding:2px 8px;border-radius:4px;background:#38bdac38;color:#38bdac;margin-right:8px;vertical-align:middle}.rich-editor-content .rich-attachment-link{color:#7dd3fc!important;font-weight:500;text-decoration:underline;word-break:break-all}.rich-editor-content .rich-video-wrap{display:block;margin:.5em 0;max-width:280px;border:1px dashed rgba(56,189,172,.45);border-radius:8px;overflow:hidden;background:#0f172acc}.rich-editor-content .rich-video-wrap video{display:block;width:100%;max-height:160px;object-fit:contain;vertical-align:middle}.rich-editor-content .rich-video-caption{font-size:11px;color:#6b7280;padding:4px 8px;border-top:1px solid #374151}.rich-editor-content a,.rich-link{color:#38bdac;text-decoration:underline;cursor:pointer}.rich-editor-content table{border-collapse:collapse;width:100%;margin:.5em 0}.rich-editor-content th,.rich-editor-content td{border:1px solid #374151;padding:6px 10px;text-align:left}.rich-editor-content th{background:#1f2937;font-weight:600}.rich-editor-content .ProseMirror-placeholder:before{content:attr(data-placeholder);color:#6b7280;float:left;height:0;pointer-events:none}.mention-tag{background:#38bdac26;color:#38bdac;border-radius:4px;padding:1px 4px;font-weight:500}.link-tag-node{display:inline;background:#ffd7001f;color:gold;border-radius:4px;padding:1px 4px;font-weight:500;cursor:default;-webkit-user-select:all;user-select:all;white-space:nowrap}.mention-popup{position:fixed;z-index:9999;background:#1a2638;border:1px solid #374151;border-radius:8px;padding:4px;min-width:180px;max-height:240px;overflow-y:auto;box-shadow:0 4px 20px #0006}.mention-item{display:flex;align-items:center;justify-content:space-between;padding:6px 10px;border-radius:4px;cursor:pointer;color:#d1d5db;font-size:13px}.mention-item:hover,.mention-item.is-selected{background:#38bdac26;color:#38bdac}.mention-name{font-weight:500}.mention-id{font-size:11px;color:#6b7280}.bubble-menu{display:flex;gap:2px;background:#1a2638;border:1px solid #374151;border-radius:6px;padding:4px;box-shadow:0 4px 12px #0000004d}.bubble-menu button{display:flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:4px;border:none;background:transparent;color:#9ca3af;cursor:pointer}.bubble-menu button:hover{background:#1f2937;color:#d1d5db}.bubble-menu button.is-active{color:#38bdac}.mention-trigger-btn{color:#38bdac!important}.mention-trigger-btn:hover{background:#38bdac33!important}.upload-progress-bar{display:flex;align-items:center;gap:8px;padding:4px 10px;background:#0f1d32;border-bottom:1px solid #374151}.upload-progress-track{flex:1;height:4px;background:#1f2937;border-radius:2px;overflow:hidden}.upload-progress-fill{height:100%;background:linear-gradient(90deg,#38bdac,#4ae3ce);border-radius:2px;transition:width .3s ease}.upload-progress-text{font-size:11px;color:#38bdac;white-space:nowrap}/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-pan-x:initial;--tw-pan-y:initial;--tw-pinch-zoom:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial}}}@layer theme{:root,:host{--font-sans:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-red-900:oklch(39.6% .141 25.723);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-950:oklch(27.9% .077 45.635);--color-yellow-300:oklch(90.5% .182 98.111);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-cyan-200:oklch(91.7% .08 205.041);--color-cyan-300:oklch(86.5% .127 207.078);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-cyan-600:oklch(60.9% .126 221.723);--color-sky-200:oklch(90.1% .058 230.902);--color-sky-300:oklch(82.8% .111 230.318);--color-sky-500:oklch(68.5% .169 237.323);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-violet-300:oklch(81.1% .111 293.571);--color-violet-500:oklch(60.6% .25 292.717);--color-purple-300:oklch(82.7% .119 306.383);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-rose-400:oklch(71.2% .194 13.428);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--container-6xl:72rem;--container-7xl:80rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5/2.25);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--blur-xl:24px;--blur-3xl:64px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.not-sr-only{clip-path:none;white-space:normal;width:auto;height:auto;margin:0;padding:0;position:static;overflow:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.-top-2\.5{top:calc(var(--spacing)*-2.5)}.top-0{top:calc(var(--spacing)*0)}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-2{top:calc(var(--spacing)*2)}.top-3{top:calc(var(--spacing)*3)}.top-4{top:calc(var(--spacing)*4)}.top-16{top:calc(var(--spacing)*16)}.top-\[50\%\]{top:50%}.top-full{top:100%}.right-0{right:calc(var(--spacing)*0)}.right-1{right:calc(var(--spacing)*1)}.right-1\/4{right:25%}.right-4{right:calc(var(--spacing)*4)}.bottom-1\/4{bottom:25%}.bottom-2{bottom:calc(var(--spacing)*2)}.-left-2\.5{left:calc(var(--spacing)*-2.5)}.left-0{left:calc(var(--spacing)*0)}.left-1\/4{left:25%}.left-2{left:calc(var(--spacing)*2)}.left-3{left:calc(var(--spacing)*3)}.left-\[-13px\]{left:-13px}.left-\[11px\]{left:11px}.left-\[50\%\]{left:50%}.isolate{isolation:isolate}.isolation-auto{isolation:auto}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.col-span-3{grid-column:span 3/span 3}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.-mx-2{margin-inline:calc(var(--spacing)*-2)}.-mx-8{margin-inline:calc(var(--spacing)*-8)}.mx-1{margin-inline:calc(var(--spacing)*1)}.mx-20{margin-inline:calc(var(--spacing)*20)}.mx-auto{margin-inline:auto}.-mt-6{margin-top:calc(var(--spacing)*-6)}.mt-0{margin-top:calc(var(--spacing)*0)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-1\.5{margin-top:calc(var(--spacing)*1.5)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mr-0\.5{margin-right:calc(var(--spacing)*.5)}.mr-1{margin-right:calc(var(--spacing)*1)}.mr-1\.5{margin-right:calc(var(--spacing)*1.5)}.mr-2{margin-right:calc(var(--spacing)*2)}.mr-3{margin-right:calc(var(--spacing)*3)}.mr-auto{margin-right:auto}.mb-0\.5{margin-bottom:calc(var(--spacing)*.5)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-1\.5{margin-bottom:calc(var(--spacing)*1.5)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-3{margin-left:calc(var(--spacing)*3)}.ml-4{margin-left:calc(var(--spacing)*4)}.ml-6{margin-left:calc(var(--spacing)*6)}.ml-\[52px\]{margin-left:52px}.ml-auto{margin-left:auto}.line-clamp-1{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.flow-root{display:flow-root}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline\!{display:inline!important}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.inline-grid{display:inline-grid}.inline-table{display:inline-table}.list-item{display:list-item}.table{display:table}.table\!{display:table!important}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-column{display:table-column}.table-column-group{display:table-column-group}.table-footer-group{display:table-footer-group}.table-header-group{display:table-header-group}.table-row{display:table-row}.table-row-group{display:table-row-group}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.size-9{width:calc(var(--spacing)*9);height:calc(var(--spacing)*9)}.size-10{width:calc(var(--spacing)*10);height:calc(var(--spacing)*10)}.h-0\.5{height:calc(var(--spacing)*.5)}.h-1\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-2\.5{height:calc(var(--spacing)*2.5)}.h-3{height:calc(var(--spacing)*3)}.h-3\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-11{height:calc(var(--spacing)*11)}.h-12{height:calc(var(--spacing)*12)}.h-14{height:calc(var(--spacing)*14)}.h-16{height:calc(var(--spacing)*16)}.h-20{height:calc(var(--spacing)*20)}.h-24{height:calc(var(--spacing)*24)}.h-40{height:calc(var(--spacing)*40)}.h-96{height:calc(var(--spacing)*96)}.h-auto{height:auto}.h-full{height:100%}.h-screen{height:100vh}.max-h-48{max-height:calc(var(--spacing)*48)}.max-h-64{max-height:calc(var(--spacing)*64)}.max-h-96{max-height:calc(var(--spacing)*96)}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[92vh\]{max-height:92vh}.max-h-\[120px\]{max-height:120px}.max-h-\[160px\]{max-height:160px}.max-h-\[300px\]{max-height:300px}.max-h-\[400px\]{max-height:400px}.max-h-\[420px\]{max-height:420px}.max-h-\[450px\]{max-height:450px}.max-h-\[520px\]{max-height:520px}.max-h-\[min\(60vh\,320px\)\]{max-height:min(60vh,320px)}.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-\[140px\]{min-height:140px}.min-h-\[260px\]{min-height:260px}.min-h-\[400px\]{min-height:400px}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-0\.5{width:calc(var(--spacing)*.5)}.w-2{width:calc(var(--spacing)*2)}.w-2\.5{width:calc(var(--spacing)*2.5)}.w-3{width:calc(var(--spacing)*3)}.w-3\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-7{width:calc(var(--spacing)*7)}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-10{width:calc(var(--spacing)*10)}.w-11{width:calc(var(--spacing)*11)}.w-12{width:calc(var(--spacing)*12)}.w-14{width:calc(var(--spacing)*14)}.w-16{width:calc(var(--spacing)*16)}.w-20{width:calc(var(--spacing)*20)}.w-24{width:calc(var(--spacing)*24)}.w-28{width:calc(var(--spacing)*28)}.w-32{width:calc(var(--spacing)*32)}.w-36{width:calc(var(--spacing)*36)}.w-40{width:calc(var(--spacing)*40)}.w-48{width:calc(var(--spacing)*48)}.w-52{width:calc(var(--spacing)*52)}.w-56{width:calc(var(--spacing)*56)}.w-64{width:calc(var(--spacing)*64)}.w-96{width:calc(var(--spacing)*96)}.w-\[5\.5rem\]{width:5.5rem}.w-\[8\%\]{width:8%}.w-\[10\%\]{width:10%}.w-\[11\%\]{width:11%}.w-\[13\%\]{width:13%}.w-\[14\%\]{width:14%}.w-\[19\%\]{width:19%}.w-\[25\%\]{width:25%}.w-\[72px\]{width:72px}.w-\[100px\]{width:100px}.w-\[280px\]{width:280px}.w-\[min\(100vw-2rem\,42rem\)\]{width:min(100vw - 2rem,42rem)}.w-fit{width:fit-content}.w-full{width:100%}.w-screen{width:100vw}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-6xl{max-width:var(--container-6xl)}.max-w-7xl{max-width:var(--container-7xl)}.max-w-\[72px\]{max-width:72px}.max-w-\[96px\]{max-width:96px}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[140px\]{max-width:140px}.max-w-\[160px\]{max-width:160px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[220px\]{max-width:220px}.max-w-\[260px\]{max-width:260px}.max-w-\[420px\]{max-width:420px}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.max-w-\[min\(100\%\,20rem\)\]{max-width:min(100%,20rem)}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-none{max-width:none}.max-w-sm{max-width:var(--container-sm)}.max-w-xl{max-width:var(--container-xl)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-40{min-width:calc(var(--spacing)*40)}.min-w-\[8rem\]{min-width:8rem}.min-w-\[60px\]{min-width:60px}.min-w-\[88px\]{min-width:88px}.min-w-\[108px\]{min-width:108px}.min-w-\[120px\]{min-width:120px}.min-w-\[148px\]{min-width:148px}.min-w-\[168px\]{min-width:168px}.min-w-\[200px\]{min-width:200px}.min-w-\[220px\]{min-width:220px}.min-w-\[1024px\]{min-width:1024px}.min-w-\[1320px\]{min-width:1320px}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.table-fixed{table-layout:fixed}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-0{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-1\/2{--tw-translate-x: 50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-0{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-none{translate:none}.scale-90{--tw-scale-x:90%;--tw-scale-y:90%;--tw-scale-z:90%;scale:var(--tw-scale-x)var(--tw-scale-y)}.scale-110{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x)var(--tw-scale-y)}.scale-3d{scale:var(--tw-scale-x)var(--tw-scale-y)var(--tw-scale-z)}.scale-\[0\.98\]{scale:.98}.rotate-90{rotate:90deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-pan-y{--tw-pan-y:pan-y;touch-action:var(--tw-pan-x,)var(--tw-pan-y,)var(--tw-pinch-zoom,)}.touch-pinch-zoom{--tw-pinch-zoom:pinch-zoom;touch-action:var(--tw-pan-x,)var(--tw-pan-y,)var(--tw-pinch-zoom,)}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.grid-cols-\[40px_1fr_90px_90px_70px_60px_110px\]{grid-template-columns:40px 1fr 90px 90px 70px 60px 110px}.grid-cols-\[40px_40px_1fr_80px_80px_80px_60px\]{grid-template-columns:40px 40px 1fr 80px 80px 80px 60px}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-nowrap{flex-wrap:nowrap}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:calc(var(--spacing)*0)}.gap-0\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-2\.5{gap:calc(var(--spacing)*2.5)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-6{gap:calc(var(--spacing)*6)}.gap-8{gap:calc(var(--spacing)*8)}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*0)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*0)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*8)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-reverse>:not(:last-child)){--tw-space-y-reverse:1}.gap-x-8{column-gap:calc(var(--spacing)*8)}:where(.space-x-reverse>:not(:last-child)){--tw-space-x-reverse:1}.gap-y-4{row-gap:calc(var(--spacing)*4)}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px*var(--tw-divide-x-reverse));border-inline-end-width:calc(1px*calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-y-reverse>:not(:last-child)){--tw-divide-y-reverse:1}:where(.divide-gray-700\/50>:not(:last-child)){border-color:#36415380}@supports (color:color-mix(in lab,red,red)){:where(.divide-gray-700\/50>:not(:last-child)){border-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}:where(.divide-white\/5>:not(:last-child)){border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){:where(.divide-white\/5>:not(:last-child)){border-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overscroll-y-contain{overscroll-behavior-y:contain}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-none{border-radius:0}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-s{border-start-start-radius:.25rem;border-end-start-radius:.25rem}.rounded-ss{border-start-start-radius:.25rem}.rounded-e{border-start-end-radius:.25rem;border-end-end-radius:.25rem}.rounded-se{border-start-end-radius:.25rem}.rounded-ee{border-end-end-radius:.25rem}.rounded-es{border-end-start-radius:.25rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-tl{border-top-left-radius:.25rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-r-md{border-top-right-radius:var(--radius-md);border-bottom-right-radius:var(--radius-md)}.rounded-tr{border-top-right-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-br{border-bottom-right-radius:.25rem}.rounded-bl{border-bottom-left-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-\[\#0f2137\]{border-color:#0f2137}.border-\[\#07C160\]{border-color:#07c160}.border-\[\#07C160\]\/20{border-color:#07c16033}.border-\[\#07C160\]\/30{border-color:#07c1604d}.border-\[\#38bdac\]{border-color:#38bdac}.border-\[\#38bdac\]\/20{border-color:#38bdac33}.border-\[\#38bdac\]\/25{border-color:#38bdac40}.border-\[\#38bdac\]\/30{border-color:#38bdac4d}.border-\[\#38bdac\]\/35{border-color:#38bdac59}.border-\[\#38bdac\]\/40{border-color:#38bdac66}.border-\[\#38bdac\]\/50{border-color:#38bdac80}.border-amber-400\/60{border-color:#fcbb0099}@supports (color:color-mix(in lab,red,red)){.border-amber-400\/60{border-color:color-mix(in oklab,var(--color-amber-400)60%,transparent)}}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.border-amber-500\/25{border-color:#f99c0040}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/25{border-color:color-mix(in oklab,var(--color-amber-500)25%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.border-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/40{border-color:color-mix(in oklab,var(--color-amber-500)40%,transparent)}}.border-amber-500\/50{border-color:#f99c0080}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/50{border-color:color-mix(in oklab,var(--color-amber-500)50%,transparent)}}.border-amber-600{border-color:var(--color-amber-600)}.border-amber-600\/60{border-color:#dd740099}@supports (color:color-mix(in lab,red,red)){.border-amber-600\/60{border-color:color-mix(in oklab,var(--color-amber-600)60%,transparent)}}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/30{border-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.border-blue-500\/40{border-color:#3080ff66}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/40{border-color:color-mix(in oklab,var(--color-blue-500)40%,transparent)}}.border-blue-500\/50{border-color:#3080ff80}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/50{border-color:color-mix(in oklab,var(--color-blue-500)50%,transparent)}}.border-cyan-500\/20{border-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/20{border-color:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.border-cyan-500\/30{border-color:#00b7d74d}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/30{border-color:color-mix(in oklab,var(--color-cyan-500)30%,transparent)}}.border-cyan-500\/40{border-color:#00b7d766}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/40{border-color:color-mix(in oklab,var(--color-cyan-500)40%,transparent)}}.border-cyan-600\/60{border-color:#0092b599}@supports (color:color-mix(in lab,red,red)){.border-cyan-600\/60{border-color:color-mix(in oklab,var(--color-cyan-600)60%,transparent)}}.border-emerald-500\/30{border-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/30{border-color:color-mix(in oklab,var(--color-emerald-500)30%,transparent)}}.border-emerald-500\/50{border-color:#00bb7f80}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/50{border-color:color-mix(in oklab,var(--color-emerald-500)50%,transparent)}}.border-gray-500{border-color:var(--color-gray-500)}.border-gray-600{border-color:var(--color-gray-600)}.border-gray-600\/50{border-color:#4a556580}@supports (color:color-mix(in lab,red,red)){.border-gray-600\/50{border-color:color-mix(in oklab,var(--color-gray-600)50%,transparent)}}.border-gray-700{border-color:var(--color-gray-700)}.border-gray-700\/30{border-color:#3641534d}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/30{border-color:color-mix(in oklab,var(--color-gray-700)30%,transparent)}}.border-gray-700\/40{border-color:#36415366}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/40{border-color:color-mix(in oklab,var(--color-gray-700)40%,transparent)}}.border-gray-700\/50{border-color:#36415380}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/50{border-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.border-gray-700\/60{border-color:#36415399}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/60{border-color:color-mix(in oklab,var(--color-gray-700)60%,transparent)}}.border-gray-700\/80{border-color:#364153cc}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/80{border-color:color-mix(in oklab,var(--color-gray-700)80%,transparent)}}.border-gray-800{border-color:var(--color-gray-800)}.border-green-500\/30{border-color:#00c7584d}@supports (color:color-mix(in lab,red,red)){.border-green-500\/30{border-color:color-mix(in oklab,var(--color-green-500)30%,transparent)}}.border-green-500\/40{border-color:#00c75866}@supports (color:color-mix(in lab,red,red)){.border-green-500\/40{border-color:color-mix(in oklab,var(--color-green-500)40%,transparent)}}.border-inherit{border-color:inherit}.border-orange-500\/20{border-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/20{border-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.border-orange-500\/30{border-color:#fe6e004d}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/30{border-color:color-mix(in oklab,var(--color-orange-500)30%,transparent)}}.border-orange-500\/40{border-color:#fe6e0066}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/40{border-color:color-mix(in oklab,var(--color-orange-500)40%,transparent)}}.border-orange-500\/50{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/50{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.border-purple-500\/30{border-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/30{border-color:color-mix(in oklab,var(--color-purple-500)30%,transparent)}}.border-purple-500\/40{border-color:#ac4bff66}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/40{border-color:color-mix(in oklab,var(--color-purple-500)40%,transparent)}}.border-purple-500\/50{border-color:#ac4bff80}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/50{border-color:color-mix(in oklab,var(--color-purple-500)50%,transparent)}}.border-red-500{border-color:var(--color-red-500)}.border-red-500\/20{border-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.border-red-500\/20{border-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.border-red-500\/50{border-color:#fb2c3680}@supports (color:color-mix(in lab,red,red)){.border-red-500\/50{border-color:color-mix(in oklab,var(--color-red-500)50%,transparent)}}.border-red-600\/40{border-color:#e4001466}@supports (color:color-mix(in lab,red,red)){.border-red-600\/40{border-color:color-mix(in oklab,var(--color-red-600)40%,transparent)}}.border-red-600\/50{border-color:#e4001480}@supports (color:color-mix(in lab,red,red)){.border-red-600\/50{border-color:color-mix(in oklab,var(--color-red-600)50%,transparent)}}.border-red-600\/60{border-color:#e4001499}@supports (color:color-mix(in lab,red,red)){.border-red-600\/60{border-color:color-mix(in oklab,var(--color-red-600)60%,transparent)}}.border-red-600\/70{border-color:#e40014b3}@supports (color:color-mix(in lab,red,red)){.border-red-600\/70{border-color:color-mix(in oklab,var(--color-red-600)70%,transparent)}}.border-red-900\/60{border-color:#82181a99}@supports (color:color-mix(in lab,red,red)){.border-red-900\/60{border-color:color-mix(in oklab,var(--color-red-900)60%,transparent)}}.border-transparent{border-color:#0000}.border-white\/5{border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.border-white\/5{border-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.border-white\/20{border-color:#fff3}@supports (color:color-mix(in lab,red,red)){.border-white\/20{border-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.border-yellow-500\/30{border-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/30{border-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.border-yellow-500\/35{border-color:#edb20059}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/35{border-color:color-mix(in oklab,var(--color-yellow-500)35%,transparent)}}.border-yellow-500\/40{border-color:#edb20066}@supports (color:color-mix(in lab,red,red)){.border-yellow-500\/40{border-color:color-mix(in oklab,var(--color-yellow-500)40%,transparent)}}.bg-\[\#0a1628\]{background-color:#0a1628}.bg-\[\#0a1628\]\/30{background-color:#0a16284d}.bg-\[\#0a1628\]\/40{background-color:#0a162866}.bg-\[\#0a1628\]\/50{background-color:#0a162880}.bg-\[\#0a1628\]\/60{background-color:#0a162899}.bg-\[\#0b1828\]{background-color:#0b1828}.bg-\[\#0f2137\]{background-color:#0f2137}.bg-\[\#0f2137\]\/90{background-color:#0f2137e6}.bg-\[\#00CED1\]{background-color:#00ced1}.bg-\[\#1C1C1E\]{background-color:#1c1c1e}.bg-\[\#3a1010\]\/35{background-color:#3a101059}.bg-\[\#07C160\]{background-color:#07c160}.bg-\[\#07C160\]\/5{background-color:#07c1600d}.bg-\[\#07C160\]\/10{background-color:#07c1601a}.bg-\[\#38bdac\]{background-color:#38bdac}.bg-\[\#38bdac\]\/5{background-color:#38bdac0d}.bg-\[\#38bdac\]\/10{background-color:#38bdac1a}.bg-\[\#38bdac\]\/15{background-color:#38bdac26}.bg-\[\#38bdac\]\/20{background-color:#38bdac33}.bg-\[\#38bdac\]\/30{background-color:#38bdac4d}.bg-\[\#38bdac\]\/80{background-color:#38bdaccc}.bg-\[\#050c18\]{background-color:#050c18}.bg-\[\#081322\]{background-color:#081322}.bg-\[\#162840\]{background-color:#162840}.bg-\[\#162840\]\/80{background-color:#162840cc}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/5{background-color:color-mix(in oklab,var(--color-amber-500)5%,transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.bg-amber-950\/25{background-color:#46190140}@supports (color:color-mix(in lab,red,red)){.bg-amber-950\/25{background-color:color-mix(in oklab,var(--color-amber-950)25%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\/30{background-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.bg-black\/30{background-color:color-mix(in oklab,var(--color-black)30%,transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black)40%,transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black)60%,transparent)}}.bg-black\/90{background-color:#000000e6}@supports (color:color-mix(in lab,red,red)){.bg-black\/90{background-color:color-mix(in oklab,var(--color-black)90%,transparent)}}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-500\/5{background-color:#3080ff0d}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/5{background-color:color-mix(in oklab,var(--color-blue-500)5%,transparent)}}.bg-blue-500\/10{background-color:#3080ff1a}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/10{background-color:color-mix(in oklab,var(--color-blue-500)10%,transparent)}}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.bg-cyan-500{background-color:var(--color-cyan-500)}.bg-cyan-500\/15{background-color:#00b7d726}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/15{background-color:color-mix(in oklab,var(--color-cyan-500)15%,transparent)}}.bg-cyan-500\/20{background-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/20{background-color:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.bg-emerald-500\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/10{background-color:color-mix(in oklab,var(--color-emerald-500)10%,transparent)}}.bg-emerald-500\/20{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/20{background-color:color-mix(in oklab,var(--color-emerald-500)20%,transparent)}}.bg-emerald-600{background-color:var(--color-emerald-600)}.bg-gray-500{background-color:var(--color-gray-500)}.bg-gray-500\/10{background-color:#6a72821a}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\/10{background-color:color-mix(in oklab,var(--color-gray-500)10%,transparent)}}.bg-gray-500\/20{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\/20{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.bg-gray-600{background-color:var(--color-gray-600)}.bg-gray-600\/20{background-color:#4a556533}@supports (color:color-mix(in lab,red,red)){.bg-gray-600\/20{background-color:color-mix(in oklab,var(--color-gray-600)20%,transparent)}}.bg-gray-600\/50{background-color:#4a556580}@supports (color:color-mix(in lab,red,red)){.bg-gray-600\/50{background-color:color-mix(in oklab,var(--color-gray-600)50%,transparent)}}.bg-gray-700{background-color:var(--color-gray-700)}.bg-gray-700\/50{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.bg-gray-700\/50{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.bg-gray-800{background-color:var(--color-gray-800)}.bg-green-400\/10{background-color:#05df721a}@supports (color:color-mix(in lab,red,red)){.bg-green-400\/10{background-color:color-mix(in oklab,var(--color-green-400)10%,transparent)}}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\/20{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/20{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.bg-green-600{background-color:var(--color-green-600)}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-500\/10{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/10{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.bg-purple-500\/10{background-color:#ac4bff1a}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/10{background-color:color-mix(in oklab,var(--color-purple-500)10%,transparent)}}.bg-purple-500\/15{background-color:#ac4bff26}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/15{background-color:color-mix(in oklab,var(--color-purple-500)15%,transparent)}}.bg-purple-500\/20{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/20{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.bg-red-500\/15{background-color:#fb2c3626}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/15{background-color:color-mix(in oklab,var(--color-red-500)15%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.bg-red-600{background-color:var(--color-red-600)}.bg-red-900\/80{background-color:#82181acc}@supports (color:color-mix(in lab,red,red)){.bg-red-900\/80{background-color:color-mix(in oklab,var(--color-red-900)80%,transparent)}}.bg-sky-500\/20{background-color:#00a5ef33}@supports (color:color-mix(in lab,red,red)){.bg-sky-500\/20{background-color:color-mix(in oklab,var(--color-sky-500)20%,transparent)}}.bg-transparent{background-color:#0000}.bg-violet-500\/20{background-color:#8d54ff33}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/20{background-color:color-mix(in oklab,var(--color-violet-500)20%,transparent)}}.bg-white{background-color:var(--color-white)}.bg-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.bg-white\/5{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.bg-white\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.bg-white\/20{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.bg-yellow-500{background-color:var(--color-yellow-500)}.bg-yellow-500\/20{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.bg-yellow-500\/20{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.bg-linear-to-br{--tw-gradient-position:to bottom right}@supports (background-image:linear-gradient(in lab,red,red)){.bg-linear-to-br{--tw-gradient-position:to bottom right in oklab}}.bg-linear-to-br{background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-\[\#00CED1\]{--tw-gradient-from:#00ced1;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#38bdac\]\/10{--tw-gradient-from:oklab(72.378% -.11483 -.0053193/.1);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#38bdac\]\/50{--tw-gradient-from:oklab(72.378% -.11483 -.0053193/.5);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-blue-500\/20{--tw-gradient-from:#3080ff33}@supports (color:color-mix(in lab,red,red)){.from-blue-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.from-blue-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-cyan-500\/20{--tw-gradient-from:#00b7d733}@supports (color:color-mix(in lab,red,red)){.from-cyan-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.from-cyan-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-green-500\/20{--tw-gradient-from:#00c75833}@supports (color:color-mix(in lab,red,red)){.from-green-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.from-green-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-purple-500\/20{--tw-gradient-from:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.from-purple-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.from-purple-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-yellow-500\/20{--tw-gradient-from:#edb20033}@supports (color:color-mix(in lab,red,red)){.from-yellow-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.from-yellow-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.via-\[\#38bdac\]\/30{--tw-gradient-via:oklab(72.378% -.11483 -.0053193/.3);--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-\[\#0f2137\]{--tw-gradient-to:#0f2137;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-\[\#20B2AA\]{--tw-gradient-to:#20b2aa;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-\[\#38bdac\]{--tw-gradient-to:#38bdac;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-amber-500\/20{--tw-gradient-to:#f99c0033}@supports (color:color-mix(in lab,red,red)){.to-amber-500\/20{--tw-gradient-to:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.to-amber-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-cyan-500\/5{--tw-gradient-to:#00b7d70d}@supports (color:color-mix(in lab,red,red)){.to-cyan-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-cyan-500)5%,transparent)}}.to-cyan-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-green-500\/5{--tw-gradient-to:#00c7580d}@supports (color:color-mix(in lab,red,red)){.to-green-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-green-500)5%,transparent)}}.to-green-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-purple-500\/5{--tw-gradient-to:#ac4bff0d}@supports (color:color-mix(in lab,red,red)){.to-purple-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-purple-500)5%,transparent)}}.to-purple-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-yellow-500\/5{--tw-gradient-to:#edb2000d}@supports (color:color-mix(in lab,red,red)){.to-yellow-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-yellow-500)5%,transparent)}}.to-yellow-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.bg-repeat{background-repeat:repeat}.mask-no-clip{-webkit-mask-clip:no-clip;mask-clip:no-clip}.mask-repeat{-webkit-mask-repeat:repeat;mask-repeat:repeat}.fill-amber-400{fill:var(--color-amber-400)}.fill-current{fill:currentColor}.object-cover{object-fit:cover}.p-0{padding:calc(var(--spacing)*0)}.p-0\.5{padding:calc(var(--spacing)*.5)}.p-1{padding:calc(var(--spacing)*1)}.p-1\.5{padding:calc(var(--spacing)*1.5)}.p-2{padding:calc(var(--spacing)*2)}.p-2\.5{padding:calc(var(--spacing)*2.5)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.px-0{padding-inline:calc(var(--spacing)*0)}.px-0\.5{padding-inline:calc(var(--spacing)*.5)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-2\.5{padding-inline:calc(var(--spacing)*2.5)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-0{padding-block:calc(var(--spacing)*0)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-5{padding-block:calc(var(--spacing)*5)}.py-6{padding-block:calc(var(--spacing)*6)}.py-8{padding-block:calc(var(--spacing)*8)}.py-10{padding-block:calc(var(--spacing)*10)}.py-12{padding-block:calc(var(--spacing)*12)}.py-14{padding-block:calc(var(--spacing)*14)}.py-16{padding-block:calc(var(--spacing)*16)}.py-20{padding-block:calc(var(--spacing)*20)}.pt-0{padding-top:calc(var(--spacing)*0)}.pt-1{padding-top:calc(var(--spacing)*1)}.pt-1\.5{padding-top:calc(var(--spacing)*1.5)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-4{padding-top:calc(var(--spacing)*4)}.pt-5{padding-top:calc(var(--spacing)*5)}.pt-6{padding-top:calc(var(--spacing)*6)}.pr-0\.5{padding-right:calc(var(--spacing)*.5)}.pr-1{padding-right:calc(var(--spacing)*1)}.pr-2{padding-right:calc(var(--spacing)*2)}.pr-4{padding-right:calc(var(--spacing)*4)}.pb-0\.5{padding-bottom:calc(var(--spacing)*.5)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-3{padding-bottom:calc(var(--spacing)*3)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pl-1{padding-left:calc(var(--spacing)*1)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-4{padding-left:calc(var(--spacing)*4)}.pl-6{padding-left:calc(var(--spacing)*6)}.pl-8{padding-left:calc(var(--spacing)*8)}.pl-9{padding-left:calc(var(--spacing)*9)}.pl-10{padding-left:calc(var(--spacing)*10)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-bottom{vertical-align:bottom}.align-middle{vertical-align:middle}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Microsoft YaHei,sans-serif}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-6{--tw-leading:calc(var(--spacing)*6);line-height:calc(var(--spacing)*6)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.text-wrap{text-wrap:wrap}.break-words,.wrap-break-word{overflow-wrap:break-word}.break-all{word-break:break-all}.text-clip{text-overflow:clip}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#00CED1\]{color:#00ced1}.text-\[\#07C160\]{color:#07c160}.text-\[\#07C160\]\/60{color:#07c16099}.text-\[\#07C160\]\/70{color:#07c160b3}.text-\[\#07C160\]\/80{color:#07c160cc}.text-\[\#26A17B\]{color:#26a17b}.text-\[\#38bdac\]{color:#38bdac}.text-\[\#38bdac\]\/20{color:#38bdac33}.text-\[\#38bdac\]\/30{color:#38bdac4d}.text-\[\#38bdac\]\/40{color:#38bdac66}.text-\[\#38bdac\]\/90{color:#38bdace6}.text-\[\#38bdac\]\/95{color:#38bdacf2}.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-200\/95{color:#fee685f2}@supports (color:color-mix(in lab,red,red)){.text-amber-200\/95{color:color-mix(in oklab,var(--color-amber-200)95%,transparent)}}.text-amber-300{color:var(--color-amber-300)}.text-amber-300\/80{color:#ffd236cc}@supports (color:color-mix(in lab,red,red)){.text-amber-300\/80{color:color-mix(in oklab,var(--color-amber-300)80%,transparent)}}.text-amber-400{color:var(--color-amber-400)}.text-amber-400\/30{color:#fcbb004d}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/30{color:color-mix(in oklab,var(--color-amber-400)30%,transparent)}}.text-amber-400\/80{color:#fcbb00cc}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/80{color:color-mix(in oklab,var(--color-amber-400)80%,transparent)}}.text-amber-400\/90{color:#fcbb00e6}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/90{color:color-mix(in oklab,var(--color-amber-400)90%,transparent)}}.text-amber-500\/80{color:#f99c00cc}@supports (color:color-mix(in lab,red,red)){.text-amber-500\/80{color:color-mix(in oklab,var(--color-amber-500)80%,transparent)}}.text-black{color:var(--color-black)}.text-blue-300{color:var(--color-blue-300)}.text-blue-300\/60{color:#90c5ff99}@supports (color:color-mix(in lab,red,red)){.text-blue-300\/60{color:color-mix(in oklab,var(--color-blue-300)60%,transparent)}}.text-blue-300\/80{color:#90c5ffcc}@supports (color:color-mix(in lab,red,red)){.text-blue-300\/80{color:color-mix(in oklab,var(--color-blue-300)80%,transparent)}}.text-blue-400{color:var(--color-blue-400)}.text-blue-400\/60{color:#54a2ff99}@supports (color:color-mix(in lab,red,red)){.text-blue-400\/60{color:color-mix(in oklab,var(--color-blue-400)60%,transparent)}}.text-cyan-200{color:var(--color-cyan-200)}.text-cyan-300{color:var(--color-cyan-300)}.text-cyan-300\/90{color:#53eafde6}@supports (color:color-mix(in lab,red,red)){.text-cyan-300\/90{color:color-mix(in oklab,var(--color-cyan-300)90%,transparent)}}.text-cyan-400{color:var(--color-cyan-400)}.text-emerald-300{color:var(--color-emerald-300)}.text-emerald-400{color:var(--color-emerald-400)}.text-emerald-400\/90{color:#00d294e6}@supports (color:color-mix(in lab,red,red)){.text-emerald-400\/90{color:color-mix(in oklab,var(--color-emerald-400)90%,transparent)}}.text-gray-200{color:var(--color-gray-200)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-green-300{color:var(--color-green-300)}.text-green-400{color:var(--color-green-400)}.text-green-400\/90{color:#05df72e6}@supports (color:color-mix(in lab,red,red)){.text-green-400\/90{color:color-mix(in oklab,var(--color-green-400)90%,transparent)}}.text-green-500{color:var(--color-green-500)}.text-orange-300{color:var(--color-orange-300)}.text-orange-300\/60{color:#ffb96d99}@supports (color:color-mix(in lab,red,red)){.text-orange-300\/60{color:color-mix(in oklab,var(--color-orange-300)60%,transparent)}}.text-orange-400{color:var(--color-orange-400)}.text-orange-400\/25{color:#ff8b1a40}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/25{color:color-mix(in oklab,var(--color-orange-400)25%,transparent)}}.text-orange-400\/60{color:#ff8b1a99}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/60{color:color-mix(in oklab,var(--color-orange-400)60%,transparent)}}.text-orange-400\/70{color:#ff8b1ab3}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/70{color:color-mix(in oklab,var(--color-orange-400)70%,transparent)}}.text-orange-400\/80{color:#ff8b1acc}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/80{color:color-mix(in oklab,var(--color-orange-400)80%,transparent)}}.text-purple-300{color:var(--color-purple-300)}.text-purple-300\/90{color:#d9b3ffe6}@supports (color:color-mix(in lab,red,red)){.text-purple-300\/90{color:color-mix(in oklab,var(--color-purple-300)90%,transparent)}}.text-purple-400{color:var(--color-purple-400)}.text-red-100{color:var(--color-red-100)}.text-red-200{color:var(--color-red-200)}.text-red-300{color:var(--color-red-300)}.text-red-300\/70{color:#ffa3a3b3}@supports (color:color-mix(in lab,red,red)){.text-red-300\/70{color:color-mix(in oklab,var(--color-red-300)70%,transparent)}}.text-red-400{color:var(--color-red-400)}.text-rose-400{color:var(--color-rose-400)}.text-sky-300{color:var(--color-sky-300)}.text-sky-300\/90{color:#77d4ffe6}@supports (color:color-mix(in lab,red,red)){.text-sky-300\/90{color:color-mix(in oklab,var(--color-sky-300)90%,transparent)}}.text-violet-300{color:var(--color-violet-300)}.text-white{color:var(--color-white)}.text-white\/40{color:#fff6}@supports (color:color-mix(in lab,red,red)){.text-white\/40{color:color-mix(in oklab,var(--color-white)40%,transparent)}}.text-white\/60{color:#fff9}@supports (color:color-mix(in lab,red,red)){.text-white\/60{color:color-mix(in oklab,var(--color-white)60%,transparent)}}.text-white\/70{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.text-white\/70{color:color-mix(in oklab,var(--color-white)70%,transparent)}}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.text-white\/80{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.text-yellow-300{color:var(--color-yellow-300)}.text-yellow-400{color:var(--color-yellow-400)}.text-yellow-400\/60{color:#fac80099}@supports (color:color-mix(in lab,red,red)){.text-yellow-400\/60{color:color-mix(in oklab,var(--color-yellow-400)60%,transparent)}}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.italic\!{font-style:italic!important}.not-italic{font-style:normal}.diagonal-fractions{--tw-numeric-fraction:diagonal-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.stacked-fractions{--tw-numeric-fraction:stacked-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.normal-nums{font-variant-numeric:normal}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.overline{text-decoration-line:overline}.underline{text-decoration-line:underline}.underline\!{text-decoration-line:underline!important}.decoration-dotted{text-decoration-style:dotted}.underline-offset-4{text-underline-offset:4px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.subpixel-antialiased{-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto}.accent-\[\#38bdac\]{accent-color:#38bdac}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-55{opacity:.55}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-none{--tw-shadow:0 0 #0000;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)}.placeholder\:text-gray-600::placeholder{color:var(--color-gray-600)}.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-\[\#0f2137\]\/90:hover{background-color:#0f2137e6}.hover\:bg-\[\#1a3050\]:hover{background-color:#1a3050}.hover\:bg-\[\#2aa896\]:hover{background-color:#2aa896}.hover\:bg-\[\#2da396\]:hover{background-color:#2da396}.hover\:bg-\[\#06AD51\]:hover{background-color:#06ad51}.hover\:bg-\[\#07C160\]\/10:hover{background-color:#07c1601a}.hover\:bg-\[\#20B2AA\]:hover{background-color:#20b2aa}.hover\:bg-\[\#38bdac\]\/10:hover{background-color:#38bdac1a}.hover\:bg-\[\#38bdac\]\/20:hover{background-color:#38bdac33}.hover\:bg-\[\#162840\]:hover{background-color:#162840}.hover\:bg-\[\#162840\]\/30:hover{background-color:#1628404d}.hover\:bg-\[\#162840\]\/50:hover{background-color:#16284080}.hover\:bg-amber-500\/10:hover{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/10:hover{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.hover\:bg-amber-500\/20:hover{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/20:hover{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.hover\:bg-amber-600:hover{background-color:var(--color-amber-600)}.hover\:bg-blue-400\/10:hover{background-color:#54a2ff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-400\/10:hover{background-color:color-mix(in oklab,var(--color-blue-400)10%,transparent)}}.hover\:bg-blue-500\/20:hover{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-500\/20:hover{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.hover\:bg-blue-600:hover{background-color:var(--color-blue-600)}.hover\:bg-cyan-500\/10:hover{background-color:#00b7d71a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-cyan-500\/10:hover{background-color:color-mix(in oklab,var(--color-cyan-500)10%,transparent)}}.hover\:bg-emerald-500:hover{background-color:var(--color-emerald-500)}.hover\:bg-emerald-500\/15:hover{background-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.hover\:bg-emerald-500\/15:hover{background-color:color-mix(in oklab,var(--color-emerald-500)15%,transparent)}}.hover\:bg-emerald-500\/20:hover{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-emerald-500\/20:hover{background-color:color-mix(in oklab,var(--color-emerald-500)20%,transparent)}}.hover\:bg-gray-500:hover{background-color:var(--color-gray-500)}.hover\:bg-gray-500\/20:hover{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-500\/20:hover{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.hover\:bg-gray-700:hover{background-color:var(--color-gray-700)}.hover\:bg-gray-700\/40:hover{background-color:#36415366}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-700\/40:hover{background-color:color-mix(in oklab,var(--color-gray-700)40%,transparent)}}.hover\:bg-gray-700\/50:hover{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-700\/50:hover{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.hover\:bg-gray-800:hover{background-color:var(--color-gray-800)}.hover\:bg-green-500\/20:hover{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.hover\:bg-green-500\/20:hover{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.hover\:bg-green-700:hover{background-color:var(--color-green-700)}.hover\:bg-orange-500\/10:hover{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/10:hover{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.hover\:bg-orange-500\/20:hover{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/20:hover{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.hover\:bg-orange-600:hover{background-color:var(--color-orange-600)}.hover\:bg-purple-500\/10:hover{background-color:#ac4bff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/10:hover{background-color:color-mix(in oklab,var(--color-purple-500)10%,transparent)}}.hover\:bg-purple-500\/20:hover{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/20:hover{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.hover\:bg-red-500\/20:hover{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/20:hover{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.hover\:bg-red-700:hover{background-color:var(--color-red-700)}.hover\:bg-red-800\/50:hover{background-color:#9f071280}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-800\/50:hover{background-color:color-mix(in oklab,var(--color-red-800)50%,transparent)}}.hover\:bg-white\/5:hover{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/5:hover{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.hover\:bg-white\/10:hover{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/10:hover{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.hover\:bg-white\/20:hover{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/20:hover{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.hover\:bg-yellow-500\/20:hover{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-500\/20:hover{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.hover\:bg-yellow-500\/30:hover{background-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-500\/30:hover{background-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.hover\:text-\[\#2da396\]:hover{color:#2da396}.hover\:text-\[\#5ee0d1\]:hover{color:#5ee0d1}.hover\:text-\[\#5fe0cd\]:hover{color:#5fe0cd}.hover\:text-\[\#38bdac\]:hover{color:#38bdac}.hover\:text-amber-200:hover{color:var(--color-amber-200)}.hover\:text-amber-300:hover{color:var(--color-amber-300)}.hover\:text-amber-400:hover{color:var(--color-amber-400)}.hover\:text-amber-400\/90:hover{color:#fcbb00e6}@supports (color:color-mix(in lab,red,red)){.hover\:text-amber-400\/90:hover{color:color-mix(in oklab,var(--color-amber-400)90%,transparent)}}.hover\:text-blue-300:hover{color:var(--color-blue-300)}.hover\:text-blue-400:hover{color:var(--color-blue-400)}.hover\:text-gray-200:hover{color:var(--color-gray-200)}.hover\:text-gray-300:hover{color:var(--color-gray-300)}.hover\:text-gray-400:hover{color:var(--color-gray-400)}.hover\:text-green-300:hover{color:var(--color-green-300)}.hover\:text-green-400:hover{color:var(--color-green-400)}.hover\:text-orange-300:hover{color:var(--color-orange-300)}.hover\:text-orange-400:hover{color:var(--color-orange-400)}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:text-sky-200:hover{color:var(--color-sky-200)}.hover\:text-white:hover{color:var(--color-white)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-80:hover{opacity:.8}.hover\:opacity-100:hover{opacity:1}.hover\:ring-\[\#38bdac\]\/60:hover{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.6)}}.focus\:border-\[\#38bdac\]:focus{border-color:#38bdac}.focus\:border-orange-500\/50:focus{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.focus\:border-orange-500\/50:focus{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.focus\:bg-\[\#1a3a4a\]:focus{background-color:#1a3a4a}.focus\:bg-\[\#38bdac\]\/20:focus{background-color:#38bdac33}.focus\:text-white:focus{color:var(--color-white)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-\[\#38bdac\]:focus{--tw-ring-color:#38bdac}.focus\:ring-amber-400:focus{--tw-ring-color:var(--color-amber-400)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:ring-0:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[3px\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[\#38bdac\]:focus-visible{--tw-ring-color:#38bdac}.focus-visible\:ring-\[\#38bdac\]\/50:focus-visible{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.5)}.focus-visible\:ring-amber-600\/50:focus-visible{--tw-ring-color:#dd740080}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-amber-600\/50:focus-visible{--tw-ring-color:color-mix(in oklab,var(--color-amber-600)50%,transparent)}}.focus-visible\:ring-red-500:focus-visible{--tw-ring-color:var(--color-red-500)}.focus-visible\:ring-offset-0:focus-visible{--tw-ring-offset-width:0px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus-visible\:ring-offset-\[\#0a1628\]:focus-visible{--tw-ring-offset-color:#0a1628}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.has-\[\>svg\]\:px-2\.5:has(>svg){padding-inline:calc(var(--spacing)*2.5)}.has-\[\>svg\]\:px-3:has(>svg){padding-inline:calc(var(--spacing)*3)}.has-\[\>svg\]\:px-4:has(>svg){padding-inline:calc(var(--spacing)*4)}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:calc(var(--spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=active\]\:bg-\[\#07C160\]\/20[data-state=active]{background-color:#07c16033}.data-\[state\=active\]\:bg-\[\#26A17B\]\/20[data-state=active]{background-color:#26a17b33}.data-\[state\=active\]\:bg-\[\#38bdac\]\/20[data-state=active]{background-color:#38bdac33}.data-\[state\=active\]\:bg-\[\#1677FF\]\/20[data-state=active]{background-color:#1677ff33}.data-\[state\=active\]\:bg-\[\#003087\]\/20[data-state=active]{background-color:#00308733}.data-\[state\=active\]\:bg-amber-500\/20[data-state=active]{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.data-\[state\=active\]\:bg-amber-500\/20[data-state=active]{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.data-\[state\=active\]\:bg-purple-500\/20[data-state=active]{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.data-\[state\=active\]\:bg-purple-500\/20[data-state=active]{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.data-\[state\=active\]\:font-medium[data-state=active]{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.data-\[state\=active\]\:text-\[\#07C160\][data-state=active]{color:#07c160}.data-\[state\=active\]\:text-\[\#26A17B\][data-state=active]{color:#26a17b}.data-\[state\=active\]\:text-\[\#38bdac\][data-state=active]{color:#38bdac}.data-\[state\=active\]\:text-\[\#169BD7\][data-state=active]{color:#169bd7}.data-\[state\=active\]\:text-\[\#1677FF\][data-state=active]{color:#1677ff}.data-\[state\=active\]\:text-amber-400[data-state=active]{color:var(--color-amber-400)}.data-\[state\=active\]\:text-purple-400[data-state=active]{color:var(--color-purple-400)}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x:calc(var(--spacing)*4);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=checked\]\:bg-\[\#38bdac\][data-state=checked]{background-color:#38bdac}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=unchecked\]\:bg-gray-600[data-state=unchecked]{background-color:var(--color-gray-600)}@media(min-width:40rem){.sm\:col-span-2{grid-column:span 2/span 2}.sm\:w-\[220px\]{width:220px}.sm\:max-w-\[600px\]{max-width:600px}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:gap-2{gap:calc(var(--spacing)*2)}.sm\:p-4{padding:calc(var(--spacing)*4)}.sm\:p-5{padding:calc(var(--spacing)*5)}.sm\:text-left{text-align:left}}@media(min-width:48rem){.md\:col-span-2{grid-column:span 2/span 2}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@media(min-width:64rem){.lg\:block{display:block}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}@media(min-width:80rem){.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.\[\&_tr\]\:border-b tr{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-style:var(--tw-border-style);border-width:0}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:calc(var(--spacing)*0)}.\[\&\>span\]\:line-clamp-1>span{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}}:root{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20% .02 240);--card-foreground:oklch(98.5% 0 0);--popover:oklch(20% .02 240);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(65% .15 180);--primary-foreground:oklch(20% 0 0);--secondary:oklch(27% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(27% 0 0);--muted-foreground:oklch(65% 0 0);--accent:oklch(27% 0 0);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(55% .2 25);--destructive-foreground:oklch(98.5% 0 0);--border:oklch(35% 0 0);--input:oklch(35% 0 0);--ring:oklch(65% .15 180);--radius:.625rem}body{font-family:var(--font-sans);color:var(--foreground);background:#0a1628}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-pan-x{syntax:"*";inherits:false}@property --tw-pan-y{syntax:"*";inherits:false}@property --tw-pinch-zoom{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}} diff --git a/soul-admin/dist/assets/index-CXKq85jN.js b/soul-admin/dist/assets/index-CXKq85jN.js deleted file mode 100644 index cf8b7d1d..00000000 --- a/soul-admin/dist/assets/index-CXKq85jN.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 pj(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var sx={exports:{}},wd={},rx={exports:{}},jt={};/** - * @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 Wv;function OT(){if(Wv)return jt;Wv=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,N={};function w(_,U,H){this.props=_,this.context=U,this.refs=N,this.updater=H||y}w.prototype.isReactComponent={},w.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")},w.prototype.forceUpdate=function(_){this.updater.enqueueForceUpdate(this,_,"forceUpdate")};function k(){}k.prototype=w.prototype;function E(_,U,H){this.props=_,this.context=U,this.refs=N,this.updater=H||y}var C=E.prototype=new k;C.constructor=E,v(C,w.prototype),C.isPureReactComponent=!0;var R=Array.isArray,O=Object.prototype.hasOwnProperty,q={current:null},$={key:!0,ref:!0,__self:!0,__source:!0};function V(_,U,H){var K,me={},X=null,le=null;if(U!=null)for(K in U.ref!==void 0&&(le=U.ref),U.key!==void 0&&(X=""+U.key),U)O.call(U,K)&&!$.hasOwnProperty(K)&&(me[K]=U[K]);var de=arguments.length-2;if(de===1)me.children=H;else if(1>>1,U=P[_];if(0>>1;_a(me,G))Xa(le,me)?(P[_]=le,P[X]=G,_=X):(P[_]=me,P[K]=G,_=K);else if(Xa(le,G))P[_]=le,P[X]=G,_=X;else break e}}return oe}function a(P,oe){var G=P.sortIndex-oe.sortIndex;return G!==0?G:P.id-oe.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,N=!1,w=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(P){for(var oe=n(h);oe!==null;){if(oe.callback===null)r(h);else if(oe.startTime<=P)r(h),oe.sortIndex=oe.expirationTime,e(u,oe);else break;oe=n(h)}}function R(P){if(N=!1,C(P),!v)if(n(u)!==null)v=!0,F(O);else{var oe=n(h);oe!==null&&D(R,oe.startTime-P)}}function O(P,oe){v=!1,N&&(N=!1,k(V),V=-1),y=!0;var G=x;try{for(C(oe),m=n(u);m!==null&&(!(m.expirationTime>oe)||P&&!Q());){var _=m.callback;if(typeof _=="function"){m.callback=null,x=m.priorityLevel;var U=_(m.expirationTime<=oe);oe=t.unstable_now(),typeof U=="function"?m.callback=U:m===n(u)&&r(u),C(oe)}else r(u);m=n(u)}if(m!==null)var H=!0;else{var K=n(h);K!==null&&D(R,K.startTime-oe),H=!1}return H}finally{m=null,x=G,y=!1}}var q=!1,$=null,V=-1,I=5,te=-1;function Q(){return!(t.unstable_now()-teP||125_?(P.sortIndex=G,e(h,P),n(u)===null&&P===n(h)&&(N?(k(V),V=-1):N=!0,D(R,G-_))):(P.sortIndex=U,e(u,P),v||y||(v=!0,F(O))),P},t.unstable_shouldYield=Q,t.unstable_wrapCallback=function(P){var oe=x;return function(){var G=x;x=oe;try{return P.apply(this,arguments)}finally{x=G}}}})(ox)),ox}var Qv;function zT(){return Qv||(Qv=1,ix.exports=_T()),ix.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 Yv;function $T(){if(Yv)return er;Yv=1;var t=du(),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 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 N(l,d,p,g,j,S,M){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=M}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){w[l]=new N(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var d=l[0];w[d]=new N(d,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){w[l]=new N(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){w[l]=new N(l,2,!1,l,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(l){w[l]=new N(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){w[l]=new N(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){w[l]=new N(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){w[l]=new N(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){w[l]=new N(l,5,!1,l.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function E(l){return l[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(l){var d=l.replace(k,E);w[d]=new N(d,1,!1,l,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(l){var d=l.replace(k,E);w[d]=new N(d,1,!1,l,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(l){var d=l.replace(k,E);w[d]=new N(d,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){w[l]=new N(l,1,!1,l.toLowerCase(),null,!1,!1)}),w.xlinkHref=new N("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){w[l]=new N(l,1,!1,l.toLowerCase(),null,!0,!0)});function C(l,d,p,g){var j=w.hasOwnProperty(d)?w[d]:null;(j!==null?j.type!==0:g||!(2W||j[M]!==S[W]){var Z=` -`+j[M].replace(" at new "," at ");return l.displayName&&Z.includes("")&&(Z=Z.replace("",l.displayName)),Z}while(1<=M&&0<=W);break}}}finally{H=!1,Error.prepareStackTrace=p}return(l=l?l.displayName||l.name:"")?U(l):""}function me(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=K(l.type,!1),l;case 11:return l=K(l.type.render,!1),l;case 1:return l=K(l.type,!0),l;default:return""}}function X(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 I:return"Profiler";case V: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 te:return(l._context.displayName||"Context")+".Provider";case B:var d=l.render;return l=l.displayName,l||(l=d.displayName||d.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case J:return d=l.displayName||null,d!==null?d:X(l.type)||"Memo";case F:d=l._payload,l=l._init;try{return X(l(d))}catch{}}return null}function le(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 X(d);case 8:return d===V?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d}return null}function de(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function ve(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function ye(l){var d=ve(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(M){g=""+M,S.call(this,M)}}),Object.defineProperty(l,d,{enumerable:p.enumerable}),{getValue:function(){return g},setValue:function(M){g=""+M},stopTracking:function(){l._valueTracker=null,delete l[d]}}}}function Se(l){l._valueTracker||(l._valueTracker=ye(l))}function Fe(l){if(!l)return!1;var d=l._valueTracker;if(!d)return!0;var p=d.getValue(),g="";return l&&(g=ve(l)?l.checked?"true":"false":l.value),l=g,l!==p?(d.setValue(l),!0):!1}function mt(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 kt(l,d){var p=d.checked;return G({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??l._wrapperState.initialChecked})}function ft(l,d){var p=d.defaultValue==null?"":d.defaultValue,g=d.checked!=null?d.checked:d.defaultChecked;p=de(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 Pt(l,d){Dt(l,d);var p=de(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")?yn(l,d.type,p):d.hasOwnProperty("defaultValue")&&yn(l,d.type,de(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(l.defaultChecked=!!d.defaultChecked)}function Rn(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 yn(l,d,p){(d!=="number"||mt(l.ownerDocument)!==l)&&(p==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+p&&(l.defaultValue=""+p))}var Wt=Array.isArray;function Xt(l,d,p,g){if(l=l.options,d){d={};for(var j=0;j"+d.valueOf().toString()+"",d=ge.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;d.firstChild;)l.appendChild(d.firstChild)}});function Be(l,d){if(d){var p=l.firstChild;if(p&&p===l.lastChild&&p.nodeType===3){p.nodeValue=d;return}}l.textContent=d}var Ze={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},St=["Webkit","ms","Moz","O"];Object.keys(Ze).forEach(function(l){St.forEach(function(d){d=d+l.charAt(0).toUpperCase()+l.substring(1),Ze[d]=Ze[l]})});function vt(l,d,p){return d==null||typeof d=="boolean"||d===""?"":p||typeof d!="number"||d===0||Ze.hasOwnProperty(l)&&Ze[l]?(""+d).trim():d+"px"}function L(l,d){l=l.style;for(var p in d)if(d.hasOwnProperty(p)){var g=p.indexOf("--")===0,j=vt(p,d[p],g);p==="float"&&(p="cssFloat"),g?l.setProperty(p,j):l[p]=j}}var Ie=G({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 xt(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 pt=null;function at(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var At=null,Kt=null,en=null;function ls(l){if(l=od(l)){if(typeof At!="function")throw Error(n(280));var d=l.stateNode;d&&(d=Eu(d),At(l.stateNode,l.type,d))}}function Ws(l){Kt?en?en.push(l):en=[l]:Kt=l}function Fr(){if(Kt){var l=Kt,d=en;if(en=Kt=null,ls(l),d)for(l=0;l>>=0,l===0?32:31-(Ll(l)/Mi|0)|0}var Ua=64,Ai=4194304;function Nr(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 Wa(l,d){var p=l.pendingLanes;if(p===0)return 0;var g=0,j=l.suspendedLanes,S=l.pingedLanes,M=p&268435455;if(M!==0){var W=M&~j;W!==0?g=Nr(W):(S&=M,S!==0&&(g=Nr(S)))}else M=p&~j,M!==0?g=Nr(M):S!==0&&(g=Nr(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 ua(l,d,p){l.pendingLanes|=d,d!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,d=31-ws(d),l[d]=p}function Ii(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=Xc),zy=" ",$y=!1;function Fy(l,d){switch(l){case"keyup":return E4.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function By(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var $l=!1;function A4(l,d){switch(l){case"compositionend":return By(d);case"keypress":return d.which!==32?null:($y=!0,zy);case"textInput":return l=d.data,l===zy&&$y?null:l;default:return null}}function I4(l,d){if($l)return l==="compositionend"||!_p&&Fy(l,d)?(l=_i(),Ya=Qa=Cr=null,$l=!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=Gy(p)}}function Qy(l,d){return l&&d?l===d?!0:l&&l.nodeType===3?!1:d&&d.nodeType===3?Qy(l,d.parentNode):"contains"in l?l.contains(d):l.compareDocumentPosition?!!(l.compareDocumentPosition(d)&16):!1:!1}function Yy(){for(var l=window,d=mt();d instanceof l.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)l=d.contentWindow;else break;d=mt(l.document)}return d}function Fp(l){var d=l&&l.nodeName&&l.nodeName.toLowerCase();return d&&(d==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||d==="textarea"||l.contentEditable==="true")}function F4(l){var d=Yy(),p=l.focusedElem,g=l.selectionRange;if(d!==p&&p&&p.ownerDocument&&Qy(p.ownerDocument.documentElement,p)){if(g!==null&&Fp(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=Jy(p,S);var M=Jy(p,g);j&&M&&(l.rangeCount!==1||l.anchorNode!==j.node||l.anchorOffset!==j.offset||l.focusNode!==M.node||l.focusOffset!==M.offset)&&(d=d.createRange(),d.setStart(j.node,j.offset),l.removeAllRanges(),S>g?(l.addRange(d),l.extend(M.node,M.offset)):(d.setEnd(M.node,M.offset),l.addRange(d)))}}for(d=[],l=p;l=l.parentNode;)l.nodeType===1&&d.push({element:l,left:l.scrollLeft,top:l.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p=document.documentMode,Fl=null,Bp=null,nd=null,Vp=!1;function Xy(l,d,p){var g=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;Vp||Fl==null||Fl!==mt(g)||(g=Fl,"selectionStart"in g&&Fp(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}),nd&&td(nd,g)||(nd=g,g=Su(Bp,"onSelect"),0Wl||(l.current=em[Wl],em[Wl]=null,Wl--)}function on(l,d){Wl++,em[Wl]=l.current,l.current=d}var Wi={},Ss=Ui(Wi),Js=Ui(!1),Wo=Wi;function Kl(l,d){var p=l.type.contextTypes;if(!p)return Wi;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 Qs(l){return l=l.childContextTypes,l!=null}function Mu(){hn(Js),hn(Ss)}function fb(l,d,p){if(Ss.current!==Wi)throw Error(n(168));on(Ss,d),on(Js,p)}function pb(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,le(l)||"Unknown",j));return G({},p,g)}function Au(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||Wi,Wo=Ss.current,on(Ss,l),on(Js,Js.current),!0}function mb(l,d,p){var g=l.stateNode;if(!g)throw Error(n(169));p?(l=pb(l,d,Wo),g.__reactInternalMemoizedMergedChildContext=l,hn(Js),hn(Ss),on(Ss,l)):hn(Js),on(Js,p)}var ei=null,Iu=!1,tm=!1;function xb(l){ei===null?ei=[l]:ei.push(l)}function X4(l){Iu=!0,xb(l)}function Ki(){if(!tm&&ei!==null){tm=!0;var l=0,d=Tt;try{var p=ei;for(Tt=1;l>=M,j-=M,ti=1<<32-ws(d)+j|p<ut?(ns=rt,rt=null):ns=rt.sibling;var _t=Te(he,rt,fe[ut],Oe);if(_t===null){rt===null&&(rt=ns);break}l&&rt&&_t.alternate===null&&d(he,rt),se=S(_t,se,ut),st===null?Ye=_t:st.sibling=_t,st=_t,rt=ns}if(ut===fe.length)return p(he,rt),mn&&qo(he,ut),Ye;if(rt===null){for(;utut?(ns=rt,rt=null):ns=rt.sibling;var to=Te(he,rt,_t.value,Oe);if(to===null){rt===null&&(rt=ns);break}l&&rt&&to.alternate===null&&d(he,rt),se=S(to,se,ut),st===null?Ye=to:st.sibling=to,st=to,rt=ns}if(_t.done)return p(he,rt),mn&&qo(he,ut),Ye;if(rt===null){for(;!_t.done;ut++,_t=fe.next())_t=Pe(he,_t.value,Oe),_t!==null&&(se=S(_t,se,ut),st===null?Ye=_t:st.sibling=_t,st=_t);return mn&&qo(he,ut),Ye}for(rt=g(he,rt);!_t.done;ut++,_t=fe.next())_t=He(rt,he,ut,_t.value,Oe),_t!==null&&(l&&_t.alternate!==null&&rt.delete(_t.key===null?ut:_t.key),se=S(_t,se,ut),st===null?Ye=_t:st.sibling=_t,st=_t);return l&&rt.forEach(function(PT){return d(he,PT)}),mn&&qo(he,ut),Ye}function Ln(he,se,fe,Oe){if(typeof fe=="object"&&fe!==null&&fe.type===$&&fe.key===null&&(fe=fe.props.children),typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case O:e:{for(var Ye=fe.key,st=se;st!==null;){if(st.key===Ye){if(Ye=fe.type,Ye===$){if(st.tag===7){p(he,st.sibling),se=j(st,fe.props.children),se.return=he,he=se;break e}}else if(st.elementType===Ye||typeof Ye=="object"&&Ye!==null&&Ye.$$typeof===F&&wb(Ye)===st.type){p(he,st.sibling),se=j(st,fe.props),se.ref=ld(he,st,fe),se.return=he,he=se;break e}p(he,st);break}else d(he,st);st=st.sibling}fe.type===$?(se=tl(fe.props.children,he.mode,Oe,fe.key),se.return=he,he=se):(Oe=ah(fe.type,fe.key,fe.props,null,he.mode,Oe),Oe.ref=ld(he,se,fe),Oe.return=he,he=Oe)}return M(he);case q:e:{for(st=fe.key;se!==null;){if(se.key===st)if(se.tag===4&&se.stateNode.containerInfo===fe.containerInfo&&se.stateNode.implementation===fe.implementation){p(he,se.sibling),se=j(se,fe.children||[]),se.return=he,he=se;break e}else{p(he,se);break}else d(he,se);se=se.sibling}se=Xm(fe,he.mode,Oe),se.return=he,he=se}return M(he);case F:return st=fe._init,Ln(he,se,st(fe._payload),Oe)}if(Wt(fe))return Ke(he,se,fe,Oe);if(oe(fe))return Je(he,se,fe,Oe);Lu(he,fe)}return typeof fe=="string"&&fe!==""||typeof fe=="number"?(fe=""+fe,se!==null&&se.tag===6?(p(he,se.sibling),se=j(se,fe),se.return=he,he=se):(p(he,se),se=Ym(fe,he.mode,Oe),se.return=he,he=se),M(he)):p(he,se)}return Ln}var Ql=jb(!0),kb=jb(!1),Du=Ui(null),_u=null,Yl=null,om=null;function lm(){om=Yl=_u=null}function cm(l){var d=Du.current;hn(Du),l._currentValue=d}function dm(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 Xl(l,d){_u=l,om=Yl=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&d)!==0&&(Ys=!0),l.firstContext=null)}function Ar(l){var d=l._currentValue;if(om!==l)if(l={context:l,memoizedValue:d,next:null},Yl===null){if(_u===null)throw Error(n(308));Yl=l,_u.dependencies={lanes:0,firstContext:l}}else Yl=Yl.next=l;return d}var Go=null;function um(l){Go===null?Go=[l]:Go.push(l)}function Sb(l,d,p,g){var j=d.interleaved;return j===null?(p.next=p,um(d)):(p.next=j.next,j.next=p),d.interleaved=p,si(l,g)}function si(l,d){l.lanes|=d;var p=l.alternate;for(p!==null&&(p.lanes|=d),p=l,l=l.return;l!==null;)l.childLanes|=d,p=l.alternate,p!==null&&(p.childLanes|=d),p=l,l=l.return;return p.tag===3?p.stateNode:null}var qi=!1;function hm(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Cb(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 ri(l,d){return{eventTime:l,lane:d,tag:0,payload:null,callback:null,next:null}}function Gi(l,d,p){var g=l.updateQueue;if(g===null)return null;if(g=g.shared,(Lt&2)!==0){var j=g.pending;return j===null?d.next=d:(d.next=j.next,j.next=d),g.pending=d,si(l,p)}return j=g.interleaved,j===null?(d.next=d,um(g)):(d.next=j.next,j.next=d),g.interleaved=d,si(l,p)}function zu(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,qs(l,p)}}function Tb(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 M={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};S===null?j=S=M:S=S.next=M,p=p.next}while(p!==null);S===null?j=S=d:S=S.next=d}else j=S=d;p={baseState: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 $u(l,d,p,g){var j=l.updateQueue;qi=!1;var S=j.firstBaseUpdate,M=j.lastBaseUpdate,W=j.shared.pending;if(W!==null){j.shared.pending=null;var Z=W,pe=Z.next;Z.next=null,M===null?S=pe:M.next=pe,M=Z;var Ee=l.alternate;Ee!==null&&(Ee=Ee.updateQueue,W=Ee.lastBaseUpdate,W!==M&&(W===null?Ee.firstBaseUpdate=pe:W.next=pe,Ee.lastBaseUpdate=Z))}if(S!==null){var Pe=j.baseState;M=0,Ee=pe=Z=null,W=S;do{var Te=W.lane,He=W.eventTime;if((g&Te)===Te){Ee!==null&&(Ee=Ee.next={eventTime:He,lane:0,tag:W.tag,payload:W.payload,callback:W.callback,next:null});e:{var Ke=l,Je=W;switch(Te=d,He=p,Je.tag){case 1:if(Ke=Je.payload,typeof Ke=="function"){Pe=Ke.call(He,Pe,Te);break e}Pe=Ke;break e;case 3:Ke.flags=Ke.flags&-65537|128;case 0:if(Ke=Je.payload,Te=typeof Ke=="function"?Ke.call(He,Pe,Te):Ke,Te==null)break e;Pe=G({},Pe,Te);break e;case 2:qi=!0}}W.callback!==null&&W.lane!==0&&(l.flags|=64,Te=j.effects,Te===null?j.effects=[W]:Te.push(W))}else He={eventTime:He,lane:Te,tag:W.tag,payload:W.payload,callback:W.callback,next:null},Ee===null?(pe=Ee=He,Z=Pe):Ee=Ee.next=He,M|=Te;if(W=W.next,W===null){if(W=j.shared.pending,W===null)break;Te=W,W=Te.next,Te.next=null,j.lastBaseUpdate=Te,j.shared.pending=null}}while(!0);if(Ee===null&&(Z=Pe),j.baseState=Z,j.firstBaseUpdate=pe,j.lastBaseUpdate=Ee,d=j.shared.interleaved,d!==null){j=d;do M|=j.lane,j=j.next;while(j!==d)}else S===null&&(j.shared.lanes=0);Yo|=M,l.lanes=M,l.memoizedState=Pe}}function Eb(l,d,p){if(l=d.effects,d.effects=null,l!==null)for(d=0;dp?p:4,l(!0);var g=gm.transition;gm.transition={};try{l(!1),d()}finally{Tt=p,gm.transition=g}}function qb(){return Ir().memoizedState}function nT(l,d,p){var g=Xi(l);if(p={lane:g,action:p,hasEagerState:!1,eagerState:null,next:null},Gb(l))Jb(d,p);else if(p=Sb(l,d,p,g),p!==null){var j=Bs();Xr(p,l,g,j),Qb(p,d,g)}}function sT(l,d,p){var g=Xi(l),j={lane:g,action:p,hasEagerState:!1,eagerState:null,next:null};if(Gb(l))Jb(d,j);else{var S=l.alternate;if(l.lanes===0&&(S===null||S.lanes===0)&&(S=d.lastRenderedReducer,S!==null))try{var M=d.lastRenderedState,W=S(M,p);if(j.hasEagerState=!0,j.eagerState=W,qr(W,M)){var Z=d.interleaved;Z===null?(j.next=j,um(d)):(j.next=Z.next,Z.next=j),d.interleaved=j;return}}catch{}finally{}p=Sb(l,d,j,g),p!==null&&(j=Bs(),Xr(p,l,g,j),Qb(p,d,g))}}function Gb(l){var d=l.alternate;return l===jn||d!==null&&d===jn}function Jb(l,d){hd=Vu=!0;var p=l.pending;p===null?d.next=d:(d.next=p.next,p.next=d),l.pending=d}function Qb(l,d,p){if((p&4194240)!==0){var g=d.lanes;g&=l.pendingLanes,p|=g,d.lanes=p,qs(l,p)}}var Wu={readContext:Ar,useCallback:Cs,useContext:Cs,useEffect:Cs,useImperativeHandle:Cs,useInsertionEffect:Cs,useLayoutEffect:Cs,useMemo:Cs,useReducer:Cs,useRef:Cs,useState:Cs,useDebugValue:Cs,useDeferredValue:Cs,useTransition:Cs,useMutableSource:Cs,useSyncExternalStore:Cs,useId:Cs,unstable_isNewReconciler:!1},rT={readContext:Ar,useCallback:function(l,d){return ja().memoizedState=[l,d===void 0?null:d],l},useContext:Ar,useEffect:$b,useImperativeHandle:function(l,d,p){return p=p!=null?p.concat([l]):null,Hu(4194308,4,Vb.bind(null,d,l),p)},useLayoutEffect:function(l,d){return Hu(4194308,4,l,d)},useInsertionEffect:function(l,d){return Hu(4,2,l,d)},useMemo:function(l,d){var p=ja();return d=d===void 0?null:d,l=l(),p.memoizedState=[l,d],l},useReducer:function(l,d,p){var g=ja();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=nT.bind(null,jn,l),[g.memoizedState,l]},useRef:function(l){var d=ja();return l={current:l},d.memoizedState=l},useState:_b,useDebugValue:km,useDeferredValue:function(l){return ja().memoizedState=l},useTransition:function(){var l=_b(!1),d=l[0];return l=tT.bind(null,l[1]),ja().memoizedState=l,[d,l]},useMutableSource:function(){},useSyncExternalStore:function(l,d,p){var g=jn,j=ja();if(mn){if(p===void 0)throw Error(n(407));p=p()}else{if(p=d(),ts===null)throw Error(n(349));(Qo&30)!==0||Pb(g,d,p)}j.memoizedState=p;var S={value:p,getSnapshot:d};return j.queue=S,$b(Ob.bind(null,g,S,l),[l]),g.flags|=2048,md(9,Rb.bind(null,g,S,p,d),void 0,null),p},useId:function(){var l=ja(),d=ts.identifierPrefix;if(mn){var p=ni,g=ti;p=(g&~(1<<32-ws(g)-1)).toString(32)+p,d=":"+d+"R"+p,p=fd++,0<\/script>",l=l.removeChild(l.firstChild)):typeof g.is=="string"?l=M.createElement(p,{is:g.is}):(l=M.createElement(p),p==="select"&&(M=l,g.multiple?M.multiple=!0:g.size&&(M.size=g.size))):l=M.createElementNS(l,p),l[Na]=d,l[id]=g,xv(l,d,!1,!1),d.stateNode=l;e:{switch(M=Rt(p,g),p){case"dialog":un("cancel",l),un("close",l),j=g;break;case"iframe":case"object":case"embed":un("load",l),j=g;break;case"video":case"audio":for(j=0;jsc&&(d.flags|=128,g=!0,xd(S,!1),d.lanes=4194304)}else{if(!g)if(l=Fu(M),l!==null){if(d.flags|=128,g=!0,p=l.updateQueue,p!==null&&(d.updateQueue=p,d.flags|=4),xd(S,!0),S.tail===null&&S.tailMode==="hidden"&&!M.alternate&&!mn)return Ts(d),null}else 2*Ft()-S.renderingStartTime>sc&&p!==1073741824&&(d.flags|=128,g=!0,xd(S,!1),d.lanes=4194304);S.isBackwards?(M.sibling=d.child,d.child=M):(p=S.last,p!==null?p.sibling=M:d.child=M,S.last=M)}return S.tail!==null?(d=S.tail,S.rendering=d,S.tail=d.sibling,S.renderingStartTime=Ft(),d.sibling=null,p=wn.current,on(wn,g?p&1|2:p&1),d):(Ts(d),null);case 22:case 23:return Gm(),g=d.memoizedState!==null,l!==null&&l.memoizedState!==null!==g&&(d.flags|=8192),g&&(d.mode&1)!==0?(hr&1073741824)!==0&&(Ts(d),d.subtreeFlags&6&&(d.flags|=8192)):Ts(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function hT(l,d){switch(sm(d),d.tag){case 1:return Qs(d.type)&&Mu(),l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 3:return Zl(),hn(Js),hn(Ss),xm(),l=d.flags,(l&65536)!==0&&(l&128)===0?(d.flags=l&-65537|128,d):null;case 5:return pm(d),null;case 13:if(hn(wn),l=d.memoizedState,l!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(n(340));Jl()}return l=d.flags,l&65536?(d.flags=l&-65537|128,d):null;case 19:return hn(wn),null;case 4:return Zl(),null;case 10:return cm(d.type._context),null;case 22:case 23:return Gm(),null;case 24:return null;default:return null}}var Ju=!1,Es=!1,fT=typeof WeakSet=="function"?WeakSet:Set,We=null;function tc(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 Dm(l,d,p){try{p()}catch(g){Tn(l,d,g)}}var bv=!1;function pT(l,d){if(Gp=Ga,l=Yy(),Fp(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 M=0,W=-1,Z=-1,pe=0,Ee=0,Pe=l,Te=null;t:for(;;){for(var He;Pe!==p||j!==0&&Pe.nodeType!==3||(W=M+j),Pe!==S||g!==0&&Pe.nodeType!==3||(Z=M+g),Pe.nodeType===3&&(M+=Pe.nodeValue.length),(He=Pe.firstChild)!==null;)Te=Pe,Pe=He;for(;;){if(Pe===l)break t;if(Te===p&&++pe===j&&(W=M),Te===S&&++Ee===g&&(Z=M),(He=Pe.nextSibling)!==null)break;Pe=Te,Te=Pe.parentNode}Pe=He}p=W===-1||Z===-1?null:{start:W,end:Z}}else p=null}p=p||{start:0,end:0}}else p=null;for(Jp={focusedElem:l,selectionRange:p},Ga=!1,We=d;We!==null;)if(d=We,l=d.child,(d.subtreeFlags&1028)!==0&&l!==null)l.return=d,We=l;else for(;We!==null;){d=We;try{var Ke=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(Ke!==null){var Je=Ke.memoizedProps,Ln=Ke.memoizedState,he=d.stateNode,se=he.getSnapshotBeforeUpdate(d.elementType===d.type?Je:Jr(d.type,Je),Ln);he.__reactInternalSnapshotBeforeUpdate=se}break;case 3:var fe=d.stateNode.containerInfo;fe.nodeType===1?fe.textContent="":fe.nodeType===9&&fe.documentElement&&fe.removeChild(fe.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,We=l;break}We=d.return}return Ke=bv,bv=!1,Ke}function gd(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&&Dm(d,p,S)}j=j.next}while(j!==g)}}function Qu(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 _m(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 vv(l){var d=l.alternate;d!==null&&(l.alternate=null,vv(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode,d!==null&&(delete d[Na],delete d[id],delete d[Zp],delete d[Q4],delete d[Y4])),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function Nv(l){return l.tag===5||l.tag===3||l.tag===4}function wv(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||Nv(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 zm(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=Tu));else if(g!==4&&(l=l.child,l!==null))for(zm(l,d,p),l=l.sibling;l!==null;)zm(l,d,p),l=l.sibling}function $m(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($m(l,d,p),l=l.sibling;l!==null;)$m(l,d,p),l=l.sibling}var hs=null,Qr=!1;function Ji(l,d,p){for(p=p.child;p!==null;)jv(l,d,p),p=p.sibling}function jv(l,d,p){if(Ns&&typeof Ns.onCommitFiberUnmount=="function")try{Ns.onCommitFiberUnmount(da,p)}catch{}switch(p.tag){case 5:Es||tc(p,d);case 6:var g=hs,j=Qr;hs=null,Ji(l,d,p),hs=g,Qr=j,hs!==null&&(Qr?(l=hs,p=p.stateNode,l.nodeType===8?l.parentNode.removeChild(p):l.removeChild(p)):hs.removeChild(p.stateNode));break;case 18:hs!==null&&(Qr?(l=hs,p=p.stateNode,l.nodeType===8?Xp(l.parentNode,p):l.nodeType===1&&Xp(l,p),Gs(l)):Xp(hs,p.stateNode));break;case 4:g=hs,j=Qr,hs=p.stateNode.containerInfo,Qr=!0,Ji(l,d,p),hs=g,Qr=j;break;case 0:case 11:case 14:case 15:if(!Es&&(g=p.updateQueue,g!==null&&(g=g.lastEffect,g!==null))){j=g=g.next;do{var S=j,M=S.destroy;S=S.tag,M!==void 0&&((S&2)!==0||(S&4)!==0)&&Dm(p,d,M),j=j.next}while(j!==g)}Ji(l,d,p);break;case 1:if(!Es&&(tc(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)}Ji(l,d,p);break;case 21:Ji(l,d,p);break;case 22:p.mode&1?(Es=(g=Es)||p.memoizedState!==null,Ji(l,d,p),Es=g):Ji(l,d,p);break;default:Ji(l,d,p)}}function kv(l){var d=l.updateQueue;if(d!==null){l.updateQueue=null;var p=l.stateNode;p===null&&(p=l.stateNode=new fT),d.forEach(function(g){var j=jT.bind(null,l,g);p.has(g)||(p.add(g),g.then(j,j))})}}function Yr(l,d){var p=d.deletions;if(p!==null)for(var g=0;gj&&(j=M),g&=~S}if(g=j,g=Ft()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*xT(g/1960))-g,10l?16:l,Yi===null)var g=!1;else{if(l=Yi,Yi=null,th=0,(Lt&6)!==0)throw Error(n(331));var j=Lt;for(Lt|=4,We=l.current;We!==null;){var S=We,M=S.child;if((We.flags&16)!==0){var W=S.deletions;if(W!==null){for(var Z=0;ZFt()-Vm?Zo(l,0):Bm|=p),Zs(l,d)}function _v(l,d){d===0&&((l.mode&1)===0?d=1:(d=Ai,Ai<<=1,(Ai&130023424)===0&&(Ai=4194304)));var p=Bs();l=si(l,d),l!==null&&(ua(l,d,p),Zs(l,p))}function wT(l){var d=l.memoizedState,p=0;d!==null&&(p=d.retryLane),_v(l,p)}function jT(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),_v(l,p)}var zv;zv=function(l,d,p){if(l!==null)if(l.memoizedProps!==d.pendingProps||Js.current)Ys=!0;else{if((l.lanes&p)===0&&(d.flags&128)===0)return Ys=!1,dT(l,d,p);Ys=(l.flags&131072)!==0}else Ys=!1,mn&&(d.flags&1048576)!==0&&gb(d,Ru,d.index);switch(d.lanes=0,d.tag){case 2:var g=d.type;Gu(l,d),l=d.pendingProps;var j=Kl(d,Ss.current);Xl(d,p),j=bm(null,d,g,l,j,p);var S=vm();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,Qs(g)?(S=!0,Au(d)):S=!1,d.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,hm(d),j.updater=Ku,d.stateNode=j,j._reactInternals=d,Cm(d,g,l,p),d=Am(null,d,g,!0,S,p)):(d.tag=0,mn&&S&&nm(d),Fs(null,d,j,p),d=d.child),d;case 16:g=d.elementType;e:{switch(Gu(l,d),l=d.pendingProps,j=g._init,g=j(g._payload),d.type=g,j=d.tag=ST(g),l=Jr(g,l),j){case 0:d=Mm(null,d,g,l,p);break e;case 1:d=dv(null,d,g,l,p);break e;case 11:d=av(null,d,g,l,p);break e;case 14:d=iv(null,d,g,Jr(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:Jr(g,j),Mm(l,d,g,j,p);case 1:return g=d.type,j=d.pendingProps,j=d.elementType===g?j:Jr(g,j),dv(l,d,g,j,p);case 3:e:{if(uv(d),l===null)throw Error(n(387));g=d.pendingProps,S=d.memoizedState,j=S.element,Cb(l,d),$u(d,g,null,p);var M=d.memoizedState;if(g=M.element,S.isDehydrated)if(S={element:g,isDehydrated:!1,cache:M.cache,pendingSuspenseBoundaries:M.pendingSuspenseBoundaries,transitions:M.transitions},d.updateQueue.baseState=S,d.memoizedState=S,d.flags&256){j=ec(Error(n(423)),d),d=hv(l,d,g,p,j);break e}else if(g!==j){j=ec(Error(n(424)),d),d=hv(l,d,g,p,j);break e}else for(ur=Hi(d.stateNode.containerInfo.firstChild),dr=d,mn=!0,Gr=null,p=kb(d,null,g,p),d.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(Jl(),g===j){d=ai(l,d,p);break e}Fs(l,d,g,p)}d=d.child}return d;case 5:return Mb(d),l===null&&am(d),g=d.type,j=d.pendingProps,S=l!==null?l.memoizedProps:null,M=j.children,Qp(g,j)?M=null:S!==null&&Qp(g,S)&&(d.flags|=32),cv(l,d),Fs(l,d,M,p),d.child;case 6:return l===null&&am(d),null;case 13:return fv(l,d,p);case 4:return fm(d,d.stateNode.containerInfo),g=d.pendingProps,l===null?d.child=Ql(d,null,g,p):Fs(l,d,g,p),d.child;case 11:return g=d.type,j=d.pendingProps,j=d.elementType===g?j:Jr(g,j),av(l,d,g,j,p);case 7:return Fs(l,d,d.pendingProps,p),d.child;case 8:return Fs(l,d,d.pendingProps.children,p),d.child;case 12:return Fs(l,d,d.pendingProps.children,p),d.child;case 10:e:{if(g=d.type._context,j=d.pendingProps,S=d.memoizedProps,M=j.value,on(Du,g._currentValue),g._currentValue=M,S!==null)if(qr(S.value,M)){if(S.children===j.children&&!Js.current){d=ai(l,d,p);break e}}else for(S=d.child,S!==null&&(S.return=d);S!==null;){var W=S.dependencies;if(W!==null){M=S.child;for(var Z=W.firstContext;Z!==null;){if(Z.context===g){if(S.tag===1){Z=ri(-1,p&-p),Z.tag=2;var pe=S.updateQueue;if(pe!==null){pe=pe.shared;var Ee=pe.pending;Ee===null?Z.next=Z:(Z.next=Ee.next,Ee.next=Z),pe.pending=Z}}S.lanes|=p,Z=S.alternate,Z!==null&&(Z.lanes|=p),dm(S.return,p,d),W.lanes|=p;break}Z=Z.next}}else if(S.tag===10)M=S.type===d.type?null:S.child;else if(S.tag===18){if(M=S.return,M===null)throw Error(n(341));M.lanes|=p,W=M.alternate,W!==null&&(W.lanes|=p),dm(M,p,d),M=S.sibling}else M=S.child;if(M!==null)M.return=S;else for(M=S;M!==null;){if(M===d){M=null;break}if(S=M.sibling,S!==null){S.return=M.return,M=S;break}M=M.return}S=M}Fs(l,d,j.children,p),d=d.child}return d;case 9:return j=d.type,g=d.pendingProps.children,Xl(d,p),j=Ar(j),g=g(j),d.flags|=1,Fs(l,d,g,p),d.child;case 14:return g=d.type,j=Jr(g,d.pendingProps),j=Jr(g.type,j),iv(l,d,g,j,p);case 15:return ov(l,d,d.type,d.pendingProps,p);case 17:return g=d.type,j=d.pendingProps,j=d.elementType===g?j:Jr(g,j),Gu(l,d),d.tag=1,Qs(g)?(l=!0,Au(d)):l=!1,Xl(d,p),Xb(d,g,j),Cm(d,g,j,p),Am(null,d,g,!0,l,p);case 19:return mv(l,d,p);case 22:return lv(l,d,p)}throw Error(n(156,d.tag))};function $v(l,d){return Ct(l,d)}function kT(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 Rr(l,d,p,g){return new kT(l,d,p,g)}function Qm(l){return l=l.prototype,!(!l||!l.isReactComponent)}function ST(l){if(typeof l=="function")return Qm(l)?1:0;if(l!=null){if(l=l.$$typeof,l===B)return 11;if(l===J)return 14}return 2}function eo(l,d){var p=l.alternate;return p===null?(p=Rr(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 ah(l,d,p,g,j,S){var M=2;if(g=l,typeof l=="function")Qm(l)&&(M=1);else if(typeof l=="string")M=5;else e:switch(l){case $:return tl(p.children,j,S,d);case V:M=8,j|=8;break;case I:return l=Rr(12,p,d,j|2),l.elementType=I,l.lanes=S,l;case re:return l=Rr(13,p,d,j),l.elementType=re,l.lanes=S,l;case ae:return l=Rr(19,p,d,j),l.elementType=ae,l.lanes=S,l;case D:return ih(p,j,S,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case te:M=10;break e;case Q:M=9;break e;case B:M=11;break e;case J:M=14;break e;case F:M=16,g=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return d=Rr(M,p,d,j),d.elementType=l,d.type=g,d.lanes=S,d}function tl(l,d,p,g){return l=Rr(7,l,g,d),l.lanes=p,l}function ih(l,d,p,g){return l=Rr(22,l,g,d),l.elementType=D,l.lanes=p,l.stateNode={isHidden:!1},l}function Ym(l,d,p){return l=Rr(6,l,null,d),l.lanes=p,l}function Xm(l,d,p){return d=Rr(4,l.children!==null?l.children:[],l.key,d),d.lanes=p,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function CT(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=zs(0),this.expirationTimes=zs(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zs(0),this.identifierPrefix=g,this.onRecoverableError=j,this.mutableSourceEagerHydrationData=null}function Zm(l,d,p,g,j,S,M,W,Z){return l=new CT(l,d,p,W,Z),d===1?(d=1,S===!0&&(d|=8)):d=0,S=Rr(3,null,null,d),l.current=S,S.stateNode=l,S.memoizedState={element:g,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},hm(S),l}function TT(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(),ax.exports=$T(),ax.exports}var Zv;function FT(){if(Zv)return fh;Zv=1;var t=mj();return fh.createRoot=t.createRoot,fh.hydrateRoot=t.hydrateRoot,fh}var BT=FT(),uu=mj();const xj=pj(uu);/** - * @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 Gd(){return Gd=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function g0(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function HT(){return Math.random().toString(36).substr(2,8)}function t1(t,e){return{usr:t.state,key:t.key,idx:e}}function ig(t,e,n,r){return n===void 0&&(n=null),Gd({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Fc(e):e,{state:n,key:e&&e.key||r||HT()})}function Xh(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 Fc(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 UT(t,e,n,r){r===void 0&&(r={});let{window:a=document.defaultView,v5Compat:i=!1}=r,o=a.history,c=po.Pop,u=null,h=f();h==null&&(h=0,o.replaceState(Gd({},o.state,{idx:h}),""));function f(){return(o.state||{idx:null}).idx}function m(){c=po.Pop;let w=f(),k=w==null?null:w-h;h=w,u&&u({action:c,location:N.location,delta:k})}function x(w,k){c=po.Push;let E=ig(N.location,w,k);h=f()+1;let C=t1(E,h),R=N.createHref(E);try{o.pushState(C,"",R)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;a.location.assign(R)}i&&u&&u({action:c,location:N.location,delta:1})}function y(w,k){c=po.Replace;let E=ig(N.location,w,k);h=f();let C=t1(E,h),R=N.createHref(E);o.replaceState(C,"",R),i&&u&&u({action:c,location:N.location,delta:0})}function v(w){let k=a.location.origin!=="null"?a.location.origin:a.location.href,E=typeof w=="string"?w:Xh(w);return E=E.replace(/ $/,"%20"),zn(k,"No window.location.(origin|href) available to create URL for href: "+E),new URL(E,k)}let N={get action(){return c},get location(){return t(a,o)},listen(w){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(e1,m),u=w,()=>{a.removeEventListener(e1,m),u=null}},createHref(w){return e(a,w)},createURL:v,encodeLocation(w){let k=v(w);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:x,replace:y,go(w){return o.go(w)}};return N}var n1;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(n1||(n1={}));function WT(t,e,n){return n===void 0&&(n="/"),KT(t,e,n)}function KT(t,e,n,r){let a=typeof e=="string"?Fc(e):e,i=y0(a.pathname||"/",n);if(i==null)return null;let o=gj(t);qT(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=bo([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+'".')),gj(i.children,e,f,h)),!(i.path==null&&!i.index)&&e.push({path:h,score:eE(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 yj(i.path))a(i,o,u)}),e}function yj(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=yj(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 qT(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:tE(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const GT=/^:[\w-]+$/,JT=3,QT=2,YT=1,XT=10,ZT=-2,s1=t=>t==="*";function eE(t,e){let n=t.split("/"),r=n.length;return n.some(s1)&&(r+=ZT),e&&(r+=QT),n.filter(a=>!s1(a)).reduce((a,i)=>a+(GT.test(i)?JT:i===""?YT:XT),r)}function tE(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 nE(t,e,n){let{routesMeta:r}=t,a={},i="/",o=[];for(let c=0;c{let{paramName:x,isOptional:y}=f;if(x==="*"){let N=c[m]||"";o=i.slice(0,i.length-N.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 rE(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),g0(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 aE(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return g0(!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 y0(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 iE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,oE=t=>iE.test(t);function lE(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:a=""}=typeof t=="string"?Fc(t):t,i;if(n)if(oE(n))i=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),g0(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=r1(n.substring(1),"/"):i=r1(n,e)}else i=e;return{pathname:i,search:uE(r),hash:hE(a)}}function r1(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 lx(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 cE(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function b0(t,e){let n=cE(t);return e?n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function v0(t,e,n,r){r===void 0&&(r=!1);let a;typeof t=="string"?a=Fc(t):(a=Gd({},t),zn(!a.pathname||!a.pathname.includes("?"),lx("?","pathname","search",a)),zn(!a.pathname||!a.pathname.includes("#"),lx("#","pathname","hash",a)),zn(!a.search||!a.search.includes("#"),lx("#","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=lE(a,c),h=o&&o!=="/"&&o.endsWith("/"),f=(i||o===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(h||f)&&(u.pathname+="/"),u}const bo=t=>t.join("/").replace(/\/\/+/g,"/"),dE=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),uE=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,hE=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function fE(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const bj=["post","put","patch","delete"];new Set(bj);const pE=["get",...bj];new Set(pE);/** - * 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 Jd(){return Jd=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=v0(h,JSON.parse(o),i,f.relative==="path");t==null&&e!=="/"&&(m.pathname=m.pathname==="/"?e:bo([e,m.pathname])),(f.replace?r.replace:r.push)(m,f.state,f)},[e,r,o,i,t])}const yE=b.createContext(null);function bE(t){let e=b.useContext(Ci).outlet;return e&&b.createElement(yE.Provider,{value:t},e)}function wj(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=b.useContext(Po),{matches:a}=b.useContext(Ci),{pathname:i}=Ro(),o=JSON.stringify(b0(a,r.v7_relativeSplatPath));return b.useMemo(()=>v0(t,JSON.parse(o),i,n==="path"),[t,o,i,n])}function vE(t,e){return NE(t,e)}function NE(t,e,n,r){Bc()||zn(!1);let{navigator:a}=b.useContext(Po),{matches:i}=b.useContext(Ci),o=i[i.length-1],c=o?o.params:{};o&&o.pathname;let u=o?o.pathnameBase:"/";o&&o.route;let h=Ro(),f;if(e){var m;let w=typeof e=="string"?Fc(e):e;u==="/"||(m=w.pathname)!=null&&m.startsWith(u)||zn(!1),f=w}else f=h;let x=f.pathname||"/",y=x;if(u!=="/"){let w=u.replace(/^\//,"").split("/");y="/"+x.replace(/^\//,"").split("/").slice(w.length).join("/")}let v=WT(t,{pathname:y}),N=CE(v&&v.map(w=>Object.assign({},w,{params:Object.assign({},c,w.params),pathname:bo([u,a.encodeLocation?a.encodeLocation(w.pathname).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?u:bo([u,a.encodeLocation?a.encodeLocation(w.pathnameBase).pathname:w.pathnameBase])})),i,n,r);return e&&N?b.createElement(ap.Provider,{value:{location:Jd({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:po.Pop}},N):N}function wE(){let t=AE(),e=fE(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 jE=b.createElement(wE,null);class kE 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(Ci.Provider,{value:this.props.routeContext},b.createElement(vj.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function SE(t){let{routeContext:e,match:n,children:r}=t,a=b.useContext(N0);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),b.createElement(Ci.Provider,{value:e},r)}function CE(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,N=null,w=null;n&&(y=c&&m.route.id?c[m.route.id]:void 0,N=m.route.errorElement||jE,u&&(h<0&&x===0?(PE("route-fallback"),v=!0,w=null):h===x&&(v=!0,w=m.route.hydrateFallbackElement||null)));let k=e.concat(o.slice(0,x+1)),E=()=>{let C;return y?C=N:v?C=w:m.route.Component?C=b.createElement(m.route.Component,null):m.route.element?C=m.route.element:C=f,b.createElement(SE,{match:m,routeContext:{outlet:f,matches:k,isDataRoute:n!=null},children:C})};return n&&(m.route.ErrorBoundary||m.route.errorElement||x===0)?b.createElement(kE,{location:n.location,revalidation:n.revalidation,component:N,error:y,children:E(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):E()},null)}var jj=(function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t})(jj||{}),kj=(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})(kj||{});function TE(t){let e=b.useContext(N0);return e||zn(!1),e}function EE(t){let e=b.useContext(mE);return e||zn(!1),e}function ME(t){let e=b.useContext(Ci);return e||zn(!1),e}function Sj(t){let e=ME(),n=e.matches[e.matches.length-1];return n.route.id||zn(!1),n.route.id}function AE(){var t;let e=b.useContext(vj),n=EE(),r=Sj();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function IE(){let{router:t}=TE(jj.UseNavigateStable),e=Sj(kj.UseNavigateStable),n=b.useRef(!1);return Nj(()=>{n.current=!0}),b.useCallback(function(a,i){i===void 0&&(i={}),n.current&&(typeof a=="number"?t.navigate(a):t.navigate(a,Jd({fromRouteId:e},i)))},[t,e])}const a1={};function PE(t,e,n){a1[t]||(a1[t]=!0)}function RE(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function ph(t){let{to:e,replace:n,state:r,relative:a}=t;Bc()||zn(!1);let{future:i,static:o}=b.useContext(Po),{matches:c}=b.useContext(Ci),{pathname:u}=Ro(),h=La(),f=v0(e,b0(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 OE(t){return bE(t.context)}function ln(t){zn(!1)}function LE(t){let{basename:e="/",children:n=null,location:r,navigationType:a=po.Pop,navigator:i,static:o=!1,future:c}=t;Bc()&&zn(!1);let u=e.replace(/^\/*/,"/"),h=b.useMemo(()=>({basename:u,navigator:i,static:o,future:Jd({v7_relativeSplatPath:!1},c)}),[u,c,i,o]);typeof r=="string"&&(r=Fc(r));let{pathname:f="/",search:m="",hash:x="",state:y=null,key:v="default"}=r,N=b.useMemo(()=>{let w=y0(f,u);return w==null?null:{location:{pathname:w,search:m,hash:x,state:y,key:v},navigationType:a}},[u,f,m,x,y,v,a]);return N==null?null:b.createElement(Po.Provider,{value:h},b.createElement(ap.Provider,{children:n,value:N}))}function DE(t){let{children:e,location:n}=t;return vE(og(e),n)}new Promise(()=>{});function og(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,og(r.props.children,i));return}r.type!==ln&&zn(!1),!r.props.index||!r.props.children||zn(!1);let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=og(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 lg(){return lg=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 $E(t,e){return t.button===0&&(!e||e==="_self")&&!zE(t)}function cg(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 FE(t,e){let n=cg(t);return e&&e.forEach((r,a)=>{n.has(a)||e.getAll(a).forEach(i=>{n.append(a,i)})}),n}const BE=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],VE="6";try{window.__reactRouterVersion=VE}catch{}const HE="startTransition",i1=rp[HE];function UE(t){let{basename:e,children:n,future:r,window:a}=t,i=b.useRef();i.current==null&&(i.current=VT({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&&i1?i1(()=>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 WE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",KE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Tc=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=_E(e,BE),{basename:y}=b.useContext(Po),v,N=!1;if(typeof h=="string"&&KE.test(h)&&(v=h,WE))try{let C=new URL(window.location.href),R=h.startsWith("//")?new URL(C.protocol+h):new URL(h),O=y0(R.pathname,y);R.origin===C.origin&&O!=null?h=O+R.search+R.hash:N=!0}catch{}let w=xE(h,{relative:a}),k=qE(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",lg({},x,{href:v||w,onClick:N||i?r:E,ref:n,target:u}))});var o1;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(o1||(o1={}));var l1;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(l1||(l1={}));function qE(t,e){let{target:n,replace:r,state:a,preventScrollReset:i,relative:o,viewTransition:c}=e===void 0?{}:e,u=La(),h=Ro(),f=wj(t,{relative:o});return b.useCallback(m=>{if($E(m,n)){m.preventDefault();let x=r!==void 0?r:Xh(h)===Xh(f);u(t,{replace:x,state:a,preventScrollReset:i,relative:o,viewTransition:c})}},[h,u,f,r,a,n,t,i,o,c])}function w0(t){let e=b.useRef(cg(t)),n=b.useRef(!1),r=Ro(),a=b.useMemo(()=>FE(r.search,n.current?null:e.current),[r.search]),i=La(),o=b.useCallback((c,u)=>{const h=cg(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 GE=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),JE=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),c1=t=>{const e=JE(t);return e.charAt(0).toUpperCase()+e.slice(1)},Cj=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),QE=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 YE={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 XE=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,...YE,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:Cj("lucide",a),...!i&&!QE(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 Me=(t,e)=>{const n=b.forwardRef(({className:r,...a},i)=>b.createElement(XE,{ref:i,iconNode:e,className:Cj(`lucide-${GE(c1(t))}`,`lucide-${t}`,r),...a}));return n.displayName=c1(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 ZE=[["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"}]],cx=Me("arrow-up-down",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 e5=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],t5=Me("at-sign",e5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const n5=[["path",{d:"M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727",key:"yr8idg"}]],d1=Me("bitcoin",n5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const s5=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],r5=Me("bold",s5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const a5=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],rr=Me("book-open",a5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const i5=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],dg=Me("calendar",i5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const o5=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],hc=Me("chart-column",o5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const l5=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ip=Me("check",l5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const c5=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ec=Me("chevron-down",c5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const d5=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],u5=Me("chevron-left",d5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const h5=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ol=Me("chevron-right",h5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const f5=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],ug=Me("chevron-up",f5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const p5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Tj=Me("circle-alert",p5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const m5=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],dx=Me("circle-check-big",m5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const x5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ej=Me("circle-check",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.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Mj=Me("circle-question-mark",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"}],["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"}]],mh=Me("circle-user",y5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const b5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Aj=Me("circle-x",b5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const v5=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],hg=Me("clock",v5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const N5=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],u1=Me("cloud",N5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const w5=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],j5=Me("code",w5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const k5=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Ij=Me("copy",k5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const S5=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],h1=Me("credit-card",S5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const C5=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],wc=Me("crown",C5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const T5=[["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"}]],Zh=Me("dollar-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 E5=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],M5=Me("download",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 A5=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],wi=Me("external-link",A5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const I5=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],P5=Me("eye-off",I5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const R5=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ef=Me("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 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"}]],Pj=Me("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 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"}]],Rj=Me("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 D5=[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]],fg=Me("gift",D5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _5=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],z5=Me("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 $5=[["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"}]],pg=Me("globe",$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=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],B5=Me("graduation-cap",F5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const V5=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],oi=Me("grip-vertical",V5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const H5=[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]],U5=Me("handshake",H5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const W5=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],f1=Me("hash",W5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const K5=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],q5=Me("heading-1",K5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const G5=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],J5=Me("heading-2",G5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Q5=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],Y5=Me("heading-3",Q5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const X5=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],Z5=Me("house",X5);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const eM=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Oj=Me("image",eM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const tM=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],xh=Me("info",tM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nM=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],sM=Me("italic",nM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const rM=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],mg=Me("key",rM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const aM=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],iM=Me("layout-dashboard",aM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oM=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],lM=Me("layout-grid",oM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cM=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Ea=Me("link-2",cM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dM=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],xg=Me("link",dM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const uM=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],hM=Me("list-ordered",uM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fM=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],pM=Me("list",fM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mM=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],xM=Me("lock",mM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gM=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],yM=Me("log-out",gM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bM=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],Lj=Me("map-pin",bM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const vM=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],NM=Me("menu",vM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wM=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],jM=Me("message-circle",wM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kM=[["path",{d:"M5 12h14",key:"1ays0h"}]],SM=Me("minus",kM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const CM=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],ea=Me("navigation",CM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const TM=[["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"}]],EM=Me("palette",TM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const MM=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],AM=Me("paperclip",MM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const IM=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],tn=Me("pen-line",IM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const PM=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],p1=Me("pencil",PM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const RM=[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]],OM=Me("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"}]],m1=Me("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 DM=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],_M=Me("pin",DM);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Dn=Me("plus",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=[["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"}]],x1=Me("qr-code",$M);/** - * @license lucide-react v0.562.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const 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=Me("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=Me("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=Me("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"}]],kn=Me("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"}]],Aa=Me("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=Me("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"}]],mo=Me("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"}]],gh=Me("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=Me("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"}]],yc=Me("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"}]],Ld=Me("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"}]],gl=Me("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=Me("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=Me("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"}]],bc=Me("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=Me("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=Me("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"}]],Dd=Me("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"}]],Ms=Me("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"}]],tf=Me("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"}]],gg=Me("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"}]],Dj=Me("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=Me("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"}]],nf=Me("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"}]],vc=Me("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"}]],xi=Me("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"}]],_n=Me("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=Me("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"}]],Mc=Me("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=Me("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"}]],ss=Me("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"}]],ji=Me("zap",EA),j0="admin_token";function hu(){try{return localStorage.getItem(j0)}catch{return null}}function MA(t){try{localStorage.setItem(j0,t)}catch{}}function ux(){try{localStorage.removeItem(j0)}catch{}}const AA="https://soulapi.quwanzhi.com",IA=15e3,g1=6e4,PA=()=>{const t="https://soulapi.quwanzhi.com";{const e=t.trim();if(e.length>0)return e.replace(/\/$/,"")}return AA};function Ac(t){const e=PA(),n=t.startsWith("/")?t:`/${t}`;return e?`${e}${n}`:n}async function op(t,e={}){const{data:n,...r}=e,a=Ac(t),i=new Headers(r.headers),o=hu();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 y;if(x.includes("application/json"))try{y=await m.json()}catch{throw new Error(`API 响应解析失败 (${m.status})`)}else{const N=await m.text();throw new Error(`API 返回非 JSON 响应 (${m.status}): ${N.slice(0,100)}`)}const v=N=>{const w=N,k=((w==null?void 0:w.message)||(w==null?void 0:w.error)||"").toString();(k.includes("可提现金额不足")||k.includes("可提现不足")||k.includes("余额不足"))&&window.dispatchEvent(new CustomEvent("recharge-alert",{detail:k}))};if(!m.ok){v(y);const N=new Error((y==null?void 0:y.error)||`HTTP ${m.status}`);throw N.status=m.status,N.data=y,N}return v(y),y}function Le(t,e){return op(t,{...e,method:"GET"})}function Et(t,e,n){return op(t,{...n,method:"POST",data:e})}function Zt(t,e,n){return op(t,{...n,method:"PUT",data:e})}function gi(t,e){return op(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(Tj,{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(ss,{className:"w-4 h-4"})})]}):null}const OA=[{icon:iM,label:"数据概览",href:"/dashboard"},{icon:rr,label:"内容管理",href:"/content"},{icon:_n,label:"用户管理",href:"/users"},{icon:z5,label:"找伙伴",href:"/find-partner"},{icon:Mc,label:"推广中心",href:"/distribution"}];function LA(){const t=Ro(),e=La(),[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(!hu()){e("/login",{replace:!0});return}return Le("/api/admin").then(u=>{c||(u&&u.success!==!1?i(!0):(ux(),e("/login",{replace:!0,state:{from:t.pathname}})))}).catch(()=>{c||(ux(),e("/login",{replace:!0,state:{from:t.pathname}}))}),()=>{c=!0}},[t.pathname,n,e]);const o=async()=>{ux();try{await Et("/api/admin/logout",{})}catch{}e("/login",{replace:!0})};return!n||!a?s.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[s.jsx("div",{className:"w-64 bg-[#0f2137] border-r border-gray-700/50"}),s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx("div",{className:"text-[#38bdac]",children:"加载中..."})})]}):s.jsxs("div",{className:"flex min-h-screen bg-[#0a1628]",children:[s.jsxs("div",{className:"w-64 bg-[#0f2137] flex flex-col border-r border-gray-700/50 shadow-xl",children:[s.jsxs("div",{className:"p-6 border-b border-gray-700/50",children:[s.jsx("h1",{className:"text-xl font-bold text-[#38bdac]",children:"管理后台"}),s.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Soul创业派对"})]}),s.jsxs("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:[OA.map(c=>{const u=t.pathname===c.href;return s.jsxs(Tc,{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(Tc,{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(mo,{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(yM,{className:"w-5 h-5"}),s.jsx("span",{className:"text-sm",children:"退出登录"})]})})]}),s.jsxs("div",{className:"flex-1 overflow-auto bg-[#0a1628] min-w-0 flex flex-col",children:[s.jsx(RA,{}),s.jsx("div",{className:"w-full min-w-[1024px] min-h-full flex-1",children:s.jsx(OE,{})})]})]})}function y1(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function k0(...t){return e=>{let n=!1;const r=t.map(a=>{const i=y1(a,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a{let{children:i,...o}=r;_j(i)&&typeof sf=="function"&&(i=sf(i._payload));const c=b.Children.toArray(i),u=c.find(FA);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 $j=zj("Slot");function zA(t){const e=b.forwardRef((n,r)=>{let{children:a,...i}=n;if(_j(a)&&typeof sf=="function"&&(a=sf(a._payload)),b.isValidElement(a)){const o=VA(a),c=BA(i,a.props);return a.type!==b.Fragment&&(c.ref=r?k0(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 $A=Symbol("radix.slottable");function FA(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===$A}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 Fj(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,v1=Bj,Vj=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return v1(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=b1(f)||b1(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[N,w]=v;return Array.isArray(w)?w.includes({...i,...c}[N]):{...i,...c}[N]===w})?[...h,m,x]:h},[]);return v1(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}),Hj=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),rf="-",N1=[],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(rf),u=c[0]===""&&c.length>1?1:0;return Uj(c,u,e)},getConflictingClassGroupIds:(o,c)=>{if(c){const u=r[o],h=n[o];return u?h?HA(h,u):u:h||N1}return n[o]||N1}}},Uj=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const a=t[e],i=n.nextPart.get(a);if(i){const h=Uj(t,e+1,i);if(h)return h}const o=n.validators;if(o===null)return;const c=e===0?t.join(rf):t.slice(e).join(rf),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=Hj();for(const r in t){const a=t[r];S0(a,n,r,e)}return n},S0=(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:Wj(e,t);r.classGroupId=n},XA=(t,e,n,r)=>{if(eI(t)){S0(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(rf),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)}}},yg="!",w1=":",nI=[],j1=(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 N=0;Nu?h-u:void 0;return j1(i,y,x,v)};if(e){const a=e+w1,i=r;r=o=>o.startsWith(a)?i(o.slice(a.length)):j1(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:y,baseClassName:v,maybePostfixModifierPosition:N}=n(f);if(m){u=f+(u.length>0?" "+u:u);continue}let w=!!N,k=r(w?v.substring(0,N):v);if(!k){if(!w){u=f+(u.length>0?" "+u:u);continue}if(k=r(v),!k){u=f+(u.length>0?" "+u:u);continue}w=!1}const E=x.length===0?"":x.length===1?x[0]:i(x).join(":"),C=y?E+yg:E,R=C+k;if(o.indexOf(R)>-1)continue;o.push(R);const O=a(k,w);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=[],Jn=t=>{const e=n=>n[t]||dI;return e.isThemeGetter=!0,e},qj=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Gj=/^\((?:(\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)\(.+\)$/,ac=t=>uI.test(t),Nt=t=>!!t&&!Number.isNaN(Number(t)),no=t=>!!t&&Number.isInteger(Number(t)),hx=t=>t.endsWith("%")&&Nt(t.slice(0,-1)),li=t=>hI.test(t),gI=()=>!0,yI=t=>fI.test(t)&&!pI.test(t),Jj=()=>!1,bI=t=>mI.test(t),vI=t=>xI.test(t),NI=t=>!qe(t)&&!Ge(t),wI=t=>Vc(t,Xj,Jj),qe=t=>qj.test(t),nl=t=>Vc(t,Zj,yI),fx=t=>Vc(t,TI,Nt),k1=t=>Vc(t,Qj,Jj),jI=t=>Vc(t,Yj,vI),yh=t=>Vc(t,ek,bI),Ge=t=>Gj.test(t),jd=t=>Hc(t,Zj),kI=t=>Hc(t,EI),S1=t=>Hc(t,Qj),SI=t=>Hc(t,Xj),CI=t=>Hc(t,Yj),bh=t=>Hc(t,ek,!0),Vc=(t,e,n)=>{const r=qj.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Hc=(t,e,n=!1)=>{const r=Gj.exec(t);return r?r[1]?e(r[1]):n:!1},Qj=t=>t==="position"||t==="percentage",Yj=t=>t==="image"||t==="url",Xj=t=>t==="length"||t==="size"||t==="bg-size",Zj=t=>t==="length",TI=t=>t==="number",EI=t=>t==="family-name",ek=t=>t==="shadow",MI=()=>{const t=Jn("color"),e=Jn("font"),n=Jn("text"),r=Jn("font-weight"),a=Jn("tracking"),i=Jn("leading"),o=Jn("breakpoint"),c=Jn("container"),u=Jn("spacing"),h=Jn("radius"),f=Jn("shadow"),m=Jn("inset-shadow"),x=Jn("text-shadow"),y=Jn("drop-shadow"),v=Jn("blur"),N=Jn("perspective"),w=Jn("aspect"),k=Jn("ease"),E=Jn("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"],O=()=>[...R(),Ge,qe],q=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto","contain","none"],V=()=>[Ge,qe,u],I=()=>[ac,"full","auto",...V()],te=()=>[no,"none","subgrid",Ge,qe],Q=()=>["auto",{span:["full",no,Ge,qe]},no,Ge,qe],B=()=>[no,"auto",Ge,qe],re=()=>["auto","min","max","fr",Ge,qe],ae=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],J=()=>["start","end","center","stretch","center-safe","end-safe"],F=()=>["auto",...V()],D=()=>[ac,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...V()],P=()=>[t,Ge,qe],oe=()=>[...R(),S1,k1,{position:[Ge,qe]}],G=()=>["no-repeat",{repeat:["","x","y","space","round"]}],_=()=>["auto","cover","contain",SI,wI,{size:[Ge,qe]}],U=()=>[hx,jd,nl],H=()=>["","none","full",h,Ge,qe],K=()=>["",Nt,jd,nl],me=()=>["solid","dashed","dotted","double"],X=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],le=()=>[Nt,hx,S1,k1],de=()=>["","none",v,Ge,qe],ve=()=>["none",Nt,Ge,qe],ye=()=>["none",Nt,Ge,qe],Se=()=>[Nt,Ge,qe],Fe=()=>[ac,"full",...V()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[li],breakpoint:[li],color:[gI],container:[li],"drop-shadow":[li],ease:["in","out","in-out"],font:[NI],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[li],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[li],shadow:[li],spacing:["px",Nt],text:[li],"text-shadow":[li],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ac,qe,Ge,w]}],container:["container"],columns:[{columns:[Nt,qe,Ge,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: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:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{start:I()}],end:[{end:I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[no,"auto",Ge,qe]}],basis:[{basis:[ac,"full","auto",c,...V()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Nt,ac,"auto","initial","none",qe]}],grow:[{grow:["",Nt,Ge,qe]}],shrink:[{shrink:["",Nt,Ge,qe]}],order:[{order:[no,"first","last","none",Ge,qe]}],"grid-cols":[{"grid-cols":te()}],"col-start-end":[{col:Q()}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":te()}],"row-start-end":[{row:Q()}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":re()}],"auto-rows":[{"auto-rows":re()}],gap:[{gap:V()}],"gap-x":[{"gap-x":V()}],"gap-y":[{"gap-y":V()}],"justify-content":[{justify:[...ae(),"normal"]}],"justify-items":[{"justify-items":[...J(),"normal"]}],"justify-self":[{"justify-self":["auto",...J()]}],"align-content":[{content:["normal",...ae()]}],"align-items":[{items:[...J(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...J(),{baseline:["","last"]}]}],"place-content":[{"place-content":ae()}],"place-items":[{"place-items":[...J(),"baseline"]}],"place-self":[{"place-self":["auto",...J()]}],p:[{p:V()}],px:[{px:V()}],py:[{py:V()}],ps:[{ps:V()}],pe:[{pe:V()}],pt:[{pt:V()}],pr:[{pr:V()}],pb:[{pb:V()}],pl:[{pl:V()}],m:[{m:F()}],mx:[{mx:F()}],my:[{my:F()}],ms:[{ms:F()}],me:[{me:F()}],mt:[{mt:F()}],mr:[{mr:F()}],mb:[{mb:F()}],ml:[{ml:F()}],"space-x":[{"space-x":V()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":V()}],"space-y-reverse":["space-y-reverse"],size:[{size:D()}],w:[{w:[c,"screen",...D()]}],"min-w":[{"min-w":[c,"screen","none",...D()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...D()]}],h:[{h:["screen","lh",...D()]}],"min-h":[{"min-h":["screen","lh","none",...D()]}],"max-h":[{"max-h":["screen","lh",...D()]}],"font-size":[{text:["base",n,jd,nl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Ge,fx]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",hx,qe]}],"font-family":[{font:[kI,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,Ge,qe]}],"line-clamp":[{"line-clamp":[Nt,"none",Ge,fx]}],leading:[{leading:[i,...V()]}],"list-image":[{"list-image":["none",Ge,qe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ge,qe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...me(),"wavy"]}],"text-decoration-thickness":[{decoration:[Nt,"from-font","auto",Ge,nl]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[Nt,"auto",Ge,qe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:V()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ge,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",Ge,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:oe()}],"bg-repeat":[{bg:G()}],"bg-size":[{bg:_()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},no,Ge,qe],radial:["",Ge,qe],conic:[no,Ge,qe]},CI,jI]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:H()}],"rounded-s":[{"rounded-s":H()}],"rounded-e":[{"rounded-e":H()}],"rounded-t":[{"rounded-t":H()}],"rounded-r":[{"rounded-r":H()}],"rounded-b":[{"rounded-b":H()}],"rounded-l":[{"rounded-l":H()}],"rounded-ss":[{"rounded-ss":H()}],"rounded-se":[{"rounded-se":H()}],"rounded-ee":[{"rounded-ee":H()}],"rounded-es":[{"rounded-es":H()}],"rounded-tl":[{"rounded-tl":H()}],"rounded-tr":[{"rounded-tr":H()}],"rounded-br":[{"rounded-br":H()}],"rounded-bl":[{"rounded-bl":H()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...me(),"hidden","none"]}],"divide-style":[{divide:[...me(),"hidden","none"]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...me(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Nt,Ge,qe]}],"outline-w":[{outline:["",Nt,jd,nl]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","none",f,bh,yh]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",m,bh,yh]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[Nt,nl]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":["none",x,bh,yh]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[Nt,Ge,qe]}],"mix-blend":[{"mix-blend":[...X(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":X()}],"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":[Nt]}],"mask-image-linear-from-pos":[{"mask-linear-from":le()}],"mask-image-linear-to-pos":[{"mask-linear-to":le()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":le()}],"mask-image-t-to-pos":[{"mask-t-to":le()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":le()}],"mask-image-r-to-pos":[{"mask-r-to":le()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":le()}],"mask-image-b-to-pos":[{"mask-b-to":le()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":le()}],"mask-image-l-to-pos":[{"mask-l-to":le()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":le()}],"mask-image-x-to-pos":[{"mask-x-to":le()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":le()}],"mask-image-y-to-pos":[{"mask-y-to":le()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[Ge,qe]}],"mask-image-radial-from-pos":[{"mask-radial-from":le()}],"mask-image-radial-to-pos":[{"mask-radial-to":le()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"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":[Nt]}],"mask-image-conic-from-pos":[{"mask-conic-from":le()}],"mask-image-conic-to-pos":[{"mask-conic-to":le()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:oe()}],"mask-repeat":[{mask:G()}],"mask-size":[{mask:_()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ge,qe]}],filter:[{filter:["","none",Ge,qe]}],blur:[{blur:de()}],brightness:[{brightness:[Nt,Ge,qe]}],contrast:[{contrast:[Nt,Ge,qe]}],"drop-shadow":[{"drop-shadow":["","none",y,bh,yh]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",Nt,Ge,qe]}],"hue-rotate":[{"hue-rotate":[Nt,Ge,qe]}],invert:[{invert:["",Nt,Ge,qe]}],saturate:[{saturate:[Nt,Ge,qe]}],sepia:[{sepia:["",Nt,Ge,qe]}],"backdrop-filter":[{"backdrop-filter":["","none",Ge,qe]}],"backdrop-blur":[{"backdrop-blur":de()}],"backdrop-brightness":[{"backdrop-brightness":[Nt,Ge,qe]}],"backdrop-contrast":[{"backdrop-contrast":[Nt,Ge,qe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Nt,Ge,qe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Nt,Ge,qe]}],"backdrop-invert":[{"backdrop-invert":["",Nt,Ge,qe]}],"backdrop-opacity":[{"backdrop-opacity":[Nt,Ge,qe]}],"backdrop-saturate":[{"backdrop-saturate":[Nt,Ge,qe]}],"backdrop-sepia":[{"backdrop-sepia":["",Nt,Ge,qe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":V()}],"border-spacing-x":[{"border-spacing-x":V()}],"border-spacing-y":[{"border-spacing-y":V()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ge,qe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Nt,"initial",Ge,qe]}],ease:[{ease:["linear","initial",k,Ge,qe]}],delay:[{delay:[Nt,Ge,qe]}],animate:[{animate:["none",E,Ge,qe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[N,Ge,qe]}],"perspective-origin":[{"perspective-origin":O()}],rotate:[{rotate:ve()}],"rotate-x":[{"rotate-x":ve()}],"rotate-y":[{"rotate-y":ve()}],"rotate-z":[{"rotate-z":ve()}],scale:[{scale:ye()}],"scale-x":[{"scale-x":ye()}],"scale-y":[{"scale-y":ye()}],"scale-z":[{"scale-z":ye()}],"scale-3d":["scale-3d"],skew:[{skew:Se()}],"skew-x":[{"skew-x":Se()}],"skew-y":[{"skew-y":Se()}],transform:[{transform:[Ge,qe,"","none","gpu","cpu"]}],"transform-origin":[{origin:O()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Fe()}],"translate-x":[{"translate-x":Fe()}],"translate-y":[{"translate-y":Fe()}],"translate-z":[{"translate-z":Fe()}],"translate-none":["translate-none"],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}],"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",Ge,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":V()}],"scroll-mx":[{"scroll-mx":V()}],"scroll-my":[{"scroll-my":V()}],"scroll-ms":[{"scroll-ms":V()}],"scroll-me":[{"scroll-me":V()}],"scroll-mt":[{"scroll-mt":V()}],"scroll-mr":[{"scroll-mr":V()}],"scroll-mb":[{"scroll-mb":V()}],"scroll-ml":[{"scroll-ml":V()}],"scroll-p":[{"scroll-p":V()}],"scroll-px":[{"scroll-px":V()}],"scroll-py":[{"scroll-py":V()}],"scroll-ps":[{"scroll-ps":V()}],"scroll-pe":[{"scroll-pe":V()}],"scroll-pt":[{"scroll-pt":V()}],"scroll-pr":[{"scroll-pr":V()}],"scroll-pb":[{"scroll-pb":V()}],"scroll-pl":[{"scroll-pl":V()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ge,qe]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[Nt,jd,nl,fx]}],stroke:[{stroke:["none",...P()]}],"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 Qt(...t){return AI(Bj(t))}function So(t){if(!t)return"";let e=t.trim();return e?(e=e.replace(/^(https?)\/\//,"$1://"),e):""}const II=Vj("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 Y({className:t,variant:e,size:n,asChild:r=!1,...a}){const i=r?$j:"button";return s.jsx(i,{"data-slot":"button",className:Qt(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:Qt("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 PI(){const t=La(),[e,n]=b.useState(""),[r,a]=b.useState(""),[i,o]=b.useState(""),[c,u]=b.useState(!1);b.useEffect(()=>{hu()&&t("/dashboard",{replace:!0})},[t]);const h=async()=>{o(""),u(!0);try{const f=await Et("/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(yc,{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(xi,{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(xM,{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(Y,{onClick:h,disabled:c,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white py-5 disabled:opacity-50",children:c?"登录中...":"登录"})]})]}),s.jsx("p",{className:"text-center text-gray-500 text-xs mt-6",children:"Soul创业实验场 · 后台管理系统"})]})]})}const De=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Qt("rounded-xl border bg-card text-card-foreground shadow",t),...e}));De.displayName="Card";const it=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Qt("flex flex-col space-y-1.5 p-6",t),...e}));it.displayName="CardHeader";const ot=b.forwardRef(({className:t,...e},n)=>s.jsx("h3",{ref:n,className:Qt("font-semibold leading-none tracking-tight",t),...e}));ot.displayName="CardTitle";const Yt=b.forwardRef(({className:t,...e},n)=>s.jsx("p",{ref:n,className:Qt("text-sm text-muted-foreground",t),...e}));Yt.displayName="CardDescription";const _e=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Qt("p-6 pt-0",t),...e}));_e.displayName="CardContent";const RI=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{ref:n,className:Qt("flex items-center p-6 pt-0",t),...e}));RI.displayName="CardFooter";const OI={success:{bg:"#f0fdf4",border:"#22c55e",icon:"✓"},error:{bg:"#fef2f2",border:"#ef4444",icon:"✕"},info:{bg:"#eff6ff",border:"#3b82f6",icon:"ℹ"}};function px(t,e="info",n=3e3){const r=`toast-${Date.now()}`,a=OI[e],i=document.createElement("div");i.id=r,i.setAttribute("role","alert"),Object.assign(i.style,{position:"fixed",top:"24px",right:"24px",zIndex:"9999",display:"flex",alignItems:"center",gap:"10px",padding:"12px 18px",borderRadius:"10px",background:a.bg,border:`1.5px solid ${a.border}`,boxShadow:"0 4px 20px rgba(0,0,0,.12)",fontSize:"14px",color:"#1a1a1a",fontWeight:"500",maxWidth:"380px",lineHeight:"1.5",opacity:"0",transform:"translateY(-8px)",transition:"opacity .22s ease, transform .22s ease",pointerEvents:"none"});const o=document.createElement("span");Object.assign(o.style,{width:"20px",height:"20px",borderRadius:"50%",background:a.border,color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:"700",flexShrink:"0"}),o.textContent=a.icon;const c=document.createElement("span");c.textContent=t,i.appendChild(o),i.appendChild(c),document.body.appendChild(i),requestAnimationFrame(()=>{i.style.opacity="1",i.style.transform="translateY(0)"});const u=setTimeout(()=>h(r),n);function h(f){clearTimeout(u);const m=document.getElementById(f);m&&(m.style.opacity="0",m.style.transform="translateY(-8px)",setTimeout(()=>{var x;return(x=m.parentNode)==null?void 0:x.removeChild(m)},250))}}const ne={success:(t,e)=>px(t,"success",e),error:(t,e)=>px(t,"error",e),info:(t,e)=>px(t,"info",e)};function yt(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 Oo(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,N=((k=x==null?void 0:x[t])==null?void 0:k[u])||c,w=b.useMemo(()=>v,Object.values(v));return s.jsx(N.Provider,{value:w,children:y})};h.displayName=i+"Provider";function f(m,x){var N;const y=((N=x==null?void 0:x[t])==null?void 0:N[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,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 b.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var Is=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},_I=rp[" useId ".trim().toString()]||(()=>{}),zI=0;function vo(t){const[e,n]=b.useState(_I());return Is(()=>{n(r=>r??String(zI++))},[t]),e?`radix-${e}`:""}var $I=rp[" useInsertionEffect ".trim().toString()]||Is;function yl({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=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=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]=b.useState(t),a=b.useRef(n),i=b.useRef(e);return $I(()=>{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 BI(t){return typeof t=="function"}function Qd(t){const e=VI(t),n=b.forwardRef((r,a)=>{const{children:i,...o}=r,c=b.Children.toArray(i),u=c.find(UI);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 VI(t){const e=b.forwardRef((n,r)=>{const{children:a,...i}=n;if(b.isValidElement(a)){const o=KI(a),c=WI(i,a.props);return a.type!==b.Fragment&&(c.ref=r?k0(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 HI=Symbol("radix.slottable");function UI(t){return b.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"],wt=qI.reduce((t,e)=>{const n=Qd(`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 GI(t,e){t&&uu.flushSync(()=>t.dispatchEvent(e))}function Co(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 JI(t,e=globalThis==null?void 0:globalThis.document){const n=Co(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 QI="DismissableLayer",bg="dismissableLayer.update",YI="dismissableLayer.pointerDownOutside",XI="dismissableLayer.focusOutside",C1,tk=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),C0=b.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:o,onDismiss:c,...u}=t,h=b.useContext(tk),[f,m]=b.useState(null),x=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=b.useState({}),v=Jt(e,$=>m($)),N=Array.from(h.layers),[w]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),k=N.indexOf(w),E=f?N.indexOf(f):-1,C=h.layersWithOutsidePointerEventsDisabled.size>0,R=E>=k,O=tP($=>{const V=$.target,I=[...h.branches].some(te=>te.contains(V));!R||I||(a==null||a($),o==null||o($),$.defaultPrevented||c==null||c())},x),q=nP($=>{const V=$.target;[...h.branches].some(te=>te.contains(V))||(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),b.useEffect(()=>{if(f)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(C1=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),T1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=C1)}},[f,x,n,h]),b.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),T1())},[f,h]),b.useEffect(()=>{const $=()=>y({});return document.addEventListener(bg,$),()=>document.removeEventListener(bg,$)},[]),s.jsx(wt.div,{...u,ref:v,style:{pointerEvents:C?R?"auto":"none":void 0,...t.style},onFocusCapture:yt(t.onFocusCapture,q.onFocusCapture),onBlurCapture:yt(t.onBlurCapture,q.onBlurCapture),onPointerDownCapture:yt(t.onPointerDownCapture,O.onPointerDownCapture)})});C0.displayName=QI;var ZI="DismissableLayerBranch",eP=b.forwardRef((t,e)=>{const n=b.useContext(tk),r=b.useRef(null),a=Jt(e,r);return b.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),s.jsx(wt.div,{...t,ref:a})});eP.displayName=ZI;function tP(t,e=globalThis==null?void 0:globalThis.document){const n=Co(t),r=b.useRef(!1),a=b.useRef(()=>{});return b.useEffect(()=>{const i=c=>{if(c.target&&!r.current){let u=function(){nk(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 nP(t,e=globalThis==null?void 0:globalThis.document){const n=Co(t),r=b.useRef(!1);return b.useEffect(()=>{const a=i=>{i.target&&!r.current&&nk(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 T1(){const t=new CustomEvent(bg);document.dispatchEvent(t)}function nk(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 mx="focusScope.autoFocusOnMount",xx="focusScope.autoFocusOnUnmount",E1={bubbles:!1,cancelable:!0},sP="FocusScope",T0=b.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:i,...o}=t,[c,u]=b.useState(null),h=Co(a),f=Co(i),m=b.useRef(null),x=Jt(e,N=>u(N)),y=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(r){let N=function(C){if(y.paused||!c)return;const R=C.target;c.contains(R)?m.current=R:ao(m.current,{select:!0})},w=function(C){if(y.paused||!c)return;const R=C.relatedTarget;R!==null&&(c.contains(R)||ao(m.current,{select:!0}))},k=function(C){if(document.activeElement===document.body)for(const O of C)O.removedNodes.length>0&&ao(c)};document.addEventListener("focusin",N),document.addEventListener("focusout",w);const E=new MutationObserver(k);return c&&E.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",N),document.removeEventListener("focusout",w),E.disconnect()}}},[r,c,y.paused]),b.useEffect(()=>{if(c){A1.add(y);const N=document.activeElement;if(!c.contains(N)){const k=new CustomEvent(mx,E1);c.addEventListener(mx,h),c.dispatchEvent(k),k.defaultPrevented||(rP(cP(sk(c)),{select:!0}),document.activeElement===N&&ao(c))}return()=>{c.removeEventListener(mx,h),setTimeout(()=>{const k=new CustomEvent(xx,E1);c.addEventListener(xx,f),c.dispatchEvent(k),k.defaultPrevented||ao(N??document.body,{select:!0}),c.removeEventListener(xx,f),A1.remove(y)},0)}}},[c,h,f,y]);const v=b.useCallback(N=>{if(!n&&!r||y.paused)return;const w=N.key==="Tab"&&!N.altKey&&!N.ctrlKey&&!N.metaKey,k=document.activeElement;if(w&&k){const E=N.currentTarget,[C,R]=aP(E);C&&R?!N.shiftKey&&k===R?(N.preventDefault(),n&&ao(C,{select:!0})):N.shiftKey&&k===C&&(N.preventDefault(),n&&ao(R,{select:!0})):k===E&&N.preventDefault()}},[n,r,y.paused]);return s.jsx(wt.div,{tabIndex:-1,...o,ref:x,onKeyDown:v})});T0.displayName=sP;function rP(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(ao(r,{select:e}),document.activeElement!==n)return}function aP(t){const e=sk(t),n=M1(e,t),r=M1(e.reverse(),t);return[n,r]}function sk(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 M1(t,e){for(const n of t)if(!iP(n,{upTo:e}))return n}function iP(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 oP(t){return t instanceof HTMLInputElement&&"select"in t}function ao(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&oP(t)&&e&&t.select()}}var A1=lP();function lP(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=I1(t,e),t.unshift(e)},remove(e){var n;t=I1(t,e),(n=t[0])==null||n.resume()}}}function I1(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function cP(t){return t.filter(e=>e.tagName!=="A")}var dP="Portal",E0=b.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[a,i]=b.useState(!1);Is(()=>i(!0),[]);const o=n||a&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return o?xj.createPortal(s.jsx(wt.div,{...r,ref:e}),o):null});E0.displayName=dP;function uP(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}var fu=t=>{const{present:e,children:n}=t,r=hP(e),a=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),i=Jt(r.ref,fP(a));return typeof n=="function"||r.isPresent?b.cloneElement(a,{ref:i}):null};fu.displayName="Presence";function hP(t){const[e,n]=b.useState(),r=b.useRef(null),a=b.useRef(t),i=b.useRef("none"),o=t?"mounted":"unmounted",[c,u]=uP(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const h=vh(r.current);i.current=c==="mounted"?h:"none"},[c]),Is(()=>{const h=r.current,f=a.current;if(f!==t){const x=i.current,y=vh(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]),Is(()=>{if(e){let h;const f=e.ownerDocument.defaultView??window,m=y=>{const N=vh(r.current).includes(CSS.escape(y.animationName));if(y.target===e&&N&&(u("ANIMATION_END"),!a.current)){const w=e.style.animationFillMode;e.style.animationFillMode="forwards",h=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=w)})}},x=y=>{y.target===e&&(i.current=vh(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 vh(t){return(t==null?void 0:t.animationName)||"none"}function fP(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 gx=0;function rk(){b.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??P1()),document.body.insertAdjacentElement("beforeend",t[1]??P1()),gx++,()=>{gx===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),gx--}},[])}function P1(){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 Ta=function(){return Ta=Object.assign||function(e){for(var n,r=1,a=arguments.length;r"u")return AP;var e=IP(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])}},RP=lk(),jc="data-scroll-locked",OP=function(t,e,n,r){var a=t.left,i=t.top,o=t.right,c=t.gap;return n===void 0&&(n="margin"),` - .`.concat(mP,` { - overflow: hidden `).concat(r,`; - padding-right: `).concat(c,"px ").concat(r,`; - } - body[`).concat(jc,`] { - 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(Vh,` { - right: `).concat(c,"px ").concat(r,`; - } - - .`).concat(Hh,` { - margin-right: `).concat(c,"px ").concat(r,`; - } - - .`).concat(Vh," .").concat(Vh,` { - right: 0 `).concat(r,`; - } - - .`).concat(Hh," .").concat(Hh,` { - margin-right: 0 `).concat(r,`; - } - - body[`).concat(jc,`] { - `).concat(xP,": ").concat(c,`px; - } -`)},O1=function(){var t=parseInt(document.body.getAttribute(jc)||"0",10);return isFinite(t)?t:0},LP=function(){b.useEffect(function(){return document.body.setAttribute(jc,(O1()+1).toString()),function(){var t=O1()-1;t<=0?document.body.removeAttribute(jc):document.body.setAttribute(jc,t.toString())}},[])},DP=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,a=r===void 0?"margin":r;LP();var i=b.useMemo(function(){return PP(a)},[a]);return b.createElement(RP,{styles:OP(i,!e,a,n?"":"!important")})},vg=!1;if(typeof window<"u")try{var Nh=Object.defineProperty({},"passive",{get:function(){return vg=!0,!0}});window.addEventListener("test",Nh,Nh),window.removeEventListener("test",Nh,Nh)}catch{vg=!1}var ic=vg?{passive:!1}:!1,_P=function(t){return t.tagName==="TEXTAREA"},ck=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!_P(t)&&n[e]==="visible")},zP=function(t){return ck(t,"overflowY")},$P=function(t){return ck(t,"overflowX")},L1=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=dk(t,r);if(a){var i=uk(t,r),o=i[1],c=i[2];if(o>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},FP=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},BP=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},dk=function(t,e){return t==="v"?zP(e):$P(e)},uk=function(t,e){return t==="v"?FP(e):BP(e)},VP=function(t,e){return t==="h"&&e==="rtl"?-1:1},HP=function(t,e,n,r,a){var i=VP(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=uk(t,c),v=y[0],N=y[1],w=y[2],k=N-w-i*v;(v||k)&&dk(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},wh=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},D1=function(t){return[t.deltaX,t.deltaY]},_1=function(t){return t&&"current"in t?t.current:t},UP=function(t,e){return t[0]===e[0]&&t[1]===e[1]},WP=function(t){return` - .block-interactivity-`.concat(t,` {pointer-events: none;} - .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},KP=0,oc=[];function qP(t){var e=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),a=b.useState(KP++)[0],i=b.useState(lk)[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 N=pP([t.lockRef.current],(t.shards||[]).map(_1),!0).filter(Boolean);return N.forEach(function(w){return w.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),N.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(a))})}}},[t.inert,t.lockRef.current,t.shards]);var c=b.useCallback(function(N,w){if("touches"in N&&N.touches.length===2||N.type==="wheel"&&N.ctrlKey)return!o.current.allowPinchZoom;var k=wh(N),E=n.current,C="deltaX"in N?N.deltaX:E[0]-k[0],R="deltaY"in N?N.deltaY:E[1]-k[1],O,q=N.target,$=Math.abs(C)>Math.abs(R)?"h":"v";if("touches"in N&&$==="h"&&q.type==="range")return!1;var V=window.getSelection(),I=V&&V.anchorNode,te=I?I===q||I.contains(q):!1;if(te)return!1;var Q=L1($,q);if(!Q)return!0;if(Q?O=$:(O=$==="v"?"h":"v",Q=L1($,q)),!Q)return!1;if(!r.current&&"changedTouches"in N&&(C||R)&&(r.current=O),!O)return!0;var B=r.current||O;return HP(B,w,N,B==="h"?C:R)},[]),u=b.useCallback(function(N){var w=N;if(!(!oc.length||oc[oc.length-1]!==i)){var k="deltaY"in w?D1(w):wh(w),E=e.current.filter(function(O){return O.name===w.type&&(O.target===w.target||w.target===O.shadowParent)&&UP(O.delta,k)})[0];if(E&&E.should){w.cancelable&&w.preventDefault();return}if(!E){var C=(o.current.shards||[]).map(_1).filter(Boolean).filter(function(O){return O.contains(w.target)}),R=C.length>0?c(w,C[0]):!o.current.noIsolation;R&&w.cancelable&&w.preventDefault()}}},[]),h=b.useCallback(function(N,w,k,E){var C={name:N,delta:w,target:k,should:E,shadowParent:GP(k)};e.current.push(C),setTimeout(function(){e.current=e.current.filter(function(R){return R!==C})},1)},[]),f=b.useCallback(function(N){n.current=wh(N),r.current=void 0},[]),m=b.useCallback(function(N){h(N.type,D1(N),N.target,c(N,t.lockRef.current))},[]),x=b.useCallback(function(N){h(N.type,wh(N),N.target,c(N,t.lockRef.current))},[]);b.useEffect(function(){return oc.push(i),t.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:x}),document.addEventListener("wheel",u,ic),document.addEventListener("touchmove",u,ic),document.addEventListener("touchstart",f,ic),function(){oc=oc.filter(function(N){return N!==i}),document.removeEventListener("wheel",u,ic),document.removeEventListener("touchmove",u,ic),document.removeEventListener("touchstart",f,ic)}},[]);var y=t.removeScrollBar,v=t.inert;return b.createElement(b.Fragment,null,v?b.createElement(i,{styles:WP(a)}):null,y?b.createElement(DP,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function GP(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const JP=jP(ok,qP);var M0=b.forwardRef(function(t,e){return b.createElement(lp,Ta({},t,{ref:e,sideCar:JP}))});M0.classNames=lp.classNames;var QP=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},lc=new WeakMap,jh=new WeakMap,kh={},Nx=0,hk=function(t){return t&&(t.host||hk(t.parentNode))},YP=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=hk(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})},XP=function(t,e,n,r){var a=YP(e,Array.isArray(t)?t:[t]);kh[n]||(kh[n]=new WeakMap);var i=kh[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",N=(lc.get(x)||0)+1,w=(i.get(x)||0)+1;lc.set(x,N),i.set(x,w),o.push(x),N===1&&v&&jh.set(x,!0),w===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(),Nx++,function(){o.forEach(function(m){var x=lc.get(m)-1,y=i.get(m)-1;lc.set(m,x),i.set(m,y),x||(jh.has(m)||m.removeAttribute(r),jh.delete(m)),y||m.removeAttribute(n)}),Nx--,Nx||(lc=new WeakMap,lc=new WeakMap,jh=new WeakMap,kh={})}},fk=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),a=QP(t);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),XP(r,a,n,"aria-hidden")):function(){return null}},cp="Dialog",[pk]=Oo(cp),[ZP,aa]=pk(cp),mk=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]=yl({prop:r,defaultProp:a??!1,onChange:i,caller:cp});return s.jsx(ZP,{scope:e,triggerRef:c,contentRef:u,contentId:vo(),titleId:vo(),descriptionId:vo(),open:h,onOpenChange:f,onOpenToggle:b.useCallback(()=>f(m=>!m),[f]),modal:o,children:n})};mk.displayName=cp;var xk="DialogTrigger",eR=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=aa(xk,n),i=Jt(e,a.triggerRef);return s.jsx(wt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":P0(a.open),...r,ref:i,onClick:yt(t.onClick,a.onOpenToggle)})});eR.displayName=xk;var A0="DialogPortal",[tR,gk]=pk(A0,{forceMount:void 0}),yk=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:a}=t,i=aa(A0,e);return s.jsx(tR,{scope:e,forceMount:n,children:b.Children.map(r,o=>s.jsx(fu,{present:n||i.open,children:s.jsx(E0,{asChild:!0,container:a,children:o})}))})};yk.displayName=A0;var af="DialogOverlay",bk=b.forwardRef((t,e)=>{const n=gk(af,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=aa(af,t.__scopeDialog);return i.modal?s.jsx(fu,{present:r||i.open,children:s.jsx(sR,{...a,ref:e})}):null});bk.displayName=af;var nR=Qd("DialogOverlay.RemoveScroll"),sR=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=aa(af,n);return s.jsx(M0,{as:nR,allowPinchZoom:!0,shards:[a.contentRef],children:s.jsx(wt.div,{"data-state":P0(a.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),bl="DialogContent",vk=b.forwardRef((t,e)=>{const n=gk(bl,t.__scopeDialog),{forceMount:r=n.forceMount,...a}=t,i=aa(bl,t.__scopeDialog);return s.jsx(fu,{present:r||i.open,children:i.modal?s.jsx(rR,{...a,ref:e}):s.jsx(aR,{...a,ref:e})})});vk.displayName=bl;var rR=b.forwardRef((t,e)=>{const n=aa(bl,t.__scopeDialog),r=b.useRef(null),a=Jt(e,n.contentRef,r);return b.useEffect(()=>{const i=r.current;if(i)return fk(i)},[]),s.jsx(Nk,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:yt(t.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:yt(t.onPointerDownOutside,i=>{const o=i.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0;(o.button===2||c)&&i.preventDefault()}),onFocusOutside:yt(t.onFocusOutside,i=>i.preventDefault())})}),aR=b.forwardRef((t,e)=>{const n=aa(bl,t.__scopeDialog),r=b.useRef(!1),a=b.useRef(!1);return s.jsx(Nk,{...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()}})}),Nk=b.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:i,...o}=t,c=aa(bl,n),u=b.useRef(null),h=Jt(e,u);return rk(),s.jsxs(s.Fragment,{children:[s.jsx(T0,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:i,children:s.jsx(C0,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":P0(c.open),...o,ref:h,onDismiss:()=>c.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(iR,{titleId:c.titleId}),s.jsx(lR,{contentRef:u,descriptionId:c.descriptionId})]})]})}),I0="DialogTitle",wk=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=aa(I0,n);return s.jsx(wt.h2,{id:a.titleId,...r,ref:e})});wk.displayName=I0;var jk="DialogDescription",kk=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=aa(jk,n);return s.jsx(wt.p,{id:a.descriptionId,...r,ref:e})});kk.displayName=jk;var Sk="DialogClose",Ck=b.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,a=aa(Sk,n);return s.jsx(wt.button,{type:"button",...r,ref:e,onClick:yt(t.onClick,()=>a.onOpenChange(!1))})});Ck.displayName=Sk;function P0(t){return t?"open":"closed"}var Tk="DialogTitleWarning",[DV,Ek]=LI(Tk,{contentName:bl,titleName:I0,docsSlug:"dialog"}),iR=({titleId:t})=>{const e=Ek(Tk),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},oR="DialogDescriptionWarning",lR=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ek(oR).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},cR=mk,dR=yk,uR=bk,hR=vk,fR=wk,pR=kk,mR=Ck;function Bt(t){return s.jsx(cR,{"data-slot":"dialog",...t})}function xR(t){return s.jsx(dR,{...t})}const Mk=b.forwardRef(({className:t,...e},n)=>s.jsx(uR,{ref:n,className:Qt("fixed inset-0 z-50 bg-black/50",t),...e}));Mk.displayName="DialogOverlay";const zt=b.forwardRef(({className:t,children:e,showCloseButton:n=!0,...r},a)=>s.jsxs(xR,{children:[s.jsx(Mk,{}),s.jsxs(hR,{ref:a,"aria-describedby":void 0,className:Qt("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(mR,{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(ss,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));zt.displayName="DialogContent";function Vt({className:t,...e}){return s.jsx("div",{className:Qt("flex flex-col gap-2 text-center sm:text-left",t),...e})}function xn({className:t,...e}){return s.jsx("div",{className:Qt("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function Ht(t){return s.jsx(fR,{className:"text-lg font-semibold leading-none",...t})}function of(t){return s.jsx(pR,{className:"text-sm text-muted-foreground",...t})}const gR=Vj("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 Ue({className:t,variant:e,asChild:n=!1,...r}){const a=n?$j:"span";return s.jsx(a,{className:Qt(gR({variant:e}),t),...r})}var yR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],bR=yR.reduce((t,e)=>{const n=zj(`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}},{}),vR="Label",Ak=b.forwardRef((t,e)=>s.jsx(bR.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())}}));Ak.displayName=vR;var Ik=Ak;const ee=b.forwardRef(({className:t,...e},n)=>s.jsx(Ik,{ref:n,className:Qt("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));ee.displayName=Ik.displayName;function R0(t){const e=t+"CollectionProvider",[n,r]=Oo(e),[a,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=N=>{const{scope:w,children:k}=N,E=Vs.useRef(null),C=Vs.useRef(new Map).current;return s.jsx(a,{scope:w,itemMap:C,collectionRef:E,children:k})};o.displayName=e;const c=t+"CollectionSlot",u=Qd(c),h=Vs.forwardRef((N,w)=>{const{scope:k,children:E}=N,C=i(c,k),R=Jt(w,C.collectionRef);return s.jsx(u,{ref:R,children:E})});h.displayName=c;const f=t+"CollectionItemSlot",m="data-radix-collection-item",x=Qd(f),y=Vs.forwardRef((N,w)=>{const{scope:k,children:E,...C}=N,R=Vs.useRef(null),O=Jt(w,R),q=i(f,k);return Vs.useEffect(()=>(q.itemMap.set(R,{ref:R,...C}),()=>void q.itemMap.delete(R))),s.jsx(x,{[m]:"",ref:O,children:E})});y.displayName=f;function v(N){const w=i(t+"CollectionConsumer",N);return Vs.useCallback(()=>{const E=w.collectionRef.current;if(!E)return[];const C=Array.from(E.querySelectorAll(`[${m}]`));return Array.from(w.itemMap.values()).sort((q,$)=>C.indexOf(q.ref.current)-C.indexOf($.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:h,ItemSlot:y},v,r]}var NR=b.createContext(void 0);function dp(t){const e=b.useContext(NR);return t||e||"ltr"}var wx="rovingFocusGroup.onEntryFocus",wR={bubbles:!1,cancelable:!0},pu="RovingFocusGroup",[Ng,Pk,jR]=R0(pu),[kR,Rk]=Oo(pu,[jR]),[SR,CR]=kR(pu),Ok=b.forwardRef((t,e)=>s.jsx(Ng.Provider,{scope:t.__scopeRovingFocusGroup,children:s.jsx(Ng.Slot,{scope:t.__scopeRovingFocusGroup,children:s.jsx(TR,{...t,ref:e})})}));Ok.displayName=pu;var TR=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=Jt(e,x),v=dp(i),[N,w]=yl({prop:o,defaultProp:c??null,onChange:u,caller:pu}),[k,E]=b.useState(!1),C=Co(h),R=Pk(n),O=b.useRef(!1),[q,$]=b.useState(0);return b.useEffect(()=>{const V=x.current;if(V)return V.addEventListener(wx,C),()=>V.removeEventListener(wx,C)},[C]),s.jsx(SR,{scope:n,orientation:r,dir:v,loop:a,currentTabStopId:N,onItemFocus:b.useCallback(V=>w(V),[w]),onItemShiftTab:b.useCallback(()=>E(!0),[]),onFocusableItemAdd:b.useCallback(()=>$(V=>V+1),[]),onFocusableItemRemove:b.useCallback(()=>$(V=>V-1),[]),children:s.jsx(wt.div,{tabIndex:k||q===0?-1:0,"data-orientation":r,...m,ref:y,style:{outline:"none",...t.style},onMouseDown:yt(t.onMouseDown,()=>{O.current=!0}),onFocus:yt(t.onFocus,V=>{const I=!O.current;if(V.target===V.currentTarget&&I&&!k){const te=new CustomEvent(wx,wR);if(V.currentTarget.dispatchEvent(te),!te.defaultPrevented){const Q=R().filter(F=>F.focusable),B=Q.find(F=>F.active),re=Q.find(F=>F.id===N),J=[B,re,...Q].filter(Boolean).map(F=>F.ref.current);_k(J,f)}}O.current=!1}),onBlur:yt(t.onBlur,()=>E(!1))})})}),Lk="RovingFocusGroupItem",Dk=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:i,children:o,...c}=t,u=vo(),h=i||u,f=CR(Lk,n),m=f.currentTabStopId===h,x=Pk(n),{onFocusableItemAdd:y,onFocusableItemRemove:v,currentTabStopId:N}=f;return b.useEffect(()=>{if(r)return y(),()=>v()},[r,y,v]),s.jsx(Ng.ItemSlot,{scope:n,id:h,focusable:r,active:a,children:s.jsx(wt.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...c,ref:e,onMouseDown:yt(t.onMouseDown,w=>{r?f.onItemFocus(h):w.preventDefault()}),onFocus:yt(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:yt(t.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){f.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const k=AR(w,f.orientation,f.dir);if(k!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.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(w.currentTarget);C=f.loop?IR(C,R+1):C.slice(R+1)}setTimeout(()=>_k(C))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:N!=null}):o})})});Dk.displayName=Lk;var ER={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function MR(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function AR(t,e,n){const r=MR(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return ER[r]}function _k(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function IR(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var PR=Ok,RR=Dk,up="Tabs",[OR]=Oo(up,[Rk]),zk=Rk(),[LR,O0]=OR(up),$k=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:i,orientation:o="horizontal",dir:c,activationMode:u="automatic",...h}=t,f=dp(c),[m,x]=yl({prop:r,onChange:a,defaultProp:i??"",caller:up});return s.jsx(LR,{scope:n,baseId:vo(),value:m,onValueChange:x,orientation:o,dir:f,activationMode:u,children:s.jsx(wt.div,{dir:f,"data-orientation":o,...h,ref:e})})});$k.displayName=up;var Fk="TabsList",Bk=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...a}=t,i=O0(Fk,n),o=zk(n);return s.jsx(PR,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:s.jsx(wt.div,{role:"tablist","aria-orientation":i.orientation,...a,ref:e})})});Bk.displayName=Fk;var Vk="TabsTrigger",Hk=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...i}=t,o=O0(Vk,n),c=zk(n),u=Kk(o.baseId,r),h=qk(o.baseId,r),f=r===o.value;return s.jsx(RR,{asChild:!0,...c,focusable:!a,active:f,children:s.jsx(wt.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:yt(t.onMouseDown,m=>{!a&&m.button===0&&m.ctrlKey===!1?o.onValueChange(r):m.preventDefault()}),onKeyDown:yt(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&o.onValueChange(r)}),onFocus:yt(t.onFocus,()=>{const m=o.activationMode!=="manual";!f&&!a&&m&&o.onValueChange(r)})})})});Hk.displayName=Vk;var Uk="TabsContent",Wk=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:a,children:i,...o}=t,c=O0(Uk,n),u=Kk(c.baseId,r),h=qk(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(fu,{present:a||f,children:({present:x})=>s.jsx(wt.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})})});Wk.displayName=Uk;function Kk(t,e){return`${t}-trigger-${e}`}function qk(t,e){return`${t}-content-${e}`}var DR=$k,Gk=Bk,Jk=Hk,Qk=Wk;const Ic=DR,vl=b.forwardRef(({className:t,...e},n)=>s.jsx(Gk,{ref:n,className:Qt("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));vl.displayName=Gk.displayName;const nn=b.forwardRef(({className:t,...e},n)=>s.jsx(Jk,{ref:n,className:Qt("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...e}));nn.displayName=Jk.displayName;const sn=b.forwardRef(({className:t,...e},n)=>s.jsx(Qk,{ref:n,className:Qt("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));sn.displayName=Qk.displayName;function L0(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 D0(t){const[e,n]=b.useState(void 0);return Is(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const i=a[0];let o,c;if("borderBoxSize"in i){const u=i.borderBoxSize,h=Array.isArray(u)?u[0]:u;o=h.inlineSize,c=h.blockSize}else o=t.offsetWidth,c=t.offsetHeight;n({width:o,height:c})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var hp="Switch",[_R]=Oo(hp),[zR,$R]=_R(hp),Yk=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=Jt(e,C=>y(C)),N=b.useRef(!1),w=x?f||!!x.closest("form"):!0,[k,E]=yl({prop:a,defaultProp:i??!1,onChange:h,caller:hp});return s.jsxs(zR,{scope:n,checked:k,disabled:c,children:[s.jsx(wt.button,{type:"button",role:"switch","aria-checked":k,"aria-required":o,"data-state":t2(k),"data-disabled":c?"":void 0,disabled:c,value:u,...m,ref:v,onClick:yt(t.onClick,C=>{E(R=>!R),w&&(N.current=C.isPropagationStopped(),N.current||C.stopPropagation())})}),w&&s.jsx(e2,{control:x,bubbles:!N.current,name:r,value:u,checked:k,required:o,disabled:c,form:f,style:{transform:"translateX(-100%)"}})]})});Yk.displayName=hp;var Xk="SwitchThumb",Zk=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,a=$R(Xk,n);return s.jsx(wt.span,{"data-state":t2(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:e})});Zk.displayName=Xk;var FR="SwitchBubbleInput",e2=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...a},i)=>{const o=b.useRef(null),c=Jt(o,i),u=L0(n),h=D0(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}})});e2.displayName=FR;function t2(t){return t?"checked":"unchecked"}var n2=Yk,BR=Zk;const Ut=b.forwardRef(({className:t,...e},n)=>s.jsx(n2,{className:Qt("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(BR,{className:Qt("pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Ut.displayName=n2.displayName;const VR={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 HR(t){return VR[t]||t||"行为"}function UR(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 _0({open:t,onClose:e,userId:n,onUserUpdated:r}){var Vr,Ls,Ds,or,br,la;const[a,i]=b.useState(null),[o,c]=b.useState([]),[u,h]=b.useState({}),[f,m]=b.useState([]),[x,y]=b.useState(null),[v,N]=b.useState(null),[w,k]=b.useState(!1),[E,C]=b.useState(!1),[R,O]=b.useState(!1),[q,$]=b.useState("info"),[V,I]=b.useState(""),[te,Q]=b.useState(""),[B,re]=b.useState(""),[ae,J]=b.useState([]),[F,D]=b.useState(""),[P,oe]=b.useState(""),[G,_]=b.useState(""),[U,H]=b.useState(!1),[K,me]=b.useState({isVip:!1,vipExpireDate:"",vipRole:"",vipName:"",vipProject:"",vipContact:"",vipBio:""}),[X,le]=b.useState([]),[de,ve]=b.useState(!1),[ye,Se]=b.useState(""),[Fe,mt]=b.useState(""),[kt,ft]=b.useState(!1),[Dt,Pt]=b.useState(!1),[Rn,yn]=b.useState(null),[Wt,Xt]=b.useState(null),[Sn,Fn]=b.useState(""),[Wn,Mt]=b.useState(""),[pn,bn]=b.useState(""),[ge,Ce]=b.useState(!1),[Be,Ze]=b.useState(null),[St,vt]=b.useState(!1),[L,Ie]=b.useState({}),[xt,Rt]=b.useState([]);b.useEffect(()=>{t&&n&&(vt(!1),$("info"),yn(null),Xt(null),Ze(null),oe(""),_(""),at(),Le("/api/db/vip-roles").then(ie=>{ie!=null&&ie.success&&ie.data&&le(ie.data)}).catch(()=>{}))},[t,n]),b.useEffect(()=>{t&&Le("/api/admin/mbti-avatars").then(ie=>{ie!=null&&ie.avatars&&typeof ie.avatars=="object"?Ie(ie.avatars):Ie({})}).catch(()=>Ie({}))},[t]);const pt=(ie,xe)=>{const It=(ie||"").trim();if(It)return So(It);const $t=(xe||"").trim().toUpperCase();return/^[EI][NS][FT][JP]$/.test($t)?(L[$t]||"").trim():""};async function at(){if(n){k(!0);try{const ie=await Le(`/api/db/users?id=${encodeURIComponent(n)}`);if(ie!=null&&ie.success&&ie.user){const xe=ie.user;i(xe),I(xe.phone||""),Q(xe.wechatId||""),re(xe.nickname||""),Fn(xe.phone||""),Mt(xe.wechatId||""),bn(xe.openId||"");try{J(typeof xe.tags=="string"?JSON.parse(xe.tags||"[]"):[])}catch{J([])}me({isVip:!!(xe.isVip??!1),vipExpireDate:xe.vipExpireDate?String(xe.vipExpireDate).slice(0,10):"",vipRole:String(xe.vipRole??""),vipName:String(xe.vipName??""),vipProject:String(xe.vipProject??""),vipContact:String(xe.vipContact??""),vipBio:String(xe.vipBio??"")})}try{const xe=await Le(`/api/admin/user/track?userId=${encodeURIComponent(n)}&limit=100`);if(xe!=null&&xe.success){h(xe.stats&&typeof xe.stats=="object"?xe.stats:{});const It=xe.tracks||[];c(It.map($t=>({...$t,actionLabel:$t.actionLabel||$t.action,timeAgo:$t.timeAgo||""})))}else h({}),c([])}catch{h({}),c([])}try{const xe=await Le(`/api/db/users/referrals?userId=${encodeURIComponent(n)}`);xe!=null&&xe.success?(m(xe.referrals||[]),y(xe.inboundSource||null)):(m([]),y(null))}catch{m([]),y(null)}try{const xe=await Le(`/api/admin/users/${encodeURIComponent(n)}/balance`);xe!=null&&xe.success&&xe.data?N(xe.data):N(null)}catch{N(null)}try{const xe=await Le(`/api/orders?userId=${encodeURIComponent(n)}&status=paid&pageSize=50`);xe!=null&&xe.success&&xe.orders?Rt(xe.orders):Rt([])}catch{Rt([])}}catch(ie){console.error("Load user detail error:",ie)}finally{k(!1)}}}async function At(){if(!(a!=null&&a.phone)){ne.info("用户未绑定手机号,无法同步");return}C(!0);try{const ie=await Et("/api/ckb/sync",{action:"full_sync",phone:a.phone,userId:a.id});ie!=null&&ie.success?(ne.success("同步成功"),at()):ne.error("同步失败: "+(ie==null?void 0:ie.error))}catch(ie){console.error("Sync CKB error:",ie),ne.error("同步失败")}finally{C(!1)}}async function Kt(){if(a){if(K.isVip&&!K.vipExpireDate.trim()){ne.error("开启 VIP 请填写有效到期日");return}O(!0);try{const ie={id:a.id,phone:V.trim()||void 0,wechatId:te.trim(),nickname:B||void 0,tags:JSON.stringify(ae),isVip:K.isVip,vipExpireDate:K.isVip?K.vipExpireDate:void 0,vipRole:K.vipRole||void 0,vipName:K.vipName||void 0,vipProject:K.vipProject||void 0,vipContact:K.vipContact||void 0,vipBio:K.vipBio||void 0},xe=await Zt("/api/db/users",ie);xe!=null&&xe.success?(ne.success("保存成功"),at(),r==null||r()):ne.error("保存失败: "+(xe==null?void 0:xe.error))}catch(ie){console.error("Save user error:",ie),ne.error("保存失败")}finally{O(!1)}}}const en=()=>{F&&!ae.includes(F)&&(J([...ae,F]),D(""))},ls=ie=>J(ae.filter(xe=>xe!==ie));async function Ws(){if(a){if(!P){ne.error("请输入新密码");return}if(P!==G){ne.error("两次密码不一致");return}if(P.length<6){ne.error("密码至少 6 位");return}H(!0);try{const ie=await Zt("/api/db/users",{id:a.id,password:P});ie!=null&&ie.success?(ne.success("修改成功"),oe(""),_("")):ne.error("修改失败: "+((ie==null?void 0:ie.error)||""))}catch{ne.error("修改失败")}finally{H(!1)}}}async function Fr(){if(!a)return;const ie=parseFloat(ye);if(Number.isNaN(ie)||ie===0){ne.error("请输入有效金额(正数增加、负数扣减)");return}ft(!0);try{const xe=await Et(`/api/admin/users/${a.id}/balance/adjust`,{amount:ie,remark:Fe||void 0});xe!=null&&xe.success?(ne.success("余额已调整"),ve(!1),Se(""),mt(""),at(),r==null||r()):ne.error("调整失败: "+((xe==null?void 0:xe.error)||""))}catch{ne.error("调整失败")}finally{ft(!1)}}async function za(){if(!Sn&&!pn&&!Wn){Xt("请至少输入手机号、微信号或 OpenID 中的一项");return}Pt(!0),Xt(null),yn(null);try{const ie=new URLSearchParams;Sn&&ie.set("phone",Sn),pn&&ie.set("openId",pn),Wn&&ie.set("wechatId",Wn);const xe=await Le(`/api/admin/shensheshou/query?${ie}`);xe!=null&&xe.success&&xe.data?(yn(xe.data),a&&await $a(xe.data)):Xt((xe==null?void 0:xe.error)||"未查询到数据,该用户可能未在神射手收录")}catch(ie){console.error("SSS query error:",ie),Xt("请求失败,请检查神射手接口配置")}finally{Pt(!1)}}async function $a(ie){if(a)try{await Et("/api/admin/shensheshou/enrich",{userId:a.id,phone:Sn||a.phone||"",openId:pn||a.openId||"",wechatId:Wn||a.wechatId||""}),at()}catch(xe){console.error("SSS enrich error:",xe)}}async function Fa(){if(a){Ce(!0),Ze(null);try{const ie=Array.from(new Set(o.filter(Xn=>Xn.action==="view_chapter"||Xn.action==="purchase"||Xn.action==="first_pay").map(Xn=>(Xn.chapterTitle||Xn.target||"").trim()).filter(Boolean))).slice(0,12),xe={viewChapter:u.view_chapter||0,purchase:u.purchase||0,firstPay:u.first_pay||0},It=ie.length>0?`意向章节:${ie.join("、")}`:"",$t={users:[{phone:a.phone||"",name:a.nickname||"",openId:a.openId||"",tags:ae,purchaseIntent:xe,purchaseIntentChapters:ie,remark:It}]},Yn=await Et("/api/admin/shensheshou/ingest",$t);Yn!=null&&Yn.success&&Yn.data?Ze(Yn.data):Ze({error:(Yn==null?void 0:Yn.error)||"推送失败"})}catch(ie){console.error("SSS ingest error:",ie),Ze({error:"请求失败"})}finally{Ce(!1)}}}const oa=ie=>{const It={view_chapter:rr,purchase:Ld,match:_n,login:xi,register:xi,share:Ea,bind_phone:m1,bind_wechat:jM,fill_profile:Dd,fill_avatar:xi,visit_page:ea,first_pay:Ld,vip_activate:wc,click_super:_n,lead_submit:m1,withdraw:mg,referral_bind:Ea,card_click:xi,btn_click:ji,tab_click:ea,nav_click:ea,page_view:ea,search:ea}[ie]||hg;return s.jsx(It,{className:"w-4 h-4"})};function Br(ie){const xe=String(ie||"").trim();return xe.length>22&&/^[a-zA-Z0-9_-]+$/.test(xe)}const yr=b.useMemo(()=>UR(u,a),[u,a]);function ir(){const ie=[...ae];for(const xe of yr)ie.includes(xe)||ie.push(xe);J(ie),ne.success("已将旅程推断标签合并到已选")}return t?s.jsxs(s.Fragment,{children:[s.jsx(Bt,{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(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(xi,{className:"w-5 h-5 text-[#38bdac]"}),"用户详情",(a==null?void 0:a.phone)&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0 ml-2",children:"已绑定手机"}),(a==null?void 0:a.isVip)&&s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 border-0",children:"VIP"})]})}),w?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:pt(a.avatar,a.mbti)&&!St?s.jsx("img",{src:pt(a.avatar,a.mbti),className:"w-full h-full rounded-full object-cover",alt:"",onError:()=>vt(!0)}):((Vr=a.nickname)==null?void 0:Vr.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(Ue,{className:"bg-purple-500/20 text-purple-400 border-0 text-[10px] py-0",children:"管理员"}),a.hasFullBook&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0 text-[10px] py-0",children:"全书已购"}),a.vipRole&&s.jsx(Ue,{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:B||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:V||"—"})]}),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:te||"—"})]}),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(Y,{type:"button",size:"sm",variant:"ghost",className:"h-5 px-1 text-[9px] text-[#38bdac] hover:bg-[#38bdac]/10",onClick:()=>{Se(""),mt(""),ve(!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(Ic,{value:q,onValueChange:$,className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[s.jsxs(vl,{className:"bg-[#0a1628] border border-gray-700/50 p-0.5 mb-2 flex-wrap h-auto gap-0.5 shrink-0",children:[s.jsx(nn,{value:"info",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-[11px] px-2 py-1 h-7",children:"用户信息"}),s.jsxs(nn,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-[11px] px-2 py-1 h-7",children:[s.jsx(ea,{className:"w-3 h-3 mr-0.5"}),"旅程与轨迹"]}),s.jsx(nn,{value:"relations",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-[11px] px-2 py-1 h-7",children:"关系链路"}),s.jsx(nn,{value:"tags",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-[11px] px-2 py-1 h-7",children:"标签体系"})]}),s.jsxs(sn,{value:"info",className:"flex-1 min-h-0 overflow-y-auto space-y-2 pr-0.5",children:[s.jsxs("details",{className:"rounded-lg bg-[#0a1628] border border-gray-700/40 p-2 text-[11px] group",children:[s.jsxs("summary",{className:"cursor-pointer text-gray-400 select-none list-none flex items-center gap-1",children:[s.jsx("span",{className:"group-open:text-[#38bdac]",children:"技术标识"}),s.jsx("span",{className:"text-gray-600",children:"(用户ID / OpenID,默认折叠)"})]}),s.jsxs("div",{className:"mt-2 space-y-1.5 text-gray-300 font-mono text-[10px] break-all border-t border-gray-700/30 pt-2",children:[s.jsxs("p",{children:[s.jsx("span",{className:"text-gray-500 not-italic font-sans",children:"用户ID"})," ",a.id]}),s.jsxs("p",{children:[s.jsx("span",{className:"text-gray-500 not-italic font-sans",children:"OpenID"})," ",a.openId||"—"]}),s.jsx("p",{className:"text-gray-500 not-italic font-sans leading-snug",children:"OpenID 为微信用户标识;下方「微信标识」为微信号/wxid,供存客宝归属,与 OpenID 不同。"})]})]}),s.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{className:"text-gray-400 text-[11px]",children:"昵称"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"昵称",value:B,onChange:ie=>re(ie.target.value)})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{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:V,onChange:ie=>I(ie.target.value)})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{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:te,onChange:ie=>Q(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(Lj,{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(wc,{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(Ue,{className:"bg-amber-500/20 text-amber-400 border-0 text-[10px] py-0 shrink-0",children:a.vipRole||"VIP"})]}),s.jsx(Ut,{className:"scale-90",checked:K.isVip,onCheckedChange:ie=>me(xe=>({...xe,isVip:ie}))})]}),K.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(ee,{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:K.vipExpireDate,onChange:ie=>me(xe=>({...xe,vipExpireDate:ie.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ee,{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:K.vipRole,onChange:ie=>me(xe=>({...xe,vipRole:ie.target.value})),children:[s.jsx("option",{value:"",children:"请选择"}),X.map(ie=>s.jsx("option",{value:ie.name,children:ie.name},ie.id))]})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ee,{className:"text-gray-500 text-[10px]",children:"展示名"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"展示名",value:K.vipName,onChange:ie=>me(xe=>({...xe,vipName:ie.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ee,{className:"text-gray-500 text-[10px]",children:"项目"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"项目",value:K.vipProject,onChange:ie=>me(xe=>({...xe,vipProject:ie.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(ee,{className:"text-gray-500 text-[10px]",children:"联系方式"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"微信/手机",value:K.vipContact,onChange:ie=>me(xe=>({...xe,vipContact:ie.target.value}))})]}),s.jsxs("div",{className:"space-y-0.5 sm:col-span-2",children:[s.jsx(ee,{className:"text-gray-500 text-[10px]",children:"简介"}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"简短介绍",value:K.vipBio,onChange:ie=>me(xe=>({...xe,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(ji,{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:Sn,onChange:ie=>Fn(ie.target.value)}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:微信号",value:Wn,onChange:ie=>Mt(ie.target.value)}),s.jsx(ce,{className:"bg-[#162840] border-gray-700 text-white h-7 text-xs",placeholder:"查:OpenID",value:pn,onChange:ie=>bn(ie.target.value)})]}),s.jsxs("div",{className:"flex flex-wrap gap-1",children:[s.jsxs(Y,{size:"sm",className:"h-7 text-[11px] px-2 bg-[#38bdac] hover:bg-[#2da396]",onClick:za,disabled:Dt,children:[Dt?s.jsx(Ve,{className:"w-3 h-3 animate-spin"}):s.jsx(Aa,{className:"w-3 h-3 mr-0.5"}),"查询回填"]}),s.jsx(Y,{size:"sm",variant:"outline",className:"h-7 text-[11px] px-2 border-purple-500/40 text-purple-300",onClick:Fa,disabled:ge||!a.phone,children:ge?"推送…":"推神射手"}),s.jsx(Y,{size:"sm",variant:"outline",className:"h-7 text-[11px] px-2",onClick:At,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()]}),Wt&&s.jsx("p",{className:"mt-1 text-red-400 text-[11px]",children:Wt}),Rn&&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:Rn.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:Rn.user_level??"—"})]})]}),Be&&s.jsx("p",{className:"mt-1 text-[11px]",children:Be.error?s.jsx("span",{className:"text-red-400",children:String(Be.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(mg,{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:P,onChange:ie=>oe(ie.target.value)}),s.jsx(ce,{type:"password",className:"bg-[#162840] border-gray-700 text-white h-7 text-xs flex-1",placeholder:"确认密码",value:G,onChange:ie=>_(ie.target.value)}),s.jsx(Y,{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:Ws,disabled:U||!P||!G,children:U?"保存中":"确认修改"})]})]})]}),s.jsxs(sn,{value:"journey",className:"flex-1 min-h-0 overflow-y-auto space-y-2 pr-0.5",children:[xt.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(Ld,{className:"w-3.5 h-3.5 text-amber-400"}),s.jsxs("span",{className:"text-white text-xs font-medium",children:["购买清单(",xt.length," 笔)"]})]}),s.jsx("div",{className:"space-y-1 max-h-[120px] overflow-y-auto",children:xt.map((ie,xe)=>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||xe))})]}),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(ea,{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,xe)=>xe[1]-ie[1]).map(([ie,xe])=>s.jsxs(Ue,{variant:"outline",className:"text-[10px] border-gray-600 text-gray-300 bg-[#162840] py-0 h-5",children:[HR(ie)," ×",xe]},ie))})]}),s.jsx("div",{className:"space-y-1.5",children:o.length>0?o.map((ie,xe)=>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:oa(ie.action)}),xe0?((x==null?void 0:x.visits)||[]).map((ie,xe)=>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||xe+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"}_${xe}`)):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(Ea,{className:"w-3.5 h-3.5 text-[#38bdac]"}),s.jsx("span",{className:"text-white text-sm font-medium",children:"推荐的用户"})]}),s.jsxs(Ue,{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,xe)=>{var $t;const It=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:(($t=It.nickname)==null?void 0:$t.charAt(0))||"?"}),s.jsx("span",{className:"text-white truncate",children:It.nickname})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[It.status==="vip"&&s.jsx(Ue,{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:It.createdAt?new Date(It.createdAt).toLocaleDateString():""})]})]},It.id||xe)}):s.jsx("p",{className:"text-gray-500 text-sm text-center py-3",children:"暂无推荐用户"})})]})]}),s.jsxs(sn,{value:"tags",className:"flex-1 min-h-0 overflow-y-auto space-y-3 pr-0.5",children:[s.jsxs("div",{className:"p-2.5 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2 flex-wrap",children:[s.jsx(Dd,{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(Ej,{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(Y,{type:"button",size:"sm",variant:"outline",className:"h-7 text-[11px] border-cyan-500/40 text-cyan-200 hover:bg-cyan-500/10",disabled:yr.length===0,onClick:ir,children:"合并到已选"})]}),yr.length>0?s.jsx("div",{className:"flex flex-wrap gap-1",children:yr.map(ie=>s.jsxs(Ue,{variant:"outline",className:`text-[10px] py-0 h-5 border-cyan-500/30 ${ae.includes(ie)?"bg-cyan-500/15 text-cyan-200":"text-gray-300"}`,children:[ae.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(xe=>s.jsxs("button",{type:"button",onClick:()=>{ae.includes(xe)?ls(xe):J([...ae,xe])},className:`px-1.5 py-0.5 rounded text-[11px] border transition-all ${ae.includes(xe)?"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(xe)?"✓ ":"",xe]},xe))})]},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:[ae.map((ie,xe)=>s.jsxs(Ue,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0 pr-1 text-[11px] py-0",children:[ie,s.jsx("button",{type:"button",onClick:()=>ls(ie),className:"ml-1 hover:text-red-400",children:s.jsx(ss,{className:"w-3 h-3"})})]},xe)),ae.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:F,onChange:ie=>D(ie.target.value),onKeyDown:ie=>ie.key==="Enter"&&en()}),s.jsx(Y,{onClick:en,className:"bg-[#38bdac] hover:bg-[#2da396] h-8 text-xs px-3",children:"添加"})]})]})]}),(()=>{const ie=a.tags||a.ckbTags||"";let xe=[];try{const $t=typeof ie=="string"?JSON.parse(ie||"[]"):[];xe=Array.isArray($t)?$t:typeof ie=="string"?ie.split(","):[]}catch{xe=typeof ie=="string"?ie.split(","):[]}const It=xe.map($t=>String($t).trim()).filter(Boolean);return It.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(Dd,{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:It.map(($t,Yn)=>s.jsx(Ue,{className:"bg-purple-500/20 text-purple-400 border-0 text-[11px] py-0",children:$t},Yn))})]})})()]})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-3 border-t border-gray-700 mt-3 shrink-0",children:[s.jsxs(Y,{variant:"outline",onClick:e,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(ss,{className:"w-4 h-4 mr-2"}),"关闭"]}),s.jsxs(Y,{onClick:Kt,disabled:R,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(kn,{className:"w-4 h-4 mr-2"}),R?"保存中...":"保存修改"]})]})]}):s.jsx("div",{className:"text-center py-12 text-gray-500",children:"用户不存在"})]})}),s.jsx(Bt,{open:de,onOpenChange:ve,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsx(Vt,{children:s.jsx(Ht,{children:"调整余额"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{children:[s.jsx(ee,{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:ye,onChange:ie=>Se(ie.target.value)})]}),s.jsxs("div",{children:[s.jsx(ee,{className:"text-gray-300 text-sm",children:"备注(可选)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white mt-1",placeholder:"如:活动补偿",value:Fe,onChange:ie=>mt(ie.target.value)})]})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(Y,{variant:"outline",onClick:()=>ve(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(Y,{onClick:Fr,disabled:kt,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:kt?"提交中...":"确认调整"})]})]})})]}):null}function WR(){const t=La(),[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),[N,w]=b.useState(0),[k,E]=b.useState(0),[C,R]=b.useState(null),[O,q]=b.useState(null),[$,V]=b.useState(!1),[I,te]=b.useState(0),[Q,B]=b.useState(!1),[re,ae]=b.useState(null),[J,F]=b.useState("overview"),[D,P]=b.useState([]),[oe,G]=b.useState(!1),[_,U]=b.useState("today"),[H,K]=b.useState(null),[me,X]=b.useState(!1),[le,de]=b.useState(!0),[ve,ye]=b.useState(null),[Se,Fe]=b.useState(null),[mt,kt]=b.useState([]),ft=ge=>{const Ce=ge;if((Ce==null?void 0:Ce.status)===401)R("登录已过期,请重新登录");else{if((Ce==null?void 0:Ce.name)==="AbortError")return;R("加载失败,请检查网络或联系管理员")}};async function Dt(ge){var St,vt;const Ce=ge?{signal:ge}:void 0;n(!0),R(null);try{const L=await Le("/api/admin/dashboard/stats",Ce);L!=null&&L.success&&(x(L.totalUsers??0),v(L.paidOrderCount??0),w(L.totalRevenue??0),E(L.conversionRate??0))}catch(L){if((L==null?void 0:L.name)!=="AbortError"){console.error("stats 失败,尝试 overview 降级",L);try{const Ie=await Le("/api/admin/dashboard/overview",Ce);Ie!=null&&Ie.success&&(x(Ie.totalUsers??0),v(Ie.paidOrderCount??0),w(Ie.totalRevenue??0),E(Ie.conversionRate??0))}catch(Ie){ft(Ie)}}}finally{n(!1)}try{const L=await Le("/api/admin/balance/summary",Ce);L!=null&&L.success&&L.data&&te(L.data.totalGifted??0)}catch{}try{const L=await Le("/api/db/ckb-plan-stats",Ce);L!=null&&L.success&&L.data?ae({ckbTotal:L.data.ckbTotal??0,withContact:L.data.withContact??0}):ae(null)}catch{ae(null)}de(!0);try{const[L,Ie]=await Promise.allSettled([Le("/api/db/match-records?stats=true",Ce),Le("/api/admin/distribution/overview",Ce)]);L.status==="fulfilled"&&((St=L.value)!=null&&St.success)&&L.value.data?ye({totalMatches:L.value.data.totalMatches??0,todayMatches:L.value.data.todayMatches??0,uniqueUsers:L.value.data.uniqueUsers??0,paidMatchCount:L.value.data.paidMatchCount??0}):ye(null),Ie.status==="fulfilled"&&((vt=Ie.value)!=null&&vt.success)&&Ie.value.overview?Fe({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}):Fe(null)}catch{ye(null),Fe(null)}finally{de(!1)}try{const L=await Le("/api/db/vip-members?limit=500",Ce);L!=null&&L.success&&Array.isArray(L.data)?kt(L.data):kt([])}catch{kt([])}a(!0),o(!0);const Be=async()=>{try{const L=await Le("/api/admin/dashboard/recent-orders?limit=10",Ce);if(L!=null&&L.success&&L.recentOrders)f(L.recentOrders);else throw new Error("no data")}catch(L){if((L==null?void 0:L.name)!=="AbortError")try{const Ie=await Le("/api/admin/orders?page=1&pageSize=20&status=paid",Ce),Rt=((Ie==null?void 0:Ie.orders)??[]).filter(pt=>["paid","completed","success"].includes(pt.status||""));f(Rt.slice(0,5))}catch{f([])}}finally{a(!1)}},Ze=async()=>{try{const L=await Le("/api/admin/dashboard/new-users",Ce);if(L!=null&&L.success&&L.newUsers)u(L.newUsers);else throw new Error("no data")}catch(L){if((L==null?void 0:L.name)!=="AbortError")try{const Ie=await Le("/api/db/users?page=1&pageSize=10",Ce);u((Ie==null?void 0:Ie.users)??[])}catch{u([])}}finally{o(!1)}};await Promise.all([Be(),Ze()])}async function Pt(ge){const Ce=ge||_;X(!0);try{const Be=await Le(`/api/admin/track/stats?period=${Ce}`);Be!=null&&Be.success&&K({total:Be.total??0,byModule:Be.byModule??{}})}catch{K(null)}finally{X(!1)}}const Rn={home:"首页",chapters:"目录",read:"阅读页",my:"我的",vip:"超级个体",wallet:"钱包",match:"找伙伴",referral:"推广中心",search:"搜索",settings:"设置",about:"关于",member_detail:"成员详情",other:"其他"},yn={btn_click:"按钮点击",nav_click:"导航点击",card_click:"卡片点击",tab_click:"标签切换",page_view:"页面浏览",share:"分享",purchase:"购买",register:"注册",rule_trigger:"规则触发",view_chapter:"浏览章节",link_click:"链接点击"},Wt=ge=>ge?ge.replace(/^part-/,"").replace(/^soulvip_/,"").replace(/^super_?/,"").replace(/^user_/,"").replace(/[_-]+/g," ").trim():"",Xt=ge=>{if(!ge)return"";const Ce=ge.trim().toLowerCase();if(!Ce)return"";const Be=mt.find(St=>{const vt=String(St.id||"").toLowerCase();return vt===Ce||vt.includes(Ce)||Ce.includes(vt)});if(Be)return Be.name||Be.nickname||"";const Ze=mt.find(St=>{const vt=String(St.token||"").toLowerCase();return vt&&(vt===Ce||vt.includes(Ce)||Ce.includes(vt))});return Ze&&(Ze.name||Ze.nickname)||""},Sn=ge=>{if(!ge)return"未命名点击";const Ce=ge.trim(),Be=Ce.toLowerCase();if(/^链接头像[_-]/.test(Ce)){const St=Wt(Ce.replace(/^链接头像[_-]/,""));return St?`头像:${St}`:"头像点击"}if(/^member[_-]?detail$/i.test(Be)||Be.includes("member detail"))return"成员详情";if(/^giftpay$/i.test(Be)||Be.includes("gift pay"))return"代付入口";if(/^part[-_]/i.test(Be))return`章节:${Wt(Ce)}`;if(Be.includes("soulvip")||Be.includes("super")){const St=Ce.replace(/^超级个体[::]?/i,"").replace(/^super[_-]?/i,"").replace(/^soulvip[_-]?/i,"").replace(/^user[_-]?/i,"").trim(),vt=Xt(St)||Xt(Wt(St));return vt?`超级个体:${vt}`:`超级个体:${Wt(St)}`}if(Be.includes("qgdtw")||Be.includes("token")||Be.includes("0000"))return`对象:${Wt(Ce)}`;const Ze={开始匹配:"开始匹配",mentor:"导师顾问",team:"团队招募",investor:"资源对接",充值:"充值",退款:"退款",wallet:"钱包",设置:"设置",VIP:"VIP会员",推广:"推广中心",目录:"目录",搜索:"搜索",匹配:"找伙伴",settings:"设置",expired:"已过期",active:"活跃",converted:"已转化",fill_profile:"完善资料",register:"注册",purchase:"购买",链接卡若:"链接卡若",更多分享:"更多分享",分享朋友圈文案:"分享朋友圈",选择金额10:"选择金额10元",member_detail:"成员详情",giftPay:"代付入口"};return Ze[Ce]?Ze[Ce]:/^[a-z0-9_-]+$/i.test(Ce)&&Wt(Ce)||Ce},Fn=ge=>{const Ce=Rn[ge.module]||Rn[ge.page]||ge.module||ge.page||"其他",Be=yn[ge.action]||ge.action||"点击",Ze=Sn(ge.target);return`${Ce} · ${Be} · ${Ze}`};async function Wn(){G(!0);try{const ge=await Le("/api/admin/super-individual/stats");ge!=null&&ge.success&&Array.isArray(ge.data)&&P(ge.data)}catch{}finally{G(!1)}}b.useEffect(()=>{const ge=new AbortController;return Dt(ge.signal),Pt(),Wn(),()=>{ge.abort()}},[]);const Mt=m,pn=ge=>{const Ce=ge.productType||"",Be=ge.description||"";if(Ce==="balance_recharge")return{title:`余额充值 ¥${typeof ge.amount=="number"?ge.amount.toFixed(2):parseFloat(String(ge.amount||"0")).toFixed(2)}`,subtitle:"余额充值"};if(Ce==="gift_pay")return{title:`代付 ¥${typeof ge.amount=="number"?ge.amount.toFixed(2):parseFloat(String(ge.amount||"0")).toFixed(2)}`,subtitle:"好友代付"};if(Ce==="gift_pay_batch"){const Ze=typeof ge.amount=="number"?ge.amount.toFixed(2):parseFloat(String(ge.amount||"0")).toFixed(2);return{title:Be||`代付分享 ¥${Ze}`,subtitle:"代付分享"}}if(Ce==="section"&&Be.includes("代付领取"))return{title:Be.replace("代付领取 - ",""),subtitle:"代付领取"};if(Be){if(Ce==="section"&&Be.includes("章节")){if(Be.includes("-")){const Ze=Be.split("-");if(Ze.length>=3)return{title:`第${Ze[1]}章 第${Ze[2]}节`,subtitle:"《一场Soul的创业实验》"}}return{title:Be,subtitle:"章节购买"}}return Ce==="fullbook"||Be.includes("全书")?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:Ce==="vip"||Be.includes("VIP")?{title:"超级个体开通费用",subtitle:"超级个体"}:Ce==="match"||Be.includes("伙伴")?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:Be,subtitle:Ce==="section"?"单章":Ce==="fullbook"?"全书":"其他"}}return Ce==="section"?{title:`章节 ${ge.productId||""}`,subtitle:"单章购买"}:Ce==="fullbook"?{title:"《一场Soul的创业实验》",subtitle:"全书购买"}:Ce==="vip"?{title:"超级个体开通费用",subtitle:"超级个体"}:Ce==="match"?{title:"找伙伴匹配",subtitle:"功能服务"}:{title:"未知商品",subtitle:Ce||"其他"}},bn=[{title:"总用户数",value:e?null:Mt,sub:null,icon:_n,color:"text-blue-400",bg:"bg-blue-500/20",link:"/users"},{title:"总收入",value:e?null:`¥${(N??0).toFixed(2)}`,sub:I>0?`含代付 ¥${I.toFixed(2)}`:null,icon:tf,color:"text-[#38bdac]",bg:"bg-[#38bdac]/20",link:"/orders"},{title:"订单数",value:e?null:y,sub:null,icon:Ld,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:rr,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:vc,color:"text-cyan-400",bg:"bg-cyan-500/20",link:"/users?tab=leads"},{title:"伙伴&推广协同",value:le?null:((ve==null?void 0:ve.totalMatches)??0)+((Se==null?void 0:Se.totalClicks)??0),sub:le?null:`找伙伴 ${(ve==null?void 0:ve.totalMatches)??0} / 推广 ${(Se==null?void 0:Se.totalClicks)??0}`,icon:hc,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:bn.map((ge,Ce)=>s.jsxs(De,{className:"min-w-[220px] flex-1 bg-[#0f2137] border-gray-700/50 shadow-xl cursor-pointer hover:border-[#38bdac]/50 transition-colors group",onClick:()=>ge.link&&t(ge.link),children:[s.jsxs(it,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsx(ot,{className:"text-sm font-medium text-gray-400",children:ge.title}),s.jsx("div",{className:`p-2 rounded-lg ${ge.bg}`,children:s.jsx(ge.icon,{className:`w-4 h-4 ${ge.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:ge.value!=null?ge.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"}),"加载中"]})}),ge.sub&&s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:ge.sub})]}),s.jsx(ol,{className:"w-5 h-5 text-gray-600 group-hover:text-[#38bdac] transition-colors"})]})})]},Ce))}),s.jsxs("div",{className:"flex gap-2 mb-6 mt-2",children:[s.jsx("button",{type:"button",onClick:()=>F("overview"),className:`px-5 py-2 rounded-lg text-sm font-medium transition-colors ${J==="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:()=>F("tags"),className:`px-5 py-2 rounded-lg text-sm font-medium transition-colors ${J==="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:()=>F("super"),className:`px-5 py-2 rounded-lg text-sm font-medium transition-colors ${J==="super"?"bg-[#38bdac] text-white":"bg-[#0f2137] text-gray-400 hover:text-white hover:bg-gray-700/50 border border-gray-700/50"}`,children:"超级个体统计"})]}),J==="overview"&&s.jsxs("div",{className:"space-y-8",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{className:"flex flex-row items-center justify-between",children:[s.jsx(ot,{className:"text-white",children:"找伙伴 × 推广中心(共统计)"}),s.jsxs("button",{type:"button",onClick:()=>Dt(),disabled:le,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 ${le?"animate-spin":""}`}),"刷新"]})]}),s.jsxs(_e,{children:[le&&!ve&&!Se?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:(ve==null?void 0:ve.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:(ve==null?void 0:ve.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:(ve==null?void 0:ve.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:(Se==null?void 0:Se.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:(Se==null?void 0:Se.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:(Se==null?void 0:Se.totalConversions)??0})]})]}),(Se==null?void 0:Se.conversionRate)&&s.jsxs("p",{className:"text-xs text-gray-500 mt-3",children:["推广转化率:",Se.conversionRate]})]})]}),s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{className:"flex flex-row items-center justify-between",children:[s.jsx(ot,{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,Q?10:4).map(ge=>{var vt;const Ce=ge.referrerId?c.find(L=>L.id===ge.referrerId):void 0,Be=ge.referralCode||(Ce==null?void 0:Ce.referralCode)||(Ce==null?void 0:Ce.nickname)||(ge.referrerId?String(ge.referrerId).slice(0,8):""),Ze=pn(ge),St=ge.userNickname||((vt=c.find(L=>L.id===ge.userId))==null?void 0:vt.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:[ge.userAvatar?s.jsx("img",{src:ge.userAvatar,alt:St,className:"w-9 h-9 rounded-full object-cover shrink-0 mt-0.5",onError:L=>{L.currentTarget.style.display="none";const Ie=L.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 ${ge.userAvatar?"hidden":""}`,children:St.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:()=>{ge.userId&&(q(ge.userId),V(!0))},className:"text-sm text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:St}),s.jsx("span",{className:"text-gray-600",children:"·"}),s.jsx("span",{className:"text-sm font-medium text-white truncate",title:Ze.title,children:Ze.title})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[Ze.subtitle&&Ze.subtitle!=="章节购买"&&s.jsx("span",{className:"px-1.5 py-0.5 bg-gray-700/50 rounded",children:Ze.subtitle}),s.jsx("span",{children:new Date(ge.createdAt||0).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})})]}),Be&&s.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["推荐: ",Be]})]})]}),s.jsxs("div",{className:"text-right ml-4 shrink-0",children:[s.jsxs("p",{className:"text-sm font-bold text-[#38bdac]",children:["+¥",Number(ge.amount).toFixed(2)]}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:ge.paymentMethod||"微信"})]})]},ge.id)}),h.length>4&&!Q&&s.jsx("button",{type:"button",onClick:()=>B(!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(Ld,{className:"w-12 h-12 text-gray-600 mx-auto mb-3"}),s.jsx("p",{className:"text-gray-500",children:"暂无订单数据"})]})]})})})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(it,{children:s.jsx(ot,{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(ge=>{var Ce;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:((Ce=ge.nickname)==null?void 0:Ce.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("button",{type:"button",onClick:()=>{q(ge.id),V(!0)},className:"text-sm font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left",children:ge.nickname||"匿名用户"}),s.jsx("p",{className:"text-xs text-gray-500",children:ge.phone||"未绑定手机"})]})]}),s.jsx("p",{className:"text-xs text-gray-400",children:ge.createdAt?new Date(ge.createdAt).toLocaleDateString():"-"})]},ge.id)}),c.length===0&&!i&&s.jsx("p",{className:"text-gray-500 text-center py-8",children:"暂无用户数据"})]})})})]})]})]}),J==="tags"&&s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{className:"flex flex-row items-center justify-between",children:[s.jsxs(ot,{className:"text-white flex items-center gap-2",children:[s.jsx(hc,{className:"w-5 h-5 text-[#38bdac]"}),"分类标签点击统计"]}),s.jsx("div",{className:"flex items-center gap-2",children:["today","week","month","all"].map(ge=>s.jsx("button",{type:"button",onClick:()=>{U(ge),Pt(ge)},className:`px-3 py-1 text-xs rounded-full transition-colors ${_===ge?"bg-[#38bdac] text-white":"bg-gray-700/50 text-gray-400 hover:bg-gray-700"}`,children:{today:"今日",week:"本周",month:"本月",all:"全部"}[ge]},ge))})]}),s.jsx(_e,{children:me&&!H?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:"加载中..."})]}):H&&Object.keys(H.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:H.total})," 次"]}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Object.entries(H.byModule).sort((ge,Ce)=>Ce[1].reduce((Be,Ze)=>Be+Ze.count,0)-ge[1].reduce((Be,Ze)=>Be+Ze.count,0)).slice(0,5).map(([ge,Ce])=>{const Be=Ce.reduce((Ze,St)=>Ze+St.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:Rn[ge]||ge}),s.jsxs("span",{className:"text-xs text-gray-500",children:[Be," 次"]})]}),s.jsx("div",{className:"space-y-2",children:Ce.sort((Ze,St)=>St.count-Ze.count).slice(0,8).map((Ze,St)=>{const vt=Fn(Ze);return s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-gray-300 truncate mr-2",title:vt,children:vt}),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:`${Be>0?Ze.count/Be*100:0}%`}})}),s.jsx("span",{className:"text-gray-400 w-8 text-right",children:Ze.count})]})]},St)})})]},ge)})})]}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(hc,{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:"小程序端接入埋点后,数据将在此实时展示"})]})})]}),J==="super"&&s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{className:"flex flex-row items-center justify-between",children:[s.jsxs(ot,{className:"text-white flex items-center gap-2",children:[s.jsx(hc,{className:"w-5 h-5 text-amber-400"}),"超级个体点击统计"]}),s.jsxs(Y,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-300 h-8",onClick:Wn,disabled:oe,children:[s.jsx(Ve,{className:`w-3.5 h-3.5 mr-1 ${oe?"animate-spin":""}`}),"刷新"]})]}),s.jsx(_e,{children:oe&&D.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:"加载中..."})]}):D.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:D.map((ge,Ce)=>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:Ce+1}),s.jsx("td",{className:"py-2 px-3",children:s.jsxs("div",{className:"flex items-center gap-2",children:[ge.avatar?s.jsx("img",{src:ge.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(ge.nickname||ge.userId)}`),title:"点击跳转用户管理",children:ge.nickname||ge.userId})]})}),s.jsx("td",{className:"py-2 px-3 text-center text-white font-bold",children:ge.clicks}),s.jsx("td",{className:"py-2 px-3 text-center text-[#38bdac]",children:ge.uniqueClicks}),s.jsx("td",{className:"py-2 px-3 text-center text-gray-400",children:ge.uniqueClicks>0?(ge.clicks/ge.uniqueClicks).toFixed(1):"-"}),s.jsx("td",{className:"py-2 px-3 text-center text-green-400 text-xs font-medium",children:typeof ge.leadCount=="number"?ge.leadCount:0}),s.jsx("td",{className:"py-2 px-3 text-gray-400 text-xs",children:ge.phone||"-"})]},ge.userId))})]})}):s.jsxs("div",{className:"text-center py-12",children:[s.jsx(hc,{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(_0,{open:$,onClose:()=>{V(!1),q(null)},userId:O,onUserUpdated:()=>Dt()})]})}const gs=b.forwardRef(({className:t,...e},n)=>s.jsx("div",{className:"relative w-full overflow-auto",children:s.jsx("table",{ref:n,className:Qt("w-full caption-bottom text-sm",t),...e})}));gs.displayName="Table";const ys=b.forwardRef(({className:t,...e},n)=>s.jsx("thead",{ref:n,className:Qt("[&_tr]:border-b",t),...e}));ys.displayName="TableHeader";const bs=b.forwardRef(({className:t,...e},n)=>s.jsx("tbody",{ref:n,className:Qt("[&_tr:last-child]:border-0",t),...e}));bs.displayName="TableBody";const ht=b.forwardRef(({className:t,...e},n)=>s.jsx("tr",{ref:n,className:Qt("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));ht.displayName="TableRow";const ke=b.forwardRef(({className:t,...e},n)=>s.jsx("th",{ref:n,className:Qt("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));ke.displayName="TableHead";const be=b.forwardRef(({className:t,...e},n)=>s.jsx("td",{ref:n,className:Qt("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));be.displayName="TableCell";function lf(t,e){const[n,r]=b.useState(t);return b.useEffect(()=>{const a=setTimeout(()=>r(t),e);return()=>clearTimeout(a)},[t,e]),n}function sr({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 KR(){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,N]=b.useState(""),w=lf(v,300),[k,E]=b.useState("all"),[C,R]=b.useState(!0),[O,q]=b.useState(null),[$,V]=b.useState(null),[I,te]=b.useState(""),[Q,B]=b.useState(!1);async function re(){R(!0),q(null);try{const G=k==="all"?"":k==="completed"?"completed":k,_=new URLSearchParams({page:String(f),pageSize:String(x),...G&&{status:G},...w&&{search:w}}),[U,H]=await Promise.all([Le(`/api/admin/orders?${_}`),Le("/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)),H!=null&&H.success&&H.users&&r(H.users)}catch(G){console.error("加载订单失败",G),q("加载订单失败,请检查网络后重试")}finally{R(!1)}}b.useEffect(()=>{m(1)},[w,k]),b.useEffect(()=>{re()},[f,x,w,k]);const ae=G=>{var _;return G.userNickname||((_=n.find(U=>U.id===G.userId))==null?void 0:_.nickname)||"匿名用户"},J=G=>{var _;return((_=n.find(U=>U.id===G))==null?void 0:_.phone)||"-"},F=G=>{const _=G.productType||G.type||"",U=G.description||"";if(_==="balance_recharge")return{name:`余额充值 ¥${Number(G.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 H=U.split("-");if(H.length>=3)return{name:`第${H[1]}章 第${H[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:`章节 ${G.productId||G.sectionId||""}`,type:"单章"}:_==="fullbook"?{name:"《一场Soul的创业实验》",type:"全书"}:_==="vip"?{name:"超级个体开通费用",type:"超级个体"}:_==="match"?{name:"找伙伴匹配",type:"功能"}:{name:"未知商品",type:_||"其他"}},D=Math.ceil(a/x)||1;async function P(){var G;if(!(!($!=null&&$.orderSn)&&!($!=null&&$.id))){B(!0),q(null);try{const _=await Zt("/api/admin/orders/refund",{orderSn:$.orderSn||$.id,reason:I||void 0});_!=null&&_.success?(V(null),te(""),re()):q((_==null?void 0:_.error)||"退款失败")}catch(_){const U=_;q(((G=U==null?void 0:U.data)==null?void 0:G.error)||"退款失败,请检查网络后重试")}finally{B(!1)}}}function oe(){if(t.length===0){ne.info("暂无数据可导出");return}const G=["订单号","用户","手机号","商品","金额","支付方式","状态","退款原因","分销佣金","下单时间"],_=t.map(X=>{const le=F(X);return[X.orderSn||X.id||"",ae(X),J(X.userId),le.name,Number(X.amount||0).toFixed(2),X.paymentMethod==="wechat"?"微信支付":X.paymentMethod==="balance"?"余额支付":X.paymentMethod==="alipay"?"支付宝":X.paymentMethod||"微信支付",X.status==="refunded"?"已退款":X.status==="paid"||X.status==="completed"?"已完成":X.status==="pending"||X.status==="created"?"待支付":"已失败",X.status==="refunded"&&X.refundReason?X.refundReason:"-",X.referrerEarnings?Number(X.referrerEarnings).toFixed(2):"-",X.createdAt?new Date(X.createdAt).toLocaleString("zh-CN"):""].join(",")}),U="\uFEFF"+[G.join(","),..._].join(` -`),H=new Blob([U],{type:"text/csv;charset=utf-8"}),K=URL.createObjectURL(H),me=document.createElement("a");me.href=K,me.download=`订单列表_${new Date().toISOString().slice(0,10)}.csv`,me.click(),URL.revokeObjectURL(K)}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:()=>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(Y,{variant:"outline",onClick:re,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(Aa,{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:G=>N(G.target.value)})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Rj,{className:"w-4 h-4 text-gray-400"}),s.jsxs("select",{value:k,onChange:G=>E(G.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(Y,{variant:"outline",onClick:oe,disabled:t.length===0,className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(M5,{className:"w-4 h-4 mr-2"}),"导出 CSV"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:C?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(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(gs,{children:[s.jsx(ys,{children:s.jsxs(ht,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"订单号"}),s.jsx(ke,{className:"text-gray-400",children:"用户"}),s.jsx(ke,{className:"text-gray-400",children:"商品"}),s.jsx(ke,{className:"text-gray-400",children:"金额"}),s.jsx(ke,{className:"text-gray-400",children:"支付方式"}),s.jsx(ke,{className:"text-gray-400",children:"状态"}),s.jsx(ke,{className:"text-gray-400",children:"退款原因"}),s.jsx(ke,{className:"text-gray-400",children:"分销佣金"}),s.jsx(ke,{className:"text-gray-400",children:"下单时间"}),s.jsx(ke,{className:"text-gray-400",children:"操作"})]})}),s.jsxs(bs,{children:[t.map(G=>{const _=F(G);return s.jsxs(ht,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsxs(be,{className:"font-mono text-xs text-gray-400",children:[(G.orderSn||G.id||"").slice(0,12),"..."]}),s.jsx(be,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[ae(G),G.paymentMethod==="gift_pay"&&s.jsx(Ue,{className:"bg-emerald-500/20 text-emerald-400 hover:bg-emerald-500/20 border-0 text-xs",children:"代付领取"}),G.payerUserId&&G.paymentMethod!=="gift_pay"&&s.jsx(Ue,{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:J(G.userId)}),G.payerUserId&&G.payerNickname&&s.jsxs("p",{className:"text-amber-400/80 text-xs mt-0.5",children:[G.paymentMethod==="gift_pay"?"赠送人:":"代付人:",G.payerNickname]})]})}),s.jsx(be,{children:s.jsxs("div",{children:[s.jsxs("p",{className:"text-white text-sm flex items-center gap-2",children:[_.name,(G.productType||G.type)==="vip"&&s.jsx(Ue,{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(be,{className:"text-[#38bdac] font-bold",children:["¥",Number(G.amount||0).toFixed(2)]}),s.jsx(be,{className:"text-gray-300",children:G.paymentMethod==="wechat"?"微信支付":G.paymentMethod==="balance"?"余额支付":G.paymentMethod==="alipay"?"支付宝":G.paymentMethod||"微信支付"}),s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[G.status==="refunded"?s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 hover:bg-gray-500/20 border-0",children:"已退款"}):G.status==="paid"||G.status==="completed"?s.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"}):G.status==="pending"||G.status==="created"?s.jsx(Ue,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:"待支付"}):s.jsx(Ue,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已失败"}),(G.status==="paid"||G.status==="completed")&&(G.webhookPushStatus==="sent"?s.jsx(Ue,{className:"bg-emerald-500/20 text-emerald-300 hover:bg-emerald-500/20 border-0",children:"已推送"}):s.jsx(Ue,{className:"bg-orange-500/20 text-orange-300 hover:bg-orange-500/20 border-0",children:"待补推"}))]})}),s.jsx(be,{className:"text-gray-400 text-sm max-w-[120px] truncate",title:G.refundReason,children:G.status==="refunded"&&G.refundReason?G.refundReason:"-"}),s.jsx(be,{className:"text-[#FFD700]",children:G.referrerEarnings?`¥${Number(G.referrerEarnings).toFixed(2)}`:"-"}),s.jsx(be,{className:"text-gray-400 text-sm",children:new Date(G.createdAt).toLocaleString("zh-CN")}),s.jsx(be,{children:(G.status==="paid"||G.status==="completed")&&G.paymentMethod!=="balance"&&s.jsxs(Y,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{V(G),te("")},children:[s.jsx(Dj,{className:"w-3 h-3 mr-1"}),"退款"]})})]},G.id)}),t.length===0&&s.jsx(ht,{children:s.jsx(be,{colSpan:10,className:"text-center py-12 text-gray-500",children:"暂无订单数据"})})]})]}),s.jsx(sr,{page:f,totalPages:D,total:a,pageSize:x,onPageChange:m,onPageSizeChange:G=>{y(G),m(1)}})]})})}),s.jsx(Bt,{open:!!$,onOpenChange:G=>!G&&V(null),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Vt,{children:s.jsx(Ht,{className:"text-white",children:"订单退款"})}),$&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",$.orderSn||$.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",Number($.amount||0).toFixed(2)]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"退款原因(选填)"}),s.jsx("div",{className:"form-input",children:s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"如:用户申请退款",value:I,onChange:G=>te(G.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(xn,{children:[s.jsx(Y,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>V(null),disabled:Q,children:"取消"}),s.jsx(Y,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:P,disabled:Q,children:Q?"退款中...":"确认退款"})]})]})})]})}const To=b.forwardRef(({className:t,...e},n)=>s.jsx("textarea",{className:Qt("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}));To.displayName="Textarea";const z1=["INTJ","INTP","ENTJ","ENTP","INFJ","INFP","ENFJ","ENFP","ISTJ","ISFJ","ESTJ","ESFJ","ISTP","ISFP","ESTP","ESFP"],s2={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 qR(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 GR(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 JR(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 $1(t){const e=s2[t],n=qR(e.group),r=GR(e.mood),a=JR(e.mood),i=` - - - - - - - - - - - - - - - - - - - - - - - - - -`;return`data:image/svg+xml;utf8,${encodeURIComponent(i)}`}function QR(){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 Le("/api/admin/mbti-avatars");x!=null&&x.avatars?e(x.avatars):e({})}catch{ne.error("加载 MBTI 头像配置失败")}finally{r(!1)}},[]);b.useEffect(()=>{u()},[u]);const h=async()=>{i(!0);try{const x=await Et("/api/admin/mbti-avatars",{avatars:t});if(!x||x.success===!1){ne.error((x==null?void 0:x.error)||"保存失败");return}ne.success("已保存,后台与小程序默认头像同步生效"),u()}catch{ne.error("保存失败")}finally{i(!1)}},f=x=>{const y=$1(x);e(v=>({...v,[x]:y})),ne.success(`${x} 已生成`)},m=()=>{c(!0);try{const x={...t};z1.forEach(y=>{x[y]=$1(y)}),e(x),ne.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(De,{className:"bg-[#0f2137] border-[#38bdac]/25 shadow-xl",children:[s.jsxs(it,{className:"pb-2",children:[s.jsxs(ot,{className:"text-white flex items-center gap-2 text-lg",children:[s.jsx(sA,{className:"w-5 h-5 text-[#38bdac]"}),"MBTI 头像库"]}),s.jsx(Yt,{className:"text-gray-400 text-sm leading-relaxed",children:"采用人物化风格,按 MBTI 性格自动生成。头像内不显示中英文,仅显示人物形象,颜色与站点主题融合。"})]}),s.jsxs(_e,{className:"flex flex-wrap gap-2",children:[s.jsxs(Y,{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(Y,{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(Y,{type:"button",size:"sm",className:"bg-emerald-600 hover:bg-emerald-500",onClick:h,disabled:a,children:[s.jsx(kn,{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:z1.map(x=>{const y=t[x]??"",v=s2[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(Ue,{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(ce,{className:"bg-[#162840] border-gray-700 text-white h-8 text-xs",placeholder:"https://... 或 data:image/...",value:y,onChange:N=>e(w=>({...w,[x]:N.target.value}))})})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Y,{type:"button",size:"sm",variant:"outline",className:"h-7 text-[11px] border-[#38bdac]/40 text-[#38bdac]",onClick:()=>f(x),children:"生成这张"}),s.jsx(Y,{type:"button",size:"sm",variant:"ghost",className:"h-7 text-[11px] text-gray-400",onClick:()=>e(N=>({...N,[x]:""})),children:"清空"})]})]},x)})})]})}const F1=[{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:"用户状态"}],B1=[{value:"popup",label:"弹窗提示",desc:"在小程序内弹窗引导用户完成下一步"},{value:"navigate",label:"跳转页面",desc:"引导用户跳转到指定页面"},{value:"webhook",label:"推送飞书群",desc:"触发后推送消息到飞书群Webhook"},{value:"tag",label:"自动打标签",desc:"触发后自动给用户打上指定标签"}];function r2(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 YR(t){return{...t,triggerConditions:r2(t.triggerConditions)}}const XR=[{level:"S",range:"≥85",label:"高价值"},{level:"A",range:"70–84",label:"优质"},{level:"B",range:"50–69",label:"中等"},{level:"C",range:"30–49",label:"潜力"},{level:"D",range:"<30",label:"待激活"}],cc=[{id:"register",label:"注册/登录",icon:"👤",color:"bg-blue-500/20 border-blue-500/40 text-blue-400",desc:"微信授权登录或手机号注册"},{id:"browse",label:"浏览章节",icon:"📖",color:"bg-purple-500/20 border-purple-500/40 text-purple-400",desc:"点击免费/付费章节预览"},{id:"bind_phone",label:"绑定手机",icon:"📱",color:"bg-cyan-500/20 border-cyan-500/40 text-cyan-400",desc:"触发付费章节后绑定手机"},{id:"first_pay",label:"首次付款",icon:"💳",color:"bg-green-500/20 border-green-500/40 text-green-400",desc:"购买单章或全书"},{id:"fill_profile",label:"完善资料",icon:"✍️",color:"bg-yellow-500/20 border-yellow-500/40 text-yellow-400",desc:"填写头像、MBTI、行业等"},{id:"match",label:"派对房匹配",icon:"🤝",color:"bg-orange-500/20 border-orange-500/40 text-orange-400",desc:"参与 Soul 派对房"},{id:"vip",label:"升级 VIP",icon:"👑",color:"bg-amber-500/20 border-amber-500/40 text-amber-400",desc:"付款 ¥1980 购买全书"},{id:"distribution",label:"开启分销",icon:"🔗",color:"bg-[#38bdac]/20 border-[#38bdac]/40 text-[#38bdac]",desc:"生成推广码并推荐好友"}];function V1(t){return confirm(`确定删除该${t}?此操作不可恢复。`)?window.prompt(`请输入「删除」以确认删除${t}`)==="删除":!1}function ZR(){var $i,ya,zl,Fi,Bi,ba,Xa;const[t,e]=w0(),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(""),N=lf(y,300),w=n==="vip"?"vip":n==="complete"?"complete":"all",[k,E]=b.useState(w),[C,R]=b.useState(!0),[O,q]=b.useState(!1),[$,V]=b.useState(null),[I,te]=b.useState(!1),[Q,B]=b.useState(!1),[re,ae]=b.useState("desc");b.useEffect(()=>{n==="vip"?E("vip"):n==="complete"?E("complete"):n==="all"&&E("all")},[n]);const[J,F]=b.useState(!1),[D,P]=b.useState(null),[oe,G]=b.useState(!1),[_,U]=b.useState(!1),[H,K]=b.useState({referrals:[],stats:{}}),[me,X]=b.useState(!1),[le,de]=b.useState(null),[ve,ye]=b.useState(!1),[Se,Fe]=b.useState(null),[mt,kt]=b.useState(!1),[ft,Dt]=b.useState({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),[Pt,Rn]=b.useState([]),[yn,Wt]=b.useState(!1),[Xt,Sn]=b.useState(!1),[Fn,Wn]=b.useState(null),[Mt,pn]=b.useState({title:"",description:"",trigger:"",triggerConditions:[],actionType:"popup",sort:0,enabled:!0}),[bn,ge]=b.useState([]),[Ce,Be]=b.useState(!1),[Ze,St]=b.useState(null),[vt,L]=b.useState(null),[Ie,xt]=b.useState({}),[Rt,pt]=b.useState(!1),[at,At]=b.useState(null),[Kt,en]=b.useState([]),[ls,Ws]=b.useState(!1),[Fr,za]=b.useState(null),[$a,Fa]=b.useState(""),[oa,Br]=b.useState([]),[yr,ir]=b.useState(!1),[Vr,Ls]=b.useState({}),[Ds,or]=b.useState([]),[br,la]=b.useState(0),[ie,xe]=b.useState(1),[It]=b.useState(20),[$t,Yn]=b.useState(!1),[Xn,Ks]=b.useState(null),[Ba,Ct]=b.useState(""),vn=lf(Ba,300),[Va,Ol]=b.useState(""),[Ft,Fo]=b.useState({}),vr=b.useCallback(async(A,je)=>{Yn(!0),Ks(null);try{const Ae=new URLSearchParams({mode:"contact",page:String(ie),pageSize:String(It)}),$e=A??vn;$e&&Ae.set("search",$e);const et=je??Va;et&&Ae.set("source",et);const gt=await Le(`/api/db/ckb-leads?${Ae}`);if(gt!=null&>.success)or(gt.records||[]),la(gt.total??0),gt.stats&&Fo(gt.stats);else{const Nn=(gt==null?void 0:gt.error)||"加载获客列表失败";Ks(Nn),ne.error(Nn),or([]),la(0)}}catch(Ae){const $e=Ae instanceof Error?Ae.message:"网络错误";Ks($e),ne.error("加载获客列表失败: "+$e),or([]),la(0)}finally{Yn(!1)}},[ie,It,vn,Va]),ca=b.useCallback(async()=>{try{const A=await Le("/api/admin/mbti-avatars"),je=A!=null&&A.avatars&&typeof A.avatars=="object"?A.avatars:{};Ls(je)}catch{Ls({})}},[]);b.useEffect(()=>{t.get("tab")==="leads"&&vr()},[t.get("tab"),ie,vr]),b.useEffect(()=>{ca()},[ca]);const cs=b.useCallback((A,je)=>{const Ae=(A||"").trim();if(Ae)return Ae;const $e=(je||"").trim().toUpperCase();return/^[EI][NS][FT][JP]$/.test($e)?(Vr[$e]||"").trim():""},[Vr]),Ei=b.useCallback(A=>{const je=!!A.hasFullBook,Ae=Number(A.purchasedSectionCount||0);return je?{tone:"vip",main:"已购全书",sub:Ae>0?`另购单章 ${Ae} 章`:"购买项:VIP / 全书"}:Ae>0?{tone:"paid",main:`已购 ${Ae} 章`,sub:"购买项:章节"}:{tone:"free",main:"未购买",sub:""}},[]),[Ha,da]=b.useState(null),Ns=b.useCallback(async()=>{try{const A=await Le("/api/admin/users/online-stats");A!=null&&A.success&&typeof A.onlineCount=="number"?da(A.onlineCount):da(0)}catch{da(null)}},[]);b.useEffect(()=>{Ns();const A=setInterval(Ns,1e4);return()=>clearInterval(A)},[Ns]);async function Hr(A=!1){var je;R(!0),A&&q(!0),V(null);try{if(I){const Ae=new URLSearchParams({search:N,limit:String(m*5)}),$e=await Le(`/api/db/users/rfm?${Ae}`);if($e!=null&&$e.success){let et=$e.users||[];re==="asc"&&(et=[...et].reverse());const gt=(h-1)*m;o(et.slice(gt,gt+m)),u(((je=$e.users)==null?void 0:je.length)??0),et.length===0&&(te(!1),V("暂无订单数据,RFM 排序需要用户有购买记录后才能生效"))}else te(!1),V(($e==null?void 0:$e.error)||"RFM 加载失败,已切回普通模式")}else{const Ae=new URLSearchParams({page:String(h),pageSize:String(m),search:N,...k==="vip"&&{vip:"true"},...k==="complete"&&{pool:"complete"}}),$e=await Le(`/api/db/users?${Ae}`);$e!=null&&$e.success?(o($e.users||[]),u($e.total??0)):V(($e==null?void 0:$e.error)||"加载失败")}}catch(Ae){console.error("Load users error:",Ae),V("网络错误")}finally{R(!1),A&&q(!1)}}b.useEffect(()=>{f(1)},[N,k,I]),b.useEffect(()=>{Hr()},[h,m,N,k,I,re]);const ws=Math.ceil(c/m)||1,Ll=()=>{I?re==="desc"?ae("asc"):(te(!1),ae("desc")):(te(!0),ae("desc"))},Mi=A=>({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"})[A||""]||"bg-gray-500/20 text-gray-400";async function Jc(A){var je;if(!V1("用户")){ne.info("已取消删除");return}try{const Ae=await gi(`/api/db/users?id=${encodeURIComponent(A)}`);Ae!=null&&Ae.success?(ne.success("已删除"),Hr()):ne.error("删除失败: "+((Ae==null?void 0:Ae.error)||"未知错误"))}catch(Ae){const $e=Ae,et=((je=$e==null?void 0:$e.data)==null?void 0:je.error)||($e==null?void 0:$e.message)||"网络错误";ne.error("删除失败: "+et)}}const Ua=A=>{P(A),Dt({phone:A.phone||"",nickname:A.nickname||"",password:"",isAdmin:!!(A.isAdmin??!1),hasFullBook:!!(A.hasFullBook??!1)}),F(!0)},Ai=()=>{P(null),Dt({phone:"",nickname:"",password:"",isAdmin:!1,hasFullBook:!1}),F(!0)};async function Nr(){if(!ft.phone||!ft.nickname){ne.error("请填写手机号和昵称");return}G(!0);try{if(D){const A=await Zt("/api/db/users",{id:D.id,phone:ft.phone||void 0,nickname:ft.nickname,isAdmin:ft.isAdmin,hasFullBook:ft.hasFullBook,...ft.password&&{password:ft.password}});if(!(A!=null&&A.success)){ne.error("更新失败: "+((A==null?void 0:A.error)||""));return}}else{const A=await Et("/api/db/users",{phone:ft.phone,nickname:ft.nickname,password:ft.password,isAdmin:ft.isAdmin});if(!(A!=null&&A.success)){ne.error("创建失败: "+((A==null?void 0:A.error)||""));return}}F(!1),Hr()}catch{ne.error("保存失败")}finally{G(!1)}}async function Wa(A){de(A),U(!0),X(!0);try{const je=await Le(`/api/db/users/referrals?userId=${encodeURIComponent(A.id)}`);je!=null&&je.success?K({referrals:je.referrals||[],stats:je.stats||{}}):K({referrals:[],stats:{}})}catch{K({referrals:[],stats:{}})}finally{X(!1)}}const _s=b.useCallback(async()=>{Wt(!0);try{const A=await Le("/api/db/user-rules");A!=null&&A.success&&Rn((A.rules||[]).map(je=>YR(je)))}catch{}finally{Wt(!1)}},[]);async function Qc(){if(!Mt.title){ne.error("请填写规则标题");return}G(!0);try{if(Fn){const A=await Zt("/api/db/user-rules",{id:Fn.id,...Mt});if(!(A!=null&&A.success)){ne.error("更新失败: "+((A==null?void 0:A.error)||""));return}}else{const A=await Et("/api/db/user-rules",Mt);if(!(A!=null&&A.success)){ne.error("创建失败: "+((A==null?void 0:A.error)||""));return}}Sn(!1),_s()}catch{ne.error("保存失败")}finally{G(!1)}}async function Bo(A){if(!V1("规则")){ne.info("已取消删除");return}try{const je=await gi(`/api/db/user-rules?id=${A}`);je!=null&&je.success&&_s()}catch{}}async function Vo(A){try{await Zt("/api/db/user-rules",{id:A.id,enabled:!A.enabled}),_s()}catch{}}const zs=b.useCallback(async()=>{Be(!0);try{const A=await Le("/api/db/vip-members?limit=500");if(A!=null&&A.success&&A.data){const je=[...A.data].map((Ae,$e)=>({...Ae,vipSort:typeof Ae.vipSort=="number"?Ae.vipSort:$e+1}));je.sort((Ae,$e)=>(Ae.vipSort??999999)-($e.vipSort??999999)),ge(je)}else A&&A.error&&ne.error(A.error)}catch{ne.error("加载超级个体列表失败")}finally{Be(!1)}},[]),[ua,Ii]=b.useState(!1),[qs,Tt]=b.useState(null),[ha,Pi]=b.useState(""),[Bn,Ri]=b.useState(!1),[Ka,Ur]=b.useState(!1),[wr,Cn]=b.useState(null),[ds,lr]=b.useState(""),[cr,fa]=b.useState(!1),pa=["创业者","资源整合者","技术达人","投资人","产品经理","流量操盘手"],jr=A=>{Tt(A),Pi(A.vipRole||""),Ii(!0)},Dl=A=>{Cn(A),lr((A.webhookUrl||"").trim()),Ur(!0)},kr=async A=>{const je=A.trim();if(qs){if(!je){ne.error("请选择或输入标签");return}Ri(!0);try{const Ae=await Zt("/api/db/users",{id:qs.id,vipRole:je});if(!(Ae!=null&&Ae.success)){ne.error((Ae==null?void 0:Ae.error)||"更新超级个体标签失败");return}ne.success("已更新超级个体标签"),Ii(!1),Tt(null),await zs()}catch{ne.error("更新超级个体标签失败")}finally{Ri(!1)}}},$s=async()=>{if(!wr)return;const A=ds.trim();if(A&&!/^https?:\/\//i.test(A)){ne.error("Webhook 地址需以 http/https 开头");return}fa(!0);try{const je=await Zt("/api/db/vip-members/webhook",{userId:wr.id,webhookUrl:A});if(!(je!=null&&je.success)){ne.error((je==null?void 0:je.error)||"保存飞书群 Webhook 失败");return}ne.success(A?"已保存该超级个体的飞书群 Webhook":"已清空该超级个体的飞书群 Webhook"),Ur(!1),Cn(null),await zs()}catch{ne.error("保存飞书群 Webhook 失败")}finally{fa(!1)}},[_l,ma]=b.useState(!1),[js,Sr]=b.useState(null),[qa,xa]=b.useState(""),[Gs,ks]=b.useState(!1),Ga=A=>{Sr(A),xa(A.vipSort!=null?String(A.vipSort):""),ma(!0)},Wr=async()=>{if(!js)return;const A=Number(qa);if(!Number.isFinite(A)){ne.error("请输入有效的数字序号");return}ks(!0);try{const je=await Zt("/api/db/users",{id:js.id,vipSort:A});if(!(je!=null&&je.success)){ne.error((je==null?void 0:je.error)||"更新排序序号失败");return}ne.success("已更新排序序号"),ma(!1),Sr(null),await zs()}catch{ne.error("更新排序序号失败")}finally{ks(!1)}},Yc=(A,je)=>{A.dataTransfer.effectAllowed="move",A.dataTransfer.setData("text/plain",je),St(je)},Oi=(A,je)=>{A.preventDefault(),vt!==je&&L(je)},Ja=()=>{St(null),L(null)},Li=async(A,je)=>{A.preventDefault();const Ae=A.dataTransfer.getData("text/plain")||Ze;if(St(null),L(null),!Ae||Ae===je)return;const $e=bn.find(ct=>ct.id===Ae),et=bn.find(ct=>ct.id===je);if(!$e||!et)return;const gt=$e.vipSort??bn.findIndex(ct=>ct.id===Ae)+1,Nn=et.vipSort??bn.findIndex(ct=>ct.id===je)+1;ge(ct=>{const T=[...ct],z=T.findIndex(Ot=>Ot.id===Ae),ue=T.findIndex(Ot=>Ot.id===je);if(z===-1||ue===-1)return ct;const we=[...T],[Qe,dt]=[we[z],we[ue]];return we[z]={...dt,vipSort:gt},we[ue]={...Qe,vipSort:Nn},we});try{const[ct,T]=await Promise.all([Zt("/api/db/users",{id:Ae,vipSort:Nn}),Zt("/api/db/users",{id:je,vipSort:gt})]);if(!(ct!=null&&ct.success)||!(T!=null&&T.success)){ne.error((ct==null?void 0:ct.error)||(T==null?void 0:T.error)||"更新排序失败"),await zs();return}ne.success("已更新排序"),await zs()}catch{ne.error("更新排序失败"),await zs()}},Di=b.useCallback(async()=>{pt(!0);try{const A=await Le("/api/db/users/journey-stats");A!=null&&A.success&&A.stats&&xt(A.stats)}catch{}finally{pt(!1)}},[]),Cr=b.useCallback(async A=>{At(A),Ws(!0);try{const je=await Le(`/api/db/users/journey-users?stage=${A}&limit=50`);je!=null&&je.success&&je.users&&en(je.users)}catch{}finally{Ws(!1)}},[]),Qa=b.useCallback(async(A,je)=>{za(A),Fa(je),ir(!0);try{const Ae=await Le(`/api/db/users/tracks?userId=${A}&limit=50`);Ae!=null&&Ae.success&&Ae.tracks&&Br(Ae.tracks)}catch{}finally{ir(!1)}},[]),[Ya,_i]=b.useState(!1),ga=async()=>{_i(!0);try{const A=await Et("/api/admin/shensheshou/batch-enrich",{limit:20});A!=null&&A.success?(ne.success(`批量补全完成:${A.enriched} 人已补全,${A.skipped} 人跳过`),Hr()):ne.error((A==null?void 0:A.error)||"批量补全失败")}catch{ne.error("批量补全请求失败")}finally{_i(!1)}},zi=A=>{const je=[A.phone,A.nickname,A.avatar,A.wechatId,A.mbti,A.industry,A.region,A.position],Ae=je.filter($e=>$e!=null&&$e!=="").length;return Math.round(Ae/je.length*100)},{leadsRows:Ho,leadsRawCount:us,leadsDeduped:Kr}=b.useMemo(()=>{const A=ct=>(ct||"").replace(/\D/g,"")||"",je=ct=>{const T=A(ct.phone);if(T)return`phone:${T}`;const z=(ct.userId||"").trim();if(z)return`user:${z}`;const ue=(ct.wechatId||"").trim();return ue?`wechat:${ue}`:`row:${ct.id}`},Ae=vn.trim().toLowerCase();let $e=Ds;Ae&&($e=Ds.filter(ct=>[ct.userNickname,ct.name,ct.phone,ct.wechatId,ct.personName,ct.source,String(ct.ckbPlanId??"")].filter(Boolean).join(" ").toLowerCase().includes(Ae)));const et=[...$e].sort((ct,T)=>{const z=ct.createdAt?new Date(ct.createdAt).getTime():0;return(T.createdAt?new Date(T.createdAt).getTime():0)-z}),gt=new Set,Nn=[];for(const ct of et){const T=je(ct);gt.has(T)||(gt.add(T),Nn.push(ct))}return{leadsRows:Nn,leadsRawCount:$e.length,leadsDeduped:$e.length-Nn.length}},[Ds,vn]);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:()=>V(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," 人"]}),I&&" · RFM 排序中"]})]}),s.jsx(De,{className:"shrink-0 w-full max-w-md border-[#38bdac]/35 bg-[#0f2137]/90",children:s.jsxs(_e,{className:"p-3 sm:p-4 space-y-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsxs("button",{type:"button",onClick:()=>B(A=>!A),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(tf,{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(ug,{className:"w-4 h-4 text-gray-400 shrink-0"}):s.jsx(Ec,{className:"w-4 h-4 text-gray-400 shrink-0"})]}),s.jsx(Y,{type:"button",variant:"outline",size:"sm",onClick:Ll,className:"border-[#38bdac]/50 text-[#38bdac] hover:bg-[#38bdac]/10 bg-transparent shrink-0",children:I?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:XR.map(({level:A,range:je,label:Ae})=>s.jsxs(Ue,{variant:"outline",className:`text-[10px] border-0 ${Mi(A)}`,children:[A," ",je," · ",Ae]},A))})]})]})})]}),s.jsxs(Ic,{value:a,onValueChange:A=>{const je=new URLSearchParams(t);A==="users"?je.delete("tab"):je.set("tab",A),e(je)},className:"w-full",children:[s.jsxs(vl,{className:"bg-[#0a1628] border border-gray-700/50 p-1 mb-6 flex-wrap h-auto gap-1",children:[s.jsxs(nn,{value:"users",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",children:[s.jsx(_n,{className:"w-4 h-4"})," 用户列表"]}),s.jsxs(nn,{value:"leads",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:()=>vr(),children:[s.jsx(vc,{className:"w-4 h-4"})," 获客列表"]}),s.jsxs(nn,{value:"journey",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:Di,children:[s.jsx(ea,{className:"w-4 h-4"})," 用户旅程总览"]}),s.jsxs(nn,{value:"rules",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:_s,children:[s.jsx(mo,{className:"w-4 h-4"})," 规则配置"]}),s.jsxs(nn,{value:"vip-roles",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] flex items-center gap-1.5",onClick:zs,children:[s.jsx(wc,{className:"w-4 h-4"})," 超级个体列表"]})]}),s.jsxs(sn,{value:"users",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4 justify-end flex-wrap",children:[s.jsxs(Y,{variant:"outline",onClick:ga,disabled:Ya,className:"border-purple-500/50 text-purple-400 hover:bg-purple-500/10 bg-transparent",title:"批量调用神射手补全有手机号用户的资料",children:[Ya?s.jsx(Ve,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(ji,{className:"w-4 h-4 mr-2"}),"批量补全"]}),s.jsxs(Y,{variant:"outline",onClick:()=>Hr(!0),disabled: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 ${O?"animate-spin":""}`})," 刷新"]}),s.jsxs("select",{value:k,onChange:A=>{const je=A.target.value;E(je),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:I,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(Aa,{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:y,onChange:A=>v(A.target.value)})]}),s.jsxs(Y,{onClick:Ai,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(vc,{className:"w-4 h-4 mr-2"})," 添加用户"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children: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(gs,{children:[s.jsx(ys,{children:s.jsxs(ht,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"用户信息"}),s.jsx(ke,{className:"text-gray-400",children:"绑定信息"}),s.jsx(ke,{className:"text-gray-400",children:"购买状态"}),s.jsx(ke,{className:"text-gray-400",children:"分销收益"}),s.jsxs(ke,{className:"text-gray-400 cursor-pointer select-none",onClick:Ll,children:[s.jsxs("div",{className:"flex items-center gap-1 group",children:[s.jsx(tf,{className:"w-3.5 h-3.5"}),s.jsx("span",{children:"RFM分值"}),I?re==="desc"?s.jsx(Ec,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(ug,{className:"w-3.5 h-3.5 text-[#38bdac]"}):s.jsx(cx,{className:"w-3.5 h-3.5 text-gray-600 group-hover:text-gray-400"})]}),I&&s.jsx("div",{className:"text-[10px] text-[#38bdac] font-normal mt-0.5",children:"点击切换方向/关闭"})]}),s.jsx(ke,{className:"text-gray-400",children:"资料完善"}),s.jsx(ke,{className:"text-gray-400",children:"注册时间"}),s.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(bs,{children:[i.map(A=>{var je,Ae,$e;return s.jsxs(ht,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[(()=>{var Nn;const et=cs(A.avatar,A.mbti),gt=((Nn=A.nickname)==null?void 0:Nn.charAt(0))||"?";return s.jsx("button",{type:"button",title:"点击管理 MBTI 默认头像库",onClick:()=>kt(!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:et?s.jsx("img",{src:et,className:"w-full h-full rounded-full object-cover",alt:"",onError:ct=>{var ue;const T=ct.target;if(T.style.display="none",T.nextElementSibling)return;const z=document.createElement("span");z.textContent=gt,(ue=T.parentElement)==null||ue.appendChild(z)}}):gt})})(),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("button",{type:"button",onClick:()=>{Fe(A.id),ye(!0)},className:"font-medium text-[#38bdac] hover:text-[#2da396] hover:underline text-left truncate max-w-[120px]",children:A.nickname}),A.isAdmin&&s.jsx(Ue,{className:"bg-purple-500/20 text-purple-400 hover:bg-purple-500/20 border-0 text-xs",children:"管理员"}),A.openId&&!((je=A.id)!=null&&je.startsWith("user_"))&&s.jsx(Ue,{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:A.id,children:[(Ae=A.id)==null?void 0:Ae.slice(0,16),((($e=A.id)==null?void 0:$e.length)??0)>16?"…":""]})]})]})}),s.jsx(be,{children:s.jsxs("div",{className:"space-y-1",children:[A.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:A.phone})]}),A.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:A.wechatId})]}),!A.phone&&!A.wechatId&&s.jsx("span",{className:"text-gray-600 text-xs",children:"未绑定"})]})}),s.jsx(be,{children:(()=>{const et=Ei(A);return et.tone==="vip"?s.jsxs("div",{className:"space-y-1",children:[s.jsx(Ue,{className:"bg-amber-500/20 text-amber-400 hover:bg-amber-500/20 border-0",children:et.main}),et.sub&&s.jsx("p",{className:"text-[11px] text-amber-300/80",children:et.sub})]}):et.tone==="paid"?s.jsxs("div",{className:"space-y-1",children:[s.jsx(Ue,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:et.main}),et.sub&&s.jsx("p",{className:"text-[11px] text-blue-300/80",children:et.sub})]}):s.jsx(Ue,{variant:"outline",className:"text-gray-500 border-gray-600",children:et.main})})()}),s.jsx(be,{children:s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"text-white font-medium",children:["¥",parseFloat(String(A.earnings||0)).toFixed(2)]}),parseFloat(String(A.pendingEarnings||0))>0&&s.jsxs("div",{className:"text-xs text-yellow-400",children:["待提现: ¥",parseFloat(String(A.pendingEarnings||0)).toFixed(2)]}),s.jsxs("div",{className:"text-xs text-[#38bdac] cursor-pointer hover:underline flex items-center gap-1",onClick:()=>Wa(A),role:"button",tabIndex:0,onKeyDown:et=>et.key==="Enter"&&Wa(A),children:[s.jsx(_n,{className:"w-3 h-3"})," 绑定",A.referralCount||0,"人"]})]})}),s.jsx(be,{children:A.rfmScore!=null&&A.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:A.rfmScore}),s.jsx(Ue,{className:`border-0 text-xs ${Mi(A.rfmLevel)}`,children:A.rfmLevel})]}):s.jsx("span",{className:"text-gray-600 text-xs",children:"无订单"})}),s.jsx(be,{children:(()=>{const et=zi(A),gt=et>=75?"text-green-400":et>=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 ${et>=75?"bg-green-500":et>=50?"bg-yellow-500":"bg-gray-500"}`,style:{width:`${et}%`}})}),s.jsxs("span",{className:`text-xs ${gt}`,children:[et,"%"]})]})})()}),s.jsx(be,{className:"text-gray-400",children:A.createdAt?new Date(A.createdAt).toLocaleDateString():"-"}),s.jsx(be,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>{Fe(A.id),ye(!0)},className:"text-gray-400 hover:text-blue-400 hover:bg-blue-400/10",title:"用户详情",children:s.jsx(ef,{className:"w-4 h-4"})}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>Ua(A),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",title:"编辑用户",children:s.jsx(tn,{className:"w-4 h-4"})}),s.jsx(Y,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>Jc(A.id),title:"删除",children:s.jsx(Ms,{className:"w-4 h-4"})})]})})]},A.id)}),i.length===0&&s.jsx(ht,{children:s.jsx(be,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无用户数据"})})]})]}),s.jsx(sr,{page:h,totalPages:ws,total:c,pageSize:m,onPageChange:f,onPageSizeChange:A=>{x(A),f(1)}})]})})})]}),s.jsxs(sn,{value:"leads",children:[Xn&&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:Xn}),s.jsx("button",{type:"button",className:"shrink-0 ml-2",onClick:()=>Ks(null),"aria-label":"关闭",children:"×"})]}),!$t&&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:Ft.uniqueUsers??0})]}),(Ft.sourceStats&&Ft.sourceStats.length>0?Ft.sourceStats.slice(0,2):[]).map(A=>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:["来源:",A.source]}),s.jsx("p",{className:"text-xl font-bold text-purple-400",children:A.cnt})]},A.source))]}),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(Aa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500"}),s.jsx(ce,{placeholder:"搜索昵称/手机/微信/@人/来源…",value:Ba,onChange:A=>Ct(A.target.value),className:"pl-9 bg-[#0f2137] border-gray-700 text-white placeholder:text-gray-500"})]}),Ft.sourceStats&&Ft.sourceStats.length>0&&s.jsxs("select",{value:Va,onChange:A=>{Ol(A.target.value),xe(1)},className:"bg-[#0f2137] border border-gray-700 text-white rounded-lg px-3 py-2 text-sm",children:[s.jsx("option",{value:"",children:"全部来源"}),Ft.sourceStats.map(A=>s.jsxs("option",{value:A.source,children:[A.source,"(",A.cnt,")"]},A.source))]}),s.jsxs("span",{className:"text-xs text-gray-500 whitespace-nowrap max-w-[min(100%,20rem)]",title:"同一页内:相同手机号或相同用户 ID(含微信侧标识)只保留最近一条",children:["本页 ",us," 条",Kr>0?` · 已合并 ${Kr} 条重复`:""]})]}),s.jsxs(Y,{variant:"outline",onClick:()=>vr(),disabled:$t,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 ${$t?"animate-spin":""}`})," 刷新"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:$t?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(gs,{children:[s.jsx(ys,{children:s.jsxs(ht,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"昵称"}),s.jsx(ke,{className:"text-gray-400",children:"手机号"}),s.jsx(ke,{className:"text-gray-400",children:"微信号"}),s.jsx(ke,{className:"text-gray-400",children:"对应 @人"}),s.jsx(ke,{className:"text-gray-400",children:"获客计划"}),s.jsx(ke,{className:"text-gray-400",children:"来源"}),s.jsx(ke,{className:"text-gray-400",children:"时间"})]})}),s.jsxs(bs,{children:[Ho.map(A=>s.jsxs(ht,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{className:"text-gray-300",children:A.userNickname||A.name||"-"}),s.jsx(be,{className:"text-gray-300",children:A.phone||"-"}),s.jsx(be,{className:"text-gray-300",children:A.wechatId||"-"}),s.jsx(be,{className:"text-[#38bdac]",children:A.personName||"-"}),s.jsx(be,{className:"text-gray-400",children:A.ckbPlanId?`#${A.ckbPlanId}`:"-"}),s.jsx(be,{children:s.jsx(Ue,{variant:"outline",className:"text-gray-400 border-gray-600 text-xs",children:A.source||"未知"})}),s.jsx(be,{className:"text-gray-400",children:A.createdAt?new Date(A.createdAt).toLocaleString():"-"})]},A.id)),Ho.length===0&&s.jsx(ht,{children:s.jsx(be,{colSpan:7,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(vc,{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:vn.trim()||Va?"当前搜索或来源筛选下没有匹配记录,可清空条件后重试。":"存客宝场景产生的手机号 / 微信留资会出现在此列表。请确认获客计划已开启,并有用户完成留资。"}),s.jsxs(Y,{type:"button",variant:"outline",onClick:()=>vr(),disabled:$t,className:"border-[#38bdac]/40 text-[#38bdac] hover:bg-[#38bdac]/10 bg-transparent",children:[s.jsx(Ve,{className:`w-4 h-4 mr-2 ${$t?"animate-spin":""}`}),"重新加载"]})]})})})]})]}),s.jsx(sr,{page:ie,totalPages:Math.ceil(br/It)||1,total:br,pageSize:It,onPageChange:xe,onPageSizeChange:()=>{}})]})})})]}),s.jsxs(sn,{value:"journey",children:[s.jsxs("div",{className:"flex items-center justify-between mb-5",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"用户从注册到 VIP 的完整行动路径,点击各阶段查看用户动态"}),s.jsxs(Y,{variant:"outline",onClick:Di,disabled:Rt,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 ${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:cc.map((A,je)=>s.jsxs("div",{className:"relative flex flex-col items-center",children:[s.jsxs("div",{className:`relative w-full p-3 rounded-xl border ${A.color} text-center cursor-pointer hover:opacity-80 transition-opacity ${at===A.id?"ring-2 ring-[#38bdac]":""}`,onClick:()=>Cr(A.id),title:`点击查看「${A.label}」阶段的用户`,children:[s.jsx("div",{className:"text-2xl mb-1",children:A.icon}),s.jsx("div",{className:`text-xs font-medium ${A.color.split(" ").find(Ae=>Ae.startsWith("text-"))}`,children:A.label}),Ie[A.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[A.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:je+1})]}),jes.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:A.step}),s.jsxs("div",{children:[s.jsx("p",{className:"text-gray-300",children:A.action}),s.jsxs("p",{className:"text-gray-600 text-xs",children:["→ ",A.next]})]})]},A.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(rr,{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(Ve,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Object.keys(Ie).length>0?s.jsx("div",{className:"space-y-2",children:cc.map(A=>{const je=Ie[A.id]||0,Ae=Math.max(...cc.map(et=>Ie[et.id]||0),1),$e=Math.round(je/Ae*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:[A.icon," ",A.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:`${$e}%`}})}),s.jsx("span",{className:"text-gray-400 text-xs w-10 text-right",children:je})]},A.id)})}):s.jsx("div",{className:"text-center py-8",children:s.jsx("p",{className:"text-gray-500 text-sm",children:"点击「刷新数据」加载统计"})})]})]}),at&&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:[($i=cc.find(A=>A.id===at))==null?void 0:$i.icon," ",(ya=cc.find(A=>A.id===at))==null?void 0:ya.label," 阶段用户"]}),s.jsxs(Ue,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-xs",children:[Kt.length," 人"]})]}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>At(null),className:"text-gray-400 hover:text-white",children:s.jsx(ss,{className:"w-4 h-4"})})]}),ls?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(Ve,{className:"w-5 h-5 text-[#38bdac] animate-spin"})}):Kt.length===0?s.jsx("p",{className:"text-gray-500 text-center py-6",children:"该阶段暂无用户"}):s.jsxs(gs,{children:[s.jsx(ys,{children:s.jsxs(ht,{className:"border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"昵称"}),s.jsx(ke,{className:"text-gray-400",children:"手机号"}),s.jsx(ke,{className:"text-gray-400",children:"注册时间"}),s.jsx(ke,{className:"text-gray-400 text-right",children:"操作"})]})}),s.jsx(bs,{children:Kt.map(A=>s.jsxs(ht,{className:"border-gray-700/50 hover:bg-[#0a1628]",children:[s.jsx(be,{className:"text-white",children:A.nickname||"微信用户"}),s.jsx(be,{className:"text-gray-300",children:A.phone||"-"}),s.jsx(be,{className:"text-gray-400 text-xs",children:A.createdAt?new Date(A.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx(be,{className:"text-right",children:s.jsxs(Y,{variant:"ghost",size:"sm",className:"text-[#38bdac] hover:bg-[#38bdac]/10",onClick:()=>Qa(A.id,A.nickname||"微信用户"),children:[s.jsx(ef,{className:"w-4 h-4 mr-1"})," 行为轨迹"]})})]},A.id))})]})]}),s.jsx(Bt,{open:!!Fr,onOpenChange:A=>{A||za(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(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(ea,{className:"w-5 h-5 text-[#38bdac]"}),$a," 的行为轨迹"]})}),yr?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Ve,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):oa.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"}),oa.map((A,je)=>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:A.actionLabel}),A.module&&s.jsx(Ue,{className:"bg-purple-500/10 text-purple-400 border border-purple-500/30 text-[10px]",children:A.module})]}),(A.chapterTitle||A.target)&&s.jsx("p",{className:"text-gray-400 text-xs mt-0.5 truncate",children:A.chapterTitle||A.target}),s.jsxs("p",{className:"text-gray-600 text-[10px] mt-0.5",children:[A.timeAgo," · ",A.createdAt?new Date(A.createdAt).toLocaleString("zh-CN"):""]})]})]},A.id||je))]})]})})]}),s.jsxs(sn,{value:"rules",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"用户旅程触达规则:各行为节点的触发条件与展示文案(偏利他说明,少用命令式)"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(Y,{variant:"outline",onClick:_s,disabled:yn,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 ${yn?"animate-spin":""}`})," 刷新"]}),s.jsxs(Y,{onClick:()=>{Wn(null),pn({title:"",description:"",trigger:"",triggerConditions:[],actionType:"popup",sort:0,enabled:!0}),Sn(!0)},className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Dn,{className:"w-4 h-4 mr-2"})," 添加规则"]})]})]}),yn?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Ve,{className:"w-6 h-6 text-[#38bdac] animate-spin"})}):Pt.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(rr,{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(Y,{onClick:_s,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:Pt.map(A=>{var Ae;const je=r2(A.triggerConditions);return s.jsxs("div",{className:`p-3 rounded-lg border transition-all ${A.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:["#",A.sort]}),s.jsx(tn,{className:"w-3.5 h-3.5 text-[#38bdac] shrink-0"}),s.jsx("span",{className:"text-white font-medium text-sm truncate",children:A.title}),A.trigger&&s.jsx(Ue,{className:"bg-[#38bdac]/10 text-[#38bdac] border border-[#38bdac]/30 text-[10px] shrink-0",children:A.trigger}),je.length>0&&s.jsxs("div",{className:"flex flex-wrap gap-0.5 ml-1",children:[je.slice(0,3).map($e=>{const et=F1.find(gt=>gt.value===$e);return s.jsx(Ue,{className:"bg-purple-500/10 text-purple-400 border border-purple-500/30 text-[9px]",children:(et==null?void 0:et.label)||$e},$e)}),je.length>3&&s.jsxs("span",{className:"text-gray-500 text-[9px]",children:["+",je.length-3]})]}),A.actionType&&A.actionType!=="popup"&&s.jsx(Ue,{className:"bg-amber-500/10 text-amber-400 border border-amber-500/30 text-[9px] shrink-0",children:((Ae=B1.find($e=>$e.value===A.actionType))==null?void 0:Ae.label)||A.actionType})]}),s.jsxs("div",{className:"flex items-center gap-1.5 ml-3 shrink-0",children:[s.jsx(Ut,{checked:A.enabled,onCheckedChange:()=>Vo(A)}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>{Wn(A),pn({title:A.title,description:A.description,trigger:A.trigger,triggerConditions:je,actionType:A.actionType||"popup",sort:A.sort,enabled:A.enabled}),Sn(!0)},className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10 h-7 w-7 p-0",children:s.jsx(tn,{className:"w-3.5 h-3.5"})}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>Bo(A.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10 h-7 w-7 p-0",children:s.jsx(Ms,{className:"w-3.5 h-3.5"})})]})]}),A.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:["(",A.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:A.description})]})]},A.id)})})]}),s.jsxs(sn,{value:"vip-roles",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"展示当前所有有效的超级个体(VIP 用户),用于检查会员信息与排序值。"}),s.jsx("p",{className:"text-xs text-[#38bdac]",children:"提示:按住任意一行即可拖拽排序,释放后将同步更新小程序展示顺序。"})]}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsxs(Y,{variant:"outline",onClick:zs,disabled:Ce,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 ${Ce?"animate-spin":""}`})," ","刷新"]})})]}),Ce?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:"加载中..."})]}):bn.length===0?s.jsxs("div",{className:"text-center py-16 bg-[#0f2137] rounded-lg border border-gray-700/50",children:[s.jsx(wc,{className:"w-12 h-12 text-amber-400/30 mx-auto mb-4"}),s.jsx("p",{className:"text-gray-400 mb-4",children:"当前没有有效的超级个体用户。"})]}):s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:s.jsxs(gs,{children:[s.jsx(ys,{children:s.jsxs(ht,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400 w-12",children:"序号"}),s.jsx(ke,{className:"text-gray-400",children:"成员"}),s.jsx(ke,{className:"text-gray-400 min-w-40",children:"超级个体标签"}),s.jsx(ke,{className:"text-gray-400 w-16 text-center",children:"头像点击"}),s.jsx(ke,{className:"text-gray-400 w-16 text-center",children:"获客数"}),s.jsx(ke,{className:"text-gray-400 w-20",children:"排序值"}),s.jsx(ke,{className:"text-gray-400 w-36",children:"飞书群"}),s.jsx(ke,{className:"text-gray-400 w-36 text-right",children:"操作"})]})}),s.jsx(bs,{children:bn.map((A,je)=>{var et;const Ae=Ze===A.id,$e=vt===A.id;return s.jsxs(ht,{draggable:!0,onDragStart:gt=>Yc(gt,A.id),onDragOver:gt=>Oi(gt,A.id),onDrop:gt=>Li(gt,A.id),onDragEnd:Ja,className:`border-gray-700/50 cursor-grab active:cursor-grabbing select-none ${Ae?"opacity-60":""} ${$e?"bg-[#38bdac]/10":""}`,children:[s.jsx(be,{className:"text-gray-300",children:je+1}),s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[cs(A.avatar,A.mbti)?s.jsx("img",{src:cs(A.avatar,A.mbti),className:"w-8 h-8 rounded-full object-cover border border-amber-400/60",alt:"",onError:gt=>{var ct,T;gt.target.style.display="none";const Nn=document.createElement("div");Nn.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",Nn.textContent=((ct=A.name)==null?void 0:ct[0])||"创",(T=gt.target.parentElement)==null||T.appendChild(Nn)}}):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:((et=A.name)==null?void 0:et[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:A.name})})]})}),s.jsx(be,{className:"text-gray-300 whitespace-nowrap",children:A.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置)"})}),s.jsx(be,{className:"text-center text-blue-400 text-xs font-mono",children:A.clickCount!=null?String(A.clickCount):"-"}),s.jsx(be,{className:"text-center text-green-400 text-xs font-mono",children:A.leadCount!=null?String(A.leadCount):"-"}),s.jsx(be,{className:"text-gray-300",children:A.vipSort??je+1}),s.jsx(be,{className:"text-xs",children:A.webhookUrl?s.jsx("span",{className:"text-[#38bdac] truncate block max-w-[180px]",title:A.webhookUrl,children:"已配置"}):s.jsx("span",{className:"text-gray-500",children:"未配置"})}),s.jsx(be,{className:"text-right text-xs text-gray-300",children:s.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[s.jsx(Y,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-amber-300 hover:text-amber-200",onClick:()=>jr(A),title:"设置超级个体标签",children:s.jsx(Dd,{className:"w-3.5 h-3.5"})}),s.jsx(Y,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-[#38bdac] hover:text-[#5fe0cd]",onClick:()=>Dl(A),title:"编辑飞书群Webhook",children:s.jsx(tn,{className:"w-3.5 h-3.5"})}),s.jsx(Y,{variant:"ghost",size:"sm",className:"h-7 w-7 px-0 text-sky-300 hover:text-sky-200",onClick:()=>Ga(A),title:"设置排序序号",children:s.jsx(cx,{className:"w-3.5 h-3.5"})})]})})]},A.id)})})]})})})]})]}),s.jsx(Bt,{open:mt,onOpenChange:kt,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-6xl",children:[s.jsx(Vt,{children:s.jsx(Ht,{className:"text-white",children:"MBTI 默认头像库"})}),s.jsx(QR,{})]})}),s.jsx(Bt,{open:_l,onOpenChange:A=>{ma(A),A||Sr(null)},children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(cx,{className:"w-5 h-5 text-[#38bdac]"}),"设置排序 — ",js==null?void 0:js.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(ee,{className:"text-gray-300 text-sm",children:"排序序号(数字越小越靠前)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:1",value:qa,onChange:A=>xa(A.target.value)})]}),s.jsxs(xn,{children:[s.jsxs(Y,{variant:"outline",onClick:()=>ma(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(ss,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(Y,{onClick:Wr,disabled:Gs,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(kn,{className:"w-4 h-4 mr-2"}),Gs?"保存中...":"保存"]})]})]})}),s.jsx(Bt,{open:ua,onOpenChange:A=>{Ii(A),A||Tt(null)},children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(wc,{className:"w-5 h-5 text-amber-400"}),"设置超级个体标签 — ",qs==null?void 0:qs.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(ee,{className:"text-gray-300 text-sm",children:"选择或输入标签"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:pa.map(A=>s.jsx(Y,{variant:ha===A?"default":"outline",size:"sm",className:ha===A?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50",onClick:()=>Pi(A),children:A},A))}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"或手动输入"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:创业者、资源整合者等",value:ha,onChange:A=>Pi(A.target.value)})]})]}),s.jsxs(xn,{children:[s.jsxs(Y,{variant:"outline",onClick:()=>Ii(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(ss,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(Y,{onClick:()=>kr(ha),disabled:Bn,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(kn,{className:"w-4 h-4 mr-2"}),Bn?"保存中...":"保存"]})]})]})}),s.jsx(Bt,{open:Ka,onOpenChange:A=>{Ur(A),A||Cn(null)},children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-xl",children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(tn,{className:"w-5 h-5 text-[#38bdac]"}),"设置飞书群 Webhook — ",wr==null?void 0:wr.name]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsx(ee,{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:ds,onChange:A=>lr(A.target.value)}),s.jsx("p",{className:"text-xs text-gray-500",children:"当用户点击该超级个体头像并提交链接时,线索将优先推送到这里配置的飞书群。"})]}),s.jsxs(xn,{children:[s.jsxs(Y,{variant:"outline",onClick:()=>Ur(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(ss,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(Y,{onClick:$s,disabled:cr,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(kn,{className:"w-4 h-4 mr-2"}),cr?"保存中...":"保存"]})]})]})}),s.jsx(Bt,{open:J,onOpenChange:F,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[D?s.jsx(tn,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(vc,{className:"w-5 h-5 text-[#38bdac]"}),D?"编辑用户":"添加用户"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"手机号"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入手机号",value:ft.phone,onChange:A=>Dt({...ft,phone:A.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"昵称"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"请输入昵称",value:ft.nickname,onChange:A=>Dt({...ft,nickname:A.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:D?"新密码 (留空则不修改)":"密码"}),s.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:D?"留空则不修改":"请输入密码",value:ft.password,onChange:A=>Dt({...ft,password:A.target.value})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(ee,{className:"text-gray-300",children:"管理员权限"}),s.jsx(Ut,{checked:ft.isAdmin,onCheckedChange:A=>Dt({...ft,isAdmin:A})})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(ee,{className:"text-gray-300",children:"已购全书"}),s.jsx(Ut,{checked:ft.hasFullBook,onCheckedChange:A=>Dt({...ft,hasFullBook:A})})]})]}),s.jsxs(xn,{children:[s.jsxs(Y,{variant:"outline",onClick:()=>F(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(ss,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(Y,{onClick:Nr,disabled:oe,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(kn,{className:"w-4 h-4 mr-2"}),oe?"保存中...":"保存"]})]})]})}),s.jsx(Bt,{open:Xt,onOpenChange:Sn,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-2xl max-h-[90vh] overflow-y-auto",children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(tn,{className:"w-5 h-5 text-[#38bdac]"}),Fn?"编辑规则":"添加规则"]})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"规则标题 *"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"例:匹配后填写头像、付款1980需填写信息",value:Mt.title,onChange:A=>pn({...Mt,title:A.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"规则描述"}),s.jsx(To,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[60px] resize-none",placeholder:"弹窗内容/推送文案...",value:Mt.description,onChange:A=>pn({...Mt,description:A.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"触发条件(可多选)"}),s.jsx("div",{className:"space-y-2",children:["用户状态","阅读行为","付费行为","社交行为","分销行为"].map(A=>{const je=F1.filter(Ae=>Ae.group===A);return je.length===0?null:s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] text-gray-500 mb-1",children:A}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:je.map(Ae=>{const $e=(Mt.triggerConditions||[]).includes(Ae.value);return s.jsx("button",{type:"button",className:`px-2.5 py-1 rounded-md text-xs border transition-colors ${$e?"bg-[#38bdac]/20 border-[#38bdac]/50 text-[#38bdac]":"bg-[#0a1628] border-gray-700 text-gray-400 hover:border-gray-500"}`,onClick:()=>{const et=Mt.triggerConditions||[],gt=$e?et.filter(Nn=>Nn!==Ae.value):[...et,Ae.value];pn({...Mt,triggerConditions:gt})},children:Ae.label},Ae.value)})})]},A)})}),(Mt.triggerConditions||[]).length>0&&s.jsxs("p",{className:"text-[10px] text-[#38bdac]",children:["已选 ",(Mt.triggerConditions||[]).length," 个触发条件(满足任一即触发)"]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{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:Mt.trigger,onChange:A=>pn({...Mt,trigger:A.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"推送动作"}),s.jsx("div",{className:"grid grid-cols-2 gap-2",children:B1.map(A=>s.jsxs("button",{type:"button",className:`p-2 rounded-lg border text-left transition-colors ${Mt.actionType===A.value?"bg-[#38bdac]/15 border-[#38bdac]/50":"bg-[#0a1628] border-gray-700 hover:border-gray-500"}`,onClick:()=>pn({...Mt,actionType:A.value}),children:[s.jsx("span",{className:`text-xs font-medium ${Mt.actionType===A.value?"text-[#38bdac]":"text-gray-300"}`,children:A.label}),s.jsx("p",{className:"text-[10px] text-gray-500 mt-0.5",children:A.desc})]},A.value))})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{children:s.jsx(ee,{className:"text-gray-300",children:"启用状态"})}),s.jsx(Ut,{checked:Mt.enabled,onCheckedChange:A=>pn({...Mt,enabled:A})})]})]}),s.jsxs(xn,{children:[s.jsxs(Y,{variant:"outline",onClick:()=>Sn(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(ss,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(Y,{onClick:Qc,disabled:oe,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(kn,{className:"w-4 h-4 mr-2"}),oe?"保存中...":"保存"]})]})]})}),s.jsx(Bt,{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(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(_n,{className:"w-5 h-5 text-[#38bdac]"}),"绑定关系 - ",le==null?void 0:le.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:((zl=H.stats)==null?void 0:zl.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:((Fi=H.stats)==null?void 0:Fi.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:["¥",(((Bi=H.stats)==null?void 0:Bi.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:["¥",(((ba=H.stats)==null?void 0:ba.pendingEarnings)||0).toFixed(2)]}),s.jsx("div",{className:"text-xs text-gray-400",children:"待提现"})]})]}),me?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:"加载中..."})]}):(((Xa=H.referrals)==null?void 0:Xa.length)??0)>0?s.jsx("div",{className:"space-y-2 max-h-[300px] overflow-y-auto",children:(H.referrals??[]).map((A,je)=>{var $e;const Ae=A;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:(($e=Ae.nickname)==null?void 0:$e.charAt(0))||"?"}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white text-sm",children:Ae.nickname}),s.jsx("div",{className:"text-xs text-gray-500",children:Ae.phone||(Ae.hasOpenId?"微信用户":"未绑定")})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[Ae.status==="vip"&&s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0 text-xs",children:"全书已购"}),Ae.status==="paid"&&s.jsxs(Ue,{className:"bg-blue-500/20 text-blue-400 border-0 text-xs",children:["已付费",Ae.purchasedSections,"章"]}),Ae.status==="free"&&s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 border-0 text-xs",children:"未付费"}),s.jsx("span",{className:"text-xs text-gray-500",children:Ae.createdAt?new Date(Ae.createdAt).toLocaleDateString():""})]})]},Ae.id||je)})}):s.jsx("div",{className:"text-center py-8 text-gray-500",children:"暂无绑定用户"})]}),s.jsx(xn,{children:s.jsx(Y,{variant:"outline",onClick:()=>U(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"关闭"})})]})}),s.jsx(_0,{open:ve,onClose:()=>ye(!1),userId:Se,onUserUpdated:Hr})]})}function cf(t,[e,n]){return Math.min(n,Math.max(e,t))}var a2=["PageUp","PageDown"],i2=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],o2={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Uc="Slider",[wg,e8,t8]=R0(Uc),[l2]=Oo(Uc,[t8]),[n8,fp]=l2(Uc),c2=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,...N}=t,w=b.useRef(new Set),k=b.useRef(0),C=o==="horizontal"?s8:r8,[R=[],O]=yl({prop:f,defaultProp:h,onChange:Q=>{var re;(re=[...w.current][k.current])==null||re.focus(),m(Q)}}),q=b.useRef(R);function $(Q){const B=c8(R,Q);te(Q,B)}function V(Q){te(Q,k.current)}function I(){const Q=q.current[k.current];R[k.current]!==Q&&x(R)}function te(Q,B,{commit:re}={commit:!1}){const ae=f8(i),J=p8(Math.round((Q-r)/i)*i+r,ae),F=cf(J,[r,a]);O((D=[])=>{const P=o8(D,F,B);if(h8(P,u*i)){k.current=P.indexOf(F);const oe=String(P)!==String(D);return oe&&re&&x(P),oe?P:D}else return D})}return s.jsx(n8,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:a,valueIndexToChangeRef:k,thumbs:w.current,values:R,orientation:o,form:v,children:s.jsx(wg.Provider,{scope:t.__scopeSlider,children:s.jsx(wg.Slot,{scope:t.__scopeSlider,children:s.jsx(C,{"aria-disabled":c,"data-disabled":c?"":void 0,...N,ref:e,onPointerDown:yt(N.onPointerDown,()=>{c||(q.current=R)}),min:r,max:a,inverted:y,onSlideStart:c?void 0:$,onSlideMove:c?void 0:V,onSlideEnd:c?void 0:I,onHomeKeyDown:()=>!c&&te(r,0,{commit:!0}),onEndKeyDown:()=>!c&&te(a,R.length-1,{commit:!0}),onStepKeyDown:({event:Q,direction:B})=>{if(!c){const J=a2.includes(Q.key)||Q.shiftKey&&i2.includes(Q.key)?10:1,F=k.current,D=R[F],P=i*J*B;te(D+P,F,{commit:!0})}}})})})})});c2.displayName=Uc;var[d2,u2]=l2(Uc,{startEdge:"left",endEdge:"right",size:"width",direction:1}),s8=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=Jt(e,C=>x(C)),v=b.useRef(void 0),N=dp(a),w=N==="ltr",k=w&&!i||!w&&i;function E(C){const R=v.current||m.getBoundingClientRect(),O=[0,R.width],$=z0(O,k?[n,r]:[r,n]);return v.current=R,$(C-R.left)}return s.jsx(d2,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:s.jsx(h2,{dir:N,"data-orientation":"horizontal",...f,ref:y,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 O=o2[k?"from-left":"from-right"].includes(C.key);h==null||h({event:C,direction:O?-1:1})}})})}),r8=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=Jt(e,f),x=b.useRef(void 0),y=!a;function v(N){const w=x.current||f.current.getBoundingClientRect(),k=[0,w.height],C=z0(k,y?[r,n]:[n,r]);return x.current=w,C(N-w.top)}return s.jsx(d2,{scope:t.__scopeSlider,startEdge:y?"bottom":"top",endEdge:y?"top":"bottom",size:"height",direction:y?1:-1,children:s.jsx(h2,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:N=>{const w=v(N.clientY);i==null||i(w)},onSlideMove:N=>{const w=v(N.clientY);o==null||o(w)},onSlideEnd:()=>{x.current=void 0,c==null||c()},onStepKeyDown:N=>{const k=o2[y?"from-bottom":"from-top"].includes(N.key);u==null||u({event:N,direction:k?-1:1})}})})}),h2=b.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:a,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:c,onStepKeyDown:u,...h}=t,f=fp(Uc,n);return s.jsx(wt.span,{...h,ref:e,onKeyDown:yt(t.onKeyDown,m=>{m.key==="Home"?(o(m),m.preventDefault()):m.key==="End"?(c(m),m.preventDefault()):a2.concat(i2).includes(m.key)&&(u(m),m.preventDefault())}),onPointerDown:yt(t.onPointerDown,m=>{const x=m.target;x.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(x)?x.focus():r(m)}),onPointerMove:yt(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&a(m)}),onPointerUp:yt(t.onPointerUp,m=>{const x=m.target;x.hasPointerCapture(m.pointerId)&&(x.releasePointerCapture(m.pointerId),i(m))})})}),f2="SliderTrack",p2=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=fp(f2,n);return s.jsx(wt.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...r,ref:e})});p2.displayName=f2;var jg="SliderRange",m2=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,a=fp(jg,n),i=u2(jg,n),o=b.useRef(null),c=Jt(e,o),u=a.values.length,h=a.values.map(x=>y2(x,a.min,a.max)),f=u>1?Math.min(...h):0,m=100-Math.max(...h);return s.jsx(wt.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...r,ref:c,style:{...t.style,[i.startEdge]:f+"%",[i.endEdge]:m+"%"}})});m2.displayName=jg;var kg="SliderThumb",x2=b.forwardRef((t,e)=>{const n=e8(t.__scopeSlider),[r,a]=b.useState(null),i=Jt(e,c=>a(c)),o=b.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return s.jsx(a8,{...t,ref:i,index:o})}),a8=b.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:a,...i}=t,o=fp(kg,n),c=u2(kg,n),[u,h]=b.useState(null),f=Jt(e,E=>h(E)),m=u?o.form||!!u.closest("form"):!0,x=D0(u),y=o.values[r],v=y===void 0?0:y2(y,o.min,o.max),N=l8(r,o.values.length),w=x==null?void 0:x[c.size],k=w?d8(w,v,c.direction):0;return b.useEffect(()=>{if(u)return o.thumbs.add(u),()=>{o.thumbs.delete(u)}},[u,o.thumbs]),s.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${v}% + ${k}px)`},children:[s.jsx(wg.ItemSlot,{scope:t.__scopeSlider,children:s.jsx(wt.span,{role:"slider","aria-label":t["aria-label"]||N,"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:yt(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),m&&s.jsx(g2,{name:a??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:y},r)]})});x2.displayName=kg;var i8="RadioBubbleInput",g2=b.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const a=b.useRef(null),i=Jt(a,r),o=L0(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(wt.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});g2.displayName=i8;function o8(t=[],e,n){const r=[...t];return r[n]=e,r.sort((a,i)=>a-i)}function y2(t,e,n){const i=100/(n-e)*(t-e);return cf(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=z0([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 z0(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function 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=c2,x8=p2,g8=m2,y8=x2;function b8({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(m8,{defaultValue:e,value:n,min:r,max:a,className:Qt("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 b2(t){const e=!!(t!=null&&t.embedded),[n,r]=b.useState(v8),[a,i]=b.useState(!0),[o,c]=b.useState(!1);b.useEffect(()=>{Le("/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 Et("/api/admin/referral-settings",f);if(!m||m.success===!1){ne.error("保存失败: "+(m&&typeof m=="object"&&"error"in m?m.error:""));return}ne.success(`✅ 分销配置已保存成功! - -• 小程序与网站的推广规则会一起生效 -• 绑定关系会使用新的天数配置 -• 佣金比例会立即应用到新订单 - -如有缓存,请刷新前台/小程序页面。`)}catch(f){console.error(f),ne.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(Mc,{className:"w-5 h-5 text-[#38bdac]"}),"推广 / 分销设置"]}),s.jsxs("p",{className:"text-gray-400 mt-1",children:["统一管理「好友优惠」「你得 90% 收益」「绑定期 30 天」「提现门槛」等规则,小程序和 Web 共用这套配置(与系统设置中的「推广功能」开关配合:开关在"," ",s.jsx(Tc,{to:"/settings",className:"text-[#38bdac] underline hover:text-[#5ee0d1]",children:"系统设置 → 功能开关"}),")。"]})]}),s.jsxs(Y,{onClick:u,disabled:o||a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(kn,{className:"w-4 h-4 mr-2"}),o?"保存中...":"保存配置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{children:[s.jsxs(ot,{className:"flex items-center gap-2 text-white",children:[s.jsx(OM,{className:"w-4 h-4 text-[#38bdac]"}),"推广规则"]}),s.jsx(Yt,{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(ee,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(xh,{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(ee,{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(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(ee,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(xh,{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(ee,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(xh,{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(ee,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(_n,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{children:[s.jsxs(ot,{className:"flex items-center gap-2 text-white",children:[s.jsx(Mc,{className:"w-4 h-4 text-[#38bdac]"}),"提现规则"]}),s.jsx(Yt,{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(ee,{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(ee,{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(ee,{className:"text-gray-300 flex items-center gap-2",children:["自动提现开关",s.jsx(Ue,{variant:"outline",className:"border-[#38bdac]/40 text-[#38bdac] text-[10px]",children:"预留"})]}),s.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[s.jsx(Ut,{checked:n.enableAutoWithdraw,onCheckedChange:f=>r(m=>({...m,enableAutoWithdraw:f}))}),s.jsx("span",{className:"text-sm text-gray-400",children:"开启后,可结合定时任务实现「收益自动打款到微信零钱」。"})]})]})]})})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(it,{children:s.jsxs(ot,{className:"flex items-center gap-2 text-gray-200 text-sm",children:[s.jsx(xh,{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]=w0(),[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([]),[N,w]=b.useState(!0),[k,E]=b.useState(null),[C,R]=b.useState(""),[O,q]=b.useState("all"),[$,V]=b.useState(1),[I,te]=b.useState(10),[Q,B]=b.useState(0),[re,ae]=b.useState(new Set),[J,F]=b.useState(null),[D,P]=b.useState(""),[oe,G]=b.useState(!1),[_,U]=b.useState(null),[H,K]=b.useState(""),[me,X]=b.useState(!1),[le,de]=b.useState(!1),[ve,ye]=b.useState(!1),[Se,Fe]=b.useState([]),[mt,kt]=b.useState(1),[ft,Dt]=b.useState(0),[Pt,Rn]=b.useState("");b.useEffect(()=>{yn()},[]),b.useEffect(()=>{const L=t.get("tab");(L==="overview"||L==="orders"||L==="bindings"||L==="withdrawals"||L==="settings")&&n(L)},[t]),b.useEffect(()=>{V(1)},[e,O]),b.useEffect(()=>{Wt(e)},[e]),b.useEffect(()=>{if(e==="orders"&&r==="giftpay"){Wt("giftPay",!0);return}["orders","bindings","withdrawals"].includes(e)&&Wt(e,!0)},[$,I,O,C,e,r,mt,Pt]),b.useEffect(()=>{e==="withdrawals"&&Mt()},[e]);async function yn(){E(null);try{const L=await Le("/api/admin/distribution/overview");L!=null&&L.success&&L.overview&&u(L.overview)}catch(L){console.error("[Admin] 概览接口异常:",L),E("加载概览失败")}try{const L=await Le("/api/db/users");v((L==null?void 0:L.users)||[])}catch(L){console.error("[Admin] 用户数据加载失败:",L)}}async function Wt(L,Ie=!1){var xt;if(!(!Ie&&re.has(L))){w(!0);try{const Rt=y;switch(L){case"overview":break;case"orders":{try{const pt=new URLSearchParams({page:String($),pageSize:String(I),...O!=="all"&&{status:O},...C&&{search:C}}),at=await Le(`/api/admin/orders?${pt}`);if(at!=null&&at.success&&at.orders){const At=at.orders.map(Kt=>{const en=Rt.find(Ws=>Ws.id===Kt.userId),ls=Kt.referrerId?Rt.find(Ws=>Ws.id===Kt.referrerId):null;return{...Kt,amount:parseFloat(String(Kt.amount))||0,userNickname:(en==null?void 0:en.nickname)||Kt.userNickname||"未知用户",userPhone:(en==null?void 0:en.phone)||Kt.userPhone||"-",referrerNickname:(ls==null?void 0:ls.nickname)||null,referrerCode:(ls==null?void 0:ls.referralCode)??null,type:Kt.productType||Kt.type}});o(At),B(at.total??At.length)}else o([]),B(0)}catch(pt){console.error(pt),E("加载订单失败"),o([])}break}case"bindings":{try{const pt=new URLSearchParams({page:String($),pageSize:String(I),...O!=="all"&&{status:O}}),at=await Le(`/api/db/distribution?${pt}`);f((at==null?void 0:at.bindings)||[]),B((at==null?void 0:at.total)??((xt=at==null?void 0:at.bindings)==null?void 0:xt.length)??0)}catch(pt){console.error(pt),E("加载绑定数据失败"),f([])}break}case"withdrawals":{try{const pt=O==="completed"?"success":O==="rejected"?"failed":O,at=new URLSearchParams({...pt&&pt!=="all"&&{status:pt},page:String($),pageSize:String(I)}),At=await Le(`/api/admin/withdrawals?${at}`);if(At!=null&&At.success&&At.withdrawals){const Kt=At.withdrawals.map(en=>({...en,account:en.account??"未绑定微信号",status:en.status==="success"?"completed":en.status==="failed"?"rejected":en.status}));x(Kt),B((At==null?void 0:At.total)??Kt.length)}else At!=null&&At.success||E(`获取提现记录失败: ${(At==null?void 0:At.error)||"未知错误"}`),x([])}catch(pt){console.error(pt),E("加载提现数据失败"),x([])}break}case"giftPay":{try{const pt=new URLSearchParams({page:String(mt),pageSize:"20",...Pt&&{status:Pt}}),at=await Le(`/api/admin/gift-pay-requests?${pt}`);at!=null&&at.success&&at.data?(Fe(at.data),Dt(at.total??at.data.length)):(Fe([]),Dt(0))}catch(pt){console.error(pt),E("加载代付请求失败"),Fe([])}break}}ae(pt=>new Set(pt).add(L))}catch(Rt){console.error(Rt)}finally{w(!1)}}}async function Xt(){E(null),ae(L=>{const Ie=new Set(L);return Ie.delete(e),e==="orders"&&r==="giftpay"&&Ie.delete("giftPay"),Ie}),e==="overview"&&yn(),e==="orders"&&r==="giftpay"?await Wt("giftPay",!0):await Wt(e,!0)}async function Sn(L){if(confirm("确认审核通过并打款?"))try{const Ie=await Zt("/api/admin/withdrawals",{id:L,action:"approve"});if(!(Ie!=null&&Ie.success)){const xt=(Ie==null?void 0:Ie.message)||(Ie==null?void 0:Ie.error)||"操作失败";ne.error(xt);return}await Xt()}catch(Ie){console.error(Ie),ne.error("操作失败")}}function Fn(L){U(L),K("")}async function Wn(){const L=_;if(!L)return;const Ie=H.trim();if(!Ie){ne.error("请填写拒绝原因");return}X(!0);try{const xt=await Zt("/api/admin/withdrawals",{id:L,action:"reject",errorMessage:Ie});if(!(xt!=null&&xt.success)){ne.error((xt==null?void 0:xt.error)||"操作失败");return}ne.success("已拒绝该提现申请"),U(null),K(""),await Xt()}catch(xt){console.error(xt),ne.error("操作失败")}finally{X(!1)}}async function Mt(){try{const L=await Le("/api/admin/withdrawals/auto-approve");L!=null&&L.success&&typeof L.enableAutoApprove=="boolean"&&de(L.enableAutoApprove)}catch{}}async function pn(L){ye(!0);try{const Ie=await Zt("/api/admin/withdrawals/auto-approve",{enableAutoApprove:L});Ie!=null&&Ie.success?(de(L),ne.success(L?"已开启自动审批,新提现将自动打款":"已关闭自动审批")):ne.error("更新失败: "+((Ie==null?void 0:Ie.error)??""))}catch{ne.error("更新失败")}finally{ye(!1)}}function bn(){_&&ne.info("已取消操作"),U(null),K("")}async function ge(){var L;if(!(!(J!=null&&J.orderSn)&&!(J!=null&&J.id))){G(!0),E(null);try{const Ie=await Zt("/api/admin/orders/refund",{orderSn:J.orderSn||J.id,reason:D||void 0});Ie!=null&&Ie.success?(F(null),P(""),await Wt("orders",!0)):E((Ie==null?void 0:Ie.error)||"退款失败")}catch(Ie){const xt=Ie;E(((L=xt==null?void 0:xt.data)==null?void 0:L.error)||"退款失败,请检查网络后重试")}finally{G(!1)}}}function Ce(L){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"},xt={active:"有效",converted:"已转化",expired:"已过期",cancelled:"已取消",pending:"待审核",pending_confirm:"待用户确认",processing:"处理中",completed:"已完成",rejected:"已拒绝"};return s.jsx(Ue,{className:`${Ie[L]||"bg-gray-500/20 text-gray-400"} border-0`,children:xt[L]||L})}const Be=Math.ceil(Q/I)||1,Ze=i,St=h.filter(L=>{var xt,Rt,pt,at;if(!C)return!0;const Ie=C.toLowerCase();return((xt=L.refereeNickname)==null?void 0:xt.toLowerCase().includes(Ie))||((Rt=L.refereePhone)==null?void 0:Rt.includes(Ie))||((pt=L.referrerName)==null?void 0:pt.toLowerCase().includes(Ie))||((at=L.referrerCode)==null?void 0:at.toLowerCase().includes(Ie))}),vt=m.filter(L=>{var xt;if(!C)return!0;const Ie=C.toLowerCase();return((xt=L.userName)==null?void 0:xt.toLowerCase().includes(Ie))||L.account&&L.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(Y,{onClick:Xt,disabled:N,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 ${N?"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:tf},{key:"orders",label:"订单与代付",icon:Zh},{key:"bindings",label:"绑定管理",icon:Ea},{key:"withdrawals",label:"提现审核",icon:Mc},{key:"settings",label:"推广设置",icon:mo}].map(L=>s.jsxs("button",{type:"button",onClick:()=>{n(L.key),q("all"),R(""),L.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===L.key?"bg-[#38bdac] text-white shadow-md":"text-gray-400 hover:text-white hover:bg-gray-700/40"}`,children:[s.jsx(L.icon,{className:"w-3.5 h-3.5"}),L.label]},L.key))}),N?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(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-4",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("span",{className:"text-sm font-medium text-gray-300 flex items-center gap-2",children:[s.jsx(ji,{className:"w-4 h-4 text-amber-400"}),"推广转化漏斗"]}),s.jsx(Y,{type:"button",size:"sm",variant:"ghost",onClick:()=>void Xt(),disabled:N,className:"text-gray-400 h-7",children:s.jsx(Ve,{className:`w-3.5 h-3.5 ${N?"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(ef,{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(Ea,{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(dx,{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(Zh,{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(De,{className:"bg-orange-500/10 border-orange-500/30",children:s.jsx(_e,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(hg,{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(De,{className:"bg-blue-500/10 border-blue-500/30",children:s.jsx(_e,{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Mc,{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(Y,{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(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-4",children:s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-white/5",children:[s.jsx(_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(dx,{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"),Wt("giftPay",!0)},children:[s.jsx(fg,{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(Aa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ce,{value:C,onChange:L=>R(L.target.value),placeholder:"搜索订单号、用户名、手机号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:O,onChange:L=>q(L.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(Y,{type:"button",variant:"outline",onClick:()=>void Xt(),disabled:N,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 ${N?"animate-spin":""}`}),"刷新"]})]}),s.jsx(De,{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:Ze.map(L=>{var Ie,xt;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=L.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:L.userNickname}),s.jsx("p",{className:"text-gray-500 text-xs",children:L.userPhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white text-sm",children:(()=>{const Rt=L.productType||L.type,pt=L.description||"",at=String(L.productId||L.sectionId||""),At=Rt==="vip"||pt.includes("VIP")||pt.toLowerCase().includes("vip")||at.toLowerCase().includes("vip");return Rt==="balance_recharge"?`余额充值 ¥${typeof L.amount=="number"?L.amount.toFixed(2):parseFloat(String(L.amount||"0")).toFixed(2)}`:At?"超级个体开通费用":Rt==="fullbook"?`${L.bookName||"《底层逻辑》"} - 全本`:Rt==="match"?"匹配次数购买":`${L.bookName||"《底层逻辑》"} - ${L.sectionTitle||L.chapterTitle||`章节${L.productId||L.sectionId||""}`}`})()}),s.jsx("p",{className:"text-gray-500 text-xs",children:(()=>{const Rt=L.productType||L.type,pt=L.description||"",at=String(L.productId||L.sectionId||""),At=Rt==="vip"||pt.includes("VIP")||pt.toLowerCase().includes("vip")||at.toLowerCase().includes("vip");return Rt==="balance_recharge"?"余额充值":At?"超级个体":Rt==="fullbook"?"全书解锁":Rt==="match"?"功能权益":L.chapterTitle||"单章购买"})()})]})}),s.jsxs("td",{className:"p-4 text-[#38bdac] font-bold",children:["¥",typeof L.amount=="number"?L.amount.toFixed(2):parseFloat(String(L.amount||"0")).toFixed(2)]}),s.jsx("td",{className:"p-4 text-gray-300",children:L.paymentMethod==="wechat"?"微信支付":L.paymentMethod==="balance"?"余额支付":L.paymentMethod==="alipay"?"支付宝":L.paymentMethod||"微信支付"}),s.jsx("td",{className:"p-4",children:L.status==="refunded"?s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 border-0",children:"已退款"}):L.status==="completed"||L.status==="paid"?s.jsx(Ue,{className:"bg-green-500/20 text-green-400 border-0",children:"已完成"}):L.status==="pending"||L.status==="created"?s.jsx(Ue,{className:"bg-yellow-500/20 text-yellow-400 border-0",children:"待支付"}):s.jsx(Ue,{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:L.refundReason,children:L.status==="refunded"&&L.refundReason?L.refundReason:"-"}),s.jsx("td",{className:"p-4 text-gray-300 text-sm",children:L.referrerId||L.referralCode?s.jsxs("span",{title:L.referralCode||L.referrerCode||L.referrerId||"",children:[L.referrerNickname||L.referralCode||L.referrerCode||((xt=L.referrerId)==null?void 0:xt.slice(0,8)),(L.referralCode||L.referrerCode)&&` (${L.referralCode||L.referrerCode})`]}):"-"}),s.jsx("td",{className:"p-4 text-[#FFD700]",children:L.referrerEarnings?`¥${(typeof L.referrerEarnings=="number"?L.referrerEarnings:parseFloat(String(L.referrerEarnings))).toFixed(2)}`:"-"}),s.jsx("td",{className:"p-4 text-gray-400 text-sm",children:L.createdAt?new Date(L.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:(L.status==="paid"||L.status==="completed")&&s.jsxs(Y,{variant:"outline",size:"sm",className:"border-orange-500/50 text-orange-400 hover:bg-orange-500/20",onClick:()=>{F(L),P("")},children:[s.jsx(Dj,{className:"w-3 h-3 mr-1"}),"退款"]})})]},L.id)})})]})}),e==="orders"&&s.jsx(sr,{page:$,totalPages:Be,total:Q,pageSize:I,onPageChange:V,onPageSizeChange:L=>{te(L),V(1)}})]})})]}),r==="giftpay"&&s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsx(it,{children:s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[s.jsx(ot,{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:Pt,onChange:L=>{Rn(L.target.value),kt(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(Y,{size:"sm",variant:"outline",onClick:()=>void Wt("giftPay",!0),disabled:N,className:"border-gray-600 text-gray-300",children:[s.jsx(Ve,{className:`w-3.5 h-3.5 mr-1 ${N?"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:Se.map(L=>s.jsxs("tr",{className:"hover:bg-[#0a1628]",children:[s.jsx("td",{className:"p-3 font-mono text-xs text-gray-400",children:L.requestSn}),s.jsx("td",{className:"p-3 text-white text-sm",children:L.initiatorNick||L.initiatorUserId}),s.jsxs("td",{className:"p-3",children:[s.jsxs("p",{className:"text-white",children:[L.productType," · ¥",L.amount.toFixed(2)]}),L.description&&s.jsx("p",{className:"text-gray-500 text-xs",children:L.description})]}),s.jsx("td",{className:"p-3 text-gray-400",children:(L.quantity??1)>1?`${L.quantity}份 / 已领${L.redeemedCount??0}`:"-"}),s.jsx("td",{className:"p-3 text-gray-400",children:L.payerNick||(L.payerUserId?L.payerUserId:"-")}),s.jsx("td",{className:"p-3",children:s.jsx(Ue,{className:L.status==="paid"?"bg-green-500/20 text-green-400 border-0":L.status==="pending"||L.status==="pending_pay"?"bg-amber-500/20 text-amber-400 border-0":L.status==="refunded"?"bg-red-500/20 text-red-400 border-0":"bg-gray-500/20 text-gray-400 border-0",children:L.status==="paid"?"已支付":L.status==="pending"||L.status==="pending_pay"?"待支付":L.status==="refunded"?"已退款":L.status==="cancelled"?"已取消":"已过期"})}),s.jsx("td",{className:"p-3 text-gray-400 text-xs",children:L.createdAt?new Date(L.createdAt).toLocaleString("zh-CN"):"-"})]},L.id))})]})}),Se.length===0&&!N&&s.jsx("p",{className:"text-center py-8 text-gray-500",children:"暂无代付请求"}),ft>20&&s.jsx("div",{className:"mt-4 flex justify-center",children:s.jsx(sr,{page:mt,totalPages:Math.ceil(ft/20),total:ft,pageSize:20,onPageChange:kt,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(Aa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ce,{value:C,onChange:L=>R(L.target.value),placeholder:"搜索用户昵称、手机号、推广码...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:O,onChange:L=>q(L.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(Y,{type:"button",variant:"outline",onClick:()=>void Xt(),disabled:N,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 ${N?"animate-spin":""}`}),"刷新"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-0",children:[St.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:St.map(L=>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:L.refereeNickname||"匿名用户"}),s.jsx("p",{className:"text-gray-500 text-xs",children:L.refereePhone})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white",children:L.referrerName||"-"}),s.jsx("p",{className:"text-gray-500 text-xs font-mono",children:L.referrerCode})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:L.boundAt?new Date(L.boundAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:L.expiresAt?new Date(L.expiresAt).toLocaleDateString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:Ce(L.status)}),s.jsx("td",{className:"p-4",children:L.commission?s.jsxs("span",{className:"text-[#38bdac] font-medium",children:["¥",L.commission.toFixed(2)]}):s.jsx("span",{className:"text-gray-500",children:"-"})})]},L.id))})]})}),e==="bindings"&&s.jsx(sr,{page:$,totalPages:Be,total:Q,pageSize:I,onPageChange:V,onPageSizeChange:L=>{te(L),V(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(Aa,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),s.jsx(ce,{value:C,onChange:L=>R(L.target.value),placeholder:"搜索用户名称、账号...",className:"pl-10 bg-[#0f2137] border-gray-700 text-white"})]}),s.jsxs("select",{value:O,onChange:L=>q(L.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(ji,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx("span",{className:"text-sm text-gray-300",children:"自动审批"}),s.jsx(Ut,{checked:le,onCheckedChange:pn,disabled:ve,className:"data-[state=checked]:bg-[#38bdac]"})]}),s.jsxs(Y,{type:"button",variant:"outline",onClick:()=>void Xt(),disabled:N,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 ${N?"animate-spin":""}`}),"刷新"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-0",children:[vt.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:vt.map(L=>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:[L.userAvatar?s.jsx("img",{src:L.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:(L.userName||L.name||"?").slice(0,1)}),s.jsx("p",{className:"text-white font-medium",children:L.userName||L.name})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"text-[#38bdac] font-bold",children:["¥",L.amount.toFixed(2)]})}),s.jsx("td",{className:"p-4",children:s.jsx(Ue,{className:L.method==="wechat"?"bg-green-500/20 text-green-400 border-0":"bg-blue-500/20 text-blue-400 border-0",children:L.method==="wechat"?"微信":"支付宝"})}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-mono text-xs",children:L.account}),s.jsx("p",{className:"text-gray-500 text-xs",children:L.name})]})}),s.jsx("td",{className:"p-4 text-gray-400",children:L.createdAt?new Date(L.createdAt).toLocaleString("zh-CN"):"-"}),s.jsx("td",{className:"p-4",children:Ce(L.status)}),s.jsx("td",{className:"p-4 max-w-[160px]",children:s.jsx("span",{className:`text-xs ${L.status==="rejected"||L.status==="failed"?"text-red-400":"text-gray-400"}`,title:L.remark,children:L.remark||"-"})}),s.jsx("td",{className:"p-4 text-right",children:L.status==="pending"&&s.jsxs("div",{className:"flex gap-2 justify-end",children:[s.jsxs(Y,{size:"sm",onClick:()=>Sn(L.id),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(dx,{className:"w-4 h-4 mr-1"}),"通过"]}),s.jsxs(Y,{size:"sm",variant:"outline",onClick:()=>Fn(L.id),className:"border-red-500/50 text-red-400 hover:bg-red-500/20",children:[s.jsx(Aj,{className:"w-4 h-4 mr-1"}),"拒绝"]})]})})]},L.id))})]})}),e==="withdrawals"&&s.jsx(sr,{page:$,totalPages:Be,total:Q,pageSize:I,onPageChange:V,onPageSizeChange:L=>{te(L),V(1)}})]})})]})]}),s.jsx(Bt,{open:!!J,onOpenChange:L=>!L&&F(null),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Vt,{children:s.jsx(Ht,{className:"text-white",children:"订单退款"})}),J&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["订单号:",J.orderSn||J.id]}),s.jsxs("p",{className:"text-gray-400 text-sm",children:["退款金额:¥",typeof J.amount=="number"?J.amount.toFixed(2):parseFloat(String(J.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:D,onChange:L=>P(L.target.value)})})]}),s.jsx("p",{className:"text-orange-400/80 text-xs",children:"退款将原路退回至用户微信,且无法撤销,请确认后再操作。"})]}),s.jsxs(xn,{children:[s.jsx(Y,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:()=>F(null),disabled:oe,children:"取消"}),s.jsx(Y,{className:"bg-orange-500 hover:bg-orange-600 text-white",onClick:ge,disabled:oe,children:oe?"退款中...":"确认退款"})]})]})}),s.jsx(Bt,{open:!!_,onOpenChange:L=>!L&&bn(),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Vt,{children:s.jsx(Ht,{className:"text-white",children:"拒绝提现"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"拒绝后该笔提现金额将返还用户余额。"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"拒绝原因(必填)"}),s.jsx("div",{className:"form-input",children:s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:H,onChange:L=>K(L.target.value)})})]})]}),s.jsxs(xn,{children:[s.jsx(Y,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:bn,disabled:me,children:"取消"}),s.jsx(Y,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:Wn,disabled:me||!H.trim(),children:me?"提交中...":"确认拒绝"})]})]})}),e==="settings"&&s.jsx("div",{className:"-mx-8 -mt-6",children:s.jsx(b2,{embedded:!0})})]})}function w8(){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,N]=b.useState(0),[w,k]=b.useState(null),[E,C]=b.useState(null),[R,O]=b.useState(""),[q,$]=b.useState(!1);async function V(){var J,F,D,P,oe,G,_;i(!0),c(null);try{const U=new URLSearchParams({status:u,page:String(f),pageSize:String(x)}),H=await Le(`/api/admin/withdrawals?${U}`);if(H!=null&&H.success){const K=H.withdrawals||[];e(K),N(H.total??((J=H.stats)==null?void 0:J.total)??K.length),r({total:((F=H.stats)==null?void 0:F.total)??H.total??K.length,pendingCount:((D=H.stats)==null?void 0:D.pendingCount)??0,pendingAmount:((P=H.stats)==null?void 0:P.pendingAmount)??0,successCount:((oe=H.stats)==null?void 0:oe.successCount)??0,successAmount:((G=H.stats)==null?void 0:G.successAmount)??0,failedCount:((_=H.stats)==null?void 0:_.failedCount)??0})}else c("加载提现记录失败")}catch(U){console.error("Load withdrawals error:",U),c("加载失败,请检查网络后重试")}finally{i(!1)}}b.useEffect(()=>{m(1)},[u]),b.useEffect(()=>{V()},[u,f,x]);const I=Math.ceil(v/x)||1;async function te(J){const F=t.find(D=>D.id===J);if(F!=null&&F.userCommissionInfo&&F.userCommissionInfo.availableAfterThis<0){if(!confirm(`⚠️ 风险警告:该用户审核后余额为负数(¥${F.userCommissionInfo.availableAfterThis.toFixed(2)}),可能存在超额提现。 - -确认已核实用户账户并完成打款?`))return}else if(!confirm("确认已完成打款?批准后将更新用户提现记录。"))return;k(J);try{const D=await Zt("/api/admin/withdrawals",{id:J,action:"approve"});D!=null&&D.success?V():ne.error("操作失败: "+((D==null?void 0:D.error)??""))}catch{ne.error("操作失败")}finally{k(null)}}function Q(J){C(J),O("")}async function B(){const J=E;if(!J)return;const F=R.trim();if(!F){ne.error("请填写拒绝原因");return}$(!0);try{const D=await Zt("/api/admin/withdrawals",{id:J,action:"reject",errorMessage:F});D!=null&&D.success?(ne.success("已拒绝该提现申请"),C(null),O(""),V()):ne.error("操作失败: "+((D==null?void 0:D.error)??""))}catch{ne.error("操作失败")}finally{$(!1)}}function re(){E&&ne.info("已取消操作"),C(null),O("")}function ae(J){switch(J){case"pending":return s.jsx(Ue,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待处理"});case"pending_confirm":return s.jsx(Ue,{className:"bg-orange-500/20 text-orange-400 hover:bg-orange-500/20 border-0",children:"待用户确认"});case"processing":return s.jsx(Ue,{className:"bg-blue-500/20 text-blue-400 hover:bg-blue-500/20 border-0",children:"已审批等待打款"});case"success":case"completed":return s.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"已完成"});case"failed":case"rejected":return s.jsx(Ue,{className:"bg-red-500/20 text-red-400 hover:bg-red-500/20 border-0",children:"已拒绝"});default:return s.jsx(Ue,{className:"bg-gray-500/20 text-gray-400 border-0",children:J})}}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(Y,{variant:"outline",onClick:V,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(De,{className:"bg-gradient-to-r from-[#38bdac]/10 to-[#0f2137] border-[#38bdac]/30 mb-6",children:s.jsx(_e,{className:"p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Zh,{className:"w-5 h-5 text-[#38bdac] mt-0.5"}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-white font-medium mb-2",children:"自动分账规则"}),s.jsxs("div",{className:"text-sm text-gray-400 space-y-1",children:[s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"分销比例"}),":推广者获得订单金额的"," ",s.jsx("span",{className:"text-white font-medium",children:"90%"})]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"结算方式"}),":用户付款后,分销收益自动计入推广者账户"]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"提现方式"}),":用户在小程序端点击提现,系统自动转账到微信零钱"]}),s.jsxs("p",{children:["• ",s.jsx("span",{className:"text-[#38bdac]",children:"审批流程"}),":待处理的提现需管理员手动确认打款后批准(自动审批开关在推广中心-提现审核)"]})]})]})]})})}),s.jsxs("div",{className:"grid grid-cols-4 gap-4 mb-6",children:[s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-[#38bdac]",children:n.total}),s.jsx("div",{className:"text-sm text-gray-400",children:"总申请"})]})}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-orange-400",children:n.pendingCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"待处理"}),s.jsxs("div",{className:"text-xs text-orange-400 mt-1",children:["¥",n.pendingAmount.toFixed(2)]})]})}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-green-400",children:n.successCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"已完成"}),s.jsxs("div",{className:"text-xs text-green-400 mt-1",children:["¥",n.successAmount.toFixed(2)]})]})}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsxs(_e,{className:"p-4 text-center",children:[s.jsx("div",{className:"text-3xl font-bold text-red-400",children:n.failedCount}),s.jsx("div",{className:"text-sm text-gray-400",children:"已拒绝"})]})})]}),s.jsx("div",{className:"flex gap-2 mb-4",children:["all","pending","success","failed"].map(J=>s.jsx(Y,{variant:u===J?"default":"outline",size:"sm",onClick:()=>h(J),className:u===J?"bg-[#38bdac] hover:bg-[#2da396] text-white":"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:J==="all"?"全部":J==="pending"?"待处理":J==="success"?"已完成":"已拒绝"},J))}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:a?s.jsxs("div",{className:"flex items-center justify-center py-12",children:[s.jsx(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(Mc,{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(J=>s.jsxs("tr",{className:"hover:bg-[#0a1628] transition-colors",children:[s.jsx("td",{className:"p-4 text-gray-400",children:new Date(J.createdAt??"").toLocaleString()}),s.jsx("td",{className:"p-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[J.userAvatar?s.jsx("img",{src:So(J.userAvatar),alt:J.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:(J.userName??"?").charAt(0)}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-white",children:J.userName??"未知"}),s.jsx("p",{className:"text-xs text-gray-500",children:J.userPhone??J.referralCode??(J.userId??"").slice(0,10)})]})]})}),s.jsx("td",{className:"p-4",children:s.jsxs("span",{className:"font-bold text-orange-400",children:["¥",Number(J.amount).toFixed(2)]})}),s.jsx("td",{className:"p-4",children:J.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:["¥",J.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:["¥",J.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:["¥",J.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:J.userCommissionInfo.availableAfterThis>=0?"text-green-400 font-medium":"text-red-400 font-medium",children:["¥",J.userCommissionInfo.availableAfterThis.toFixed(2)]})]})]}):s.jsx("span",{className:"text-gray-500 text-xs",children:"暂无数据"})}),s.jsx("td",{className:"p-4",children:ae(J.status)}),s.jsx("td",{className:"p-4 max-w-[180px]",children:s.jsx("span",{className:`text-xs ${J.status==="rejected"||J.status==="failed"?"text-red-400":"text-gray-400"}`,title:J.remark,children:J.remark||"-"})}),s.jsx("td",{className:"p-4 text-gray-400",children:J.processedAt?new Date(J.processedAt).toLocaleString():"-"}),s.jsx("td",{className:"p-4 text-gray-400",children:J.userConfirmedAt?s.jsxs("span",{className:"text-green-400",title:J.userConfirmedAt,children:["已确认 ",new Date(J.userConfirmedAt).toLocaleString()]}):"-"}),s.jsxs("td",{className:"p-4 text-right",children:[(J.status==="pending"||J.status==="pending_confirm")&&s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsxs(Y,{size:"sm",onClick:()=>te(J.id),disabled:w===J.id,className:"bg-green-600 hover:bg-green-700 text-white",children:[s.jsx(ip,{className:"w-4 h-4 mr-1"}),"批准"]}),s.jsxs(Y,{size:"sm",variant:"outline",onClick:()=>Q(J.id),disabled:w===J.id,className:"border-red-500/50 text-red-400 hover:bg-red-500/10 bg-transparent",children:[s.jsx(ss,{className:"w-4 h-4 mr-1"}),"拒绝"]})]}),(J.status==="success"||J.status==="completed")&&J.transactionId&&s.jsx("span",{className:"text-xs text-gray-500 font-mono",children:J.transactionId})]})]},J.id))})]})}),s.jsx(sr,{page:f,totalPages:I,total:v,pageSize:x,onPageChange:m,onPageSizeChange:J=>{y(J),m(1)}})]})})}),s.jsx(Bt,{open:!!E,onOpenChange:J=>!J&&re(),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",children:[s.jsx(Vt,{children:s.jsx(Ht,{className:"text-white",children:"拒绝提现"})}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-gray-400 text-sm",children:"拒绝后该笔提现金额将返还用户余额。"}),s.jsxs("div",{children:[s.jsx("label",{className:"text-sm text-gray-400 block mb-2",children:"拒绝原因(必填)"}),s.jsx("div",{className:"form-input",children:s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white placeholder:text-gray-500",placeholder:"请输入拒绝原因",value:R,onChange:J=>O(J.target.value)})})]})]}),s.jsxs(xn,{children:[s.jsx(Y,{variant:"outline",className:"border-gray-600 text-gray-300",onClick:re,disabled:q,children:"取消"}),s.jsx(Y,{className:"bg-red-600 hover:bg-red-700 text-white",onClick:B,disabled:q||!R.trim(),children:q?"提交中...":"确认拒绝"})]})]})})]})}var jx={exports:{}},kx={};/** - * @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 H1;function j8(){if(H1)return kx;H1=1;var t=du();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}}),N=v[0].inst,w=v[1];return i(function(){N.value=y,N.getSnapshot=x,u(N)&&w({inst:N})},[m,y,x]),a(function(){return u(N)&&w({inst:N}),m(function(){u(N)&&w({inst:N})})},[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 kx.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,kx}var U1;function v2(){return U1||(U1=1,jx.exports=j8()),jx.exports}var N2=v2();function ps(t){this.content=t}ps.prototype={constructor:ps,find:function(t){for(var e=0;e>1}};ps.from=function(t){if(t instanceof ps)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new ps(e)};function w2(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=w2(a.content,i.content,n+1);if(o!=null)return o}n+=a.nodeSize}}function j2(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 Ne(r,a)}cutByIndex(e,n){return e==n?Ne.empty:e==0&&n==this.content.length?this:new Ne(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 Ne(a,i)}addToStart(e){return new Ne([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Ne(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?Sh(n+1,i):Sh(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 Ne.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Ne(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Ne.empty;let n,r=0;for(let a=0;athis.type.rank&&(n||(n=e.slice(0,a)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-a.type.rank),n}};an.none=[];class uf extends Error{}class ze{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=S2(this.content,e+this.openStart,n);return r&&new ze(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ze(k2(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 ze.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 ze(Ne.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 ze(e,r,a)}}ze.empty=new ze(Ne.empty,0,0);function k2(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(k2(i.content,e-a-1,n-a-1)))}function S2(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=S2(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 uf("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new uf("Inconsistent open depths");return C2(t,e,n,0)}function C2(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 _d(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&&Cg(t,e,a+1),o=r.depth>a&&Cg(n,r,a+1),c=[];return _d(null,t,a,c),i&&o&&e.index(a)==n.index(a)?(T2(i,o),hl(fl(i,E2(t,e,n,r,a+1)),c)):(i&&hl(fl(i,hf(t,e,a+1)),c),_d(e,n,a,c),o&&hl(fl(o,hf(n,r,a+1)),c)),_d(r,null,a,c),new Ne(c)}function hf(t,e,n){let r=[];if(_d(null,t,n,r),t.depth>n){let a=Cg(t,e,n+1);hl(fl(a,hf(t,e,n+1)),r)}return _d(e,null,n,r),new Ne(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(Ne.from(a));return{start:a.resolveNoCache(t.openStart+n),end:a.resolveNoCache(a.content.size-t.openEnd-n)}}class Yd{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 ff(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 Yd(n,r,i)}static resolveCached(e,n){let r=W1.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()+")"),M2(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=Ne.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=Ne.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,a,r);return i.type.checkAttrs(i.attrs),i}};bi.prototype.text=void 0;class pf extends bi{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):M2(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 pf(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new pf(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 M2(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Nl{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new M8(e,n);if(r.next==null)return Nl.empty;let a=A2(r);r.next&&r.err("Unexpected trailing text");let i=D8(L8(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(` -`)}}Nl.empty=new Nl(!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 A2(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=O8(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=P8(t,e);else break;return e}function K1(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function P8(t,e){let n=K1(t),r=n;return t.eat(",")&&(t.next!="}"?r=K1(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 O8(t){if(t.eat("(")){let e=A2(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 Nl(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:R2(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new bi(this,this.computeAttrs(e),Ne.from(n),an.setFrom(r))}createChecked(e=null,n,r){return n=Ne.from(n),this.checkContent(n),new bi(this,this.computeAttrs(e),n,an.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=Ne.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(Ne.empty,!0);return i?new bi(this,e,n.append(i),an.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;nr[i]=new D2(i,n,o));let a=n.spec.topNode||"doc";if(!r[a])throw new RangeError("Schema is missing its top node type ('"+a+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function z8(t,e,n){let r=n.split("|");return a=>{let i=a===null?"null":typeof a;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class $8{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?z8(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class pp{constructor(e,n,r,a){this.name=e,this.rank=n,this.schema=r,this.spec=a,this.attrs=L2(e,a.attrs),this.excluded=null;let i=P2(this.attrs);this.instance=i?new an(this,i):null}create(e=null){return!e&&this.instance?this.instance:new an(this,R2(this.attrs,e))}static compile(e,n){let r=Object.create(null),a=0;return e.forEach((i,o)=>r[i]=new pp(i,a++,n,o)),r}removeFromSet(e){for(var n=0;n-1}}class _2{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=ps.from(e.nodes),n.marks=ps.from(e.marks||{}),this.nodes=G1.compile(this.spec.nodes,this),this.marks=pp.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]=Nl.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?J1(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==""?[]:J1(this,o.split(" "))}this.nodeFromJSON=a=>bi.fromJSON(this,a),this.markFromJSON=a=>an.fromJSON(this,a),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,a){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof G1){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 pf(r,r.defaultAttrs,e,an.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function J1(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 No{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 Y1(this,n,!1);return r.addAll(e,an.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Y1(this,n,!0);return r.addAll(e,an.none,n.from,n.to),ze.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=X1(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=X1(o)),o.node||o.ignore||o.mark||(o.node=a)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new No(e,No.schemaRules(e)))}}const z2={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},$2={ol:!0,ul:!0},Xd=1,Eg=2,zd=4;function Q1(t,e,n){return e!=null?(e?Xd:0)|(e==="full"?Eg:0):t&&t.whitespace=="pre"?Xd|Eg:n&~zd}class Ch{constructor(e,n,r,a,i,o){this.type=e,this.attrs=n,this.marks=r,this.solid=a,this.options=o,this.content=[],this.activeMarks=an.none,this.match=i||(o&zd?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Ne.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&Xd)){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=Ne.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(Ne.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&&!z2.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Y1{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=Q1(null,n.preserveWhitespace,0)|(r?zd:0);a?i=new Ch(a.type,a.attrs,an.none,!0,n.topMatch||a.type.contentMatch,o):r?i=new Ch(null,null,an.none,!0,null,o):i=new Ch(e.schema.topNodeType,null,an.none,!0,null,o),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,a=this.top,i=a.options&Eg?"full":this.localPreserveWS||(a.options&Xd)>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):Z1(h.type,e))?(u=h.addToSet(u),!1):!0),this.nodes.push(new Ch(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|=Xd)}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&&$2.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 X1(t){let e={};for(let n in t)e[n]=t[n];return e}function Z1(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&&Uh(Cx(r),a(e,n),null,e.attrs)}static renderSpec(e,n,r=null,a){return Uh(e,n,r,a)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Il(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=eN(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return eN(e.marks)}}function eN(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Cx(t){return t.document||window.document}const tN=new WeakMap;function W8(t){let e=tN.get(t);return e===void 0&&tN.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:y,contentDOM:v}=Uh(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 F2=65535,B2=Math.pow(2,16);function q8(t,e){return t+e*B2}function nN(t){return t&F2}function G8(t){return(t-(t&F2))/B2}const V2=1,H2=2,Wh=4,U2=8;class Mg{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&U2)>0}get deletedBefore(){return(this.delInfo&(V2|Wh))>0}get deletedAfter(){return(this.delInfo&(H2|Wh))>0}get deletedAcross(){return(this.delInfo&Wh)>0}}class pr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&pr.empty)return pr.empty}recover(e){let n=0,r=nN(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:q8(c/3,e-u),N=e==u?H2:e==m?V2:Wh;return(n<0?e!=u:e!=m)&&(N|=U2),new Mg(y,N,v)}a+=f-h}return r?e+a:new Mg(e+a,0,null)}touches(e,n){let r=0,a=nN(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 Zd;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 Hn.fromReplace(e,this.from,this.to,i)}invert(){return new na(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new xo(n.pos,r.pos,this.mark)}merge(e){return e instanceof xo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new xo(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 xo(n.from,n.to,e.markFromJSON(n.mark))}}Os.jsonID("addMark",xo);class na extends Os{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 ze($0(n.content,a=>a.mark(this.mark.removeFromSet(a.marks)),e),n.openStart,n.openEnd);return Hn.fromReplace(e,this.from,this.to,r)}invert(){return new xo(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new na(n.pos,r.pos,this.mark)}merge(e){return e instanceof na&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new na(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new na(n.from,n.to,e.markFromJSON(n.mark))}}Os.jsonID("removeMark",na);class go extends Os{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Hn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Hn.fromReplace(e,this.pos,this.pos+1,new ze(Ne.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 as(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 as(n.from,n.to,n.gapFrom,n.gapTo,ze.fromJSON(e,n.slice),n.insert,!!n.structure)}}Os.jsonID("replaceAround",as);function Ag(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),y=Math.min(h+u.nodeSize,n),v=r.addToSet(m);for(let N=0;Nt.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 pp){let h=o.marks,f;for(;f=r.isInSet(h);)(u||(u=[])).push(f),h=f.removeFromSet(h)}else r?r.isInSet(o.marks)&&(u=[r]):u=o.marks;if(u&&u.length){let h=Math.min(c+o.nodeSize,n);for(let f=0;ft.step(new na(o.from,o.to,o.style)))}function F0(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 Wc(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--)N||r.index(v)>0?(N=!0,f=Ne.from(r.node(v).copy(f)),m++):u--;let x=Ne.empty,y=0;for(let v=i,N=!1;v>n;v--)N||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=Ne.from(n[o].type.create(n[o].attrs,r))}let a=e.start,i=e.end;t.step(new as(a,i,a,i,new ze(r,0,0),n.length,!0))}function nO(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)&&sO(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&&K2(t,o,c,i),F0(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 as(m,x,m+1,x-1,new ze(Ne.from(r.create(u,null,o.marks)),0,0),1,!0)),h===!0&&W2(t,o,c,i),!1}})}function W2(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 K2(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 sO(t,e,n){let r=t.resolve(e),a=r.index();return r.parent.canReplaceWith(a,a+1,n)}function rO(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 as(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new ze(Ne.from(o),0,0),1,!0))}function vi(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 N=r&&r[f]||m;if(!m.canReplace(x+1,m.childCount)||!N.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 aO(t,e,n=1,r){let a=t.doc.resolve(e),i=Ne.empty,o=Ne.empty;for(let c=a.depth,u=a.depth-n,h=n-1;c>u;c--,h--){i=Ne.from(a.node(c).copy(i));let f=r&&r[h];o=Ne.from(f?f.type.create(f.attrs,o):a.node(c).copy(o))}t.step(new rs(e,e,new ze(i.append(o),n,n),!0))}function Lo(t,e){let n=t.resolve(e),r=n.index();return q2(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function iO(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&&q2(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 oO(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);K2(t,f.node(),f.before(),c)}o.inlineContent&&F0(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 rs(h,u.map(e+n,-1),ze.empty,!0)),r===!0){let f=t.doc.resolve(h);W2(t,f.node(),f.before(),t.steps.length)}return t}function lO(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 xp(t,e,n=e,r=ze.empty){if(e==n&&!r.size)return null;let a=t.resolve(e),i=t.resolve(n);return J2(a,i,r)?new rs(e,n,r):new cO(a,i,r).fit()}function J2(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class cO{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=Ne.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=Ne.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 ze(i,o,c);return e>-1?new as(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new rs(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=Ex(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(Ne.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=Ex(e,n);return!a.childCount||a.firstChild.isLeaf?!1:(this.unplaced=new ze(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=Ex(e,n);if(a.childCount<=1&&n>0){let i=e.size-n<=n+a.size;this.unplaced=new ze(Ed(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new ze(Ed(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 N=0;N1||u==0||N.content.size)&&(m=w,f.push(Q2(N.mark(x.allowedMarks(N.marks)),h==1?u:0,h==c.childCount?y:-1)))}let v=h==c.childCount;v||(y=-1),this.placed=Md(this.placed,n,Ne.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 N=0,w=c;N1&&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=Mx(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=Md(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=Md(this.placed,this.depth,Ne.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(Ne.empty,!0);n.childCount&&(this.placed=Md(this.placed,this.frontier.length,n))}}function Ed(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Ed(t.firstChild.content,e-1,n)))}function Md(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Md(t.lastChild.content,e-1,n)))}function Ex(t,e){for(let n=0;n1&&(r=r.replaceChild(0,Q2(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(Ne.empty,!0)))),t.copy(r)}function Mx(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&&!dO(n,i.content,o)?c:null}function dO(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=uO(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 N=0;N=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 Y2(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(Ne.empty,!0))}return t}function fO(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let a=lO(t.doc,e,r.type);a!=null&&(e=n=a)}t.replaceRange(e,n,new ze(Ne.from(r),0,0))}function pO(t,e,n){let r=t.doc.resolve(e),a=t.doc.resolve(n),i=X2(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 X2(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 kc extends Os{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 Hn.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 Hn.fromReplace(e,this.pos,this.pos+1,new ze(Ne.from(a),0,n.isLeaf?0:1))}getMap(){return pr.empty}invert(e){return new kc(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 kc(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 kc(n.pos,n.attr,n.value)}}Os.jsonID("attr",kc);class eu extends Os{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 Hn.ok(r)}getMap(){return pr.empty}invert(e){return new eu(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 eu(n.attr,n.value)}}Os.jsonID("docAttr",eu);let Pc=class extends Error{};Pc=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Pc.prototype=Object.create(Error.prototype);Pc.prototype.constructor=Pc;Pc.prototype.name="TransformError";class V0{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Zd}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Pc(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=ze.empty){let a=xp(this.doc,e,n,r);return a&&this.step(a),this}replaceWith(e,n,r){return this.replace(e,n,new ze(Ne.from(r),0,0))}delete(e,n){return this.replace(e,n,ze.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return hO(this,e,n,r),this}replaceRangeWith(e,n,r){return fO(this,e,n,r),this}deleteRange(e,n){return pO(this,e,n),this}lift(e,n){return X8(this,e,n),this}join(e,n=1){return oO(this,e,n),this}wrap(e,n){return tO(this,e,n),this}setBlockType(e,n=e,r,a=null){return nO(this,e,n,r,a),this}setNodeMarkup(e,n,r=null,a){return rO(this,e,n,r,a),this}setNodeAttribute(e,n,r){return this.step(new kc(e,n,r)),this}setDocAttribute(e,n){return this.step(new eu(e,n)),this}addNodeMark(e,n){return this.step(new go(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof an)n.isInSet(r.marks)&&this.step(new wl(e,n));else{let a=r.marks,i,o=[];for(;i=n.isInSet(a);)o.push(new wl(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 aO(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 F0(this,e,n,r),this}}const Ax=Object.create(null);class lt{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Z2(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?fc(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):fc(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 xr(e.node(0))}static atStart(e){return fc(e,e,0,0,1)||new xr(e)}static atEnd(e){return fc(e,e,e.content.size,e.childCount,-1)||new xr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ax[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 Ax)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ax[e]=n,n.prototype.jsonID=e,n}getBookmark(){return nt.between(this.$anchor,this.$head).getBookmark()}}lt.prototype.visible=!0;class Z2{constructor(e,n){this.$from=e,this.$to=n}}let rN=!1;function aN(t){!rN&&!t.parent.inlineContent&&(rN=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class nt extends lt{constructor(e,n=e){aN(e),aN(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 lt.near(r);let a=e.resolve(n.map(this.anchor));return new nt(a.parent.inlineContent?a:r,r)}replace(e,n=ze.empty){if(super.replace(e,n),n==ze.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof nt&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new gp(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 nt(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=lt.findFrom(n,r,!0)||lt.findFrom(n,-r,!0);if(i)n=i.$head;else return lt.near(n,r)}return e.parent.inlineContent||(a==0?e=n:(e=(lt.findFrom(e,-r,!0)||lt.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&&tt.isSelectable(c))return tt.create(t,n-(a<0?c.nodeSize:0))}else{let u=fc(t,c,n+a,a<0?c.childCount:0,a,i);if(u)return u}n+=c.nodeSize*a}return null}function iN(t,e,n){let r=t.steps.length-1;if(r{o==null&&(o=f)}),t.setSelection(lt.near(t.doc.resolve(o),n))}const oN=1,Th=2,lN=4;class xO extends V0{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|=Th,this}ensureMarks(e){return an.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Th)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Th,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||an.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let a=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(a.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(n);i=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,a.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(lt.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|=lN,this}get scrolledIntoView(){return(this.updated&lN)>0}}function cN(t,e){return!e||!t?t:t.bind(e)}class Ad{constructor(e,n,r){this.name=e,this.init=cN(n.init,r),this.apply=cN(n.apply,r)}}const gO=[new Ad("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Ad("selection",{init(t,e){return t.selection||lt.atStart(e.doc)},apply(t){return t.selection}}),new Ad("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Ad("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Ix{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=gO.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 Ad(r.key,r.spec.state,r))})}}class Nc{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 Ix(e.schema,e.plugins),i=new Nc(a);return a.fields.forEach(o=>{if(o.name=="doc")i.doc=bi.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=lt.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 eS(t,e,n){for(let r in t){let a=t[r];a instanceof Function?a=a.bind(e):r=="handleDOMEvents"&&(a=eS(a,e,{})),n[r]=a}return n}class dn{constructor(e){this.spec=e,this.props={},e.props&&eS(e.props,this,this.props),this.key=e.key?e.key.key:tS("plugin")}getState(e){return e[this.key]}}const Px=Object.create(null);function tS(t){return t in Px?t+"$"+ ++Px[t]:(Px[t]=0,t+"$")}class gn{constructor(e="key"){this.key=tS(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const U0=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function nS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const sS=(t,e,n)=>{let r=nS(t,n);if(!r)return!1;let a=W0(r);if(!a){let o=r.blockRange(),c=o&&Wc(o);return c==null?!1:(e&&e(t.tr.lift(o,c).scrollIntoView()),!0)}let i=a.nodeBefore;if(hS(t,a,e,-1))return!0;if(r.parent.content.size==0&&(Rc(i,"end")||tt.isSelectable(i)))for(let o=r.depth;;o--){let c=xp(t.doc,r.before(o),r.after(o),ze.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},yO=(t,e,n)=>{let r=nS(t,n);if(!r)return!1;let a=W0(r);return a?rS(t,a,e):!1},bO=(t,e,n)=>{let r=iS(t,n);if(!r)return!1;let a=K0(r);return a?rS(t,a,e):!1};function rS(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=xp(t.doc,i,u,ze.empty);if(!h||h.from!=i||h instanceof rs&&h.slice.size>=u-i)return!1;if(n){let f=t.tr.step(h);f.setSelection(nt.create(f.doc,i)),n(f.scrollIntoView())}return!0}function Rc(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 aS=(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=W0(r)}let o=i&&i.nodeBefore;return!o||!tt.isSelectable(o)?!1:(e&&e(t.tr.setSelection(tt.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function W0(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 iS(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=iS(t,n);if(!r)return!1;let a=K0(r);if(!a)return!1;let i=a.nodeAfter;if(hS(t,a,e,1))return!0;if(r.parent.content.size==0&&(Rc(i,"start")||tt.isSelectable(i))){let o=xp(t.doc,r.before(),r.after(),ze.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 tt,a;if(r){if(n.node.isTextblock||!Lo(t.doc,n.from))return!1;a=n.from}else if(a=mp(t.doc,n.from,-1),a==null)return!1;if(e){let i=t.tr.join(a);r&&i.setSelection(tt.create(i.doc,a-t.doc.resolve(a).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},NO=(t,e)=>{let n=t.selection,r;if(n instanceof tt){if(n.node.isTextblock||!Lo(t.doc,n.to))return!1;r=n.to}else if(r=mp(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},wO=(t,e)=>{let{$from:n,$to:r}=t.selection,a=n.blockRange(r),i=a&&Wc(a);return i==null?!1:(e&&e(t.tr.lift(a,i).scrollIntoView()),!0)},cS=(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 q0(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=q0(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(lt.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},dS=(t,e)=>{let n=t.selection,{$from:r,$to:a}=n;if(n instanceof xr||r.parent.inlineContent||a.parent.inlineContent)return!1;let i=q0(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(vi(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),a=r&&Wc(r);return a==null?!1:(e&&e(t.tr.lift(r,a).scrollIntoView()),!0)};function kO(t){return(e,n)=>{let{$from:r,$to:a}=e.selection;if(e.selection instanceof tt&&e.selection.node.isBlock)return!r.parentOffset||!vi(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=q0(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 nt||e.selection instanceof xr)&&f.deleteSelection();let m=f.mapping.map(r.pos),x=vi(f.doc,m,i.length,i);if(x||(i[0]=c?{type:c}:null,x=vi(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 SO=kO(),CO=(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(tt.create(t.doc,a))),!0)};function TO(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||Lo(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function hS(t,e,n,r){let a=e.nodeBefore,i=e.nodeAfter,o,c,u=a.type.spec.isolating||i.type.spec.isolating;if(!u&&TO(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=Ne.empty;for(let k=o.length-1;k>=0;k--)v=Ne.from(o[k].create(null,v));v=Ne.from(a.copy(v));let N=t.tr.step(new as(e.pos-1,y,e.pos,y,new ze(v,1,0),o.length,!0)),w=N.doc.resolve(y+2*o.length);w.nodeAfter&&w.nodeAfter.type==a.type&&Lo(N.doc,w.pos)&&N.join(w.pos),n(N.scrollIntoView())}return!0}let f=i.type.spec.isolating||r>0&&u?null:lt.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),x=m&&Wc(m);if(x!=null&&x>=e.depth)return n&&n(t.tr.lift(m,x).scrollIntoView()),!0;if(h&&Rc(i,"start",!0)&&Rc(a,"end")){let y=a,v=[];for(;v.push(y),!y.isTextblock;)y=y.lastChild;let N=i,w=1;for(;!N.isTextblock;N=N.firstChild)w++;if(y.canReplace(y.childCount,y.childCount,N.content)){if(n){let k=Ne.empty;for(let C=v.length-1;C>=0;C--)k=Ne.from(v[C].copy(k));let E=t.tr.step(new as(e.pos-v.length,e.pos+i.nodeSize,e.pos+w,e.pos+i.nodeSize-w,new ze(k,v.length,0),0,!0));n(E.scrollIntoView())}return!0}}return!1}function fS(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(nt.create(e.doc,t<0?a.start(i):a.end(i)))),!0):!1}}const EO=fS(-1),MO=fS(1);function AO(t,e=null){return function(n,r){let{$from:a,$to:i}=n.selection,o=a.blockRange(i),c=o&&B0(o,t,e);return c?(r&&r(n.tr.wrap(o,c).scrollIntoView()),!0):!1}}function dN(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 ff(u,u,e.depth),e.endIndex=0;f--)i=Ne.from(n[f].type.create(n[f].attrs,i));t.step(new as(e.start-(r?2:0),e.end,e.start,e.end,new ze(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?LO(e,n,t,i):DO(e,n,i):!0:!1}}function LO(t,e,n,r){let a=t.tr,i=r.end,o=r.$to.end(r.depth);iN;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?Ne.empty:Ne.from(a))))return!1;let m=i.pos,x=m+o.nodeSize;return r.step(new as(m-(c?1:0),x+(u?1:0),m+1,x-1,new ze((c?Ne.empty:Ne.from(a.copy(Ne.empty))).append(u?Ne.empty:Ne.from(a.copy(Ne.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function _O(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=Ne.from(h?t.create():null),m=new ze(Ne.from(t.create(null,Ne.from(c.type.create(null,f)))),h?3:1,0),x=i.start,y=i.end;n(e.tr.step(new as(x-(h?3:1),y,x,y,m,1,!0)).scrollIntoView())}return!0}}const ms=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Oc=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Ig=null;const pi=function(t,e,n){let r=Ig||(Ig=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},zO=function(){Ig=null},jl=function(t,e,n,r){return n&&(uN(t,e,n,r,-1)||uN(t,e,n,r,1))},$O=/^(img|br|input|textarea|hr)$/i;function uN(t,e,n,r,a){for(var i;;){if(t==n&&e==r)return!0;if(e==(a<0?0:_r(t))){let o=t.parentNode;if(!o||o.nodeType!=1||mu(t)||$O.test(t.nodeName)||t.contentEditable=="false")return!1;e=ms(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?_r(t):0}else return!1}}function _r(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function FO(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=_r(t)}else if(t.parentNode&&!mu(t))e=ms(t),t=t.parentNode;else return null}}function BO(t,e){for(;;){if(t.nodeType==3&&e2),Dr=Lc||(Pa?/Mac/.test(Pa.platform):!1),xS=Pa?/Win/.test(Pa.platform):!1,yi=/Android \d/.test(Do),xu=!!hN&&"webkitFontSmoothing"in hN.documentElement.style,WO=xu?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function KO(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 ci(t,e){return typeof t=="number"?t:t[e]}function qO(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function fN(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=Oc(o);continue}let c=o,u=c==i.body,h=u?KO(i):qO(c),f=0,m=0;if(e.toph.bottom-ci(r,"bottom")&&(m=e.bottom-e.top>h.bottom-h.top?e.top+ci(a,"top")-h.top:e.bottom-h.bottom+ci(a,"bottom")),e.lefth.right-ci(r,"right")&&(f=e.right-h.right+ci(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 N=c.scrollLeft-y,w=c.scrollTop-v;e={left:e.left-N,top:e.top-w,right:e.right-N,bottom:e.bottom-w}}let x=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(x))break;o=x=="absolute"?o.offsetParent:Oc(o)}}function GO(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:gS(t.dom)}}function gS(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Oc(r));return e}function JO({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;yS(n,r==0?0:r-e)}function yS(t,e){for(let n=0;n=c){o=Math.max(v.bottom,o),c=Math.min(v.top,c);let N=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?YO(n,a):!n||r&&n.nodeType==1?{node:t,offset:i}:bS(n,a)}function YO(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 J0(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function XO(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 eL(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 vS(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&a++}let h;xu&&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=eL(t,r,a,e))}c==null&&(c=ZO(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function pN(t){return t.top=0&&a==r.nodeValue.length?(u--,f=1):n<0?u--:h++,kd(io(pi(r,u,h),f),f<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&a&&(n<0||a==_r(r))){let u=r.childNodes[a-1];if(u.nodeType==1)return Rx(u.getBoundingClientRect(),!1)}if(i==null&&a<_r(r)){let u=r.childNodes[a];if(u.nodeType==1)return Rx(u.getBoundingClientRect(),!0)}return Rx(r.getBoundingClientRect(),n>=0)}if(i==null&&a&&(n<0||a==_r(r))){let u=r.childNodes[a-1],h=u.nodeType==3?pi(u,_r(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(h)return kd(io(h,1),!1)}if(i==null&&a<_r(r)){let u=r.childNodes[a];for(;u.pmViewDesc&&u.pmViewDesc.ignoreForCoords;)u=u.nextSibling;let h=u?u.nodeType==3?pi(u,0,o?0:1):u.nodeType==1?u:null:null;if(h)return kd(io(h,-1),!0)}return kd(io(r.nodeType==3?pi(r):r,-n),n>=0)}function kd(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 Rx(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 wS(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 sL(t,e,n){let r=e.selection,a=n=="up"?r.$from:r.$to;return wS(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=NS(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=pi(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 rL=/[\u0590-\u08ac]/;function aL(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?!rL.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?i:o:wS(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:N}=t.domSelectionRange(),w=v&&!y.contains(v.nodeType==1?v:v.parentNode)||u==v&&h==N;try{c.collapse(f,m),u&&(u!=f||h!=m)&&c.extend&&c.extend(u,h)}catch{}return x!=null&&(c.caretBidiLevel=x),w}):r.pos==r.start()||r.pos==r.end()}let mN=null,xN=null,gN=!1;function iL(t,e,n){return mN==e&&xN==n?gN:(mN=e,xN=n,gN=n=="up"||n=="down"?sL(t,e,n):aL(t,e,n))}const $r=0,yN=1,ll=2,Ra=3;class gu{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;nms(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 kS){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 jS&&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?ms(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=ms(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?ll:yN,e==c&&n==u&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Ra:i.markDirty(e-c,n-c);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?ll:Ra}r=o}this.dirty=ll}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?ll:yN;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 oL extends gu{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 kl extends gu{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=Il.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new kl(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Ra||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ra&&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=Dg(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}=Il.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=TS(f,r,n),h?u=new lL(e,n,r,a,f,m||null,x,h,i,o+1):n.isText?new bp(e,n,r,a,f,x,i):new jo(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=()=>Ne.empty)}return e}matchesNode(e,n,r){return this.dirty==$r&&e.eq(this.node)&&mf(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 dL(this,o&&o.node,e);fL(this.node,this.innerDeco,(h,f,m)=>{h.spec.marks?u.syncToMarks(h.spec.marks,r,e,f):h.type.side>=0&&!m&&u.syncToMarks(f==this.node.childCount?an.none:this.node.child(f).marks,r,e,f),u.placeWidget(h,e,a)},(h,f,m,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==ll)&&(o&&this.protectLocalComposition(e,o),SS(this.contentDOM,this.children,e),Lc&&pL(this.dom))}localCompositionInfo(e,n){let{from:r,to:a}=e.state.selection;if(!(e.state.selection instanceof nt)||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=mL(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 oL(this,i,n,a);e.input.compositionNodes.push(o),this.children=Dg(this.children,r,r+a.length,e,o)}update(e,n,r,a){return this.dirty==Ra||!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(mf(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=CS(this.dom,this.nodeDOM,Lg(this.outerDeco,this.node,n),Lg(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 bN(t,e,n,r,a){TS(r,e,t);let i=new jo(void 0,t,e,n,r,r,r,a,0);return i.contentDOM&&i.updateChildren(a,0),i}class bp extends jo{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==Ra||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 bp(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=Ra)}get domAtom(){return!1}isText(e){return this.node.text==e}}class kS extends gu{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 lL extends jo{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==Ra)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 SS(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=kl.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 kl)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 hL(t,e){return t.type.side-e.type.side}function fL(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 w=v;o!w.inline):c.slice();r(x,N,e.forChild(i,x),y),i=v}}function pL(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 mL(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 Dg(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 Q0(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(yp(n)){for(u=o;a&&!a.node;)a=a.parent;let m=a.node;if(a&&m.isAtom&&tt.isSelectable(m)&&a.parent&&!(m.isInline&&VO(n.focusNode,n.focusOffset,a.dom))){let x=a.posBefore;h=new tt(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(()=>{(!ES(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function gL(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,ms(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&ar&&wo<=11&&(n.disabled=!0,n.disabled=!1)}function MS(t,e){if(e instanceof tt){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(kN(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else kN(t)}function kN(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Y0(t,e,n,r){return t.someProp("createSelectionBetween",a=>a(t,e,n))||nt.between(e,n,r)}function SN(t){return t.editable&&!t.hasFocus()?!1:AS(t)}function AS(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 yL(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return jl(e.node,e.offset,n.anchorNode,n.anchorOffset)}function _g(t,e){let{$anchor:n,$head:r}=t.selection,a=e>0?n.max(r):n.min(r),i=a.parent.inlineContent?a.depth?t.doc.resolve(e>0?a.after():a.before()):null:a;return i&<.findFrom(i,e)}function oo(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function CN(t,e,n){let r=t.state.selection;if(r instanceof nt)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 oo(t,new nt(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let a=_g(t.state,e);return a&&a instanceof tt?oo(t,a):!1}else if(!(Dr&&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?tt.isSelectable(i)?oo(t,new tt(e<0?t.state.doc.resolve(a.pos-i.nodeSize):a)):xu?oo(t,new nt(t.state.doc.resolve(e<0?c:c+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof tt&&r.node.isInline)return oo(t,new nt(e>0?r.$to:r.$from));{let a=_g(t.state,e);return a?oo(t,a):!1}}}function xf(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Fd(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function uc(t,e){return e<0?bL(t):vL(t)}function bL(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a,i,o=!1;for(zr&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(Fd(c,-1))a=n,i=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(IS(n))break;{let c=n.previousSibling;for(;c&&Fd(c,-1);)a=n.parentNode,i=ms(c),c=c.previousSibling;if(c)n=c,r=xf(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?zg(t,n,r):a&&zg(t,a,i)}function vL(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let a=xf(n),i,o;for(;;)if(r{t.state==a&&Ni(t)},50)}function TN(t,e){let n=t.state.doc.resolve(e);if(!(vs||xS)&&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 EN(t,e,n){let r=t.state.selection;if(r instanceof nt&&!r.empty||n.indexOf("s")>-1||Dr&&n.indexOf("m")>-1)return!1;let{$from:a,$to:i}=r;if(!a.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=_g(t.state,e);if(o&&o instanceof tt)return oo(t,o)}if(!a.parent.inlineContent){let o=e<0?a:i,c=r instanceof xr?lt.near(o,e):lt.findFrom(o,e);return c?oo(t,c):!1}return!1}function MN(t,e){if(!(t.state.selection instanceof nt))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 AN(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function jL(t){if(!Ps||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;AN(t,r,"true"),setTimeout(()=>AN(t,r,"false"),20)}return!1}function kL(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function SL(t,e){let n=e.keyCode,r=kL(e);if(n==8||Dr&&n==72&&r=="c")return MN(t,-1)||uc(t,-1);if(n==46&&!e.shiftKey||Dr&&n==68&&r=="c")return MN(t,1)||uc(t,1);if(n==13||n==27)return!0;if(n==37||Dr&&n==66&&r=="c"){let a=n==37?TN(t,t.state.selection.from)=="ltr"?-1:1:-1;return CN(t,a,r)||uc(t,a)}else if(n==39||Dr&&n==70&&r=="c"){let a=n==39?TN(t,t.state.selection.from)=="ltr"?1:-1:1;return CN(t,a,r)||uc(t,a)}else{if(n==38||Dr&&n==80&&r=="c")return EN(t,-1,r)||uc(t,-1);if(n==40||Dr&&n==78&&r=="c")return jL(t)||EN(t,1,r)||uc(t,1);if(r==(Dr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function X0(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")||Il.fromSchema(t.state.schema),c=_S(),u=c.createElement("div");u.appendChild(o.serializeFragment(r,{document:c}));let h=u.firstChild,f,m=0;for(;h&&h.nodeType==1&&(f=DS[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 PS(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 ze(Ne.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=Il.fromSchema(y);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(N=>{let w=o.appendChild(document.createElement("p"));N&&w.appendChild(v.serializeNode(y.text(N,x)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),o=ML(n),xu&&AL(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")||No.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||f),context:a,ruleFromNode(x){return x.nodeName=="BR"&&!x.nextSibling&&x.parentNode&&!CL.test(x.parentNode.nodeName)?{ignore:!0}:null}})),f)c=IL(IN(c,+f[1],+f[2]),f[4]);else if(c=ze.maxOpen(TL(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 CL=/^(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 TL(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&&OS(u,i,c,o[o.length-1],0))o[o.length-1]=h;else{o.length&&(o[o.length-1]=LS(o[o.length-1],i.length));let f=RS(c,u);o.push(f),a=a.matchType(f.type),i=u}}),o)return Ne.from(o)}return t}function RS(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,Ne.from(t));return t}function OS(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(Ne.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(c))}function IN(t,e,n){return en})),Lx.createHTML(t)):t}function ML(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=_S().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),a;if((a=r&&DS[r[1].toLowerCase()])&&(t=a.map(i=>"<"+i+">").join("")+t+a.map(i=>"").reverse().join("")),n.innerHTML=EL(t),a)for(let i=0;i=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;a=Ne.from(u.create(r[c+1],a)),i++,o++}return new ze(a,i,o)}const Hs={},Us={},PL={touchstart:!0,touchmove:!0};class RL{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 OL(t){for(let e in Hs){let n=Hs[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{DL(t,r)&&!Z0(t,r)&&(t.editable||!(r.type in Us))&&n(t,r)},PL[e]?{passive:!0}:void 0)}Ps&&t.dom.addEventListener("input",()=>null),Fg(t)}function yo(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function LL(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 Fg(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Z0(t,r))})}function Z0(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function DL(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 _L(t,e){!Z0(t,e)&&Hs[e.type]&&(t.editable||!(e.type in Us))&&Hs[e.type](t,e)}Us.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!$S(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(yi&&vs&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Lc&&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))||SL(t,n)?n.preventDefault():yo(t,"key")};Us.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Us.keypress=(t,e)=>{let n=e;if($S(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Dr&&n.metaKey)return;if(t.someProp("handleKeyPress",a=>a(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof nt)||!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 vp(t){return{left:t.clientX,top:t.clientY}}function zL(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function ey(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 Sc(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 $L(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&tt.isSelectable(r)?(Sc(t,new tt(n)),!0):!1}function FL(t,e){if(e==-1)return!1;let n=t.state.selection,r,a;n instanceof tt&&(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(tt.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?(Sc(t,tt.create(t.state.doc,a)),!0):!1}function BL(t,e,n,r,a){return ey(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(a?FL(t,n):$L(t,n))}function VL(t,e,n,r){return ey(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",a=>a(t,e,r))}function HL(t,e,n,r){return ey(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",a=>a(t,e,r))||UL(t,n,r)}function UL(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Sc(t,nt.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)Sc(t,nt.create(r,c+1,c+1+o.content.size));else if(tt.isSelectable(o))Sc(t,tt.create(r,c));else continue;return!0}}function ty(t){return gf(t)}const zS=Dr?"metaKey":"ctrlKey";Hs.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=ty(t),a=Date.now(),i="singleClick";a-t.input.lastClick.time<500&&zL(n,t.input.lastClick)&&!n[zS]&&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(vp(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new WL(t,o,n,!!r)):(i=="doubleClick"?VL:HL)(t,o.pos,o.inside,n)?n.preventDefault():yo(t,"pointer"))};class WL{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[zS],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 tt&&h.from<=o&&h.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&zr&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),yo(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(()=>Ni(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(vp(e))),this.updateAllowDefault(e),this.allowDefault||!n?yo(this.view,"pointer"):BL(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ps&&this.mightDrag&&!this.mightDrag.node.isAtom||vs&&!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)?(Sc(this.view,lt.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):yo(this.view,"pointer")}move(e){this.updateAllowDefault(e),yo(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Hs.touchstart=t=>{t.input.lastTouch=Date.now(),ty(t),yo(t,"pointer")};Hs.touchmove=t=>{t.input.lastTouch=Date.now(),yo(t,"pointer")};Hs.contextmenu=t=>ty(t);function $S(t,e){return t.composing?!0:Ps&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const KL=yi?5e3:-1;Us.compositionstart=Us.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof nt&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||vs&&xS&&qL(t)))t.markCursor=t.state.storedMarks||n.marks(),gf(t,!0),t.markCursor=null;else if(gf(t,!e.selection.empty),zr&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let a=r.focusNode,i=r.focusOffset;a&&a.nodeType==1&&i!=0;){let o=i<0?a.lastChild:a.childNodes[i-1];if(!o)break;if(o.nodeType==3){let c=t.domSelection();c&&c.collapse(o,o.nodeValue.length);break}else a=o,i=-1}}t.input.composing=!0}FS(t,KL)};function qL(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Us.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,FS(t,20))};function FS(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>gf(t),e))}function BS(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=JL());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function GL(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=FO(e.focusNode,e.focusOffset),r=BO(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 JL(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function gf(t,e=!1){if(!(yi&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),BS(t),e||t.docView&&t.docView.dirty){let n=Q0(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 QL(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 tu=ar&&wo<15||Lc&&WO<604;Hs.copy=Us.cut=(t,e)=>{let n=e,r=t.state.selection,a=n.type=="cut";if(r.empty)return;let i=tu?null:n.clipboardData,o=r.content(),{dom:c,text:u}=X0(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",c.innerHTML),i.setData("text/plain",u)):QL(t,c),a&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function YL(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function XL(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?nu(t,r.value,null,a,e):nu(t,r.textContent,r.innerHTML,a,e)},50)}function nu(t,e,n,r,a){let i=PS(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,a,i||ze.empty)))return!0;if(!i)return!1;let o=YL(i),c=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(i);return t.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function VS(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Us.paste=(t,e)=>{let n=e;if(t.composing&&!yi)return;let r=tu?null:n.clipboardData,a=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&nu(t,VS(r),r.getData("text/html"),a,n)?n.preventDefault():XL(t,n)};class HS{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const ZL=Dr?"altKey":"ctrlKey";function US(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[ZL]}Hs.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let a=t.state.selection,i=a.empty?null:t.posAtCoords(vp(n)),o;if(!(i&&i.pos>=a.from&&i.pos<=(a instanceof tt?a.to-1:a.to))){if(r&&r.mightDrag)o=tt.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=tt.create(t.state.doc,m.posBefore))}}let c=(o||t.state.selection).content(),{dom:u,text:h,slice:f}=X0(t,c);(!n.dataTransfer.files.length||!vs||mS>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(tu?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",tu||n.dataTransfer.setData("text/plain",h),t.dragging=new HS(f,US(t,n),o)};Hs.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Us.dragover=Us.dragenter=(t,e)=>e.preventDefault();Us.drop=(t,e)=>{try{e6(t,e,t.dragging)}finally{t.dragging=null}};function e6(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(vp(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=PS(t,VS(e.dataTransfer),tu?null:e.dataTransfer.getData("text/html"),!1,a);let o=!!(n&&US(t,e));if(t.someProp("handleDrop",y=>y(t,e,i||ze.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let c=i?G2(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&&tt.isSelectable(i.content.firstChild)&&x.nodeAfter&&x.nodeAfter.sameMarkup(i.content.firstChild))u.setSelection(new tt(x));else{let y=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((v,N,w,k)=>y=k),u.setSelection(Y0(t,x,u.doc.resolve(y)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}Hs.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Ni(t)},20))};Hs.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Hs.beforeinput=(t,e)=>{if(vs&&yi&&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 Us)Hs[t]=Us[t];function su(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 yf{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 yf&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&su(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class ko{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==As||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=KS(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 ko){let h=Math.max(i,u.from)-i,f=Math.min(o,u.to)-i;ha.map(e,n,pl));return uo.from(r)}forChild(e,n){if(n.isLeaf)return rn.empty;let r=[];for(let a=0;an instanceof rn)?e:e.reduce((n,r)=>n.concat(r instanceof rn?r:r.members),[]))}}forEachSet(e){for(let n=0;n{let w=N-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&&w&&(c[k]+=w,c[k+1]+=w)}m+=w}),f=n.maps[h].map(f,-1)}let u=!1;for(let h=0;h=r.content.size){u=!0;continue}let x=n.map(t[h+1]+i,-1),y=x-a,{index:v,offset:N}=r.content.findIndex(m),w=r.maybeChild(v);if(w&&N==m&&N+w.nodeSize==y){let k=c[h+2].mapInner(n,w,f+1,t[h]+i+1,o);k!=As?(c[h]=m,c[h+1]=y,c[h+2]=k):(c[h+1]=-2,u=!0)}else u=!0}if(u){let h=n6(c,t,e,n,a,i,o),f=bf(h,r,0,o);e=f.local;for(let m=0;mn&&o.to{let h=KS(t,c,u+n);if(h){i=!0;let f=bf(h,c,n+u+1,r);f!=As&&a.push(u,u+c.nodeSize,f)}});let o=WS(i?qS(t):t,-n).sort(ml);for(let c=0;c0;)e++;t.splice(e,0,n)}function Dx(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=As&&e.push(r)}),t.cursorWrapper&&e.push(rn.create(t.state.doc,[t.cursorWrapper.deco])),uo.from(e)}const s6={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},r6=ar&&wo<=11;class a6{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 i6{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new a6,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let a=0;aa.type=="childList"&&a.removedNodes.length||a.type=="characterData"&&a.oldValue.length>a.target.nodeValue.length)?this.flushSoon():Ps&&e.composing&&r.some(a=>a.type=="childList"&&a.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),r6&&(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,s6)),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(SN(this.view)){if(this.suppressingSelectionUpdates)return Ni(this.view);if(ar&&wo<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&jl(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=Oc(i))n.add(i);for(let i=e.anchorNode;i;i=Oc(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)&&SN(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,c=!1,u=[];if(e.editable)for(let f=0;ff.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let f of u)if(f.nodeName=="BR"&&f.parentNode){let m=f.nextSibling;m&&m.nodeType==1&&m.contentEditable=="false"&&f.parentNode.removeChild(f)}}else if(zr&&u.length){let f=u.filter(m=>m.nodeName=="BR");if(f.length==2){let[m,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||c6(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),o6(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,d6(e,u)),this.handleDOMChange(i,o,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Ni(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;w--){let k=r.childNodes[w-1],E=k.pmViewDesc;if(k.nodeName=="BR"&&!E){i=w;break}if(!E||E.size)break}let m=t.state.doc,x=t.someProp("domParser")||No.fromSchema(t.state.schema),y=m.resolve(o),v=null,N=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:h6,context:y});if(h&&h[0].pos!=null){let w=h[0].pos,k=h[1]&&h[1].pos;k==null&&(k=w),v={anchor:w+o,head:k+o}}return{doc:N,sel:v,from:o,to:c}}function h6(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Ps&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Ps&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const f6=/^(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 p6(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,V=Q0(t,$);if(V&&!t.state.selection.eq(V)){if(vs&&yi&&t.input.lastKeyCode===13&&Date.now()-100te(t,rl(13,"Enter"))))return;let I=t.state.tr.setSelection(V);$=="pointer"?I.setMeta("pointer",!0):$=="key"&&I.scrollIntoView(),i&&I.setMeta("composition",i),t.dispatch(I)}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=u6(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||yi)&&a.some($=>$.nodeType==1&&!f6.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 nt&&!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 $=_N(t,t.state.doc,h.sel);if($&&!$.eq(t.state.selection)){let V=t.state.tr.setSelection($);i&&V.setMeta("composition",i),t.dispatch(V)}}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)),ar&&wo<=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 N=h.doc.resolveNoCache(v.start-h.from),w=h.doc.resolveNoCache(v.endB-h.from),k=f.resolve(v.start),E=N.sameParent(w)&&N.parent.inlineContent&&k.end()>=v.endA;if((Lc&&t.input.lastIOSEnter>Date.now()-225&&(!E||a.some($=>$.nodeName=="DIV"||$.nodeName=="P"))||!E&&N.pos$(t,rl(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>v.start&&x6(f,v.start,v.endA,N,w)&&t.someProp("handleKeyDown",$=>$(t,rl(8,"Backspace")))){yi&&vs&&t.domObserver.suppressSelectionUpdates();return}vs&&v.endB==v.start&&(t.input.lastChromeDelete=Date.now()),yi&&!E&&N.start()!=w.start()&&w.parentOffset==0&&N.depth==w.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==v.endA&&(v.endB-=2,w=h.doc.resolveNoCache(v.endB-h.from),setTimeout(()=>{t.someProp("handleKeyDown",function($){return $(t,rl(13,"Enter"))})},20));let C=v.start,R=v.endA,O=$=>{let V=$||t.state.tr.replace(C,R,h.doc.slice(v.start-h.from,v.endB-h.from));if(h.sel){let I=_N(t,V.doc,h.sel);I&&!(vs&&t.composing&&I.empty&&(v.start!=v.endB||t.input.lastChromeDeleteNi(t),20));let $=O(t.state.tr.delete(C,R)),V=f.resolve(v.start).marksAcross(f.resolve(v.endA));V&&$.ensureMarks(V),t.dispatch($)}else if(v.endA==v.endB&&(q=m6(N.parent.content.cut(N.parentOffset,w.parentOffset),k.parent.content.cut(k.parentOffset,v.endA-k.start())))){let $=O(t.state.tr);q.type=="add"?$.addMark(C,R,q.mark):$.removeMark(C,R,q.mark),t.dispatch($)}else if(N.parent.child(N.index()).isText&&N.index()==w.index()-(w.textOffset?0:1)){let $=N.parent.textBetween(N.parentOffset,w.parentOffset),V=()=>O(t.state.tr.insertText($,C,R));t.someProp("handleTextInput",I=>I(t,C,R,$,V))||t.dispatch(V())}else t.dispatch(O());else t.dispatch(O())}function _N(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Y0(t,e.resolve(n.anchor),e.resolve(n.head))}function m6(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||_x(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 g6(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 GS{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 RL,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(HN),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=BN(this),FN(this),this.nodeViews=VN(this),this.docView=bN(this.state.doc,$N(this),Dx(this),this.dom,this),this.domObserver=new i6(this,(r,a,i,o)=>p6(this,r,a,i,o)),this.domObserver.start(),OL(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&&Fg(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(HN),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&&(BS(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=VN(this);b6(y,this.nodeViews)&&(this.nodeViews=y,i=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&Fg(this),this.editable=BN(this),FN(this);let u=Dx(this),h=$N(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&&GO(this);if(o){this.domObserver.stop();let y=m&&(ar||vs)&&!this.composing&&!a.selection.empty&&!e.selection.empty&&y6(a.selection,e.selection);if(m){let v=vs?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=GL(this)),(i||!this.docView.update(e.doc,h,u,this))&&(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=bN(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())&&yL(this))?Ni(this,y):(MS(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&&JO(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 tt){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&fN(this,n.getBoundingClientRect(),e)}else fN(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 HS(e.slice,e.move,a<0?void 0:tt.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 tL(this,e)}coordsAtPos(e,n=1){return NS(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 iL(this,n||this.state,e)}pasteHTML(e,n){return nu(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return nu(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return X0(this,e)}destroy(){this.docView&&(LL(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Dx(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,zO())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return _L(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ps&&this.root.nodeType===11&&HO(this.dom.ownerDocument)==this.dom&&l6(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}GS.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function $N(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 FN(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 BN(t){return!t.someProp("editable",e=>e(t.state)===!1)}function y6(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 VN(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 b6(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 HN(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 Eo={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:"'"},vf={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},v6=typeof navigator<"u"&&/Mac/.test(navigator.platform),N6=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var xs=0;xs<10;xs++)Eo[48+xs]=Eo[96+xs]=String(xs);for(var xs=1;xs<=24;xs++)Eo[xs+111]="F"+xs;for(var xs=65;xs<=90;xs++)Eo[xs]=String.fromCharCode(xs+32),vf[xs]=String.fromCharCode(xs);for(var zx in Eo)vf.hasOwnProperty(zx)||(vf[zx]=Eo[zx]);function w6(t){var e=v6&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||N6&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?vf:Eo)[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 j6=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),k6=typeof navigator<"u"&&/Win/.test(navigator.platform);function S6(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)E6(t,n,{get:e[n],enumerable:!0})};function Np(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 wp=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 N=this.buildProps(u,e),w=x(...v)(N);return o.push(w),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:Np({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}},JS={};ay(JS,{blur:()=>M6,clearContent:()=>A6,clearNodes:()=>I6,command:()=>P6,createParagraphNear:()=>R6,cut:()=>O6,deleteCurrentNode:()=>L6,deleteNode:()=>D6,deleteRange:()=>_6,deleteSelection:()=>z6,enter:()=>$6,exitCode:()=>F6,extendMarkRange:()=>B6,first:()=>V6,focus:()=>U6,forEach:()=>W6,insertContent:()=>K6,insertContentAt:()=>J6,joinBackward:()=>X6,joinDown:()=>Y6,joinForward:()=>Z6,joinItemBackward:()=>eD,joinItemForward:()=>tD,joinTextblockBackward:()=>nD,joinTextblockForward:()=>sD,joinUp:()=>Q6,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:()=>zD,setMeta:()=>$D,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 M6=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),A6=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),I6=()=>({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=Wc(y);if(c.type.isTextblock){const{defaultType:N}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(y.start,N)}(v||v===0)&&e.lift(y,v)})}),!0},P6=t=>e=>t(e),R6=()=>({state:t,dispatch:e})=>dS(t,e),O6=(t,e)=>({editor:n,tr:r})=>{const{state:a}=n,i=a.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new nt(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 Un(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 D6=t=>({tr:e,state:n,dispatch:r})=>{const a=Un(t,n.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===a){if(r){const u=i.before(o),h=i.after(o);e.delete(u,h).scrollIntoView()}return!0}return!1},_6=t=>({tr:e,dispatch:n})=>{const{from:r,to:a}=t;return n&&e.delete(r,a),!0},z6=()=>({state:t,dispatch:e})=>U0(t,e),$6=()=>({commands:t})=>t.keyboardShortcut("Enter"),F6=()=>({state:t,dispatch:e})=>jO(t,e);function iy(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Nf(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(a=>n.strict?e[a]===t[a]:iy(e[a])?e[a].test(t[a]):e[a]===t[a]):!0}function QS(t,e,n={}){return t.find(r=>r.type===e&&Nf(Object.fromEntries(Object.keys(n).map(a=>[a,r.attrs[a]])),n))}function UN(t,e,n={}){return!!QS(t,e,n)}function oy(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),!QS([...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&&UN([...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=Ti(t,r.schema),{doc:o,selection:c}=n,{$from:u,from:h,to:f}=c;if(a){const m=oy(u,i,e);if(m&&m.from<=h&&m.to>=f){const x=nt.create(o,m.from,m.to);n.setSelection(x)}}return!0},V6=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=()=>{(wf()||WN())&&r.dom.focus(),H6()&&!wf()&&!WN()&&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&&!YS(n.state.selection))return o(),!0;const c=XS(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},W6=(t,e)=>n=>t.every((r,a)=>e(r,{...n,index:a})),K6=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),ZS=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&&ZS(r)}return t};function Eh(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 ZS(n)}function ru(t,e,n){if(t instanceof bi||t instanceof Ne)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 Ne.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),ru("",e,n)}if(a){if(n.errorOnInvalidContent){let o=!1,c="";const u=new _2({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?No.fromSchema(u).parseSlice(Eh(t),n.parseOptions):No.fromSchema(u).parse(Eh(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const i=No.fromSchema(e);return n.slice?i.parseSlice(Eh(t),n.parseOptions).content:i.parse(Eh(t),n.parseOptions)}return ru("",e,n)}function q6(t,e,n){const r=t.steps.length-1;if(r{o===0&&(o=f)}),t.setSelection(lt.near(t.doc.resolve(o),n))}var G6=t=>!("type"in t),J6=(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=w=>{i.emit("contentError",{editor:i,error:w,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{ru(e,i.schema,{parseOptions:h,errorOnInvalidContent:!0})}catch(w){u(w)}try{c=ru(e,i.schema,{parseOptions:h,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(w){return u(w),!1}let{from:f,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},x=!0,y=!0;if((G6(c)?c:[c]).forEach(w=>{w.check(),x=x?w.isText&&w.marks.length===0:!1,y=y?w.isBlock:!1}),f===m&&y){const{parent:w}=r.doc.resolve(f);w.isTextblock&&!w.type.spec.code&&!w.childCount&&(f-=1,m+=1)}let N;if(x){if(Array.isArray(e))N=e.map(w=>w.text||"").join("");else if(e instanceof Ne){let w="";e.forEach(k=>{k.text&&(w+=k.text)}),N=w}else typeof e=="object"&&e&&e.text?N=e.text:N=e;r.insertText(N,f,m)}else{N=c;const w=r.doc.resolve(f),k=w.node(),E=w.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,N)}n.updateSelection&&q6(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:f,text:N}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:f,text:N})}return!0},Q6=()=>({state:t,dispatch:e})=>vO(t,e),Y6=()=>({state:t,dispatch:e})=>NO(t,e),X6=()=>({state:t,dispatch:e})=>sS(t,e),Z6=()=>({state:t,dispatch:e})=>oS(t,e),eD=()=>({state:t,dispatch:e,tr:n})=>{try{const r=mp(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=mp(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})=>yO(t,e),sD=()=>({state:t,dispatch:e})=>bO(t,e);function eC(){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 Mo(t,e,n={}){const{from:r,to:a,empty:i}=t.selection,o=e?Un(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=>Nf(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=Un(t,n.schema);return Mo(n,a,e)?wO(n,r):!1},oD=()=>({state:t,dispatch:e})=>uS(t,e),lD=t=>({state:e,dispatch:n})=>{const r=Un(t,e.schema);return OO(r)(e,n)},cD=()=>({state:t,dispatch:e})=>cS(t,e);function jp(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function KN(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=jp(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(i=Un(t,r.schema)),c==="mark"&&(o=Ti(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,KN(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(KN(x.attrs,e))))})})}),u},uD=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),hD=()=>({tr:t,dispatch:e})=>{if(e){const n=new xr(t.doc);t.setSelection(n)}return!0},fD=()=>({state:t,dispatch:e})=>aS(t,e),pD=()=>({state:t,dispatch:e})=>lS(t,e),mD=()=>({state:t,dispatch:e})=>CO(t,e),xD=()=>({state:t,dispatch:e})=>MO(t,e),gD=()=>({state:t,dispatch:e})=>EO(t,e);function Bg(t,e,n={},r={}){return ru(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=Bg(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 tC(t,e){const n=Ti(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 nC(t,e){const n=new V0(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 sC(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 kp(t){return e=>sC(e.$from,t)}function Xe(t,e,n){return t.config[e]===void 0&&t.parent?Xe(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?Xe(t.parent,e,n):null}):t.config[e]}function ly(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=Xe(e,"addExtensions",n);return r?[e,...ly(r())]:e}).flat(10)}function cy(t,e){const n=Il.fromSchema(e).serializeFragment(t),a=document.implementation.createHTMLDocument().createElement("div");return a.appendChild(n),a.innerHTML}function rC(t){return typeof t=="function"}function qt(t,e=void 0,...n){return rC(t)?e?t.bind(e)(...n):t(...n):t}function ND(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Dc(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 aC(t){const e=[],{nodeExtensions:n,markExtensions:r}=Dc(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=Xe(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(N=>{Object.entries(y.attributes).forEach(([w,k])=>{e.push({type:N,name:w,attribute:{...i,...k}})})})})}),a.forEach(h=>{const f={name:h.name,options:h.options,storage:h.storage},m=Xe(h,"addAttributes",f);if(!m)return;const x=m();Object.entries(x).forEach(([y,v])=>{const N={...i,...v};typeof(N==null?void 0:N.default)=="function"&&(N.default=N.default()),N!=null&&N.isRequired&&(N==null?void 0:N.default)===void 0&&delete N.default,e.push({type:h.name,name:y,attribute:N})})}),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 qN(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([...qN(r[a]),...qN(i)]);r[a]=Array.from(c.entries()).map(([u,h])=>`${u}: ${h}`).join("; ")}else r[a]=i}),r},{})}function au(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)=>Gt(n,r),{})}function jD(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function GN(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const a=e.reduce((i,o)=>{const c=o.attribute.parseHTML?o.attribute.parseHTML(n):jD(n.getAttribute(o.name));return c==null?i:{...i,[o.name]:c}},{});return{...r,...a}}}}function JN(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&ND(n)?!1:n!=null))}function QN(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=aC(t),{nodeExtensions:a,markExtensions:i}=Dc(t),o=(n=a.find(h=>Xe(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=Xe(E,"extendNodeSchema",m);return{...k,...C?C(h):{}}},{}),y=JN({...x,content:qt(Xe(h,"content",m)),marks:qt(Xe(h,"marks",m)),group:qt(Xe(h,"group",m)),inline:qt(Xe(h,"inline",m)),atom:qt(Xe(h,"atom",m)),selectable:qt(Xe(h,"selectable",m)),draggable:qt(Xe(h,"draggable",m)),code:qt(Xe(h,"code",m)),whitespace:qt(Xe(h,"whitespace",m)),linebreakReplacement:qt(Xe(h,"linebreakReplacement",m)),defining:qt(Xe(h,"defining",m)),isolating:qt(Xe(h,"isolating",m)),attrs:Object.fromEntries(f.map(QN))}),v=qt(Xe(h,"parseHTML",m));v&&(y.parseDOM=v.map(k=>GN(k,f)));const N=Xe(h,"renderHTML",m);N&&(y.toDOM=k=>N({node:k,HTMLAttributes:au(k,f)}));const w=Xe(h,"renderText",m);return w&&(y.toText=w),[h.name,y]})),u=Object.fromEntries(i.map(h=>{const f=r.filter(w=>w.type===h.name),m={name:h.name,options:h.options,storage:h.storage,editor:e},x=t.reduce((w,k)=>{const E=Xe(k,"extendMarkSchema",m);return{...w,...E?E(h):{}}},{}),y=JN({...x,inclusive:qt(Xe(h,"inclusive",m)),excludes:qt(Xe(h,"excludes",m)),group:qt(Xe(h,"group",m)),spanning:qt(Xe(h,"spanning",m)),code:qt(Xe(h,"code",m)),attrs:Object.fromEntries(f.map(QN))}),v=qt(Xe(h,"parseHTML",m));v&&(y.parseDOM=v.map(w=>GN(w,f)));const N=Xe(h,"renderHTML",m);return N&&(y.toDOM=w=>N({mark:w,HTMLAttributes:au(w,f)})),[h.name,y]}));return new _2({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 Bd(t){return t.sort((n,r)=>{const a=Xe(n,"priority")||100,i=Xe(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 oC(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 CD(t,e){const n={from:0,to:t.content.size};return oC(t,n,e)}function lC(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=Un(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 cC(t,e){const n=jp(typeof e=="string"?e:e.name,t.schema);return n==="node"?TD(t,e):n==="mark"?tC(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 dC(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 dy(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(a=>{const i=n.resolve(t),o=oy(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 Sd(t,e){return e.nodes[t]||e.marks[t]||null}function Kh(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 Vg(t,e,n={}){const{empty:r,ranges:a}=t.selection,i=e?Ti(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>i?i.name===m.type.name:!0).find(m=>Nf(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,(N,w)=>{if(i&&N.inlineContent&&!N.type.allowsMarkType(i))return!1;if(!N.isText&&!N.marks.length)return;const k=Math.max(y,w),E=Math.min(v,w+N.nodeSize),C=E-k;o+=C,c.push(...N.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=>Nf(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 PD(t,e,n={}){if(!e)return Mo(t,null,n)||Vg(t,null,n);const r=jp(e,t.schema);return r==="node"?Mo(t,e,n):r==="mark"?Vg(t,e,n):!1}var RD=(t,e)=>{const{$from:n,$to:r,$anchor:a}=t.selection;if(e){const i=kp(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 YN(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function XN(t,e){const{nodeExtensions:n}=Dc(e),r=n.find(o=>o.name===t);if(!r)return!1;const a={name:r.name,options:r.options,storage:r.storage},i=qt(Xe(r,"group",a));return typeof i!="string"?!1:i.split(" ").includes("list")}function Sp(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&&(Sp(i,{ignoreWhitespace:n,checkChildren:e})||(a=!1))}),a}return!1}function uC(t){return t instanceof tt}var hC=class fC{constructor(e){this.position=e}static fromJSON(e){return new fC(e.position)}toJSON(){return{position:this.position}}};function LD(t,e){const n=e.mapping.mapResult(t.position);return{position:new hC(n.pos),mapResult:n}}function DD(t){return new hC(t)}function _D(t,e,n){var r;const{selection:a}=e;let i=null;if(YS(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(N=>N.type.excludes(n));h=y&&v}return!h}),h})}var zD=(t,e={})=>({tr:n,state:r,dispatch:a})=>{const{selection:i}=n,{empty:o,ranges:c}=i,u=Ti(t,r.schema);if(a)if(o){const h=tC(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),N=Math.min(y+x.nodeSize,m);x.marks.find(k=>k.type===u)?x.marks.forEach(k=>{u===k.type&&n.addMark(v,N,u.create({...k.attrs,...e}))}):n.addMark(v,N,u.create(e))})});return _D(r,n,u)},$D=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),FD=(t,e={})=>({state:n,dispatch:r,chain:a})=>{const i=Un(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})=>dN(i,{...o,...e})(n)?!0:c.clearNodes()).command(({state:c})=>dN(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=tt.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=nt.atStart(r).from,c=nt.atEnd(r).to,u=dl(a,o,c),h=dl(i,o,c),f=nt.create(r,u,h);e.setSelection(f)}return!0},UD=t=>({state:e,dispatch:n})=>{const r=Un(t,e.schema);return _O(r)(e,n)};function ZN(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=Kh(h,c.node().type.name,c.node().attrs);if(i instanceof tt&&i.node.isBlock)return!c.parentOffset||!vi(o,c.pos)?!1:(r&&(t&&ZN(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 y=m&&x?[{type:x,attrs:f}]:void 0,v=vi(e.doc,e.mapping.map(c.pos),1,y);if(!y&&!v&&vi(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 nt&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,y),x&&!m&&!c.parentOffset&&c.parent.type!==x)){const N=e.mapping.map(c.before()),w=e.doc.resolve(N);c.node(-1).canReplaceWith(w.index(),w.index()+1,x)&&e.setNodeMarkup(e.mapping.map(c.before()),x)}t&&ZN(n,a.extensionManager.splittableMarks),e.scrollIntoView()}return v},KD=(t,e={})=>({tr:n,state:r,dispatch:a,editor:i})=>{var o;const c=Un(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=Ne.empty;const E=u.index(-1)?1:u.index(-2)?2:3;for(let V=u.depth-E;V>=u.depth-3;V-=1)k=Ne.from(u.node(V).copy(k));const C=u.indexAfter(-1){if($>-1)return!1;V.isTextblock&&V.content.size===0&&($=I+1)}),$>-1&&n.setSelection(nt.near(n.doc.resolve($))),n.scrollIntoView()}return!0}const y=h.pos===u.end()?m.contentMatchAt(0).defaultType:null,v={...Kh(x,m.type.name,m.attrs),...e},N={...Kh(x,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,h.pos);const w=y?[{type:c,attrs:v},{type:y,attrs:N}]:[{type:c,attrs:v}];if(!vi(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,w).scrollIntoView(),!R||!a)return!0;const O=R.filter(q=>C.includes(q.type.name));n.ensureMarks(O)}return!0},Fx=(t,e)=>{const n=kp(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)&&Lo(t.doc,n.pos)&&t.join(n.pos),!0},Bx=(t,e)=>{const n=kp(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)&&Lo(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,y=Un(t,o.schema),v=Un(e,o.schema),{selection:N,storedMarks:w}=o,{$from:k,$to:E}=N,C=k.blockRange(E),R=w||N.$to.parentOffset&&N.$from.marks();if(!C)return!1;const O=kp(q=>XN(q.type.name,m))(N);if(C.depth>=1&&O&&C.depth-O.depth<=1){if(O.node.type===y)return h.liftListItem(v);if(XN(O.node.type.name,m)&&y.validContent(O.node.content)&&c)return u().command(()=>(i.setNodeMarkup(O.pos,y),!0)).command(()=>Fx(i,y)).command(()=>Bx(i,y)).run()}return!n||!R||!c?u().command(()=>f().wrapInList(y,r)?!0:h.clearNodes()).wrapInList(y,r).command(()=>Fx(i,y)).command(()=>Bx(i,y)).run():u().command(()=>{const q=f().wrapInList(y,r),$=R.filter(V=>x.includes(V.type.name));return i.ensureMarks($),q?!0:h.clearNodes()}).wrapInList(y,r).command(()=>Fx(i,y)).command(()=>Bx(i,y)).run()},GD=(t,e={},n={})=>({state:r,commands:a})=>{const{extendEmptyMarkRange:i=!1}=n,o=Ti(t,r.schema);return Vg(r,o,e)?a.unsetMark(o,{extendEmptyMarkRange:i}):a.setMark(o,e)},JD=(t,e,n={})=>({state:r,commands:a})=>{const i=Un(t,r.schema),o=Un(e,r.schema),c=Mo(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=Un(t,n.schema);return Mo(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=Ti(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(w=>w.type===u))==null?void 0:i.attrs,N=oy(h,u,v);N&&(x=N.from,y=N.to),n.removeMark(x,y,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=jp(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(i=Un(t,r.schema)),c==="mark"&&(o=Ti(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,N;n.selection.empty?r.doc.nodesBetween(f,m,(w,k)=>{i&&i===w.type&&(u=!0,v=Math.max(k,f),N=Math.min(k+w.nodeSize,m),x=k,y=w)}):r.doc.nodesBetween(f,m,(w,k)=>{k=f&&k<=m&&(i&&i===w.type&&(u=!0,a&&n.setNodeMarkup(k,void 0,{...w.attrs,...e})),o&&w.marks.length&&w.marks.forEach(E=>{if(o===E.type&&(u=!0,a)){const C=Math.max(k,f),R=Math.min(k+w.nodeSize,m);n.addMark(C,R,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(w=>{o===w.type&&a&&n.addMark(v,N,o.create({...w.attrs,...e}))}))}),u},n_=(t,e={})=>({state:n,dispatch:r})=>{const a=Un(t,n.schema);return AO(a,e)(n,r)},s_=(t,e={})=>({state:n,dispatch:r})=>{const a=Un(t,n.schema);return IO(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={}}},Cp=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(iy(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 Mh(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 y=a_(m,x.find);if(!y)return;const v=u.state.tr,N=Np({state:u.state,transaction:v}),w={from:r-(y[0].length-i.length),to:a},{commands:k,chain:E,can:C}=new wp({editor:n,state:N});x.handler({state:N,range:w,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 i_(t){const{editor:e,rules:n}=t,r=new dn({state:{init(){return null},apply(a,i,o){const c=a.getMeta(r);if(c)return c;const u=a.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:f}=u;typeof f=="string"?f=f:f=cy(Ne.from(f),o.schema);const{from:m}=u,x=m+f.length;Mh({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 Mh({editor:e,from:i,to:o,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:a=>(setTimeout(()=>{const{$cursor:i}=a.state.selection;i&&Mh({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?Mh({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 Ah(t){return o_(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function pC(t,e){const n={...t};return Ah(t)&&Ah(e)&&Object.keys(e).forEach(r=>{Ah(e[r])&&Ah(t[r])?n[r]=pC(t[r],e[r]):n[r]=e[r]}),n}var uy=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{...qt(Xe(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...qt(Xe(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>pC(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}},Pl=class mC extends uy{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new mC(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(iy(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 wp({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,a,(y,v)=>{var N,w,k,E,C;if((w=(N=y.type)==null?void 0:N.spec)!=null&&w.code||!(y.isText||y.isTextblock||y.isInline))return;const R=(C=(E=(k=y.content)==null?void 0:k.size)!=null?E:y.nodeSize)!=null?C:0,O=Math.max(r,v),q=Math.min(a,v+R);if(O>=q)return;const $=y.isText?y.text||"":y.textBetween(O-v,q-v,void 0,"");d_($,i.find,o).forEach(I=>{if(I.index===void 0)return;const te=O+I.index+1,Q=te+I[0].length,B={from:n.tr.mapping.map(te),to:n.tr.mapping.map(Q)},re=i.handler({state:n,range:B,match:I,commands:u,chain:h,can:f,pasteEvent:o,dropEvent:c});m.push(re)})}),m.every(y=>y!==null)}var Ih=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:y,pasteEvt:v})=>{const N=f.tr,w=Np({state:f,transaction:N});if(!(!u_({editor:e,state:w,from:Math.max(m-1,0),to:x.b-1,rule:y,pasteEvent:v,dropEvent:c})||!N.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,N}};return n.map(f=>new dn({view(m){const x=v=>{var N;r=(N=m.dom.parentElement)!=null&&N.contains(v.target)?m.dom.parentElement:null,r&&(Ih=e)},y=()=>{Ih&&(Ih=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=Ih;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],N=v.getMeta("uiEvent")==="paste"&&!a,w=v.getMeta("uiEvent")==="drop"&&!i,k=v.getMeta("applyPasteRules"),E=!!k;if(!N&&!w&&!E)return;if(E){let{text:O}=k;typeof O=="string"?O=O:O=cy(Ne.from(O),y.schema);const{from:q}=k,$=q+O.length,V=h_(O);return u({rule:f,state:y,from:q,to:{b:$},pasteEvt:V})}const C=x.doc.content.findDiffStart(y.doc.content),R=x.doc.content.findDiffEnd(y.doc.content);if(!(!l_(C)||!R||C===R.b))return u({rule:f,state:y,from:C,to:R,pasteEvt:o})}}))}var Tp=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=iC(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:Sd(e.name,this.schema)},r=Xe(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return Bd([...this.extensions].reverse()).flatMap(r=>{const a={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Sd(r.name,this.schema)},i=[],o=Xe(r,"addKeyboardShortcuts",a);let c={};if(r.type==="mark"&&Xe(r,"exitable",a)&&(c.ArrowRight=()=>Pl.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=T6(c);i.push(u);const h=Xe(r,"addInputRules",a);if(YN(r,t.options.enableInputRules)&&h){const x=h();if(x&&x.length){const y=i_({editor:t,rules:x}),v=Array.isArray(y)?y:[y];i.push(...v)}}const f=Xe(r,"addPasteRules",a);if(YN(r,t.options.enablePasteRules)&&f){const x=f();if(x&&x.length){const y=f_({editor:t,rules:x});i.push(...y)}}const m=Xe(r,"addProseMirrorPlugins",a);if(m){const x=m();i.push(...x)}return i})}get attributes(){return aC(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Dc(this.extensions);return Object.fromEntries(e.filter(n=>!!Xe(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:Un(n.name,this.schema)},i=Xe(n,"addNodeView",a);if(!i)return[];const o=i();if(!o)return[];const c=(u,h,f,m,x)=>{const y=au(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 Bd([...this.extensions].reverse()).reduceRight((r,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:Sd(a.name,this.schema)},o=Xe(a,"dispatchTransaction",i);return o?c=>{o.call(i,{transaction:c,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return Bd([...this.extensions]).reduce((r,a)=>{const i={name:a.name,options:a.options,storage:this.editor.extensionStorage[a.name],editor:e,type:Sd(a.name,this.schema)},o=Xe(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}=Dc(this.extensions);return Object.fromEntries(e.filter(n=>!!Xe(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:Ti(n.name,this.schema)},i=Xe(n,"addMarkView",a);if(!i)return[];const o=(c,u,h)=>{const f=au(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:Sd(e.name,this.schema)};e.type==="mark"&&((n=qt(Xe(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const a=Xe(e,"onBeforeCreate",r),i=Xe(e,"onCreate",r),o=Xe(e,"onUpdate",r),c=Xe(e,"onSelectionUpdate",r),u=Xe(e,"onTransaction",r),h=Xe(e,"onFocus",r),f=Xe(e,"onBlur",r),m=Xe(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)})}};Tp.resolve=iC;Tp.sort=Bd;Tp.flatten=ly;var p_={};ay(p_,{ClipboardTextSerializer:()=>gC,Commands:()=>yC,Delete:()=>bC,Drop:()=>vC,Editable:()=>NC,FocusEvents:()=>jC,Keymap:()=>kC,Paste:()=>SC,Tabindex:()=>CC,TextDirection:()=>TC,focusEventsPluginKey:()=>wC});var Pn=class xC extends uy{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new xC(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},gC=Pn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new dn({key:new gn("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=lC(n);return oC(r,{from:o,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),yC=Pn.create({name:"commands",addCommands(){return{...JS}}}),bC=Pn.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=nC(t.before,[t,...e]);dC(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,N)=>{const w=N+v.nodeSize-2,k=y.oldRange.from<=N&&w<=y.oldRange.to;this.editor.emit("delete",{type:"node",node:v,from:N,to:w,newFrom:f.mapping.map(N),newTo:f.mapping.map(w),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 N,w;if(y instanceof na){const k=x.slice(v).map(y.from,-1),E=x.slice(v).map(y.to),C=x.invert().map(k,-1),R=x.invert().map(E),O=(N=f.doc.nodeAt(k-1))==null?void 0:N.marks.some($=>$.eq(y.mark)),q=(w=f.doc.nodeAt(E))==null?void 0:w.marks.some($=>$.eq(y.mark));this.editor.emit("delete",{type:"mark",mark:y.mark,from:y.from,to:y.to,deletedRange:{from:C,to:R},newRange:{from:k,to:E},partial:!!(q||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()}}),vC=Pn.create({name:"drop",addProseMirrorPlugins(){return[new dn({key:new gn("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),NC=Pn.create({name:"editable",addProseMirrorPlugins(){return[new dn({key:new gn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),wC=new gn("focusEvents"),jC=Pn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new dn({key:wC,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}}}})]}}),kC=Pn.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,N=v.parent.type.spec.isolating,w=m.pos-m.parentOffset,k=N&&v.parent.childCount===1?w===m.pos:lt.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 wf()||eC()?i:a},addProseMirrorPlugins(){return[new dn({key:new gn("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(N=>N.getMeta("composition")))return;const r=t.some(N=>N.docChanged)&&!e.doc.eq(n.doc),a=t.some(N=>N.getMeta("preventClearDocument"));if(!r||a)return;const{empty:i,from:o,to:c}=e.selection,u=lt.atStart(e.doc).from,h=lt.atEnd(e.doc).to;if(i||!(o===u&&c===h)||!Sp(n.doc))return;const x=n.tr,y=Np({state:n,transaction:x}),{commands:v}=new wp({editor:this.editor,state:y});if(v.clearNodes(),!!x.steps.length)return x}})]}}),SC=Pn.create({name:"paste",addProseMirrorPlugins(){return[new dn({key:new gn("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),CC=Pn.create({name:"tabindex",addProseMirrorPlugins(){return[new dn({key:new gn("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),TC=Pn.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Dc(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new dn({key:new gn("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),m_=class Id{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 Id(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 Id(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 Id(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 Id(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:LD,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=XS(e,this.options.autofocus);this.editorState=Nc.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=rC(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?[NC,gC.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),yC,jC,kC,CC,vC,SC,bC,TC.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 Tp(r,this)}createCommandManager(){this.commandManager=new wp({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Bg(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=Bg(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 GS(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 cC(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return PD(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return cy(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=` - -`,textSerializers:n={}}=t||{};return CD(this.state.doc,{blockSeparator:e,textSerializers:{...lC(this.schema),...n}})}get isEmpty(){return Sp(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 _c(t){return new Cp({find:t.find,handler:({state:e,range:n,match:r})=>{const a=qt(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(dy(n.from,n.to,e.doc).filter(y=>y.mark.type.excluded.find(N=>N===t.type&&N!==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 EC(t){return new Cp({find:t.find,handler:({state:e,range:n,match:r})=>{const a=qt(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 Hg(t){return new Cp({find:t.find,handler:({state:e,range:n,match:r})=>{const a=e.doc.resolve(n.from),i=qt(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 zc(t){return new Cp({find:t.find,handler:({state:e,range:n,match:r,chain:a})=>{const i=qt(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),u=o.doc.resolve(n.from).blockRange(),h=u&&B0(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 N=v.filter(w=>y.includes(w.type.name));o.ensureMarks(N)}}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&&Lo(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 tt){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_={};ay(j_,{createAtomBlockMarkdownSpec:()=>k_,createBlockMarkdownSpec:()=>S_,createInlineMarkdownSpec:()=>MC,parseAttributes:()=>hy,parseIndentedBlocks:()=>Ug,renderNestedMarkdownContent:()=>py,serializeAttributes:()=>fy});function hy(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 fy(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=hy,serializeAttributes:a=fy,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 N=v[1]||"",w=r(N);if(!o.find(E=>!(E in w)))return{type:e,raw:v[0],attributes:w}}},renderMarkdown:f=>{const m=h(f.attrs||{}),x=a(m),y=x?` {${x}}`:"";return`:::${u}${y} :::`}}}function S_(t){const{nodeName:e,name:n,getContent:r,parseAttributes:a=hy,serializeAttributes:i=fy,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 N=r(m);y=typeof N=="string"?[{type:"text",text:N}]:N}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 N=new RegExp(`^:::${h}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),w=m.match(N);if(!w)return;const[k,E=""]=w,C=a(E);let R=1;const O=k.length;let q="";const $=/^:::([\w-]*)(\s.*)?/gm,V=m.slice(O);for($.lastIndex=0;;){const I=$.exec(V);if(I===null)break;const te=I.index,Q=I[1];if(!((v=I[2])!=null&&v.endsWith(":::"))){if(Q)R+=1;else if(R-=1,R===0){const B=V.slice(0,te);q=B.trim();const re=m.slice(0,O+te+I[0].length);let ae=[];if(q)if(c==="block")for(ae=y.blockTokens(B),ae.forEach(J=>{J.text&&(!J.tokens||J.tokens.length===0)&&(J.tokens=y.inlineTokens(J.text))});ae.length>0;){const J=ae[ae.length-1];if(J.type==="paragraph"&&(!J.text||J.text.trim()===""))ae.pop();else break}else ae=y.inlineTokens(q);return{type:e,raw:re,attributes:C,content:q,tokens:ae}}}}}},renderMarkdown:(m,x)=>{const y=f(m.attrs||{}),v=i(y),N=v?` {${v}}`:"",w=x.renderChildren(m.content||[],` - -`);return`:::${h}${N} - -${w} - -:::`}}}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 MC(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 y={};return u.forEach(v=>{const N=typeof v=="string"?v:v.name,w=typeof v=="string"?void 0:v.skipIfDefault;if(N in x){const k=x[N];if(w!==void 0&&k===w)return;y[N]=k}}),y},m=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(x,y)=>{const v={...o,...x.attributes};if(c)return y.createNode(e,v);const N=r?r(x):x.content||"";return N?y.createNode(e,v,[y.createTextNode(N)]):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),N=v==null?void 0:v.index;return N!==void 0?N:-1},tokenize(x,y,v){const N=c?new RegExp(`^\\[${m}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${m}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${m}\\]`),w=x.match(N);if(!w)return;let k="",E="";if(c){const[,R]=w;E=R}else{const[,R,O]=w;E=R,k=O||""}const C=a(E.trim());return{type:e,raw:w[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||{}),N=i(v),w=N?` ${N}`:"";return c?`[${h}${w}]`:`[${h}${w}]${y}[/${h}]`}}}function Ug(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:N,mainContent:w}=v;h=`${h}${x} -`;const k=[w];for(f+=1;fte.trim()!=="");if($===-1)break;if((((a=(r=c[f+1+$].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:a.length)||0)>N){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)>N)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(q=>q.slice(N+m)).join(` -`);O.trim()&&(e.customNestedParser?E=e.customNestedParser(O):E=n.blockTokens(O))}const R=e.createToken(v,E);u.push(R)}if(u.length!==0)return{items:u,raw:h}}function py(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(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 AC extends uy{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new AC(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Sl(t){return new c_({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:a})=>{const i=qt(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(dy(n.from,n.to,e.doc).filter(v=>v.mark.type.excluded.find(w=>w===t.type&&w!==v.mark.type)).filter(v=>v.to>m).length)return null;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 Vx(t,e){return function(r,a,i){return t(r,a,i)&&e(r,a,i)}}function Ph(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 P_(t){return t!=null?t[Symbol.toStringTag]:void 0}function ew(t){return M_(t).concat(A_(t))}const R_=Object.hasOwn||((t,e)=>I_.call(t,e));function Rl(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const O_="__v",L_="__o",D_="_owner",{getOwnPropertyDescriptor:tw,keys:nw}=Object;function __(t,e){return t.byteLength===e.byteLength&&jf(new Uint8Array(t),new Uint8Array(e))}function z_(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function $_(t,e){return t.byteLength===e.byteLength&&jf(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function F_(t,e){return Rl(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 sw(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 H_=Rl;function U_(t,e,n){const r=nw(t);let a=r.length;if(nw(e).length!==a)return!1;for(;a-- >0;)if(!IC(t,e,n,r[a]))return!1;return!0}function Cd(t,e,n){const r=ew(t);let a=r.length;if(ew(e).length!==a)return!1;let i,o,c;for(;a-- >0;)if(i=r[a],!IC(t,e,n,i)||(o=tw(t,i),c=tw(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 Rl(t.valueOf(),e.valueOf())}function K_(t,e){return t.source===e.source&&t.flags===e.flags}function rw(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 jf(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 IC(t,e,n,r){return(r===D_||r===L_||r===O_)&&(t.$$typeof||e.$$typeof)?!0:R_(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:y,unknownTagComparators:v}){return function(w,k,E){if(w===k)return!0;if(w==null||k==null)return!1;const C=typeof w;if(C!==typeof k)return!1;if(C!=="object")return C==="number"?c(w,k,E):C==="function"?i(w,k,E):!1;const R=w.constructor;if(R!==k.constructor)return!1;if(R===Object)return u(w,k,E);if(Array.isArray(w))return e(w,k,E);if(R===Date)return r(w,k,E);if(R===RegExp)return f(w,k,E);if(R===Map)return o(w,k,E);if(R===Set)return m(w,k,E);const O=l7.call(w);if(O===X_)return r(w,k,E);if(O===s7)return f(w,k,E);if(O===e7)return o(w,k,E);if(O===r7)return m(w,k,E);if(O===n7)return typeof w.then!="function"&&typeof k.then!="function"&&u(w,k,E);if(O===o7)return y(w,k,E);if(O===Z_)return a(w,k,E);if(O===J_)return u(w,k,E);if(i7[O])return x(w,k,E);if(O===G_)return t(w,k,E);if(O===Y_)return n(w,k,E);if(O===Q_||O===t7||O===a7)return h(w,k,E);if(v){let q=v[O];if(!q){const $=P_(w);$&&(q=v[$])}if(q)return q(w,k,E)}return!1}}function d7({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:__,areArraysEqual:n?Cd:z_,areDataViewsEqual:$_,areDatesEqual:F_,areErrorsEqual:B_,areFunctionsEqual:V_,areMapsEqual:n?Vx(sw,Cd):sw,areNumbersEqual:H_,areObjectsEqual:n?Cd:U_,arePrimitiveWrappersEqual:W_,areRegExpsEqual:K_,areSetsEqual:n?Vx(rw,Cd):rw,areTypedArraysEqual:n?Vx(jf,Cd):jf,areUrlsEqual:q_,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const a=Ph(r.areArraysEqual),i=Ph(r.areMapsEqual),o=Ph(r.areObjectsEqual),c=Ph(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=_o();_o({strict:!0});_o({circular:!0});_o({circular:!0,strict:!0});_o({createInternalComparator:()=>Rl});_o({strict:!0,createInternalComparator:()=>Rl});_o({circular:!0,createInternalComparator:()=>Rl});_o({circular:!0,createInternalComparator:()=>Rl,strict:!0});function _o(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 Hx={exports:{}},Ux={};/** - * @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 aw;function p7(){if(aw)return Ux;aw=1;var t=du(),e=v2();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 Ux.useSyncExternalStoreWithSelector=function(h,f,m,x,y){var v=i(null);if(v.current===null){var N={hasValue:!1,value:null};v.current=N}else N=v.current;v=c(function(){function k(q){if(!E){if(E=!0,C=q,q=x(q),y!==void 0&&N.hasValue){var $=N.value;if(y($,q))return R=$}return R=q}if($=R,r(C,q))return $;var V=x(q);return y!==void 0&&y($,V)?(C=q,$):(C=q,R=V)}var E=!1,C,R,O=m===void 0?null:m;return[function(){return k(f())},O===null?void 0:function(){return k(O())}]},[f,m,x,y]);var w=a(h,v[0],v[1]);return o(function(){N.hasValue=!0,N.value=w},[w]),u(w),w},Ux}var iw;function m7(){return iw||(iw=1,Hx.exports=p7()),Hx.exports}var x7=m7(),g7=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},y7=({contentComponent:t})=>{const e=N2.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]:xj.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 Vs.Component{constructor(t){var e;super(t),this.editorContentRef=Vs.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=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=b.forwardRef((t,e)=>{const n=Vs.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Vs.createElement(v7,{key:n,innerRef:e,...t})}),PC=Vs.memo(N7),w7=typeof window<"u"?b.useLayoutEffect:b.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]=b.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]),b.useDebugValue(r),r}var S7=!1,Wg=typeof window>"u",C7=Wg||!!(typeof window<"u"&&window.next),T7=class RC{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?Wg||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?RC.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=b.useRef(t);n.current=t;const[r]=b.useState(()=>new T7(n)),a=N2.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return b.useDebugValue(a),b.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 OC=b.createContext({editor:null});OC.Consumer;var M7=b.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),A7=()=>b.useContext(M7);Vs.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}})});Vs.createContext({markViewContentRef:()=>{}});var my=b.createContext({get editor(){throw new Error("useTiptap must be used within a provider")}});my.displayName="TiptapContext";var I7=()=>b.useContext(my);function LC({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(OC.Provider,{value:i,children:s.jsx(my.Provider,{value:a,children:n})})}LC.displayName="Tiptap";function DC({...t}){const{editor:e}=I7();return s.jsx(PC,{editor:e,...t})}DC.displayName="Tiptap.Content";Object.assign(LC,{Content:DC});var kf=(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]},P7=/^\s*>\s$/,R7=$n.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return kf("blockquote",{...Gt(this.options.HTMLAttributes,t),children:kf("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[zc({find:P7,type:this.type})]}}),O7=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,L7=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,D7=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,_7=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,z7=Pl.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 kf("strong",{...Gt(this.options.HTMLAttributes,t),children:kf("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[_c({find:O7,type:this.type}),_c({find:D7,type:this.type})]},addPasteRules(){return[Sl({find:L7,type:this.type}),Sl({find:_7,type:this.type})]}}),$7=/(^|[^`])`([^`]+)`(?!`)$/,F7=/(^|[^`])`([^`]+)`(?!`)/g,B7=Pl.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Gt(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[_c({find:$7,type:this.type})]},addPasteRules(){return[Sl({find:F7,type:this.type})]}}),Wx=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:Wx,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",Gt(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:Wx,{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:Wx,{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,N=0;const w=h-f;for(let q=0;q=w){v=q;break}N+=y[q].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 R=f;for(let q=0;q{const{from:u,to:h}=a,x=r.doc.textBetween(u,h,` -`,` -`).split(` -`).map(y=>{var v;const N=((v=y.match(/^ */))==null?void 0:v[0])||"",w=Math.min(N.length,n);return y.slice(w)}).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(lt.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[Hg({find:V7,type:this.type,getAttributes:t=>({language:t[1]})}),Hg({find:H7,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new dn({key:new gn("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(nt.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",Gt(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]}`,Gt(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=>Hg({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",Gt(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 uC(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(nt.create(o.doc,u.pos+1)):u.nodeAfter.isBlock?o.setSelection(tt.create(o.doc,u.pos)):o.setSelection(nt.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(nt.create(o.doc,h+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[EC({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=Pl.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",Gt(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[_c({find:J7,type:this.type}),_c({find:Y7,type:this.type})]},addPasteRules(){return[Sl({find:Q7,type:this.type}),Sl({find:X7,type:this.type})]}});const ez="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",tz="ελ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",Kg="numeric",qg="ascii",Gg="alpha",Vd="asciinumeric",Pd="alphanumeric",Jg="domain",_C="emoji",nz="scheme",sz="slashscheme",Kx="whitespace";function rz(t,e){return t in e||(e[t]=[]),e[t]}function ul(t,e,n){e[Kg]&&(e[Vd]=!0,e[Pd]=!0),e[qg]&&(e[Vd]=!0,e[Gg]=!0),e[Vd]&&(e[Pd]=!0),e[Gg]&&(e[Pd]=!0),e[Pd]&&(e[Jg]=!0),e[_C]&&(e[Jg]=!0);for(const r in e){const a=rz(r,n);a.indexOf(t)<0&&a.push(t)}}function az(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function nr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}nr.groups={};nr.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;rt.ta(e,n,r,a),En=(t,e,n,r,a)=>t.tr(e,n,r,a),ow=(t,e,n,r,a)=>t.ts(e,n,r,a),Re=(t,e,n,r,a)=>t.tt(e,n,r,a),hi="WORD",Qg="UWORD",zC="ASCIINUMERICAL",$C="ALPHANUMERICAL",iu="LOCALHOST",Yg="TLD",Xg="UTLD",qh="SCHEME",mc="SLASH_SCHEME",xy="NUM",Zg="WS",gy="NL",Hd="OPENBRACE",Ud="CLOSEBRACE",Sf="OPENBRACKET",Cf="CLOSEBRACKET",Tf="OPENPAREN",Ef="CLOSEPAREN",Mf="OPENANGLEBRACKET",Af="CLOSEANGLEBRACKET",If="FULLWIDTHLEFTPAREN",Pf="FULLWIDTHRIGHTPAREN",Rf="LEFTCORNERBRACKET",Of="RIGHTCORNERBRACKET",Lf="LEFTWHITECORNERBRACKET",Df="RIGHTWHITECORNERBRACKET",_f="FULLWIDTHLESSTHAN",zf="FULLWIDTHGREATERTHAN",$f="AMPERSAND",Ff="APOSTROPHE",Bf="ASTERISK",lo="AT",Vf="BACKSLASH",Hf="BACKTICK",Uf="CARET",ho="COLON",yy="COMMA",Wf="DOLLAR",Sa="DOT",Kf="EQUALS",by="EXCLAMATION",Lr="HYPHEN",Wd="PERCENT",qf="PIPE",Gf="PLUS",Jf="POUND",Kd="QUERY",vy="QUOTE",FC="FULLWIDTHMIDDLEDOT",Ny="SEMI",Ca="SLASH",qd="TILDE",Qf="UNDERSCORE",BC="EMOJI",Yf="SYM";var VC=Object.freeze({__proto__:null,ALPHANUMERICAL:$C,AMPERSAND:$f,APOSTROPHE:Ff,ASCIINUMERICAL:zC,ASTERISK:Bf,AT:lo,BACKSLASH:Vf,BACKTICK:Hf,CARET:Uf,CLOSEANGLEBRACKET:Af,CLOSEBRACE:Ud,CLOSEBRACKET:Cf,CLOSEPAREN:Ef,COLON:ho,COMMA:yy,DOLLAR:Wf,DOT:Sa,EMOJI:BC,EQUALS:Kf,EXCLAMATION:by,FULLWIDTHGREATERTHAN:zf,FULLWIDTHLEFTPAREN:If,FULLWIDTHLESSTHAN:_f,FULLWIDTHMIDDLEDOT:FC,FULLWIDTHRIGHTPAREN:Pf,HYPHEN:Lr,LEFTCORNERBRACKET:Rf,LEFTWHITECORNERBRACKET:Lf,LOCALHOST:iu,NL:gy,NUM:xy,OPENANGLEBRACKET:Mf,OPENBRACE:Hd,OPENBRACKET:Sf,OPENPAREN:Tf,PERCENT:Wd,PIPE:qf,PLUS:Gf,POUND:Jf,QUERY:Kd,QUOTE:vy,RIGHTCORNERBRACKET:Of,RIGHTWHITECORNERBRACKET:Df,SCHEME:qh,SEMI:Ny,SLASH:Ca,SLASH_SCHEME:mc,SYM:Yf,TILDE:qd,TLD:Yg,UNDERSCORE:Qf,UTLD:Xg,UWORD:Qg,WORD:hi,WS:Zg});const di=/[a-z]/,Td=new RegExp("\\p{L}","u"),qx=new RegExp("\\p{Emoji}","u"),ui=/\d/,Gx=/\s/,lw="\r",Jx=` -`,iz="️",oz="‍",Qx="";let Rh=null,Oh=null;function lz(t=[]){const e={};nr.groups=e;const n=new nr;Rh==null&&(Rh=cw(ez)),Oh==null&&(Oh=cw(tz)),Re(n,"'",Ff),Re(n,"{",Hd),Re(n,"}",Ud),Re(n,"[",Sf),Re(n,"]",Cf),Re(n,"(",Tf),Re(n,")",Ef),Re(n,"<",Mf),Re(n,">",Af),Re(n,"(",If),Re(n,")",Pf),Re(n,"「",Rf),Re(n,"」",Of),Re(n,"『",Lf),Re(n,"』",Df),Re(n,"<",_f),Re(n,">",zf),Re(n,"&",$f),Re(n,"*",Bf),Re(n,"@",lo),Re(n,"`",Hf),Re(n,"^",Uf),Re(n,":",ho),Re(n,",",yy),Re(n,"$",Wf),Re(n,".",Sa),Re(n,"=",Kf),Re(n,"!",by),Re(n,"-",Lr),Re(n,"%",Wd),Re(n,"|",qf),Re(n,"+",Gf),Re(n,"#",Jf),Re(n,"?",Kd),Re(n,'"',vy),Re(n,"/",Ca),Re(n,";",Ny),Re(n,"~",qd),Re(n,"_",Qf),Re(n,"\\",Vf),Re(n,"・",FC);const r=En(n,ui,xy,{[Kg]:!0});En(r,ui,r);const a=En(r,di,zC,{[Vd]:!0}),i=En(r,Td,$C,{[Pd]:!0}),o=En(n,di,hi,{[qg]:!0});En(o,ui,a),En(o,di,o),En(a,ui,a),En(a,di,a);const c=En(n,Td,Qg,{[Gg]:!0});En(c,di),En(c,ui,i),En(c,Td,c),En(i,ui,i),En(i,di),En(i,Td,i);const u=Re(n,Jx,gy,{[Kx]:!0}),h=Re(n,lw,Zg,{[Kx]:!0}),f=En(n,Gx,Zg,{[Kx]:!0});Re(n,Qx,f),Re(h,Jx,u),Re(h,Qx,f),En(h,Gx,f),Re(f,lw),Re(f,Jx),En(f,Gx,f),Re(f,Qx,f);const m=En(n,qx,BC,{[_C]:!0});Re(m,"#"),En(m,qx,m),Re(m,iz,m);const x=Re(m,oz);Re(x,"#"),En(x,qx,m);const y=[[di,o],[ui,a]],v=[[di,null],[Td,c],[ui,i]];for(let N=0;NN[0]>w[0]?1:-1);for(let N=0;N=0?E[Jg]=!0:di.test(w)?ui.test(w)?E[Vd]=!0:E[qg]=!0:E[Kg]=!0,ow(n,w,w,E)}return ow(n,"localhost",iu,{ascii:!0}),n.jd=new nr(Yf),{start:n,tokens:Object.assign({groups:e},VC)}}function HC(t,e){const n=cz(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 cz(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 so(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 ou={defaultProtocol:"http",events:null,format:dw,formatHref:dw,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function wy(t,e=null){let n=Object.assign({},ou);t&&(n=Object.assign(n,t instanceof wy?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=ou.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 Ep(t,e){class n extends UC{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 uw=Ep("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),hw=Ep("text"),dz=Ep("nl"),Lh=Ep("url",{isLink:!0,toHref(t=ou.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==iu&&t[1].t===ho}}),Or=t=>new nr(t);function uz({groups:t}){const e=t.domain.concat([$f,Bf,lo,Vf,Hf,Uf,Wf,Kf,Lr,xy,Wd,qf,Gf,Jf,Ca,Yf,qd,Qf]),n=[Ff,ho,yy,Sa,by,Wd,Kd,vy,Ny,Mf,Af,Hd,Ud,Cf,Sf,Tf,Ef,If,Pf,Rf,Of,Lf,Df,_f,zf],r=[$f,Ff,Bf,Vf,Hf,Uf,Wf,Kf,Lr,Hd,Ud,Wd,qf,Gf,Jf,Kd,Ca,Yf,qd,Qf],a=Or(),i=Re(a,qd);bt(i,r,i),bt(i,t.domain,i);const o=Or(),c=Or(),u=Or();bt(a,t.domain,o),bt(a,t.scheme,c),bt(a,t.slashscheme,u),bt(o,r,i),bt(o,t.domain,o);const h=Re(o,lo);Re(i,lo,h),Re(c,lo,h),Re(u,lo,h);const f=Re(i,Sa);bt(f,r,i),bt(f,t.domain,i);const m=Or();bt(h,t.domain,m),bt(m,t.domain,m);const x=Re(m,Sa);bt(x,t.domain,m);const y=Or(uw);bt(x,t.tld,y),bt(x,t.utld,y),Re(h,iu,y);const v=Re(m,Lr);Re(v,Lr,v),bt(v,t.domain,m),bt(y,t.domain,m),Re(y,Sa,x),Re(y,Lr,v);const N=Re(y,ho);bt(N,t.numeric,uw);const w=Re(o,Lr),k=Re(o,Sa);Re(w,Lr,w),bt(w,t.domain,o),bt(k,r,i),bt(k,t.domain,o);const E=Or(Lh);bt(k,t.tld,E),bt(k,t.utld,E),bt(E,t.domain,o),bt(E,r,i),Re(E,Sa,k),Re(E,Lr,w),Re(E,lo,h);const C=Re(E,ho),R=Or(Lh);bt(C,t.numeric,R);const O=Or(Lh),q=Or();bt(O,e,O),bt(O,n,q),bt(q,e,O),bt(q,n,q),Re(E,Ca,O),Re(R,Ca,O);const $=Re(c,ho),V=Re(u,ho),I=Re(V,Ca),te=Re(I,Ca);bt(c,t.domain,o),Re(c,Sa,k),Re(c,Lr,w),bt(u,t.domain,o),Re(u,Sa,k),Re(u,Lr,w),bt($,t.domain,O),Re($,Ca,O),Re($,Kd,O),bt(te,t.domain,O),bt(te,e,O),Re(te,Ca,O);const Q=[[Hd,Ud],[Sf,Cf],[Tf,Ef],[Mf,Af],[If,Pf],[Rf,Of],[Lf,Df],[_f,zf]];for(let B=0;B=0&&x++,a++,f++;if(x<0)a-=f,a0&&(i.push(Yx(hw,e,o)),o=[]),a-=x,f-=x;const y=m.t,v=n.slice(a-f,a);i.push(Yx(y,e,v))}}return o.length>0&&i.push(Yx(hw,e,o)),i}function Yx(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 fz=typeof console<"u"&&console&&console.warn||(()=>{}),pz="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",fn={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function mz(){return nr.groups={},fn.scanner=null,fn.parser=null,fn.tokenQueue=[],fn.pluginQueue=[],fn.customSchemes=[],fn.initialized=!1,fn}function fw(t,e=!1){if(fn.initialized&&fz(`linkifyjs: already initialized - will not register custom scheme "${t}" ${pz}`),!/^[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`);fn.customSchemes.push([t,e])}function xz(){fn.scanner=lz(fn.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=nC(n.doc,[...e]);if(dC(c).forEach(({newRange:h})=>{const f=vD(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(!yz.test(y))return;m=f[0],x=r.doc.textBetween(m.pos,h.to,void 0," ")}if(m&&x){const y=x.split(gz).filter(Boolean);if(y.length<=0)return!1;const v=y[y.length-1],N=m.pos+x.lastIndexOf(v);if(!v)return!1;const w=jy(v).map(k=>k.toObject(t.defaultProtocol));if(!vz(w))return!1;w.filter(k=>k.isLink).map(k=>({...k,from:N+k.start+1,to:N+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=>{dy(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 wz(t){return new dn({key:new gn("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=cC(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 jz(t){return new dn({key:new gn("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=WC(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(bz,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var kz=Pl.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"){fw(t);return}fw(t.scheme,t.optionalSlashes)})},onDestroy(){mz()},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",Gt(this.options.HTMLAttributes,t),0]:["a",Gt(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[Sl({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,a=WC(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(Nz({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(wz({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(jz({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),Sz=Object.defineProperty,Cz=(t,e)=>{for(var n in e)Sz(t,n,{get:e[n],enumerable:!0})},Tz="listItem",pw="textStyle",mw=/^\s*([-+*])\s$/,KC=$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",Gt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,` -`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Tz,this.editor.getAttributes(pw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=zc({find:mw,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=zc({find:mw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(pw),editor:this.editor})),[t]}}),qC=$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",Gt(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)=>py(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)}}}),Ez={};Cz(Ez,{findListItemPos:()=>yu,getNextListDepth:()=>Sy,handleBackspace:()=>e0,handleDelete:()=>t0,hasListBefore:()=>GC,hasListItemAfter:()=>Mz,hasListItemBefore:()=>JC,listItemHasSubList:()=>QC,nextListIsDeeper:()=>YC,nextListIsHigher:()=>XC});var yu=(t,e)=>{const{$from:n}=e.selection,r=Un(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}},Sy=(t,e)=>{const n=yu(t,e);if(!n)return!1;const[,r]=AD(e,t,n.$pos.pos+4);return r},GC=(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))},JC=(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)},QC=(t,e,n)=>{if(!n)return!1;const r=Un(t,e.schema);let a=!1;return n.descendants(i=>{i.type===r&&(a=!0)}),a},e0=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Mo(t.state,e)&&GC(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(!Mo(t.state,e)||!OD(t.state))return!1;const r=yu(e,t.state);if(!r)return!1;const i=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=QC(e,t.state,i);return JC(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},YC=(t,e)=>{const n=Sy(t,e),r=yu(t,e);return!r||!n?!1:n>r.depth},XC=(t,e)=>{const n=Sy(t,e),r=yu(t,e);return!r||!n?!1:n{if(!Mo(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:YC(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():XC(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},Mz=(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)},ZC=Pn.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&&t0(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&&t0(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&&e0(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&&e0(t,n,r)&&(e=!0)}),e}}}}),xw=/^(\s*)(\d+)\.\s+(.*)$/,Az=/^\s/;function Iz(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(N=>N.indent)),v=e3(x,y,n);h.push({type:"list",ordered:!0,start:x[0].number,items:v,raw:x.map(N=>N.raw).join(` -`)})}a.push({type:"list_item",raw:o.raw,tokens:h}),i=m}else i+=1}return a}function Pz(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",gw="textStyle",yw=/^(\d+)\.\s$/,t3=$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",Gt(this.options.HTMLAttributes,n),0]:["ol",Gt(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?Pz(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]=Iz(a);if(i.length===0)return;const c=e3(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(gw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=zc({find:yw,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=zc({find:yw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(gw)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),Oz=/^\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",Gt(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 py(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 N=y.doc.nodeAt(v);return y.setNodeMarkup(v,void 0,{...N==null?void 0:N.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=au(m,x),v=new Set(Object.keys(y)),N=this.options.HTMLAttributes;return f.forEach(w=>{v.has(w)||(w in N?a.setAttribute(w,N[w]):a.removeAttribute(w))}),Object.entries(y).forEach(([w,k])=>{k==null?w in N?a.setAttribute(w,N[w]):a.removeAttribute(w):a.setAttribute(w,k)}),f=v,!0}}}},addInputRules(){return[zc({find:Oz,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Dz=$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",Gt(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=Ug(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=Ug(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()}}});Pn.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(KC.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(qC.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(ZC.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(t3.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(Lz.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(Dz.configure(this.options.taskList)),t}});var bw=" ",_z=" ",zz=$n.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Gt(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===bw||r[0].text===_z)?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?bw: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+~~))$/,Fz=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Bz=Pl.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",Gt(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[_c({find:$z,type:this.type})]},addPasteRules(){return[Sl({find:Fz,type:this.type})]}}),Vz=$n.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),Hz=Pl.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",Gt(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 Uz(t={}){return new dn({view(e){return new Wz(e,t)}})}class Wz{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(),N=m?v.bottom:v.top;m&&x&&(N=(N+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let w=this.width/2*c;r={left:v.left,right:v.right,top:N-w,bottom:N+w}}}}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=G2(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 lt{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return An.valid(r)?new An(r):lt.near(r)}content(){return ze.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 Cy(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!Kz(e)||!qz(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&&!tt.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;lt.jsonID("gapcursor",An);class Cy{constructor(e){this.pos=e}map(e){return new Cy(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return An.valid(n)?new An(n):lt.near(n)}}function n3(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function Kz(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||n3(a.type))return!0;if(a.inlineContent)return!1}}return!0}function qz(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let a=r.child(n);;a=a.firstChild){if(a.childCount==0&&!a.inlineContent||n3(a.type))return!0;if(a.inlineContent)return!1}}return!0}function Gz(){return new dn({props:{decorations:Xz,createSelectionBetween(t,e,n){return e.pos==n.pos&&An.valid(n)?new An(n):null},handleClick:Qz,handleKeyDown:Jz,handleDOMEvents:{beforeinput:Yz}}})}const Jz=ry({ArrowLeft:Dh("horiz",-1),ArrowRight:Dh("horiz",1),ArrowUp:Dh("vert",-1),ArrowDown:Dh("vert",1)});function Dh(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 nt){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 Qz(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&&tt.isSelectable(t.state.doc.nodeAt(a.inside))?!1:(t.dispatch(t.state.tr.setSelection(new An(r))),!0)}function Yz(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=Ne.empty;for(let o=r.length-1;o>=0;o--)a=Ne.from(r[o].createAndFill(null,a));let i=t.state.tr.replace(n.pos,n.pos,new ze(a,0,0));return i.setSelection(nt.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function Xz(t){if(!(t.selection instanceof An))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",rn.create(t.doc,[Qn.widget(t.selection.head,e,{key:"gapcursor"})])}var Xf=200,is=function(){};is.prototype.append=function(e){return e.length?(e=is.from(e),!this.length&&e||e.length=n?is.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};is.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};is.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)};is.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};is.from=function(e){return e instanceof is?e:e&&e.length?new s3(e):is.empty};var s3=(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<=Xf)return new e(this.values.concat(a.flatten()))},e.prototype.leafPrepend=function(a){if(this.length+a.length<=Xf)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})(is);is.empty=new s3([]);var Zz=(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})(is);const e$=500;class ta{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 ro(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 ro(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 ta(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;fn$&&(c=t$(c,h),o-=h),new ta(c.append(i),o)}remapping(e,n){let r=new Zd;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 ta(this.items.append(e.map(n=>new ro(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 N=e.steps[y].invert(e.docs[y]),w=x.selection&&x.selection.map(i.slice(u+1,y));w&&c++,r.push(new ro(v,N,w))}else r.push(new ro(v))},a);let h=[];for(let x=n;xe$&&(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 ro(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 ta(is.from(a.reverse()),i)}}ta.empty=new ta(is.empty,0);function t$(t,e){let n;return t.forEach((r,a)=>{if(r.selection&&e--==0)return n=a,!1}),t.slice(n)}let ro=class r3{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 r3(n.getMap().invert(),n,this.selection)}}};class co{constructor(e,n,r,a,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=a,this.prevComposition=i}}const n$=20;function s$(t,e,n,r){let a=n.getMeta(xl),i;if(a)return a.historyState;n.getMeta(i$)&&(t=new co(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 co(t.done.addTransform(n,void 0,r,Gh(e)),t.undone,vw(n.mapping.maps),t.prevTime,t.prevComposition):new co(t.done,t.undone.addTransform(n,void 0,r,Gh(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||!r$(n,t.prevRanges)),h=o?Xx(t.prevRanges,n.mapping):vw(n.mapping.maps);return new co(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,Gh(e)),ta.empty,h,n.time,c??t.prevComposition)}else return(i=n.getMeta("rebased"))?new co(t.done.rebased(n,i),t.undone.rebased(n,i),Xx(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new co(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Xx(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function r$(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 vw(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 Xx(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=a$(a,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const i3=a3(!1,!0),o3=a3(!0,!0);Pn.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new dn({key:new gn("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 l$=Pn.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Uz(this.options)]}});Pn.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new dn({key:new gn("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:a}=e,i=[];if(!n||!r)return rn.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((u,h)=>{if(u.isText)return;if(!(a>=h&&a<=h+u.nodeSize-1))return!1;o+=1});let c=0;return t.descendants((u,h)=>{if(u.isText||!(a>=h&&a<=h+u.nodeSize-1))return!1;if(c+=1,this.options.mode==="deepest"&&o-c>0||this.options.mode==="shallowest"&&c>1)return this.options.mode==="deepest";i.push(Qn.node(h,h+u.nodeSize,{class:this.options.className}))}),rn.create(t,i)}}})]}});var c$=Pn.create({name:"gapCursor",addProseMirrorPlugins(){return[Gz()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=qt(Xe(t,"allowGapCursor",n)))!=null?e:null}}}),ww="placeholder";function d$(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var u$=Pn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:ww,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${d$(this.options.dataAttribute)}`:`data-${ww}`;return[new dn({key:new gn("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&&Sp(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}),rn.create(e,i)}}})]}});Pn.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new dn({key:new gn("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||uC(n.selection)||t.view.dragging?null:rn.create(n.doc,[Qn.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function jw({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var h$=Pn.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new gn(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,a])=>a).filter(a=>(this.options.notAfter||[]).concat(n).includes(a.name));return[new dn({key:e,appendTransaction:(a,i,o)=>{const{doc:c,tr:u,schema:h}=o,f=e.getState(o),m=c.content.size,x=h.nodes[n];if(f)return u.insert(m,x.create())},state:{init:(a,i)=>{const o=i.tr.doc.lastChild;return!jw({node:o,types:r})},apply:(a,i)=>{if(!a.docChanged||a.getMeta("__uniqueIDTransaction"))return i;const o=a.doc.lastChild;return!jw({node:o,types:r})}}})]}}),f$=Pn.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>i3(t,e),redo:()=>({state:t,dispatch:e})=>o3(t,e)}},addProseMirrorPlugins(){return[o$(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()}}}),p$=Pn.create({name:"starterKit",addExtensions(){var t,e,n,r;const a=[];return this.options.bold!==!1&&a.push(z7.configure(this.options.bold)),this.options.blockquote!==!1&&a.push(R7.configure(this.options.blockquote)),this.options.bulletList!==!1&&a.push(KC.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(l$.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&a.push(c$.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(f$.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(qC.configure(this.options.listItem)),this.options.listKeymap!==!1&&a.push(ZC.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&a.push(kz.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&a.push(t3.configure(this.options.orderedList)),this.options.paragraph!==!1&&a.push(zz.configure(this.options.paragraph)),this.options.strike!==!1&&a.push(Bz.configure(this.options.strike)),this.options.text!==!1&&a.push(Vz.configure(this.options.text)),this.options.underline!==!1&&a.push(Hz.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&a.push(h$.configure((r=this.options)==null?void 0:r.trailingNode)),a}}),m$=p$,x$=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,g$=$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",Gt(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 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[EC({find:x$,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),y$=g$;function b$(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,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 N=c.pos-v.length,w=Array.from(v.matchAll(y)).pop();if(!w||w.input===void 0||w.index===void 0)return null;const k=w.input.slice(Math.max(0,w.index-1),w.index),E=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(k);if(i!==null&&!E)return null;const C=N+w.index;let R=C+w[0].length;return u&&f.test(v.slice(R-1,R+1))&&(w[0]+=" ",R+=1),C=c.pos?{range:{from:C,to:R},query:w[0].slice(n.length),text:w[0]}:null}var v$=new gn("suggestion");function N$({pluginKey:t=v$,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:N=b$,shouldShow:w}){let k;const E=y==null?void 0:y(),C=()=>{const $=e.state.selection.$anchor.pos,V=e.view.coordsAtPos($),{top:I,right:te,bottom:Q,left:B}=V;try{return new DOMRect(B,I,te-B,Q-I)}catch{return null}},R=($,V)=>V?()=>{const I=t.getState(e.state),te=I==null?void 0:I.decorationId,Q=$.dom.querySelector(`[data-decoration-id="${te}"]`);return(Q==null?void 0:Q.getBoundingClientRect())||null}:C;function O($,V){var I;try{const Q=t.getState($.state),B=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:B,clientRect:R($,B)};(I=E==null?void 0:E.onExit)==null||I.call(E,re)}catch{}const te=$.state.tr.setMeta(V,{exit:!0});$.dispatch(te)}const q=new dn({key:t,view(){return{update:async($,V)=>{var I,te,Q,B,re,ae,J;const F=(I=this.key)==null?void 0:I.getState(V),D=(te=this.key)==null?void 0:te.getState($.state),P=F.active&&D.active&&F.range.from!==D.range.from,oe=!F.active&&D.active,G=F.active&&!D.active,_=!oe&&!G&&F.query!==D.query,U=oe||P&&_,H=_||P,K=G||P&&_;if(!U&&!H&&!K)return;const me=K&&!U?F:D,X=$.dom.querySelector(`[data-decoration-id="${me.decorationId}"]`);k={editor:e,range:me.range,query:me.query,text:me.text,items:[],command:le=>m({editor:e,range:me.range,props:le}),decorationNode:X,clientRect:R($,X)},U&&((Q=E==null?void 0:E.onBeforeStart)==null||Q.call(E,k)),H&&((B=E==null?void 0:E.onBeforeUpdate)==null||B.call(E,k)),(H||U)&&(k.items=await x({editor:e,query:me.query})),K&&((re=E==null?void 0:E.onExit)==null||re.call(E,k)),H&&((ae=E==null?void 0:E.onUpdate)==null||ae.call(E,k)),U&&((J=E==null?void 0:E.onStart)==null||J.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($,V,I,te){const{isEditable:Q}=e,{composing:B}=e.view,{selection:re}=$,{empty:ae,from:J}=re,F={...V},D=$.getMeta(t);if(D&&D.exit)return F.active=!1,F.decorationId=null,F.range={from:0,to:0},F.query=null,F.text=null,F;if(F.composing=B,Q&&(ae||e.view.composing)){(JV.range.to)&&!B&&!V.composing&&(F.active=!1);const P=N({char:n,allowSpaces:r,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:o,$position:re.$from}),oe=`id_${Math.floor(Math.random()*4294967295)}`;P&&v({editor:e,state:te,range:P.range,isActive:V.active})&&(!w||w({editor:e,range:P.range,query:P.query,text:P.text,transaction:$}))?(F.active=!0,F.decorationId=V.decorationId?V.decorationId:oe,F.range=P.range,F.query=P.query,F.text=P.text):F.active=!1}else F.active=!1;return F.active||(F.decorationId=null,F.range={from:0,to:0},F.query=null,F.text=null),F}},props:{handleKeyDown($,V){var I,te,Q,B;const{active:re,range:ae}=q.getState($.state);if(!re)return!1;if(V.key==="Escape"||V.key==="Esc"){const F=q.getState($.state),D=(I=k==null?void 0:k.decorationNode)!=null?I:null,P=D??(F!=null&&F.decorationId?$.dom.querySelector(`[data-decoration-id="${F.decorationId}"]`):null);if(((te=E==null?void 0:E.onKeyDown)==null?void 0:te.call(E,{view:$,event:V,range:F.range}))||!1)return!0;const G={editor:e,range:F.range,query:F.query,text:F.text,items:[],command:_=>m({editor:e,range:F.range,props:_}),decorationNode:P,clientRect:P?()=>P.getBoundingClientRect()||null:null};return(Q=E==null?void 0:E.onExit)==null||Q.call(E,G),O($,t),!0}return((B=E==null?void 0:E.onKeyDown)==null?void 0:B.call(E,{view:$,event:V,range:ae}))||!1},decorations($){const{active:V,range:I,decorationId:te,query:Q}=q.getState($);if(!V)return null;const B=!(Q!=null&&Q.length),re=[u];return B&&re.push(f),rn.create($.doc,[Qn.inline(I.from,I.to,{nodeName:c,class:re.join(" "),"data-decoration-id":te,"data-decoration-content":h})])}}});return q}function w$({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const a=new gn;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 l3(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>w$({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function kw(t,e){const n=l3(t),r=n.find(a=>a.char===e);return r||(n.length?n[0]:null)}var j$=$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",Gt(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=kw(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Gt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=Gt({"data-type":this.name},this.options.HTMLAttributes,e);const a=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof a=="string"?["span",Gt({"data-type":this.name},this.options.HTMLAttributes,e),a]:a},...MC({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:kw(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 bi,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 l3(this).map(N$)}}),k$=j$,S$=u$;let n0,s0;if(typeof WeakMap<"u"){let t=new WeakMap;n0=e=>t.get(e),s0=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;n0=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 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 E$(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 A$(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 ia(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 Mp(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=Cl(e.$head)||I$(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function I$(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 r0(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function P$(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Ty(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function c3(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 Tl(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 d3(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 Z2(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(r0(r)&&r0(a)&&Ty(r,a)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?fi.rowSelection(r,a):i&&this.isColSelection()?fi.colSelection(r,a):new fi(r,a)}return nt.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||w>0){let k=v.attrs;if(N>0&&(k=Tl(k,0,N)),w>0&&(k=Tl(k,k.colspan-w,w)),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 fi&&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"}))}),rn.create(t.doc,e)}function D$({$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 _$({$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 tt&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")i=cn.create(a,r.from);else if(o=="row"){const c=a.resolve(r.from+1);i=cn.rowSelection(c,c)}else if(!n){const c=In.get(r.node),u=r.from+1,h=u+c.map[c.width*c.height-1];i=cn.create(a,u+1,h)}}else r instanceof nt&&D$(r)?i=nt.create(a,r.from):r instanceof nt&&_$(r)&&(i=nt.create(a,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}const $$=new gn("fix-tables");function h3(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=F$(t,a,i,n))};return e?e.doc!=t.doc&&h3(e.doc,t.doc,0,r):t.doc.descendants(r),n}function F$(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 w=0;w0?-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;W$(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=Sw(h)?u+1:f;i.replaceWith(m+r.tableStart,f+r.tableStart,c)}i.setSelection(new cn(i.doc.resolve(u+r.tableStart))),e(i)}return!0}function Tw(t,e){const n=Rs(t.schema);return Y$(({node:r})=>n[r.type.spec.tableRole])(t,e)}function Y$(t){return(e,n)=>{const r=e.selection;let a,i;if(r instanceof cn){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;a=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{var o;if(a=A$(r.$from),!a)return!1;i=(o=Cl(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=Da(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 Z$(t){return function(e,n){if(!ia(e))return!1;if(n){const r=Rs(e.schema),a=Da(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}}lu("row",{useDeprecatedLogic:!0});lu("column",{useDeprecatedLogic:!0});const eF=lu("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 _h(t,e){const n=t.selection;if(!(n instanceof cn))return!1;if(e){const r=t.tr,a=Rs(t.schema).cell.createAndFill().content;n.forEachCell((i,o)=>{i.content.eq(a)||r.replace(r.mapping.map(o+1),r.mapping.map(o+i.nodeSize-1),new ze(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(Ne.empty),n[a]r&&(x=x.type.createChecked(Tl(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(Ne.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=Rs(c);let h,f;if(a>e.width)for(let m=0,x=0;me.height){const m=[];for(let v=0,N=(e.height-1)*e.width;v=e.width?!1:n.nodeAt(e.map[N+v]).type==u.header_cell;m.push(w?f||(f=u.header_cell.createAndFill()):h||(h=u.cell.createAndFill()))}const x=u.row.create(null,Ne.from(m)),y=[];for(let v=e.height;v{if(!a)return!1;const i=n.selection;if(i instanceof cn)return Jh(n,r,lt.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const o=x3(a,t,e);if(o==null)return!1;if(t=="horiz")return Jh(n,r,lt.near(n.doc.resolve(i.head+e),e));{const c=n.doc.resolve(o),u=c3(c,t,e);let h;return u?h=lt.near(u,1):e<0?h=lt.near(n.doc.resolve(c.before(-1)),-1):h=lt.near(n.doc.resolve(c.after(-1)),1),Jh(n,r,h)}}}function $h(t,e){return(n,r,a)=>{if(!a)return!1;const i=n.selection;let o;if(i instanceof cn)o=i;else{const u=x3(a,t,e);if(u==null)return!1;o=new cn(n.doc.resolve(u))}const c=c3(o.$headCell,t,e);return c?Jh(n,r,new cn(o.$anchorCell,c)):!1}}function lF(t,e){const n=t.state.doc,r=Cl(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new cn(r))),!0):!1}function cF(t,e,n){if(!ia(t.state))return!1;let r=sF(n);const a=t.state.selection;if(a instanceof cn){r||(r={width:1,height:1,rows:[Ne.from(a0(Rs(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),Pw(t.state,t.dispatch,o,c,r),!0}else if(r){const i=Mp(t.state),o=i.start(-1);return Pw(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=Rw(t,e.target);let a;if(e.shiftKey&&t.state.selection instanceof cn)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(a=Cl(t.state.selection.$anchor))!=null&&((n=eg(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=eg(t,h);const m=fo.getState(t.state)==null;if(!f||!Ty(u,f))if(m)f=u;else return;const x=new cn(u,f);if(m||!t.state.selection.eq(x)){const y=t.state.tr.setSelection(x);m&&y.setMeta(fo,u.pos),t.dispatch(y)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",c),fo.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(fo,-1))}function c(u){const h=u,f=fo.getState(t.state);let m;if(f!=null)m=t.state.doc.resolve(f);else if(Rw(t,h.target)!=r&&(m=eg(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 x3(t,e,n){if(!(t.state.selection instanceof nt))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 Rw(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function eg(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&&Cl(t.state.doc.resolve(r))||Cl(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")),i0(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,i0(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function i0(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=mr.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=mr.getState(o);if(c&&c.activeHandle>-1)return NF(o,c.activeHandle)},nodeViews:{}}});return i}var fF=class Qh{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(mr);if(r&&r.setHandle!=null)return new Qh(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Qh(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let a=e.mapping.map(n.activeHandle,-1);return r0(e.doc.resolve(a))||(a=-1),new Qh(a,n.dragging)}return n}};function pF(t,e,n,r){if(!t.editable)return;const a=mr.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=Ow(t,e,"left",n):u-e.clientX<=n&&(o=Ow(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}g3(t,o)}}}function mF(t){if(!t.editable)return;const e=mr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&g3(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=mr.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(mr,{setDragging:{startX:e.clientX,startWidth:u}}));function h(m){i.removeEventListener("mouseup",h),i.removeEventListener("mousemove",f);const x=mr.getState(t.state);x!=null&&x.dragging&&(bF(t,x.activeHandle,Lw(x.dragging,m,n)),t.dispatch(t.state.tr.setMeta(mr,{setDragging:null})))}function f(m){if(!m.which)return h(m);const x=mr.getState(t.state);if(x&&x.dragging){const y=Lw(x.dragging,m,n);Dw(t,x.activeHandle,y,r)}}return Dw(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",Gt(this.options.HTMLAttributes,t),0]}}),b3=$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",Gt(this.options.HTMLAttributes,t),0]}}),v3=$n.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Gt(this.options.HTMLAttributes,t),0]}});function o0(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function _w(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 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=sC(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 N=[];v.content&&v.content.forEach(w=>{let k="";w.content&&Array.isArray(w.content)&&w.content.length>1?k=w.content.map(O=>e.renderChildren(O)).join(a):k=w.content?e.renderChildren(w.content):"";const E=MF(k),C=w.type==="tableHeader";N.push({text:E,isHeader:C})}),i.push(N)});const o=i.reduce((v,N)=>Math.max(v,N.length),0);if(o===0)return"";const c=new Array(o).fill(0);i.forEach(v=>{var N;for(let w=0;wc[w]&&(c[w]=E),c[w]<3&&(c[w]=3)}});const u=(v,N)=>v+" ".repeat(Math.max(0,N-v.length)),h=i[0],f=h.some(v=>v.isHeader);let m=` -`;const x=new Array(o).fill(0).map((v,N)=>f&&h[N]&&h[N].text||"");return m+=`| ${x.map((v,N)=>u(v,c[N])).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((N,w)=>u(v[w]&&v[w].text||"",c[w])).join(" | ")} | -`}),m}var IF=AF,N3=$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",Gt(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(nt.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>B$(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>V$(t,e),deleteColumn:()=>({state:t,dispatch:e})=>U$(t,e),addRowBefore:()=>({state:t,dispatch:e})=>K$(t,e),addRowAfter:()=>({state:t,dispatch:e})=>q$(t,e),deleteRow:()=>({state:t,dispatch:e})=>J$(t,e),deleteTable:()=>({state:t,dispatch:e})=>nF(t,e),mergeCells:()=>({state:t,dispatch:e})=>Cw(t,e),splitCell:()=>({state:t,dispatch:e})=>Tw(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>lu("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>lu("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>eF(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Cw(t,e)?!0:Tw(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>X$(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Mw(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Mw(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&f3(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=cn.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Fh,"Mod-Backspace":Fh,Delete:Fh,"Mod-Delete":Fh}},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:qt(Xe(t,"tableRole",e))}}});Pn.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(N3.configure(this.options.table)),this.options.tableCell!==!1&&t.push(y3.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(b3.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(v3.configure(this.options.tableRow)),t}});function PF(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function RF(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}function OF(t){if(!t)return"";let e=t;return e=e.replace(/]*>(.*?)<\/h1>/gi,`# $1 - -`),e=e.replace(/]*>(.*?)<\/h2>/gi,`## $1 - -`),e=e.replace(/]*>(.*?)<\/h3>/gi,`### $1 - -`),e=e.replace(/]*>(.*?)<\/strong>/gi,"**$1**"),e=e.replace(/]*>(.*?)<\/b>/gi,"**$1**"),e=e.replace(/]*>(.*?)<\/em>/gi,"*$1*"),e=e.replace(/]*>(.*?)<\/i>/gi,"*$1*"),e=e.replace(/]*>(.*?)<\/s>/gi,"~~$1~~"),e=e.replace(/]*>(.*?)<\/del>/gi,"~~$1~~"),e=e.replace(/]*>(.*?)<\/code>/gi,"`$1`"),e=e.replace(/]*>(.*?)<\/blockquote>/gi,`> $1 - -`),e=e.replace(/]*src="([^"]*)"[^>]*alt="([^"]*)"[^>]*>/gi,"![$2]($1)"),e=e.replace(/]*src="([^"]*)"[^>]*>/gi,"![]($1)"),e=e.replace(/]*href="([^"]*)"[^>]*>(.*?)<\/a>/gi,"[$2]($1)"),e=e.replace(/]*>(.*?)<\/li>/gi,`- $1 -`),e=e.replace(/<\/?[uo]l[^>]*>/gi,` -`),e=e.replace(//gi,` -`),e=e.replace(/]*>(.*?)<\/p>/gi,`$1 - -`),e=e.replace(//gi,`--- - -`),e=e.replace(/]*data-type="mention"[^>]*data-id="([^"]*)"[^>]*>@([^<]*)<\/span>/gi,"@$2"),e=e.replace(/]*data-type="linkTag"[^>]*data-url="([^"]*)"[^>]*>#([^<]*)<\/span>/gi,"#[$2]($1)"),e=e.replace(/<[^>]+>/g,""),e=e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'"),e=e.replace(/\n{3,}/g,` - -`),e.trim()}function $w(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 端全宽播放)"]]}}),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",Gt(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 Fw(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)=>`
    - @${Fw(o.name)} - ${Fw(o.label||o.id)} -
    `).join(""),e.querySelectorAll(".mention-item").forEach(o=>{o.addEventListener("click",()=>{const c=parseInt(o.getAttribute("data-index")||"0");a&&r[c]&&a({id:r[c].id,label:r[c].name})})}))};return{onStart:o=>{if(e=document.createElement("div"),e.className="mention-popup",document.body.appendChild(e),r=o.items,a=o.command,n=0,i(),o.clientRect){const c=o.clientRect();c&&(e.style.top=`${c.bottom+4}px`,e.style.left=`${c.left}px`)}},onUpdate:o=>{if(r=o.items,a=o.command,n=0,i(),o.clientRect&&e){const c=o.clientRect();c&&(e.style.top=`${c.bottom+4}px`,e.style.left=`${c.left}px`)}},onKeyDown:o=>o.event.key==="ArrowUp"?(n=Math.max(0,n-1),i(),!0):o.event.key==="ArrowDown"?(n=Math.min(r.length-1,n+1),i(),!0):o.event.key==="Enter"?(a&&r[n]&&a({id:r[n].id,label:r[n].name}),!0):o.event.key==="Escape"?(e==null||e.remove(),e=null,!0):!1,onExit:()=>{e==null||e.remove(),e=null}}}});function zF(t){var r;const e=[],n=(r=t.clipboardData)==null?void 0:r.items;if(!n)return e;for(let a=0;a{const h=b.useRef(null),f=b.useRef(null),m=b.useRef(null),x=b.useRef(null),[y,v]=b.useState(""),[N,w]=b.useState(!1),k=b.useRef($w(t)),E=b.useCallback((Q,B)=>{var F;const re=x.current;if(!re||!n)return!1;const ae=zF(B);if(ae.length>0)return B.preventDefault(),(async()=>{for(const D of ae)try{const P=await n(D);P&&re.chain().focus().setImage({src:P}).run()}catch(P){console.error("粘贴图片上传失败",P)}})(),!0;const J=(F=B.clipboardData)==null?void 0:F.getData("text/html");if(J&&/data:image\/[^;"']+;base64,/i.test(J)){B.preventDefault();const{from:D,to:P}=re.state.selection;return(async()=>{try{const oe=await BF(J,n);re.chain().focus().insertContentAt({from:D,to:P},oe).run()}catch(oe){console.error("粘贴 HTML 内 base64 转换失败",oe)}})(),!0}return!1},[n]),C=E7({extensions:[m$.configure({link:{openOnClick:!1,HTMLAttributes:{class:"rich-link"}}}),y$.configure({inline:!0,allowBase64:!0,HTMLAttributes:{class:"rich-editor-img-thumb"}}),LF,k$.configure({HTMLAttributes:{class:"mention-tag"},suggestion:_F(a)}),DF,S$.configure({placeholder:o}),N3.configure({resizable:!0}),v3,y3,b3],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:()=>OF((C==null?void 0:C.getHTML())||"")})),b.useEffect(()=>{if(C&&t!==C.getHTML()){const Q=$w(t);Q!==C.getHTML()&&C.commands.setContent(Q)}},[t]);const R=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 B=(re=Q.target.files)==null?void 0:re[0];if(!(!B||!C)){if(n){const ae=await n(B);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(B)}Q.target.value=""}},[C,n]),q=b.useCallback(async Q=>{var re;const B=(re=Q.target.files)==null?void 0:re[0];if(!(!B||!C)){try{const ae=await R(B);ae&&C.chain().focus().insertContent({type:"videoEmbed",attrs:{src:ae}}).run()}catch(ae){console.error(ae)}Q.target.value=""}},[C,R]),$=b.useCallback(async Q=>{var re;const B=(re=Q.target.files)==null?void 0:re[0];if(!(!B||!C)){try{const ae=await R(B);if(!ae)return;const J=B.name||"附件";C.chain().focus().insertContent(`

    附件 ${PF(J)}

    `).run()}catch(ae){console.error(ae)}Q.target.value=""}},[C,R]),V=b.useCallback(()=>{C&&C.chain().focus().insertContent("@").run()},[C]),I=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]),te=b.useCallback(()=>{!C||!y||(C.chain().focus().setLink({href:y}).run(),v(""),w(!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(r5,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().toggleItalic().run(),className:C.isActive("italic")?"is-active":"",type:"button",children:s.jsx(sM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().toggleStrike().run(),className:C.isActive("strike")?"is-active":"",type:"button",children:s.jsx(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(j5,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>C.chain().focus().toggleHeading({level:1}).run(),className:C.isActive("heading",{level:1})?"is-active":"",type:"button",children:s.jsx(q5,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().toggleHeading({level:2}).run(),className:C.isActive("heading",{level:2})?"is-active":"",type:"button",children:s.jsx(J5,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().toggleHeading({level:3}).run(),className:C.isActive("heading",{level:3})?"is-active":"",type:"button",children:s.jsx(Y5,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("button",{onClick:()=>C.chain().focus().toggleBulletList().run(),className:C.isActive("bulletList")?"is-active":"",type:"button",children:s.jsx(pM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().toggleOrderedList().run(),className:C.isActive("orderedList")?"is-active":"",type:"button",children:s.jsx(hM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().toggleBlockquote().run(),className:C.isActive("blockquote")?"is-active":"",type:"button",children:s.jsx(BM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>C.chain().focus().setHorizontalRule().run(),type:"button",children:s.jsx(SM,{className:"w-4 h-4"})})]}),s.jsx("div",{className:"toolbar-divider"}),s.jsxs("div",{className:"toolbar-group",children:[s.jsx("input",{ref:h,type:"file",accept:"image/*",onChange:O,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 Q;return(Q=h.current)==null?void 0:Q.click()},type:"button",title:"上传图片",children:s.jsx(Oj,{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(jA,{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(AM,{className:"w-4 h-4"})}),s.jsx("button",{onClick:V,type:"button",title:"插入 @ 并选择人物",className:a.length?"mention-trigger-btn":"",disabled:a.length===0,children:s.jsx(t5,{className:"w-4 h-4"})}),s.jsx("button",{onClick:()=>w(!N),className:C.isActive("link")?"is-active":"",type:"button",title:"链接",children:s.jsx(xg,{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:Q=>{const B=i.find(re=>re.id===Q.target.value);B&&I(B),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))]})})]})]}),N&&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"&&te(),className:"link-input"}),s.jsx("button",{onClick:te,className:"link-confirm",type:"button",children:"确定"}),s.jsx("button",{onClick:()=>{C.chain().focus().unsetLink().run(),w(!1)},className:"link-remove",type:"button",children:"移除"})]}),s.jsx(PC,{editor:C})]}):null});l0.displayName="RichEditor";const VF=["top","right","bottom","left"],Ao=Math.min,fr=Math.max,Zf=Math.round,Bh=Math.floor,Ia=t=>({x:t,y:t}),HF={left:"right",right:"left",bottom:"top",top:"bottom"},UF={start:"end",end:"start"};function c0(t,e,n){return fr(t,Ao(e,n))}function ki(t,e){return typeof t=="function"?t(e):t}function Si(t){return t.split("-")[0]}function Kc(t){return t.split("-")[1]}function Ey(t){return t==="x"?"y":"x"}function My(t){return t==="y"?"height":"width"}const WF=new Set(["top","bottom"]);function Ma(t){return WF.has(Si(t))?"y":"x"}function Ay(t){return Ey(Ma(t))}function KF(t,e,n){n===void 0&&(n=!1);const r=Kc(t),a=Ay(t),i=My(a);let o=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=ep(o)),[o,ep(o)]}function qF(t){const e=ep(t);return[d0(t),e,d0(e)]}function d0(t){return t.replace(/start|end/g,e=>UF[e])}const Bw=["left","right"],Vw=["right","left"],GF=["top","bottom"],JF=["bottom","top"];function QF(t,e,n){switch(t){case"top":case"bottom":return n?e?Vw:Bw:e?Bw:Vw;case"left":case"right":return e?GF:JF;default:return[]}}function YF(t,e,n,r){const a=Kc(t);let i=QF(Si(t),n==="start",r);return a&&(i=i.map(o=>o+"-"+a),e&&(i=i.concat(i.map(d0)))),i}function ep(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 w3(t){return typeof t!="number"?XF(t):{top:t,right:t,bottom:t,left:t}}function tp(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 Hw(t,e,n){let{reference:r,floating:a}=t;const i=Ma(e),o=Ay(e),c=My(o),u=Si(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(Kc(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 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:y=0}=ki(e,t),v=w3(y),w=c[x?m==="floating"?"reference":"floating":m],k=tp(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(w)))==null||n?w:w.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},O=tp(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:E,offsetParent:C,strategy:u}):E);return{top:(k.top-O.top+v.top)/R.y,bottom:(O.bottom-k.bottom+v.bottom)/R.y,left:(k.left-O.left+v.left)/R.x,right:(O.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}=Hw(h,r,u),x=r,y={},v=0;for(let w=0;w({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}=ki(t,e)||{};if(h==null)return{};const m=w3(f),x={x:n,y:r},y=Ay(a),v=My(y),N=await o.getDimensions(h),w=y==="y",k=w?"top":"left",E=w?"bottom":"right",C=w?"clientHeight":"clientWidth",R=i.reference[v]+i.reference[y]-x[y]-i.floating[v],O=x[y]-i.reference[y],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 V=R/2-O/2,I=$/2-N[v]/2-1,te=Ao(m[k],I),Q=Ao(m[E],I),B=te,re=$-N[v]-Q,ae=$/2-N[v]/2+V,J=c0(B,ae,re),F=!u.arrow&&Kc(a)!=null&&ae!==J&&i.reference[v]/2-(aeae<=0)){var Q,B;const ae=(((Q=i.flip)==null?void 0:Q.index)||0)+1,J=$[ae];if(J&&(!(m==="alignment"?E!==Ma(J):!1)||te.every(P=>Ma(P.placement)===E?P.overflows[0]>0:!0)))return{data:{index:ae,overflows:te},reset:{placement:J}};let F=(B=te.filter(D=>D.overflows[0]<=0).sort((D,P)=>D.overflows[1]-P.overflows[1])[0])==null?void 0:B.placement;if(!F)switch(y){case"bestFit":{var re;const D=(re=te.filter(P=>{if(q){const oe=Ma(P.placement);return oe===E||oe==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(oe=>oe>0).reduce((oe,G)=>oe+G,0)]).sort((P,oe)=>P[1]-oe[1])[0])==null?void 0:re[0];D&&(F=D);break}case"initialPlacement":F=c;break}if(a!==F)return{reset:{placement:F}}}return{}}}};function Uw(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Ww(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}=ki(t,e);switch(a){case"referenceHidden":{const o=await r.detectOverflow(e,{...i,elementContext:"reference"}),c=Uw(o,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Ww(c)}}}case"escaped":{const o=await r.detectOverflow(e,{...i,altBoundary:!0}),c=Uw(o,n.floating);return{data:{escapedOffsets:c,escaped:Ww(c)}}}default:return{}}}}},j3=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=Si(n),c=Kc(n),u=Ma(n)==="y",h=j3.has(o)?-1:1,f=i&&u?-1:1,m=ki(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 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}=ki(t,e),f={x:n,y:r},m=await i.detectOverflow(e,h),x=Ma(Si(a)),y=Ey(x);let v=f[y],N=f[x];if(o){const k=y==="y"?"top":"left",E=y==="y"?"bottom":"right",C=v+m[k],R=v-m[E];v=c0(C,v,R)}if(c){const k=x==="y"?"top":"left",E=x==="y"?"bottom":"right",C=N+m[k],R=N-m[E];N=c0(C,N,R)}const w=u.fn({...e,[y]:v,[x]:N});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[y]: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}=ki(t,e),f={x:n,y:r},m=Ma(a),x=Ey(m);let y=f[x],v=f[m];const N=ki(c,e),w=typeof N=="number"?{mainAxis:N,crossAxis:0}:{mainAxis:0,crossAxis:0,...N};if(u){const C=x==="y"?"height":"width",R=i.reference[x]-i.floating[C]+w.mainAxis,O=i.reference[x]+i.reference[C]-w.mainAxis;yO&&(y=O)}if(h){var k,E;const C=x==="y"?"width":"height",R=j3.has(Si(a)),O=i.reference[m]-i.floating[C]+(R&&((k=o.offset)==null?void 0:k[m])||0)+(R?0:w.crossAxis),q=i.reference[m]+i.reference[C]+(R?0:((E=o.offset)==null?void 0:E[m])||0)-(R?w.crossAxis:0);vq&&(v=q)}return{[x]:y,[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}=ki(t,e),f=await o.detectOverflow(e,h),m=Si(a),x=Kc(a),y=Ma(a)==="y",{width:v,height:N}=i.floating;let w,k;m==="top"||m==="bottom"?(w=m,k=x===(await(o.isRTL==null?void 0:o.isRTL(c.floating))?"start":"end")?"left":"right"):(k=m,w=x==="end"?"top":"bottom");const E=N-f.top-f.bottom,C=v-f.left-f.right,R=Ao(N-f[w],E),O=Ao(v-f[k],C),q=!e.middlewareData.shift;let $=R,V=O;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(V=C),(r=e.middlewareData.shift)!=null&&r.enabled.y&&($=E),q&&!x){const te=fr(f.left,0),Q=fr(f.right,0),B=fr(f.top,0),re=fr(f.bottom,0);y?V=v-2*(te!==0||Q!==0?te+Q:fr(f.left,f.right)):$=N-2*(B!==0||re!==0?B+re:fr(f.top,f.bottom))}await u({...e,availableWidth:V,availableHeight:$});const I=await o.getDimensions(c.floating);return v!==I.width||N!==I.height?{reset:{rects:!0}}:{}}}};function Ap(){return typeof window<"u"}function qc(t){return k3(t)?(t.nodeName||"").toLowerCase():"#document"}function gr(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function _a(t){var e;return(e=(k3(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function k3(t){return Ap()?t instanceof Node||t instanceof gr(t).Node:!1}function sa(t){return Ap()?t instanceof Element||t instanceof gr(t).Element:!1}function Oa(t){return Ap()?t instanceof HTMLElement||t instanceof gr(t).HTMLElement:!1}function Kw(t){return!Ap()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof gr(t).ShadowRoot}const cB=new Set(["inline","contents"]);function bu(t){const{overflow:e,overflowX:n,overflowY:r,display:a}=ra(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(qc(t))}const hB=[":popover-open",":modal"];function Ip(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 Iy(t){const e=Py(),n=sa(t)?ra(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=Io(t);for(;Oa(e)&&!$c(e);){if(Iy(e))return e;if(Ip(e))return null;e=Io(e)}return null}function Py(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const gB=new Set(["html","body","#document"]);function $c(t){return gB.has(qc(t))}function ra(t){return gr(t).getComputedStyle(t)}function Pp(t){return sa(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Io(t){if(qc(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Kw(t)&&t.host||_a(t);return Kw(e)?e.host:e}function S3(t){const e=Io(t);return $c(e)?t.ownerDocument?t.ownerDocument.body:t.body:Oa(e)&&bu(e)?e:S3(e)}function cu(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const a=S3(t),i=a===((r=t.ownerDocument)==null?void 0:r.body),o=gr(a);if(i){const c=u0(o);return e.concat(o,o.visualViewport||[],bu(a)?a:[],c&&n?cu(c):[])}return e.concat(a,cu(a,[],n))}function u0(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function C3(t){const e=ra(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const a=Oa(t),i=a?t.offsetWidth:n,o=a?t.offsetHeight:r,c=Zf(n)!==i||Zf(r)!==o;return c&&(n=i,r=o),{width:n,height:r,$:c}}function Ry(t){return sa(t)?t:t.contextElement}function Cc(t){const e=Ry(t);if(!Oa(e))return Ia(1);const n=e.getBoundingClientRect(),{width:r,height:a,$:i}=C3(e);let o=(i?Zf(n.width):n.width)/r,c=(i?Zf(n.height):n.height)/a;return(!o||!Number.isFinite(o))&&(o=1),(!c||!Number.isFinite(c))&&(c=1),{x:o,y:c}}const yB=Ia(0);function T3(t){const e=gr(t);return!Py()||!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!==gr(t)?!1:e}function El(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const a=t.getBoundingClientRect(),i=Ry(t);let o=Ia(1);e&&(r?sa(r)&&(o=Cc(r)):o=Cc(t));const c=bB(i,n,r)?T3(i):Ia(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=gr(i),y=r&&sa(r)?gr(r):r;let v=x,N=u0(v);for(;N&&r&&y!==v;){const w=Cc(N),k=N.getBoundingClientRect(),E=ra(N),C=k.left+(N.clientLeft+parseFloat(E.paddingLeft))*w.x,R=k.top+(N.clientTop+parseFloat(E.paddingTop))*w.y;u*=w.x,h*=w.y,f*=w.x,m*=w.y,u+=C,h+=R,v=gr(N),N=u0(v)}}return tp({width:f,height:m,x:u,y:h})}function Rp(t,e){const n=Pp(t).scrollLeft;return e?e.left+n:El(_a(t)).left+n}function E3(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-Rp(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=_a(r),c=e?Ip(e.floating):!1;if(r===o||c&&i)return n;let u={scrollLeft:0,scrollTop:0},h=Ia(1);const f=Ia(0),m=Oa(r);if((m||!m&&!i)&&((qc(r)!=="body"||bu(o))&&(u=Pp(r)),Oa(r))){const y=El(r);h=Cc(r),f.x=y.x+r.clientLeft,f.y=y.y+r.clientTop}const x=o&&!m&&!i?E3(o,u):Ia(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=_a(t),n=Pp(t),r=t.ownerDocument.body,a=fr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=fr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Rp(t);const c=-n.scrollTop;return ra(r).direction==="rtl"&&(o+=fr(e.clientWidth,r.clientWidth)-a),{width:a,height:i,x:o,y:c}}const qw=25;function jB(t,e){const n=gr(t),r=_a(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=Py();(!f||f&&e==="fixed")&&(c=a.offsetLeft,u=a.offsetTop)}const h=Rp(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<=qw&&(i-=v)}else h<=qw&&(i+=h);return{width:i,height:o,x:c,y:u}}const kB=new Set(["absolute","fixed"]);function SB(t,e){const n=El(t,!0,e==="fixed"),r=n.top+t.clientTop,a=n.left+t.clientLeft,i=Oa(t)?Cc(t):Ia(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 Gw(t,e,n){let r;if(e==="viewport")r=jB(t,n);else if(e==="document")r=wB(_a(t));else if(sa(e))r=SB(e,n);else{const a=T3(t);r={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return tp(r)}function M3(t,e){const n=Io(t);return n===e||!sa(n)||$c(n)?!1:ra(n).position==="fixed"||M3(n,e)}function CB(t,e){const n=e.get(t);if(n)return n;let r=cu(t,[],!1).filter(c=>sa(c)&&qc(c)!=="body"),a=null;const i=ra(t).position==="fixed";let o=i?Io(t):t;for(;sa(o)&&!$c(o);){const c=ra(o),u=Iy(o);!u&&c.position==="fixed"&&(a=null),(i?!u&&!a:!u&&c.position==="static"&&!!a&&kB.has(a.position)||bu(o)&&!u&&M3(t,o))?r=r.filter(f=>f!==o):a=c,o=Io(o)}return e.set(t,r),r}function TB(t){let{element:e,boundary:n,rootBoundary:r,strategy:a}=t;const o=[...n==="clippingAncestors"?Ip(e)?[]:CB(e,this._c):[].concat(n),r],c=o[0],u=o.reduce((h,f)=>{const m=Gw(e,f,a);return h.top=fr(m.top,h.top),h.right=Ao(m.right,h.right),h.bottom=Ao(m.bottom,h.bottom),h.left=fr(m.left,h.left),h},Gw(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}=C3(t);return{width:e,height:n}}function MB(t,e,n){const r=Oa(e),a=_a(e),i=n==="fixed",o=El(t,!0,i,e);let c={scrollLeft:0,scrollTop:0};const u=Ia(0);function h(){u.x=Rp(a)}if(r||!r&&!i)if((qc(e)!=="body"||bu(a))&&(c=Pp(e)),r){const y=El(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?E3(a,c):Ia(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 tg(t){return ra(t).position==="static"}function Jw(t,e){if(!Oa(t)||ra(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return _a(t)===n&&(n=n.ownerDocument.body),n}function A3(t,e){const n=gr(t);if(Ip(t))return n;if(!Oa(t)){let a=Io(t);for(;a&&!$c(a);){if(sa(a)&&!tg(a))return a;a=Io(a)}return n}let r=Jw(t,e);for(;r&&uB(r)&&tg(r);)r=Jw(r,e);return r&&$c(r)&&tg(r)&&!Iy(r)?n:r||xB(t)||n}const AB=async function(t){const e=this.getOffsetParent||A3,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 ra(t).direction==="rtl"}const PB={convertOffsetParentRelativeRectToViewportRelativeRect:vB,getDocumentElement:_a,getClippingRect:TB,getOffsetParent:A3,getElementRects:AB,getClientRects:NB,getDimensions:EB,getScale:Cc,isElement:sa,isRTL:IB};function I3(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=_a(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=Bh(m),N=Bh(a.clientWidth-(f+x)),w=Bh(a.clientHeight-(m+y)),k=Bh(f),C={rootMargin:-v+"px "+-N+"px "+-w+"px "+-k+"px",threshold:fr(0,Ao(1,u))||1};let R=!0;function O(q){const $=q[0].intersectionRatio;if($!==u){if(!R)return o();$?o(!1,$):r=setTimeout(()=>{o(!1,1e-7)},1e3)}$===1&&!I3(h,t.getBoundingClientRect())&&o(),R=!1}try{n=new IntersectionObserver(O,{...C,root:a.ownerDocument})}catch{n=new IntersectionObserver(O,C)}n.observe(t)}return o(!0),i}function OB(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,h=Ry(t),f=a||i?[...h?cu(h):[],...cu(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,N=u?El(t):null;u&&w();function w(){const k=El(t);N&&!I3(N,k)&&n(),N=k,v=requestAnimationFrame(w)}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=aB,DB=iB,_B=nB,zB=lB,$B=sB,Qw=tB,FB=oB,BB=(t,e,n)=>{const r=new Map,a={platform:PB,...n},i={...a.platform,_c:r};return eB(t,e,{...a,platform:i})};var VB=typeof document<"u",HB=function(){},Yh=VB?b.useLayoutEffect:HB;function np(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,a;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!np(t[r],e[r]))return!1;return!0}if(a=Object.keys(t),n=a.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,a[r]))return!1;for(r=n;r--!==0;){const i=a[r];if(!(i==="_owner"&&t.$$typeof)&&!np(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function P3(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Yw(t,e){const n=P3(t);return Math.round(e*n)/n}function ng(t){const e=b.useRef(t);return Yh(()=>{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]=b.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[x,y]=b.useState(r);np(x,r)||y(r);const[v,N]=b.useState(null),[w,k]=b.useState(null),E=b.useCallback(P=>{P!==q.current&&(q.current=P,N(P))},[]),C=b.useCallback(P=>{P!==$.current&&($.current=P,k(P))},[]),R=i||v,O=o||w,q=b.useRef(null),$=b.useRef(null),V=b.useRef(f),I=u!=null,te=ng(u),Q=ng(a),B=ng(h),re=b.useCallback(()=>{if(!q.current||!$.current)return;const P={placement:e,strategy:n,middleware:x};Q.current&&(P.platform=Q.current),BB(q.current,$.current,P).then(oe=>{const G={...oe,isPositioned:B.current!==!1};ae.current&&!np(V.current,G)&&(V.current=G,uu.flushSync(()=>{m(G)}))})},[x,e,n,Q,B]);Yh(()=>{h===!1&&V.current.isPositioned&&(V.current.isPositioned=!1,m(P=>({...P,isPositioned:!1})))},[h]);const ae=b.useRef(!1);Yh(()=>(ae.current=!0,()=>{ae.current=!1}),[]),Yh(()=>{if(R&&(q.current=R),O&&($.current=O),R&&O){if(te.current)return te.current(R,O,re);re()}},[R,O,re,te,I]);const J=b.useMemo(()=>({reference:q,floating:$,setReference:E,setFloating:C}),[E,C]),F=b.useMemo(()=>({reference:R,floating:O}),[R,O]),D=b.useMemo(()=>{const P={position:n,left:0,top:0};if(!F.floating)return P;const oe=Yw(F.floating,f.x),G=Yw(F.floating,f.y);return c?{...P,transform:"translate("+oe+"px, "+G+"px)",...P3(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:oe,top:G}},[n,c,F.floating,f.x,f.y]);return b.useMemo(()=>({...f,update:re,refs:J,elements:F,floatingStyles:D}),[f,re,J,F,D])}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?Qw({element:r.current,padding:a}).fn(n):{}:r?Qw({element:r,padding:a}).fn(n):{}}}},KB=(t,e)=>({...LB(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)=>({...zB(t),options:[t,e]}),YB=(t,e)=>({...$B(t),options:[t,e]}),XB=(t,e)=>({...WB(t),options:[t,e]});var ZB="Arrow",R3=b.forwardRef((t,e)=>{const{children:n,width:r=10,height:a=5,...i}=t;return s.jsx(wt.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"})})});R3.displayName=ZB;var e9=R3,Oy="Popper",[O3,L3]=Oo(Oy),[t9,D3]=O3(Oy),_3=t=>{const{__scopePopper:e,children:n}=t,[r,a]=b.useState(null);return s.jsx(t9,{scope:e,anchor:r,onAnchorChange:a,children:n})};_3.displayName=Oy;var z3="PopperAnchor",$3=b.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...a}=t,i=D3(z3,n),o=b.useRef(null),c=Jt(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(wt.div,{...a,ref:c})});$3.displayName=z3;var Ly="PopperContent",[n9,s9]=O3(Ly),F3=b.forwardRef((t,e)=>{var le,de,ve,ye,Se,Fe;const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:i="center",alignOffset:o=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:h=[],collisionPadding:f=0,sticky:m="partial",hideWhenDetached:x=!1,updatePositionStrategy:y="optimized",onPlaced:v,...N}=t,w=D3(Ly,n),[k,E]=b.useState(null),C=Jt(e,mt=>E(mt)),[R,O]=b.useState(null),q=D0(R),$=(q==null?void 0:q.width)??0,V=(q==null?void 0:q.height)??0,I=r+(i!=="center"?"-"+i:""),te=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},Q=Array.isArray(h)?h:[h],B=Q.length>0,re={padding:te,boundary:Q.filter(a9),altBoundary:B},{refs:ae,floatingStyles:J,placement:F,isPositioned:D,middlewareData:P}=UB({strategy:"fixed",placement:I,whileElementsMounted:(...mt)=>OB(...mt,{animationFrame:y==="always"}),elements:{reference:w.anchor},middleware:[KB({mainAxis:a+V,alignmentAxis:o}),u&&qB({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?GB():void 0,...re}),u&&JB({...re}),QB({...re,apply:({elements:mt,rects:kt,availableWidth:ft,availableHeight:Dt})=>{const{width:Pt,height:Rn}=kt.reference,yn=mt.floating.style;yn.setProperty("--radix-popper-available-width",`${ft}px`),yn.setProperty("--radix-popper-available-height",`${Dt}px`),yn.setProperty("--radix-popper-anchor-width",`${Pt}px`),yn.setProperty("--radix-popper-anchor-height",`${Rn}px`)}}),R&&XB({element:R,padding:c}),i9({arrowWidth:$,arrowHeight:V}),x&&YB({strategy:"referenceHidden",...re})]}),[oe,G]=H3(F),_=Co(v);Is(()=>{D&&(_==null||_())},[D,_]);const U=(le=P.arrow)==null?void 0:le.x,H=(de=P.arrow)==null?void 0:de.y,K=((ve=P.arrow)==null?void 0:ve.centerOffset)!==0,[me,X]=b.useState();return Is(()=>{k&&X(window.getComputedStyle(k).zIndex)},[k]),s.jsx("div",{ref:ae.setFloating,"data-radix-popper-content-wrapper":"",style:{...J,transform:D?J.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:me,"--radix-popper-transform-origin":[(ye=P.transformOrigin)==null?void 0:ye.x,(Se=P.transformOrigin)==null?void 0:Se.y].join(" "),...((Fe=P.hide)==null?void 0:Fe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:s.jsx(n9,{scope:n,placedSide:oe,onArrowChange:O,arrowX:U,arrowY:H,shouldHideArrow:K,children:s.jsx(wt.div,{"data-side":oe,"data-align":G,...N,ref:C,style:{...N.style,animation:D?void 0:"none"}})})})});F3.displayName=Ly;var B3="PopperArrow",r9={top:"bottom",right:"left",bottom:"top",left:"right"},V3=b.forwardRef(function(e,n){const{__scopePopper:r,...a}=e,i=s9(B3,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"}})})});V3.displayName=B3;function a9(t){return t!==null}var i9=t=>({name:"transformOrigin",options:t,fn(e){var w,k,E;const{placement:n,rects:r,middlewareData:a}=e,o=((w=a.arrow)==null?void 0:w.centerOffset)!==0,c=o?0:t.arrowWidth,u=o?0:t.arrowHeight,[h,f]=H3(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="",N="";return h==="bottom"?(v=o?m:`${x}px`,N=`${-u}px`):h==="top"?(v=o?m:`${x}px`,N=`${r.floating.height+u}px`):h==="right"?(v=`${-u}px`,N=o?m:`${y}px`):h==="left"&&(v=`${r.floating.width+u}px`,N=o?m:`${y}px`),{data:{x:v,y:N}}}});function H3(t){const[e,n="center"]=t.split("-");return[e,n]}var o9=_3,l9=$3,c9=F3,d9=V3,U3=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=b.forwardRef((t,e)=>s.jsx(wt.span,{...t,ref:e,style:{...U3,...t.style}}));h9.displayName=u9;var f9=[" ","Enter","ArrowUp","ArrowDown"],p9=[" ","Enter"],Ml="Select",[Op,Lp,m9]=R0(Ml),[Gc]=Oo(Ml,[m9,L3]),Dp=L3(),[x9,zo]=Gc(Ml),[g9,y9]=Gc(Ml),W3=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,N=Dp(e),[w,k]=b.useState(null),[E,C]=b.useState(null),[R,O]=b.useState(!1),q=dp(h),[$,V]=yl({prop:r,defaultProp:a??!1,onChange:i,caller:Ml}),[I,te]=yl({prop:o,defaultProp:c,onChange:u,caller:Ml}),Q=b.useRef(null),B=w?v||!!w.closest("form"):!0,[re,ae]=b.useState(new Set),J=Array.from(re).map(F=>F.props.value).join(";");return s.jsx(o9,{...N,children:s.jsxs(x9,{required:y,scope:e,trigger:w,onTriggerChange:k,valueNode:E,onValueNodeChange:C,valueNodeHasChildren:R,onValueNodeHasChildrenChange:O,contentId:vo(),value:I,onValueChange:te,open:$,onOpenChange:V,dir:q,triggerPointerDownPosRef:Q,disabled:x,children:[s.jsx(Op.Provider,{scope:e,children:s.jsx(g9,{scope:t.__scopeSelect,onNativeOptionAdd:b.useCallback(F=>{ae(D=>new Set(D).add(F))},[]),onNativeOptionRemove:b.useCallback(F=>{ae(D=>{const P=new Set(D);return P.delete(F),P})},[]),children:n})}),B?s.jsxs(f4,{"aria-hidden":!0,required:y,tabIndex:-1,name:f,autoComplete:m,value:I,onChange:F=>te(F.target.value),disabled:x,form:v,children:[I===void 0?s.jsx("option",{value:""}):null,Array.from(re)]},J):null]})})};W3.displayName=Ml;var K3="SelectTrigger",q3=b.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...a}=t,i=Dp(n),o=zo(K3,n),c=o.disabled||r,u=Jt(e,o.onTriggerChange),h=Lp(n),f=b.useRef("touch"),[m,x,y]=m4(N=>{const w=h().filter(C=>!C.disabled),k=w.find(C=>C.value===o.value),E=x4(w,N,k);E!==void 0&&o.onValueChange(E.value)}),v=N=>{c||(o.onOpenChange(!0),y()),N&&(o.triggerPointerDownPosRef.current={x:Math.round(N.pageX),y:Math.round(N.pageY)})};return s.jsx(l9,{asChild:!0,...i,children:s.jsx(wt.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":p4(o.value)?"":void 0,...a,ref:u,onClick:yt(a.onClick,N=>{N.currentTarget.focus(),f.current!=="mouse"&&v(N)}),onPointerDown:yt(a.onPointerDown,N=>{f.current=N.pointerType;const w=N.target;w.hasPointerCapture(N.pointerId)&&w.releasePointerCapture(N.pointerId),N.button===0&&N.ctrlKey===!1&&N.pointerType==="mouse"&&(v(N),N.preventDefault())}),onKeyDown:yt(a.onKeyDown,N=>{const w=m.current!=="";!(N.ctrlKey||N.altKey||N.metaKey)&&N.key.length===1&&x(N.key),!(w&&N.key===" ")&&f9.includes(N.key)&&(v(),N.preventDefault())})})})});q3.displayName=K3;var G3="SelectValue",J3=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,children:i,placeholder:o="",...c}=t,u=zo(G3,n),{onValueNodeHasChildrenChange:h}=u,f=i!==void 0,m=Jt(e,u.onValueNodeChange);return Is(()=>{h(f)},[h,f]),s.jsx(wt.span,{...c,ref:m,style:{pointerEvents:"none"},children:p4(u.value)?s.jsx(s.Fragment,{children:o}):i})});J3.displayName=G3;var b9="SelectIcon",Q3=b.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...a}=t;return s.jsx(wt.span,{"aria-hidden":!0,...a,ref:e,children:r||"▼"})});Q3.displayName=b9;var v9="SelectPortal",Y3=t=>s.jsx(E0,{asChild:!0,...t});Y3.displayName=v9;var Al="SelectContent",X3=b.forwardRef((t,e)=>{const n=zo(Al,t.__scopeSelect),[r,a]=b.useState();if(Is(()=>{a(new DocumentFragment)},[]),!n.open){const i=r;return i?uu.createPortal(s.jsx(Z3,{scope:t.__scopeSelect,children:s.jsx(Op.Slot,{scope:t.__scopeSelect,children:s.jsx("div",{children:t.children})})}),i):null}return s.jsx(e4,{...t,ref:e})});X3.displayName=Al;var Zr=10,[Z3,$o]=Gc(Al),N9="SelectContentImpl",w9=Qd("SelectContent.RemoveScroll"),e4=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:N,avoidCollisions:w,...k}=t,E=zo(Al,n),[C,R]=b.useState(null),[O,q]=b.useState(null),$=Jt(e,le=>R(le)),[V,I]=b.useState(null),[te,Q]=b.useState(null),B=Lp(n),[re,ae]=b.useState(!1),J=b.useRef(!1);b.useEffect(()=>{if(C)return fk(C)},[C]),rk();const F=b.useCallback(le=>{const[de,...ve]=B().map(Fe=>Fe.ref.current),[ye]=ve.slice(-1),Se=document.activeElement;for(const Fe of le)if(Fe===Se||(Fe==null||Fe.scrollIntoView({block:"nearest"}),Fe===de&&O&&(O.scrollTop=0),Fe===ye&&O&&(O.scrollTop=O.scrollHeight),Fe==null||Fe.focus(),document.activeElement!==Se))return},[B,O]),D=b.useCallback(()=>F([V,C]),[F,V,C]);b.useEffect(()=>{re&&D()},[re,D]);const{onOpenChange:P,triggerPointerDownPosRef:oe}=E;b.useEffect(()=>{if(C){let le={x:0,y:0};const de=ye=>{var Se,Fe;le={x:Math.abs(Math.round(ye.pageX)-(((Se=oe.current)==null?void 0:Se.x)??0)),y:Math.abs(Math.round(ye.pageY)-(((Fe=oe.current)==null?void 0:Fe.y)??0))}},ve=ye=>{le.x<=10&&le.y<=10?ye.preventDefault():C.contains(ye.target)||P(!1),document.removeEventListener("pointermove",de),oe.current=null};return oe.current!==null&&(document.addEventListener("pointermove",de),document.addEventListener("pointerup",ve,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",de),document.removeEventListener("pointerup",ve,{capture:!0})}}},[C,P,oe]),b.useEffect(()=>{const le=()=>P(!1);return window.addEventListener("blur",le),window.addEventListener("resize",le),()=>{window.removeEventListener("blur",le),window.removeEventListener("resize",le)}},[P]);const[G,_]=m4(le=>{const de=B().filter(Se=>!Se.disabled),ve=de.find(Se=>Se.ref.current===document.activeElement),ye=x4(de,le,ve);ye&&setTimeout(()=>ye.ref.current.focus())}),U=b.useCallback((le,de,ve)=>{const ye=!J.current&&!ve;(E.value!==void 0&&E.value===de||ye)&&(I(le),ye&&(J.current=!0))},[E.value]),H=b.useCallback(()=>C==null?void 0:C.focus(),[C]),K=b.useCallback((le,de,ve)=>{const ye=!J.current&&!ve;(E.value!==void 0&&E.value===de||ye)&&Q(le)},[E.value]),me=r==="popper"?h0:t4,X=me===h0?{side:c,sideOffset:u,align:h,alignOffset:f,arrowPadding:m,collisionBoundary:x,collisionPadding:y,sticky:v,hideWhenDetached:N,avoidCollisions:w}:{};return s.jsx(Z3,{scope:n,content:C,viewport:O,onViewportChange:q,itemRefCallback:U,selectedItem:V,onItemLeave:H,itemTextRefCallback:K,focusSelectedItem:D,selectedItemText:te,position:r,isPositioned:re,searchRef:G,children:s.jsx(M0,{as:w9,allowPinchZoom:!0,children:s.jsx(T0,{asChild:!0,trapped:E.open,onMountAutoFocus:le=>{le.preventDefault()},onUnmountAutoFocus:yt(a,le=>{var de;(de=E.trigger)==null||de.focus({preventScroll:!0}),le.preventDefault()}),children:s.jsx(C0,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:le=>le.preventDefault(),onDismiss:()=>E.onOpenChange(!1),children:s.jsx(me,{role:"listbox",id:E.contentId,"data-state":E.open?"open":"closed",dir:E.dir,onContextMenu:le=>le.preventDefault(),...k,...X,onPlaced:()=>ae(!0),ref:$,style:{display:"flex",flexDirection:"column",outline:"none",...k.style},onKeyDown:yt(k.onKeyDown,le=>{const de=le.ctrlKey||le.altKey||le.metaKey;if(le.key==="Tab"&&le.preventDefault(),!de&&le.key.length===1&&_(le.key),["ArrowUp","ArrowDown","Home","End"].includes(le.key)){let ye=B().filter(Se=>!Se.disabled).map(Se=>Se.ref.current);if(["ArrowUp","End"].includes(le.key)&&(ye=ye.slice().reverse()),["ArrowUp","ArrowDown"].includes(le.key)){const Se=le.target,Fe=ye.indexOf(Se);ye=ye.slice(Fe+1)}setTimeout(()=>F(ye)),le.preventDefault()}})})})})})})});e4.displayName=N9;var j9="SelectItemAlignedPosition",t4=b.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...a}=t,i=zo(Al,n),o=$o(Al,n),[c,u]=b.useState(null),[h,f]=b.useState(null),m=Jt(e,$=>f($)),x=Lp(n),y=b.useRef(!1),v=b.useRef(!0),{viewport:N,selectedItem:w,selectedItemText:k,focusSelectedItem:E}=o,C=b.useCallback(()=>{if(i.trigger&&i.valueNode&&c&&h&&N&&w&&k){const $=i.trigger.getBoundingClientRect(),V=h.getBoundingClientRect(),I=i.valueNode.getBoundingClientRect(),te=k.getBoundingClientRect();if(i.dir!=="rtl"){const Se=te.left-V.left,Fe=I.left-Se,mt=$.left-Fe,kt=$.width+mt,ft=Math.max(kt,V.width),Dt=window.innerWidth-Zr,Pt=cf(Fe,[Zr,Math.max(Zr,Dt-ft)]);c.style.minWidth=kt+"px",c.style.left=Pt+"px"}else{const Se=V.right-te.right,Fe=window.innerWidth-I.right-Se,mt=window.innerWidth-$.right-Fe,kt=$.width+mt,ft=Math.max(kt,V.width),Dt=window.innerWidth-Zr,Pt=cf(Fe,[Zr,Math.max(Zr,Dt-ft)]);c.style.minWidth=kt+"px",c.style.right=Pt+"px"}const Q=x(),B=window.innerHeight-Zr*2,re=N.scrollHeight,ae=window.getComputedStyle(h),J=parseInt(ae.borderTopWidth,10),F=parseInt(ae.paddingTop,10),D=parseInt(ae.borderBottomWidth,10),P=parseInt(ae.paddingBottom,10),oe=J+F+re+P+D,G=Math.min(w.offsetHeight*5,oe),_=window.getComputedStyle(N),U=parseInt(_.paddingTop,10),H=parseInt(_.paddingBottom,10),K=$.top+$.height/2-Zr,me=B-K,X=w.offsetHeight/2,le=w.offsetTop+X,de=J+F+le,ve=oe-de;if(de<=K){const Se=Q.length>0&&w===Q[Q.length-1].ref.current;c.style.bottom="0px";const Fe=h.clientHeight-N.offsetTop-N.offsetHeight,mt=Math.max(me,X+(Se?H:0)+Fe+D),kt=de+mt;c.style.height=kt+"px"}else{const Se=Q.length>0&&w===Q[0].ref.current;c.style.top="0px";const mt=Math.max(K,J+N.offsetTop+(Se?U:0)+X)+ve;c.style.height=mt+"px",N.scrollTop=de-K+N.offsetTop}c.style.margin=`${Zr}px 0`,c.style.minHeight=G+"px",c.style.maxHeight=B+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[x,i.trigger,i.valueNode,c,h,N,w,k,i.dir,r]);Is(()=>C(),[C]);const[R,O]=b.useState();Is(()=>{h&&O(window.getComputedStyle(h).zIndex)},[h]);const q=b.useCallback($=>{$&&v.current===!0&&(C(),E==null||E(),v.current=!1)},[C,E]);return s.jsx(S9,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:y,onScrollButtonChange:q,children:s.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:R},children:s.jsx(wt.div,{...a,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});t4.displayName=j9;var k9="SelectPopperPosition",h0=b.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=Zr,...i}=t,o=Dp(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)"}})});h0.displayName=k9;var[S9,Dy]=Gc(Al,{}),f0="SelectViewport",n4=b.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...a}=t,i=$o(f0,n),o=Dy(f0,n),c=Jt(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(Op.Slot,{scope:n,children:s.jsx(wt.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:yt(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-Zr*2,N=parseFloat(m.style.minHeight),w=parseFloat(m.style.height),k=Math.max(N,w);if(k0?R:0,m.style.justifyContent="flex-end")}}}u.current=f.scrollTop})})})]})});n4.displayName=f0;var s4="SelectGroup",[C9,T9]=Gc(s4),E9=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=vo();return s.jsx(C9,{scope:n,id:a,children:s.jsx(wt.div,{role:"group","aria-labelledby":a,...r,ref:e})})});E9.displayName=s4;var r4="SelectLabel",M9=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=T9(r4,n);return s.jsx(wt.div,{id:a.id,...r,ref:e})});M9.displayName=r4;var sp="SelectItem",[A9,a4]=Gc(sp),i4=b.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:i,...o}=t,c=zo(sp,n),u=$o(sp,n),h=c.value===r,[f,m]=b.useState(i??""),[x,y]=b.useState(!1),v=Jt(e,E=>{var C;return(C=u.itemRefCallback)==null?void 0:C.call(u,E,r,a)}),N=vo(),w=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(A9,{scope:n,value:r,disabled:a,textId:N,isSelected:h,onItemTextChange:b.useCallback(E=>{m(C=>C||((E==null?void 0:E.textContent)??"").trim())},[]),children:s.jsx(Op.ItemSlot,{scope:n,value:r,disabled:a,textValue:f,children:s.jsx(wt.div,{role:"option","aria-labelledby":N,"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:yt(o.onFocus,()=>y(!0)),onBlur:yt(o.onBlur,()=>y(!1)),onClick:yt(o.onClick,()=>{w.current!=="mouse"&&k()}),onPointerUp:yt(o.onPointerUp,()=>{w.current==="mouse"&&k()}),onPointerDown:yt(o.onPointerDown,E=>{w.current=E.pointerType}),onPointerMove:yt(o.onPointerMove,E=>{var C;w.current=E.pointerType,a?(C=u.onItemLeave)==null||C.call(u):w.current==="mouse"&&E.currentTarget.focus({preventScroll:!0})}),onPointerLeave:yt(o.onPointerLeave,E=>{var C;E.currentTarget===document.activeElement&&((C=u.onItemLeave)==null||C.call(u))}),onKeyDown:yt(o.onKeyDown,E=>{var R;((R=u.searchRef)==null?void 0:R.current)!==""&&E.key===" "||(p9.includes(E.key)&&k(),E.key===" "&&E.preventDefault())})})})})});i4.displayName=sp;var Rd="SelectItemText",o4=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:a,...i}=t,o=zo(Rd,n),c=$o(Rd,n),u=a4(Rd,n),h=y9(Rd,n),[f,m]=b.useState(null),x=Jt(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:N,onNativeOptionRemove:w}=h;return Is(()=>(N(v),()=>w(v)),[N,w,v]),s.jsxs(s.Fragment,{children:[s.jsx(wt.span,{id:u.textId,...i,ref:x}),u.isSelected&&o.valueNode&&!o.valueNodeHasChildren?uu.createPortal(i.children,o.valueNode):null]})});o4.displayName=Rd;var l4="SelectItemIndicator",c4=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return a4(l4,n).isSelected?s.jsx(wt.span,{"aria-hidden":!0,...r,ref:e}):null});c4.displayName=l4;var p0="SelectScrollUpButton",d4=b.forwardRef((t,e)=>{const n=$o(p0,t.__scopeSelect),r=Dy(p0,t.__scopeSelect),[a,i]=b.useState(!1),o=Jt(e,r.onScrollButtonChange);return Is(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=u.scrollTop>0;i(h)};const u=n.viewport;return c(),u.addEventListener("scroll",c),()=>u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),a?s.jsx(h4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop-u.offsetHeight)}}):null});d4.displayName=p0;var m0="SelectScrollDownButton",u4=b.forwardRef((t,e)=>{const n=$o(m0,t.__scopeSelect),r=Dy(m0,t.__scopeSelect),[a,i]=b.useState(!1),o=Jt(e,r.onScrollButtonChange);return Is(()=>{if(n.viewport&&n.isPositioned){let c=function(){const h=u.scrollHeight-u.clientHeight,f=Math.ceil(u.scrollTop)u.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),a?s.jsx(h4,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:u}=n;c&&u&&(c.scrollTop=c.scrollTop+u.offsetHeight)}}):null});u4.displayName=m0;var h4=b.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=t,i=$o("SelectScrollButton",n),o=b.useRef(null),c=Lp(n),u=b.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return b.useEffect(()=>()=>u(),[u]),Is(()=>{var f;const h=c().find(m=>m.ref.current===document.activeElement);(f=h==null?void 0:h.ref.current)==null||f.scrollIntoView({block:"nearest"})},[c]),s.jsx(wt.div,{"aria-hidden":!0,...a,ref:e,style:{flexShrink:0,...a.style},onPointerDown:yt(a.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:yt(a.onPointerMove,()=>{var h;(h=i.onItemLeave)==null||h.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:yt(a.onPointerLeave,()=>{u()})})}),I9="SelectSeparator",P9=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return s.jsx(wt.div,{"aria-hidden":!0,...r,ref:e})});P9.displayName=I9;var x0="SelectArrow",R9=b.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,a=Dp(n),i=zo(x0,n),o=$o(x0,n);return i.open&&o.position==="popper"?s.jsx(d9,{...a,...r,ref:e}):null});R9.displayName=x0;var O9="SelectBubbleInput",f4=b.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const a=b.useRef(null),i=Jt(r,a),o=L0(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(wt.select,{...n,style:{...U3,...n.style},ref:i,defaultValue:e})});f4.displayName=O9;function p4(t){return t===""||t===void 0}function m4(t){const e=Co(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 x4(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 D9=W3,g4=q3,_9=J3,z9=Q3,$9=Y3,y4=X3,F9=n4,b4=i4,B9=o4,V9=c4,H9=d4,U9=u4;const xc=D9,gc=_9,al=b.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(g4,{ref:r,className:Qt("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,s.jsx(z9,{asChild:!0,children:s.jsx(Ec,{className:"h-4 w-4 opacity-50"})})]}));al.displayName=g4.displayName;const il=b.forwardRef(({className:t,children:e,position:n="popper",...r},a)=>s.jsx($9,{children:s.jsxs(y4,{ref:a,className:Qt("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(ug,{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(Ec,{className:"h-4 w-4"})})]})}));il.displayName=y4.displayName;const tr=b.forwardRef(({className:t,children:e,...n},r)=>s.jsxs(b4,{ref:r,className:Qt("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(ip,{className:"h-4 w-4"})})}),s.jsx(B9,{children:e})]}));tr.displayName=b4.displayName;const Xw=["📖","📕","📗","📘","📙","📓","📔","📒","📚","📖"];function W9(t){return t.title==="序言"||t.title.includes("序言")}function Zw(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 sg(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:y,onShowSectionOrders:v,pinnedSectionIds:N=[]}){const[w,k]=b.useState(null),[E,C]=b.useState(null),R=(B,re)=>(w==null?void 0:w.type)===B&&(w==null?void 0:w.id)===re,O=(B,re)=>(E==null?void 0:E.type)===B&&(E==null?void 0:E.id)===re,q=b.useCallback(()=>{const B=[];for(const re of t)for(const ae of re.chapters)for(const J of ae.sections)B.push({id:J.id,partId:re.id,partTitle:re.title,chapterId:ae.id,chapterTitle:ae.title});return B},[t]),$=b.useCallback(async(B,re,ae,J)=>{var G;B.preventDefault(),B.stopPropagation();const F=B.dataTransfer.getData("text/plain"),D=sg(F);if(!D||D.type===re&&D.id===ae)return;const P=q(),oe=new Map(P.map(_=>[_.id,_]));if(D.type==="part"&&re==="part"){const _=t.map(X=>X.id),U=_.indexOf(D.id),H=_.indexOf(ae);if(U===-1||H===-1)return;const K=[..._];K.splice(U,1),K.splice(Ude.id===X);if(le)for(const de of le.chapters)for(const ve of de.sections){const ye=oe.get(ve.id);ye&&me.push(ye)}}await r(me);return}if(D.type==="chapter"&&(re==="chapter"||re==="section"||re==="part")){const _=t.find(ye=>ye.chapters.some(Se=>Se.id===D.id)),U=_==null?void 0:_.chapters.find(ye=>ye.id===D.id);if(!_||!U)return;let H,K,me=null;if(re==="section"){const ye=oe.get(ae);if(!ye)return;H=ye.partId,K=ye.partTitle,me=ae}else if(re==="chapter"){const ye=t.find(mt=>mt.chapters.some(kt=>kt.id===ae)),Se=ye==null?void 0:ye.chapters.find(mt=>mt.id===ae);if(!ye||!Se)return;H=ye.id,K=ye.title;const Fe=P.filter(mt=>mt.chapterId===ae).pop();me=(Fe==null?void 0:Fe.id)??null}else{const ye=t.find(Se=>Se.id===ae);if(!ye)return;if(H=ye.id,K=ye.title,ye.chapters[0]){const Se=P.filter(Fe=>Fe.partId===ye.id&&Fe.chapterId===ye.chapters[0].id);me=((G=Se[Se.length-1])==null?void 0:G.id)??null}}const X=U.sections.map(ye=>ye.id),le=P.filter(ye=>!X.includes(ye.id));let de=le.length;if(me){const ye=le.findIndex(Se=>Se.id===me);ye>=0&&(de=ye+1)}const ve=X.map(ye=>({...oe.get(ye),partId:H,partTitle:K,chapterId:U.id,chapterTitle:U.title}));await r([...le.slice(0,de),...ve,...le.slice(de)]);return}if(D.type==="section"&&(re==="section"||re==="chapter"||re==="part")){if(!J)return;const{partId:_,partTitle:U,chapterId:H,chapterTitle:K}=J;let me;if(re==="section")me=P.findIndex(Se=>Se.id===ae);else if(re==="chapter"){const Se=P.filter(Fe=>Fe.chapterId===ae).pop();me=Se?P.findIndex(Fe=>Fe.id===Se.id)+1:P.length}else{const Se=t.find(Fe=>Fe.id===ae);if(Se!=null&&Se.chapters[0]){const Fe=P.filter(kt=>kt.partId===Se.id&&kt.chapterId===Se.chapters[0].id),mt=Fe[Fe.length-1];me=mt?P.findIndex(kt=>kt.id===mt.id)+1:P.length}else me=P.length}const X=P.findIndex(Se=>Se.id===D.id);if(X===-1)return;const le=P.filter(Se=>Se.id!==D.id),de=X({onDragEnter:J=>{J.preventDefault(),J.stopPropagation(),J.dataTransfer.dropEffect="move",C({type:B,id:re})},onDragOver:J=>{J.preventDefault(),J.stopPropagation(),J.dataTransfer.dropEffect="move",C({type:B,id:re})},onDragLeave:()=>C(null),onDrop:J=>{C(null);const F=sg(J.dataTransfer.getData("text/plain"));F&&(B==="section"&&F.type==="section"&&F.id===re||(B==="part"?F.type==="part"?$(J,"part",re):ae&&$(J,"part",re,ae):B==="chapter"&&ae?(F.type==="section"||F.type==="chapter")&&$(J,"chapter",re,ae):B==="section"&&ae&&$(J,"section",re,ae)))}}),I=B=>Xw[B%Xw.length],te=B=>t.slice(0,B).filter(re=>!W9(re)).length,Q=B=>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: ${B.id}`,children:B.id}),s.jsx("span",{className:"truncate",children:B.title})]});return s.jsx("div",{className:"space-y-3",children:t.map((B,re)=>{var U,H,K,me;const ae=B.title==="序言"||B.title.includes("序言"),J=B.title==="尾声"||B.title.includes("尾声"),F=B.title==="附录"||B.title.includes("附录"),D=O("part",B.id),P=e.includes(B.id),oe=B.chapters.length,G=B.chapters.reduce((X,le)=>X+le.sections.length,0);if(ae&&B.chapters.length===1&&B.chapters[0].sections.length===1){const X=B.chapters[0].sections[0],le=O("section",X.id),de={partId:B.id,partTitle:B.title,chapterId:B.chapters[0].id,chapterTitle:B.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:ve=>{ve.stopPropagation(),ve.dataTransfer.setData("text/plain","section:"+X.id),ve.dataTransfer.effectAllowed="move",k({type:"section",id:X.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] ${le?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${R("section",X.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...V("section",X.id,de),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(oi,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:ve=>ve.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:x.includes(X.id),onChange:()=>y(X.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(rr,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[B.chapters[0].title," | ",X.title]}),N.includes(X.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(bc,{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:ve=>ve.stopPropagation(),onClick:ve=>ve.stopPropagation(),children:[X.price===0||X.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:["¥",X.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",X.clickCount??0," · 付款 ",X.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(X.hotScore??0).toFixed(1)," · 第",X.hotRank&&X.hotRank>0?X.hotRank:"-","名"]}),v&&s.jsx(Y,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(X),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(Y,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(X),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(tn,{className:"w-3.5 h-3.5"})}),s.jsx(Y,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(X),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Ms,{className:"w-3.5 h-3.5"})})]})]})]},B.id)}if(B.title==="2026每日派对干货"||B.title.includes("2026每日派对干货")){const X=O("part",B.id);return s.jsxs("div",{className:`rounded-xl border overflow-hidden transition-all duration-200 ${X?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50 bg-[#1C1C1E]"}`,...V("part",B.id,{partId:B.id,partTitle:B.title,chapterId:((U=B.chapters[0])==null?void 0:U.id)??"",chapterTitle:((H=B.chapters[0])==null?void 0:H.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:le=>{le.stopPropagation(),le.dataTransfer.setData("text/plain","part:"+B.id),le.dataTransfer.effectAllowed="move",k({type:"part",id:B.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",B.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(oi,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),s.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#38bdac]/80 flex items-center justify-center text-white font-bold shrink-0",children:"派"}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:B.title}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:Zw(B)})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:le=>le.stopPropagation(),onClick:le=>le.stopPropagation(),children:[o&&s.jsx(Y,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(B),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(Y,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(B),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx(tn,{className:"w-3.5 h-3.5"})}),f&&s.jsx(Y,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(B),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(Ms,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",title:"本篇章数与节数",children:[oe," 章 · ",G," 节"]}),s.jsx("button",{type:"button",draggable:!1,className:"p-1 rounded-md hover:bg-white/10 text-gray-500",title:P?"收起":"展开",onMouseDown:le=>le.stopPropagation(),onClick:le=>{le.stopPropagation(),n(B.id)},children:P?s.jsx(Ec,{className:"w-5 h-5"}):s.jsx(ol,{className:"w-5 h-5"})})]})]}),P&&B.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:B.chapters.map(le=>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:le.title}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:de=>de.stopPropagation(),children:[m&&s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>m(B,le),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(tn,{className:"w-3.5 h-3.5"})}),c&&s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>c(B),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(Y,{variant:"ghost",size:"sm",onClick:()=>u(B,le),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(Ms,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:le.sections.map(de=>{const ve=O("section",de.id);return s.jsxs("div",{draggable:!0,onDragStart:ye=>{ye.stopPropagation(),ye.dataTransfer.setData("text/plain","section:"+de.id),ye.dataTransfer.effectAllowed="move",k({type:"section",id:de.id})},onDragEnd:()=>{k(null),C(null)},onClick:()=>a(de),className:`flex items-center justify-between py-2 px-3 rounded-lg min-h-[40px] cursor-pointer select-none transition-all duration-200 ${ve?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${R("section",de.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...V("section",de.id,{partId:B.id,partTitle:B.title,chapterId:le.id,chapterTitle:le.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(oi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:ye=>ye.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:x.includes(de.id),onChange:()=>y(de.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(de)}),N.includes(de.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(bc,{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:ye=>ye.stopPropagation(),children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",de.clickCount??0," · 付款 ",de.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(de.hotScore??0).toFixed(1)," · 第",de.hotRank&&de.hotRank>0?de.hotRank:"-","名"]}),v&&s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>v(de),className:"text-[10px] text-gray-500 hover:text-[#38bdac] h-7 px-1.5",children:"付款记录"}),s.jsx(Y,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(de),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(tn,{className:"w-3.5 h-3.5"})}),s.jsx(Y,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(de),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Ms,{className:"w-3.5 h-3.5"})})]})]},de.id)})})]},le.id))})]},B.id)}if(F)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:B.chapters.map((X,le)=>X.sections.length>0?X.sections.map(de=>{const ve=O("section",de.id);return s.jsxs("div",{draggable:!0,onDragStart:ye=>{ye.stopPropagation(),ye.dataTransfer.setData("text/plain","section:"+de.id),ye.dataTransfer.effectAllowed="move",k({type:"section",id:de.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 ${ve?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${R("section",de.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...V("section",de.id,{partId:B.id,partTitle:B.title,chapterId:X.id,chapterTitle:X.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(oi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:ye=>ye.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:x.includes(de.id),onChange:()=>y(de.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:["附录",le+1," | ",X.title," | ",de.title]}),N.includes(de.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(bc,{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:["点击 ",de.clickCount??0," · 付款 ",de.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(de.hotScore??0).toFixed(1)," · 第",de.hotRank&&de.hotRank>0?de.hotRank:"-","名"]}),v&&s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>v(de),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(Y,{variant:"ghost",size:"sm",onClick:()=>a(de),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(tn,{className:"w-3.5 h-3.5"})}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>i(de),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Ms,{className:"w-3.5 h-3.5"})})]})]}),s.jsx(ol,{className:"w-4 h-4 text-gray-500 shrink-0"})]},de.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:["附录",le+1," | ",X.title,"(空)"]}),s.jsx(ol,{className:"w-4 h-4 text-gray-500 shrink-0"})]},X.id))})]},B.id);if(J&&B.chapters.length===1&&B.chapters[0].sections.length===1){const X=B.chapters[0].sections[0],le=O("section",X.id),de={partId:B.id,partTitle:B.title,chapterId:B.chapters[0].id,chapterTitle:B.chapters[0].title};return s.jsxs("div",{draggable:!0,onDragStart:ve=>{ve.stopPropagation(),ve.dataTransfer.setData("text/plain","section:"+X.id),ve.dataTransfer.effectAllowed="move",k({type:"section",id:X.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] ${le?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${R("section",X.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...V("section",X.id,de),children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0 select-none",children:[s.jsx(oi,{className:"w-5 h-5 text-gray-500 shrink-0 opacity-60"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:ve=>ve.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:x.includes(X.id),onChange:()=>y(X.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(rr,{className:"w-4 h-4 text-gray-400"})}),s.jsxs("span",{className:"font-medium text-gray-200 truncate",children:[B.chapters[0].title," | ",X.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:ve=>ve.stopPropagation(),onClick:ve=>ve.stopPropagation(),children:[X.price===0||X.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:["¥",X.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",X.clickCount??0," · 付款 ",X.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(X.hotScore??0).toFixed(1)," · 第",X.hotRank&&X.hotRank>0?X.hotRank:"-","名"]}),v&&s.jsx(Y,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(X),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(Y,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(X),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(tn,{className:"w-3.5 h-3.5"})}),s.jsx(Y,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(X),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Ms,{className:"w-3.5 h-3.5"})})]})]})]},B.id)}return J?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:B.chapters.map(X=>X.sections.map(le=>{const de=O("section",le.id);return s.jsxs("div",{draggable:!0,onDragStart:ve=>{ve.stopPropagation(),ve.dataTransfer.setData("text/plain","section:"+le.id),ve.dataTransfer.effectAllowed="move",k({type:"section",id:le.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 ${de?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":"hover:bg-[#162840]/50"} ${R("section",le.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":""}`,...V("section",le.id,{partId:B.id,partTitle:B.title,chapterId:X.id,chapterTitle:X.title}),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[s.jsx(oi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),y&&s.jsx("label",{className:"shrink-0 flex items-center",onClick:ve=>ve.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:x.includes(le.id),onChange:()=>y(le.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:[X.title," | ",le.title]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs("span",{className:"text-[10px] text-gray-500",children:["点击 ",le.clickCount??0," · 付款 ",le.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(le.hotScore??0).toFixed(1)," · 第",le.hotRank&&le.hotRank>0?le.hotRank:"-","名"]}),v&&s.jsx(Y,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>v(le),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(Y,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(le),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑",children:s.jsx(tn,{className:"w-3.5 h-3.5"})}),s.jsx(Y,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(le),className:"text-gray-500 hover:text-red-400 h-7 px-2",children:s.jsx(Ms,{className:"w-3.5 h-3.5"})})]})]})]},le.id)}))})]},B.id):s.jsxs("div",{className:`rounded-xl border bg-[#1C1C1E] overflow-hidden transition-all duration-200 ${D?"border-[#38bdac] ring-2 ring-[#38bdac]/40 bg-[#38bdac]/5":"border-gray-700/50"}`,...V("part",B.id,{partId:B.id,partTitle:B.title,chapterId:((K=B.chapters[0])==null?void 0:K.id)??"",chapterTitle:((me=B.chapters[0])==null?void 0:me.title)??""}),children:[s.jsxs("div",{draggable:!0,onDragStart:X=>{X.stopPropagation(),X.dataTransfer.setData("text/plain","part:"+B.id),X.dataTransfer.effectAllowed="move",k({type:"part",id:B.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",B.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(oi,{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:I(te(re))}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-bold text-white text-base",children:B.title}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:Zw(B)})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",onMouseDown:X=>X.stopPropagation(),onClick:X=>X.stopPropagation(),children:[o&&s.jsx(Y,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>o(B),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(Y,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>h(B),className:"text-gray-500 hover:text-[#38bdac] h-7 px-2",title:"编辑篇名",children:s.jsx(tn,{className:"w-3.5 h-3.5"})}),f&&s.jsx(Y,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>f(B),className:"text-gray-500 hover:text-red-400 h-7 px-2",title:"删除本篇",children:s.jsx(Ms,{className:"w-3.5 h-3.5"})}),s.jsxs("span",{className:"text-xs text-gray-500",title:"本篇章数与节数",children:[oe," 章 · ",G," 节"]}),s.jsx("button",{type:"button",draggable:!1,className:"p-1 rounded-md hover:bg-white/10 text-gray-500",title:P?"收起":"展开",onMouseDown:X=>X.stopPropagation(),onClick:X=>{X.stopPropagation(),n(B.id)},children:P?s.jsx(Ec,{className:"w-5 h-5"}):s.jsx(ol,{className:"w-5 h-5"})})]})]}),P&&s.jsx("div",{className:"border-t border-gray-700/50 pl-4 pr-4 pb-4 pt-3 space-y-4",children:B.chapters.map(X=>{const le=O("chapter",X.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:de=>{de.stopPropagation(),de.dataTransfer.setData("text/plain","chapter:"+X.id),de.dataTransfer.effectAllowed="move",k({type:"chapter",id:X.id})},onDragEnd:()=>{k(null),C(null)},onDragEnter:de=>{de.preventDefault(),de.stopPropagation(),de.dataTransfer.dropEffect="move",C({type:"chapter",id:X.id})},onDragOver:de=>{de.preventDefault(),de.stopPropagation(),de.dataTransfer.dropEffect="move",C({type:"chapter",id:X.id})},onDragLeave:()=>C(null),onDrop:de=>{C(null);const ve=sg(de.dataTransfer.getData("text/plain"));if(!ve)return;const ye={partId:B.id,partTitle:B.title,chapterId:X.id,chapterTitle:X.title};(ve.type==="section"||ve.type==="chapter")&&$(de,"chapter",X.id,ye)},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 ${le?"bg-[#38bdac]/15 ring-1 ring-[#38bdac]/50":""} ${R("chapter",X.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac]":"hover:bg-[#162840]/30"}`,children:[s.jsx(oi,{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:X.title})]}),s.jsxs("div",{className:"flex gap-0.5 shrink-0",onClick:de=>de.stopPropagation(),children:[m&&s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>m(B,X),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑章节名称",children:s.jsx(tn,{className:"w-3.5 h-3.5"})}),c&&s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>c(B),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(Y,{variant:"ghost",size:"sm",onClick:()=>u(B,X),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",title:"删除本章",children:s.jsx(Ms,{className:"w-3.5 h-3.5"})})]})]}),s.jsx("div",{className:"space-y-1 pl-2",children:X.sections.map(de=>{const ve=O("section",de.id);return s.jsxs("div",{draggable:!0,onDragStart:ye=>{ye.stopPropagation(),ye.dataTransfer.setData("text/plain","section:"+de.id),ye.dataTransfer.effectAllowed="move",k({type:"section",id:de.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 ${ve?"bg-[#38bdac]/15 ring-2 ring-[#38bdac]/50":""} ${R("section",de.id)?"opacity-60 scale-[0.98] ring-2 ring-[#38bdac] shadow-lg":"hover:bg-[#162840]/50"}`,...V("section",de.id,{partId:B.id,partTitle:B.title,chapterId:X.id,chapterTitle:X.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:ye=>ye.stopPropagation(),children:s.jsx("input",{type:"checkbox",checked:x.includes(de.id),onChange:()=>y(de.id),className:"w-4 h-4 rounded border-gray-600 bg-[#0a1628] text-[#38bdac] focus:ring-[#38bdac]"})}),s.jsx(oi,{className:"w-4 h-4 text-gray-500 shrink-0 opacity-50"}),s.jsx("div",{className:`w-2 h-2 rounded-full shrink-0 ${de.price===0||de.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(de)}),N.includes(de.id)&&s.jsx("span",{title:"已置顶",children:s.jsx(bc,{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:ye=>ye.stopPropagation(),onClick:ye=>ye.stopPropagation(),children:[de.isNew&&s.jsx("span",{className:"px-2 py-1 bg-[#38bdac]/20 text-[#38bdac] text-[10px] font-medium rounded",children:"NEW"}),de.price===0||de.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:["¥",de.price]}),s.jsxs("span",{className:"text-[10px] text-gray-500",title:"点击次数 · 付款笔数",children:["点击 ",de.clickCount??0," · 付款 ",de.payCount??0]}),s.jsxs("span",{className:"text-[10px] text-amber-400/90",title:"热度积分与排名",children:["热度 ",(de.hotScore??0).toFixed(1)," · 第",de.hotRank&&de.hotRank>0?de.hotRank:"-","名"]}),v&&s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>v(de),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(Y,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>a(de),className:"text-gray-500 hover:text-[#38bdac] h-7 px-1.5",title:"编辑",children:s.jsx(tn,{className:"w-3.5 h-3.5"})}),s.jsx(Y,{draggable:!1,variant:"ghost",size:"sm",onClick:()=>i(de),className:"text-gray-500 hover:text-red-400 h-7 px-1.5",children:s.jsx(Ms,{className:"w-3.5 h-3.5"})})]})]})]},de.id)})})]},X.id)})})]},B.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 Le(r)}function G9(t){return Le(`/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 Le(n?`/api/admin/ckb/plans?${n}`:"/api/admin/ckb/plans")}const v4=11,ej={personId:"",name:"",boundUserId:"",aliases:"",label:"",sceneId:v4,ckbApiKey:"",greeting:"你好,请通过",tips:"请注意消息,稍后加你微信",remarkType:"phone",remarkFormat:"",addFriendInterval:1,startTime:"06:00",endTime:"22:00",deviceGroups:""};function Q9({open:t,onOpenChange:e,editingPerson:n,onSubmit:r}){var F;const a=!!n,[i,o]=b.useState(ej),[c,u]=b.useState(!1),[h,f]=b.useState(!1),[m,x]=b.useState([]),[y,v]=b.useState(!1),[N,w]=b.useState(""),[k,E]=b.useState([]),[C,R]=b.useState(!1),[O,q]=b.useState(""),[$,V]=b.useState(!1),[I,te]=b.useState({});b.useEffect(()=>{t&&(w(""),o(n?{personId:n.personId??n.name??"",name:n.name??"",boundUserId:n.userId??"",aliases:n.aliases??"",label:n.label??"",sceneId:v4,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??""}:{...ej}),te({}),m.length===0&&Q(""),k.length===0&&B(""))},[t,n]);const Q=async D=>{v(!0);try{const P=await q9({page:1,limit:50,keyword:D});P!=null&&P.success&&Array.isArray(P.devices)?x(P.devices):P!=null&&P.error&&ne.error(P.error)}catch(P){ne.error(P instanceof Error?P.message:"加载设备列表失败")}finally{v(!1)}},B=async D=>{R(!0);try{const P=await J9({page:1,limit:100,keyword:D});P!=null&&P.success&&Array.isArray(P.plans)?E(P.plans):P!=null&&P.error&&ne.error(P.error)}catch{ne.error("加载计划列表失败")}finally{R(!1)}},re=D=>{const P=Array.isArray(D.deviceGroups)?D.deviceGroups.map(String).join(","):"";o(oe=>({...oe,ckbApiKey:D.apiKey||"",greeting:D.greeting||oe.greeting,tips:D.tips||oe.tips,remarkType:D.remarkType||oe.remarkType,remarkFormat:D.remarkFormat||oe.remarkFormat,addFriendInterval:D.addInterval||oe.addFriendInterval,startTime:D.startTime||oe.startTime,endTime:D.endTime||oe.endTime,deviceGroups:P||oe.deviceGroups})),V(!1),ne.success(`已选择计划「${D.name}」,参数已覆盖`)},ae=O.trim()?k.filter(D=>(D.name||"").includes(O.trim())||String(D.id).includes(O.trim())):k,J=async()=>{var G;const D={};(!i.name||!String(i.name).trim())&&(D.name="请填写名称");const P=i.addFriendInterval;if((typeof P!="number"||P<1)&&(D.addFriendInterval="添加间隔至少为 1 分钟"),(((G=i.deviceGroups)==null?void 0:G.split(",").map(_=>_.trim()).filter(Boolean))??[]).length===0&&(D.deviceGroups="请至少选择 1 台设备"),te(D),Object.keys(D).length>0){ne.error(D.name||D.addFriendInterval||D.deviceGroups||"请完善必填项");return}u(!0);try{await r(i),e(!1)}catch(_){ne.error(_ instanceof Error?_.message:"保存失败")}finally{u(!1)}};return s.jsx(Bt,{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(Vt,{children:[s.jsx(Ht,{className:"text-[#38bdac]",children:a?"编辑人物":"添加人物 — 存客宝 API 获客"}),s.jsx(of,{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(ee,{className:"text-gray-400 text-xs",children:["名称 ",s.jsx("span",{className:"text-red-400",children:"*"})]}),s.jsx(ce,{className:`bg-[#0a1628] text-white ${I.name?"border-red-500 focus-visible:ring-red-500":"border-gray-700"}`,placeholder:"如 卡若",value:i.name,onChange:D=>{o(P=>({...P,name:D.target.value})),I.name&&te(P=>({...P,name:void 0}))}}),I.name&&s.jsx("p",{className:"text-xs text-red-400",children:I.name})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"人物ID(可选)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"自动生成",value:i.personId,onChange:D=>o(P=>({...P,personId:D.target.value})),disabled:a})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"标签(身份/角色)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 超级个体",value:i.label,onChange:D=>o(P=>({...P,label:D.target.value}))})]}),s.jsxs("div",{className:"space-y-1.5 col-span-3",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"绑定会员用户 ID(可选,与「用户管理」中用户 id 一致)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-xs",placeholder:"留空则不绑定;填写后获客统计可与超级个体对齐",value:i.boundUserId,onChange:D=>o(P=>({...P,boundUserId:D.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(ee,{className:"text-gray-400 text-xs",children:"别名(逗号分隔,@ 可匹配)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 卡卡, 若若",value:i.aliases,onChange:D=>o(P=>({...P,aliases:D.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(ee,{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:()=>V(!$),children:i.ckbApiKey?s.jsx("span",{className:"text-white truncate",children:((F=k.find(D=>D.apiKey===i.ckbApiKey))==null?void 0:F.name)||`获客计划 (${i.ckbApiKey.slice(0,8)}…)`}):s.jsx("span",{className:"text-gray-500",children:"点击选择已有计划 / 新建时自动创建"})}),s.jsx(Y,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-200 shrink-0",onClick:()=>{B(O),V(!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(ce,{className:"bg-[#050c18] border-gray-700 text-white h-8 text-xs",placeholder:"搜索计划名称...",value:O,onChange:D=>q(D.target.value),onKeyDown:D=>{D.key==="Enter"&&B(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(D=>s.jsxs("div",{className:`px-3 py-2 cursor-pointer hover:bg-[#38bdac]/10 text-sm flex items-center justify-between ${i.ckbApiKey===D.apiKey?"bg-[#38bdac]/20 text-[#38bdac]":"text-white"}`,onClick:()=>re(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(Y,{type:"button",size:"sm",variant:"ghost",className:"text-gray-400 h-7 text-xs",onClick:()=>V(!1),children:"关闭"})})]}),s.jsx("p",{className:"text-xs text-gray-500",children:"选择计划后自动覆盖下方参数。新建人物时若不选择则自动创建新计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(ee,{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 ${I.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:i.deviceGroups?`已选择 ${i.deviceGroups.split(",").filter(Boolean).length} 个设备`:"",onClick:()=>f(!0)}),s.jsx(Y,{type:"button",variant:"outline",className:"border-0 border-l border-inherit rounded-r-md text-gray-200",onClick:()=>f(!0),children:"选择"})]}),I.deviceGroups?s.jsx("p",{className:"text-xs text-red-400",children:I.deviceGroups}):s.jsx("p",{className:"text-xs text-gray-500",children:"从存客宝设备列表中选择,至少选择 1 台设备参与获客计划。"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"好友备注"}),s.jsxs(xc,{value:i.remarkType,onValueChange:D=>o(P=>({...P,remarkType:D})),children:[s.jsx(al,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(gc,{placeholder:"选择备注类型"})}),s.jsxs(il,{children:[s.jsx(tr,{value:"phone",children:"手机号"}),s.jsx(tr,{value:"nickname",children:"昵称"}),s.jsx(tr,{value:"source",children:"来源"})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"备注格式(手机号+标签,标签不超过6字)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如 {手机号}-{来源标签},总长不超过10字",value:i.remarkFormat,onChange:D=>o(P=>({...P,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(ee,{className:"text-gray-400 text-xs",children:"打招呼语"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"你好,请通过",value:i.greeting,onChange:D=>o(P=>({...P,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(ee,{className:"text-gray-400 text-xs",children:"添加间隔(分钟)"}),s.jsx(ce,{type:"number",min:1,className:`bg-[#0a1628] text-white ${I.addFriendInterval?"border-red-500 focus-visible:ring-red-500":"border-gray-700"}`,value:i.addFriendInterval,onChange:D=>{o(P=>({...P,addFriendInterval:Number(D.target.value)||1})),I.addFriendInterval&&te(P=>({...P,addFriendInterval:void 0}))}}),I.addFriendInterval&&s.jsx("p",{className:"text-xs text-red-400",children:I.addFriendInterval})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ee,{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:i.startTime,onChange:D=>o(P=>({...P,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:i.endTime,onChange:D=>o(P=>({...P,endTime:D.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ee,{className:"text-gray-400 text-xs",children:"获客成功提示"}),s.jsx(To,{className:"bg-[#0a1628] border-gray-700 text-white min-h-[72px] resize-none",placeholder:"请注意消息,稍后加你微信",value:i.tips,onChange:D=>o(P=>({...P,tips:D.target.value}))})]})]})]})]})]}),s.jsxs(xn,{className:"gap-3 pt-2",children:[s.jsx(Y,{variant:"outline",onClick:()=>e(!1),className:"border-gray-600 text-gray-300",children:"取消"}),s.jsx(Y,{onClick:J,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(Y,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-200 h-8",onClick:()=>{const D=m.map(G=>String(G.id??"")),P=i.deviceGroups?i.deviceGroups.split(",").map(G=>G.trim()).filter(Boolean):[],oe=D.length>0&&D.every(G=>P.includes(G));o(G=>({...G,deviceGroups:oe?"":D.join(",")})),!oe&&D.length>0&&te(G=>({...G,deviceGroups:void 0}))},children:(()=>{const D=m.map(oe=>String(oe.id??"")),P=i.deviceGroups?i.deviceGroups.split(",").map(oe=>oe.trim()).filter(Boolean):[];return D.length>0&&D.every(oe=>P.includes(oe))?"取消全选":"全选"})()}),s.jsx(ce,{className:"bg-[#050c18] border-gray-700 text-white h-8 w-52",placeholder:"搜索备注/微信号/IMEI",value:N,onChange:D=>w(D.target.value),onKeyDown:D=>{D.key==="Enter"&&Q(N)}}),s.jsx(Y,{type:"button",size:"sm",variant:"outline",className:"border-gray-600 text-gray-200 h-8",onClick:()=>Q(N),disabled:y,children:"刷新"}),s.jsx(Y,{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(D=>{const P=String(D.id??""),oe=i.deviceGroups?i.deviceGroups.split(",").map(U=>U.trim()).filter(Boolean):[],G=oe.includes(P),_=()=>{let U;G?U=oe.filter(H=>H!==P):U=[...oe,P],o(H=>({...H,deviceGroups:U.join(",")})),U.length>0&&te(H=>({...H,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:G,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:D.memo||D.wechatId||`设备 ${P}`}),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: ",P]}),D.wechatId&&s.jsxs("span",{className:"mr-3",children:["微信号: ",D.wechatId]}),typeof D.totalFriend=="number"&&s.jsxs("span",{children:["好友数: ",D.totalFriend]})]})]})]},P)})})}),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(Y,{type:"button",variant:"outline",className:"border-gray-600 text-gray-200 h-8 px-4",onClick:()=>f(!1),children:"取消"}),s.jsx(Y,{type:"button",className:"bg-[#38bdac] hover:bg-[#2da396] text-white h-8 px-4",onClick:()=>f(!1),children:"确定"})]})]})]})})]})})}const rg=JSON.stringify({singlePageUnlockTitle:"解锁完整内容",singlePagePayButtonText:"支付 ¥{price} 解锁全文",singlePageExpandedHint:"预览页不能直接付款,务必先点底栏「前往小程序」。",payTapModalTitle:"解锁说明",payTapModalContent:"全文 ¥{price}。预览里无法完成支付:请先点屏幕底部「前往小程序」进入完整版,登录后再付款解锁。",fullUnlockTitle:"解锁完整内容",fullUnlockDesc:"可先上滑阅读预览;需要全文时,点下方「支付¥{price}」查看说明",fullLockedProgressText:"已阅读约 {percent}% ,购买后继续阅读",fullPaywallTip:"转发给需要的人,一起学习还能赚佣金",notLoginUnlockDesc:"已预览约 {percent}% 内容,登录并支付 ¥{price} 后阅读全文",notLoginPaywallTip:"分享给好友一起学习,还能赚取佣金",shareTipLine:"好友经你分享购买,你可获得约 90% 收益",momentsModalTitle:"分享到朋友圈",momentsModalContent:`已复制发圈文案(非分享给好友)。 - -请点击右上角「···」→「分享到朋友圈」粘贴发布。`,momentsClipboardFooter:` - -—— 以上为正文预览约 {percent}% ,搜「卡若创业派对」小程序阅读全文 ——`,timelineTitleSuffix:"(预览{percent}%)"},null,2);function Y9(t,e){const n=new Map;for(const i of t){const o=i.partId||"part-1",c=i.partTitle||"未分类",u=i.chapterId||"chapter-1",h=i.chapterTitle||"未分类";n.has(o)||n.set(o,{id:o,title:c,chapters:new Map});const f=n.get(o);f.chapters.has(u)||f.chapters.set(u,{id:u,title:h,sections:[]}),f.chapters.get(u).sections.push({id:i.id,mid:i.mid,title:i.title,price:i.price??1,filePath:i.filePath,isFree:i.isFree,isNew:i.isNew,clickCount:i.clickCount??0,payCount:i.payCount??0,hotScore:i.hotScore??0,hotRank:e.get(i.id)??0})}const r=Array.from(n.values()).map(i=>({...i,chapters:Array.from(i.chapters.values())})),a=new Map;for(let i=0;i{const c=a.get(i.id),u=a.get(o.id);return c!==void 0&&u!==void 0&&c!==u?c-u:c!==void 0&&u===void 0?-1:c===void 0&&u!==void 0?1:i.id.localeCompare(o.id)})}function X9(){var gt,Nn,ct;const t=La(),[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),[N,w]=b.useState(""),[k,E]=b.useState([]),[C,R]=b.useState(!1),[O,q]=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}),[$,V]=b.useState(null),[I,te]=b.useState(!1),[Q,B]=b.useState(!1),[re,ae]=b.useState(null),[J,F]=b.useState(!1),[D,P]=b.useState([]),[oe,G]=b.useState(!1),[_,U]=b.useState(""),[H,K]=b.useState(""),[me,X]=b.useState(!1),[le,de]=b.useState(""),[ve,ye]=b.useState(!1),[Se,Fe]=b.useState(null),[mt,kt]=b.useState(!1),[ft,Dt]=b.useState(!1),[Pt,Rn]=b.useState({readWeight:.5,recencyWeight:.3,payWeight:.2}),[yn,Wt]=b.useState(!1),[Xt,Sn]=b.useState(!1),[Fn,Wn]=b.useState(1),[Mt,pn]=b.useState([]),[bn,ge]=b.useState(!1),[Ce,Be]=b.useState([]),[Ze,St]=b.useState(!1),[vt,L]=b.useState(20),[Ie,xt]=b.useState(!1),[Rt,pt]=b.useState(!1),[at,At]=b.useState(rg),[Kt,en]=b.useState(!1),[ls,Ws]=b.useState(!1),[Fr,za]=b.useState([]),[$a,Fa]=b.useState([]),[oa,Br]=b.useState([]),[yr,ir]=b.useState(!1),[Vr,Ls]=b.useState(1),[Ds,or]=b.useState(20),[br,la]=b.useState(0),[ie,xe]=b.useState(1),[It,$t]=b.useState(""),[Yn,Xn]=b.useState(!1),[Ks,Ba]=b.useState(null),[Ct,vn]=b.useState({tagId:"",label:"",aliases:"",url:"",type:"url",appId:"",appSecret:"",pagePath:""}),[Va,Ol]=b.useState(!1),[Ft,Fo]=b.useState(!1),[vr,ca]=b.useState(null),[cs,Ei]=b.useState(null),[Ha,da]=b.useState({}),[Ns,Hr]=b.useState(!1),[ws,Ll]=b.useState(""),[Mi,Jc]=b.useState(""),[Ua,Ai]=b.useState([]),[Nr,Wa]=b.useState(0),[_s,Qc]=b.useState(1),[Bo,Vo]=b.useState(!1),[zs,ua]=b.useState(""),Ii=b.useRef(null),qs=b.useCallback(async(T,z)=>{var dt;const ue=new FormData;ue.append("file",T),ue.append("folder",z);const Qe=await(await fetch(Ac("/api/upload"),{method:"POST",body:ue,headers:{Authorization:`Bearer ${localStorage.getItem("admin_token")||""}`}})).json();return((dt=Qe==null?void 0:Qe.data)==null?void 0:dt.url)||(Qe==null?void 0:Qe.url)||""},[]),Tt=b.useCallback(T=>qs(T,"book-images"),[qs]),ha=b.useCallback(T=>{const z=T.type.startsWith("video/")?"book-videos":"book-attachments";return qs(T,z)},[qs]),Pi=b.useMemo(()=>{const T=new Map;return Mt.forEach((z,ue)=>{T.set(z.id,ue+1)}),T},[Mt]),Bn=Y9(e,Pi),Ri=e.length,Ka=10,Ur=Math.max(1,Math.ceil(Mt.length/Ka)),wr=Mt.slice((Fn-1)*Ka,Fn*Ka),Cn=async()=>{a(!0);try{const T=await Le("/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)}},ds=async()=>{ge(!0);try{const T=await Le("/api/db/book?action=ranking",{cache:"no-store"}),z=Array.isArray(T==null?void 0:T.sections)?T.sections:[];pn(z);const ue=z.filter(we=>we.isPinned).map(we=>we.id);Be(ue)}catch(T){console.error(T),pn([])}finally{ge(!1)}};b.useEffect(()=>{Cn(),ds()},[]);const lr=T=>{o(z=>z.includes(T)?z.filter(ue=>ue!==T):[...z,T])},cr=b.useCallback(T=>{const z=e,ue=T.flatMap(we=>{const Qe=z.find(dt=>dt.id===we.id);return Qe?[{...Qe,partId:we.partId,partTitle:we.partTitle,chapterId:we.chapterId,chapterTitle:we.chapterTitle}]:[]});return n(ue),Zt("/api/db/book",{action:"reorder",items:T}).then(we=>{we&&we.success===!1&&(n(z),ne.error("排序失败: "+(we&&typeof we=="object"&&"error"in we?we.error:"未知错误")))}).catch(we=>{n(z),console.error("排序失败:",we),ne.error("排序失败: "+(we instanceof Error?we.message:"网络或服务异常"))}),Promise.resolve()},[e]),fa=async T=>{if(confirm(`确定要删除章节「${T.title}」吗?此操作不可恢复。`))try{const z=await gi(`/api/db/book?id=${encodeURIComponent(T.id)}`);z&&z.success!==!1?(ne.success("已删除"),Cn(),ds()):ne.error("删除失败: "+(z&&typeof z=="object"&&"error"in z?z.error:"未知错误"))}catch(z){console.error(z),ne.error("删除失败")}},pa=b.useCallback(async()=>{Wt(!0);try{const T=await Le("/api/db/config/full?key=article_ranking_weights",{cache:"no-store"}),z=T&&T.data;z&&typeof z.readWeight=="number"&&typeof z.recencyWeight=="number"&&typeof z.payWeight=="number"&&Rn({readWeight:Math.max(0,Math.min(1,z.readWeight)),recencyWeight:Math.max(0,Math.min(1,z.recencyWeight)),payWeight:Math.max(0,Math.min(1,z.payWeight))})}catch{}finally{Wt(!1)}},[]);b.useEffect(()=>{ft&&pa()},[ft,pa]);const jr=async()=>{const{readWeight:T,recencyWeight:z,payWeight:ue}=Pt,we=T+z+ue;if(Math.abs(we-1)>.001){ne.error("三个权重之和必须等于 1");return}Sn(!0);try{const Qe=await Et("/api/db/config",{key:"article_ranking_weights",value:{readWeight:T,recencyWeight:z,payWeight:ue},description:"文章排名算法权重"});Qe&&Qe.success!==!1?(ne.success("排名权重已保存"),Dt(!1),Cn(),ds()):ne.error("保存失败: "+(Qe&&typeof Qe=="object"&&"error"in Qe?Qe.error:""))}catch(Qe){console.error(Qe),ne.error("保存失败")}finally{Sn(!1)}},Dl=b.useCallback(async()=>{St(!0);try{const T=await Le("/api/db/config/full?key=pinned_section_ids",{cache:"no-store"}),z=T&&T.data;Array.isArray(z)&&Be(z)}catch{}finally{St(!1)}},[]),kr=b.useCallback(async()=>{try{const T=await Le("/api/db/persons");T!=null&&T.success&&T.persons&&za(T.persons.map(z=>{const ue=z.deviceGroups,we=Array.isArray(ue)?ue.join(","):ue??"";return{id:z.token??z.personId??"",personId:z.personId,name:z.name,personSource:z.personSource??"",userId:z.userId,aliases:z.aliases??"",label:z.label??"",ckbApiKey:z.ckbApiKey??"",ckbPlanId:z.ckbPlanId,remarkType:z.remarkType,remarkFormat:z.remarkFormat,addFriendInterval:z.addFriendInterval,startTime:z.startTime,endTime:z.endTime,deviceGroups:we}}))}catch{}},[]),$s=b.useCallback(async()=>{try{const T=await Le("/api/db/link-tags");T!=null&&T.success&&T.linkTags&&Fa(T.linkTags.map(z=>({id:z.tagId,label:z.label,url:z.url,type:z.type||"url",appId:z.appId||"",pagePath:z.pagePath||"",hasAppSecret:!!z.hasAppSecret})))}catch{}},[]),_l=b.useCallback(async()=>{try{const T=await Le("/api/db/config/full?key=ckb_lead_webhook_url",{cache:"no-store"});T!=null&&T.success&&typeof T.data=="string"&&ua(T.data)}catch{}},[]),ma=b.useCallback(async()=>{try{const T=await Le("/api/db/ckb-person-leads");if(T!=null&&T.success&&T.byPerson){const z={};for(const ue of T.byPerson)z[ue.token]=ue.total;da(z)}}catch{}},[]),js=b.useCallback(async(T,z,ue=1)=>{Ll(T),Jc(z),Hr(!0),Qc(ue),Vo(!0);try{const we=await Le(`/api/db/ckb-person-leads?token=${encodeURIComponent(T)}&page=${ue}&pageSize=20`);we!=null&&we.success?(Ai(we.records||[]),Wa(we.total||0)):ne.error((we==null?void 0:we.error)||"加载获客详情失败")}catch(we){ne.error(we instanceof Error?we.message:"加载获客详情失败")}finally{Vo(!1)}},[]),Sr=b.useCallback(async()=>{ir(!0);try{const T=new URLSearchParams({page:String(Vr),pageSize:String(Ds)}),z=It.trim();z&&T.set("search",z);const ue=await Le(`/api/db/link-tags?${T.toString()}`);if(ue!=null&&ue.success){const we=Array.isArray(ue.linkTags)?ue.linkTags:[];Br(we.map(Qe=>({id:Qe.tagId,label:Qe.label,aliases:Qe.aliases||"",url:Qe.url,type:Qe.type||"url",appId:Qe.appId||"",pagePath:Qe.pagePath||"",hasAppSecret:!!Qe.hasAppSecret}))),la(typeof ue.total=="number"?ue.total:0),xe(typeof ue.totalPages=="number"&&ue.totalPages>0?ue.totalPages:1)}}catch(T){console.error(T),ne.error("加载链接标签失败")}finally{ir(!1)}},[Vr,Ds,It]),[qa,xa]=b.useState([]),[Gs,ks]=b.useState(""),[Ga,Wr]=b.useState(!1),Yc=b.useRef(null),Oi=b.useCallback(async()=>{try{const T=await Le("/api/admin/linked-miniprograms");T!=null&&T.success&&Array.isArray(T.data)&&xa(T.data.map(z=>({...z,key:z.key})))}catch{}},[]),Ja=qa.filter(T=>!Gs.trim()||T.name.toLowerCase().includes(Gs.toLowerCase())||T.key&&T.key.toLowerCase().includes(Gs.toLowerCase())||T.appId.toLowerCase().includes(Gs.toLowerCase())),Li=async T=>{const z=Ce.includes(T)?Ce.filter(ue=>ue!==T):[...Ce,T];Be(z);try{await Et("/api/db/config",{key:"pinned_section_ids",value:z,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"}),ds()}catch{Be(Ce)}},Di=b.useCallback(async()=>{xt(!0);try{const T=await Le("/api/db/config/full?key=unpaid_preview_percent",{cache:"no-store"}),z=T&&T.data;typeof z=="number"&&z>0&&z<=100&&L(z)}catch{}finally{xt(!1)}},[]),Cr=async()=>{if(vt<1||vt>100){ne.error("预览比例需在 1~100 之间");return}pt(!0);try{const T=await Et("/api/db/config",{key:"unpaid_preview_percent",value:vt,description:"小程序未付费内容默认预览比例(%)"});T&&T.success!==!1?ne.success("预览比例已保存"):ne.error("保存失败: "+(T.error||""))}catch{ne.error("保存失败")}finally{pt(!1)}},Qa=b.useCallback(async()=>{en(!0);try{const T=await Le("/api/db/config/full?key=read_preview_ui",{cache:"no-store"}),z=T&&T.data;z!=null&&typeof z=="object"&&!Array.isArray(z)&&Object.keys(z).length>0?At(JSON.stringify(z,null,2)):At(rg)}catch{At(rg)}finally{en(!1)}},[]),Ya=async()=>{let T;try{T=JSON.parse(at)}catch{ne.error("JSON 格式错误,请检查括号与引号");return}Ws(!0);try{const z=await Et("/api/db/config",{key:"read_preview_ui",value:T,description:"阅读页/朋友圈付费墙与分享文案(占位符 {percent} {price})"});z&&z.success!==!1?ne.success("阅读页文案已保存"):ne.error("保存失败: "+(z.error||""))}catch{ne.error("保存失败")}finally{Ws(!1)}};b.useEffect(()=>{Dl(),Di(),Qa(),kr(),$s(),ma(),Oi(),_l()},[Dl,Di,Qa,kr,$s,ma,Oi,_l]),b.useEffect(()=>{Sr()},[Sr]);const _i=async T=>{Fe({section:T,orders:[]}),kt(!0);try{const z=await Le(`/api/db/book?action=section-orders&id=${encodeURIComponent(T.id)}`),ue=z!=null&&z.success&&Array.isArray(z.orders)?z.orders:[];Fe(we=>we?{...we,orders:ue}:null)}catch(z){console.error(z),Fe(ue=>ue?{...ue,orders:[]}:null)}finally{kt(!1)}},ga=async T=>{x(!0);try{const z=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 Le(z);if(ue!=null&&ue.success&&ue.section){const we=ue.section,Qe=we.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:we.isNew??T.isNew,isPinned:Ce.includes(T.id),hotScore:T.hotScore??0,editionStandard:Qe?!1:we.editionStandard??!0,editionPremium:Qe})}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:Ce.includes(T.id),hotScore:T.hotScore??0,editionStandard:!0,editionPremium:!1}),ue&&!ue.success&&ne.error("无法读取文件内容: "+(ue.error||"未知错误"))}catch(z){console.error(z),u({id:T.id,title:T.title,price:T.price,content:"",filePath:T.filePath,isFree:T.isFree})}finally{x(!1)}},zi=async()=>{var T;if(c){v(!0);try{let z=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 Zn of ue)z=z.replace(Zn,"");z=z.replace(/^\s*\n+/,"").trim();const we=c.originalId||c.id,Qe=c.id!==we,dt=await Zt("/api/db/book",{id:we,...Qe?{newId:c.id}:{},title:c.title,price:c.isFree?0:c.price,content:z,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:g1}),Ot=Qe?c.id:we;c.isPinned!==Ce.includes(Ot)&&await Li(Ot),dt&&dt.success!==!1?(ne.success(`已保存:${c.title}`),u(null),Cn(),kr(),$s()):ne.error("保存失败: "+(dt&&typeof dt=="object"&&"error"in dt?dt.error:"未知错误"))}catch(z){console.error(z);const ue=z instanceof Error&&z.name==="AbortError"?"保存超时,请检查网络或稍后重试":"保存失败";ne.error(ue)}finally{v(!1)}}},Ho=async()=>{if(!O.id||!O.title){ne.error("请填写章节ID和标题");return}v(!0);try{const T=Bn.find(we=>we.id===O.partId),z=T==null?void 0:T.chapters.find(we=>we.id===O.chapterId),ue=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:(z==null?void 0:z.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:g1});if(ue&&ue.success!==!1){if(O.isPinned){const we=[...Ce,O.id];Be(we);try{await Et("/api/db/config",{key:"pinned_section_ids",value:we,description:"强制置顶章节ID列表(精选推荐/首页最新更新)"})}catch{}}ne.success(`章节创建成功:${O.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}),Cn(),kr(),$s()}else ne.error("创建失败: "+(ue&&typeof ue=="object"&&"error"in ue?ue.error:"未知错误"))}catch(T){console.error(T),ne.error("创建失败")}finally{v(!1)}},us=T=>{q(z=>{var ue;return{...z,partId:T.id,chapterId:((ue=T.chapters[0])==null?void 0:ue.id)??"chapter-1"}}),f(!0)},Kr=T=>{V({id:T.id,title:T.title})},$i=async()=>{var T;if((T=$==null?void 0:$.title)!=null&&T.trim()){te(!0);try{const z=e.map(we=>({id:we.id,partId:we.partId||"part-1",partTitle:we.partId===$.id?$.title.trim():we.partTitle||"",chapterId:we.chapterId||"chapter-1",chapterTitle:we.chapterTitle||""})),ue=await Zt("/api/db/book",{action:"reorder",items:z});if(ue&&ue.success!==!1){const we=$.title.trim();n(Qe=>Qe.map(dt=>dt.partId===$.id?{...dt,partTitle:we}:dt)),V(null),Cn()}else ne.error("更新篇名失败: "+(ue&&typeof ue=="object"&&"error"in ue?ue.error:"未知错误"))}catch(z){console.error(z),ne.error("更新篇名失败")}finally{te(!1)}}},ya=T=>{const z=T.chapters.length+1,ue=`chapter-${T.id}-${z}-${Date.now()}`;q({id:`${z}.1`,title:"新章节",price:1,partId:T.id,chapterId:ue,content:"",editionStandard:!0,editionPremium:!1,isFree:!1,isNew:!1,isPinned:!1,hotScore:0}),f(!0)},zl=(T,z)=>{const ue=z.sections;let we=1,Qe=!1,dt=!1;if(ue.length>0){const Ot=typeof ue[0].price=="number"?ue[0].price:Number(ue[0].price)||1,Zn=!!(ue[0].isFree||Ot===0);dt=ue.some(va=>{const On=typeof va.price=="number"?va.price:Number(va.price)||1,Tr=!!(va.isFree||On===0);return On!==Ot||Tr!==Zn}),we=Zn?0:Ot,Qe=Zn}ae({part:T,chapter:z,title:z.title,price:we,isFree:Qe,priceMixed:dt,initialTitle:z.title,initialPrice:we,initialIsFree:Qe})},Fi=async()=>{var Qe;if(!((Qe=re==null?void 0:re.title)!=null&&Qe.trim()))return;const T=re,z=T.title.trim(),ue=z!==T.initialTitle,we=T.isFree!==T.initialIsFree||!T.isFree&&Number(T.price)!==Number(T.initialPrice);if(!ue&&!we){ne.info("未修改任何内容"),ae(null);return}if(T.priceMixed&&we){const dt=T.chapter.sections.length,Ot=T.isFree?"全部设为免费":`全部设为 ¥${T.price}`;if(!confirm(`本章 ${dt} 节当前定价不一致,保存后将${Ot},确定?`))return}F(!0);try{if(ue){const dt=e.map(On=>({id:On.id,partId:On.partId||T.part.id,partTitle:On.partId===T.part.id?T.part.title:On.partTitle||"",chapterId:On.chapterId||T.chapter.id,chapterTitle:On.partId===T.part.id&&On.chapterId===T.chapter.id?z:On.chapterTitle||""})),Ot=await Zt("/api/db/book",{action:"reorder",items:dt});if(Ot&&Ot.success===!1){ne.error("保存章节名失败: "+(Ot&&typeof Ot=="object"&&"error"in Ot?Ot.error:"未知错误"));return}const Zn=T.part.id,va=T.chapter.id;n(On=>On.map(Tr=>Tr.partId===Zn&&Tr.chapterId===va?{...Tr,chapterTitle:z}:Tr))}if(we){const dt=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(dt&&dt.success===!1){ne.error("保存定价失败: "+(dt&&typeof dt=="object"&&"error"in dt?dt.error:"未知错误")),ue&&Cn();return}}ae(null),Cn(),ne.success("已保存")}catch(dt){console.error(dt),ne.error("保存失败")}finally{F(!1)}},Bi=async(T,z)=>{const ue=z.sections.map(we=>we.id);if(ue.length===0){ne.info("该章下无小节,无需删除");return}if(confirm(`确定要删除「第${T.chapters.indexOf(z)+1}章 | ${z.title}」吗?将删除共 ${ue.length} 节,此操作不可恢复。`))try{for(const we of ue)await gi(`/api/db/book?id=${encodeURIComponent(we)}`);Cn()}catch(we){console.error(we),ne.error("删除失败")}},ba=async()=>{if(!le.trim()){ne.error("请输入篇名");return}ye(!0);try{const T=`part-new-${Date.now()}`,z="chapter-1",ue=`part-placeholder-${Date.now()}`,we=await Zt("/api/db/book",{id:ue,title:"占位节(可编辑)",price:0,content:"",partId:T,partTitle:le.trim(),chapterId:z,chapterTitle:"第1章 | 待编辑",saveToFile:!1});we&&we.success!==!1?(ne.success(`篇「${le}」创建成功`),B(!1),de(""),Cn()):ne.error("创建失败: "+(we&&typeof we=="object"&&"error"in we?we.error:"未知错误"))}catch(T){console.error(T),ne.error("创建失败")}finally{ye(!1)}},Xa=async()=>{if(D.length===0){ne.error("请先勾选要移动的章节");return}const T=Bn.find(ue=>ue.id===_),z=T==null?void 0:T.chapters.find(ue=>ue.id===H);if(!T||!z||!_||!H){ne.error("请选择目标篇和章");return}X(!0);try{const ue=()=>{const Ot=new Set(D),Zn=e.map(Kn=>({id:Kn.id,partId:Kn.partId||"",partTitle:Kn.partTitle||"",chapterId:Kn.chapterId||"",chapterTitle:Kn.chapterTitle||""})),va=Zn.filter(Kn=>Ot.has(Kn.id)).map(Kn=>({...Kn,partId:_,partTitle:T.title||_,chapterId:H,chapterTitle:z.title||H})),On=Zn.filter(Kn=>!Ot.has(Kn.id));let Tr=On.length;for(let Kn=On.length-1;Kn>=0;Kn-=1){const vu=On[Kn];if(vu.partId===_&&vu.chapterId===H){Tr=Kn+1;break}}return[...On.slice(0,Tr),...va,...On.slice(Tr)]},we=async()=>{const Ot=ue(),Zn=await Zt("/api/db/book",{action:"reorder",items:Ot});return Zn&&Zn.success!==!1?(ne.success(`已移动 ${D.length} 节到「${T.title}」-「${z.title}」`),G(!1),P([]),await Cn(),!0):!1},Qe={action:"move-sections",sectionIds:D,targetPartId:_,targetChapterId:H,targetPartTitle:T.title||_,targetChapterTitle:z.title||H},dt=await Zt("/api/db/book",Qe);if(dt&&dt.success!==!1)ne.success(`已移动 ${dt.count??D.length} 节到「${T.title}」-「${z.title}」`),G(!1),P([]),await Cn();else{const Ot=dt&&typeof dt=="object"&&"error"in dt?dt.error||"":"未知错误";if((Ot.includes("缺少 id")||Ot.includes("无效的 action"))&&await we())return;ne.error("移动失败: "+Ot)}}catch(ue){console.error(ue),ne.error("移动失败: "+(ue instanceof Error?ue.message:"网络或服务异常"))}finally{X(!1)}},A=T=>{P(z=>z.includes(T)?z.filter(ue=>ue!==T):[...z,T])},je=async T=>{const z=e.filter(ue=>ue.partId===T.id).map(ue=>ue.id);if(z.length===0){ne.info("该篇下暂无小节可删除");return}if(confirm(`确定要删除「${T.title}」整篇吗?将删除共 ${z.length} 节内容,此操作不可恢复。`))try{for(const ue of z)await gi(`/api/db/book?id=${encodeURIComponent(ue)}`);Cn()}catch(ue){console.error(ue),ne.error("删除失败")}},Ae=async()=>{var T;if(N.trim()){R(!0);try{const z=await Le(`/api/search?q=${encodeURIComponent(N)}`);z!=null&&z.success&&((T=z.data)!=null&&T.results)?E(z.data.results):(E([]),z&&!z.success&&ne.error("搜索失败: "+z.error))}catch(z){console.error(z),E([]),ne.error("搜索失败")}finally{R(!1)}}},$e=Bn.find(T=>T.id===O.partId),et=($e==null?void 0:$e.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:["共 ",Bn.length," 篇 · ",Ri," 节内容"]})]}),s.jsx("div",{className:"flex gap-2",children:s.jsxs(Y,{onClick:()=>Dt(!0),variant:"outline",className:"border-amber-500/50 text-amber-400 hover:bg-amber-500/10 bg-transparent",children:[s.jsx(gh,{className:"w-4 h-4 mr-2"}),"排名算法"]})})]}),s.jsx(Bt,{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(Vt,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(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(ee,{className:"text-gray-300",children:"章节ID *"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 9.15",value:O.id,onChange:T=>q({...O,id:T.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"价格 (元)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:O.isFree?0:O.price,onChange:T=>q({...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(ee,{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=>q({...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(ee,{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=>q({...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(ee,{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=>q({...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(ee,{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:()=>q({...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:()=>q({...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(ee,{className:"text-gray-300",children:"热度分"}),s.jsx(ce,{type:"number",step:"0.1",min:"0",className:"bg-[#0a1628] border-gray-700 text-white",value:O.hotScore??0,onChange:T=>q({...O,hotScore:Math.max(0,parseFloat(T.target.value)||0)})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"章节标题 *"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"输入章节标题",value:O.title,onChange:T=>q({...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(ee,{className:"text-gray-300",children:"所属篇"}),s.jsxs(xc,{value:O.partId,onValueChange:T=>{var ue;const z=Bn.find(we=>we.id===T);q({...O,partId:T,chapterId:((ue=z==null?void 0:z.chapters[0])==null?void 0:ue.id)??"chapter-1"})},children:[s.jsx(al,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(gc,{})}),s.jsxs(il,{className:"bg-[#0f2137] border-gray-700",children:[Bn.map(T=>s.jsx(tr,{value:T.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:T.title},T.id)),Bn.length===0&&s.jsx(tr,{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(ee,{className:"text-gray-300",children:"所属章"}),s.jsxs(xc,{value:O.chapterId,onValueChange:T=>q({...O,chapterId:T}),children:[s.jsx(al,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(gc,{})}),s.jsxs(il,{className:"bg-[#0f2137] border-gray-700",children:[et.map(T=>s.jsx(tr,{value:T.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:T.title},T.id)),et.length===0&&s.jsx(tr,{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(ee,{className:"text-gray-300",children:"内容(富文本编辑器,支持 @链接AI人物 和 #链接标签)"}),s.jsx(l0,{content:O.content||"",onChange:T=>q({...O,content:T}),onImageUpload:Tt,onMediaUpload:ha,persons:Fr,linkTags:$a,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(xn,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[s.jsx(Y,{variant:"outline",onClick:()=>f(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(Y,{onClick:Ho,disabled:y||!O.id||!O.title,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:y?s.jsxs(s.Fragment,{children:[s.jsx(Ve,{className:"w-4 h-4 mr-2 animate-spin"}),"创建中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Dn,{className:"w-4 h-4 mr-2"}),"创建章节"]})})]})]})}),s.jsx(Bt,{open:!!$,onOpenChange:T=>!T&&V(null),children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(tn,{className:"w-5 h-5 text-[#38bdac]"}),"编辑篇名"]})}),$&&s.jsx("div",{className:"space-y-4 py-4",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"篇名"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:$.title,onChange:T=>V({...$,title:T.target.value}),placeholder:"输入篇名"})]})}),s.jsxs(xn,{children:[s.jsx(Y,{variant:"outline",onClick:()=>V(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(Y,{onClick:$i,disabled:I||!((gt=$==null?void 0:$.title)!=null&>.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:I?s.jsxs(s.Fragment,{children:[s.jsx(Ve,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(kn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Bt,{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(Vt,{children:[s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(tn,{className:"w-5 h-5 text-[#38bdac]"}),"章节设置"]}),s.jsx("p",{className:"text-gray-400 text-sm font-normal pt-1",children:"修改本章显示名称,或为本章下全部节设置统一金额(仍可在单节编辑里单独改某一节)。"})]}),re&&s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"章节名称(如:第8章|底层结构)"}),s.jsx(ce,{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(ee,{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(ce,{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(xn,{children:[s.jsx(Y,{variant:"outline",onClick:()=>ae(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(Y,{onClick:Fi,disabled:J||!((Nn=re==null?void 0:re.title)!=null&&Nn.trim()),className:"bg-[#38bdac] hover:bg-[#2da396] 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(kn,{className:"w-4 h-4 mr-2"}),"保存"]})})]})]})}),s.jsx(Bt,{open:oe,onOpenChange:T=>{var z;if(G(T),T&&Bn.length>0){const ue=Bn[0];U(ue.id),K(((z=ue.chapters[0])==null?void 0:z.id)??"")}},children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Vt,{children:s.jsx(Ht,{className:"text-white",children:"批量移动至指定目录"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("p",{className:"text-gray-400 text-sm",children:["已选 ",s.jsx("span",{className:"text-[#38bdac] font-medium",children:D.length})," 节,请选择目标篇与章。"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"目标篇"}),s.jsxs(xc,{value:_,onValueChange:T=>{var ue;U(T);const z=Bn.find(we=>we.id===T);K(((ue=z==null?void 0:z.chapters[0])==null?void 0:ue.id)??"")},children:[s.jsx(al,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(gc,{placeholder:"选择篇"})}),s.jsx(il,{className:"bg-[#0f2137] border-gray-700",children:Bn.map(T=>s.jsx(tr,{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(ee,{className:"text-gray-300",children:"目标章"}),s.jsxs(xc,{value:H,onValueChange:K,children:[s.jsx(al,{className:"bg-[#0a1628] border-gray-700 text-white",children:s.jsx(gc,{placeholder:"选择章"})}),s.jsx(il,{className:"bg-[#0f2137] border-gray-700",children:(((ct=Bn.find(T=>T.id===_))==null?void 0:ct.chapters)??[]).map(T=>s.jsx(tr,{value:T.id,className:"text-white hover:bg-[#38bdac]/20 focus:bg-[#38bdac]/20",children:T.title},T.id))})]})]})]}),s.jsxs(xn,{children:[s.jsx(Y,{variant:"outline",onClick:()=>G(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(Y,{onClick:Xa,disabled:me||D.length===0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:me?s.jsxs(s.Fragment,{children:[s.jsx(Ve,{className:"w-4 h-4 mr-2 animate-spin"}),"移动中..."]}):"确认移动"})]})]})}),s.jsx(Bt,{open:!!Se,onOpenChange:T=>!T&&Fe(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(Vt,{children:s.jsxs(Ht,{className:"text-white",children:["付款记录 — ",(Se==null?void 0:Se.section.title)??""]})}),s.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:mt?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:"加载中..."})]}):Se&&Se.orders.length===0?s.jsx("p",{className:"text-gray-500 text-center py-6",children:"暂无付款记录"}):Se?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:Se.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 z=T.userId??T.openId??"-";return z.length>12?z.slice(0,6)+"..."+z.slice(-4):z})()})}),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(Bt,{open:ft,onOpenChange:Dt,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(gh,{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)"}),yn?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(ee,{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:Pt.readWeight,onChange:T=>Rn(z=>({...z,readWeight:Math.max(0,Math.min(1,parseFloat(T.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{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:Pt.recencyWeight,onChange:T=>Rn(z=>({...z,recencyWeight:Math.max(0,Math.min(1,parseFloat(T.target.value)||0))}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{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:Pt.payWeight,onChange:T=>Rn(z=>({...z,payWeight:Math.max(0,Math.min(1,parseFloat(T.target.value)||0))}))})]})]}),s.jsxs("p",{className:"text-xs text-gray-500",children:["当前之和: ",(Pt.readWeight+Pt.recencyWeight+Pt.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(Y,{onClick:jr,disabled:Xt||Math.abs(Pt.readWeight+Pt.recencyWeight+Pt.payWeight-1)>.001,className:"w-full bg-amber-500 hover:bg-amber-600 text-white",children:Xt?"保存中...":"保存权重"})]})]})]})}),s.jsx(Bt,{open:Q,onOpenChange:B,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-md",showCloseButton:!0,children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(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(ee,{className:"text-gray-300",children:"篇名(如:第六篇|真实的社会)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",value:le,onChange:T=>de(T.target.value),placeholder:"输入篇名"})]})}),s.jsxs(xn,{children:[s.jsx(Y,{variant:"outline",onClick:()=>{B(!1),de("")},className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsx(Y,{onClick:ba,disabled:ve||!le.trim(),className:"bg-amber-500 hover:bg-amber-600 text-white",children:ve?s.jsxs(s.Fragment,{children:[s.jsx(Ve,{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(Bt,{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(Vt,{className:"shrink-0 px-6 pt-6 pb-2",children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(tn,{className:"w-5 h-5 text-[#38bdac]"}),"编辑章节"]})}),c&&s.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0 px-6 space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{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(ee,{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(ee,{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(ee,{className:"text-gray-300",children:"预览%"}),s.jsx(ce,{type:"number",min:0,max:100,className:"bg-[#0a1628] border-gray-700 text-white",placeholder:`全局 ${vt}%`,value:c.previewPercent??"",onChange:T=>{const z=T.target.value===""?void 0:Math.min(100,Math.max(0,Number(T.target.value)));u({...c,previewPercent:z})}})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{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(ee,{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(ee,{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(ee,{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(ee,{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(ee,{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(ee,{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(l0,{ref:Ii,content:c.content||"",onChange:T=>u({...c,content:T}),onImageUpload:Tt,onMediaUpload:ha,persons:Fr,linkTags:$a,placeholder:"开始编辑内容... 输入 @ 可链接AI人物,工具栏可插入 #链接标签"})]})]}),s.jsxs(xn,{className:"shrink-0 px-6 py-4 border-t border-gray-700/50",children:[c&&s.jsxs(Y,{variant:"outline",onClick:()=>_i({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(rr,{className:"w-4 h-4 mr-2"}),"付款记录"]}),s.jsxs(Y,{variant:"outline",onClick:()=>u(null),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:[s.jsx(ss,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsx(Y,{onClick:zi,disabled:y,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:y?s.jsxs(s.Fragment,{children:[s.jsx(Ve,{className:"w-4 h-4 mr-2 animate-spin"}),"保存中..."]}):s.jsxs(s.Fragment,{children:[s.jsx(kn,{className:"w-4 h-4 mr-2"}),"保存修改"]})})]})]})}),s.jsxs(Ic,{defaultValue:"chapters",className:"space-y-6",children:[s.jsxs(vl,{className:"bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(nn,{value:"chapters",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(rr,{className:"w-4 h-4 mr-2"}),"章节管理"]}),s.jsxs(nn,{value:"ranking",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(gg,{className:"w-4 h-4 mr-2"}),"内容排行榜"]}),s.jsxs(nn,{value:"search",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400",children:[s.jsx(Aa,{className:"w-4 h-4 mr-2"}),"内容搜索"]}),s.jsxs(nn,{value:"link-person",className:"data-[state=active]:bg-purple-500/20 data-[state=active]:text-purple-400 text-gray-400",children:[s.jsx(Ea,{className:"w-4 h-4 mr-2"}),"链接人与事"]}),s.jsxs(nn,{value:"link-tag",className:"data-[state=active]:bg-amber-500/20 data-[state=active]:text-amber-400 text-gray-400",children:[s.jsx(f1,{className:"w-4 h-4 mr-2"}),"链接标签"]})]}),s.jsxs(sn,{value:"chapters",className:"space-y-4",children:[s.jsxs("div",{className:"rounded-2xl border border-gray-700/50 bg-[#1C1C1E] p-4 flex items-center justify-between shadow-sm",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#38bdac] flex items-center justify-center text-white shadow-lg shadow-[#38bdac]/20 shrink-0",children:s.jsx(rr,{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:Ri}),s.jsx("span",{className:"text-xs text-gray-500",children:"章节"})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs(Y,{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(Y,{onClick:()=>B(!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(Y,{variant:"outline",onClick:()=>G(!0),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:["批量移动(已选 ",D.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:Bn,expandedParts:i,onTogglePart:lr,onReorder:cr,onReadSection:ga,onDeleteSection:fa,onAddSectionInPart:us,onAddChapterInPart:ya,onDeleteChapter:Bi,onEditPart:Kr,onDeletePart:je,onEditChapter:zl,selectedSectionIds:D,onToggleSectionSelect:A,onShowSectionOrders:_i,pinnedSectionIds:Ce})]}),s.jsx(sn,{value:"search",className:"space-y-4",children:s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(it,{children:s.jsx(ot,{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:N,onChange:T=>w(T.target.value),onKeyDown:T=>T.key==="Enter"&&Ae()}),s.jsx(Y,{onClick:Ae,disabled:C||!N.trim(),className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:C?s.jsx(Ve,{className:"w-4 h-4 animate-spin"}):s.jsx(Aa,{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:()=>ga({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}),Ce.includes(T.id)&&s.jsx(bc,{className:"w-3 h-3 text-amber-400 fill-amber-400 shrink-0"})]}),s.jsx(Ue,{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(sn,{value:"ranking",className:"space-y-4",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(it,{className:"pb-3",children:s.jsxs(ot,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(gh,{className:"w-4 h-4 text-[#38bdac]"}),"内容显示规则"]})}),s.jsxs(_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(ee,{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:vt,onChange:T=>L(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(Y,{size:"sm",onClick:Cr,disabled:Rt,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:Rt?"保存中...":"保存"}),s.jsxs("span",{className:"text-xs text-gray-500",children:["小程序未付费用户默认显示文章前 ",vt,"% 内容;章节「预览%」可单独覆盖"]})]}),s.jsxs("div",{className:"mt-6 space-y-2",children:[s.jsx(ee,{className:"text-gray-400 text-sm",children:"阅读页 / 朋友圈文案(JSON)"}),s.jsxs("p",{className:"text-xs text-gray-500",children:["占位符:",s.jsx("code",{className:"text-gray-400",children:"{percent}"})," 为预览比例、",s.jsx("code",{className:"text-gray-400",children:"{price}"})," 为章节价;与小程序付费墙、复制发圈、单页模式弹窗一致。"]}),s.jsx(To,{className:"bg-[#0a1628] border-gray-700 text-gray-200 font-mono text-xs min-h-[280px]",value:at,onChange:T=>At(T.target.value),disabled:Kt,spellCheck:!1}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx(Y,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-300",onClick:()=>Qa(),disabled:Kt,children:"重新加载"}),s.jsx(Y,{type:"button",size:"sm",onClick:Ya,disabled:ls||Kt,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:ls?"保存中...":"保存文案配置"})]})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsx(it,{className:"pb-3",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs(ot,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(gg,{className:"w-4 h-4 text-amber-400"}),"内容排行榜",s.jsxs("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["按热度排行 · 共 ",Mt.length," 节"]})]}),s.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>ds(),disabled:bn,className:"text-gray-400 hover:text-white h-7 w-7 p-0",title:"刷新排行榜",children:s.jsx(Ve,{className:`w-4 h-4 ${bn?"animate-spin":""}`})}),s.jsx(Y,{variant:"ghost",size:"sm",disabled:Fn<=1||bn,onClick:()=>Wn(T=>Math.max(1,T-1)),className:"text-gray-400 hover:text-white h-7 w-7 p-0",children:s.jsx(u5,{className:"w-4 h-4"})}),s.jsxs("span",{className:"text-gray-400 min-w-[60px] text-center",children:[Fn," / ",Ur]}),s.jsx(Y,{variant:"ghost",size:"sm",disabled:Fn>=Ur||bn,onClick:()=>Wn(T=>Math.min(Ur,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:"编辑"})]}),wr.map((T,z)=>{const ue=(Fn-1)*Ka+z+1,we=T.isPinned??Ce.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 ${we?"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(Y,{variant:"ghost",size:"sm",className:`h-6 w-6 p-0 ${we?"text-amber-400":"text-gray-600 hover:text-amber-400"}`,onClick:()=>Li(T.id),disabled:Ze,title:we?"取消置顶":"强制置顶(精选推荐/首页最新更新)",children:we?s.jsx(bc,{className:"w-3.5 h-3.5 fill-current"}):s.jsx(_M,{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(Y,{variant:"ghost",size:"sm",className:"text-gray-500 hover:text-[#38bdac] h-6 px-1",onClick:()=>ga({id:T.id,mid:T.mid,title:T.title,price:T.price,filePath:""}),title:"编辑文章",children:s.jsx(tn,{className:"w-3 h-3"})})})]},T.id)}),wr.length===0&&s.jsx("div",{className:"py-8 text-center text-gray-500",children:"暂无数据"})]})})]})]}),s.jsxs(sn,{value:"link-person",className:"space-y-4",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{className:"pb-3",children:[s.jsxs(ot,{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(Y,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 hover:bg-gray-700/50",onClick:()=>{kr()},title:"刷新",children:s.jsx(Ve,{className:"w-4 h-4"})}),s.jsxs(Y,{size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",onClick:()=>{ca(null),Fo(!0)},children:[s.jsx(Dn,{className:"w-4 h-4 mr-2"}),"添加"]})]})]}),s.jsx("div",{className:"max-h-[400px] overflow-y-auto",children:Fr.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:Fr.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:()=>{Ha[T.id]&&js(T.id,T.name)},title:Ha[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 z=Ha[T.id]||0;return s.jsx("td",{className:`py-2 px-3 shrink-0 w-16 text-center text-xs font-bold cursor-pointer ${z>0?"text-green-400 hover:text-green-300 hover:underline":"text-gray-600"}`,title:z>0?"点击查看获客详情":"暂无获客",onClick:()=>{z>0&&js(T.id,T.name)},children:z})})(),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(Y,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-[#38bdac] h-6 px-2",title:"编辑",onClick:async()=>{try{const z=await G9(T.personId||"");if(z!=null&&z.success&&z.person){const ue=z.person;ca({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 ca(T),z!=null&&z.error&&ne.error(z.error)}catch(z){console.error(z),ca(T),ne.error(z instanceof Error?z.message:"加载人物详情失败")}Fo(!0)},children:s.jsx(p1,{className:"w-3 h-3"})}),s.jsx(Y,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-green-400 h-6 px-2",title:"查看新客户",onClick:()=>js(T.id,T.name),children:s.jsx(_n,{className:"w-3 h-3"})}),s.jsx(Y,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-6 px-2",title:T.personSource==="vip_sync"?"删除本地 @人物(不删统一获客计划)":"删除(同时删除存客宝对应获客计划)",onClick:()=>Ei(T),children:s.jsx(ss,{className:"w-3 h-3"})})]})})]},T.id))})]}):s.jsx("div",{className:"text-gray-500 text-sm py-4 text-center",children:"暂无AI人物,添加后可在编辑器中 @链接"})})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{className:"pb-3",children:[s.jsxs(ot,{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(ee,{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(ee,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{className:"pb-3",children:[s.jsxs(ot,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(gh,{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(ee,{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:zs,onChange:T=>ua(T.target.value)})]}),s.jsxs(Y,{size:"sm",className:"bg-blue-500 hover:bg-blue-600 text-white h-8",onClick:async()=>{const T=zs.trim();try{const z=await Et("/api/db/config",{key:"ckb_lead_webhook_url",value:T,description:"获客线索 Webhook 通知 URL(企微/飞书)"});z!=null&&z.success?ne.success(T?"Webhook 已保存":"Webhook 已清除"):ne.error((z==null?void 0:z.error)??"保存失败")}catch{ne.error("保存失败")}},children:[s.jsx(kn,{className:"w-3.5 h-3.5 mr-1"}),"保存"]})]}),s.jsx("p",{className:"text-xs text-gray-500",children:"配置企业微信或飞书群机器人 Webhook URL,获客成功后自动推送通知"})]})]})]}),s.jsxs(sn,{value:"link-tag",className:"space-y-4",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{className:"pb-3",children:[s.jsxs(ot,{className:"text-white text-base flex items-center gap-2",children:[s.jsx(f1,{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(ee,{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:It,onChange:T=>{$t(T.target.value),Ls(1)}})]}),s.jsx(Y,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 hover:bg-gray-700/50 h-8",onClick:()=>{$s(),Sr()},title:"刷新",children:s.jsx(Ve,{className:"w-4 h-4"})})]}),s.jsxs(Y,{size:"sm",className:"bg-amber-500 hover:bg-amber-600 text-white h-8",onClick:()=>{Ba(null),vn({tagId:"",label:"",aliases:"",url:"",type:"url",appId:"",appSecret:"",pagePath:""}),ks(""),Wr(!1),Xn(!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:yr?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:"加载中..."})}):oa.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-500",children:"暂无链接标签,添加后可在编辑器中使用 #标签 跳转"})}):oa.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:()=>{Ba(T),vn({tagId:T.id,label:T.label,aliases:T.aliases??"",url:T.url,type:T.type,appId:T.appId??"",appSecret:"",pagePath:T.pagePath??""}),ks(T.appId??""),Wr(!1),Xn(!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(Ue,{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 z=qa.find(ue=>ue.key===T.appId);return s.jsxs(s.Fragment,{children:[z&&s.jsx("div",{className:"text-xs text-white",children:z.name}),s.jsxs("div",{className:"text-xs font-mono text-[#38bdac]",children:["AppID: ",(z==null?void 0:z.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(wi,{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(Y,{variant:"ghost",size:"sm",className:"text-gray-300 hover:text-white h-7 px-2",onClick:()=>{Ba(T),vn({tagId:T.id,label:T.label,aliases:T.aliases??"",url:T.url,type:T.type,appId:T.appId??"",appSecret:"",pagePath:T.pagePath??""}),ks(T.appId??""),Wr(!1),Xn(!0)},title:"编辑",children:s.jsx(p1,{className:"w-3 h-3"})}),s.jsx(Y,{variant:"ghost",size:"sm",className:"text-red-400 hover:text-red-300 h-7 px-2",onClick:async()=>{if(confirm(`确定要删除「#${T.label}」吗?`))try{const z=await gi(`/api/db/link-tags?tagId=${encodeURIComponent(T.id)}`);z!=null&&z.success?(ne.success("已删除"),$s(),Sr()):ne.error((z==null?void 0:z.error)??"删除失败")}catch(z){console.error(z),ne.error("删除失败")}},title:"删除",children:s.jsx(ss,{className:"w-3 h-3"})})]})})]},T.id))})]})}),s.jsx(sr,{page:Vr,pageSize:Ds,total:br,totalPages:ie,onPageChange:T=>Ls(T),onPageSizeChange:T=>{or(T),Ls(1)}})]})]})]}),s.jsx(Bt,{open:Yn,onOpenChange:Xn,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg p-4 gap-3",children:[s.jsxs(Vt,{className:"gap-1",children:[s.jsx(Ht,{className:"text-base",children:Ks?"编辑链接标签":"添加链接标签"}),s.jsx(of,{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(ee,{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:Ct.tagId,disabled:!!Ks,onChange:T=>vn(z=>({...z,tagId:T.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{className:"text-gray-300 text-sm",children:"显示文字"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"如 神仙团队",value:Ct.label,onChange:T=>vn(z=>({...z,label:T.target.value}))})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{className:"text-gray-300 text-sm",children:"别名(多个用逗号分隔,同指向一个目标)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"如 团队招募, 团队合伙人",value:Ct.aliases,onChange:T=>vn(z=>({...z,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(ee,{className:"text-gray-300 text-sm",children:"类型"}),s.jsxs(xc,{value:Ct.type,onValueChange:T=>vn(z=>({...z,type:T})),children:[s.jsx(al,{className:"bg-[#0a1628] border-gray-700 text-white h-8",children:s.jsx(gc,{})}),s.jsxs(il,{className:"bg-[#0f2137] border-gray-700 text-white",children:[s.jsx(tr,{value:"url",children:"网页链接"}),s.jsx(tr,{value:"miniprogram",children:"小程序(API跳转)"}),s.jsx(tr,{value:"wxlink",children:"小程序链接(右上角复制)"}),s.jsx(tr,{value:"ckb",children:"存客宝"})]})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{className:"text-gray-300 text-sm",children:Ct.type==="url"?"URL地址":Ct.type==="ckb"?"存客宝计划URL":Ct.type==="wxlink"?"小程序链接":"小程序 mpKey / 微信 AppID"}),Ct.type==="wxlink"?s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"粘贴小程序右上角 ... → 复制链接 得到的 URL",value:Ct.url,onChange:T=>vn(z=>({...z,url:T.target.value}))}):Ct.type==="miniprogram"&&qa.length>0?s.jsxs("div",{ref:Yc,className:"relative",children:[s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white h-8 text-sm",placeholder:"搜索名称或密钥",value:Ga?Gs:Ct.appId,onChange:T=>{const z=T.target.value;ks(z),Wr(!0),qa.some(ue=>ue.key===z)||vn(ue=>({...ue,appId:z}))},onFocus:()=>{ks(Ct.appId),Wr(!0)},onBlur:()=>setTimeout(()=>Wr(!1),150)}),Ga&&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:Ja.length===0?s.jsx("div",{className:"px-3 py-2 text-gray-500 text-xs",children:"无匹配,可手动输入密钥"}):Ja.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:z=>{z.preventDefault(),vn(ue=>({...ue,appId:T.key,pagePath:T.path||""})),ks(""),Wr(!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:Ct.type==="url"?"https://...":Ct.type==="ckb"?"https://ckbapi.quwanzhi.com/...":"关联配置的 key,或直接填 wx 开头的 AppID",value:Ct.type==="url"||Ct.type==="ckb"?Ct.url:Ct.appId,onChange:T=>{Ct.type==="url"||Ct.type==="ckb"?vn(z=>({...z,url:T.target.value})):vn(z=>({...z,appId:T.target.value}))}})]})]}),Ct.type==="wxlink"&&s.jsx("p",{className:"text-[11px] text-amber-400/80 leading-snug px-0.5",children:"操作:打开目标小程序 → 右上角「...」→「复制链接」→ 粘贴到上面。小程序内点击此标签会在 web-view 中打开,微信自动唤起目标小程序,无需修改小程序版本。"}),Ct.type==="miniprogram"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{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:Ct.pagePath,onChange:T=>vn(z=>({...z,pagePath:T.target.value}))})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{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:Ks!=null&&Ks.hasAppSecret?"已保存密钥,留空不改;填写则覆盖":"粘贴目标小程序 AppSecret",value:Ct.appSecret,onChange:T=>vn(z=>({...z,appSecret:T.target.value}))}),s.jsx("p",{className:"text-[11px] text-gray-500 leading-snug",children:"与 AppID 成对落库;接口响应与小程序配置中均不会返回此字段。"})]})]})]}),s.jsxs(xn,{className:"gap-2 pt-1",children:[s.jsx(Y,{variant:"outline",onClick:()=>Xn(!1),className:"border-gray-600",children:"取消"}),s.jsx(Y,{onClick:async()=>{const T={tagId:Ct.tagId.trim(),label:Ct.label.trim(),aliases:Ct.aliases.trim(),url:Ct.url.trim(),type:Ct.type,appId:Ct.appId.trim(),appSecret:Ct.appSecret.trim(),pagePath:Ct.pagePath.trim()};if(T.tagId){const z=T.tagId;if([...z].length>50){ne.error("标签ID 最长 50 个字符");return}if(/[#,\n\r\t]/.test(z)){ne.error("标签ID 不能含 #、逗号或换行");return}}if(!T.label){ne.error("显示文字必填");return}T.type==="miniprogram"&&(T.url=""),T.type==="wxlink"&&(T.appId="",T.pagePath=""),Ol(!0);try{const z=await Et("/api/db/link-tags",T);z!=null&&z.success?(ne.success(Ks?"已更新":"已添加"),Xn(!1),$s(),Sr()):ne.error((z==null?void 0:z.error)??"保存失败")}catch(z){console.error(z),ne.error("保存失败")}finally{Ol(!1)}},disabled:Va,className:"bg-amber-500 hover:bg-amber-600 text-white",children:Va?"保存中...":"保存"})]})]})})]})]}),s.jsx(Q9,{open:Ft,onOpenChange:Fo,editingPerson:vr,onSubmit:async T=>{var we;const z={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:(we=T.deviceGroups)!=null&&we.trim()?T.deviceGroups.split(",").map(Qe=>parseInt(Qe.trim(),10)).filter(Qe=>!Number.isNaN(Qe)):void 0},ue=await Et("/api/db/persons",z);if(ue&&ue.success===!1){const Qe=ue;Qe.ckbResponse&&console.log("存客宝返回",Qe.ckbResponse);const dt=Qe.error||"操作失败";throw new Error(dt)}if(kr(),ne.success(vr?"已保存":"已添加"),ue!=null&&ue.ckbCreateResult&&Object.keys(ue.ckbCreateResult).length>0){const Qe=ue.ckbCreateResult;console.log("存客宝创建结果",Qe);const dt=Qe.planId??Qe.id,Ot=dt!=null?[`planId: ${dt}`]:[];Qe.apiKey!=null&&Ot.push("apiKey: ***"),ne.info(Ot.length?`存客宝创建结果:${Ot.join(",")}`:"存客宝创建结果见控制台")}}}),s.jsx(Bt,{open:!!cs,onOpenChange:T=>{T||Ei(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(Vt,{className:"gap-1",children:[s.jsx(Ht,{className:"text-white text-base",children:"确认删除"}),s.jsx(of,{className:"text-gray-400 text-sm leading-relaxed wrap-break-word",children:cs&&s.jsxs(s.Fragment,{children:[cs.personSource==="vip_sync"?s.jsxs(s.Fragment,{children:[s.jsxs("p",{children:["确定删除超级个体「",cs.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链接人与事-",cs.name,"」?将同时删除存客宝对应获客计划。"]})}),s.jsxs("p",{className:"mt-1.5",children:["二次确认:删除后无法恢复,文章中的 @",cs.name," 将无法正常跳转。"]})]})})]}),s.jsxs(xn,{className:"gap-2 sm:gap-2 pt-1",children:[s.jsx(Y,{variant:"outline",size:"sm",className:"border-gray-600 text-gray-300",onClick:()=>Ei(null),children:"取消"}),s.jsx(Y,{variant:"destructive",size:"sm",className:"bg-red-600 hover:bg-red-700",onClick:async()=>{cs&&(await gi(`/api/db/persons?personId=${cs.personId}`),Ei(null),kr(),ne.success("已删除"))},children:"确定删除"})]})]})}),s.jsx(Bt,{open:Ns,onOpenChange:Hr,children:s.jsxs(zt,{className:"max-w-2xl bg-[#0f2137] border-gray-700",children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[s.jsx(_n,{className:"w-5 h-5 text-green-400"}),Mi," — 获客详情(共 ",Nr," 条)"]})}),s.jsx("div",{className:"max-h-[450px] overflow-y-auto space-y-2",children:Bo?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:"加载中..."})]}):Ua.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:"时间"})]}),Ua.map((T,z)=>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:(_s-1)*20+z+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))]})}),Nr>20&&s.jsxs("div",{className:"flex items-center justify-center gap-2 pt-2",children:[s.jsx(Y,{size:"sm",variant:"outline",disabled:_s<=1,onClick:()=>js(ws,Mi,_s-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:[_s," / ",Math.ceil(Nr/20)]}),s.jsx(Y,{size:"sm",variant:"outline",disabled:_s>=Math.ceil(Nr/20),onClick:()=>js(ws,Mi,_s+1),className:"border-gray-600 text-gray-300 bg-transparent h-7 px-3",children:"下一页"})]})]})})]})}const mi={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 tj(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):mi.stats}function nj(t){return Array.isArray(t)?t.map(e=>typeof e=="string"?e:String(e??"")).filter(Boolean):mi.highlights}function Z9(){const[t,e]=b.useState(mi),[n,r]=b.useState(!0),[a,i]=b.useState(!1),[o,c]=b.useState(!1),u=b.useRef(null);b.useEffect(()=>{Le("/api/admin/author-settings").then(k=>{const E=k==null?void 0:k.data;E&&typeof E=="object"&&e({name:String(E.name??mi.name),avatar:String(E.avatar??mi.avatar),avatarImg:String(E.avatarImg??""),title:String(E.title??mi.title),bio:String(E.bio??mi.bio),stats:tj(E.stats).length?tj(E.stats):mi.stats,highlights:nj(E.highlights).length?nj(E.highlights):mi.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 Et("/api/admin/author-settings",k);if(!E||E.success===!1){ne.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),ne.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 O=hu(),q={};O&&(q.Authorization=`Bearer ${O}`);const V=await(await fetch(Ac("/api/upload"),{method:"POST",body:R,credentials:"include",headers:q})).json();V!=null&&V.success&&(V!=null&&V.url)?e(I=>({...I,avatarImg:V.url})):ne.error("上传失败: "+((V==null?void 0:V.error)||"未知错误"))}catch(R){console.error(R),ne.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)})),y=(k,E,C)=>e(R=>({...R,stats:R.stats.map((O,q)=>q===k?{...O,[E]:C}:O)})),v=()=>e(k=>({...k,highlights:[...k.highlights,""]})),N=k=>e(E=>({...E,highlights:E.highlights.filter((C,R)=>R!==k)})),w=(k,E)=>e(C=>({...C,highlights:C.highlights.map((R,O)=>O===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(xi,{className:"w-5 h-5 text-[#38bdac]"}),"作者详情"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"配置小程序「关于作者」页展示的作者信息,包括头像、简介、统计数据与亮点标签。"})]}),s.jsxs(Y,{onClick:h,disabled:a||n,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(kn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{children:[s.jsxs(ot,{className:"flex items-center gap-2 text-white",children:[s.jsx(xi,{className:"w-4 h-4 text-[#38bdac]"}),"基本信息"]}),s.jsx(Yt,{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(ee,{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(ee,{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(ee,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(Oj,{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(Y,{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(nf,{className:"w-4 h-4 mr-2"}),o?"上传中...":"上传"]})]}),t.avatarImg&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:So(t.avatarImg.startsWith("http")?t.avatarImg:Ac(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(ee,{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(ee,{className:"text-gray-300",children:"个人简介"}),s.jsx(To,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{children:[s.jsx(ot,{className:"text-white",children:"统计数据"}),s.jsx(Yt,{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=>y(E,"label",C.target.value),placeholder:"标签"}),s.jsx(ce,{className:"flex-1 bg-[#0a1628] border-gray-700 text-white",value:k.value,onChange:C=>y(E,"value",C.target.value),placeholder:"数值"}),s.jsx(Y,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>x(E),children:s.jsx(ss,{className:"w-4 h-4"})})]},E)),s.jsxs(Y,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{children:[s.jsx(ot,{className:"text-white",children:"亮点标签"}),s.jsx(Yt,{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=>w(E,C.target.value),placeholder:"5年私域运营经验"}),s.jsx(Y,{variant:"ghost",size:"icon",className:"text-gray-400 hover:text-red-400",onClick:()=>N(E),children:s.jsx(ss,{className:"w-4 h-4"})})]},E)),s.jsxs(Y,{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 eV(t){return confirm(`确定删除该${t}?此操作不可恢复。`)?window.prompt(`请输入「删除」以确认删除${t}`)==="删除":!1}function tV(){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=lf(h,300),[x,y]=b.useState(!0),[v,N]=b.useState(null),[w,k]=b.useState(!1),[E,C]=b.useState(null),[R,O]=b.useState(""),[q,$]=b.useState(""),[V,I]=b.useState(""),[te,Q]=b.useState("admin"),[B,re]=b.useState("active"),[ae,J]=b.useState(!1);async function F(){var U;y(!0),N(null);try{const H=new URLSearchParams({page:String(a),pageSize:String(o)});m.trim()&&H.set("search",m.trim());const K=await Le(`/api/admin/users?${H}`);K!=null&&K.success?(e(K.records||[]),r(K.total??0),u(K.totalPages??0)):N(K.error||"加载失败")}catch(H){const K=H;N(K.status===403?"无权限访问":((U=K==null?void 0:K.data)==null?void 0:U.error)||"加载失败"),e([])}finally{y(!1)}}b.useEffect(()=>{F()},[a,o,m]);const D=()=>{C(null),O(""),$(""),I(""),Q("admin"),re("active"),k(!0)},P=U=>{C(U),O(U.username),$(""),I(U.name||""),Q(U.role==="super_admin"?"super_admin":"admin"),re(U.status==="disabled"?"disabled":"active"),k(!0)},oe=async()=>{var U;if(!R.trim()){N("用户名不能为空");return}if(!E&&!q){N("新建时密码必填,至少 6 位");return}if(q&&q.length<6){N("密码至少 6 位");return}N(null),J(!0);try{if(E){const H=await Zt("/api/admin/users",{id:E.id,password:q||void 0,name:V.trim(),role:te,status:B});H!=null&&H.success?(k(!1),F()):N((H==null?void 0:H.error)||"保存失败")}else{const H=await Et("/api/admin/users",{username:R.trim(),password:q,name:V.trim(),role:te});H!=null&&H.success?(k(!1),F()):N((H==null?void 0:H.error)||"保存失败")}}catch(H){const K=H;N(((U=K==null?void 0:K.data)==null?void 0:U.error)||"保存失败")}finally{J(!1)}},G=async U=>{var H;if(!eV("管理员")){N("已取消删除");return}try{const K=await gi(`/api/admin/users?id=${U}`);K!=null&&K.success?F():N((K==null?void 0:K.error)||"删除失败")}catch(K){const me=K;N(((H=me==null?void 0:me.data)==null?void 0:H.error)||"删除失败")}},_=U=>{if(!U)return"-";try{const H=new Date(U);return isNaN(H.getTime())?U:H.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(yc,{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(Y,{variant:"outline",size:"sm",onClick:F,disabled:x,className:"border-gray-600 text-gray-300",children:s.jsx(Ve,{className:`w-4 h-4 ${x?"animate-spin":""}`})}),s.jsxs(Y,{onClick:D,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:()=>N(null),className:"text-red-400 hover:text-red-300",children:"×"})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-0",children:x?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(s.Fragment,{children:[s.jsxs(gs,{children:[s.jsx(ys,{children:s.jsxs(ht,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"ID"}),s.jsx(ke,{className:"text-gray-400",children:"用户名"}),s.jsx(ke,{className:"text-gray-400",children:"昵称"}),s.jsx(ke,{className:"text-gray-400",children:"角色"}),s.jsx(ke,{className:"text-gray-400",children:"状态"}),s.jsx(ke,{className:"text-gray-400",children:"创建时间"}),s.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(bs,{children:[t.map(U=>s.jsxs(ht,{className:"border-gray-700/50",children:[s.jsx(be,{className:"text-gray-300",children:U.id}),s.jsx(be,{className:"text-white font-medium",children:U.username}),s.jsx(be,{className:"text-gray-400",children:U.name||"-"}),s.jsx(be,{children:s.jsx(Ue,{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(be,{children:s.jsx(Ue,{variant:"outline",className:U.status==="active"?"border-[#38bdac]/50 text-[#38bdac]":"border-gray-500 text-gray-500",children:U.status==="active"?"正常":"已禁用"})}),s.jsx(be,{className:"text-gray-500 text-sm",children:_(U.createdAt)}),s.jsxs(be,{className:"text-right",children:[s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>P(U),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(tn,{className:"w-4 h-4"})}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>G(U.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(Ms,{className:"w-4 h-4"})})]})]},U.id)),t.length===0&&!x&&s.jsx(ht,{children:s.jsx(be,{colSpan:7,className:"text-center py-12 text-gray-500",children:v==="无权限访问"?"仅超级管理员可查看":"暂无管理员"})})]})]}),c>1&&s.jsx("div",{className:"p-4 border-t border-gray-700/50",children:s.jsx(sr,{page:a,pageSize:o,total:n,totalPages:c,onPageChange:i})})]})})}),s.jsx(Bt,{open:w,onOpenChange:k,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-sm",children:[s.jsx(Vt,{children:s.jsx(Ht,{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(ee,{className:"text-gray-300",children:"用户名"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"登录用户名",value:R,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(ee,{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(ee,{className:"text-gray-300",children:"昵称"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"显示名称",value:V,onChange:U=>I(U.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"角色"}),s.jsxs("select",{value:te,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(ee,{className:"text-gray-300",children:"状态"}),s.jsxs("select",{value:B,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(xn,{children:[s.jsxs(Y,{variant:"outline",onClick:()=>k(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(ss,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(Y,{onClick:oe,disabled:ae,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(kn,{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 N4(){const t=["Authorization: Bearer {token}","Content-Type: application/json"];return s.jsxs("div",{className:"p-8 w-full bg-[#0a1628] text-white",children:[s.jsxs("div",{className:"mb-8",children:[s.jsx("h1",{className:"text-2xl font-bold text-white",children:"API 接口文档"}),s.jsx("p",{className:"text-gray-400 mt-1",children:"内容管理相关接口 · RESTful · 基础路径 /api · 管理端需 Bearer Token"})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(it,{className:"pb-3",children:s.jsxs(ot,{className:"text-white flex items-center gap-2",children:[s.jsx(mg,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(it,{className:"pb-3",children:s.jsxs(ot,{className:"text-white flex items-center gap-2",children:[s.jsx(rr,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(it,{className:"pb-3",children:s.jsxs(ot,{className:"text-white flex items-center gap-2",children:[s.jsx(xi,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(it,{className:"pb-3",children:s.jsxs(ot,{className:"text-white flex items-center gap-2",children:[s.jsx(Dd,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(it,{className:"pb-3",children:s.jsxs(ot,{className:"text-white flex items-center gap-2",children:[s.jsx(Aa,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(it,{className:"pb-3",children:s.jsxs(ot,{className:"text-white flex items-center gap-2",children:[s.jsx(gg,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl mb-6",children:[s.jsx(it,{className:"pb-3",children:s.jsxs(ot,{className:"text-white flex items-center gap-2",children:[s.jsx(gl,{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 nV={appId:"wxb8bbb2b10dec74aa",withdrawSubscribeTmplId:"u3MbZGPRkrZIk-I7QdpwzFxnO_CeQPaCWF2FkiIablE",mchId:"1318592501",minWithdraw:10},sV={name:"卡若",startDate:"2025年10月15日",bio:"连续创业者,私域运营专家,每天早上6-9点在Soul派对房分享真实商业故事",liveTime:"06:00-09:00",platform:"Soul派对房",description:"连续创业者,私域运营专家"},rV={sectionPrice:1,baseBookPrice:9.9,distributorShare:90,authorInfo:{...sV},ckbLeadApiKey:""},aV={matchEnabled:!0,referralEnabled:!0,searchEnabled:!0,aboutEnabled:!0},iV={tabBar:{home:"首页",chapters:"目录",match:"找伙伴",my:"我的"},chaptersPage:{bookTitle:"一场SOUL的创业实验场",bookSubtitle:"来自Soul派对房的真实商业故事"},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"}},oV=["system","author","admin","api-docs"],sj=["basic","mp","oss","features"];function lV(){const[t,e]=w0(),n=t.get("tab")??"system",r=oV.includes(n)?n:"system",a=t.get("section")??"basic",i=sj.includes(a)?a:"basic",[o,c]=b.useState(rV),[u,h]=b.useState(aV),[f,m]=b.useState(nV),[x,y]=b.useState("{}"),[v,N]=b.useState({}),[w,k]=b.useState(!1),[E,C]=b.useState(!0),[R,O]=b.useState(!1),[q,$]=b.useState(""),[V,I]=b.useState(""),[te,Q]=b.useState(!1),[B,re]=b.useState(!1),ae=(H,K,me=!1)=>{$(H),I(K),Q(me),O(!0)};b.useEffect(()=>{(async()=>{try{const K=await Le("/api/admin/settings");if(!K||K.success===!1)return;if(K.featureConfig&&Object.keys(K.featureConfig).length&&h(me=>({...me,...K.featureConfig})),K.mpConfig&&typeof K.mpConfig=="object"){const me={...K.mpConfig};m(le=>({...le,...me}));const X=me.mpUi;y(JSON.stringify(X!=null&&typeof X=="object"&&!Array.isArray(X)?X:{},null,2))}if(K.ossConfig&&typeof K.ossConfig=="object"&&N(me=>({...me,...K.ossConfig})),K.siteSettings&&typeof K.siteSettings=="object"){const me=K.siteSettings;c(X=>({...X,...typeof me.sectionPrice=="number"&&{sectionPrice:me.sectionPrice},...typeof me.baseBookPrice=="number"&&{baseBookPrice:me.baseBookPrice},...typeof me.distributorShare=="number"&&{distributorShare:me.distributorShare},...me.authorInfo&&typeof me.authorInfo=="object"&&{authorInfo:{...X.authorInfo,...me.authorInfo}},...typeof me.ckbLeadApiKey=="string"&&{ckbLeadApiKey:me.ckbLeadApiKey}}))}}catch(K){console.error("Load settings error:",K)}finally{C(!1)}})()},[]);const J=async(H,K)=>{re(!0);try{const me=await Et("/api/admin/settings",{featureConfig:H});if(!me||me.success===!1){K(),ae("保存失败",(me==null?void 0:me.error)??"未知错误",!0);return}ae("已保存","功能开关已更新,相关入口将随之显示或隐藏。")}catch(me){console.error("Save feature config error:",me),K(),ae("保存失败",me instanceof Error?me.message:String(me),!0)}finally{re(!1)}},F=(H,K)=>{const me=u,X={...me,[H]:K};h(X),J(X,()=>h(me))},[D,P]=b.useState(!1),oe=async H=>{const K=f,me={...K,auditMode:H};m(me),P(!0);try{const X=await Et("/api/admin/settings",{mpConfig:me});if(!X||X.success===!1){m(K),ae("保存失败",(X==null?void 0:X.error)??"未知错误",!0);return}ae("已保存",H?"审核模式已开启,小程序将隐藏所有支付入口。":"审核模式已关闭,支付功能已恢复。")}catch(X){m(K),ae("保存失败",X instanceof Error?X.message:String(X),!0)}finally{P(!1)}},G=async()=>{k(!0);try{let H={};try{const me=x.trim();if(me){const X=JSON.parse(me);if(X&&typeof X=="object"&&!Array.isArray(X))H=X;else{ae("保存失败","小程序文案 mpUi 须为 JSON 对象(非数组)",!0),k(!1);return}}}catch{ae("保存失败","小程序文案 mpUi 不是合法 JSON",!0),k(!1);return}const K=await Et("/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:H},ossConfig:Object.keys(v).length?{endpoint:v.endpoint??"",bucket:v.bucket??"",region:v.region??"",accessKeyId:v.accessKeyId??"",accessKeySecret:v.accessKeySecret??""}:void 0});if(!K||K.success===!1){ae("保存失败",(K==null?void 0:K.error)??"未知错误",!0);return}ae("已保存","设置已保存成功。")}catch(H){console.error("Save settings error:",H),ae("保存失败",H instanceof Error?H.message:String(H),!0)}finally{k(!1)}},_=H=>{if(H==="system"){const K=new URLSearchParams(t);K.delete("tab"),sj.includes(K.get("section")||"basic")||K.set("section","basic"),e(K);return}e({tab:H})},U=H=>{const K=new URLSearchParams(t);K.delete("tab"),K.set("section",H),e(K)};return E?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(Y,{onClick:G,disabled:w,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(kn,{className:"w-4 h-4 mr-2"}),w?"保存中...":"保存设置"]})]}),s.jsxs(Ic,{value:r,onValueChange:_,className:"w-full",children:[s.jsxs(vl,{className:"mb-6 bg-[#0f2137] border border-gray-700/50 p-1",children:[s.jsxs(nn,{value:"system",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(mo,{className:"w-4 h-4 mr-2"}),"系统设置"]}),s.jsxs(nn,{value:"author",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(mh,{className:"w-4 h-4 mr-2"}),"作者详情"]}),s.jsxs(nn,{value:"admin",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",children:[s.jsx(yc,{className:"w-4 h-4 mr-2"}),"管理员"]}),s.jsxs(nn,{value:"api-docs",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 data-[state=active]:font-medium",onClick:H=>{H.preventDefault(),window.open("/api-docs","_blank")},children:[s.jsx(Pj,{className:"w-4 h-4 mr-2"}),"API 文档 ↗"]})]}),s.jsxs(sn,{value:"system",className:"mt-0",children:[s.jsxs("p",{className:"text-xs text-gray-500 mb-3",children:["MBTI 默认头像已迁至"," ",s.jsx(Tc,{to:"/users",className:"text-[#38bdac] underline",children:"用户管理(用户列表点头像打开)"})]}),s.jsxs(Ic,{value:i,onValueChange:U,className:"w-full",children:[s.jsxs(vl,{className:"mb-4 bg-[#0a1628] border border-gray-700/50 p-1 flex-wrap h-auto gap-1",children:[s.jsxs(nn,{value:"basic",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(lM,{className:"w-3.5 h-3.5 mr-1"}),"基础与价格"]}),s.jsxs(nn,{value:"mp",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(gl,{className:"w-3.5 h-3.5 mr-1"}),"小程序与审核"]}),s.jsxs(nn,{value:"oss",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(u1,{className:"w-3.5 h-3.5 mr-1"}),"OSS"]}),s.jsxs(nn,{value:"features",className:"data-[state=active]:bg-[#38bdac]/20 data-[state=active]:text-[#38bdac] text-gray-400 text-xs",children:[s.jsx(mo,{className:"w-3.5 h-3.5 mr-1"}),"功能开关"]})]}),s.jsxs(sn,{value:"basic",className:"space-y-6 mt-0",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{children:[s.jsxs(ot,{className:"text-white flex items-center gap-2",children:[s.jsx(mh,{className:"w-5 h-5 text-[#38bdac]"}),"关于作者"]}),s.jsx(Yt,{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(ee,{htmlFor:"author-name",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(mh,{className:"w-3 h-3"}),"主理人名称"]}),s.jsx(ce,{id:"author-name",className:"bg-[#0a1628] border-gray-700 text-white",value:o.authorInfo.name??"",onChange:H=>c(K=>({...K,authorInfo:{...K.authorInfo,name:H.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{htmlFor:"start-date",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(dg,{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:H=>c(K=>({...K,authorInfo:{...K.authorInfo,startDate:H.target.value}}))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{htmlFor:"live-time",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(dg,{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:H=>c(K=>({...K,authorInfo:{...K.authorInfo,liveTime:H.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{htmlFor:"platform",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Lj,{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:H=>c(K=>({...K,authorInfo:{...K.authorInfo,platform:H.target.value}}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{htmlFor:"description",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(rr,{className:"w-3 h-3"}),"简介描述"]}),s.jsx(ce,{id:"description",className:"bg-[#0a1628] border-gray-700 text-white",value:o.authorInfo.description??"",onChange:H=>c(K=>({...K,authorInfo:{...K.authorInfo,description:H.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{htmlFor:"bio",className:"text-gray-300",children:"详细介绍"}),s.jsx(To,{id:"bio",className:"bg-[#0a1628] border-gray-700 text-white min-h-[100px]",placeholder:"输入作者详细介绍...",value:o.authorInfo.bio??"",onChange:H=>c(K=>({...K,authorInfo:{...K.authorInfo,bio:H.target.value}}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{htmlFor:"ckb-lead-api-key",className:"text-gray-300 flex items-center gap-1",children:[s.jsx(Ea,{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:H=>c(K=>({...K,ckbLeadApiKey:H.target.value}))}),s.jsx("p",{className:"text-xs text-gray-500",children:"小程序首页「链接卡若」留资接口使用的存客宝 API Key,优先于 .env 配置"})]}),s.jsxs("div",{className:"mt-4 p-4 rounded-xl bg-[#0a1628] border border-[#38bdac]/30",children:[s.jsx("p",{className:"text-xs text-gray-500 mb-2",children:"预览效果"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-12 h-12 rounded-full bg-gradient-to-br from-[#00CED1] to-[#20B2AA] flex items-center justify-center text-xl font-bold text-white",children:(o.authorInfo.name??"K").charAt(0)}),s.jsxs("div",{children:[s.jsx("p",{className:"text-white font-semibold",children:o.authorInfo.name}),s.jsx("p",{className:"text-gray-400 text-xs",children:o.authorInfo.description}),s.jsxs("p",{className:"text-[#38bdac] text-xs mt-1",children:["每日 ",o.authorInfo.liveTime," · ",o.authorInfo.platform]})]})]})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{children:[s.jsxs(ot,{className:"text-white flex items-center gap-2",children:[s.jsx(Zh,{className:"w-5 h-5 text-[#38bdac]"}),"价格设置"]}),s.jsx(Yt,{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(ee,{className:"text-gray-300",children:"单节价格 (元)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.sectionPrice,onChange:H=>c(K=>({...K,sectionPrice:Number.parseFloat(H.target.value)||1}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"整本价格 (元)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:o.baseBookPrice,onChange:H=>c(K=>({...K,baseBookPrice:Number.parseFloat(H.target.value)||9.9}))})]})]})})]})]}),s.jsxs(sn,{value:"mp",className:"space-y-6 mt-0",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{children:[s.jsxs(ot,{className:"text-white flex items-center gap-2",children:[s.jsx(gl,{className:"w-5 h-5 text-[#38bdac]"}),"小程序配置"]}),s.jsx(Yt,{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(ee,{className:"text-gray-300",children:"小程序 AppID"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"wxb8bbb2b10dec74aa",value:f.appId??"",onChange:H=>m(K=>({...K,appId:H.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"提现订阅模板 ID"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"用户申请提现时需授权",value:f.withdrawSubscribeTmplId??"",onChange:H=>m(K=>({...K,withdrawSubscribeTmplId:H.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"微信支付商户号"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"1318592501",value:f.mchId??"",onChange:H=>m(K=>({...K,mchId:H.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"最低提现金额 (元)"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:f.minWithdraw??10,onChange:H=>m(K=>({...K,minWithdraw:Number.parseFloat(H.target.value)||10}))})]})]}),s.jsxs("div",{className:"space-y-2 pt-2 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsx(ee,{className:"text-gray-300",children:"小程序界面文案 mpUi(JSON)"}),s.jsx(Y,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-200",onClick:()=>y(JSON.stringify(iV,null,2)),children:"填入默认模板"})]}),s.jsx("p",{className:"text-xs text-gray-500",children:"覆盖 Tab 文案、首页/目录标题、我的页名片与阅读记录路径等;仅填需要改的字段也可(与后端默认值深合并)。保存后小程序约 5 分钟内通过 config 缓存刷新。"}),s.jsx(To,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm min-h-[280px]",spellCheck:!1,value:x,onChange:H=>y(H.target.value)})]})]})]}),s.jsxs(De,{className:`bg-[#0f2137] shadow-xl ${f.auditMode?"border-amber-500/50 border-2":"border-gray-700/50"}`,children:[s.jsxs(it,{children:[s.jsxs(ot,{className:"text-white flex items-center gap-2",children:[s.jsx(yc,{className:"w-5 h-5 text-amber-400"}),"小程序审核模式"]}),s.jsx(Yt,{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(yc,{className:`w-4 h-4 ${f.auditMode?"text-amber-400":"text-gray-400"}`}),s.jsx(ee,{htmlFor:"audit-mode",className:"text-white font-medium cursor-pointer",children:f.auditMode?"审核模式(已开启)":"审核模式(已关闭)"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:f.auditMode?"当前已隐藏所有支付、VIP、充值、收益等入口,审核员看不到任何付费内容":"关闭状态,小程序正常显示所有功能(含支付、VIP 等)"})]}),s.jsx(Ut,{id:"audit-mode",checked:f.auditMode??!1,disabled:D,onCheckedChange:oe})]})})]})]}),s.jsx(sn,{value:"oss",className:"space-y-6 mt-0",children:s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{children:[s.jsxs(ot,{className:"text-white flex items-center gap-2",children:[s.jsx(u1,{className:"w-5 h-5 text-[#38bdac]"}),"OSS 配置(阿里云对象存储)"]}),s.jsx(Yt,{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(ee,{className:"text-gray-300",children:"Endpoint"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"oss-cn-hangzhou.aliyuncs.com",value:v.endpoint??"",onChange:H=>N(K=>({...K,endpoint:H.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"Bucket"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"bucket 名称",value:v.bucket??"",onChange:H=>N(K=>({...K,bucket:H.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"Region"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"oss-cn-hangzhou",value:v.region??"",onChange:H=>N(K=>({...K,region:H.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"AccessKey ID"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"AccessKey ID",value:v.accessKeyId??"",onChange:H=>N(K=>({...K,accessKeyId:H.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"AccessKey Secret"}),s.jsx(ce,{type:"password",className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"AccessKey Secret",value:v.accessKeySecret??"",onChange:H=>N(K=>({...K,accessKeySecret:H.target.value}))})]})]})})]})}),s.jsxs(sn,{value:"features",className:"space-y-6 mt-0",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{children:[s.jsxs(ot,{className:"text-white flex items-center gap-2",children:[s.jsx(mo,{className:"w-5 h-5 text-[#38bdac]"}),"功能开关"]}),s.jsx(Yt,{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(_n,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(ee,{htmlFor:"match-enabled",className:"text-white font-medium cursor-pointer",children:"找伙伴功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制小程序和Web端的找伙伴功能显示"})]}),s.jsx(Ut,{id:"match-enabled",checked:u.matchEnabled,disabled:B,onCheckedChange:H=>F("matchEnabled",H)})]}),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(fg,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(ee,{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(Tc,{to:"/distribution?tab=settings",className:"underline mx-1 text-[#38bdac]",children:"推广中心 → 推广设置"}),"为同一套接口,在此仅控制是否展示入口。"]})]}),s.jsx(Ut,{id:"referral-enabled",checked:u.referralEnabled,disabled:B,onCheckedChange:H=>F("referralEnabled",H)})]}),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(rr,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(ee,{htmlFor:"search-enabled",className:"text-white font-medium cursor-pointer",children:"搜索功能"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制首页、目录页搜索栏的显示"})]}),s.jsx(Ut,{id:"search-enabled",checked:u.searchEnabled,disabled:B,onCheckedChange:H=>F("searchEnabled",H)})]}),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(mo,{className:"w-4 h-4 text-[#38bdac]"}),s.jsx(ee,{htmlFor:"about-enabled",className:"text-white font-medium cursor-pointer",children:"关于页面"})]}),s.jsx("p",{className:"text-xs text-gray-400 ml-6",children:"控制关于页面的访问"})]}),s.jsx(Ut,{id:"about-enabled",checked:u.aboutEnabled,disabled:B,onCheckedChange:H=>F("aboutEnabled",H)})]})]}),s.jsx("div",{className:"p-3 rounded-lg bg-blue-500/10 border border-blue-500/30",children:s.jsx("p",{className:"text-xs text-blue-300",children:"💡 关闭功能后,相关入口会自动隐藏。建议在功能开发完成后再开启。"})})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{children:[s.jsxs(ot,{className:"text-white flex items-center gap-2",children:[s.jsx(ef,{className:"w-5 h-5 text-[#38bdac]"}),"小程序模块显隐说明"]}),s.jsx(Yt,{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(_n,{className:"w-3 h-3"})},{mod:"推广中心 / 推荐好友",ctrl:"推广功能开关",icon:s.jsx(fg,{className:"w-3 h-3"})},{mod:"搜索",ctrl:"搜索功能开关",icon:s.jsx(rr,{className:"w-3 h-3"})},{mod:"关于页面",ctrl:"关于页面开关",icon:s.jsx(mh,{className:"w-3 h-3"})},{mod:"支付 / VIP / 充值 / 收益",ctrl:"审核模式",icon:s.jsx(yc,{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(H=>s.jsxs("div",{className:"flex items-center gap-2 p-2 rounded bg-[#0a1628] border border-gray-700/30",children:[H.icon,s.jsxs("div",{children:[s.jsx("span",{className:"text-white",children:H.mod}),s.jsxs("span",{className:"text-gray-500 ml-1",children:["← ",H.ctrl]})]})]},H.mod))})})]})]})]})]}),s.jsx(sn,{value:"author",className:"mt-0",children:s.jsx(Z9,{})}),s.jsx(sn,{value:"admin",className:"mt-0",children:s.jsx(tV,{})}),s.jsx(sn,{value:"api-docs",className:"mt-0",children:s.jsx(N4,{})})]}),s.jsx(Bt,{open:R,onOpenChange:O,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white",showCloseButton:!0,children:[s.jsxs(Vt,{children:[s.jsx(Ht,{className:te?"text-red-400":"text-[#38bdac]",children:q}),s.jsx(of,{className:"text-gray-400 whitespace-pre-wrap pt-2",children:V})]}),s.jsx(xn,{className:"mt-4",children:s.jsx(Y,{onClick:()=>O(!1),className:te?"bg-gray-600 hover:bg-gray-500":"bg-[#38bdac] hover:bg-[#2da396]",children:"确定"})})]})})]})}const rj={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 cV(){const[t,e]=b.useState(!1),[n,r]=b.useState(rj),[a,i]=b.useState(""),o=async()=>{e(!0);try{const k=await Le("/api/config");k!=null&&k.paymentMethods&&r({...rj,...k.paymentMethods})}catch(k){console.error(k)}finally{e(!1)}};b.useEffect(()=>{o()},[]);const c=async()=>{e(!0);try{await Et("/api/db/config",{key:"payment_methods",value:n,description:"支付方式配置"}),ne.success("配置已保存!")}catch(k){console.error("保存失败:",k),ne.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,N=n.usdt,w=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(Y,{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(Y,{onClick:c,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(kn,{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(Mj,{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(Ic,{defaultValue:"wechat",className:"space-y-6",children:[s.jsxs(vl,{className:"bg-[#0f2137] border border-gray-700/50 p-1 grid grid-cols-4 w-full",children:[s.jsxs(nn,{value:"wechat",className:"data-[state=active]:bg-[#07C160]/20 data-[state=active]:text-[#07C160] text-gray-400",children:[s.jsx(gl,{className:"w-4 h-4 mr-2"}),"微信"]}),s.jsxs(nn,{value:"alipay",className:"data-[state=active]:bg-[#1677FF]/20 data-[state=active]:text-[#1677FF] text-gray-400",children:[s.jsx(h1,{className:"w-4 h-4 mr-2"}),"支付宝"]}),s.jsxs(nn,{value:"usdt",className:"data-[state=active]:bg-[#26A17B]/20 data-[state=active]:text-[#26A17B] text-gray-400",children:[s.jsx(d1,{className:"w-4 h-4 mr-2"}),"USDT"]}),s.jsxs(nn,{value:"paypal",className:"data-[state=active]:bg-[#003087]/20 data-[state=active]:text-[#169BD7] text-gray-400",children:[s.jsx(pg,{className:"w-4 h-4 mr-2"}),"PayPal"]})]}),s.jsx(sn,{value:"wechat",className:"space-y-4",children:s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(ot,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(gl,{className:"w-5 h-5"}),"微信支付配置"]}),s.jsx(Yt,{className:"text-gray-400",children:"配置微信支付参数和跳转链接"})]}),s.jsx(Ut,{checked:!!y.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(ee,{className:"text-gray-300",children:"网站AppID"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.websiteAppId??""),onChange:k=>h("websiteAppId",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"商户号"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white font-mono text-sm",value:String(y.merchantId??""),onChange:k=>h("merchantId",k.target.value)})]})]}),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(wi,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置(核心功能)"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{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(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(ee,{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(y.groupQrCode??""),onChange:k=>h("groupQrCode",k.target.value)}),s.jsx("p",{className:"text-xs text-[#07C160]/70",children:"用户支付成功后将自动跳转到此链接,进入指定微信群"})]})]})]})]})}),s.jsx(sn,{value:"alipay",className:"space-y-4",children:s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(ot,{className:"text-[#1677FF] flex items-center gap-2",children:[s.jsx(h1,{className:"w-5 h-5"}),"支付宝配置"]}),s.jsx(Yt,{className:"text-gray-400",children:"已加载真实支付宝参数"})]}),s.jsx(Ut,{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(ee,{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(Y,{size:"icon",variant:"outline",className:"border-gray-700 bg-transparent",onClick:()=>u(String(v.partnerId??""),"pid"),children:a==="pid"?s.jsx(ip,{className:"w-4 h-4 text-green-500"}):s.jsx(Ij,{className:"w-4 h-4 text-gray-400"})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{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(wi,{className:"w-4 h-4 text-[#38bdac]"}),"跳转链接配置"]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{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(sn,{value:"usdt",className:"space-y-4",children:s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(ot,{className:"text-[#26A17B] flex items-center gap-2",children:[s.jsx(d1,{className:"w-5 h-5"}),"USDT配置"]}),s.jsx(Yt,{className:"text-gray-400",children:"配置加密货币收款地址"})]}),s.jsx(Ut,{checked:!!N.enabled,onCheckedChange:k=>m("enabled",k)})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{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(N.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(ee,{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(N.address??""),onChange:k=>m("address",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{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=>m("exchangeRate",Number.parseFloat(k.target.value)||7.2)})]})]})]})}),s.jsx(sn,{value:"paypal",className:"space-y-4",children:s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{className:"flex flex-row items-center justify-between pb-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsxs(ot,{className:"text-[#169BD7] flex items-center gap-2",children:[s.jsx(pg,{className:"w-5 h-5"}),"PayPal配置"]}),s.jsx(Yt,{className:"text-gray-400",children:"配置PayPal收款账户"})]}),s.jsx(Ut,{checked:!!w.enabled,onCheckedChange:k=>x("enabled",k)})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"PayPal邮箱"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"your@email.com",value:String(w.email??""),onChange:k=>x("email",k.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{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=>x("exchangeRate",Number(k.target.value)||7.2)})]})]})]})})]})]})}const dV={siteName:"卡若日记",siteTitle:"一场SOUL的创业实验场",siteDescription:"来自Soul派对房的真实商业故事",logo:"/logo.png",favicon:"/favicon.ico",primaryColor:"#00CED1"},uV={home:{enabled:!0,label:"首页"},chapters:{enabled:!0,label:"目录"},match:{enabled:!0,label:"匹配"},my:{enabled:!0,label:"我的"}},hV={homeTitle:"一场SOUL的创业实验场",homeSubtitle:"来自Soul派对房的真实商业故事",chaptersTitle:"我要看",matchTitle:"语音匹配",myTitle:"我的",aboutTitle:"关于作者"};function fV(){const[t,e]=b.useState({siteConfig:{...dV},menuConfig:{...uV},pageConfig:{...hV}}),[n,r]=b.useState(!1),[a,i]=b.useState(!1);b.useEffect(()=>{Le("/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 Et("/api/db/config",{key:"site_config",value:t.siteConfig,description:"网站基础配置"}),await Et("/api/db/config",{key:"menu_config",value:t.menuConfig,description:"底部菜单配置"}),await Et("/api/db/config",{key:"page_config",value:t.pageConfig,description:"页面标题配置"}),r(!0),setTimeout(()=>r(!1),2e3),ne.success("配置已保存")}catch(f){console.error(f),ne.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(Y,{onClick:o,disabled:a,className:`${n?"bg-green-500":"bg-[#00CED1]"} hover:bg-[#20B2AA] text-white transition-colors`,children:[s.jsx(kn,{className:"w-4 h-4 mr-2"}),a?"保存中...":n?"已保存":"保存设置"]})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{children:[s.jsxs(ot,{className:"text-white flex items-center gap-2",children:[s.jsx(pg,{className:"w-5 h-5 text-[#00CED1]"}),"网站基础信息"]}),s.jsx(Yt,{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(ee,{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(ee,{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(ee,{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(ee,{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(ee,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{children:[s.jsxs(ot,{className:"text-white flex items-center gap-2",children:[s.jsx(EM,{className:"w-5 h-5 text-[#00CED1]"}),"主题颜色"]}),s.jsx(Yt,{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(ee,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{children:[s.jsxs(ot,{className:"text-white flex items-center gap-2",children:[s.jsx(NM,{className:"w-5 h-5 text-[#00CED1]"}),"底部菜单配置"]}),s.jsx(Yt,{className:"text-gray-400",children:"控制底部导航栏菜单的显示和名称"})]}),s.jsx(_e,{className:"space-y-4",children:Object.entries(u).map(([f,m])=>s.jsxs("div",{className:"flex items-center justify-between p-4 bg-[#0a1628] rounded-lg",children:[s.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[s.jsx(Ut,{checked:(m==null?void 0:m.enabled)??!0,onCheckedChange: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(ce,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:[s.jsxs(it,{children:[s.jsxs(ot,{className:"text-white flex items-center gap-2",children:[s.jsx(Pj,{className:"w-5 h-5 text-[#00CED1]"}),"页面标题配置"]}),s.jsx(Yt,{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(ee,{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(ee,{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(ee,{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(ee,{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(ee,{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(ee,{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 pV(){const[t,e]=b.useState(""),[n,r]=b.useState(""),[a,i]=b.useState(""),[o,c]=b.useState({}),u=async()=>{var y,v,N,w;try{const k=await Le("/api/config"),E=(v=(y=k==null?void 0:k.liveQRCodes)==null?void 0:y[0])==null?void 0:v.urls;Array.isArray(E)&&e(E.join(` -`));const C=(w=(N=k==null?void 0:k.paymentMethods)==null?void 0:N.wechat)==null?void 0:w.groupQrCode;C&&r(C),c({paymentMethods:k==null?void 0:k.paymentMethods,liveQRCodes:k==null?void 0:k.liveQRCodes})}catch(k){console.error(k)}};b.useEffect(()=>{u()},[]);const h=(y,v)=>{navigator.clipboard.writeText(y),i(v),setTimeout(()=>i(""),2e3)},f=async()=>{try{const y=t.split(` -`).map(N=>N.trim()).filter(Boolean),v=[...o.liveQRCodes||[]];v[0]?v[0].urls=y:v.push({id:"live-1",name:"微信群活码",urls:y,clickCount:0}),await Et("/api/db/config",{key:"live_qr_codes",value:v,description:"群活码配置"}),ne.success("群活码配置已保存!"),await u()}catch(y){console.error(y),ne.error("保存失败: "+(y instanceof Error?y.message:String(y)))}},m=async()=>{var y;try{await Et("/api/db/config",{key:"payment_methods",value:{...o.paymentMethods||{},wechat:{...((y=o.paymentMethods)==null?void 0:y.wechat)||{},groupQrCode:n}},description:"支付方式配置"}),ne.success("微信群链接已保存!用户支付成功后将自动跳转"),await u()}catch(v){console.error(v),ne.error("保存失败: "+(v instanceof Error?v.message:String(v)))}},x=()=>{n?window.open(n,"_blank"):ne.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(Mj,{className:"w-5 h-5 text-[#07C160] flex-shrink-0 mt-0.5"}),s.jsxs("div",{className:"text-sm",children:[s.jsx("p",{className:"font-medium mb-2 text-[#07C160]",children:"微信群活码配置指南"}),s.jsxs("div",{className:"text-[#07C160]/80 space-y-2",children:[s.jsx("p",{className:"font-medium",children:"方法一:使用草料活码(推荐)"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[s.jsx("li",{children:"访问草料二维码创建活码"}),s.jsx("li",{children:"上传微信群二维码图片,生成永久链接"}),s.jsx("li",{children:"复制生成的短链接填入下方配置"}),s.jsx("li",{children:"群满后可直接在草料后台更换新群码,链接不变"})]}),s.jsx("p",{className:"font-medium mt-3",children:"方法二:直接使用微信群链接"}),s.jsxs("ol",{className:"list-decimal list-inside space-y-1 pl-2",children:[s.jsx("li",{children:'微信打开目标群 → 右上角"..." → 群二维码'}),s.jsx("li",{children:"长按二维码 → 识别二维码 → 复制链接"})]}),s.jsx("p",{className:"text-[#07C160]/60 mt-2",children:"注意:微信原生群二维码7天后失效,建议使用草料活码"})]})]})]})}),s.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(it,{children:[s.jsxs(ot,{className:"text-[#07C160] flex items-center gap-2",children:[s.jsx(x1,{className:"w-5 h-5"}),"支付成功跳转链接(核心配置)"]}),s.jsx(Yt,{className:"text-gray-400",children:"用户支付完成后自动跳转到此链接,进入指定微信群"})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(xg,{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:y=>r(y.target.value)}),s.jsx(Y,{variant:"outline",size:"icon",className:"border-gray-700 bg-transparent hover:bg-gray-700/50",onClick:()=>h(n,"group"),children:a==="group"?s.jsx(ip,{className:"w-4 h-4 text-green-500"}):s.jsx(Ij,{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(wi,{className:"w-3 h-3"}),"支持格式:草料短链、微信群链接(https://weixin.qq.com/g/...)、企业微信链接等"]})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs(Y,{onClick:m,className:"flex-1 bg-[#07C160] hover:bg-[#06AD51] text-white",children:[s.jsx(nf,{className:"w-4 h-4 mr-2"}),"保存配置"]}),s.jsxs(Y,{onClick:x,variant:"outline",className:"border-[#07C160] text-[#07C160] hover:bg-[#07C160]/10 bg-transparent",children:[s.jsx(wi,{className:"w-4 h-4 mr-2"}),"测试跳转"]})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl md:col-span-2",children:[s.jsxs(it,{children:[s.jsxs(ot,{className:"text-white flex items-center gap-2",children:[s.jsx(x1,{className:"w-5 h-5 text-[#38bdac]"}),"多群轮换(高级配置)"]}),s.jsx(Yt,{className:"text-gray-400",children:"配置多个群链接,系统自动轮换分配,避免单群满员"})]}),s.jsxs(_e,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs(ee,{className:"text-gray-300 flex items-center gap-2",children:[s.jsx(xg,{className:"w-4 h-4"}),"多个群链接(每行一个)"]}),s.jsx(To,{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(Y,{onClick:f,className:"w-full bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(nf,{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 aj={matchTypes:[{id:"partner",label:"创业合伙",matchLabel:"创业伙伴",icon:"⭐",matchFromDB:!0,showJoinAfterMatch:!1,price:1,enabled:!0},{id:"investor",label:"资源对接",matchLabel:"资源对接",icon:"👥",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"mentor",label:"导师顾问",matchLabel:"导师顾问",icon:"❤️",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0},{id:"team",label:"团队招募",matchLabel:"加入项目",icon:"🎮",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}],freeMatchLimit:3,matchPrice:1,settings:{enableFreeMatches:!0,enablePaidMatches:!0,maxMatchesPerDay:10}},mV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function xV(){const[t,e]=b.useState(aj),[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 Le("/api/db/config/full?key=match_config"),R=(C==null?void 0:C.data)??(C==null?void 0:C.config);R&&e({...aj,...R})}catch(C){console.error("加载匹配配置失败:",C)}finally{r(!1)}};b.useEffect(()=>{x()},[]);const y=async()=>{i(!0);try{const C=await Et("/api/db/config",{key:"match_config",value:t,description:"匹配功能配置"});C&&C.success!==!1?ne.success("配置保存成功!"):ne.error("保存失败: "+(C&&typeof C=="object"&&"error"in C?C.error:"未知错误"))}catch(C){console.error("保存配置失败:",C),ne.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)},N=()=>{h(null),m({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),c(!0)},w=()=>{if(!f.id||!f.label){ne.error("请填写类型ID和名称");return}const C=[...t.matchTypes];if(u){const R=C.findIndex(O=>O.id===u.id);R!==-1&&(C[R]={...f})}else{if(C.some(R=>R.id===f.id)){ne.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(mo,{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(Y,{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(Y,{onClick:y,disabled:a,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(kn,{className:"w-4 h-4 mr-2"}),a?"保存中...":"保存配置"]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(it,{children:[s.jsxs(ot,{className:"text-white flex items-center gap-2",children:[s.jsx(ji,{className:"w-5 h-5 text-yellow-400"}),"基础设置"]}),s.jsx(Yt,{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(ee,{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(ee,{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(ee,{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(Ut,{checked:t.settings.enableFreeMatches,onCheckedChange:C=>e({...t,settings:{...t.settings,enableFreeMatches:C}})}),s.jsx(ee,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:t.settings.enablePaidMatches,onCheckedChange:C=>e({...t,settings:{...t.settings,enablePaidMatches:C}})}),s.jsx(ee,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(it,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(ot,{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(Y,{onClick:N,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Dn,{className:"w-4 h-4 mr-1"}),"添加类型"]})]}),s.jsx(_e,{children:s.jsxs(gs,{children:[s.jsx(ys,{children:s.jsxs(ht,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"图标"}),s.jsx(ke,{className:"text-gray-400",children:"类型ID"}),s.jsx(ke,{className:"text-gray-400",children:"显示名称"}),s.jsx(ke,{className:"text-gray-400",children:"匹配标签"}),s.jsx(ke,{className:"text-gray-400",children:"价格"}),s.jsx(ke,{className:"text-gray-400",children:"数据库匹配"}),s.jsx(ke,{className:"text-gray-400",children:"状态"}),s.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsx(bs,{children:t.matchTypes.map(C=>s.jsxs(ht,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{children:s.jsx("span",{className:"text-2xl",children:C.icon})}),s.jsx(be,{className:"font-mono text-gray-300",children:C.id}),s.jsx(be,{className:"text-white font-medium",children:C.label}),s.jsx(be,{className:"text-gray-300",children:C.matchLabel}),s.jsx(be,{children:s.jsxs(Ue,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",C.price]})}),s.jsx(be,{children:C.matchFromDB?s.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):s.jsx(Ue,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),s.jsx(be,{children:s.jsx(Ut,{checked:C.enabled,onCheckedChange:()=>E(C.id)})}),s.jsx(be,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>v(C),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(tn,{className:"w-4 h-4"})}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>k(C.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(Ms,{className:"w-4 h-4"})})]})})]},C.id))})]})})]}),s.jsx(Bt,{open:o,onOpenChange:c,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[u?s.jsx(tn,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(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(ee,{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(ee,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:mV.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(ee,{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(ee,{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(ee,{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(Ut,{checked:f.matchFromDB,onCheckedChange:C=>m({...f,matchFromDB:C})}),s.jsx(ee,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:f.showJoinAfterMatch,onCheckedChange:C=>m({...f,showJoinAfterMatch:C})}),s.jsx(ee,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:f.enabled,onCheckedChange:C=>m({...f,enabled:C})}),s.jsx(ee,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(xn,{children:[s.jsx(Y,{variant:"outline",onClick:()=>c(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsxs(Y,{onClick:w,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(kn,{className:"w-4 h-4 mr-2"}),"保存"]})]})]})})]})}const ij={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function gV(){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 w=new URLSearchParams({page:String(a),pageSize:String(o)});u&&w.set("matchType",u);const k=await Le(`/api/db/match-records?${w}`);k!=null&&k.success?(e(k.records||[]),r(k.total??0)):y("加载匹配记录失败")}catch(w){console.error("加载匹配记录失败",w),y("加载失败,请检查网络后重试")}finally{m(!1)}}b.useEffect(()=>{v()},[a,u]);const N=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:w=>{h(w.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(ij).map(([w,k])=>s.jsx("option",{value:w,children:k},w))]}),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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(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(gs,{children:[s.jsx(ys,{children:s.jsxs(ht,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"发起人"}),s.jsx(ke,{className:"text-gray-400",children:"匹配到"}),s.jsx(ke,{className:"text-gray-400",children:"类型"}),s.jsx(ke,{className:"text-gray-400",children:"联系方式"}),s.jsx(ke,{className:"text-gray-400",children:"匹配时间"})]})}),s.jsxs(bs,{children:[t.map(w=>s.jsxs(ht,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[w.userAvatar?s.jsx("img",{src:So(w.userAvatar),alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const E=k.currentTarget.nextElementSibling;E&&E.classList.remove("hidden")}}):null,s.jsx("span",{className:w.userAvatar?"hidden":"",children:(w.userNickname||w.userId||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white",children:w.userNickname||w.userId}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[w.userId.slice(0,16),"..."]})]})]})}),s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"w-9 h-9 rounded-full bg-[#38bdac]/20 flex items-center justify-center text-sm font-medium text-[#38bdac] flex-shrink-0 overflow-hidden",children:[w.matchedUserAvatar?s.jsx("img",{src:So(w.matchedUserAvatar),alt:"",className:"w-full h-full object-cover",onError:k=>{k.currentTarget.style.display="none";const E=k.currentTarget.nextElementSibling;E&&E.classList.remove("hidden")}}):null,s.jsx("span",{className:w.matchedUserAvatar?"hidden":"",children:(w.matchedNickname||w.matchedUserId||"?").charAt(0)})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-white",children:w.matchedNickname||w.matchedUserId}),s.jsxs("div",{className:"text-xs text-gray-500 font-mono",children:[w.matchedUserId.slice(0,16),"..."]})]})]})}),s.jsx(be,{children:s.jsx(Ue,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:ij[w.matchType]||w.matchType})}),s.jsxs(be,{className:"text-gray-400 text-sm",children:[w.phone&&s.jsxs("div",{children:["📱 ",w.phone]}),w.wechatId&&s.jsxs("div",{children:["💬 ",w.wechatId]}),!w.phone&&!w.wechatId&&"-"]}),s.jsx(be,{className:"text-gray-400",children:w.createdAt?new Date(w.createdAt).toLocaleString():"-"})]},w.id)),t.length===0&&s.jsx(ht,{children:s.jsx(be,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(sr,{page:a,totalPages:N,total:n,pageSize:o,onPageChange:i,onPageSizeChange:w=>{c(w),i(1)}})]})})})]})}function yV(){const[t,e]=b.useState([]),[n,r]=b.useState(!0);async function a(){r(!0);try{const i=await Le("/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),ne.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(wc,{className:"w-5 h-5 text-amber-400"}),"用户管理 / 超级个体列表"]}),s.jsx("p",{className:"text-gray-400 mt-1",children:"这里展示所有有效超级个体用户,仅用于查看其基本信息与排序值。"})]})}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(gs,{children:[s.jsx(ys,{children:s.jsxs(ht,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400 w-20",children:"序号"}),s.jsx(ke,{className:"text-gray-400",children:"成员"}),s.jsx(ke,{className:"text-gray-400 w-40",children:"超级个体"}),s.jsx(ke,{className:"text-gray-400 w-28",children:"排序值"})]})}),s.jsxs(bs,{children:[t.map((i,o)=>{var c;return s.jsxs(ht,{className:"border-gray-700/50",children:[s.jsx(be,{className:"text-gray-300",children:o+1}),s.jsx(be,{children:s.jsxs("div",{className:"flex items-center gap-3",children:[i.avatar?s.jsx("img",{src:So(i.avatar),className:"w-8 h-8 rounded-full object-cover border border-amber-400/60"}):s.jsx("div",{className:"w-8 h-8 rounded-full bg-amber-500/20 border border-amber-400/60 flex items-center justify-center text-amber-300 text-sm",children:((c=i.name)==null?void 0:c[0])||"创"}),s.jsx("div",{className:"min-w-0",children:s.jsx("div",{className:"text-white text-sm truncate",children:i.name})})]})}),s.jsx(be,{className:"text-gray-300",children:i.vipRole||s.jsx("span",{className:"text-gray-500",children:"(未设置超级个体)"})}),s.jsx(be,{className:"text-gray-300",children:i.vipSort??o+1})]},i.id)}),t.length===0&&s.jsx(ht,{children:s.jsx(be,{colSpan:5,className:"text-center py-12 text-gray-500",children:"当前没有有效的超级个体用户。"})})]})]})})})]})}function w4(t){const e=La(),[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,N]=b.useState(!1),w=b.useRef(null),k=async I=>{var Q;const te=(Q=I.target.files)==null?void 0:Q[0];if(te){N(!0);try{const B=new FormData;B.append("file",te),B.append("folder","mentors");const re=hu(),ae={};re&&(ae.Authorization=`Bearer ${re}`);const F=await(await fetch(Ac("/api/upload"),{method:"POST",body:B,credentials:"include",headers:ae})).json();F!=null&&F.success&&(F!=null&&F.url)?m(D=>({...D,avatar:F.url})):ne.error("上传失败: "+((F==null?void 0:F.error)||"未知错误"))}catch(B){console.error(B),ne.error("上传失败")}finally{N(!1),w.current&&(w.current.value="")}}};async function E(){i(!0);try{const I=await Le("/api/db/mentors");I!=null&&I.success&&I.data&&r(I.data)}catch(I){console.error("Load mentors error:",I)}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(I=>I.sort))+1:0,enabled:!0})},R=()=>{h(null),C(),c(!0)},O=I=>{h(I),m({name:I.name,avatar:I.avatar||"",intro:I.intro||"",tags:I.tags||"",priceSingle:I.priceSingle!=null?String(I.priceSingle):"",priceHalfYear:I.priceHalfYear!=null?String(I.priceHalfYear):"",priceYear:I.priceYear!=null?String(I.priceYear):"",quote:I.quote||"",whyFind:I.whyFind||"",offering:I.offering||"",judgmentStyle:I.judgmentStyle||"",sort:I.sort,enabled:I.enabled??!0}),c(!0)},q=async()=>{if(!f.name.trim()){ne.error("导师姓名不能为空");return}y(!0);try{const I=Q=>Q===""?void 0:parseFloat(Q),te={name:f.name.trim(),avatar:f.avatar.trim()||void 0,intro:f.intro.trim()||void 0,tags:f.tags.trim()||void 0,priceSingle:I(f.priceSingle),priceHalfYear:I(f.priceHalfYear),priceYear:I(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,...te});Q!=null&&Q.success?(c(!1),E()):ne.error("更新失败: "+(Q==null?void 0:Q.error))}else{const Q=await Et("/api/db/mentors",te);Q!=null&&Q.success?(c(!1),E()):ne.error("新增失败: "+(Q==null?void 0:Q.error))}}catch(I){console.error("Save error:",I),ne.error("保存失败")}finally{y(!1)}},$=async I=>{if(confirm("确定删除该导师?"))try{const te=await gi(`/api/db/mentors?id=${I}`);te!=null&&te.success?E():ne.error("删除失败: "+(te==null?void 0:te.error))}catch(te){console.error("Delete error:",te),ne.error("删除失败")}},V=I=>I!=null?`¥${I}`:"-";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(Y,{onClick:R,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(Dn,{className:"w-4 h-4 mr-2"}),"新增导师"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-0",children:a?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(gs,{children:[s.jsx(ys,{children:s.jsxs(ht,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"ID"}),s.jsx(ke,{className:"text-gray-400",children:"姓名"}),s.jsx(ke,{className:"text-gray-400",children:"简介"}),s.jsx(ke,{className:"text-gray-400",children:"单次"}),s.jsx(ke,{className:"text-gray-400",children:"半年"}),s.jsx(ke,{className:"text-gray-400",children:"年度"}),s.jsx(ke,{className:"text-gray-400",children:"排序"}),s.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsxs(bs,{children:[n.map(I=>s.jsxs(ht,{className:"border-gray-700/50",children:[s.jsx(be,{className:"text-gray-300",children:I.id}),s.jsx(be,{children:s.jsxs("button",{type:"button",onClick:()=>e(`/users?search=${encodeURIComponent(I.name)}`),className:"text-[#38bdac] hover:text-[#2da396] hover:underline flex items-center gap-1",title:"在用户管理中查看",children:[I.name,s.jsx(wi,{className:"w-3 h-3"})]})}),s.jsx(be,{className:"text-gray-400 max-w-[200px] truncate",children:I.intro||"-"}),s.jsx(be,{className:"text-gray-400",children:V(I.priceSingle)}),s.jsx(be,{className:"text-gray-400",children:V(I.priceHalfYear)}),s.jsx(be,{className:"text-gray-400",children:V(I.priceYear)}),s.jsx(be,{className:"text-gray-400",children:I.sort}),s.jsxs(be,{className:"text-right",children:[s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>O(I),className:"text-gray-400 hover:text-[#38bdac]",children:s.jsx(tn,{className:"w-4 h-4"})}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>$(I.id),className:"text-gray-400 hover:text-red-400",children:s.jsx(Ms,{className:"w-4 h-4"})})]})]},I.id)),n.length===0&&s.jsx(ht,{children:s.jsx(be,{colSpan:8,className:"text-center py-12 text-gray-500",children:"暂无导师,点击「新增导师」添加"})})]})]})})}),s.jsx(Bt,{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(Vt,{children:s.jsx(Ht,{className:"text-white",children:u?"编辑导师":"新增导师"})}),s.jsxs("div",{className:"space-y-4 py-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"姓名 *"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:卡若",value:f.name,onChange:I=>m(te=>({...te,name:I.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"排序"}),s.jsx(ce,{type:"number",className:"bg-[#0a1628] border-gray-700 text-white",value:f.sort,onChange:I=>m(te=>({...te,sort:parseInt(I.target.value,10)||0}))})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{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:I=>m(te=>({...te,avatar:I.target.value})),placeholder:"点击上传或粘贴图片地址"}),s.jsx("input",{ref:w,type:"file",accept:"image/*",className:"hidden",onChange:k}),s.jsxs(Y,{type:"button",variant:"outline",size:"sm",className:"border-gray-600 text-gray-400 shrink-0",disabled:v,onClick:()=>{var I;return(I=w.current)==null?void 0:I.click()},children:[s.jsx(nf,{className:"w-4 h-4 mr-2"}),v?"上传中...":"上传"]})]}),f.avatar&&s.jsx("div",{className:"mt-2",children:s.jsx("img",{src:So(f.avatar.startsWith("http")?f.avatar:Ac(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(ee,{className:"text-gray-300",children:"简介"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:结构判断型咨询 · Decision > Execution",value:f.intro,onChange:I=>m(te=>({...te,intro:I.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"技能标签(逗号分隔)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:项目结构判断、风险止损、人×项目匹配",value:f.tags,onChange:I=>m(te=>({...te,tags:I.target.value}))})]}),s.jsxs("div",{className:"border-t border-gray-700 pt-4",children:[s.jsx(ee,{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(ee,{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:I=>m(te=>({...te,priceSingle:I.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{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:I=>m(te=>({...te,priceHalfYear:I.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{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:I=>m(te=>({...te,priceYear:I.target.value}))})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"引言"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:大多数人失败,不是因为不努力...",value:f.quote,onChange:I=>m(te=>({...te,quote:I.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"为什么找(文本)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:f.whyFind,onChange:I=>m(te=>({...te,whyFind:I.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"提供什么(文本)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"",value:f.offering,onChange:I=>m(te=>({...te,offering:I.target.value}))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"判断风格(逗号分隔)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如:冷静、克制、偏风险视角",value:f.judgmentStyle,onChange:I=>m(te=>({...te,judgmentStyle:I.target.value}))})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",id:"enabled",checked:f.enabled,onChange:I=>m(te=>({...te,enabled:I.target.checked})),className:"rounded border-gray-600 bg-[#0a1628]"}),s.jsx(ee,{htmlFor:"enabled",className:"text-gray-300 cursor-pointer",children:"上架(小程序可见)"})]})]}),s.jsxs(xn,{children:[s.jsxs(Y,{variant:"outline",onClick:()=>c(!1),className:"border-gray-600 text-gray-300",children:[s.jsx(ss,{className:"w-4 h-4 mr-2"}),"取消"]}),s.jsxs(Y,{onClick:q,disabled:x,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(kn,{className:"w-4 h-4 mr-2"}),x?"保存中...":"保存"]})]})]})})]})}function bV(){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 Le(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(dg,{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(Y,{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(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(gs,{children:[s.jsx(ys,{children:s.jsxs(ht,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"ID"}),s.jsx(ke,{className:"text-gray-400",children:"用户ID"}),s.jsx(ke,{className:"text-gray-400",children:"导师ID"}),s.jsx(ke,{className:"text-gray-400",children:"类型"}),s.jsx(ke,{className:"text-gray-400",children:"金额"}),s.jsx(ke,{className:"text-gray-400",children:"状态"}),s.jsx(ke,{className:"text-gray-400",children:"创建时间"})]})}),s.jsxs(bs,{children:[t.map(h=>s.jsxs(ht,{className:"border-gray-700/50",children:[s.jsx(be,{className:"text-gray-300",children:h.id}),s.jsx(be,{className:"text-gray-400",children:h.userId}),s.jsx(be,{className:"text-gray-400",children:h.mentorId}),s.jsx(be,{className:"text-gray-400",children:u[h.consultationType]||h.consultationType}),s.jsxs(be,{className:"text-white",children:["¥",h.amount]}),s.jsx(be,{className:"text-gray-400",children:c[h.status]||h.status}),s.jsx(be,{className:"text-gray-500 text-sm",children:h.createdAt})]},h.id)),t.length===0&&s.jsx(ht,{children:s.jsx(be,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}const Od={poolSource:["vip"],requirePhone:!0,requireNickname:!0,requireAvatar:!1,requireBusiness:!1},oj={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:Od},vV=["⭐","👥","❤️","🎮","💼","🚀","💡","🎯","🔥","✨"];function NV(){const t=La(),[e,n]=b.useState(oj),[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),[N,w]=b.useState(!1),k=async()=>{w(!0);try{const I=await Le("/api/db/match-pool-counts");I!=null&&I.success&&I.data&&v(I.data)}catch(I){console.error("加载池子人数失败:",I)}finally{w(!1)}},E=async()=>{a(!0);try{const I=await Le("/api/db/config/full?key=match_config"),te=(I==null?void 0:I.data)??(I==null?void 0:I.config);if(te){let Q=te.poolSettings??Od;Q.poolSource&&!Array.isArray(Q.poolSource)&&(Q={...Q,poolSource:[Q.poolSource]}),n({...oj,...te,poolSettings:Q})}}catch(I){console.error("加载匹配配置失败:",I)}finally{a(!1)}};b.useEffect(()=>{E(),k()},[]);const C=async()=>{o(!0);try{const I=await Et("/api/db/config",{key:"match_config",value:e,description:"匹配功能配置"});ne.error((I==null?void 0:I.success)!==!1?"配置保存成功!":"保存失败: "+((I==null?void 0:I.error)||"未知错误"))}catch(I){console.error(I),ne.error("保存失败")}finally{o(!1)}},R=I=>{f(I),x({...I}),u(!0)},O=()=>{f(null),x({id:"",label:"",matchLabel:"",icon:"⭐",matchFromDB:!1,showJoinAfterMatch:!0,price:1,enabled:!0}),u(!0)},q=()=>{if(!m.id||!m.label){ne.error("请填写类型ID和名称");return}const I=[...e.matchTypes];if(h){const te=I.findIndex(Q=>Q.id===h.id);te!==-1&&(I[te]={...m})}else{if(I.some(te=>te.id===m.id)){ne.error("类型ID已存在");return}I.push({...m})}n({...e,matchTypes:I}),u(!1)},$=I=>{confirm("确定要删除这个匹配类型吗?")&&n({...e,matchTypes:e.matchTypes.filter(te=>te.id!==I)})},V=I=>{n({...e,matchTypes:e.matchTypes.map(te=>te.id===I?{...te,enabled:!te.enabled}:te)})};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex justify-end gap-3",children:[s.jsxs(Y,{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(Y,{onClick:C,disabled:i,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(kn,{className:"w-4 h-4 mr-2"})," ",i?"保存中...":"保存配置"]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(it,{children:[s.jsxs(ot,{className:"text-white flex items-center gap-2",children:[s.jsx(Rj,{className:"w-5 h-5 text-blue-400"})," 匹配池选择"]}),s.jsx(Yt,{className:"text-gray-400",children:"选择匹配的用户池和完善程度要求,只有满足条件的用户才可被匹配到"})]}),s.jsxs(_e,{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx(ee,{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(I=>{const te=e.poolSettings??Od,B=(Array.isArray(te.poolSource)?te.poolSource:[te.poolSource]).includes(I.value),re=y==null?void 0:y[I.countKey],ae=()=>{const J=Array.isArray(te.poolSource)?[...te.poolSource]:[te.poolSource],F=B?J.filter(D=>D!==I.value):[...J,I.value];F.length===0&&F.push(I.value),n({...e,poolSettings:{...te,poolSource:F}})};return s.jsxs("button",{type:"button",onClick:ae,className:`p-4 rounded-lg border text-left transition-all ${B?"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 ${B?"border-[#38bdac] bg-[#38bdac] text-white":"border-gray-600"}`,children:B&&"✓"}),s.jsx("span",{className:"text-xl",children:I.icon}),s.jsx("span",{className:`text-sm font-medium ${B?"text-[#38bdac]":"text-gray-300"}`,children:I.label})]}),s.jsxs("span",{className:"text-lg font-bold text-white",children:[N?"...":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:I.desc}),s.jsx("span",{role:"link",tabIndex:0,onClick:J=>{J.stopPropagation(),t(`/users?pool=${I.value}`)},onKeyDown:J=>{J.key==="Enter"&&(J.stopPropagation(),t(`/users?pool=${I.value}`))},className:"text-[#38bdac] text-xs mt-2 inline-block hover:underline cursor-pointer",children:"查看用户列表 →"})]},I.value)})})]}),s.jsxs("div",{className:"space-y-3 pt-4 border-t border-gray-700/50",children:[s.jsx(ee,{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(I=>{const Q=(e.poolSettings??Od)[I.key];return s.jsxs("div",{className:"flex items-center gap-3 bg-[#0a1628] rounded-lg p-3",children:[s.jsx(Ut,{checked:Q,onCheckedChange:B=>n({...e,poolSettings:{...e.poolSettings??Od,[I.key]:B}})}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{children:I.icon}),s.jsx(ee,{className:"text-gray-300 text-sm",children:I.label})]})]},I.key)})})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(it,{children:[s.jsxs(ot,{className:"text-white flex items-center gap-2",children:[s.jsx(ji,{className:"w-5 h-5 text-yellow-400"})," 基础设置"]}),s.jsx(Yt,{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(ee,{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:I=>n({...e,freeMatchLimit:parseInt(I.target.value,10)||0})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{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:I=>n({...e,matchPrice:parseFloat(I.target.value)||1})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{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:I=>n({...e,settings:{...e.settings,maxMatchesPerDay:parseInt(I.target.value,10)||10}})})]})]}),s.jsxs("div",{className:"flex gap-8 pt-4 border-t border-gray-700/50",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:e.settings.enableFreeMatches,onCheckedChange:I=>n({...e,settings:{...e.settings,enableFreeMatches:I}})}),s.jsx(ee,{className:"text-gray-300",children:"启用免费匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:e.settings.enablePaidMatches,onCheckedChange:I=>n({...e,settings:{...e.settings,enablePaidMatches:I}})}),s.jsx(ee,{className:"text-gray-300",children:"启用付费匹配"})]})]})]})]}),s.jsxs(De,{className:"bg-[#0f2137] border-gray-700/50",children:[s.jsxs(it,{className:"flex flex-row items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs(ot,{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(Y,{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(_e,{children:s.jsxs(gs,{children:[s.jsx(ys,{children:s.jsxs(ht,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"图标"}),s.jsx(ke,{className:"text-gray-400",children:"类型ID"}),s.jsx(ke,{className:"text-gray-400",children:"显示名称"}),s.jsx(ke,{className:"text-gray-400",children:"匹配标签"}),s.jsx(ke,{className:"text-gray-400",children:"价格"}),s.jsx(ke,{className:"text-gray-400",children:"数据库匹配"}),s.jsx(ke,{className:"text-gray-400",children:"状态"}),s.jsx(ke,{className:"text-right text-gray-400",children:"操作"})]})}),s.jsx(bs,{children:e.matchTypes.map(I=>s.jsxs(ht,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{children:s.jsx("span",{className:"text-2xl",children:I.icon})}),s.jsx(be,{className:"font-mono text-gray-300",children:I.id}),s.jsx(be,{className:"text-white font-medium",children:I.label}),s.jsx(be,{className:"text-gray-300",children:I.matchLabel}),s.jsx(be,{children:s.jsxs(Ue,{className:"bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/20 border-0",children:["¥",I.price]})}),s.jsx(be,{children:I.matchFromDB?s.jsx(Ue,{className:"bg-green-500/20 text-green-400 hover:bg-green-500/20 border-0",children:"是"}):s.jsx(Ue,{variant:"outline",className:"text-gray-500 border-gray-600",children:"否"})}),s.jsx(be,{children:s.jsx(Ut,{checked:I.enabled,onCheckedChange:()=>V(I.id)})}),s.jsx(be,{className:"text-right",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>R(I),className:"text-gray-400 hover:text-[#38bdac] hover:bg-[#38bdac]/10",children:s.jsx(tn,{className:"w-4 h-4"})}),s.jsx(Y,{variant:"ghost",size:"sm",onClick:()=>$(I.id),className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:s.jsx(Ms,{className:"w-4 h-4"})})]})})]},I.id))})]})})]}),s.jsx(Bt,{open:c,onOpenChange:u,children:s.jsxs(zt,{className:"bg-[#0f2137] border-gray-700 text-white max-w-lg",showCloseButton:!0,children:[s.jsx(Vt,{children:s.jsxs(Ht,{className:"text-white flex items-center gap-2",children:[h?s.jsx(tn,{className:"w-5 h-5 text-[#38bdac]"}):s.jsx(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(ee,{className:"text-gray-300",children:"类型ID(英文)"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: partner",value:m.id,onChange:I=>x({...m,id:I.target.value}),disabled:!!h})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"图标"}),s.jsx("div",{className:"flex gap-1 flex-wrap",children:vV.map(I=>s.jsx("button",{type:"button",className:`w-8 h-8 text-lg rounded ${m.icon===I?"bg-[#38bdac]/30 ring-1 ring-[#38bdac]":"bg-[#0a1628]"}`,onClick:()=>x({...m,icon:I}),children:I},I))})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"显示名称"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.label,onChange:I=>x({...m,label:I.target.value})})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{className:"text-gray-300",children:"匹配标签"}),s.jsx(ce,{className:"bg-[#0a1628] border-gray-700 text-white",placeholder:"如: 超级个体",value:m.matchLabel,onChange:I=>x({...m,matchLabel:I.target.value})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ee,{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:I=>x({...m,price:parseFloat(I.target.value)||1})})]}),s.jsxs("div",{className:"flex gap-6 pt-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:m.matchFromDB,onCheckedChange:I=>x({...m,matchFromDB:I})}),s.jsx(ee,{className:"text-gray-300 text-sm",children:"从数据库匹配"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:m.showJoinAfterMatch,onCheckedChange:I=>x({...m,showJoinAfterMatch:I})}),s.jsx(ee,{className:"text-gray-300 text-sm",children:"匹配后显示加入"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ut,{checked:m.enabled,onCheckedChange:I=>x({...m,enabled:I})}),s.jsx(ee,{className:"text-gray-300 text-sm",children:"启用"})]})]})]}),s.jsxs(xn,{children:[s.jsx(Y,{variant:"outline",onClick:()=>u(!1),className:"border-gray-600 text-gray-300 hover:bg-gray-700/50 bg-transparent",children:"取消"}),s.jsxs(Y,{onClick:q,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(kn,{className:"w-4 h-4 mr-2"})," 保存"]})]})]})})]})}const lj={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function wV(){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,N]=b.useState(null);async function w(){m(!0),y(null);try{const C=new URLSearchParams({page:String(a),pageSize:String(o)});u&&C.set("matchType",u);const R=await Le(`/api/db/match-records?${C}`);R!=null&&R.success?(e(R.records||[]),r(R.total??0)):y("加载匹配记录失败")}catch{y("加载失败,请检查网络后重试")}finally{m(!1)}}b.useEffect(()=>{w()},[a,u]);const k=Math.ceil(n/o)||1,E=({userId:C,nickname:R,avatar:O})=>s.jsxs("div",{className:"flex items-center gap-3 cursor-pointer group",onClick:()=>N(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:So(O),alt:"",className:"w-full h-full object-cover",onError:q=>{q.currentTarget.style.display="none"}}):null,s.jsx("span",{className:O?"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:()=>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(lj).map(([C,R])=>s.jsx("option",{value:C,children:R},C))]}),s.jsxs("button",{type:"button",onClick:w,disabled:f,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50",children:[s.jsx(Ve,{className:`w-4 h-4 ${f?"animate-spin":""}`})," 刷新"]})]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:f?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(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(gs,{children:[s.jsx(ys,{children:s.jsxs(ht,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"发起人"}),s.jsx(ke,{className:"text-gray-400",children:"匹配到"}),s.jsx(ke,{className:"text-gray-400",children:"类型"}),s.jsx(ke,{className:"text-gray-400",children:"联系方式"}),s.jsx(ke,{className:"text-gray-400",children:"匹配时间"})]})}),s.jsxs(bs,{children:[t.map(C=>s.jsxs(ht,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{children:s.jsx(E,{userId:C.userId,nickname:C.userNickname,avatar:C.userAvatar})}),s.jsx(be,{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(be,{children:s.jsx(Ue,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:lj[C.matchType]||C.matchType})}),s.jsxs(be,{className:"text-sm",children:[C.phone&&s.jsxs("div",{className:"text-green-400",children:["📱 ",C.phone]}),C.wechatId&&s.jsxs("div",{className:"text-blue-400",children:["💬 ",C.wechatId]}),!C.phone&&!C.wechatId&&s.jsx("span",{className:"text-gray-600",children:"-"})]}),s.jsx(be,{className:"text-gray-400",children:C.createdAt?new Date(C.createdAt).toLocaleString():"-"})]},C.id)),t.length===0&&s.jsx(ht,{children:s.jsx(be,{colSpan:5,className:"text-center py-12 text-gray-500",children:"暂无匹配记录"})})]})]}),s.jsx(sr,{page:a,totalPages:k,total:n,pageSize:o,onPageChange:i,onPageSizeChange:C=>{c(C),i(1)}})]})})}),s.jsx(_0,{open:!!v,onClose:()=>N(null),userId:v,onUserUpdated:w})]})}function jV(){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(wV,{}),t==="pool"&&s.jsx(NV,{})]})}const cj={investor:"资源对接",mentor:"导师顾问",team:"团队招募"};function kV(){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 Le(`/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 N=async E=>{if(!E.phone&&!E.wechatId){ne.info("该记录无联系方式,无法推送到存客宝");return}y(E.id);try{const C=await Et("/api/ckb/join",{type:E.matchType||"investor",phone:E.phone||"",wechat:E.wechatId||"",userId:E.userId,name:E.userNickname||""});ne.error((C==null?void 0:C.message)||(C!=null&&C.success?"推送成功":"推送失败"))}catch(C){ne.error("推送失败: "+(C instanceof Error?C.message:"网络错误"))}finally{y(null)}},w=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(cj).map(([E,C])=>s.jsx("option",{value:E,children:C},E))}),s.jsxs(Y,{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(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(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(gs,{children:[s.jsx(ys,{children:s.jsxs(ht,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"发起人"}),s.jsx(ke,{className:"text-gray-400",children:"匹配到"}),s.jsx(ke,{className:"text-gray-400",children:"类型"}),s.jsx(ke,{className:"text-gray-400",children:"联系方式"}),s.jsx(ke,{className:"text-gray-400",children:"时间"}),s.jsx(ke,{className:"text-gray-400 text-right",children:"操作"})]})}),s.jsxs(bs,{children:[t.map(E=>{var C,R;return s.jsxs(ht,{className:`border-gray-700/50 ${k(E)?"hover:bg-[#0a1628]":"opacity-60"}`,children:[s.jsx(be,{className:"text-white",children:E.userNickname||((C=E.userId)==null?void 0:C.slice(0,12))}),s.jsx(be,{className:"text-white",children:E.matchedNickname||((R=E.matchedUserId)==null?void 0:R.slice(0,12))}),s.jsx(be,{children:s.jsx(Ue,{className:"bg-[#38bdac]/20 text-[#38bdac] border-0",children:cj[E.matchType]||E.matchType})}),s.jsxs(be,{className:"text-sm",children:[E.phone&&s.jsxs("div",{className:"text-green-400",children:["📱 ",E.phone]}),E.wechatId&&s.jsxs("div",{className:"text-blue-400",children:["💬 ",E.wechatId]}),!E.phone&&!E.wechatId&&s.jsx("span",{className:"text-gray-600",children:"无联系方式"})]}),s.jsx(be,{className:"text-gray-400 text-sm",children:E.createdAt?new Date(E.createdAt).toLocaleString():"-"}),s.jsx(be,{className:"text-right",children:k(E)?s.jsxs(Y,{size:"sm",onClick:()=>N(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(ht,{children:s.jsx(be,{colSpan:6,className:"text-center py-12 text-gray-500",children:"暂无记录"})})]})]}),s.jsx(sr,{page:a,totalPages:w,total:n,pageSize:o,onPageChange:i,onPageSizeChange:E=>{c(E),i(1)}})]})})})]})}const dj={created:"已创建",pending_pay:"待支付",paid:"已支付",completed:"已完成",cancelled:"已取消"},SV={single:"单次",half_year:"半年",year:"年度"};function CV(){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 Le(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(dj).map(([c,u])=>s.jsx("option",{value:c,children:u},c))]}),s.jsxs(Y,{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(De,{className:"bg-[#0f2137] border-gray-700/50",children:s.jsx(_e,{className:"p-0",children:n?s.jsx("div",{className:"py-12 text-center text-gray-400",children:"加载中..."}):s.jsxs(gs,{children:[s.jsx(ys,{children:s.jsxs(ht,{className:"bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"ID"}),s.jsx(ke,{className:"text-gray-400",children:"用户ID"}),s.jsx(ke,{className:"text-gray-400",children:"导师ID"}),s.jsx(ke,{className:"text-gray-400",children:"类型"}),s.jsx(ke,{className:"text-gray-400",children:"金额"}),s.jsx(ke,{className:"text-gray-400",children:"状态"}),s.jsx(ke,{className:"text-gray-400",children:"创建时间"})]})}),s.jsxs(bs,{children:[t.map(c=>s.jsxs(ht,{className:"border-gray-700/50",children:[s.jsx(be,{className:"text-gray-300",children:c.id}),s.jsx(be,{className:"text-gray-400",children:c.userId}),s.jsx(be,{className:"text-gray-400",children:c.mentorId}),s.jsx(be,{className:"text-gray-400",children:SV[c.consultationType]||c.consultationType}),s.jsxs(be,{className:"text-white",children:["¥",c.amount]}),s.jsx(be,{className:"text-gray-400",children:dj[c.status]||c.status}),s.jsx(be,{className:"text-gray-500 text-sm",children:c.createdAt?new Date(c.createdAt).toLocaleString():"-"})]},c.id)),t.length===0&&s.jsx(ht,{children:s.jsx(be,{colSpan:7,className:"text-center py-12 text-gray-500",children:"暂无预约记录"})})]})]})})})]})}function TV(){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(CV,{}),t==="manage"&&s.jsx("div",{className:"-mx-8",children:s.jsx(w4,{embedded:!0})})]})}function EV(){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 Le(`/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(Ve,{className:`w-4 h-4 ${u?"animate-spin":""}`})," 刷新"]})]}),s.jsx(De,{className:"bg-[#0f2137] border-gray-700/50 shadow-xl",children:s.jsx(_e,{className:"p-0",children:u?s.jsxs("div",{className:"flex justify-center py-12",children:[s.jsx(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(gs,{children:[s.jsx(ys,{children:s.jsxs(ht,{className:"bg-[#0a1628] hover:bg-[#0a1628] border-gray-700",children:[s.jsx(ke,{className:"text-gray-400",children:"发起人"}),s.jsx(ke,{className:"text-gray-400",children:"匹配到"}),s.jsx(ke,{className:"text-gray-400",children:"联系方式"}),s.jsx(ke,{className:"text-gray-400",children:"时间"})]})}),s.jsxs(bs,{children:[t.map(x=>s.jsxs(ht,{className:"hover:bg-[#0a1628] border-gray-700/50",children:[s.jsx(be,{className:"text-white",children:x.userNickname||x.userId}),s.jsx(be,{className:"text-white",children:x.matchedNickname||x.matchedUserId}),s.jsxs(be,{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(be,{className:"text-gray-400",children:x.createdAt?new Date(x.createdAt).toLocaleString():"-"})]},x.id)),t.length===0&&s.jsx(ht,{children:s.jsx(be,{colSpan:4,className:"text-center py-12 text-gray-500",children:"暂无团队招募记录"})})]})]}),s.jsx(sr,{page:a,totalPages:m,total:n,pageSize:o,onPageChange:i,onPageSizeChange:x=>{c(x),i(1)}})]})})})]})}const uj={partner:"找伙伴",investor:"资源对接",mentor:"导师顾问",team:"团队招募",join:"加入",match:"匹配"},hj={partner:"⭐",investor:"👥",mentor:"❤️",team:"🎮",join:"📋",match:"🔗"};function MV({onSwitchTab:t,onOpenCKB:e}={}){const n=La(),[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,N]=await Promise.allSettled([Le("/api/db/match-records?stats=true"),Le("/api/db/ckb-plan-stats")]);if(v.status==="fulfilled"&&((x=v.value)!=null&&x.success)&&v.value.data){let w=v.value.data;if(w.totalMatches>0&&(!w.uniqueUsers||w.uniqueUsers===0))try{const k=await Le("/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));w={...w,uniqueUsers:E.size}}}catch{}a(w)}N.status==="fulfilled"&&((y=N.value)!=null&&y.success)&&N.value.data&&o(N.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(De,{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(wi,{className:"w-2.5 h-2.5"})," 查看记录"]})]})}),s.jsx(De,{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(ji,{className:"w-2.5 h-2.5"})," 实时"]})]})}),s.jsx(De,{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(_n,{className:"w-2.5 h-2.5"})," 查看用户"]})]})}),s.jsx(De,{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(De,{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(De,{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 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:hj[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:uj[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(De,{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(Ea,{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:hj[x.matchType]||"📋"}),s.jsx("span",{className:"text-gray-400",children:uj[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 AV=["partner","investor","mentor","team"],ag=[{key:"join_partner",label:"找伙伴场景"},{key:"join_investor",label:"资源对接场景"},{key:"join_mentor",label:"导师顾问场景"},{key:"join_team",label:"团队招募场景"},{key:"match",label:"匹配上报"},{key:"lead",label:"链接卡若"}],fj=`# 场景获客接口摘要 -- 地址:POST /v1/api/scenarios -- 必填:apiKey、sign、timestamp -- 主标识:phone 或 wechatId 至少一项 -- 可选:name、source、remark、tags、siteTags、portrait -- 签名:排除 sign/apiKey/portrait,键名升序拼接值后双重 MD5 -- 成功:code=200,message=新增成功 或 已存在`;function IV({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(fj),[m,x]=b.useState(!1),[y,v]=b.useState(!1),[N,w]=b.useState([]),[k,E]=b.useState([]),[C,R]=b.useState({}),[O,q]=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 F={};return ag.forEach(D=>{F[D.key]=C[D.key]||{apiUrl:"https://ckbapi.quwanzhi.com/v1/api/scenarios",apiKey:"fyngh-ecy9h-qkdae-epwd5-rz6kd",source:"",tags:"",siteTags:"创业实验APP",notes:""}}),F},[C]),V=F=>{const D=r.trim(),P=i.trim();return F<=3?{type:AV[F],phone:D||void 0,wechat:P||void 0,userId:"admin_test",name:"后台测试"}:F===4?{matchType:"partner",phone:D||void 0,wechat:P||void 0,userId:"admin_test",nickname:"后台测试",matchedUser:{id:"test",nickname:"测试",matchScore:88}}:F===5?{phone:D||void 0,wechatId:P||void 0,userId:"admin_test",name:"后台测试"}:{}};async function I(){v(!0);try{const[F,D,P]=await Promise.all([Le("/api/db/config/full?key=ckb_config"),Le("/api/db/ckb-leads?mode=submitted&page=1&pageSize=50"),Le("/api/db/ckb-leads?mode=contact&page=1&pageSize=50")]),oe=F==null?void 0:F.data;oe!=null&&oe.routes&&R(oe.routes),oe!=null&&oe.docNotes&&u(oe.docNotes),oe!=null&&oe.docContent&&f(oe.docContent),D!=null&&D.success&&w(D.records||[]),P!=null&&P.success&&E(P.records||[])}finally{v(!1)}}b.useEffect(()=>{n(t)},[t]),b.useEffect(()=>{I()},[]);const te=b.useMemo(()=>{const F=_=>(_||"").replace(/\D/g,"")||"",D=_=>{const U=F(_.phone);if(U)return`phone:${U}`;const H=(_.userId||"").trim();if(H)return`user:${H}`;const K=(_.wechatId||"").trim();return K?`wechat:${K}`:`row:${_.id}`},P=[...k].sort((_,U)=>{const H=_.createdAt?new Date(_.createdAt).getTime():0;return(U.createdAt?new Date(U.createdAt).getTime():0)-H}),oe=new Set,G=[];for(const _ of P){const U=D(_);oe.has(U)||(oe.add(U),G.push(_))}return G},[k]);async function Q(){x(!0);try{const F=await Et("/api/db/config",{key:"ckb_config",value:{routes:$,docNotes:c,docContent:h},description:"存客宝接口配置"});ne.error((F==null?void 0:F.success)!==!1?"存客宝配置已保存":`保存失败: ${(F==null?void 0:F.error)||"未知错误"}`)}catch(F){ne.error(`保存失败: ${F instanceof Error?F.message:"网络错误"}`)}finally{x(!1)}}const B=(F,D)=>{R(P=>({...P,[F]:{...$[F],...D}}))},re=async F=>{const D=O[F];if(D.method==="POST"&&!r.trim()&&!i.trim()){ne.error("请填写测试手机号");return}const P=[...O];P[F]={...D,status:"testing",message:void 0,responseTime:void 0},q(P);const oe=performance.now();try{const G=D.method==="GET"?await Le(D.endpoint):await Et(D.endpoint,V(F)),_=Math.round(performance.now()-oe),U=(G==null?void 0:G.message)||"",H=(G==null?void 0:G.success)===!0||U.includes("已存在")||U.includes("已加入")||U.includes("已提交"),K=[...O];K[F]={...D,status:H?"success":"error",message:U||(H?"正常":"异常"),responseTime:_},q(K),await I()}catch(G){const _=Math.round(performance.now()-oe),U=[...O];U[F]={...D,status:"error",message:G instanceof Error?G.message:"失败",responseTime:_},q(U)}},ae=async()=>{if(!r.trim()&&!i.trim()){ne.error("请填写测试手机号");return}for(let F=0;Fs.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:F.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(gl,{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:D}),P?s.jsx("p",{className:"text-gray-500 text-sm mt-2 max-w-md mx-auto leading-relaxed",children:P}):null]})})}):F.map(oe=>s.jsxs("tr",{className:"border-t border-gray-700/30",children:[s.jsx("td",{className:"px-4 py-3 text-white",children:oe.userNickname||oe.userId}),s.jsx("td",{className:"px-4 py-3 text-gray-300",children:oe.matchType}),s.jsx("td",{className:"px-4 py-3 text-green-400",children:oe.phone||"—"}),s.jsx("td",{className:"px-4 py-3 text-blue-400",children:oe.wechatId||"—"}),s.jsx("td",{className:"px-4 py-3 text-gray-400",children:oe.createdAt?new Date(oe.createdAt).toLocaleString():"—"})]},String(oe.id)))})]})});return s.jsx(De,{className:"bg-[#0f2137] border-orange-500/30 mb-6",children:s.jsxs(_e,{className:"p-5",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("h3",{className:"text-white font-semibold",children:"存客宝工作台"}),s.jsx(Ue,{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(wi,{className:"w-3 h-3"})," API 文档"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(Y,{onClick:()=>I(),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 ${y?"animate-spin":""}`})," 刷新"]}),s.jsxs(Y,{onClick:Q,disabled:m,size:"sm",className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:[s.jsx(kn,{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(([F,D])=>s.jsx("button",{type:"button",onClick:()=>n(F),className:`px-4 py-2 rounded-lg text-sm transition-colors ${e===F?"bg-orange-500 text-white":"bg-[#0a1628] text-gray-400 hover:text-white"}`,children:D},F))}),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:N.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:te.length}),k.length!==te.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:ag.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"&&J(N,"暂无已提交线索","用户通过场景提交后会出现于此。"),e==="contact"&&s.jsxs("div",{className:"space-y-2",children:[k.length>te.length&&s.jsxs("p",{className:"text-xs text-gray-500",children:["已合并 ",k.length-te.length," 条重复(同手机号或同用户 ID 仅保留最近一条)"]}),J(te,"暂无有联系方式线索","存客宝留资同步后显示;完整列表与筛选请前往「用户管理 → 获客列表」。")]}),e==="config"&&s.jsx("div",{className:"space-y-4",children:ag.map(F=>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:F.label}),s.jsx(Ue,{className:"bg-orange-500/20 text-orange-300 border-0 text-xs",children:F.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(ee,{className:"text-gray-500 text-xs",children:"API 地址"}),s.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:$[F.key].apiUrl,onChange:D=>B(F.key,{apiUrl:D.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{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:$[F.key].apiKey,onChange:D=>B(F.key,{apiKey:D.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{className:"text-gray-500 text-xs",children:"Source"}),s.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:$[F.key].source,onChange:D=>B(F.key,{source:D.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{className:"text-gray-500 text-xs",children:"Tags"}),s.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:$[F.key].tags,onChange:D=>B(F.key,{tags:D.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{className:"text-gray-500 text-xs",children:"SiteTags"}),s.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:$[F.key].siteTags,onChange:D=>B(F.key,{siteTags:D.target.value})})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx(ee,{className:"text-gray-500 text-xs",children:"说明备注"}),s.jsx(ce,{className:"bg-[#0f2137] border-gray-700 text-white h-9 text-sm",value:$[F.key].notes,onChange:D=>B(F.key,{notes:D.target.value})})]})]})]},F.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(gl,{className:"w-4 h-4 text-gray-500 shrink-0"}),s.jsxs("div",{className:"flex-1",children:[s.jsx(ee,{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:F=>a(F.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(ee,{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:F=>o(F.target.value)})]})]}),s.jsx("div",{className:"flex items-end",children:s.jsxs(Y,{onClick:ae,className:"bg-orange-500 hover:bg-orange-600 text-white",children:[s.jsx(ji,{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((F,D)=>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:[F.status==="idle"&&s.jsx("div",{className:"w-2 h-2 rounded-full bg-gray-600 shrink-0"}),F.status==="testing"&&s.jsx(Ve,{className:"w-3 h-3 text-yellow-400 animate-spin shrink-0"}),F.status==="success"&&s.jsx(Ej,{className:"w-3 h-3 text-green-400 shrink-0"}),F.status==="error"&&s.jsx(Aj,{className:"w-3 h-3 text-red-400 shrink-0"}),s.jsx("span",{className:"text-white text-xs truncate",children:F.label})]}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[F.responseTime!==void 0&&s.jsxs("span",{className:"text-gray-600 text-[10px]",children:[F.responseTime,"ms"]}),s.jsx("button",{type:"button",onClick:()=>re(D),disabled:F.status==="testing",className:"text-orange-400/60 hover:text-orange-400 text-[10px] disabled:opacity-50",children:"测试"})]})]},`${F.endpoint}-${D}`))})]}),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(wi,{className:"w-3 h-3"})," 打开外链"]})]}),s.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-400 leading-6",children:h||fj})]}),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:F=>u(F.target.value),placeholder:"记录 Token、入口差异、回复率统计规则、对接约定等。"})]})]})]})})}const PV=[{id:"stats",label:"数据统计",icon:hc,desc:"匹配与获客概览"},{id:"partner",label:"找伙伴",icon:_n,desc:"匹配池与记录"},{id:"resource",label:"资源对接",icon:U5,desc:"人脉资源"},{id:"mentor",label:"导师预约",icon:B5,desc:"预约与管理"},{id:"team",label:"团队招募",icon:vc,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(Y,{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(Ea,{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(IV,{initialTab:a}),s.jsx("div",{className:"flex gap-1 mb-6 bg-[#0a1628] rounded-lg p-1 border border-gray-700/40",children:PV.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(MV,{onSwitchTab:o=>e(o),onOpenCKB:o=>{i(o||"overview"),r(!0)}}),t==="partner"&&s.jsx(jV,{}),t==="resource"&&s.jsx(kV,{}),t==="mentor"&&s.jsx(TV,{}),t==="team"&&s.jsx(EV,{})]})}function OV(){const t=Ro();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(Tj,{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(Y,{asChild:!0,className:"bg-[#38bdac] hover:bg-[#2da396] text-white",children:s.jsxs(Tc,{to:"/",children:[s.jsx(Z5,{className:"w-4 h-4 mr-2"}),"返回首页"]})})]})})}function LV(){return s.jsxs(DE,{children:[s.jsx(ln,{path:"/login",element:s.jsx(PI,{})}),s.jsxs(ln,{path:"/",element:s.jsx(LA,{}),children:[s.jsx(ln,{index:!0,element:s.jsx(ph,{to:"/dashboard",replace:!0})}),s.jsx(ln,{path:"dashboard",element:s.jsx(WR,{})}),s.jsx(ln,{path:"orders",element:s.jsx(KR,{})}),s.jsx(ln,{path:"users",element:s.jsx(ZR,{})}),s.jsx(ln,{path:"distribution",element:s.jsx(N8,{})}),s.jsx(ln,{path:"withdrawals",element:s.jsx(w8,{})}),s.jsx(ln,{path:"content",element:s.jsx(X9,{})}),s.jsx(ln,{path:"referral-settings",element:s.jsx(b2,{})}),s.jsx(ln,{path:"author-settings",element:s.jsx(ph,{to:"/settings?tab=author",replace:!0})}),s.jsx(ln,{path:"vip-roles",element:s.jsx(yV,{})}),s.jsx(ln,{path:"mentors",element:s.jsx(w4,{})}),s.jsx(ln,{path:"mentor-consultations",element:s.jsx(bV,{})}),s.jsx(ln,{path:"admin-users",element:s.jsx(ph,{to:"/settings?tab=admin",replace:!0})}),s.jsx(ln,{path:"settings",element:s.jsx(lV,{})}),s.jsx(ln,{path:"payment",element:s.jsx(cV,{})}),s.jsx(ln,{path:"site",element:s.jsx(fV,{})}),s.jsx(ln,{path:"qrcodes",element:s.jsx(pV,{})}),s.jsx(ln,{path:"find-partner",element:s.jsx(RV,{})}),s.jsx(ln,{path:"match",element:s.jsx(xV,{})}),s.jsx(ln,{path:"match-records",element:s.jsx(gV,{})}),s.jsx(ln,{path:"api-doc",element:s.jsx(ph,{to:"/api-docs",replace:!0})}),s.jsx(ln,{path:"api-docs",element:s.jsx(N4,{})})]}),s.jsx(ln,{path:"*",element:s.jsx(OV,{})})]})}BT.createRoot(document.getElementById("root")).render(s.jsx(b.StrictMode,{children:s.jsx(UE,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:s.jsx(LV,{})})})); diff --git a/soul-admin/dist/assets/index-DNOTbQsR.css b/soul-admin/dist/assets/index-DNOTbQsR.css new file mode 100644 index 00000000..11320246 --- /dev/null +++ b/soul-admin/dist/assets/index-DNOTbQsR.css @@ -0,0 +1 @@ +.rich-editor-wrapper{border:1px solid #374151;border-radius:.5rem;background:#0a1628;overflow:hidden}.rich-editor-toolbar{display:flex;align-items:center;gap:2px;padding:6px 8px;border-bottom:1px solid #374151;background:#0f1d32;flex-wrap:wrap}.toolbar-group{display:flex;align-items:center;gap:1px}.toolbar-divider{width:1px;height:20px;background:#374151;margin:0 4px}.rich-editor-toolbar button{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:4px;border:none;background:transparent;color:#9ca3af;cursor:pointer;transition:all .15s}.rich-editor-toolbar button:hover{background:#1f2937;color:#d1d5db}.rich-editor-toolbar button.is-active{background:#38bdac33;color:#38bdac}.rich-editor-toolbar button:disabled{opacity:.3;cursor:not-allowed}.link-tag-select{background:#0a1628;border:1px solid #374151;color:#d1d5db;font-size:12px;padding:2px 6px;border-radius:4px;cursor:pointer;max-width:160px}.link-input-bar{display:flex;align-items:center;gap:4px;padding:4px 8px;border-bottom:1px solid #374151;background:#0f1d32}.link-input{flex:1;background:#0a1628;border:1px solid #374151;color:#fff;padding:4px 8px;border-radius:4px;font-size:13px}.link-confirm,.link-remove{padding:4px 10px;border-radius:4px;border:none;font-size:12px;cursor:pointer}.link-confirm{background:#38bdac;color:#fff}.link-remove{background:#374151;color:#9ca3af}.rich-editor-content{min-height:450px;max-height:720px;overflow-y:auto;padding:12px 16px;color:#e5e7eb;font-size:14px;line-height:1.7}.rich-editor-content:focus{outline:none}.rich-editor-content h1{font-size:1.5em;font-weight:700;margin:.8em 0 .4em;color:#fff}.rich-editor-content h2{font-size:1.3em;font-weight:600;margin:.7em 0 .3em;color:#fff}.rich-editor-content h3{font-size:1.15em;font-weight:600;margin:.6em 0 .3em;color:#fff}.rich-editor-content p{margin:.4em 0}.rich-editor-content strong{color:#fff}.rich-editor-content code{background:#1f2937;padding:2px 6px;border-radius:3px;font-size:.9em;color:#38bdac}.rich-editor-content pre{background:#1f2937;padding:12px;border-radius:6px;overflow-x:auto;margin:.6em 0}.rich-editor-content blockquote{border-left:3px solid #38bdac;padding-left:12px;margin:.6em 0;color:#9ca3af}.rich-editor-content ul,.rich-editor-content ol{padding-left:1.5em;margin:.4em 0}.rich-editor-content li{margin:.2em 0}.rich-editor-content hr{border:none;border-top:1px solid #374151;margin:1em 0}.rich-editor-content img,.rich-editor-content .ProseMirror img,.rich-editor-content img.rich-editor-img-thumb{max-width:240px!important;max-height:140px!important;width:auto!important;height:auto!important;object-fit:contain;display:inline-block;vertical-align:middle;border-radius:6px;margin:.35em .25em .35em 0;border:1px dashed rgba(56,189,172,.45);background:#0f172a99;box-sizing:border-box}.rich-editor-content .rich-attachment-line{margin:.5em 0;padding:8px 12px;border-radius:8px;border:1px dashed rgba(125,211,252,.35);background:#0f172a8c;font-size:13px;line-height:1.5}.rich-editor-content .rich-attachment-badge{display:inline-block;font-size:10px;font-weight:600;letter-spacing:.02em;padding:2px 8px;border-radius:4px;background:#38bdac38;color:#38bdac;margin-right:8px;vertical-align:middle}.rich-editor-content .rich-attachment-link{color:#7dd3fc!important;font-weight:500;text-decoration:underline;word-break:break-all}.rich-editor-content .rich-video-wrap{display:block;margin:.5em 0;max-width:280px;border:1px dashed rgba(56,189,172,.45);border-radius:8px;overflow:hidden;background:#0f172acc}.rich-editor-content .rich-video-wrap video{display:block;width:100%;max-height:160px;object-fit:contain;vertical-align:middle}.rich-editor-content .rich-video-caption{font-size:11px;color:#6b7280;padding:4px 8px;border-top:1px solid #374151}.rich-editor-content a,.rich-link{color:#38bdac;text-decoration:underline;cursor:pointer}.rich-editor-content table{border-collapse:collapse;width:100%;margin:.5em 0}.rich-editor-content th,.rich-editor-content td{border:1px solid #374151;padding:6px 10px;text-align:left}.rich-editor-content th{background:#1f2937;font-weight:600}.rich-editor-content .ProseMirror-placeholder:before{content:attr(data-placeholder);color:#6b7280;float:left;height:0;pointer-events:none}.mention-tag{background:#38bdac26;color:#38bdac;border-radius:4px;padding:1px 4px;font-weight:500}.link-tag-node{display:inline;background:#ffd7001f;color:gold;border-radius:4px;padding:1px 4px;font-weight:500;cursor:default;-webkit-user-select:all;user-select:all;white-space:nowrap}.mention-popup{position:fixed;z-index:9999;background:#1a2638;border:1px solid #374151;border-radius:8px;padding:4px;min-width:180px;max-height:240px;overflow-y:auto;box-shadow:0 4px 20px #0006}.mention-item{display:flex;align-items:center;justify-content:space-between;padding:6px 10px;border-radius:4px;cursor:pointer;color:#d1d5db;font-size:13px}.mention-item:hover,.mention-item.is-selected{background:#38bdac26;color:#38bdac}.mention-name{font-weight:500}.mention-id{font-size:11px;color:#6b7280}.bubble-menu{display:flex;gap:2px;background:#1a2638;border:1px solid #374151;border-radius:6px;padding:4px;box-shadow:0 4px 12px #0000004d}.bubble-menu button{display:flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:4px;border:none;background:transparent;color:#9ca3af;cursor:pointer}.bubble-menu button:hover{background:#1f2937;color:#d1d5db}.bubble-menu button.is-active{color:#38bdac}.mention-trigger-btn{color:#38bdac!important}.mention-trigger-btn:hover{background:#38bdac33!important}.upload-progress-bar{display:flex;align-items:center;gap:8px;padding:4px 10px;background:#0f1d32;border-bottom:1px solid #374151}.upload-progress-track{flex:1;height:4px;background:#1f2937;border-radius:2px;overflow:hidden}.upload-progress-fill{height:100%;background:linear-gradient(90deg,#38bdac,#4ae3ce);border-radius:2px;transition:width .3s ease}.upload-progress-text{font-size:11px;color:#38bdac;white-space:nowrap}/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-pan-x:initial;--tw-pan-y:initial;--tw-pinch-zoom:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial}}}@layer theme{:root,:host{--font-sans:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-red-900:oklch(39.6% .141 25.723);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-950:oklch(27.9% .077 45.635);--color-yellow-300:oklch(90.5% .182 98.111);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-cyan-200:oklch(91.7% .08 205.041);--color-cyan-300:oklch(86.5% .127 207.078);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-cyan-600:oklch(60.9% .126 221.723);--color-sky-200:oklch(90.1% .058 230.902);--color-sky-300:oklch(82.8% .111 230.318);--color-sky-500:oklch(68.5% .169 237.323);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-violet-300:oklch(81.1% .111 293.571);--color-violet-500:oklch(60.6% .25 292.717);--color-purple-300:oklch(82.7% .119 306.383);--color-purple-400:oklch(71.4% .203 305.504);--color-purple-500:oklch(62.7% .265 303.9);--color-rose-400:oklch(71.2% .194 13.428);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--container-6xl:72rem;--container-7xl:80rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5/2.25);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--blur-xl:24px;--blur-3xl:64px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.not-sr-only{clip-path:none;white-space:normal;width:auto;height:auto;margin:0;padding:0;position:static;overflow:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.-top-2\.5{top:calc(var(--spacing)*-2.5)}.top-0{top:calc(var(--spacing)*0)}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-2{top:calc(var(--spacing)*2)}.top-3{top:calc(var(--spacing)*3)}.top-4{top:calc(var(--spacing)*4)}.top-16{top:calc(var(--spacing)*16)}.top-\[50\%\]{top:50%}.top-full{top:100%}.right-0{right:calc(var(--spacing)*0)}.right-1{right:calc(var(--spacing)*1)}.right-1\/4{right:25%}.right-4{right:calc(var(--spacing)*4)}.bottom-1\/4{bottom:25%}.bottom-2{bottom:calc(var(--spacing)*2)}.-left-2\.5{left:calc(var(--spacing)*-2.5)}.left-0{left:calc(var(--spacing)*0)}.left-1\/4{left:25%}.left-2{left:calc(var(--spacing)*2)}.left-3{left:calc(var(--spacing)*3)}.left-\[-13px\]{left:-13px}.left-\[11px\]{left:11px}.left-\[50\%\]{left:50%}.isolate{isolation:isolate}.isolation-auto{isolation:auto}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.col-span-3{grid-column:span 3/span 3}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.-mx-2{margin-inline:calc(var(--spacing)*-2)}.-mx-8{margin-inline:calc(var(--spacing)*-8)}.mx-1{margin-inline:calc(var(--spacing)*1)}.mx-20{margin-inline:calc(var(--spacing)*20)}.mx-auto{margin-inline:auto}.-mt-6{margin-top:calc(var(--spacing)*-6)}.mt-0{margin-top:calc(var(--spacing)*0)}.mt-0\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-1\.5{margin-top:calc(var(--spacing)*1.5)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mr-0\.5{margin-right:calc(var(--spacing)*.5)}.mr-1{margin-right:calc(var(--spacing)*1)}.mr-1\.5{margin-right:calc(var(--spacing)*1.5)}.mr-2{margin-right:calc(var(--spacing)*2)}.mr-3{margin-right:calc(var(--spacing)*3)}.mr-auto{margin-right:auto}.mb-0\.5{margin-bottom:calc(var(--spacing)*.5)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-1\.5{margin-bottom:calc(var(--spacing)*1.5)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-3{margin-left:calc(var(--spacing)*3)}.ml-4{margin-left:calc(var(--spacing)*4)}.ml-6{margin-left:calc(var(--spacing)*6)}.ml-\[52px\]{margin-left:52px}.ml-auto{margin-left:auto}.line-clamp-1{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.flow-root{display:flow-root}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline\!{display:inline!important}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.inline-grid{display:inline-grid}.inline-table{display:inline-table}.list-item{display:list-item}.table{display:table}.table\!{display:table!important}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-column{display:table-column}.table-column-group{display:table-column-group}.table-footer-group{display:table-footer-group}.table-header-group{display:table-header-group}.table-row{display:table-row}.table-row-group{display:table-row-group}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.size-9{width:calc(var(--spacing)*9);height:calc(var(--spacing)*9)}.size-10{width:calc(var(--spacing)*10);height:calc(var(--spacing)*10)}.h-0\.5{height:calc(var(--spacing)*.5)}.h-1\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-2\.5{height:calc(var(--spacing)*2.5)}.h-3{height:calc(var(--spacing)*3)}.h-3\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-11{height:calc(var(--spacing)*11)}.h-12{height:calc(var(--spacing)*12)}.h-14{height:calc(var(--spacing)*14)}.h-16{height:calc(var(--spacing)*16)}.h-20{height:calc(var(--spacing)*20)}.h-24{height:calc(var(--spacing)*24)}.h-40{height:calc(var(--spacing)*40)}.h-96{height:calc(var(--spacing)*96)}.h-auto{height:auto}.h-full{height:100%}.h-screen{height:100vh}.max-h-48{max-height:calc(var(--spacing)*48)}.max-h-64{max-height:calc(var(--spacing)*64)}.max-h-96{max-height:calc(var(--spacing)*96)}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[92vh\]{max-height:92vh}.max-h-\[120px\]{max-height:120px}.max-h-\[160px\]{max-height:160px}.max-h-\[300px\]{max-height:300px}.max-h-\[400px\]{max-height:400px}.max-h-\[420px\]{max-height:420px}.max-h-\[450px\]{max-height:450px}.max-h-\[520px\]{max-height:520px}.max-h-\[min\(60vh\,320px\)\]{max-height:min(60vh,320px)}.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-\[140px\]{min-height:140px}.min-h-\[260px\]{min-height:260px}.min-h-\[280px\]{min-height:280px}.min-h-\[400px\]{min-height:400px}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-0\.5{width:calc(var(--spacing)*.5)}.w-2{width:calc(var(--spacing)*2)}.w-2\.5{width:calc(var(--spacing)*2.5)}.w-3{width:calc(var(--spacing)*3)}.w-3\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-7{width:calc(var(--spacing)*7)}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-10{width:calc(var(--spacing)*10)}.w-11{width:calc(var(--spacing)*11)}.w-12{width:calc(var(--spacing)*12)}.w-14{width:calc(var(--spacing)*14)}.w-16{width:calc(var(--spacing)*16)}.w-20{width:calc(var(--spacing)*20)}.w-24{width:calc(var(--spacing)*24)}.w-28{width:calc(var(--spacing)*28)}.w-32{width:calc(var(--spacing)*32)}.w-36{width:calc(var(--spacing)*36)}.w-40{width:calc(var(--spacing)*40)}.w-48{width:calc(var(--spacing)*48)}.w-52{width:calc(var(--spacing)*52)}.w-56{width:calc(var(--spacing)*56)}.w-64{width:calc(var(--spacing)*64)}.w-96{width:calc(var(--spacing)*96)}.w-\[5\.5rem\]{width:5.5rem}.w-\[8\%\]{width:8%}.w-\[10\%\]{width:10%}.w-\[11\%\]{width:11%}.w-\[13\%\]{width:13%}.w-\[14\%\]{width:14%}.w-\[19\%\]{width:19%}.w-\[25\%\]{width:25%}.w-\[72px\]{width:72px}.w-\[100px\]{width:100px}.w-\[280px\]{width:280px}.w-\[min\(100vw-2rem\,42rem\)\]{width:min(100vw - 2rem,42rem)}.w-fit{width:fit-content}.w-full{width:100%}.w-screen{width:100vw}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-6xl{max-width:var(--container-6xl)}.max-w-7xl{max-width:var(--container-7xl)}.max-w-\[72px\]{max-width:72px}.max-w-\[96px\]{max-width:96px}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[140px\]{max-width:140px}.max-w-\[160px\]{max-width:160px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[220px\]{max-width:220px}.max-w-\[260px\]{max-width:260px}.max-w-\[420px\]{max-width:420px}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.max-w-\[min\(100\%\,20rem\)\]{max-width:min(100%,20rem)}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-none{max-width:none}.max-w-sm{max-width:var(--container-sm)}.max-w-xl{max-width:var(--container-xl)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-40{min-width:calc(var(--spacing)*40)}.min-w-\[8rem\]{min-width:8rem}.min-w-\[60px\]{min-width:60px}.min-w-\[88px\]{min-width:88px}.min-w-\[108px\]{min-width:108px}.min-w-\[120px\]{min-width:120px}.min-w-\[148px\]{min-width:148px}.min-w-\[168px\]{min-width:168px}.min-w-\[200px\]{min-width:200px}.min-w-\[220px\]{min-width:220px}.min-w-\[1024px\]{min-width:1024px}.min-w-\[1320px\]{min-width:1320px}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.table-fixed{table-layout:fixed}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-0{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-1\/2{--tw-translate-x: 50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-0{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-none{translate:none}.scale-90{--tw-scale-x:90%;--tw-scale-y:90%;--tw-scale-z:90%;scale:var(--tw-scale-x)var(--tw-scale-y)}.scale-110{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x)var(--tw-scale-y)}.scale-3d{scale:var(--tw-scale-x)var(--tw-scale-y)var(--tw-scale-z)}.scale-\[0\.98\]{scale:.98}.rotate-90{rotate:90deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-pan-y{--tw-pan-y:pan-y;touch-action:var(--tw-pan-x,)var(--tw-pan-y,)var(--tw-pinch-zoom,)}.touch-pinch-zoom{--tw-pinch-zoom:pinch-zoom;touch-action:var(--tw-pan-x,)var(--tw-pan-y,)var(--tw-pinch-zoom,)}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.grid-cols-\[40px_1fr_90px_90px_70px_60px_110px\]{grid-template-columns:40px 1fr 90px 90px 70px 60px 110px}.grid-cols-\[40px_40px_1fr_80px_80px_80px_60px\]{grid-template-columns:40px 40px 1fr 80px 80px 80px 60px}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-nowrap{flex-wrap:nowrap}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:calc(var(--spacing)*0)}.gap-0\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-2\.5{gap:calc(var(--spacing)*2.5)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-6{gap:calc(var(--spacing)*6)}.gap-8{gap:calc(var(--spacing)*8)}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*0)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*0)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*8)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-reverse>:not(:last-child)){--tw-space-y-reverse:1}.gap-x-8{column-gap:calc(var(--spacing)*8)}:where(.space-x-reverse>:not(:last-child)){--tw-space-x-reverse:1}.gap-y-4{row-gap:calc(var(--spacing)*4)}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px*var(--tw-divide-x-reverse));border-inline-end-width:calc(1px*calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-y-reverse>:not(:last-child)){--tw-divide-y-reverse:1}:where(.divide-gray-700\/50>:not(:last-child)){border-color:#36415380}@supports (color:color-mix(in lab,red,red)){:where(.divide-gray-700\/50>:not(:last-child)){border-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}:where(.divide-white\/5>:not(:last-child)){border-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){:where(.divide-white\/5>:not(:last-child)){border-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overscroll-y-contain{overscroll-behavior-y:contain}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-none{border-radius:0}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-s{border-start-start-radius:.25rem;border-end-start-radius:.25rem}.rounded-ss{border-start-start-radius:.25rem}.rounded-e{border-start-end-radius:.25rem;border-end-end-radius:.25rem}.rounded-se{border-start-end-radius:.25rem}.rounded-ee{border-end-end-radius:.25rem}.rounded-es{border-end-start-radius:.25rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-tl{border-top-left-radius:.25rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-r-md{border-top-right-radius:var(--radius-md);border-bottom-right-radius:var(--radius-md)}.rounded-tr{border-top-right-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-br{border-bottom-right-radius:.25rem}.rounded-bl{border-bottom-left-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-\[\#0f2137\]{border-color:#0f2137}.border-\[\#07C160\]{border-color:#07c160}.border-\[\#07C160\]\/20{border-color:#07c16033}.border-\[\#07C160\]\/30{border-color:#07c1604d}.border-\[\#38bdac\]{border-color:#38bdac}.border-\[\#38bdac\]\/20{border-color:#38bdac33}.border-\[\#38bdac\]\/25{border-color:#38bdac40}.border-\[\#38bdac\]\/30{border-color:#38bdac4d}.border-\[\#38bdac\]\/35{border-color:#38bdac59}.border-\[\#38bdac\]\/40{border-color:#38bdac66}.border-\[\#38bdac\]\/50{border-color:#38bdac80}.border-amber-400\/60{border-color:#fcbb0099}@supports (color:color-mix(in lab,red,red)){.border-amber-400\/60{border-color:color-mix(in oklab,var(--color-amber-400)60%,transparent)}}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.border-amber-500\/25{border-color:#f99c0040}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/25{border-color:color-mix(in oklab,var(--color-amber-500)25%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500)30%,transparent)}}.border-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/40{border-color:color-mix(in oklab,var(--color-amber-500)40%,transparent)}}.border-amber-500\/50{border-color:#f99c0080}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/50{border-color:color-mix(in oklab,var(--color-amber-500)50%,transparent)}}.border-amber-600{border-color:var(--color-amber-600)}.border-amber-600\/60{border-color:#dd740099}@supports (color:color-mix(in lab,red,red)){.border-amber-600\/60{border-color:color-mix(in oklab,var(--color-amber-600)60%,transparent)}}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/30{border-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}.border-blue-500\/40{border-color:#3080ff66}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/40{border-color:color-mix(in oklab,var(--color-blue-500)40%,transparent)}}.border-blue-500\/50{border-color:#3080ff80}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/50{border-color:color-mix(in oklab,var(--color-blue-500)50%,transparent)}}.border-cyan-500\/20{border-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/20{border-color:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.border-cyan-500\/30{border-color:#00b7d74d}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/30{border-color:color-mix(in oklab,var(--color-cyan-500)30%,transparent)}}.border-cyan-500\/40{border-color:#00b7d766}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/40{border-color:color-mix(in oklab,var(--color-cyan-500)40%,transparent)}}.border-cyan-600\/60{border-color:#0092b599}@supports (color:color-mix(in lab,red,red)){.border-cyan-600\/60{border-color:color-mix(in oklab,var(--color-cyan-600)60%,transparent)}}.border-emerald-500\/30{border-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/30{border-color:color-mix(in oklab,var(--color-emerald-500)30%,transparent)}}.border-emerald-500\/50{border-color:#00bb7f80}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/50{border-color:color-mix(in oklab,var(--color-emerald-500)50%,transparent)}}.border-gray-500{border-color:var(--color-gray-500)}.border-gray-600{border-color:var(--color-gray-600)}.border-gray-600\/50{border-color:#4a556580}@supports (color:color-mix(in lab,red,red)){.border-gray-600\/50{border-color:color-mix(in oklab,var(--color-gray-600)50%,transparent)}}.border-gray-700{border-color:var(--color-gray-700)}.border-gray-700\/30{border-color:#3641534d}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/30{border-color:color-mix(in oklab,var(--color-gray-700)30%,transparent)}}.border-gray-700\/40{border-color:#36415366}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/40{border-color:color-mix(in oklab,var(--color-gray-700)40%,transparent)}}.border-gray-700\/50{border-color:#36415380}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/50{border-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.border-gray-700\/60{border-color:#36415399}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/60{border-color:color-mix(in oklab,var(--color-gray-700)60%,transparent)}}.border-gray-700\/80{border-color:#364153cc}@supports (color:color-mix(in lab,red,red)){.border-gray-700\/80{border-color:color-mix(in oklab,var(--color-gray-700)80%,transparent)}}.border-gray-800{border-color:var(--color-gray-800)}.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\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/10{background-color:color-mix(in oklab,var(--color-emerald-500)10%,transparent)}}.bg-emerald-500\/20{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/20{background-color:color-mix(in oklab,var(--color-emerald-500)20%,transparent)}}.bg-emerald-600{background-color:var(--color-emerald-600)}.bg-gray-500{background-color:var(--color-gray-500)}.bg-gray-500\/10{background-color:#6a72821a}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\/10{background-color:color-mix(in oklab,var(--color-gray-500)10%,transparent)}}.bg-gray-500\/20{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.bg-gray-500\/20{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.bg-gray-600{background-color:var(--color-gray-600)}.bg-gray-600\/20{background-color:#4a556533}@supports (color:color-mix(in lab,red,red)){.bg-gray-600\/20{background-color:color-mix(in oklab,var(--color-gray-600)20%,transparent)}}.bg-gray-600\/50{background-color:#4a556580}@supports (color:color-mix(in lab,red,red)){.bg-gray-600\/50{background-color:color-mix(in oklab,var(--color-gray-600)50%,transparent)}}.bg-gray-700{background-color:var(--color-gray-700)}.bg-gray-700\/50{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.bg-gray-700\/50{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.bg-gray-800{background-color:var(--color-gray-800)}.bg-green-400\/10{background-color:#05df721a}@supports (color:color-mix(in lab,red,red)){.bg-green-400\/10{background-color:color-mix(in oklab,var(--color-green-400)10%,transparent)}}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\/20{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.bg-green-500\/20{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.bg-green-600{background-color:var(--color-green-600)}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-500\/10{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/10{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.bg-purple-500\/10{background-color:#ac4bff1a}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/10{background-color:color-mix(in oklab,var(--color-purple-500)10%,transparent)}}.bg-purple-500\/15{background-color:#ac4bff26}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/15{background-color:color-mix(in oklab,var(--color-purple-500)15%,transparent)}}.bg-purple-500\/20{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/20{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.bg-red-500\/15{background-color:#fb2c3626}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/15{background-color:color-mix(in oklab,var(--color-red-500)15%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.bg-red-600{background-color:var(--color-red-600)}.bg-red-900\/80{background-color:#82181acc}@supports (color:color-mix(in lab,red,red)){.bg-red-900\/80{background-color:color-mix(in oklab,var(--color-red-900)80%,transparent)}}.bg-sky-500\/20{background-color:#00a5ef33}@supports (color:color-mix(in lab,red,red)){.bg-sky-500\/20{background-color:color-mix(in oklab,var(--color-sky-500)20%,transparent)}}.bg-transparent{background-color:#0000}.bg-violet-500\/20{background-color:#8d54ff33}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/20{background-color:color-mix(in oklab,var(--color-violet-500)20%,transparent)}}.bg-white{background-color:var(--color-white)}.bg-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.bg-white\/5{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.bg-white\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.bg-white\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.bg-white\/20{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.bg-yellow-500{background-color:var(--color-yellow-500)}.bg-yellow-500\/20{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.bg-yellow-500\/20{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.bg-linear-to-br{--tw-gradient-position:to bottom right}@supports (background-image:linear-gradient(in lab,red,red)){.bg-linear-to-br{--tw-gradient-position:to bottom right in oklab}}.bg-linear-to-br{background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-\[\#00CED1\]{--tw-gradient-from:#00ced1;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#38bdac\]\/10{--tw-gradient-from:oklab(72.378% -.11483 -.0053193/.1);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-\[\#38bdac\]\/50{--tw-gradient-from:oklab(72.378% -.11483 -.0053193/.5);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-blue-500\/20{--tw-gradient-from:#3080ff33}@supports (color:color-mix(in lab,red,red)){.from-blue-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.from-blue-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-cyan-500\/20{--tw-gradient-from:#00b7d733}@supports (color:color-mix(in lab,red,red)){.from-cyan-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-cyan-500)20%,transparent)}}.from-cyan-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-green-500\/20{--tw-gradient-from:#00c75833}@supports (color:color-mix(in lab,red,red)){.from-green-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.from-green-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-purple-500\/20{--tw-gradient-from:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.from-purple-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.from-purple-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-yellow-500\/20{--tw-gradient-from:#edb20033}@supports (color:color-mix(in lab,red,red)){.from-yellow-500\/20{--tw-gradient-from:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.from-yellow-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.via-\[\#38bdac\]\/30{--tw-gradient-via:oklab(72.378% -.11483 -.0053193/.3);--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-\[\#0f2137\]{--tw-gradient-to:#0f2137;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-\[\#20B2AA\]{--tw-gradient-to:#20b2aa;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-\[\#38bdac\]{--tw-gradient-to:#38bdac;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-amber-500\/20{--tw-gradient-to:#f99c0033}@supports (color:color-mix(in lab,red,red)){.to-amber-500\/20{--tw-gradient-to:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.to-amber-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-cyan-500\/5{--tw-gradient-to:#00b7d70d}@supports (color:color-mix(in lab,red,red)){.to-cyan-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-cyan-500)5%,transparent)}}.to-cyan-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-green-500\/5{--tw-gradient-to:#00c7580d}@supports (color:color-mix(in lab,red,red)){.to-green-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-green-500)5%,transparent)}}.to-green-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-purple-500\/5{--tw-gradient-to:#ac4bff0d}@supports (color:color-mix(in lab,red,red)){.to-purple-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-purple-500)5%,transparent)}}.to-purple-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-yellow-500\/5{--tw-gradient-to:#edb2000d}@supports (color:color-mix(in lab,red,red)){.to-yellow-500\/5{--tw-gradient-to:color-mix(in oklab,var(--color-yellow-500)5%,transparent)}}.to-yellow-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.bg-repeat{background-repeat:repeat}.mask-no-clip{-webkit-mask-clip:no-clip;mask-clip:no-clip}.mask-repeat{-webkit-mask-repeat:repeat;mask-repeat:repeat}.fill-amber-400{fill:var(--color-amber-400)}.fill-current{fill:currentColor}.object-cover{object-fit:cover}.p-0{padding:calc(var(--spacing)*0)}.p-0\.5{padding:calc(var(--spacing)*.5)}.p-1{padding:calc(var(--spacing)*1)}.p-1\.5{padding:calc(var(--spacing)*1.5)}.p-2{padding:calc(var(--spacing)*2)}.p-2\.5{padding:calc(var(--spacing)*2.5)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-5{padding:calc(var(--spacing)*5)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.px-0{padding-inline:calc(var(--spacing)*0)}.px-0\.5{padding-inline:calc(var(--spacing)*.5)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-2\.5{padding-inline:calc(var(--spacing)*2.5)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.py-0{padding-block:calc(var(--spacing)*0)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-5{padding-block:calc(var(--spacing)*5)}.py-6{padding-block:calc(var(--spacing)*6)}.py-8{padding-block:calc(var(--spacing)*8)}.py-10{padding-block:calc(var(--spacing)*10)}.py-12{padding-block:calc(var(--spacing)*12)}.py-14{padding-block:calc(var(--spacing)*14)}.py-16{padding-block:calc(var(--spacing)*16)}.py-20{padding-block:calc(var(--spacing)*20)}.pt-0{padding-top:calc(var(--spacing)*0)}.pt-1{padding-top:calc(var(--spacing)*1)}.pt-1\.5{padding-top:calc(var(--spacing)*1.5)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-4{padding-top:calc(var(--spacing)*4)}.pt-5{padding-top:calc(var(--spacing)*5)}.pt-6{padding-top:calc(var(--spacing)*6)}.pr-0\.5{padding-right:calc(var(--spacing)*.5)}.pr-1{padding-right:calc(var(--spacing)*1)}.pr-2{padding-right:calc(var(--spacing)*2)}.pr-4{padding-right:calc(var(--spacing)*4)}.pb-0\.5{padding-bottom:calc(var(--spacing)*.5)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-3{padding-bottom:calc(var(--spacing)*3)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pl-1{padding-left:calc(var(--spacing)*1)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-4{padding-left:calc(var(--spacing)*4)}.pl-6{padding-left:calc(var(--spacing)*6)}.pl-8{padding-left:calc(var(--spacing)*8)}.pl-9{padding-left:calc(var(--spacing)*9)}.pl-10{padding-left:calc(var(--spacing)*10)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-bottom{vertical-align:bottom}.align-middle{vertical-align:middle}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Microsoft YaHei,sans-serif}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-6{--tw-leading:calc(var(--spacing)*6);line-height:calc(var(--spacing)*6)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.text-wrap{text-wrap:wrap}.break-words,.wrap-break-word{overflow-wrap:break-word}.break-all{word-break:break-all}.text-clip{text-overflow:clip}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#00CED1\]{color:#00ced1}.text-\[\#07C160\]{color:#07c160}.text-\[\#07C160\]\/60{color:#07c16099}.text-\[\#07C160\]\/70{color:#07c160b3}.text-\[\#07C160\]\/80{color:#07c160cc}.text-\[\#26A17B\]{color:#26a17b}.text-\[\#38bdac\]{color:#38bdac}.text-\[\#38bdac\]\/20{color:#38bdac33}.text-\[\#38bdac\]\/30{color:#38bdac4d}.text-\[\#38bdac\]\/40{color:#38bdac66}.text-\[\#38bdac\]\/90{color:#38bdace6}.text-\[\#38bdac\]\/95{color:#38bdacf2}.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-200\/95{color:#fee685f2}@supports (color:color-mix(in lab,red,red)){.text-amber-200\/95{color:color-mix(in oklab,var(--color-amber-200)95%,transparent)}}.text-amber-300{color:var(--color-amber-300)}.text-amber-300\/80{color:#ffd236cc}@supports (color:color-mix(in lab,red,red)){.text-amber-300\/80{color:color-mix(in oklab,var(--color-amber-300)80%,transparent)}}.text-amber-400{color:var(--color-amber-400)}.text-amber-400\/30{color:#fcbb004d}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/30{color:color-mix(in oklab,var(--color-amber-400)30%,transparent)}}.text-amber-400\/80{color:#fcbb00cc}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/80{color:color-mix(in oklab,var(--color-amber-400)80%,transparent)}}.text-amber-400\/90{color:#fcbb00e6}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/90{color:color-mix(in oklab,var(--color-amber-400)90%,transparent)}}.text-amber-500\/80{color:#f99c00cc}@supports (color:color-mix(in lab,red,red)){.text-amber-500\/80{color:color-mix(in oklab,var(--color-amber-500)80%,transparent)}}.text-black{color:var(--color-black)}.text-blue-300{color:var(--color-blue-300)}.text-blue-300\/60{color:#90c5ff99}@supports (color:color-mix(in lab,red,red)){.text-blue-300\/60{color:color-mix(in oklab,var(--color-blue-300)60%,transparent)}}.text-blue-300\/80{color:#90c5ffcc}@supports (color:color-mix(in lab,red,red)){.text-blue-300\/80{color:color-mix(in oklab,var(--color-blue-300)80%,transparent)}}.text-blue-400{color:var(--color-blue-400)}.text-blue-400\/60{color:#54a2ff99}@supports (color:color-mix(in lab,red,red)){.text-blue-400\/60{color:color-mix(in oklab,var(--color-blue-400)60%,transparent)}}.text-cyan-200{color:var(--color-cyan-200)}.text-cyan-300{color:var(--color-cyan-300)}.text-cyan-300\/90{color:#53eafde6}@supports (color:color-mix(in lab,red,red)){.text-cyan-300\/90{color:color-mix(in oklab,var(--color-cyan-300)90%,transparent)}}.text-cyan-400{color:var(--color-cyan-400)}.text-emerald-300{color:var(--color-emerald-300)}.text-emerald-400{color:var(--color-emerald-400)}.text-emerald-400\/90{color:#00d294e6}@supports (color:color-mix(in lab,red,red)){.text-emerald-400\/90{color:color-mix(in oklab,var(--color-emerald-400)90%,transparent)}}.text-gray-200{color:var(--color-gray-200)}.text-gray-300{color:var(--color-gray-300)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-green-300{color:var(--color-green-300)}.text-green-400{color:var(--color-green-400)}.text-green-400\/90{color:#05df72e6}@supports (color:color-mix(in lab,red,red)){.text-green-400\/90{color:color-mix(in oklab,var(--color-green-400)90%,transparent)}}.text-green-500{color:var(--color-green-500)}.text-orange-300{color:var(--color-orange-300)}.text-orange-300\/60{color:#ffb96d99}@supports (color:color-mix(in lab,red,red)){.text-orange-300\/60{color:color-mix(in oklab,var(--color-orange-300)60%,transparent)}}.text-orange-400{color:var(--color-orange-400)}.text-orange-400\/25{color:#ff8b1a40}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/25{color:color-mix(in oklab,var(--color-orange-400)25%,transparent)}}.text-orange-400\/60{color:#ff8b1a99}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/60{color:color-mix(in oklab,var(--color-orange-400)60%,transparent)}}.text-orange-400\/70{color:#ff8b1ab3}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/70{color:color-mix(in oklab,var(--color-orange-400)70%,transparent)}}.text-orange-400\/80{color:#ff8b1acc}@supports (color:color-mix(in lab,red,red)){.text-orange-400\/80{color:color-mix(in oklab,var(--color-orange-400)80%,transparent)}}.text-purple-300{color:var(--color-purple-300)}.text-purple-300\/90{color:#d9b3ffe6}@supports (color:color-mix(in lab,red,red)){.text-purple-300\/90{color:color-mix(in oklab,var(--color-purple-300)90%,transparent)}}.text-purple-400{color:var(--color-purple-400)}.text-red-100{color:var(--color-red-100)}.text-red-200{color:var(--color-red-200)}.text-red-300{color:var(--color-red-300)}.text-red-300\/70{color:#ffa3a3b3}@supports (color:color-mix(in lab,red,red)){.text-red-300\/70{color:color-mix(in oklab,var(--color-red-300)70%,transparent)}}.text-red-400{color:var(--color-red-400)}.text-rose-400{color:var(--color-rose-400)}.text-sky-300{color:var(--color-sky-300)}.text-sky-300\/90{color:#77d4ffe6}@supports (color:color-mix(in lab,red,red)){.text-sky-300\/90{color:color-mix(in oklab,var(--color-sky-300)90%,transparent)}}.text-violet-300{color:var(--color-violet-300)}.text-white{color:var(--color-white)}.text-white\/40{color:#fff6}@supports (color:color-mix(in lab,red,red)){.text-white\/40{color:color-mix(in oklab,var(--color-white)40%,transparent)}}.text-white\/60{color:#fff9}@supports (color:color-mix(in lab,red,red)){.text-white\/60{color:color-mix(in oklab,var(--color-white)60%,transparent)}}.text-white\/70{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.text-white\/70{color:color-mix(in oklab,var(--color-white)70%,transparent)}}.text-white\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.text-white\/80{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.text-yellow-300{color:var(--color-yellow-300)}.text-yellow-400{color:var(--color-yellow-400)}.text-yellow-400\/60{color:#fac80099}@supports (color:color-mix(in lab,red,red)){.text-yellow-400\/60{color:color-mix(in oklab,var(--color-yellow-400)60%,transparent)}}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.italic\!{font-style:italic!important}.not-italic{font-style:normal}.diagonal-fractions{--tw-numeric-fraction:diagonal-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.stacked-fractions{--tw-numeric-fraction:stacked-fractions;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.normal-nums{font-variant-numeric:normal}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.overline{text-decoration-line:overline}.underline{text-decoration-line:underline}.underline\!{text-decoration-line:underline!important}.decoration-dotted{text-decoration-style:dotted}.underline-offset-4{text-underline-offset:4px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.subpixel-antialiased{-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto}.accent-\[\#38bdac\]{accent-color:#38bdac}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-55{opacity:.55}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-none{--tw-shadow:0 0 #0000;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)}.placeholder\:text-gray-600::placeholder{color:var(--color-gray-600)}.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-\[\#0f2137\]\/90:hover{background-color:#0f2137e6}.hover\:bg-\[\#1a3050\]:hover{background-color:#1a3050}.hover\:bg-\[\#2aa896\]:hover{background-color:#2aa896}.hover\:bg-\[\#2da396\]:hover{background-color:#2da396}.hover\:bg-\[\#06AD51\]:hover{background-color:#06ad51}.hover\:bg-\[\#07C160\]\/10:hover{background-color:#07c1601a}.hover\:bg-\[\#20B2AA\]:hover{background-color:#20b2aa}.hover\:bg-\[\#38bdac\]\/10:hover{background-color:#38bdac1a}.hover\:bg-\[\#38bdac\]\/20:hover{background-color:#38bdac33}.hover\:bg-\[\#162840\]:hover{background-color:#162840}.hover\:bg-\[\#162840\]\/30:hover{background-color:#1628404d}.hover\:bg-\[\#162840\]\/50:hover{background-color:#16284080}.hover\:bg-amber-500\/10:hover{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/10:hover{background-color:color-mix(in oklab,var(--color-amber-500)10%,transparent)}}.hover\:bg-amber-500\/20:hover{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/20:hover{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.hover\:bg-amber-600:hover{background-color:var(--color-amber-600)}.hover\:bg-blue-400\/10:hover{background-color:#54a2ff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-400\/10:hover{background-color:color-mix(in oklab,var(--color-blue-400)10%,transparent)}}.hover\:bg-blue-500\/20:hover{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-500\/20:hover{background-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.hover\:bg-blue-600:hover{background-color:var(--color-blue-600)}.hover\:bg-cyan-500\/10:hover{background-color:#00b7d71a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-cyan-500\/10:hover{background-color:color-mix(in oklab,var(--color-cyan-500)10%,transparent)}}.hover\:bg-emerald-500:hover{background-color:var(--color-emerald-500)}.hover\:bg-emerald-500\/15:hover{background-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.hover\:bg-emerald-500\/15:hover{background-color:color-mix(in oklab,var(--color-emerald-500)15%,transparent)}}.hover\:bg-emerald-500\/20:hover{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-emerald-500\/20:hover{background-color:color-mix(in oklab,var(--color-emerald-500)20%,transparent)}}.hover\:bg-gray-500:hover{background-color:var(--color-gray-500)}.hover\:bg-gray-500\/20:hover{background-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-500\/20:hover{background-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.hover\:bg-gray-700:hover{background-color:var(--color-gray-700)}.hover\:bg-gray-700\/40:hover{background-color:#36415366}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-700\/40:hover{background-color:color-mix(in oklab,var(--color-gray-700)40%,transparent)}}.hover\:bg-gray-700\/50:hover{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-700\/50:hover{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.hover\:bg-gray-800:hover{background-color:var(--color-gray-800)}.hover\:bg-green-500\/20:hover{background-color:#00c75833}@supports (color:color-mix(in lab,red,red)){.hover\:bg-green-500\/20:hover{background-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.hover\:bg-green-700:hover{background-color:var(--color-green-700)}.hover\:bg-orange-500\/10:hover{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/10:hover{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.hover\:bg-orange-500\/20:hover{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-orange-500\/20:hover{background-color:color-mix(in oklab,var(--color-orange-500)20%,transparent)}}.hover\:bg-orange-600:hover{background-color:var(--color-orange-600)}.hover\:bg-purple-500\/10:hover{background-color:#ac4bff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/10:hover{background-color:color-mix(in oklab,var(--color-purple-500)10%,transparent)}}.hover\:bg-purple-500\/20:hover{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-purple-500\/20:hover{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.hover\:bg-red-500\/20:hover{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/20:hover{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.hover\:bg-red-700:hover{background-color:var(--color-red-700)}.hover\:bg-red-800\/50:hover{background-color:#9f071280}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-800\/50:hover{background-color:color-mix(in oklab,var(--color-red-800)50%,transparent)}}.hover\:bg-white\/5:hover{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/5:hover{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.hover\:bg-white\/10:hover{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/10:hover{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.hover\:bg-white\/20:hover{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-white\/20:hover{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.hover\:bg-yellow-500\/20:hover{background-color:#edb20033}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-500\/20:hover{background-color:color-mix(in oklab,var(--color-yellow-500)20%,transparent)}}.hover\:bg-yellow-500\/30:hover{background-color:#edb2004d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-yellow-500\/30:hover{background-color:color-mix(in oklab,var(--color-yellow-500)30%,transparent)}}.hover\:text-\[\#2da396\]:hover{color:#2da396}.hover\:text-\[\#5ee0d1\]:hover{color:#5ee0d1}.hover\:text-\[\#5fe0cd\]:hover{color:#5fe0cd}.hover\:text-\[\#38bdac\]:hover{color:#38bdac}.hover\:text-amber-200:hover{color:var(--color-amber-200)}.hover\:text-amber-300:hover{color:var(--color-amber-300)}.hover\:text-amber-400:hover{color:var(--color-amber-400)}.hover\:text-amber-400\/90:hover{color:#fcbb00e6}@supports (color:color-mix(in lab,red,red)){.hover\:text-amber-400\/90:hover{color:color-mix(in oklab,var(--color-amber-400)90%,transparent)}}.hover\:text-blue-300:hover{color:var(--color-blue-300)}.hover\:text-blue-400:hover{color:var(--color-blue-400)}.hover\:text-gray-200:hover{color:var(--color-gray-200)}.hover\:text-gray-300:hover{color:var(--color-gray-300)}.hover\:text-gray-400:hover{color:var(--color-gray-400)}.hover\:text-green-300:hover{color:var(--color-green-300)}.hover\:text-green-400:hover{color:var(--color-green-400)}.hover\:text-orange-300:hover{color:var(--color-orange-300)}.hover\:text-orange-400:hover{color:var(--color-orange-400)}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:text-sky-200:hover{color:var(--color-sky-200)}.hover\:text-white:hover{color:var(--color-white)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-80:hover{opacity:.8}.hover\:opacity-100:hover{opacity:1}.hover\:ring-\[\#38bdac\]\/60:hover{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.6)}}.focus\:border-\[\#38bdac\]:focus{border-color:#38bdac}.focus\:border-orange-500\/50:focus{border-color:#fe6e0080}@supports (color:color-mix(in lab,red,red)){.focus\:border-orange-500\/50:focus{border-color:color-mix(in oklab,var(--color-orange-500)50%,transparent)}}.focus\:bg-\[\#1a3a4a\]:focus{background-color:#1a3a4a}.focus\:bg-\[\#38bdac\]\/20:focus{background-color:#38bdac33}.focus\:text-white:focus{color:var(--color-white)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-\[\#38bdac\]:focus{--tw-ring-color:#38bdac}.focus\:ring-amber-400:focus{--tw-ring-color:var(--color-amber-400)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:ring-0:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[3px\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-\[\#38bdac\]:focus-visible{--tw-ring-color:#38bdac}.focus-visible\:ring-\[\#38bdac\]\/50:focus-visible{--tw-ring-color:oklab(72.378% -.11483 -.0053193/.5)}.focus-visible\:ring-amber-600\/50:focus-visible{--tw-ring-color:#dd740080}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-amber-600\/50:focus-visible{--tw-ring-color:color-mix(in oklab,var(--color-amber-600)50%,transparent)}}.focus-visible\:ring-red-500:focus-visible{--tw-ring-color:var(--color-red-500)}.focus-visible\:ring-offset-0:focus-visible{--tw-ring-offset-width:0px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus-visible\:ring-offset-\[\#0a1628\]:focus-visible{--tw-ring-offset-color:#0a1628}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.has-\[\>svg\]\:px-2\.5:has(>svg){padding-inline:calc(var(--spacing)*2.5)}.has-\[\>svg\]\:px-3:has(>svg){padding-inline:calc(var(--spacing)*3)}.has-\[\>svg\]\:px-4:has(>svg){padding-inline:calc(var(--spacing)*4)}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:calc(var(--spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=active\]\:bg-\[\#07C160\]\/20[data-state=active]{background-color:#07c16033}.data-\[state\=active\]\:bg-\[\#26A17B\]\/20[data-state=active]{background-color:#26a17b33}.data-\[state\=active\]\:bg-\[\#38bdac\]\/20[data-state=active]{background-color:#38bdac33}.data-\[state\=active\]\:bg-\[\#1677FF\]\/20[data-state=active]{background-color:#1677ff33}.data-\[state\=active\]\:bg-\[\#003087\]\/20[data-state=active]{background-color:#00308733}.data-\[state\=active\]\:bg-amber-500\/20[data-state=active]{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.data-\[state\=active\]\:bg-amber-500\/20[data-state=active]{background-color:color-mix(in oklab,var(--color-amber-500)20%,transparent)}}.data-\[state\=active\]\:bg-purple-500\/20[data-state=active]{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.data-\[state\=active\]\:bg-purple-500\/20[data-state=active]{background-color:color-mix(in oklab,var(--color-purple-500)20%,transparent)}}.data-\[state\=active\]\:font-medium[data-state=active]{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.data-\[state\=active\]\:text-\[\#07C160\][data-state=active]{color:#07c160}.data-\[state\=active\]\:text-\[\#26A17B\][data-state=active]{color:#26a17b}.data-\[state\=active\]\:text-\[\#38bdac\][data-state=active]{color:#38bdac}.data-\[state\=active\]\:text-\[\#169BD7\][data-state=active]{color:#169bd7}.data-\[state\=active\]\:text-\[\#1677FF\][data-state=active]{color:#1677ff}.data-\[state\=active\]\:text-amber-400[data-state=active]{color:var(--color-amber-400)}.data-\[state\=active\]\:text-purple-400[data-state=active]{color:var(--color-purple-400)}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x:calc(var(--spacing)*4);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=checked\]\:bg-\[\#38bdac\][data-state=checked]{background-color:#38bdac}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\[state\=unchecked\]\:bg-gray-600[data-state=unchecked]{background-color:var(--color-gray-600)}@media(min-width:40rem){.sm\:col-span-2{grid-column:span 2/span 2}.sm\:w-\[220px\]{width:220px}.sm\:max-w-\[600px\]{max-width:600px}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:gap-2{gap:calc(var(--spacing)*2)}.sm\:p-4{padding:calc(var(--spacing)*4)}.sm\:p-5{padding:calc(var(--spacing)*5)}.sm\:text-left{text-align:left}}@media(min-width:48rem){.md\:col-span-2{grid-column:span 2/span 2}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@media(min-width:64rem){.lg\:block{display:block}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}@media(min-width:80rem){.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.\[\&_tr\]\:border-b tr{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-style:var(--tw-border-style);border-width:0}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:calc(var(--spacing)*0)}.\[\&\>span\]\:line-clamp-1>span{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}}:root{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20% .02 240);--card-foreground:oklch(98.5% 0 0);--popover:oklch(20% .02 240);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(65% .15 180);--primary-foreground:oklch(20% 0 0);--secondary:oklch(27% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(27% 0 0);--muted-foreground:oklch(65% 0 0);--accent:oklch(27% 0 0);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(55% .2 25);--destructive-foreground:oklch(98.5% 0 0);--border:oklch(35% 0 0);--input:oklch(35% 0 0);--ring:oklch(65% .15 180);--radius:.625rem}body{font-family:var(--font-sans);color:var(--foreground);background:#0a1628}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-pan-x{syntax:"*";inherits:false}@property --tw-pan-y{syntax:"*";inherits:false}@property --tw-pinch-zoom{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}} diff --git a/soul-admin/dist/index.html b/soul-admin/dist/index.html index cfa4294b..4f07061e 100644 --- a/soul-admin/dist/index.html +++ b/soul-admin/dist/index.html @@ -1,13 +1,13 @@ - - - - - - 管理后台 - Soul创业派对 - - - - -
    - - + + + + + + 管理后台 - Soul创业派对 + + + + +
    + + diff --git a/soul-api/docs/master.py b/soul-api/docs/master.py index c17f89b8..59a4cb1f 100644 --- a/soul-api/docs/master.py +++ b/soul-api/docs/master.py @@ -119,7 +119,7 @@ def run_build(root): # ==================== 打包 ==================== -DEPLOY_PORT = 8080 +DEPLOY_PORT = 9090 def set_env_port(env_path, port=DEPLOY_PORT): diff --git a/soul-api/internal/config/config.go b/soul-api/internal/config/config.go index 5c27eda6..304a949d 100644 --- a/soul-api/internal/config/config.go +++ b/soul-api/internal/config/config.go @@ -154,7 +154,7 @@ func Load() (*Config, error) { port := os.Getenv("PORT") if port == "" { - port = "8080" + port = "9090" } mode := os.Getenv("GIN_MODE") if mode == "" { diff --git a/soul-api/internal/database/database.go b/soul-api/internal/database/database.go index ca1d933f..99518baf 100644 --- a/soul-api/internal/database/database.go +++ b/soul-api/internal/database/database.go @@ -40,6 +40,16 @@ func Init(dsn string) error { return err } + // 连接池配置:防止腾讯云 CDB 等云数据库在空闲后主动断开长连接导致 "unexpected EOF" + sqlDB, err := db.DB() + if err != nil { + return err + } + sqlDB.SetMaxOpenConns(25) + sqlDB.SetMaxIdleConns(5) + sqlDB.SetConnMaxLifetime(5 * time.Minute) // 短于 MySQL wait_timeout,避免用到已关闭的连接 + sqlDB.SetConnMaxIdleTime(2 * time.Minute) // 空闲连接超过此时间自动关闭并重建 + skipMigrate := strings.ToLower(strings.TrimSpace(os.Getenv("SKIP_AUTO_MIGRATE"))) if skipMigrate == "1" || skipMigrate == "true" || skipMigrate == "yes" { log.Println("database: SKIP_AUTO_MIGRATE enabled, skipping schema migration") diff --git a/soul-api/master.py b/soul-api/master.py index c4c84edf..dba70a3a 100644 --- a/soul-api/master.py +++ b/soul-api/master.py @@ -121,7 +121,7 @@ def run_build(root): # ==================== 打包 ==================== -DEPLOY_PORT = 8080 +DEPLOY_PORT = 9090 def set_env_port(env_path, port=DEPLOY_PORT): diff --git a/soul-api/wechat/info.log b/soul-api/wechat/info.log index d31f9f9d..b503c93c 100644 --- a/soul-api/wechat/info.log +++ b/soul-api/wechat/info.log @@ -172,3 +172,51 @@ {"level":"debug","timestamp":"2026-03-27T18:23:13+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 249\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Fri, 27 Mar 2026 10:23:14 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 0892B599CE0610A60218D2CEC05520A8E02128EFD204-0\r\nServer: nginx\r\nWechatpay-Nonce: 6c9d80dc4bd6f0ec023fee64ecbaf517\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: bNytAH4NrLgb8avYDtWnXqe73hze0ZfGlqzfEI0+alBAt3cErrOl/SJeochHiekplEuuqqvf549BMjRwp1xhSU8BmPZMNO5dDaGIVNCOD1eLKIMbFaEQsiT2EXo7Pueq6pZda13zMe5wPGCqNmIROs//nDRXk/TgLT79RXOKYmh7kDSoX/SGhjCymrmwKkaytcErpn8miWqpbwl+0ZKFaoeJDb9DO7sbj7IeTLJxK1QAQ8rg5LnnKRRWzipnEslSAO7quVZNSRV6iXGvgXac83k6B5I5NGCDCsg7StZI9v7JnVTOU9ggrwROWt6way9JmK1/BKbVK1pFpKw0c/zXEw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774606994\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":100},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260327175317081300\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} {"level":"debug","timestamp":"2026-03-27T18:28:13+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260327175317081300?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"t14tjFFt7TDBm6GRUgTOhT3qruhPSlWt\",timestamp=\"1774607293\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"gjyVaVX1Dl+NSsQf5rajxCZfKsrxlKIFbRooJI2NfzLioCYVy/vc21MuR+ImKcSQ1CCbeilpuTwo5vOjnq9p8pEZE+jK8PNg8oB+MsHfrkcZoQqKRK1Khvoj7LjElYWD3FtJy8l5slEY2ucwaQW2DiSuYBjazZG7cpprH4iwjBy3lUhX5xpoiK/5sdSBWcrdz/g5J1wPoeuzEonyWhEQH0NOWTJzhgP1Tw1/vRbjyeV0hAmfMjnKUm8zf94icCioSHi6UspXG2EvdWFQlBmirBJWs7sSFKDcFGhO8a3bvhX52CoPXL98uLZGVfj/HNJjgcnyqdUBc+vbB3+Kv52Piw==\"Accept:*/*} request body:"} {"level":"debug","timestamp":"2026-03-27T18:28:13+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 249\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Fri, 27 Mar 2026 10:28:14 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08BEB799CE0610F30118C4A9C0552098860B2883D705-0\r\nServer: nginx\r\nWechatpay-Nonce: 19151c02244f70df955a28a0c795538a\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: h970oEQru2q0k8GXAWL07TNFuV74qeQ1sX/4AE/xQP7bM0fsQGdf4XaHogF52Z6MQEBa/AHqmka9yhg0FZ5LINsj3s4J0EHIaOzxyhfaum83GjhIwtV0cadhmJG/y0xoUC/VfqpEKHXptlCgdBiTzEbrLML+r/izBYCGO0ufUr77HCh7O9VIYNLHeaDHmji2gNSfsD5ePQFSSksQZzouPMR21SORptdXAS0e5qN7SKS67/gMipJCtMUdkFTcEKyESBXzlKKA3NXiBg7tc9VO4Dit+xE9ruvdUJZ9VoGtVCoVDXBx994x+YYfnovIwVim8J804xySSn10FXio5tyb3g==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774607294\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":100},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260327175317081300\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-30T14:15:02+08:00","caller":"kernel/baseClient.go:457","content":"POST https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"FkNynreMzVusP4DXvecdoACc2MTOJPxP\",timestamp=\"1774851302\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"TNFNJ0teot5TXVVbeSdQhRRPiG3gMhKKzixdU7LoWrwLjQBu60DIHawHQ8W2URebm3tngHExtxm83QXnX3WDn9XFwTZuIS3/cEyxRUf4VN/d02ya094Pwcz6YFbOVyRFKmAVGXRymT4RoGAZkQ3FyiCqgjUeHKOx1ymxms6a7sCKSWA1JBvcK0lNA7TJnnP100Q1AzIWLWKz7TNerf/4FgmtnAH+TVFTY3DVGDAxIvZQlHM4WlM4+3QW/9iDBNMEQGfAOjgRLqwjc88iKc9u1o1Cs99pxZHLzaHoCvQDtdchbeOvlm1GmP/keuynQBYz/Se56+4Nr+ssIo+V0wRcYQ==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-30T14:15:02+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 52\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 30 Mar 2026 06:15:02 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08E5A9A8CE0610AF0518E7B7C0552086DF2128948304-0\r\nServer: nginx\r\nWechatpay-Nonce: 1631b91f4e225c21e2f6ea4dc79ec62f\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: KhA2PLwcQyL4+qqgW4TzH3dVcUHHwZkJnlVy7EuUU00WHPimyx7SLeGYUHlE3ZpaT3BvV9pMOnDp/Kf+S2QWzbBww6EeinUfQ1lGb0ouaOXKtNg101a4wBuC7GTmwDDP66Z3UQlfIU+D67MHlv3qX5J774Jo9MlRT+Ypg8bYMgNsmKZKqTJMEcF2n536bRFFHxlq2A92zX+isR1bPvMLWa5gdnjKZ+qSdbWHUh+IqgTRXb9dbSdVaDGp85fv57PmSLgZDJGejhAmnT+9BRK8S0DTFXumA3yD27Gdu37j3ceimdVAoP8YSSj7LACb7AZS9e1p98YJ7ZYuN1xx4MAoGA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774851301\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"prepay_id\":\"wx3014150193595831a367058e176d060000\"}"} +{"level":"debug","timestamp":"2026-03-30T14:15:10+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260330141502430700?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"bsEisvic20nkvxIutW2FLW5sj1dfLQAB\",timestamp=\"1774851309\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"d6XWpaaeICTxYulvupoS1PzyRnjItgKzOJ7GeZEc3kdMuw687x5UrXAY3PeMr4/+GDU6QFWV1yft3rJyRTpQtWJ0M+QU6XYwo0G/h0KMWDGM4tkzj9K7qxxCH88ix5tWThxtQnosiu+7eWGcrC7lAz0kiFSb5dcOmtgdKS8J1rWpEsz5Fi0fallpPtj4S3QUnkg94iPRadKjSAGKCGEq3JISSs+nuew1QpaP1EewKEleBWlc6U5ij17OZ+HKy1OeYdD706SsiB/QZkGyfKiWvuG2OVfQOQeraofwjUPGRTWL23Loa6Ie8wgrtKRpmkV8vWP+B2esTX3ypWlK7tL/Vw==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-30T14:15:10+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 249\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 30 Mar 2026 06:15:09 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08EDA9A8CE06108E0218D58EA85C20CEAC302884E804-0\r\nServer: nginx\r\nWechatpay-Nonce: 7624a35c7df896e731e76b70475eec04\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: N+zgqxDQ+oeBNAk+pRLtsMrQLbHBLsROoWUzbI9yAJCXivn6HtdY1zDoal34iewzP2x9jke6oQnuKq2Mkvkmii/wd+gRpVSZgO3RwprTbrGfABYUqhNAAhjdl7F3Zm3vexGbU04QAlA36ya+Z5fdVtTT76/6AQxjbgxLPq3JSdWDoF+S8RBhFcMj35HGrkq68OAWzxQINTw0mevrbUvBSidqHxCj/JW7b22W6mtaodCUph5Gueotfuyv23JEKUC2yXRurlndyiPI6d8pFOdN1rZ3vYPEnAwUq/3dUGLgFKvvfCCELdnL8u5FzG+nPDOmYV+hiDcD5spu80rHLemBUw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774851309\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":100},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260330141502430700\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-30T14:15:53+08:00","caller":"kernel/baseClient.go:457","content":"POST https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"F6v1c141kxJ7bOniITsQ7toCeUloF5me\",timestamp=\"1774851353\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"m8hdHYkiohN7BZDwqTcb2HSuDxUVa/oF0spgMM68hFVwzFUbQZcQAjItA3ALmRzM5KZ8avMOGaXU4cKRqFSgC+7hCZw7cZlLdxVUJ0o7UekU2mRjHEQDAv0oXftdXJWL+h/f4a1M3Ml+sPChrdrO2KSAoo7eKv/3SftJGbZFsWPiMbERq78K99StsxLX3yrMvB5jclEhnni2019GSj6N0B3GnkNomNwvQvWvFrVWvaB0mjVWRwp5T2X3okN4n0qM1z5Nwd3hIMGOayPjRiyaVUlsunIqLqNNEeXtR/ZH80/tO/qRoMupJJu6Tnp554HUGklLJfvphIu/JGKqS6yhyQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-30T14:15:53+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 52\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 30 Mar 2026 06:15:52 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 0898AAA8CE0610FF0418C4C2F8AF012080B2102885A504-0\r\nServer: nginx\r\nWechatpay-Nonce: 1f1c52350d5a88ef97a48d21c0bb350d\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: NCYaHMoWl/ycA7d4G7Za7ADbfpXPRyOj+zeva6NjBePOY3gdSE0h0PkJLX1MLMxyMo2nv9+Oguzjfe3xzvkoSmJ4Ncz/cDDHiaf8/ar+rOLSe99jFEAhmdx7goN3Lv0BSH1qbFM08DlMJN1p9MuzQ5J3IkBDA+gEwYVNHK+1crdA8noyYjQjbKeHOzmQl/soRl67YS7U0iw1fDieRoCFY6F60RYmTKWc9yY5WGaQ3gD29v0Bp5TEwTpVwpWijtpr4IqeopSLre+Rkr1Fa2NZtWa/5Qm+ylCW65vH+pSwku7GeIKYtuHY4FH0q4slaZU97P3hOWaRUMO+0BFqQpZzOw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774851352\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"prepay_id\":\"wx30141552867097a1f5369b46eb27d20000\"}"} +{"level":"debug","timestamp":"2026-03-30T14:20:10+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260330141502430700?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"FV89JCA83V0EZjZLqJlQWTgT749g32pe\",timestamp=\"1774851609\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"BCqtoyi5TJV/aR1NQm8L+jqi9i+0GEic+P3qyYfvgxluPL7QpYfBvbdx8hALamGx4cuwdS3e7ANvfLH/QyI1ojZmkbLwrEtgEGGPoyTPBmYUK22Oc1niUpRk4+YP66FXD3rbRuyxRha7pCig/Jjocm79+n+S8BdDq7MElDVzratP0hsreTqiDFXDJhJFnXuzdxM5GHRdZSkCJdFSb33fhTr4V5QnrkuUlU3Fj5cKAxZw65RyAr+D/hGOPLUO/1VZpcV7SlBQIckcsEmYWxGPXVl3g/+lO+GUWcpKYFekAe7fK9IfH+oOUECykITkf8bHJN7zNRilMTrVqaJmWxbkhQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-30T14:20:10+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 249\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 30 Mar 2026 06:20:09 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 0899ACA8CE0610DB0218DD9F85AB0120C09D08288BD004-0\r\nServer: nginx\r\nWechatpay-Nonce: e58d9f4fa2ed6d751ae87cf4955d1cd3\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: PlHfPkRe/cIsNRtDyQNEO6Ti01CLfZazP1tpH4MyZ82rKCC3mS3kwtqSn7MlWeJUlmDkPD5OHJBcIku3YiJ+mwyQU30t9YzW56jscAh22LMZJCT+jf861yE+tDnxakKFvAUvonQeI+wmOK70G6T+390alco5Y4FHAlJn+eZKRIVroMLeW6V2bsTGIrH80zwy0CmrenIKvOGrUTpiAEsAEUd/VdxNxtpoVl5NJbvEWxu11OwD/Cnm27Q7PGsRUiAnoUcdJbOQqB3AU9JmJrSbyEVsHhoQsB7c1idk2KViObFmT08Rb1NF/biSeTLa3e3dqUb75HHnEadUrUJnDkitNA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774851609\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":100},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260330141502430700\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-30T14:20:10+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260330141553661200?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"XnEQxs0aVjAJbdmEqg74NN6fEhWMQH5O\",timestamp=\"1774851610\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"6bzn6Oaq9sKe9HdhcnKJlFRAP6WKS04iDwXuaAdXXm5S0qbcqeLGv23c3DQsPyaVMAlBhglapWiLjLKcLlj4ceGz76MQLojJdz+4KRTLS/E8kneYehLKm5KmLRc+7GvFRSj/GVtjNp/AYI591tIGEoLEGuW5pIasgqEz8CFZMTuZMV5dBduKCnpNSP4dGzc9qeNpDfY5CxzJgaTTea5IplsINOkPntKO0yYbGbJT/2BnWZWAZoPy3X074ZhByh/EbBsWNY+LrFgSTzDcZteuBl5fmB5aOS2tLRO221N6nUSGCDniUEp5UXJoA0OWWOteZYLvrxVgf6d6L1oSCXUDDg==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-30T14:20:10+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 249\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 30 Mar 2026 06:20:09 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 0899ACA8CE0610DD0418B381F8AF0120D4820128E5F305-0\r\nServer: nginx\r\nWechatpay-Nonce: e1f3b65ed7f45d966461eb644aded308\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: owp/QYwCz9zca8tuxrd0LsMEZPHPniDoNVXMHavxPLpouYE5tNCXiGPnJZZcI+JgSN3JE4ScGy5yxBv29Pir5lU0ewz+Ke/ZIP1DdgeeFITAqUut1pTz3YnTOyKmJF05lKKxHkxMnS3N1de2BDLGATQI7RJinQ4T/X2+PqV8RuRV4X9vHUSuYJ4GjdwCZjLeTc/rYk4EFpczcG8o8XH6Ckv2n2IX5berGwEB931l6elBY5S6R+aZFYsovhzorBinc0JK/jvigFqQjruvlk3BG2d00fbI8t/N9PUpUfiNQ0Jum5+Bzl9jET+nf8H2wM/HTEQwmsw96W6h4hKvOJkV3w==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774851609\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":100},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260330141553661200\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-30T14:25:10+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260330141502430700?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"gjDcsw0z7GBFKiZD07WwGxatuMUSJ4JT\",timestamp=\"1774851909\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"tvaPUBJ6JCH3WGmbVA6FJDnyx3SVJno48pWlCiMI1BHvxN5ZckTj3KyFiVo3uErK1XpfsEHlwMy+SRJyk3lse6pP2IIMbBqc+FjLHfPS4+ejDZMrNDyr84pwggqYky1hGwqx4ni8YEowMGe7ftanXc1h4RE3RtdOXvtaXfpD3eR1MZ/dyQmoQwEHN8FXlDylgA4ucUKolhvnmYNJhiTM+T6RypNdFEmvjKzd+jzFxHEjnz0syxEikwm67ZOVZHKGjiH1NbGmGowaYZ2M6w8vwVu1WdzOKM3VupHad+weJt4k1v60pzozkDldd4+A1W9C8Zbdz+EMZGTaPnig6ZtkOg==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-30T14:25:10+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 249\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 30 Mar 2026 06:25:09 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C5AEA8CE06109F031890D28C5820EC802928FAAE02-0\r\nServer: nginx\r\nWechatpay-Nonce: f8b3975585fefdea54488670491d05bd\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: XHr9Q9WpQikjpr98x+oxuax2jJsVdUb347og7eHQVlWRhxB5wpxlpfd8VDtmQgPDR0FaOQITqaTfkGXEbRV5cXupfdecYQx8zkNwD9KKq+o6yNDC8P5SKtEONYEREG6viCzZwTf290I5iS+ntPs1wwbEMvZvkj8aTpMFK6ehs+6+NYkHf8KdScf01H5PDhUbW3U2vwwDtb1k3/j3SXibr1W989kQP9D7MHURnFo6URxF3xfj7PkjUaexdopPEDCJ0Cpd7nyXS3hirL9Rlq9pyhAtFO3Y2QhUDen189dyk1WhgZcvjvcuLflIgBITRfHylcUuHlJVrX/nK8M/Rs2RBQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774851909\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":100},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260330141502430700\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-30T14:25:10+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260330141553661200?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"02Ma7tcBhNEcMB0tNTSzicdLpSCfLkGX\",timestamp=\"1774851910\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"fpD7YqaEpMlgXg0RplDhsFgVUPOSXeXbOJ956tU0Cgq5IaDqDJNhjFyscheg6sHMMFtsehk+cW488eTXujfVTREwwALlFWy4KESCmA5JhyK3pedGEmDJUZJ89d1Q74+yxnrRT6ZBtrxST/6qGSYg+gwv85a0fcEXpAJ13gMXnSCHS2D0PGs8miSFjDFxOUgBfKAISJmBKQtWpx5mgf5NZY/CXZr5hB8xvvqgOa3t3YqJfI+1tcQmyzOSJE15X4QUebhmeIHCNzLN7CJ1dxSpdh9ZmeZO2fC6a/pLgFIEO7YMk25S6mWgyOW/PuApVhWRFNkkVaJTJzu179GFZxctgQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-30T14:25:10+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 249\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 30 Mar 2026 06:25:09 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C5AEA8CE0610A7051890B5F8AF01208EFD1228EFA301-0\r\nServer: nginx\r\nWechatpay-Nonce: 486dc8d4393c960d1daf8afa48da9dd2\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: P8WZ66qvBt0iWkFfGeybs5cKfBmiAs8slhxsb7WP44YFLYuhSnwZ0aSQtfcokmfowdRwsmiwL/UnKUydF2Uk+ag7wdDdIc4A8jXzhD62h05+uncOHbEhpKks5yOTyXRLygP+m0M3urTr9hNfbSY7Z/x8eVZ6GRFn3nweHwByLzGxuFEQzZhMAlVJSQZZhegru6Dm3Qd5Pk1IJXtE5lE0xB9Wx3E/D+9Tj4gGAirV2FoNHQPeZOC0NMe4i0+WVQoUwrYDvQu7hKllzHYBWlJiC/K3gPGxyyPiXFC3ipoMDtjWZ/a2VY87gBf3ywfkkkJfjzgj1lhlPCeotr6Tiljx6w==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774851909\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":100},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260330141553661200\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-30T14:30:10+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260330141502430700?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"ePixenOdEccxmBCdp4bP4oaZb9WN5oO2\",timestamp=\"1774852209\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"M3um9vghPz8TxWhT2+2R9CjDckV4bSvlu+3us8tlRdRqwUpZqAbM6t4T6TKn2QUkNUMwKExiWStrsw2UVcHt76RU0MY7sm5cO6b4sCrJNL8XEall4oAZD3BBggvbb9mY6kfRY7N2L38I0ARJ1JjBi6vvW3IIEOSr+4l23Au9d9BSFi99wBeaq9AjrRqhhWBKc9V5snHH5XXcb3tMYgf/rkAeeHSesVkZltgPe2aAK4MEx1uMiFLTXRmrFqQ+p2bC+gisKBQgQCmnpfZXJDUjFh/5KjvEG4rV7nINWroly+uMS0SBEsACIDQOYTRchT3QTrA/uZdXHBVi4zSrrp4yuQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-30T14:30:10+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 249\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 30 Mar 2026 06:30:09 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08F1B0A8CE06109A0318EFC7C05520C0AB0C28FCFB03-0\r\nServer: nginx\r\nWechatpay-Nonce: 7ab31e795dbe5f6bfcb0c2a90c3b1b1a\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: az5aGopJR4B5+1qvZDHrCR0BMaCIK33kvtmyztyWQUMFOgbEp9FSxeoioQiRjXeq918oC0fs3mcJJM59TFJQpzjLYw4vU8EVD15NkjJxEmT0lfiRzsl2T4+c+W5ipnDrs5c74LwofA6NqZC6yl26SxeyHOVFFuwJGQ0vMEO9nyGuPjhctiAQTGUd6aGEusHjztlbjWWx9AglfXTkznts8Z41+mB1cRAw9ObVe4csjAZOarCnn42Nw70X2Sx0pkfYi/pHm7WJR4ECtE1CpH/CyN5J+LXIQqC/KWcb0iwdnQoTjeIEtKm5+kt4P+1JlT5/RYipErlt5r9V2YEyoX8Tog==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774852209\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":100},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260330141502430700\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-30T14:30:10+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260330141553661200?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"PQzDnui3H7y3Mu4QCTmZVyGACvEQVkxa\",timestamp=\"1774852210\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"5pUsbdLLKrDWvqxb4GwdBxkbgAts6thU3TK//ZtIGNmf7TFrh/ie9Me4iL0AD01l2/yo+MxA0GLrGe/MlS+6VQo4WQH7yq6PPL5e4JwSalhQ8W1YabEFgfsTgGzkjaI6mdkYv+DFoST7SAAppTLKoL3dvUW/p6Bgn81AFH7mr5JzwdtntRq7YwTJJ0tZMU0lmga/IT9BSlPL2/PtNad4wup1tgvWblBnUqcgWcTfTDURLm7PnxW3iSt0iWT6b/dO/gJMkPz4e2neq7J6xJzq6wKN9/1W4mpRkpkojDwk9Xnx4ZkkIsKKAnya5r+OvZhvYKiiQkRtJOCFf3ZeBK0YAg==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-30T14:30:10+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 249\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 30 Mar 2026 06:30:09 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08F1B0A8CE0610980518BC9885AB0120CE880428ECFE04-0\r\nServer: nginx\r\nWechatpay-Nonce: 84186f9bc1e5f3a8eaa6fec1c47874c5\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: NX3BcYjsbqO1IgEkLx5mNkgQ4ypB6gwQwGeMxuDVV03wcsz1xxuL/BseHVOa1oqahZHphXEScazIaOiqTmI/vhqkbsbT9TVbY5Xlmtzr28nK35GZWtIsBRy9OOdYWH4DQCi4Y6XikFK9y3JP61khW/FxQG73EcbnyCLEThrKlD8Tq9vLqY3ABlr2H7aJx87DP0iYaf9++g/o2JhhdpsYY4CGqwJPOQ9PGRYG5zWnPAOW/BW4w7jHFPr2JatvSZya9XCbLPB4rbbdCrTefHljpPxx0EfRnf0MqYZeehircLi/4/j3CcgxRHQq7ntKfB3WPKLMeClSlVASjGxzS1s3vw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774852209\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":100},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260330141553661200\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-30T14:35:10+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260330141502430700?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"4bAWnK8oLY0uIWYjQ86QPwKXWN94LoCo\",timestamp=\"1774852509\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"MoMWkmv7sOCfx85+ClAy3FfOS9YImgMMo+lRsbA0SXFx4c67FbJMqEVVWXiJDSKWXd8tyF7OKA/qwBJntX5SYfZNQ5ayJjwjxacSubD+qWHz7vXD5uN6XGrCXEmXc3gJVAzwPewZ4ArPbf6/WUJ3eCzOeh9HhPiMW6HIs2pZAqU7xR5HJ18hh6wcOCB/SFI3AqYg8FEFWlEp2Huvbb46JPXVPcNAsCBHtJmGoxl5QJsm8U8guvl5IDjoh/kh+uNVngsX8dp3sX+8QXKblJYAQws/+spWqPeRLqJCs3QnWNTfLGJA0cNUwc9SXCaG25x6JwcFwZOQAB3Dx+GZCswrSw==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-30T14:35:10+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 249\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 30 Mar 2026 06:35:09 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 089DB3A8CE0610DF0218C2E7F8AF0120F8C40628D2DD03-0\r\nServer: nginx\r\nWechatpay-Nonce: b8ae21f69a2b1592b6eeac798fe42378\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: GrquJPPVxV9eb8qV+yFDryIUFHmwT+9ZtrYSSwQdh9vjaA2jAAFtoV0guHE8umPCqQiFU1oSQsSeyLoA9auiv1t/VZTfkQKPIp2bMWUyMi7w3zI7oim+nvuiema7mnts3mlktZGxdzIB46r2sSAnfaTDi5YAmrhf1/vOuNatQ9cJXL++YZ7Gp033PZd+hdStm8PNFs22HMWm3JiMEKl7ydsaWB5GACutUZoJx5svccXYvjOMy8qMia8YmA8hFqHWCjpfrWJdxRZFJb9kiXNV1AAi13itAArMyU+K0YwVvzLMectAjBQB9B5/WnMgATrooRx4izdcuoBFDb4p03stKw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774852509\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":100},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260330141502430700\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-30T14:35:10+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260330141553661200?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"RNSWcH7FC2xUQRgDIttuQVgTfEQwer2f\",timestamp=\"1774852510\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"WjxMo2lp+VDR68yINeHoRvUIu8NPN0GMDF2feUnvWuoVcgCW2/coazWCWGi0D4+1cAtAosBEZC1b2Cbj2pCdjkPNYt2KwskqME6zxM0N44UA1Rtn46hV3nD+A5UjEz58PzTSMIyIdRNXEE4LjSfT28b+Gicjw81H6vn5hq0Ve0wHw6xZ9/Y+GVbhmhp3ItT0OId+jbGHltt+OxmeqfM4tpWUjH4BtS649Um0DKvlmWOggPkhFLrQ38QIDbk8nFy5bYEo6i52QimEKCKWpWD7DD5ZAwltLkmaAsLgEljjNfxe5DtNEFjLxbuBZbS1q6LJIzyWmFIiIcwevQ4ZvbFDDA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-30T14:35:10+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 249\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 30 Mar 2026 06:35:09 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 089DB3A8CE0610CE0418BD82F8AF0120E4A12228B1E903-0\r\nServer: nginx\r\nWechatpay-Nonce: c0e3675048d27c3370109347f2af5f4b\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: ZNYR68RCNAFCgqTvVBxNgEENsynbtnTQhA/R+Yb6B93ayL/n6TQzcI1fMKHGnaw4pFVkMD3ZUW9E4v2A5hthMmezN3CNtW5Mtu9aHmW+2G2xWQzA0WYvvbar0k53fcM/LJZ7RDy4HaOteEvil+ZfvqgY5rvjO+TkBWpJbtrTbmxFKst3xhwJ4pjbTJyRBpgHqWnX3p+MaIqf2Hdob0SB1WZXF6OOH7o1MfOt5Y7+XF8jlyXADieJl0vjIaI/BI0dgoYVDtkgu3JuqGHrNdLNUSy7DnRzJD932C5ejLv4gGmDLUMtWNhmaLzoYaT7l0Fe3+Xo2TEsLL4jXHqEWNEYqw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774852509\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":100},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260330141553661200\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-30T14:38:03+08:00","caller":"kernel/baseClient.go:457","content":"POST https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"NcbNcarAbyX6xY1J0ths0sRfjEUhUuIK\",timestamp=\"1774852683\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"z2sZfs/k/+zqXPptt6rxL0KfqLTVMfFcZX4cfvr5eXeQWZcRIVLMLLq+qZjP5x3i1XrxHRfKYfXCzlKDnGLk9SYVVxJ7jcNFf++86F6flt/+NHCHNnGELNyVSBEg7Y5tUvWXGuHaovcjjWv9DGu7XrMEdckCBJ/tjGNs06mqeQiHOsC2HuvQfsNOxV8qtla6Rs/I9xh4Ul4NAHl+NAKVfh9xLtbRPge/oUpuybzdVJe0uDyxzj3SOCACakS6JildALgM6oATImKHOM5hGH7WBYojmqXP1rsfGgU0mh8Olh/dw71dc4UyIUq97w9DOBQeGZznqTZqyJ+TdRoBOJ1qDw==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-30T14:38:03+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 52\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 30 Mar 2026 06:38:02 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08CAB4A8CE0610920418B0C8C05520CCD42E28D78204-0\r\nServer: nginx\r\nWechatpay-Nonce: 4ddeeb9dfe18073f71fa3c9ce21dc1db\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: j35SRjdl0qNCVfmVSS0Vtqmg9pYGMC9HPU0bTC/eBnMkLKcMELMDfhZrmIDmKdWwgweQ6J/tv4vUrBtOfSAHDusn0QMXxL7u9lts0ajYsdgrb/+HKE5KhtmyhMQNQiqlpj/euKeHHB1Xl6qk+/IndaH9SH/e31f+HZ8+GC2aQR3pEc5wC/+eQR/Qx4z6flbZv50FIhs6oe1fJ7AhdE/AMgUE5gzTrq74a62jPQga51rMV5+AmiOa4O0Z8oB4HmBGooIxjGT6qHlEX+unbRuAtnVVg7cMuYZntEX8BERFxRSLPiNMMeJ3JYkol38G9wvdjjIStE3ZDkEgnEThbtxT+g==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774852682\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"prepay_id\":\"wx30143802786349f301984f0d3c76990000\"}"} +{"level":"debug","timestamp":"2026-03-30T14:40:10+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260330141502430700?mchid=1318592501 request header: { Accept:*/*Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"qnroUuyR57xYA8U6slSVKJbFeVWheEjb\",timestamp=\"1774852809\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"yevzGVD9NHTq/y1CuEp+HlkyEDu8EWJ2SqsnApDy/LTIaz2IWZGFvI2H+3g0hdcRc78nt6YY+pr9vnJ+0ggVxtRKy4QO7jSyaiCLhltu4092vJ9Ksfz4Ep1tTEdWXnEsUJ842lVl41ZBdBTaL0ZXxDffdzjQZ2irrib0119xkFlwgJUOm4Ts30xzUob5EtWetKkGmtLIW1f3Qjx+6x7Mtx2YsZYFbc43kKIvyw5ZlUpSEW019gfA1+4tO6QDLaq873LNEFLgtVa+DxVEfgeWKPpDqGg3aQE802FXyQiUj3UcZ2jBqWjfIe4n6cRdqOSfCYAnKZLN8W/UL6EREqsKfw==\"} request body:"} +{"level":"debug","timestamp":"2026-03-30T14:40:10+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 249\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 30 Mar 2026 06:40:09 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C9B5A8CE0610ED0218E0E3F8AF0120EE9B2228D3CA02-0\r\nServer: nginx\r\nWechatpay-Nonce: a622583af2c3c1add71b82c41d774e55\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: lNSQAUOswg4R40brl+PUOXNhCGIfdu//VsJnnd4GAFMu9bBSp55zkyeJ+7WpQsGe8ZZzxh/Q6k3jrMDhnGtZMvfhOoAIiou+P6eLHX8Yi28NalSfchp1JifSiqeCHBON852dIGKF4xLEbqLEOFTFVSxApbk6bqcVXKgMvUOkzvdhByV9lqwhmxlPtB/U5HOemsQ/5pjuanqXo+TWf41Le4sTBH6rJSJ/OcP2Txp8cn4xe6vYMETKYhUj0W9Q7e+B7H0ATQqCNQnWdTsZNb4LqupG3wwSqa9HfbOBbLm5gdi3m6ho9nxzRCtIWYwEHCljtX8QOvVZGJsgVjhbbWuisQ==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774852809\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":100},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260330141502430700\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-30T14:40:10+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260330141553661200?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"ItcHSeFQK9RqF90Z7Gx5L3DjC4b9fAK0\",timestamp=\"1774852810\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"DriZEhQWqrTuE5RtpE9tQUIR13y3IHKW4tGS9CWMP+r66DJP1fXXofuAczB6/Kt9f8Pacv2vFuaYm9Aab+jpJ5KPlxgTjQxADWxM54KfH1w0CXCIM4BXnSYqZIZtcEFolWuJpkkVQDCZ7AQ+u85CYakmp4UHonToadwIGy4gG92Tq4rZ6OS7JUx2UwTsBbqFVP7sj6lww7ziH6bZKPnptIOssW6Vmt8TeYliaNu7LJhQ1xUXg9aDairscY8J5LIZqxSuug4ytpZYFPewEPtJaqnNE3elgcRNGirpxDdUR2CGKP2ClmWUUTdpPSWG6fWXutXR5aH66F2802HweQNseQ==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-30T14:40:10+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 249\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 30 Mar 2026 06:40:09 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C9B5A8CE0610CF0418DFAAC05520E29E0128D48501-0\r\nServer: nginx\r\nWechatpay-Nonce: a6554d46ad8e48785c37f84d692db96f\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: h1l6/2K2ymMEqorC/888SfckYs0phwV93F0f6+84NsQ1nOAmAxYv8R6xb/ObUWPrsIKYn4tpuKRVuIf623NSVza7mdihUH/9qLNY+pL3Ty16Gq2guZuQ5SUYl8mqvILVFhQZh263bQio5s6xlae8FAhqwtwaF/tum1nSdJKDat/nCkDy41DlMltwN58d5kQIvQ2NiP9teyRPLVRQ3K3GdcG3D3uX9c/UCPOLhEtFAzEfRRjGpi4Yp107Jx9fMMIeorsScMWjW2kbQqFJDmuClxA5VYxN6gFmr+IQpLSTXkjfXPqUKqEMhTphtzUqDcUzqV+KlkQnBaA6fkWc0nNELw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774852809\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":100},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260330141553661200\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-30T14:40:10+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260330143802578900?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"FLwOf5ZPtAmtHPJTXqjt3La5TSDtZo4q\",timestamp=\"1774852810\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"qrpuQn61/3MbKl5ycGPkTaMGfyZCOIBfWw6ZvgPLSmF43gyvy7KNNP+120dy2eEYs6PiOEYPq53HTmuKZ/99mkCT+aEYI6WvvJuhsMScwwr8tpcXM/ucE5giOfoXr0CTWSXs4Q7cm9WIRBr8rFP5lBT0DOCuDvNKBUg9cuqwZ+YnU8zj+oy8Nz0zuBrlGWe339XnuiUZyRleYxClN7aWhfF1ZxTYQ28UvUECYucrjJGCzAF2bMTtQifWxS/fjyT36S9fx4NTwx3VC5lDVf1PxkC5vyQqgaYd/d8vEkJao2M4j7Hf8fRw5vJYdUWkAc2Vj8Xzq5bE18bRUtyDKtJn4w==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-30T14:40:10+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 249\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 30 Mar 2026 06:40:09 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08C9B5A8CE0610A40618D9DB8C582094941928E0D605-0\r\nServer: nginx\r\nWechatpay-Nonce: f326adcbd1a8cb53b89f0895fc8b2b0b\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: HdH+s62/9ZFDHWOZbJuWc6ExE4nEkah/fooayJdDDMdGwSu4M2ZeXz4AWKjSxJq4lA2Qb6NpP6YLncbYGs8mX6oJGIRn/kJWr9EVOtm37/l7G3NRrEyurXheBVtrR4vzS1BLjlmqJG6+68zXyJ4th34qpIEcKKDcsQoTIg265gboj365c9EMD3abiJaJFKw2fHmgYacg0D0quXnRPqhK1nz+zvi4S8sWwmF7+/uIfp73yjuzPD7N3HxM+Jzs1ejpnVaL8qW6/o8GkMKqtrr9GIwuIlc4UxoKA42CHq7ZO39OUqeu12RNSiN9VwsGf2BQWu19Yv6jjePuC8TJdKHYlw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774852809\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":100},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260330143802578900\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-30T14:45:10+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260330141502430700?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"Eu0of1HsPoNm94LUF9nywuhrCl7M8lcs\",timestamp=\"1774853109\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"k7MMSdliVfi+qz1bsaOEm5nLUOGBOCKR/eF80M1Yk2KjngD5LMM6tm7mm5ounAZHxJeI+bu3fAk4jX1XTBtlKCB9/Mb3VqIwt6hzwLZv6K/FQnbykWg/51noLJ4Ao636VK40pGsWCp3R0w6w9t9FfpHHOmN9q+aFOgKTsY8rRZ2xNQIJR2LqZWeGLOswl4zotLN+KkkXJI6aIg7fwNCHdG+M8HbQSmCVVk8ION1KpwSaYojzCd6SH5L6At4WSF50McbFOhtFlGZkHmYChcbKUoi44z/psYJjEW/b8YeNzTdToyKrbjwd2wkqbJ/8+Wv85VRpsSbnz/SiR1I9YfVuTA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-30T14:45:10+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 249\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 30 Mar 2026 06:45:09 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08F5B7A8CE0610A60318FAC18C5820CAC40428BF9701-0\r\nServer: nginx\r\nWechatpay-Nonce: 5268f1c8886c9e3c33efc858151bbca4\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: hx8/iYYMuR9iUzaZAIgIVK6MBa/nDHatWJEwBcJuKR+xZnsJkMkmRLrL+IbMMrbXvCG7sopgti9IvL2jZoB1GumjyzOhCR9j4fucVdZEwpYo4PpjNbKrBL2F4Zg5aLEQPnGKmmfgjFPBKlNSP0RyEJ0gMq0/OiXnMcDFov5UbjDhTL0SiDyKb4Pz8h73O4H1L+nWlBptTUK97Cty8cAjJW7eCwTzsdzAWCjVQqoWlNDReHasUkGwbuvjcgmbfZ5NRK5PREhLVw89QAF/ois5HIgBaUN7juqvlhcjerbPvXJbgXoFRPyy3u7LXwxfdeIqyd31S31L5cL+t68woyDojA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774853109\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":100},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260330141502430700\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-30T14:45:10+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260330141553661200?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"rTidZ3orIHbMtEjqvxhIsZwn3LDXNSpK\",timestamp=\"1774853110\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"2koo9mucyBl46qqAIrChFLskS4GPrEcsJTJGMHVVXPOHUv25tIZTrmofEPPhxgvVISkfy8PXX5KvyaF0UJebcmqmKBjK8/mSwpUXxK+nJl3URNA1iPgLVBP3U552WFVigML4etuXVKt8ej3imdIr9+buS7oVtQ4ENnrbdOuJpi5+b7VMfez99rspCNPZQPkW12yzUnIisdtWNmxhIZ4Wbinx575ZuW0NX29CQNNhB/XNKQwZWuUESCqW6RAnx2q4kHWPWuuOb0f5lPnPOnAnXJbINZ8bT4pk8JScHqr3rA7bCZY+38Ukt8vfSC/Wp0NABHXf2TpWxScVI1Ds4T5hwg==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-30T14:45:10+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 249\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 30 Mar 2026 06:45:09 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08F5B7A8CE0610810618B1E5F8AF0120DEBB2E28E59A02-0\r\nServer: nginx\r\nWechatpay-Nonce: 145abfd72e1c78fd884f0827047cec12\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: HcsyOYCSSV63ThTCeyVnmy6dculFOVs6ulE/5Y53kH6r+Bcj1GoUGXTAeSaGOpn0aTu1IKa+A+KLvtIAv529scf0FC+qOUbh0bhohMeoW8mOvKOd8FIWmO6dvbzOq5j/B+gqoRU8VusOcBHdSL0FWh+8mYZxgWi8Fj3VcVIs++G0kiPXgfG7NFr3jzpwNaw236a9LCPkhs301Nmnck0RGzj/NIA+egWEP0T0T/LnbWM5MuulBd9+tG8k1EJQ4YHebyPkvmHDvt1yJXy9xltwFza0F9/dY67W/bxTnHbPtqW+WqPNBK4kzsGT/pkZYgyi23a0YRTu3XDcDhVJmR157Q==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774853109\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":100},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260330141553661200\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-30T14:45:10+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260330143802578900?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"IUse6sE3SqWaoE8BwKYqcP7zLXIUL3wG\",timestamp=\"1774853110\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"D9LES+J2KgWLZhh1Lf4stkHffJJ5VP5HADOA5dBsABnFJsHDZD4gUqbGluKbYQmDuF66R9tsPnxf14uy62enHFCeL+CXbGmO0Sc47Alak9cRys6Ah/r3BOMtxiTVE7wYijl+AAGiyeNr+w9scrPrvYokzT/cQKIOAxfuCK08Tr6+ZHpMd+QIZgVY8TNin1J7FwfaC9RpIlfvlZdO4NIFRPbJmKi5gh4ZhFNOW+aYc0+F2Q9Et5+2Jotp1yjOYdYA4STP5U2MhSMBpRwIvP87ifF8ZaNazPQvl936WODSce5hnyipIFJRgQNVxLGdveRJpOo1RRGXUT+y8snVWEU0jA==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-30T14:45:10+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 249\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 30 Mar 2026 06:45:10 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08F6B7A8CE06100418E9C6C05520E6E11828CEBF01-0\r\nServer: nginx\r\nWechatpay-Nonce: 3acb7f665baaef1acaaef693e6897631\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: xwyDQFxHxKmVy8ta7ZAmXHXK+MG9bXx7w+oaj4yqFXEsvYHVeq3DmS8TyU7IXm59e8M8fLnGXq/I1zgkdkZAaVhBERHdCYYyDkmr6Ird0k3Cyw/X5LHHUGpoJfJ1PT9/58l3wzU/MN/mX1kkAa2Z/eOzv/+IrrSytGaafl6BdXtIWS4KwXO7bmNvrIGHmOWjm+PfSZgKPAm8sAP882m/V7jEWoXgHF+ZUaReJyPtiR3iysHgITB8iYBI7hAOGsqte3ZLiHgL4sbZoiIaHh2z9L04IkOmidgz8fbuJ8xMgfxnO32v28xhiWdpHwH8l1Kxgx+tSNMOfkkOlQ7Y7aLDOA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774853110\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":100},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260330143802578900\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-30T14:50:10+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260330141553661200?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"CAGmt8wF9qTsmhq2wtFUZ1Qch5OZXB7i\",timestamp=\"1774853409\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"lAbvMuUzgyzaMhI8nMPr7StDWO0oaWkrsyCrBtWq2/Fy3OPtSM7meKe7p4R1a3wpVXX0w+rUEsUK/6IXtiPEVsQcS54PEbjVhnukoE4NRqY2AhR730Kpy1tRRztbbmJ7SI3UcBrE1pWnQ4vvK/EpdquoGXMaylIsF4ysFKoYvtwUIGzShHUjCVrnDMOO3GQQqozt2+HBhdN+Xh0V34w/GcVhVZOfYefLFdcjWzPOHyFpWtAjiXvkk/pIjLC5H+Uqv1ki0j6vYvbzKi++p9/fKFgN4OUj1HKviPI7DCAfiZZiprxWpCkNKqBjidQgiAR9E4gUjU2r4GjIAeyg4ksHWA==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-30T14:50:10+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 249\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 30 Mar 2026 06:50:09 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08A1BAA8CE0610B303189796F5AF0120A08F0D28DDC702-0\r\nServer: nginx\r\nWechatpay-Nonce: 5f3341e84b6efe7889f760a8d08671d9\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: psj9TMnQhKPgWt2KZ5cWgXQNeEwH94D/8nzNAZDthmXaPsRZRIuVfBpM/+FUp3i7mJRlSLnP+zDG+zneW2kguE4ybx6tG9SIWXx6a0fmRS377JlVgXabyfsW+4BusqNJZ9UGnSuRxKhvOAbubENyg/CdnuiShJpxZa1aqQV2y8/PMbABAFu8luB3P5+x/tpagLisOo+wMPFM7SEnwcB13tHDBBd2GWobCPMu7IerIeZrtOXKyHaJllW/NVNbzghPqEcVHp+BkPa1dem7/G5TPLe58ll46p42Ub//ZUJqz0l5G7NMfNz7205rXMQ0TcAdT8Nt5X85BHtvbxgDI7IZeA==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774853409\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":100},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260330141553661200\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-30T14:50:10+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260330143802578900?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"CGJjD9KamZZMMeJfELQArIDGyfDNer6r\",timestamp=\"1774853410\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"xyR6nqqPdk4xcFGgcHlJwxVGKcUdZzNUtbpFEoIsnlo/7dOc8F9VmJllzy8SUrPJ5NlZb/d/WlIcK/Zk87d43F6QKMpfbkVILfLzz7jcpP7CaTR7M3og+XHolZt5duloR/w0hV4JMjyfzsLVJD9SRbDeHHijsn9rOSLobvw3JDTIY33gXrvaXYXZdJnt7tnMDWE08siy/nt49+jRVkIrCDYX2Y65bLLPLSI6uur+CYKAsUOuKyLggxxt6Yyrx7VTXpzvSEP9OETiIZ6nwqrHVACRhtWQUmcGtd4r8j0LFjWtx8KBUNXRRCz/8dinz+STvwUOsf71iLrK2xTiPSaIUw==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-30T14:50:10+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 249\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 30 Mar 2026 06:50:09 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08A1BAA8CE0610890618E8D58C5820B2D51E28E6F905-0\r\nServer: nginx\r\nWechatpay-Nonce: f9f51d96596976a82cd63568f1c7d667\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: gOUDJh4kfVtfQyedAp4p4V7CoWb36xxkV4snQIl6o97C4nlWoR/BL0POzYYkukuCH1qqJG8crTcjcyG8Q8dBx0iVvXpx4m394YwuJM1yZLXGRgGJV+LgJRtB2bUZSFJN9BvioB3vp+RoUuIfHUwBXQvASGEGzE5MAwn9P+Swnhi0fyo4PsCf8F29naP/O0O2ngsLfA33IDFGhcutbD25abUbXxG6JpWBJY4vr0hCNMlEc4Yrr96Hj4n+FhylNiRNXQdwyzGw07z1+Q02bFb4V6ljmOONWTBLAhhEwB7YvRWlA54mPDhIxcIzHrVjBEUDOHOuIBWY2jcyHqCR0JybOw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774853409\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":100},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260330143802578900\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-30T14:55:14+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260330143802578900?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"xqmIXq7Rll2vU1KB9mPNavFpSGaNugN5\",timestamp=\"1774853709\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"Q9zSjrd+jUT/9twAQd83/dfI8ykpWD4xcYA05k70IRNBcaxJkrFE3lWVyZj1ydruojrJ/jHd5P1yoNbHxpS5JoQ0oEs+3Ols5cNROP7yLu+KwyrX6DMPk8NUlKqCDFhteIJAfDixtUV3hkD1EpOjElFlN9zLUTiDgczITvtReOlPaQf8zHfy9z79sK+tpioQWzO1wCDD3eYjJkL4tIc+DJXMYeI0F2VEFJGrXbCLFXn1DeuhjuruW258wpYypucPvLCVNQgPGDXthZuRIZkuBniEPaIqpDuIaROKfArJ3aASQOOq56KR0a1sAEY3cH8qXVyWMrHm064QhJ0JCUBWZg==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-30T14:55:14+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 249\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 30 Mar 2026 06:55:13 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08D0BCA8CE0610E606189982F8AF0120C4910E289EF805-0\r\nServer: nginx\r\nWechatpay-Nonce: c258cf54256cd17508fd087352d0d49e\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: BT6OpYo5sDBJg22UsuF/BktrJy1xKfZY82/4rp7sOFipBl1LK6tV8tlu7mLv9omqkdVL18wufHRNFHMz2qGKtaDL1+wQqMaTyDK54F+rDC8Dwg3RSKwS6EloAF8/dsiydqBK8N7IJLVaAn8gI5bukoK0VxkXeRANnLI6Mh693zKyLNRSQ81wilDaQ8dUkvWhSIpDQQaQ5JMHLKVbKt96Djukny5dL0lF6CjxaQqT/Blqw7z1dELcu6RjFt8rK0pUmGb4Z0T4BLFVaDpgD1wabT7ascvm/Q31yj5BC4pzmHty/AIuSFcaccyL3/vS50f3+5bTrehOVcIRnB8ceFywKw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774853712\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":100},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260330143802578900\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-30T15:00:11+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260330143802578900?mchid=1318592501 request header: { Content-Type:application/jsonAuthorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"AQfdz24ssfkfKdBjuIKhrJCRToQ6W9Cl\",timestamp=\"1774854009\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"5y4R58x9sjtGkG+h2jbh1cYH/T6OT0k4RadV+UNs/7LdQ6m9SuNoN9f2AYmZfEFAEPzEnrwzlpALKWhNpU341+YkfbwRBns4p28huqOZWemw6+kEHVl2P/YoZUi10TnsJVgEfU7dDB5wdwSbEpb6qPqkncGaHblEmLhI3XxprLA1XX491uRZxbVXrMNllEIa7upkBFWSjuBttZyg/oaUOZrVFLYz4k+Hm56xkh9JP/gh9V3R0ejl6BLSq8A38SnHkGG7oRDBPzd0v3w7ywrxwc5XnthG5NGlWV4zvI6AHcT61dUimBCY0nHY5qoRsXFsqXR+mfss5KX+e0Ci7CymNg==\"Accept:*/*} request body:"} +{"level":"debug","timestamp":"2026-03-30T15:00:11+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 249\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 30 Mar 2026 07:00:11 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08FBBEA8CE06100718BD82F8AF0120BCC21628ACFA03-0\r\nServer: nginx\r\nWechatpay-Nonce: 04eb0e96e3dced8c4dd98d2067d6da7f\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: UQ2bpd8rGxxN6xTOac0zsb+UCluQ49ZHHQRWlG6UxKGb/cuUVPBqHBZmNaIdO5boPFLMK9mMLEOdUyJZIUuLZpqFoVsgI16jk5p52Cq0T09JlxUTZ7r1YVAV52yeaBgKxzCmQsEKw6eFSgtJoHTmsG73HQPxcohJxBNwQxf95isX0Q4temD7MjZZ+yBS687Q/7dXaKtZSk07c8jY5WNk8raTAjKIszCqO4MAJIlFczULZS6T3pY5wW+cSDdGNuB7TlHJbqkocuRX2DvrC7UA3Jyvj9PlEdgo7ruj1iFrQ+2Ru5l8IluQiQx/j0/udCWvPedyXvCiqM+n2uB+ROfT7g==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774854011\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":100},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260330143802578900\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-30T15:05:10+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260330143802578900?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"5tos3V5ApzXkQKeQlrwYCTxAQ0s9C6YS\",timestamp=\"1774854309\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"4j/24XDxRT5mFZd98c/obIMTLWEzXV5i/lDYD4crN8dQXll9zFRWKvkxPuJRTo04wr0xTgqcw+tVfyyhufFMiJhlSft5hyh3LEEHozjzu1kSGGePipiPAXEzqKCv0XSc8veHD4zoRq/2wk7289TKj44Qsf1USDYO762SfcgRw6R2rYDTu816uV7+u5z/KN6ujN8vqn7zb3HomHhNjgdacvRUhGzoY5Y4DfoUReXD/WVcETxTIGHTYZ59lDdtS3PMjas6/1lCkzdPbLheYhSEDU1GNzhRKfYV4fAMEbAv+laFJOswN5MTCwQ5Tq8pPxCKKOrs4XePIxGYj7xntXb5AQ==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-30T15:05:10+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 249\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 30 Mar 2026 07:05:10 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08A6C1A8CE0610571886CFC6AF012094A90928ADFB04-0\r\nServer: nginx\r\nWechatpay-Nonce: 061afaf9987c1ec787df70b7640c4b12\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: ioExuadHX2iVBwr0LO2oi2XjkrHuR2RBgCOOvF4gVxHqkdBCm4XSscy+jGJ2H5dlU+GGGNejbNczldb+PWIdwdr6MC3Is8V9cjgCHxUndrNz75zVnFS968KBuJ1zkzrcTWf7ophKZQ6r27Qm7uVpgIUKCdA2cg8SLBroxoLwUiG5lBkMf06j1cVhqp7sdPFoj38W2uNUONwCsYFou8Q/vwwKLa1xGteYK91fUtffLXu4kNKNYjP8nnkapFaJLBq1Zc0DNX+vRQ2LuIgKArkUy0R7Cyb3XttGqQNbTS3hcTlBrXas+ofDfUnPR5zV0a0nFbV2sV1xwuYWBgr6a4Zqlw==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774854310\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":100},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260330143802578900\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"} +{"level":"debug","timestamp":"2026-03-30T15:10:14+08:00","caller":"kernel/baseClient.go:457","content":"GET https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no/MP20260330143802578900?mchid=1318592501 request header: { Authorization:WECHATPAY2-SHA256-RSA2048 mchid=\"1318592501\",nonce_str=\"0I968RakemptQWgjIqDCc0PEG9ZzSqoE\",timestamp=\"1774854609\",serial_no=\"4A1DB62CD5C9BE0B6FC51C30621D6F99686E75C5\",signature=\"ZwA0YzrqeXCsv0KN9x9swSLcU0V35PsGYjgRt4T9BlwCrwds76Sy1spdPRX1scnfv5UHehhO5M+/kS7tcc+vlq6+ZZ8FKD/Nlg61EgSka8Ry+CsU1EZQQrwzxu0YSMKGIW/REt5ClEBw/rqnBq81Dkoe4SEdH3v7ugv4r3gtdcv8LrIb62Ok4+Huop9A0l4gKUMlNpddytaKpxjq2Etn7AxU3YY3wJVN9OEIKQ1PpcaBSdDqFfI6x/kuxol3a2oyEsKBJT+1xs0a9ZeNTPkMeuZ4EPxQpFq06ZdH23k+jRfIGGF63G1iuzSagZimpJMI47kM521gj7CzkcP5EeW5NA==\"Accept:*/*Content-Type:application/json} request body:"} +{"level":"debug","timestamp":"2026-03-30T15:10:14+08:00","caller":"kernel/baseClient.go:459","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 249\r\nCache-Control: no-cache, must-revalidate\r\nConnection: keep-alive\r\nContent-Language: zh-CN\r\nContent-Type: application/json; charset=utf-8\r\nDate: Mon, 30 Mar 2026 07:10:13 GMT\r\nKeep-Alive: timeout=8\r\nRequest-Id: 08D5C3A8CE0610BE0318E0CFC05520F8BD1A28D5DF03-0\r\nServer: nginx\r\nWechatpay-Nonce: 70860c9185cfd03e71778c0f64c053c5\r\nWechatpay-Serial: 5F2543BF58239A4EB68FA4433DF1438A88B34B16\r\nWechatpay-Signature: PHrVCE95WRVDHpu03AQeo5z5yBRAMiOlyGpt9rDW8Fv7sXWVg0LhtErGeSlmXqgDu6olOywa7QiTY36LhXE7L5hANP84EaDB0sps2Twtc1Ty8z6UpZjcx6m4ym0yT+fl2oEQFbu0zZvr+6AAa9wyuiKnIoJ9DjHeUXOZqzJgEnMYrMipkeHOqR7OrkD5pVnOWV86OaTEuYau9Lct0VATXjeSAMFR8f5yOL54/iAzpjahayElWa/p9xZmU+L2mB3ElSjCvIjoR1L00OMWXf+9e61IbCMr6JEvDgBN/2reZJWWLLFT3i2Wr8ntoZkG0OEvFTguCRb84cZadIsu7FzF/A==\r\nWechatpay-Signature-Type: WECHATPAY2-SHA256-RSA2048\r\nWechatpay-Timestamp: 1774854613\r\nX-Content-Type-Options: nosniff\r\n\r\n{\"amount\":{\"payer_currency\":\"CNY\",\"total\":100},\"appid\":\"wxb8bbb2b10dec74aa\",\"mchid\":\"1318592501\",\"out_trade_no\":\"MP20260330143802578900\",\"promotion_detail\":[],\"scene_info\":{\"device_id\":\"\"},\"trade_state\":\"NOTPAY\",\"trade_state_desc\":\"订单未支付\"}"}